1(function() { 2 //#region \0rolldown/runtime.js 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); 10 var __copyProps = (to, from, except, desc) => { 11 if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { 12 key = keys[i]; 13 if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { 14 get: ((k) => from[k]).bind(null, key), 15 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable 16 }); 17 } 18 return to; 19 }; 20 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { 21 value: mod, 22 enumerable: true 23 }) : target, mod)); 24 //#endregion 25 //#region src/zod-config.ts 26 var g = globalThis; 27 (g.__zod_globalConfig ??= {}).jitless = true; 28 //#endregion 29 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/disclose-version.js 30 if (typeof window !== "undefined") ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5"); 31 //#endregion 32 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/constants.js 33 var HYDRATION_ERROR = {}; 34 var UNINITIALIZED = Symbol("uninitialized"); 35 var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml"; 36 var NAMESPACE_SVG = "http://www.w3.org/2000/svg"; 37 var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML"; 38 var ATTACHMENT_KEY = "@attach"; 39 //#endregion 40 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/shared/utils.js 41 var is_array = Array.isArray; 42 var index_of = Array.prototype.indexOf; 43 var includes = Array.prototype.includes; 44 var array_from = Array.from; 45 var object_keys = Object.keys; 46 var define_property = Object.defineProperty; 47 var get_descriptor = Object.getOwnPropertyDescriptor; 48 var get_descriptors = Object.getOwnPropertyDescriptors; 49 var object_prototype = Object.prototype; 50 var array_prototype = Array.prototype; 51 var get_prototype_of = Object.getPrototypeOf; 52 var is_extensible = Object.isExtensible; 53 /** 54 * @param {any} thing 55 * @returns {thing is Function} 56 */ 57 function is_function(thing) { 58 return typeof thing === "function"; 59 } 60 var noop$1 = () => {}; 61 /** @param {Function} fn */ 62 function run(fn) { 63 return fn(); 64 } 65 /** @param {Array<() => void>} arr */ 66 function run_all(arr) { 67 for (var i = 0; i < arr.length; i++) arr[i](); 68 } 69 /** 70 * TODO replace with Promise.withResolvers once supported widely enough 71 * @template [T=void] 72 */ 73 function deferred() { 74 /** @type {(value: T) => void} */ 75 var resolve; 76 /** @type {(reason: any) => void} */ 77 var reject; 78 return { 79 promise: new Promise((res, rej) => { 80 resolve = res; 81 reject = rej; 82 }), 83 resolve, 84 reject 85 }; 86 } 87 //#endregion 88 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/constants.js 89 /** 90 * An effect that does not destroy its child effects when it reruns. 91 * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing. 92 */ 93 var MANAGED_EFFECT = 1 << 24; 94 var CLEAN = 1024; 95 var DIRTY = 2048; 96 var MAYBE_DIRTY = 4096; 97 var INERT = 8192; 98 var DESTROYED = 16384; 99 /** Set once a reaction has run for the first time */ 100 var REACTION_RAN = 32768; 101 /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */ 102 var DESTROYING = 1 << 25; 103 /** 104 * 'Transparent' effects do not create a transition boundary. 105 * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned 106 */ 107 var EFFECT_TRANSPARENT = 65536; 108 var HEAD_EFFECT = 1 << 18; 109 var EFFECT_PRESERVED = 1 << 19; 110 var USER_EFFECT = 1 << 20; 111 var EFFECT_OFFSCREEN = 1 << 25; 112 /** 113 * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase. 114 * Will be lifted during execution of the derived and during checking its dirty state (both are necessary 115 * because a derived might be checked but not executed). This is a pure performance optimization flag and 116 * should not be used for any other purpose! 117 */ 118 var WAS_MARKED = 65536; 119 var REACTION_IS_UPDATING = 1 << 21; 120 var ASYNC = 1 << 22; 121 var ERROR_VALUE = 1 << 23; 122 var STATE_SYMBOL = Symbol("$state"); 123 var LEGACY_PROPS = Symbol("legacy props"); 124 var LOADING_ATTR_SYMBOL = Symbol(""); 125 var ATTRIBUTES_CACHE = Symbol("attributes"); 126 var CLASS_CACHE = Symbol("class"); 127 var STYLE_CACHE = Symbol("style"); 128 var TEXT_CACHE = Symbol("text"); 129 var FORM_RESET_HANDLER = Symbol("form reset"); 130 /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
131 var STALE_REACTION = new class StaleReactionError extends Error { 132 name = "StaleReactionError"; 133 message = "The reaction that called `getAbortSignal()` was re-run or destroyed"; 134 }(); 135 var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml"); 136 /** 137 * `%name%(...)` can only be used during component initialisation 138 * @param {string} name 139 * @returns {never} 140 */ 141 function lifecycle_outside_component(name) { 142 throw new Error(`https://svelte.dev/e/lifecycle_outside_component`); 143 } 144 //#endregion 145 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/errors.js 146 /** 147 * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree 148 * @returns {never} 149 */ 150 function async_derived_orphan() { 151 throw new Error(`https://svelte.dev/e/async_derived_orphan`); 152 } 153 /** 154 * Keyed each block has duplicate key `%value%` at indexes %a% and %b% 155 * @param {string} a 156 * @param {string} b 157 * @param {string | undefined | null} [value] 158 * @returns {never} 159 */ 160 function each_key_duplicate(a, b, value) { 161 throw new Error(`https://svelte.dev/e/each_key_duplicate`); 162 } 163 /** 164 * `%rune%` cannot be used inside an effect cleanup function 165 * @param {string} rune 166 * @returns {never} 167 */ 168 function effect_in_teardown(rune) { 169 throw new Error(`https://svelte.dev/e/effect_in_teardown`); 170 } 171 /** 172 * Effect cannot be created inside a `$derived` value that was not itself created inside an effect 173 * @returns {never} 174 */ 175 function effect_in_unowned_derived() { 176 throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`); 177 } 178 /** 179 * `%rune%` can only be used inside an effect (e.g. during component initialisation) 180 * @param {string} rune 181 * @returns {never} 182 */ 183 function effect_orphan(rune) { 184 throw new Error(`https://svelte.dev/e/effect_orphan`); 185 } 186 /** 187 * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state 188 * @returns {never} 189 */ 190 function effect_update_depth_exceeded() { 191 throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`); 192 } 193 /** 194 * Failed to hydrate the application 195 * @returns {never} 196 */ 197 function hydration_failed() { 198 throw new Error(`https://svelte.dev/e/hydration_failed`); 199 } 200 /** 201 * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value 202 * @param {string} key 203 * @returns {never} 204 */ 205 function props_invalid_value(key) { 206 throw new Error(`https://svelte.dev/e/props_invalid_value`); 207 } 208 /** 209 * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression 210 * @returns {never} 211 */ 212 function set_context_after_init() { 213 throw new Error(`https://svelte.dev/e/set_context_after_init`); 214 } 215 /** 216 * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`. 217 * @returns {never} 218 */ 219 function state_descriptors_fixed() { 220 throw new Error(`https://svelte.dev/e/state_descriptors_fixed`); 221 } 222 /** 223 * Cannot set prototype of `$state` object 224 * @returns {never} 225 */ 226 function state_prototype_fixed() { 227 throw new Error(`https://svelte.dev/e/state_prototype_fixed`); 228 } 229 /** 230 * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state` 231 * @returns {never} 232 */ 233 function state_unsafe_mutation() { 234 throw new Error(`https://svelte.dev/e/state_unsafe_mutation`); 235 } 236 /** 237 * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled 238 * @returns {never} 239 */ 240 function svelte_boundary_reset_onerror() { 241 throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`); 242 } 243 /** 244 * Reading a derived belonging to a now-destroyed effect may result in stale values 245 */ 246 function derived_inert() { 247 console.warn(`https://svelte.dev/e/derived_inert`); 248 } 249 /** 250 * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location% 251 * @param {string | undefined | null} [location] 252 */ 253 function hydration_mismatch(location) { 254 console.warn(`https://svelte.dev/e/hydration_mismatch`); 255 } 256 /** 257 * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is. 258 */ 259 function select_multiple_invalid_value() { 260 console.warn(`https://svelte.dev/e/select_multiple_invalid_value`); 261 } 262 /** 263 * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called 264 */ 265 function svelte_boundary_reset_noop() { 266 console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`); 267 } 268 //#endregion 269 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/hydration.js 270 /** @import { TemplateNode } from '#client' */ 271 /** 272 * Use this variable to guard everything related to hydration code so it can be treeshaken out 273 * if the user doesn't use the `hydrate` method and these code paths are therefore not needed. 274 */ 275 var hydrating = false;
276 /** @param {boolean} value */ 277 function set_hydrating(value) { 278 hydrating = value; 279 } 280 /** 281 * The node that is currently being hydrated. This starts out as the first node inside the opening 282 * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`. 283 * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the 284 * time we leave the block it is the closing comment, which serves as the block's anchor. 285 * @type {TemplateNode} 286 */ 287 var hydrate_node; 288 /** @param {TemplateNode | null} node */ 289 function set_hydrate_node(node) { 290 if (node === null) { 291 hydration_mismatch(); 292 throw HYDRATION_ERROR; 293 } 294 return hydrate_node = node; 295 } 296 function hydrate_next() { 297 return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node)); 298 } 299 /** @param {TemplateNode} node */ 300 function reset(node) { 301 if (!hydrating) return; 302 if (/* @__PURE__ */ get_next_sibling(hydrate_node) !== null) { 303 hydration_mismatch(); 304 throw HYDRATION_ERROR; 305 } 306 hydrate_node = node; 307 } 308 function next(count = 1) { 309 if (hydrating) { 310 var i = count; 311 var node = hydrate_node; 312 while (i--) node = /* @__PURE__ */ get_next_sibling(node); 313 hydrate_node = node; 314 } 315 } 316 /** 317 * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment 318 * @param {boolean} remove 319 */ 320 function skip_nodes(remove = true) { 321 var depth = 0; 322 var node = hydrate_node; 323 while (true) { 324 if (node.nodeType === 8) { 325 var data = node.data; 326 if (data === "]") { 327 if (depth === 0) return node; 328 depth -= 1; 329 } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1; 330 } 331 var next = /* @__PURE__ */ get_next_sibling(node); 332 if (remove) node.remove(); 333 node = next; 334 } 335 } 336 /** 337 * 338 * @param {TemplateNode} node 339 */ 340 function read_hydration_instruction(node) { 341 if (!node || node.nodeType !== 8) { 342 hydration_mismatch(); 343 throw HYDRATION_ERROR; 344 } 345 return node.data; 346 } 347 //#endregion 348 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/equality.js 349 /** @import { Equals } from '#client' */ 350 /** @type {Equals} */ 351 function equals(value) { 352 return value === this.v; 353 } 354 /** 355 * @param {unknown} a 356 * @param {unknown} b 357 * @returns {boolean} 358 */ 359 function safe_not_equal(a, b) { 360 return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function"; 361 } 362 /** @type {Equals} */ 363 function safe_equals(value) { 364 return !safe_not_equal(value, this.v); 365 } 366 //#endregion 367 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/flags/index.js 368 /** True if experimental.async=true */ 369 var async_mode_flag = false; 370 /** True if we're not certain that we only have Svelte 5 code in the compilation */ 371 var legacy_mode_flag = false; 372 function enable_legacy_mode_flag() { 373 legacy_mode_flag = true; 374 } 375 //#endregion 376 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/shared/clone.js 377 /** @import { Snapshot } from './types' */ 378 /** 379 * In dev, we keep track of which properties could not be cloned. In prod 380 * we don't bother, but we keep a dummy array around so that the 381 * signature stays the same 382 * @type {string[]} 383 */ 384 var empty = []; 385 /** 386 * @template T 387 * @param {T} value 388 * @param {boolean} [skip_warning] 389 * @param {boolean} [no_tojson] 390 * @returns {Snapshot<T>} 391 */ 392 function snapshot(value, skip_warning = false, no_tojson = false) { 393 return clone$2(value, /* @__PURE__ */ new Map(), "", empty, null, no_tojson); 394 } 395 /** 396 * @template T 397 * @param {T} value 398 * @param {Map<T, Snapshot<T>>} cloned 399 * @param {string} path 400 * @param {string[]} paths 401 * @param {null | T} [original] The original value, if `value` was produced from a `toJSON` call 402 * @param {boolean} [no_tojson] 403 * @returns {Snapshot<T>} 404 */ 405 function clone$2(value, cloned, path, paths, original = null, no_tojson = false) { 406 if (typeof value === "object" && value !== null) { 407 var unwrapped = cloned.get(value); 408 if (unwrapped !== void 0) return unwrapped; 409 if (value instanceof Map) return new Map(value); 410 if (value instanceof Set) return new Set(value); 411 if (is_array(value)) { 412 var copy = Array(value.length); 413 cloned.set(value, copy); 414 if (original !== null) cloned.set(original, copy); 415 for (var i = 0; i < value.length; i += 1) { 416 var element = value[i]; 417 if (i in value) copy[i] = clone$2(element, cloned, path, paths, null, no_tojson); 418 } 419 return copy; 420 } 421 if (get_prototype_of(value) === object_prototype) { 422 /** @type {Snapshot<any>} */ 423 copy = {}; 424 cloned.set(value, copy); 425 if (original !== null) cloned.set(original, copy); 426 for (var key of Object.keys(value)) copy[key] = clone$2(value[key], cloned, path, paths, null, no_tojson); 427 return copy; 428 } 429 if (value instanceof Date) return structuredClone(value); 430 if (typeof value.toJSON === "function" && !no_tojson) return clone$2( 431 /** @type {T & { toJSON(): any } } */ 432 value.toJSON(), 433 cloned, 434 path, 435 paths, 436 value 437 ); 438 } 439 if (value instanceof EventTarget) return value; 440 try { 441 return structuredClone(value); 442 } catch (e) { 443 return value; 444 } 445 } 446 //#endregion 447 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/context.js
448 /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */ 449 /** @type {ComponentContext | null} */ 450 var component_context = null; 451 /** @param {ComponentContext | null} context */ 452 function set_component_context(context) { 453 component_context = context; 454 } 455 /** 456 * Retrieves the context that belongs to the closest parent component with the specified `key`. 457 * Must be called during component initialisation. 458 * 459 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative. 460 * 461 * @template T 462 * @param {any} key 463 * @returns {T} 464 */ 465 function getContext(key) { 466 return get_or_init_context_map("getContext").get(key); 467 } 468 /** 469 * Associates an arbitrary `context` object with the current component and the specified `key` 470 * and returns that object. The context is then available to children of the component 471 * (including slotted content) with `getContext`. 472 * 473 * Like lifecycle functions, this must be called during component initialisation. 474 * 475 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative. 476 * 477 * @template T 478 * @param {any} key 479 * @param {T} context 480 * @returns {T} 481 */ 482 function setContext(key, context) { 483 const context_map = get_or_init_context_map("setContext"); 484 if (async_mode_flag) { 485 var flags = active_effect.f; 486 if (!(!active_reaction && (flags & 32) !== 0 && !component_context.i)) set_context_after_init(); 487 } 488 context_map.set(key, context); 489 return context; 490 } 491 /** 492 * Checks whether a given `key` has been set in the context of a parent component. 493 * Must be called during component initialisation. 494 * 495 * @param {any} key 496 * @returns {boolean} 497 */ 498 function hasContext(key) { 499 return get_or_init_context_map("hasContext").has(key); 500 } 501 /** 502 * @param {Record<string, unknown>} props 503 * @param {any} runes 504 * @param {Function} [fn] 505 * @returns {void} 506 */ 507 function push(props, runes = false, fn) { 508 component_context = { 509 p: component_context, 510 i: false, 511 c: null, 512 e: null, 513 s: props, 514 x: null, 515 r: active_effect, 516 l: legacy_mode_flag && !runes ? { 517 s: null, 518 u: null, 519 $: [] 520 } : null 521 }; 522 } 523 /** 524 * @template {Record<string, any>} T 525 * @param {T} [component] 526 * @returns {T} 527 */ 528 function pop(component) { 529 var context = component_context; 530 var effects = context.e; 531 if (effects !== null) { 532 context.e = null; 533 for (var fn of effects) create_user_effect(fn); 534 } 535 if (component !== void 0) context.x = component; 536 context.i = true; 537 component_context = context.p; 538 return component ?? {}; 539 } 540 /** @returns {boolean} */ 541 function is_runes() { 542 return !legacy_mode_flag || component_context !== null && component_context.l === null; 543 } 544 /** 545 * @param {string} name 546 * @returns {Map<unknown, unknown>} 547 */ 548 function get_or_init_context_map(name) { 549 if (component_context === null) lifecycle_outside_component(name); 550 return component_context.c ??= new Map(get_parent_context(component_context) || void 0); 551 } 552 /** 553 * @param {ComponentContext} component_context 554 * @returns {Map<unknown, unknown> | null} 555 */ 556 function get_parent_context(component_context) { 557 let parent = component_context.p; 558 while (parent !== null) { 559 const context_map = parent.c; 560 if (context_map !== null) return context_map; 561 parent = parent.p; 562 } 563 return null; 564 } 565 //#endregion 566 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/task.js 567 /** @type {Array<() => void>} */ 568 var micro_tasks = []; 569 function run_micro_tasks() { 570 var tasks = micro_tasks; 571 micro_tasks = []; 572 run_all(tasks); 573 } 574 /** 575 * @param {() => void} fn 576 */ 577 function queue_micro_task(fn) { 578 if (micro_tasks.length === 0 && !is_flushing_sync) { 579 var tasks = micro_tasks; 580 queueMicrotask(() => { 581 if (tasks === micro_tasks) run_micro_tasks(); 582 }); 583 } 584 micro_tasks.push(fn); 585 } 586 /** 587 * Synchronously run any queued tasks. 588 */ 589 function flush_tasks() { 590 while (micro_tasks.length > 0) run_micro_tasks(); 591 } 592 /** 593 * @param {unknown} error 594 */ 595 function handle_error(error) { 596 var effect = active_effect; 597 if (effect === null) { 598 /** @type {Derived} */ active_reaction.f |= ERROR_VALUE; 599 return error; 600 } 601 if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error; 602 invoke_error_boundary(error, effect); 603 } 604 /** 605 * @param {unknown} error 606 * @param {Effect | null} effect 607 */ 608 function invoke_error_boundary(error, effect) { 609 while (effect !== null) { 610 if ((effect.f & 128) !== 0) { 611 if ((effect.f & 32768) === 0) throw error; 612 try { 613 /** @type {Boundary} */ effect.b.error(error); 614 return; 615 } catch (e) { 616 error = e; 617 } 618 } 619 effect = effect.parent; 620 } 621 throw error; 622 } 623 //#endregion 624 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/status.js 625 /** @import { Derived, Signal } from '#client' */ 626 var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN); 627 /** 628 * @param {Signal} signal 629 * @param {number} status 630 */ 631 function set_signal_status(signal, status) { 632 signal.f = signal.f & STATUS_MASK | status; 633 } 634 /** 635 * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state. 636 * @param {Derived} derived 637 */ 638 function update_derived_status(derived) { 639 if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN); 640 else set_signal_status(derived, MAYBE_DIRTY); 641 } 642 //#endregion 643 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/utils.js 644 /** @import { Derived, Effect, Value } from '#client' */ 645 /** 646 * @param {Value[] | null} deps 647 */ 648 function clear_marked(deps) { 649 if (deps === null) return; 650 for (const dep of deps) { 651 if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue; 652 dep.f ^= WAS_MARKED; 653 clear_marked( 654 /** @type {Derived} */ 655 dep.deps 656 ); 657 } 658 } 659 /** 660 * @param {Effect} effect 661 * @param {Set<Effect>} dirty_effects 662 * @param {Set<Effect>} maybe_dirty_effects 663 */ 664 function defer_effect(effect, dirty_effects, maybe_dirty_effects) { 665 if ((effect.f & 2048) !== 0) dirty_effects.add(effect); 666 else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect); 667 clear_marked(effect.deps); 668 set_signal_status(effect, CLEAN); 669 } 670 //#endregion 671 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/store.js
672 /** 673 * We set this to `true` when updating a store so that we correctly 674 * schedule effects if the update takes place inside a `$:` effect 675 */ 676 var legacy_is_updating_store = false; 677 /** 678 * Whether or not the prop currently being read is a store binding, as in 679 * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in 680 * runes mode, and skip `binding_property_non_reactive` validation 681 */ 682 var is_store_binding = false; 683 /** 684 * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding. 685 * Used to prevent `binding_property_non_reactive` validation false positives and 686 * ensure that these props are treated as mutable even in runes mode 687 * @template T 688 * @param {() => T} fn 689 * @returns {[T, boolean]} 690 */ 691 function capture_store_binding(fn) { 692 var previous_is_store_binding = is_store_binding; 693 try { 694 is_store_binding = false; 695 return [fn(), is_store_binding]; 696 } finally { 697 is_store_binding = previous_is_store_binding; 698 } 699 } 700 //#endregion 701 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/batch.js 702 /** @import { Fork } from 'svelte' */ 703 /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */ 704 /** @type {Batch | null} */ 705 var first_batch = null; 706 /** @type {Batch | null} */ 707 var last_batch = null; 708 /** @type {Batch | null} */ 709 var current_batch = null; 710 /** 711 * This is needed to avoid overwriting inputs 712 * @type {Batch | null} 713 */ 714 var previous_batch = null; 715 /** 716 * When time travelling (i.e. working in one batch, while other batches 717 * still have ongoing work), we ignore the real values of affected 718 * signals in favour of their values within the batch 719 * @type {Map<Value, any> | null} 720 */ 721 var batch_values = null; 722 /** @type {Effect | null} */ 723 var last_scheduled_effect = null; 724 var is_flushing_sync = false; 725 var is_processing = false; 726 /** 727 * During traversal, this is an array. Newly created effects are (if not immediately 728 * executed) pushed to this array, rather than going through the scheduling 729 * rigamarole that would cause another turn of the flush loop. 730 * @type {Effect[] | null} 731 */ 732 var collected_effects = null; 733 /** 734 * An array of effects that are marked during traversal as a result of a `set` 735 * (not `internal_set`) call. These will be added to the next batch and 736 * trigger another `batch.process()` 737 * @type {Effect[] | null} 738 * @deprecated when we get rid of legacy mode and stores, we can get rid of this 739 */ 740 var legacy_updates = null; 741 var flush_count = 0; 742 var uid = 1; 743 var Batch = class Batch { 744 id = uid++; 745 /** True as soon as `#process` was called */ 746 #started = false; 747 linked = true; 748 /** @type {Batch | null} */ 749 #prev = null; 750 /** @type {Batch | null} */ 751 #next = null; 752 /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */ 753 async_deriveds = /* @__PURE__ */ new Map(); 754 /** 755 * The current values of any signals that are updated in this batch. 756 * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment) 757 * They keys of this map are identical to `this.#previous` 758 * @type {Map<Value, [any, boolean]>} 759 */ 760 current = /* @__PURE__ */ new Map(); 761 /** 762 * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place. 763 * They keys of this map are identical to `this.#current` 764 * @type {Map<Value, any>} 765 */ 766 previous = /* @__PURE__ */ new Map(); 767 /** 768 * When the batch is committed (and the DOM is updated), we need to remove old branches 769 * and append new ones by calling the functions added inside (if/each/key/etc) blocks 770 * @type {Set<(batch: Batch) => void>} 771 */ 772 #commit_callbacks = /* @__PURE__ */ new Set(); 773 /** 774 * If a fork is discarded, we need to destroy any effects that are no longer needed 775 * @type {Set<(batch: Batch) => void>} 776 */ 777 #discard_callbacks = /* @__PURE__ */ new Set(); 778 /** 779 * The number of async effects that are currently in flight 780 */ 781 #pending = 0; 782 /** 783 * Async effects that are currently in flight, _not_ inside a pending boundary 784 * @type {Map<Effect, number>} 785 */ 786 #blocking_pending = /* @__PURE__ */ new Map(); 787 /** 788 * A deferred that resolves when the batch is committed, used with `settled()` 789 * TODO replace with Promise.withResolvers once supported widely enough 790 * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null} 791 */ 792 #deferred = null; 793 /** 794 * The root effects that need to be flushed 795 * @type {Effect[]} 796 */ 797 #roots = []; 798 /** 799 * Effects created while this batch was active. 800 * @type {Effect[]} 801 */ 802 #new_effects = []; 803 /** 804 * Deferred effects (which run after async work has completed) that are DIRTY 805 * @type {Set<Effect>} 806 */ 807 #dirty_effects = /* @__PURE__ */ new Set(); 808 /** 809 * Deferred effects that are MAYBE_DIRTY 810 * @type {Set<Effect>} 811 */ 812 #maybe_dirty_effects = /* @__PURE__ */ new Set(); 813 /** 814 * A map of branches that still exist, but will be destroyed when this batch 815 * is committed â we skip over these during `process`. 816 * The value contains child effects that were dirty/maybe_dirty before being reset, 817 * so they can be rescheduled if the branch survives. 818 * @type {Map<Effect, { d: Effect[], m: Effect[] }>} 819 */ 820 #skipped_branches = /* @__PURE__ */ new Map(); 821 /** 822 * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing 823 * @type {Set<Effect>} 824 */ 825 #unskipped_branches = /* @__PURE__ */ new Set(); 826 is_fork = false;
827 #decrement_queued = false; 828 constructor() { 829 if (last_batch === null) first_batch = last_batch = this; 830 else { 831 last_batch.#next = this; 832 this.#prev = last_batch; 833 } 834 last_batch = this; 835 } 836 #is_deferred() { 837 if (this.is_fork) return true; 838 for (const effect of this.#blocking_pending.keys()) { 839 var e = effect; 840 var skipped = false; 841 while (e.parent !== null) { 842 if (this.#skipped_branches.has(e)) { 843 skipped = true; 844 break; 845 } 846 e = e.parent; 847 } 848 if (!skipped) return true; 849 } 850 return false; 851 } 852 /** 853 * Add an effect to the #skipped_branches map and reset its children 854 * @param {Effect} effect 855 */ 856 skip_effect(effect) { 857 if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, { 858 d: [], 859 m: [] 860 }); 861 this.#unskipped_branches.delete(effect); 862 } 863 /** 864 * Remove an effect from the #skipped_branches map and reschedule 865 * any tracked dirty/maybe_dirty child effects 866 * @param {Effect} effect 867 * @param {(e: Effect) => void} callback 868 */ 869 unskip_effect(effect, callback = (e) => this.schedule(e)) { 870 var tracked = this.#skipped_branches.get(effect); 871 if (tracked) { 872 this.#skipped_branches.delete(effect); 873 for (var e of tracked.d) { 874 set_signal_status(e, DIRTY); 875 callback(e); 876 } 877 for (e of tracked.m) { 878 set_signal_status(e, MAYBE_DIRTY); 879 callback(e); 880 } 881 } 882 this.#unskipped_branches.add(effect); 883 } 884 #process() { 885 this.#started = true; 886 if (flush_count++ > 1e3) { 887 this.#unlink(); 888 infinite_loop_guard(); 889 } 890 for (const e of this.#dirty_effects) { 891 this.#maybe_dirty_effects.delete(e); 892 set_signal_status(e, DIRTY); 893 this.schedule(e); 894 } 895 for (const e of this.#maybe_dirty_effects) { 896 set_signal_status(e, MAYBE_DIRTY); 897 this.schedule(e); 898 } 899 const roots = this.#roots; 900 this.#roots = []; 901 this.apply(); 902 /** @type {Effect[]} */ 903 var effects = collected_effects = []; 904 /** @type {Effect[]} */ 905 var render_effects = []; 906 /** 907 * @type {Effect[]} 908 * @deprecated when we get rid of legacy mode and stores, we can get rid of this 909 */ 910 var updates = legacy_updates = []; 911 for (const root of roots) try { 912 this.#traverse(root, effects, render_effects); 913 } catch (e) { 914 reset_all(root); 915 if (!this.#is_deferred()) this.discard(); 916 throw e; 917 } 918 current_batch = null; 919 if (updates.length > 0) { 920 var batch = Batch.ensure(); 921 for (const e of updates) batch.schedule(e); 922 } 923 collected_effects = null; 924 legacy_updates = null; 925 if (this.#is_deferred()) { 926 this.#defer_effects(render_effects); 927 this.#defer_effects(effects); 928 for (const [e, t] of this.#skipped_branches) reset_branch(e, t); 929 if (updates.length > 0) 930 /** @type {Batch} */ current_batch.#process(); 931 return; 932 } 933 const earlier_batch = this.#find_earlier_batch(); 934 if (earlier_batch) { 935 this.#defer_effects(render_effects); 936 this.#defer_effects(effects); 937 earlier_batch.#merge(this); 938 return; 939 } 940 this.#dirty_effects.clear(); 941 this.#maybe_dirty_effects.clear(); 942 for (const fn of this.#commit_callbacks) fn(this); 943 this.#commit_callbacks.clear(); 944 previous_batch = this; 945 flush_queued_effects(render_effects); 946 flush_queued_effects(effects); 947 previous_batch = null; 948 this.#deferred?.resolve(); 949 var next_batch = current_batch; 950 if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) { 951 this.#unlink(); 952 if (async_mode_flag) { 953 this.#commit(); 954 current_batch = next_batch; 955 } 956 } 957 if (this.#roots.length > 0) if (next_batch !== null) { 958 const batch = next_batch; 959 batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r))); 960 } else next_batch = this; 961 if (next_batch !== null) next_batch.#process(); 962 } 963 /** 964 * Traverse the effect tree, executing effects or stashing 965 * them for later execution as appropriate 966 * @param {Effect} root 967 * @param {Effect[]} effects 968 * @param {Effect[]} render_effects 969 */ 970 #traverse(root, effects, render_effects) { 971 root.f ^= CLEAN; 972 var effect = root.first; 973 while (effect !== null) { 974 var flags = effect.f; 975 var is_branch = (flags & 96) !== 0; 976 if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) { 977 if (is_branch) effect.f ^= CLEAN; 978 else if ((flags & 4) !== 0) effects.push(effect); 979 else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect); 980 else if (is_dirty(effect)) { 981 if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect); 982 update_effect(effect); 983 } 984 var child = effect.first; 985 if (child !== null) { 986 effect = child; 987 continue; 988 } 989 } 990 while (effect !== null) { 991 var next = effect.next; 992 if (next !== null) { 993 effect = next; 994 break; 995 } 996 effect = effect.parent; 997 } 998 } 999 } 1000 #find_earlier_batch() { 1001 var batch = this.#prev; 1002 while (batch !== null) { 1003 if (!batch.is_fork) { 1004 for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch; 1005 } 1006 batch = batch.#prev; 1007 } 1008 return null; 1009 } 1010 /** 1011 * @param {Batch} batch 1012 */ 1013 #merge(batch) { 1014 for (const [source, value] of batch.current) { 1015 if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source)); 1016 this.current.set(source, value); 1017 } 1018 for (const [effect, deferred] of batch.async_deriveds) { 1019 const d = this.async_deriveds.get(effect);
1020 if (d) deferred.promise.then(d.resolve).catch(d.reject); 1021 } 1022 this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects); 1023 /** 1024 * mark all effects that depend on `batch.current`, except the 1025 * async effects that we just resolved (TODO unless they depend 1026 * on values in this batch that are NOT in the later batch?). 1027 * Through this we also will populate the correct #skipped_branches, 1028 * oncommit callbacks etc, so we don't need to merge them separately. 1029 * @param {Value} value 1030 */ 1031 const mark = (value) => { 1032 var reactions = value.reactions; 1033 if (reactions === null) return; 1034 for (const reaction of reactions) { 1035 var flags = reaction.f; 1036 if ((flags & 2) !== 0) mark(reaction); 1037 else { 1038 var effect = reaction; 1039 if (flags & 4194320 && !this.async_deriveds.has(effect)) { 1040 this.#maybe_dirty_effects.delete(effect); 1041 set_signal_status(effect, DIRTY); 1042 this.schedule(effect); 1043 } 1044 } 1045 } 1046 }; 1047 for (const source of this.current.keys()) mark(source); 1048 this.oncommit(() => batch.discard()); 1049 batch.#unlink(); 1050 current_batch = this; 1051 this.#process(); 1052 } 1053 /** 1054 * @param {Effect[]} effects 1055 */ 1056 #defer_effects(effects) { 1057 for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects); 1058 } 1059 /** 1060 * Associate a change to a given source with the current 1061 * batch, noting its previous and current values 1062 * @param {Value} source 1063 * @param {any} value 1064 * @param {boolean} [is_derived] 1065 */ 1066 capture(source, value, is_derived = false) { 1067 if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v); 1068 if ((source.f & 8388608) === 0) { 1069 this.current.set(source, [value, is_derived]); 1070 batch_values?.set(source, value); 1071 } 1072 if (!this.is_fork) source.v = value; 1073 } 1074 activate() { 1075 current_batch = this; 1076 } 1077 deactivate() { 1078 current_batch = null; 1079 batch_values = null; 1080 } 1081 flush() { 1082 try { 1083 is_processing = true; 1084 current_batch = this; 1085 this.#process(); 1086 } finally { 1087 flush_count = 0; 1088 last_scheduled_effect = null; 1089 collected_effects = null; 1090 legacy_updates = null; 1091 is_processing = false; 1092 current_batch = null; 1093 batch_values = null; 1094 old_values.clear(); 1095 } 1096 } 1097 discard() { 1098 for (const fn of this.#discard_callbacks) fn(this); 1099 this.#discard_callbacks.clear(); 1100 this.#unlink(); 1101 this.#deferred?.resolve(); 1102 } 1103 /** 1104 * @param {Effect} effect 1105 */ 1106 register_created_effect(effect) { 1107 this.#new_effects.push(effect); 1108 } 1109 #commit() { 1110 for (let batch = first_batch; batch !== null; batch = batch.#next) { 1111 var is_earlier = batch.id < this.id; 1112 /** @type {Source[]} */ 1113 var sources = []; 1114 for (const [source, [value, is_derived]] of this.current) { 1115 if (batch.current.has(source)) { 1116 var batch_value = batch.current.get(source)[0]; 1117 if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]); 1118 else continue; 1119 } 1120 sources.push(source); 1121 } 1122 if (is_earlier) for (const [effect, deferred] of this.async_deriveds) { 1123 const d = batch.async_deriveds.get(effect); 1124 if (d) deferred.promise.then(d.resolve).catch(d.reject); 1125 } 1126 if (!batch.#started) continue; 1127 var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s)); 1128 if (others.length === 0) { 1129 if (is_earlier) batch.discard(); 1130 } else if (sources.length > 0) { 1131 if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => { 1132 if ((e.f & 4194320) !== 0) batch.schedule(e); 1133 else batch.#defer_effects([e]); 1134 }); 1135 batch.activate(); 1136 /** @type {Set<Value>} */ 1137 var marked = /* @__PURE__ */ new Set(); 1138 /** @type {Map<Reaction, boolean>} */ 1139 var checked = /* @__PURE__ */ new Map(); 1140 for (var source of sources) mark_effects(source, others, marked, checked); 1141 checked = /* @__PURE__ */ new Map(); 1142 var current_unequal = [...batch.current].filter(([c, v1]) => { 1143 const v2 = this.current.get(c); 1144 if (!v2) return true; 1145 return v2[0] !== v1[0] || v2[1] !== v1[1]; 1146 }).map(([c]) => c); 1147 if (current_unequal.length > 0) { 1148 for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) { 1149 set_signal_status(effect, DIRTY); 1150 batch.schedule(effect); 1151 } else batch.#dirty_effects.add(effect); 1152 } 1153 if (batch.#roots.length > 0 && !batch.#decrement_queued) { 1154 batch.apply(); 1155 for (var root of batch.#roots) batch.#traverse(root, [], []); 1156 batch.#roots = []; 1157 } 1158 batch.deactivate(); 1159 } 1160 } 1161 } 1162 /** 1163 * @param {boolean} blocking 1164 * @param {Effect} effect 1165 */ 1166 increment(blocking, effect) { 1167 this.#pending += 1; 1168 if (blocking) { 1169 let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0; 1170 this.#blocking_pending.set(effect, blocking_pending_count + 1); 1171 } 1172 } 1173 /** 1174 * @param {boolean} blocking 1175 * @param {Effect} effect 1176 */
1177 decrement(blocking, effect) { 1178 this.#pending -= 1; 1179 if (blocking) { 1180 let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0; 1181 if (blocking_pending_count === 1) this.#blocking_pending.delete(effect); 1182 else this.#blocking_pending.set(effect, blocking_pending_count - 1); 1183 } 1184 if (this.#decrement_queued) return; 1185 this.#decrement_queued = true; 1186 queue_micro_task(() => { 1187 this.#decrement_queued = false; 1188 if (this.linked) this.flush(); 1189 }); 1190 } 1191 /** 1192 * @param {Set<Effect>} dirty_effects 1193 * @param {Set<Effect>} maybe_dirty_effects 1194 */ 1195 transfer_effects(dirty_effects, maybe_dirty_effects) { 1196 for (const e of dirty_effects) this.#dirty_effects.add(e); 1197 for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e); 1198 dirty_effects.clear(); 1199 maybe_dirty_effects.clear(); 1200 } 1201 /** @param {(batch: Batch) => void} fn */ 1202 oncommit(fn) { 1203 this.#commit_callbacks.add(fn); 1204 } 1205 /** @param {(batch: Batch) => void} fn */ 1206 ondiscard(fn) { 1207 this.#discard_callbacks.add(fn); 1208 } 1209 settled() { 1210 return (this.#deferred ??= deferred()).promise; 1211 } 1212 static ensure() { 1213 if (current_batch === null) { 1214 const batch = current_batch = new Batch(); 1215 if (!is_processing && !is_flushing_sync) queue_micro_task(() => { 1216 if (!batch.#started) batch.flush(); 1217 }); 1218 } 1219 return current_batch; 1220 } 1221 apply() { 1222 if (!async_mode_flag || !this.is_fork && this.#prev === null && this.#next === null) { 1223 batch_values = null; 1224 return; 1225 } 1226 batch_values = /* @__PURE__ */ new Map(); 1227 for (const [source, [value]] of this.current) batch_values.set(source, value); 1228 for (let batch = first_batch; batch !== null; batch = batch.#next) { 1229 if (batch === this || batch.is_fork) continue; 1230 var intersects = false; 1231 if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) { 1232 if (is_derived) continue; 1233 if (this.current.has(source)) { 1234 intersects = true; 1235 break; 1236 } 1237 } 1238 if (!intersects) { 1239 for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous); 1240 } 1241 } 1242 } 1243 /** 1244 * 1245 * @param {Effect} effect 1246 */ 1247 schedule(effect) { 1248 last_scheduled_effect = effect; 1249 if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) { 1250 effect.b.defer_effect(effect); 1251 return; 1252 } 1253 var e = effect; 1254 while (e.parent !== null) { 1255 e = e.parent; 1256 var flags = e.f; 1257 if (collected_effects !== null && e === active_effect) { 1258 if (async_mode_flag) return; 1259 if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return; 1260 } 1261 if ((flags & 96) !== 0) { 1262 if ((flags & 1024) === 0) return; 1263 e.f ^= CLEAN; 1264 } 1265 } 1266 this.#roots.push(e); 1267 } 1268 #unlink() { 1269 if (!this.linked) return; 1270 var prev = this.#prev; 1271 var next = this.#next; 1272 if (prev === null) first_batch = next; 1273 else prev.#next = next; 1274 if (next === null) last_batch = prev; 1275 else next.#prev = prev; 1276 this.linked = false; 1277 } 1278 }; 1279 /** 1280 * Synchronously flush any pending updates. 1281 * Returns void if no callback is provided, otherwise returns the result of calling the callback. 1282 * @template [T=void] 1283 * @param {(() => T) | undefined} [fn] 1284 * @returns {T} 1285 */ 1286 function flushSync(fn) { 1287 var was_flushing_sync = is_flushing_sync; 1288 is_flushing_sync = true; 1289 try { 1290 var result; 1291 if (fn) { 1292 if (current_batch !== null && !current_batch.is_fork) current_batch.flush(); 1293 result = fn(); 1294 } 1295 while (true) { 1296 flush_tasks(); 1297 if (current_batch === null) return result; 1298 current_batch.flush(); 1299 } 1300 } finally { 1301 is_flushing_sync = was_flushing_sync; 1302 } 1303 } 1304 function infinite_loop_guard() { 1305 try { 1306 effect_update_depth_exceeded(); 1307 } catch (error) { 1308 invoke_error_boundary(error, last_scheduled_effect); 1309 } 1310 } 1311 /** @type {Set<Effect> | null} */ 1312 var eager_block_effects = null; 1313 /** 1314 * @param {Array<Effect>} effects 1315 * @returns {void} 1316 */ 1317 function flush_queued_effects(effects) { 1318 var length = effects.length; 1319 if (length === 0) return; 1320 var i = 0; 1321 while (i < length) { 1322 var effect = effects[i++]; 1323 if ((effect.f & 24576) === 0 && is_dirty(effect)) { 1324 eager_block_effects = /* @__PURE__ */ new Set(); 1325 update_effect(effect); 1326 if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect); 1327 if (eager_block_effects?.size > 0) { 1328 old_values.clear(); 1329 for (const e of eager_block_effects) { 1330 if ((e.f & 24576) !== 0) continue; 1331 /** @type {Effect[]} */ 1332 const ordered_effects = [e]; 1333 let ancestor = e.parent; 1334 while (ancestor !== null) { 1335 if (eager_block_effects.has(ancestor)) { 1336 eager_block_effects.delete(ancestor); 1337 ordered_effects.push(ancestor); 1338 } 1339 ancestor = ancestor.parent; 1340 } 1341 for (let j = ordered_effects.length - 1; j >= 0; j--) { 1342 const e = ordered_effects[j]; 1343 if ((e.f & 24576) !== 0) continue; 1344 update_effect(e); 1345 } 1346 } 1347 eager_block_effects.clear(); 1348 } 1349 } 1350 } 1351 eager_block_effects = null; 1352 }
1353 /** 1354 * This is similar to `mark_reactions`, but it only marks async/block effects 1355 * depending on `value` and at least one of the other `sources`, so that 1356 * these effects can re-run after another batch has been committed 1357 * @param {Value} value 1358 * @param {Source[]} sources 1359 * @param {Set<Value>} marked 1360 * @param {Map<Reaction, boolean>} checked 1361 */ 1362 function mark_effects(value, sources, marked, checked) { 1363 if (marked.has(value)) return; 1364 marked.add(value); 1365 if (value.reactions !== null) for (const reaction of value.reactions) { 1366 const flags = reaction.f; 1367 if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked); 1368 else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) { 1369 set_signal_status(reaction, DIRTY); 1370 schedule_effect(reaction); 1371 } 1372 } 1373 } 1374 /** 1375 * @param {Reaction} reaction 1376 * @param {Source[]} sources 1377 * @param {Map<Reaction, boolean>} checked 1378 */ 1379 function depends_on(reaction, sources, checked) { 1380 const depends = checked.get(reaction); 1381 if (depends !== void 0) return depends; 1382 if (reaction.deps !== null) for (const dep of reaction.deps) { 1383 if (includes.call(sources, dep)) return true; 1384 if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) { 1385 checked.set(dep, true); 1386 return true; 1387 } 1388 } 1389 checked.set(reaction, false); 1390 return false; 1391 } 1392 /** 1393 * @param {Effect} effect 1394 * @returns {void} 1395 */ 1396 function schedule_effect(effect) { 1397 /** @type {Batch} */ current_batch.schedule(effect); 1398 } 1399 /** 1400 * Mark all the effects inside a skipped branch CLEAN, so that 1401 * they can be correctly rescheduled later. Tracks dirty and maybe_dirty 1402 * effects so they can be rescheduled if the branch survives. 1403 * @param {Effect} effect 1404 * @param {{ d: Effect[], m: Effect[] }} tracked 1405 */ 1406 function reset_branch(effect, tracked) { 1407 if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return; 1408 if ((effect.f & 2048) !== 0) tracked.d.push(effect); 1409 else if ((effect.f & 4096) !== 0) tracked.m.push(effect); 1410 set_signal_status(effect, CLEAN); 1411 var e = effect.first; 1412 while (e !== null) { 1413 reset_branch(e, tracked); 1414 e = e.next; 1415 } 1416 } 1417 /** 1418 * Mark an entire effect tree clean following an error 1419 * @param {Effect} effect 1420 */ 1421 function reset_all(effect) { 1422 set_signal_status(effect, CLEAN); 1423 var e = effect.first; 1424 while (e !== null) { 1425 reset_all(e); 1426 e = e.next; 1427 } 1428 } 1429 //#endregion 1430 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/reactivity/create-subscriber.js 1431 /** 1432 * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity. 1433 * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`. 1434 * 1435 * If `subscribe` is called inside an effect (including indirectly, for example inside a getter), 1436 * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs. 1437 * 1438 * If `start` returns a cleanup function, it will be called when the effect is destroyed. 1439 * 1440 * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects 1441 * are active, and the returned teardown function will only be called when all effects are destroyed. 1442 * 1443 * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery): 1444 * 1445 * ```js 1446 * import { createSubscriber } from 'svelte/reactivity'; 1447 * import { on } from 'svelte/events'; 1448 * 1449 * export class MediaQuery { 1450 * #query; 1451 * #subscribe; 1452 * 1453 * constructor(query) { 1454 * this.#query = window.matchMedia(`(${query})`); 1455 * 1456 * this.#subscribe = createSubscriber((update) => { 1457 * // when the `change` event occurs, re-run any effects that read `this.current` 1458 * const off = on(this.#query, 'change', update); 1459 * 1460 * // stop listening when all the effects are destroyed 1461 * return () => off(); 1462 * }); 1463 * } 1464 * 1465 * get current() { 1466 * // This makes the getter reactive, if read in an effect 1467 * this.#subscribe(); 1468 * 1469 * // Return the current state of the query, whether or not we're in an effect 1470 * return this.#query.matches; 1471 * } 1472 * } 1473 * ``` 1474 * @param {(update: () => void) => (() => void) | void} start 1475 * @since 5.7.0 1476 */ 1477 function createSubscriber(start) { 1478 let subscribers = 0; 1479 let version = source(0); 1480 /** @type {(() => void) | void} */ 1481 let stop; 1482 return () => { 1483 if (effect_tracking()) { 1484 get$2(version); 1485 render_effect(() => { 1486 if (subscribers === 0) stop = untrack(() => start(() => increment$1(version))); 1487 subscribers += 1; 1488 return () => { 1489 queue_micro_task(() => { 1490 subscribers -= 1; 1491 if (subscribers === 0) { 1492 stop?.(); 1493 stop = void 0; 1494 increment$1(version); 1495 } 1496 }); 1497 }; 1498 }); 1499 } 1500 }; 1501 } 1502 //#endregion 1503 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/boundary.js 1504 /** @import { Effect, Source, TemplateNode, } from '#client' */ 1505 /** 1506 * @typedef {{ 1507 * onerror?: ((error: unknown, reset: () => void) => void) | null; 1508 * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null; 1509 * pending?: ((anchor: Node) => void) | null; 1510 * }} BoundaryProps 1511 */ 1512 var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED; 1513 /** 1514 * @param {TemplateNode} node 1515 * @param {BoundaryProps} props 1516 * @param {((anchor: Node) => void)} children 1517 * @param {((error: unknown) => unknown) | undefined} [transform_error] 1518 * @returns {void} 1519 */ 1520 function boundary(node, props, children, transform_error) { 1521 new Boundary(node, props, children, transform_error); 1522 } 1523 var Boundary = class { 1524 /** @type {Boundary | null} */ 1525 parent; 1526 is_pending = false;
1527 /** 1528 * API-level transformError transform function. Transforms errors before they reach the `failed` snippet. 1529 * Inherited from parent boundary, or defaults to identity. 1530 * @type {(error: unknown) => unknown} 1531 */ 1532 transform_error; 1533 /** @type {TemplateNode} */ 1534 #anchor; 1535 /** @type {TemplateNode | null} */ 1536 #hydrate_open = hydrating ? hydrate_node : null; 1537 /** @type {BoundaryProps} */ 1538 #props; 1539 /** @type {((anchor: Node) => void)} */ 1540 #children; 1541 /** @type {Effect} */ 1542 #effect; 1543 /** @type {Effect | null} */ 1544 #main_effect = null; 1545 /** @type {Effect | null} */ 1546 #pending_effect = null; 1547 /** @type {Effect | null} */ 1548 #failed_effect = null; 1549 /** @type {DocumentFragment | null} */ 1550 #offscreen_fragment = null; 1551 #local_pending_count = 0; 1552 #pending_count = 0; 1553 #pending_count_update_queued = false; 1554 /** @type {Set<Effect>} */ 1555 #dirty_effects = /* @__PURE__ */ new Set(); 1556 /** @type {Set<Effect>} */ 1557 #maybe_dirty_effects = /* @__PURE__ */ new Set(); 1558 /** 1559 * A source containing the number of pending async deriveds/expressions. 1560 * Only created if `$effect.pending()` is used inside the boundary, 1561 * otherwise updating the source results in needless `Batch.ensure()` 1562 * calls followed by no-op flushes 1563 * @type {Source<number> | null} 1564 */ 1565 #effect_pending = null; 1566 #effect_pending_subscriber = createSubscriber(() => { 1567 this.#effect_pending = source(this.#local_pending_count); 1568 return () => { 1569 this.#effect_pending = null; 1570 }; 1571 }); 1572 /** 1573 * @param {TemplateNode} node 1574 * @param {BoundaryProps} props 1575 * @param {((anchor: Node) => void)} children 1576 * @param {((error: unknown) => unknown) | undefined} [transform_error] 1577 */ 1578 constructor(node, props, children, transform_error) { 1579 this.#anchor = node; 1580 this.#props = props; 1581 this.#children = (anchor) => { 1582 var effect = active_effect; 1583 effect.b = this; 1584 effect.f |= 128; 1585 children(anchor); 1586 }; 1587 this.parent = active_effect.b; 1588 this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e); 1589 this.#effect = block(() => { 1590 if (hydrating) { 1591 const comment = this.#hydrate_open; 1592 hydrate_next(); 1593 const server_rendered_pending = comment.data === "[!"; 1594 if (comment.data.startsWith("[?")) { 1595 const serialized_error = JSON.parse(comment.data.slice(2)); 1596 this.#hydrate_failed_content(serialized_error); 1597 } else if (server_rendered_pending) this.#hydrate_pending_content(); 1598 else this.#hydrate_resolved_content(); 1599 } else this.#render(); 1600 }, flags); 1601 if (hydrating) this.#anchor = hydrate_node; 1602 } 1603 #hydrate_resolved_content() { 1604 try { 1605 this.#main_effect = branch(() => this.#children(this.#anchor)); 1606 } catch (error) { 1607 this.error(error); 1608 } 1609 } 1610 /** 1611 * @param {unknown} error The deserialized error from the server's hydration comment 1612 */ 1613 #hydrate_failed_content(error) { 1614 const failed = this.#props.failed; 1615 if (!failed) return; 1616 this.#failed_effect = branch(() => { 1617 failed(this.#anchor, () => error, () => () => {}); 1618 }); 1619 } 1620 #hydrate_pending_content() { 1621 const pending = this.#props.pending; 1622 if (!pending) return; 1623 this.is_pending = true; 1624 this.#pending_effect = branch(() => pending(this.#anchor)); 1625 queue_micro_task(() => { 1626 var fragment = this.#offscreen_fragment = document.createDocumentFragment(); 1627 var anchor = create_text(); 1628 fragment.append(anchor); 1629 this.#main_effect = this.#run(() => { 1630 return branch(() => this.#children(anchor)); 1631 }); 1632 if (this.#pending_count === 0) { 1633 this.#anchor.before(fragment); 1634 this.#offscreen_fragment = null; 1635 pause_effect(this.#pending_effect, () => { 1636 this.#pending_effect = null; 1637 }); 1638 this.#resolve(current_batch); 1639 } 1640 }); 1641 } 1642 #render() { 1643 try { 1644 this.is_pending = this.has_pending_snippet(); 1645 this.#pending_count = 0; 1646 this.#local_pending_count = 0; 1647 this.#main_effect = branch(() => { 1648 this.#children(this.#anchor); 1649 }); 1650 if (this.#pending_count > 0) { 1651 var fragment = this.#offscreen_fragment = document.createDocumentFragment(); 1652 move_effect(this.#main_effect, fragment); 1653 const pending = this.#props.pending; 1654 this.#pending_effect = branch(() => pending(this.#anchor)); 1655 } else this.#resolve(current_batch); 1656 } catch (error) { 1657 this.error(error); 1658 } 1659 } 1660 /** 1661 * @param {Batch} batch 1662 */ 1663 #resolve(batch) { 1664 this.is_pending = false;
1665 (batch ?? Batch.ensure()).transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects); 1666 } 1667 /** 1668 * Defer an effect inside a pending boundary until the boundary resolves 1669 * @param {Effect} effect 1670 */ 1671 defer_effect(effect) { 1672 defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects); 1673 } 1674 /** 1675 * Returns `false` if the effect exists inside a boundary whose pending snippet is shown 1676 * @returns {boolean} 1677 */ 1678 is_rendered() { 1679 return !this.is_pending && (!this.parent || this.parent.is_rendered()); 1680 } 1681 has_pending_snippet() { 1682 return !!this.#props.pending; 1683 } 1684 /** 1685 * @template T 1686 * @param {() => T} fn 1687 */ 1688 #run(fn) { 1689 var previous_effect = active_effect; 1690 var previous_reaction = active_reaction; 1691 var previous_ctx = component_context; 1692 set_active_effect(this.#effect); 1693 set_active_reaction(this.#effect); 1694 set_component_context(this.#effect.ctx); 1695 try { 1696 Batch.ensure(); 1697 return fn(); 1698 } catch (e) { 1699 handle_error(e); 1700 return null; 1701 } finally { 1702 set_active_effect(previous_effect); 1703 set_active_reaction(previous_reaction); 1704 set_component_context(previous_ctx); 1705 } 1706 } 1707 /** 1708 * Updates the pending count associated with the currently visible pending snippet, 1709 * if any, such that we can replace the snippet with content once work is done 1710 * @param {1 | -1} d 1711 * @param {Batch} batch 1712 */ 1713 #update_pending_count(d, batch) { 1714 if (!this.has_pending_snippet()) { 1715 if (this.parent) this.parent.#update_pending_count(d, batch); 1716 return; 1717 } 1718 this.#pending_count += d; 1719 if (this.#pending_count === 0) { 1720 this.#resolve(batch); 1721 if (this.#pending_effect) pause_effect(this.#pending_effect, () => { 1722 this.#pending_effect = null; 1723 }); 1724 if (this.#offscreen_fragment) { 1725 this.#anchor.before(this.#offscreen_fragment); 1726 this.#offscreen_fragment = null; 1727 } 1728 } 1729 } 1730 /** 1731 * Update the source that powers `$effect.pending()` inside this boundary, 1732 * and controls when the current `pending` snippet (if any) is removed. 1733 * Do not call from inside the class 1734 * @param {1 | -1} d 1735 * @param {Batch} batch 1736 */ 1737 update_pending_count(d, batch) { 1738 this.#update_pending_count(d, batch); 1739 this.#local_pending_count += d; 1740 if (!this.#effect_pending || this.#pending_count_update_queued) return; 1741 this.#pending_count_update_queued = true; 1742 queue_micro_task(() => { 1743 this.#pending_count_update_queued = false; 1744 if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count); 1745 }); 1746 } 1747 get_effect_pending() { 1748 this.#effect_pending_subscriber(); 1749 return get$2(this.#effect_pending); 1750 } 1751 /** @param {unknown} error */ 1752 error(error) { 1753 if (!this.#props.onerror && !this.#props.failed) throw error; 1754 if (current_batch?.is_fork) { 1755 if (this.#main_effect) current_batch.skip_effect(this.#main_effect); 1756 if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect); 1757 if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect); 1758 current_batch.oncommit(() => { 1759 this.#handle_error(error); 1760 }); 1761 } else this.#handle_error(error); 1762 } 1763 /** 1764 * @param {unknown} error 1765 */ 1766 #handle_error(error) { 1767 if (this.#main_effect) { 1768 destroy_effect(this.#main_effect); 1769 this.#main_effect = null; 1770 } 1771 if (this.#pending_effect) { 1772 destroy_effect(this.#pending_effect); 1773 this.#pending_effect = null; 1774 } 1775 if (this.#failed_effect) { 1776 destroy_effect(this.#failed_effect); 1777 this.#failed_effect = null; 1778 } 1779 if (hydrating) { 1780 set_hydrate_node(this.#hydrate_open); 1781 next(); 1782 set_hydrate_node(skip_nodes()); 1783 } 1784 var onerror = this.#props.onerror; 1785 let failed = this.#props.failed; 1786 var did_reset = false; 1787 var calling_on_error = false; 1788 const reset = () => { 1789 if (did_reset) { 1790 svelte_boundary_reset_noop(); 1791 return; 1792 } 1793 did_reset = true; 1794 if (calling_on_error) svelte_boundary_reset_onerror(); 1795 if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => { 1796 this.#failed_effect = null; 1797 }); 1798 this.#run(() => { 1799 this.#render(); 1800 }); 1801 }; 1802 /** @param {unknown} transformed_error */ 1803 const handle_error_result = (transformed_error) => { 1804 try { 1805 calling_on_error = true; 1806 onerror?.(transformed_error, reset); 1807 calling_on_error = false;
1808 } catch (error) { 1809 invoke_error_boundary(error, this.#effect && this.#effect.parent); 1810 } 1811 if (failed) this.#failed_effect = this.#run(() => { 1812 try { 1813 return branch(() => { 1814 var effect = active_effect; 1815 effect.b = this; 1816 effect.f |= 128; 1817 failed(this.#anchor, () => transformed_error, () => reset); 1818 }); 1819 } catch (error) { 1820 invoke_error_boundary(error, this.#effect.parent); 1821 return null; 1822 } 1823 }); 1824 }; 1825 queue_micro_task(() => { 1826 /** @type {unknown} */ 1827 var result; 1828 try { 1829 result = this.transform_error(error); 1830 } catch (e) { 1831 invoke_error_boundary(e, this.#effect && this.#effect.parent); 1832 return; 1833 } 1834 if (result !== null && typeof result === "object" && typeof result.then === "function") 1835 /** @type {any} */ result.then( 1836 handle_error_result, 1837 /** @param {unknown} e */ 1838 (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent) 1839 ); 1840 else handle_error_result(result); 1841 }); 1842 } 1843 }; 1844 //#endregion 1845 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/async.js 1846 /** @import { Blocker, Effect, Source, Value } from '#client' */ 1847 /** 1848 * @param {Blocker[]} blockers 1849 * @param {Array<() => any>} sync 1850 * @param {Array<() => Promise<any>>} async 1851 * @param {(values: Value[]) => any} fn 1852 */ 1853 function flatten(blockers, sync, async, fn) { 1854 const d = is_runes() ? derived : derived_safe_equal; 1855 var pending = blockers.filter((b) => !b.settled); 1856 var deriveds = sync.map(d); 1857 if (async.length === 0 && pending.length === 0) { 1858 fn(deriveds); 1859 return; 1860 } 1861 var parent = active_effect; 1862 var restore = capture(); 1863 var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null; 1864 /** 1865 * @param {Source[]} async 1866 */ 1867 function finish(async) { 1868 if ((parent.f & 16384) !== 0) return; 1869 restore(); 1870 try { 1871 fn([...deriveds, ...async]); 1872 } catch (error) { 1873 invoke_error_boundary(error, parent); 1874 } 1875 unset_context(); 1876 } 1877 var decrement_pending = increment_pending(); 1878 if (async.length === 0) { 1879 /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending); 1880 return; 1881 } 1882 function run() { 1883 Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending); 1884 } 1885 if (blocker_promise) blocker_promise.then(() => { 1886 restore(); 1887 run(); 1888 unset_context(); 1889 }); 1890 else run(); 1891 } 1892 /** 1893 * Captures the current effect context so that we can restore it after 1894 * some asynchronous work has happened (so that e.g. `await a + b` 1895 * causes `b` to be registered as a dependency). 1896 */ 1897 function capture() { 1898 var previous_effect = active_effect; 1899 var previous_reaction = active_reaction; 1900 var previous_component_context = component_context; 1901 var previous_batch = current_batch; 1902 return function restore(activate_batch = true) { 1903 set_active_effect(previous_effect); 1904 set_active_reaction(previous_reaction); 1905 set_component_context(previous_component_context); 1906 if (activate_batch && (previous_effect.f & 16384) === 0) { 1907 previous_batch?.activate(); 1908 previous_batch?.apply(); 1909 } 1910 }; 1911 } 1912 function unset_context(deactivate_batch = true) { 1913 set_active_effect(null); 1914 set_active_reaction(null); 1915 set_component_context(null); 1916 if (deactivate_batch) current_batch?.deactivate(); 1917 } 1918 /** 1919 * @returns {(skip?: boolean) => void} 1920 */ 1921 function increment_pending() { 1922 var effect = active_effect; 1923 var boundary = effect.b; 1924 var batch = current_batch; 1925 var blocking = !!boundary?.is_rendered(); 1926 boundary?.update_pending_count(1, batch); 1927 batch.increment(blocking, effect); 1928 return () => { 1929 boundary?.update_pending_count(-1, batch); 1930 batch.decrement(blocking, effect); 1931 }; 1932 } 1933 /** 1934 * @template V 1935 * @param {() => V} fn 1936 * @returns {Derived<V>} 1937 */ 1938 /*#__NO_SIDE_EFFECTS__*/ 1939 function derived(fn) { 1940 var flags = 2 | DIRTY; 1941 if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED; 1942 return { 1943 ctx: component_context, 1944 deps: null, 1945 effects: null, 1946 equals, 1947 f: flags, 1948 fn, 1949 reactions: null, 1950 rv: 0, 1951 v: UNINITIALIZED, 1952 wv: 0, 1953 parent: active_effect, 1954 ac: null 1955 }; 1956 } 1957 var OBSOLETE = Symbol("obsolete"); 1958 /** 1959 * @template V 1960 * @param {() => V | Promise<V>} fn 1961 * @param {string} [label] 1962 * @param {string} [location] If provided, print a warning if the value is not read immediately after update 1963 * @returns {Promise<Source<V>>} 1964 */ 1965 /*#__NO_SIDE_EFFECTS__*/ 1966 function async_derived(fn, label, location) { 1967 let parent = active_effect; 1968 if (parent === null) async_derived_orphan(); 1969 var promise = void 0; 1970 var signal = source(UNINITIALIZED); 1971 var should_suspend = !active_reaction; 1972 /** @type {Set<ReturnType<typeof deferred<V>>>} */ 1973 var deferreds = /* @__PURE__ */ new Set(); 1974 async_effect(() => { 1975 var effect = active_effect; 1976 /** @type {ReturnType<typeof deferred<V>>} */ 1977 var d = deferred(); 1978 promise = d.promise; 1979 try { 1980 Promise.resolve(fn()).then(d.resolve, (e) => { 1981 if (e !== STALE_REACTION) d.reject(e); 1982 }).finally(unset_context); 1983 } catch (error) { 1984 d.reject(error); 1985 unset_context(); 1986 } 1987 var batch = current_batch; 1988 if (should_suspend) { 1989 if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending(); 1990 if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE); 1991 else for (const d of deferreds.values()) d.reject(OBSOLETE); 1992 deferreds.add(d); 1993 batch.async_deriveds.set(effect, d); 1994 } 1995 /** 1996 * @param {any} value 1997 * @param {unknown} error 1998 */ 1999 const handler = (value, error = void 0) => { 2000 decrement_pending?.();
2001 deferreds.delete(d); 2002 if (error === OBSOLETE) return; 2003 batch.activate(); 2004 if (error) { 2005 signal.f |= ERROR_VALUE; 2006 internal_set(signal, error); 2007 } else { 2008 if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE; 2009 internal_set(signal, value); 2010 } 2011 batch.deactivate(); 2012 }; 2013 d.promise.then(handler, (e) => handler(null, e || "unknown")); 2014 }); 2015 teardown(() => { 2016 for (const d of deferreds) d.reject(OBSOLETE); 2017 }); 2018 return new Promise((fulfil) => { 2019 /** @param {Promise<V>} p */ 2020 function next(p) { 2021 function go() { 2022 if (p === promise) fulfil(signal); 2023 else next(promise); 2024 } 2025 p.then(go, go); 2026 } 2027 next(promise); 2028 }); 2029 } 2030 /** 2031 * @template V 2032 * @param {() => V} fn 2033 * @returns {Derived<V>} 2034 */ 2035 /*#__NO_SIDE_EFFECTS__*/ 2036 function user_derived(fn) { 2037 const d = /* @__PURE__ */ derived(fn); 2038 if (!async_mode_flag) push_reaction_value(d); 2039 return d; 2040 } 2041 /** 2042 * @template V 2043 * @param {() => V} fn 2044 * @returns {Derived<V>} 2045 */ 2046 /*#__NO_SIDE_EFFECTS__*/ 2047 function derived_safe_equal(fn) { 2048 const signal = /* @__PURE__ */ derived(fn); 2049 signal.equals = safe_equals; 2050 return signal; 2051 }
2052 /** 2053 * @param {Derived} derived 2054 * @returns {void} 2055 */ 2056 function destroy_derived_effects(derived) { 2057 var effects = derived.effects; 2058 if (effects !== null) { 2059 derived.effects = null; 2060 for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]); 2061 } 2062 } 2063 /** 2064 * @template T 2065 * @param {Derived} derived 2066 * @returns {T} 2067 */ 2068 function execute_derived(derived) { 2069 var value; 2070 var prev_active_effect = active_effect; 2071 var parent = derived.parent; 2072 if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) { 2073 derived_inert(); 2074 return derived.v; 2075 } 2076 set_active_effect(parent); 2077 try { 2078 derived.f &= ~WAS_MARKED; 2079 destroy_derived_effects(derived); 2080 value = update_reaction(derived); 2081 } finally { 2082 set_active_effect(prev_active_effect); 2083 } 2084 return value; 2085 } 2086 /** 2087 * @param {Derived} derived 2088 * @returns {void} 2089 */ 2090 function update_derived(derived) { 2091 var value = execute_derived(derived); 2092 if (!derived.equals(value)) { 2093 derived.wv = increment_write_version(); 2094 if (!current_batch?.is_fork || derived.deps === null) { 2095 if (current_batch !== null) { 2096 current_batch.capture(derived, value, true); 2097 previous_batch?.capture(derived, value, true); 2098 } else derived.v = value; 2099 if (derived.deps === null) { 2100 set_signal_status(derived, CLEAN); 2101 return; 2102 } 2103 } 2104 } 2105 if (is_destroying_effect) return; 2106 if (batch_values !== null) { 2107 if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value); 2108 } else update_derived_status(derived); 2109 } 2110 /** 2111 * @param {Derived} derived 2112 */ 2113 function freeze_derived_effects(derived) { 2114 if (derived.effects === null) return; 2115 for (const e of derived.effects) if (e.teardown || e.ac) { 2116 e.teardown?.(); 2117 e.ac?.abort(STALE_REACTION); 2118 if (e.fn !== null) e.teardown = noop$1; 2119 e.ac = null; 2120 remove_reactions(e, 0); 2121 destroy_effect_children(e); 2122 } 2123 } 2124 /** 2125 * @param {Derived} derived 2126 */ 2127 function unfreeze_derived_effects(derived) { 2128 if (derived.effects === null) return; 2129 for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e); 2130 } 2131 //#endregion 2132 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/sources.js 2133 /** @import { Derived, Effect, Source, Value } from '#client' */ 2134 /** @type {Set<Effect>} */ 2135 var eager_effects = /* @__PURE__ */ new Set(); 2136 /** @type {Map<Source, any>} */ 2137 var old_values = /* @__PURE__ */ new Map(); 2138 var eager_effects_deferred = false; 2139 /** 2140 * @template V 2141 * @param {V} v 2142 * @param {Error | null} [stack] 2143 * @returns {Source<V>} 2144 */ 2145 function source(v, stack) { 2146 return { 2147 f: 0, 2148 v, 2149 reactions: null, 2150 equals, 2151 rv: 0, 2152 wv: 0 2153 }; 2154 } 2155 /** 2156 * @template V 2157 * @param {V} v 2158 * @param {Error | null} [stack] 2159 */ 2160 /*#__NO_SIDE_EFFECTS__*/ 2161 function state(v, stack) { 2162 const s = source(v, stack); 2163 push_reaction_value(s); 2164 return s; 2165 } 2166 /** 2167 * @template V 2168 * @param {V} initial_value 2169 * @param {boolean} [immutable] 2170 * @returns {Source<V>} 2171 */ 2172 /*#__NO_SIDE_EFFECTS__*/ 2173 function mutable_source(initial_value, immutable = false, trackable = true) { 2174 const s = source(initial_value); 2175 if (!immutable) s.equals = safe_equals; 2176 if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s); 2177 return s; 2178 } 2179 /** 2180 * @template V 2181 * @param {Source<V>} source 2182 * @param {V} value 2183 * @param {boolean} [should_proxy] 2184 * @returns {V} 2185 */ 2186 function set(source, value, should_proxy = false) { 2187 if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation(); 2188 return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates); 2189 } 2190 /** 2191 * @template V 2192 * @param {Source<V>} source 2193 * @param {V} value 2194 * @param {Effect[] | null} [updated_during_traversal] 2195 * @returns {V} 2196 */ 2197 function internal_set(source, value, updated_during_traversal = null) { 2198 if (!source.equals(value)) { 2199 old_values.set(source, is_destroying_effect ? value : source.v); 2200 var batch = Batch.ensure(); 2201 batch.capture(source, value); 2202 if ((source.f & 2) !== 0) { 2203 const derived = source; 2204 if ((source.f & 2048) !== 0) execute_derived(derived); 2205 if (batch_values === null) update_derived_status(derived); 2206 } 2207 source.wv = increment_write_version(); 2208 mark_reactions(source, DIRTY, updated_during_traversal); 2209 if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]); 2210 else untracked_writes.push(source); 2211 if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects(); 2212 } 2213 return value; 2214 } 2215 function flush_eager_effects() { 2216 eager_effects_deferred = false;
2217 for (const effect of eager_effects) { 2218 if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY); 2219 let dirty; 2220 try { 2221 dirty = is_dirty(effect); 2222 } catch { 2223 dirty = true; 2224 } 2225 if (dirty) update_effect(effect); 2226 } 2227 eager_effects.clear(); 2228 } 2229 /** 2230 * Silently (without using `get`) increment a source 2231 * @param {Source<number>} source 2232 */ 2233 function increment$1(source) { 2234 set(source, source.v + 1); 2235 } 2236 /** 2237 * @param {Value} signal 2238 * @param {number} status should be DIRTY or MAYBE_DIRTY 2239 * @param {Effect[] | null} updated_during_traversal 2240 * @returns {void} 2241 */ 2242 function mark_reactions(signal, status, updated_during_traversal) { 2243 var reactions = signal.reactions; 2244 if (reactions === null) return; 2245 var runes = is_runes(); 2246 var length = reactions.length; 2247 for (var i = 0; i < length; i++) { 2248 var reaction = reactions[i]; 2249 var flags = reaction.f; 2250 if (!runes && reaction === active_effect) continue; 2251 var not_dirty = (flags & DIRTY) === 0; 2252 if (not_dirty) set_signal_status(reaction, status); 2253 if ((flags & 131072) !== 0) eager_effects.add(reaction); 2254 else if ((flags & 2) !== 0) { 2255 var derived = reaction; 2256 batch_values?.delete(derived); 2257 if ((flags & 65536) === 0) { 2258 if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED; 2259 mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal); 2260 } 2261 } else if (not_dirty) { 2262 var effect = reaction; 2263 if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect); 2264 if (updated_during_traversal !== null) updated_during_traversal.push(effect); 2265 else schedule_effect(effect); 2266 } 2267 } 2268 } 2269 /** 2270 * @template T 2271 * @param {T} value 2272 * @returns {T} 2273 */ 2274 function proxy(value) { 2275 if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value; 2276 const prototype = get_prototype_of(value); 2277 if (prototype !== object_prototype && prototype !== array_prototype) return value; 2278 /** @type {Map<any, Source<any>>} */ 2279 var sources = /* @__PURE__ */ new Map(); 2280 var is_proxied_array = is_array(value); 2281 var version = /* @__PURE__ */ state(0); 2282 var stack = null; 2283 var parent_version = update_version; 2284 /** 2285 * Executes the proxy in the context of the reaction it was originally created in, if any 2286 * @template T 2287 * @param {() => T} fn 2288 */ 2289 var with_parent = (fn) => { 2290 if (update_version === parent_version) return fn(); 2291 var reaction = active_reaction; 2292 var version = update_version; 2293 set_active_reaction(null); 2294 set_update_version(parent_version); 2295 var result = fn(); 2296 set_active_reaction(reaction); 2297 set_update_version(version); 2298 return result; 2299 }; 2300 if (is_proxied_array) sources.set("length", /* @__PURE__ */ state( 2301 /** @type {any[]} */ 2302 value.length, 2303 stack 2304 )); 2305 return new Proxy(value, { 2306 defineProperty(_, prop, descriptor) { 2307 if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed(); 2308 var s = sources.get(prop); 2309 if (s === void 0) with_parent(() => { 2310 var s = /* @__PURE__ */ state(descriptor.value, stack); 2311 sources.set(prop, s); 2312 return s; 2313 }); 2314 else set(s, descriptor.value, true); 2315 return true; 2316 }, 2317 deleteProperty(target, prop) { 2318 var s = sources.get(prop); 2319 if (s === void 0) { 2320 if (prop in target) { 2321 const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack)); 2322 sources.set(prop, s); 2323 increment$1(version); 2324 } 2325 } else { 2326 set(s, UNINITIALIZED); 2327 increment$1(version); 2328 } 2329 return true; 2330 }, 2331 get(target, prop, receiver) { 2332 if (prop === STATE_SYMBOL) return value; 2333 var s = sources.get(prop); 2334 var exists = prop in target; 2335 if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) { 2336 s = with_parent(() => { 2337 return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack); 2338 }); 2339 sources.set(prop, s); 2340 } 2341 if (s !== void 0) { 2342 var v = get$2(s); 2343 return v === UNINITIALIZED ? void 0 : v; 2344 } 2345 return Reflect.get(target, prop, receiver); 2346 }, 2347 getOwnPropertyDescriptor(target, prop) { 2348 var descriptor = Reflect.getOwnPropertyDescriptor(target, prop); 2349 if (descriptor && "value" in descriptor) { 2350 var s = sources.get(prop); 2351 if (s) descriptor.value = get$2(s); 2352 } else if (descriptor === void 0) { 2353 var source = sources.get(prop); 2354 var value = source?.v; 2355 if (source !== void 0 && value !== UNINITIALIZED) return { 2356 enumerable: true, 2357 configurable: true, 2358 value, 2359 writable: true 2360 }; 2361 } 2362 return descriptor; 2363 }, 2364 has(target, prop) { 2365 if (prop === STATE_SYMBOL) return true; 2366 var s = sources.get(prop); 2367 var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop); 2368 if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) { 2369 if (s === void 0) { 2370 s = with_parent(() => { 2371 return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack); 2372 }); 2373 sources.set(prop, s); 2374 } 2375 if (get$2(s) === UNINITIALIZED) return false;
2376 } 2377 return has; 2378 }, 2379 set(target, prop, value, receiver) { 2380 var s = sources.get(prop); 2381 var has = prop in target; 2382 if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) { 2383 var other_s = sources.get(i + ""); 2384 if (other_s !== void 0) set(other_s, UNINITIALIZED); 2385 else if (i in target) { 2386 other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack)); 2387 sources.set(i + "", other_s); 2388 } 2389 } 2390 if (s === void 0) { 2391 if (!has || get_descriptor(target, prop)?.writable) { 2392 s = with_parent(() => /* @__PURE__ */ state(void 0, stack)); 2393 set(s, proxy(value)); 2394 sources.set(prop, s); 2395 } 2396 } else { 2397 has = s.v !== UNINITIALIZED; 2398 var p = with_parent(() => proxy(value)); 2399 set(s, p); 2400 } 2401 var descriptor = Reflect.getOwnPropertyDescriptor(target, prop); 2402 if (descriptor?.set) descriptor.set.call(receiver, value); 2403 if (!has) { 2404 if (is_proxied_array && typeof prop === "string") { 2405 var ls = sources.get("length"); 2406 var n = Number(prop); 2407 if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1); 2408 } 2409 increment$1(version); 2410 } 2411 return true; 2412 }, 2413 ownKeys(target) { 2414 get$2(version); 2415 var own_keys = Reflect.ownKeys(target).filter((key) => { 2416 var source = sources.get(key); 2417 return source === void 0 || source.v !== UNINITIALIZED; 2418 }); 2419 for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key); 2420 return own_keys; 2421 }, 2422 setPrototypeOf() { 2423 state_prototype_fixed(); 2424 } 2425 }); 2426 } 2427 /** 2428 * @param {any} value 2429 */ 2430 function get_proxied_value(value) { 2431 try { 2432 if (value !== null && typeof value === "object" && STATE_SYMBOL in value) return value[STATE_SYMBOL]; 2433 } catch {} 2434 return value; 2435 } 2436 /** 2437 * @param {any} a 2438 * @param {any} b 2439 */ 2440 function is(a, b) { 2441 return Object.is(get_proxied_value(a), get_proxied_value(b)); 2442 } 2443 new Set([ 2444 "copyWithin", 2445 "fill", 2446 "pop", 2447 "push", 2448 "reverse", 2449 "shift", 2450 "sort", 2451 "splice", 2452 "unshift" 2453 ]); 2454 //#endregion 2455 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/operations.js 2456 /** @import { Effect, TemplateNode } from '#client' */ 2457 /** @type {Window} */ 2458 var $window; 2459 /** @type {boolean} */ 2460 var is_firefox; 2461 /** @type {() => Node | null} */ 2462 var first_child_getter; 2463 /** @type {() => Node | null} */ 2464 var next_sibling_getter; 2465 /** 2466 * Initialize these lazily to avoid issues when using the runtime in a server context 2467 * where these globals are not available while avoiding a separate server entry point 2468 */ 2469 function init_operations() { 2470 if ($window !== void 0) return; 2471 $window = window; 2472 is_firefox = /Firefox/.test(navigator.userAgent); 2473 var element_prototype = Element.prototype; 2474 var node_prototype = Node.prototype; 2475 var text_prototype = Text.prototype; 2476 first_child_getter = get_descriptor(node_prototype, "firstChild").get; 2477 next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get; 2478 if (is_extensible(element_prototype)) { 2479 /** @type {any} */ element_prototype[CLASS_CACHE] = void 0; 2480 /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null; 2481 /** @type {any} */ element_prototype[STYLE_CACHE] = void 0; 2482 element_prototype.__e = void 0; 2483 } 2484 if (is_extensible(text_prototype)) 2485 /** @type {any} */ text_prototype[TEXT_CACHE] = void 0; 2486 } 2487 /** 2488 * @param {string} value 2489 * @returns {Text} 2490 */ 2491 function create_text(value = "") { 2492 return document.createTextNode(value); 2493 } 2494 /** 2495 * @template {Node} N 2496 * @param {N} node 2497 */ 2498 /*@__NO_SIDE_EFFECTS__*/ 2499 function get_first_child(node) { 2500 return first_child_getter.call(node); 2501 } 2502 /** 2503 * @template {Node} N 2504 * @param {N} node 2505 */ 2506 /*@__NO_SIDE_EFFECTS__*/ 2507 function get_next_sibling(node) { 2508 return next_sibling_getter.call(node); 2509 } 2510 /** 2511 * Don't mark this as side-effect-free, hydration needs to walk all nodes 2512 * @template {Node} N 2513 * @param {N} node 2514 * @param {boolean} is_text 2515 * @returns {TemplateNode | null} 2516 */ 2517 function child(node, is_text) { 2518 if (!hydrating) return /* @__PURE__ */ get_first_child(node); 2519 var child = /* @__PURE__ */ get_first_child(hydrate_node); 2520 if (child === null) child = hydrate_node.appendChild(create_text()); 2521 else if (is_text && child.nodeType !== 3) { 2522 var text = create_text(); 2523 child?.before(text); 2524 set_hydrate_node(text); 2525 return text; 2526 } 2527 if (is_text) merge_text_nodes(child); 2528 set_hydrate_node(child); 2529 return child; 2530 } 2531 /** 2532 * Don't mark this as side-effect-free, hydration needs to walk all nodes 2533 * @param {TemplateNode} node 2534 * @param {boolean} [is_text] 2535 * @returns {TemplateNode | null} 2536 */ 2537 function first_child(node, is_text = false) { 2538 if (!hydrating) { 2539 var first = /* @__PURE__ */ get_first_child(node); 2540 if (first instanceof Comment && first.data === "") return /* @__PURE__ */ get_next_sibling(first); 2541 return first; 2542 } 2543 if (is_text) {
2544 if (hydrate_node?.nodeType !== 3) { 2545 var text = create_text(); 2546 hydrate_node?.before(text); 2547 set_hydrate_node(text); 2548 return text; 2549 } 2550 merge_text_nodes(hydrate_node); 2551 } 2552 return hydrate_node; 2553 } 2554 /** 2555 * Don't mark this as side-effect-free, hydration needs to walk all nodes 2556 * @param {TemplateNode} node 2557 * @param {number} count 2558 * @param {boolean} is_text 2559 * @returns {TemplateNode | null} 2560 */ 2561 function sibling(node, count = 1, is_text = false) { 2562 let next_sibling = hydrating ? hydrate_node : node; 2563 var last_sibling; 2564 while (count--) { 2565 last_sibling = next_sibling; 2566 next_sibling = /* @__PURE__ */ get_next_sibling(next_sibling); 2567 } 2568 if (!hydrating) return next_sibling; 2569 if (is_text) { 2570 if (next_sibling?.nodeType !== 3) { 2571 var text = create_text(); 2572 if (next_sibling === null) last_sibling?.after(text); 2573 else next_sibling.before(text); 2574 set_hydrate_node(text); 2575 return text; 2576 } 2577 merge_text_nodes(next_sibling); 2578 } 2579 set_hydrate_node(next_sibling); 2580 return next_sibling; 2581 } 2582 /** 2583 * @template {Node} N 2584 * @param {N} node 2585 * @returns {void} 2586 */ 2587 function clear_text_content(node) { 2588 node.textContent = ""; 2589 } 2590 /** 2591 * Returns `true` if we're updating the current block, for example `condition` in 2592 * an `{#if condition}` block just changed. In this case, the branch should be 2593 * appended (or removed) at the same time as other updates within the 2594 * current `<svelte:boundary>` 2595 */ 2596 function should_defer_append() { 2597 if (!async_mode_flag) return false; 2598 if (eager_block_effects !== null) return false; 2599 return (active_effect.f & REACTION_RAN) !== 0; 2600 } 2601 /** 2602 * Branching here is intentional and load-bearing for perf. `createElement(tag)` 2603 * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't, 2604 * and passing an explicit `undefined` as the trailing options arg measurably 2605 * slows both APIs. Funnelling every case through a single `createElementNS(ns, 2606 * tag, options)` call would be smaller but slower on the HTML path. 2607 * 2608 * @template {keyof HTMLElementTagNameMap | string} T 2609 * @param {T} tag 2610 * @param {string} [namespace] 2611 * @param {string} [is] 2612 * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} 2613 */ 2614 function create_element(tag, namespace, is) { 2615 if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag); 2616 return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag); 2617 } 2618 /** 2619 * @param {string} data 2620 * @returns 2621 */ 2622 function create_comment(data = "") { 2623 return document.createComment(data); 2624 } 2625 /** 2626 * Browsers split text nodes larger than 65536 bytes when parsing. 2627 * For hydration to succeed, we need to stitch them back together 2628 * @param {Text} text 2629 */ 2630 function merge_text_nodes(text) { 2631 if (text.nodeValue.length < 65536) return; 2632 let next = text.nextSibling; 2633 while (next !== null && next.nodeType === 3) { 2634 next.remove(); 2635 /** @type {string} */ text.nodeValue += next.nodeValue; 2636 next = text.nextSibling; 2637 } 2638 } 2639 //#endregion 2640 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/misc.js 2641 /** 2642 * @param {HTMLElement} dom 2643 * @param {boolean} value 2644 * @returns {void} 2645 */ 2646 function autofocus(dom, value) { 2647 if (value) { 2648 const body = document.body; 2649 dom.autofocus = true; 2650 queue_micro_task(() => { 2651 if (document.activeElement === body) dom.focus(); 2652 }); 2653 } 2654 } 2655 /** 2656 * The child of a textarea actually corresponds to the defaultValue property, so we need 2657 * to remove it upon hydration to avoid a bug when someone resets the form value. 2658 * @param {HTMLTextAreaElement} dom 2659 * @returns {void} 2660 */ 2661 function remove_textarea_child(dom) { 2662 if (hydrating && /* @__PURE__ */ get_first_child(dom) !== null) clear_text_content(dom); 2663 } 2664 var listening_to_form_reset = false; 2665 function add_form_reset_listener() { 2666 if (!listening_to_form_reset) { 2667 listening_to_form_reset = true; 2668 document.addEventListener("reset", (evt) => { 2669 Promise.resolve().then(() => { 2670 if (!evt.defaultPrevented) for (const e of evt.target.elements) 2671 /** @type {any} */ e[FORM_RESET_HANDLER]?.(); 2672 }); 2673 }, { capture: true }); 2674 } 2675 } 2676 //#endregion 2677 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js 2678 /** 2679 * @template T 2680 * @param {() => T} fn 2681 */ 2682 function without_reactive_context(fn) { 2683 var previous_reaction = active_reaction; 2684 var previous_effect = active_effect; 2685 set_active_reaction(null); 2686 set_active_effect(null); 2687 try { 2688 return fn(); 2689 } finally { 2690 set_active_reaction(previous_reaction); 2691 set_active_effect(previous_effect); 2692 } 2693 } 2694 /** 2695 * Listen to the given event, and then instantiate a global form reset listener if not already done, 2696 * to notify all bindings when the form is reset 2697 * @param {HTMLElement} element 2698 * @param {string} event 2699 * @param {(is_reset?: true) => void} handler 2700 * @param {(is_reset?: true) => void} [on_reset] 2701 */ 2702 function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) { 2703 element.addEventListener(event, () => without_reactive_context(handler)); 2704 const prev = element[FORM_RESET_HANDLER]; 2705 if (prev) 2706 /** @type {any} */ element[FORM_RESET_HANDLER] = () => { 2707 prev(); 2708 on_reset(true); 2709 }; 2710 else 2711 /** @type {any} */ element[FORM_RESET_HANDLER] = () => on_reset(true); 2712 add_form_reset_listener(); 2713 } 2714 //#endregion 2715 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/effects.js 2716 /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */ 2717 /** 2718 * @param {'$effect' | '$effect.pre' | '$inspect'} rune 2719 */ 2720 function validate_effect(rune) { 2721 if (active_effect === null) { 2722 if (active_reaction === null) effect_orphan(rune); 2723 effect_in_unowned_derived(); 2724 }
2725 if (is_destroying_effect) effect_in_teardown(rune); 2726 } 2727 /** 2728 * @param {Effect} effect 2729 * @param {Effect} parent_effect 2730 */ 2731 function push_effect(effect, parent_effect) { 2732 var parent_last = parent_effect.last; 2733 if (parent_last === null) parent_effect.last = parent_effect.first = effect; 2734 else { 2735 parent_last.next = effect; 2736 effect.prev = parent_last; 2737 parent_effect.last = effect; 2738 } 2739 } 2740 /** 2741 * @param {number} type 2742 * @param {null | (() => void | (() => void))} fn 2743 * @returns {Effect} 2744 */ 2745 function create_effect(type, fn) { 2746 var parent = active_effect; 2747 if (parent !== null && (parent.f & 8192) !== 0) type |= INERT; 2748 /** @type {Effect} */ 2749 var effect = { 2750 ctx: component_context, 2751 deps: null, 2752 nodes: null, 2753 f: type | DIRTY | 512, 2754 first: null, 2755 fn, 2756 last: null, 2757 next: null, 2758 parent, 2759 b: parent && parent.b, 2760 prev: null, 2761 teardown: null, 2762 wv: 0, 2763 ac: null 2764 }; 2765 current_batch?.register_created_effect(effect); 2766 /** @type {Effect | null} */ 2767 var e = effect; 2768 if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect); 2769 else Batch.ensure().schedule(effect); 2770 else if (fn !== null) { 2771 try { 2772 update_effect(effect); 2773 } catch (e) { 2774 destroy_effect(effect); 2775 throw e; 2776 } 2777 if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) { 2778 e = e.first; 2779 if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT; 2780 } 2781 } 2782 if (e !== null) { 2783 e.parent = parent; 2784 if (parent !== null) push_effect(e, parent); 2785 if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) { 2786 var derived = active_reaction; 2787 (derived.effects ??= []).push(e); 2788 } 2789 } 2790 return effect; 2791 } 2792 /** 2793 * Internal representation of `$effect.tracking()` 2794 * @returns {boolean} 2795 */ 2796 function effect_tracking() { 2797 return active_reaction !== null && !untracking; 2798 } 2799 /** 2800 * @param {() => void} fn 2801 */ 2802 function teardown(fn) { 2803 const effect = create_effect(8, null); 2804 set_signal_status(effect, CLEAN); 2805 effect.teardown = fn; 2806 return effect; 2807 } 2808 /** 2809 * Internal representation of `$effect(...)` 2810 * @param {() => void | (() => void)} fn 2811 */ 2812 function user_effect(fn) { 2813 validate_effect("$effect"); 2814 var flags = active_effect.f; 2815 if (!active_reaction && (flags & 32) !== 0 && component_context !== null && !component_context.i) { 2816 var context = component_context; 2817 (context.e ??= []).push(fn); 2818 } else return create_user_effect(fn); 2819 } 2820 /** 2821 * @param {() => void | (() => void)} fn 2822 */ 2823 function create_user_effect(fn) { 2824 return create_effect(4 | USER_EFFECT, fn); 2825 } 2826 /** 2827 * Internal representation of `$effect.pre(...)` 2828 * @param {() => void | (() => void)} fn 2829 * @returns {Effect} 2830 */ 2831 function user_pre_effect(fn) { 2832 validate_effect("$effect.pre"); 2833 return create_effect(8 | USER_EFFECT, fn); 2834 } 2835 /** 2836 * Internal representation of `$effect.root(...)` 2837 * @param {() => void | (() => void)} fn 2838 * @returns {() => void} 2839 */ 2840 function effect_root(fn) { 2841 Batch.ensure(); 2842 const effect = create_effect(64 | EFFECT_PRESERVED, fn); 2843 return () => { 2844 destroy_effect(effect); 2845 }; 2846 } 2847 /** 2848 * An effect root whose children can transition out 2849 * @param {() => void} fn 2850 * @returns {(options?: { outro?: boolean }) => Promise<void>} 2851 */ 2852 function component_root(fn) { 2853 Batch.ensure(); 2854 const effect = create_effect(64 | EFFECT_PRESERVED, fn); 2855 return (options = {}) => { 2856 return new Promise((fulfil) => { 2857 if (options.outro) pause_effect(effect, () => { 2858 destroy_effect(effect); 2859 fulfil(void 0); 2860 }); 2861 else { 2862 destroy_effect(effect); 2863 fulfil(void 0); 2864 } 2865 }); 2866 }; 2867 } 2868 /** 2869 * @param {() => void | (() => void)} fn 2870 * @returns {Effect} 2871 */ 2872 function effect(fn) { 2873 return create_effect(4, fn); 2874 } 2875 /** 2876 * @param {() => void | (() => void)} fn 2877 * @returns {Effect} 2878 */ 2879 function async_effect(fn) { 2880 return create_effect(ASYNC | EFFECT_PRESERVED, fn); 2881 } 2882 /** 2883 * @param {() => void | (() => void)} fn 2884 * @returns {Effect} 2885 */ 2886 function render_effect(fn, flags = 0) { 2887 return create_effect(8 | flags, fn); 2888 } 2889 /** 2890 * @param {(...expressions: any) => void | (() => void)} fn 2891 * @param {Array<() => any>} sync 2892 * @param {Array<() => Promise<any>>} async 2893 * @param {Blocker[]} blockers 2894 */ 2895 function template_effect(fn, sync = [], async = [], blockers = []) { 2896 flatten(blockers, sync, async, (values) => { 2897 create_effect(8, () => { 2898 fn(...values.map(get$2)); 2899 }); 2900 }); 2901 } 2902 /** 2903 * @param {(() => void)} fn 2904 * @param {number} flags 2905 */ 2906 function block(fn, flags = 0) { 2907 return create_effect(16 | flags, fn); 2908 } 2909 /** 2910 * @param {(() => void)} fn 2911 * @param {number} flags 2912 */ 2913 function managed(fn, flags = 0) { 2914 return create_effect(MANAGED_EFFECT | flags, fn); 2915 } 2916 /** 2917 * @param {(() => void)} fn 2918 */ 2919 function branch(fn) { 2920 return create_effect(32 | EFFECT_PRESERVED, fn); 2921 } 2922 /** 2923 * @param {Effect} effect 2924 */ 2925 function execute_effect_teardown(effect) { 2926 var teardown = effect.teardown; 2927 if (teardown !== null) { 2928 const previously_destroying_effect = is_destroying_effect; 2929 const previous_reaction = active_reaction; 2930 set_is_destroying_effect(true); 2931 set_active_reaction(null); 2932 try { 2933 teardown.call(null); 2934 } finally { 2935 set_is_destroying_effect(previously_destroying_effect); 2936 set_active_reaction(previous_reaction); 2937 } 2938 } 2939 } 2940 /** 2941 * @param {Effect} signal 2942 * @param {boolean} remove_dom 2943 * @returns {void} 2944 */ 2945 function destroy_effect_children(signal, remove_dom = false) { 2946 var effect = signal.first; 2947 signal.first = signal.last = null; 2948 while (effect !== null) { 2949 const controller = effect.ac; 2950 if (controller !== null) without_reactive_context(() => { 2951 controller.abort(STALE_REACTION); 2952 }); 2953 var next = effect.next; 2954 if ((effect.f & 64) !== 0) effect.parent = null; 2955 else destroy_effect(effect, remove_dom); 2956 effect = next; 2957 } 2958 } 2959 /** 2960 * @param {Effect} signal 2961 * @returns {void} 2962 */ 2963 function destroy_block_effect_children(signal) { 2964 var effect = signal.first; 2965 while (effect !== null) { 2966 var next = effect.next; 2967 if ((effect.f & 32) === 0) destroy_effect(effect); 2968 effect = next; 2969 } 2970 } 2971 /** 2972 * @param {Effect} effect 2973 * @param {boolean} [remove_dom] 2974 * @returns {void} 2975 */ 2976 function destroy_effect(effect, remove_dom = true) { 2977 var removed = false;
2978 if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) { 2979 remove_effect_dom(effect.nodes.start, effect.nodes.end); 2980 removed = true; 2981 } 2982 effect.f |= DESTROYING; 2983 destroy_effect_children(effect, remove_dom && !removed); 2984 remove_reactions(effect, 0); 2985 var transitions = effect.nodes && effect.nodes.t; 2986 if (transitions !== null) for (const transition of transitions) transition.stop(); 2987 execute_effect_teardown(effect); 2988 effect.f ^= DESTROYING; 2989 effect.f |= DESTROYED; 2990 var parent = effect.parent; 2991 if (parent !== null && parent.first !== null) unlink_effect(effect); 2992 effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null; 2993 } 2994 /** 2995 * 2996 * @param {TemplateNode | null} node 2997 * @param {TemplateNode} end 2998 */ 2999 function remove_effect_dom(node, end) { 3000 while (node !== null) { 3001 /** @type {TemplateNode | null} */ 3002 var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node); 3003 node.remove(); 3004 node = next; 3005 } 3006 } 3007 /** 3008 * Detach an effect from the effect tree, freeing up memory and 3009 * reducing the amount of work that happens on subsequent traversals 3010 * @param {Effect} effect 3011 */ 3012 function unlink_effect(effect) { 3013 var parent = effect.parent; 3014 var prev = effect.prev; 3015 var next = effect.next; 3016 if (prev !== null) prev.next = next; 3017 if (next !== null) next.prev = prev; 3018 if (parent !== null) { 3019 if (parent.first === effect) parent.first = next; 3020 if (parent.last === effect) parent.last = prev; 3021 } 3022 } 3023 /** 3024 * When a block effect is removed, we don't immediately destroy it or yank it 3025 * out of the DOM, because it might have transitions. Instead, we 'pause' it. 3026 * It stays around (in memory, and in the DOM) until outro transitions have 3027 * completed, and if the state change is reversed then we _resume_ it. 3028 * A paused effect does not update, and the DOM subtree becomes inert. 3029 * @param {Effect} effect 3030 * @param {() => void} [callback] 3031 * @param {boolean} [destroy] 3032 */ 3033 function pause_effect(effect, callback, destroy = true) { 3034 /** @type {TransitionManager[]} */ 3035 var transitions = []; 3036 pause_children(effect, transitions, true); 3037 var fn = () => { 3038 if (destroy) destroy_effect(effect); 3039 if (callback) callback(); 3040 }; 3041 var remaining = transitions.length; 3042 if (remaining > 0) { 3043 var check = () => --remaining || fn(); 3044 for (var transition of transitions) transition.out(check); 3045 } else fn(); 3046 } 3047 /** 3048 * @param {Effect} effect 3049 * @param {TransitionManager[]} transitions 3050 * @param {boolean} local 3051 */ 3052 function pause_children(effect, transitions, local) { 3053 if ((effect.f & 8192) !== 0) return; 3054 effect.f ^= INERT; 3055 var t = effect.nodes && effect.nodes.t; 3056 if (t !== null) { 3057 for (const transition of t) if (transition.is_global || local) transitions.push(transition); 3058 } 3059 var child = effect.first; 3060 while (child !== null) { 3061 var sibling = child.next; 3062 if ((child.f & 64) === 0) { 3063 var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0; 3064 pause_children(child, transitions, transparent ? local : false); 3065 } 3066 child = sibling; 3067 } 3068 } 3069 /** 3070 * The opposite of `pause_effect`. We call this if (for example) 3071 * `x` becomes falsy then truthy: `{#if x}...{/if}` 3072 * @param {Effect} effect 3073 */ 3074 function resume_effect(effect) { 3075 resume_children(effect, true); 3076 } 3077 /** 3078 * @param {Effect} effect 3079 * @param {boolean} local 3080 */ 3081 function resume_children(effect, local) { 3082 if ((effect.f & 8192) === 0) return; 3083 effect.f ^= INERT; 3084 if ((effect.f & 1024) === 0) { 3085 set_signal_status(effect, DIRTY); 3086 Batch.ensure().schedule(effect); 3087 } 3088 var child = effect.first; 3089 while (child !== null) { 3090 var sibling = child.next; 3091 var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0; 3092 resume_children(child, transparent ? local : false); 3093 child = sibling; 3094 } 3095 var t = effect.nodes && effect.nodes.t; 3096 if (t !== null) { 3097 for (const transition of t) if (transition.is_global || local) transition.in(); 3098 } 3099 } 3100 /** 3101 * @param {Effect} effect 3102 * @param {DocumentFragment} fragment 3103 */ 3104 function move_effect(effect, fragment) { 3105 if (!effect.nodes) return; 3106 /** @type {TemplateNode | null} */ 3107 var node = effect.nodes.start; 3108 var end = effect.nodes.end; 3109 while (node !== null) { 3110 /** @type {TemplateNode | null} */ 3111 var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node); 3112 fragment.append(node); 3113 node = next; 3114 } 3115 } 3116 //#endregion 3117 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/legacy.js 3118 /** 3119 * @type {Set<Value> | null} 3120 * @deprecated 3121 */ 3122 var captured_signals = null; 3123 //#endregion 3124 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/runtime.js
3125 /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */ 3126 var is_updating_effect = false; 3127 var is_destroying_effect = false; 3128 /** @param {boolean} value */ 3129 function set_is_destroying_effect(value) { 3130 is_destroying_effect = value; 3131 } 3132 /** @type {null | Reaction} */ 3133 var active_reaction = null; 3134 var untracking = false; 3135 /** @param {null | Reaction} reaction */ 3136 function set_active_reaction(reaction) { 3137 active_reaction = reaction; 3138 } 3139 /** @type {null | Effect} */ 3140 var active_effect = null; 3141 /** @param {null | Effect} effect */ 3142 function set_active_effect(effect) { 3143 active_effect = effect; 3144 } 3145 /** 3146 * When sources are created within a reaction, reading and writing 3147 * them within that reaction should not cause a re-run 3148 * @type {null | Set<Source>} 3149 */ 3150 var current_sources = null; 3151 /** @param {Value} value */ 3152 function push_reaction_value(value) { 3153 if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ??= /* @__PURE__ */ new Set()).add(value); 3154 } 3155 /** 3156 * The dependencies of the reaction that is currently being executed. In many cases, 3157 * the dependencies are unchanged between runs, and so this will be `null` unless
3158 * and until a new dependency is accessed â we track this via `skipped_deps` 3159 * @type {null | Value[]} 3160 */ 3161 var new_deps = null; 3162 var skipped_deps = 0; 3163 /** 3164 * Tracks writes that the effect it's executed in doesn't listen to yet, 3165 * so that the dependency can be added to the effect later on if it then reads it 3166 * @type {null | Source[]} 3167 */ 3168 var untracked_writes = null; 3169 /** @param {null | Source[]} value */ 3170 function set_untracked_writes(value) { 3171 untracked_writes = value; 3172 } 3173 /** 3174 * @type {number} Used by sources and deriveds for handling updates. 3175 * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing 3176 **/ 3177 var write_version = 1; 3178 /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */ 3179 var read_version = 0; 3180 var update_version = read_version; 3181 /** @param {number} value */ 3182 function set_update_version(value) { 3183 update_version = value; 3184 } 3185 function increment_write_version() { 3186 return ++write_version; 3187 } 3188 /** 3189 * Determines whether a derived or effect is dirty. 3190 * If it is MAYBE_DIRTY, will set the status to CLEAN 3191 * @param {Reaction} reaction 3192 * @returns {boolean} 3193 */ 3194 function is_dirty(reaction) { 3195 var flags = reaction.f; 3196 if ((flags & 2048) !== 0) return true; 3197 if (flags & 2) reaction.f &= ~WAS_MARKED; 3198 if ((flags & 4096) !== 0) { 3199 var dependencies = reaction.deps; 3200 var length = dependencies.length; 3201 for (var i = 0; i < length; i++) { 3202 var dependency = dependencies[i]; 3203 if (is_dirty(dependency)) update_derived(dependency); 3204 if (dependency.wv > reaction.wv) return true; 3205 } 3206 if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN); 3207 } 3208 return false; 3209 } 3210 /** 3211 * @param {Value} signal 3212 * @param {Effect} effect 3213 * @param {boolean} [root] 3214 */ 3215 function schedule_possible_effect_self_invalidation(signal, effect, root = true) { 3216 var reactions = signal.reactions; 3217 if (reactions === null) return; 3218 if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return; 3219 for (var i = 0; i < reactions.length; i++) { 3220 var reaction = reactions[i]; 3221 if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false); 3222 else if (effect === reaction) { 3223 if (root) set_signal_status(reaction, DIRTY); 3224 else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY); 3225 schedule_effect(reaction); 3226 } 3227 } 3228 } 3229 /** @param {Reaction} reaction */ 3230 function update_reaction(reaction) { 3231 var previous_deps = new_deps; 3232 var previous_skipped_deps = skipped_deps; 3233 var previous_untracked_writes = untracked_writes; 3234 var previous_reaction = active_reaction; 3235 var previous_sources = current_sources; 3236 var previous_component_context = component_context; 3237 var previous_untracking = untracking; 3238 var previous_update_version = update_version; 3239 var flags = reaction.f; 3240 new_deps = null; 3241 skipped_deps = 0; 3242 untracked_writes = null; 3243 active_reaction = (flags & 96) === 0 ? reaction : null; 3244 current_sources = null; 3245 set_component_context(reaction.ctx); 3246 untracking = false; 3247 update_version = ++read_version; 3248 if (reaction.ac !== null) { 3249 without_reactive_context(() => { 3250 /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION); 3251 }); 3252 reaction.ac = null; 3253 } 3254 try { 3255 reaction.f |= REACTION_IS_UPDATING; 3256 var fn = reaction.fn; 3257 var result = fn(); 3258 reaction.f |= REACTION_RAN; 3259 var deps = reaction.deps; 3260 var is_fork = current_batch?.is_fork; 3261 if (new_deps !== null) { 3262 var i; 3263 if (!is_fork) remove_reactions(reaction, skipped_deps); 3264 if (deps !== null && skipped_deps > 0) { 3265 deps.length = skipped_deps + new_deps.length; 3266 for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i]; 3267 } else reaction.deps = deps = new_deps; 3268 if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction); 3269 } else if (!is_fork && deps !== null && skipped_deps < deps.length) { 3270 remove_reactions(reaction, skipped_deps); 3271 deps.length = skipped_deps; 3272 } 3273 if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction); 3274 if (previous_reaction !== null && previous_reaction !== reaction) { 3275 read_version++; 3276 if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version; 3277 if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version; 3278 if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes; 3279 else previous_untracked_writes.push(...untracked_writes); 3280 } 3281 if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE; 3282 return result; 3283 } catch (error) { 3284 return handle_error(error); 3285 } finally { 3286 reaction.f ^= REACTION_IS_UPDATING; 3287 new_deps = previous_deps; 3288 skipped_deps = previous_skipped_deps; 3289 untracked_writes = previous_untracked_writes; 3290 active_reaction = previous_reaction; 3291 current_sources = previous_sources; 3292 set_component_context(previous_component_context); 3293 untracking = previous_untracking; 3294 update_version = previous_update_version; 3295 } 3296 } 3297 /** 3298 * @template V 3299 * @param {Reaction} signal 3300 * @param {Value<V>} dependency 3301 * @returns {void} 3302 */ 3303 function remove_reaction(signal, dependency) {
3304 let reactions = dependency.reactions; 3305 if (reactions !== null) { 3306 var index = index_of.call(reactions, signal); 3307 if (index !== -1) { 3308 var new_length = reactions.length - 1; 3309 if (new_length === 0) reactions = dependency.reactions = null; 3310 else { 3311 reactions[index] = reactions[new_length]; 3312 reactions.pop(); 3313 } 3314 } 3315 } 3316 if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) { 3317 var derived = dependency; 3318 if ((derived.f & 512) !== 0) { 3319 derived.f ^= 512; 3320 derived.f &= ~WAS_MARKED; 3321 } 3322 if (derived.v !== UNINITIALIZED) update_derived_status(derived); 3323 freeze_derived_effects(derived); 3324 remove_reactions(derived, 0); 3325 } 3326 } 3327 /** 3328 * @param {Reaction} signal 3329 * @param {number} start_index 3330 * @returns {void} 3331 */ 3332 function remove_reactions(signal, start_index) { 3333 var dependencies = signal.deps; 3334 if (dependencies === null) return; 3335 for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]); 3336 } 3337 /** 3338 * @param {Effect} effect 3339 * @returns {void} 3340 */ 3341 function update_effect(effect) { 3342 var flags = effect.f; 3343 if ((flags & 16384) !== 0) return; 3344 set_signal_status(effect, CLEAN); 3345 var previous_effect = active_effect; 3346 var was_updating_effect = is_updating_effect; 3347 active_effect = effect; 3348 is_updating_effect = true; 3349 try { 3350 if ((flags & 16777232) !== 0) destroy_block_effect_children(effect); 3351 else destroy_effect_children(effect); 3352 execute_effect_teardown(effect); 3353 var teardown = update_reaction(effect); 3354 effect.teardown = typeof teardown === "function" ? teardown : null; 3355 effect.wv = write_version; 3356 } finally { 3357 is_updating_effect = was_updating_effect; 3358 active_effect = previous_effect; 3359 } 3360 } 3361 /** 3362 * Returns a promise that resolves once any pending state changes have been applied. 3363 * @returns {Promise<void>} 3364 */ 3365 async function tick() { 3366 if (async_mode_flag) return new Promise((f) => { 3367 requestAnimationFrame(() => f()); 3368 setTimeout(() => f()); 3369 }); 3370 await Promise.resolve(); 3371 flushSync(); 3372 } 3373 /** 3374 * @template V 3375 * @param {Value<V>} signal 3376 * @returns {V} 3377 */ 3378 function get$2(signal) { 3379 var is_derived = (signal.f & 2) !== 0; 3380 captured_signals?.add(signal); 3381 if (active_reaction !== null && !untracking) { 3382 if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) { 3383 var deps = active_reaction.deps; 3384 if ((active_reaction.f & 2097152) !== 0) { 3385 if (signal.rv < read_version) { 3386 signal.rv = read_version; 3387 if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++; 3388 else if (new_deps === null) new_deps = [signal]; 3389 else new_deps.push(signal); 3390 } 3391 } else { 3392 active_reaction.deps ??= []; 3393 if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal); 3394 var reactions = signal.reactions; 3395 if (reactions === null) signal.reactions = [active_reaction]; 3396 else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction); 3397 } 3398 } 3399 } 3400 if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal); 3401 if (is_derived) { 3402 var derived = signal; 3403 if (is_destroying_effect) { 3404 var value = derived.v; 3405 if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived); 3406 old_values.set(derived, value); 3407 return value; 3408 } 3409 var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0); 3410 var is_new = (derived.f & REACTION_RAN) === 0; 3411 if (is_dirty(derived)) { 3412 if (should_connect) derived.f |= 512; 3413 update_derived(derived); 3414 } 3415 if (should_connect && !is_new) { 3416 unfreeze_derived_effects(derived); 3417 reconnect(derived); 3418 } 3419 } 3420 if (batch_values?.has(signal)) return batch_values.get(signal); 3421 if ((signal.f & 8388608) !== 0) throw signal.v; 3422 return signal.v; 3423 } 3424 /** 3425 * (Re)connect a disconnected derived, so that it is notified 3426 * of changes in `mark_reactions` 3427 * @param {Derived} derived 3428 */ 3429 function reconnect(derived) { 3430 derived.f |= 512; 3431 if (derived.deps === null) return; 3432 for (const dep of derived.deps) { 3433 (dep.reactions ??= []).push(derived); 3434 if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) { 3435 unfreeze_derived_effects(dep); 3436 reconnect(dep); 3437 } 3438 } 3439 } 3440 /** @param {Derived} derived */ 3441 function depends_on_old_values(derived) { 3442 if (derived.v === UNINITIALIZED) return true; 3443 if (derived.deps === null) return false;
3444 for (const dep of derived.deps) { 3445 if (old_values.has(dep)) return true; 3446 if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true; 3447 } 3448 return false; 3449 } 3450 /** 3451 * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect), 3452 * any state read inside `fn` will not be treated as a dependency. 3453 * 3454 * ```ts 3455 * $effect(() => { 3456 * // this will run when `data` changes, but not when `time` changes 3457 * save(data, { 3458 * timestamp: untrack(() => time) 3459 * }); 3460 * }); 3461 * ``` 3462 * @template T 3463 * @param {() => T} fn 3464 * @returns {T} 3465 */ 3466 function untrack(fn) { 3467 var previous_untracking = untracking; 3468 try { 3469 untracking = true; 3470 return fn(); 3471 } finally { 3472 untracking = previous_untracking; 3473 } 3474 } 3475 /** 3476 * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`. 3477 * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases). 3478 * @param {any} value 3479 * @returns {void} 3480 */ 3481 function deep_read_state(value) { 3482 if (typeof value !== "object" || !value || value instanceof EventTarget) return; 3483 if (STATE_SYMBOL in value) deep_read(value); 3484 else if (!Array.isArray(value)) for (let key in value) { 3485 const prop = value[key]; 3486 if (typeof prop === "object" && prop && STATE_SYMBOL in prop) deep_read(prop); 3487 } 3488 } 3489 /** 3490 * Deeply traverse an object and read all its properties 3491 * so that they're all reactive in case this is `$state` 3492 * @param {any} value 3493 * @param {Set<any>} visited 3494 * @returns {void} 3495 */ 3496 function deep_read(value, visited = /* @__PURE__ */ new Set()) { 3497 if (typeof value === "object" && value !== null && !(value instanceof EventTarget) && !visited.has(value)) { 3498 visited.add(value); 3499 if (value instanceof Date) value.getTime(); 3500 for (let key in value) try { 3501 deep_read(value[key], visited); 3502 } catch (e) {} 3503 const proto = get_prototype_of(value); 3504 if (proto !== Object.prototype && proto !== Array.prototype && proto !== Map.prototype && proto !== Set.prototype && proto !== Date.prototype) { 3505 const descriptors = get_descriptors(proto); 3506 for (let key in descriptors) { 3507 const get = descriptors[key].get; 3508 if (get) try { 3509 get.call(value); 3510 } catch (e) {} 3511 } 3512 } 3513 } 3514 } 3515 //#endregion 3516 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/events.js 3517 /** 3518 * Used on elements, as a map of event type -> event handler, 3519 * and on events themselves to track which element handled an event 3520 */ 3521 var event_symbol = Symbol("events"); 3522 /** @type {Set<string>} */ 3523 var all_registered_events = /* @__PURE__ */ new Set(); 3524 /** @type {Set<(events: Array<string>) => void>} */ 3525 var root_event_handles = /* @__PURE__ */ new Set(); 3526 /** 3527 * @param {string} event_name 3528 * @param {EventTarget} dom 3529 * @param {EventListener} [handler] 3530 * @param {AddEventListenerOptions} [options] 3531 */ 3532 function create_event(event_name, dom, handler, options = {}) { 3533 /** 3534 * @this {EventTarget} 3535 */ 3536 function target_handler(event) { 3537 if (!options.capture) handle_event_propagation.call(dom, event); 3538 if (!event.cancelBubble) return without_reactive_context(() => { 3539 return handler?.call(this, event); 3540 }); 3541 } 3542 if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") queue_micro_task(() => { 3543 dom.addEventListener(event_name, target_handler, options); 3544 }); 3545 else dom.addEventListener(event_name, target_handler, options); 3546 return target_handler; 3547 } 3548 /** 3549 * Attaches an event handler to an element and returns a function that removes the handler. Using this 3550 * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively 3551 * (with attributes like `onclick`), which use event delegation for performance reasons 3552 * 3553 * @param {EventTarget} element 3554 * @param {string} type 3555 * @param {EventListener} handler 3556 * @param {AddEventListenerOptions} [options] 3557 */ 3558 function on(element, type, handler, options = {}) { 3559 var target_handler = create_event(type, element, handler, options); 3560 return () => { 3561 element.removeEventListener(type, target_handler, options); 3562 }; 3563 } 3564 /** 3565 * @param {string} event_name 3566 * @param {Element} dom 3567 * @param {EventListener} [handler] 3568 * @param {boolean} [capture] 3569 * @param {boolean} [passive] 3570 * @returns {void} 3571 */ 3572 function event(event_name, dom, handler, capture, passive) { 3573 var options = { 3574 capture, 3575 passive 3576 }; 3577 var target_handler = create_event(event_name, dom, handler, options); 3578 if (dom === document.body || dom === window || dom === document || dom instanceof HTMLMediaElement) teardown(() => { 3579 dom.removeEventListener(event_name, target_handler, options); 3580 }); 3581 } 3582 /** 3583 * @param {string} event_name 3584 * @param {Element} element 3585 * @param {EventListener} [handler] 3586 * @returns {void} 3587 */ 3588 function delegated(event_name, element, handler) { 3589 (element[event_symbol] ??= {})[event_name] = handler; 3590 }
3591 /** 3592 * @param {Array<string>} events 3593 * @returns {void} 3594 */ 3595 function delegate(events) { 3596 for (var i = 0; i < events.length; i++) all_registered_events.add(events[i]); 3597 for (var fn of root_event_handles) fn(events); 3598 } 3599 var last_propagated_event = null; 3600 /** 3601 * @this {EventTarget} 3602 * @param {Event} event 3603 * @returns {void} 3604 */ 3605 function handle_event_propagation(event) { 3606 var handler_element = this; 3607 var owner_document = handler_element.ownerDocument; 3608 var event_name = event.type; 3609 var path = event.composedPath?.() || []; 3610 var current_target = path[0] || event.target; 3611 last_propagated_event = event; 3612 var path_idx = 0; 3613 var handled_at = last_propagated_event === event && event[event_symbol]; 3614 if (handled_at) { 3615 var at_idx = path.indexOf(handled_at); 3616 if (at_idx !== -1 && (handler_element === document || handler_element === window)) { 3617 event[event_symbol] = handler_element; 3618 return; 3619 } 3620 var handler_idx = path.indexOf(handler_element); 3621 if (handler_idx === -1) return; 3622 if (at_idx <= handler_idx) path_idx = at_idx; 3623 } 3624 current_target = path[path_idx] || event.target; 3625 if (current_target === handler_element) return; 3626 define_property(event, "currentTarget", { 3627 configurable: true, 3628 get() { 3629 return current_target || owner_document; 3630 } 3631 }); 3632 var previous_reaction = active_reaction; 3633 var previous_effect = active_effect; 3634 set_active_reaction(null); 3635 set_active_effect(null); 3636 try { 3637 /** 3638 * @type {unknown} 3639 */ 3640 var throw_error; 3641 /** 3642 * @type {unknown[]} 3643 */ 3644 var other_errors = []; 3645 while (current_target !== null) { 3646 if (current_target === handler_element) break; 3647 try { 3648 var delegated = current_target[event_symbol]?.[event_name]; 3649 if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event); 3650 } catch (error) { 3651 if (throw_error) other_errors.push(error); 3652 else throw_error = error; 3653 } 3654 if (event.cancelBubble) break; 3655 path_idx++; 3656 current_target = path_idx < path.length ? path[path_idx] : null; 3657 } 3658 if (throw_error) { 3659 for (let error of other_errors) queueMicrotask(() => { 3660 throw error; 3661 }); 3662 throw throw_error; 3663 } 3664 } finally { 3665 event[event_symbol] = handler_element; 3666 delete event.currentTarget; 3667 set_active_reaction(previous_reaction); 3668 set_active_effect(previous_effect); 3669 } 3670 } 3671 //#endregion 3672 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/reconciler.js 3673 var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { 3674 /** @param {string} html */ 3675createHTML: (html) => { 3676 return html; 3677 } }); 3678 /** @param {string} html */ 3679 function create_trusted_html(html) { 3680 return policy?.createHTML(html) ?? html; 3681 } 3682 /** 3683 * @param {string} html 3684 */ 3685 function create_fragment_from_html(html) { 3686 var elem = create_element("template"); 3687 elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->")); 3688 return elem.content; 3689 } 3690 //#endregion 3691 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/template.js
3692 /** @import { Effect, EffectNodes, TemplateNode } from '#client' */ 3693 /** @import { TemplateStructure } from './types' */ 3694 var SCRIPT_TAG = IS_XHTML ? "script" : "SCRIPT"; 3695 /** 3696 * @param {TemplateNode} start 3697 * @param {TemplateNode | null} end 3698 */ 3699 function assign_nodes(start, end) { 3700 var effect = active_effect; 3701 if (effect.nodes === null) effect.nodes = { 3702 start, 3703 end, 3704 a: null, 3705 t: null 3706 }; 3707 } 3708 /** 3709 * @param {string} content 3710 * @param {number} flags 3711 * @returns {() => Node | Node[]} 3712 */ 3713 /*#__NO_SIDE_EFFECTS__*/ 3714 function from_html(content, flags) { 3715 var is_fragment = (flags & 1) !== 0; 3716 var use_import_node = (flags & 2) !== 0; 3717 /** @type {Node} */ 3718 var node; 3719 /** 3720 * Whether or not the first item is a text/element node. If not, we need to 3721 * create an additional comment node to act as `effect.nodes.start` 3722 */ 3723 var has_start = !content.startsWith("<!>"); 3724 return () => { 3725 if (hydrating) { 3726 assign_nodes(hydrate_node, null); 3727 return hydrate_node; 3728 } 3729 if (node === void 0) { 3730 node = create_fragment_from_html(has_start ? content : "<!>" + content); 3731 if (!is_fragment) node = /* @__PURE__ */ get_first_child(node); 3732 } 3733 var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true); 3734 if (is_fragment) { 3735 var start = /* @__PURE__ */ get_first_child(clone); 3736 var end = clone.lastChild; 3737 assign_nodes(start, end); 3738 } else assign_nodes(clone, clone); 3739 return clone; 3740 }; 3741 } 3742 /** 3743 * @param {() => Element | DocumentFragment} fn 3744 */ 3745 function with_script(fn) { 3746 return () => run_scripts(fn()); 3747 } 3748 /** 3749 * Creating a document fragment from HTML that contains script tags will not execute 3750 * the scripts. We need to replace the script tags with new ones so that they are executed. 3751 * @param {Element | DocumentFragment} node 3752 * @returns {Node | Node[]} 3753 */ 3754 function run_scripts(node) { 3755 if (hydrating) return node; 3756 const is_fragment = node.nodeType === 11; 3757 const scripts = node.nodeName === SCRIPT_TAG ? [node] : node.querySelectorAll("script"); 3758 const effect = active_effect; 3759 for (const script of scripts) { 3760 const clone = create_element("script"); 3761 for (var attribute of script.attributes) clone.setAttribute(attribute.name, attribute.value); 3762 clone.textContent = script.textContent; 3763 if (is_fragment ? node.firstChild === script : node === script) effect.nodes.start = clone; 3764 if (is_fragment ? node.lastChild === script : node === script) effect.nodes.end = clone; 3765 script.replaceWith(clone); 3766 } 3767 return node; 3768 } 3769 /** 3770 * Don't mark this as side-effect-free, hydration needs to walk all nodes 3771 * @param {any} value 3772 */ 3773 function text$1(value = "") { 3774 if (!hydrating) { 3775 var t = create_text(value + ""); 3776 assign_nodes(t, t); 3777 return t; 3778 } 3779 var node = hydrate_node; 3780 if (node.nodeType !== 3) { 3781 node.before(node = create_text()); 3782 set_hydrate_node(node); 3783 } else merge_text_nodes(node); 3784 assign_nodes(node, node); 3785 return node; 3786 } 3787 /** 3788 * @returns {TemplateNode | DocumentFragment} 3789 */ 3790 function comment() { 3791 if (hydrating) { 3792 assign_nodes(hydrate_node, null); 3793 return hydrate_node; 3794 } 3795 var frag = document.createDocumentFragment(); 3796 var start = document.createComment(""); 3797 var anchor = create_text(); 3798 frag.append(start, anchor); 3799 assign_nodes(start, anchor); 3800 return frag; 3801 } 3802 /** 3803 * Assign the created (or in hydration mode, traversed) dom elements to the current block 3804 * and insert the elements into the dom (in client mode). 3805 * @param {Text | Comment | Element} anchor 3806 * @param {DocumentFragment | Element} dom 3807 */ 3808 function append(anchor, dom) { 3809 if (hydrating) { 3810 var effect = active_effect; 3811 if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node; 3812 hydrate_next(); 3813 return; 3814 } 3815 if (anchor === null) return; 3816 anchor.before(dom); 3817 } 3818 /** 3819 * Create (or hydrate) an unique UID for the component instance. 3820 */ 3821 function props_id() { 3822 if (hydrating && hydrate_node && hydrate_node.nodeType === 8 && hydrate_node.textContent?.startsWith(`$`)) { 3823 const id = hydrate_node.textContent.substring(1); 3824 hydrate_next(); 3825 return id; 3826 } 3827 (window.__svelte ??= {}).uid ??= 1; 3828 return `c${window.__svelte.uid++}`; 3829 }
3830 /** 3831 * @param {string} name 3832 */ 3833 function is_capture_event(name) { 3834 return name.endsWith("capture") && name !== "gotpointercapture" && name !== "lostpointercapture"; 3835 } 3836 /** List of Element events that will be delegated */ 3837 var DELEGATED_EVENTS = [ 3838 "beforeinput", 3839 "click", 3840 "change", 3841 "dblclick", 3842 "contextmenu", 3843 "focusin", 3844 "focusout", 3845 "input", 3846 "keydown", 3847 "keyup", 3848 "mousedown", 3849 "mousemove", 3850 "mouseout", 3851 "mouseover", 3852 "mouseup", 3853 "pointerdown", 3854 "pointermove", 3855 "pointerout", 3856 "pointerover", 3857 "pointerup", 3858 "touchend", 3859 "touchmove", 3860 "touchstart" 3861 ]; 3862 /** 3863 * Returns `true` if `event_name` is a delegated event 3864 * @param {string} event_name 3865 */ 3866 function can_delegate_event(event_name) { 3867 return DELEGATED_EVENTS.includes(event_name); 3868 } 3869 /** 3870 * Attributes that are boolean, i.e. they are present or not present. 3871 */ 3872 var DOM_BOOLEAN_ATTRIBUTES = [ 3873 "allowfullscreen", 3874 "async", 3875 "autofocus", 3876 "autoplay", 3877 "checked", 3878 "controls", 3879 "default", 3880 "disabled", 3881 "formnovalidate", 3882 "indeterminate", 3883 "inert", 3884 "ismap", 3885 "loop", 3886 "multiple", 3887 "muted", 3888 "nomodule", 3889 "novalidate", 3890 "open", 3891 "playsinline", 3892 "readonly", 3893 "required", 3894 "reversed", 3895 "seamless", 3896 "selected", 3897 "webkitdirectory", 3898 "defer", 3899 "disablepictureinpicture", 3900 "disableremoteplayback" 3901 ]; 3902 /** 3903 * @type {Record<string, string>} 3904 * List of attribute names that should be aliased to their property names 3905 * because they behave differently between setting them as an attribute and 3906 * setting them as a property. 3907 */ 3908 var ATTRIBUTE_ALIASES = { 3909 formnovalidate: "formNoValidate", 3910 ismap: "isMap", 3911 nomodule: "noModule", 3912 playsinline: "playsInline", 3913 readonly: "readOnly", 3914 defaultvalue: "defaultValue", 3915 defaultchecked: "defaultChecked", 3916 srcobject: "srcObject", 3917 novalidate: "noValidate", 3918 allowfullscreen: "allowFullscreen", 3919 disablepictureinpicture: "disablePictureInPicture", 3920 disableremoteplayback: "disableRemotePlayback" 3921 }; 3922 /** 3923 * @param {string} name 3924 */ 3925 function normalize_attribute(name) { 3926 name = name.toLowerCase(); 3927 return ATTRIBUTE_ALIASES[name] ?? name; 3928 } 3929 [...DOM_BOOLEAN_ATTRIBUTES]; 3930 /** 3931 * Subset of delegated events which should be passive by default. 3932 * These two are already passive via browser defaults on window, document and body. 3933 * But since 3934 * - we're delegating them 3935 * - they happen often 3936 * - they apply to mobile which is generally less performant 3937 * we're marking them as passive by default for other elements, too. 3938 */ 3939 var PASSIVE_EVENTS = ["touchstart", "touchmove"]; 3940 /** 3941 * Returns `true` if `name` is a passive event 3942 * @param {string} name 3943 */ 3944 function is_passive_event(name) { 3945 return PASSIVE_EVENTS.includes(name); 3946 } 3947 /** 3948 * @param {Element} text 3949 * @param {string} value 3950 * @returns {void} 3951 */ 3952 function set_text(text, value) { 3953 var str = value == null ? "" : typeof value === "object" ? `${value}` : value; 3954 if (str !== (text[TEXT_CACHE] ??= text.nodeValue)) { 3955 /** @type {any} */ text[TEXT_CACHE] = str; 3956 text.nodeValue = `${str}`; 3957 } 3958 } 3959 /** 3960 * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component. 3961 * Transitions will play during the initial render unless the `intro` option is set to `false`. 3962 * 3963 * @template {Record<string, any>} Props 3964 * @template {Record<string, any>} Exports 3965 * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component 3966 * @param {MountOptions<Props>} options 3967 * @returns {Exports} 3968 */ 3969 function mount(component, options) { 3970 return _mount(component, options); 3971 } 3972 /** 3973 * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component 3974 * 3975 * @template {Record<string, any>} Props 3976 * @template {Record<string, any>} Exports 3977 * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component 3978 * @param {{} extends Props ? { 3979 * target: Document | Element | ShadowRoot; 3980 * props?: Props; 3981 * events?: Record<string, (e: any) => any>; 3982 * context?: Map<any, any>; 3983 * intro?: boolean; 3984 * recover?: boolean; 3985 * transformError?: (error: unknown) => unknown; 3986 * } : { 3987 * target: Document | Element | ShadowRoot; 3988 * props: Props; 3989 * events?: Record<string, (e: any) => any>; 3990 * context?: Map<any, any>; 3991 * intro?: boolean; 3992 * recover?: boolean; 3993 * transformError?: (error: unknown) => unknown; 3994 * }} options 3995 * @returns {Exports} 3996 */ 3997 function hydrate(component, options) { 3998 init_operations(); 3999 options.intro = options.intro ?? false; 4000 const target = options.target; 4001 const was_hydrating = hydrating; 4002 const previous_hydrate_node = hydrate_node; 4003 try { 4004 var anchor = /* @__PURE__ */ get_first_child(target); 4005 while (anchor && (anchor.nodeType !== 8 || anchor.data !== "[")) anchor = /* @__PURE__ */ get_next_sibling(anchor); 4006 if (!anchor) throw HYDRATION_ERROR; 4007 set_hydrating(true); 4008 set_hydrate_node(anchor); 4009 const instance = _mount(component, { 4010 ...options, 4011 anchor 4012 }); 4013 set_hydrating(false); 4014 return instance; 4015 } catch (error) { 4016 if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) throw error; 4017 if (error !== HYDRATION_ERROR) console.warn("Failed to hydrate: ", error); 4018 if (options.recover === false) hydration_failed(); 4019 init_operations(); 4020 clear_text_content(target); 4021 set_hydrating(false); 4022 return mount(component, options); 4023 } finally { 4024 set_hydrating(was_hydrating); 4025 set_hydrate_node(previous_hydrate_node); 4026 } 4027 } 4028 /** @type {Map<EventTarget, Map<string, number>>} */ 4029 var listeners = /* @__PURE__ */ new Map(); 4030 /** 4031 * @template {Record<string, any>} Exports 4032 * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component 4033 * @param {MountOptions} options 4034 * @returns {Exports} 4035 */ 4036 function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) { 4037 init_operations(); 4038 /** @type {Exports} */ 4039 var component = void 0; 4040 var unmount = component_root(() => { 4041 var anchor_node = anchor ?? target.appendChild(create_text()); 4042 boundary(anchor_node, { pending: () => {} }, (anchor_node) => { 4043 push({}); 4044 var ctx = component_context; 4045 if (context) ctx.c = context; 4046 if (events) 4047 /** @type {any} */ props.$$events = events; 4048 if (hydrating) assign_nodes(anchor_node, null); 4049 component = Component(anchor_node, props) || {}; 4050 if (hydrating) { 4051 /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node; 4052 if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") { 4053 hydration_mismatch(); 4054 throw HYDRATION_ERROR; 4055 } 4056 } 4057 pop(); 4058 }, transformError); 4059 /** @type {Set<string>} */ 4060 var registered_events = /* @__PURE__ */ new Set(); 4061 /** @param {Array<string>} events */ 4062 var event_handle = (events) => { 4063 for (var i = 0; i < events.length; i++) { 4064 var event_name = events[i]; 4065 if (registered_events.has(event_name)) continue; 4066 registered_events.add(event_name); 4067 var passive = is_passive_event(event_name); 4068 for (const node of [target, document]) { 4069 var counts = listeners.get(node); 4070 if (counts === void 0) { 4071 counts = /* @__PURE__ */ new Map(); 4072 listeners.set(node, counts); 4073 } 4074 var count = counts.get(event_name); 4075 if (count === void 0) { 4076 node.addEventListener(event_name, handle_event_propagation, { passive }); 4077 counts.set(event_name, 1); 4078 } else counts.set(event_name, count + 1); 4079 } 4080 } 4081 }; 4082 event_handle(array_from(all_registered_events)); 4083 root_event_handles.add(event_handle); 4084 return () => { 4085 for (var event_name of registered_events) for (const node of [target, document]) { 4086 var counts = listeners.get(node); 4087 var count = counts.get(event_name); 4088 if (--count == 0) { 4089 node.removeEventListener(event_name, handle_event_propagation); 4090 counts.delete(event_name); 4091 if (counts.size === 0) listeners.delete(node); 4092 } else counts.set(event_name, count); 4093 } 4094 root_event_handles.delete(event_handle); 4095 if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node); 4096 }; 4097 }); 4098 mounted_components.set(component, unmount); 4099 return component; 4100 }
4101 /** 4102 * References of the components that were mounted or hydrated. 4103 * Uses a `WeakMap` to avoid memory leaks. 4104 */ 4105 var mounted_components = /* @__PURE__ */ new WeakMap(); 4106 /** 4107 * Unmounts a component that was previously mounted using `mount` or `hydrate`. 4108 * 4109 * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM. 4110 * 4111 * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`). 4112 * 4113 * ```js 4114 * import { mount, unmount } from 'svelte'; 4115 * import App from './App.svelte'; 4116 * 4117 * const app = mount(App, { target: document.body }); 4118 * 4119 * // later... 4120 * unmount(app, { outro: true }); 4121 * ``` 4122 * @param {Record<string, any>} component 4123 * @param {{ outro?: boolean }} [options] 4124 * @returns {Promise<void>} 4125 */ 4126 function unmount(component, options) { 4127 const fn = mounted_components.get(component); 4128 if (fn) { 4129 mounted_components.delete(component); 4130 return fn(options); 4131 } 4132 return Promise.resolve(); 4133 } 4134 //#endregion 4135 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/branches.js 4136 /** @import { Effect, TemplateNode } from '#client' */ 4137 /** 4138 * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch 4139 */ 4140 /** 4141 * @template Key 4142 */ 4143 var BranchManager = class { 4144 /** @type {TemplateNode} */ 4145 anchor; 4146 /** @type {Map<Batch, Key>} */ 4147 #batches = /* @__PURE__ */ new Map(); 4148 /** 4149 * Map of keys to effects that are currently rendered in the DOM. 4150 * These effects are visible and actively part of the document tree. 4151 * Example: 4152 * ``` 4153 * {#if condition} 4154 * foo 4155 * {:else} 4156 * bar 4157 * {/if} 4158 * ``` 4159 * Can result in the entries `true->Effect` and `false->Effect` 4160 * @type {Map<Key, Effect>} 4161 */ 4162 #onscreen = /* @__PURE__ */ new Map(); 4163 /** 4164 * Similar to #onscreen with respect to the keys, but contains branches that are not yet 4165 * in the DOM, because their insertion is deferred. 4166 * @type {Map<Key, Branch>} 4167 */ 4168 #offscreen = /* @__PURE__ */ new Map(); 4169 /** 4170 * Keys of effects that are currently outroing 4171 * @type {Set<Key>} 4172 */ 4173 #outroing = /* @__PURE__ */ new Set(); 4174 /** 4175 * Whether to pause (i.e. outro) on change, or destroy immediately. 4176 * This is necessary for `<svelte:element>` 4177 */ 4178 #transition = true; 4179 /** 4180 * @param {TemplateNode} anchor 4181 * @param {boolean} transition 4182 */ 4183 constructor(anchor, transition = true) { 4184 this.anchor = anchor; 4185 this.#transition = transition; 4186 } 4187 /** 4188 * @param {Batch} batch 4189 */ 4190 #commit = (batch) => { 4191 if (!this.#batches.has(batch)) return; 4192 var key = this.#batches.get(batch); 4193 var onscreen = this.#onscreen.get(key); 4194 if (onscreen) { 4195 resume_effect(onscreen); 4196 this.#outroing.delete(key); 4197 } else { 4198 var offscreen = this.#offscreen.get(key); 4199 if (offscreen) { 4200 resume_effect(offscreen.effect); 4201 this.#onscreen.set(key, offscreen.effect); 4202 this.#offscreen.delete(key); 4203 /** @type {TemplateNode} */ offscreen.fragment.lastChild.remove(); 4204 this.anchor.before(offscreen.fragment); 4205 onscreen = offscreen.effect; 4206 } 4207 } 4208 for (const [b, k] of this.#batches) { 4209 this.#batches.delete(b); 4210 if (b === batch) break; 4211 const offscreen = this.#offscreen.get(k); 4212 if (offscreen) { 4213 destroy_effect(offscreen.effect); 4214 this.#offscreen.delete(k); 4215 } 4216 } 4217 for (const [k, effect] of this.#onscreen) { 4218 if (k === key || this.#outroing.has(k)) continue; 4219 const on_destroy = () => { 4220 if (Array.from(this.#batches.values()).includes(k)) { 4221 var fragment = document.createDocumentFragment(); 4222 move_effect(effect, fragment); 4223 fragment.append(create_text()); 4224 this.#offscreen.set(k, { 4225 effect, 4226 fragment 4227 }); 4228 } else destroy_effect(effect); 4229 this.#outroing.delete(k); 4230 this.#onscreen.delete(k); 4231 }; 4232 if (this.#transition || !onscreen) { 4233 this.#outroing.add(k); 4234 pause_effect(effect, on_destroy, false); 4235 }
4235 else on_destroy(); 4236 } 4237 }; 4238 /** 4239 * @param {Batch} batch 4240 */ 4241 #discard = (batch) => { 4242 this.#batches.delete(batch); 4243 const keys = Array.from(this.#batches.values()); 4244 for (const [k, branch] of this.#offscreen) if (!keys.includes(k)) { 4245 destroy_effect(branch.effect); 4246 this.#offscreen.delete(k); 4247 } 4248 }; 4249 /** 4250 * 4251 * @param {any} key 4252 * @param {null | ((target: TemplateNode) => void)} fn 4253 */ 4254 ensure(key, fn) { 4255 var batch = current_batch; 4256 var defer = should_defer_append(); 4257 if (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) if (defer) { 4258 var fragment = document.createDocumentFragment(); 4259 var target = create_text(); 4260 fragment.append(target); 4261 this.#offscreen.set(key, { 4262 effect: branch(() => fn(target)), 4263 fragment 4264 }); 4265 } else this.#onscreen.set(key, branch(() => fn(this.anchor))); 4266 this.#batches.set(batch, key); 4267 if (defer) { 4268 for (const [k, effect] of this.#onscreen) if (k === key) batch.unskip_effect(effect); 4269 else batch.skip_effect(effect); 4270 for (const [k, branch] of this.#offscreen) if (k === key) batch.unskip_effect(branch.effect); 4271 else batch.skip_effect(branch.effect); 4272 batch.oncommit(this.#commit); 4273 batch.ondiscard(this.#discard); 4274 } else { 4275 if (hydrating) this.anchor = hydrate_node; 4276 this.#commit(batch); 4277 } 4278 } 4279 }; 4280 //#endregion 4281 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/snippet.js 4282 /** @import { Snippet } from 'svelte' */ 4283 /** @import { TemplateNode } from '#client' */ 4284 /** @import { Getters } from '#shared' */ 4285 /** 4286 * @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn 4287 * @param {TemplateNode} node 4288 * @param {() => SnippetFn | null | undefined} get_snippet 4289 * @param {(() => any)[]} args 4290 * @returns {void} 4291 */ 4292 function snippet(node, get_snippet, ...args) { 4293 var branches = new BranchManager(node); 4294 block(() => { 4295 const snippet = get_snippet() ?? null; 4296 branches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args))); 4297 }, EFFECT_TRANSPARENT); 4298 } 4299 /** 4300 * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM. 4301 * Unlike `$effect`, the provided function only runs once. 4302 * 4303 * It must be called during the component's initialisation (but doesn't need to live _inside_ the component; 4304 * it can be called from an external module). If a function is returned _synchronously_ from `onMount`, 4305 * it will be called when the component is unmounted. 4306 * 4307 * `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render). 4308 * 4309 * @template T 4310 * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn 4311 * @returns {void} 4312 */ 4313 function onMount(fn) { 4314 if (component_context === null) lifecycle_outside_component("onMount"); 4315 if (legacy_mode_flag && component_context.l !== null) init_update_callbacks(component_context).m.push(fn); 4316 else user_effect(() => { 4317 const cleanup = untrack(fn); 4318 if (typeof cleanup === "function") return cleanup; 4319 }); 4320 } 4321 /** 4322 * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate 4323 * @param {ComponentContext} context 4324 */ 4325 function init_update_callbacks(context) { 4326 var l = context.l; 4327 return l.u ??= { 4328 a: [], 4329 b: [], 4330 m: [] 4331 }; 4332 } 4333 //#endregion 4334 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/attachments/index.js 4335 /** 4336 * Creates an object key that will be recognised as an attachment when the object is spread onto an element, 4337 * as a programmatic alternative to using `{@attach ...}`. This can be useful for library authors, though 4338 * is generally not needed when building an app. 4339 * 4340 * ```svelte 4341 * <script> 4342 * import { createAttachmentKey } from 'svelte/attachments'; 4343 * 4344 * const props = { 4345 * class: 'cool', 4346 * onclick: () => alert('clicked'), 4347 * [createAttachmentKey()]: (node) => { 4348 * node.textContent = 'attached!'; 4349 * } 4350 * }; 4351 * <\/script> 4352 * 4353 * <button {...props}>click me</button> 4354 * ``` 4355 * @since 5.29 4356 */ 4357 function createAttachmentKey() { 4358 return Symbol(ATTACHMENT_KEY); 4359 } 4360 //#endregion 4361 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/if.js
4362 /** @import { TemplateNode } from '#client' */ 4363 /** 4364 * @param {TemplateNode} node 4365 * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn 4366 * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local' 4367 * @returns {void} 4368 */ 4369 function if_block(node, fn, elseif = false) { 4370 /** @type {TemplateNode | undefined} */ 4371 var marker; 4372 if (hydrating) { 4373 marker = hydrate_node; 4374 hydrate_next(); 4375 } 4376 var branches = new BranchManager(node); 4377 var flags = elseif ? EFFECT_TRANSPARENT : 0; 4378 /** 4379 * @param {number | false} key 4380 * @param {null | ((anchor: Node) => void)} fn 4381 */ 4382 function update_branch(key, fn) { 4383 if (hydrating) { 4384 var data = read_hydration_instruction(marker); 4385 if (key !== parseInt(data.substring(1))) { 4386 var anchor = skip_nodes(); 4387 set_hydrate_node(anchor); 4388 branches.anchor = anchor; 4389 set_hydrating(false); 4390 branches.ensure(key, fn); 4391 set_hydrating(true); 4392 return; 4393 } 4394 } 4395 branches.ensure(key, fn); 4396 } 4397 block(() => { 4398 var has_branch = false; 4399 fn((fn, key = 0) => { 4400 has_branch = true; 4401 update_branch(key, fn); 4402 }); 4403 if (!has_branch) update_branch(-1, null); 4404 }, flags); 4405 } 4406 //#endregion 4407 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/each.js 4408 /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */ 4409 /** @import { Batch } from '../../reactivity/batch.js'; */ 4410 /** 4411 * @param {any} _ 4412 * @param {number} i 4413 */ 4414 function index$1(_, i) { 4415 return i; 4416 } 4417 /** 4418 * Pause multiple effects simultaneously, and coordinate their 4419 * subsequent destruction. Used in each blocks 4420 * @param {EachState} state 4421 * @param {Effect[]} to_destroy 4422 * @param {null | Node} controlled_anchor 4423 */ 4424 function pause_effects(state, to_destroy, controlled_anchor) { 4425 /** @type {TransitionManager[]} */ 4426 var transitions = []; 4427 var length = to_destroy.length; 4428 /** @type {EachOutroGroup} */ 4429 var group; 4430 var remaining = to_destroy.length; 4431 for (var i = 0; i < length; i++) { 4432 let effect = to_destroy[i]; 4433 pause_effect(effect, () => { 4434 if (group) { 4435 group.pending.delete(effect); 4436 group.done.add(effect); 4437 if (group.pending.size === 0) { 4438 var groups = state.outrogroups; 4439 destroy_effects(state, array_from(group.done)); 4440 groups.delete(group); 4441 if (groups.size === 0) state.outrogroups = null; 4442 } 4443 } else remaining -= 1; 4444 }, false); 4445 } 4446 if (remaining === 0) { 4447 var fast_path = transitions.length === 0 && controlled_anchor !== null; 4448 if (fast_path) { 4449 var anchor = controlled_anchor; 4450 var parent_node = anchor.parentNode; 4451 clear_text_content(parent_node); 4452 parent_node.append(anchor); 4453 state.items.clear(); 4454 } 4455 destroy_effects(state, to_destroy, !fast_path); 4456 } else { 4457 group = { 4458 pending: new Set(to_destroy), 4459 done: /* @__PURE__ */ new Set() 4460 }; 4461 (state.outrogroups ??= /* @__PURE__ */ new Set()).add(group); 4462 } 4463 } 4464 /** 4465 * @param {EachState} state 4466 * @param {Effect[]} to_destroy 4467 * @param {boolean} remove_dom 4468 */ 4469 function destroy_effects(state, to_destroy, remove_dom = true) { 4470 /** @type {Set<Effect> | undefined} */ 4471 var preserved_effects; 4472 if (state.pending.size > 0) { 4473 preserved_effects = /* @__PURE__ */ new Set(); 4474 for (const keys of state.pending.values()) for (const key of keys) preserved_effects.add( 4475 /** @type {EachItem} */ 4476 state.items.get(key).e 4477 ); 4478 } 4479 for (var i = 0; i < to_destroy.length; i++) { 4480 var e = to_destroy[i]; 4481 if (preserved_effects?.has(e)) { 4482 e.f |= EFFECT_OFFSCREEN; 4483 move_effect(e, document.createDocumentFragment()); 4484 } else destroy_effect(to_destroy[i], remove_dom); 4485 } 4486 } 4487 /** @type {TemplateNode} */ 4488 var offscreen_anchor; 4489 /** 4490 * @template V 4491 * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block 4492 * @param {number} flags 4493 * @param {() => V[]} get_collection 4494 * @param {(value: V, index: number) => any} get_key 4495 * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn 4496 * @param {null | ((anchor: Node) => void)} fallback_fn 4497 * @returns {void} 4498 */ 4499 function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) { 4500 var anchor = node; 4501 /** @type {Map<any, EachItem>} */ 4502 var items = /* @__PURE__ */ new Map(); 4503 if ((flags & 4) !== 0) { 4504 var parent_node = node; 4505 anchor = hydrating ? set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node)) : parent_node.appendChild(create_text()); 4506 } 4507 if (hydrating) hydrate_next(); 4508 /** @type {Effect | null} */ 4509 var fallback = null; 4510 var each_array = /* @__PURE__ */ derived_safe_equal(() => { 4511 var collection = get_collection(); 4512 return is_array(collection) ? collection : collection == null ? [] : array_from(collection); 4513 }); 4514 /** @type {V[]} */ 4515 var array; 4516 /** @type {Map<Batch, Set<any>>} */
4517 var pending = /* @__PURE__ */ new Map(); 4518 var first_run = true; 4519 /** 4520 * @param {Batch} batch 4521 */ 4522 function commit(batch) { 4523 if ((state.effect.f & 16384) !== 0) return; 4524 state.pending.delete(batch); 4525 state.fallback = fallback; 4526 reconcile(state, array, anchor, flags, get_key); 4527 if (fallback !== null) if (array.length === 0) if ((fallback.f & 33554432) === 0) resume_effect(fallback); 4528 else { 4529 fallback.f ^= EFFECT_OFFSCREEN; 4530 move(fallback, null, anchor); 4531 } 4532 else pause_effect(fallback, () => { 4533 fallback = null; 4534 }); 4535 } 4536 /** 4537 * @param {Batch} batch 4538 */ 4539 function discard(batch) { 4540 state.pending.delete(batch); 4541 } 4542 /** @type {EachState} */ 4543 var state = { 4544 effect: block(() => { 4545 array = get$2(each_array); 4546 var length = array.length; 4547 /** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */ 4548 let mismatch = false; 4549 if (hydrating) { 4550 if (read_hydration_instruction(anchor) === "[!" !== (length === 0)) { 4551 anchor = skip_nodes(); 4552 set_hydrate_node(anchor); 4553 set_hydrating(false); 4554 mismatch = true; 4555 } 4556 } 4557 var keys = /* @__PURE__ */ new Set(); 4558 var batch = current_batch; 4559 var defer = should_defer_append(); 4560 for (var index = 0; index < length; index += 1) { 4561 if (hydrating && hydrate_node.nodeType === 8 && hydrate_node.data === "]") { 4562 anchor = hydrate_node; 4563 mismatch = true; 4564 set_hydrating(false); 4565 } 4566 var value = array[index]; 4567 var key = get_key(value, index); 4568 var item = first_run ? null : items.get(key); 4569 if (item) { 4570 if (item.v) internal_set(item.v, value); 4571 if (item.i) internal_set(item.i, index); 4572 if (defer) batch.unskip_effect(item.e); 4573 } else { 4574 item = create_item(items, first_run ? anchor : offscreen_anchor ??= create_text(), value, key, index, render_fn, flags, get_collection); 4575 if (!first_run) item.e.f |= EFFECT_OFFSCREEN; 4576 items.set(key, item); 4577 } 4578 keys.add(key); 4579 } 4580 if (length === 0 && fallback_fn && !fallback) if (first_run) fallback = branch(() => fallback_fn(anchor)); 4581 else { 4582 fallback = branch(() => fallback_fn(offscreen_anchor ??= create_text())); 4583 fallback.f |= EFFECT_OFFSCREEN; 4584 } 4585 if (length > keys.size) each_key_duplicate("", "", ""); 4586 if (hydrating && length > 0) set_hydrate_node(skip_nodes()); 4587 if (!first_run) { 4588 pending.set(batch, keys); 4589 if (defer) { 4590 for (const [key, item] of items) if (!keys.has(key)) batch.skip_effect(item.e); 4591 batch.oncommit(commit); 4592 batch.ondiscard(discard); 4593 } else commit(batch); 4594 } 4595 if (mismatch) set_hydrating(true); 4596 get$2(each_array); 4597 }), 4598 flags, 4599 items, 4600 pending, 4601 outrogroups: null, 4602 fallback 4603 }; 4604 first_run = false; 4605 if (hydrating) anchor = hydrate_node; 4606 } 4607 /** 4608 * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect 4609 * @param {Effect | null} effect 4610 * @returns {Effect | null} 4611 */ 4612 function skip_to_branch(effect) { 4613 while (effect !== null && (effect.f & 32) === 0) effect = effect.next; 4614 return effect; 4615 } 4616 /** 4617 * Add, remove, or reorder items output by an each block as its input changes 4618 * @template V 4619 * @param {EachState} state 4620 * @param {Array<V>} array 4621 * @param {Element | Comment | Text} anchor 4622 * @param {number} flags 4623 * @param {(value: V, index: number) => any} get_key 4624 * @returns {void} 4625 */ 4626 function reconcile(state, array, anchor, flags, get_key) { 4627 var is_animated = (flags & 8) !== 0; 4628 var length = array.length; 4629 var items = state.items; 4630 var current = skip_to_branch(state.effect.first); 4631 /** @type {undefined | Set<Effect>} */ 4632 var seen; 4633 /** @type {Effect | null} */ 4634 var prev = null; 4635 /** @type {undefined | Set<Effect>} */ 4636 var to_animate; 4637 /** @type {Effect[]} */ 4638 var matched = []; 4639 /** @type {Effect[]} */ 4640 var stashed = []; 4641 /** @type {V} */ 4642 var value; 4643 /** @type {any} */ 4644 var key; 4645 /** @type {Effect | undefined} */ 4646 var effect; 4647 /** @type {number} */ 4648 var i; 4649 if (is_animated) for (i = 0; i < length; i += 1) { 4650 value = array[i]; 4651 key = get_key(value, i); 4652 effect = items.get(key).e; 4653 if ((effect.f & 33554432) === 0) { 4654 effect.nodes?.a?.measure(); 4655 (to_animate ??= /* @__PURE__ */ new Set()).add(effect); 4656 } 4657 } 4658 for (i = 0; i < length; i += 1) { 4659 value = array[i]; 4660 key = get_key(value, i); 4661 effect = items.get(key).e; 4662 if (state.outrogroups !== null) for (const group of state.outrogroups) { 4663 group.pending.delete(effect); 4664 group.done.delete(effect); 4665 } 4666 if ((effect.f & 8192) !== 0) { 4667 resume_effect(effect); 4668 if (is_animated) { 4669 effect.nodes?.a?.unfix(); 4670 (to_animate ??= /* @__PURE__ */ new Set()).delete(effect); 4671 } 4672 } 4673 if ((effect.f & 33554432) !== 0) { 4674 effect.f ^= EFFECT_OFFSCREEN; 4675 if (effect === current) move(effect, null, anchor); 4676 else { 4677 var next = prev ? prev.next : current; 4678 if (effect === state.effect.last) state.effect.last = effect.prev; 4679 if (effect.prev) effect.prev.next = effect.next; 4680 if (effect.next) effect.next.prev = effect.prev; 4681 link(state, prev, effect); 4682 link(state, effect, next); 4683 move(effect, next, anchor); 4684 prev = effect; 4685 matched = []; 4686 stashed = []; 4687 current = skip_to_branch(prev.next); 4688 continue; 4689 } 4690 } 4691 if (effect !== current) { 4692 if (seen !== void 0 && seen.has(effect)) { 4693 if (matched.length < stashed.length) { 4694 var start = stashed[0]; 4695 var j; 4696 prev = start.prev; 4697 var a = matched[0]; 4698 var b = matched[matched.length - 1]; 4699 for (j = 0; j < matched.length; j += 1) move(matched[j], start, anchor); 4700 for (j = 0; j < stashed.length; j += 1) seen.delete(stashed[j]); 4701 link(state, a.prev, b.next); 4702 link(state, prev, a); 4703 link(state, b, start); 4704 current = start; 4705 prev = b; 4706 i -= 1; 4707 matched = []; 4708 stashed = []; 4709 } else { 4710 seen.delete(effect);
4711 move(effect, current, anchor); 4712 link(state, effect.prev, effect.next); 4713 link(state, effect, prev === null ? state.effect.first : prev.next); 4714 link(state, prev, effect); 4715 prev = effect; 4716 } 4717 continue; 4718 } 4719 matched = []; 4720 stashed = []; 4721 while (current !== null && current !== effect) { 4722 (seen ??= /* @__PURE__ */ new Set()).add(current); 4723 stashed.push(current); 4724 current = skip_to_branch(current.next); 4725 } 4726 if (current === null) continue; 4727 } 4728 if ((effect.f & 33554432) === 0) matched.push(effect); 4729 prev = effect; 4730 current = skip_to_branch(effect.next); 4731 } 4732 if (state.outrogroups !== null) { 4733 for (const group of state.outrogroups) if (group.pending.size === 0) { 4734 destroy_effects(state, array_from(group.done)); 4735 state.outrogroups?.delete(group); 4736 } 4737 if (state.outrogroups.size === 0) state.outrogroups = null; 4738 } 4739 if (current !== null || seen !== void 0) { 4740 /** @type {Effect[]} */ 4741 var to_destroy = []; 4742 if (seen !== void 0) { 4743 for (effect of seen) if ((effect.f & 8192) === 0) to_destroy.push(effect); 4744 } 4745 while (current !== null) { 4746 if ((current.f & 8192) === 0 && current !== state.fallback) to_destroy.push(current); 4747 current = skip_to_branch(current.next); 4748 } 4749 var destroy_length = to_destroy.length; 4750 if (destroy_length > 0) { 4751 var controlled_anchor = (flags & 4) !== 0 && length === 0 ? anchor : null; 4752 if (is_animated) { 4753 for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure(); 4754 for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix(); 4755 } 4756 pause_effects(state, to_destroy, controlled_anchor); 4757 } 4758 } 4759 if (is_animated) queue_micro_task(() => { 4760 if (to_animate === void 0) return; 4761 for (effect of to_animate) effect.nodes?.a?.apply(); 4762 }); 4763 } 4764 /** 4765 * @template V 4766 * @param {Map<any, EachItem>} items 4767 * @param {Node} anchor 4768 * @param {V} value 4769 * @param {unknown} key 4770 * @param {number} index 4771 * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn 4772 * @param {number} flags 4773 * @param {() => V[]} get_collection 4774 * @returns {EachItem} 4775 */ 4776 function create_item(items, anchor, value, key, index, render_fn, flags, get_collection) { 4777 var v = (flags & 1) !== 0 ? (flags & 16) === 0 ? /* @__PURE__ */ mutable_source(value, false, false) : source(value) : null; 4778 var i = (flags & 2) !== 0 ? source(index) : null; 4779 return { 4780 v, 4781 i, 4782 e: branch(() => { 4783 render_fn(anchor, v ?? value, i ?? index, get_collection); 4784 return () => { 4785 items.delete(key); 4786 }; 4787 }) 4788 }; 4789 } 4790 /** 4791 * @param {Effect} effect 4792 * @param {Effect | null} next 4793 * @param {Text | Element | Comment} anchor 4794 */ 4795 function move(effect, next, anchor) { 4796 if (!effect.nodes) return; 4797 var node = effect.nodes.start; 4798 var end = effect.nodes.end; 4799 var dest = next && (next.f & 33554432) === 0 ? next.nodes.start : anchor; 4800 while (node !== null) { 4801 var next_node = /* @__PURE__ */ get_next_sibling(node); 4802 dest.before(node); 4803 if (node === end) return; 4804 node = next_node; 4805 } 4806 } 4807 /** 4808 * @param {EachState} state 4809 * @param {Effect | null} prev 4810 * @param {Effect | null} next 4811 */ 4812 function link(state, prev, next) { 4813 if (prev === null) state.effect.first = next; 4814 else prev.next = next; 4815 if (next === null) state.effect.last = prev; 4816 else next.prev = prev; 4817 } 4818 /** 4819 * @param {Element | Text | Comment} node 4820 * @param {() => string | TrustedHTML} get_value 4821 * @param {boolean} [is_controlled] 4822 * @param {boolean} [svg] 4823 * @param {boolean} [mathml] 4824 * @param {boolean} [skip_warning] 4825 * @returns {void} 4826 */ 4827 function html$2(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) { 4828 var anchor = node; 4829 /** @type {string | TrustedHTML} */ 4830 var value = ""; 4831 if (is_controlled) { 4832 var parent_node = node; 4833 if (hydrating) anchor = set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node)); 4834 } 4835 template_effect(() => { 4836 var effect = active_effect; 4837 if (value === (value = get_value() ?? "")) { 4838 if (hydrating) hydrate_next(); 4839 return; 4840 } 4841 if (is_controlled && !hydrating) { 4842 effect.nodes = null; 4843 parent_node.innerHTML = value; 4844 if (value !== "") assign_nodes(/* @__PURE__ */ get_first_child(parent_node), parent_node.lastChild); 4845 return; 4846 } 4847 if (effect.nodes !== null) { 4848 remove_effect_dom(effect.nodes.start, effect.nodes.end); 4849 effect.nodes = null; 4850 } 4851 if (value === "") return; 4852 if (hydrating) { 4853 hydrate_node.data; 4854 /** @type {TemplateNode | null} */ 4855 var next = hydrate_next(); 4856 var last = next; 4857 while (next !== null && (next.nodeType !== 8 || next.data !== "")) { 4858 last = next; 4859 next = /* @__PURE__ */ get_next_sibling(next); 4860 } 4861 if (next === null) { 4862 hydration_mismatch(); 4863 throw HYDRATION_ERROR; 4864 } 4865 assign_nodes(hydrate_node, last); 4866 anchor = set_hydrate_node(next); 4867 return; 4868 }
4869 var wrapper = create_element(svg ? "svg" : mathml ? "math" : "template", svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : void 0); 4870 wrapper.innerHTML = value; 4871 /** @type {DocumentFragment | Element} */ 4872 var node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ wrapper.content; 4873 assign_nodes(/* @__PURE__ */ get_first_child(node), node.lastChild); 4874 if (svg || mathml) while (/* @__PURE__ */ get_first_child(node)) anchor.before(/* @__PURE__ */ get_first_child(node)); 4875 else anchor.before(node); 4876 }); 4877 } 4878 //#endregion 4879 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/slot.js 4880 /** 4881 * @param {Comment} anchor 4882 * @param {Record<string, any>} $$props 4883 * @param {string} name 4884 * @param {Record<string, unknown>} slot_props 4885 * @param {null | ((anchor: Comment) => void)} fallback_fn 4886 */ 4887 function slot(anchor, $$props, name, slot_props, fallback_fn) { 4888 if (hydrating) hydrate_next(); 4889 var slot_fn = $$props.$$slots?.[name]; 4890 var is_interop = false; 4891 if (slot_fn === true) { 4892 slot_fn = $$props[name === "default" ? "children" : name]; 4893 is_interop = true; 4894 } 4895 if (slot_fn === void 0) { 4896 if (fallback_fn !== null) fallback_fn(anchor); 4897 } else slot_fn(anchor, is_interop ? () => slot_props : slot_props); 4898 } 4899 //#endregion 4900 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js 4901 /** @import { TemplateNode, Dom } from '#client' */ 4902 /** 4903 * @template P 4904 * @template {(props: P) => void} C 4905 * @param {TemplateNode} node 4906 * @param {() => C} get_component 4907 * @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn 4908 * @returns {void} 4909 */ 4910 function component(node, get_component, render_fn) { 4911 /** @type {TemplateNode | undefined} */ 4912 var hydration_start_node; 4913 if (hydrating) { 4914 hydration_start_node = hydrate_node; 4915 hydrate_next(); 4916 } 4917 var branches = new BranchManager(node); 4918 block(() => { 4919 var component = get_component() ?? null; 4920 if (hydrating) { 4921 if (read_hydration_instruction(hydration_start_node) === "[" !== (component !== null)) { 4922 var anchor = skip_nodes(); 4923 set_hydrate_node(anchor); 4924 branches.anchor = anchor; 4925 set_hydrating(false); 4926 branches.ensure(component, component && ((target) => render_fn(target, component))); 4927 set_hydrating(true); 4928 return; 4929 } 4930 } 4931 branches.ensure(component, component && ((target) => render_fn(target, component))); 4932 }, EFFECT_TRANSPARENT); 4933 } 4934 //#endregion 4935 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js 4936 /** @import { TemplateNode } from '#client' */ 4937 /** 4938 * @param {string} hash 4939 * @param {(anchor: Node) => void} render_fn 4940 * @returns {void} 4941 */ 4942 function head(hash, render_fn) { 4943 let previous_hydrate_node = null; 4944 let was_hydrating = hydrating; 4945 /** @type {Comment | Text} */ 4946 var anchor; 4947 if (hydrating) { 4948 previous_hydrate_node = hydrate_node; 4949 var head_anchor = /* @__PURE__ */ get_first_child(document.head); 4950 while (head_anchor !== null && (head_anchor.nodeType !== 8 || head_anchor.data !== hash)) head_anchor = /* @__PURE__ */ get_next_sibling(head_anchor); 4951 if (head_anchor === null) set_hydrating(false); 4952 else { 4953 var start = /* @__PURE__ */ get_next_sibling(head_anchor); 4954 head_anchor.remove(); 4955 set_hydrate_node(start); 4956 } 4957 } 4958 if (!hydrating) anchor = document.head.appendChild(create_text()); 4959 try { 4960 block(() => { 4961 var e = branch(() => render_fn(anchor)); 4962 e.f |= HEAD_EFFECT; 4963 }); 4964 } finally { 4965 if (was_hydrating) { 4966 set_hydrating(true); 4967 set_hydrate_node(previous_hydrate_node); 4968 } 4969 } 4970 } 4971 //#endregion 4972 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/css.js 4973 /** 4974 * @param {Node} anchor 4975 * @param {{ hash: string, code: string }} css 4976 */ 4977 function append_styles$1(anchor, css) { 4978 effect(() => { 4979 var root = anchor.getRootNode(); 4980 var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head; 4981 if (!target.querySelector("#" + css.hash)) {
4982 const style = create_element("style"); 4983 style.id = css.hash; 4984 style.textContent = css.code; 4985 target.appendChild(style); 4986 } 4987 }); 4988 } 4989 //#endregion 4990 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/actions.js 4991 /** @import { ActionPayload } from '#client' */ 4992 /** 4993 * @template P 4994 * @param {Element} dom 4995 * @param {(dom: Element, value?: P) => ActionPayload<P>} action 4996 * @param {() => P} [get_value] 4997 * @returns {void} 4998 */ 4999 function action(dom, action, get_value) { 5000 effect(() => { 5001 var payload = untrack(() => action(dom, get_value?.()) || {}); 5002 if (get_value && payload?.update) { 5003 var inited = false; 5004 /** @type {P} */ 5005 var prev = {}; 5006 render_effect(() => { 5007 var value = get_value(); 5008 deep_read_state(value); 5009 if (inited && safe_not_equal(prev, value)) { 5010 prev = value; 5011 /** @type {Function} */ payload.update(value); 5012 } 5013 }); 5014 inited = true; 5015 } 5016 if (payload?.destroy) return () => payload.destroy(); 5017 }); 5018 } 5019 //#endregion 5020 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/attachments.js 5021 /** @import { Effect } from '#client' */ 5022 /** 5023 * @param {Element} node 5024 * @param {() => (node: Element) => void} get_fn 5025 */ 5026 function attach(node, get_fn) { 5027 /** @type {false | undefined | ((node: Element) => void)} */ 5028 var fn = void 0; 5029 /** @type {Effect | null} */ 5030 var e; 5031 managed(() => { 5032 if (fn !== (fn = get_fn())) { 5033 if (e) { 5034 destroy_effect(e); 5035 e = null; 5036 } 5037 if (fn) e = branch(() => { 5038 effect(() => fn(node)); 5039 }); 5040 } 5041 }); 5042 } 5043 //#endregion 5044 //#region ../../node_modules/.pnpm/[email protected]/node_modules/clsx/dist/clsx.mjs 5045 function r(e) { 5046 var t, f, n = ""; 5047 if ("string" == typeof e || "number" == typeof e) n += e; 5048 else if ("object" == typeof e) if (Array.isArray(e)) { 5049 var o = e.length; 5050 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 5051 } else for (f in e) e[f] && (n && (n += " "), n += f); 5052 return n; 5053 } 5054 function clsx$1() { 5055 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 5056 return n; 5057 } 5058 //#endregion 5059 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/shared/attributes.js 5060 /** 5061 * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values. 5062 * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does) 5063 * @param {any} value 5064 */ 5065 function clsx(value) { 5066 if (typeof value === "object") return clsx$1(value); 5067 else return value ?? ""; 5068 } 5069 var whitespace = [..." \n\r\f\xA0\v"]; 5070 /** 5071 * @param {any} value 5072 * @param {string | null} [hash] 5073 * @param {Record<string, boolean>} [directives] 5074 * @returns {string | null} 5075 */ 5076 function to_class(value, hash, directives) { 5077 var classname = value == null ? "" : "" + value; 5078 if (hash) classname = classname ? classname + " " + hash : hash; 5079 if (directives) { 5080 for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key; 5081 else if (classname.length) { 5082 var len = key.length; 5083 var a = 0; 5084 while ((a = classname.indexOf(key, a)) >= 0) { 5085 var b = a + len; 5086 if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1); 5087 else a = b; 5088 } 5089 } 5090 } 5091 return classname === "" ? null : classname; 5092 } 5093 /** 5094 * 5095 * @param {Record<string,any>} styles 5096 * @param {boolean} important 5097 */ 5098 function append_styles(styles, important = false) { 5099 var separator = important ? " !important;" : ";"; 5100 var css = ""; 5101 for (var key of Object.keys(styles)) { 5102 var value = styles[key]; 5103 if (value != null && value !== "") css += " " + key + ": " + value + separator; 5104 } 5105 return css; 5106 } 5107 /** 5108 * @param {string} name 5109 * @returns {string} 5110 */ 5111 function to_css_name(name) { 5112 if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase(); 5113 return name; 5114 }
5115 /** 5116 * @param {any} value 5117 * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles] 5118 * @returns {string | null} 5119 */ 5120 function to_style(value, styles) { 5121 if (styles) { 5122 var new_style = ""; 5123 /** @type {Record<string,any> | undefined} */ 5124 var normal_styles; 5125 /** @type {Record<string,any> | undefined} */ 5126 var important_styles; 5127 if (Array.isArray(styles)) { 5128 normal_styles = styles[0]; 5129 important_styles = styles[1]; 5130 } else normal_styles = styles; 5131 if (value) { 5132 value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim(); 5133 /** @type {boolean | '"' | "'"} */ 5134 var in_str = false; 5135 var in_apo = 0; 5136 var in_comment = false; 5137 var reserved_names = []; 5138 if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name)); 5139 if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name)); 5140 var start_index = 0; 5141 var name_index = -1; 5142 const len = value.length; 5143 for (var i = 0; i < len; i++) { 5144 var c = value[i]; 5145 if (in_comment) { 5146 if (c === "/" && value[i - 1] === "*") in_comment = false; 5147 } else if (in_str) { 5148 if (in_str === c) in_str = false; 5149 } else if (c === "/" && value[i + 1] === "*") in_comment = true; 5150 else if (c === "\"" || c === "'") in_str = c; 5151 else if (c === "(") in_apo++; 5152 else if (c === ")") in_apo--; 5153 if (!in_comment && in_str === false && in_apo === 0) { 5154 if (c === ":" && name_index === -1) name_index = i; 5155 else if (c === ";" || i === len - 1) { 5156 if (name_index !== -1) { 5157 var name = to_css_name(value.substring(start_index, name_index).trim()); 5158 if (!reserved_names.includes(name)) { 5159 if (c !== ";") i++; 5160 var property = value.substring(start_index, i).trim(); 5161 new_style += " " + property + ";"; 5162 } 5163 } 5164 start_index = i + 1; 5165 name_index = -1; 5166 } 5167 } 5168 } 5169 } 5170 if (normal_styles) new_style += append_styles(normal_styles); 5171 if (important_styles) new_style += append_styles(important_styles, true); 5172 new_style = new_style.trim(); 5173 return new_style === "" ? null : new_style; 5174 } 5175 return value == null ? null : String(value); 5176 } 5177 //#endregion 5178 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/class.js 5179 /** 5180 * @param {Element} dom 5181 * @param {boolean | number} is_html 5182 * @param {string | null} value 5183 * @param {string} [hash] 5184 * @param {Record<string, any>} [prev_classes] 5185 * @param {Record<string, any>} [next_classes] 5186 * @returns {Record<string, boolean> | undefined} 5187 */ 5188 function set_class(dom, is_html, value, hash, prev_classes, next_classes) { 5189 var prev = dom[CLASS_CACHE]; 5190 if (hydrating || prev !== value || prev === void 0) { 5191 var next_class_name = to_class(value, hash, next_classes); 5192 if (!hydrating || next_class_name !== dom.getAttribute("class")) if (next_class_name == null) dom.removeAttribute("class"); 5193 else if (is_html) dom.className = next_class_name; 5194 else dom.setAttribute("class", next_class_name); 5195 /** @type {any} */ dom[CLASS_CACHE] = value; 5196 } else if (next_classes && prev_classes !== next_classes) for (var key in next_classes) { 5197 var is_present = !!next_classes[key]; 5198 if (prev_classes == null || is_present !== !!prev_classes[key]) dom.classList.toggle(key, is_present); 5199 } 5200 return next_classes; 5201 } 5202 //#endregion 5203 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/style.js 5204 /** 5205 * @param {Element & ElementCSSInlineStyle} dom 5206 * @param {Record<string, any>} prev 5207 * @param {Record<string, any>} next 5208 * @param {string} [priority] 5209 */ 5210 function update_styles(dom, prev = {}, next, priority) { 5211 for (var key in next) { 5212 var value = next[key]; 5213 if (prev[key] !== value) if (next[key] == null) dom.style.removeProperty(key); 5214 else dom.style.setProperty(key, value, priority); 5215 } 5216 } 5217 /** 5218 * @param {Element & ElementCSSInlineStyle} dom 5219 * @param {string | null} value 5220 * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles] 5221 * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles] 5222 */ 5223 function set_style(dom, value, prev_styles, next_styles) { 5224 var prev = dom[STYLE_CACHE]; 5225 if (hydrating || prev !== value) { 5226 var next_style_attr = to_style(value, next_styles); 5227 if (!hydrating || next_style_attr !== dom.getAttribute("style")) if (next_style_attr == null) dom.removeAttribute("style"); 5228 else dom.style.cssText = next_style_attr; 5229 /** @type {any} */ dom[STYLE_CACHE] = value; 5230 } else if (next_styles) if (Array.isArray(next_styles)) { 5231 update_styles(dom, prev_styles?.[0], next_styles[0]); 5232 update_styles(dom, prev_styles?.[1], next_styles[1], "important"); 5233 } else update_styles(dom, prev_styles, next_styles); 5234 return next_styles; 5235 } 5236 //#endregion 5237 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/bindings/select.js
5238 /** 5239 * Selects the correct option(s) (depending on whether this is a multiple select) 5240 * @template V 5241 * @param {HTMLSelectElement} select 5242 * @param {V} value 5243 * @param {boolean} mounting 5244 */ 5245 function select_option(select, value, mounting = false) { 5246 if (select.multiple) { 5247 if (value == void 0) return; 5248 if (!is_array(value)) return select_multiple_invalid_value(); 5249 for (var option of select.options) option.selected = value.includes(get_option_value(option)); 5250 return; 5251 } 5252 for (option of select.options) if (is(get_option_value(option), value)) { 5253 option.selected = true; 5254 return; 5255 } 5256 if (!mounting || value !== void 0) select.selectedIndex = -1; 5257 } 5258 /** 5259 * Selects the correct option(s) if `value` is given, 5260 * and then sets up a mutation observer to sync the 5261 * current selection to the dom when it changes. Such 5262 * changes could for example occur when options are 5263 * inside an `#each` block. 5264 * @param {HTMLSelectElement} select 5265 */ 5266 function init_select(select) { 5267 var observer = new MutationObserver(() => { 5268 select_option(select, select.__value); 5269 }); 5270 observer.observe(select, { 5271 childList: true, 5272 subtree: true, 5273 attributes: true, 5274 attributeFilter: ["value"] 5275 }); 5276 teardown(() => { 5277 observer.disconnect(); 5278 }); 5279 } 5280 /** 5281 * @param {HTMLSelectElement} select 5282 * @param {() => unknown} get 5283 * @param {(value: unknown) => void} set 5284 * @returns {void} 5285 */ 5286 function bind_select_value(select, get, set = get) { 5287 var batches = /* @__PURE__ */ new WeakSet(); 5288 var mounting = true; 5289 listen_to_event_and_reset_event(select, "change", (is_reset) => { 5290 var query = is_reset ? "[selected]" : ":checked"; 5291 /** @type {unknown} */ 5292 var value; 5293 if (select.multiple) value = [].map.call(select.querySelectorAll(query), get_option_value); 5294 else { 5295 /** @type {HTMLOptionElement | null} */ 5296 var selected_option = select.querySelector(query) ?? select.querySelector("option:not([disabled])"); 5297 value = selected_option && get_option_value(selected_option); 5298 } 5299 set(value); 5300 select.__value = value; 5301 if (current_batch !== null) batches.add(current_batch); 5302 }); 5303 effect(() => { 5304 var value = get(); 5305 if (select === document.activeElement) { 5306 var batch = async_mode_flag ? previous_batch : current_batch; 5307 if (batches.has(batch)) return; 5308 } 5309 select_option(select, value, mounting); 5310 if (mounting && value === void 0) { 5311 /** @type {HTMLOptionElement | null} */ 5312 var selected_option = select.querySelector(":checked"); 5313 if (selected_option !== null) { 5314 value = get_option_value(selected_option); 5315 set(value); 5316 } 5317 } 5318 select.__value = value; 5319 mounting = false; 5320 }); 5321 init_select(select); 5322 } 5323 /** @param {HTMLOptionElement} option */ 5324 function get_option_value(option) { 5325 if ("__value" in option) return option.__value; 5326 else return option.value; 5327 } 5328 //#endregion 5329 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/attributes.js 5330 /** @import { Blocker, Effect } from '#client' */ 5331 var CLASS = Symbol("class"); 5332 var STYLE = Symbol("style"); 5333 var IS_CUSTOM_ELEMENT = Symbol("is custom element"); 5334 var IS_HTML = Symbol("is html"); 5335 var LINK_TAG = IS_XHTML ? "link" : "LINK"; 5336 var INPUT_TAG = IS_XHTML ? "input" : "INPUT"; 5337 var OPTION_TAG = IS_XHTML ? "option" : "OPTION"; 5338 var SELECT_TAG = IS_XHTML ? "select" : "SELECT"; 5339 var PROGRESS_TAG = IS_XHTML ? "progress" : "PROGRESS"; 5340 /** 5341 * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need 5342 * to remove it upon hydration to avoid a bug when someone resets the form value. 5343 * @param {HTMLInputElement} input 5344 * @returns {void} 5345 */ 5346 function remove_input_defaults(input) { 5347 if (!hydrating) return; 5348 var already_removed = false; 5349 var remove_defaults = () => { 5350 if (already_removed) return; 5351 already_removed = true; 5352 if (input.hasAttribute("value")) { 5353 var value = input.value; 5354 set_attribute(input, "value", null); 5355 input.value = value; 5356 } 5357 if (input.hasAttribute("checked")) { 5358 var checked = input.checked; 5359 set_attribute(input, "checked", null); 5360 input.checked = checked; 5361 } 5362 }; 5363 /** @type {any} */ input[FORM_RESET_HANDLER] = remove_defaults; 5364 queue_micro_task(remove_defaults); 5365 add_form_reset_listener(); 5366 } 5367 /** 5368 * @param {Element} element 5369 * @param {any} value 5370 */ 5371 function set_value(element, value) { 5372 var attributes = get_attributes(element); 5373 if (attributes.value === (attributes.value = value ?? void 0) || element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG)) return; 5374 element.value = value ?? ""; 5375 }
5376 /** 5377 * @param {Element} element 5378 * @param {boolean} checked 5379 */ 5380 function set_checked(element, checked) { 5381 var attributes = get_attributes(element); 5382 if (attributes.checked === (attributes.checked = checked ?? void 0)) return; 5383 element.checked = checked; 5384 } 5385 /** 5386 * Sets the `selected` attribute on an `option` element. 5387 * Not set through the property because that doesn't reflect to the DOM, 5388 * which means it wouldn't be taken into account when a form is reset. 5389 * @param {HTMLOptionElement} element 5390 * @param {boolean} selected 5391 */ 5392 function set_selected(element, selected) { 5393 if (selected) { 5394 if (!element.hasAttribute("selected")) element.setAttribute("selected", ""); 5395 } else element.removeAttribute("selected"); 5396 } 5397 /** 5398 * @param {Element} element 5399 * @param {string} attribute 5400 * @param {string | null} value 5401 * @param {boolean} [skip_warning] 5402 */ 5403 function set_attribute(element, attribute, value, skip_warning) { 5404 var attributes = get_attributes(element); 5405 if (hydrating) { 5406 attributes[attribute] = element.getAttribute(attribute); 5407 if (attribute === "src" || attribute === "srcset" || attribute === "href" && element.nodeName === LINK_TAG) { 5408 if (!skip_warning); 5409 return; 5410 } 5411 } 5412 if (attributes[attribute] === (attributes[attribute] = value)) return; 5413 if (attribute === "loading") element[LOADING_ATTR_SYMBOL] = value; 5414 if (value == null) element.removeAttribute(attribute); 5415 else if (typeof value !== "string" && get_setters(element).includes(attribute)) element[attribute] = value; 5416 else element.setAttribute(attribute, value); 5417 } 5418 /** 5419 * @param {HTMLElement} node 5420 * @param {string} prop 5421 * @param {any} value 5422 */ 5423 function set_custom_element_data(node, prop, value) { 5424 var previous_reaction = active_reaction; 5425 var previous_effect = active_effect; 5426 let was_hydrating = hydrating; 5427 if (hydrating) set_hydrating(false); 5428 set_active_reaction(null); 5429 set_active_effect(null); 5430 try { 5431 if (prop !== "style" && (setters_cache.has(node.getAttribute("is") || node.nodeName) || !customElements || customElements.get(node.getAttribute("is") || node.nodeName.toLowerCase()) ? get_setters(node).includes(prop) : value && typeof value === "object")) node[prop] = value; 5432 else set_attribute(node, prop, value == null ? value : String(value)); 5433 } finally { 5434 set_active_reaction(previous_reaction); 5435 set_active_effect(previous_effect); 5436 if (was_hydrating) set_hydrating(true); 5437 } 5438 } 5439 /** 5440 * Spreads attributes onto a DOM element, taking into account the currently set attributes 5441 * @param {Element & ElementCSSInlineStyle} element 5442 * @param {Record<string | symbol, any> | undefined} prev 5443 * @param {Record<string | symbol, any>} next New attributes - this function mutates this object 5444 * @param {string} [css_hash] 5445 * @param {boolean} [should_remove_defaults] 5446 * @param {boolean} [skip_warning] 5447 * @returns {Record<string, any>} 5448 */ 5449 function set_attributes(element, prev, next, css_hash, should_remove_defaults = false, skip_warning = false) { 5450 if (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) { 5451 var input = element; 5452 if (!((input.type === "checkbox" ? "defaultChecked" : "defaultValue") in next)) remove_input_defaults(input); 5453 } 5454 var attributes = get_attributes(element); 5455 var is_custom_element = attributes[IS_CUSTOM_ELEMENT]; 5456 var preserve_attribute_case = !attributes[IS_HTML]; 5457 let is_hydrating_custom_element = hydrating && is_custom_element; 5458 if (is_hydrating_custom_element) set_hydrating(false); 5459 var current = prev || {}; 5460 var is_option_element = element.nodeName === OPTION_TAG; 5461 for (var key in prev) if (!(key in next)) next[key] = null; 5462 if (next.class) next.class = clsx(next.class); 5463 else if (css_hash || next[CLASS]) next.class = null; 5464 if (next[STYLE]) next.style ??= null; 5465 var setters = get_setters(element); 5466 if (element.nodeName === INPUT_TAG && "type" in next && ("value" in next || "__value" in next)) { 5467 var type = next.type; 5468 if (type !== current.type || type === void 0 && element.hasAttribute("type")) { 5469 current.type = type; 5470 set_attribute(element, "type", type, skip_warning); 5471 } 5472 } 5473 for (const key in next) { 5474 let value = next[key];
5475 if (is_option_element && key === "value" && value == null) { 5476 element.value = element.__value = ""; 5477 current[key] = value; 5478 continue; 5479 } 5480 if (key === "class") { 5481 set_class(element, element.namespaceURI === "http://www.w3.org/1999/xhtml", value, css_hash, prev?.[CLASS], next[CLASS]); 5482 current[key] = value; 5483 current[CLASS] = next[CLASS]; 5484 continue; 5485 } 5486 if (key === "style") { 5487 set_style(element, value, prev?.[STYLE], next[STYLE]); 5488 current[key] = value; 5489 current[STYLE] = next[STYLE]; 5490 continue; 5491 } 5492 var prev_value = current[key]; 5493 if (value === prev_value && !(value === void 0 && element.hasAttribute(key))) continue; 5494 current[key] = value; 5495 var prefix = key[0] + key[1]; 5496 if (prefix === "$$") continue; 5497 if (prefix === "on") { 5498 /** @type {{ capture?: true }} */ 5499 const opts = {}; 5500 const event_handle_key = "$$" + key; 5501 let event_name = key.slice(2); 5502 var is_delegated = can_delegate_event(event_name); 5503 if (is_capture_event(event_name)) { 5504 event_name = event_name.slice(0, -7); 5505 opts.capture = true; 5506 } 5507 if (!is_delegated && prev_value) { 5508 if (value != null) continue; 5509 element.removeEventListener(event_name, current[event_handle_key], opts); 5510 current[event_handle_key] = null; 5511 } 5512 if (is_delegated) { 5513 delegated(event_name, element, value); 5514 delegate([event_name]); 5515 } else if (value != null) { 5516 /** 5517 * @this {any} 5518 * @param {Event} evt 5519 */ 5520 function handle(evt) { 5521 current[key].call(this, evt); 5522 } 5523 current[event_handle_key] = create_event(event_name, element, handle, opts); 5524 } 5525 } else if (key === "style") set_attribute(element, key, value); 5526 else if (key === "autofocus") autofocus(element, Boolean(value)); 5527 else if (!is_custom_element && (key === "__value" || key === "value" && value != null)) element.value = element.__value = value; 5528 else if (key === "selected" && is_option_element) set_selected(element, value); 5529 else { 5530 var name = key; 5531 if (!preserve_attribute_case) name = normalize_attribute(name); 5532 var is_default = name === "defaultValue" || name === "defaultChecked"; 5533 if (value == null && !is_custom_element && !is_default) { 5534 attributes[key] = null; 5535 if (name === "value" || name === "checked") { 5536 let input = element; 5537 const use_default = prev === void 0; 5538 if (name === "value") { 5539 let previous = input.defaultValue; 5540 input.removeAttribute(name); 5541 input.defaultValue = previous; 5542 input.value = input.__value = use_default ? previous : null; 5543 } else { 5544 let previous = input.defaultChecked; 5545 input.removeAttribute(name); 5546 input.defaultChecked = previous; 5547 input.checked = use_default ? previous : false; 5548 } 5549 } else element.removeAttribute(key); 5550 } else if (is_default || setters.includes(name) && (is_custom_element || typeof value !== "string")) { 5551 element[name] = value; 5552 if (name in attributes) attributes[name] = UNINITIALIZED; 5553 } else if (typeof value !== "function") set_attribute(element, name, value, skip_warning); 5554 } 5555 } 5556 if (is_hydrating_custom_element) set_hydrating(true); 5557 return current; 5558 } 5559 /** 5560 * @param {Element & ElementCSSInlineStyle} element 5561 * @param {(...expressions: any) => Record<string | symbol, any>} fn 5562 * @param {Array<() => any>} sync 5563 * @param {Array<() => Promise<any>>} async 5564 * @param {Blocker[]} blockers 5565 * @param {string} [css_hash] 5566 * @param {boolean} [should_remove_defaults] 5567 * @param {boolean} [skip_warning] 5568 */ 5569 function attribute_effect(element, fn, sync = [], async = [], blockers = [], css_hash, should_remove_defaults = false, skip_warning = false) { 5570 flatten(blockers, sync, async, (values) => { 5571 /** @type {Record<string | symbol, any> | undefined} */ 5572 var prev = void 0; 5573 /** @type {Record<symbol, Effect>} */ 5574 var effects = {}; 5575 var is_select = element.nodeName === SELECT_TAG; 5576 var inited = false; 5577 managed(() => { 5578 var next = fn(...values.map(get$2)); 5579 /** @type {Record<string | symbol, any>} */ 5580 var current = set_attributes(element, prev, next, css_hash, should_remove_defaults, skip_warning); 5581 if (inited && is_select && "value" in next) select_option(element, next.value); 5582 for (let symbol of Object.getOwnPropertySymbols(effects)) if (!next[symbol]) destroy_effect(effects[symbol]); 5583 for (let symbol of Object.getOwnPropertySymbols(next)) { 5584 var n = next[symbol]; 5585 if (symbol.description === "@attach" && (!prev || n !== prev[symbol])) { 5586 if (effects[symbol]) destroy_effect(effects[symbol]); 5587 effects[symbol] = branch(() => attach(element, () => n)); 5588 } 5589 current[symbol] = n; 5590 } 5591 prev = current; 5592 }); 5593 if (is_select) { 5594 var select = element; 5595 effect(() => { 5596 select_option( 5597 select, 5598 /** @type {Record<string | symbol, any>} */ 5599 prev.value, 5600 true 5601 ); 5602 init_select(select); 5603 }); 5604 } 5605 inited = true; 5606 }); 5607 } 5608 /** 5609 * 5610 * @param {Element} element 5611 */ 5612 function get_attributes(element) { 5613 return element[ATTRIBUTES_CACHE] ??= { 5614 [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"), 5615 [IS_HTML]: element.namespaceURI === NAMESPACE_HTML 5616 }; 5617 } 5618 /** @type {Map<string, string[]>} */
5619 var setters_cache = /* @__PURE__ */ new Map(); 5620 /** @param {Element} element */ 5621 function get_setters(element) { 5622 var cache_key = element.getAttribute("is") || element.nodeName; 5623 var setters = setters_cache.get(cache_key); 5624 if (setters) return setters; 5625 setters_cache.set(cache_key, setters = []); 5626 var descriptors; 5627 var proto = element; 5628 var element_proto = Element.prototype; 5629 while (element_proto !== proto) { 5630 descriptors = get_descriptors(proto); 5631 for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.push(key); 5632 proto = get_prototype_of(proto); 5633 } 5634 return setters; 5635 } 5636 //#endregion 5637 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/customizable-select.js 5638 /** @type {boolean | null} */ 5639 var supported = null; 5640 /** 5641 * Checks if the browser supports rich HTML content inside `<option>` elements. 5642 * Modern browsers preserve HTML elements inside options, while older browsers 5643 * strip them during parsing, leaving only text content. 5644 * @returns {boolean} 5645 */ 5646 function is_supported() { 5647 if (supported === null) { 5648 var select = create_element("select"); 5649 select.innerHTML = create_trusted_html("<option><span>t</span></option>"); 5650 supported = select.firstChild?.firstChild?.nodeType === 1; 5651 } 5652 return supported; 5653 } 5654 /** 5655 * Handles rich HTML content inside `<option>`, `<optgroup>`, or `<select>` elements with browser-specific branching. 5656 * Modern browsers preserve HTML inside options, while older browsers strip it to text only. 5657 * 5658 * @param {HTMLOptionElement | HTMLOptGroupElement | HTMLSelectElement} element The element to process 5659 * @param {() => void} rich_fn Function to process rich HTML content (modern browsers) 5660 */ 5661 function customizable_select(element, rich_fn) { 5662 var was_hydrating = hydrating; 5663 if (!is_supported()) { 5664 set_hydrating(false); 5665 element.textContent = ""; 5666 element.append(create_comment("")); 5667 } 5668 try { 5669 rich_fn(); 5670 } finally { 5671 if (was_hydrating) if (hydrating) reset(element); 5672 else { 5673 set_hydrating(true); 5674 set_hydrate_node(element); 5675 } 5676 } 5677 } 5678 //#endregion 5679 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js 5680 /** @import { Batch } from '../../../reactivity/batch.js' */ 5681 /** 5682 * @param {HTMLInputElement} input 5683 * @param {() => unknown} get 5684 * @param {(value: unknown) => void} set 5685 * @returns {void} 5686 */ 5687 function bind_value(input, get, set = get) { 5688 var batches = /* @__PURE__ */ new WeakSet(); 5689 listen_to_event_and_reset_event(input, "input", async (is_reset) => { 5690 /** @type {any} */ 5691 var value = is_reset ? input.defaultValue : input.value; 5692 value = is_numberlike_input(input) ? to_number(value) : value; 5693 set(value); 5694 if (current_batch !== null) batches.add(current_batch); 5695 await tick(); 5696 if (value !== (value = get())) { 5697 var start = input.selectionStart; 5698 var end = input.selectionEnd; 5699 var length = input.value.length; 5700 input.value = value ?? ""; 5701 if (end !== null) { 5702 var new_length = input.value.length; 5703 if (start === end && end === length && new_length > length) { 5704 input.selectionStart = new_length; 5705 input.selectionEnd = new_length; 5706 } else { 5707 input.selectionStart = start; 5708 input.selectionEnd = Math.min(end, new_length); 5709 } 5710 } 5711 } 5712 }); 5713 if (hydrating && input.defaultValue !== input.value || untrack(get) == null && input.value) { 5714 set(is_numberlike_input(input) ? to_number(input.value) : input.value); 5715 if (current_batch !== null) batches.add(current_batch); 5716 } 5717 render_effect(() => { 5718 var value = get(); 5719 if (input === document.activeElement) { 5720 var batch = async_mode_flag ? previous_batch : current_batch; 5721 if (batches.has(batch)) return; 5722 } 5723 if (is_numberlike_input(input) && value === to_number(input.value)) return; 5724 if (input.type === "date" && !value && !input.value) return; 5725 if (value !== input.value) input.value = value ?? ""; 5726 }); 5727 } 5728 /** @type {Set<HTMLInputElement[]>} */ 5729 var pending = /* @__PURE__ */ new Set(); 5730 /** 5731 * @param {HTMLInputElement[]}
5731 inputs 5732 * @param {null | [number]} group_index 5733 * @param {HTMLInputElement} input 5734 * @param {() => unknown} get 5735 * @param {(value: unknown) => void} set 5736 * @returns {void} 5737 */ 5738 function bind_group(inputs, group_index, input, get, set = get) { 5739 var is_checkbox = input.getAttribute("type") === "checkbox"; 5740 var binding_group = inputs; 5741 let hydration_mismatch = false; 5742 if (group_index !== null) for (var index of group_index) binding_group = binding_group[index] ??= []; 5743 binding_group.push(input); 5744 listen_to_event_and_reset_event(input, "change", () => { 5745 var value = input.__value; 5746 if (is_checkbox) value = get_binding_group_value(binding_group, value, input.checked); 5747 set(value); 5748 }, () => set(is_checkbox ? [] : null)); 5749 render_effect(() => { 5750 var value = get(); 5751 if (hydrating && input.defaultChecked !== input.checked) { 5752 hydration_mismatch = true; 5753 return; 5754 } 5755 if (is_checkbox) { 5756 value = value || []; 5757 input.checked = value.includes(input.__value); 5758 } else input.checked = is(input.__value, value); 5759 }); 5760 teardown(() => { 5761 var index = binding_group.indexOf(input); 5762 if (index !== -1) binding_group.splice(index, 1); 5763 }); 5764 if (!pending.has(binding_group)) { 5765 pending.add(binding_group); 5766 queue_micro_task(() => { 5767 binding_group.sort((a, b) => a.compareDocumentPosition(b) === 4 ? -1 : 1); 5768 pending.delete(binding_group); 5769 }); 5770 } 5771 queue_micro_task(() => { 5772 if (hydration_mismatch) { 5773 var value; 5774 if (is_checkbox) value = get_binding_group_value(binding_group, value, input.checked); 5775 else value = binding_group.find((input) => input.checked)?.__value; 5776 set(value); 5777 } 5778 }); 5779 } 5780 /** 5781 * @param {HTMLInputElement} input 5782 * @param {() => unknown} get 5783 * @param {(value: unknown) => void} set 5784 * @returns {void} 5785 */ 5786 function bind_checked(input, get, set = get) { 5787 listen_to_event_and_reset_event(input, "change", (is_reset) => { 5788 set(is_reset ? input.defaultChecked : input.checked); 5789 }); 5790 if (hydrating && input.defaultChecked !== input.checked || untrack(get) == null) set(input.checked); 5791 render_effect(() => { 5792 var value = get(); 5793 input.checked = Boolean(value); 5794 }); 5795 } 5796 /** 5797 * @template V 5798 * @param {Array<HTMLInputElement>} group 5799 * @param {V} __value 5800 * @param {boolean} checked 5801 * @returns {V[]} 5802 */ 5803 function get_binding_group_value(group, __value, checked) { 5804 /** @type {Set<V>} */ 5805 var value = /* @__PURE__ */ new Set(); 5806 for (var i = 0; i < group.length; i += 1) if (group[i].checked) value.add(group[i].__value); 5807 if (!checked) value.delete(__value); 5808 return Array.from(value); 5809 } 5810 /** 5811 * @param {HTMLInputElement} input 5812 */ 5813 function is_numberlike_input(input) { 5814 var type = input.type; 5815 return type === "number" || type === "range"; 5816 } 5817 /** 5818 * @param {string} value 5819 */ 5820 function to_number(value) { 5821 return value === "" ? null : +value; 5822 } 5823 //#endregion 5824 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js 5825 /** @import { ComponentContext, Effect } from '#client' */ 5826 /** 5827 * @param {any} bound_value 5828 * @param {Element} element_or_component 5829 * @returns {boolean} 5830 */ 5831 function is_bound_this(bound_value, element_or_component) { 5832 return bound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component; 5833 } 5834 /** 5835 * @param {any} element_or_component 5836 * @param {(value: unknown, ...parts: unknown[]) => void} update 5837 * @param {(...parts: unknown[]) => unknown} get_value 5838 * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block, 5839 * returns all the parts of the each block context that are used in the expression 5840 * @returns {void} 5841 */ 5842 function bind_this(element_or_component = {}, update, get_value, get_parts) { 5843 var component_effect = component_context.r; 5844 var parent = active_effect; 5845 effect(() => { 5846 /** @type {unknown[]} */ 5847 var old_parts; 5848 /** @type {unknown[]} */ 5849 var parts; 5850 render_effect(() => { 5851 old_parts = parts; 5852 parts = get_parts?.() || []; 5853 untrack(() => { 5854 if (!is_bound_this(get_value(...parts), element_or_component)) { 5855 update(element_or_component, ...parts); 5856 if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) update(null, ...old_parts); 5857 } 5858 }); 5859 }); 5860 return () => { 5861 let p = parent; 5862 while (p !== component_effect && p.parent !== null && p.parent.f & 33554432) p = p.parent; 5863 const teardown = () => { 5864 if (parts && is_bound_this(get_value(...parts), element_or_component)) update(null, ...parts); 5865 }; 5866 const original_teardown = p.teardown; 5867 p.teardown = () => { 5868 teardown(); 5869 original_teardown?.(); 5870 }; 5871 }; 5872 }); 5873 return element_or_component; 5874 } 5875 //#endregion 5876 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js
5877 /** @import { ComponentContextLegacy } from '#client' */ 5878 /** 5879 * Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects 5880 * @param {boolean} [immutable] 5881 */ 5882 function init$1(immutable = false) { 5883 const context = component_context; 5884 const callbacks = context.l.u; 5885 if (!callbacks) return; 5886 let props = () => deep_read_state(context.s); 5887 if (immutable) { 5888 let version = 0; 5889 let prev = {}; 5890 const d = /* @__PURE__ */ derived(() => { 5891 let changed = false; 5892 const props = context.s; 5893 for (const key in props) if (props[key] !== prev[key]) { 5894 prev[key] = props[key]; 5895 changed = true; 5896 } 5897 if (changed) version++; 5898 return version; 5899 }); 5900 props = () => get$2(d); 5901 } 5902 if (callbacks.b.length) user_pre_effect(() => { 5903 observe_all(context, props); 5904 run_all(callbacks.b); 5905 }); 5906 user_effect(() => { 5907 const fns = untrack(() => callbacks.m.map(run)); 5908 return () => { 5909 for (const fn of fns) if (typeof fn === "function") fn(); 5910 }; 5911 }); 5912 if (callbacks.a.length) user_effect(() => { 5913 observe_all(context, props); 5914 run_all(callbacks.a); 5915 }); 5916 } 5917 /** 5918 * Invoke the getter of all signals associated with a component 5919 * so they can be registered to the effect this function is called in. 5920 * @param {ComponentContextLegacy} context 5921 * @param {(() => void)} props 5922 */ 5923 function observe_all(context, props) { 5924 if (context.l.s) for (const signal of context.l.s) get$2(signal); 5925 props(); 5926 } 5927 //#endregion 5928 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/reactivity/props.js 5929 /** @import { Derived, Effect, Source } from './types.js' */ 5930 /** 5931 * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`). 5932 * Is passed the full `$$props` object and excludes the named props. 5933 * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Set<string | symbol>, name?: string }>}} 5934 */ 5935 var rest_props_handler = { 5936 get(target, key) { 5937 if (target.exclude.has(key)) return; 5938 return target.props[key]; 5939 }, 5940 set(target, key) { 5941 return false; 5942 }, 5943 getOwnPropertyDescriptor(target, key) { 5944 if (target.exclude.has(key)) return; 5945 if (key in target.props) return { 5946 enumerable: true, 5947 configurable: true, 5948 value: target.props[key] 5949 }; 5950 }, 5951 has(target, key) { 5952 if (target.exclude.has(key)) return false; 5953 return key in target.props; 5954 }, 5955 ownKeys(target) { 5956 return Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key)); 5957 } 5958 }; 5959 /** 5960 * @param {Record<string, unknown>} props 5961 * @param {Set<string>} exclude 5962 * @param {string} [name] 5963 * @returns {Record<string, unknown>} 5964 */ 5965 /*#__NO_SIDE_EFFECTS__*/ 5966 function rest_props(props, exclude, name) { 5967 return new Proxy({ 5968 props, 5969 exclude 5970 }, rest_props_handler); 5971 } 5972 /** 5973 * The proxy handler for spread props. Handles the incoming array of props 5974 * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps 5975 * them so that the whole thing is passed to the component as the `$$props` argument. 5976 * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}} 5977 */ 5978 var spread_props_handler = { 5979 get(target, key) { 5980 let i = target.props.length; 5981 while (i--) { 5982 let p = target.props[i]; 5983 if (is_function(p)) p = p(); 5984 if (typeof p === "object" && p !== null && key in p) return p[key]; 5985 } 5986 }, 5987 set(target, key, value) { 5988 let i = target.props.length; 5989 while (i--) { 5990 let p = target.props[i]; 5991 if (is_function(p)) p = p(); 5992 const desc = get_descriptor(p, key); 5993 if (desc && desc.set) { 5994 desc.set(value); 5995 return true; 5996 } 5997 } 5998 return false; 5999 }, 6000 getOwnPropertyDescriptor(target, key) { 6001 let i = target.props.length; 6002 while (i--) { 6003 let p = target.props[i]; 6004 if (is_function(p)) p = p(); 6005 if (typeof p === "object" && p !== null && key in p) { 6006 const descriptor = get_descriptor(p, key); 6007 if (descriptor && !descriptor.configurable) descriptor.configurable = true; 6008 return descriptor; 6009 } 6010 } 6011 }, 6012 has(target, key) { 6013 if (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;
6014 for (let p of target.props) { 6015 if (is_function(p)) p = p(); 6016 if (p != null && key in p) return true; 6017 } 6018 return false; 6019 }, 6020 ownKeys(target) { 6021 /** @type {Array<string | symbol>} */ 6022 const keys = []; 6023 for (let p of target.props) { 6024 if (is_function(p)) p = p(); 6025 if (!p) continue; 6026 for (const key in p) if (!keys.includes(key)) keys.push(key); 6027 for (const key of Object.getOwnPropertySymbols(p)) if (!keys.includes(key)) keys.push(key); 6028 } 6029 return keys; 6030 } 6031 }; 6032 /** 6033 * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props 6034 * @returns {any} 6035 */ 6036 function spread_props(...props) { 6037 return new Proxy({ props }, spread_props_handler); 6038 } 6039 /** 6040 * This function is responsible for synchronizing a possibly bound prop with the inner component state. 6041 * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value. 6042 * @template V 6043 * @param {Record<string, unknown>} props 6044 * @param {string} key 6045 * @param {number} flags 6046 * @param {V | (() => V)} [fallback] 6047 * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))} 6048 */ 6049 function prop(props, key, flags, fallback) { 6050 var runes = !legacy_mode_flag || (flags & 2) !== 0; 6051 var bindable = (flags & 8) !== 0; 6052 var lazy = (flags & 16) !== 0; 6053 var fallback_value = fallback; 6054 var fallback_dirty = true; 6055 var fallback_signal = void 0; 6056 var get_fallback = () => { 6057 if (lazy && runes) { 6058 fallback_signal ??= /* @__PURE__ */ derived(fallback); 6059 return get$2(fallback_signal); 6060 } 6061 if (fallback_dirty) { 6062 fallback_dirty = false; 6063 fallback_value = lazy ? untrack(fallback) : fallback; 6064 } 6065 return fallback_value; 6066 }; 6067 /** @type {((v: V) => void) | undefined} */ 6068 let setter; 6069 if (bindable) { 6070 var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props; 6071 setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0); 6072 } 6073 /** @type {V} */ 6074 var initial_value; 6075 var is_store_sub = false; 6076 if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]); 6077 else initial_value = props[key]; 6078 if (initial_value === void 0 && fallback !== void 0) { 6079 initial_value = get_fallback(); 6080 if (setter) { 6081 if (runes) props_invalid_value(key); 6082 setter(initial_value); 6083 } 6084 } 6085 /** @type {() => V} */ 6086 var getter; 6087 if (runes) getter = () => { 6088 var value = props[key]; 6089 if (value === void 0) return get_fallback(); 6090 fallback_dirty = true; 6091 return value; 6092 }; 6093 else getter = () => { 6094 var value = props[key]; 6095 if (value !== void 0) fallback_value = void 0; 6096 return value === void 0 ? fallback_value : value; 6097 }; 6098 if (runes && (flags & 4) === 0) return getter; 6099 if (setter) { 6100 var legacy_parent = props.$$legacy; 6101 return (function(value, mutation) { 6102 if (arguments.length > 0) { 6103 if (!runes || !mutation || legacy_parent || is_store_sub) 6104 /** @type {Function} */ setter(mutation ? getter() : value); 6105 return value; 6106 } 6107 return getter(); 6108 }); 6109 } 6110 var overridden = false; 6111 var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => { 6112 overridden = false; 6113 return getter(); 6114 }); 6115 if (bindable) get$2(d); 6116 var parent_effect = active_effect; 6117 return (function(value, mutation) { 6118 if (arguments.length > 0) { 6119 const new_value = mutation ? get$2(d) : runes && bindable ? proxy(value) : value; 6120 set(d, new_value); 6121 overridden = true; 6122 if (fallback_value !== void 0) fallback_value = new_value; 6123 return value; 6124 } 6125 if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v; 6126 return get$2(d); 6127 }); 6128 } 6129 //#endregion 6130 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/legacy/legacy-client.js 6131 /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */ 6132 /** 6133 * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component. 6134 * 6135 * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5. 6136 * 6137 * @template {Record<string, any>} Props 6138 * @template {Record<string, any>} Exports 6139 * @template {Record<string, any>} Events 6140 * @template {Record<string, any>} Slots 6141 * 6142 * @param {ComponentConstructorOptions<Props> & { 6143 * component: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>; 6144 * }} options 6145 * @returns {SvelteComponent<Props, Events, Slots> & Exports} 6146 */ 6147 function createClassComponent(options) { 6148 return new Svelte4Component(options); 6149 } 6150 /** 6151 * Support using the component as both a class and function during the transition period 6152 * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType 6153 */ 6154 var Svelte4Component = class { 6155 /** @type {any} */ 6156 #events; 6157 /** @type {Record<string, any>} */ 6158 #instance; 6159 /** 6160 * @param {ComponentConstructorOptions & { 6161 * component: any; 6162 * }} options 6163 */ 6164 constructor(options) { 6165 var sources = /* @__PURE__ */ new Map(); 6166 /** 6167 * @param {string | symbol} key 6168 * @param {unknown} value 6169 */ 6170 var add_source = (key, value) => { 6171 var s = /* @__PURE__ */ mutable_source(value, false, false); 6172 sources.set(key, s); 6173 return s; 6174 }; 6175 const props = new Proxy({ 6176 ...options.props || {}, 6177 $$events: {} 6178 }, { 6179 get(target, prop) { 6180 return get$2(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop))); 6181 }, 6182 has(target, prop) { 6183 if (prop === LEGACY_PROPS) return true; 6184 get$2(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop))); 6185 return Reflect.has(target, prop); 6186 }, 6187 set(target, prop, value) { 6188 set(sources.get(prop) ?? add_source(prop, value), value); 6189 return Reflect.set(target, prop, value); 6190 } 6191 }); 6192 this.#instance = (options.hydrate ? hydrate : mount)(options.component, { 6193 target: options.target, 6194 anchor: options.anchor, 6195 props, 6196 context: options.context, 6197 intro: options.intro ?? false, 6198 recover: options.recover, 6199 transformError: options.transformError 6200 }); 6201 if (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) flushSync(); 6202 this.#events = props.$$events; 6203 for (const key of Object.keys(this.#instance)) { 6204 if (key === "$set" || key === "$destroy" || key === "$on") continue; 6205 define_property(this, key, { 6206 get() { 6207 return this.#instance[key]; 6208 }, 6209 /** @param {any} value */ 6210 set(value) { 6211 this.#instance[key] = value; 6212 }, 6213 enumerable: true 6214 }); 6215 } 6216 this.#instance.$set = (next) => { 6217 Object.assign(props, next); 6218 }; 6219 this.#instance.$destroy = () => { 6220 unmount(this.#instance); 6221 }; 6222 } 6223 /** @param {Record<string, any>} props */ 6224 $set(props) { 6225 this.#instance.$set(props); 6226 } 6227 /** 6228 * @param {string} event 6229 * @param {(...args: any[]) => any} callback 6230 * @returns {any} 6231 */ 6232 $on(event, callback) { 6233 this.#events[event] = this.#events[event] || []; 6234 /** @param {any[]} args */ 6235 const cb = (...args) => callback.call(this, ...args); 6236 this.#events[event].push(cb); 6237 return () => { 6238 this.#events[event] = this.#events[event].filter( 6239 /** @param {any} fn */ 6240 (fn) => fn !== cb 6241 ); 6242 }; 6243 } 6244 $destroy() { 6245 this.#instance.$destroy(); 6246 } 6247 }; 6248 //#endregion 6249 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
6250 /** 6251 * @typedef {Object} CustomElementPropDefinition 6252 * @property {string} [attribute] 6253 * @property {boolean} [reflect] 6254 * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type] 6255 */ 6256 /** @type {any} */ 6257 var SvelteElement; 6258 if (typeof HTMLElement === "function") SvelteElement = class extends HTMLElement { 6259 /** The Svelte component constructor */ 6260 $$ctor; 6261 /** Slots */ 6262 $$s; 6263 /** @type {any} The Svelte component instance */ 6264 $$c; 6265 /** Whether or not the custom element is connected */ 6266 $$cn = false; 6267 /** @type {Record<string, any>} Component props data */ 6268 $$d = {}; 6269 /** `true` if currently in the process of reflecting component props back to attributes */ 6270 $$r = false; 6271 /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */ 6272 $$p_d = {}; 6273 /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */ 6274 $$l = {}; 6275 /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */ 6276 $$l_u = /* @__PURE__ */ new Map(); 6277 /** @type {any} The managed render effect for reflecting attributes */ 6278 $$me; 6279 /** @type {ShadowRoot | null} The ShadowRoot of the custom element */ 6280 $$shadowRoot = null; 6281 /** 6282 * @param {*} $$componentCtor 6283 * @param {*} $$slots 6284 * @param {ShadowRootInit | undefined} shadow_root_init 6285 */ 6286 constructor($$componentCtor, $$slots, shadow_root_init) { 6287 super(); 6288 this.$$ctor = $$componentCtor; 6289 this.$$s = $$slots; 6290 if (shadow_root_init) this.$$shadowRoot = this.attachShadow(shadow_root_init); 6291 } 6292 /** 6293 * @param {string} type 6294 * @param {EventListenerOrEventListenerObject} listener 6295 * @param {boolean | AddEventListenerOptions} [options] 6296 */ 6297 addEventListener(type, listener, options) { 6298 this.$$l[type] = this.$$l[type] || []; 6299 this.$$l[type].push(listener); 6300 if (this.$$c) { 6301 const unsub = this.$$c.$on(type, listener); 6302 this.$$l_u.set(listener, unsub); 6303 } 6304 super.addEventListener(type, listener, options); 6305 } 6306 /** 6307 * @param {string} type 6308 * @param {EventListenerOrEventListenerObject} listener 6309 * @param {boolean | AddEventListenerOptions} [options] 6310 */ 6311 removeEventListener(type, listener, options) { 6312 super.removeEventListener(type, listener, options); 6313 if (this.$$c) { 6314 const unsub = this.$$l_u.get(listener); 6315 if (unsub) { 6316 unsub(); 6317 this.$$l_u.delete(listener); 6318 } 6319 } 6320 } 6321 async connectedCallback() { 6322 this.$$cn = true; 6323 if (!this.$$c) { 6324 await Promise.resolve(); 6325 if (!this.$$cn || this.$$c) return; 6326 /** @param {string} name */ 6327 function create_slot(name) { 6328 /** 6329 * @param {Element} anchor 6330 */ 6331 return (anchor) => { 6332 const slot = create_element("slot"); 6333 if (name !== "default") slot.name = name; 6334 append(anchor, slot); 6335 }; 6336 } 6337 /** @type {Record<string, any>} */ 6338 const $$slots = {}; 6339 const existing_slots = get_custom_elements_slots(this); 6340 for (const name of this.$$s) if (name in existing_slots) if (name === "default" && !this.$$d.children) { 6341 this.$$d.children = create_slot(name); 6342 $$slots.default = true; 6343 } else $$slots[name] = create_slot(name); 6344 for (const attribute of this.attributes) { 6345 const name = this.$$g_p(attribute.name); 6346 if (!(name in this.$$d)) this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp"); 6347 } 6348 for (const key in this.$$p_d) if (!(key in this.$$d) && this[key] !== void 0) { 6349 this.$$d[key] = this[key]; 6350 delete this[key]; 6351 } 6352 this.$$c = createClassComponent({ 6353 component: this.$$ctor, 6354 target: this.$$shadowRoot || this, 6355 props: { 6356 ...this.$$d, 6357 $$slots, 6358 $$host: this 6359 } 6360 }); 6361 this.$$me = effect_root(() => { 6362 render_effect(() => { 6363 this.$$r = true; 6364 for (const key of object_keys(this.$$c)) { 6365 if (!this.$$p_d[key]?.reflect) continue; 6366 this.$$d[key] = this.$$c[key]; 6367 const attribute_value = get_custom_element_value(key, this.$$d[key], this.$$p_d, "toAttribute"); 6368 if (attribute_value == null) this.removeAttribute(this.$$p_d[key].attribute || key); 6369 else this.setAttribute(this.$$p_d[key].attribute || key, attribute_value); 6370 } 6371 this.$$r = false;
6372 }); 6373 }); 6374 for (const type in this.$$l) for (const listener of this.$$l[type]) { 6375 const unsub = this.$$c.$on(type, listener); 6376 this.$$l_u.set(listener, unsub); 6377 } 6378 this.$$l = {}; 6379 } 6380 } 6381 /** 6382 * @param {string} attr 6383 * @param {string} _oldValue 6384 * @param {string} newValue 6385 */ 6386 attributeChangedCallback(attr, _oldValue, newValue) { 6387 if (this.$$r) return; 6388 attr = this.$$g_p(attr); 6389 this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, "toProp"); 6390 this.$$c?.$set({ [attr]: this.$$d[attr] }); 6391 } 6392 disconnectedCallback() { 6393 this.$$cn = false; 6394 Promise.resolve().then(() => { 6395 if (!this.$$cn && this.$$c) { 6396 this.$$c.$destroy(); 6397 this.$$me(); 6398 this.$$c = void 0; 6399 } 6400 }); 6401 } 6402 /** 6403 * @param {string} attribute_name 6404 */ 6405 $$g_p(attribute_name) { 6406 return object_keys(this.$$p_d).find((key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name) || attribute_name; 6407 } 6408 }; 6409 /** 6410 * @param {string} prop 6411 * @param {any} value 6412 * @param {Record<string, CustomElementPropDefinition>} props_definition 6413 * @param {'toAttribute' | 'toProp'} [transform] 6414 */ 6415 function get_custom_element_value(prop, value, props_definition, transform) { 6416 const type = props_definition[prop]?.type; 6417 value = type === "Boolean" && typeof value !== "boolean" ? value != null : value; 6418 if (!transform || !props_definition[prop]) return value; 6419 else if (transform === "toAttribute") switch (type) { 6420 case "Object": 6421 case "Array": return value == null ? null : JSON.stringify(value); 6422 case "Boolean": return value ? "" : null; 6423 case "Number": return value == null ? null : value; 6424 default: return value; 6425 } 6426 else switch (type) { 6427 case "Object": 6428 case "Array": return value && JSON.parse(value); 6429 case "Boolean": return value; 6430 case "Number": return value != null ? +value : value; 6431 default: return value; 6432 } 6433 } 6434 /** 6435 * @param {HTMLElement} element 6436 */ 6437 function get_custom_elements_slots(element) { 6438 /** @type {Record<string, true>} */ 6439 const result = {}; 6440 element.childNodes.forEach((node) => { 6441 result[node.slot || "default"] = true; 6442 }); 6443 return result; 6444 } 6445 /** 6446 * @internal 6447 * 6448 * Turn a Svelte component into a custom element. 6449 * @param {any} Component A Svelte component function 6450 * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe 6451 * @param {string[]} slots The slots to create 6452 * @param {string[]} exports Explicitly exported values, other than props 6453 * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor 6454 * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend] 6455 */ 6456 function create_custom_element(Component, props_definition, slots, exports, shadow_root_init, extend) { 6457 let Class = class extends SvelteElement { 6458 constructor() { 6459 super(Component, slots, shadow_root_init); 6460 this.$$p_d = props_definition; 6461 } 6462 static get observedAttributes() { 6463 return object_keys(props_definition).map((key) => (props_definition[key].attribute || key).toLowerCase()); 6464 } 6465 }; 6466 object_keys(props_definition).forEach((prop) => { 6467 define_property(Class.prototype, prop, { 6468 get() { 6469 return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop]; 6470 }, 6471 set(value) { 6472 value = get_custom_element_value(prop, value, props_definition); 6473 this.$$d[prop] = value; 6474 var component = this.$$c; 6475 if (component) if (get_descriptor(component, prop)?.get) component[prop] = value; 6476 else component.$set({ [prop]: value }); 6477 } 6478 }); 6479 }); 6480 exports.forEach((property) => { 6481 define_property(Class.prototype, property, { get() { 6482 return this.$$c?.[property]; 6483 } }); 6484 }); 6485 if (extend) Class = extend(Class); 6486 Component.element = Class; 6487 return Class; 6488 } 6489 //#endregion 6490 //#region src/lib/helpers/urls.ts 6491 var ANGULAR_URLS = { 6492 account: () => "/#/user/account", 6493 annualTickets: () => "/#/tickets/annual", 6494 checkoutFailure: (errorMessage) => `/#/checkout/failure?payment_error=${errorMessage}`, 6495 checkoutSuccess: (token) => `/#/checkout/success?ORDERID=${token}`, 6496 checkoutForm: () => "/#/checkout", 6497 coupons: () => "/#/coupons", 6498 combiTickets: () => "/#/tickets/combi", 6499 combiTicketGroup: (slug) => "/#/tickets/combi?group=" + slug, 6500 dayTickets: () => "/#/tickets/day", 6501 eventGroup: eventGroupUrl, 6502 event: (id) => "/#/product/event/" + id, 6503 events: () => "/#/products/events", 6504 exhibition: (id) => "/#/exhibition/" + id, 6505 exhibitions: () => "/#/exhibitions", 6506 home: () => "/#/start", 6507 login: () => "/#/login", 6508 merchandise: (id) => "/#/merchandise/detail/" + id, 6509 merchandises: () => "/#/merchandise/list", 6510 museum: (id) => "/#/museum/" + id, 6511 museums: () => "/#/museums", 6512 publicTours: () => "/#/products/public-tours", 6513 register: () => "/#/registration", 6514 tickets: () => "/#/tickets/filters", 6515 ticketGroup: (slug) => "/#/tickets/filters?group=" + slug, 6516 tour: (id) => "/#/product/tour/" + id, 6517 tours: () => "/#/products/tours", 6518 toursGroup: toursGroupUrl, 6519 cart: () => "/#/cart", 6520 annualTicketPersonalizationForm: (token, ticketSaleId) => `/#/tickets/annual/personalisation/${token}/${ticketSaleId}`, 6521 annualTicketPersonalizationList: (token) => `/#/tickets/annual/personalisation/${token}`, 6522 annualTicketPersonalizationFormSubmit: (token) => `/#/tickets/annual/personalisation/${token}` 6523 }; 6524 var JMB_Urls = { 6525 ...ANGULAR_URLS, 6526 checkoutSuccess: (token) => `/checkout/success/?token=${token}`, 6527 checkoutFailure: (errorMessage) => `/checkout/failure?error=${errorMessage}` 6528 }; 6529 function shopUrlProvider(type) { 6530 return type === "angular" ? ANGULAR_URLS : JMB_Urls; 6531 } 6532 function eventGroupUrl(id) { 6533 return `/#/products/events?category_id=${(shop.settings?.multipleEventsMenuItems.event_groups[id] || []).join("&category_id=")}`; 6534 } 6535 function toursGroupUrl(id) { 6536 return `/#/products/tours?category_id=${(shop.settings?.multipleToursMenuItems.tour_groups[id] || []).join("&category_id=")}`; 6537 } 6538 //#endregion 6539 //#region src/lib/utils.ts 6540 function wait(ms) { 6541 return new Promise((resolve) => setTimeout(resolve, ms)); 6542 } 6543 function isEmail(email) { 6544 return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); 6545 } 6546 function isBoolean(value) { 6547 return typeof value === "boolean"; 6548 }
6549 /** 6550 * Repeatedly invokes a callback function at regular intervals until it returns a truthy value, 6551 * or until a timeout is reached. Resolves with the truthy result or `undefined` if the timeout expires. 6552 * If the callback throws an error at any point, the promise will be rejected with that error. 6553 * 6554 * @param {Function} callback A function to be repeatedly invoked. It should return a value 6555 * which will be checked for truthiness. If it throws an error, 6556 * the polling will stop, and the returned promise will be rejected. 6557 * @param maxDuration 6558 * @return {Promise<any>} A promise that resolves with the first truthy value returned by the callback, 6559 * `undefined` if the timeout is reached without any truthy value, 6560 * or rejects if the callback throws an error. 6561 */ 6562 function pollUntilTruthy(callback, maxDuration = 1e3) { 6563 return new Promise((resolve, reject) => { 6564 const startTime = Date.now(); 6565 const interval = 20; 6566 const poll = () => { 6567 try { 6568 const result = callback(); 6569 if (result) { 6570 resolve(result); 6571 return; 6572 } 6573 if (Date.now() - startTime >= maxDuration) { 6574 reject(/* @__PURE__ */ new Error("Timeout reached without truthy value")); 6575 return; 6576 } 6577 setTimeout(poll, interval); 6578 } catch (error) { 6579 reject(error); 6580 } 6581 }; 6582 poll(); 6583 }); 6584 } 6585 //#endregion 6586 //#region ../../node_modules/.pnpm/[email protected]/node_modules/radash/dist/esm/typed.mjs 6587 var isArray = Array.isArray; 6588 var isObject$2 = (value) => { 6589 return !!value && value.constructor === Object; 6590 }; 6591 var isString = (value) => { 6592 return typeof value === "string" || value instanceof String; 6593 }; 6594 var isNumber = (value) => { 6595 try { 6596 return Number(value) === value; 6597 } catch { 6598 return false; 6599 } 6600 }; 6601 //#endregion 6602 //#region ../../node_modules/.pnpm/[email protected]/node_modules/radash/dist/esm/array.mjs 6603 var group = (array, getGroupId) => { 6604 return array.reduce((acc, item) => { 6605 const groupId = getGroupId(item); 6606 if (!acc[groupId]) acc[groupId] = []; 6607 acc[groupId].push(item); 6608 return acc; 6609 }, {}); 6610 }; 6611 var boil = (array, compareFunc) => { 6612 if (!array || (array.length ?? 0) === 0) return null; 6613 return array.reduce(compareFunc); 6614 }; 6615 function sum(array, fn) { 6616 return (array || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0); 6617 } 6618 var sort = (array, getter, desc = false) => { 6619 if (!array) return []; 6620 const asc = (a, b) => getter(a) - getter(b); 6621 const dsc = (a, b) => getter(b) - getter(a); 6622 return array.slice().sort(desc === true ? dsc : asc); 6623 }; 6624 function max$2(array, getter) { 6625 const get = getter ?? ((v) => v); 6626 return boil(array, (a, b) => get(a) > get(b) ? a : b); 6627 } 6628 function min$2(array, getter) { 6629 const get = getter ?? ((v) => v); 6630 return boil(array, (a, b) => get(a) < get(b) ? a : b); 6631 } 6632 var unique = (array, toKey) => { 6633 const valueMap = array.reduce((acc, item) => { 6634 const key = toKey ? toKey(item) : item; 6635 if (acc[key]) return acc; 6636 acc[key] = item; 6637 return acc; 6638 }, {}); 6639 return Object.values(valueMap); 6640 }; 6641 var iterate = (count, func, initValue) => { 6642 let value = initValue; 6643 for (let i = 1; i <= count; i++) value = func(value, i); 6644 return value; 6645 }; 6646 //#endregion 6647 //#region ../../node_modules/.pnpm/[email protected]/node_modules/radash/dist/esm/object.mjs 6648 var omit$1 = (obj, keys2) => { 6649 if (!obj) return {}; 6650 if (!keys2 || keys2.length === 0) return obj; 6651 return keys2.reduce((acc, key) => { 6652 delete acc[key]; 6653 return acc; 6654 }, { ...obj }); 6655 }; 6656 var assign$1 = (initial, override) => { 6657 if (!initial || !override) return initial ?? override ?? {}; 6658 return Object.entries({ 6659 ...initial, 6660 ...override 6661 }).reduce((acc, [key, value]) => { 6662 return { 6663 ...acc, 6664 [key]: (() => { 6665 if (isObject$2(initial[key])) return assign$1(initial[key], value); 6666 return value; 6667 })() 6668 }; 6669 }, {}); 6670 }; 6671 //#endregion 6672 //#region src/lib/stores/auth.svelte.ts 6673 var Auth = class { 6674 #data = { 6675 uid: "", 6676 client: "", 6677 accessToken: "", 6678 expiry: 0 6679 }; 6680 constructor() { 6681 this.load(); 6682 if (typeof window !== "undefined") window.addEventListener("storage", (e) => { 6683 if (e.key === "go-auth") this.load(); 6684 }); 6685 } 6686 customerLevel() {
6687 if (this.isGuest()) return 10; 6688 if (this.isLoggedIn()) return 20; 6689 } 6690 isAuthenticated() { 6691 return this.#data.uid !== ""; 6692 } 6693 isLoggedIn() { 6694 return Boolean(this.#data.uid && isEmail(this.#data.uid)); 6695 } 6696 isGuest() { 6697 return Boolean(this.#data.uid && !isEmail(this.#data.uid)); 6698 } 6699 signOut() { 6700 this.#data.uid = ""; 6701 this.#data.client = ""; 6702 this.#data.accessToken = ""; 6703 this.#data.expiry = 0; 6704 this.save(); 6705 } 6706 signIn(options) { 6707 this.#data.uid = options.uid; 6708 this.#data.client = options.client; 6709 this.#data.accessToken = options.accessToken; 6710 this.#data.expiry = options.expiry; 6711 this.save(); 6712 } 6713 get data() { 6714 if (this.#data.expiry < Math.floor(Date.now() / 1e3)) this.signOut(); 6715 return this.#data; 6716 } 6717 toString() { 6718 return JSON.stringify(this.#data); 6719 } 6720 save() { 6721 if (typeof localStorage === "undefined") return; 6722 localStorage.setItem("go-auth", this.toString()); 6723 } 6724 load() { 6725 if (typeof localStorage === "undefined") return; 6726 const str = localStorage.getItem("go-auth"); 6727 if (!str) { 6728 this.signOut(); 6729 return; 6730 } 6731 const d = JSON.parse(str); 6732 if (!(isObject$2(d) && "uid" in d && "client" in d && "accessToken" in d && "expiry" in d)) throw new Error(`(Auth.loadFromString) invalid auth json ${str}`); 6733 this.signIn(d); 6734 } 6735 }; 6736 //#endregion 6737 //#region src/lib/middlewares/AuthMiddleware.ts 6738 var AuthMiddleware = class { 6739 auth; 6740 constructor(auth) { 6741 this.auth = auth; 6742 } 6743 /** 6744 * Intercepts and modifies outgoing HTTP requests by adding authentication headers. 6745 */ 6746 onRequest({ request }) { 6747 const { uid, client, accessToken, expiry } = this.auth.data; 6748 const h = request.headers; 6749 if (uid && !h.has("uid")) h.set("uid", uid); 6750 if (client && !h.has("client")) h.set("client", client); 6751 if (accessToken && !h.has("access-token")) h.set("access-token", accessToken); 6752 if (expiry && !h.has("expiry")) h.set("expiry", String(expiry)); 6753 if (accessToken && !h.has("token-type")) h.set("token-type", "Bearer"); 6754 } 6755 /** 6756 * Intercepts HTTP responses and updates authentication state if new credentials are received. 6757 */ 6758 onResponse({ response }) { 6759 const accessToken = response.headers.get("access-token"); 6760 const client = response.headers.get("client"); 6761 const uid = response.headers.get("uid"); 6762 const expiry = parseInt(response.headers.get("expiry") || ""); 6763 if (accessToken && client && uid && expiry) this.auth.signIn({ 6764 uid, 6765 client, 6766 accessToken, 6767 expiry 6768 }); 6769 return response; 6770 } 6771 }; 6772 //#endregion 6773 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/core.js 6774 var _a$1; 6775 function $constructor(name, initializer, params) { 6776 function init(inst, def) { 6777 if (!inst._zod) Object.defineProperty(inst, "_zod", { 6778 value: { 6779 def, 6780 constr: _, 6781 traits: /* @__PURE__ */ new Set() 6782 }, 6783 enumerable: false 6784 }); 6785 if (inst._zod.traits.has(name)) return; 6786 inst._zod.traits.add(name); 6787 initializer(inst, def); 6788 const proto = _.prototype; 6789 const keys = Object.keys(proto); 6790 for (let i = 0; i < keys.length; i++) { 6791 const k = keys[i]; 6792 if (!(k in inst)) inst[k] = proto[k].bind(inst); 6793 } 6794 } 6795 const Parent = params?.Parent ?? Object; 6796 class Definition extends Parent {} 6797 Object.defineProperty(Definition, "name", { value: name }); 6798 function _(def) { 6799 var _a; 6800 const inst = params?.Parent ? new Definition() : this; 6801 init(inst, def); 6802 (_a = inst._zod).deferred ?? (_a.deferred = []); 6803 for (const fn of inst._zod.deferred) fn(); 6804 return inst; 6805 } 6806 Object.defineProperty(_, "init", { value: init }); 6807 Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => { 6808 if (params?.Parent && inst instanceof params.Parent) return true; 6809 return inst?._zod?.traits?.has(name); 6810 } }); 6811 Object.defineProperty(_, "name", { value: name }); 6812 return _; 6813 } 6814 var $ZodAsyncError = class extends Error { 6815 constructor() { 6816 super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); 6817 } 6818 }; 6819 var $ZodEncodeError = class extends Error { 6820 constructor(name) { 6821 super(`Encountered unidirectional transform during encode: ${name}`); 6822 this.name = "ZodEncodeError"; 6823 } 6824 }; 6825 (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {}); 6826 var globalConfig = globalThis.__zod_globalConfig; 6827 function config(newConfig) { 6828 if (newConfig) Object.assign(globalConfig, newConfig); 6829 return globalConfig; 6830 } 6831 //#endregion 6832 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/util.js 6833 function getEnumValues(entries) { 6834 const numericValues = Object.values(entries).filter((v) => typeof v === "number"); 6835 return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v); 6836 } 6837 function jsonStringifyReplacer(_, value) { 6838 if (typeof value === "bigint") return value.toString(); 6839 return value; 6840 } 6841 function cached(getter) { 6842 return { get value() { 6843 { 6844 const value = getter(); 6845 Object.defineProperty(this, "value", { value }); 6846 return value; 6847 } 6848 throw new Error("cached value already set"); 6849 } }; 6850 } 6851 function nullish(input) { 6852 return input === null || input === void 0; 6853 } 6854 function cleanRegex(source) { 6855 const start = source.startsWith("^") ? 1 : 0; 6856 const end = source.endsWith("$") ? source.length - 1 : source.length; 6857 return source.slice(start, end); 6858 } 6859 function floatSafeRemainder(val, step) { 6860 const ratio = val / step; 6861 const roundedRatio = Math.round(ratio); 6862 const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1); 6863 if (Math.abs(ratio - roundedRatio) < tolerance) return 0; 6864 return ratio - roundedRatio; 6865 } 6866 var EVALUATING = /* @__PURE__*/ Symbol("evaluating"); 6867 function defineLazy(object, key, getter) { 6868 let value = void 0; 6869 Object.defineProperty(object, key, { 6870 get() { 6871 if (value === EVALUATING) return; 6872 if (value === void 0) { 6873 value = EVALUATING; 6874 value = getter(); 6875 } 6876 return value; 6877 }, 6878 set(v) { 6879 Object.defineProperty(object, key, { value: v }); 6880 },
vendor: 122,592 bytes, lines 6881-10672
6881 configurable: true 6882 }); 6883 } 6884 function assignProp(target, prop, value) { 6885 Object.defineProperty(target, prop, { 6886 value, 6887 writable: true, 6888 enumerable: true, 6889 configurable: true 6890 }); 6891 } 6892 function mergeDefs(...defs) { 6893 const mergedDescriptors = {}; 6894 for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def)); 6895 return Object.defineProperties({}, mergedDescriptors); 6896 } 6897 function esc(str) { 6898 return JSON.stringify(str); 6899 } 6900 function slugify(input) { 6901 return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""); 6902 } 6903 var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {}; 6904 function isObject$1(data) { 6905 return typeof data === "object" && data !== null && !Array.isArray(data); 6906 } 6907 var allowsEval = /* @__PURE__*/ cached(() => { 6908 if (globalConfig.jitless) return false; 6909 if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false; 6910 try { 6911 new Function(""); 6912 return true; 6913 } catch (_) { 6914 return false; 6915 } 6916 }); 6917 function isPlainObject(o) { 6918 if (isObject$1(o) === false) return false; 6919 const ctor = o.constructor; 6920 if (ctor === void 0) return true; 6921 if (typeof ctor !== "function") return true; 6922 const prot = ctor.prototype; 6923 if (isObject$1(prot) === false) return false; 6924 if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false; 6925 return true; 6926 } 6927 function shallowClone(o) { 6928 if (isPlainObject(o)) return { ...o }; 6929 if (Array.isArray(o)) return [...o]; 6930 if (o instanceof Map) return new Map(o); 6931 if (o instanceof Set) return new Set(o); 6932 return o; 6933 } 6934 var propertyKeyTypes = /* @__PURE__*/ new Set([ 6935 "string", 6936 "number", 6937 "symbol" 6938 ]); 6939 function escapeRegex(str) { 6940 return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); 6941 } 6942 function clone$1(inst, def, params) { 6943 const cl = new inst._zod.constr(def ?? inst._zod.def); 6944 if (!def || params?.parent) cl._zod.parent = inst; 6945 return cl; 6946 } 6947 function normalizeParams(_params) { 6948 const params = _params; 6949 if (!params) return {}; 6950 if (typeof params === "string") return { error: () => params }; 6951 if (params?.message !== void 0) { 6952 if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params"); 6953 params.error = params.message; 6954 } 6955 delete params.message; 6956 if (typeof params.error === "string") return { 6957 ...params, 6958 error: () => params.error 6959 }; 6960 return params; 6961 } 6962 function optionalKeys(shape) { 6963 return Object.keys(shape).filter((k) => { 6964 return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional"; 6965 }); 6966 } 6967 var NUMBER_FORMAT_RANGES = { 6968 safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], 6969 int32: [-2147483648, 2147483647], 6970 uint32: [0, 4294967295], 6971 float32: [-34028234663852886e22, 34028234663852886e22], 6972 float64: [-Number.MAX_VALUE, Number.MAX_VALUE] 6973 }; 6974 function pick(schema, mask) { 6975 const currDef = schema._zod.def; 6976 const checks = currDef.checks; 6977 if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements"); 6978 return clone$1(schema, mergeDefs(schema._zod.def, { 6979 get shape() { 6980 const newShape = {}; 6981 for (const key in mask) { 6982 if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`); 6983 if (!mask[key]) continue; 6984 newShape[key] = currDef.shape[key]; 6985 } 6986 assignProp(this, "shape", newShape); 6987 return newShape; 6988 }, 6989 checks: [] 6990 })); 6991 } 6992 function omit(schema, mask) { 6993 const currDef = schema._zod.def; 6994 const checks = currDef.checks; 6995 if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements"); 6996 return clone$1(schema, mergeDefs(schema._zod.def, { 6997 get shape() { 6998 const newShape = { ...schema._zod.def.shape }; 6999 for (const key in mask) { 7000 if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`); 7001 if (!mask[key]) continue; 7002 delete newShape[key]; 7003 } 7004 assignProp(this, "shape", newShape); 7005 return newShape; 7006 }, 7007 checks: [] 7008 })); 7009 } 7010 function extend(schema, shape) { 7011 if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object"); 7012 const checks = schema._zod.def.checks; 7013 if (checks && checks.length > 0) { 7014 const existingShape = schema._zod.def.shape; 7015 for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead."); 7016 } 7017 return clone$1(schema, mergeDefs(schema._zod.def, { get shape() { 7018 const _shape = { 7019 ...schema._zod.def.shape, 7020 ...shape 7021 }; 7022 assignProp(this, "shape", _shape); 7023 return _shape; 7024 } })); 7025 } 7026 function safeExtend(schema, shape) { 7027 if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object"); 7028 return clone$1(schema, mergeDefs(schema._zod.def, { get shape() { 7029 const _shape = { 7030 ...schema._zod.def.shape, 7031 ...shape 7032 }; 7033 assignProp(this, "shape", _shape); 7034 return _shape; 7035 } })); 7036 } 7037 function merge(a, b) { 7038 if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead."); 7039 return clone$1(a, mergeDefs(a._zod.def, { 7040 get shape() { 7041 const _shape = { 7042 ...a._zod.def.shape, 7043 ...b._zod.def.shape 7044 }; 7045 assignProp(this, "shape", _shape); 7046 return _shape; 7047 }, 7048 get catchall() { 7049 return b._zod.def.catchall; 7050 }, 7051 checks: b._zod.def.checks ?? [] 7052 })); 7053 } 7054 function partial(Class, schema, mask) { 7055 const checks = schema._zod.def.checks; 7056 if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements"); 7057 return clone$1(schema, mergeDefs(schema._zod.def, { 7058 get shape() { 7059 const oldShape = schema._zod.def.shape; 7060 const shape = { ...oldShape }; 7061 if (mask) for (const key in mask) { 7062 if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`); 7063 if (!mask[key]) continue; 7064 shape[key] = Class ? new Class({ 7065 type: "optional", 7066 innerType: oldShape[key] 7067 }) : oldShape[key]; 7068 } 7069 else for (const key in oldShape) shape[key] = Class ? new Class({ 7070 type: "optional", 7071 innerType: oldShape[key] 7072 }) : oldShape[key]; 7073 assignProp(this, "shape", shape); 7074 return shape; 7075 }, 7076 checks: [] 7077 })); 7078 } 7079 function required(Class, schema, mask) { 7080 return clone$1(schema, mergeDefs(schema._zod.def, { get shape() { 7081 const oldShape = schema._zod.def.shape; 7082 const shape = { ...oldShape }; 7083 if (mask) for (const key in mask) { 7084 if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`); 7085 if (!mask[key]) continue; 7086 shape[key] = new Class({ 7087 type: "nonoptional", 7088 innerType: oldShape[key] 7089 }); 7090 } 7091 else for (const key in oldShape) shape[key] = new Class({ 7092 type: "nonoptional", 7093 innerType: oldShape[key] 7094 }); 7095 assignProp(this, "shape", shape); 7096 return shape; 7097 } })); 7098 } 7099 function aborted(x, startIndex = 0) { 7100 if (x.aborted === true) return true; 7101 for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true; 7102 return false; 7103 } 7104 function explicitlyAborted(x, startIndex = 0) { 7105 if (x.aborted === true) return true; 7106 for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true; 7107 return false; 7108 } 7109 function prefixIssues(path, issues) { 7110 return issues.map((iss) => { 7111 var _a; 7112 (_a = iss).path ?? (_a.path = []); 7113 iss.path.unshift(path); 7114 return iss; 7115 }); 7116 } 7117 function unwrapMessage(message) { 7118 return typeof message === "string" ? message : message?.message; 7119 } 7120 function finalizeIssue(iss, ctx, config) { 7121 const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input"; 7122 const { inst: _inst, continue: _continue, input: _input, ...rest } = iss; 7123 rest.path ?? (rest.path = []); 7124 rest.message = message; 7125 if (ctx?.reportInput) rest.input = _input; 7126 return rest; 7127 } 7128 function getLengthableOrigin(input) { 7129 if (Array.isArray(input)) return "array"; 7130 if (typeof input === "string") return "string"; 7131 return "unknown"; 7132 } 7133 function issue(...args) { 7134 const [iss, input, inst] = args; 7135 if (typeof iss === "string") return { 7136 message: iss, 7137 code: "custom", 7138 input, 7139 inst 7140 }; 7141 return { ...iss }; 7142 } 7143 //#endregion 7144 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/errors.js 7145 var initializer$1 = (inst, def) => { 7146 inst.name = "$ZodError"; 7147 Object.defineProperty(inst, "_zod", { 7148 value: inst._zod, 7149 enumerable: false 7150 }); 7151 Object.defineProperty(inst, "issues", { 7152 value: def, 7153 enumerable: false 7154 }); 7155 inst.message = JSON.stringify(def, jsonStringifyReplacer, 2); 7156 Object.defineProperty(inst, "toString", { 7157 value: () => inst.message, 7158 enumerable: false 7159 }); 7160 }; 7161 var $ZodError = $constructor("$ZodError", initializer$1); 7162 var $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error }); 7163 function flattenError(error, mapper = (issue) => issue.message) { 7164 const fieldErrors = {}; 7165 const formErrors = []; 7166 for (const sub of error.issues) if (sub.path.length > 0) { 7167 fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; 7168 fieldErrors[sub.path[0]].push(mapper(sub)); 7169 } else formErrors.push(mapper(sub)); 7170 return { 7171 formErrors, 7172 fieldErrors 7173 }; 7174 } 7175 function formatError(error, mapper = (issue) => issue.message) { 7176 const fieldErrors = { _errors: [] }; 7177 const processError = (error, path = []) => { 7178 for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path])); 7179 else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]); 7180 else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]); 7181 else { 7182 const fullpath = [...path, ...issue.path]; 7183 if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue)); 7184 else { 7185 let curr = fieldErrors; 7186 let i = 0; 7187 while (i < fullpath.length) { 7188 const el = fullpath[i]; 7189 if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] }; 7190 else { 7191 curr[el] = curr[el] || { _errors: [] }; 7192 curr[el]._errors.push(mapper(issue)); 7193 } 7194 curr = curr[el]; 7195 i++; 7196 } 7197 } 7198 } 7199 }; 7200 processError(error); 7201 return fieldErrors; 7202 } 7203 //#endregion 7204 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/parse.js 7205 var _parse = (_Err) => (schema, value, _ctx, _params) => { 7206 const ctx = _ctx ? { 7207 ..._ctx, 7208 async: false 7209 } : { async: false }; 7210 const result = schema._zod.run({ 7211 value, 7212 issues: [] 7213 }, ctx); 7214 if (result instanceof Promise) throw new $ZodAsyncError(); 7215 if (result.issues.length) { 7216 const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); 7217 captureStackTrace(e, _params?.callee); 7218 throw e; 7219 } 7220 return result.value; 7221 }; 7222 var _parseAsync = (_Err) => async (schema, value, _ctx, params) => { 7223 const ctx = _ctx ? { 7224 ..._ctx, 7225 async: true 7226 } : { async: true }; 7227 let result = schema._zod.run({ 7228 value, 7229 issues: [] 7230 }, ctx); 7231 if (result instanceof Promise) result = await result; 7232 if (result.issues.length) { 7233 const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); 7234 captureStackTrace(e, params?.callee); 7235 throw e; 7236 } 7237 return result.value; 7238 }; 7239 var _safeParse = (_Err) => (schema, value, _ctx) => { 7240 const ctx = _ctx ? { 7241 ..._ctx, 7242 async: false 7243 } : { async: false }; 7244 const result = schema._zod.run({ 7245 value, 7246 issues: [] 7247 }, ctx); 7248 if (result instanceof Promise) throw new $ZodAsyncError(); 7249 return result.issues.length ? { 7250 success: false, 7251 error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) 7252 } : { 7253 success: true, 7254 data: result.value 7255 }; 7256 }; 7257 var safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError); 7258 var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { 7259 const ctx = _ctx ? { 7260 ..._ctx, 7261 async: true 7262 } : { async: true }; 7263 let result = schema._zod.run({ 7264 value, 7265 issues: [] 7266 }, ctx); 7267 if (result instanceof Promise) result = await result; 7268 return result.issues.length ? { 7269 success: false, 7270 error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) 7271 } : { 7272 success: true, 7273 data: result.value 7274 }; 7275 }; 7276 var safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError); 7277 var _encode = (_Err) => (schema, value, _ctx) => { 7278 const ctx = _ctx ? { 7279 ..._ctx, 7280 direction: "backward" 7281 } : { direction: "backward" }; 7282 return _parse(_Err)(schema, value, ctx); 7283 }; 7284 var _decode = (_Err) => (schema, value, _ctx) => { 7285 return _parse(_Err)(schema, value, _ctx); 7286 }; 7287 var _encodeAsync = (_Err) => async (schema, value, _ctx) => { 7288 const ctx = _ctx ? { 7289 ..._ctx, 7290 direction: "backward" 7291 } : { direction: "backward" }; 7292 return _parseAsync(_Err)(schema, value, ctx); 7293 }; 7294 var _decodeAsync = (_Err) => async (schema, value, _ctx) => { 7295 return _parseAsync(_Err)(schema, value, _ctx); 7296 }; 7297 var _safeEncode = (_Err) => (schema, value, _ctx) => { 7298 const ctx = _ctx ? { 7299 ..._ctx, 7300 direction: "backward" 7301 } : { direction: "backward" }; 7302 return _safeParse(_Err)(schema, value, ctx); 7303 }; 7304 var _safeDecode = (_Err) => (schema, value, _ctx) => { 7305 return _safeParse(_Err)(schema, value, _ctx); 7306 }; 7307 var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => { 7308 const ctx = _ctx ? { 7309 ..._ctx, 7310 direction: "backward" 7311 } : { direction: "backward" }; 7312 return _safeParseAsync(_Err)(schema, value, ctx); 7313 }; 7314 var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => { 7315 return _safeParseAsync(_Err)(schema, value, _ctx); 7316 }; 7317 //#endregion 7318 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/regexes.js 7319 /** 7320 * @deprecated CUID v1 is deprecated by its authors due to information leakage 7321 * (timestamps embedded in the id). Use {@link cuid2} instead. 7322 * See https://github.com/paralleldrive/cuid. 7323 */ 7324 var cuid = /^[cC][0-9a-z]{6,}$/; 7325 var cuid2 = /^[0-9a-z]+$/; 7326 var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/; 7327 var xid = /^[0-9a-vA-V]{20}$/; 7328 var ksuid = /^[A-Za-z0-9]{27}$/; 7329 var nanoid = /^[a-zA-Z0-9_-]{21}$/; 7330 /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */ 7331 var duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; 7332 /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */ 7333 var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/; 7334 /** Returns a regex for validating an RFC 9562/4122 UUID. 7335 * 7336 * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */ 7337 var uuid = (version) => { 7338 if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/; 7339 return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`); 7340 }; 7341 /** Practical email validation */ 7342 var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; 7343 var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; 7344 function emoji() { 7345 return new RegExp(_emoji$1, "u"); 7346 } 7347 var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; 7348 var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/; 7349 var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/; 7350 var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/; 7351 var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; 7352 var base64url = /^[A-Za-z0-9_-]*$/; 7353 var httpProtocol = /^https?$/; 7354 var e164 = /^\+[1-9]\d{6,14}$/; 7355 var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`; 7356 var date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`); 7357 function timeSource(args) { 7358 const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; 7359 return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; 7360 } 7361 function time$1(args) { 7362 return new RegExp(`^${timeSource(args)}$`); 7363 } 7364 function datetime$1(args) { 7365 const time = timeSource({ precision: args.precision }); 7366 const opts = ["Z"]; 7367 if (args.local) opts.push(""); 7368 if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); 7369 const timeRegex = `${time}(?:${opts.join("|")})`; 7370 return new RegExp(`^${dateSource}T(?:${timeRegex})$`); 7371 } 7372 var string$1 = (params) => { 7373 const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`; 7374 return new RegExp(`^${regex}$`); 7375 }; 7376 var integer = /^-?\d+$/; 7377 var number$1 = /^-?\d+(?:\.\d+)?$/; 7378 var lowercase = /^[^A-Z]*$/; 7379 var uppercase = /^[^a-z]*$/; 7380 //#endregion 7381 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/checks.js 7382 var $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => { 7383 var _a; 7384 inst._zod ?? (inst._zod = {}); 7385 inst._zod.def = def; 7386 (_a = inst._zod).onattach ?? (_a.onattach = []); 7387 }); 7388 var numericOriginMap = { 7389 number: "number", 7390 bigint: "bigint", 7391 object: "date" 7392 }; 7393 var $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => { 7394 $ZodCheck.init(inst, def); 7395 const origin = numericOriginMap[typeof def.value]; 7396 inst._zod.onattach.push((inst) => { 7397 const bag = inst._zod.bag; 7398 const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; 7399 if (def.value < curr) if (def.inclusive) bag.maximum = def.value; 7400 else bag.exclusiveMaximum = def.value; 7401 }); 7402 inst._zod.check = (payload) => { 7403 if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return; 7404 payload.issues.push({ 7405 origin, 7406 code: "too_big", 7407 maximum: typeof def.value === "object" ? def.value.getTime() : def.value, 7408 input: payload.value, 7409 inclusive: def.inclusive, 7410 inst, 7411 continue: !def.abort 7412 }); 7413 }; 7414 }); 7415 var $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => { 7416 $ZodCheck.init(inst, def); 7417 const origin = numericOriginMap[typeof def.value]; 7418 inst._zod.onattach.push((inst) => { 7419 const bag = inst._zod.bag; 7420 const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; 7421 if (def.value > curr) if (def.inclusive) bag.minimum = def.value; 7422 else bag.exclusiveMinimum = def.value; 7423 }); 7424 inst._zod.check = (payload) => { 7425 if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return; 7426 payload.issues.push({ 7427 origin, 7428 code: "too_small", 7429 minimum: typeof def.value === "object" ? def.value.getTime() : def.value, 7430 input: payload.value, 7431 inclusive: def.inclusive, 7432 inst, 7433 continue: !def.abort 7434 }); 7435 }; 7436 }); 7437 var $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => { 7438 $ZodCheck.init(inst, def); 7439 inst._zod.onattach.push((inst) => { 7440 var _a; 7441 (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value); 7442 }); 7443 inst._zod.check = (payload) => { 7444 if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check."); 7445 if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return; 7446 payload.issues.push({ 7447 origin: typeof payload.value, 7448 code: "not_multiple_of", 7449 divisor: def.value, 7450 input: payload.value, 7451 inst, 7452 continue: !def.abort 7453 }); 7454 }; 7455 }); 7456 var $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => { 7457 $ZodCheck.init(inst, def); 7458 def.format = def.format || "float64"; 7459 const isInt = def.format?.includes("int"); 7460 const origin = isInt ? "int" : "number"; 7461 const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format]; 7462 inst._zod.onattach.push((inst) => { 7463 const bag = inst._zod.bag; 7464 bag.format = def.format; 7465 bag.minimum = minimum; 7466 bag.maximum = maximum; 7467 if (isInt) bag.pattern = integer; 7468 }); 7469 inst._zod.check = (payload) => { 7470 const input = payload.value; 7471 if (isInt) { 7472 if (!Number.isInteger(input)) { 7473 payload.issues.push({ 7474 expected: origin, 7475 format: def.format, 7476 code: "invalid_type", 7477 continue: false, 7478 input, 7479 inst 7480 }); 7481 return; 7482 } 7483 if (!Number.isSafeInteger(input)) { 7484 if (input > 0) payload.issues.push({ 7485 input, 7486 code: "too_big", 7487 maximum: Number.MAX_SAFE_INTEGER, 7488 note: "Integers must be within the safe integer range.", 7489 inst, 7490 origin, 7491 inclusive: true, 7492 continue: !def.abort 7493 }); 7494 else payload.issues.push({ 7495 input, 7496 code: "too_small", 7497 minimum: Number.MIN_SAFE_INTEGER, 7498 note: "Integers must be within the safe integer range.", 7499 inst, 7500 origin, 7501 inclusive: true, 7502 continue: !def.abort 7503 }); 7504 return; 7505 } 7506 } 7507 if (input < minimum) payload.issues.push({ 7508 origin: "number", 7509 input, 7510 code: "too_small", 7511 minimum, 7512 inclusive: true, 7513 inst, 7514 continue: !def.abort 7515 }); 7516 if (input > maximum) payload.issues.push({ 7517 origin: "number", 7518 input, 7519 code: "too_big", 7520 maximum, 7521 inclusive: true, 7522 inst, 7523 continue: !def.abort 7524 }); 7525 }; 7526 }); 7527 var $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => { 7528 var _a; 7529 $ZodCheck.init(inst, def); 7530 (_a = inst._zod.def).when ?? (_a.when = (payload) => { 7531 const val = payload.value; 7532 return !nullish(val) && val.length !== void 0; 7533 }); 7534 inst._zod.onattach.push((inst) => { 7535 const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY; 7536 if (def.maximum < curr) inst._zod.bag.maximum = def.maximum; 7537 }); 7538 inst._zod.check = (payload) => { 7539 const input = payload.value; 7540 if (input.length <= def.maximum) return; 7541 const origin = getLengthableOrigin(input); 7542 payload.issues.push({ 7543 origin, 7544 code: "too_big", 7545 maximum: def.maximum, 7546 inclusive: true, 7547 input, 7548 inst, 7549 continue: !def.abort 7550 }); 7551 }; 7552 }); 7553 var $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => { 7554 var _a; 7555 $ZodCheck.init(inst, def); 7556 (_a = inst._zod.def).when ?? (_a.when = (payload) => { 7557 const val = payload.value; 7558 return !nullish(val) && val.length !== void 0; 7559 }); 7560 inst._zod.onattach.push((inst) => { 7561 const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; 7562 if (def.minimum > curr) inst._zod.bag.minimum = def.minimum; 7563 }); 7564 inst._zod.check = (payload) => { 7565 const input = payload.value; 7566 if (input.length >= def.minimum) return; 7567 const origin = getLengthableOrigin(input); 7568 payload.issues.push({ 7569 origin, 7570 code: "too_small", 7571 minimum: def.minimum, 7572 inclusive: true, 7573 input, 7574 inst, 7575 continue: !def.abort 7576 }); 7577 }; 7578 }); 7579 var $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => { 7580 var _a; 7581 $ZodCheck.init(inst, def); 7582 (_a = inst._zod.def).when ?? (_a.when = (payload) => { 7583 const val = payload.value; 7584 return !nullish(val) && val.length !== void 0; 7585 }); 7586 inst._zod.onattach.push((inst) => { 7587 const bag = inst._zod.bag; 7588 bag.minimum = def.length; 7589 bag.maximum = def.length; 7590 bag.length = def.length; 7591 }); 7592 inst._zod.check = (payload) => { 7593 const input = payload.value; 7594 const length = input.length; 7595 if (length === def.length) return; 7596 const origin = getLengthableOrigin(input); 7597 const tooBig = length > def.length; 7598 payload.issues.push({ 7599 origin, 7600 ...tooBig ? { 7601 code: "too_big", 7602 maximum: def.length 7603 } : { 7604 code: "too_small", 7605 minimum: def.length 7606 }, 7607 inclusive: true, 7608 exact: true, 7609 input: payload.value, 7610 inst, 7611 continue: !def.abort 7612 }); 7613 }; 7614 }); 7615 var $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => { 7616 var _a, _b; 7617 $ZodCheck.init(inst, def); 7618 inst._zod.onattach.push((inst) => { 7619 const bag = inst._zod.bag; 7620 bag.format = def.format; 7621 if (def.pattern) { 7622 bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); 7623 bag.patterns.add(def.pattern); 7624 } 7625 }); 7626 if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => { 7627 def.pattern.lastIndex = 0; 7628 if (def.pattern.test(payload.value)) return; 7629 payload.issues.push({ 7630 origin: "string", 7631 code: "invalid_format", 7632 format: def.format, 7633 input: payload.value, 7634 ...def.pattern ? { pattern: def.pattern.toString() } : {}, 7635 inst, 7636 continue: !def.abort 7637 }); 7638 }); 7639 else (_b = inst._zod).check ?? (_b.check = () => {}); 7640 }); 7641 var $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => { 7642 $ZodCheckStringFormat.init(inst, def); 7643 inst._zod.check = (payload) => { 7644 def.pattern.lastIndex = 0; 7645 if (def.pattern.test(payload.value)) return; 7646 payload.issues.push({ 7647 origin: "string", 7648 code: "invalid_format", 7649 format: "regex", 7650 input: payload.value, 7651 pattern: def.pattern.toString(), 7652 inst, 7653 continue: !def.abort 7654 }); 7655 }; 7656 }); 7657 var $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => { 7658 def.pattern ?? (def.pattern = lowercase); 7659 $ZodCheckStringFormat.init(inst, def); 7660 }); 7661 var $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => { 7662 def.pattern ?? (def.pattern = uppercase); 7663 $ZodCheckStringFormat.init(inst, def); 7664 }); 7665 var $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => { 7666 $ZodCheck.init(inst, def); 7667 const escapedRegex = escapeRegex(def.includes); 7668 const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex); 7669 def.pattern = pattern; 7670 inst._zod.onattach.push((inst) => { 7671 const bag = inst._zod.bag; 7672 bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); 7673 bag.patterns.add(pattern); 7674 }); 7675 inst._zod.check = (payload) => { 7676 if (payload.value.includes(def.includes, def.position)) return; 7677 payload.issues.push({ 7678 origin: "string", 7679 code: "invalid_format", 7680 format: "includes", 7681 includes: def.includes, 7682 input: payload.value, 7683 inst, 7684 continue: !def.abort 7685 }); 7686 }; 7687 }); 7688 var $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => { 7689 $ZodCheck.init(inst, def); 7690 const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`); 7691 def.pattern ?? (def.pattern = pattern); 7692 inst._zod.onattach.push((inst) => { 7693 const bag = inst._zod.bag; 7694 bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); 7695 bag.patterns.add(pattern); 7696 }); 7697 inst._zod.check = (payload) => { 7698 if (payload.value.startsWith(def.prefix)) return; 7699 payload.issues.push({ 7700 origin: "string", 7701 code: "invalid_format", 7702 format: "starts_with", 7703 prefix: def.prefix, 7704 input: payload.value, 7705 inst, 7706 continue: !def.abort 7707 }); 7708 }; 7709 }); 7710 var $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => { 7711 $ZodCheck.init(inst, def); 7712 const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`); 7713 def.pattern ?? (def.pattern = pattern); 7714 inst._zod.onattach.push((inst) => { 7715 const bag = inst._zod.bag; 7716 bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); 7717 bag.patterns.add(pattern); 7718 }); 7719 inst._zod.check = (payload) => { 7720 if (payload.value.endsWith(def.suffix)) return; 7721 payload.issues.push({ 7722 origin: "string", 7723 code: "invalid_format", 7724 format: "ends_with", 7725 suffix: def.suffix, 7726 input: payload.value, 7727 inst, 7728 continue: !def.abort 7729 }); 7730 }; 7731 }); 7732 var $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => { 7733 $ZodCheck.init(inst, def); 7734 inst._zod.check = (payload) => { 7735 payload.value = def.tx(payload.value); 7736 }; 7737 }); 7738 //#endregion 7739 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/doc.js 7740 var Doc = class { 7741 constructor(args = []) { 7742 this.content = []; 7743 this.indent = 0; 7744 if (this) this.args = args; 7745 } 7746 indented(fn) { 7747 this.indent += 1; 7748 fn(this); 7749 this.indent -= 1; 7750 } 7751 write(arg) { 7752 if (typeof arg === "function") { 7753 arg(this, { execution: "sync" }); 7754 arg(this, { execution: "async" }); 7755 return; 7756 } 7757 const lines = arg.split("\n").filter((x) => x); 7758 const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)); 7759 const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x); 7760 for (const line of dedented) this.content.push(line); 7761 } 7762 compile() { 7763 const F = Function; 7764 const args = this?.args; 7765 const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)]; 7766 return new F(...args, lines.join("\n")); 7767 } 7768 }; 7769 //#endregion 7770 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/versions.js 7771 var version = { 7772 major: 4, 7773 minor: 4, 7774 patch: 3 7775 }; 7776 //#endregion 7777 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/schemas.js 7778 var $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => { 7779 var _a; 7780 inst ?? (inst = {}); 7781 inst._zod.def = def; 7782 inst._zod.bag = inst._zod.bag || {}; 7783 inst._zod.version = version; 7784 const checks = [...inst._zod.def.checks ?? []]; 7785 if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst); 7786 for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst); 7787 if (checks.length === 0) { 7788 (_a = inst._zod).deferred ?? (_a.deferred = []); 7789 inst._zod.deferred?.push(() => { 7790 inst._zod.run = inst._zod.parse; 7791 }); 7792 } else { 7793 const runChecks = (payload, checks, ctx) => { 7794 let isAborted = aborted(payload); 7795 let asyncResult; 7796 for (const ch of checks) { 7797 if (ch._zod.def.when) { 7798 if (explicitlyAborted(payload)) continue; 7799 if (!ch._zod.def.when(payload)) continue; 7800 } else if (isAborted) continue; 7801 const currLen = payload.issues.length; 7802 const _ = ch._zod.check(payload); 7803 if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError(); 7804 if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => { 7805 await _; 7806 if (payload.issues.length === currLen) return; 7807 if (!isAborted) isAborted = aborted(payload, currLen); 7808 }); 7809 else { 7810 if (payload.issues.length === currLen) continue; 7811 if (!isAborted) isAborted = aborted(payload, currLen); 7812 } 7813 } 7814 if (asyncResult) return asyncResult.then(() => { 7815 return payload; 7816 }); 7817 return payload; 7818 }; 7819 const handleCanaryResult = (canary, payload, ctx) => { 7820 if (aborted(canary)) { 7821 canary.aborted = true; 7822 return canary; 7823 } 7824 const checkResult = runChecks(payload, checks, ctx); 7825 if (checkResult instanceof Promise) { 7826 if (ctx.async === false) throw new $ZodAsyncError(); 7827 return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx)); 7828 } 7829 return inst._zod.parse(checkResult, ctx); 7830 }; 7831 inst._zod.run = (payload, ctx) => { 7832 if (ctx.skipChecks) return inst._zod.parse(payload, ctx); 7833 if (ctx.direction === "backward") { 7834 const canary = inst._zod.parse({ 7835 value: payload.value, 7836 issues: [] 7837 }, { 7838 ...ctx, 7839 skipChecks: true 7840 }); 7841 if (canary instanceof Promise) return canary.then((canary) => { 7842 return handleCanaryResult(canary, payload, ctx); 7843 }); 7844 return handleCanaryResult(canary, payload, ctx); 7845 } 7846 const result = inst._zod.parse(payload, ctx); 7847 if (result instanceof Promise) { 7848 if (ctx.async === false) throw new $ZodAsyncError(); 7849 return result.then((result) => runChecks(result, checks, ctx)); 7850 } 7851 return runChecks(result, checks, ctx); 7852 }; 7853 } 7854 defineLazy(inst, "~standard", () => ({ 7855 validate: (value) => { 7856 try { 7857 const r = safeParse$1(inst, value); 7858 return r.success ? { value: r.data } : { issues: r.error?.issues }; 7859 } catch (_) { 7860 return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues }); 7861 } 7862 }, 7863 vendor: "zod", 7864 version: 1 7865 })); 7866 }); 7867 var $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => { 7868 $ZodType.init(inst, def); 7869 inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag); 7870 inst._zod.parse = (payload, _) => { 7871 if (def.coerce) try { 7872 payload.value = String(payload.value); 7873 } catch (_) {} 7874 if (typeof payload.value === "string") return payload; 7875 payload.issues.push({ 7876 expected: "string", 7877 code: "invalid_type", 7878 input: payload.value, 7879 inst 7880 }); 7881 return payload; 7882 }; 7883 }); 7884 var $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => { 7885 $ZodCheckStringFormat.init(inst, def); 7886 $ZodString.init(inst, def); 7887 }); 7888 var $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => { 7889 def.pattern ?? (def.pattern = guid); 7890 $ZodStringFormat.init(inst, def); 7891 }); 7892 var $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => { 7893 if (def.version) { 7894 const v = { 7895 v1: 1, 7896 v2: 2, 7897 v3: 3, 7898 v4: 4, 7899 v5: 5, 7900 v6: 6, 7901 v7: 7, 7902 v8: 8 7903 }[def.version]; 7904 if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`); 7905 def.pattern ?? (def.pattern = uuid(v)); 7906 } else def.pattern ?? (def.pattern = uuid()); 7907 $ZodStringFormat.init(inst, def); 7908 }); 7909 var $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => { 7910 def.pattern ?? (def.pattern = email); 7911 $ZodStringFormat.init(inst, def); 7912 }); 7913 var $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => { 7914 $ZodStringFormat.init(inst, def); 7915 inst._zod.check = (payload) => { 7916 try { 7917 const trimmed = payload.value.trim(); 7918 if (!def.normalize && def.protocol?.source === httpProtocol.source) { 7919 if (!/^https?:\/\//i.test(trimmed)) { 7920 payload.issues.push({ 7921 code: "invalid_format", 7922 format: "url", 7923 note: "Invalid URL format", 7924 input: payload.value, 7925 inst, 7926 continue: !def.abort 7927 }); 7928 return; 7929 } 7930 } 7931 const url = new URL(trimmed); 7932 if (def.hostname) { 7933 def.hostname.lastIndex = 0; 7934 if (!def.hostname.test(url.hostname)) payload.issues.push({ 7935 code: "invalid_format", 7936 format: "url", 7937 note: "Invalid hostname", 7938 pattern: def.hostname.source, 7939 input: payload.value, 7940 inst, 7941 continue: !def.abort 7942 }); 7943 } 7944 if (def.protocol) { 7945 def.protocol.lastIndex = 0; 7946 if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({ 7947 code: "invalid_format", 7948 format: "url", 7949 note: "Invalid protocol", 7950 pattern: def.protocol.source, 7951 input: payload.value, 7952 inst, 7953 continue: !def.abort 7954 }); 7955 } 7956 if (def.normalize) payload.value = url.href; 7957 else payload.value = trimmed; 7958 return; 7959 } catch (_) { 7960 payload.issues.push({ 7961 code: "invalid_format", 7962 format: "url", 7963 input: payload.value, 7964 inst, 7965 continue: !def.abort 7966 }); 7967 } 7968 }; 7969 }); 7970 var $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => { 7971 def.pattern ?? (def.pattern = emoji()); 7972 $ZodStringFormat.init(inst, def); 7973 }); 7974 var $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => { 7975 def.pattern ?? (def.pattern = nanoid); 7976 $ZodStringFormat.init(inst, def); 7977 }); 7978 /** 7979 * @deprecated CUID v1 is deprecated by its authors due to information leakage 7980 * (timestamps embedded in the id). Use {@link $ZodCUID2} instead. 7981 * See https://github.com/paralleldrive/cuid. 7982 */ 7983 var $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => { 7984 def.pattern ?? (def.pattern = cuid); 7985 $ZodStringFormat.init(inst, def); 7986 }); 7987 var $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => { 7988 def.pattern ?? (def.pattern = cuid2); 7989 $ZodStringFormat.init(inst, def); 7990 }); 7991 var $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => { 7992 def.pattern ?? (def.pattern = ulid); 7993 $ZodStringFormat.init(inst, def); 7994 }); 7995 var $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => { 7996 def.pattern ?? (def.pattern = xid); 7997 $ZodStringFormat.init(inst, def); 7998 }); 7999 var $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => { 8000 def.pattern ?? (def.pattern = ksuid); 8001 $ZodStringFormat.init(inst, def); 8002 }); 8003 var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => { 8004 def.pattern ?? (def.pattern = datetime$1(def)); 8005 $ZodStringFormat.init(inst, def); 8006 }); 8007 var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => { 8008 def.pattern ?? (def.pattern = date$1); 8009 $ZodStringFormat.init(inst, def); 8010 }); 8011 var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => { 8012 def.pattern ?? (def.pattern = time$1(def)); 8013 $ZodStringFormat.init(inst, def); 8014 }); 8015 var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => { 8016 def.pattern ?? (def.pattern = duration$1); 8017 $ZodStringFormat.init(inst, def); 8018 }); 8019 var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => { 8020 def.pattern ?? (def.pattern = ipv4); 8021 $ZodStringFormat.init(inst, def); 8022 inst._zod.bag.format = `ipv4`; 8023 }); 8024 var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => { 8025 def.pattern ?? (def.pattern = ipv6); 8026 $ZodStringFormat.init(inst, def); 8027 inst._zod.bag.format = `ipv6`; 8028 inst._zod.check = (payload) => { 8029 try { 8030 new URL(`http://[${payload.value}]`); 8031 } catch { 8032 payload.issues.push({ 8033 code: "invalid_format", 8034 format: "ipv6", 8035 input: payload.value, 8036 inst, 8037 continue: !def.abort 8038 }); 8039 } 8040 }; 8041 }); 8042 var $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => { 8043 def.pattern ?? (def.pattern = cidrv4); 8044 $ZodStringFormat.init(inst, def); 8045 }); 8046 var $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => { 8047 def.pattern ?? (def.pattern = cidrv6); 8048 $ZodStringFormat.init(inst, def); 8049 inst._zod.check = (payload) => { 8050 const parts = payload.value.split("/"); 8051 try { 8052 if (parts.length !== 2) throw new Error(); 8053 const [address, prefix] = parts; 8054 if (!prefix) throw new Error(); 8055 const prefixNum = Number(prefix); 8056 if (`${prefixNum}` !== prefix) throw new Error(); 8057 if (prefixNum < 0 || prefixNum > 128) throw new Error(); 8058 new URL(`http://[${address}]`); 8059 } catch { 8060 payload.issues.push({ 8061 code: "invalid_format", 8062 format: "cidrv6", 8063 input: payload.value, 8064 inst, 8065 continue: !def.abort 8066 }); 8067 } 8068 }; 8069 }); 8070 function isValidBase64(data) { 8071 if (data === "") return true; 8072 if (/\s/.test(data)) return false; 8073 if (data.length % 4 !== 0) return false; 8074 try { 8075 atob(data); 8076 return true; 8077 } catch { 8078 return false; 8079 } 8080 } 8081 var $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => { 8082 def.pattern ?? (def.pattern = base64); 8083 $ZodStringFormat.init(inst, def); 8084 inst._zod.bag.contentEncoding = "base64"; 8085 inst._zod.check = (payload) => { 8086 if (isValidBase64(payload.value)) return; 8087 payload.issues.push({ 8088 code: "invalid_format", 8089 format: "base64", 8090 input: payload.value, 8091 inst, 8092 continue: !def.abort 8093 }); 8094 }; 8095 }); 8096 function isValidBase64URL(data) { 8097 if (!base64url.test(data)) return false; 8098 const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/"); 8099 return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "=")); 8100 } 8101 var $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => { 8102 def.pattern ?? (def.pattern = base64url); 8103 $ZodStringFormat.init(inst, def); 8104 inst._zod.bag.contentEncoding = "base64url"; 8105 inst._zod.check = (payload) => { 8106 if (isValidBase64URL(payload.value)) return; 8107 payload.issues.push({ 8108 code: "invalid_format", 8109 format: "base64url", 8110 input: payload.value, 8111 inst, 8112 continue: !def.abort 8113 }); 8114 }; 8115 }); 8116 var $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => { 8117 def.pattern ?? (def.pattern = e164); 8118 $ZodStringFormat.init(inst, def); 8119 }); 8120 function isValidJWT(token, algorithm = null) { 8121 try { 8122 const tokensParts = token.split("."); 8123 if (tokensParts.length !== 3) return false; 8124 const [header] = tokensParts; 8125 if (!header) return false; 8126 const parsedHeader = JSON.parse(atob(header)); 8127 if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false; 8128 if (!parsedHeader.alg) return false; 8129 if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false; 8130 return true; 8131 } catch { 8132 return false; 8133 } 8134 } 8135 var $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => { 8136 $ZodStringFormat.init(inst, def); 8137 inst._zod.check = (payload) => { 8138 if (isValidJWT(payload.value, def.alg)) return; 8139 payload.issues.push({ 8140 code: "invalid_format", 8141 format: "jwt", 8142 input: payload.value, 8143 inst, 8144 continue: !def.abort 8145 }); 8146 }; 8147 }); 8148 var $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => { 8149 $ZodType.init(inst, def); 8150 inst._zod.pattern = inst._zod.bag.pattern ?? number$1; 8151 inst._zod.parse = (payload, _ctx) => { 8152 if (def.coerce) try { 8153 payload.value = Number(payload.value); 8154 } catch (_) {} 8155 const input = payload.value; 8156 if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload; 8157 const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0; 8158 payload.issues.push({ 8159 expected: "number", 8160 code: "invalid_type", 8161 input, 8162 inst, 8163 ...received ? { received } : {} 8164 }); 8165 return payload; 8166 }; 8167 }); 8168 var $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => { 8169 $ZodCheckNumberFormat.init(inst, def); 8170 $ZodNumber.init(inst, def); 8171 }); 8172 var $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => { 8173 $ZodType.init(inst, def); 8174 inst._zod.parse = (payload) => payload; 8175 }); 8176 var $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => { 8177 $ZodType.init(inst, def); 8178 inst._zod.parse = (payload, _ctx) => { 8179 payload.issues.push({ 8180 expected: "never", 8181 code: "invalid_type", 8182 input: payload.value, 8183 inst 8184 }); 8185 return payload; 8186 }; 8187 }); 8188 function handleArrayResult(result, final, index) { 8189 if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues)); 8190 final.value[index] = result.value; 8191 } 8192 var $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => { 8193 $ZodType.init(inst, def); 8194 inst._zod.parse = (payload, ctx) => { 8195 const input = payload.value; 8196 if (!Array.isArray(input)) { 8197 payload.issues.push({ 8198 expected: "array", 8199 code: "invalid_type", 8200 input, 8201 inst 8202 }); 8203 return payload; 8204 } 8205 payload.value = Array(input.length); 8206 const proms = []; 8207 for (let i = 0; i < input.length; i++) { 8208 const item = input[i]; 8209 const result = def.element._zod.run({ 8210 value: item, 8211 issues: [] 8212 }, ctx); 8213 if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i))); 8214 else handleArrayResult(result, payload, i); 8215 } 8216 if (proms.length) return Promise.all(proms).then(() => payload); 8217 return payload; 8218 }; 8219 }); 8220 function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) { 8221 const isPresent = key in input; 8222 if (result.issues.length) { 8223 if (isOptionalIn && isOptionalOut && !isPresent) return; 8224 final.issues.push(...prefixIssues(key, result.issues)); 8225 } 8226 if (!isPresent && !isOptionalIn) { 8227 if (!result.issues.length) final.issues.push({ 8228 code: "invalid_type", 8229 expected: "nonoptional", 8230 input: void 0, 8231 path: [key] 8232 }); 8233 return; 8234 } 8235 if (result.value === void 0) { 8236 if (isPresent) final.value[key] = void 0; 8237 } else final.value[key] = result.value; 8238 } 8239 function normalizeDef(def) { 8240 const keys = Object.keys(def.shape); 8241 for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`); 8242 const okeys = optionalKeys(def.shape); 8243 return { 8244 ...def, 8245 keys, 8246 keySet: new Set(keys), 8247 numKeys: keys.length, 8248 optionalKeys: new Set(okeys) 8249 }; 8250 } 8251 function handleCatchall(proms, input, payload, ctx, def, inst) { 8252 const unrecognized = []; 8253 const keySet = def.keySet; 8254 const _catchall = def.catchall._zod; 8255 const t = _catchall.def.type; 8256 const isOptionalIn = _catchall.optin === "optional"; 8257 const isOptionalOut = _catchall.optout === "optional"; 8258 for (const key in input) { 8259 if (key === "__proto__") continue; 8260 if (keySet.has(key)) continue; 8261 if (t === "never") { 8262 unrecognized.push(key); 8263 continue; 8264 } 8265 const r = _catchall.run({ 8266 value: input[key], 8267 issues: [] 8268 }, ctx); 8269 if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut))); 8270 else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut); 8271 } 8272 if (unrecognized.length) payload.issues.push({ 8273 code: "unrecognized_keys", 8274 keys: unrecognized, 8275 input, 8276 inst 8277 }); 8278 if (!proms.length) return payload; 8279 return Promise.all(proms).then(() => { 8280 return payload; 8281 }); 8282 } 8283 var $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => { 8284 $ZodType.init(inst, def); 8285 if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) { 8286 const sh = def.shape; 8287 Object.defineProperty(def, "shape", { get: () => { 8288 const newSh = { ...sh }; 8289 Object.defineProperty(def, "shape", { value: newSh }); 8290 return newSh; 8291 } }); 8292 } 8293 const _normalized = cached(() => normalizeDef(def)); 8294 defineLazy(inst._zod, "propValues", () => { 8295 const shape = def.shape; 8296 const propValues = {}; 8297 for (const key in shape) { 8298 const field = shape[key]._zod; 8299 if (field.values) { 8300 propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set()); 8301 for (const v of field.values) propValues[key].add(v); 8302 } 8303 } 8304 return propValues; 8305 }); 8306 const isObject = isObject$1; 8307 const catchall = def.catchall; 8308 let value; 8309 inst._zod.parse = (payload, ctx) => { 8310 value ?? (value = _normalized.value); 8311 const input = payload.value; 8312 if (!isObject(input)) { 8313 payload.issues.push({ 8314 expected: "object", 8315 code: "invalid_type", 8316 input, 8317 inst 8318 }); 8319 return payload; 8320 } 8321 payload.value = {}; 8322 const proms = []; 8323 const shape = value.shape; 8324 for (const key of value.keys) { 8325 const el = shape[key]; 8326 const isOptionalIn = el._zod.optin === "optional"; 8327 const isOptionalOut = el._zod.optout === "optional"; 8328 const r = el._zod.run({ 8329 value: input[key], 8330 issues: [] 8331 }, ctx); 8332 if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut))); 8333 else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut); 8334 } 8335 if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload; 8336 return handleCatchall(proms, input, payload, ctx, _normalized.value, inst); 8337 }; 8338 }); 8339 var $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => { 8340 $ZodObject.init(inst, def); 8341 const superParse = inst._zod.parse; 8342 const _normalized = cached(() => normalizeDef(def)); 8343 const generateFastpass = (shape) => { 8344 const doc = new Doc([ 8345 "shape", 8346 "payload", 8347 "ctx" 8348 ]); 8349 const normalized = _normalized.value; 8350 const parseStr = (key) => { 8351 const k = esc(key); 8352 return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; 8353 }; 8354 doc.write(`const input = payload.value;`); 8355 const ids = Object.create(null); 8356 let counter = 0; 8357 for (const key of normalized.keys) ids[key] = `key_${counter++}`; 8358 doc.write(`const newResult = {};`); 8359 for (const key of normalized.keys) { 8360 const id = ids[key]; 8361 const k = esc(key); 8362 const schema = shape[key]; 8363 const isOptionalIn = schema?._zod?.optin === "optional"; 8364 const isOptionalOut = schema?._zod?.optout === "optional"; 8365 doc.write(`const ${id} = ${parseStr(key)};`); 8366 if (isOptionalIn && isOptionalOut) doc.write(` 8367 if (${id}.issues.length) { 8368 if (${k} in input) { 8369 payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ 8370 ...iss, 8371 path: iss.path ? [${k}, ...iss.path] : [${k}] 8372 }))); 8373 } 8374 } 8375 8376 if (${id}.value === undefined) { 8377 if (${k} in input) { 8378 newResult[${k}] = undefined; 8379 } 8380 } else { 8381 newResult[${k}] = ${id}.value; 8382 } 8383 8384 `); 8385 else if (!isOptionalIn) doc.write(` 8386 const ${id}_present = ${k} in input; 8387 if (${id}.issues.length) { 8388 payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ 8389 ...iss, 8390 path: iss.path ? [${k}, ...iss.path] : [${k}] 8391 }))); 8392 } 8393 if (!${id}_present && !${id}.issues.length) { 8394 payload.issues.push({ 8395 code: "invalid_type", 8396 expected: "nonoptional", 8397 input: undefined, 8398 path: [${k}] 8399 }); 8400 } 8401 8402 if (${id}_present) { 8403 if (${id}.value === undefined) { 8404 newResult[${k}] = undefined; 8405 } else { 8406 newResult[${k}] = ${id}.value; 8407 } 8408 } 8409 8410 `); 8411 else doc.write(` 8412 if (${id}.issues.length) { 8413 payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ 8414 ...iss, 8415 path: iss.path ? [${k}, ...iss.path] : [${k}] 8416 }))); 8417 } 8418 8419 if (${id}.value === undefined) { 8420 if (${k} in input) { 8421 newResult[${k}] = undefined; 8422 } 8423 } else { 8424 newResult[${k}] = ${id}.value; 8425 } 8426 8427 `); 8428 } 8429 doc.write(`payload.value = newResult;`); 8430 doc.write(`return payload;`); 8431 const fn = doc.compile(); 8432 return (payload, ctx) => fn(shape, payload, ctx); 8433 }; 8434 let fastpass; 8435 const isObject = isObject$1; 8436 const jit = !globalConfig.jitless; 8437 const fastEnabled = jit && allowsEval.value; 8438 const catchall = def.catchall; 8439 let value; 8440 inst._zod.parse = (payload, ctx) => { 8441 value ?? (value = _normalized.value); 8442 const input = payload.value; 8443 if (!isObject(input)) { 8444 payload.issues.push({ 8445 expected: "object", 8446 code: "invalid_type", 8447 input, 8448 inst 8449 }); 8450 return payload; 8451 } 8452 if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) { 8453 if (!fastpass) fastpass = generateFastpass(def.shape); 8454 payload = fastpass(payload, ctx); 8455 if (!catchall) return payload; 8456 return handleCatchall([], input, payload, ctx, value, inst); 8457 } 8458 return superParse(payload, ctx); 8459 }; 8460 }); 8461 function handleUnionResults(results, final, inst, ctx) { 8462 for (const result of results) if (result.issues.length === 0) { 8463 final.value = result.value; 8464 return final; 8465 } 8466 const nonaborted = results.filter((r) => !aborted(r)); 8467 if (nonaborted.length === 1) { 8468 final.value = nonaborted[0].value; 8469 return nonaborted[0]; 8470 } 8471 final.issues.push({ 8472 code: "invalid_union", 8473 input: final.value, 8474 inst, 8475 errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) 8476 }); 8477 return final; 8478 } 8479 var $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => { 8480 $ZodType.init(inst, def); 8481 defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0); 8482 defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0); 8483 defineLazy(inst._zod, "values", () => { 8484 if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values))); 8485 }); 8486 defineLazy(inst._zod, "pattern", () => { 8487 if (def.options.every((o) => o._zod.pattern)) { 8488 const patterns = def.options.map((o) => o._zod.pattern); 8489 return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`); 8490 } 8491 }); 8492 const first = def.options.length === 1 ? def.options[0]._zod.run : null; 8493 inst._zod.parse = (payload, ctx) => { 8494 if (first) return first(payload, ctx); 8495 let async = false; 8496 const results = []; 8497 for (const option of def.options) { 8498 const result = option._zod.run({ 8499 value: payload.value, 8500 issues: [] 8501 }, ctx); 8502 if (result instanceof Promise) { 8503 results.push(result); 8504 async = true; 8505 } else { 8506 if (result.issues.length === 0) return result; 8507 results.push(result); 8508 } 8509 } 8510 if (!async) return handleUnionResults(results, payload, inst, ctx); 8511 return Promise.all(results).then((results) => { 8512 return handleUnionResults(results, payload, inst, ctx); 8513 }); 8514 }; 8515 }); 8516 var $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => { 8517 $ZodType.init(inst, def); 8518 inst._zod.parse = (payload, ctx) => { 8519 const input = payload.value; 8520 const left = def.left._zod.run({ 8521 value: input, 8522 issues: [] 8523 }, ctx); 8524 const right = def.right._zod.run({ 8525 value: input, 8526 issues: [] 8527 }, ctx); 8528 if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => { 8529 return handleIntersectionResults(payload, left, right); 8530 }); 8531 return handleIntersectionResults(payload, left, right); 8532 }; 8533 }); 8534 function mergeValues(a, b) { 8535 if (a === b) return { 8536 valid: true, 8537 data: a 8538 }; 8539 if (a instanceof Date && b instanceof Date && +a === +b) return { 8540 valid: true, 8541 data: a 8542 }; 8543 if (isPlainObject(a) && isPlainObject(b)) { 8544 const bKeys = Object.keys(b); 8545 const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1); 8546 const newObj = { 8547 ...a, 8548 ...b 8549 }; 8550 for (const key of sharedKeys) { 8551 const sharedValue = mergeValues(a[key], b[key]); 8552 if (!sharedValue.valid) return { 8553 valid: false, 8554 mergeErrorPath: [key, ...sharedValue.mergeErrorPath] 8555 }; 8556 newObj[key] = sharedValue.data; 8557 } 8558 return { 8559 valid: true, 8560 data: newObj 8561 }; 8562 } 8563 if (Array.isArray(a) && Array.isArray(b)) { 8564 if (a.length !== b.length) return { 8565 valid: false, 8566 mergeErrorPath: [] 8567 }; 8568 const newArray = []; 8569 for (let index = 0; index < a.length; index++) { 8570 const itemA = a[index]; 8571 const itemB = b[index]; 8572 const sharedValue = mergeValues(itemA, itemB); 8573 if (!sharedValue.valid) return { 8574 valid: false, 8575 mergeErrorPath: [index, ...sharedValue.mergeErrorPath] 8576 }; 8577 newArray.push(sharedValue.data); 8578 } 8579 return { 8580 valid: true, 8581 data: newArray 8582 }; 8583 } 8584 return { 8585 valid: false, 8586 mergeErrorPath: [] 8587 }; 8588 } 8589 function handleIntersectionResults(result, left, right) { 8590 const unrecKeys = /* @__PURE__ */ new Map(); 8591 let unrecIssue; 8592 for (const iss of left.issues) if (iss.code === "unrecognized_keys") { 8593 unrecIssue ?? (unrecIssue = iss); 8594 for (const k of iss.keys) { 8595 if (!unrecKeys.has(k)) unrecKeys.set(k, {}); 8596 unrecKeys.get(k).l = true; 8597 } 8598 } else result.issues.push(iss); 8599 for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) { 8600 if (!unrecKeys.has(k)) unrecKeys.set(k, {}); 8601 unrecKeys.get(k).r = true; 8602 } 8603 else result.issues.push(iss); 8604 const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k); 8605 if (bothKeys.length && unrecIssue) result.issues.push({ 8606 ...unrecIssue, 8607 keys: bothKeys 8608 }); 8609 if (aborted(result)) return result; 8610 const merged = mergeValues(left.value, right.value); 8611 if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`); 8612 result.value = merged.data; 8613 return result; 8614 } 8615 var $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => { 8616 $ZodType.init(inst, def); 8617 const values = getEnumValues(def.entries); 8618 const valuesSet = new Set(values); 8619 inst._zod.values = valuesSet; 8620 inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`); 8621 inst._zod.parse = (payload, _ctx) => { 8622 const input = payload.value; 8623 if (valuesSet.has(input)) return payload; 8624 payload.issues.push({ 8625 code: "invalid_value", 8626 values, 8627 input, 8628 inst 8629 }); 8630 return payload; 8631 }; 8632 }); 8633 var $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => { 8634 $ZodType.init(inst, def); 8635 inst._zod.optin = "optional"; 8636 inst._zod.parse = (payload, ctx) => { 8637 if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name); 8638 const _out = def.transform(payload.value, payload); 8639 if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => { 8640 payload.value = output; 8641 payload.fallback = true; 8642 return payload; 8643 }); 8644 if (_out instanceof Promise) throw new $ZodAsyncError(); 8645 payload.value = _out; 8646 payload.fallback = true; 8647 return payload; 8648 }; 8649 }); 8650 function handleOptionalResult(result, input) { 8651 if (input === void 0 && (result.issues.length || result.fallback)) return { 8652 issues: [], 8653 value: void 0 8654 }; 8655 return result; 8656 } 8657 var $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => { 8658 $ZodType.init(inst, def); 8659 inst._zod.optin = "optional"; 8660 inst._zod.optout = "optional"; 8661 defineLazy(inst._zod, "values", () => { 8662 return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0; 8663 }); 8664 defineLazy(inst._zod, "pattern", () => { 8665 const pattern = def.innerType._zod.pattern; 8666 return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0; 8667 }); 8668 inst._zod.parse = (payload, ctx) => { 8669 if (def.innerType._zod.optin === "optional") { 8670 const input = payload.value; 8671 const result = def.innerType._zod.run(payload, ctx); 8672 if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input)); 8673 return handleOptionalResult(result, input); 8674 } 8675 if (payload.value === void 0) return payload; 8676 return def.innerType._zod.run(payload, ctx); 8677 }; 8678 }); 8679 var $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => { 8680 $ZodOptional.init(inst, def); 8681 defineLazy(inst._zod, "values", () => def.innerType._zod.values); 8682 defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern); 8683 inst._zod.parse = (payload, ctx) => { 8684 return def.innerType._zod.run(payload, ctx); 8685 }; 8686 }); 8687 var $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => { 8688 $ZodType.init(inst, def); 8689 defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); 8690 defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); 8691 defineLazy(inst._zod, "pattern", () => { 8692 const pattern = def.innerType._zod.pattern; 8693 return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0; 8694 }); 8695 defineLazy(inst._zod, "values", () => { 8696 return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0; 8697 }); 8698 inst._zod.parse = (payload, ctx) => { 8699 if (payload.value === null) return payload; 8700 return def.innerType._zod.run(payload, ctx); 8701 }; 8702 }); 8703 var $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => { 8704 $ZodType.init(inst, def); 8705 inst._zod.optin = "optional"; 8706 defineLazy(inst._zod, "values", () => def.innerType._zod.values); 8707 inst._zod.parse = (payload, ctx) => { 8708 if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); 8709 if (payload.value === void 0) { 8710 payload.value = def.defaultValue; 8711 /** 8712 * $ZodDefault returns the default value immediately in forward direction. 8713 * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */ 8714 return payload; 8715 } 8716 const result = def.innerType._zod.run(payload, ctx); 8717 if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def)); 8718 return handleDefaultResult(result, def); 8719 }; 8720 }); 8721 function handleDefaultResult(payload, def) { 8722 if (payload.value === void 0) payload.value = def.defaultValue; 8723 return payload; 8724 } 8725 var $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => { 8726 $ZodType.init(inst, def); 8727 inst._zod.optin = "optional"; 8728 defineLazy(inst._zod, "values", () => def.innerType._zod.values); 8729 inst._zod.parse = (payload, ctx) => { 8730 if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); 8731 if (payload.value === void 0) payload.value = def.defaultValue; 8732 return def.innerType._zod.run(payload, ctx); 8733 }; 8734 }); 8735 var $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => { 8736 $ZodType.init(inst, def); 8737 defineLazy(inst._zod, "values", () => { 8738 const v = def.innerType._zod.values; 8739 return v ? new Set([...v].filter((x) => x !== void 0)) : void 0; 8740 }); 8741 inst._zod.parse = (payload, ctx) => { 8742 const result = def.innerType._zod.run(payload, ctx); 8743 if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst)); 8744 return handleNonOptionalResult(result, inst); 8745 }; 8746 }); 8747 function handleNonOptionalResult(payload, inst) { 8748 if (!payload.issues.length && payload.value === void 0) payload.issues.push({ 8749 code: "invalid_type", 8750 expected: "nonoptional", 8751 input: payload.value, 8752 inst 8753 }); 8754 return payload; 8755 } 8756 var $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => { 8757 $ZodType.init(inst, def); 8758 inst._zod.optin = "optional"; 8759 defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); 8760 defineLazy(inst._zod, "values", () => def.innerType._zod.values); 8761 inst._zod.parse = (payload, ctx) => { 8762 if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); 8763 const result = def.innerType._zod.run(payload, ctx); 8764 if (result instanceof Promise) return result.then((result) => { 8765 payload.value = result.value; 8766 if (result.issues.length) { 8767 payload.value = def.catchValue({ 8768 ...payload, 8769 error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) }, 8770 input: payload.value 8771 }); 8772 payload.issues = []; 8773 payload.fallback = true; 8774 } 8775 return payload; 8776 }); 8777 payload.value = result.value; 8778 if (result.issues.length) { 8779 payload.value = def.catchValue({ 8780 ...payload, 8781 error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) }, 8782 input: payload.value 8783 }); 8784 payload.issues = []; 8785 payload.fallback = true; 8786 } 8787 return payload; 8788 }; 8789 }); 8790 var $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => { 8791 $ZodType.init(inst, def); 8792 defineLazy(inst._zod, "values", () => def.in._zod.values); 8793 defineLazy(inst._zod, "optin", () => def.in._zod.optin); 8794 defineLazy(inst._zod, "optout", () => def.out._zod.optout); 8795 defineLazy(inst._zod, "propValues", () => def.in._zod.propValues); 8796 inst._zod.parse = (payload, ctx) => { 8797 if (ctx.direction === "backward") { 8798 const right = def.out._zod.run(payload, ctx); 8799 if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx)); 8800 return handlePipeResult(right, def.in, ctx); 8801 } 8802 const left = def.in._zod.run(payload, ctx); 8803 if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx)); 8804 return handlePipeResult(left, def.out, ctx); 8805 }; 8806 }); 8807 function handlePipeResult(left, next, ctx) { 8808 if (left.issues.length) { 8809 left.aborted = true; 8810 return left; 8811 } 8812 return next._zod.run({ 8813 value: left.value, 8814 issues: left.issues, 8815 fallback: left.fallback 8816 }, ctx); 8817 } 8818 var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => { 8819 $ZodType.init(inst, def); 8820 defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues); 8821 defineLazy(inst._zod, "values", () => def.innerType._zod.values); 8822 defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin); 8823 defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout); 8824 inst._zod.parse = (payload, ctx) => { 8825 if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); 8826 const result = def.innerType._zod.run(payload, ctx); 8827 if (result instanceof Promise) return result.then(handleReadonlyResult); 8828 return handleReadonlyResult(result); 8829 }; 8830 }); 8831 function handleReadonlyResult(payload) { 8832 payload.value = Object.freeze(payload.value); 8833 return payload; 8834 } 8835 var $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => { 8836 $ZodCheck.init(inst, def); 8837 $ZodType.init(inst, def); 8838 inst._zod.parse = (payload, _) => { 8839 return payload; 8840 }; 8841 inst._zod.check = (payload) => { 8842 const input = payload.value; 8843 const r = def.fn(input); 8844 if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst)); 8845 handleRefineResult(r, payload, input, inst); 8846 }; 8847 }); 8848 function handleRefineResult(result, payload, input, inst) { 8849 if (!result) { 8850 const _iss = { 8851 code: "custom", 8852 input, 8853 inst, 8854 path: [...inst._zod.def.path ?? []], 8855 continue: !inst._zod.def.abort 8856 }; 8857 if (inst._zod.def.params) _iss.params = inst._zod.def.params; 8858 payload.issues.push(issue(_iss)); 8859 } 8860 } 8861 //#endregion 8862 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/registries.js 8863 var _a; 8864 var $ZodRegistry = class { 8865 constructor() { 8866 this._map = /* @__PURE__ */ new WeakMap(); 8867 this._idmap = /* @__PURE__ */ new Map(); 8868 } 8869 add(schema, ..._meta) { 8870 const meta = _meta[0]; 8871 this._map.set(schema, meta); 8872 if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema); 8873 return this; 8874 } 8875 clear() { 8876 this._map = /* @__PURE__ */ new WeakMap(); 8877 this._idmap = /* @__PURE__ */ new Map(); 8878 return this; 8879 } 8880 remove(schema) { 8881 const meta = this._map.get(schema); 8882 if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id); 8883 this._map.delete(schema); 8884 return this; 8885 } 8886 get(schema) { 8887 const p = schema._zod.parent; 8888 if (p) { 8889 const pm = { ...this.get(p) ?? {} }; 8890 delete pm.id; 8891 const f = { 8892 ...pm, 8893 ...this._map.get(schema) 8894 }; 8895 return Object.keys(f).length ? f : void 0; 8896 } 8897 return this._map.get(schema); 8898 } 8899 has(schema) { 8900 return this._map.has(schema); 8901 } 8902 }; 8903 function registry() { 8904 return new $ZodRegistry(); 8905 } 8906 (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry()); 8907 var globalRegistry = globalThis.__zod_globalRegistry; 8908 //#endregion 8909 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/api.js 8910 // @__NO_SIDE_EFFECTS__ 8911 function _string(Class, params) { 8912 return new Class({ 8913 type: "string", 8914 ...normalizeParams(params) 8915 }); 8916 } 8917 // @__NO_SIDE_EFFECTS__ 8918 function _email(Class, params) { 8919 return new Class({ 8920 type: "string", 8921 format: "email", 8922 check: "string_format", 8923 abort: false, 8924 ...normalizeParams(params) 8925 }); 8926 } 8927 // @__NO_SIDE_EFFECTS__ 8928 function _guid(Class, params) { 8929 return new Class({ 8930 type: "string", 8931 format: "guid", 8932 check: "string_format", 8933 abort: false, 8934 ...normalizeParams(params) 8935 }); 8936 } 8937 // @__NO_SIDE_EFFECTS__ 8938 function _uuid(Class, params) { 8939 return new Class({ 8940 type: "string", 8941 format: "uuid", 8942 check: "string_format", 8943 abort: false, 8944 ...normalizeParams(params) 8945 }); 8946 } 8947 // @__NO_SIDE_EFFECTS__ 8948 function _uuidv4(Class, params) { 8949 return new Class({ 8950 type: "string", 8951 format: "uuid", 8952 check: "string_format", 8953 abort: false, 8954 version: "v4", 8955 ...normalizeParams(params) 8956 }); 8957 } 8958 // @__NO_SIDE_EFFECTS__ 8959 function _uuidv6(Class, params) { 8960 return new Class({ 8961 type: "string", 8962 format: "uuid", 8963 check: "string_format", 8964 abort: false, 8965 version: "v6", 8966 ...normalizeParams(params) 8967 }); 8968 } 8969 // @__NO_SIDE_EFFECTS__ 8970 function _uuidv7(Class, params) { 8971 return new Class({ 8972 type: "string", 8973 format: "uuid", 8974 check: "string_format", 8975 abort: false, 8976 version: "v7", 8977 ...normalizeParams(params) 8978 }); 8979 } 8980 // @__NO_SIDE_EFFECTS__ 8981 function _url(Class, params) { 8982 return new Class({ 8983 type: "string", 8984 format: "url", 8985 check: "string_format", 8986 abort: false, 8987 ...normalizeParams(params) 8988 }); 8989 } 8990 // @__NO_SIDE_EFFECTS__ 8991 function _emoji(Class, params) { 8992 return new Class({ 8993 type: "string", 8994 format: "emoji", 8995 check: "string_format", 8996 abort: false, 8997 ...normalizeParams(params) 8998 }); 8999 } 9000 // @__NO_SIDE_EFFECTS__ 9001 function _nanoid(Class, params) { 9002 return new Class({ 9003 type: "string", 9004 format: "nanoid", 9005 check: "string_format", 9006 abort: false, 9007 ...normalizeParams(params) 9008 }); 9009 } 9010 /** 9011 * @deprecated CUID v1 is deprecated by its authors due to information leakage 9012 * (timestamps embedded in the id). Use {@link _cuid2} instead. 9013 * See https://github.com/paralleldrive/cuid. 9014 */ 9015 // @__NO_SIDE_EFFECTS__ 9016 function _cuid(Class, params) { 9017 return new Class({ 9018 type: "string", 9019 format: "cuid", 9020 check: "string_format", 9021 abort: false, 9022 ...normalizeParams(params) 9023 }); 9024 } 9025 // @__NO_SIDE_EFFECTS__ 9026 function _cuid2(Class, params) { 9027 return new Class({ 9028 type: "string", 9029 format: "cuid2", 9030 check: "string_format", 9031 abort: false, 9032 ...normalizeParams(params) 9033 }); 9034 } 9035 // @__NO_SIDE_EFFECTS__ 9036 function _ulid(Class, params) { 9037 return new Class({ 9038 type: "string", 9039 format: "ulid", 9040 check: "string_format", 9041 abort: false, 9042 ...normalizeParams(params) 9043 }); 9044 } 9045 // @__NO_SIDE_EFFECTS__ 9046 function _xid(Class, params) { 9047 return new Class({ 9048 type: "string", 9049 format: "xid", 9050 check: "string_format", 9051 abort: false, 9052 ...normalizeParams(params) 9053 }); 9054 } 9055 // @__NO_SIDE_EFFECTS__ 9056 function _ksuid(Class, params) { 9057 return new Class({ 9058 type: "string", 9059 format: "ksuid", 9060 check: "string_format", 9061 abort: false, 9062 ...normalizeParams(params) 9063 }); 9064 } 9065 // @__NO_SIDE_EFFECTS__ 9066 function _ipv4(Class, params) { 9067 return new Class({ 9068 type: "string", 9069 format: "ipv4", 9070 check: "string_format", 9071 abort: false, 9072 ...normalizeParams(params) 9073 }); 9074 } 9075 // @__NO_SIDE_EFFECTS__ 9076 function _ipv6(Class, params) { 9077 return new Class({ 9078 type: "string", 9079 format: "ipv6", 9080 check: "string_format", 9081 abort: false, 9082 ...normalizeParams(params) 9083 }); 9084 } 9085 // @__NO_SIDE_EFFECTS__ 9086 function _cidrv4(Class, params) { 9087 return new Class({ 9088 type: "string", 9089 format: "cidrv4", 9090 check: "string_format", 9091 abort: false, 9092 ...normalizeParams(params) 9093 }); 9094 } 9095 // @__NO_SIDE_EFFECTS__ 9096 function _cidrv6(Class, params) { 9097 return new Class({ 9098 type: "string", 9099 format: "cidrv6", 9100 check: "string_format", 9101 abort: false, 9102 ...normalizeParams(params) 9103 }); 9104 } 9105 // @__NO_SIDE_EFFECTS__ 9106 function _base64(Class, params) { 9107 return new Class({ 9108 type: "string", 9109 format: "base64", 9110 check: "string_format", 9111 abort: false, 9112 ...normalizeParams(params) 9113 }); 9114 } 9115 // @__NO_SIDE_EFFECTS__ 9116 function _base64url(Class, params) { 9117 return new Class({ 9118 type: "string", 9119 format: "base64url", 9120 check: "string_format", 9121 abort: false, 9122 ...normalizeParams(params) 9123 }); 9124 } 9125 // @__NO_SIDE_EFFECTS__ 9126 function _e164(Class, params) { 9127 return new Class({ 9128 type: "string", 9129 format: "e164", 9130 check: "string_format", 9131 abort: false, 9132 ...normalizeParams(params) 9133 }); 9134 } 9135 // @__NO_SIDE_EFFECTS__ 9136 function _jwt(Class, params) { 9137 return new Class({ 9138 type: "string", 9139 format: "jwt", 9140 check: "string_format", 9141 abort: false, 9142 ...normalizeParams(params) 9143 }); 9144 } 9145 // @__NO_SIDE_EFFECTS__ 9146 function _isoDateTime(Class, params) { 9147 return new Class({ 9148 type: "string", 9149 format: "datetime", 9150 check: "string_format", 9151 offset: false, 9152 local: false, 9153 precision: null, 9154 ...normalizeParams(params) 9155 }); 9156 } 9157 // @__NO_SIDE_EFFECTS__ 9158 function _isoDate(Class, params) { 9159 return new Class({ 9160 type: "string", 9161 format: "date", 9162 check: "string_format", 9163 ...normalizeParams(params) 9164 }); 9165 } 9166 // @__NO_SIDE_EFFECTS__ 9167 function _isoTime(Class, params) { 9168 return new Class({ 9169 type: "string", 9170 format: "time", 9171 check: "string_format", 9172 precision: null, 9173 ...normalizeParams(params) 9174 }); 9175 } 9176 // @__NO_SIDE_EFFECTS__ 9177 function _isoDuration(Class, params) { 9178 return new Class({ 9179 type: "string", 9180 format: "duration", 9181 check: "string_format", 9182 ...normalizeParams(params) 9183 }); 9184 } 9185 // @__NO_SIDE_EFFECTS__ 9186 function _number(Class, params) { 9187 return new Class({ 9188 type: "number", 9189 checks: [], 9190 ...normalizeParams(params) 9191 }); 9192 } 9193 // @__NO_SIDE_EFFECTS__ 9194 function _int(Class, params) { 9195 return new Class({ 9196 type: "number", 9197 check: "number_format", 9198 abort: false, 9199 format: "safeint", 9200 ...normalizeParams(params) 9201 }); 9202 } 9203 // @__NO_SIDE_EFFECTS__ 9204 function _unknown(Class) { 9205 return new Class({ type: "unknown" }); 9206 } 9207 // @__NO_SIDE_EFFECTS__ 9208 function _never(Class, params) { 9209 return new Class({ 9210 type: "never", 9211 ...normalizeParams(params) 9212 }); 9213 } 9214 // @__NO_SIDE_EFFECTS__ 9215 function _lt(value, params) { 9216 return new $ZodCheckLessThan({ 9217 check: "less_than", 9218 ...normalizeParams(params), 9219 value, 9220 inclusive: false 9221 }); 9222 } 9223 // @__NO_SIDE_EFFECTS__ 9224 function _lte(value, params) { 9225 return new $ZodCheckLessThan({ 9226 check: "less_than", 9227 ...normalizeParams(params), 9228 value, 9229 inclusive: true 9230 }); 9231 } 9232 // @__NO_SIDE_EFFECTS__ 9233 function _gt(value, params) { 9234 return new $ZodCheckGreaterThan({ 9235 check: "greater_than", 9236 ...normalizeParams(params), 9237 value, 9238 inclusive: false 9239 }); 9240 } 9241 // @__NO_SIDE_EFFECTS__ 9242 function _gte(value, params) { 9243 return new $ZodCheckGreaterThan({ 9244 check: "greater_than", 9245 ...normalizeParams(params), 9246 value, 9247 inclusive: true 9248 }); 9249 } 9250 // @__NO_SIDE_EFFECTS__ 9251 function _multipleOf(value, params) { 9252 return new $ZodCheckMultipleOf({ 9253 check: "multiple_of", 9254 ...normalizeParams(params), 9255 value 9256 }); 9257 } 9258 // @__NO_SIDE_EFFECTS__ 9259 function _maxLength(maximum, params) { 9260 return new $ZodCheckMaxLength({ 9261 check: "max_length", 9262 ...normalizeParams(params), 9263 maximum 9264 }); 9265 } 9266 // @__NO_SIDE_EFFECTS__ 9267 function _minLength(minimum, params) { 9268 return new $ZodCheckMinLength({ 9269 check: "min_length", 9270 ...normalizeParams(params), 9271 minimum 9272 }); 9273 } 9274 // @__NO_SIDE_EFFECTS__ 9275 function _length(length, params) { 9276 return new $ZodCheckLengthEquals({ 9277 check: "length_equals", 9278 ...normalizeParams(params), 9279 length 9280 }); 9281 } 9282 // @__NO_SIDE_EFFECTS__ 9283 function _regex(pattern, params) { 9284 return new $ZodCheckRegex({ 9285 check: "string_format", 9286 format: "regex", 9287 ...normalizeParams(params), 9288 pattern 9289 }); 9290 } 9291 // @__NO_SIDE_EFFECTS__ 9292 function _lowercase(params) { 9293 return new $ZodCheckLowerCase({ 9294 check: "string_format", 9295 format: "lowercase", 9296 ...normalizeParams(params) 9297 }); 9298 } 9299 // @__NO_SIDE_EFFECTS__ 9300 function _uppercase(params) { 9301 return new $ZodCheckUpperCase({ 9302 check: "string_format", 9303 format: "uppercase", 9304 ...normalizeParams(params) 9305 }); 9306 } 9307 // @__NO_SIDE_EFFECTS__ 9308 function _includes(includes, params) { 9309 return new $ZodCheckIncludes({ 9310 check: "string_format", 9311 format: "includes", 9312 ...normalizeParams(params), 9313 includes 9314 }); 9315 } 9316 // @__NO_SIDE_EFFECTS__ 9317 function _startsWith(prefix, params) { 9318 return new $ZodCheckStartsWith({ 9319 check: "string_format", 9320 format: "starts_with", 9321 ...normalizeParams(params), 9322 prefix 9323 }); 9324 } 9325 // @__NO_SIDE_EFFECTS__ 9326 function _endsWith(suffix, params) { 9327 return new $ZodCheckEndsWith({ 9328 check: "string_format", 9329 format: "ends_with", 9330 ...normalizeParams(params), 9331 suffix 9332 }); 9333 } 9334 // @__NO_SIDE_EFFECTS__ 9335 function _overwrite(tx) { 9336 return new $ZodCheckOverwrite({ 9337 check: "overwrite", 9338 tx 9339 }); 9340 } 9341 // @__NO_SIDE_EFFECTS__ 9342 function _normalize(form) { 9343 return /* @__PURE__ */ _overwrite((input) => input.normalize(form)); 9344 } 9345 // @__NO_SIDE_EFFECTS__ 9346 function _trim() { 9347 return /* @__PURE__ */ _overwrite((input) => input.trim()); 9348 } 9349 // @__NO_SIDE_EFFECTS__ 9350 function _toLowerCase() { 9351 return /* @__PURE__ */ _overwrite((input) => input.toLowerCase()); 9352 } 9353 // @__NO_SIDE_EFFECTS__ 9354 function _toUpperCase() { 9355 return /* @__PURE__ */ _overwrite((input) => input.toUpperCase()); 9356 } 9357 // @__NO_SIDE_EFFECTS__ 9358 function _slugify() { 9359 return /* @__PURE__ */ _overwrite((input) => slugify(input)); 9360 } 9361 // @__NO_SIDE_EFFECTS__ 9362 function _array(Class, element, params) { 9363 return new Class({ 9364 type: "array", 9365 element, 9366 ...normalizeParams(params) 9367 }); 9368 } 9369 // @__NO_SIDE_EFFECTS__ 9370 function _refine(Class, fn, _params) { 9371 return new Class({ 9372 type: "custom", 9373 check: "custom", 9374 fn, 9375 ...normalizeParams(_params) 9376 }); 9377 } 9378 // @__NO_SIDE_EFFECTS__ 9379 function _superRefine(fn, params) { 9380 const ch = /* @__PURE__ */ _check((payload) => { 9381 payload.addIssue = (issue$2) => { 9382 if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def)); 9383 else { 9384 const _issue = issue$2; 9385 if (_issue.fatal) _issue.continue = false; 9386 _issue.code ?? (_issue.code = "custom"); 9387 _issue.input ?? (_issue.input = payload.value); 9388 _issue.inst ?? (_issue.inst = ch); 9389 _issue.continue ?? (_issue.continue = !ch._zod.def.abort); 9390 payload.issues.push(issue(_issue)); 9391 } 9392 }; 9393 return fn(payload.value, payload); 9394 }, params); 9395 return ch; 9396 } 9397 // @__NO_SIDE_EFFECTS__ 9398 function _check(fn, params) { 9399 const ch = new $ZodCheck({ 9400 check: "custom", 9401 ...normalizeParams(params) 9402 }); 9403 ch._zod.check = fn; 9404 return ch; 9405 } 9406 //#endregion 9407 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/to-json-schema.js 9408 function initializeContext(params) { 9409 let target = params?.target ?? "draft-2020-12"; 9410 if (target === "draft-4") target = "draft-04"; 9411 if (target === "draft-7") target = "draft-07"; 9412 return { 9413 processors: params.processors ?? {}, 9414 metadataRegistry: params?.metadata ?? globalRegistry, 9415 target, 9416 unrepresentable: params?.unrepresentable ?? "throw", 9417 override: params?.override ?? (() => {}), 9418 io: params?.io ?? "output", 9419 counter: 0, 9420 seen: /* @__PURE__ */ new Map(), 9421 cycles: params?.cycles ?? "ref", 9422 reused: params?.reused ?? "inline", 9423 external: params?.external ?? void 0 9424 }; 9425 } 9426 function process$1(schema, ctx, _params = { 9427 path: [], 9428 schemaPath: [] 9429 }) { 9430 var _a; 9431 const def = schema._zod.def; 9432 const seen = ctx.seen.get(schema); 9433 if (seen) { 9434 seen.count++; 9435 if (_params.schemaPath.includes(schema)) seen.cycle = _params.path; 9436 return seen.schema; 9437 } 9438 const result = { 9439 schema: {}, 9440 count: 1, 9441 cycle: void 0, 9442 path: _params.path 9443 }; 9444 ctx.seen.set(schema, result); 9445 const overrideSchema = schema._zod.toJSONSchema?.(); 9446 if (overrideSchema) result.schema = overrideSchema; 9447 else { 9448 const params = { 9449 ..._params, 9450 schemaPath: [..._params.schemaPath, schema], 9451 path: _params.path 9452 }; 9453 if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params); 9454 else { 9455 const _json = result.schema; 9456 const processor = ctx.processors[def.type]; 9457 if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`); 9458 processor(schema, ctx, _json, params); 9459 } 9460 const parent = schema._zod.parent; 9461 if (parent) { 9462 if (!result.ref) result.ref = parent; 9463 process$1(parent, ctx, params); 9464 ctx.seen.get(parent).isParent = true; 9465 } 9466 } 9467 const meta = ctx.metadataRegistry.get(schema); 9468 if (meta) Object.assign(result.schema, meta); 9469 if (ctx.io === "input" && isTransforming(schema)) { 9470 delete result.schema.examples; 9471 delete result.schema.default; 9472 } 9473 if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault); 9474 delete result.schema._prefault; 9475 return ctx.seen.get(schema).schema; 9476 } 9477 function extractDefs(ctx, schema) { 9478 const root = ctx.seen.get(schema); 9479 if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); 9480 const idToSchema = /* @__PURE__ */ new Map(); 9481 for (const entry of ctx.seen.entries()) { 9482 const id = ctx.metadataRegistry.get(entry[0])?.id; 9483 if (id) { 9484 const existing = idToSchema.get(id); 9485 if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`); 9486 idToSchema.set(id, entry[0]); 9487 } 9488 } 9489 const makeURI = (entry) => { 9490 const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions"; 9491 if (ctx.external) { 9492 const externalId = ctx.external.registry.get(entry[0])?.id; 9493 const uriGenerator = ctx.external.uri ?? ((id) => id); 9494 if (externalId) return { ref: uriGenerator(externalId) }; 9495 const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`; 9496 entry[1].defId = id; 9497 return { 9498 defId: id, 9499 ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` 9500 }; 9501 } 9502 if (entry[1] === root) return { ref: "#" }; 9503 const defUriPrefix = `#/${defsSegment}/`; 9504 const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`; 9505 return { 9506 defId, 9507 ref: defUriPrefix + defId 9508 }; 9509 }; 9510 const extractToDef = (entry) => { 9511 if (entry[1].schema.$ref) return; 9512 const seen = entry[1]; 9513 const { ref, defId } = makeURI(entry); 9514 seen.def = { ...seen.schema }; 9515 if (defId) seen.defId = defId; 9516 const schema = seen.schema; 9517 for (const key in schema) delete schema[key]; 9518 schema.$ref = ref; 9519 }; 9520 if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) { 9521 const seen = entry[1]; 9522 if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root> 9523 9524Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); 9525 } 9526 for (const entry of ctx.seen.entries()) { 9527 const seen = entry[1]; 9528 if (schema === entry[0]) { 9529 extractToDef(entry); 9530 continue; 9531 } 9532 if (ctx.external) { 9533 const ext = ctx.external.registry.get(entry[0])?.id; 9534 if (schema !== entry[0] && ext) { 9535 extractToDef(entry); 9536 continue; 9537 } 9538 } 9539 if (ctx.metadataRegistry.get(entry[0])?.id) { 9540 extractToDef(entry); 9541 continue; 9542 } 9543 if (seen.cycle) { 9544 extractToDef(entry); 9545 continue; 9546 } 9547 if (seen.count > 1) { 9548 if (ctx.reused === "ref") { 9549 extractToDef(entry); 9550 continue; 9551 } 9552 } 9553 } 9554 } 9555 function finalize(ctx, schema) { 9556 const root = ctx.seen.get(schema); 9557 if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); 9558 const flattenRef = (zodSchema) => { 9559 const seen = ctx.seen.get(zodSchema); 9560 if (seen.ref === null) return; 9561 const schema = seen.def ?? seen.schema; 9562 const _cached = { ...schema }; 9563 const ref = seen.ref; 9564 seen.ref = null; 9565 if (ref) { 9566 flattenRef(ref); 9567 const refSeen = ctx.seen.get(ref); 9568 const refSchema = refSeen.schema; 9569 if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) { 9570 schema.allOf = schema.allOf ?? []; 9571 schema.allOf.push(refSchema); 9572 } else Object.assign(schema, refSchema); 9573 Object.assign(schema, _cached); 9574 if (zodSchema._zod.parent === ref) for (const key in schema) { 9575 if (key === "$ref" || key === "allOf") continue; 9576 if (!(key in _cached)) delete schema[key]; 9577 } 9578 if (refSchema.$ref && refSeen.def) for (const key in schema) { 9579 if (key === "$ref" || key === "allOf") continue; 9580 if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key]; 9581 } 9582 } 9583 const parent = zodSchema._zod.parent; 9584 if (parent && parent !== ref) { 9585 flattenRef(parent); 9586 const parentSeen = ctx.seen.get(parent); 9587 if (parentSeen?.schema.$ref) { 9588 schema.$ref = parentSeen.schema.$ref; 9589 if (parentSeen.def) for (const key in schema) { 9590 if (key === "$ref" || key === "allOf") continue; 9591 if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key]; 9592 } 9593 } 9594 } 9595 ctx.override({ 9596 zodSchema, 9597 jsonSchema: schema, 9598 path: seen.path ?? [] 9599 }); 9600 }; 9601 for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]); 9602 const result = {}; 9603 if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema"; 9604 else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#"; 9605 else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#"; 9606 else if (ctx.target === "openapi-3.0") {} 9607 if (ctx.external?.uri) { 9608 const id = ctx.external.registry.get(schema)?.id; 9609 if (!id) throw new Error("Schema is missing an `id` property"); 9610 result.$id = ctx.external.uri(id); 9611 } 9612 Object.assign(result, root.def ?? root.schema); 9613 const rootMetaId = ctx.metadataRegistry.get(schema)?.id; 9614 if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id; 9615 const defs = ctx.external?.defs ?? {}; 9616 for (const entry of ctx.seen.entries()) { 9617 const seen = entry[1]; 9618 if (seen.def && seen.defId) { 9619 if (seen.def.id === seen.defId) delete seen.def.id; 9620 defs[seen.defId] = seen.def; 9621 } 9622 } 9623 if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs; 9624 else result.definitions = defs; 9625 try { 9626 const finalized = JSON.parse(JSON.stringify(result)); 9627 Object.defineProperty(finalized, "~standard", { 9628 value: { 9629 ...schema["~standard"], 9630 jsonSchema: { 9631 input: createStandardJSONSchemaMethod(schema, "input", ctx.processors), 9632 output: createStandardJSONSchemaMethod(schema, "output", ctx.processors) 9633 } 9634 }, 9635 enumerable: false, 9636 writable: false 9637 }); 9638 return finalized; 9639 } catch (_err) { 9640 throw new Error("Error converting schema to JSON."); 9641 } 9642 } 9643 function isTransforming(_schema, _ctx) { 9644 const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() }; 9645 if (ctx.seen.has(_schema)) return false; 9646 ctx.seen.add(_schema); 9647 const def = _schema._zod.def; 9648 if (def.type === "transform") return true; 9649 if (def.type === "array") return isTransforming(def.element, ctx); 9650 if (def.type === "set") return isTransforming(def.valueType, ctx); 9651 if (def.type === "lazy") return isTransforming(def.getter(), ctx); 9652 if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx); 9653 if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx); 9654 if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); 9655 if (def.type === "pipe") { 9656 if (_schema._zod.traits.has("$ZodCodec")) return true; 9657 return isTransforming(def.in, ctx) || isTransforming(def.out, ctx); 9658 } 9659 if (def.type === "object") { 9660 for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true; 9661 return false; 9662 } 9663 if (def.type === "union") { 9664 for (const option of def.options) if (isTransforming(option, ctx)) return true; 9665 return false; 9666 } 9667 if (def.type === "tuple") { 9668 for (const item of def.items) if (isTransforming(item, ctx)) return true; 9669 if (def.rest && isTransforming(def.rest, ctx)) return true; 9670 return false; 9671 } 9672 return false; 9673 } 9674 /** 9675 * Creates a toJSONSchema method for a schema instance. 9676 * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing. 9677 */ 9678 var createToJSONSchemaMethod = (schema, processors = {}) => (params) => { 9679 const ctx = initializeContext({ 9680 ...params, 9681 processors 9682 }); 9683 process$1(schema, ctx); 9684 extractDefs(ctx, schema); 9685 return finalize(ctx, schema); 9686 }; 9687 var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => { 9688 const { libraryOptions, target } = params ?? {}; 9689 const ctx = initializeContext({ 9690 ...libraryOptions ?? {}, 9691 target, 9692 io, 9693 processors 9694 }); 9695 process$1(schema, ctx); 9696 extractDefs(ctx, schema); 9697 return finalize(ctx, schema); 9698 }; 9699 //#endregion 9700 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/core/json-schema-processors.js 9701 var formatMap = { 9702 guid: "uuid", 9703 url: "uri", 9704 datetime: "date-time", 9705 json_string: "json-string", 9706 regex: "" 9707 }; 9708 var stringProcessor = (schema, ctx, _json, _params) => { 9709 const json = _json; 9710 json.type = "string"; 9711 const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag; 9712 if (typeof minimum === "number") json.minLength = minimum; 9713 if (typeof maximum === "number") json.maxLength = maximum; 9714 if (format) { 9715 json.format = formatMap[format] ?? format; 9716 if (json.format === "") delete json.format; 9717 if (format === "time") delete json.format; 9718 } 9719 if (contentEncoding) json.contentEncoding = contentEncoding; 9720 if (patterns && patterns.size > 0) { 9721 const regexes = [...patterns]; 9722 if (regexes.length === 1) json.pattern = regexes[0].source; 9723 else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({ 9724 ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {}, 9725 pattern: regex.source 9726 }))]; 9727 } 9728 }; 9729 var numberProcessor = (schema, ctx, _json, _params) => { 9730 const json = _json; 9731 const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag; 9732 if (typeof format === "string" && format.includes("int")) json.type = "integer"; 9733 else json.type = "number"; 9734 const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY); 9735 const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY); 9736 const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0"; 9737 if (exMin) if (legacy) { 9738 json.minimum = exclusiveMinimum; 9739 json.exclusiveMinimum = true; 9740 } else json.exclusiveMinimum = exclusiveMinimum; 9741 else if (typeof minimum === "number") json.minimum = minimum; 9742 if (exMax) if (legacy) { 9743 json.maximum = exclusiveMaximum; 9744 json.exclusiveMaximum = true; 9745 } else json.exclusiveMaximum = exclusiveMaximum; 9746 else if (typeof maximum === "number") json.maximum = maximum; 9747 if (typeof multipleOf === "number") json.multipleOf = multipleOf; 9748 }; 9749 var neverProcessor = (_schema, _ctx, json, _params) => { 9750 json.not = {}; 9751 }; 9752 var enumProcessor = (schema, _ctx, json, _params) => { 9753 const def = schema._zod.def; 9754 const values = getEnumValues(def.entries); 9755 if (values.every((v) => typeof v === "number")) json.type = "number"; 9756 if (values.every((v) => typeof v === "string")) json.type = "string"; 9757 json.enum = values; 9758 }; 9759 var customProcessor = (_schema, ctx, _json, _params) => { 9760 if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema"); 9761 }; 9762 var transformProcessor = (_schema, ctx, _json, _params) => { 9763 if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema"); 9764 }; 9765 var arrayProcessor = (schema, ctx, _json, params) => { 9766 const json = _json; 9767 const def = schema._zod.def; 9768 const { minimum, maximum } = schema._zod.bag; 9769 if (typeof minimum === "number") json.minItems = minimum; 9770 if (typeof maximum === "number") json.maxItems = maximum; 9771 json.type = "array"; 9772 json.items = process$1(def.element, ctx, { 9773 ...params, 9774 path: [...params.path, "items"] 9775 }); 9776 }; 9777 var objectProcessor = (schema, ctx, _json, params) => { 9778 const json = _json; 9779 const def = schema._zod.def; 9780 json.type = "object"; 9781 json.properties = {}; 9782 const shape = def.shape; 9783 for (const key in shape) json.properties[key] = process$1(shape[key], ctx, { 9784 ...params, 9785 path: [ 9786 ...params.path, 9787 "properties", 9788 key 9789 ] 9790 }); 9791 const allKeys = new Set(Object.keys(shape)); 9792 const requiredKeys = new Set([...allKeys].filter((key) => { 9793 const v = def.shape[key]._zod; 9794 if (ctx.io === "input") return v.optin === void 0; 9795 else return v.optout === void 0; 9796 })); 9797 if (requiredKeys.size > 0) json.required = Array.from(requiredKeys); 9798 if (def.catchall?._zod.def.type === "never") json.additionalProperties = false; 9799 else if (!def.catchall) { 9800 if (ctx.io === "output") json.additionalProperties = false; 9801 } else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, { 9802 ...params, 9803 path: [...params.path, "additionalProperties"] 9804 }); 9805 }; 9806 var unionProcessor = (schema, ctx, json, params) => { 9807 const def = schema._zod.def; 9808 const isExclusive = def.inclusive === false; 9809 const options = def.options.map((x, i) => process$1(x, ctx, { 9810 ...params, 9811 path: [ 9812 ...params.path, 9813 isExclusive ? "oneOf" : "anyOf", 9814 i 9815 ] 9816 })); 9817 if (isExclusive) json.oneOf = options; 9818 else json.anyOf = options; 9819 }; 9820 var intersectionProcessor = (schema, ctx, json, params) => { 9821 const def = schema._zod.def; 9822 const a = process$1(def.left, ctx, { 9823 ...params, 9824 path: [ 9825 ...params.path, 9826 "allOf", 9827 0 9828 ] 9829 }); 9830 const b = process$1(def.right, ctx, { 9831 ...params, 9832 path: [ 9833 ...params.path, 9834 "allOf", 9835 1 9836 ] 9837 }); 9838 const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1; 9839 json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]]; 9840 }; 9841 var nullableProcessor = (schema, ctx, json, params) => { 9842 const def = schema._zod.def; 9843 const inner = process$1(def.innerType, ctx, params); 9844 const seen = ctx.seen.get(schema); 9845 if (ctx.target === "openapi-3.0") { 9846 seen.ref = def.innerType; 9847 json.nullable = true; 9848 } else json.anyOf = [inner, { type: "null" }]; 9849 }; 9850 var nonoptionalProcessor = (schema, ctx, _json, params) => { 9851 const def = schema._zod.def; 9852 process$1(def.innerType, ctx, params); 9853 const seen = ctx.seen.get(schema); 9854 seen.ref = def.innerType; 9855 }; 9856 var defaultProcessor = (schema, ctx, json, params) => { 9857 const def = schema._zod.def; 9858 process$1(def.innerType, ctx, params); 9859 const seen = ctx.seen.get(schema); 9860 seen.ref = def.innerType; 9861 json.default = JSON.parse(JSON.stringify(def.defaultValue)); 9862 }; 9863 var prefaultProcessor = (schema, ctx, json, params) => { 9864 const def = schema._zod.def; 9865 process$1(def.innerType, ctx, params); 9866 const seen = ctx.seen.get(schema); 9867 seen.ref = def.innerType; 9868 if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue)); 9869 }; 9870 var catchProcessor = (schema, ctx, json, params) => { 9871 const def = schema._zod.def; 9872 process$1(def.innerType, ctx, params); 9873 const seen = ctx.seen.get(schema); 9874 seen.ref = def.innerType; 9875 let catchValue; 9876 try { 9877 catchValue = def.catchValue(void 0); 9878 } catch { 9879 throw new Error("Dynamic catch values are not supported in JSON Schema"); 9880 } 9881 json.default = catchValue; 9882 }; 9883 var pipeProcessor = (schema, ctx, _json, params) => { 9884 const def = schema._zod.def; 9885 const inIsTransform = def.in._zod.traits.has("$ZodTransform"); 9886 const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out; 9887 process$1(innerType, ctx, params); 9888 const seen = ctx.seen.get(schema); 9889 seen.ref = innerType; 9890 }; 9891 var readonlyProcessor = (schema, ctx, json, params) => { 9892 const def = schema._zod.def; 9893 process$1(def.innerType, ctx, params); 9894 const seen = ctx.seen.get(schema); 9895 seen.ref = def.innerType; 9896 json.readOnly = true; 9897 }; 9898 var optionalProcessor = (schema, ctx, _json, params) => { 9899 const def = schema._zod.def; 9900 process$1(def.innerType, ctx, params); 9901 const seen = ctx.seen.get(schema); 9902 seen.ref = def.innerType; 9903 }; 9904 //#endregion 9905 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/classic/iso.js 9906 var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => { 9907 $ZodISODateTime.init(inst, def); 9908 ZodStringFormat.init(inst, def); 9909 }); 9910 function datetime(params) { 9911 return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params); 9912 } 9913 var ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => { 9914 $ZodISODate.init(inst, def); 9915 ZodStringFormat.init(inst, def); 9916 }); 9917 function date(params) { 9918 return /* @__PURE__ */ _isoDate(ZodISODate, params); 9919 } 9920 var ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => { 9921 $ZodISOTime.init(inst, def); 9922 ZodStringFormat.init(inst, def); 9923 }); 9924 function time(params) { 9925 return /* @__PURE__ */ _isoTime(ZodISOTime, params); 9926 } 9927 var ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => { 9928 $ZodISODuration.init(inst, def); 9929 ZodStringFormat.init(inst, def); 9930 }); 9931 function duration(params) { 9932 return /* @__PURE__ */ _isoDuration(ZodISODuration, params); 9933 } 9934 //#endregion 9935 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/classic/errors.js 9936 var initializer = (inst, issues) => { 9937 $ZodError.init(inst, issues); 9938 inst.name = "ZodError"; 9939 Object.defineProperties(inst, { 9940 format: { value: (mapper) => formatError(inst, mapper) }, 9941 flatten: { value: (mapper) => flattenError(inst, mapper) }, 9942 addIssue: { value: (issue) => { 9943 inst.issues.push(issue); 9944 inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); 9945 } }, 9946 addIssues: { value: (issues) => { 9947 inst.issues.push(...issues); 9948 inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); 9949 } }, 9950 isEmpty: { get() { 9951 return inst.issues.length === 0; 9952 } } 9953 }); 9954 }; 9955 var ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error }); 9956 //#endregion 9957 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/classic/parse.js 9958 var parse = /* @__PURE__ */ _parse(ZodRealError); 9959 var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError); 9960 var safeParse = /* @__PURE__ */ _safeParse(ZodRealError); 9961 var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError); 9962 var encode = /* @__PURE__ */ _encode(ZodRealError); 9963 var decode = /* @__PURE__ */ _decode(ZodRealError); 9964 var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError); 9965 var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError); 9966 var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError); 9967 var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError); 9968 var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError); 9969 var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError); 9970 //#endregion 9971 //#region ../../node_modules/.pnpm/[email protected]/node_modules/zod/v4/classic/schemas.js 9972 var _installedGroups = /* @__PURE__ */ new WeakMap(); 9973 function _installLazyMethods(inst, group, methods) { 9974 const proto = Object.getPrototypeOf(inst); 9975 let installed = _installedGroups.get(proto); 9976 if (!installed) { 9977 installed = /* @__PURE__ */ new Set(); 9978 _installedGroups.set(proto, installed); 9979 } 9980 if (installed.has(group)) return; 9981 installed.add(group); 9982 for (const key in methods) { 9983 const fn = methods[key]; 9984 Object.defineProperty(proto, key, { 9985 configurable: true, 9986 enumerable: false, 9987 get() { 9988 const bound = fn.bind(this); 9989 Object.defineProperty(this, key, { 9990 configurable: true, 9991 writable: true, 9992 enumerable: true, 9993 value: bound 9994 }); 9995 return bound; 9996 }, 9997 set(v) { 9998 Object.defineProperty(this, key, { 9999 configurable: true, 10000 writable: true, 10001 enumerable: true, 10002 value: v 10003 }); 10004 } 10005 }); 10006 } 10007 } 10008 var ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => { 10009 $ZodType.init(inst, def); 10010 Object.assign(inst["~standard"], { jsonSchema: { 10011 input: createStandardJSONSchemaMethod(inst, "input"), 10012 output: createStandardJSONSchemaMethod(inst, "output") 10013 } }); 10014 inst.toJSONSchema = createToJSONSchemaMethod(inst, {}); 10015 inst.def = def; 10016 inst.type = def.type; 10017 Object.defineProperty(inst, "_def", { value: def }); 10018 inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse }); 10019 inst.safeParse = (data, params) => safeParse(inst, data, params); 10020 inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync }); 10021 inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params); 10022 inst.spa = inst.safeParseAsync; 10023 inst.encode = (data, params) => encode(inst, data, params); 10024 inst.decode = (data, params) => decode(inst, data, params); 10025 inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params); 10026 inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params); 10027 inst.safeEncode = (data, params) => safeEncode(inst, data, params); 10028 inst.safeDecode = (data, params) => safeDecode(inst, data, params); 10029 inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params); 10030 inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params); 10031 _installLazyMethods(inst, "ZodType", { 10032 check(...chks) { 10033 const def = this.def; 10034 return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: { 10035 check: ch, 10036 def: { check: "custom" }, 10037 onattach: [] 10038 } } : ch)] }), { parent: true }); 10039 }, 10040 with(...chks) { 10041 return this.check(...chks); 10042 }, 10043 clone(def, params) { 10044 return clone$1(this, def, params); 10045 }, 10046 brand() { 10047 return this; 10048 }, 10049 register(reg, meta) { 10050 reg.add(this, meta); 10051 return this; 10052 }, 10053 refine(check, params) { 10054 return this.check(refine(check, params)); 10055 }, 10056 superRefine(refinement, params) { 10057 return this.check(superRefine(refinement, params)); 10058 }, 10059 overwrite(fn) { 10060 return this.check(/* @__PURE__ */ _overwrite(fn)); 10061 }, 10062 optional() { 10063 return optional(this); 10064 }, 10065 exactOptional() { 10066 return exactOptional(this); 10067 }, 10068 nullable() { 10069 return nullable(this); 10070 }, 10071 nullish() { 10072 return optional(nullable(this)); 10073 }, 10074 nonoptional(params) { 10075 return nonoptional(this, params); 10076 }, 10077 array() { 10078 return array(this); 10079 }, 10080 or(arg) { 10081 return union([this, arg]); 10082 }, 10083 and(arg) { 10084 return intersection(this, arg); 10085 }, 10086 transform(tx) { 10087 return pipe(this, transform(tx)); 10088 }, 10089 default(d) { 10090 return _default(this, d); 10091 }, 10092 prefault(d) { 10093 return prefault(this, d); 10094 }, 10095 catch(params) { 10096 return _catch(this, params); 10097 }, 10098 pipe(target) { 10099 return pipe(this, target); 10100 }, 10101 readonly() { 10102 return readonly(this); 10103 }, 10104 describe(description) { 10105 const cl = this.clone(); 10106 globalRegistry.add(cl, { description }); 10107 return cl; 10108 }, 10109 meta(...args) { 10110 if (args.length === 0) return globalRegistry.get(this); 10111 const cl = this.clone(); 10112 globalRegistry.add(cl, args[0]); 10113 return cl; 10114 }, 10115 isOptional() { 10116 return this.safeParse(void 0).success; 10117 }, 10118 isNullable() { 10119 return this.safeParse(null).success; 10120 }, 10121 apply(fn) { 10122 return fn(this); 10123 } 10124 }); 10125 Object.defineProperty(inst, "description", { 10126 get() { 10127 return globalRegistry.get(inst)?.description; 10128 }, 10129 configurable: true 10130 }); 10131 return inst; 10132 }); 10133 /** @internal */ 10134 var _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => { 10135 $ZodString.init(inst, def); 10136 ZodType.init(inst, def); 10137 inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params); 10138 const bag = inst._zod.bag; 10139 inst.format = bag.format ?? null; 10140 inst.minLength = bag.minimum ?? null; 10141 inst.maxLength = bag.maximum ?? null; 10142 _installLazyMethods(inst, "_ZodString", { 10143 regex(...args) { 10144 return this.check(/* @__PURE__ */ _regex(...args)); 10145 }, 10146 includes(...args) { 10147 return this.check(/* @__PURE__ */ _includes(...args)); 10148 }, 10149 startsWith(...args) { 10150 return this.check(/* @__PURE__ */ _startsWith(...args)); 10151 }, 10152 endsWith(...args) { 10153 return this.check(/* @__PURE__ */ _endsWith(...args)); 10154 }, 10155 min(...args) { 10156 return this.check(/* @__PURE__ */ _minLength(...args)); 10157 }, 10158 max(...args) { 10159 return this.check(/* @__PURE__ */ _maxLength(...args)); 10160 }, 10161 length(...args) { 10162 return this.check(/* @__PURE__ */ _length(...args)); 10163 }, 10164 nonempty(...args) { 10165 return this.check(/* @__PURE__ */ _minLength(1, ...args)); 10166 }, 10167 lowercase(params) { 10168 return this.check(/* @__PURE__ */ _lowercase(params)); 10169 }, 10170 uppercase(params) { 10171 return this.check(/* @__PURE__ */ _uppercase(params)); 10172 }, 10173 trim() { 10174 return this.check(/* @__PURE__ */ _trim()); 10175 }, 10176 normalize(...args) { 10177 return this.check(/* @__PURE__ */ _normalize(...args)); 10178 }, 10179 toLowerCase() { 10180 return this.check(/* @__PURE__ */ _toLowerCase()); 10181 }, 10182 toUpperCase() { 10183 return this.check(/* @__PURE__ */ _toUpperCase()); 10184 }, 10185 slugify() { 10186 return this.check(/* @__PURE__ */ _slugify()); 10187 } 10188 }); 10189 }); 10190 var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => { 10191 $ZodString.init(inst, def); 10192 _ZodString.init(inst, def); 10193 inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params)); 10194 inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params)); 10195 inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params)); 10196 inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params)); 10197 inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params)); 10198 inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params)); 10199 inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params)); 10200 inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params)); 10201 inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params)); 10202 inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params)); 10203 inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params)); 10204 inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params)); 10205 inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params)); 10206 inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params)); 10207 inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params)); 10208 inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params)); 10209 inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params)); 10210 inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params)); 10211 inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params)); 10212 inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params)); 10213 inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params)); 10214 inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params)); 10215 inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params)); 10216 inst.datetime = (params) => inst.check(datetime(params)); 10217 inst.date = (params) => inst.check(date(params)); 10218 inst.time = (params) => inst.check(time(params)); 10219 inst.duration = (params) => inst.check(duration(params)); 10220 }); 10221 function string(params) { 10222 return /* @__PURE__ */ _string(ZodString, params); 10223 } 10224 var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => { 10225 $ZodStringFormat.init(inst, def); 10226 _ZodString.init(inst, def); 10227 }); 10228 var ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => { 10229 $ZodEmail.init(inst, def); 10230 ZodStringFormat.init(inst, def); 10231 }); 10232 var ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => { 10233 $ZodGUID.init(inst, def); 10234 ZodStringFormat.init(inst, def); 10235 }); 10236 var ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => { 10237 $ZodUUID.init(inst, def); 10238 ZodStringFormat.init(inst, def); 10239 }); 10240 var ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => { 10241 $ZodURL.init(inst, def); 10242 ZodStringFormat.init(inst, def); 10243 }); 10244 var ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => { 10245 $ZodEmoji.init(inst, def); 10246 ZodStringFormat.init(inst, def); 10247 }); 10248 var ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => { 10249 $ZodNanoID.init(inst, def); 10250 ZodStringFormat.init(inst, def); 10251 }); 10252 /** 10253 * @deprecated CUID v1 is deprecated by its authors due to information leakage 10254 * (timestamps embedded in the id). Use {@link ZodCUID2} instead. 10255 * See https://github.com/paralleldrive/cuid. 10256 */ 10257 var ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => { 10258 $ZodCUID.init(inst, def); 10259 ZodStringFormat.init(inst, def); 10260 }); 10261 var ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => { 10262 $ZodCUID2.init(inst, def); 10263 ZodStringFormat.init(inst, def); 10264 }); 10265 var ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => { 10266 $ZodULID.init(inst, def); 10267 ZodStringFormat.init(inst, def); 10268 }); 10269 var ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => { 10270 $ZodXID.init(inst, def); 10271 ZodStringFormat.init(inst, def); 10272 }); 10273 var ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => { 10274 $ZodKSUID.init(inst, def); 10275 ZodStringFormat.init(inst, def); 10276 }); 10277 var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => { 10278 $ZodIPv4.init(inst, def); 10279 ZodStringFormat.init(inst, def); 10280 }); 10281 var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => { 10282 $ZodIPv6.init(inst, def); 10283 ZodStringFormat.init(inst, def); 10284 }); 10285 var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => { 10286 $ZodCIDRv4.init(inst, def); 10287 ZodStringFormat.init(inst, def); 10288 }); 10289 var ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => { 10290 $ZodCIDRv6.init(inst, def); 10291 ZodStringFormat.init(inst, def); 10292 }); 10293 var ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => { 10294 $ZodBase64.init(inst, def); 10295 ZodStringFormat.init(inst, def); 10296 }); 10297 var ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => { 10298 $ZodBase64URL.init(inst, def); 10299 ZodStringFormat.init(inst, def); 10300 }); 10301 var ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => { 10302 $ZodE164.init(inst, def); 10303 ZodStringFormat.init(inst, def); 10304 }); 10305 var ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => { 10306 $ZodJWT.init(inst, def); 10307 ZodStringFormat.init(inst, def); 10308 }); 10309 var ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => { 10310 $ZodNumber.init(inst, def); 10311 ZodType.init(inst, def); 10312 inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params); 10313 _installLazyMethods(inst, "ZodNumber", { 10314 gt(value, params) { 10315 return this.check(/* @__PURE__ */ _gt(value, params)); 10316 }, 10317 gte(value, params) { 10318 return this.check(/* @__PURE__ */ _gte(value, params)); 10319 }, 10320 min(value, params) { 10321 return this.check(/* @__PURE__ */ _gte(value, params)); 10322 }, 10323 lt(value, params) { 10324 return this.check(/* @__PURE__ */ _lt(value, params)); 10325 }, 10326 lte(value, params) { 10327 return this.check(/* @__PURE__ */ _lte(value, params)); 10328 }, 10329 max(value, params) { 10330 return this.check(/* @__PURE__ */ _lte(value, params)); 10331 }, 10332 int(params) { 10333 return this.check(int(params)); 10334 }, 10335 safe(params) { 10336 return this.check(int(params)); 10337 }, 10338 positive(params) { 10339 return this.check(/* @__PURE__ */ _gt(0, params)); 10340 }, 10341 nonnegative(params) { 10342 return this.check(/* @__PURE__ */ _gte(0, params)); 10343 }, 10344 negative(params) { 10345 return this.check(/* @__PURE__ */ _lt(0, params)); 10346 }, 10347 nonpositive(params) { 10348 return this.check(/* @__PURE__ */ _lte(0, params)); 10349 }, 10350 multipleOf(value, params) { 10351 return this.check(/* @__PURE__ */ _multipleOf(value, params)); 10352 }, 10353 step(value, params) { 10354 return this.check(/* @__PURE__ */ _multipleOf(value, params)); 10355 }, 10356 finite() { 10357 return this; 10358 } 10359 }); 10360 const bag = inst._zod.bag; 10361 inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null; 10362 inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null; 10363 inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5); 10364 inst.isFinite = true; 10365 inst.format = bag.format ?? null; 10366 }); 10367 function number(params) { 10368 return /* @__PURE__ */ _number(ZodNumber, params); 10369 } 10370 var ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => { 10371 $ZodNumberFormat.init(inst, def); 10372 ZodNumber.init(inst, def); 10373 }); 10374 function int(params) { 10375 return /* @__PURE__ */ _int(ZodNumberFormat, params); 10376 } 10377 var ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => { 10378 $ZodUnknown.init(inst, def); 10379 ZodType.init(inst, def); 10380 inst._zod.processJSONSchema = (ctx, json, params) => void 0; 10381 }); 10382 function unknown() { 10383 return /* @__PURE__ */ _unknown(ZodUnknown); 10384 } 10385 var ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => { 10386 $ZodNever.init(inst, def); 10387 ZodType.init(inst, def); 10388 inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params); 10389 }); 10390 function never(params) { 10391 return /* @__PURE__ */ _never(ZodNever, params); 10392 } 10393 var ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => { 10394 $ZodArray.init(inst, def); 10395 ZodType.init(inst, def); 10396 inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params); 10397 inst.element = def.element; 10398 _installLazyMethods(inst, "ZodArray", { 10399 min(n, params) { 10400 return this.check(/* @__PURE__ */ _minLength(n, params)); 10401 }, 10402 nonempty(params) { 10403 return this.check(/* @__PURE__ */ _minLength(1, params)); 10404 }, 10405 max(n, params) { 10406 return this.check(/* @__PURE__ */ _maxLength(n, params)); 10407 }, 10408 length(n, params) { 10409 return this.check(/* @__PURE__ */ _length(n, params)); 10410 }, 10411 unwrap() { 10412 return this.element; 10413 } 10414 }); 10415 }); 10416 function array(element, params) { 10417 return /* @__PURE__ */ _array(ZodArray, element, params); 10418 } 10419 var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => { 10420 $ZodObjectJIT.init(inst, def); 10421 ZodType.init(inst, def); 10422 inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params); 10423 defineLazy(inst, "shape", () => { 10424 return def.shape; 10425 }); 10426 _installLazyMethods(inst, "ZodObject", { 10427 keyof() { 10428 return _enum(Object.keys(this._zod.def.shape)); 10429 }, 10430 catchall(catchall) { 10431 return this.clone({ 10432 ...this._zod.def, 10433 catchall 10434 }); 10435 }, 10436 passthrough() { 10437 return this.clone({ 10438 ...this._zod.def, 10439 catchall: unknown() 10440 }); 10441 }, 10442 loose() { 10443 return this.clone({ 10444 ...this._zod.def, 10445 catchall: unknown() 10446 }); 10447 }, 10448 strict() { 10449 return this.clone({ 10450 ...this._zod.def, 10451 catchall: never() 10452 }); 10453 }, 10454 strip() { 10455 return this.clone({ 10456 ...this._zod.def, 10457 catchall: void 0 10458 }); 10459 }, 10460 extend(incoming) { 10461 return extend(this, incoming); 10462 }, 10463 safeExtend(incoming) { 10464 return safeExtend(this, incoming); 10465 }, 10466 merge(other) { 10467 return merge(this, other); 10468 }, 10469 pick(mask) { 10470 return pick(this, mask); 10471 }, 10472 omit(mask) { 10473 return omit(this, mask); 10474 }, 10475 partial(...args) { 10476 return partial(ZodOptional, this, args[0]); 10477 }, 10478 required(...args) { 10479 return required(ZodNonOptional, this, args[0]); 10480 } 10481 }); 10482 }); 10483 function object(shape, params) { 10484 return new ZodObject({ 10485 type: "object", 10486 shape: shape ?? {}, 10487 ...normalizeParams(params) 10488 }); 10489 } 10490 var ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => { 10491 $ZodUnion.init(inst, def); 10492 ZodType.init(inst, def); 10493 inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params); 10494 inst.options = def.options; 10495 }); 10496 function union(options, params) { 10497 return new ZodUnion({ 10498 type: "union", 10499 options, 10500 ...normalizeParams(params) 10501 }); 10502 } 10503 var ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => { 10504 $ZodIntersection.init(inst, def); 10505 ZodType.init(inst, def); 10506 inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params); 10507 }); 10508 function intersection(left, right) { 10509 return new ZodIntersection({ 10510 type: "intersection", 10511 left, 10512 right 10513 }); 10514 } 10515 var ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => { 10516 $ZodEnum.init(inst, def); 10517 ZodType.init(inst, def); 10518 inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params); 10519 inst.enum = def.entries; 10520 inst.options = Object.values(def.entries); 10521 const keys = new Set(Object.keys(def.entries)); 10522 inst.extract = (values, params) => { 10523 const newEntries = {}; 10524 for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value]; 10525 else throw new Error(`Key ${value} not found in enum`); 10526 return new ZodEnum({ 10527 ...def, 10528 checks: [], 10529 ...normalizeParams(params), 10530 entries: newEntries 10531 }); 10532 }; 10533 inst.exclude = (values, params) => { 10534 const newEntries = { ...def.entries }; 10535 for (const value of values) if (keys.has(value)) delete newEntries[value]; 10536 else throw new Error(`Key ${value} not found in enum`); 10537 return new ZodEnum({ 10538 ...def, 10539 checks: [], 10540 ...normalizeParams(params), 10541 entries: newEntries 10542 }); 10543 }; 10544 }); 10545 function _enum(values, params) { 10546 return new ZodEnum({ 10547 type: "enum", 10548 entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values, 10549 ...normalizeParams(params) 10550 }); 10551 } 10552 var ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => { 10553 $ZodTransform.init(inst, def); 10554 ZodType.init(inst, def); 10555 inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params); 10556 inst._zod.parse = (payload, _ctx) => { 10557 if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name); 10558 payload.addIssue = (issue$1) => { 10559 if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def)); 10560 else { 10561 const _issue = issue$1; 10562 if (_issue.fatal) _issue.continue = false; 10563 _issue.code ?? (_issue.code = "custom"); 10564 _issue.input ?? (_issue.input = payload.value); 10565 _issue.inst ?? (_issue.inst = inst); 10566 payload.issues.push(issue(_issue)); 10567 } 10568 }; 10569 const output = def.transform(payload.value, payload); 10570 if (output instanceof Promise) return output.then((output) => { 10571 payload.value = output; 10572 payload.fallback = true; 10573 return payload; 10574 }); 10575 payload.value = output; 10576 payload.fallback = true; 10577 return payload; 10578 }; 10579 }); 10580 function transform(fn) { 10581 return new ZodTransform({ 10582 type: "transform", 10583 transform: fn 10584 }); 10585 } 10586 var ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => { 10587 $ZodOptional.init(inst, def); 10588 ZodType.init(inst, def); 10589 inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params); 10590 inst.unwrap = () => inst._zod.def.innerType; 10591 }); 10592 function optional(innerType) { 10593 return new ZodOptional({ 10594 type: "optional", 10595 innerType 10596 }); 10597 } 10598 var ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => { 10599 $ZodExactOptional.init(inst, def); 10600 ZodType.init(inst, def); 10601 inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params); 10602 inst.unwrap = () => inst._zod.def.innerType; 10603 }); 10604 function exactOptional(innerType) { 10605 return new ZodExactOptional({ 10606 type: "optional", 10607 innerType 10608 }); 10609 } 10610 var ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => { 10611 $ZodNullable.init(inst, def); 10612 ZodType.init(inst, def); 10613 inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params); 10614 inst.unwrap = () => inst._zod.def.innerType; 10615 }); 10616 function nullable(innerType) { 10617 return new ZodNullable({ 10618 type: "nullable", 10619 innerType 10620 }); 10621 } 10622 var ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => { 10623 $ZodDefault.init(inst, def); 10624 ZodType.init(inst, def); 10625 inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params); 10626 inst.unwrap = () => inst._zod.def.innerType; 10627 inst.removeDefault = inst.unwrap; 10628 }); 10629 function _default(innerType, defaultValue) { 10630 return new ZodDefault({ 10631 type: "default", 10632 innerType, 10633 get defaultValue() { 10634 return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); 10635 } 10636 }); 10637 } 10638 var ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => { 10639 $ZodPrefault.init(inst, def); 10640 ZodType.init(inst, def); 10641 inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params); 10642 inst.unwrap = () => inst._zod.def.innerType; 10643 }); 10644 function prefault(innerType, defaultValue) { 10645 return new ZodPrefault({ 10646 type: "prefault", 10647 innerType, 10648 get defaultValue() { 10649 return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); 10650 } 10651 }); 10652 } 10653 var ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => { 10654 $ZodNonOptional.init(inst, def); 10655 ZodType.init(inst, def); 10656 inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params); 10657 inst.unwrap = () => inst._zod.def.innerType; 10658 }); 10659 function nonoptional(innerType, params) { 10660 return new ZodNonOptional({ 10661 type: "nonoptional", 10662 innerType, 10663 ...normalizeParams(params) 10664 }); 10665 } 10666 var ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => { 10667 $ZodCatch.init(inst, def); 10668 ZodType.init(inst, def); 10669 inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params); 10670 inst.unwrap = () => inst._zod.def.innerType; 10671 inst.removeCatch = inst.unwrap; 10672 });
10673 function _catch(innerType, catchValue) { 10674 return new ZodCatch({ 10675 type: "catch", 10676 innerType, 10677 catchValue: typeof catchValue === "function" ? catchValue : () => catchValue 10678 }); 10679 } 10680 var ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => { 10681 $ZodPipe.init(inst, def); 10682 ZodType.init(inst, def); 10683 inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params); 10684 inst.in = def.in; 10685 inst.out = def.out; 10686 }); 10687 function pipe(in_, out) { 10688 return new ZodPipe({ 10689 type: "pipe", 10690 in: in_, 10691 out 10692 }); 10693 } 10694 var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => { 10695 $ZodReadonly.init(inst, def); 10696 ZodType.init(inst, def); 10697 inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params); 10698 inst.unwrap = () => inst._zod.def.innerType; 10699 }); 10700 function readonly(innerType) { 10701 return new ZodReadonly({ 10702 type: "readonly", 10703 innerType 10704 }); 10705 } 10706 var ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => { 10707 $ZodCustom.init(inst, def); 10708 ZodType.init(inst, def); 10709 inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params); 10710 }); 10711 function refine(fn, _params = {}) { 10712 return /* @__PURE__ */ _refine(ZodCustom, fn, _params); 10713 } 10714 function superRefine(fn, params) { 10715 return /* @__PURE__ */ _superRefine(fn, params); 10716 } 10717 function _instanceof(cls, params = {}) { 10718 const inst = new ZodCustom({ 10719 type: "custom", 10720 check: "custom", 10721 fn: (data) => data instanceof cls, 10722 abort: true, 10723 ...normalizeParams(params) 10724 }); 10725 inst._zod.bag.Class = cls; 10726 inst._zod.check = (payload) => { 10727 if (!(payload.value instanceof cls)) payload.issues.push({ 10728 code: "invalid_type", 10729 expected: cls.name, 10730 input: payload.value, 10731 inst, 10732 path: [...inst._zod.def.path ?? []] 10733 }); 10734 }; 10735 return inst; 10736 } 10737 //#endregion 10738 //#region ../../packages/gomus-types/lib/zodSchemas/PersonalizationFormSchema.ts 10739 var PersonalizationSchema = object({ 10740 id: number(), 10741 customer: object({ 10742 customer_salutation_id: number().positive({ message: "user.fieldErrors.titleRequire" }), 10743 name: string().min(1, { message: "user.fieldErrors.nameRequire" }), 10744 surname: string().min(1, { message: "user.fieldErrors.surnameRequire" }), 10745 email: string().email({ message: "user.fieldErrors.emailValid" }).min(1, { message: "user.fieldErrors.emailRequire" }), 10746 email_confirmation: string().email({ message: "user.fieldErrors.emailValidRequire" }).optional(), 10747 addr_street: string().min(1, { message: "user.fieldErrors.streetRequire" }), 10748 addr_zip: string().min(1, { message: "user.fieldErrors.postRequire" }), 10749 addr_city: string().min(1, { message: "user.fieldErrors.cityRequire" }), 10750 addr_country_id: number().positive().default(60), 10751 language_id: number().positive({ message: "user.fieldErrors.languageRequire" }).default(1) 10752 }) 10753 }); 10754 object({ 10755 ticket_sale_id: number(), 10756 start_at: string().date(), 10757 personalizations: array(PersonalizationSchema) 10758 }); 10759 //#endregion 10760 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/utils.mjs 10761 function $09ec6a572d60460f$export$842a2cf37af977e1(amount, numerator) { 10762 return amount - numerator * Math.floor(amount / numerator); 10763 } 10764 //#endregion 10765 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.mjs 10766 var $93635573935797de$var$EPOCH = 1721426; 10767 function $93635573935797de$export$f297eb839006d339(era, year, month, day) { 10768 year = $93635573935797de$export$c36e0ecb2d4fa69d(era, year); 10769 let y1 = year - 1; 10770 let monthOffset = -2; 10771 if (month <= 2) monthOffset = 0; 10772 else if ($93635573935797de$export$553d7fa8e3805fc0(year)) monthOffset = -1; 10773 return $93635573935797de$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day); 10774 } 10775 function $93635573935797de$export$553d7fa8e3805fc0(year) { 10776 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); 10777 } 10778 function $93635573935797de$export$c36e0ecb2d4fa69d(era, year) {
10779 return era === "BC" ? 1 - year : year; 10780 } 10781 function $93635573935797de$export$4475b7e617eb123c(year) { 10782 let era = "AD"; 10783 if (year <= 0) { 10784 era = "BC"; 10785 year = 1 - year; 10786 } 10787 return [era, year]; 10788 } 10789 var $93635573935797de$var$daysInMonth = { 10790 standard: [ 10791 31, 10792 28, 10793 31, 10794 30, 10795 31, 10796 30, 10797 31, 10798 31, 10799 30, 10800 31, 10801 30, 10802 31 10803 ], 10804 leapyear: [ 10805 31, 10806 29, 10807 31, 10808 30, 10809 31, 10810 30, 10811 31, 10812 31, 10813 30, 10814 31, 10815 30, 10816 31 10817 ] 10818 }; 10819 var $93635573935797de$export$80ee6245ec4f29ec = class { 10820 fromJulianDay(jd) { 10821 let jd0 = jd; 10822 let depoch = jd0 - $93635573935797de$var$EPOCH; 10823 let quadricent = Math.floor(depoch / 146097); 10824 let dqc = $09ec6a572d60460f$export$842a2cf37af977e1(depoch, 146097); 10825 let cent = Math.floor(dqc / 36524); 10826 let dcent = $09ec6a572d60460f$export$842a2cf37af977e1(dqc, 36524); 10827 let quad = Math.floor(dcent / 1461); 10828 let dquad = $09ec6a572d60460f$export$842a2cf37af977e1(dcent, 1461); 10829 let yindex = Math.floor(dquad / 365); 10830 let [era, year] = $93635573935797de$export$4475b7e617eb123c(quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0)); 10831 let yearDay = jd0 - $93635573935797de$export$f297eb839006d339(era, year, 1, 1); 10832 let leapAdj = 2; 10833 if (jd0 < $93635573935797de$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0; 10834 else if ($93635573935797de$export$553d7fa8e3805fc0(year)) leapAdj = 1; 10835 let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367); 10836 return new $2aaf608024c21ca1$export$99faa760c7908e4f(era, year, month, jd0 - $93635573935797de$export$f297eb839006d339(era, year, month, 1) + 1); 10837 } 10838 toJulianDay(date) { 10839 return $93635573935797de$export$f297eb839006d339(date.era, date.year, date.month, date.day); 10840 } 10841 getDaysInMonth(date) { 10842 return $93635573935797de$var$daysInMonth[$93635573935797de$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1]; 10843 } 10844 getMonthsInYear(date) { 10845 return 12; 10846 } 10847 getDaysInYear(date) { 10848 return $93635573935797de$export$553d7fa8e3805fc0(date.year) ? 366 : 365; 10849 } 10850 getMaximumMonthsInYear() { 10851 return 12; 10852 } 10853 getMaximumDaysInMonth() { 10854 return 31; 10855 } 10856 getYearsInEra(date) { 10857 return 9999; 10858 } 10859 getEras() { 10860 return ["BC", "AD"]; 10861 } 10862 isInverseEra(date) { 10863 return date.era === "BC"; 10864 } 10865 balanceDate(date) { 10866 if (date.year <= 0) { 10867 date.era = date.era === "BC" ? "AD" : "BC"; 10868 date.year = 1 - date.year; 10869 } 10870 } 10871 constructor() { 10872 this.identifier = "gregory"; 10873 } 10874 }; 10875 //#endregion 10876 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/weekStartData.mjs 10877 var $d2ca8165c9aa885a$export$7a5acbd77d414bd9 = { 10878 "001": 1, 10879 AD: 1, 10880 AE: 6, 10881 AF: 6, 10882 AI: 1, 10883 AL: 1, 10884 AM: 1, 10885 AN: 1, 10886 AR: 1, 10887 AT: 1, 10888 AU: 1, 10889 AX: 1, 10890 AZ: 1, 10891 BA: 1, 10892 BE: 1, 10893 BG: 1, 10894 BH: 6, 10895 BM: 1, 10896 BN: 1, 10897 BY: 1, 10898 CH: 1, 10899 CL: 1, 10900 CM: 1, 10901 CN: 1, 10902 CR: 1, 10903 CY: 1, 10904 CZ: 1, 10905 DE: 1, 10906 DJ: 6, 10907 DK: 1, 10908 DZ: 6, 10909 EC: 1, 10910 EE: 1, 10911 EG: 6, 10912 ES: 1, 10913 FI: 1, 10914 FJ: 1, 10915 FO: 1, 10916 FR: 1, 10917 GB: 1, 10918 GE: 1, 10919 GF: 1, 10920 GP: 1, 10921 GR: 1, 10922 HR: 1, 10923 HU: 1, 10924 IE: 1, 10925 IQ: 6, 10926 IR: 6, 10927 IS: 1, 10928 IT: 1, 10929 JO: 6, 10930 KG: 1, 10931 KW: 6, 10932 KZ: 1, 10933 LB: 1, 10934 LI: 1, 10935 LK: 1, 10936 LT: 1, 10937 LU: 1, 10938 LV: 1, 10939 LY: 6, 10940 MC: 1, 10941 MD: 1, 10942 ME: 1, 10943 MK: 1, 10944 MN: 1, 10945 MQ: 1, 10946 MV: 5, 10947 MY: 1, 10948 NL: 1, 10949 NO: 1, 10950 NZ: 1, 10951 OM: 6, 10952 PL: 1, 10953 QA: 6, 10954 RE: 1, 10955 RO: 1, 10956 RS: 1, 10957 RU: 1, 10958 SD: 6, 10959 SE: 1, 10960 SI: 1, 10961 SK: 1, 10962 SM: 1, 10963 SY: 6, 10964 TJ: 1, 10965 TM: 1, 10966 TR: 1, 10967 UA: 1, 10968 UY: 1, 10969 UZ: 1, 10970 VA: 1, 10971 VN: 1, 10972 XK: 1 10973 }; 10974 //#endregion 10975 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/queries.mjs 10976 function $ad063034c8620db8$export$ea39ec197993aef0(a, b) { 10977 b = $d07e34cce18680fd$export$b4a036af3fc0b032(b, a.calendar); 10978 return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day; 10979 } 10980 function $ad063034c8620db8$export$a18c89cbd24170ff(a, b) { 10981 b = $d07e34cce18680fd$export$b4a036af3fc0b032(b, a.calendar); 10982 a = $ad063034c8620db8$export$a5a3b454ada2268e(a); 10983 b = $ad063034c8620db8$export$a5a3b454ada2268e(b); 10984 return a.era === b.era && a.year === b.year && a.month === b.month; 10985 } 10986 function $ad063034c8620db8$export$dbc69fd56b53d5e(a, b) { 10987 return a.isEqual?.(b) ?? b.isEqual?.(a) ?? a.identifier === b.identifier; 10988 } 10989 function $ad063034c8620db8$export$629b0a497aa65267(date, timeZone) { 10990 return $ad063034c8620db8$export$ea39ec197993aef0(date, $ad063034c8620db8$export$d0bdf45af03a6ea3(timeZone)); 10991 } 10992 var $ad063034c8620db8$var$DAY_MAP = { 10993 sun: 0, 10994 mon: 1, 10995 tue: 2, 10996 wed: 3, 10997 thu: 4, 10998 fri: 5, 10999 sat: 6 11000 }; 11001 function $ad063034c8620db8$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) { 11002 let julian = date.calendar.toJulianDay(date); 11003 let weekStart = firstDayOfWeek ? $ad063034c8620db8$var$DAY_MAP[firstDayOfWeek] : $ad063034c8620db8$var$getWeekStart(locale); 11004 let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7; 11005 if (dayOfWeek < 0) dayOfWeek += 7; 11006 return dayOfWeek; 11007 } 11008 function $ad063034c8620db8$export$461939dd4422153(timeZone) { 11009 return $d07e34cce18680fd$export$1b96692a1ba042ac(Date.now(), timeZone); 11010 } 11011 function $ad063034c8620db8$export$d0bdf45af03a6ea3(timeZone) { 11012 return $d07e34cce18680fd$export$93522d1a439f3617($ad063034c8620db8$export$461939dd4422153(timeZone)); 11013 } 11014 function $ad063034c8620db8$export$68781ddf31c0090f(a, b) { 11015 return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b); 11016 } 11017 function $ad063034c8620db8$export$c19a80a9721b80f6(a, b) { 11018 return $ad063034c8620db8$var$timeToMs(a) - $ad063034c8620db8$var$timeToMs(b); 11019 } 11020 function $ad063034c8620db8$var$timeToMs(a) { 11021 return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond; 11022 } 11023 var $ad063034c8620db8$var$localTimeZone = null; 11024 var $ad063034c8620db8$var$localTimeZoneOverride = false;
11025 function $ad063034c8620db8$export$aa8b41735afcabd2() { 11026 if ($ad063034c8620db8$var$localTimeZone == null) $ad063034c8620db8$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone; 11027 return $ad063034c8620db8$var$localTimeZone; 11028 } 11029 function $ad063034c8620db8$export$6ab69b273755230b() { 11030 return $ad063034c8620db8$var$localTimeZoneOverride; 11031 } 11032 function $ad063034c8620db8$export$a5a3b454ada2268e(date) { 11033 return date.subtract({ days: date.day - 1 }); 11034 } 11035 function $ad063034c8620db8$export$a2258d9c4118825c(date) { 11036 return date.add({ days: date.calendar.getDaysInMonth(date) - date.day }); 11037 } 11038 var $ad063034c8620db8$var$cachedRegions = /* @__PURE__ */ new Map(); 11039 var $ad063034c8620db8$var$cachedWeekInfo = /* @__PURE__ */ new Map(); 11040 function $ad063034c8620db8$var$getRegion(locale) { 11041 if (Intl.Locale) { 11042 let region = $ad063034c8620db8$var$cachedRegions.get(locale); 11043 if (!region) { 11044 region = new Intl.Locale(locale).maximize().region; 11045 if (region) $ad063034c8620db8$var$cachedRegions.set(locale, region); 11046 } 11047 return region; 11048 } 11049 let part = locale.split("-")[1]; 11050 return part === "u" ? void 0 : part; 11051 } 11052 function $ad063034c8620db8$var$getWeekStart(locale) { 11053 let weekInfo = $ad063034c8620db8$var$cachedWeekInfo.get(locale); 11054 if (!weekInfo) { 11055 if (Intl.Locale) { 11056 let localeInst = new Intl.Locale(locale); 11057 if ("getWeekInfo" in localeInst) { 11058 weekInfo = localeInst.getWeekInfo(); 11059 if (weekInfo) { 11060 $ad063034c8620db8$var$cachedWeekInfo.set(locale, weekInfo); 11061 return weekInfo.firstDay; 11062 } 11063 } 11064 } 11065 let region = $ad063034c8620db8$var$getRegion(locale); 11066 if (locale.includes("-fw-")) { 11067 let day = locale.split("-fw-")[1].split("-")[0]; 11068 if (day === "mon") weekInfo = { firstDay: 1 }; 11069 else if (day === "tue") weekInfo = { firstDay: 2 }; 11070 else if (day === "wed") weekInfo = { firstDay: 3 }; 11071 else if (day === "thu") weekInfo = { firstDay: 4 }; 11072 else if (day === "fri") weekInfo = { firstDay: 5 }; 11073 else if (day === "sat") weekInfo = { firstDay: 6 }; 11074 else weekInfo = { firstDay: 0 }; 11075 } else if (locale.includes("-ca-iso8601")) weekInfo = { firstDay: 1 }; 11076 else weekInfo = { firstDay: region ? $d2ca8165c9aa885a$export$7a5acbd77d414bd9[region] || 0 : 0 }; 11077 $ad063034c8620db8$var$cachedWeekInfo.set(locale, weekInfo); 11078 } 11079 return weekInfo.firstDay; 11080 } 11081 //#endregion 11082 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/conversion.mjs 11083 function $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) { 11084 date = $d07e34cce18680fd$export$b4a036af3fc0b032(date, new $93635573935797de$export$80ee6245ec4f29ec()); 11085 return $d07e34cce18680fd$var$epochFromParts($93635573935797de$export$c36e0ecb2d4fa69d(date.era, date.year), date.month, date.day, date.hour, date.minute, date.second, date.millisecond); 11086 } 11087 function $d07e34cce18680fd$var$epochFromParts(year, month, day, hour, minute, second, millisecond) { 11088 let date = /* @__PURE__ */ new Date(); 11089 date.setUTCHours(hour, minute, second, millisecond); 11090 date.setUTCFullYear(year, month - 1, day); 11091 return date.getTime(); 11092 } 11093 function $d07e34cce18680fd$export$59c99f3515d3493f(ms, timeZone) { 11094 if (timeZone === "UTC") return 0; 11095 if (ms > 0 && timeZone === $ad063034c8620db8$export$aa8b41735afcabd2() && !$ad063034c8620db8$export$6ab69b273755230b()) return new Date(ms).getTimezoneOffset() * -6e4; 11096 let { year, month, day, hour, minute, second } = $d07e34cce18680fd$var$getTimeZoneParts(ms, timeZone); 11097 return $d07e34cce18680fd$var$epochFromParts(year, month, day, hour, minute, second, 0) - Math.floor(ms / 1e3) * 1e3; 11098 } 11099 var $d07e34cce18680fd$var$formattersByTimeZone = /* @__PURE__ */ new Map(); 11100 function $d07e34cce18680fd$var$getTimeZoneParts(ms, timeZone) { 11101 let formatter = $d07e34cce18680fd$var$formattersByTimeZone.get(timeZone); 11102 if (!formatter) { 11103 formatter = new Intl.DateTimeFormat("en-US", { 11104 timeZone, 11105 hour12: false, 11106 era: "short", 11107 year: "numeric", 11108 month: "numeric", 11109 day: "numeric", 11110 hour: "numeric", 11111 minute: "numeric", 11112 second: "numeric" 11113 }); 11114 $d07e34cce18680fd$var$formattersByTimeZone.set(timeZone, formatter); 11115 } 11116 let parts = formatter.formatToParts(new Date(ms)); 11117 let namedParts = {}; 11118 for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value; 11119 return { 11120 year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year, 11121 month: +namedParts.month, 11122 day: +namedParts.day, 11123 hour: namedParts.hour === "24" ? 0 : +namedParts.hour, 11124 minute: +namedParts.minute, 11125 second: +namedParts.second 11126 }; 11127 } 11128 var $d07e34cce18680fd$var$DAYMILLIS = 864e5; 11129 function $d07e34cce18680fd$export$136f38efe7caf549(date, timeZone) { 11130 let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date); 11131 return $d07e34cce18680fd$var$getValidWallTimes(date, timeZone, ms - $d07e34cce18680fd$export$59c99f3515d3493f(ms - $d07e34cce18680fd$var$DAYMILLIS, timeZone), ms - $d07e34cce18680fd$export$59c99f3515d3493f(ms + $d07e34cce18680fd$var$DAYMILLIS, timeZone)); 11132 } 11133 function $d07e34cce18680fd$var$getValidWallTimes(date, timeZone, earlier, later) { 11134 return (earlier === later ? [earlier] : [earlier, later]).filter((absolute) => $d07e34cce18680fd$var$isValidWallTime(date, timeZone, absolute)); 11135 } 11136 function $d07e34cce18680fd$var$isValidWallTime(date, timeZone, absolute) { 11137 let parts = $d07e34cce18680fd$var$getTimeZoneParts(absolute, timeZone); 11138 return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second; 11139 } 11140 function $d07e34cce18680fd$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") { 11141 let dateTime = $d07e34cce18680fd$export$b21e0b124e224484(date); 11142 if (timeZone === "UTC") return $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime); 11143 if (timeZone === $ad063034c8620db8$export$aa8b41735afcabd2() && disambiguation === "compatible" && !$ad063034c8620db8$export$6ab69b273755230b()) { 11144 dateTime = $d07e34cce18680fd$export$b4a036af3fc0b032(dateTime, new $93635573935797de$export$80ee6245ec4f29ec()); 11145 let date = /* @__PURE__ */ new Date(); 11146 let year = $93635573935797de$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year); 11147 date.setFullYear(year, dateTime.month - 1, dateTime.day); 11148 date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond); 11149 return date.getTime(); 11150 } 11151 let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime); 11152 let offsetBefore = $d07e34cce18680fd$export$59c99f3515d3493f(ms - $d07e34cce18680fd$var$DAYMILLIS, timeZone); 11153 let offsetAfter = $d07e34cce18680fd$export$59c99f3515d3493f(ms + $d07e34cce18680fd$var$DAYMILLIS, timeZone); 11154 let valid = $d07e34cce18680fd$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter); 11155 if (valid.length === 1) return valid[0]; 11156 if (valid.length > 1) switch (disambiguation) { 11157 case "compatible": 11158 case "earlier": return valid[0]; 11159 case "later": return valid[valid.length - 1]; 11160 case "reject": throw new RangeError("Multiple possible absolute times found"); 11161 } 11162 switch (disambiguation) {
11163 case "earlier": return Math.min(ms - offsetBefore, ms - offsetAfter); 11164 case "compatible": 11165 case "later": return Math.max(ms - offsetBefore, ms - offsetAfter); 11166 case "reject": throw new RangeError("No such absolute time found"); 11167 } 11168 } 11169 function $d07e34cce18680fd$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") { 11170 return new Date($d07e34cce18680fd$export$5107c82f94518f5c(dateTime, timeZone, disambiguation)); 11171 } 11172 function $d07e34cce18680fd$export$1b96692a1ba042ac(ms, timeZone) { 11173 let offset = $d07e34cce18680fd$export$59c99f3515d3493f(ms, timeZone); 11174 let date = new Date(ms + offset); 11175 let year = date.getUTCFullYear(); 11176 let month = date.getUTCMonth() + 1; 11177 let day = date.getUTCDate(); 11178 let hour = date.getUTCHours(); 11179 let minute = date.getUTCMinutes(); 11180 let second = date.getUTCSeconds(); 11181 let millisecond = date.getUTCMilliseconds(); 11182 return new $2aaf608024c21ca1$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond); 11183 } 11184 function $d07e34cce18680fd$export$93522d1a439f3617(dateTime) { 11185 return new $2aaf608024c21ca1$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day); 11186 } 11187 function $d07e34cce18680fd$export$b21e0b124e224484(date, time) { 11188 let hour = 0, minute = 0, second = 0, millisecond = 0; 11189 if ("timeZone" in date) ({hour: hour, minute: minute, second: second, millisecond: millisecond} = date); 11190 else if ("hour" in date && !time) return date; 11191 if (time) ({hour: hour, minute: minute, second: second, millisecond: millisecond} = time); 11192 return new $2aaf608024c21ca1$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond); 11193 } 11194 function $d07e34cce18680fd$export$d33f79e3ffc3dc83(dateTime) { 11195 return new $2aaf608024c21ca1$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond); 11196 } 11197 function $d07e34cce18680fd$export$b4a036af3fc0b032(date, calendar) { 11198 if ($ad063034c8620db8$export$dbc69fd56b53d5e(date.calendar, calendar)) return date; 11199 let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date)); 11200 let copy = date.copy(); 11201 copy.calendar = calendar; 11202 copy.era = calendarDate.era; 11203 copy.year = calendarDate.year; 11204 copy.month = calendarDate.month; 11205 copy.day = calendarDate.day; 11206 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(copy); 11207 return copy; 11208 } 11209 function $d07e34cce18680fd$export$84c95a83c799e074(date, timeZone, disambiguation) { 11210 if (date instanceof $2aaf608024c21ca1$export$d3b7288e7994edea) { 11211 if (date.timeZone === timeZone) return date; 11212 return $d07e34cce18680fd$export$538b00033cc11c75(date, timeZone); 11213 } 11214 return $d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$5107c82f94518f5c(date, timeZone, disambiguation), timeZone); 11215 } 11216 function $d07e34cce18680fd$export$83aac07b4c37b25(date) { 11217 let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) - date.offset; 11218 return new Date(ms); 11219 } 11220 function $d07e34cce18680fd$export$538b00033cc11c75(date, timeZone) { 11221 return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) - date.offset, timeZone), date.calendar); 11222 } 11223 //#endregion 11224 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/manipulation.mjs 11225 var $435a2ceaa8778ed8$var$ONE_HOUR = 36e5; 11226 function $435a2ceaa8778ed8$export$e16d8520af44a096(date, duration) { 11227 let mutableDate = date.copy(); 11228 let days = "hour" in mutableDate ? $435a2ceaa8778ed8$var$addTimeFields(mutableDate, duration) : 0; 11229 $435a2ceaa8778ed8$var$addYears(mutableDate, duration.years || 0); 11230 if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date); 11231 mutableDate.month += duration.months || 0; 11232 $435a2ceaa8778ed8$var$balanceYearMonth(mutableDate); 11233 $435a2ceaa8778ed8$var$constrainMonthDay(mutableDate); 11234 mutableDate.day += (duration.weeks || 0) * 7; 11235 mutableDate.day += duration.days || 0; 11236 mutableDate.day += days; 11237 $435a2ceaa8778ed8$var$balanceDay(mutableDate); 11238 if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate); 11239 if (mutableDate.year < 1) { 11240 mutableDate.year = 1; 11241 mutableDate.month = 1; 11242 mutableDate.day = 1; 11243 } 11244 let maxYear = mutableDate.calendar.getYearsInEra(mutableDate); 11245 if (mutableDate.year > maxYear) { 11246 let isInverseEra = mutableDate.calendar.isInverseEra?.(mutableDate); 11247 mutableDate.year = maxYear; 11248 mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate); 11249 mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate); 11250 } 11251 if (mutableDate.month < 1) { 11252 mutableDate.month = 1; 11253 mutableDate.day = 1; 11254 } 11255 let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate); 11256 if (mutableDate.month > maxMonth) { 11257 mutableDate.month = maxMonth; 11258 mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate); 11259 } 11260 mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day)); 11261 return mutableDate; 11262 } 11263 function $435a2ceaa8778ed8$var$addYears(date, years) { 11264 if (date.calendar.isInverseEra?.(date)) years = -years; 11265 date.year += years; 11266 } 11267 function $435a2ceaa8778ed8$var$balanceYearMonth(date) { 11268 while (date.month < 1) { 11269 $435a2ceaa8778ed8$var$addYears(date, -1); 11270 date.month += date.calendar.getMonthsInYear(date); 11271 } 11272 let monthsInYear = 0; 11273 while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) { 11274 date.month -= monthsInYear; 11275 $435a2ceaa8778ed8$var$addYears(date, 1); 11276 } 11277 } 11278 function $435a2ceaa8778ed8$var$balanceDay(date) { 11279 while (date.day < 1) { 11280 date.month--; 11281 $435a2ceaa8778ed8$var$balanceYearMonth(date); 11282 date.day += date.calendar.getDaysInMonth(date); 11283 } 11284 while (date.day > date.calendar.getDaysInMonth(date)) { 11285 date.day -= date.calendar.getDaysInMonth(date); 11286 date.month++; 11287 $435a2ceaa8778ed8$var$balanceYearMonth(date); 11288 } 11289 } 11290 function $435a2ceaa8778ed8$var$constrainMonthDay(date) { 11291 date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month)); 11292 date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day)); 11293 } 11294 function $435a2ceaa8778ed8$export$c4e2ecac49351ef2(date) { 11295 if (date.calendar.constrainDate) date.calendar.constrainDate(date); 11296 date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year)); 11297 $435a2ceaa8778ed8$var$constrainMonthDay(date); 11298 }
vendor: 5,425 bytes, lines 11299-11425
11299 function $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration) { 11300 let inverseDuration = {}; 11301 for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key]; 11302 return inverseDuration; 11303 } 11304 function $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3(date, duration) { 11305 return $435a2ceaa8778ed8$export$e16d8520af44a096(date, $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration)); 11306 } 11307 function $435a2ceaa8778ed8$export$adaa4cf7ef1b65be(date, fields) { 11308 let mutableDate = date.copy(); 11309 if (fields.era != null) mutableDate.era = fields.era; 11310 if (fields.year != null) mutableDate.year = fields.year; 11311 if (fields.month != null) mutableDate.month = fields.month; 11312 if (fields.day != null) mutableDate.day = fields.day; 11313 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutableDate); 11314 return mutableDate; 11315 } 11316 function $435a2ceaa8778ed8$export$e5d5e1c1822b6e56(value, fields) { 11317 let mutableValue = value.copy(); 11318 if (fields.hour != null) mutableValue.hour = fields.hour; 11319 if (fields.minute != null) mutableValue.minute = fields.minute; 11320 if (fields.second != null) mutableValue.second = fields.second; 11321 if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond; 11322 $435a2ceaa8778ed8$export$7555de1e070510cb(mutableValue); 11323 return mutableValue; 11324 } 11325 function $435a2ceaa8778ed8$var$balanceTime(time) { 11326 time.second += Math.floor(time.millisecond / 1e3); 11327 time.millisecond = $435a2ceaa8778ed8$var$nonNegativeMod(time.millisecond, 1e3); 11328 time.minute += Math.floor(time.second / 60); 11329 time.second = $435a2ceaa8778ed8$var$nonNegativeMod(time.second, 60); 11330 time.hour += Math.floor(time.minute / 60); 11331 time.minute = $435a2ceaa8778ed8$var$nonNegativeMod(time.minute, 60); 11332 let days = Math.floor(time.hour / 24); 11333 time.hour = $435a2ceaa8778ed8$var$nonNegativeMod(time.hour, 24); 11334 return days; 11335 } 11336 function $435a2ceaa8778ed8$export$7555de1e070510cb(time) { 11337 time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3)); 11338 time.second = Math.max(0, Math.min(time.second, 59)); 11339 time.minute = Math.max(0, Math.min(time.minute, 59)); 11340 time.hour = Math.max(0, Math.min(time.hour, 23)); 11341 } 11342 function $435a2ceaa8778ed8$var$nonNegativeMod(a, b) { 11343 let result = a % b; 11344 if (result < 0) result += b; 11345 return result; 11346 } 11347 function $435a2ceaa8778ed8$var$addTimeFields(time, duration) { 11348 time.hour += duration.hours || 0; 11349 time.minute += duration.minutes || 0; 11350 time.second += duration.seconds || 0; 11351 time.millisecond += duration.milliseconds || 0; 11352 return $435a2ceaa8778ed8$var$balanceTime(time); 11353 } 11354 function $435a2ceaa8778ed8$export$7ed87b6bc2506470(time, duration) { 11355 let res = time.copy(); 11356 $435a2ceaa8778ed8$var$addTimeFields(res, duration); 11357 return res; 11358 } 11359 function $435a2ceaa8778ed8$export$fe34d3a381cd7501(time, duration) { 11360 return $435a2ceaa8778ed8$export$7ed87b6bc2506470(time, $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration)); 11361 } 11362 function $435a2ceaa8778ed8$export$d52ced6badfb9a4c(value, field, amount, options) { 11363 let mutable = value.copy(); 11364 switch (field) { 11365 case "era": { 11366 let eras = value.calendar.getEras(); 11367 let eraIndex = eras.indexOf(value.era); 11368 if (eraIndex < 0) throw new Error("Invalid era: " + value.era); 11369 eraIndex = $435a2ceaa8778ed8$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round); 11370 mutable.era = eras[eraIndex]; 11371 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutable); 11372 break; 11373 } 11374 case "year": 11375 if (mutable.calendar.isInverseEra?.(mutable)) amount = -amount; 11376 mutable.year = $435a2ceaa8778ed8$var$cycleValue(value.year, amount, -Infinity, 9999, options?.round); 11377 if (mutable.year === -Infinity) mutable.year = 1; 11378 if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value); 11379 break; 11380 case "month": 11381 mutable.month = $435a2ceaa8778ed8$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round); 11382 break; 11383 case "day": 11384 mutable.day = $435a2ceaa8778ed8$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round); 11385 break; 11386 default: throw new Error("Unsupported field " + field); 11387 } 11388 if (value.calendar.balanceDate) value.calendar.balanceDate(mutable); 11389 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutable); 11390 return mutable; 11391 } 11392 function $435a2ceaa8778ed8$export$dd02b3e0007dfe28(value, field, amount, options) { 11393 let mutable = value.copy(); 11394 switch (field) { 11395 case "hour": { 11396 let hours = value.hour; 11397 let min = 0; 11398 let max = 23; 11399 if (options?.hourCycle === 12) { 11400 let isPM = hours >= 12; 11401 min = isPM ? 12 : 0; 11402 max = isPM ? 23 : 11; 11403 } 11404 mutable.hour = $435a2ceaa8778ed8$var$cycleValue(hours, amount, min, max, options?.round); 11405 break; 11406 } 11407 case "minute": 11408 mutable.minute = $435a2ceaa8778ed8$var$cycleValue(value.minute, amount, 0, 59, options?.round); 11409 break; 11410 case "second": 11411 mutable.second = $435a2ceaa8778ed8$var$cycleValue(value.second, amount, 0, 59, options?.round); 11412 break; 11413 case "millisecond": 11414 mutable.millisecond = $435a2ceaa8778ed8$var$cycleValue(value.millisecond, amount, 0, 999, options?.round); 11415 break; 11416 default: throw new Error("Unsupported field " + field); 11417 } 11418 return mutable; 11419 } 11420 function $435a2ceaa8778ed8$var$cycleValue(value, amount, min, max, round = false) { 11421 if (round) { 11422 value += Math.sign(amount); 11423 if (value < min) value = max; 11424 let div = Math.abs(amount); 11425 if (amount >
11425 0) value = Math.ceil(value / div) * div; 11426 else value = Math.floor(value / div) * div; 11427 if (value > max) value = min; 11428 } else { 11429 value += amount; 11430 if (value < min) value = max - (min - value - 1); 11431 else if (value > max) value = min + (value - max - 1); 11432 } 11433 return value; 11434 } 11435 function $435a2ceaa8778ed8$export$96b1d28349274637(dateTime, duration) { 11436 let ms; 11437 if (duration.years != null && duration.years !== 0 || duration.months != null && duration.months !== 0 || duration.weeks != null && duration.weeks !== 0 || duration.days != null && duration.days !== 0) ms = $d07e34cce18680fd$export$5107c82f94518f5c($435a2ceaa8778ed8$export$e16d8520af44a096($d07e34cce18680fd$export$b21e0b124e224484(dateTime), { 11438 years: duration.years, 11439 months: duration.months, 11440 weeks: duration.weeks, 11441 days: duration.days 11442 }), dateTime.timeZone); 11443 else ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset; 11444 ms += duration.milliseconds || 0; 11445 ms += (duration.seconds || 0) * 1e3; 11446 ms += (duration.minutes || 0) * 6e4; 11447 ms += (duration.hours || 0) * 36e5; 11448 return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar); 11449 } 11450 function $435a2ceaa8778ed8$export$6814caac34ca03c7(dateTime, duration) { 11451 return $435a2ceaa8778ed8$export$96b1d28349274637(dateTime, $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration)); 11452 } 11453 function $435a2ceaa8778ed8$export$9a297d111fc86b79(dateTime, field, amount, options) { 11454 switch (field) { 11455 case "hour": { 11456 let min = 0; 11457 let max = 23; 11458 if (options?.hourCycle === 12) { 11459 let isPM = dateTime.hour >= 12; 11460 min = isPM ? 12 : 0; 11461 max = isPM ? 23 : 11; 11462 } 11463 let plainDateTime = $d07e34cce18680fd$export$b21e0b124e224484(dateTime); 11464 let minDate = $d07e34cce18680fd$export$b4a036af3fc0b032($435a2ceaa8778ed8$export$e5d5e1c1822b6e56(plainDateTime, { hour: min }), new $93635573935797de$export$80ee6245ec4f29ec()); 11465 let minAbsolute = [$d07e34cce18680fd$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"), $d07e34cce18680fd$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")].filter((ms) => $d07e34cce18680fd$export$1b96692a1ba042ac(ms, dateTime.timeZone).day === minDate.day)[0]; 11466 let maxDate = $d07e34cce18680fd$export$b4a036af3fc0b032($435a2ceaa8778ed8$export$e5d5e1c1822b6e56(plainDateTime, { hour: max }), new $93635573935797de$export$80ee6245ec4f29ec()); 11467 let maxAbsolute = [$d07e34cce18680fd$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"), $d07e34cce18680fd$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")].filter((ms) => $d07e34cce18680fd$export$1b96692a1ba042ac(ms, dateTime.timeZone).day === maxDate.day).pop(); 11468 let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset; 11469 let hours = Math.floor(ms / $435a2ceaa8778ed8$var$ONE_HOUR); 11470 let remainder = ms % $435a2ceaa8778ed8$var$ONE_HOUR; 11471 ms = $435a2ceaa8778ed8$var$cycleValue(hours, amount, Math.floor(minAbsolute / $435a2ceaa8778ed8$var$ONE_HOUR), Math.floor(maxAbsolute / $435a2ceaa8778ed8$var$ONE_HOUR), options?.round) * $435a2ceaa8778ed8$var$ONE_HOUR + remainder; 11472 return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar); 11473 } 11474 case "minute": 11475 case "second": 11476 case "millisecond": return $435a2ceaa8778ed8$export$dd02b3e0007dfe28(dateTime, field, amount, options); 11477 case "era": 11478 case "year": 11479 case "month": 11480 case "day": return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$5107c82f94518f5c($435a2ceaa8778ed8$export$d52ced6badfb9a4c($d07e34cce18680fd$export$b21e0b124e224484(dateTime), field, amount, options), dateTime.timeZone), dateTime.timeZone), dateTime.calendar); 11481 default: throw new Error("Unsupported field " + field); 11482 } 11483 } 11484 function $435a2ceaa8778ed8$export$31b5430eb18be4f8(dateTime, fields, disambiguation) { 11485 let plainDateTime = $d07e34cce18680fd$export$b21e0b124e224484(dateTime); 11486 let res = $435a2ceaa8778ed8$export$e5d5e1c1822b6e56($435a2ceaa8778ed8$export$adaa4cf7ef1b65be(plainDateTime, fields), fields); 11487 if (res.compare(plainDateTime) === 0) return dateTime; 11488 return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation), dateTime.timeZone), dateTime.calendar); 11489 } 11490 //#endregion 11491 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/string.mjs 11492 var $58246871e4652552$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/; 11493 var $58246871e4652552$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/; 11494 var $58246871e4652552$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?(?::?(\d{2}))?)?\[(.*?)\]$/; 11495 var $58246871e4652552$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/; 11496 function $58246871e4652552$export$6b862160d295c8e(value) { 11497 let m = value.match($58246871e4652552$var$DATE_RE); 11498 if (!m) { 11499 if ($58246871e4652552$var$ABSOLUTE_RE.test(value)) throw new Error(`Invalid ISO 8601 date string: ${value}. Use parseAbsolute() instead.`); 11500 throw new Error("Invalid ISO 8601 date string: " + value); 11501 } 11502 let date = new $2aaf608024c21ca1$export$99faa760c7908e4f($58246871e4652552$var$parseNumber(m[1], 0, 9999), $58246871e4652552$var$parseNumber(m[2], 1, 12), 1); 11503 date.day = $58246871e4652552$var$parseNumber(m[3], 1, date.calendar.getDaysInMonth(date)); 11504 return date; 11505 } 11506 function $58246871e4652552$export$588937bcd60ade55(value) { 11507 let m = value.match($58246871e4652552$var$DATE_TIME_RE); 11508 if (!m) { 11509 if ($58246871e4652552$var$ABSOLUTE_RE.test(value)) throw new Error(`Invalid ISO 8601 date time string: ${value}. Use parseAbsolute() instead.`); 11510 throw new Error("Invalid ISO 8601 date time string: " + value); 11511 } 11512 let year = $58246871e4652552$var$parseNumber(m[1], -9999, 9999); 11513 let date = new $2aaf608024c21ca1$export$ca871e8dbb80966f(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, $58246871e4652552$var$parseNumber(m[2], 1, 12), 1, m[4] ? $58246871e4652552$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $58246871e4652552$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $58246871e4652552$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $58246871e4652552$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0); 11514 date.day = $58246871e4652552$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date)); 11515 return date; 11516 } 11517 function $58246871e4652552$export$fd7893f06e92a6a4(value, disambiguation) { 11518 let m = value.match($58246871e4652552$var$ZONED_DATE_TIME_RE); 11519 if (!m) throw new Error("Invalid ISO 8601 date time string: " + value); 11520 let year = $58246871e4652552$var$parseNumber(m[1], -9999, 9999); 11521 let date = new $2aaf608024c21ca1$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, $58246871e4652552$var$parseNumber(m[2], 1, 12), 1, m[11], 0, m[4] ? $58246871e4652552$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $58246871e4652552$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $58246871e4652552$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $58246871e4652552$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0); 11522 date.day = $58246871e4652552$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date)); 11523 let plainDateTime = $d07e34cce18680fd$export$b21e0b124e224484(date); 11524 let ms; 11525 if (m[8]) { 11526 let hourOffset = $58246871e4652552$var$parseNumber(m[8], -23, 23); 11527 date.offset = Math.sign(hourOffset) * (Math.abs(hourOffset) * 36e5 + $58246871e4652552$var$parseNumber(m[9] ?? "0", 0, 59) * 6e4 + $58246871e4652552$var$parseNumber(m[10] ?? "0", 0, 59) * 1e3); 11528 ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) - date.offset; 11529 if (!$d07e34cce18680fd$export$136f38efe7caf549(plainDateTime, date.timeZone).includes(ms)) throw new Error(`Offset ${$58246871e4652552$var$offsetToString(date.offset)}
11529 is invalid for ${$58246871e4652552$export$4223de14708adc63(date)} in ${date.timeZone}`); 11530 } else ms = $d07e34cce18680fd$export$5107c82f94518f5c($d07e34cce18680fd$export$b21e0b124e224484(plainDateTime), date.timeZone, disambiguation); 11531 return $d07e34cce18680fd$export$1b96692a1ba042ac(ms, date.timeZone); 11532 } 11533 function $58246871e4652552$export$5adfdab05168c219(value, timeZone) { 11534 let m = value.match($58246871e4652552$var$ABSOLUTE_RE); 11535 if (!m) throw new Error("Invalid ISO 8601 date time string: " + value); 11536 let year = $58246871e4652552$var$parseNumber(m[1], -9999, 9999); 11537 let date = new $2aaf608024c21ca1$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, $58246871e4652552$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $58246871e4652552$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $58246871e4652552$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $58246871e4652552$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $58246871e4652552$var$parseNumber(m[7], 0, Infinity) * 1e3 : 0); 11538 date.day = $58246871e4652552$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date)); 11539 if (m[8]) date.offset = $58246871e4652552$var$parseNumber(m[8], -23, 23) * 36e5 + $58246871e4652552$var$parseNumber(m[9] ?? "0", 0, 59) * 6e4; 11540 return $d07e34cce18680fd$export$538b00033cc11c75(date, timeZone); 11541 } 11542 function $58246871e4652552$var$parseNumber(value, min, max) { 11543 let val = Number(value); 11544 if (val < min || val > max) throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`); 11545 return val; 11546 } 11547 function $58246871e4652552$export$f59dee82248f5ad4(time) { 11548 return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`; 11549 } 11550 function $58246871e4652552$export$60dfd74aa96791bd(date) { 11551 let gregorianDate = $d07e34cce18680fd$export$b4a036af3fc0b032(date, new $93635573935797de$export$80ee6245ec4f29ec()); 11552 let year; 11553 if (gregorianDate.era === "BC") year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00"); 11554 else year = String(gregorianDate.year).padStart(4, "0"); 11555 return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`; 11556 } 11557 function $58246871e4652552$export$4223de14708adc63(date) { 11558 return `${$58246871e4652552$export$60dfd74aa96791bd(date)}T${$58246871e4652552$export$f59dee82248f5ad4(date)}`; 11559 } 11560 function $58246871e4652552$var$offsetToString(offset) { 11561 let sign = Math.sign(offset) < 0 ? "-" : "+"; 11562 offset = Math.abs(offset);
11563 let offsetHours = Math.floor(offset / 36e5); 11564 let offsetMinutes = Math.floor(offset % 36e5 / 6e4); 11565 let offsetSeconds = Math.floor(offset % 36e5 % 6e4 / 1e3); 11566 let stringOffset = `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`; 11567 if (offsetSeconds !== 0) stringOffset += `:${String(offsetSeconds).padStart(2, "0")}`; 11568 return stringOffset; 11569 } 11570 function $58246871e4652552$export$bf79f1ebf4b18792(date) { 11571 return `${$58246871e4652552$export$4223de14708adc63(date)}${$58246871e4652552$var$offsetToString(date.offset)}[${date.timeZone}]`; 11572 } 11573 //#endregion 11574 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/CalendarDate.mjs 11575 function $2aaf608024c21ca1$var$shiftArgs(args) { 11576 let calendar = typeof args[0] === "object" ? args.shift() : new $93635573935797de$export$80ee6245ec4f29ec(); 11577 let era; 11578 if (typeof args[0] === "string") era = args.shift(); 11579 else { 11580 let eras = calendar.getEras(); 11581 era = eras[eras.length - 1]; 11582 } 11583 let year = args.shift(); 11584 let month = args.shift(); 11585 let day = args.shift(); 11586 return [ 11587 calendar, 11588 era, 11589 year, 11590 month, 11591 day 11592 ]; 11593 } 11594 var $2aaf608024c21ca1$export$99faa760c7908e4f = class $2aaf608024c21ca1$export$99faa760c7908e4f { 11595 #type; 11596 constructor(...args) { 11597 let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args); 11598 this.calendar = calendar; 11599 this.era = era; 11600 this.year = year; 11601 this.month = month; 11602 this.day = day; 11603 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(this); 11604 } 11605 /** Returns a copy of this date. */ copy() { 11606 if (this.era) return new $2aaf608024c21ca1$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day); 11607 else return new $2aaf608024c21ca1$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day); 11608 } 11609 /** Returns a new `CalendarDate` with the given duration added to it. */ add(duration) { 11610 return $435a2ceaa8778ed8$export$e16d8520af44a096(this, duration); 11611 } 11612 /** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(duration) { 11613 return $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3(this, duration); 11614 } 11615 /** 11616 * Returns a new `CalendarDate` with the given fields set to the provided values. Other fields 11617 * will be constrained accordingly. 11618 */ set(fields) { 11619 return $435a2ceaa8778ed8$export$adaa4cf7ef1b65be(this, fields); 11620 } 11621 /** 11622 * Returns a new `CalendarDate` with the given field adjusted by a specified amount. 11623 * When the resulting value reaches the limits of the field, it wraps around. 11624 */ cycle(field, amount, options) { 11625 return $435a2ceaa8778ed8$export$d52ced6badfb9a4c(this, field, amount, options); 11626 } 11627 /** 11628 * Converts the date to a native JavaScript Date object, with the time set to midnight in the 11629 * given time zone. 11630 */ toDate(timeZone) { 11631 return $d07e34cce18680fd$export$e67a095c620b86fe(this, timeZone); 11632 } 11633 /** Converts the date to an ISO 8601 formatted string. */ toString() { 11634 return $58246871e4652552$export$60dfd74aa96791bd(this); 11635 } 11636 /** 11637 * Compares this date with another. A negative result indicates that this date is before the given 11638 * one, and a positive date indicates that it is after. 11639 */ compare(b) { 11640 return $ad063034c8620db8$export$68781ddf31c0090f(this, b); 11641 } 11642 }; 11643 var $2aaf608024c21ca1$export$680ea196effce5f = class $2aaf608024c21ca1$export$680ea196effce5f { 11644 #type; 11645 constructor(hour = 0, minute = 0, second = 0, millisecond = 0) { 11646 this.hour = hour; 11647 this.minute = minute; 11648 this.second = second; 11649 this.millisecond = millisecond; 11650 $435a2ceaa8778ed8$export$7555de1e070510cb(this); 11651 } 11652 /** Returns a copy of this time. */ copy() { 11653 return new $2aaf608024c21ca1$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond); 11654 } 11655 /** Returns a new `Time` with the given duration added to it. */ add(duration) { 11656 return $435a2ceaa8778ed8$export$7ed87b6bc2506470(this, duration); 11657 } 11658 /** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) { 11659 return $435a2ceaa8778ed8$export$fe34d3a381cd7501(this, duration); 11660 } 11661 /** 11662 * Returns a new `Time` with the given fields set to the provided values. Other fields will be 11663 * constrained accordingly. 11664 */ set(fields) { 11665 return $435a2ceaa8778ed8$export$e5d5e1c1822b6e56(this, fields); 11666 } 11667 /** 11668 * Returns a new `Time` with the given field adjusted by a specified amount. 11669 * When the resulting value reaches the limits of the field, it wraps around. 11670 */ cycle(field, amount, options) { 11671 return $435a2ceaa8778ed8$export$dd02b3e0007dfe28(this, field, amount, options); 11672 } 11673 /** Converts the time to an ISO 8601 formatted string. */ toString() { 11674 return $58246871e4652552$export$f59dee82248f5ad4(this); 11675 } 11676 /** 11677 * Compares this time with another. A negative result indicates that this time is before the given 11678 * one, and a positive time indicates that it is after. 11679 */ compare(b) { 11680 return $ad063034c8620db8$export$c19a80a9721b80f6(this, b); 11681 } 11682 }; 11683 var $2aaf608024c21ca1$export$ca871e8dbb80966f = class $2aaf608024c21ca1$export$ca871e8dbb80966f { 11684 #type; 11685 constructor(...args) { 11686 let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args); 11687 this.calendar = calendar; 11688 this.era = era;
11689 this.year = year; 11690 this.month = month; 11691 this.day = day; 11692 this.hour = args.shift() || 0; 11693 this.minute = args.shift() || 0; 11694 this.second = args.shift() || 0; 11695 this.millisecond = args.shift() || 0; 11696 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(this); 11697 } 11698 /** Returns a copy of this date. */ copy() { 11699 if (this.era) return new $2aaf608024c21ca1$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); 11700 else return new $2aaf608024c21ca1$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); 11701 } 11702 /** Returns a new `CalendarDateTime` with the given duration added to it. */ add(duration) { 11703 return $435a2ceaa8778ed8$export$e16d8520af44a096(this, duration); 11704 } 11705 /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(duration) { 11706 return $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3(this, duration); 11707 } 11708 /** 11709 * Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields 11710 * will be constrained accordingly. 11711 */ set(fields) { 11712 return $435a2ceaa8778ed8$export$adaa4cf7ef1b65be($435a2ceaa8778ed8$export$e5d5e1c1822b6e56(this, fields), fields); 11713 } 11714 /** 11715 * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount. 11716 * When the resulting value reaches the limits of the field, it wraps around. 11717 */ cycle(field, amount, options) { 11718 switch (field) { 11719 case "era": 11720 case "year": 11721 case "month": 11722 case "day": return $435a2ceaa8778ed8$export$d52ced6badfb9a4c(this, field, amount, options); 11723 default: return $435a2ceaa8778ed8$export$dd02b3e0007dfe28(this, field, amount, options); 11724 } 11725 } 11726 /** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(timeZone, disambiguation) { 11727 return $d07e34cce18680fd$export$e67a095c620b86fe(this, timeZone, disambiguation); 11728 } 11729 /** Converts the date to an ISO 8601 formatted string. */ toString() { 11730 return $58246871e4652552$export$4223de14708adc63(this); 11731 } 11732 /** 11733 * Compares this date with another. A negative result indicates that this date is before the given 11734 * one, and a positive date indicates that it is after. 11735 */ compare(b) { 11736 let res = $ad063034c8620db8$export$68781ddf31c0090f(this, b); 11737 if (res === 0) return $ad063034c8620db8$export$c19a80a9721b80f6(this, $d07e34cce18680fd$export$b21e0b124e224484(b)); 11738 return res; 11739 } 11740 }; 11741 var $2aaf608024c21ca1$export$d3b7288e7994edea = class $2aaf608024c21ca1$export$d3b7288e7994edea { 11742 #type; 11743 constructor(...args) { 11744 let [calendar, era, year, month, day] = $2aaf608024c21ca1$var$shiftArgs(args); 11745 let timeZone = args.shift(); 11746 let offset = args.shift(); 11747 this.calendar = calendar; 11748 this.era = era; 11749 this.year = year; 11750 this.month = month; 11751 this.day = day; 11752 this.timeZone = timeZone; 11753 this.offset = offset; 11754 this.hour = args.shift() || 0; 11755 this.minute = args.shift() || 0; 11756 this.second = args.shift() || 0; 11757 this.millisecond = args.shift() || 0; 11758 $435a2ceaa8778ed8$export$c4e2ecac49351ef2(this); 11759 } 11760 /** Returns a copy of this date. */ copy() { 11761 if (this.era) return new $2aaf608024c21ca1$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond); 11762 else return new $2aaf608024c21ca1$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond); 11763 } 11764 /** Returns a new `ZonedDateTime` with the given duration added to it. */ add(duration) { 11765 return $435a2ceaa8778ed8$export$96b1d28349274637(this, duration); 11766 } 11767 /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(duration) { 11768 return $435a2ceaa8778ed8$export$6814caac34ca03c7(this, duration); 11769 } 11770 /** 11771 * Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields 11772 * will be constrained accordingly. 11773 */ set(fields, disambiguation) { 11774 return $435a2ceaa8778ed8$export$31b5430eb18be4f8(this, fields, disambiguation); 11775 } 11776 /** 11777 * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount. 11778 * When the resulting value reaches the limits of the field, it wraps around. 11779 */ cycle(field, amount, options) { 11780 return $435a2ceaa8778ed8$export$9a297d111fc86b79(this, field, amount, options); 11781 } 11782 /** Converts the date to a native JavaScript Date object. */ toDate() { 11783 return $d07e34cce18680fd$export$83aac07b4c37b25(this); 11784 } 11785 /** 11786 * Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone 11787 * identifier. 11788 */ toString() { 11789 return $58246871e4652552$export$bf79f1ebf4b18792(this); 11790 } 11791 /** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() { 11792 return this.toDate().toISOString(); 11793 } 11794 /** 11795 * Compares this date with another. A negative result indicates that this date is before the given 11796 * one, and a positive date indicates that it is after. 11797 */ compare(b) { 11798 return this.toDate().getTime() - $d07e34cce18680fd$export$84c95a83c799e074(b, this.timeZone).toDate().getTime(); 11799 } 11800 }; 11801 //#endregion 11802 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@internationalized/date/dist/private/DateFormatter.mjs 11803 var $12a3c853105e5a70$var$formatterCache = /* @__PURE__ */ new Map(); 11804 var $12a3c853105e5a70$export$ad991b66133851cf = class { 11805 constructor(locale, options = {}) { 11806 this.formatter = $12a3c853105e5a70$var$getCachedDateFormatter(locale, options); 11807 this.options = options; 11808 } 11809 /** 11810 * Formats a date as a string according to the locale and format options passed to the 11811 * constructor. 11812 */ format(value) { 11813 return this.formatter.format(value); 11814 } 11815 /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) { 11816 return this.formatter.formatToParts(value); 11817 } 11818 /** Formats a date range as a string. */ formatRange(start, end) { 11819 if (typeof this.formatter.formatRange === "function") return this.formatter.formatRange(start, end); 11820 if (end < start) throw new RangeError("End date must be >= start date"); 11821 return `${this.formatter.format(start)} \u{2013} ${this.formatter.format(end)}`; 11822 } 11823 /** Formats a date range as an array of parts. */ formatRangeToParts(start, end) { 11824 if (typeof this.formatter.formatRangeToParts === "function") return this.formatter.formatRangeToParts(start, end); 11825 if (end < start) throw new RangeError("End date must be >= start date"); 11826 let startParts = this.formatter.formatToParts(start); 11827 let endParts = this.formatter.formatToParts(end); 11828 return [ 11829 ...startParts.map((p) => ({ 11830 ...p, 11831 source: "startRange" 11832 })), 11833 { 11834 type: "literal", 11835 value: " â ", 11836 source: "shared" 11837 }, 11838 ...endParts.map((p) => ({ 11839 ...p, 11840 source: "endRange" 11841 })) 11842 ]; 11843 } 11844 /** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() { 11845 let resolvedOptions = this.formatter.resolvedOptions(); 11846 if ($12a3c853105e5a70$var$hasBuggyResolvedHourCycle()) { 11847 if (!this.resolvedHourCycle) this.resolvedHourCycle = $12a3c853105e5a70$var$getResolvedHourCycle(resolvedOptions.locale, this.options); 11848 resolvedOptions.hourCycle = this.resolvedHourCycle; 11849 resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12"; 11850 } 11851 if (resolvedOptions.calendar === "ethiopic-amete-alem") resolvedOptions.calendar = "ethioaa"; 11852 return resolvedOptions; 11853 } 11854 }; 11855 var $12a3c853105e5a70$var$hour12Preferences = { 11856 true: { ja: "h11" }, 11857 false: {} 11858 }; 11859 function $12a3c853105e5a70$var$getCachedDateFormatter(locale, options = {}) { 11860 if (typeof options.hour12 === "boolean" && $12a3c853105e5a70$var$hasBuggyHour12Behavior()) { 11861 options = { ...options };
11862 let pref = $12a3c853105e5a70$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]]; 11863 let defaultHourCycle = options.hour12 ? "h12" : "h23"; 11864 options.hourCycle = pref ?? defaultHourCycle; 11865 delete options.hour12; 11866 } 11867 let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : ""); 11868 if ($12a3c853105e5a70$var$formatterCache.has(cacheKey)) return $12a3c853105e5a70$var$formatterCache.get(cacheKey); 11869 let numberFormatter = new Intl.DateTimeFormat(locale, options); 11870 $12a3c853105e5a70$var$formatterCache.set(cacheKey, numberFormatter); 11871 return numberFormatter; 11872 } 11873 var $12a3c853105e5a70$var$_hasBuggyHour12Behavior = null; 11874 function $12a3c853105e5a70$var$hasBuggyHour12Behavior() { 11875 if ($12a3c853105e5a70$var$_hasBuggyHour12Behavior == null) $12a3c853105e5a70$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", { 11876 hour: "numeric", 11877 hour12: false 11878 }).format(new Date(2020, 2, 3, 0)) === "24"; 11879 return $12a3c853105e5a70$var$_hasBuggyHour12Behavior; 11880 } 11881 var $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle = null; 11882 function $12a3c853105e5a70$var$hasBuggyResolvedHourCycle() { 11883 if ($12a3c853105e5a70$var$_hasBuggyResolvedHourCycle == null) $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", { 11884 hour: "numeric", 11885 hour12: false 11886 }).resolvedOptions().hourCycle === "h12"; 11887 return $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle; 11888 } 11889 function $12a3c853105e5a70$var$getResolvedHourCycle(locale, options) { 11890 if (!options.timeStyle && !options.hour) return void 0; 11891 locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, ""); 11892 locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn"; 11893 let formatter = $12a3c853105e5a70$var$getCachedDateFormatter(locale, { 11894 ...options, 11895 timeZone: void 0 11896 }); 11897 let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10); 11898 let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10); 11899 if (min === 0 && max === 23) return "h23"; 11900 if (min === 24 && max === 23) return "h24"; 11901 if (min === 0 && max === 11) return "h11"; 11902 if (min === 12 && max === 11) return "h12"; 11903 throw new Error("Unexpected hour cycle result"); 11904 } 11905 //#endregion 11906 //#region ../../packages/gomus-types/lib/helpers/utils.ts 11907 function formatTime(value) { 11908 return $d07e34cce18680fd$export$d33f79e3ffc3dc83($58246871e4652552$export$5adfdab05168c219(value, "Europe/Berlin")).toString().slice(0, -3); 11909 } 11910 function formatDate(isoDateString, options = { 11911 weekday: "long", 11912 year: "numeric", 11913 month: "long", 11914 day: "numeric" 11915 }, locale = "de") { 11916 const zoned = $58246871e4652552$export$5adfdab05168c219(isoDateString instanceof Date ? isoDateString.toISOString() : isoDateString, "Europe/Berlin"); 11917 return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { 11918 timeZone: zoned.timeZone, 11919 ...options 11920 }).format(zoned.toDate()); 11921 } 11922 function formatCurrency$1(priceCents) { 11923 if (priceCents === void 0) throw Error("priceCents is required"); 11924 return new Intl.NumberFormat("de-DE", { 11925 style: "currency", 11926 currency: "EUR" 11927 }).format(priceCents / 100); 11928 } 11929 //#endregion 11930 //#region src/lib/models/ticket/UITicket.svelte.ts 11931 function isUITicket(x) { 11932 return x?.type === "Ticket"; 11933 } 11934 /** 11935 * Mantle-ness is derived from the raw API fields already spread onto every 11936 * UITicket â the base type stays pure (no `subTickets` field on non-mantles). 11937 * A ticket is a mantle only when `is_mantle` is set AND it actually carries 11938 * sub-tickets (the `sub_tickets` map is feature-flagged and may be empty). 11939 */ 11940 function isMantleTicket(x) { 11941 const t = x; 11942 return !!t && t.type === "Ticket" && t.is_mantle === true && !!t.sub_tickets && Object.keys(t.sub_tickets).length > 0; 11943 } 11944 /** Normalizes a mantle's raw `sub_tickets` map into ordered UI sub-ticket defs. */ 11945 function subTicketDefs(mantle) { 11946 return Object.entries(mantle.sub_tickets ?? {}).map(([id, s]) => ({ 11947 id: Number(id), 11948 title: s?.title ?? "", 11949 description: s?.description ?? null, 11950 min_persons: s?.min_persons ?? 0, 11951 max_persons: s?.max_persons ?? 0 11952 })); 11953 } 11954 function createUITicket(apiTicket, options) { 11955 return { 11956 ...apiTicket, 11957 selectedTime: options?.selectedTime ?? "", 11958 type: "Ticket", 11959 subtype: { 11960 time_slot: "timeslot", 11961 normal: "day", 11962 annual: "annual" 11963 }[apiTicket.ticket_type], 11964 shop_order: apiTicket.shop_order ?? 0, 11965 content: void 0 11966 }; 11967 } 11968 function initUITimeslotTickets(tickets, selectedTime = "") { 11969 return sort(Object.values(tickets).map((ticket) => createUITicket(ticket, { selectedTime })), (f) => f.shop_order); 11970 } 11971 function filterAvailabletickets(tickets, selectedTime = "") { 11972 let available = Object.entries(tickets); 11973 if (selectedTime !== "") available = available.filter(([, t]) => t.total_capacities?.[selectedTime] && t.total_capacities[selectedTime] > 0); 11974 return Object.fromEntries(available); 11975 } 11976 //#endregion 11977 //#region src/lib/models/capacity/calculators/quotas.ts 11978 /** Σ of a mantle's chosen sub-ticket quantities (the capacity one mantle draws); 0 otherwise. */ 11979 var compositionSum = (item) => sum(Object.values(item.mantle?.composition ?? {})); 11980 /** 11981 * Quota capacity one cart item draws â the single source of truth shared by every quota-based 11982 * calculator (a verbatim parallel to the Angular shop's `getNeededCapacityForTicket`). 11983 * 11984 * A mantle draws `qty à Σ(composition)` capacity off its quota; everything else draws `qty`. 11985 * Used both to net items out when sizing OTHER tickets on the same quota and as the basis for a 11986 * mantle's own count. 11987 */ 11988 function neededCapacity(item) {
11989 const qty = item.quantity ?? 0; 11990 return isMantleTicket(item.product) ? qty * compositionSum(item) : qty; 11991 } 11992 /** 11993 * Feed cart + preCart into the quota precart as *needed capacity*, so every item sharing a quota is 11994 * netted out before sizing `item`. `addPrecartItemQuantity` SUMS draws per id, so two lines of the 11995 * same ticket id (e.g. two mantle lines with different mixes) both count instead of the last 11996 * overwriting the rest. Returns the draw of the line being sized â captured by reference â so the 11997 * caller credits back only its OWN draw via `ticketCapacity(..., ownDraw)`, never a sibling 11998 * same-id line's (which must keep consuming, or the two oversell). 11999 */ 12000 function feedQuotaPrecart(quotaManager, cart, preCart, item) { 12001 quotaManager.clearPrecart(); 12002 let ownDraw = 0; 12003 for (const i of [...preCart.items, ...cart.items]) { 12004 if (!isUITicket(i.product)) continue; 12005 const draw = neededCapacity(i); 12006 if (i === item) ownDraw = draw; 12007 quotaManager.addPrecartItemQuantity(i.product.id, draw); 12008 } 12009 return ownDraw; 12010 } 12011 var maxQuantity_Quotas = function(manager, cart, item, preCart) { 12012 if (manager.capacityPolicy(item) !== "quotas") throw new Error("(getMaxQuantityQuotas) impossible"); 12013 if (!isUITicket(item.product)) throw new Error("(getMaxQuantityQuotas) impossible"); 12014 const p = item.product; 12015 const quotaManager = manager.quotaManager; 12016 const ownDraw = feedQuotaPrecart(quotaManager, cart, preCart, item); 12017 const cap = quotaManager.ticketCapacity(p.id, p.selectedTime, ownDraw); 12018 const total = quotaManager.totalCapacity(p.id, p.selectedTime); 12019 return { 12020 max: Math.min(p.max_persons || 100, cap), 12021 min: p.min_persons || 0, 12022 bookedOut: cap === 0, 12023 unavailable: total === 0 12024 }; 12025 }; 12026 //#endregion 12027 //#region src/lib/models/capacity/calculators/mantle.ts 12028 /** 12029 * Capacity for a Mantelticket â a verbatim port of the legacy Angular shop 12030 * (`gomus-shop` `ticket.service.coffee`: `getNeededCapacityForTicket` + 12031 * `getSelectableQuantitiesForTicket`). 12032 * 12033 * A mantle is gated off its OWN quota, exactly like a normal ticket, except one mantle 12034 * draws `Σ(chosen sub-quantities)` capacity instead of one. So: 12035 * 12036 * maxMantles = â mantleHeadroom / Σ(composition) â (divide only when Σ > 1) 12037 * 12038 * The sub-tickets' own quotas are never read â the shop API never exposes them, and the 12039 * mantle's own quota already reflects the venue/exhibition contingent. The chosen 12040 * composition is only the divisor. Best-effort (path a): the backend is the final authority 12041 * at checkout for any sub constrained by a separate quota the mantle isn't on. 12042 */ 12043 var maxQuantity_Mantle = function(manager, cart, item, preCart) { 12044 if (manager.capacityPolicy(item) !== "mantle") throw new Error("(maxQuantity_Mantle) impossible"); 12045 if (!isMantleTicket(item.product)) throw new Error("(maxQuantity_Mantle) impossible"); 12046 const p = item.product; 12047 const quotaManager = manager.quotaManager; 12048 const ownDraw = feedQuotaPrecart(quotaManager, cart, preCart, item); 12049 const headroom = quotaManager.ticketCapacity(p.id, p.selectedTime, ownDraw); 12050 const total = quotaManager.totalCapacity(p.id, p.selectedTime); 12051 const perMantle = compositionSum(item); 12052 const maxMantles = perMantle > 1 ? Math.floor(headroom / perMantle) : headroom; 12053 return { 12054 max: Math.min(p.max_persons || 100, maxMantles), 12055 min: p.min_persons || 0, 12056 bookedOut: maxMantles === 0, 12057 unavailable: total === 0 12058 }; 12059 }; 12060 /** Each sub's TicketCombination max_persons â the ceiling when no quota gates the mantle. */ 12061 var combinationSubMaxes = (p) => Object.fromEntries(subTicketDefs(p).map((s) => [s.id, s.max_persons])); 12062 /** 12063 * Capacity-aware ceilings for a mantle line's sub-ticket selectors, keyed by sub id. 12064 * 12065 * Growing a sub by one adds `quantity` seats to the line's draw (every mantle in the line gains 12066 * one sub), so a sub may grow by at most âspare / quantityâ above its CURRENT value, still 12067 * bounded by its TicketCombination max_persons. `spare` is the quota headroom left after 12068 * netting cart + preCart INCLUDING the sized line's own draw â unlike line sizing, nothing is 12069 * credited back, because a mix edit spends seats on top of what the line already holds. 12070 * Shrinking is never capacity-gated; min_persons stays the selector's floor. 12071 */ 12072 function maxSubQuantities(manager, cart, item, preCart) { 12073 if (manager.capacityPolicy(item) !== "mantle") throw new Error("(maxSubQuantities) impossible"); 12074 if (!isMantleTicket(item.product)) throw new Error("(maxSubQuantities) impossible");
12075 const p = item.product; 12076 const quantity = item.quantity ?? 0; 12077 let growth = Infinity; 12078 if (quantity > 0) { 12079 feedQuotaPrecart(manager.quotaManager, cart, preCart, item); 12080 growth = Math.floor(manager.quotaManager.ticketCapacity(p.id, p.selectedTime, 0) / quantity); 12081 } 12082 return Object.fromEntries(subTicketDefs(p).map((s) => [s.id, Math.min(s.max_persons, (item.mantle?.composition?.[s.id] ?? 0) + growth)])); 12083 } 12084 //#endregion 12085 //#region src/lib/models/eventTicket/UIEventTicket.svelte.ts 12086 function isEventTicket(x) { 12087 return x?.type === "Event"; 12088 } 12089 function isScaleEventTicket(x) { 12090 return isEventTicket(x) && x.subtype === "scale"; 12091 } 12092 function buildUIEventTicket(apiTicket, dateId, options) { 12093 const product = { 12094 type: "Event", 12095 id: dateId, 12096 tax_included: true, 12097 ...apiTicket 12098 }; 12099 if (options?.date) { 12100 const date = options.date; 12101 options.date_title = date.title || ""; 12102 options.date_description = date.description || ""; 12103 options.event_title = date.event_title || ""; 12104 options.event_subtitle = date.event_sub_title || ""; 12105 options.price_title = apiTicket.title || ""; 12106 options.price_description = apiTicket.description || ""; 12107 } 12108 return { 12109 dateId, 12110 minAvailableCapacity: 0, 12111 selectedTime: "", 12112 ...options, 12113 ...product, 12114 ...apiTicket, 12115 type: "Event", 12116 subtype: apiTicket.scale_price_id === void 0 ? "flat" : "scale" 12117 }; 12118 } 12119 function createUIEventTicket(apiTicket, dateId, options) { 12120 return buildUIEventTicket(apiTicket, dateId, options); 12121 } 12122 //#endregion 12123 //#region src/lib/models/capacity/calculators/seats.ts 12124 /** 12125 * Calculates the maximum number of available seats for a given item in the cart and preCart. 12126 * 12127 * @param {CapacityManager} manager - Instance of CapacityManager containing seat information. 12128 * @param {Cart} cart - The current shopping cart containing items. 12129 * @param {CartItem} item - The specific cart item for which to calculate seat Quantity. 12130 * @param {Cart}
12130 preCart - The pre-cart containing items that should also be considered. 12131 * 12132 * @return {number} The maximum number of available seats for the specific item after considering the cart and preCart. 12133 * @throws {Error} Throws an error if the item's product is not a valid UI event ticket. 12134 */ 12135 var maxQuantity_Seats = function(manager, cart, item, preCart) { 12136 if (manager.capacityPolicy(item) !== "seats") throw new Error("(getMaxQuantitySeats) impossible"); 12137 if (!isEventTicket(item.product)) throw new Error("(getMaxQuantitySeats) impossible"); 12138 const dateId = item.product.dateId; 12139 const savedSeats = manager.allSeats[dateId]; 12140 if (!savedSeats) { 12141 console.error("(getMaxQuantity) no seats found for dateId", dateId); 12142 return { 12143 max: 0, 12144 min: 0, 12145 unavailable: true, 12146 bookedOut: false 12147 }; 12148 } 12149 const max_in_cart = Math.min(savedSeats.max || 100, savedSeats.max_per_registration || 100, savedSeats.available ?? 100); 12150 const seats = { 12151 max_per_registration: max_in_cart, 12152 available: 100, 12153 overbook: false, 12154 ...savedSeats 12155 }; 12156 let available = max_in_cart; 12157 if (seats.overbook) available = Math.min(seats.max || 100, seats.max_per_registration || 100); 12158 const preCartTotal = preCart.totalQuantity; 12159 const cartTotal = sum(cart.items.filter((i) => preCart.items.some((pi) => pi.uuid === i.uuid)), (i) => i.quantity); 12160 const max = Math.max(available - cartTotal - preCartTotal + item.quantity, 0); 12161 return { 12162 max, 12163 min: seats.min ?? 0, 12164 unavailable: seats.available === 0, 12165 bookedOut: max === 0 12166 }; 12167 }; 12168 //#endregion 12169 //#region src/lib/models/capacity/calculators/unlimited.ts 12170 var maxQuantity_Unlimited = function(manager, cart, item, preCart) { 12171 if (manager.capacityPolicy(item) !== "unlimited") throw new Error("(getMaxQuantityUnlimited) impossible"); 12172 return { 12173 max: item.product.max_persons ?? 100, 12174 min: item.product.min_persons ?? 0, 12175 unavailable: false, 12176 bookedOut: false 12177 }; 12178 }; 12179 //#endregion 12180 //#region src/lib/models/capacity/calculators/quotaManager/QuotaManager.ts 12181 function createQuotaManager(quotas) { 12182 return { 12183 apiData: quotas, 12184 _timeslots: [], 12185 addQuotas(data) { 12186 this._timeslots = []; 12187 this.apiData = { 12188 ...this.apiData, 12189 ...data 12190 }; 12191 }, 12192 precart: {}, 12193 clearPrecart() { 12194 this.precart = {}; 12195 this._timeslots = []; 12196 }, 12197 setPrecartItemQuantity(ticketId, quantity) { 12198 this.precart[ticketId] = quantity; 12199 this._timeslots = []; 12200 }, 12201 addPrecartItemQuantity(ticketId, quantity) { 12202 this.precart[ticketId] = (this.precart[ticketId] ?? 0) + quantity; 12203 this._timeslots = []; 12204 }, 12205 getPrecartItemQuantity(ticketId) { 12206 return this.precart[ticketId] ?? 0; 12207 }, 12208 /** 12209 * a flat list of all timeslots and their capacities, respecting preCart. 12210 */ 12211 timeslots() { 12212 if (this._timeslots.length === 0) this._timeslots = Object.entries(this.apiData).flatMap(([quota, cap]) => { 12213 return Object.keys(cap.capacities).map((timeSlot) => { 12214 const sumPreCart = sum(cap.ticket_ids.map((ticket) =>
12214 this.getPrecartItemQuantity(ticket))); 12215 return { 12216 timeSlot, 12217 quota, 12218 capacity: cap.capacities[timeSlot] - sumPreCart, 12219 tickets: cap.ticket_ids, 12220 totalCapacity: cap.total_capacities[timeSlot] 12221 }; 12222 }); 12223 }); 12224 return this._timeslots; 12225 }, 12226 /** 12227 * Filters timeslots based on timeslot or ticketId. 12228 * 12229 * If timeslot is provided, it will return the timeslot with the closest earlier timeSlot. 12230 */ 12231 filterBy({ timeslot, ticketId, date } = {}) { 12232 let ret = this.timeslots(); 12233 if (ticketId) ret = ret.filter((x) => x.tickets.includes(ticketId)); 12234 if (timeslot) ret = ret.filter((x) => x.timeSlot === timeslot); 12235 if (date) ret = ret.filter((x) => x.timeSlot.startsWith(date)); 12236 return ret.flatMap((x) => x.tickets.map((ticket) => ({ 12237 timeslot, 12238 ticket, 12239 quota: x.quota, 12240 capacity: x.capacity, 12241 totalCapacity: x.totalCapacity 12242 }))); 12243 }, 12244 ticketCapacity(ticketId, timeslot, ownQuantity = this.getPrecartItemQuantity(ticketId)) { 12245 const minCap = min$2(this.filterBy({ 12246 timeslot, 12247 ticketId 12248 }).map((x) => x.capacity)) ?? 0; 12249 return Math.max(0, minCap + ownQuantity); 12250 }, 12251 totalCapacity(ticketId, timeslot) { 12252 return min$2(this.filterBy({ 12253 timeslot, 12254 ticketId 12255 }).map((x) => x.totalCapacity)) ?? 0; 12256 }, 12257 timeslotsOn(date, ticketIds) { 12258 let rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date.toString())); 12259 if (ticketIds) rows = rows.filter((x) => x.tickets.some((t) => ticketIds.includes(t))); 12260 const bySlot = group(rows, (r) => r.timeSlot); 12261 return Object.values(bySlot).map((slotRows) => { 12262 return max$2(unique(slotRows.flatMap((r) => r.tickets)).map((t) => min$2(slotRows.filter((r) => r.tickets.includes(t)), (r) => r.capacity)).filter((r) => r !== null), (r) => r.capacity) ?? slotRows[0]; 12263 }).sort((a, b) => a.timeSlot.localeCompare(b.timeSlot)); 12264 } 12265 }; 12266 } 12267 //#endregion 12268 //#region src/lib/models/cart/CartEvents.svelte.ts 12269 function dispatchCartEvents(cart) { 12270 let lastLength = 0; 12271 effect_root(() => { 12272 user_effect(() => { 12273 if (cart.items.length === lastLength) return; 12274 const event = cart.items.length > lastLength ? "go-cart-item-added" : "go-cart-item-removed"; 12275 lastLength = cart.items.length; 12276 document.dispatchEvent(new CustomEvent(event, { detail: cart.items.length })); 12277 }); 12278 }); 12279 } 12280 //#endregion 12281 //#region src/lib/models/cart/CartItem.ts 12282 var lastMantleKey = 0; 12283 function createCartItem(product, options) { 12284 const finalOptions = { 12285 quantity: 0, 12286 time: "", 12287 ...options ?? {} 12288 }; 12289 if (isMantleTicket(product)) finalOptions.mantle = { 12290 composition: finalOptions.mantle?.composition ?? Object.fromEntries(subTicketDefs(product).map((s) => [s.id, s.max_persons])), 12291 key: finalOptions.mantle?.key ?? `mantle-${lastMantleKey++}` 12292 }; 12293 return { 12294 ...finalOptions, 12295 type: product.type, 12296 product, 12297 /** 12298 * is passed to the Order API 12299 */ 12300 orderAttributes() { 12301 const base = { 12302 shipped_with_merchandise_id: null, 12303 shipping_mode: "email", 12304 id: this.product.id, 12305 uuid: this.uuid 12306 }; 12307 switch (product.type) { 12308 case "Ticket": return { 12309 ...base, 12310 time: this.time, 12311 quantity: this.quantity, 12312 ...isMantleTicket(this.product) && this.mantle ? { sub_ticket_quantities: this.mantle.composition } : {} 12313 }; 12314 case "Event": switch (product.subtype) { 12315 case "flat": return { 12316 ...base, 12317 quantity: this.quantity 12318 }; 12319 case "scale": return { 12320 ...base, 12321 quantities: { [product.scale_price_id]: this.quantity } 12322 }; 12323 default: throw new Error(`(orderAttributes) Unhandled Event subtype: ${product}`); 12324 } 12325 case "Coupon": return { 12326 ...base, 12327 quantity: this.quantity 12328 }; 12329 default: throw new Error(`(orderAttributes) Unhandled product type: ${product}`); 12330 } 12331 }, 12332 get uuid() { 12333 return this.type + "-" + this.product.id + this.subUId; 12334 }, 12335 get subUId() { 12336 const segments = []; 12337 if (this.time) segments.push(`time: ${this.time}`); 12338 if (isScaleEventTicket(this.product)) segments.push(`scale_price: ${this.product.scale_price_id}`); 12339 if (this.display?.discounted) segments.push("discounted"); 12340 if (isMantleTicket(this.product) && this.mantle?.key) segments.push(`mantle_key: ${this.mantle.key}`); 12341 return segments.length > 0 ? ` (${segments.join(", ")})` : ""; 12342 }, 12343 toString() { 12344 return this.uuid + ":" + this.quantity; 12345 }, 12346 get price_cents() { 12347 if (this.time && this.product.dynamic_prices?.[this.time] != null) return this.product.dynamic_prices[this.time]; 12348 return this.product.price_cents; 12349 }, 12350 get price_formatted() { 12351 return formatCurrency(this.price_cents); 12352 }, 12353 get final_price_cents() { 12354 const taxFactor = this.product.tax_included ? 1 : 1 + this.product.vat_pct / 100; 12355 return this.price_cents * taxFactor; 12356 }, 12357 get final_price_formatted() { 12358 return formatCurrency(this.final_price_cents); 12359 }, 12360 get total_price_cents() { 12361 return this.quantity * this.final_price_cents; 12362 }, 12363 get total_price_formatted() { 12364 return formatCurrency(this.total_price_cents); 12365 } 12366 }; 12367 } 12368 function isLocalStorageAvailable() { 12369 return typeof window !== "undefined" && typeof localStorage !== "undefined"; 12370 } 12371 function saveToLocalStorage(key, data) { 12372 if (!isLocalStorageAvailable()) return; 12373 try { 12374 localStorage.setItem(key, JSON.stringify(data)); 12375 } catch (e) { 12376 console.warn(`Failed to save to localStorage (${key}):`, e); 12377 } 12378 } 12379 function loadFromLocalStorage$1(key) { 12380 if (!isLocalStorageAvailable()) return null; 12381 try { 12382 const item = localStorage.getItem(key); 12383 return item ? JSON.parse(item) : null; 12384 } catch (e) { 12385 console.warn(`Failed to load from localStorage (${key}):`, e); 12386 return null; 12387 } 12388 }
12389 function removeFromLocalStorage(key) { 12390 if (!isLocalStorageAvailable()) return; 12391 try { 12392 localStorage.removeItem(key); 12393 } catch (e) { 12394 console.warn(`Failed to remove from localStorage (${key}):`, e); 12395 } 12396 } 12397 //#endregion 12398 //#region src/lib/models/coupon/UICoupon.svelte.ts 12399 /** 12400 * A purchasable coupon (German "Wertgutschein" = value voucher / gift card). 12401 * 12402 * Unlike tickets and event prices, a coupon is a fixed-value product: the API 12403 * returns predefined coupons and the order payload (`coupon_cart_item`) only 12404 * carries `id` + `quantity`. `coupon_index` has no `description`, so we default 12405 * it to an empty string to satisfy the shared `BaseProduct` shape. 12406 */ 12407 function createUICoupon(apiCoupon) { 12408 return { 12409 ...apiCoupon, 12410 description: "", 12411 tax_included: true, 12412 type: "Coupon" 12413 }; 12414 } 12415 //#endregion 12416 //#region src/lib/models/cart/localStorage.svelte.ts 12417 var KEY$9 = "go-cart"; 12418 var persistCart = (items, coupons) => localStorage.setItem(KEY$9, JSON.stringify({ 12419 items, 12420 coupons, 12421 savedAt: Date.now() 12422 })); 12423 function generateCartItem(cartItem) { 12424 const type = cartItem.product.type; 12425 switch (type) { 12426 case "Ticket": 12427 if (!isStillValid(cartItem)) return; 12428 return createCartItem(createUITicket(cartItem.product, { selectedTime: cartItem.product.selectedTime }), { 12429 time: cartItem.time, 12430 quantity: cartItem.quantity, 12431 mantle: cartItem.mantle 12432 }); 12433 case "Event": 12434 if (!isStillValid(cartItem)) return; 12435 return createCartItem(createUIEventTicket(cartItem.product, cartItem.id), { 12436 time: cartItem.time, 12437 quantity: cartItem.quantity 12438 }); 12439 case "Coupon": return createCartItem(createUICoupon(cartItem.product), { quantity: cartItem.quantity }); 12440 default: throw new Error(`Unhandled case: ${type}`); 12441 } 12442 } 12443 function loadFromLocalStorage(cart) { 12444 let lsItems = []; 12445 let lsCoupons = []; 12446 let savedAt; 12447 try { 12448 const content = localStorage.getItem(KEY$9); 12449 if (!content) return []; 12450 const parsed = JSON.parse(content); 12451 if (Array.isArray(parsed)) { 12452 lsItems = parsed; 12453 lsCoupons = []; 12454 } else if (typeof parsed === "object" && parsed !== null) { 12455 lsItems = parsed.items || []; 12456 lsCoupons = parsed.coupons || []; 12457 savedAt = parsed.savedAt; 12458 } else { 12459 console.dir({ 12460 parsed, 12461 content 12462 }); 12463 throw new Error("go-cart has invalid format"); 12464 } 12465 if (!!savedAt && Date.now() - savedAt > 9e5) { 12466 cart.clearItems(); 12467 cart.clearCoupons(); 12468 persistCart([], []); 12469 return []; 12470 } 12471 if (lsItems.length === 0) cart.clearItems(); 12472 else cart.items = lsItems.map(generateCartItem).filter(defined); 12473 cart.clearCoupons(); 12474 lsCoupons.forEach((coupon) => cart.addCoupon(typeof coupon === "string" ? { 12475 code: coupon, 12476 kind: "actionToken" 12477 } : coupon)); 12478 return cart.items; 12479 } catch (e) { 12480 console.error(e); 12481 persistCart([], []); 12482 return []; 12483 } 12484 } 12485 /** 12486 * Synchronizes the given shopping cart with the local storage. The method ensures that the cart is loaded from local storage, 12487 * updates are reflected in the local storage, and any external changes to the local storage are propagated to the cart. 12488 * 12489 * @return {void} This method does not return a value. 12490 */ 12491 function syncCartToLocalStorage(cart) { 12492 loadFromLocalStorage(cart); 12493 let lastWritten = JSON.stringify({ 12494 items: cart.items || [], 12495 coupons: cart.coupons || [] 12496 }); 12497 persistCart(cart.items || [], cart.coupons || []); 12498 effect_root(() => { 12499 user_effect(() => { 12500 const content = JSON.stringify({ 12501 items: cart.items || [], 12502 coupons: cart.coupons || [] 12503 }); 12504 if (content === lastWritten) return; 12505 lastWritten = content; 12506 persistCart(cart.items || [], cart.coupons || []); 12507 }); 12508 }); 12509 } 12510 var inTheFuture = (time) => { 12511 return /* @__PURE__ */ new Date() < new Date(time); 12512 }; 12513 var validForToday = (time) => $58246871e4652552$export$6b862160d295c8e(time.slice(0, 10)).compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) >= 0; 12514 var isStillValid = (cartItem) => { 12515 if (!cartItem.time) return true; 12516 return cartItem.product.subtype === "day" ? validForToday(cartItem.time) : inTheFuture(cartItem.time); 12517 }; 12518 var defined = (x) => x !== void 0; 12519 //#endregion 12520 //#region src/lib/models/cart/cart.svelte.ts 12521 var lastUuid = 0; 12522 function createCart(products, contingent = 20) { 12523 const cart = { 12524 items: proxy([]), 12525 coupons: proxy([]), 12526 paymentModeId: void 0, 12527 uid: `cart-${lastUuid++}`, 12528 get nonEmptyItems() { 12529 return this.items.filter((i) => i.quantity > 0); 12530 }, 12531 get totalPriceCents() { 12532 return Math.max(0, sum(this.items, (item) => item.total_price_cents)); 12533 }, 12534 get totalQuantity() { 12535 return sum(this.items, (item) => item.quantity); 12536 }, 12537 get valueVoucherCents() { 12538 return sum(this.coupons.filter((c) => c.kind === "valueVoucher"), (c) => c.valueCents ?? 0); 12539 }, 12540 get amountToPayCents() { 12541 return Math.max(0, this.totalPriceCents - this.valueVoucherCents); 12542 }, 12543 /** 12544 * Generates a formatted string representation of the current object. 12545 */ 12546 toString() { 12547 return this.uid + " > [" + this.items.map((i) => i.uuid + ":" + i.quantity).join(", ") + "]"; 12548 }, 12549 orderData() { 12550 return { 12551 items: this.items.map((item) => ({ 12552 type: item.type, 12553 attributes: item.orderAttributes() 12554 })), 12555 shipping_address_id: null, 12556 comment: null, 12557 reference: null, 12558 payment_mode_id: this.paymentModeId ?? shop.settings?.defaultPaymentModeId, 12559 coupons: this.coupons.map((c) => c.code), 12560 donations: [], 12561 affiliate: {}, 12562 total: this.amountToPayCents 12563 }; 12564 }, 12565 get totalFormatted() { 12566 return formatCurrency(this.totalPriceCents); 12567 }, 12568 clearItems() { 12569 while (this.items.length > 0) this.items.pop(); 12570 }, 12571 deleteItem(item) { 12572 for (let i = this.items.length - 1; i >= 0; i--) if (this.items[i].uuid === item.uuid) this.items.splice(i, 1); 12573 }, 12574 addItem(item) { 12575 const existingItem = this.items.find((i) => i.uuid === item.uuid); 12576 existingItem ? existingItem.quantity += item.quantity : this.items.push(item); 12577 }, 12578 addItems(items) {
12579 items.forEach((item) => this.addItem(item)); 12580 }, 12581 addCoupon(item) { 12582 const coupon = { 12583 ...item, 12584 code: item.code.toUpperCase() 12585 }; 12586 if (!this.coupons.some((c) => c.code === coupon.code)) this.coupons.push(coupon); 12587 }, 12588 removeCoupon(code) { 12589 const upper = code.toUpperCase(); 12590 const index = this.coupons.findIndex((c) => c.code === upper); 12591 if (index > -1) this.coupons.splice(index, 1); 12592 }, 12593 clearCoupons() { 12594 while (this.coupons.length > 0) this.coupons.pop(); 12595 } 12596 }; 12597 if (products) products.forEach((p) => cart.addItem(createCartItem(p))); 12598 return cart; 12599 } 12600 function formatCurrency(priceCents) { 12601 priceCents = priceCents ?? 0; 12602 return new Intl.NumberFormat("de-DE", { 12603 style: "currency", 12604 currency: "EUR" 12605 }).format(priceCents / 100); 12606 } 12607 function createMainCart() { 12608 const cart = proxy(createCart()); 12609 syncCartToLocalStorage(cart); 12610 dispatchCartEvents(cart); 12611 return cart; 12612 } 12613 //#endregion 12614 //#region src/lib/models/capacity/localStorage.ts 12615 var KEY$8 = "go-capacity"; 12616 function saveCapacityToLocalStorage(allSeats, allQuotas) { 12617 const existing = loadFromLocalStorage$1(KEY$8); 12618 saveToLocalStorage(KEY$8, { 12619 allSeats: { 12620 ...existing?.allSeats || {}, 12621 ...allSeats 12622 }, 12623 allQuotas: { 12624 ...existing?.allQuotas || {}, 12625 ...allQuotas 12626 }, 12627 savedAt: Date.now() 12628 }); 12629 } 12630 function loadCapacityFromLocalStorage(manager) { 12631 const data = loadFromLocalStorage$1(KEY$8); 12632 if (!data) return; 12633 if (!data.savedAt || Date.now() - data.savedAt > 9e5) { 12634 removeFromLocalStorage(KEY$8); 12635 return; 12636 } 12637 if (data.allSeats) for (const dateId in data.allSeats) { 12638 const did = parseInt(dateId); 12639 manager.addSeats(did, data.allSeats[did], false); 12640 } 12641 if (data.allQuotas) manager.addQuotas(data.allQuotas, false); 12642 } 12643 function syncCapacityAcrossTabs(manager) { 12644 if (!isLocalStorageAvailable()) return; 12645 window.addEventListener("storage", (event) => { 12646 if (event.key === KEY$8) loadCapacityFromLocalStorage(manager); 12647 if (event.key === "go-cart") { 12648 const cart = loadFromLocalStorage$1("go-cart"); 12649 if (!cart || !cart.items || cart.items.length === 0) removeFromLocalStorage(KEY$8); 12650 } 12651 }); 12652 } 12653 //#endregion 12654 //#region src/lib/models/capacity/CapacityManager.ts 12655 /** 12656 * Creates and returns an object to manage capacity for quotas and seats. 12657 * It provides methods to calculate the maximum quantity of items in a cart. 12658 * 12659 * It uses the seats and quotas as constrains 12660 * 12661 */ 12662 function createCapacityManager() { 12663 const manager = { 12664 allSeats: {}, 12665 allQuotas: {}, 12666 quotaManager: createQuotaManager({}), 12667 addQuotas(quotas, saveToLocalStorage = true) { 12668 this.allQuotas = { 12669 ...this.allQuotas, 12670 ...quotas 12671 }; 12672 this.quotaManager.addQuotas(quotas); 12673 if (saveToLocalStorage) saveCapacityToLocalStorage(this.allSeats, this.allQuotas); 12674 }, 12675 addSeats(dateId, seats, saveToLocalStorage = true) { 12676 this.allSeats[dateId] = seats; 12677 if (saveToLocalStorage) saveCapacityToLocalStorage(this.allSeats, this.allQuotas); 12678 }, 12679 capacityPolicy(item) { 12680 const type = item.product.type; 12681 switch (type) { 12682 case "Ticket": 12683 const product1 = item.product; 12684 const subtype1 = product1.subtype; 12685 switch (subtype1) { 12686 case "timeslot": 12687 case "event:ticket": 12688 case "day": return isMantleTicket(product1) ? "mantle" : "quotas"; 12689 case "annual": return "unlimited"; 12690 default: throw new Error(`(getMaxAvailability) Unhandled case: ${subtype1}`); 12691 } 12692 case "Event": 12693 const subtype2 = item.product.subtype; 12694 switch (subtype2) { 12695 case "flat": 12696 case "scale": return "seats"; 12697 default: throw new Error(`(getMaxAvailability) Unhandled case: ${subtype2}`); 12698 } 12699 case "Coupon": return "unlimited"; 12700 default: throw new Error(`(getMaxAvailability) Unhandled case: ${type}`); 12701 } 12702 }, 12703 capacity(cart, item, preCart) { 12704 const policy = this.capacityPolicy(item); 12705 const calculator = { 12706 quotas: maxQuantity_Quotas, 12707 mantle: maxQuantity_Mantle, 12708 seats: maxQuantity_Seats, 12709 unlimited: maxQuantity_Unlimited 12710 }[policy]; 12711 if (!calculator) throw new Error(`(maxQuantity) impossible: ${policy}`); 12712 return untrack(() => calculator(this, cart, item, preCart)); 12713 }, 12714 subTicketMaxes(cart, item, preCart) { 12715 if (!isMantleTicket(item.product)) return {}; 12716 const policy = this.capacityPolicy(item); 12717 if (policy !== "mantle" && policy !== "unlimited") throw new Error(`(subTicketMaxes) impossible: ${policy}`); 12718 return untrack(() => policy === "mantle" ? maxSubQuantities(this, cart, item, preCart) : combinationSubMaxes(item.product)); 12719 } 12720 }; 12721 loadCapacityFromLocalStorage(manager); 12722 syncCapacityAcrossTabs(manager); 12723 return manager; 12724 } 12725 //#endregion
12726 //#region src/lib/helpers/cookies.ts 12727 function getCookie(name) { 12728 if (typeof document === "undefined") return; 12729 if (!name) return; 12730 const parts = `; ${document.cookie}`.split(`; ${name}=`); 12731 if (parts.length === 2) { 12732 const rawValue = parts.pop()?.split(";").shift(); 12733 return rawValue ? decodeURIComponent(rawValue) : void 0; 12734 } 12735 } 12736 //#endregion 12737 //#region src/lib/stores/user.svelte.ts 12738 var User = class { 12739 get isAuthenticated() { 12740 return this.isLoggedIn || this.isGuest; 12741 } 12742 }; 12743 var AngularUser = class extends User { 12744 constructor() { 12745 super(); 12746 } 12747 get isLoggedIn() { 12748 try { 12749 const raw = getCookie("auth_headers"); 12750 if (!raw) return false; 12751 const auth = JSON.parse(raw); 12752 const now = Math.floor(Date.now() / 1e3); 12753 if (!auth["access-token"]) return false; 12754 if (parseInt(auth["expiry"], 10) < now) return false; 12755 return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth["uid"]); 12756 } catch { 12757 return false; 12758 } 12759 } 12760 get isGuest() { 12761 if (this.isLoggedIn) return false; 12762 try { 12763 const raw = getCookie("auth_headers"); 12764 if (!raw) return true; 12765 const auth = JSON.parse(raw); 12766 return typeof auth["uid"] === "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth["uid"]); 12767 } catch { 12768 return true; 12769 } 12770 } 12771 }; 12772 var JMBUser = class extends User { 12773 get isGuest() { 12774 throw new Error("Not implemented."); 12775 } 12776 get isLoggedIn() { 12777 throw new Error("Not implemented"); 12778 } 12779 }; 12780 var getUserProvider = (type) => { 12781 switch (type) { 12782 case "angular": return new AngularUser(); 12783 case "jmb": return new JMBUser(); 12784 default: throw new Error("Unhandled shop type: " + type); 12785 } 12786 }; 12787 //#endregion 12788 //#region src/lib/validation.ts 12789 /** 12790 * Checks if a value is empty (null, undefined, empty string, or whitespace-only string) 12791 */ 12792 function isEmpty(value) { 12793 return value === null || value === void 0 || typeof value === "string" && value.trim() === ""; 12794 } 12795 /** 12796 * Validates that all required fields are present and non-empty in the body 12797 * @returns Record of field names to error messages, empty if all valid 12798 */ 12799 function validateRequiredFields(body, requiredFields) { 12800 const errors = {}; 12801 if (!requiredFields || requiredFields.length === 0) return errors; 12802 for (const field of requiredFields) if (!(field in body) || isEmpty(body[field])) errors[field] = [`Field '${field}' is required and cannot be empty`]; 12803 return errors; 12804 } 12805 /** 12806 * Validates the entire request body for API POST requests 12807 * - Validates required fields 12808 * - Validates email fields 12809 * - Validates password fields 12810 * @returns Record of field names to error messages, empty if all valid 12811 */ 12812 function validateApiPostBody(body, requiredFields) { 12813 return validateRequiredFields(body, requiredFields); 12814 } 12815 //#endregion 12816 //#region ../../node_modules/.pnpm/[email protected]/node_modules/neverthrow/dist/index.es.js 12817 var defaultErrorConfig = { withStackTrace: false }; 12818 var createNeverThrowError = (message, result, config = defaultErrorConfig) => { 12819 return { 12820 data: result.isOk() ? { 12821 type: "Ok", 12822 value: result.value 12823 } : { 12824 type: "Err", 12825 value: result.error 12826 }, 12827 message, 12828 stack: config.withStackTrace ? (/* @__PURE__ */ new Error()).stack : void 0 12829 }; 12830 }; 12831 /****************************************************************************** 12832 Copyright (c) Microsoft Corporation. 12833 12834 Permission to use, copy, modify, and/or distribute this software for any 12835 purpose with or without fee is hereby granted. 12836 12837 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 12838 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12839 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12840 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12841 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12842 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 12843 PERFORMANCE OF THIS SOFTWARE. 12844 ***************************************************************************** */ 12845 function __awaiter(thisArg, _arguments, P, generator) { 12846 function adopt(value) { 12847 return value instanceof P ? value : new P(function(resolve) { 12848 resolve(value); 12849 }); 12850 } 12851 return new (P || (P = Promise))(function(resolve, reject) { 12852 function fulfilled(value) { 12853 try { 12854 step(generator.next(value)); 12855 } catch (e) { 12856 reject(e); 12857 } 12858 } 12859 function rejected(value) { 12860 try { 12861 step(generator["throw"](value)); 12862 } catch (e) { 12863 reject(e); 12864 } 12865 } 12866 function step(result) { 12867 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 12868 } 12869 step((generator = generator.apply(thisArg, _arguments || [])).next()); 12870 }); 12871 } 12872 function __values(o) { 12873 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 12874 if (m) return m.call(o); 12875 if (o && typeof o.length === "number") return { next: function() { 12876 if (o && i >= o.length) o = void 0; 12877 return { 12878 value: o && o[i++], 12879 done: !o 12880 }; 12881 } }; 12882 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 12883 } 12884 function __await(v) { 12885 return this instanceof __await ? (this.v = v, this) : new __await(v); 12886 } 12887 function __asyncGenerator(thisArg, _arguments, generator) { 12888 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 12889 var g = generator.apply(thisArg, _arguments || []), i, q = []; 12890 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { 12891 return this; 12892 }, i; 12893 function awaitReturn(f) { 12894 return function(v) { 12895 return Promise.resolve(v).then(f, reject); 12896 }; 12897 } 12898 function verb(n, f) { 12899 if (g[n]) { 12900 i[n] = function(v) { 12901 return new Promise(function(a, b) { 12902 q.push([ 12903 n, 12904 v, 12905 a, 12906 b 12907 ]) > 1 || resume(n, v); 12908 }); 12909 }; 12910 if (f) i[n] = f(i[n]); 12911 } 12912 } 12913 function resume(n, v) { 12914 try { 12915 step(g[n](v)); 12916 } catch (e) { 12917 settle(q[0][3], e); 12918 } 12919 } 12920 function step(r) { 12921 r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); 12922 } 12923 function fulfill(value) { 12924 resume("next", value); 12925 } 12926 function reject(value) { 12927 resume("throw", value); 12928 } 12929 function settle(f, v) { 12930 if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); 12931 } 12932 } 12933 function __asyncDelegator(o) { 12934 var i, p; 12935 return i = {}, verb("next"), verb("throw", function(e) { 12936 throw e; 12937 }), verb("return"), i[Symbol.iterator] = function() { 12938 return this; 12939 }, i; 12940 function verb(n, f) { 12941 i[n] = o[n] ? function(v) { 12942 return (p = !p) ? { 12943 value: __await(o[n](v)), 12944 done: false 12945 } : f ? f(v) : v; 12946 } : f; 12947 } 12948 } 12949 function __asyncValues(o) { 12950 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 12951 var m = o[Symbol.asyncIterator], i; 12952 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { 12953 return this; 12954 }, i); 12955 function verb(n) { 12956 i[n] = o[n] && function(v) { 12957 return new Promise(function(resolve, reject) { 12958 v = o[n](v), settle(resolve, reject, v.done, v.value); 12959 }); 12960 }; 12961 } 12962 function settle(resolve, reject, d, v) { 12963 Promise.resolve(v).then(function(v) { 12964 resolve({ 12965 value: v, 12966 done: d 12967 }); 12968 }, reject); 12969 } 12970 } 12971 var ResultAsync = class ResultAsync { 12972 constructor(res) { 12973 this._promise = res; 12974 } 12975 static fromSafePromise(promise) { 12976 return new ResultAsync(promise.then((value) => new Ok(value))); 12977 } 12978 static fromPromise(promise, errorFn) { 12979 return new ResultAsync(promise.then((value) => new Ok(value)).catch((e) => new Err(errorFn(e)))); 12980 } 12981 static fromThrowable(fn, errorFn) { 12982 return (...args) => { 12983 return new ResultAsync((() => __awaiter(this, void 0, void 0, function* () { 12984 try { 12985 return new Ok(yield fn(...args)); 12986 } catch (error) { 12987 return new Err(errorFn ? errorFn(error) : error); 12988 } 12989 }))()); 12990 }; 12991 } 12992 static combine(asyncResultList) { 12993 return combineResultAsyncList(asyncResultList); 12994 } 12995 static combineWithAllErrors(asyncResultList) { 12996 return combineResultAsyncListWithAllErrors(asyncResultList); 12997 } 12998 map(f) { 12999 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13000 if (res.isErr()) return new Err(res.error); 13001 return new Ok(yield f(res.value)); 13002 }))); 13003 } 13004 andThrough(f) { 13005 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13006 if (res.isErr()) return new Err(res.error); 13007 const newRes = yield f(res.value); 13008 if (newRes.isErr()) return new Err(newRes.error); 13009 return new Ok(res.value); 13010 }))); 13011 } 13012 andTee(f) { 13013 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13014 if (res.isErr()) return new Err(res.error);
13015 try { 13016 yield f(res.value); 13017 } catch (e) {} 13018 return new Ok(res.value); 13019 }))); 13020 } 13021 orTee(f) { 13022 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13023 if (res.isOk()) return new Ok(res.value); 13024 try { 13025 yield f(res.error); 13026 } catch (e) {} 13027 return new Err(res.error); 13028 }))); 13029 } 13030 mapErr(f) { 13031 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13032 if (res.isOk()) return new Ok(res.value); 13033 return new Err(yield f(res.error)); 13034 }))); 13035 } 13036 andThen(f) { 13037 return new ResultAsync(this._promise.then((res) => { 13038 if (res.isErr()) return new Err(res.error); 13039 const newValue = f(res.value); 13040 return newValue instanceof ResultAsync ? newValue._promise : newValue; 13041 })); 13042 } 13043 orElse(f) { 13044 return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () { 13045 if (res.isErr()) return f(res.error); 13046 return new Ok(res.value); 13047 }))); 13048 } 13049 match(ok, _err) { 13050 return this._promise.then((res) => res.match(ok, _err)); 13051 } 13052 unwrapOr(t) { 13053 return this._promise.then((res) => res.unwrapOr(t)); 13054 } 13055 /** 13056 * @deprecated will be removed in 9.0.0. 13057 * 13058 * You can use `safeTry` without this method. 13059 * @example 13060 * ```typescript 13061 * safeTry(async function* () { 13062 * const okValue = yield* yourResult 13063 * }) 13064 * ``` 13065 * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`. 13066 */ 13067 safeUnwrap() { 13068 return __asyncGenerator(this, arguments, function* safeUnwrap_1() { 13069 return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap())))))); 13070 }); 13071 } 13072 then(successCallback, failureCallback) { 13073 return this._promise.then(successCallback, failureCallback); 13074 } 13075 [Symbol.asyncIterator]() { 13076 return __asyncGenerator(this, arguments, function* _a() { 13077 const result = yield __await(this._promise); 13078 if (result.isErr()) yield yield __await(errAsync(result.error)); 13079 return yield __await(result.value); 13080 }); 13081 } 13082 }; 13083 function errAsync(err) { 13084 return new ResultAsync(Promise.resolve(new Err(err))); 13085 } 13086 ResultAsync.fromPromise; 13087 ResultAsync.fromSafePromise; 13088 ResultAsync.fromThrowable; 13089 /** 13090 * Short circuits on the FIRST Err value that we find 13091 */ 13092 var combineResultList = (resultList) => { 13093 let acc = ok([]); 13094 for (const result of resultList) if (result.isErr()) { 13095 acc = err(result.error); 13096 break; 13097 } else acc.map((list) => list.push(result.value)); 13098 return acc; 13099 }; 13100 var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList); 13101 /** 13102 * Give a list of all the errors we find 13103 */ 13104 var combineResultListWithAllErrors = (resultList) => { 13105 let acc = ok([]); 13106 for (const result of resultList) if (result.isErr() && acc.isErr()) acc.error.push(result.error); 13107 else if (result.isErr() && acc.isOk()) acc = err([result.error]); 13108 else if (result.isOk() && acc.isOk()) acc.value.push(result.value); 13109 return acc; 13110 }; 13111 var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors); 13112 var Result; 13113 (function(Result) { 13114 /** 13115 * Wraps a function with a try catch, creating a new function with the same 13116 * arguments but returning `Ok` if successful, `Err` if the function throws 13117 * 13118 * @param fn function to wrap with ok on success or err on failure 13119 * @param errorFn when an error is thrown, this will wrap the error result if provided 13120 */ 13121 function fromThrowable(fn, errorFn) { 13122 return (...args) => { 13123 try { 13124 return ok(fn(...args)); 13125 } catch (e) { 13126 return err(errorFn ? errorFn(e) : e); 13127 } 13128 }; 13129 } 13130 Result.fromThrowable = fromThrowable; 13131 function combine(resultList) { 13132 return combineResultList(resultList); 13133 } 13134 Result.combine = combine; 13135 function combineWithAllErrors(resultList) { 13136 return combineResultListWithAllErrors(resultList); 13137 } 13138 Result.combineWithAllErrors = combineWithAllErrors; 13139 })(Result || (Result = {})); 13140 function ok(value) { 13141 return new Ok(value); 13142 } 13143 function err(err) { 13144 return new Err(err); 13145 } 13146 var Ok = class { 13147 constructor(value) { 13148 this.value = value; 13149 } 13150 isOk() { 13151 return true; 13152 } 13153 isErr() { 13154 return !this.isOk(); 13155 } 13156 map(f) { 13157 return ok(f(this.value)); 13158 } 13159 mapErr(_f) { 13160 return ok(this.value); 13161 } 13162 andThen(f) { 13163 return f(this.value); 13164 } 13165 andThrough(f) { 13166 return f(this.value).map((_value) => this.value); 13167 } 13168 andTee(f) { 13169 try { 13170 f(this.value); 13171 } catch (e) {} 13172 return ok(this.value); 13173 } 13174 orTee(_f) { 13175 return ok(this.value); 13176 } 13177 orElse(_f) { 13178 return ok(this.value); 13179 } 13180 asyncAndThen(f) { 13181 return f(this.value); 13182 } 13183 asyncAndThrough(f) { 13184 return f(this.value).map(() => this.value); 13185 } 13186 asyncMap(f) { 13187 return ResultAsync.fromSafePromise(f(this.value)); 13188 } 13189 unwrapOr(_v) { 13190 return this.value; 13191 } 13192 match(ok, _err) { 13193 return ok(this.value); 13194 } 13195 safeUnwrap() { 13196 const value = this.value; 13197 return (function* () { 13198 return value; 13199 })(); 13200 } 13201 _unsafeUnwrap(_) { 13202 return this.value; 13203 } 13204 _unsafeUnwrapErr(config) { 13205 throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config); 13206 } 13207 *[Symbol.iterator]() { 13208 return this.value; 13209 } 13210 }; 13211 var Err = class { 13212 constructor(error) { 13213 this.error = error; 13214 } 13215 isOk() { 13216 return false;
13217 } 13218 isErr() { 13219 return !this.isOk(); 13220 } 13221 map(_f) { 13222 return err(this.error); 13223 } 13224 mapErr(f) { 13225 return err(f(this.error)); 13226 } 13227 andThrough(_f) { 13228 return err(this.error); 13229 } 13230 andTee(_f) { 13231 return err(this.error); 13232 } 13233 orTee(f) { 13234 try { 13235 f(this.error); 13236 } catch (e) {} 13237 return err(this.error); 13238 } 13239 andThen(_f) { 13240 return err(this.error); 13241 } 13242 orElse(f) { 13243 return f(this.error); 13244 } 13245 asyncAndThen(_f) { 13246 return errAsync(this.error); 13247 } 13248 asyncAndThrough(_f) { 13249 return errAsync(this.error); 13250 } 13251 asyncMap(_f) { 13252 return errAsync(this.error); 13253 } 13254 unwrapOr(v) { 13255 return v; 13256 } 13257 match(_ok, err) { 13258 return err(this.error); 13259 } 13260 safeUnwrap() { 13261 const error = this.error; 13262 return (function* () { 13263 yield err(error); 13264 throw new Error("Do not use this generator out of `safeTry`"); 13265 })(); 13266 } 13267 _unsafeUnwrap(config) { 13268 throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config); 13269 } 13270 _unsafeUnwrapErr(_) { 13271 return this.error; 13272 } 13273 *[Symbol.iterator]() { 13274 const self = this; 13275 yield self; 13276 return self; 13277 } 13278 }; 13279 Result.fromThrowable; 13280 //#endregion 13281 //#region ../../node_modules/.pnpm/[email protected]/node_modules/openapi-fetch/dist/index.mjs 13282 var PATH_PARAM_RE = /\{[^{}]+\}/g; 13283 var supportsRequestInitExt = () => { 13284 return typeof process === "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici; 13285 }; 13286 function randomID() { 13287 return Math.random().toString(36).slice(2, 11); 13288 } 13289 function createClient(clientOptions) { 13290 let { baseUrl = "", Request: CustomRequest = globalThis.Request, fetch: baseFetch = globalThis.fetch, querySerializer: globalQuerySerializer, bodySerializer: globalBodySerializer, pathSerializer: globalPathSerializer, headers: baseHeaders, requestInitExt = void 0, ...baseOptions } = { ...clientOptions }; 13291 requestInitExt = supportsRequestInitExt() ? requestInitExt : void 0; 13292 baseUrl = removeTrailingSlash(baseUrl); 13293 const globalMiddlewares = []; 13294 async function coreFetch(schemaPath, fetchOptions) { 13295 const { baseUrl: localBaseUrl, fetch = baseFetch, Request = CustomRequest, headers, params = {}, parseAs = "json", querySerializer: requestQuerySerializer, bodySerializer = globalBodySerializer ?? defaultBodySerializer, pathSerializer: requestPathSerializer, body, middleware: requestMiddlewares = [], ...init } = fetchOptions || {}; 13296 let finalBaseUrl = baseUrl; 13297 if (localBaseUrl) finalBaseUrl = removeTrailingSlash(localBaseUrl) ?? baseUrl; 13298 let querySerializer = typeof globalQuerySerializer === "function" ? globalQuerySerializer : createQuerySerializer(globalQuerySerializer); 13299 if (requestQuerySerializer) querySerializer = typeof requestQuerySerializer === "function" ? requestQuerySerializer : createQuerySerializer({ 13300 ...typeof globalQuerySerializer === "object" ? globalQuerySerializer : {}, 13301 ...requestQuerySerializer 13302 }); 13303 const pathSerializer = requestPathSerializer || globalPathSerializer || defaultPathSerializer;
13304 const serializedBody = body === void 0 ? void 0 : bodySerializer(body, mergeHeaders(baseHeaders, headers, params.header)); 13305 const finalHeaders = mergeHeaders(serializedBody === void 0 || serializedBody instanceof FormData ? {} : { "Content-Type": "application/json" }, baseHeaders, headers, params.header); 13306 const finalMiddlewares = [...globalMiddlewares, ...requestMiddlewares]; 13307 const requestInit = { 13308 redirect: "follow", 13309 ...baseOptions, 13310 ...init, 13311 body: serializedBody, 13312 headers: finalHeaders 13313 }; 13314 let id; 13315 let options; 13316 let request = new Request(createFinalURL(schemaPath, { 13317 baseUrl: finalBaseUrl, 13318 params, 13319 querySerializer, 13320 pathSerializer 13321 }), requestInit); 13322 let response; 13323 for (const key in init) if (!(key in request)) request[key] = init[key]; 13324 if (finalMiddlewares.length) { 13325 id = randomID(); 13326 options = Object.freeze({ 13327 baseUrl: finalBaseUrl, 13328 fetch, 13329 parseAs, 13330 querySerializer, 13331 bodySerializer, 13332 pathSerializer 13333 }); 13334 for (const m of finalMiddlewares) if (m && typeof m === "object" && typeof m.onRequest === "function") { 13335 const result = await m.onRequest({ 13336 request, 13337 schemaPath, 13338 params, 13339 options, 13340 id 13341 }); 13342 if (result) if (result instanceof Request) request = result; 13343 else if (result instanceof Response) { 13344 response = result; 13345 break; 13346 } else throw new Error("onRequest: must return new Request() or Response() when modifying the request"); 13347 } 13348 } 13349 if (!response) { 13350 try { 13351 response = await fetch(request, requestInitExt); 13352 } catch (error2) { 13353 let errorAfterMiddleware = error2; 13354 if (finalMiddlewares.length) for (let i = finalMiddlewares.length - 1; i >= 0; i--) { 13355 const m = finalMiddlewares[i]; 13356 if (m && typeof m === "object" && typeof m.onError === "function") { 13357 const result = await m.onError({ 13358 request, 13359 error: errorAfterMiddleware, 13360 schemaPath, 13361 params, 13362 options, 13363 id 13364 }); 13365 if (result) { 13366 if (result instanceof Response) { 13367 errorAfterMiddleware = void 0; 13368 response = result; 13369 break; 13370 } 13371 if (result instanceof Error) { 13372 errorAfterMiddleware = result; 13373 continue; 13374 } 13375 throw new Error("onError: must return new Response() or instance of Error"); 13376 } 13377 } 13378 } 13379 if (errorAfterMiddleware) throw errorAfterMiddleware; 13380 } 13381 if (finalMiddlewares.length) for (let i = finalMiddlewares.length - 1; i >= 0; i--) { 13382 const m = finalMiddlewares[i]; 13383 if (m && typeof m === "object" && typeof m.onResponse === "function") { 13384 const result = await m.onResponse({ 13385 request, 13386 response, 13387 schemaPath, 13388 params, 13389 options, 13390 id 13391 }); 13392 if (result) { 13393 if (!(result instanceof Response)) throw new Error("onResponse: must return new Response() when modifying the response"); 13394 response = result; 13395 } 13396 } 13397 } 13398 } 13399 const contentLength = response.headers.get("Content-Length"); 13400 if (response.status === 204 || request.method === "HEAD" || contentLength === "0" && !response.headers.get("Transfer-Encoding")?.includes("chunked")) return response.ok ? { 13401 data: void 0, 13402 response 13403 } : { 13404 error: void 0, 13405 response 13406 }; 13407 if (response.ok) { 13408 const getResponseData = async () => { 13409 if (parseAs === "stream") return response.body; 13410 if (parseAs === "json" && !contentLength) { 13411 const raw = await response.text(); 13412 return raw ? JSON.parse(raw) : void 0; 13413 } 13414 return await response[parseAs](); 13415 }; 13416 return { 13417 data: await getResponseData(), 13418 response 13419 }; 13420 } 13421 let error = await response.text(); 13422 try { 13423 error = JSON.parse(error); 13424 } catch {} 13425 return { 13426 error, 13427 response 13428 }; 13429 } 13430 return { 13431 request(method, url, init) { 13432 return coreFetch(url, { 13433 ...init, 13434 method: method.toUpperCase() 13435 }); 13436 }, 13437 /** Call a GET endpoint */ 13438 GET(url, init) { 13439 return coreFetch(url, { 13440 ...init, 13441 method: "GET" 13442 }); 13443 }, 13444 /** Call a PUT endpoint */ 13445 PUT(url, init) { 13446 return coreFetch(url, { 13447 ...init, 13448 method: "PUT" 13449 }); 13450 }, 13451 /** Call a POST endpoint */ 13452 POST(url, init) { 13453 return coreFetch(url, { 13454 ...init, 13455 method: "POST" 13456 }); 13457 }, 13458 /** Call a DELETE endpoint */ 13459 DELETE(url, init) { 13460 return coreFetch(url, { 13461 ...init, 13462 method: "DELETE" 13463 }); 13464 }, 13465 /** Call a OPTIONS endpoint */ 13466 OPTIONS(url, init) { 13467 return coreFetch(url, { 13468 ...init, 13469 method: "OPTIONS" 13470 }); 13471 }, 13472 /** Call a HEAD endpoint */ 13473 HEAD(url, init) { 13474 return coreFetch(url, { 13475 ...init, 13476 method: "HEAD" 13477 }); 13478 }, 13479 /** Call a PATCH endpoint */ 13480 PATCH(url, init) { 13481 return coreFetch(url, { 13482 ...init, 13483 method: "PATCH" 13484 }); 13485 }, 13486 /** Call a TRACE endpoint */ 13487 TRACE(url, init) { 13488 return coreFetch(url, { 13489 ...init, 13490 method: "TRACE" 13491 }); 13492 }, 13493 /** Register middleware */ 13494 use(...middleware) { 13495 for (const m of middleware) { 13496 if (!m) continue; 13497 if (typeof m !== "object" || !("onRequest" in m || "onResponse" in m || "onError" in m)) throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`"); 13498 globalMiddlewares.push(m); 13499 } 13500 }, 13501 /** Unregister middleware */ 13502 eject(...middleware) { 13503 for (const m of middleware) { 13504 const i = globalMiddlewares.indexOf(m); 13505 if (i !== -1) globalMiddlewares.splice(i, 1); 13506 } 13507 } 13508 }; 13509 } 13510 function serializePrimitiveParam(name, value, options) { 13511 if (value === void 0 || value === null) return ""; 13512 if (typeof value === "object") throw new Error("Deeply-nested arrays/objects arenât supported. Provide your own `querySerializer()` to handle these."); 13513 return `${name}=${options?.allowReserved === true ? value : encodeURIComponent(value)}`; 13514 } 13515 function serializeObjectParam(name, value, options) { 13516 if (!value || typeof value !== "object") return ""; 13517 const values = []; 13518 const joiner = { 13519 simple: ",", 13520 label: ".", 13521 matrix: ";" 13522 }[options.style] || "&"; 13523 if (options.style !== "deepObject" && options.explode === false) { 13524 for (const k in value) values.push(k, options.allowReserved === true ? value[k] : encodeURIComponent(value[k])); 13525 const final2 = values.join(","); 13526 switch (options.style) { 13527 case "form": return `${name}=${final2}`; 13528 case "label": return `.${final2}`; 13529 case "matrix": return `;${name}=${final2}`; 13530 default: return final2; 13531 } 13532 } 13533 for (const k in value) { 13534 const finalName = options.style === "deepObject" ? `${name}[${k}]` : k; 13535 values.push(serializePrimitiveParam(finalName, value[k], options)); 13536 } 13537 const final = values.join(joiner); 13538 return options.style === "label" || options.style === "matrix" ? `${joiner}${final}
13538` : final; 13539 } 13540 function serializeArrayParam(name, value, options) { 13541 if (!Array.isArray(value)) return ""; 13542 if (options.explode === false) { 13543 const joiner2 = { 13544 form: ",", 13545 spaceDelimited: "%20", 13546 pipeDelimited: "|" 13547 }[options.style] || ","; 13548 const final = (options.allowReserved === true ? value : value.map((v) => encodeURIComponent(v))).join(joiner2); 13549 switch (options.style) { 13550 case "simple": return final; 13551 case "label": return `.${final}`; 13552 case "matrix": return `;${name}=${final}`; 13553 default: return `${name}=${final}`; 13554 } 13555 } 13556 const joiner = { 13557 simple: ",", 13558 label: ".", 13559 matrix: ";" 13560 }[options.style] || "&"; 13561 const values = []; 13562 for (const v of value) if (options.style === "simple" || options.style === "label") values.push(options.allowReserved === true ? v : encodeURIComponent(v)); 13563 else values.push(serializePrimitiveParam(name, v, options)); 13564 return options.style === "label" || options.style === "matrix" ? `${joiner}${values.join(joiner)}` : values.join(joiner); 13565 } 13566 function createQuerySerializer(options) { 13567 return function querySerializer(queryParams) { 13568 const search = []; 13569 if (queryParams && typeof queryParams === "object") for (const name in queryParams) { 13570 const value = queryParams[name]; 13571 if (value === void 0 || value === null) continue; 13572 if (Array.isArray(value)) { 13573 if (value.length === 0) continue; 13574 search.push(serializeArrayParam(name, value, { 13575 style: "form", 13576 explode: true, 13577 ...options?.array, 13578 allowReserved: options?.allowReserved || false 13579 })); 13580 continue; 13581 } 13582 if (typeof value === "object") { 13583 search.push(serializeObjectParam(name, value, { 13584 style: "deepObject", 13585 explode: true, 13586 ...options?.object, 13587 allowReserved: options?.allowReserved || false 13588 })); 13589 continue; 13590 } 13591 search.push(serializePrimitiveParam(name, value, options)); 13592 } 13593 return search.join("&"); 13594 }; 13595 } 13596 function defaultPathSerializer(pathname, pathParams) { 13597 let nextURL = pathname; 13598 for (const match of pathname.match(PATH_PARAM_RE) ?? []) { 13599 let name = match.substring(1, match.length - 1); 13600 let explode = false;
13601 let style = "simple"; 13602 if (name.endsWith("*")) { 13603 explode = true; 13604 name = name.substring(0, name.length - 1); 13605 } 13606 if (name.startsWith(".")) { 13607 style = "label"; 13608 name = name.substring(1); 13609 } else if (name.startsWith(";")) { 13610 style = "matrix"; 13611 name = name.substring(1); 13612 } 13613 if (!pathParams || pathParams[name] === void 0 || pathParams[name] === null) continue; 13614 const value = pathParams[name]; 13615 if (Array.isArray(value)) { 13616 nextURL = nextURL.replace(match, serializeArrayParam(name, value, { 13617 style, 13618 explode 13619 })); 13620 continue; 13621 } 13622 if (typeof value === "object") { 13623 nextURL = nextURL.replace(match, serializeObjectParam(name, value, { 13624 style, 13625 explode 13626 })); 13627 continue; 13628 } 13629 if (style === "matrix") { 13630 nextURL = nextURL.replace(match, `;${serializePrimitiveParam(name, value)}`); 13631 continue; 13632 } 13633 nextURL = nextURL.replace(match, style === "label" ? `.${encodeURIComponent(value)}` : encodeURIComponent(value)); 13634 } 13635 return nextURL; 13636 } 13637 function defaultBodySerializer(body, headers) { 13638 if (body instanceof FormData) return body; 13639 if (headers) { 13640 if ((headers.get instanceof Function ? headers.get("Content-Type") ?? headers.get("content-type") : headers["Content-Type"] ?? headers["content-type"]) === "application/x-www-form-urlencoded") return new URLSearchParams(body).toString(); 13641 } 13642 return JSON.stringify(body); 13643 } 13644 function createFinalURL(pathname, options) { 13645 let finalURL = `${options.baseUrl}${pathname}`; 13646 if (options.params?.path) finalURL = options.pathSerializer(finalURL, options.params.path); 13647 let search = options.querySerializer(options.params.query ?? {}); 13648 if (search.startsWith("?")) search = search.substring(1); 13649 if (search) finalURL += `?${search}`; 13650 return finalURL; 13651 } 13652 function mergeHeaders(...allHeaders) { 13653 const finalHeaders = new Headers(); 13654 for (const h of allHeaders) { 13655 if (!h || typeof h !== "object") continue; 13656 const iterator = h instanceof Headers ? h.entries() : Object.entries(h); 13657 for (const [k, v] of iterator) if (v === null) finalHeaders.delete(k); 13658 else if (Array.isArray(v)) for (const v2 of v) finalHeaders.append(k, v2); 13659 else if (v !== void 0) finalHeaders.set(k, v); 13660 } 13661 return finalHeaders; 13662 } 13663 function removeTrailingSlash(url) { 13664 if (url.endsWith("/")) return url.substring(0, url.length - 1); 13665 return url; 13666 } 13667 //#endregion 13668 //#region ../../packages/gomus-api/lib/client.ts 13669 function client(publicApiUrl, shopUrl) { 13670 return createClient({ 13671 baseUrl: publicApiUrl, 13672 headers: { "X-Shop-Url": shopUrl } 13673 }); 13674 } 13675 //#endregion 13676 //#region ../../packages/gomus-api/lib/order.ts 13677 function createOrder(client, headers, requestBody) { 13678 return ResultAsync.fromPromise(client.POST("/api/v4/orders", { 13679 params: { header: { 13680 "Access-Token": headers["access-token"], 13681 Client: headers["client"], 13682 Uid: headers["uid"], 13683 "X-Shop-Url": headers["X-Shop-Url"] 13684 } }, 13685 body: requestBody 13686 }), () => /* @__PURE__ */ new Error("Database error")).andThen(({ response, data, error }) => { 13687 if (error) return err(new Error(error.error)); 13688 else return ok({ ...data }); 13689 }); 13690 } 13691 //#endregion 13692 //#region ../../packages/gomus-api/lib/paypal/capture.ts 13693 function capturePaypalOrder(client, token, paypalOrderId) { 13694 const promise = client.POST("/api/v4/payments/paypal/capture/{orderToken}/{paypalOrderId}", { params: { path: { 13695 orderToken: token, 13696 paypalOrderId 13697 } } }); 13698 return ResultAsync.fromPromise(promise, () => /* @__PURE__ */ new Error("Database error")).andThen(({ response, data, error }) => { 13699 if (response.status >= 400) return err({ 13700 status: response.status, 13701 message: error 13702 }); 13703 else return ok({ ...data }); 13704 }); 13705 } 13706 //#endregion 13707 //#region ../../packages/gomus-api/lib/types.ts 13708 var CALENDAR_ENDPOINT = "/api/v4/calendar"; 13709 var TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar"; 13710 var VALIDATE_TOKEN_ENDPOINT = "/api/v4/auth/validate_token"; 13711 var TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas"; 13712 var TICKETS_ENDPOINT = "/api/v4/tickets"; 13713 var SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in"; 13714 var SIGN_UP_ENDPOINT = "/api/v4/auth"; 13715 var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals"; 13716 var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate"; 13717 var ORDERS_ENDPOINT = "/api/v4/orders"; 13718 //#endregion 13719 //#region ../../packages/gomus-api/lib/customerLevels.ts 13720 var CustomerLevels = { 13721 SHOP_GUEST: 10, 13722 SHOP: 20 13723 }; 13724 //#endregion 13725 //#region src/lib/stores/shop.svelte.ts 13726 var NOT_SIGNED_IN = { error: { 13727 success: false, 13728 errors: ["Not signed in"] 13729 } }; 13730 var Shop = class { 13731 type; 13732 #data = /* @__PURE__ */ state(proxy({ 13733 customerSalutations: [], 13734 countries: [], 13735 locales: [] 13736 })); 13737 #fetchStatus = {};
13738 constructor(apiUrl, shopDomain, locale, type = "angular") { 13739 this.type = type; 13740 if (apiUrl && shopDomain && locale) this.load(apiUrl, shopDomain, locale, type); 13741 } 13742 async load(apiUrl, shopDomain, locale, type = "angular") { 13743 if (apiUrl.includes("jmb-staging.gomus.de") || apiUrl.includes("jmb.gomus.de")) this.type = "jmb"; 13744 get$2(this.#data).urls = shopUrlProvider(this.type); 13745 get$2(this.#data).currentUser = getUserProvider(this.type); 13746 get$2(this.#data).apiUrl = apiUrl; 13747 get$2(this.#data).shopDomain = shopDomain; 13748 get$2(this.#data).locale = locale || "de"; 13749 this.#fetchStatus = {}; 13750 get$2(this.#data).client = client(apiUrl, shopDomain); 13751 get$2(this.#data).capacityManager = createCapacityManager(); 13752 get$2(this.#data).cart = createMainCart(); 13753 get$2(this.#data).auth = new Auth(); 13754 get$2(this.#data).client.use(new AuthMiddleware(this.auth)); 13755 await this.waitForAllFetches(this.shop); 13756 } 13757 get capacityManager() { 13758 if (!get$2(this.#data).capacityManager) get$2(this.#data).capacityManager = createCapacityManager(); 13759 return get$2(this.#data).capacityManager; 13760 } 13761 get cart() { 13762 return get$2(this.#data).cart; 13763 } 13764 get auth() { 13765 if (!get$2(this.#data).auth) get$2(this.#data).auth = new Auth(); 13766 return get$2(this.#data).auth; 13767 } 13768 get currentUser() { 13769 return get$2(this.#data).currentUser; 13770 } 13771 get slug() { 13772 return this.shopDomain?.match(/^(?:https?:\/\/)?([^.-]+)/)?.[1]; 13773 } 13774 get client() { 13775 return get$2(this.#data).client; 13776 } 13777 get name() { 13778 return this.shop?.name; 13779 } 13780 get config() { 13781 return this.shop?.config; 13782 } 13783 get payment_modes() { 13784 return this.shop?.payment_modes; 13785 } 13786 get content() { 13787 return this.shop?.content; 13788 } 13789 get settings() { 13790 return this.shop?.settings; 13791 } 13792 get donations() { 13793 return this.shop?.config.donations; 13794 } 13795 get translations() { 13796 return this.shop?.translations; 13797 } 13798 get currency() { 13799 return this.shop?.config.currency; 13800 } 13801 t(key, values) { 13802 return this.translate(key, values); 13803 } 13804 translate(key, values) { 13805 if (!this.translations?.[key]) return ""; 13806 let translatedString = this.translations[key]; 13807 if (values && translatedString) for (const [key, value] of Object.entries(values)) translatedString = translatedString.replace(`{{${key}}}`, value); 13808 return translatedString || ""; 13809 } 13810 get apiUrl() { 13811 return get$2(this.#data).apiUrl; 13812 } 13813 get shopDomain() { 13814 return get$2(this.#data).shopDomain; 13815 } 13816 get baseUrl() { 13817 return "https://" + this.shopDomain; 13818 } 13819 get locale() { 13820 return get$2(this.#data).locale; 13821 } 13822 get shop() { 13823 return this.fetchAndCache("/api/v4/shop", "shop", "shop"); 13824 } 13825 get _data() { 13826 return get$2(this.#data); 13827 } 13828 getCustomer() { 13829 if (!this.auth.data.accessToken) return NOT_SIGNED_IN; 13830 return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `getCustomer`, "", { cache: 5 }); 13831 } 13832 getOrders(params = {}) { 13833 if (!this.auth.data.accessToken) return NOT_SIGNED_IN; 13834 return this.fetchAndCache(ORDERS_ENDPOINT, `orders-${JSON.stringify(params)}`, "", { 13835 cache: 5, 13836 query: params 13837 }); 13838 } 13839 ticketsCalendar(params) { 13840 return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", { 13841 cache: 60, 13842 query: params 13843 }); 13844 } 13845 calendar(params) { 13846 return this.fetchAndCache(CALENDAR_ENDPOINT, `calendar-${JSON.stringify(params)}`, "data", { 13847 cache: 60, 13848 query: params 13849 }); 13850 } 13851 ticketsAndQuotas(params) { 13852 return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { 13853 cache: 60, 13854 query: assign$1({ per_page: 100 }, params ?? {}) 13855 }); 13856 } 13857 tickets(params) { 13858 return this.fetchAndCache(TICKETS_ENDPOINT, `tickets-${JSON.stringify(params)}`, "tickets", { 13859 cache: 60, 13860 query: assign$1({ per_page: 100 }, params ?? {}) 13861 }); 13862 } 13863 ticketsContent(ticketIds) { 13864 return this.fetchAndCache("/api/v4/tickets/content", `ticketsContent-${JSON.stringify(ticketIds)}`, "data", { 13865 cache: 300, 13866 query: assign$1({ "ticket_ids[]": ticketIds }, { per_page: 100 }) 13867 }); 13868 } 13869 signIn(params) { 13870 return this.apiPost(SIGN_IN_ENDPOINT, { 13871 body: params, 13872 requiredFields: ["email", "password"] 13873 }); 13874 } 13875 signUp(params, asGuest = false) { 13876 params = assign$1({ 13877 addr_addressat: "", 13878 addr_street: "n/a", 13879 addr_zip: "n/a", 13880 addr_city: "n/a", 13881 level: asGuest ? CustomerLevels.SHOP_GUEST : CustomerLevels.SHOP 13882 }, params); 13883 // Custom code hehehehe 13884 if (!params.name && asGuest) { 13885 params.name = "n/a"; 13886 } 13887 if (!params.surname && asGuest) { 13888 params.surname = "n/a"; 13889 } 13890 let requiredFields = [ 13891 "name", 13892 "surname", 13893 "email", 13894 "email_confirmation", 13895 "terms" 13896 ]; 13897 if (!asGuest) requiredFields.push("password", "password_confirmation"); 13898 return this.apiPost(SIGN_UP_ENDPOINT, { 13899 body: params, 13900 requiredFields 13901 }); 13902 } 13903 withdrawal(params) { 13904 const body = { 13905 ...params, 13906 order_id: String(params.order_id) 13907 }; 13908 if (!body.note) delete body.note; 13909 return this.apiPost(WITHDRAWAL_ENDPOINT, { 13910 body, 13911 requiredFields: [ 13912 "order_id", 13913 "first_name", 13914 "last_name", 13915 "email" 13916 ], 13917 parseAs: "text" 13918 }); 13919 } 13920 getDates(query) { 13921 return this.fetchAndCache("/api/v4/dates", `dates-${JSON.stringify(query)}`, "dates", { 13922 query: assign$1({ per_page: 100 }, query), 13923 cache: 60 13924 }); 13925 } 13926 updatePassword(params) { 13927 return this.apiPut("/api/v4/auth/password", { 13928 body: params, 13929 requiredFields: [ 13930 "current_password", 13931 "password", 13932 "password_confirmation" 13933 ] 13934 }); 13935 } 13936 passwordReset(params) { 13937 return this.apiPost("/api/v4/auth/password", { 13938 body: params, 13939 requiredFields: ["email"] 13940 }); 13941 } 13942 activateMembership(params) { 13943 return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, { 13944 body: params, 13945 requiredFields: ["email"], 13946 parseAs: "text" 13947 }); 13948 } 13949 checkout(params) { 13950 return this.apiPost(`/api/v4/orders`, { 13951 body: params, 13952 requiredFields: ["items", "total"] 13953 }); 13954 } 13955 #lastCart = null; 13956 async createCart(params) {
13957 const key = JSON.stringify({ 13958 items: params.items ?? [], 13959 coupons: params.coupons ?? [] 13960 }); 13961 if (this.#lastCart?.key === key) return this.#lastCart.result; 13962 const result = await this.apiPost(`/api/v4/cart`, { 13963 body: params, 13964 requiredFields: ["items"] 13965 }); 13966 this.#lastCart = { 13967 key, 13968 result 13969 }; 13970 return result; 13971 } 13972 order(token) { 13973 return this.fetchAndCache("/api/v4/orders/{id}", `order-${token}`, "order", { path: { id: token } }); 13974 } 13975 annualOrder(token) { 13976 return this.fetchAndCache("/api/v4/annual/order", `annual-order-${token}`, "order", { query: { token } }); 13977 } 13978 finalizePersonalizations(token, params) { 13979 return this.apiPost("/api/v4/annual/personalization/finalize", { 13980 body: params, 13981 params: { query: { token } } 13982 }); 13983 } 13984 uploadPersonalizationPhoto(token, personalizationId, file) { 13985 const fd = new FormData(); 13986 fd.append("file", file); 13987 return this.apiUpload("/api/v4/annual/personalizations/{id}/upload", { 13988 body: fd, 13989 params: { 13990 path: { id: personalizationId }, 13991 query: { token } 13992 } 13993 }); 13994 } 13995 /** 13996 * Returns a reactive value that will contain the fetched data, no need to await. 13997 * 13998 * @param {`/api${string}`} endpoint - The API endpoint to fetch data from. Must start with `/api`. 13999 * @param {string} dataKey - The key where the fetched data will be stored in `shop.#data`. 14000 * @param {string} responseKey - The key in the API response that contains the desired data. 14001 * @param [options] 14002 * - query: A record of query parameters to include in the API request. 14003 * - cache: The cache duration (in seconds) before data is considered expired. Defaults to 1000 seconds if not provided. 14004 * @return {T} The data fetched from the API or the cached data if it is still valid. 14005 */ 14006 fetchAndCache(endpoint, dataKey, responseKey, options) { 14007 options ??= {}; 14008 options.query ??= {}; 14009 options.cache ??= 1e3; 14010 options.path ??= {}; 14011 if (!this.#canFetch()) { 14012 console.warn("(fetchAndCache) Couldn't fetch, Shop not loaded!"); 14013 return get$2(this.#data)[dataKey]; 14014 } 14015 const query = options.query; 14016 const fetchId = endpoint + JSON.stringify(query); 14017 const isNotFetchedYet = !this.#fetchStatus[fetchId]; 14018 const isCacheExpired = this.#fetchStatus[fetchId]?.fetchedAt < Date.now() - options.cache * 1e3; 14019 if (isNotFetchedYet || isCacheExpired) this.apiGet(endpoint, query, options.path).then((ret) => { 14020 if (ret) get$2(this.#data)[dataKey] = responseKey === "" ? ret : ret[responseKey]; 14021 }); 14022 return get$2(this.#data)[dataKey]; 14023 } 14024 get museums() { 14025 return this.fetchAndCache("/api/v4/museums", "museums", "museums", { query: { per_page: 100 } }); 14026 } 14027 get exhibitions() { 14028 return this.fetchAndCache("/api/v4/exhibitions", "exhibitions", "exhibitions", { query: { per_page: 100 } }); 14029 } 14030 getEvent(id) { 14031 return this.fetchAndCache(`/api/v4/events/${id}`, `single_event_${id}`, "event"); 14032 } 14033 getTicketCapacities(date, ticketIds) { 14034 return this.apiPost(`/api/v4/tickets/capacities`, { 14035 body: { 14036 date, 14037 ticket_ids: ticketIds 14038 }, 14039 requiredFields: ["date", "ticket_ids"] 14040 }); 14041 } 14042 getCouponSaleByBarcode(token) { 14043 return this.fetchAndCache(`/api/v4/coupon_sales/barcode/${token}`, `coupon_sale_barcode_${token}`, "coupon_sale"); 14044 } 14045 getCoupons() { 14046 return this.fetchAndCache("/api/v4/coupons", "coupons", "coupons", { query: { 14047 online_available: true, 14048 per_page: 100 14049 } }); 14050 } 14051 getEventDetailsOnDate(eventId, dateId) { 14052 return this.fetchAndCache(`/api/v4/events/${eventId}/dates/${dateId}`, `/api/v4/events/${eventId}/dates/${dateId}`, "date"); 14053 } 14054 get events() { 14055 return this.fetchAndCache("/api/v4/events", "events", "events", { query: { per_page: 100 } }); 14056 } 14057 get upcomingEvents() { 14058 return this.fetchAndCache("/api/v4/events", "events", "events", { query: { 14059 by_bookable: true, 14060 with_bookings_in_future: 1, 14061 per_page: 100 14062 } }); 14063 } 14064 get tours() { 14065 return this.fetchAndCache("/api/v4/tours", "tours", "tours", { query: { per_page: 100 } }); 14066 } 14067 get merchandises() { 14068 return this.fetchAndCache("/api/v4/merchandises", "merchandises", "merchandises", { query: { per_page: 100 } }); 14069 } 14070 get customerSalutations() { 14071 return this.fetchAndCache("/api/v3/customer_salutations", "customerSalutations", "customer_salutations"); 14072 } 14073 get countries() { 14074 return this.fetchAndCache("/api/v3/countries", "countries", "countries", { query: { per_page: 100 } }); 14075 } 14076 get locales() { 14077 return this.fetchAndCache("/api/v4/locales", "locales", "locales_options"); 14078 } 14079 get urls() { 14080 return get$2(this.#data).urls; 14081 } 14082 get #defaultApiParams() { 14083 return { params: { 14084 query: { locale: this.locale }, 14085 header: { "X-Shop-Url": this.shopDomain } 14086 } }; 14087 } 14088 /** 14089 * Sends a POST request to the specified API endpoint. 14090 * 14091 * @param {string} path - The API endpoint path to make the POST request. 14092 * @param {Object} options - The options for the POST request. 14093 * @param {Record<string, any>} options.body - The body of the POST request, containing the data to be sent. 14094 * @param {Record<string, unknown>} [options.params] - Optional query parameters to include in the request. 14095 * @param {string[]} [options.requiredFields] - Optional list of required field names to validate in the body. 14096 * @return {Promise<T>} A promise that resolves with the typed response of the POST request. 14097 */ 14098 async apiPost(path, options) { 14099 return this.apiCall(path, { 14100 method: "POST", 14101 ...options 14102 }); 14103 } 14104 async apiPut(path, options) { 14105 return this.apiCall(path, { 14106 method: "PUT", 14107 ...options 14108 }); 14109 } 14110 async apiDELETE(path, options) { 14111 return this.apiCall(path, { 14112 method: "DELETE", 14113 ...options 14114 }); 14115 } 14116 async apiUpload(path, options) { 14117 this.#ensureApi(); 14118 const { body, params = {} } = options; 14119 return await this.client.POST(path, { 14120 body, 14121 params: assign$1(this.#defaultApiParams, { params }).params, 14122 bodySerializer: (b) => b 14123 }); 14124 } 14125 async apiCall(path, options) { 14126 this.#ensureApi(); 14127 const { body, params = {}, requiredFields, parseAs } = options; 14128 const validationErrors = validateApiPostBody(body, requiredFields);
14129 if (Object.keys(validationErrors).length > 0) return { error: { errors: validationErrors } }; 14130 const httpMethod = this.client[options.method]; 14131 return await httpMethod(path, { 14132 body, 14133 params: assign$1(this.#defaultApiParams, { params }).params, 14134 parseAs 14135 }); 14136 } 14137 /** 14138 * Executes the provided method asynchronously, waits for all dependent fetch operations to complete, 14139 * and returns the result of the method execution. 14140 */ 14141 async asyncFetch(method) { 14142 await this.waitForAllFetches(method()); 14143 return method(); 14144 } 14145 async waitForAllFetches(...variables) { 14146 while (Object.values(this.#fetchStatus).filter((f) => f.status === "fetching").length) await wait(10); 14147 } 14148 async apiGet(path, query = {}, pathOptions) { 14149 this.#ensureApi(); 14150 const fetchId = path + JSON.stringify(query); 14151 this.#fetchStatus[fetchId] = { 14152 status: "fetching", 14153 fetchedAt: Date.now() 14154 }; 14155 let params = this.#defaultApiParams; 14156 if (query) params = assign$1(params, { params: { query } }); 14157 if (path) params = assign$1(params, { params: { path: pathOptions } }); 14158 const ret = await this.client.GET(path, params); 14159 this.#fetchStatus[fetchId] = { 14160 status: "completed", 14161 fetchedAt: Date.now() 14162 }; 14163 return ret.data || ret; 14164 } 14165 #canFetch = () => { 14166 return this.apiUrl !== void 0 && this.shopDomain !== void 0 && this.locale !== void 0 && this.client !== void 0; 14167 }; 14168 #ensureApi = () => { 14169 if (this.apiUrl === void 0) throw new Error("Public API URL is not set"); 14170 if (this.shopDomain === void 0) throw new Error("Shop Domain (X-Shop-Url) is not set"); 14171 if (this.locale === void 0) throw new Error("Locale is not set"); 14172 if (this.client === void 0) throw new Error("client is not set"); 14173 if (!this.#canFetch()) throw new Error("Fetch is not possible."); 14174 }; 14175 }; 14176 var shop = new Shop(); 14177 //#endregion 14178 //#region src/components/mainnav/lib/generators/labelGenerators.ts 14179 var labelGenerators = { "label:museum": museumLabel }; 14180 function museumLabel(id) { 14181 return shop.museums?.find((m) => m.id == id)?.title || `Museum not found: ${id}`; 14182 } 14183 //#endregion 14184 //#region src/components/mainnav/lib/generators/subNavGenerators.ts 14185 function createSubNavGenerator(options) { 14186 return (count) => { 14187 if (!options.items) return []; 14188 count ??= options.items.length; 14189 const selected = options.items.slice(0, count).map((e) => ({ 14190 label: e.title, 14191 url: options.urlItemFn(e.id) 14192 })); 14193 if (count >= options.items.length) return selected; 14194 return [ 14195 ...selected, 14196 "divider", 14197 { 14198 label: shop.t("header.dropdown.links.viewAll", { 14199 count: options.items.length, 14200 title: shop.t(`header.dropdown.titles.${options.titleKey}`) 14201 }), 14202 url: options.urlAllFn() 14203 } 14204 ]; 14205 }; 14206 } 14207 var museumsSubnavGenerator = (count) => createSubNavGenerator({ 14208 items: shop.museums, 14209 urlItemFn: shop.urls.museum, 14210 urlAllFn: shop.urls.museums, 14211 titleKey: "museums" 14212 })(count); 14213 var exhibitionsSubnavGenerator = (count) => createSubNavGenerator({ 14214 items: shop.exhibitions, 14215 urlItemFn: shop.urls.exhibition, 14216 urlAllFn: shop.urls.exhibitions, 14217 titleKey: "exhibitions" 14218 })(count); 14219 var eventsSubnavGenerator = (count) => createSubNavGenerator({ 14220 items: shop.upcomingEvents, 14221 urlItemFn: shop.urls.event, 14222 urlAllFn: shop.urls.events, 14223 titleKey: "events" 14224 })(count); 14225 var toursSubnavGenerator = (count) => createSubNavGenerator({ 14226 items: shop.tours?.filter((t) => t.bookable), 14227 urlItemFn: shop.urls.tour, 14228 urlAllFn: shop.urls.tours, 14229 titleKey: "tours" 14230 })(count); 14231 var merchandisesSubnavGenerator = (count) => createSubNavGenerator({ 14232 items: shop.merchandises, 14233 urlItemFn: shop.urls.merchandise, 14234 urlAllFn: shop.urls.merchandises, 14235 titleKey: "merchandises" 14236 })(count); 14237 var subNavGenerators = { 14238 "subnav:museums": museumsSubnavGenerator, 14239 "subnav:exhibitions": exhibitionsSubnavGenerator 14240 }; 14241 //#endregion 14242 //#region src/components/mainnav/lib/generators/navGenerators.ts 14243 var navGenerators = { 14244 annual_tickets: () => { 14245 return { 14246 label: "annualTickets", 14247 url: "url:annual_tickets", 14248 navId: "annualTickets" 14249 }; 14250 }, 14251 combi_tickets: (group) => group ? { 14252 label: "combi." + group, 14253 url: `url:combi_ticket_group(${group})`, 14254 navId: "combiTickets" 14255 } : { 14256 label: "combi", 14257 url: "url:combi_tickets", 14258 navId: "combiTickets" 14259 }, 14260 coupons: () => ({ 14261 label: "coupons", 14262 url: "url:coupons", 14263 navId: "coupons" 14264 }), 14265 events: singleOrSubnav("events", "url:events", eventsSubnavGenerator), 14266 exhibitions: singleOrSubnav("exhibitions", "url:exhibitions", exhibitionsSubnavGenerator), 14267 event_group: (id) => ({ 14268 label: "events_group" + id, 14269 url: `url:event_group(${id})`, 14270 navId: "eventsGroup" 14271 }), 14272 home: (url) => url ? { 14273 label: "icon:home", 14274 url, 14275 navId: "home" 14276 } : { 14277 label: "icon:home", 14278 url: "url:home", 14279 navId: "home" 14280 }, 14281 museums: singleOrSubnav("museums", "url:museums", museumsSubnavGenerator), 14282 tour_group: (id) => ({ 14283 label: "tours_group" + id, 14284 url: `url:tours_group(${id})`, 14285 navId: "toursGroup" 14286 }), 14287 tours: singleOrSubnav("tours", "url:tours", toursSubnavGenerator), 14288 merchandises: singleOrSubnav("merchandise", "url:merchandises", merchandisesSubnavGenerator), 14289 tickets: (group) => group ? { 14290 label: "tickets", 14291 url: `url:ticket_group(${group})`, 14292 navId: "tickets" 14293 } : { 14294 label: "tickets", 14295 url: "url:tickets", 14296 navId: "tickets" 14297 } 14298 }; 14299 /** 14300 * Determines and returns either a single navigation object or a sub-navigation object based on the given count. 14301 * 14302 * @param {string} label - The label for the navigation product. 14303 * @param {string} singleUrl - The URL to use for the single navigation product when count is 0. 14304 * @param {Function} subnavGenerator - A function that generates sub-navigation items based on the given count. 14305 * @return {Function} A function that takes a count (number) and returns an object representing either a single navigation link or a sub-navigation structure. 14306 */ 14307 function singleOrSubnav(label, singleUrl, subnavGenerator) { 14308 return (count) => count === 0 ? { 14309 label, 14310 url: singleUrl, 14311 navId: label 14312 } : { 14313 label, 14314 parentUrl: singleUrl, 14315 items: subnavGenerator(count), 14316 navId: label 14317 }; 14318 } 14319 Object.entries(shop.urls || {}).reduce((acc, [key, value]) => ({ 14320 ...acc, 14321 [`url:${key.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase()}`]: (...args) => value(args) 14322 }), {}); 14323 function generateUrl(key, ...args) { 14324 const camelCaseKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()); 14325 return shop.urls?.[camelCaseKey]?.(...args) || key; 14326 } 14327 //#endregion 14328 //#region src/components/mainnav/lib/generators/generate.ts 14329 function generate(type, expression) { 14330 const args = extractArgs(expression); 14331 const command = extractCommand(expression); 14332 if (type === "url") return generateUrl(command.replace("url:", ""), ...args); 14333 const generators = { 14334 subnav: subNavGenerators, 14335 label: labelGenerators, 14336 nav: navGenerators 14337 }[type]; 14338 const funcName = Object.keys(generators).find((k) => extractCommand(k) === command); 14339 if (!funcName) return type === "label" ? mainNavTranslate(expression) : expression; 14340 const func = generators[funcName]; 14341 return func(...args); 14342 } 14343 function extractArgs(expression) { 14344 const match = expression.match(/\w+\(([^)]*)\)/); 14345 if (!match) return []; 14346 return match[1].split(",").map((arg) => arg.trim()).filter((arg) => arg.length > 0).map((arg) => { 14347 const num = parseInt(arg); 14348 return !isNaN(num) ? num : arg; 14349 }); 14350 } 14351 function extractCommand(expression) { 14352 return expression.split("(")[0]; 14353 }
14354 function mainNavTranslate(key) { 14355 return shop.t("header.dropdown.titles." + key) || shop.t(key) || key; 14356 } 14357 //#endregion 14358 //#region src/components/mainnav/lib/navigation.ts 14359 function isNavItem(entry) { 14360 return typeof entry === "object" && "label" in entry && "url" in entry && typeof entry.label === "string" && typeof entry.url === "string"; 14361 } 14362 function isGenericNavItem(entry) { 14363 return typeof entry === "object" && "url" in entry && typeof entry.url === "string" && !("items" in entry); 14364 } 14365 function isNavDivider(entry) { 14366 return entry === "divider"; 14367 } 14368 function isSingleNavEntry(entry) { 14369 return isGenericNavItem(entry) || isNavDivider(entry); 14370 } 14371 function isGenerator(value) { 14372 return [ 14373 "url", 14374 "label", 14375 "subnav" 14376 ].includes(value.toString().split(":")[0]); 14377 } 14378 function generateNavEntry(item) { 14379 if (isNavDivider(item)) return item; 14380 if (typeof item === "string") { 14381 const generated = generate("nav", item); 14382 return generated !== item ? generateNavEntry(generated) : generated; 14383 } 14384 if (isGenericNavItem(item)) return { 14385 label: generate("label", item.label), 14386 url: generate("url", item.url), 14387 navId: item.navId || "unknown" 14388 }; 14389 return { 14390 label: generate("label", item.label), 14391 parentUrl: generate("url", item.parentUrl), 14392 items: isGenerator(item.items) ? generate("subnav", item.items) : item.items.map((i) => generateNavEntry(i)) 14393 }; 14394 } 14395 function generateNavigation(settings) { 14396 return (settings || []).map((s) => generateNavEntry(s)); 14397 } 14398 //#endregion 14399 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/internal/flags/legacy.js 14400 enable_legacy_mode_flag(); 14401 //#endregion 14402 //#region src/components/mainnav/components/Devider.svelte 14403 var root$76 = /* @__PURE__ */ from_html(`<li class="divider"></li>`); 14404 function Devider($$anchor) { 14405 append($$anchor, root$76()); 14406 } 14407 create_custom_element(Devider, {}, [], [], { mode: "open" }); 14408 //#endregion 14409 //#region src/components/mainnav/lib/states/OpenedDropdown.svelte.ts 14410 var OpenedDropdown = class { 14411 #id = /* @__PURE__ */ state(-1); 14412 get id() { 14413 return get$2(this.#id); 14414 } 14415 set id(value) { 14416 set(this.#id, value, true); 14417 } 14418 isOpen(id) { 14419 return this.id === id; 14420 } 14421 toggle(id) { 14422 if (this.id === id) this.id = void 0; 14423 else this.id = id; 14424 } 14425 close() { 14426 this.id = void 0; 14427 } 14428 }; 14429 function outsideClicksHandler() { 14430 const openedDropdown = getOpenedDropdown(); 14431 return (element) => handleOutsideClicks(element, openedDropdown); 14432 } 14433 /** 14434 * Sets up a click handler that closes dropdowns when clicking outside of them 14435 */ 14436 function handleOutsideClicks(element, openedDropdown) { 14437 function handleClick(event) { 14438 if (!event.composedPath().includes(element)) openedDropdown.id = void 0; 14439 } 14440 document.addEventListener("click", handleClick); 14441 return { destroy() { 14442 document.removeEventListener("click", handleClick); 14443 } }; 14444 } 14445 var KEY$7 = Symbol("Opened Dropdown"); 14446 function setOpenedDropdown() { 14447 return setContext(KEY$7, new OpenedDropdown()); 14448 } 14449 function getOpenedDropdown() { 14450 return getContext(KEY$7); 14451 } 14452 //#endregion 14453 //#region src/components/mainnav/lib/states/pageState.svelte.ts 14454 var PageState = class { 14455 #currentPage = /* @__PURE__ */ state(""); 14456 get currentPage() { 14457 return get$2(this.#currentPage); 14458 } 14459 set currentPage(value) { 14460 set(this.#currentPage, value, true); 14461 } 14462 isActivePage(currentUrl, entry) { 14463 if (entry === "divider") return false; 14464 const hasNavId = (navId) => () => !!entry.navId && entry.navId === navId; 14465 return { 14466 "shop.tickets.filters": hasNavId("tickets"), 14467 "shop.tickets.annual": hasNavId("annualTickets"), 14468 "shop.tickets.combi": hasNavId("combiTickets"), 14469 "shop.museums": hasNavId("museums"), 14470 "shop.products.events": hasNavId("events"), 14471 "shop.tours": hasNavId("tours"), 14472 "shop.exhibitions": hasNavId("exhibitions"), 14473 "shop.merchandise.list": hasNavId("merchandise"), 14474 "shop.coupons": hasNavId("coupons"), 14475 "shop.products.publicTours": () => entry.label === mainNavTranslate("publicTours"), 14476 "shop.start": hasNavId("home"), 14477 "": () => false 14478 }[this.currentPage || ""]?.() ?? false; 14479 } 14480 }; 14481 var KEY$6 = Symbol("pageState"); 14482 function setPageState() { 14483 return setContext(KEY$6, new PageState()); 14484 } 14485 function getPageState() { 14486 return getContext(KEY$6); 14487 } 14488 //#endregion 14489 //#region src/components/mainnav/components/Link.svelte 14490 var rest_excludes$26 = new Set([ 14491 "$$slots", 14492 "$$events", 14493 "$$legacy", 14494 "$$host", 14495 "entry" 14496 ]); 14497 var root$75 = /* @__PURE__ */ from_html(`<a><!></a>`); 14498 function Link$1($$anchor, $$props) { 14499 push($$props, true); 14500 let entry = prop($$props, "entry", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$26); 14501 let openedDropdown = getOpenedDropdown(); 14502 let isActive = /* @__PURE__ */ user_derived(() => getPageState().isActivePage(window.location.href, entry())); 14503 var $$exports = { 14504 get entry() { 14505 return entry(); 14506 }, 14507 set entry($$value) { 14508 entry($$value); 14509 flushSync(); 14510 } 14511 }; 14512 var a = root$75(); 14513 attribute_effect(a, () => ({ 14514 href: entry().url, 14515 onclick: openedDropdown.close, 14516 "ui-sref-opts": "{inherit: false, reload: true}", 14517 ...restProps, 14518 [CLASS]: { active: get$2(isActive) } 14519 })); 14520 slot(child(a), $$props, "default", {}, null); 14521 reset(a); 14522 append($$anchor, a); 14523 return pop($$exports); 14524 }
14525 create_custom_element(Link$1, { entry: {} }, ["default"], [], { mode: "open" }); 14526 //#endregion 14527 //#region src/components/mainnav/components/Home.svelte 14528 var root$74 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="fa fa-home"></span>`); 14529 var root_1$25 = /* @__PURE__ */ from_html(`<li><!></li>`); 14530 function Home($$anchor, $$props) { 14531 push($$props, true); 14532 let entry = prop($$props, "entry", 7); 14533 var $$exports = { 14534 get entry() { 14535 return entry(); 14536 }, 14537 set entry($$value) { 14538 entry($$value); 14539 flushSync(); 14540 } 14541 }; 14542 var li = root_1$25(); 14543 Link$1(child(li), { 14544 get entry() { 14545 return entry(); 14546 }, 14547 "aria-label": "Home", 14548 children: ($$anchor, $$slotProps) => { 14549 append($$anchor, root$74()); 14550 }, 14551 $$slots: { default: true } 14552 }); 14553 reset(li); 14554 append($$anchor, li); 14555 return pop($$exports); 14556 } 14557 create_custom_element(Home, { entry: {} }, [], [], { mode: "open" }); 14558 //#endregion 14559 //#region src/components/mainnav/components/NavLink.svelte 14560 var root$73 = /* @__PURE__ */ from_html(`<li><!></li>`); 14561 function NavLink($$anchor, $$props) { 14562 push($$props, true); 14563 let entry = prop($$props, "entry", 7); 14564 var $$exports = { 14565 get entry() { 14566 return entry(); 14567 }, 14568 set entry($$value) { 14569 entry($$value); 14570 flushSync(); 14571 } 14572 }; 14573 var li = root$73(); 14574 Link$1(child(li), { 14575 get entry() { 14576 return entry(); 14577 }, 14578 children: ($$anchor, $$slotProps) => { 14579 next(); 14580 var text = text$1(); 14581 template_effect(() => set_text(text, entry().label)); 14582 append($$anchor, text); 14583 }, 14584 $$slots: { default: true } 14585 }); 14586 reset(li); 14587 append($$anchor, li); 14588 return pop($$exports); 14589 } 14590 create_custom_element(NavLink, { entry: {} }, [], [], { mode: "open" }); 14591 //#endregion 14592 //#region src/components/mainnav/components/SingleNavEntry.svelte 14593 function SingleNavEntry($$anchor, $$props) { 14594 push($$props, true); 14595 let entry = prop($$props, "entry", 7); 14596 var $$exports = { 14597 get entry() { 14598 return entry(); 14599 }, 14600 set entry($$value) { 14601 entry($$value); 14602 flushSync(); 14603 } 14604 }; 14605 var fragment = comment(); 14606 var node = first_child(fragment); 14607 var consequent = ($$anchor) => { 14608 Devider($$anchor, {}); 14609 }; 14610 var d = /* @__PURE__ */ user_derived(() => isNavDivider(entry())); 14611 var consequent_2 = ($$anchor) => { 14612 var fragment_2 = comment(); 14613 var node_1 = first_child(fragment_2); 14614 var consequent_1 = ($$anchor) => { 14615 Home($$anchor, { get entry() { 14616 return entry(); 14617 } }); 14618 }; 14619 var alternate = ($$anchor) => { 14620 NavLink($$anchor, { get entry() { 14621 return entry(); 14622 } }); 14623 }; 14624 if_block(node_1, ($$render) => { 14625 if (entry().label === "icon:home") $$render(consequent_1); 14626 else $$render(alternate, -1); 14627 }); 14628 append($$anchor, fragment_2); 14629 }; 14630 var d_1 = /* @__PURE__ */ user_derived(() => isGenericNavItem(entry())); 14631 if_block(node, ($$render) => { 14632 if (get$2(d)) $$render(consequent); 14633 else if (get$2(d_1)) $$render(consequent_2, 1); 14634 }); 14635 append($$anchor, fragment); 14636 return pop($$exports); 14637 } 14638 create_custom_element(SingleNavEntry, { entry: {} }, [], [], { mode: "open" }); 14639 //#endregion 14640 //#region src/components/mainnav/components/DropDown.svelte 14641 var root$72 = /* @__PURE__ */ from_html(`<li><a href="javascript:void(0);" uib-dropdown-toggle=""><span> </span> <span aria-hidden="true" class="fa fa-caret-down svelte-zpynht"></span></a> <ul class="dropdown-menu"></ul></li>`); 14642 var $$css$6 = { 14643 hash: "svelte-zpynht", 14644 code: ".fa.svelte-zpynht {transition:transform 0.2s ease-in-out;}.open.svelte-zpynht .fa:where(.svelte-zpynht) {transform:rotate(180deg);}" 14645 }; 14646 function DropDown($$anchor, $$props) { 14647 push($$props, true); 14648 append_styles$1($$anchor, $$css$6); 14649 let entry = prop($$props, "entry", 7), id = prop($$props, "id", 7); 14650 let openedDropdown = getOpenedDropdown(); 14651 let isOpen = /* @__PURE__ */ user_derived(() => openedDropdown.isOpen(id())); 14652 let isActive = /* @__PURE__ */ user_derived(() => getPageState().isActivePage(window.location.href, entry())); 14653 var $$exports = { 14654 get entry() { 14655 return entry(); 14656 }, 14657 set entry($$value) { 14658 entry($$value); 14659 flushSync(); 14660 }, 14661 get id() { 14662 return id(); 14663 }, 14664 set id($$value) { 14665 id($$value); 14666 flushSync(); 14667 } 14668 }; 14669 var li = root$72(); 14670 let classes; 14671 var a = child(li); 14672 let classes_1; 14673 var span = child(a); 14674 var text = child(span, true); 14675 reset(span); 14676 next(2); 14677 reset(a); 14678 var ul = sibling(a, 2); 14679 each(ul, 21, () => entry().items, index$1, ($$anchor, subEntry) => { 14680 SingleNavEntry($$anchor, { get entry() { 14681 return get$2(subEntry); 14682 } }); 14683 }); 14684 reset(ul); 14685 reset(li); 14686 template_effect(() => { 14687 classes = set_class(li, 1, "dropdown svelte-zpynht", null, classes, { open: get$2(isOpen) }); 14688 classes_1 = set_class(a, 1, "dropdown-toggle", null, classes_1, { active: get$2(isActive) }); 14689 set_attribute(a, "aria-expanded", get$2(isOpen)); 14690 set_text(text, entry().label); 14691 }); 14692 delegated("click", a, () => openedDropdown.toggle(id())); 14693 append($$anchor, li); 14694 return pop($$exports); 14695 } 14696 delegate(["click"]);
14697 create_custom_element(DropDown, { 14698 entry: {}, 14699 id: {} 14700 }, [], [], { mode: "open" }); 14701 //#endregion 14702 //#region src/components/mainnav/components/MainNav.svelte 14703 var root$71 = /* @__PURE__ */ from_html(`<ul class="nav navbar-nav hidden-xs"></ul>`); 14704 var root_1$24 = /* @__PURE__ */ from_html(`<ul class="nav navbar-nav"></ul>`); 14705 function MainNav($$anchor, $$props) { 14706 push($$props, true); 14707 let nav = prop($$props, "nav", 7), mobile = prop($$props, "mobile", 7), expandMobileSubnavs = prop($$props, "expandMobileSubnavs", 7), currentPage = prop($$props, "currentPage", 7); 14708 mobile(mobile() ?? false); 14709 expandMobileSubnavs(expandMobileSubnavs() ?? false); 14710 const mobileNav = /* @__PURE__ */ user_derived(() => [...nav().filter((e) => !(isNavItem(e) && e.label === "icon:home")), "divider"]); 14711 setOpenedDropdown(); 14712 setPageState(); 14713 const clickHandler = outsideClicksHandler(); 14714 user_effect(() => { 14715 getPageState().currentPage = currentPage(); 14716 }); 14717 var $$exports = { 14718 get nav() { 14719 return nav(); 14720 }, 14721 set nav($$value) { 14722 nav($$value); 14723 flushSync(); 14724 }, 14725 get mobile() { 14726 return mobile(); 14727 }, 14728 set mobile($$value) { 14729 mobile($$value); 14730 flushSync(); 14731 }, 14732 get expandMobileSubnavs() { 14733 return expandMobileSubnavs(); 14734 }, 14735 set expandMobileSubnavs($$value) { 14736 expandMobileSubnavs($$value); 14737 flushSync(); 14738 }, 14739 get currentPage() { 14740 return currentPage(); 14741 }, 14742 set currentPage($$value) { 14743 currentPage($$value); 14744 flushSync(); 14745 } 14746 }; 14747 var fragment = comment(); 14748 var node = first_child(fragment); 14749 var consequent_2 = ($$anchor) => { 14750 var ul = root$71(); 14751 each(ul, 21, nav, index$1, ($$anchor, entry, index) => { 14752 var fragment_1 = comment();
14753 var node_1 = first_child(fragment_1); 14754 var consequent = ($$anchor) => { 14755 SingleNavEntry($$anchor, { get entry() { 14756 return get$2(entry); 14757 } }); 14758 }; 14759 var d = /* @__PURE__ */ user_derived(() => isSingleNavEntry(get$2(entry))); 14760 var consequent_1 = ($$anchor) => { 14761 DropDown($$anchor, { 14762 get entry() { 14763 return get$2(entry); 14764 }, 14765 id: index 14766 }); 14767 }; 14768 var alternate = ($$anchor) => { 14769 { 14770 let $0 = /* @__PURE__ */ user_derived(() => ({ 14771 label: get$2(entry).label, 14772 url: get$2(entry).parentUrl 14773 })); 14774 NavLink($$anchor, { get entry() { 14775 return get$2($0); 14776 } }); 14777 } 14778 }; 14779 if_block(node_1, ($$render) => { 14780 if (get$2(d)) $$render(consequent); 14781 else if (get$2(entry).items?.length > 0) $$render(consequent_1, 1); 14782 else $$render(alternate, -1); 14783 }); 14784 append($$anchor, fragment_1); 14785 }); 14786 reset(ul); 14787 action(ul, ($$node) => clickHandler?.($$node)); 14788 append($$anchor, ul); 14789 }; 14790 var alternate_2 = ($$anchor) => { 14791 var ul_1 = root_1$24(); 14792 each(ul_1, 21, () => get$2(mobileNav), index$1, ($$anchor, entry, index) => { 14793 var fragment_5 = comment(); 14794 var node_2 = first_child(fragment_5); 14795 var consequent_3 = ($$anchor) => { 14796 SingleNavEntry($$anchor, { get entry() { 14797 return get$2(entry); 14798 } }); 14799 }; 14800 var d_1 = /* @__PURE__ */ user_derived(() => isSingleNavEntry(get$2(entry))); 14801 var consequent_4 = ($$anchor) => { 14802 DropDown($$anchor, { 14803 get entry() { 14804 return get$2(entry); 14805 }, 14806 id: index 14807 }); 14808 }; 14809 var alternate_1 = ($$anchor) => { 14810 { 14811 let $0 = /* @__PURE__ */ user_derived(() => ({ 14812 label: get$2(entry).label, 14813 url: get$2(entry).parentUrl 14814 })); 14815 NavLink($$anchor, { get entry() { 14816 return get$2($0); 14817 } }); 14818 } 14819 }; 14820 if_block(node_2, ($$render) => { 14821 if (get$2(d_1)) $$render(consequent_3); 14822 else if (expandMobileSubnavs() && get$2(entry).items?.length > 0) $$render(consequent_4, 1); 14823 else $$render(alternate_1, -1); 14824 }); 14825 append($$anchor, fragment_5); 14826 }); 14827 reset(ul_1); 14828 append($$anchor, ul_1); 14829 }; 14830 if_block(node, ($$render) => { 14831 if (!mobile()) $$render(consequent_2); 14832 else $$render(alternate_2, -1); 14833 }); 14834 append($$anchor, fragment); 14835 return pop($$exports); 14836 } 14837 create_custom_element(MainNav, { 14838 nav: {}, 14839 mobile: {}, 14840 expandMobileSubnavs: {}, 14841 currentPage: {} 14842 }, [], [], { mode: "open" }); 14843 //#endregion 14844 //#region src/lib/Log.svelte 14845 var root$70 = /* @__PURE__ */ from_html(`<label class="svelte-1qd449h"> </label>`); 14846 var root_1$23 = /* @__PURE__ */ from_html(`<div class="svelte-1qd449h"><!> <pre><!> 14847 </pre></div>`); 14848 var $$css$5 = { 14849 hash: "svelte-1qd449h", 14850 code: "div.svelte-1qd449h {display:grid;}label.svelte-1qd449h {font-weight:bold;display:inline-block;}pre.svelte-1qd449h {margin-top:0.5rlh;padding:0;white-space:pre-wrap; /* CSS3: Wrap long lines */word-wrap:break-word; /* For legacy support */}" 14851 }; 14852 function Log($$anchor, $$props) { 14853 push($$props, true); 14854 append_styles$1($$anchor, $$css$5); 14855 let data = prop($$props, "data", 7), format = prop($$props, "format", 7, true), label = prop($$props, "label", 7, ""); 14856 var $$exports = { 14857 get data() { 14858 return data(); 14859 }, 14860 set data($$value) { 14861 data($$value); 14862 flushSync(); 14863 }, 14864 get format() { 14865 return format(); 14866 }, 14867 set format($$value = true) { 14868 format($$value); 14869 flushSync(); 14870 }, 14871 get label() { 14872 return label(); 14873 }, 14874 set label($$value = "") { 14875 label($$value); 14876 flushSync(); 14877 } 14878 }; 14879 var div = root_1$23(); 14880 var node = child(div); 14881 var consequent = ($$anchor) => { 14882 var label_1 = root$70(); 14883 var text = child(label_1); 14884 reset(label_1); 14885 template_effect(() => set_text(text, `${label() ?? ""}:`)); 14886 append($$anchor, label_1); 14887 }; 14888 if_block(node, ($$render) => { 14889 if (label()) $$render(consequent); 14890 }); 14891 var pre = sibling(node, 2); 14892 let classes; 14893 html$2(child(pre), () => format() ? JSON.stringify(data(), null, 2) : JSON.stringify(data())); 14894 next(); 14895 reset(pre); 14896 reset(div); 14897 template_effect(() => classes = set_class(pre, 1, "svelte-1qd449h", null, classes, { format: format() })); 14898 append($$anchor, div); 14899 return pop($$exports); 14900 }
14901 create_custom_element(Log, { 14902 data: {}, 14903 format: {}, 14904 label: {} 14905 }, [], [], { mode: "open" }); 14906 //#endregion 14907 //#region src/components/mainnav/components/ConnectedMainNav.svelte 14908 function ConnectedMainNav($$anchor, $$props) { 14909 push($$props, true); 14910 let mobile = prop($$props, "mobile", 7), nav = prop($$props, "nav", 7), expandMobileSubnavs = prop($$props, "expandMobileSubnavs", 7), currentPage = prop($$props, "currentPage", 7); 14911 currentPage(currentPage() || "shop.start"); 14912 let loadedNav = /* @__PURE__ */ state(proxy([])); 14913 user_effect(() => { 14914 nav(); 14915 (async () => { 14916 await loadNav(); 14917 })(); 14918 }); 14919 async function loadNav() { 14920 await shop.waitForAllFetches(); 14921 nav(nav() ?? []); 14922 const navSettings = nav().length ? nav() : shop.settings?.mainNav; 14923 generateNavigation(navSettings); 14924 await shop.waitForAllFetches(); 14925 set(loadedNav, generateNavigation(navSettings), true); 14926 } 14927 var $$exports = { 14928 get mobile() { 14929 return mobile(); 14930 }, 14931 set mobile($$value) { 14932 mobile($$value); 14933 flushSync(); 14934 }, 14935 get nav() { 14936 return nav(); 14937 }, 14938 set nav($$value) { 14939 nav($$value); 14940 flushSync(); 14941 }, 14942 get expandMobileSubnavs() { 14943 return expandMobileSubnavs(); 14944 }, 14945 set expandMobileSubnavs($$value) { 14946 expandMobileSubnavs($$value); 14947 flushSync(); 14948 }, 14949 get currentPage() { 14950 return currentPage(); 14951 }, 14952 set currentPage($$value) { 14953 currentPage($$value); 14954 flushSync(); 14955 } 14956 }; 14957 MainNav($$anchor, { 14958 get nav() { 14959 return get$2(loadedNav); 14960 }, 14961 get mobile() { 14962 return mobile(); 14963 }, 14964 get expandMobileSubnavs() { 14965 return expandMobileSubnavs(); 14966 }, 14967 get currentPage() { 14968 return currentPage(); 14969 } 14970 }); 14971 return pop($$exports); 14972 } 14973 customElements.define("go-mainnav", create_custom_element(ConnectedMainNav, { 14974 mobile: { 14975 attribute: "mobile", 14976 type: "Boolean" 14977 }, 14978 nav: { 14979 attribute: "nav", 14980 type: "Object" 14981 }, 14982 expandMobileSubnavs: { 14983 attribute: "expand-mobile-subnavs", 14984 type: "Boolean" 14985 }, 14986 currentPage: { 14987 attribute: "current-page", 14988 type: "String" 14989 } 14990 }, [], [])); 14991 //#endregion 14992 //#region src/lib/helpers/shopCart.ts 14993 function parsedDonations() { 14994 return JSON.parse(localStorage.getItem("201600627v4donations") ?? "[]"); 14995 } 14996 function total() { 14997 return parsedItems().reduce((total, item) => total + item.cart.totalCents, 0) + parsedDonations().reduce((total, donation) => total + donation.value, 0); 14998 } 14999 function parsedItems() { 15000 if (shop.apiUrl == "https://jmb-staging.gomus.de" || shop.apiUrl == "https://jmb.gomus.de") return parseJmbItems(); 15001 else return JSON.parse(localStorage.getItem("201600627v4items") ?? "[]"); 15002 } 15003 function parseJmbItems() { 15004 return JSON.parse(localStorage.getItem("cartItems") ?? "[]").concat(JSON.parse(localStorage.getItem("merchandise") || "[]")).map((jmbItem) => { 15005 if (jmbItem.type == "Merchandise") return { 15006 attributes: jmbItem.attributes, 15007 type: jmbItem.type, 15008 cart: { 15009 name: jmbItem.attributes.title, 15010 price_cents: jmbItem.attributes.price_cents, 15011 quantity: jmbItem.attributes.quantity, 15012 totalCents: jmbItem.attributes.price_cents 15013 } 15014 }; 15015 else return { 15016 attributes: jmbItem.attributes, 15017 type: jmbItem.type, 15018 cart: { 15019 name: jmbItem.product.title, 15020 languageName: jmbItem.product.languageName, 15021 price_cents: jmbItem.product.priceCents, 15022 quantity: jmbItem.product.quantity, 15023 totalCents: jmbItem.product.totalPriceCents, 15024 participantCount: jmbItem.product.numberOfParticipants 15025 } 15026 }; 15027 }); 15028 } 15029 //#endregion 15030 //#region ../../node_modules/.pnpm/[email protected]/node_modules/js-cookie/dist/js.cookie.mjs 15031 /*! js-cookie v3.0.8 | MIT */ 15032 function assign(target) { 15033 for (var i = 1; i < arguments.length; i++) { 15034 var source = arguments[i]; 15035 for (var key in source) { 15036 if (key === "__proto__") continue; 15037 target[key] = source[key]; 15038 } 15039 } 15040 return target; 15041 } 15042 var defaultConverter = { 15043 read: function(value) { 15044 if (value[0] === "\"") value = value.slice(1, -1); 15045 return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); 15046 }, 15047 write: function(value) { 15048 return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent); 15049 } 15050 }; 15051 function init(converter, defaultAttributes) { 15052 function set(name, value, attributes) { 15053 if (typeof document === "undefined") return; 15054 attributes = assign({}, defaultAttributes, attributes);
15055 if (typeof attributes.expires === "number") attributes.expires = new Date(Date.now() + attributes.expires * 864e5); 15056 if (attributes.expires) attributes.expires = attributes.expires.toUTCString(); 15057 name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape); 15058 var stringifiedAttributes = ""; 15059 for (var attributeName in attributes) { 15060 if (!attributes[attributeName]) continue; 15061 stringifiedAttributes += "; " + attributeName; 15062 if (attributes[attributeName] === true) continue; 15063 stringifiedAttributes += "=" + attributes[attributeName].split(";")[0]; 15064 } 15065 return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes; 15066 } 15067 function get(name) { 15068 if (typeof document === "undefined" || arguments.length && !name) return; 15069 var cookies = document.cookie ? document.cookie.split("; ") : []; 15070 var jar = {}; 15071 for (var i = 0; i < cookies.length; i++) { 15072 var parts = cookies[i].split("="); 15073 var value = parts.slice(1).join("="); 15074 try { 15075 var found = decodeURIComponent(parts[0]); 15076 if (!(found in jar)) jar[found] = converter.read(value, found); 15077 if (name === found) break; 15078 } catch (_e) {} 15079 } 15080 return name ? jar[name] : jar; 15081 } 15082 return Object.create({ 15083 set, 15084 get, 15085 remove: function(name, attributes) { 15086 set(name, "", assign({}, attributes, { expires: -1 })); 15087 }, 15088 withAttributes: function(attributes) { 15089 return init(this.converter, assign({}, this.attributes, attributes)); 15090 }, 15091 withConverter: function(converter) { 15092 return init(assign({}, this.converter, converter), this.attributes); 15093 } 15094 }, { 15095 attributes: { value: Object.freeze(defaultAttributes) }, 15096 converter: { value: Object.freeze(converter) } 15097 }); 15098 } 15099 var api = init(defaultConverter, { path: "/" }); 15100 //#endregion 15101 //#region src/components/paypal/lib/CreateGomusOrderService.ts 15102 var CreateGomusOrderService = class { 15103 requestBody; 15104 paymentModeId; 15105 paymentSource; 15106 locale; 15107 constructor(paymentSource, customerEmail) { 15108 this.paymentSource = paymentSource; 15109 this.paymentModeId = shop.payment_modes.pay_pal.id; 15110 this.locale = localStorage.getItem("lang") || "de"; 15111 const customerEmailBody = customerEmail ? { email: customerEmail } : null; 15112 this.requestBody = { 15113 items: parsedItems().map((item) => ({ 15114 type: item.type, 15115 attributes: item.attributes, 15116 payment_attributes: { 15117 name: this.paypalItemName(item), 15118 unit_amount: { 15119 quantity: this.paypalQuantities(item), 15120 value: item.cart.price_cents / 100, 15121 currency_code: shop.settings.currency 15122 } 15123 } 15124 })), 15125 donations: parsedDonations(), 15126 total: total(), 15127 payment_mode_id: this.paymentModeId.toString(), 15128 payment_source: this.paymentSource, 15129 customer: customerEmailBody 15130 }; 15131 } 15132 async call() { 15133 const authHeaders = JSON.parse(api.get("auth_headers") || "[]"); 15134 return await createOrder(shop.client, authHeaders, this.requestBody); 15135 } 15136 paypalItemName(item) { 15137 if (item.type == "Tour") return `${item.cart.name.slice(0, 110)} (${item.cart.participantCount} Teilnehmer)`; 15138 else return item.cart.name.slice(0, 120); 15139 } 15140 paypalQuantities(item) { 15141 if (item.type == "Tour") return item.cart.quantity; 15142 else if (item.type == "Event") return item.cart.quantity || item.attributes.quantity; 15143 else return item.attributes.quantity; 15144 } 15145 }; 15146 //#endregion 15147 //#region src/components/paypal/lib/PaymentError.ts 15148 var PaymentError = class extends Error { 15149 constructor(message) { 15150 super(message); 15151 } 15152 }; 15153 function PayLater($$anchor, $$props) { 15154 push($$props, true); 15155 getContext("paypalScript").paypal; 15156 proxy(total()); 15157 user_effect(() => {}); 15158 var fragment = comment(); 15159 if_block(first_child(fragment), ($$render) => {}); 15160 append($$anchor, fragment); 15161 pop(); 15162 } 15163 create_custom_element(PayLater, {}, [], [], { mode: "open" }); 15164 //#endregion 15165 //#region src/components/paypal/payment-methods/paypal/Paypal.svelte 15166 var root$69 = /* @__PURE__ */ from_html(`<div class="paypal-container svelte-1mf2e4r"><div id="paypal-btn"></div> <!></div>`); 15167 var $$css$4 = { 15168 hash: "svelte-1mf2e4r", 15169 code: ".paypal-container.svelte-1mf2e4r {display:flex;flex-direction:column;gap:16px;}" 15170 }; 15171 function Paypal($$anchor, $$props) { 15172 push($$props, true); 15173 append_styles$1($$anchor, $$css$4); 15174 const paypal = getContext("paypalScript").paypal; 15175 let gomusOrderToken; 15176 let borderRadius = prop($$props, "borderRadius", 7, 4), height = prop($$props, "height", 7, void 0); 15177 onMount(() => { 15178 console.log("Paypal Mounted"); 15179 paypal.Buttons({ 15180 fundingSource: paypal.FUNDING?.PAYPAL, 15181 style: { 15182 label: "pay", 15183 borderRadius: borderRadius(), 15184 height: height() 15185 }, 15186 onInit(data, actions) { 15187 if (total() == 0) actions.disable(); 15188 }, 15189 createOrder: async (data, _actions) => { 15190 const response = await new CreateGomusOrderService(data.paymentSource).call(); 15191 if (response.isOk()) { 15192 gomusOrderToken = response.value.order.token; 15193 return response.value.meta.payment_result.id; 15194 } else throw new PaymentError(response.error.message); 15195 }, 15196 onApprove: async (data, _actions) => { 15197 if ((await capturePaypalOrder(shop.client, gomusOrderToken, data.orderID)).isOk()) window.location.replace(shop.urls.checkoutSuccess(gomusOrderToken)); 15198 else throw new PaymentError("Something went wrong"); 15199 }, 15200 onCancel(data, actions) { 15201 console.log(data); 15202 console.log(actions); 15203 }, 15204 onError(err) { 15205 const message = err.message || "Something went wrong"; 15206 window.location.replace(shop.urls.checkoutFailure(message)); 15207 } 15208 }).render("#paypal-btn"); 15209 }); 15210 var $$exports = { 15211 get borderRadius() { 15212 return borderRadius(); 15213 }, 15214 set borderRadius($$value = 4) { 15215 borderRadius($$value); 15216 flushSync(); 15217 }, 15218 get height() { 15219 return height(); 15220 }, 15221 set height($$value = void 0) { 15222 height($$value); 15223 flushSync(); 15224 } 15225 }; 15226 var div = root$69(); 15227 PayLater(sibling(child(div), 2), {}); 15228 reset(div); 15229 append($$anchor, div); 15230 return pop($$exports); 15231 }
15232 create_custom_element(Paypal, { 15233 borderRadius: {}, 15234 height: {} 15235 }, [], [], { mode: "open" }); 15236 //#endregion 15237 //#region src/components/paypal/payment-methods/applepay/applePay.ts 15238 var initApplePay = (paypal) => { 15239 try { 15240 if (!window.ApplePaySession) { 15241 console.log("This device does not support Apple Pay"); 15242 return; 15243 } 15244 if (!ApplePaySession.canMakePayments()) { 15245 console.log("This device is not capable of making Apple Pay payments"); 15246 return; 15247 } 15248 const applepay = paypal.Applepay(); 15249 let applePaySession; 15250 applepay.config().then((applepayConfig) => { 15251 if (applepayConfig.isEligible) { 15252 const element = document.getElementById("payment-method-applepay-container"); 15253 if (element) element.classList.add("pm-show"); 15254 document.getElementById("applepay-container").innerHTML = "<apple-pay-button id=\"btn-appl\" buttonstyle=\"black\" type=\"buy\" locale=\"en\">"; 15255 document.querySelector("apple-pay-button").addEventListener("click", async () => { 15256 let cartItems = JSON.parse(localStorage.getItem("201600627v4items") || "[]"); 15257 try { 15258 let total = cartItems.reduce((amount, item) => amount + item.cart.totalCents, 0); 15259 const items = cartItems.map((item) => { 15260 return { 15261 label: item.cart.name, 15262 amount: (item.cart.price_cents / 100).toFixed(2).toString() 15263 }; 15264 }); 15265 const paymentRequest = { 15266 countryCode: applepayConfig.countryCode, 15267 merchantCapabilities: applepayConfig.merchantCapabilities, 15268 supportedNetworks: applepayConfig.supportedNetworks, 15269 currencyCode: "EUR", 15270 requiredShippingContactFields: ["name", "email"], 15271 requiredBillingContactFields: [ 15272 "name", 15273 "email", 15274 "postalAddress" 15275 ], 15276 lineItems: items, 15277 total: { 15278 label: "Edge Shop", 15279 type: "final", 15280 amount: (total / 100).toFixed(2).toString() 15281 } 15282 }; 15283 console.log(paymentRequest); 15284 applePaySession = new ApplePaySession(14, paymentRequest); 15285 console.log(applePaySession); 15286 applePaySession.onvalidatemerchant = (event) => { 15287 console.log("in onvalidatemerchant, event:", event); 15288 applepay.validateMerchant({ 15289 validationUrl: event.validationURL, 15290 displayName: "My Store" 15291 }).then((validateResult) => { 15292 console.log("in onvalidatemerchant SUCCESS"); 15293 applePaySession.completeMerchantValidation(validateResult.merchantSession); 15294 }).catch((validateError) => { 15295 console.log("validateError:", validateError); 15296 applePaySession.abort(); 15297 }); 15298 }; 15299 applePaySession.onpaymentauthorized = async (event) => { 15300 const customerEmail = event.payment.shippingContact?.emailAddress; 15301 const response = await new CreateGomusOrderService("apple_pay", customerEmail).call(); 15302 if (response.isErr()) throw new PaymentError(response.error.message); 15303 const gomusOrderToken = response.value.order.token; 15304 const paypalOrderId = response.value.meta.payment_result.id; 15305 applepay.confirmOrder({ 15306 orderId: paypalOrderId, 15307 token: event.payment.token, 15308 billingContact: event.payment.billingContact 15309 }).then(async (resp) => { 15310 if ((await capturePaypalOrder(shop.client, gomusOrderToken, paypalOrderId)).isOk()) { 15311 console.log("telling apple pay we are happy"); 15312 applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS); 15313 window.location.replace(shop.urls.checkoutSuccess(gomusOrderToken)); 15314 } else window.location.replace(shop.urls.checkoutFailure("Something went wrong")); 15315 }); 15316 }; 15317 applePaySession.begin(); 15318 } catch (error) { 15319 const message = error?.message || "Something went wrong"; 15320 window.location.replace(shop.urls.checkoutFailure(message)); 15321 } 15322 }); 15323 } 15324 }).catch((applepayConfigError) => { 15325 console.log("Error while fetching Apple Pay configuration."); 15326 }); 15327 return applepay; 15328 } catch (error) { 15329 console.log("Failed to initialize ApplePay:", error); 15330 } 15331 }; 15332 //#endregion 15333 //#region src/components/paypal/payment-methods/applepay/ApplePay.svelte 15334 var root$68 = with_script(/* @__PURE__ */ from_html(`<script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"><\/script><!>`, 1)); 15335 var root_1$22 = /* @__PURE__ */ from_html(`<div id="applepay-container" class="svelte-spw2p9"></div>`); 15336 var $$css$3 = { 15337 hash: "svelte-spw2p9", 15338 code: "#applepay-container.svelte-spw2p9 {height:55px;
15338width:200px;}#applepay-container.svelte-spw2p9 iframe {background-color:black;padding:0;}" 15339 }; 15340 function ApplePay($$anchor, $$props) { 15341 push($$props, false); 15342 append_styles$1($$anchor, $$css$3); 15343 const paypal = getContext("paypalScript").paypal; 15344 initApplePay(paypal); 15345 init$1(); 15346 var div = root_1$22(); 15347 head("spw2p9", ($$anchor) => { 15348 var fragment = root$68(); 15349 sibling(first_child(fragment)); 15350 append($$anchor, fragment); 15351 }); 15352 append($$anchor, div); 15353 pop(); 15354 } 15355 create_custom_element(ApplePay, {}, [], [], { mode: "open" }); 15356 //#endregion 15357 //#region src/components/paypal/lib/getPaypalOrder.ts 15358 async function getPaypalOrder(orderId) { 15359 const ret = await (await fetch(`${shop.apiUrl}/api/v4/payments/paypal/details/` + orderId, { method: "get" })).json(); 15360 console.warn(ret); 15361 return ret; 15362 } 15363 //#endregion 15364 //#region src/components/paypal/payment-methods/googlepay/googlePay.ts 15365 var initGooglePay = (paypal) => { 15366 let baseRequest; 15367 let paymentsClient = null; 15368 let attempts = 0; 15369 const maxAttempts = 1e3; 15370 function waitForGoogle() { 15371 if (typeof google !== "undefined" && paypal.Googlepay) { 15372 console.log("Google and PayPal Googlepay are ready!"); 15373 console.log("GP> Google and PayPal Googlepay are ready!"); 15374 onGooglePayLoaded().catch(console.log); 15375 } else if (attempts < maxAttempts) { 15376 console.log("Waiting for Google and PayPal Googlepay..."); 15377 console.log("GP> Waiting for Google and PayPal Googlepay..."); 15378 attempts++; 15379 setTimeout(waitForGoogle, 10); 15380 } else { 15381 console.error("Google is not defined after 1000 attempts"); 15382 console.error("GP> Google is not defined after 1000 attempts"); 15383 } 15384 } 15385 waitForGoogle(); 15386 async function onGooglePayLoaded() { 15387 console.log("GP> onGooglePayLoaded()"); 15388 const paymentsClient = getGooglePaymentsClient(); 15389 console.log("GP> paymentsClient:", paymentsClient); 15390 const request = await getGooglePayConfig(); 15391 console.log("GP> allowedPaymentMethods:", request.allowedPaymentMethods); 15392 paymentsClient.isReadyToPay({ 15393 apiVersion: request.apiVersion, 15394 allowedPaymentMethods: request.allowedPaymentMethods, 15395 apiVersionMinor: request.apiVersionMinor 15396 }).then((response) => { 15397 if (response.result) { 15398 const element = document.getElementById("payment-method-googlepay-container"); 15399 if (element) element.classList.add("pm-show"); 15400 addGooglePayButton(); 15401 } 15402 }).catch((err) => { 15403 console.error(err); 15404 }); 15405 } 15406 async function getGooglePayConfig() { 15407 if (baseRequest == null) baseRequest = await paypal.Googlepay().config(); 15408 return baseRequest; 15409 } 15410 function addGooglePayButton() { 15411 const button = getGooglePaymentsClient().createButton({ 15412 onClick: onGooglePaymentButtonClicked, 15413 buttonRadius: 0, 15414 buttonSizeMode: "fill" 15415 }); 15416 const googlePayDOM = document.getElementById("googlepay-container"); 15417 if (googlePayDOM) googlePayDOM.appendChild(button); 15418 else console.log("googlepay-container id not found"); 15419 } 15420 async function onGooglePaymentButtonClicked() { 15421 const paymentDataRequest = await getGooglePaymentDataRequest(); 15422 const paymentsClient = getGooglePaymentsClient(); 15423 delete paymentDataRequest["isEligible"]; 15424 delete paymentDataRequest["countryCode"]; 15425 paymentsClient.loadPaymentData(paymentDataRequest).then((paymentData) => { 15426 processPayment(paymentData); 15427 }).catch((err) => { 15428 console.error(err); 15429 }); 15430 } 15431 function getGooglePaymentsClient() { 15432 if (paymentsClient === null) paymentsClient = new google.payments.api.PaymentsClient({ environment: "PRODUCTION" }); 15433 return paymentsClient; 15434 } 15435 async function processPayment(paymentData) { 15436 try { 15437 console.log("GP> paymentData: ", paymentData); 15438 const customerEmail = paymentData.email; 15439 const response = await new CreateGomusOrderService("google_pay", customerEmail).call(); 15440 if (response.isErr()) return; 15441 const gomusOrderToken = response.value.order.token; 15442 const paypalOrderId = response.value.meta.payment_result.id; 15443 const googleConfirmOrderResponse = await paypal.Googlepay().confirmOrder({ 15444 orderId: paypalOrderId, 15445 paymentMethodData: paymentData.paymentMethodData 15446 }); 15447 if (googleConfirmOrderResponse.status == "APPROVED") if ((await capturePaypalOrder(shop.client, gomusOrderToken, paypalOrderId)).isOk()) window.location.replace(shop.urls.checkoutSuccess(gomusOrderToken)); 15448 else window.location.replace(shop.urls.checkoutFailure("Something went wrong")); 15449 if (googleConfirmOrderResponse.status == "PAYER_ACTION_REQUIRED") { 15450 await paypal.Googlepay().initiatePayerAction({ orderId: paypalOrderId }); 15451 const orderResponse = await getPaypalOrder(paypalOrderId); 15452 if (orderResponse) { 15453 console.log("GP > paypal order fetch", orderResponse); 15454 const authenticationResult = orderResponse.payment_source?.google_pay?.card.authentication_result; 15455 const okAuthentication = authenticationResult?.three_d_secure?.enrollment_status == "U" || authenticationResult?.three_d_secure?.enrollment_status == "Y" && authenticationResult?.three_d_secure?.authentication_status == "Y"; 15456 if (orderResponse.status == "APPROVED" || okAuthentication) if ((await capturePaypalOrder(shop.client, gomusOrderToken, paypalOrderId)).isOk()) window.location.replace(shop.urls.checkoutSuccess(gomusOrderToken)); 15457 else window.location.replace(shop.urls.checkoutFailure("Something went wrong")); 15458 else console.log("3DS AUTHENTICATION ERROR", JSON.stringify(orderResponse, null, 2)); 15459 } 15460 } 15461 } catch (err) { 15462 return { 15463 transactionState: "ERROR", 15464 error: { message: err.message } 15465 }; 15466 } 15467 } 15468 async function getGooglePaymentDataRequest() { 15469 const googleConfig = await getGooglePayConfig(); 15470 return { 15471 allowedPaymentMethods: googleConfig.allowedPaymentMethods, 15472 transactionInfo: getGoogleTransactionInfo(), 15473 merchantInfo: googleConfig.merchantInfo, 15474 emailRequired: true, 15475 apiVersion: baseRequest.apiVersion, 15476 apiVersionMinor: baseRequest.apiVersionMinor 15477 }; 15478 } 15479 function getGoogleTransactionInfo() { 15480 let cartItems = parsedItems(); 15481 let total$1 = total(); 15482 return { 15483 displayItems: cartItems.map((item) => { 15484 return { 15485 label: item.cart.name, 15486 price: (item.cart.price_cents / 100).toFixed(2).toString(), 15487 type: "LINE_ITEM" 15488 }; 15489 }), 15490 countryCode: "DE", 15491 currencyCode: "EUR", 15492 totalPriceStatus: "FINAL", 15493 totalPrice: (total$1 / 100).toFixed(2).toString(), 15494 totalPriceLabel: "Total" 15495 }; 15496 } 15497 }; 15498 //#endregion 15499 //#region src/components/paypal/payment-methods/googlepay/GooglePay.svelte 15500 var root$67 = with_script(/* @__PURE__ */ from_html(`<script src="https://pay.google.com/gp/p/js/pay.js"><\/script><!>`, 1)); 15501 var root_1$21 = /* @__PURE__ */ from_html(`<div id="googlepay-container"></div>`); 15502 function GooglePay($$anchor, $$props) { 15503 push($$props, false); 15504 const paypal = getContext("paypalScript").paypal; 15505 initGooglePay(paypal); 15506 init$1(); 15507 var div = root_1$21(); 15508 head("8qg27", ($$anchor) => { 15509 var fragment = root$67(); 15510 sibling(first_child(fragment)); 15511 append($$anchor, fragment); 15512 }); 15513 append($$anchor, div); 15514 pop(); 15515 }
15516 create_custom_element(GooglePay, {}, [], [], { mode: "open" }); 15517 //#endregion 15518 //#region src/components/paypal/PaypalExpress.svelte 15519 var root$66 = /* @__PURE__ */ from_html(`<div class="buttons svelte-1jxczcn"><!></div>`); 15520 var $$css$2 = { 15521 hash: "svelte-1jxczcn", 15522 code: ".buttons.svelte-1jxczcn {max-width:320px;display:flex;gap:1rem;flex-direction:column;align-items:stretch;}" 15523 }; 15524 function PaypalExpress($$anchor, $$props) { 15525 push($$props, true); 15526 append_styles$1($$anchor, $$css$2); 15527 let paypal = prop($$props, "paypal", 7), borderRadius = prop($$props, "borderRadius", 7, 4), height = prop($$props, "height", 7, void 0); 15528 setContext("paypalScript", { paypal: paypal() }); 15529 var $$exports = { 15530 get paypal() { 15531 return paypal(); 15532 }, 15533 set paypal($$value) { 15534 paypal($$value); 15535 flushSync(); 15536 }, 15537 get borderRadius() { 15538 return borderRadius(); 15539 }, 15540 set borderRadius($$value = 4) { 15541 borderRadius($$value); 15542 flushSync(); 15543 }, 15544 get height() { 15545 return height(); 15546 }, 15547 set height($$value = void 0) { 15548 height($$value); 15549 flushSync(); 15550 } 15551 }; 15552 var div = root$66(); 15553 Paypal(child(div), { 15554 get borderRadius() { 15555 return borderRadius(); 15556 }, 15557 get height() { 15558 return height(); 15559 } 15560 }); 15561 reset(div); 15562 append($$anchor, div); 15563 return pop($$exports); 15564 } 15565 create_custom_element(PaypalExpress, { 15566 paypal: {}, 15567 borderRadius: {}, 15568 height: {} 15569 }, [], [], { mode: "open" }); 15570 //#endregion 15571 //#region src/components/paypal/payment-method-component/paymentIcons.ts 15572 var paymentIcons = { 15573 applepay: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='49'%20height='20'%20fill='none'%20viewBox='0%200%2049%2020'%3e%3cpath%20fill='%23000'%20d='M8.953%202.579C8.38%203.253%207.46%203.787%206.541%203.71c-.115-.914.335-1.884.862-2.484C7.977.533%208.982.038%209.796%200c.095.951-.278%201.884-.843%202.579Zm.833%201.313c-1.33-.077-2.47.751-3.101.751-.641%200-1.608-.713-2.661-.694-1.369.019-2.642.79-3.34%202.017-1.436%202.455-.374%206.09%201.014%208.087.68.99%201.493%202.075%202.565%202.036%201.015-.038%201.417-.656%202.642-.656%201.235%200%201.589.656%202.66.637%201.111-.019%201.81-.99%202.49-1.979.775-1.122%201.09-2.217%201.11-2.274-.02-.019-2.144-.828-2.163-3.263-.02-2.036%201.675-3.007%201.751-3.064-.957-1.408-2.45-1.56-2.967-1.598Zm7.686-2.76v14.834h2.316v-5.072h3.206c2.93%200%204.987-1.998%204.987-4.89%200-2.893-2.02-4.872-4.91-4.872h-5.6Zm2.316%201.941h2.67c2.01%200%203.159%201.066%203.159%202.94%200%201.875-1.149%202.95-3.168%202.95h-2.66v-5.89ZM32.212%2016.08c1.455%200%202.804-.733%203.417-1.893h.048v1.779h2.144V8.582c0-2.14-1.723-3.52-4.374-3.52-2.46%200-4.279%201.399-4.346%203.32h2.087c.172-.913%201.024-1.512%202.192-1.512%201.416%200%202.21.656%202.21%201.865v.818l-2.89.171c-2.69.162-4.145%201.256-4.145%203.159%200%201.922%201.503%203.197%203.657%203.197Zm.622-1.76c-1.235%200-2.02-.59-2.02-1.494%200-.933.756-1.475%202.202-1.56l2.575-.162v.837c0%201.39-1.187%202.379-2.757%202.379ZM40.682%2020c2.26%200%203.322-.856%204.25-3.454L49%205.205h-2.355l-2.727%208.763h-.048l-2.728-8.763H38.72l3.925%2010.799-.211.656c-.354%201.114-.928%201.542-1.953%201.542-.181%200-.536-.02-.68-.038v1.779c.135.038.71.057.881.057Z'/%3e%3c/svg%3e", 15574 bancontact: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='20'%20fill='none'%20viewBox='0%200%2032%2020'%3e%3cpath%20fill='%23004E91'%20d='M28.518%203.497h-9.903l-1.013%201.149-3.267%203.714-1.013%201.149H3.546l.987-1.162.469-.549.988-1.161H1.494C.671%206.637%200%207.339%200%208.18v3.268c0%20.856.671%201.545%201.494%201.545h17.248c.823%200%201.95-.523%202.494-1.149l2.609-2.986%204.673-5.36Z'/%3e%3cpath%20fill='%23FD0'%20d='M30.506.013C31.329.013%2032%20.715%2032%201.557v3.268c0%20.855-.671%201.544-1.494%201.544H26.01l1-1.149.495-.574%201-1.149h-9.903l-5.28%205.999h-9.84l7.054-8.041.266-.306C11.359.523%2012.486%200%2013.309%200h17.197v.013Z'/%3e%3cpath%20fill='%23004E91'%20d='M32%2019.834v-.472c0-.064-.038-.102-.127-.102h-.303c-.09%200-.152-.013-.165-.051-.026-.039-.026-.115-.026-.243V17.18h.494a.114.114%200%200%200%20.089-.038.116.116%200%200%200%20.038-.09v-.497a.117.117%200%200%200-.038-.09.114.114%200%200%200-.089-.038h-.494v-.65c0-.039-.012-.065-.025-.077-.025-.013-.05-.026-.076-.026h-.012l-.735.128a.659.659%200%200%200-.089.038c-.025.026-.038.051-.038.077v.497h-.493a.114.114%200%200%200-.09.039.116.116%200%200%200-.037.09v.407c0%20.039.013.064.038.077.025.026.05.038.089.051l.493.077v1.787c0%20.217.026.395.064.536.05.14.114.242.19.319a.67.67%200%200%200%20.316.153c.127.025.279.038.444.038.088%200%20.164%200%20.24-.013.063-.012.152-.025.24-.038.064%200%20.102-.038.102-.102Zm-2.634-.064v-.549c0-.038-.013-.063-.038-.076-.025-.013-.05-.026-.076-.026h-.013a3.084%203.084%200%200%201-.329.026c-.101.013-.24.013-.418.013a.481.481%200%200%201-.355-.153.493.493%200%200%201-.1-.218%201.295%201.295%200%200%201-.039-.344v-.51c0-.141.013-.256.038-.345a.69.69%200%200%201%20.102-.217.482.482%200%200%201%20.354-.153c.178%200%20.317%200%20.418.012.102.013.215.013.33.026h.012c.038%200%20.063-.013.076-.026.025-.012.038-.038.038-.076v-.55c0-.05-.013-.076-.025-.088-.026-.013-.05-.039-.102-.051-.088-.026-.19-.039-.329-.064-.14-.026-.291-.026-.481-.026-.43%200-.772.128-1.038.396-.254.268-.393.65-.393%201.161v.51c0%20.499.127.894.393%201.162.253.268.607.396%201.
15574038.396.177%200%20.342-.013.481-.026.14-.025.253-.038.33-.063a.19.19%200%200%200%20.1-.051c.026-.013.026-.052.026-.09Zm-3.963-.65a1.342%201.342%200%200%201-.241.089.955.955%200%200%201-.266.038c-.127%200-.228-.013-.291-.051-.064-.038-.089-.115-.089-.255v-.051c0-.077.013-.14.025-.192a.33.33%200%200%201%20.089-.14c.038-.039.101-.064.165-.09a1.33%201.33%200%200%201%20.265-.025h.343v.676Zm.962-1.494c0-.23-.038-.421-.101-.574a1.067%201.067%200%200%200-.279-.383%201.034%201.034%200%200%200-.443-.217%202.169%202.169%200%200%200-.595-.077%204.52%204.52%200%200%200-.596.038c-.19.026-.341.052-.456.09-.075.025-.113.064-.113.14v.498c0%20.038.012.064.025.09.025.012.05.025.076.025h.025c.05%200%20.114-.013.177-.013.076%200%20.152-.013.241-.013s.19-.012.291-.012h.292a.6.6%200%200%201%20.329.076c.076.051.127.166.127.345v.217h-.33c-.519%200-.912.076-1.14.242-.24.166-.354.434-.354.792v.05c0%20.205.025.37.089.498.063.14.139.243.24.332.101.077.203.14.33.179.126.038.253.051.392.051.177%200%20.342-.026.469-.077.126-.05.253-.114.38-.204v.102c0%20.039.012.064.037.09a.118.118%200%200%200%20.09.038h.683a.114.114%200%200%200%20.088-.038.116.116%200%200%200%20.039-.09v-2.195h-.013Zm-3.255%202.208v-.472c0-.064-.038-.102-.126-.102h-.292c-.088%200-.151-.013-.164-.051-.025-.039-.025-.115-.025-.243V17.18h.493a.115.115%200%200%200%20.09-.038.116.116%200%200%200%20.037-.09v-.497a.117.117%200%200%200-.038-.09.115.115%200%200%200-.089-.038h-.493v-.65c0-.039-.013-.065-.026-.077-.025-.013-.05-.026-.076-.026h-.012l-.735.128a.59.59%200%200%200-.088.038c-.026.026-.038.051-.038.077v.497h-.494a.114.114%200%200%200-.089.039.116.116%200%200%200-.038.09v.407c0%20.039.013.064.038.077.025.026.05.038.089.051l.494.077v1.787c0%20.217.025.395.063.536.05.14.114.242.19.319.076.076.19.127.316.153.127.025.279.038.444.038.088%200%20.164%200%20.24-.013.064-.012.152-.025.24-.038.051%200%20.09-.038.09-.102Zm-2.659-.013V17.78c0-.191-.012-.37-.05-.549a1.257%201.257%200%200%200-.165-.446.74.74%200%200%200-.33-.294c-.139-.076-.316-.115-.544-.115-.19%200-.367.026-.52.077a1.77%201.77%200%200%200-.48.255v-.153a.117.117%200%200%200-.038-.09.114.114%200%200%200-.089-.038h-.684a.115.115%200%200%200-.088.039.117.117%200%200%200-.038.089v3.267c0%20.039.012.064.038.09.025.025.05.038.088.038h.735a.115.115%200%200%200%20.088-.038.116.116%200%200%200%20.038-.09V17.41c.102-.051.203-.102.304-.14a.716.716%200%200%201%20.279-.051c.088%200%20.165.012.228.025.063.013.101.051.14.09.037.05.05.102.062.178.013.077.013.166.013.268v2.042c0%20.039.013.064.038.09.025.025.05.038.089.038h.734a.114.114%200%200%200%20.089-.038c.05-.026.063-.064.063-.09Zm-4.61-1.416c0%20.497-.177.753-.544.753-.177%200-.316-.064-.405-.192-.089-.128-.14-.319-.14-.561v-.434c0-.256.051-.434.14-.562.089-.128.228-.191.405-.191.355%200%20.545.255.545.753v.434Zm.988-.434c0-.243-.038-.473-.1-.664a1.394%201.394%200%200%200-.292-.498%201.276%201.276%200%200%200-.481-.319%201.736%201.736%200%200%200-.659-.115c-.253%200-.468.038-.658.115a1.27%201.27%200%200%200-.481.32c-.127.14-.228.306-.292.497a2.147%202.147%200%200%200-.101.664v.434c0%20.242.038.472.101.663a1.276%201.276%200%200%200%20.773.817c.19.077.405.115.658.115s.469-.038.659-.115a1.275%201.275%200%200%200%20.772-.817c.063-.191.101-.42.101-.663v-.434Zm-3.393%201.8v-.55c0-.038-.013-.063-.038-.076-.026-.013-.05-.026-.089-.026h-.013a3.084%203.084%200%200%201-.329.026c-.101%200-.24.013-.418.013a.481.481%200%200%201-.355-.153.492.492%200%200%201-.1-.218%201.295%201.295%200%200%201-.039-.344v-.51c0-.141.013-.256.038-.345a.69.69%200%200%201%20.102-.217.482.482%200%200%201%20.354-.153c.178%200%20.317%200%20.418.012.101.013.215.013.33.026h.012c.038%200%20.063-.013.089-.026.025-.012.038-.038.038-.076v-.55c0-.05-.013-.076-.026-.088-.025-.013-.05-.039-.1-.051-.09-.026-.19-.039-.33-.064-.14-.026-.291-.026-.481-.026-.43%200-.773.128-1.039.396-.253.268-.392.65-.392%201.161v.51c0%20.499.126.894.392%201.162.253.268.608.396%201.
15574039.396.177%200%20.341-.013.48-.026.14-.025.241-.038.33-.063a.19.19%200%200%200%20.101-.051c.026-.013.026-.052.026-.09Zm-2.989.05V17.78c0-.191-.012-.37-.05-.549a1.253%201.253%200%200%200-.165-.446.74.74%200%200%200-.33-.294c-.139-.076-.316-.115-.544-.115-.19%200-.367.026-.52.077a1.771%201.771%200%200%200-.48.255v-.153a.117.117%200%200%200-.038-.09.115.115%200%200%200-.089-.038h-.684a.115.115%200%200%200-.088.039.117.117%200%200%200-.038.089v3.267c0%20.039.012.064.038.09.025.025.05.038.088.038h.735a.115.115%200%200%200%20.088-.038.116.116%200%200%200%20.038-.09V17.41c.102-.051.203-.102.304-.14a.717.717%200%200%201%20.279-.051c.089%200%20.165.012.228.025.063.013.101.051.14.09.037.05.05.102.062.178.013.077.013.166.013.268v2.042c0%20.039.013.064.038.09.025.025.05.038.089.038h.734a.115.115%200%200%200%20.089-.038c.038-.026.063-.064.063-.09Zm-4.71-.702a1.34%201.34%200%200%201-.241.09.954.954%200%200%201-.266.038c-.127%200-.228-.013-.291-.051-.064-.038-.089-.115-.089-.255v-.051c0-.077.013-.14.025-.192a.331.331%200%200%201%20.089-.14c.038-.039.101-.064.165-.09a1.33%201.33%200%200%201%20.266-.025h.341v.676Zm.975-1.493c0-.23-.038-.421-.102-.574a1.065%201.065%200%200%200-.278-.383%201.033%201.033%200%200%200-.444-.217%202.169%202.169%200%200%200-.595-.077c-.202%200-.405.013-.595.038-.19.026-.342.052-.456.09-.076.025-.114.064-.114.14v.498c0%20.038.013.064.026.09.025.012.05.025.076.025h.025c.05%200%20.114-.013.177-.013.076%200%20.152-.013.253-.013.089%200%20.19-.012.292-.012h.29c.14%200%20.254.025.33.076.076.051.127.166.127.345v.217h-.33c-.519%200-.911.076-1.14.242-.227.166-.354.434-.354.792v.05c0%20.205.026.37.089.498.063.14.14.243.24.332.102.077.203.14.33.179.126.038.253.051.392.051.178%200%20.342-.026.469-.077.127-.05.253-.114.38-.204v.102c0%20.039.012.064.038.09.025.025.05.038.088.038h.684a.
15574115.115%200%200%200%20.089-.038.116.116%200%200%200%20.038-.09v-2.195h-.025Zm-4.357.97a.488.488%200%200%201-.177.396c-.114.089-.342.14-.646.14h-.506v-1.149h.684c.24%200%20.417.051.506.166.089.115.14.243.14.383v.064Zm-.025-1.825c0%20.064-.013.127-.025.191a.326.326%200%200%201-.102.154.671.671%200%200%201-.19.102.982.982%200%200%201-.303.038h-.684v-1.06h.468c.317%200%20.532.039.659.115.126.077.19.205.19.37v.09H2.33Zm1.038%201.761a.962.962%200%200%200-.152-.549.965.965%200%200%200-.392-.357.861.861%200%200%200%20.38-.357c.088-.166.14-.345.14-.536v-.115c0-.243-.052-.447-.14-.613a1.065%201.065%200%200%200-.393-.396c-.164-.102-.367-.165-.608-.217a4.89%204.89%200%200%200-.785-.063h-.304c-.1%200-.202.012-.304.012-.1%200-.19.013-.278.026-.089.013-.152.013-.203.025-.114.026-.202.052-.253.115-.05.051-.076.154-.076.294v3.727c0%20.14.025.23.076.293.05.051.14.09.253.115.064.013.14.026.216.026.088.012.177.012.278.025.101%200%20.203.013.304.013h.317c.266%200%20.519-.026.747-.064.228-.038.443-.115.608-.217.177-.102.303-.242.417-.421.102-.179.152-.408.152-.676v-.09Z'/%3e%3c/svg%3e", 15575 blik: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='13'%20height='20'%20fill='none'%20viewBox='0%200%2013%2020'%3e%3cpath%20fill='%23002124'%20d='M9.931%205.962c1.695%200%203.069-1.334%203.069-2.98C13%201.334%2011.626%200%209.93%200%208.236%200%206.862%201.335%206.862%202.981c0%201.647%201.374%202.981%203.07%202.981Z'/%3e%3cpath%20fill='%23002124'%20d='M6.5%207.347a6.65%206.65%200%200%200-3.069.752V.962H0v12.723C0%2017.183%202.9%2020%206.5%2020s6.5-2.817%206.5-6.315c0-3.497-2.9-6.338-6.5-6.338Zm0%209.367c-1.74%200-3.141-1.362-3.141-3.052S4.76%2010.61%206.5%2010.61s3.141%201.362%203.141%203.052S8.24%2016.714%206.5%2016.714Z'/%3e%3c/svg%3e", 15576 eps: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='29'%20height='20'%20fill='none'%20viewBox='0%200%2029%2020'%3e%3cpath%20fill='%2371706F'%20d='M26.448%2010.339h-2.686a.537.537%200%200%201-.542-.535c0-.297.243-.558.542-.558h4.09V7.235h-4.09a2.589%202.589%200%200%200-2.59%202.58%202.59%202.59%200%200%200%202.59%202.578h2.65c.299%200%20.542.237.542.534%200%20.297-.243.516-.542.516h-5.683c-.482.918-.951%201.705-1.904%202.098h7.623C27.852%2015.52%2029%2014.337%2029%2012.93a2.605%202.605%200%200%200-2.552-2.592Z'/%3e%3cpath%20fill='%2371706F'%20d='M16.15%207.235c-2.277%200-4.132%201.86-4.132%204.144V20h2.061v-4.458h2.066c2.277%200%204.125-1.884%204.125-4.17a4.128%204.128%200%200%200-4.12-4.136Zm0%206.208h-2.07v-2.071c0-1.157.924-2.099%202.07-2.099a2.09%202.09%200%200%201%202.078%202.099c0%201.157-.933%202.07-2.078%202.07Z'/%3e%3cpath%20fill='%23C8036F'%20d='M5.492%2015.54c-1.95%200-3.588-1.383-4.032-3.192%200%200-.128-.598-.128-.992%200-.393.121-.998.121-.998a4.156%204.156%200%200%201%204.03-3.147c2.288%200%204.166%201.854%204.166%204.135v1.004H3.57c.359.699%201.085%201.093%201.923%201.093h5.466l.007-5.916a1.61%201.61%200%200%200-1.609-1.604H1.61c-.886%200-1.61.7-1.61%201.582v7.722c0%20.882.724%201.625%201.609%201.625h7.747c.794%200%201.457-.568%201.585-1.311h-5.45Z'/%3e%3cpath%20fill='%23C8036F'%20d='M5.482%209.174c-.834%200-1.56.51-1.92%201.165h3.84c-.36-.656-1.085-1.165-1.92-1.165Zm3.51-5.762C8.991%201.528%207.42%200%205.481%200%203.574%200%202.023%201.478%201.973%203.32v1.047c0%20.123.1.244.226.244H3.49c.126%200%20.237-.121.237-.244v-.956c0-.94.786-1.706%201.754-1.706s1.755.765%201.755%201.706v.956c0%20.123.102.244.228.244h1.292c.126%200%20.234-.121.234-.244v-.956Z'/%3e%3c/svg%3e", 15577 googlepay: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='42'%20height='20'%20fill='none'%20viewBox='0%200%2042%2020'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20fill='%235F6368'%20d='M19.845%2010.341v4.882H18.27V3.149h4.095a3.91%203.91%200%200%201%202.678%201.05c.735.63%201.102%201.575%201.102%202.572%200%20.998-.367%201.89-1.102%202.573a3.815%203.815%200%200%201-2.678%201.05l-2.52-.053Zm0-5.722v4.2h2.625c.578%200%201.155-.21%201.523-.63.84-.788.84-2.1.052-2.887l-.053-.053c-.42-.42-.945-.682-1.522-.63h-2.625Zm9.922%202.101c1.155%200%202.048.314%202.73.944.683.63.998%2
1557701.47.998%202.52v5.04h-1.47v-1.156h-.052c-.63.945-1.523%201.418-2.573%201.418-.892%200-1.68-.263-2.31-.788-.578-.525-.945-1.26-.945-2.047%200-.84.315-1.522.945-2.047.63-.525%201.523-.735%202.573-.735.945%200%201.68.157%202.257.525v-.368c0-.525-.21-1.05-.63-1.364a2.287%202.287%200%200%200-1.523-.578c-.892%200-1.575.368-2.047%201.102l-1.365-.84c.84-1.102%201.942-1.627%203.412-1.627Zm-1.994%205.984c0%20.42.21.787.524.997.368.262.788.42%201.208.42.63%200%201.26-.263%201.733-.735.524-.472.787-1.05.787-1.68-.473-.367-1.155-.577-2.047-.577-.63%200-1.155.157-1.576.472-.42.263-.63.63-.63%201.102ZM42%206.981l-5.198%2011.917h-1.575l1.943-4.147-3.413-7.717h1.68l2.468%205.932h.052l2.415-5.932H42V6.98Z'/%3e%3cpath%20fill='%234285F4'%20d='M13.598%209.291c0-.472-.053-.945-.105-1.417H6.93v2.677h3.728c-.158.84-.63%201.627-1.365%202.1v1.732h2.257c1.313-1.207%202.048-2.992%202.048-5.092Z'/%3e%3cpath%20fill='%2334A853'%20d='M6.93%2016.063c1.89%200%203.465-.63%204.62-1.68l-2.258-1.732c-.63.42-1.417.682-2.362.682-1.785%200-3.36-1.207-3.885-2.887H.735v1.785c1.207%202.362%203.57%203.832%206.195%203.832Z'/%3e%3cpath%20fill='%23FBBC04'%20d='M3.045%2010.446c-.315-.84-.315-1.784%200-2.677V5.984H.735c-.998%201.943-.998%204.252%200%206.247l2.31-1.785Z'/%3e%3cpath%20fill='%23EA4335'%20d='M6.93%204.934a3.91%203.91%200%200%201%202.678%201.05l1.995-1.995c-1.26-1.155-2.94-1.837-4.62-1.785-2.625%200-5.04%201.47-6.195%203.833l2.31%201.784c.472-1.68%202.047-2.887%203.832-2.887Z'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h42v20H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", 15578 ideal: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='23'%20height='20'%20fill='none'%20viewBox='0%200%2023%2020'%3e%3cpath%20fill='%23fff'%20d='m16.238%201.62-3.476-.29-11.676-.176v17.943H13.55l4.153-1.128%202.827-2.448%201.383-3.85V7.224L19.845%203.65l-3.607-2.03Z'/%3e%3cpath%20fill='%230A0B09'%20d='M1.455%201.455v17.09H11.85c6.279%200%209.694-2.921%209.694-8.567%200-5.802-3.702-8.523-9.694-8.523H1.455ZM11.85.568c9.207%200%2010.582%205.896%2010.582%209.41%200%206.096-3.758%209.454-10.582%209.454H.566V.568h11.285Z'/%3e%3cpath%20fill='%23D50172'%20d='M7.87%207.329v1.928h.592c.41%200%20.79-.119.79-.98%200-.84-.422-.948-.79-.948h-.593Zm9.886-.96h.959v2.888h1.42c-.39-5.24-4.517-6.371-8.267-6.371H7.87V6.37h.592c1.079%200%201.75.731%201.75%201.907%200%201.212-.655%201.936-1.75%201.936H7.87v6.975h3.998c6.098%200%208.22-2.828%208.295-6.975h-2.407V6.37Zm-2.671%202.146h.693l-.317-1.087h-.058l-.318%201.087Zm-1.496%201.7%201.16-3.846h1.364l1.161%203.846h-.998l-.217-.744h-1.255l-.218.744h-.997Zm-.46-.958v.957h-2.373V6.371h2.296v.957h-1.337v.445h1.264v.957h-1.264v.527h1.413Z'/%3e%3cpath%20fill='%23000'%20d='M6.615%208.29a2.068%202.068%200%200%201-4.137%200%202.068%202.068%200%200%201%204.137%200Zm-3.728%208.895h3.328V11.27H2.887v5.916Z'/%3e%3c/svg%3e", 15579 mybank: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='20'%20fill='none'%20viewBox='0%200%2028%2020'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20fill='%23334B66'%20d='M19.277%208.466c-1.077-.01-1.586.623-1.586.623-.328.355-.114.833.203.866.46.05.46-.344%201.165-.516.623-.156.65.433.65.433-2.652-.067-2.526%202.194-1.624%202.672.864.461%201.674-.122%201.674-.122s.032.311.459.311c.492%200%20.492-.494.492-.494v-2.2c-.033-1.617-1.433-1.573-1.433-1.573Zm-.207%203.184s-.695.144-.69-.361c.006-.506%201.264-.473%201.395-.434%200%200%20.038.573-.705.795Zm8.771.194-1.083-1.655.793-.761s.367-.345.066-.69c-.334-.377-.733-.005-.733-.005l-1%20.945v-1.89a.486.486%200%200%200-.482-.488.486.486%200%200%200-.481.489v4.45c0%20.272.219.489.481.489a.486.486%200%200%200%20.481-.49V11.05l.18-.184.98%201.556s.317.539.787.194c.361-.255.011-.772.011-.772Zm-3.451-1.81c0-1.606-1.317-1.834-2.214-1.323v.006a.49.49%200%200%200-.624-.311.502.502%200%200%200-.333.478v3.35c0%20.277.218.5.492.5a.494.494%200%200%200%20.492-.5l-.005-2.262a1.9%201.9%200%200%201%20.311-.283c.465-.333.903-.217.903.35l.01%202.206a.492.492%200%200%200%20.504.477.493.493%200%200%200%20.47-.477l-.005-2.211Z'/%3e%3cpath%20fill='%232ABAEA'%20d='M10.194%2012.794c.065-.1.11-.21.131-.327L9.209%209.505s-.202-.572.246-.744c.47-.178.646.278.679.372l.705%201.906.645-1.9s.186-.59.7-.384c.427.173.208.756.208.756s-.662%201.983-1.214%203.417c-.328.86-.612.944-.935%201.022-.432.106-1.247.056-1.247-.489%200-.428.432-.456.629-.45.01.011.416.045.569-.217ZM7.602%207.817l-1.018%202.855-1.11-2.839s-.164-.539-.629-.539c-.536%200-.52.434-.53.54-.011.105%200%204.438%200%204.438s-.006.456.487.456c.503%200%20.48-.461.48-.461v-2.29l.821%202.29s.12.45.498.444c.377-.005.487-.444.487-.444l.683-2.284v2.284s0%20.46.498.46c.481%200%20.481-.46.481-.46V7.833s0-.544-.52-.539c-.431.006-.596.428-.628.523v.016Z'/%3e%3cpath%20fill='%232ABAEA'%20d='M28%2014.478H13.08l.006.005a6.736%206.736%200%200%201-9.598.773C.629%2012.778.284%208.416%202.723%2
1557905.51a6.73%206.73%200%200%201%209.598-.772%206.7%206.7%200%200%201%20.777.794h1.367C12.042%201.845%207.125.85%203.495%203.317c-3.632%202.466-4.605%207.46-2.177%2011.15%202.428%203.689%207.339%204.678%2010.97%202.21.514-.35.985-.755%201.406-1.216l13.655-.01.65-.973Z'/%3e%3cpath%20fill='%23334B66'%20d='M16.554%209.817c.027-.04.355-.306.328-1.028-.055-1.456-1.296-1.439-1.575-1.45-.443-.011-.71-.006-1.526%200-.689.005-.683.644-.683.644v4.745h2.318c1.242%200%201.701-.695%201.701-1.667%200-.972-.563-1.244-.563-1.244Zm-2.456-1.473h1.28c.257.006.525.145.525.534%200%20.405-.235.533-.525.533h-1.28V8.344Zm1.373%203.417h-1.373v-1.333h1.373c.334.016.656.189.656.666%200%20.49-.295.667-.656.667Z'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h28v20H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", 15580 p24: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='21'%20fill='none'%20viewBox='0%200%2032%2021'%3e%3cpath%20fill='%23E72242'%20stroke='%23E72242'%20stroke-miterlimit='10'%20stroke-width='.97'%20d='M1%2019.986%203.081%208.29h5.371c1.325%200%202.18.251%202.571.763.392.512.467%201.457.215%202.853-.252%201.397-.653%202.248-1.241%202.732-.588.484-1.568.731-2.95.731H3.143l-.821%204.608-1.321.01Zm2.333-5.725H6.47c1.311%200%202.174-.13%202.594-.4.42-.27.71-.884.882-1.862.206-1.13.206-1.861%200-2.145-.205-.284-.76-.466-1.694-.466H4.206l-.873%204.873Z'/%3e%3cpath%20fill='%23A9ABAA'%20stroke='%23A9ABAA'%20stroke-miterlimit='10'%20stroke-width='.97'%20d='M19.833%2018.892%2019.637%2020h-8.25l.387-2.188c.215-1.222.592-2.023%201.13-2.401.536-.382%201.708-.675%203.504-.875%201.437-.162%202.327-.377%202.67-.647.34-.275.61-.977.811-2.118.178-.996.13-1.643-.144-1.94-.276-.298-.966-.466-2.068-.466-1.376%200-2.263.121-2.669.363-.406.242-.686.838-.868%201.755l-.135.865H12.74l.112-.6c.248-1.396.7-2.327%201.363-2.793.663-.465%201.866-.688%203.598-.688%201.555%200%202.55.248%202.982.744.432.497.525%201.47.28%202.919-.243%201.396-.659%202.327-1.232%202.792-.574.465-1.713.782-3.398.93-1.477.15-2.38.355-2.706.615-.327.26-.597%201-.812%202.216l-.07.39%206.976.02ZM30.688%208.397l-1.4%207.82H31l-.196%201.107H29.11L28.644%2020h-1.302l.466-2.676h-6.402l.27-1.54%207-7.387h2.012Zm-2.674%207.82%201.232-6.982h-.028l-6.533%206.981h5.329Z'/%3e%3cpath%20fill='%23A9ABAA'%20d='M6.758%203.99a18.563%2018.563%200%200%201%203.482-1.57l-.219-1.27a24.724%2024.724%200%200%200-4.484%201.903l1.222.935Zm13.827-.685L24.887.978A23.518%2023.518%200%200%200%2017.99.001h-.028l-.989%201.968a12.12%2012.12%200%200%201%203.612%201.336ZM4.44%203.706a17.169%2017.169%200%200%200-2.9%202.173h2.394a21.27%2021.27%200%200%201%201.722-1.224l-1.218-.95ZM16.567.02a25.755%2025.755%200%200%200-5.6.87l.164%201.27a13.07%2013.07%200%200%201%204.876-.363l.56-1.777Zm10.639%201.856-5.6%202.067c.277.196.54.41.79.642h8.291s-.938-1.438-3.481-2.709Z'/%3e%3c/svg%3e", 15581 paypal: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='83'%20height='20'%20fill='none'%20viewBox='0%200%2083%2020'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20fill='%23009EE3'%20fill-rule='evenodd'%20d='M7.24%204.71h5.675c3.046%200%204.194%201.531%204.012%203.789-.29%203.721-2.553%205.777-5.552%205.777H9.862c-.412%200-.69.269-.797%201.008l-.642%204.266c-.04.275-.19.437-.405.457H4.45c-.338%200-.452-.256-.365-.806l2.17-13.685c.087-.545.385-.807.986-.807Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23113984'%20fill-rule='evenodd'%20d='M31.868%204.454c1.911%200%203.68%201.035%203.438%203.608-.29%203.056-1.939%204.75-4.54%204.756h-2.269c-.324%200-.486.262-.567.806l-.44%202.775c-.067.416-.283.625-.6.625h-2.115c-.337%200-.452-.215-.378-.692L26.14%205.2c.088-.551.29-.753.668-.753h5.06v.007Zm-3.445%205.959h1.722c1.074-.04%201.79-.78%201.865-2.116.04-.827-.52-1.418-1.412-1.411l-1.621.007-.554%203.52Zm12.624%205.764c.196-.174.392-.262.365-.047l-.068.518c-.034.268.075.41.325.41h1.877c.318%200%20.473-.128.547-.612l1.155-7.222c.061-.363-.033-.538-.31-.538H42.87c-.19%200-.277.101-.324.383l-.075.444c-.04.228-.148.275-.243.04-.351-.826-1.243-1.196-2.492-1.162-2.898.06-4.843%202.244-5.053%205.045-.162%202.17%201.399%203.87%203.459%203.87%201.492-.007%202.161-.444%202.904-1.129Zm-1.574-1.108c-1.242%200-2.114-.988-1.931-2.204.182-1.21%201.344-2.203%202.593-2.203%201.25%200%202.114.987%201.932%202.203-.182%201.21-1.344%202.204-2.594%202.204Zm9.443-6.41h-1.905c-.391%200-.553.29-.425.652l2.364%206.88-2.317%203.271c-.196.276-.04.524.23.524h2.141c.
15581027%200%20.047.007.074.007.23%200%20.44-.12.56-.316l7.269-10.366c.223-.316.121-.651-.25-.651H54.63c-.345%200-.487.134-.683.423l-3.032%204.367-1.351-4.38c-.081-.27-.277-.41-.649-.41Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23009EE3'%20fill-rule='evenodd'%20d='M64.465%204.454c1.912%200%203.682%201.035%203.438%203.608-.29%203.056-1.938%204.75-4.539%204.756h-2.27c-.323%200-.486.262-.567.806l-.439%202.775c-.067.416-.283.625-.6.625h-2.115c-.338%200-.453-.215-.378-.692L58.745%205.2c.087-.544.29-.753.668-.753l5.052.007Zm-3.438%205.959h1.723c1.074-.04%201.79-.78%201.864-2.116.04-.827-.52-1.418-1.412-1.411l-1.62.007-.555%203.52Zm12.618%205.764c.196-.174.392-.262.365-.047l-.068.518c-.034.268.074.41.324.41h1.878c.317%200%20.473-.128.547-.612l1.155-7.222c.06-.363-.034-.538-.31-.538h-2.06c-.19%200-.278.101-.325.383l-.074.444c-.04.228-.149.275-.243.04-.352-.826-1.243-1.196-2.486-1.162-2.898.06-4.843%202.244-5.052%205.045-.163%202.17%201.398%203.87%203.458%203.87%201.493%200%202.161-.437%202.911-1.122l-.02-.007Zm-1.567-1.108c-1.243%200-2.115-.988-1.932-2.204.182-1.21%201.344-2.203%202.594-2.203%201.243%200%202.114.987%201.931%202.203-.182%201.21-1.35%202.204-2.593%202.204Zm8.652%201.995h-2.18a.256.256%200%200%201-.257-.255v-.034l1.905-11.992a.373.373%200%200%201%20.358-.289h2.181c.142%200%20.257.115.257.256v.033l-1.905%2011.992a.362.362%200%200%201-.358.289Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23113984'%20fill-rule='evenodd'%20d='M3.695%200h5.68c1.601%200%203.499.054%204.762%201.162.845.746%201.29%201.928%201.189%203.205-.351%204.313-2.938%206.725-6.417%206.725H6.106c-.48%200-.79.316-.925%201.162l-.784%204.951c-.054.323-.19.51-.439.531H.459c-.385%200-.527-.289-.425-.934L2.554.941C2.653.302%203.005%200%203.693%200Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23172C70'%20fill-rule='evenodd'%20d='m5.262%2011.757.993-6.241c.087-.545.385-.813.986-.813h5.674c.939%200%201.695.147%202.29.416-.568%203.836-3.067%205.973-6.336%205.973h-2.79c-.378%200-.648.188-.817.665Z'%20clip-rule='evenodd'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h83v20H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e", 15582 trustly: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='92'%20height='20'%20fill='none'%20viewBox='0%200%2092%2020'%3e%3cpath%20fill='%23000'%20d='M30.673%2015.863V3.046H26.21V0h12.135v3.046h-4.462v12.817h-3.211Z'/%3e%3cpath%20fill='%23000'%20d='M37.84%2015.864V4.354h2.953v1.822c.7-1.547%201.6-1.822%202.567-1.822h1.14v3.083h-.965c-1.39%200-2.632.826-2.632%203.35v5.085H37.84v-.01Zm8.05-4.213V4.355h3.054v6.584c0%201.348.635%202.344%201.941%202.344%201.26%200%202.061-.996%202.061-2.325V4.355H56v11.518h-2.907v-1.452c-.736%201.148-1.83%201.718-3.22%201.718-2.447-.01-3.983-1.746-3.983-4.488Zm11.417.977%202.659-.626c.129.892.819%201.566%202.153%201.566%201.03%200%201.6-.437%201.6-.978%200-.436-.23-.759-1.288-.996l-1.747-.389c-2.236-.503-3.184-1.565-3.184-3.5%200-1.974%201.583-3.568%204.554-3.568%203.156%200%204.425%201.954%204.554%203.235l-2.677.607c-.129-.673-.607-1.413-1.941-1.413-.846%200-1.472.389-1.472.958%200%20.474.313.74.865.873l2.548.607c1.941.455%202.843%201.65%202.843%203.349%200%201.822-1.408%203.738-4.637%203.738-3.551-.01-4.71-2.201-4.83-3.463Zm15.337%203.236c-1.979%200-3.303-1.13-3.303-3.369V7.106h-1.877v-2.76h1.877V1.784l3.054-.911v3.473h2.254v2.76h-2.254v4.82c0%20.845.423%201.177%201.242%201.177h1.178v2.76h-2.171Zm3.826-.001V.01h3.055v15.864h-3.054v-.01ZM88.734%204.355H92L87.345%2020h-3.266l1.288-4.127h-1.684L80.61%204.355h3.266l2.3%208.909%202.558-8.909ZM0%206.954h7.167V1.053l5.722%205.901-5.722%205.892v3.017h6.946V6.954h6.375V.01H0v6.945Z'/%3e%3c/svg%3e", 15583 card: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='96'%20height='66'%20fill='none'%20viewBox='0%200%2096%2066'%3e%3cpath%20fill='%23000'%20d='M69%2040.5v-36C69%202.019%2066.981%200%2064.5%200h-60A4.505%204.505%200%200%200%200%204.5v36C0%2042.981%202.019%2045%204.5%2045h60c2.481%200%204.5-2.019%204.5-4.5Zm-66%200v-36C3%203.673%203.673%203%204.5%203h60c.827%200%201.5.673%201.5%201.5v36c0%20.827-.673%201.5-1.5%201.5h-60c-.827%200-1.5-.673-1.5-1.5Z'/%3e%3cpath%20fill='%23000'%20d='M91.5%2021h-18a1.5%201.5%200%200%200%200%203h18c.827%200%201.5.673%201.5%201.5V33H73.5a1.5%201.5%200%200%200%200%203H93v25.5c0%20.827-.673%201.5-1.5%201.5h-60c-.827%200-1.5-.673-1.5-1.5v-12a1.5%201.5%200%200%200-3%200v12c0%202.481%202.019%204.5%204.5%204.5h60c2.481%200%204.5-2.019%204.5-4.5v-36c0-2.481-2.019
15583-4.5-4.5-4.5Zm-60%2010.5H24a1.5%201.5%200%200%200%200%203h7.5a1.5%201.5%200%200%200%200-3Zm-13.5%200h-7.5a1.5%201.5%200%200%200%200%203H18a1.5%201.5%200%200%200%200-3Z'/%3e%3cpath%20fill='%23000'%20d='M58.5%2031.5H51a1.5%201.5%200%200%200%200%203h7.5a1.5%201.5%200%200%200%200-3Zm-13.5%200h-7.5a1.5%201.5%200%200%200%200%203H45a1.5%201.5%200%200%200%200-3Zm-28.5-24H12A4.505%204.505%200%200%200%207.5%2012v1.5c0%202.481%202.019%204.5%204.5%204.5h4.5c2.481%200%204.5-2.019%204.5-4.5V12c0-2.481-2.019-4.5-4.5-4.5Zm1.5%206c0%20.827-.673%201.5-1.5%201.5H12c-.827%200-1.5-.673-1.5-1.5V12c0-.827.673-1.5%201.5-1.5h4.5c.827%200%201.5.673%201.5%201.5v1.5Zm37.5-6c-1.79%200-3.4.79-4.5%202.038A5.986%205.986%200%200%200%2046.5%207.5c-3.308%200-6%202.692-6%206s2.692%206%206%206c1.79%200%203.4-.79%204.5-2.038a5.986%205.986%200%200%200%204.5%202.038c3.308%200%206-2.692%206-6s-2.692-6-6-6Zm-9%209c-1.654%200-3-1.346-3-3s1.346-3%203-3%203%201.346%203%203-1.346%203-3%203Zm9%200c-1.654%200-3-1.346-3-3s1.346-3%203-3%203%201.346%203%203-1.346%203-3%203Zm18%2013.5H90a1.5%201.5%200%200%200%200-3H73.5a1.5%201.5%200%200%200%200%203Zm12%2018H57a1.5%201.5%200%200%200%200%203h28.5a1.5%201.5%200%200%200%200-3Zm0%206h-18a1.5%201.5%200%200%200%200%203h18a1.5%201.5%200%200%200%200-3Z'/%3e%3c/svg%3e", 15584 multibanco: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='153'%20height='147'%20fill='none'%20viewBox='0%200%20153%20147'%3e%3cpath%20fill='%233D73B9'%20fill-rule='evenodd'%20d='M76.2%20146.57h63.06c14.39%200%2014.54-15.3%2013.07-22.85-.8-5.08-9.43-5-10.38%200v5.89a4.912%204.912%200%200%201-4.9%204.9H16.17a4.909%204.909%200%200%201-4.9-4.9v-5.89c-.95-5-9.58-5.08-10.38%200-1.47%207.55-1.32%2022.85%2013.07%2022.85H76.2ZM31.63-.01h97.22c6.83%200%2012.42%205.92%2012.42%2013.15v6.28c0%208.88-12%208.84-12%20.06v-3.42a4.001%204.001%200%200%200-4-4H27.85a4%204%200%200%200-4%204v3.36c0%208.83-11.46%208.77-11.46.19v-6.46C12.42%205.92%2018-.01%2024.83-.01h6.8Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%231D1D1B'%20fill-rule='evenodd'%20d='M138.82%2072.2a19.224%2019.224%200%200%201%2011.38%2017.22c0%2010.58-9.24%2019.24-20.53%2019.24H98a5.228%205.228%200%200%201-5.38-5V43.38a5.3%205.3%200%200%201%205.29-5.28h26.37a20.128%2020.128%200%200%201%2019.844%2023.773A20.124%2020.124%200%200%201%20138.82%2072.2Zm-23.63-4.9h10.05v-.11a9.611%209.611%200%200%200%208.12-9.45%209.591%209.591%200%200%200-9.56-9.56h-20.25v50h25.67a9.877%209.877%200%200%200%209.412-6.022%209.885%209.885%200%200%200-2.223-10.95%209.882%209.882%200%200%200-7.189-2.778h-14.03a5.553%205.553%200%200%201-5.55-5.55%205.548%205.548%200%200%201%203.426-5.127%205.553%205.553%200%200%201%202.124-.423'%20clip-rule='evenodd'/%3e%3cpath%20fill='%231D1D1B'%20d='M87.59%20102.65a6.357%206.357%200%200%201-5.624%207.234%206.346%206.346%200%200%201-4.762-1.455%206.355%206.355%200%200%201-2.254-4.439l-5.23-47.91-18.41%2046.85v.57a6.124%206.124%200%200%201-1.59%201.82l-.1.08a5.762%205.762%200%200%201-1.1.78l-.12.06-.11.06h-.63a6.085%206.085%200%200%201-1.86.35h-.46a6.106%206.106%200%200%201-2.08-.43h-.52l-.11-.06-.1-.06h-.06a6.003%206.003%200%200%201-1-.67l-.21-.19-.16-.15-.38-.1-.19-.21a6%206%200%200%201-.67-1v-.06l-.06-.1-.06-.11v-.47L20.99%2056.08l-5.21%2047.91a6.35%206.35%200%200%201-12.63-1.34l6.14-56.48a10.54%2010.54%200%200%201%209.08-9.28h.34a10.87%2010.87%200%200%201%201.61%200c.647.026%201.29.113%201.92.26a10.43%2010.43%200%200%201%207.39%206.38l15.74%2039.78L61.08%2043.4a10.45%2010.45%200%200%201%209.31-6.64%2010.87%2010.87%200%200%201%201.61%200h.34a10.561%2010.561%200%200%201%207.9%205.48c.307.591.564%201.206.77%201.84.202.651.34%201.321.41%202l6.17%2056.57Z'/%3e%3c/svg%3e" 15585 }; 15586 //#endregion 15587 //#region src/components/paypal/payment-method-component/paymentMethodStore.svelte.ts 15588 var chosenMethod = proxy({ method: void 0 }); 15589 //#endregion 15590 //#region src/components/paypal/payment-method-component/PaymentMethod.svelte 15591 var root$65 = /* @__PURE__ */ from_html(`<button>Pay Now!</button>`); 15592 var root_1$20 = /* @__PURE__ */ from_html(`<div><div class="pm-radio svelte-1yayqty"><input class="radio-input" type="radio"/></div> <div class="pm-content svelte-1yayqty"><label class="pm-header svelte-1yayqty"><div class="pm-label svelte-1yayqty"> </div> <div class="icon-container svelte-1yayqty"><img alt="" class="svelte-1yayqty"/></div></label> <div><!> <!></div></div></div>`); 15593 var $$css$1 = { 15594 hash: "svelte-1yayqty", 15595 code: "label.svelte-1yayqty {all:unset;cursor:pointer;}.payment-method.svelte-1yayqty {gap:12px;padding:16px 20px;margin-bottom:16px;max-width:450px;border-radius:8px;border:1px solid #c8cedd;border:1px solid var(--border-1, #c8cedd);background:#fff;box-shadow:0px 2px 5.8px 0px rgba(0, 0, 0, 0.05);display:flex;flex-direction:row;}.payment-method.svelte-1yayqty .pm-header:where(.svelte-1yayqty) {display:flex;justify-content:space-between;flex-direction:row;width:100%;}.payment-method.pm-column.svelte-1yayqty .pm-header:where(.svelte-1yayqty) {flex-direction:column;}.payment-method.pm-column.svelte-1yayqty .pm-header:where(.svelte-1yayqty) .pm-label:where(.svelte-1yayqty) {padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid #c8cedd;border-bottom:1px solid var(--border-1, #c8cedd);}.icon-container.svelte-1yayqty {width:-moz-fit-content;width:fit-content;height:20px;}.icon-container.svelte-1yayqty img:where(.svelte-1yayqty) {max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain;}.pm-slot.svelte-1yayqty {height:0;overflow:hidden;}.pm-slot.pm-show.svelte-1yayqty {padding-top:16px;height:auto;}.pm-radio.svelte-1yayqty {display:inline-block;}.pm-label.svelte-1yayqty {font-weight:bold;}.pm-content.svelte-1yayqty {display:flex;flex-direction:column;width:100%;}#payment-method-googlepay-container:not(.pm-show),\n #payment-method-applepay-container:not(.pm-show) {display:none;}" 15596 }; 15597 function PaymentMethod($$anchor, $$props) { 15598 push($$props, true); 15599 append_styles$1($$anchor, $$css$1); 15600 const binding_group = []; 15601 let name = prop($$props, "name", 7), icon = prop($$props, "icon", 7), layout = prop($$props, "layout", 7, "row"), test = prop($$props, "test", 7, false); 15602 let imgsrc = paymentIcons[icon()] ?? icon(); 15603 let isOpen = /* @__PURE__ */ user_derived(() => chosenMethod.method === name()); 15604 let fundingSource = name().toLowerCase().replace(" ", ""); 15605 console.log(imgsrc, name()); 15606 var $$exports = { 15607 get name() { 15608 return name(); 15609 }, 15610 set name($$value) { 15611 name($$value); 15612 flushSync(); 15613 }, 15614 get icon() { 15615 return icon(); 15616 }, 15617 set icon($$value) { 15618 icon($$value); 15619 flushSync(); 15620 }, 15621 get layout() { 15622 return layout(); 15623 }, 15624 set layout($$value = "row") { 15625 layout($$value); 15626 flushSync(); 15627 }, 15628 get test() { 15629 return test(); 15630 }, 15631 set test($$value = false) { 15632 test($$value); 15633 flushSync(); 15634 } 15635 }; 15636 var div = root_1$20(); 15637 var div_1 = child(div); 15638 var input = child(div_1); 15639 remove_input_defaults(input); 15640 var input_value; 15641 reset(div_1); 15642 var div_2 = sibling(div_1, 2); 15643 var label = child(div_2); 15644 var div_3 = child(label); 15645 var text = child(div_3, true); 15646 reset(div_3); 15647 var div_4 = sibling(div_3, 2); 15648 var img = child(div_4); 15649 reset(div_4); 15650 reset(label); 15651 var div_5 = sibling(label, 2); 15652 let classes; 15653 var node = child(div_5); 15654 var consequent = ($$anchor) => { 15655 append($$anchor, root$65()); 15656 }; 15657 if_block(node, ($$render) => { 15658 if (test()) $$render(consequent); 15659 }); 15660 slot(sibling(node, 2), $$props, "default", {}, null); 15661 reset(div_5); 15662 reset(div_2); 15663 reset(div); 15664 template_effect(() => { 15665 set_class(div, 1, `payment-method pm-${layout() ?? ""}`, "svelte-1yayqty"); 15666 set_attribute(div, "id", "payment-method-" + fundingSource + "-container"); 15667 set_attribute(input, "id", name()); 15668 if (input_value !== (input_value = name())) input.value = (input.__value = name()) ?? ""; 15669 set_attribute(label, "for", name()); 15670 set_text(text, name()); 15671 set_attribute(img, "src", imgsrc); 15672 classes = set_class(div_5, 1, "pm-slot svelte-1yayqty", null, classes, { "pm-show": get$2(isOpen) }); 15673 }); 15674 bind_group(binding_group, [], input, () => { 15675 name(); 15676 return chosenMethod.method; 15677 }, ($$value) => chosenMethod.method = $$value); 15678 append($$anchor, div); 15679 return pop($$exports); 15680 }
15681 create_custom_element(PaymentMethod, { 15682 name: {}, 15683 icon: {}, 15684 layout: {}, 15685 test: {} 15686 }, ["default"], [], { mode: "open" }); 15687 //#endregion 15688 //#region src/components/paypal/payment-methods/currentOrder.svelte.ts 15689 var currentOrder = proxy({ id: null }); 15690 //#endregion 15691 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@paypal/paypal-js/dist/esm/paypal-js.js 15692 /*! 15693 * paypal-js v9.7.0 (2026-04-27T17:34:27.064Z) 15694 * Copyright 2020-present, PayPal, Inc. All rights reserved. 15695 * 15696 * Licensed under the Apache License, Version 2.0 (the "License"); 15697 * you may not use this file except in compliance with the License. 15698 * You may obtain a copy of the License at 15699 * 15700 * http://www.apache.org/licenses/LICENSE-2.0 15701 * 15702 * Unless required by applicable law or agreed to in writing, software 15703 * distributed under the License is distributed on an "AS IS" BASIS, 15704 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15705 * See the License for the specific language governing permissions and 15706 * limitations under the License. 15707 */ 15708 /****************************************************************************** 15709 Copyright (c) Microsoft Corporation. 15710 15711 Permission to use, copy, modify, and/or distribute this software for any 15712 purpose with or without fee is hereby granted. 15713 15714 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 15715 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15716 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 15717 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15718 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 15719 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15720 PERFORMANCE OF THIS SOFTWARE. 15721 ***************************************************************************** */ 15722 function __rest(s, e) { 15723 var t = {}; 15724 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; 15725 if (s != null && typeof Object.getOwnPropertySymbols === "function") { 15726 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; 15727 } 15728 return t; 15729 } 15730 function findScript(url, attributes) { 15731 var currentScript = document.querySelector("script[src=\"".concat(url, "\"]")); 15732 if (currentScript === null) return null; 15733 var nextScript = createScriptElement(url, attributes); 15734 var currentScriptClone = currentScript.cloneNode(); 15735 delete currentScriptClone.dataset.uidAuto; 15736 if (Object.keys(currentScriptClone.dataset).length !== Object.keys(nextScript.dataset).length) return null; 15737 var isExactMatch = true; 15738 Object.keys(currentScriptClone.dataset).forEach(function(key) { 15739 if (currentScriptClone.dataset[key] !== nextScript.dataset[key]) isExactMatch = false; 15740 }); 15741 return isExactMatch ? currentScript : null; 15742 } 15743 function insertScriptElement(_a) { 15744 var url = _a.url, attributes = _a.attributes, onSuccess = _a.onSuccess, onError = _a.onError; 15745 var newScript = createScriptElement(url, attributes); 15746 newScript.onerror = onError; 15747 newScript.onload = onSuccess; 15748 document.head.insertBefore(newScript, document.head.firstElementChild); 15749 } 15750 function processOptions(options) { 15751 var customSdkBaseUrl = Object.prototype.hasOwnProperty.call(options, "sdkBaseUrl") ? options.sdkBaseUrl : void 0; 15752 var environment = options.environment; 15753 options.sdkBaseUrl; 15754 var rest = __rest(options, ["environment", "sdkBaseUrl"]); 15755 var sdkBaseUrl = customSdkBaseUrl || processSdkBaseUrl(environment); 15756 var optionsWithStringIndex = rest; 15757 var _a = Object.keys(optionsWithStringIndex).filter(function(key) { 15758 return typeof optionsWithStringIndex[key] !== "undefined" && optionsWithStringIndex[key] !== null && optionsWithStringIndex[key] !== ""; 15759 }).reduce(function(accumulator, key) { 15760 var value = optionsWithStringIndex[key].toString(); 15761 key = camelCaseToKebabCase(key); 15762 if (key.substring(0, 4) === "data" || key === "crossorigin") accumulator.attributes[key] = value; 15763 else accumulator.queryParams[key] = value; 15764 return accumulator; 15765 }, { 15766 queryParams: {}, 15767 attributes: {} 15768 }), queryParams = _a.queryParams, attributes = _a.attributes; 15769 if (queryParams["merchant-id"] && queryParams["merchant-id"].indexOf(",") !== -1) { 15770 attributes["data-merchant-id"] = queryParams["merchant-id"]; 15771 queryParams["merchant-id"] = "*"; 15772 } 15773 return { 15774 url: "".concat(sdkBaseUrl, "?").concat(objectToQueryString(queryParams)), 15775 attributes 15776 }; 15777 } 15778 function camelCaseToKebabCase(str) { 15779 var replacer = function(match, indexOfMatch) { 15780 return (indexOfMatch ? "-" : "") + match.toLowerCase(); 15781 }; 15782 return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, replacer); 15783 } 15784 function objectToQueryString(params) { 15785 var queryString = "";
15786 Object.keys(params).forEach(function(key) { 15787 if (queryString.length !== 0) queryString += "&"; 15788 queryString += key + "=" + params[key]; 15789 }); 15790 return queryString; 15791 } 15792 function processSdkBaseUrl(environment) { 15793 return environment === "sandbox" ? "https://www.sandbox.paypal.com/sdk/js" : "https://www.paypal.com/sdk/js"; 15794 } 15795 function createScriptElement(url, attributes) { 15796 if (attributes === void 0) attributes = {}; 15797 var newScript = document.createElement("script"); 15798 newScript.src = url; 15799 Object.keys(attributes).forEach(function(key) { 15800 newScript.setAttribute(key, attributes[key]); 15801 if (key === "data-csp-nonce") newScript.setAttribute("nonce", attributes["data-csp-nonce"]); 15802 }); 15803 return newScript; 15804 } 15805 /** 15806 * Load the Paypal JS SDK script asynchronously. 15807 * 15808 * @param {Object} options - used to configure query parameters and data attributes for the JS SDK. 15809 * @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill. 15810 * @return {Promise<Object>} paypalObject - reference to the global window PayPal object. 15811 */ 15812 function loadScript(options, PromisePonyfill) { 15813 if (PromisePonyfill === void 0) PromisePonyfill = Promise; 15814 validateArguments(options, PromisePonyfill); 15815 if (typeof document === "undefined") return PromisePonyfill.resolve(null); 15816 var _a = processOptions(options), url = _a.url, attributes = _a.attributes; 15817 var namespace = attributes["data-namespace"] || "paypal"; 15818 var existingWindowNamespace = getPayPalWindowNamespace(namespace); 15819 if (!attributes["data-js-sdk-library"]) attributes["data-js-sdk-library"] = "paypal-js"; 15820 if (findScript(url, attributes) && existingWindowNamespace) return PromisePonyfill.resolve(existingWindowNamespace); 15821 return loadCustomScript({ 15822 url, 15823 attributes 15824 }, PromisePonyfill).then(function() { 15825 var newWindowNamespace = getPayPalWindowNamespace(namespace); 15826 if (newWindowNamespace) return newWindowNamespace; 15827 throw new Error("The window.".concat(namespace, " global variable is not available.")); 15828 }); 15829 } 15830 /** 15831 * Load a custom script asynchronously. 15832 * 15833 * @param {Object} options - used to set the script url and attributes. 15834 * @param {PromiseConstructor} [PromisePonyfill=window.Promise] - optional Promise Constructor ponyfill. 15835 * @return {Promise<void>} returns a promise to indicate if the script was successfully loaded. 15836 */ 15837 function loadCustomScript(options, PromisePonyfill) { 15838 if (PromisePonyfill === void 0) PromisePonyfill = Promise; 15839 validateArguments(options, PromisePonyfill); 15840 var url = options.url, attributes = options.attributes; 15841 if (typeof url !== "string" || url.length === 0) throw new Error("Invalid url."); 15842 if (typeof attributes !== "undefined" && typeof attributes !== "object") throw new Error("Expected attributes to be an object."); 15843 return new PromisePonyfill(function(resolve, reject) { 15844 if (typeof document === "undefined") return resolve(); 15845 insertScriptElement({ 15846 url, 15847 attributes, 15848 onSuccess: function() { 15849 return resolve(); 15850 }, 15851 onError: function() { 15852 return reject(new Error("The script \"".concat(url, "\" failed to load. Check the HTTP status code and response body in DevTools to learn more."))); 15853 } 15854 }); 15855 }); 15856 } 15857 function getPayPalWindowNamespace(namespace) { 15858 return window[namespace]; 15859 } 15860 function validateArguments(options, PromisePonyfill) { 15861 if (typeof options !== "object" || options === null) throw new Error("Expected an options object."); 15862 var environment = options.environment; 15863 if (environment && environment !== "production" && environment !== "sandbox") throw new Error("The `environment` option must be either \"production\" or \"sandbox\"."); 15864 if (typeof PromisePonyfill !== "undefined" && typeof PromisePonyfill !== "function") throw new Error("Expected PromisePonyfill to be a function."); 15865 } 15866 /*! 15867 * sweetalert2 v11.26.25 15868 * Released under the MIT License. 15869 */ 15870 //#endregion 15871 //#region src/components/paypal/payment-methods/apm.ts 15872 var import_sweetalert2_all = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => { 15873 (function(global, factory) { 15874 typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.Sweetalert2 = factory()); 15875 })(exports, (function() { 15876 "use strict"; 15877 function _assertClassBrand(e, t, n) { 15878 if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; 15879 throw new TypeError("Private element is not present on this object"); 15880 } 15881 function _checkPrivateRedeclaration(e, t) { 15882 if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); 15883 } 15884 function _classPrivateFieldGet2(s, a) { 15885 return s.get(_assertClassBrand(s, a)); 15886 } 15887 function _classPrivateFieldInitSpec(e, t, a) { 15888 _checkPrivateRedeclaration(e, t), t.set(e, a); 15889 } 15890 function _classPrivateFieldSet2(s, a, r) { 15891 return s.set(_assertClassBrand(s, a), r), r; 15892 } 15893 const RESTORE_FOCUS_TIMEOUT = 100; 15894 /** @type {GlobalState} */ 15895 const globalState = {}; 15896 const focusPreviousActiveElement = () => { 15897 if (globalState.previousActiveElement instanceof HTMLElement) { 15898 globalState.previousActiveElement.focus(); 15899 globalState.previousActiveElement = null; 15900 } else if (document.body) document.body.focus(); 15901 }; 15902 /** 15903 * Restore previous active (focused) element 15904 * 15905 * @param {boolean} returnFocus 15906 * @returns {Promise<void>} 15907 */ 15908 const restoreActiveElement = (returnFocus) => { 15909 return new Promise((resolve) => { 15910 if (!returnFocus) return resolve(); 15911 const x = window.scrollX; 15912 const y = window.scrollY; 15913 globalState.restoreFocusTimeout = setTimeout(() => { 15914 focusPreviousActiveElement(); 15915 resolve(); 15916 }, RESTORE_FOCUS_TIMEOUT); 15917 window.scrollTo(x, y); 15918 }); 15919 }; 15920 const swalPrefix = "swal2-"; 15921 const swalClasses = [ 15922 "container", 15923 "shown", 15924 "height-auto", 15925 "iosfix", 15926 "popup", 15927 "modal", 15928 "no-backdrop", 15929 "no-transition", 15930 "toast", 15931 "toast-shown", 15932 "show", 15933 "hide", 15934 "close", 15935 "title", 15936 "html-container", 15937 "actions", 15938 "confirm", 15939 "deny", 15940 "cancel", 15941 "footer", 15942 "icon", 15943 "icon-content", 15944 "image", 15945 "input", 15946 "file", 15947 "range", 15948 "select", 15949 "radio", 15950 "checkbox", 15951 "label", 15952 "textarea", 15953 "inputerror", 15954 "input-label", 15955 "validation-message", 15956 "progress-steps", 15957 "active-progress-step", 15958 "progress-step", 15959 "progress-step-line", 15960 "loader", 15961 "loading", 15962 "styled", 15963 "top", 15964 "top-start", 15965 "top-end", 15966 "top-left", 15967 "top-right", 15968 "center", 15969 "center-start", 15970 "center-end", 15971 "center-left", 15972 "center-right", 15973 "bottom", 15974 "bottom-start", 15975 "bottom-end", 15976 "bottom-left", 15977 "bottom-right", 15978 "grow-row", 15979 "grow-column", 15980 "grow-fullscreen", 15981 "rtl", 15982 "timer-progress-bar", 15983 "timer-progress-bar-container", 15984 "scrollbar-measure", 15985 "icon-success", 15986 "icon-warning", 15987 "icon-info", 15988 "icon-question", 15989 "icon-error", 15990 "draggable", 15991 "dragging" 15992 ].reduce( 15993 (acc, className) => { 15994 acc[className] = swalPrefix + className; 15995 return acc; 15996 }, 15997 /** @type {SwalClasses} */ 15998 {} 15999 ); 16000 const iconTypes = [ 16001 "success", 16002 "warning", 16003 "info", 16004 "question", 16005 "error" 16006 ].reduce( 16007 (acc, icon) => { 16008 acc[icon] = swalPrefix + icon; 16009 return acc; 16010 }, 16011 /** @type {SwalIcons} */ 16012 {} 16013 ); 16014 const consolePrefix = "SweetAlert2:"; 16015 /** 16016 * Capitalize the first letter of a string 16017 * 16018 * @param {string} str 16019 * @returns {string} 16020 */ 16021 const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1); 16022 /** 16023 * Standardize console warnings 16024 * 16025 * @param {string | string[]} message 16026 */ 16027 const warn = (message) => { 16028 console.warn(`${consolePrefix} ${typeof message === "object" ? message.join(" ") : message}`); 16029 }; 16030 /** 16031 * Standardize console errors 16032 * 16033 * @param {string} message 16034 */ 16035 const error = (message) => { 16036 console.error(`${consolePrefix} ${message}`); 16037 }; 16038 /** 16039 * Private global state for `warnOnce` 16040 * 16041 * @type {string[]} 16042 * @private 16043 */ 16044 const previousWarnOnceMessages = []; 16045 /** 16046 * Show a console warning, but only if it hasn't already been shown 16047 * 16048 * @param {string} message 16049 */ 16050 const warnOnce = (message) => { 16051 if (!previousWarnOnceMessages.includes(message)) { 16052 previousWarnOnceMessages.push(message); 16053 warn(message); 16054 } 16055 }; 16056 /** 16057 * Show a one-time console warning about deprecated params/methods 16058 * 16059 * @param {string} deprecatedParam 16060 * @param {string?} useInstead 16061 */ 16062 const warnAboutDeprecation = (deprecatedParam, useInstead = null) => { 16063 warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release.${useInstead ? ` Use "${useInstead}" instead.` : ""}`); 16064 }; 16065 /** 16066 * If `arg` is a function, call it (with no arguments or context) and return the result. 16067 * Otherwise, just pass the value through 16068 * 16069 * @param {(() => *) | *} arg 16070 * @returns {*} 16071 */ 16072 const callIfFunction = (arg) => typeof arg === "function" ? arg() : arg;
16073 /** 16074 * @param {*} arg 16075 * @returns {boolean} 16076 */ 16077 const hasToPromiseFn = (arg) => arg && typeof arg.toPromise === "function"; 16078 /** 16079 * @param {*} arg 16080 * @returns {Promise<*>} 16081 */ 16082 const asPromise = (arg) => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg); 16083 /** 16084 * @param {*} arg 16085 * @returns {boolean} 16086 */ 16087 const isPromise = (arg) => arg && Promise.resolve(arg) === arg; 16088 /** 16089 * @returns {boolean} 16090 */ 16091 const isFirefox = () => navigator.userAgent.includes("Firefox"); 16092 /** 16093 * Gets the popup container which contains the backdrop and the popup itself. 16094 * 16095 * @returns {HTMLElement | null} 16096 */ 16097 const getContainer = () => document.body.querySelector(`.${swalClasses.container}`); 16098 /** 16099 * @param {string} selectorString 16100 * @returns {HTMLElement | null} 16101 */ 16102 const elementBySelector = (selectorString) => { 16103 const container = getContainer(); 16104 return container ? container.querySelector(selectorString) : null; 16105 }; 16106 /** 16107 * @param {string} className 16108 * @returns {HTMLElement | null} 16109 */ 16110 const elementByClass = (className) => { 16111 return elementBySelector(`.${className}`); 16112 }; 16113 /** 16114 * @returns {HTMLElement | null} 16115 */ 16116 const getPopup = () => elementByClass(swalClasses.popup); 16117 /** 16118 * @returns {HTMLElement | null} 16119 */ 16120 const getIcon = () => elementByClass(swalClasses.icon); 16121 /** 16122 * @returns {HTMLElement | null} 16123 */ 16124 const getIconContent = () => elementByClass(swalClasses["icon-content"]); 16125 /** 16126 * @returns {HTMLElement | null} 16127 */ 16128 const getTitle = () => elementByClass(swalClasses.title); 16129 /** 16130 * @returns {HTMLElement | null} 16131 */ 16132 const getHtmlContainer = () => elementByClass(swalClasses["html-container"]); 16133 /** 16134 * @returns {HTMLElement | null} 16135 */ 16136 const getImage = () => elementByClass(swalClasses.image); 16137 /** 16138 * @returns {HTMLElement | null} 16139 */ 16140 const getProgressSteps = () => elementByClass(swalClasses["progress-steps"]); 16141 /** 16142 * @returns {HTMLElement | null} 16143 */ 16144 const getValidationMessage = () => elementByClass(swalClasses["validation-message"]); 16145 /** 16146 * @returns {HTMLButtonElement | null} 16147 */ 16148 const getConfirmButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`); 16149 /** 16150 * @returns {HTMLButtonElement | null} 16151 */ 16152 const getCancelButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`); 16153 /** 16154 * @returns {HTMLButtonElement | null} 16155 */ 16156 const getDenyButton = () => elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`); 16157 /** 16158 * @returns {HTMLElement | null} 16159 */ 16160 const getInputLabel = () => elementByClass(swalClasses["input-label"]); 16161 /** 16162 * @returns {HTMLElement | null} 16163 */ 16164 const getLoader = () => elementBySelector(`.${swalClasses.loader}`); 16165 /** 16166 * @returns {HTMLElement | null} 16167 */ 16168 const getActions = () => elementByClass(swalClasses.actions); 16169 /** 16170 * @returns {HTMLElement | null} 16171 */ 16172 const getFooter = () => elementByClass(swalClasses.footer); 16173 /** 16174 * @returns {HTMLElement | null} 16175 */ 16176 const getTimerProgressBar = () => elementByClass(swalClasses["timer-progress-bar"]); 16177 /** 16178 * @returns {HTMLElement | null} 16179 */ 16180 const getCloseButton = () => elementByClass(swalClasses.close); 16181 const focusable = ` 16182 a[href], 16183 area[href], 16184 input:not([disabled]), 16185 select:not([disabled]), 16186 textarea:not([disabled]), 16187 button:not([disabled]), 16188 iframe, 16189 object, 16190 embed, 16191 [tabindex="0"], 16192 [contenteditable], 16193 audio[controls], 16194 video[controls], 16195 summary 16196`; 16197 /** 16198 * @returns {HTMLElement[]} 16199 */ 16200 const getFocusableElements = () => { 16201 const popup = getPopup(); 16202 if (!popup) return []; 16203 /** @type {NodeListOf<HTMLElement>} */ 16204 const focusableElementsWithTabindex = popup.querySelectorAll("[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])"); 16205 const focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex).sort((a, b) => { 16206 const tabindexA = parseInt(a.getAttribute("tabindex") || "0"); 16207 const tabindexB = parseInt(b.getAttribute("tabindex") || "0"); 16208 if (tabindexA > tabindexB) return 1; 16209 else if (tabindexA < tabindexB) return -1; 16210 return 0; 16211 }); 16212 /** @type {NodeListOf<HTMLElement>} */ 16213 const otherFocusableElements = popup.querySelectorAll(focusable); 16214 const otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter((el) => el.getAttribute("tabindex") !== "-1"); 16215 return [...new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))].filter((el) => isVisible$1(el)); 16216 }; 16217 /** 16218 * @returns {boolean} 16219 */ 16220 const isModal = () => { 16221 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses["toast-shown"]) && !hasClass(document.body, swalClasses["no-backdrop"]); 16222 }; 16223 /** 16224 * @returns {boolean} 16225 */ 16226 const isToast = () => { 16227 const popup = getPopup(); 16228 if (!popup) return false;
16229 return hasClass(popup, swalClasses.toast); 16230 }; 16231 /** 16232 * @returns {boolean} 16233 */ 16234 const isLoading = () => { 16235 const popup = getPopup(); 16236 if (!popup) return false; 16237 return popup.hasAttribute("data-loading"); 16238 }; 16239 /** 16240 * Securely set innerHTML of an element 16241 * https://github.com/sweetalert2/sweetalert2/issues/1926 16242 * 16243 * @param {HTMLElement} elem 16244 * @param {string} html 16245 */ 16246 const setInnerHtml = (elem, html) => { 16247 elem.textContent = ""; 16248 if (html) { 16249 const parsed = new DOMParser().parseFromString(html, `text/html`); 16250 const head = parsed.querySelector("head"); 16251 if (head) Array.from(head.childNodes).forEach((child) => { 16252 elem.appendChild(child); 16253 }); 16254 const body = parsed.querySelector("body"); 16255 if (body) Array.from(body.childNodes).forEach((child) => { 16256 if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) elem.appendChild(child.cloneNode(true)); 16257 else elem.appendChild(child); 16258 }); 16259 } 16260 }; 16261 /** 16262 * @param {HTMLElement} elem 16263 * @param {string} className 16264 * @returns {boolean} 16265 */ 16266 const hasClass = (elem, className) => { 16267 if (!className) return false; 16268 return className.split(/\s+/).every((cls) => elem.classList.contains(cls)); 16269 }; 16270 /** 16271 * @param {HTMLElement} elem 16272 * @param {SweetAlertOptions} params 16273 */ 16274 const removeCustomClasses = (elem, params) => { 16275 Array.from(elem.classList).forEach((className) => { 16276 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) elem.classList.remove(className); 16277 }); 16278 }; 16279 /** 16280 * @param {HTMLElement} elem 16281 * @param {SweetAlertOptions} params 16282 * @param {string} className 16283 */ 16284 const applyCustomClass = (elem, params, className) => { 16285 removeCustomClasses(elem, params); 16286 if (!params.customClass) return; 16287 const customClass = params.customClass[className]; 16288 if (!customClass) return; 16289 if (typeof customClass !== "string" && !customClass.forEach) { 16290 warn(`Invalid type of customClass.${className}! Expected string or iterable object, got "${typeof customClass}"`); 16291 return; 16292 } 16293 addClass(elem, customClass); 16294 }; 16295 /** 16296 * @param {HTMLElement} popup 16297 * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass 16298 * @returns {HTMLInputElement | null} 16299 */ 16300 const getInput$1 = (popup, inputClass) => { 16301 if (!inputClass) return null; 16302 switch (inputClass) { 16303 case "select": 16304 case "textarea": 16305 case "file": return popup.querySelector(`.${swalClasses.popup} > .${swalClasses[inputClass]}`); 16306 case "checkbox": return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.checkbox} input`); 16307 case "radio": return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:checked`) || popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:first-child`); 16308 case "range": return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.range} input`); 16309 default: return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.input}`); 16310 } 16311 }; 16312 /** 16313 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input 16314 */ 16315 const focusInput = (input) => { 16316 input.focus(); 16317 if (input.type !== "file") { 16318 const val = input.value; 16319 input.value = ""; 16320 input.value = val; 16321 } 16322 }; 16323 /** 16324 * @param {HTMLElement | HTMLElement[] | null} target 16325 * @param {string | string[] | readonly string[] | undefined} classList 16326 * @param {boolean} condition 16327 */ 16328 const toggleClass = (target, classList, condition) => { 16329 if (!target || !classList) return; 16330 const classes = typeof classList === "string" ? classList.split(/\s+/).filter(Boolean) : classList; 16331 (Array.isArray(target) ? target : [target]).forEach((elem) => { 16332 classes.forEach((className) => { 16333 if (condition) elem.classList.add(className); 16334 else elem.classList.remove(className); 16335 }); 16336 }); 16337 }; 16338 /** 16339 * @param {HTMLElement | HTMLElement[] | null} target 16340 * @param {string | string[] | readonly string[] | undefined} classList 16341 */ 16342 const addClass = (target, classList) => { 16343 toggleClass(target, classList, true); 16344 }; 16345 /** 16346 * @param {HTMLElement | HTMLElement[] | null} target 16347 * @param {string | string[] | readonly string[] | undefined} classList 16348 */ 16349 const removeClass = (target, classList) => { 16350 toggleClass(target, classList, false); 16351 }; 16352 /**
16353 * Get direct child of an element by class name 16354 * 16355 * @param {HTMLElement} elem 16356 * @param {string} className 16357 * @returns {HTMLElement | undefined} 16358 */ 16359 const getDirectChildByClass = (elem, className) => Array.from(elem.children).find((child) => child instanceof HTMLElement && hasClass(child, className)); 16360 /** 16361 * @param {HTMLElement} elem 16362 * @param {string} property 16363 * @param {string | number | null | undefined} value 16364 */ 16365 const applyNumericalStyle = (elem, property, value) => { 16366 if (value === `${parseInt(`${value}`)}`) value = parseInt(value); 16367 if (value || value === 0) elem.style.setProperty(property, typeof value === "number" ? `${value}px` : /** @type {string} */ value); 16368 else elem.style.removeProperty(property); 16369 }; 16370 /** 16371 * @param {HTMLElement | null} elem 16372 * @param {string} display 16373 */ 16374 const show = (elem, display = "flex") => { 16375 if (!elem) return; 16376 elem.style.display = display; 16377 }; 16378 /** 16379 * @param {HTMLElement | null} elem 16380 */ 16381 const hide = (elem) => { 16382 if (!elem) return; 16383 elem.style.display = "none"; 16384 }; 16385 /** 16386 * @param {HTMLElement | null} elem 16387 * @param {string} display 16388 */ 16389 const showWhenInnerHtmlPresent = (elem, display = "block") => { 16390 if (!elem) return; 16391 new MutationObserver(() => { 16392 toggle(elem, elem.innerHTML, display); 16393 }).observe(elem, { 16394 childList: true, 16395 subtree: true 16396 }); 16397 }; 16398 /** 16399 * @param {HTMLElement} parent 16400 * @param {string} selector 16401 * @param {string} property 16402 * @param {string} value 16403 */ 16404 const setStyle = (parent, selector, property, value) => { 16405 /** @type {HTMLElement | null} */ 16406 const el = parent.querySelector(selector); 16407 if (el) el.style.setProperty(property, value); 16408 }; 16409 /** 16410 * @param {HTMLElement} elem 16411 * @param {boolean | string | null | undefined} condition 16412 * @param {string} display 16413 */ 16414 const toggle = (elem, condition, display = "flex") => { 16415 if (condition) show(elem, display); 16416 else hide(elem); 16417 }; 16418 /** 16419 * borrowed from jquery $(elem).is(':visible') implementation 16420 * 16421 * @param {HTMLElement | null} elem 16422 * @returns {boolean} 16423 */ 16424 const isVisible$1 = (elem) => Boolean(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); 16425 /** 16426 * @returns {boolean} 16427 */ 16428 const allButtonsAreHidden = () => !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton()); 16429 /** 16430 * @param {HTMLElement} elem 16431 * @returns {boolean} 16432 */ 16433 const isScrollable = (elem) => Boolean(elem.scrollHeight > elem.clientHeight); 16434 /** 16435 * @param {HTMLElement} element 16436 * @param {HTMLElement} stopElement 16437 * @returns {boolean} 16438 */ 16439 const selfOrParentIsScrollable = (element, stopElement) => { 16440 let parent = element; 16441 while (parent && parent !== stopElement) { 16442 if (isScrollable(parent)) return true; 16443 parent = parent.parentElement; 16444 } 16445 return false; 16446 }; 16447 /** 16448 * borrowed from https://stackoverflow.com/a/46352119 16449 * 16450 * @param {HTMLElement} elem 16451 * @returns {boolean} 16452 */ 16453 const hasCssAnimation = (elem) => { 16454 const style = window.getComputedStyle(elem); 16455 const animDuration = parseFloat(style.getPropertyValue("animation-duration") || "0"); 16456 const transDuration = parseFloat(style.getPropertyValue("transition-duration") || "0"); 16457 return animDuration > 0 || transDuration > 0; 16458 }; 16459 /** 16460 * @param {number} timer 16461 * @param {boolean} reset 16462 */ 16463 const animateTimerProgressBar = (timer, reset = false) => { 16464 const timerProgressBar = getTimerProgressBar(); 16465 if (!timerProgressBar) return; 16466 if (isVisible$1(timerProgressBar)) { 16467 if (reset) { 16468 timerProgressBar.style.transition = "none"; 16469 timerProgressBar.style.width = "100%"; 16470 } 16471 setTimeout(() => { 16472 timerProgressBar.style.transition = `width ${timer / 1e3}s linear`; 16473 timerProgressBar.style.width = "0%"; 16474 }, 10); 16475 } 16476 }; 16477 const stopTimerProgressBar = () => { 16478 const timerProgressBar = getTimerProgressBar(); 16479 if (!timerProgressBar) return; 16480 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); 16481 timerProgressBar.style.removeProperty("transition"); 16482 timerProgressBar.style.width = "100%"; 16483 const timerProgressBarPercent = timerProgressBarWidth / parseInt(window.getComputedStyle(timerProgressBar).width) * 100; 16484 timerProgressBar.style.width = `${timerProgressBarPercent}%`; 16485 }; 16486 /** 16487 * Detect Node env 16488 * 16489 * @returns {boolean} 16490 */ 16491 const isNodeEnv = () => typeof window === "undefined" || typeof document === "undefined"; 16492 const sweetHTML = ` 16493 <div aria-labelledby="${swalClasses.title}" aria-describedby="${swalClasses["html-container"]}" class="${swalClasses.popup}" tabindex="-1"> 16494 <button type="button" class="${swalClasses.close}"></button> 16495 <ul class="${swalClasses["progress-steps"]}"></ul> 16496 <div class="${swalClasses.icon}"></div> 16497 <img class="${swalClasses.image}" /> 16498 <h2 class="${swalClasses.title}" id="${swalClasses.title}"></h2> 16499 <div class="${swalClasses["html-container"]}" id="${swalClasses["html-container"]}"></div> 16500 <input class="${swalClasses.input}" id="${swalClasses.input}" /> 16501 <input type="file" class="${swalClasses.file}" /> 16502 <div class="${swalClasses.range}"> 16503 <input type="range" /> 16504 <output></output> 16505 </div> 16506 <select class="${swalClasses.select}" id="${swalClasses.select}"></select> 16507 <div class="${swalClasses.radio}"></div> 16508 <label class="${swalClasses.checkbox}"> 16509 <input type="checkbox" id="${swalClasses.checkbox}" /> 16510 <span class="${swalClasses.label}"></span> 16511 </label> 16512 <textarea class="${swalClasses.textarea}" id="${swalClasses.textarea}"></textarea> 16513 <div class="${swalClasses["validation-message"]}" id="${swalClasses["validation-message"]}"></div> 16514 <div class="${swalClasses.actions}"> 16515 <div class="${swalClasses.loader}"></div> 16516 <button type="button" class="${swalClasses.confirm}"></button> 16517 <button type="button" class="${swalClasses.deny}"></button> 16518 <button type="button" class="${swalClasses.cancel}"></button> 16519 </div> 16520 <div class="${swalClasses.footer}"></div> 16521 <div class="${swalClasses["timer-progress-bar-container"]}"> 16522 <div class="${swalClasses["timer-progress-bar"]}"></div> 16523 </div> 16524 </div> 16525`.replace(/(^|\n)\s*/g, ""); 16526 /** 16527 * @returns {boolean} 16528 */ 16529 const resetOldContainer = () => { 16530 const oldContainer = getContainer(); 16531 if (!oldContainer) return false;
16532 oldContainer.remove(); 16533 removeClass([document.documentElement, document.body], [ 16534 swalClasses["no-backdrop"], 16535 swalClasses["toast-shown"], 16536 swalClasses["has-column"] 16537 ]); 16538 return true; 16539 }; 16540 const resetValidationMessage$1 = () => { 16541 if (globalState.currentInstance) globalState.currentInstance.resetValidationMessage(); 16542 }; 16543 const addInputChangeListeners = () => { 16544 const popup = getPopup(); 16545 if (!popup) return; 16546 const input = getDirectChildByClass(popup, swalClasses.input); 16547 const file = getDirectChildByClass(popup, swalClasses.file); 16548 /** @type {HTMLInputElement | null} */ 16549 const range = popup.querySelector(`.${swalClasses.range} input`); 16550 /** @type {HTMLOutputElement | null} */ 16551 const rangeOutput = popup.querySelector(`.${swalClasses.range} output`); 16552 const select = getDirectChildByClass(popup, swalClasses.select); 16553 /** @type {HTMLInputElement | null} */ 16554 const checkbox = popup.querySelector(`.${swalClasses.checkbox} input`); 16555 const textarea = getDirectChildByClass(popup, swalClasses.textarea); 16556 if (input) input.oninput = resetValidationMessage$1; 16557 if (file) file.onchange = resetValidationMessage$1; 16558 if (select) select.onchange = resetValidationMessage$1; 16559 if (checkbox) checkbox.onchange = resetValidationMessage$1; 16560 if (textarea) textarea.oninput = resetValidationMessage$1; 16561 if (range && rangeOutput) { 16562 range.oninput = () => { 16563 resetValidationMessage$1(); 16564 rangeOutput.value = range.value; 16565 }; 16566 range.onchange = () => { 16567 resetValidationMessage$1(); 16568 rangeOutput.value = range.value; 16569 }; 16570 } 16571 }; 16572 /** 16573 * @param {string | HTMLElement} target 16574 * @returns {HTMLElement} 16575 */ 16576 const getTarget = (target) => { 16577 if (typeof target === "string") { 16578 const element = document.querySelector(target); 16579 if (!element) throw new Error(`Target element "${target}" not found`); 16580 return element; 16581 } 16582 return target; 16583 }; 16584 /** 16585 * @param {SweetAlertOptions} params 16586 */ 16587 const setupAccessibility = (params) => { 16588 const popup = getPopup(); 16589 if (!popup) return; 16590 popup.setAttribute("role", params.toast ? "alert" : "dialog"); 16591 popup.setAttribute("aria-live", params.toast ? "polite" : "assertive"); 16592 if (!params.toast) popup.setAttribute("aria-modal", "true"); 16593 }; 16594 /** 16595 * @param {HTMLElement} targetElement 16596 */ 16597 const setupRTL = (targetElement) => { 16598 if (window.getComputedStyle(targetElement).direction === "rtl") { 16599 addClass(getContainer(), swalClasses.rtl); 16600 globalState.isRTL = true; 16601 } 16602 }; 16603 /** 16604 * Add modal + backdrop to DOM 16605 * 16606 * @param {SweetAlertOptions} params 16607 */ 16608 const init = (params) => { 16609 const oldContainerExisted = resetOldContainer(); 16610 if (isNodeEnv()) { 16611 error("SweetAlert2 requires document to initialize"); 16612 return; 16613 } 16614 const container = document.createElement("div"); 16615 container.className = swalClasses.container; 16616 if (oldContainerExisted) addClass(container, swalClasses["no-transition"]); 16617 setInnerHtml(container, sweetHTML); 16618 container.dataset["swal2Theme"] = params.theme; 16619 const targetElement = getTarget(params.target || "body"); 16620 targetElement.appendChild(container); 16621 if (params.topLayer) { 16622 container.setAttribute("popover", ""); 16623 container.showPopover(); 16624 } 16625 setupAccessibility(params); 16626 setupRTL(targetElement); 16627 addInputChangeListeners(); 16628 }; 16629 /** 16630 * @param {HTMLElement | object | string} param 16631 * @param {HTMLElement} target 16632 */ 16633 const parseHtmlToContainer = (param, target) => { 16634 if (param instanceof HTMLElement) target.appendChild(param); 16635 else if (typeof param === "object") handleObject(param, target); 16636 else if (param) setInnerHtml(target, param); 16637 }; 16638 /** 16639 * @param {object} param 16640 * @param {HTMLElement} target 16641 */ 16642 const handleObject = (param, target) => { 16643 if ("jquery" in param) handleJqueryElem(target, param); 16644 else setInnerHtml(target, param.toString()); 16645 }; 16646 /** 16647 * @param {HTMLElement} target 16648 * @param {any} elem 16649 */ 16650 const handleJqueryElem = (target, elem) => { 16651 target.textContent = ""; 16652 if (0 in elem) for (let i = 0; i in elem; i++) target.appendChild(elem[i].cloneNode(true)); 16653 else target.appendChild(elem.cloneNode(true)); 16654 }; 16655 /** 16656 * @param {SweetAlert} instance 16657 * @param {SweetAlertOptions} params 16658 */ 16659 const renderActions = (instance, params) => { 16660 const actions = getActions(); 16661 const loader = getLoader(); 16662 if (!actions || !loader) return; 16663 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) hide(actions); 16664 else show(actions); 16665 applyCustomClass(actions, params, "actions"); 16666 renderButtons(actions, loader, params); 16667 setInnerHtml(loader, params.loaderHtml || ""); 16668 applyCustomClass(loader, params, "loader"); 16669 }; 16670 /** 16671 * @param {HTMLElement} actions 16672 * @param {HTMLElement} loader 16673 * @param {SweetAlertOptions} params 16674 */ 16675 function renderButtons(actions, loader, params) { 16676 const confirmButton = getConfirmButton(); 16677 const denyButton = getDenyButton(); 16678 const cancelButton = getCancelButton(); 16679 if (!confirmButton || !denyButton || !cancelButton) return; 16680 renderButton(confirmButton, "confirm", params); 16681 renderButton(denyButton, "deny", params); 16682 renderButton(cancelButton, "cancel", params); 16683 handleButtonsStyling(confirmButton, denyButton, cancelButton, params); 16684 if (params.reverseButtons) if (params.toast) { 16685 actions.insertBefore(cancelButton, confirmButton); 16686 actions.insertBefore(denyButton, confirmButton); 16687 } else { 16688 actions.insertBefore(cancelButton, loader); 16689 actions.insertBefore(denyButton, loader); 16690 actions.insertBefore(confirmButton, loader); 16691 } 16692 } 16693 /** 16694 * @param {HTMLElement} confirmButton 16695 * @param {HTMLElement} denyButton 16696 * @param {HTMLElement} cancelButton 16697 * @param {SweetAlertOptions} params 16698 */ 16699 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) { 16700 if (!params.buttonsStyling) { 16701 removeClass([ 16702 confirmButton, 16703 denyButton, 16704 cancelButton 16705 ], swalClasses.styled); 16706 return; 16707 } 16708 addClass([ 16709 confirmButton, 16710 denyButton, 16711 cancelButton 16712 ], swalClasses.styled); 16713 [ 16714 [ 16715 confirmButton, 16716 "confirm", 16717 params.confirmButtonColor 16718 ], 16719 [ 16720 denyButton, 16721 "deny", 16722 params.denyButtonColor 16723 ], 16724 [ 16725 cancelButton, 16726 "cancel", 16727 params.cancelButtonColor 16728 ] 16729 ].forEach(([button, type, color]) => { 16730 if (color) button.style.setProperty(`--swal2-${type}-button-background-color`, color); 16731 applyOutlineColor(button); 16732 }); 16733 } 16734 /** 16735 * @param {HTMLElement} button 16736 */ 16737 function applyOutlineColor(button) { 16738 const buttonStyle = window.getComputedStyle(button); 16739 if (buttonStyle.getPropertyValue("--swal2-action-button-focus-box-sha
16739dow")) return; 16740 const outlineColor = buttonStyle.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/, "rgba($1, $2, $3, 0.5)"); 16741 button.style.setProperty("--swal2-action-button-focus-box-shadow", buttonStyle.getPropertyValue("--swal2-outline").replace(/ rgba\(.*/, ` ${outlineColor}`)); 16742 } 16743 /** 16744 * @param {HTMLElement} button 16745 * @param {'confirm' | 'deny' | 'cancel'} buttonType 16746 * @param {SweetAlertOptions} params 16747 */ 16748 function renderButton(button, buttonType, params) { 16749 toggle(button, params[`show${capitalizeFirstLetter(buttonType)}Button`], "inline-block"); 16750 setInnerHtml(button, params[`${buttonType}ButtonText`] || ""); 16751 button.setAttribute("aria-label", params[`${buttonType}ButtonAriaLabel`] || ""); 16752 button.className = swalClasses[buttonType]; 16753 applyCustomClass(button, params, `${buttonType}Button`); 16754 } 16755 /** 16756 * @param {SweetAlert} instance 16757 * @param {SweetAlertOptions} params 16758 */ 16759 const renderCloseButton = (instance, params) => { 16760 const closeButton = getCloseButton(); 16761 if (!closeButton) return; 16762 setInnerHtml(closeButton, params.closeButtonHtml || ""); 16763 applyCustomClass(closeButton, params, "closeButton"); 16764 toggle(closeButton, params.showCloseButton); 16765 closeButton.setAttribute("aria-label", params.closeButtonAriaLabel || ""); 16766 }; 16767 /** 16768 * @param {SweetAlert} instance 16769 * @param {SweetAlertOptions} params 16770 */ 16771 const renderContainer = (instance, params) => { 16772 const container = getContainer(); 16773 if (!container) return; 16774 handleBackdropParam(container, params.backdrop); 16775 handlePositionParam(container, params.position); 16776 handleGrowParam(container, params.grow); 16777 applyCustomClass(container, params, "container"); 16778 }; 16779 /** 16780 * @param {HTMLElement} container 16781 * @param {SweetAlertOptions['backdrop']} backdrop 16782 */ 16783 function handleBackdropParam(container, backdrop) { 16784 if (typeof backdrop === "string") container.style.background = backdrop; 16785 else if (!backdrop) addClass([document.documentElement, document.body], swalClasses["no-backdrop"]); 16786 } 16787 /** 16788 * @param {HTMLElement} container 16789 * @param {SweetAlertOptions['position']} position 16790 */ 16791 function handlePositionParam(container, position) { 16792 if (!position) return; 16793 if (position in swalClasses) addClass(container, swalClasses[position]); 16794 else { 16795 warn("The \"position\" parameter is not valid, defaulting to \"center\""); 16796 addClass(container, swalClasses.center); 16797 } 16798 } 16799 /** 16800 * @param {HTMLElement} container 16801 * @param {SweetAlertOptions['grow']} grow 16802 */ 16803 function handleGrowParam(container, grow) { 16804 if (!grow) return; 16805 addClass(container, swalClasses[`grow-${grow}`]); 16806 } 16807 /** 16808 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 16809 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 16810 * This is the approach that Babel will probably take to implement private methods/fields 16811 * https://github.com/tc39/proposal-private-methods 16812 * https://github.com/babel/babel/pull/7555 16813 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 16814 * then we can use that language feature. 16815 */ 16816 var privateProps = { 16817 innerParams: /* @__PURE__ */ new WeakMap(), 16818 domCache: /* @__PURE__ */ new WeakMap(), 16819 focusedElement: /* @__PURE__ */ new WeakMap() 16820 }; 16821 /** @type {InputClass[]} */ 16822 const inputClasses = [ 16823 "input", 16824 "file", 16825 "range", 16826 "select", 16827 "radio", 16828 "checkbox", 16829 "textarea" 16830 ]; 16831 /** 16832 * @param {SweetAlert} instance 16833 * @param {SweetAlertOptions} params 16834 */ 16835 const renderInput = (instance, params) => { 16836 const popup = getPopup(); 16837 if (!popup) return; 16838 const innerParams = privateProps.innerParams.get(instance); 16839 const rerender = !innerParams || params.input !== innerParams.input; 16840 inputClasses.forEach((inputClass) => { 16841 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); 16842 if (!inputContainer) return; 16843 setAttributes(inputClass, params.inputAttributes); 16844 inputContainer.className = swalClasses[inputClass]; 16845 if (rerender) hide(inputContainer); 16846 }); 16847 if (params.input) { 16848 if (rerender) showInput(params); 16849 setCustomClass(params); 16850 } 16851 }; 16852 /** 16853 * @param {SweetAlertOptions} params 16854 */ 16855 const showInput = (params) => { 16856 if (!params.input) return; 16857 if (!renderInputType[params.input]) {
16858 error(`Unexpected type of input! Expected ${Object.keys(renderInputType).join(" | ")}, got "${params.input}"`); 16859 return; 16860 } 16861 const inputContainer = getInputContainer(params.input); 16862 if (!inputContainer) return; 16863 const input = renderInputType[params.input](inputContainer, params); 16864 show(inputContainer); 16865 if (params.inputAutoFocus) setTimeout(() => { 16866 focusInput(input); 16867 }); 16868 }; 16869 /** 16870 * @param {HTMLInputElement} input 16871 */ 16872 const removeAttributes = (input) => { 16873 for (const { name } of Array.from(input.attributes)) if (![ 16874 "id", 16875 "type", 16876 "value", 16877 "style" 16878 ].includes(name)) input.removeAttribute(name); 16879 }; 16880 /** 16881 * @param {InputClass} inputClass 16882 * @param {SweetAlertOptions['inputAttributes']} inputAttributes 16883 */ 16884 const setAttributes = (inputClass, inputAttributes) => { 16885 const popup = getPopup(); 16886 if (!popup) return; 16887 const input = getInput$1(popup, inputClass); 16888 if (!input) return; 16889 removeAttributes(input); 16890 for (const attr in inputAttributes) input.setAttribute(attr, inputAttributes[attr]); 16891 }; 16892 /** 16893 * @param {SweetAlertOptions} params 16894 */ 16895 const setCustomClass = (params) => { 16896 if (!params.input) return; 16897 const inputContainer = getInputContainer(params.input); 16898 if (inputContainer) applyCustomClass(inputContainer, params, "input"); 16899 }; 16900 /** 16901 * @param {HTMLInputElement | HTMLTextAreaElement} input 16902 * @param {SweetAlertOptions} params 16903 */ 16904 const setInputPlaceholder = (input, params) => { 16905 if (!input.placeholder && params.inputPlaceholder) input.placeholder = params.inputPlaceholder; 16906 }; 16907 /** 16908 * @param {Input} input 16909 * @param {Input} prependTo 16910 * @param {SweetAlertOptions} params 16911 */ 16912 const setInputLabel = (input, prependTo, params) => { 16913 if (params.inputLabel) { 16914 const label = document.createElement("label"); 16915 const labelClass = swalClasses["input-label"]; 16916 label.setAttribute("for", input.id); 16917 label.className = labelClass; 16918 if (typeof params.customClass === "object") addClass(label, params.customClass.inputLabel); 16919 label.innerText = params.inputLabel; 16920 prependTo.insertAdjacentElement("beforebegin", label); 16921 } 16922 }; 16923 /** 16924 * @param {SweetAlertInput} inputType 16925 * @returns {HTMLElement | undefined} 16926 */ 16927 const getInputContainer = (inputType) => { 16928 const popup = getPopup(); 16929 if (!popup) return; 16930 return getDirectChildByClass(popup, swalClasses[inputType] || swalClasses.input); 16931 }; 16932 /** 16933 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input 16934 * @param {SweetAlertOptions['inputValue']} inputValue 16935 */ 16936 const checkAndSetInputValue = (input, inputValue) => { 16937 if (["string", "number"].includes(typeof inputValue)) input.value = `${inputValue}`; 16938 else if (!isPromise(inputValue)) warn(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof inputValue}"`); 16939 }; 16940 /** @type {Record<SweetAlertInput, (input: Input | HTMLElement, params: SweetAlertOptions) => Input>} */ 16941 const renderInputType = {}; 16942 /** 16943 * @param {Input | HTMLElement} input 16944 * @param {SweetAlertOptions} params 16945 * @returns {Input} 16946 */ 16947 renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType["datetime-local"] = renderInputType.time = renderInputType.week = renderInputType.month = (input, params) => { 16948 const inputElement = input; 16949 checkAndSetInputValue(inputElement, params.inputValue); 16950 setInputLabel(inputElement, inputElement, params); 16951 setInputPlaceholder(inputElement, params); 16952 inputElement.type = params.input; 16953 return inputElement; 16954 }; 16955 /** 16956 * @param {Input | HTMLElement} input 16957 * @param {SweetAlertOptions} params 16958 * @returns {Input} 16959 */ 16960 renderInputType.file = (input, params) => { 16961 const inputElement = input; 16962 setInputLabel(inputElement, inputElement, params); 16963 setInputPlaceholder(inputElement, params); 16964 return inputElement; 16965 }; 16966 /** 16967 * @param {Input | HTMLElement} range 16968 * @param {SweetAlertOptions} params 16969 * @returns {Input} 16970 */ 16971 renderInputType.range = (range, params) => { 16972 const rangeContainer = range; 16973 const rangeInput = rangeContainer.querySelector("input"); 16974 const rangeOutput = rangeContainer.querySelector("output"); 16975 if (rangeInput) { 16976 checkAndSetInputValue(rangeInput, params.inputValue); 16977 rangeInput.type = params.input; 16978 setInputLabel( 16979 rangeInput, 16980 /** @type {Input} */ 16981 range, 16982 params 16983 ); 16984 } 16985 if (rangeOutput) checkAndSetInputValue(rangeOutput, params.inputValue); 16986 return range; 16987 }; 16988 /** 16989 * @param {Input | HTMLElement} select 16990 * @param {SweetAlertOptions} params 16991 * @returns {Input} 16992 */ 16993 renderInputType.select = (select, params) => { 16994 const selectElement = select; 16995 selectElement.textContent = ""; 16996 if (params.inputPlaceholder) { 16997 const placeholder = document.createElement("option"); 16998 setInnerHtml(placeholder, params.inputPlaceholder); 16999 placeholder.value = ""; 17000 placeholder.disabled = true; 17001 placeholder.selected = true; 17002 selectElement.appendChild(placeholder); 17003 } 17004 setInputLabel(selectElement, selectElement, params); 17005 return selectElement; 17006 }; 17007 /** 17008 * @param {Input | HTMLElement} radio 17009 * @returns {Input} 17010 */ 17011 renderInputType.radio = (radio) => { 17012 const radioElement = radio; 17013 radioElement.textContent = ""; 17014 return radio; 17015 }; 17016 /** 17017 * @param {Input | HTMLElement} checkboxContainer 17018 * @param {SweetAlertOptions} params 17019 * @returns {Input} 17020 */ 17021 renderInputType.checkbox = (checkboxContainer, params) => { 17022 const popup = getPopup(); 17023 if (!popup) throw new Error("Popup not found"); 17024 const checkbox = getInput$1(popup, "checkbox"); 17025 if (!checkbox) throw new Error("Checkbox input not found"); 17026 checkbox.value = "1"; 17027 checkbox.checked = Boolean(params.inputValue); 17028 const label = checkboxContainer.querySelector("span"); 17029 if (label) { 17030 const placeholderOrLabel = params.inputPlaceholder || params.inputLabel; 17031 if (placeholderOrLabel) setInnerHtml(label, placeholderOrLabel); 17032 } 17033 return checkbox; 17034 }; 17035 /** 17036 * @param {Input | HTMLElement} textarea 17037 * @param {SweetAlertOptions} params 17038 * @returns {Input} 17039 */ 17040 renderInputType.textarea = (textarea, params) => { 17041 const textareaElement = textarea; 17042 checkAndSetInputValue(textareaElement, params.inputValue); 17043 setInputPlaceholder(textareaElement, params); 17044 setInputLabel(textareaElement, textareaElement, params); 17045 /** 17046 * @param {HTMLElement} el 17047 * @returns {number} 17048 */ 17049 const getMargin = (el) => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); 17050 setTimeout(() => { 17051 if ("MutationObserver" in window) { 17052 const popup = getPopup(); 17053 if (!popup) return; 17054 const initialPopupWidth = parseInt(window.getComputedStyle(popup).width); 17055 const textareaResizeHandler = () => { 17056 if (!document.body.contains(textareaElement)) return; 17057 const textareaWidth = textareaElement.offsetWidth + getMargin(textareaElement); 17058 const popupElement = getPopup(); 17059 if (popupElement) if (textareaWidth > initialPopupWidth) popupElement.style.width = `${textareaWidth}px`; 17060 else applyNumericalStyle(popupElement, "width", params.width); 17061 }; 17062 new MutationObserver(textareaResizeHandler).observe(textareaElement, { 17063 attributes: true, 17064 attributeFilter: ["style"] 17065 }); 17066 } 17067 }); 17068 return textareaElement; 17069 }; 17070 /** 17071 * @param {SweetAlert} instance 17072 * @param {SweetAlertOptions} params 17073 */ 17074 const renderContent = (instance, params) => { 17075 const htmlContainer = getHtmlContainer(); 17076 if (!htmlContainer) return; 17077 showWhenInnerHtmlPresent(htmlContainer); 17078 applyCustomClass(htmlContainer, params, "htmlContainer"); 17079 if (params.html) { 17080 parseHtmlToContainer(params.html, htmlContainer); 17081 show(htmlContainer, "block"); 17082 } else if (params.text) { 17083 htmlContainer.textContent = params.text; 17084 show(htmlContainer, "block"); 17085 } else hide(htmlContainer); 17086 renderInput(instance, params); 17087 }; 17088 /** 17089 * @param {SweetAlert} instance 17090 * @param {SweetAlertOptions} params 17091 */ 17092 const renderFooter = (instance, params) => { 17093 const footer = getFooter(); 17094 if (!footer) return; 17095 showWhenInnerHtmlPresent(footer); 17096 toggle(footer, Boolean(params.footer), "block"); 17097 if (params.footer) parseHtmlToContainer(params.footer, footer); 17098 applyCustomClass(footer, params, "footer"); 17099 }; 17100 /** 17101 * @param {SweetAlert} instance 17102 * @param {SweetAlertOptions} params 17103 */ 17104 const renderIcon = (instance, params) => { 17105 const innerParams = privateProps.innerParams.get(instance); 17106 const icon = getIcon(); 17107 if (!icon) return; 17108 if (innerParams && params.icon === innerParams.icon) { 17109 setContent(icon, params); 17110 applyStyles(icon, params); 17111 return; 17112 } 17113 if (!params.icon && !params.iconHtml) { 17114 hide(icon); 17115 return; 17116 } 17117 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) { 17118 error(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${params.icon}"`); 17119 hide(icon); 17120 return; 17121 } 17122 show(icon); 17123 setContent(icon, params); 17124 applyStyles(icon, params); 17125 addClass(icon, params.showClass && params.showClass.icon); 17126 window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", adjustSuccessIconBackgroun
17126dColor); 17127 }; 17128 /** 17129 * @param {HTMLElement} icon 17130 * @param {SweetAlertOptions} params 17131 */ 17132 const applyStyles = (icon, params) => { 17133 for (const [iconType, iconClassName] of Object.entries(iconTypes)) if (params.icon !== iconType) removeClass(icon, iconClassName); 17134 addClass(icon, params.icon && iconTypes[params.icon]); 17135 setColor(icon, params); 17136 adjustSuccessIconBackgroundColor(); 17137 applyCustomClass(icon, params, "icon"); 17138 }; 17139 const adjustSuccessIconBackgroundColor = () => { 17140 const popup = getPopup(); 17141 if (!popup) return; 17142 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue("background-color"); 17143 popup.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix").forEach((part) => { 17144 part.style.backgroundColor = popupBackgroundColor; 17145 }); 17146 }; 17147 /** 17148 * 17149 * @param {SweetAlertOptions} params 17150 * @returns {string} 17151 */ 17152 const successIconHtml = (params) => ` 17153 ${params.animation ? "<div class=\"swal2-success-circular-line-left\"></div>" : ""} 17154 <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span> 17155 <div class="swal2-success-ring"></div> 17156 ${params.animation ? "<div class=\"swal2-success-fix\"></div>" : ""} 17157 ${params.animation ? "<div class=\"swal2-success-circular-line-right\"></div>" : ""} 17158`; 17159 const errorIconHtml = ` 17160 <span class="swal2-x-mark"> 17161 <span class="swal2-x-mark-line-left"></span> 17162 <span class="swal2-x-mark-line-right"></span> 17163 </span> 17164`; 17165 /** 17166 * @param {HTMLElement} icon 17167 * @param {SweetAlertOptions} params 17168 */ 17169 const setContent = (icon, params) => { 17170 if (!params.icon && !params.iconHtml) return; 17171 let oldContent = icon.innerHTML; 17172 let newContent = ""; 17173 if (params.iconHtml) newContent = iconContent(params.iconHtml); 17174 else if (params.icon === "success") { 17175 newContent = successIconHtml(params); 17176 oldContent = oldContent.replace(/ style=".*?"/g, ""); 17177 } else if (params.icon === "error") newContent = errorIconHtml; 17178 else if (params.icon) newContent = iconContent({ 17179 question: "?", 17180 warning: "!", 17181 info: "i" 17182 }[params.icon]); 17183 if (oldContent.trim() !== newContent.trim()) setInnerHtml(icon, newContent); 17184 }; 17185 /** 17186 * @param {HTMLElement} icon 17187 * @param {SweetAlertOptions} params 17188 */ 17189 const setColor = (icon, params) => { 17190 if (!params.iconColor) return; 17191 icon.style.color = params.iconColor; 17192 icon.style.borderColor = params.iconColor; 17193 for (const sel of [ 17194 ".swal2-success-line-tip", 17195 ".swal2-success-line-long", 17196 ".swal2-x-mark-line-left", 17197 ".swal2-x-mark-line-right" 17198 ]) setStyle(icon, sel, "background-color", params.iconColor); 17199 setStyle(icon, ".swal2-success-ring", "border-color", params.iconColor); 17200 }; 17201 /** 17202 * @param {string} content 17203 * @returns {string} 17204 */ 17205 const iconContent = (content) => `<div class="${swalClasses["icon-content"]}">${content}</div>`; 17206 /** 17207 * @param {SweetAlert} instance 17208 * @param {SweetAlertOptions} params 17209 */ 17210 const renderImage = (instance, params) => { 17211 const image = getImage(); 17212 if (!image) return; 17213 if (!params.imageUrl) { 17214 hide(image); 17215 return; 17216 } 17217 show(image, ""); 17218 image.setAttribute("src", params.imageUrl); 17219 image.setAttribute("alt", params.imageAlt || ""); 17220 applyNumericalStyle(image, "width", params.imageWidth); 17221 applyNumericalStyle(image, "height", params.imageHeight); 17222 image.className = swalClasses.image; 17223 applyCustomClass(image, params, "image"); 17224 }; 17225 let dragging = false; 17226 let mousedownX = 0; 17227 let mousedownY = 0; 17228 let initialX = 0; 17229 let initialY = 0; 17230 /** 17231 * @param {HTMLElement} popup 17232 */ 17233 const addDraggableListeners = (popup) => { 17234 popup.addEventListener("mousedown", down); 17235 document.body.addEventListener("mousemove", move); 17236 popup.addEventListener("mouseup", up); 17237 popup.addEventListener("touchstart", down); 17238 document.body.addEventListener("touchmove", move); 17239 popup.addEventListener("touchend", up); 17240 }; 17241 /** 17242 * @param {HTMLElement} popup 17243 */ 17244 const removeDraggableListeners = (popup) => { 17245 popup.removeEventListener("mousedown", down); 17246 document.body.removeEventListener("mousemove", move); 17247 popup.removeEventListener("mouseup", up); 17248 popup.removeEventListener("touchstart", down); 17249 document.body.removeEventListener("touchmove", move); 17250 popup.removeEventListener("touchend", up); 17251 }; 17252 /** 17253 * @param {MouseEvent | TouchEvent} event 17254 */ 17255 const down = (event) => { 17256 const popup = getPopup(); 17257 if (!popup) return; 17258 const icon = getIcon(); 17259 if (event.target === popup || icon && icon.contains( 17260 /** @type {HTMLElement} */ 17261 event.target 17262 )) { 17263 dragging = true; 17264 const clientXY = getClientXY(event); 17265 mousedownX = clientXY.clientX; 17266 mousedownY = clientXY.clientY; 17267 initialX = parseInt(popup.style.insetInlineStart) || 0; 17268 initialY = parseInt(popup.style.insetBlockStart) || 0; 17269 addClass(popup, "swal2-dragging"); 17270 } 17271 }; 17272 /** 17273 * @param {MouseEvent | TouchEvent} event 17274 */ 17275 const move = (event) => { 17276 const popup = getPopup(); 17277 if (!popup) return; 17278 if (dragging) { 17279 let { clientX, clientY } = getClientXY(event); 17280 const deltaX = clientX - mousedownX; 17281 popup.style.insetInlineStart = `${initialX + (globalState.isRTL ? -deltaX : deltaX)}px`;
17282 popup.style.insetBlockStart = `${initialY + (clientY - mousedownY)}px`; 17283 } 17284 }; 17285 const up = () => { 17286 const popup = getPopup(); 17287 dragging = false; 17288 removeClass(popup, "swal2-dragging"); 17289 }; 17290 /** 17291 * @param {MouseEvent | TouchEvent} event 17292 * @returns {{ clientX: number, clientY: number }} 17293 */ 17294 const getClientXY = (event) => { 17295 const source = event.type.startsWith("touch") ? event.touches[0] : /** @type {MouseEvent} */ event; 17296 return { 17297 clientX: source.clientX, 17298 clientY: source.clientY 17299 }; 17300 }; 17301 /** 17302 * @param {SweetAlert} instance 17303 * @param {SweetAlertOptions} params 17304 */ 17305 const renderPopup = (instance, params) => { 17306 const container = getContainer(); 17307 const popup = getPopup(); 17308 if (!container || !popup) return; 17309 if (params.toast) { 17310 applyNumericalStyle(container, "width", params.width); 17311 popup.style.width = "100%"; 17312 const loader = getLoader(); 17313 if (loader) popup.insertBefore(loader, getIcon()); 17314 } else applyNumericalStyle(popup, "width", params.width); 17315 applyNumericalStyle(popup, "padding", params.padding); 17316 if (params.color) popup.style.color = params.color; 17317 if (params.background) popup.style.background = params.background; 17318 hide(getValidationMessage()); 17319 addClasses$1(popup, params); 17320 if (params.draggable && !params.toast) { 17321 addClass(popup, swalClasses.draggable); 17322 addDraggableListeners(popup); 17323 } else { 17324 removeClass(popup, swalClasses.draggable); 17325 removeDraggableListeners(popup); 17326 } 17327 }; 17328 /** 17329 * @param {HTMLElement} popup 17330 * @param {SweetAlertOptions} params 17331 */ 17332 const addClasses$1 = (popup, params) => { 17333 const showClass = params.showClass || {}; 17334 popup.className = `${swalClasses.popup} ${isVisible$1(popup) ? showClass.popup : ""}`; 17335 if (params.toast) { 17336 addClass([document.documentElement, document.body], swalClasses["toast-shown"]); 17337 addClass(popup, swalClasses.toast); 17338 } else addClass(popup, swalClasses.modal); 17339 applyCustomClass(popup, params, "popup"); 17340 if (typeof params.customClass === "string") addClass(popup, params.customClass); 17341 if (params.icon) addClass(popup, swalClasses[`icon-${params.icon}`]); 17342 }; 17343 /** 17344 * @param {SweetAlert} instance 17345 * @param {SweetAlertOptions} params 17346 */ 17347 const renderProgressSteps = (instance, params) => { 17348 const progressStepsContainer = getProgressSteps(); 17349 if (!progressStepsContainer) return; 17350 const { progressSteps, currentProgressStep } = params; 17351 if (!progressSteps || progressSteps.length === 0 || currentProgressStep === void 0) { 17352 hide(progressStepsContainer); 17353 return; 17354 } 17355 show(progressStepsContainer); 17356 progressStepsContainer.textContent = ""; 17357 if (currentProgressStep >= progressSteps.length) warn("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"); 17358 progressSteps.forEach((step, index) => { 17359 const stepEl = createStepElement(step); 17360 progressStepsContainer.appendChild(stepEl); 17361 if (index === currentProgressStep) addClass(stepEl, swalClasses["active-progress-step"]); 17362 if (index !== progressSteps.length - 1) { 17363 const lineEl = createLineElement(params); 17364 progressStepsContainer.appendChild(lineEl); 17365 } 17366 }); 17367 }; 17368 /** 17369 * @param {string} step 17370 * @returns {HTMLLIElement} 17371 */ 17372 const createStepElement = (step) => { 17373 const stepEl = document.createElement("li"); 17374 addClass(stepEl, swalClasses["progress-step"]); 17375 setInnerHtml(stepEl, step); 17376 return stepEl; 17377 }; 17378 /** 17379 * @param {SweetAlertOptions} params 17380 * @returns {HTMLLIElement} 17381 */ 17382 const createLineElement = (params) => { 17383 const lineEl = document.createElement("li"); 17384 addClass(lineEl, swalClasses["progress-step-line"]); 17385 if (params.progressStepsDistance) applyNumericalStyle(lineEl, "width", params.progressStepsDistance); 17386 return lineEl; 17387 }; 17388 /** 17389 * @param {SweetAlert} instance 17390 * @param {SweetAlertOptions} params 17391 */ 17392 const renderTitle = (instance, params) => { 17393 const title = getTitle(); 17394 if (!title) return; 17395 showWhenInnerHtmlPresent(title); 17396 toggle(title, Boolean(params.title || params.titleText), "block"); 17397 if (params.title) parseHtmlToContainer(params.title, title); 17398 if (params.titleText) title.innerText = params.titleText; 17399 applyCustomClass(title, params, "title"); 17400 }; 17401 /** 17402 * @param {SweetAlert} instance 17403 * @param {SweetAlertOptions} params 17404 */ 17405 const render = (instance, params) => { 17406 var _globalState$eventEmi; 17407 renderPopup(instance, params); 17408 renderContainer(instance, params); 17409 renderProgressSteps(instance, params); 17410 renderIcon(instance, params); 17411 renderImage(instance, params); 17412 renderTitle(instance, params); 17413 renderCloseButton(instance, params); 17414 renderContent(instance, params); 17415 renderActions(instance, params); 17416 renderFooter(instance, params); 17417 const popup = getPopup(); 17418 if (typeof params.didRender === "function" && popup) params.didRender(popup); 17419 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit("didRender", popup); 17420 }; 17421 const isVisible = () => { 17422 return isVisible$1(getPopup()); 17423 }; 17424 const clickConfirm = () => { 17425 var _dom$getConfirmButton; 17426 return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click(); 17427 }; 17428 const clickDeny = () => {
17429 var _dom$getDenyButton; 17430 return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click(); 17431 }; 17432 const clickCancel = () => { 17433 var _dom$getCancelButton; 17434 return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click(); 17435 }; 17436 /** @type {Record<DismissReason, DismissReason>} */ 17437 const DismissReason = Object.freeze({ 17438 cancel: "cancel", 17439 backdrop: "backdrop", 17440 close: "close", 17441 esc: "esc", 17442 timer: "timer" 17443 }); 17444 /** 17445 * @param {GlobalState} globalState 17446 */ 17447 const removeKeydownHandler = (globalState) => { 17448 if (globalState.keydownTarget && globalState.keydownHandlerAdded && globalState.keydownHandler) { 17449 const handler = globalState.keydownHandler; 17450 globalState.keydownTarget.removeEventListener("keydown", handler, { capture: globalState.keydownListenerCapture }); 17451 globalState.keydownHandlerAdded = false; 17452 } 17453 }; 17454 /** 17455 * @param {GlobalState} globalState 17456 * @param {SweetAlertOptions} innerParams 17457 * @param {(dismiss: DismissReason) => void} dismissWith 17458 */ 17459 const addKeydownHandler = (globalState, innerParams, dismissWith) => { 17460 removeKeydownHandler(globalState); 17461 if (!innerParams.toast) { 17462 /** @type {(this: HTMLElement, event: KeyboardEvent) => void} */ 17463 const handler = (e) => keydownHandler(innerParams, e, dismissWith); 17464 globalState.keydownHandler = handler; 17465 const target = innerParams.keydownListenerCapture ? window : getPopup(); 17466 if (target) { 17467 globalState.keydownTarget = target; 17468 globalState.keydownListenerCapture = innerParams.keydownListenerCapture; 17469 const eventHandler = handler; 17470 globalState.keydownTarget.addEventListener("keydown", eventHandler, { capture: globalState.keydownListenerCapture }); 17471 globalState.keydownHandlerAdded = true; 17472 } 17473 } 17474 }; 17475 /** 17476 * @param {number} index 17477 * @param {number} increment 17478 * @returns {boolean} shouldPreventDefault 17479 */ 17480 const setFocus = (index, increment) => { 17481 var _dom$getPopup; 17482 const focusableElements = getFocusableElements(); 17483 if (focusableElements.length) { 17484 index = index + increment; 17485 if (index === -2) index = focusableElements.length - 1; 17486 if (index === focusableElements.length) index = 0; 17487 else if (index === -1) index = focusableElements.length - 1; 17488 focusableElements[index].focus(); 17489 if (isFirefox() && focusableElements[index] instanceof HTMLIFrameElement) return false; 17490 return true; 17491 } 17492 (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus(); 17493 return true; 17494 }; 17495 const arrowKeysNextButton = ["ArrowRight", "ArrowDown"]; 17496 const arrowKeysPreviousButton = ["ArrowLeft", "ArrowUp"]; 17497 /** 17498 * @param {SweetAlertOptions} innerParams 17499 * @param {KeyboardEvent} event 17500 * @param {(dismiss: DismissReason) => void} dismissWith 17501 */ 17502 const keydownHandler = (innerParams, event, dismissWith) => { 17503 if (!innerParams) return; 17504 if (event.isComposing || event.keyCode === 229) return; 17505 if (innerParams.stopKeydownPropagation) event.stopPropagation(); 17506 if (event.key === "Enter") handleEnter(event, innerParams); 17507 else if (event.key === "Tab") handleTab(event); 17508 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(event.key)) handleArrows(event.key); 17509 else if (event.key === "Escape") handleEsc(event, innerParams, dismissWith); 17510 }; 17511 /** 17512 * @param {KeyboardEvent} event 17513 * @param {SweetAlertOptions} innerParams 17514 */ 17515 const handleEnter = (event, innerParams) => { 17516 if (!callIfFunction(innerParams.allowEnterKey)) return; 17517 const popup = getPopup(); 17518 if (!popup || !innerParams.input) return; 17519 const input = getInput$1(popup, innerParams.input); 17520 if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) { 17521 if (["textarea", "file"].includes(innerParams.input)) return; 17522 clickConfirm(); 17523 event.preventDefault(); 17524 } 17525 }; 17526 /** 17527 * @param {KeyboardEvent} event 17528 */ 17529 const handleTab = (event) => { 17530 const targetElement = event.target; 17531 const btnIndex = getFocusableElements().findIndex((el) => el === targetElement); 17532 let shouldPreventDefault = true; 17533 if (!event.shiftKey) shouldPreventDefault = setFocus(btnIndex, 1); 17534 else shouldPreventDefault = setFocus(btnIndex, -1); 17535 event.stopPropagation(); 17536 if (shouldPreventDefault) event.preventDefault(); 17537 }; 17538 /** 17539 * @param {string} key 17540 */ 17541 const handleArrows = (key) => { 17542 const actions = getActions(); 17543 const confirmButton = getConfirmButton(); 17544 const denyButton = getDenyButton(); 17545 const cancelButton = getCancelButton(); 17546 if (!actions || !confirmButton || !denyButton || !cancelButton) return; 17547 /** @type HTMLElement[] */ 17548 const buttons = [ 17549 confirmButton, 17550 denyButton, 17551 cancelButton 17552 ]; 17553 if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) return; 17554 const sibling = arrowKeysNextButton.includes(key) ? "nextElementSibling" : "previousElementSibling"; 17555 let buttonToFocus = document.activeElement; 17556 if (!buttonToFocus) return; 17557 for (let i = 0; i < actions.children.length; i++) { 17558 buttonToFocus = buttonToFocus[sibling]; 17559 if (!buttonToFocus) return; 17560 if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) break; 17561 } 17562 if (buttonToFocus instanceof HTMLButtonElement) buttonToFocus.focus(); 17563 }; 17564 /** 17565 * @param {KeyboardEvent} event 17566 * @param {SweetAlertOptions} innerParams 17567 * @param {(dismiss: DismissReason) => void} dismissWith 17568 */ 17569 const handleEsc = (event, innerParams, dismissWith) => { 17570 event.preventDefault(); 17571 if (callIfFunction(innerParams.allowEscapeKey)) dismissWith(DismissReason.esc); 17572 }; 17573 /** 17574 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has. 17575 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` 17576 * This is the approach that Babel will probably take to implement private methods/fields 17577 * https://github.com/tc39/proposal-private-methods 17578 * https://github.com/babel/babel/pull/7555 17579 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* 17580 * then we can use that language feature. 17581 */ 17582 var privateMethods = { 17583 swalPromiseResolve: /* @__PURE__ */ new WeakMap(), 17584 swalPromiseReject: /* @__PURE__ */ new WeakMap() 17585 }; 17586 const setAriaHidden = () => { 17587 const container = getContainer();
17588 Array.from(document.body.children).forEach((el) => { 17589 if (el.contains(container)) return; 17590 if (el.hasAttribute("aria-hidden")) el.setAttribute("data-previous-aria-hidden", el.getAttribute("aria-hidden") || ""); 17591 el.setAttribute("aria-hidden", "true"); 17592 }); 17593 }; 17594 const unsetAriaHidden = () => { 17595 Array.from(document.body.children).forEach((el) => { 17596 if (el.hasAttribute("data-previous-aria-hidden")) { 17597 el.setAttribute("aria-hidden", el.getAttribute("data-previous-aria-hidden") || ""); 17598 el.removeAttribute("data-previous-aria-hidden"); 17599 } else el.removeAttribute("aria-hidden"); 17600 }); 17601 }; 17602 const isSafariOrIOS = typeof window !== "undefined" && Boolean(window.GestureEvent); 17603 const isIOS = isSafariOrIOS && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 17604 /** 17605 * Fix iOS scrolling 17606 * http://stackoverflow.com/q/39626302 17607 */ 17608 const iOSfix = () => { 17609 if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) { 17610 const offset = document.body.scrollTop; 17611 document.body.style.top = `${offset * -1}px`; 17612 addClass(document.body, swalClasses.iosfix); 17613 lockBodyScroll(); 17614 } 17615 }; 17616 /** 17617 * https://github.com/sweetalert2/sweetalert2/issues/1246 17618 */ 17619 const lockBodyScroll = () => { 17620 const container = getContainer(); 17621 if (!container) return; 17622 /** @type {boolean} */ 17623 let preventTouchMove; 17624 /** 17625 * @param {TouchEvent} event 17626 */ 17627 container.ontouchstart = (event) => { 17628 preventTouchMove = shouldPreventTouchMove(event); 17629 }; 17630 /** 17631 * @param {TouchEvent} event 17632 */ 17633 container.ontouchmove = (event) => { 17634 if (preventTouchMove) { 17635 event.preventDefault(); 17636 event.stopPropagation(); 17637 } 17638 }; 17639 }; 17640 /** 17641 * @param {TouchEvent} event 17642 * @returns {boolean} 17643 */ 17644 const shouldPreventTouchMove = (event) => { 17645 const target = event.target; 17646 const container = getContainer(); 17647 const htmlContainer = getHtmlContainer(); 17648 if (!container || !htmlContainer) return false; 17649 if (isStylus(event) || isZoom(event)) return false; 17650 if (target === container) return true; 17651 if (!isScrollable(container) && target instanceof HTMLElement && !selfOrParentIsScrollable(target, htmlContainer) && target.tagName !== "INPUT" && target.tagName !== "TEXTAREA" && !(isScrollable(htmlContainer) && htmlContainer.contains(target))) return true; 17652 return false; 17653 }; 17654 /** 17655 * https://github.com/sweetalert2/sweetalert2/issues/1786 17656 * 17657 * @param {TouchEvent} event 17658 * @returns {boolean} 17659 */ 17660 const isStylus = (event) => { 17661 return Boolean(event.touches && event.touches.length && event.touches[0].touchType === "stylus"); 17662 }; 17663 /** 17664 * https://github.com/sweetalert2/sweetalert2/issues/1891 17665 * 17666 * @param {TouchEvent} event 17667 * @returns {boolean} 17668 */ 17669 const isZoom = (event) => { 17670 return event.touches && event.touches.length > 1; 17671 }; 17672 const undoIOSfix = () => { 17673 if (hasClass(document.body, swalClasses.iosfix)) { 17674 const offset = parseInt(document.body.style.top, 10); 17675 removeClass(document.body, swalClasses.iosfix); 17676 document.body.style.top = ""; 17677 document.body.scrollTop = offset * -1; 17678 } 17679 }; 17680 /** 17681 * Measure scrollbar width for padding body during modal show/hide 17682 * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js 17683 * 17684 * @returns {number} 17685 */ 17686 const measureScrollbar = () => { 17687 const scrollDiv = document.createElement("div"); 17688 scrollDiv.className = swalClasses["scrollbar-measure"]; 17689 document.body.appendChild(scrollDiv); 17690 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 17691 document.body.removeChild(scrollDiv); 17692 return scrollbarWidth; 17693 }; 17694 /** 17695 * Remember state in cases where opening and handling a modal will fiddle with it. 17696 * @type {number | null} 17697 */ 17698 let previousBodyPadding = null; 17699 /** 17700 * @param {string} initialBodyOverflow 17701 */ 17702 const replaceScrollbarWithPadding = (initialBodyOverflow) => { 17703 if (previousBodyPadding !== null) return; 17704 if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === "scroll") { 17705 previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")); 17706 document.body.style.paddingRight = `${previousBodyPadding + measureScrollbar()}px`; 17707 } 17708 }; 17709 const undoReplaceScrollbarWithPadding = () => { 17710 if (previousBodyPadding !== null) { 17711 document.body.style.paddingRight = `${previousBodyPadding}px`; 17712 previousBodyPadding = null; 17713 } 17714 }; 17715 /** 17716 * @param {SweetAlert} instance 17717 * @param {HTMLElement} container 17718 * @param {boolean} returnFocus 17719 * @param {(() => void) | undefined} didClose 17720 */
17721 function removePopupAndResetState(instance, container, returnFocus, didClose) { 17722 if (isToast()) triggerDidCloseAndDispose(instance, didClose); 17723 else { 17724 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose)); 17725 removeKeydownHandler(globalState); 17726 } 17727 if (isSafariOrIOS) { 17728 container.setAttribute("style", "display:none !important"); 17729 container.removeAttribute("class"); 17730 container.innerHTML = ""; 17731 } else container.remove(); 17732 if (isModal()) { 17733 undoReplaceScrollbarWithPadding(); 17734 undoIOSfix(); 17735 unsetAriaHidden(); 17736 } 17737 removeBodyClasses(); 17738 } 17739 /** 17740 * Remove SweetAlert2 classes from body 17741 */ 17742 function removeBodyClasses() { 17743 removeClass([document.documentElement, document.body], [ 17744 swalClasses.shown, 17745 swalClasses["height-auto"], 17746 swalClasses["no-backdrop"], 17747 swalClasses["toast-shown"] 17748 ]); 17749 } 17750 /** 17751 * Instance method to close sweetAlert 17752 * 17753 * @param {SweetAlertResult | undefined} resolveValue 17754 * @this {SweetAlert} 17755 */ 17756 function close(resolveValue) { 17757 resolveValue = prepareResolveValue(resolveValue); 17758 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); 17759 const didClose = triggerClosePopup(this); 17760 if (this.isAwaitingPromise) { 17761 if (!resolveValue.isDismissed) { 17762 handleAwaitingPromise(this); 17763 swalPromiseResolve(resolveValue); 17764 } 17765 }
17765 else if (didClose) swalPromiseResolve(resolveValue); 17766 } 17767 /** 17768 * @param {SweetAlert} instance 17769 * @returns {boolean} 17770 */ 17771 const triggerClosePopup = (instance) => { 17772 const popup = getPopup(); 17773 if (!popup) return false; 17774 const innerParams = privateProps.innerParams.get(instance); 17775 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) return false; 17776 removeClass(popup, innerParams.showClass.popup); 17777 addClass(popup, innerParams.hideClass.popup); 17778 const backdrop = getContainer(); 17779 removeClass(backdrop, innerParams.showClass.backdrop); 17780 addClass(backdrop, innerParams.hideClass.backdrop); 17781 handlePopupAnimation(instance, popup, innerParams); 17782 return true; 17783 }; 17784 /** 17785 * @param {Error | string} error 17786 * @this {SweetAlert} 17787 */ 17788 function rejectPromise(error) { 17789 const rejectPromise = privateMethods.swalPromiseReject.get(this); 17790 handleAwaitingPromise(this); 17791 if (rejectPromise) rejectPromise(error); 17792 } 17793 /** 17794 * @param {SweetAlert} instance 17795 */ 17796 const handleAwaitingPromise = (instance) => { 17797 if (instance.isAwaitingPromise) { 17798 delete instance.isAwaitingPromise; 17799 if (!privateProps.innerParams.get(instance)) instance._destroy(); 17800 } 17801 }; 17802 /** 17803 * @param {SweetAlertResult | undefined} resolveValue 17804 * @returns {SweetAlertResult} 17805 */ 17806 const prepareResolveValue = (resolveValue) => { 17807 if (typeof resolveValue === "undefined") return { 17808 isConfirmed: false, 17809 isDenied: false, 17810 isDismissed: true 17811 }; 17812 return Object.assign({ 17813 isConfirmed: false, 17814 isDenied: false, 17815 isDismissed: false 17816 }, resolveValue); 17817 }; 17818 /** 17819 * @param {SweetAlert} instance 17820 * @param {HTMLElement} popup 17821 * @param {SweetAlertOptions} innerParams 17822 */ 17823 const handlePopupAnimation = (instance, popup, innerParams) => { 17824 var _globalState$eventEmi; 17825 const container = getContainer(); 17826 const animationIsSupported = hasCssAnimation(popup); 17827 if (typeof innerParams.willClose === "function") innerParams.willClose(popup); 17828 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit("willClose", popup); 17829 if (animationIsSupported && container) animatePopup(instance, popup, container, Boolean(innerParams.returnFocus), innerParams.didClose); 17830 else if (container) removePopupAndResetState(instance, container, Boolean(innerParams.returnFocus), innerParams.didClose); 17831 }; 17832 /** 17833 * @param {SweetAlert} instance 17834 * @param {HTMLElement} popup 17835 * @param {HTMLElement} container 17836 * @param {boolean} returnFocus 17837 * @param {(() => void) | undefined} didClose 17838 */ 17839 const animatePopup = (instance, popup, container, returnFocus, didClose) => { 17840 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose); 17841 /** 17842 * @param {AnimationEvent | TransitionEvent} e 17843 */ 17844 const swalCloseAnimationFinished = function(e) { 17845 if (e.target === popup) { 17846 var _globalState$swalClos; 17847 (_globalState$swalClos = globalState.swalCloseEventFinishedCallback) === null || _globalState$swalClos === void 0 || _globalState$swalClos.call(globalState); 17848 delete globalState.swalCloseEventFinishedCallback; 17849 popup.removeEventListener("animationend", swalCloseAnimationFinished); 17850 popup.removeEventListener("transitionend", swalCloseAnimationFinished); 17851 } 17852 }; 17853 popup.addEventListener("animationend", swalCloseAnimationFinished); 17854 popup.addEventListener("transitionend", swalCloseAnimationFinished); 17855 }; 17856 /** 17857 * @param {SweetAlert} instance 17858 * @param {(() => void) | undefined} didClose 17859 */ 17860 const triggerDidCloseAndDispose = (instance, didClose) => { 17861 setTimeout(() => { 17862 var _globalState$eventEmi2; 17863 if (typeof didClose === "function") didClose.bind(instance.params)(); 17864 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit("didClose"); 17865 if (instance._destroy) instance._destroy(); 17866 }); 17867 }; 17868 /** 17869 * Shows loader (spinner), this is useful with AJAX requests. 17870 * By default the loader be shown instead of the "Confirm" button. 17871 * 17872 * @param {HTMLButtonElement | null} [buttonToReplace] 17873 */ 17874 const showLoading = (buttonToReplace) => { 17875 let popup = getPopup(); 17876 if (!popup) new Swal(); 17877 popup = getPopup(); 17878 if (!popup) return; 17879 const loader = getLoader(); 17880 if (isToast()) hide(getIcon()); 17881 else replaceButton(popup, buttonToReplace); 17882 show(loader); 17883 popup.setAttribute("data-loading", "true"); 17884 popup.setAttribute("aria-busy", "true"); 17885 popup.focus(); 17886 }; 17887 /** 17888 * @param {HTMLElement} popup 17889 * @param {HTMLButtonElement | null} [buttonToReplace] 17890 */ 17891 const replaceButton = (popup, buttonToReplace) => { 17892 const actions = getActions(); 17893 const loader = getLoader(); 17894 if (!actions || !loader) return; 17895 if (!buttonToReplace && isVisible$1(getConfirmButton())) buttonToReplace = getConfirmButton(); 17896 show(actions); 17897 if (buttonToReplace) { 17898 hide(buttonToReplace); 17899 loader.setAttribute("data-button-to-replace", buttonToReplace.className); 17900 actions.insertBefore(loader, buttonToReplace); 17901 } 17902 addClass([popup, actions], swalClasses.loading); 17903 }; 17904 /** 17905 * @param {SweetAlert} instance 17906 * @param {SweetAlertOptions} params 17907 */ 17908 const handleInputOptionsAndValue = (instance, params) => { 17909 if (params.input === "select" || params.input === "radio") handleInputOptions(instance, params); 17910 else if ([ 17911 "text", 17912 "email", 17913 "number", 17914 "tel", 17915 "textarea" 17916 ].some((i) => i === params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) { 17917 showLoading(getConfirmButton()); 17918 handleInputValue(instance, params); 17919 } 17920 }; 17921 /** 17922 * @param {SweetAlert} instance 17923 * @param {SweetAlertOptions} innerParams 17924 * @returns {SweetAlertInputValue} 17925 */ 17926 const getInputValue = (instance, innerParams) => { 17927 const input = instance.getInput(); 17928 if (!input) return null; 17929 switch (innerParams.input) { 17930 case "checkbox": return getCheckboxValue(input); 17931 case "radio": return getRadioValue(input); 17932 case "file": return getFileValue(input); 17933 default: return innerParams.inputAutoTrim ? input.value.trim() : input.value; 17934 } 17935 }; 17936 /** 17937 * @param {HTMLInputElement} input 17938 * @returns {number} 17939 */ 17940 const getCheckboxValue = (input) => input.checked ? 1 : 0; 17941 /** 17942 * @param {HTMLInputElement} input 17943 * @returns {string | null} 17944 */ 17945 const getRadioValue = (input) => input.checked ? input.value : null; 17946 /** 17947 * @param {HTMLInputElement} input 17948 * @returns {FileList | File | null} 17949 */ 17950 const getFileValue = (input) => input.files && input.files.length ? input.getAttribute("multiple") !== null ? input.files : input.files[0] : null; 17951 /** 17952 * @param {SweetAlert} instance 17953 * @param {SweetAlertOptions} params 17954 */ 17955 const handleInputOptions = (instance, params) => { 17956 const popup = getPopup(); 17957 if (!popup) return; 17958 /** 17959 * @param {*} inputOptions 17960 */ 17961 const processInputOptions = (inputOptions) => { 17962 if (params.input === "select") populateSelectOptions(popup, formatInputOptions(inputOptions), params); 17963 else if (params.input === "radio") populateRadioOptions(popup, formatInputOptions(inputOptions), params); 17964 }; 17965 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) { 17966 showLoading(getConfirmButton()); 17967 asPromise(params.inputOptions).then((inputOptions) => { 17968 instance.hideLoading(); 17969 processInputOptions(inputOptions); 17970 }); 17971 } else if (typeof params.inputOptions === "object") processInputOptions(params.inputOptions); 17972 else error(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof params.inputOptions}`); 17973 }; 17974 /** 17975 * @param {SweetAlert} instance 17976 * @param {SweetAlertOptions} params 17977 */ 17978 const handleInputValue = (instance, params) => { 17979 const input = instance.getInput(); 17980 if (!input) return; 17981 hide(input); 17982 asPromise(params.inputValue).then((inputValue) => { 17983 input.value = params.input === "number" ? `${parseFloat(inputValue) || 0}` : `${inputValue}`; 17984 show(input); 17985 input.focus(); 17986 instance.hideLoading(); 17987 }).catch((err) => { 17988 error(`Error in inputValue promise: ${err}`); 17989 input.value = ""; 17990 show(input); 17991 input.focus(); 17992 instance.hideLoading(); 17993 }); 17994 }; 17995 /** 17996 * @param {HTMLElement} popup 17997 * @param {InputOptionFlattened[]} inputOptions 17998 * @param {SweetAlertOptions} params 17999 */ 18000 function populateSelectOptions(popup, inputOptions, params) { 18001 const select = getDirectChildByClass(popup, swalClasses.select); 18002 if (!select) return; 18003 /** 18004 * @param {HTMLElement} parent 18005 * @param {string} optionLabel 18006 * @param {string} optionValue 18007 */ 18008 const renderOption = (parent, optionLabel, optionValue) => { 18009 const option = document.createElement("option"); 18010 option.value = optionValue; 18011 setInnerHtml(option, optionLabel); 18012 option.selected = isSelected(optionValue, params.inputValue); 18013 parent.appendChild(option); 18014 }; 18015 inputOptions.forEach((inputOption) => { 18016 const optionValue = inputOption[0]; 18017 const optionLabel = inputOption[1]; 18018 if (Array.isArray(optionLabel)) { 18019 const optgroup = document.createElement("optgroup"); 18020 optgroup.label = optionValue; 18021 optgroup.disabled = false;
18022 select.appendChild(optgroup); 18023 optionLabel.forEach((o) => renderOption(optgroup, o[1], o[0])); 18024 } else renderOption(select, optionLabel, optionValue); 18025 }); 18026 select.focus(); 18027 } 18028 /** 18029 * @param {HTMLElement} popup 18030 * @param {InputOptionFlattened[]} inputOptions 18031 * @param {SweetAlertOptions} params 18032 */ 18033 function populateRadioOptions(popup, inputOptions, params) { 18034 const radio = getDirectChildByClass(popup, swalClasses.radio); 18035 if (!radio) return; 18036 inputOptions.forEach((inputOption) => { 18037 const radioValue = inputOption[0]; 18038 const radioLabel = inputOption[1]; 18039 const radioInput = document.createElement("input"); 18040 const radioLabelElement = document.createElement("label"); 18041 radioInput.type = "radio"; 18042 radioInput.name = swalClasses.radio; 18043 radioInput.value = radioValue; 18044 if (isSelected(radioValue, params.inputValue)) radioInput.checked = true; 18045 const label = document.createElement("span"); 18046 setInnerHtml(label, radioLabel); 18047 label.className = swalClasses.label; 18048 radioLabelElement.appendChild(radioInput); 18049 radioLabelElement.appendChild(label); 18050 radio.appendChild(radioLabelElement); 18051 }); 18052 const radios = radio.querySelectorAll("input"); 18053 if (radios.length) radios[0].focus(); 18054 } 18055 /** 18056 * Converts `inputOptions` into an array of `[value, label]`s 18057 * 18058 * @param {*} inputOptions 18059 * @typedef {string[]} InputOptionFlattened 18060 * @returns {InputOptionFlattened[]} 18061 */ 18062 const formatInputOptions = (inputOptions) => { 18063 return (inputOptions instanceof Map ? Array.from(inputOptions) : Object.entries(inputOptions)).map(([key, value]) => [key, typeof value === "object" ? formatInputOptions(value) : value]); 18064 }; 18065 /** 18066 * @param {string} optionValue 18067 * @param {SweetAlertInputValue} inputValue 18068 * @returns {boolean} 18069 */ 18070 const isSelected = (optionValue, inputValue) => Boolean(inputValue) && inputValue != null && inputValue.toString() === optionValue.toString(); 18071 /** 18072 * @param {SweetAlert} instance 18073 */ 18074 const handleConfirmButtonClick = (instance) => { 18075 const innerParams = privateProps.innerParams.get(instance); 18076 instance.disableButtons(); 18077 if (innerParams.input) handleConfirmOrDenyWithInput(instance, "confirm"); 18078 else confirm(instance, true); 18079 }; 18080 /** 18081 * @param {SweetAlert} instance 18082 */ 18083 const handleDenyButtonClick = (instance) => { 18084 const innerParams = privateProps.innerParams.get(instance); 18085 instance.disableButtons(); 18086 if (innerParams.returnInputValueOnDeny) handleConfirmOrDenyWithInput(instance, "deny"); 18087 else deny(instance, false); 18088 }; 18089 /** 18090 * @param {SweetAlert} instance 18091 * @param {(dismiss: DismissReason) => void} dismissWith 18092 */ 18093 const handleCancelButtonClick = (instance, dismissWith) => { 18094 instance.disableButtons(); 18095 dismissWith(DismissReason.cancel); 18096 }; 18097 /** 18098 * @param {SweetAlert} instance 18099 * @param {'confirm' | 'deny'} type 18100 */ 18101 const handleConfirmOrDenyWithInput = (instance, type) => { 18102 const innerParams = privateProps.innerParams.get(instance); 18103 if (!innerParams.input) { 18104 error(`The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`); 18105 return; 18106 } 18107 const input = instance.getInput(); 18108 const inputValue = getInputValue(instance, innerParams); 18109 if (innerParams.inputValidator) handleInputValidator(instance, inputValue, type); 18110 else if (input && !input.checkValidity()) { 18111 instance.enableButtons(); 18112 instance.showValidationMessage(innerParams.validationMessage || input.validationMessage); 18113 } else if (type === "deny") deny(instance, inputValue); 18114 else confirm(instance, inputValue); 18115 }; 18116 /** 18117 * @param {SweetAlert} instance 18118 * @param {SweetAlertInputValue} inputValue 18119 * @param {'confirm' | 'deny'} type 18120 */ 18121 const handleInputValidator = (instance, inputValue, type) => { 18122 const innerParams = privateProps.innerParams.get(instance); 18123 instance.disableInput(); 18124 Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage))).then((validationMessage) => { 18125 instance.enableButtons(); 18126 instance.enableInput(); 18127 if (validationMessage) instance.showValidationMessage(validationMessage); 18128 else if (type === "deny") deny(instance, inputValue); 18129 else confirm(instance, inputValue); 18130 }); 18131 }; 18132 /** 18133 * @param {SweetAlert} instance 18134 * @param {*} value 18135 */ 18136 const deny = (instance, value) => { 18137 const innerParams = privateProps.innerParams.get(instance); 18138 if (innerParams.showLoaderOnDeny) showLoading(getDenyButton()); 18139 if (innerParams.preDeny) { 18140 instance.isAwaitingPromise = true; 18141 Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage))).then((preDenyValue) => { 18142 if (preDenyValue === false) { 18143 instance.hideLoading(); 18144 handleAwaitingPromise(instance); 18145 } else instance.close( 18146 /** @type SweetAlertResult */ 18147 { 18148 isDenied: true, 18149 value: typeof preDenyValue === "undefined" ? value : preDenyValue 18150 } 18151 ); 18152 }).catch((error) => rejectWith(instance, error)); 18153 } else instance.close( 18154 /** @type SweetAlertResult */ 18155 { 18156 isDenied: true, 18157 value 18158 } 18159 ); 18160 }; 18161 /** 18162 * @param {SweetAlert} instance 18163 * @param {*} value 18164 */ 18165 const succeedWith = (instance, value) => { 18166 instance.close( 18167 /** @type SweetAlertResult */ 18168 { 18169 isConfirmed: true, 18170 value 18171 } 18172 ); 18173 }; 18174 /** 18175 * 18176 * @param {SweetAlert} instance 18177 * @param {string} error 18178 */ 18179 const rejectWith = (instance, error) => { 18180 instance.rejectPromise(error); 18181 }; 18182 /** 18183 * 18184 * @param {SweetAlert} instance 18185 * @param {*} value 18186 */ 18187 const confirm = (instance, value) => { 18188 const innerParams = privateProps.innerParams.get(instance); 18189 if (innerParams.showLoaderOnConfirm) showLoading(); 18190 if (innerParams.preConfirm) { 18191 instance.resetValidationMessage(); 18192 instance.isAwaitingPromise = true; 18193 Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage))).then((preConfirmValue) => { 18194 if (isVisible$1(getValidationMessage()) || preConfirmValue === false) { 18195 instance.hideLoading(); 18196 handleAwaitingPromise(instance); 18197 } else succeedWith(instance, typeof preConfirmValue === "undefined" ? value : preConfirmValue); 18198 }).catch((error) => rejectWith(instance, error)); 18199 } else succeedWith(instance, value); 18200 }; 18201 /** 18202 * Hides loader and shows back the button which was hidden by .showLoading() 18203 * @this {SweetAlert} 18204 */ 18205 function hideLoading() { 18206 const innerParams = privateProps.innerParams.get(this); 18207 if (!innerParams) return; 18208 const domCache = privateProps.domCache.get(this); 18209 hide(domCache.loader); 18210 if (isToast()) { 18211 if (innerParams.icon) show(getIcon()); 18212 } else showRelatedButton(domCache); 18213 removeClass([domCache.popup, domCache.actions], swalClasses.loading); 18214 domCache.popup.removeAttribute("aria-busy"); 18215 domCache.popup.removeAttribute("data-loading"); 18216 this.enableButtons(); 18217 } 18218 /** 18219 * @param {DomCache} domCache 18220 */ 18221 const showRelatedButton = (domCache) => { 18222 const dataButtonToReplace = domCache.loader.getAttribute("data-button-to-replace"); 18223 const buttonToReplace = dataButtonToReplace ? domCache.popup.getElementsByClassName(
18223dataButtonToReplace) : []; 18224 if (buttonToReplace.length) show( 18225 /** @type {HTMLElement} */ 18226 buttonToReplace[0], 18227 "inline-block" 18228 ); 18229 else if (allButtonsAreHidden()) hide(domCache.actions); 18230 }; 18231 /** 18232 * Gets the input DOM node, this method works with input parameter. 18233 * 18234 * @returns {HTMLInputElement | null} 18235 * @this {SweetAlert} 18236 */ 18237 function getInput() { 18238 const innerParams = privateProps.innerParams.get(this); 18239 const domCache = privateProps.domCache.get(this); 18240 if (!domCache) return null; 18241 return getInput$1(domCache.popup, innerParams.input); 18242 } 18243 /** 18244 * @param {SweetAlert} instance 18245 * @param {string[]} buttons 18246 * @param {boolean} disabled 18247 */ 18248 function setButtonsDisabled(instance, buttons, disabled) { 18249 const domCache = privateProps.domCache.get(instance); 18250 buttons.forEach((button) => { 18251 domCache[button].disabled = disabled; 18252 }); 18253 } 18254 /** 18255 * @param {HTMLInputElement | null} input 18256 * @param {boolean} disabled 18257 */ 18258 function setInputDisabled(input, disabled) { 18259 const popup = getPopup(); 18260 if (!popup || !input) return; 18261 if (input.type === "radio") popup.querySelectorAll(`[name="${swalClasses.radio}"]`).forEach((radio) => { 18262 radio.disabled = disabled; 18263 }); 18264 else input.disabled = disabled; 18265 } 18266 /** 18267 * Enable all the buttons 18268 * @this {SweetAlert} 18269 */ 18270 function enableButtons() { 18271 setButtonsDisabled(this, [ 18272 "confirmButton", 18273 "denyButton", 18274 "cancelButton" 18275 ], false); 18276 const focusedElement = privateProps.focusedElement.get(this); 18277 if (focusedElement instanceof HTMLElement && document.activeElement === document.body) focusedElement.focus(); 18278 privateProps.focusedElement.delete(this); 18279 } 18280 /** 18281 * Disable all the buttons 18282 * @this {SweetAlert} 18283 */ 18284 function disableButtons() { 18285 privateProps.focusedElement.set(this, document.activeElement); 18286 setButtonsDisabled(this, [ 18287 "confirmButton", 18288 "denyButton", 18289 "cancelButton" 18290 ], true); 18291 } 18292 /** 18293 * Enable the input field 18294 * @this {SweetAlert} 18295 */ 18296 function enableInput() { 18297 setInputDisabled(this.getInput(), false); 18298 } 18299 /** 18300 * Disable the input field 18301 * @this {SweetAlert} 18302 */ 18303 function disableInput() { 18304 setInputDisabled(this.getInput(), true); 18305 } 18306 /** 18307 * Show block with validation message 18308 * 18309 * @param {string} error 18310 * @this {SweetAlert} 18311 */ 18312 function showValidationMessage(error) { 18313 const domCache = privateProps.domCache.get(this); 18314 const params = privateProps.innerParams.get(this); 18315 setInnerHtml(domCache.validationMessage, error); 18316 domCache.validationMessage.className = swalClasses["validation-message"]; 18317 if (params.customClass && params.customClass.validationMessage) addClass(domCache.validationMessage, params.customClass.validationMessage); 18318 show(domCache.validationMessage); 18319 const input = this.getInput(); 18320 if (input) { 18321 input.setAttribute("aria-invalid", "true"); 18322 input.setAttribute("aria-describedby", swalClasses["validation-message"]); 18323 focusInput(input); 18324 addClass(input, swalClasses.inputerror); 18325 } 18326 } 18327 /** 18328 * Hide block with validation message 18329 * 18330 * @this {SweetAlert} 18331 */ 18332 function resetValidationMessage() { 18333 const domCache = privateProps.domCache.get(this); 18334 if (domCache.validationMessage) hide(domCache.validationMessage); 18335 const input = this.getInput(); 18336 if (input) { 18337 input.removeAttribute("aria-invalid"); 18338 input.removeAttribute("aria-describedby"); 18339 removeClass(input, swalClasses.inputerror); 18340 } 18341 } 18342 const defaultParams = { 18343 title: "", 18344 titleText: "", 18345 text: "", 18346 html: "", 18347 footer: "", 18348 icon: void 0, 18349 iconColor: void 0, 18350 iconHtml: void 0, 18351 template: void 0, 18352 toast: false, 18353 draggable: false, 18354 animation: true, 18355 theme: "light", 18356 showClass: { 18357 popup: "swal2-show", 18358 backdrop: "swal2-backdrop-show", 18359 icon: "swal2-icon-show" 18360 }, 18361 hideClass: { 18362 popup: "swal2-hide", 18363 backdrop: "swal2-backdrop-hide", 18364 icon: "swal2-icon-hide" 18365 }, 18366 customClass: {}, 18367 target: "body", 18368 color: void 0, 18369 backdrop: true, 18370 heightAuto: true, 18371 allowOutsideClick: true, 18372 allowEscapeKey: true, 18373 allowEnterKey: true, 18374 stopKeydownPropagation: true, 18375 keydownListenerCapture: false, 18376 showConfirmButton: true,
18377 showDenyButton: false, 18378 showCancelButton: false, 18379 preConfirm: void 0, 18380 preDeny: void 0, 18381 confirmButtonText: "OK", 18382 confirmButtonAriaLabel: "", 18383 confirmButtonColor: void 0, 18384 denyButtonText: "No", 18385 denyButtonAriaLabel: "", 18386 denyButtonColor: void 0, 18387 cancelButtonText: "Cancel", 18388 cancelButtonAriaLabel: "", 18389 cancelButtonColor: void 0, 18390 buttonsStyling: true, 18391 reverseButtons: false, 18392 focusConfirm: true, 18393 focusDeny: false, 18394 focusCancel: false, 18395 returnFocus: true, 18396 showCloseButton: false, 18397 closeButtonHtml: "×", 18398 closeButtonAriaLabel: "Close this dialog", 18399 loaderHtml: "", 18400 showLoaderOnConfirm: false, 18401 showLoaderOnDeny: false, 18402 imageUrl: void 0, 18403 imageWidth: void 0, 18404 imageHeight: void 0, 18405 imageAlt: "", 18406 timer: void 0, 18407 timerProgressBar: false, 18408 width: void 0, 18409 padding: void 0, 18410 background: void 0, 18411 input: void 0, 18412 inputPlaceholder: "", 18413 inputLabel: "", 18414 inputValue: "", 18415 inputOptions: {}, 18416 inputAutoFocus: true, 18417 inputAutoTrim: true, 18418 inputAttributes: {}, 18419 inputValidator: void 0, 18420 returnInputValueOnDeny: false, 18421 validationMessage: void 0, 18422 grow: false, 18423 position: "center", 18424 progressSteps: [], 18425 currentProgressStep: void 0, 18426 progressStepsDistance: void 0, 18427 willOpen: void 0, 18428 didOpen: void 0, 18429 didRender: void 0, 18430 willClose: void 0,
18431 didClose: void 0, 18432 didDestroy: void 0, 18433 scrollbarPadding: true, 18434 topLayer: false 18435 }; 18436 const updatableParams = [ 18437 "allowEscapeKey", 18438 "allowOutsideClick", 18439 "background", 18440 "buttonsStyling", 18441 "cancelButtonAriaLabel", 18442 "cancelButtonColor", 18443 "cancelButtonText", 18444 "closeButtonAriaLabel", 18445 "closeButtonHtml", 18446 "color", 18447 "confirmButtonAriaLabel", 18448 "confirmButtonColor", 18449 "confirmButtonText", 18450 "currentProgressStep", 18451 "customClass", 18452 "denyButtonAriaLabel", 18453 "denyButtonColor", 18454 "denyButtonText", 18455 "didClose", 18456 "didDestroy", 18457 "draggable", 18458 "footer", 18459 "hideClass", 18460 "html", 18461 "icon", 18462 "iconColor", 18463 "iconHtml", 18464 "imageAlt", 18465 "imageHeight", 18466 "imageUrl", 18467 "imageWidth", 18468 "preConfirm", 18469 "preDeny", 18470 "progressSteps", 18471 "returnFocus", 18472 "reverseButtons", 18473 "showCancelButton", 18474 "showCloseButton", 18475 "showConfirmButton", 18476 "showDenyButton", 18477 "text", 18478 "title", 18479 "titleText", 18480 "theme", 18481 "willClose" 18482 ]; 18483 /** @type {Record<string, string | undefined>} */ 18484 const deprecatedParams = { allowEnterKey: void 0 }; 18485 const toastIncompatibleParams = [ 18486 "allowOutsideClick", 18487 "allowEnterKey", 18488 "backdrop", 18489 "draggable", 18490 "focusConfirm", 18491 "focusDeny", 18492 "focusCancel", 18493 "returnFocus", 18494 "heightAuto", 18495 "keydownListenerCapture" 18496 ]; 18497 /** 18498 * Is valid parameter 18499 * 18500 * @param {string} paramName 18501 * @returns {boolean} 18502 */ 18503 const isValidParameter = (paramName) => { 18504 return Object.prototype.hasOwnProperty.call(defaultParams, paramName); 18505 }; 18506 /** 18507 * Is valid parameter for Swal.update() method 18508 * 18509 * @param {string} paramName 18510 * @returns {boolean} 18511 */ 18512 const isUpdatableParameter = (paramName) => { 18513 return updatableParams.indexOf(paramName) !== -1; 18514 }; 18515 /** 18516 * Is deprecated parameter 18517 * 18518 * @param {string} paramName 18519 * @returns {string | undefined} 18520 */ 18521 const isDeprecatedParameter = (paramName) => { 18522 return deprecatedParams[paramName]; 18523 }; 18524 /** 18525 * @param {string} param 18526 */ 18527 const checkIfParamIsValid = (param) => { 18528 if (!isValidParameter(param)) warn(`Unknown parameter "${param}"`); 18529 }; 18530 /** 18531 * @param {string} param 18532 */ 18533 const checkIfToastParamIsValid = (param) => { 18534 if (toastIncompatibleParams.includes(param)) warn(`The parameter "${param}" is incompatible with toasts`); 18535 }; 18536 /** 18537 * @param {string} param 18538 */ 18539 const checkIfParamIsDeprecated = (param) => { 18540 const isDeprecated = isDeprecatedParameter(param); 18541 if (isDeprecated) warnAboutDeprecation(param, isDeprecated); 18542 }; 18543 /** 18544 * Show relevant warnings for given params 18545 * 18546 * @param {SweetAlertOptions} params 18547 */ 18548 const showWarningsForParams = (params) => { 18549 if (params.backdrop === false && params.allowOutsideClick) warn("\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`"); 18550 if (params.theme && ![ 18551 "light", 18552 "dark", 18553 "auto", 18554 "minimal", 18555 "borderless", 18556 "bootstrap-4", 18557 "bootstrap-4-light", 18558 "bootstrap-4-dark", 18559 "bootstrap-5", 18560 "bootstrap-5-light", 18561 "bootstrap-5-dark", 18562 "material-ui", 18563 "material-ui-light", 18564 "material-ui-dark", 18565 "embed-iframe", 18566 "bulma", 18567 "bulma-light", 18568 "bulma-dark" 18569 ].includes(params.theme)) warn(`Invalid theme "${params.theme}"`); 18570 for (const param in params) { 18571 checkIfParamIsValid(param); 18572 if (params.toast) checkIfToastParamIsValid(param); 18573 checkIfParamIsDeprecated(param); 18574 } 18575 }; 18576 /** 18577 * Updates popup parameters. 18578 * 18579 * @this {any} 18580 * @param {SweetAlertOptions} params 18581 */ 18582 function update(params) { 18583 const container = getContainer(); 18584 const popup = getPopup(); 18585 const innerParams = privateProps.innerParams.get(this); 18586 if (!popup || hasClass(popup, innerParams.hideClass.popup)) { 18587 warn(`You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.`); 18588 return; 18589 } 18590 const validUpdatableParams = filterValidParams(params); 18591 const updatedParams = Object.assign({}, innerParams, validUpdatableParams); 18592 showWarningsForParams(updatedParams); 18593 if (container) container.dataset["swal2Theme"] = updatedParams.theme; 18594 render(this, updatedParams); 18595 privateProps.innerParams.set(this, updatedParams); 18596 Object.defineProperties(this, { params: { 18597 value: Object.assign({}, this.params, params), 18598 writable: false, 18599 enumerable: true 18600 } }); 18601 } 18602 /** 18603 * @param {SweetAlertOptions} params 18604 * @returns {SweetAlertOptions} 18605 */ 18606 const filterValidParams = (params) => { 18607 /** @type {Record<string, any>} */ 18608 const validUpdatableParams = {};
18609 Object.keys(params).forEach((param) => { 18610 if (isUpdatableParameter(param)) validUpdatableParams[param] = params[param]; 18611 else warn(`Invalid parameter to update: ${param}`); 18612 }); 18613 return validUpdatableParams; 18614 }; 18615 /** 18616 * Dispose the current SweetAlert2 instance 18617 * @this {SweetAlert} 18618 */ 18619 function _destroy() { 18620 var _globalState$eventEmi; 18621 const domCache = privateProps.domCache.get(this); 18622 const innerParams = privateProps.innerParams.get(this); 18623 if (!innerParams) { 18624 disposeWeakMaps(this); 18625 return; 18626 } 18627 if (domCache.popup && globalState.swalCloseEventFinishedCallback) { 18628 globalState.swalCloseEventFinishedCallback(); 18629 delete globalState.swalCloseEventFinishedCallback; 18630 } 18631 if (typeof innerParams.didDestroy === "function") innerParams.didDestroy(); 18632 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit("didDestroy"); 18633 disposeSwal(this); 18634 } 18635 /** 18636 * @param {SweetAlert} instance 18637 */ 18638 const disposeSwal = (instance) => { 18639 disposeWeakMaps(instance); 18640 delete instance.params; 18641 delete globalState.keydownHandler; 18642 delete globalState.keydownTarget; 18643 delete globalState.currentInstance; 18644 }; 18645 /** 18646 * @param {SweetAlert} instance 18647 */ 18648 const disposeWeakMaps = (instance) => { 18649 if (instance.isAwaitingPromise) { 18650 unsetWeakMaps(privateProps, instance); 18651 instance.isAwaitingPromise = true; 18652 } else { 18653 unsetWeakMaps(privateMethods, instance); 18654 unsetWeakMaps(privateProps, instance); 18655 delete instance.isAwaitingPromise; 18656 delete instance.disableButtons; 18657 delete instance.enableButtons; 18658 delete instance.getInput; 18659 delete instance.disableInput; 18660 delete instance.enableInput; 18661 delete instance.hideLoading; 18662 delete instance.disableLoading; 18663 delete instance.showValidationMessage; 18664 delete instance.resetValidationMessage; 18665 delete instance.close; 18666 delete instance.closePopup; 18667 delete instance.closeModal; 18668 delete instance.closeToast; 18669 delete instance.rejectPromise; 18670 delete instance.update; 18671 delete instance._destroy; 18672 } 18673 }; 18674 /** 18675 * @param {Record<string, WeakMap<any, any>>} obj 18676 * @param {SweetAlert} instance 18677 */ 18678 const unsetWeakMaps = (obj, instance) => { 18679 for (const i in obj) obj[i].delete(instance); 18680 }; 18681 var instanceMethods = /*#__PURE__*/ Object.freeze({ 18682 __proto__: null, 18683 _destroy, 18684 close, 18685 closeModal: close, 18686 closePopup: close, 18687 closeToast: close, 18688 disableButtons, 18689 disableInput, 18690 disableLoading: hideLoading, 18691 enableButtons, 18692 enableInput, 18693 getInput, 18694 handleAwaitingPromise, 18695 hideLoading, 18696 rejectPromise, 18697 resetValidationMessage, 18698 showValidationMessage, 18699 update 18700 }); 18701 /** 18702 * @param {SweetAlertOptions} innerParams 18703 * @param {DomCache} domCache 18704 * @param {(dismiss: DismissReason) => void} dismissWith 18705 */ 18706 const handlePopupClick = (innerParams, domCache, dismissWith) => { 18707 if (innerParams.toast) handleToastClick(innerParams, domCache, dismissWith); 18708 else { 18709 handleModalMousedown(domCache); 18710 handleContainerMousedown(domCache); 18711 handleModalClick(innerParams, domCache, dismissWith); 18712 } 18713 }; 18714 /** 18715 * @param {SweetAlertOptions} innerParams 18716 * @param {DomCache} domCache 18717 * @param {(dismiss: DismissReason) => void} dismissWith 18718 */ 18719 const handleToastClick = (innerParams, domCache, dismissWith) => { 18720 domCache.popup.onclick = () => { 18721 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) return; 18722 dismissWith(DismissReason.close); 18723 }; 18724 }; 18725 /** 18726 * @param {SweetAlertOptions} innerParams 18727 * @returns {boolean} 18728 */ 18729 const isAnyButtonShown = (innerParams) => { 18730 return Boolean(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton); 18731 }; 18732 let ignoreOutsideClick = false; 18733 /** 18734 * @param {DomCache} domCache 18735 */ 18736 const handleModalMousedown = (domCache) => { 18737 domCache.popup.onmousedown = () => { 18738 domCache.container.onmouseup = function(e) { 18739 domCache.container.onmouseup = () => {}; 18740 if (e.target === domCache.container) ignoreOutsideClick = true; 18741 }; 18742 }; 18743 }; 18744 /** 18745 * @param {DomCache} domCache 18746 */ 18747 const handleContainerMousedown = (domCache) => { 18748 domCache.container.onmousedown = (e) => { 18749 if (e.target === domCache.container) e.preventDefault(); 18750 domCache.popup.onmouseup = function(e) { 18751 domCache.popup.onmouseup = () => {}; 18752 if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) ignoreOutsideClick = true; 18753 }; 18754 }; 18755 }; 18756 /** 18757 * @param {SweetAlertOptions} innerParams 18758 * @param {DomCache} domCache 18759 * @param {(dismiss: DismissReason) => void} dismissWith 18760 */ 18761 const handleModalClick = (innerParams, domCache, dismissWith) => { 18762 domCache.container.onclick = (e) => { 18763 if (ignoreOutsideClick) { 18764 ignoreOutsideClick = false;
18765 return; 18766 } 18767 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) dismissWith(DismissReason.backdrop); 18768 }; 18769 }; 18770 /** 18771 * @param {unknown} elem 18772 * @returns {boolean} 18773 */ 18774 const isJqueryElement = (elem) => typeof elem === "object" && elem !== null && "jquery" in elem; 18775 /** 18776 * @param {unknown} elem 18777 * @returns {boolean} 18778 */ 18779 const isElement = (elem) => elem instanceof Element || isJqueryElement(elem); 18780 /** 18781 * @param {ReadonlyArray<unknown>} args 18782 * @returns {SweetAlertOptions} 18783 */ 18784 const argsToParams = (args) => { 18785 /** @type {Record<string, unknown>} */ 18786 const params = {}; 18787 if (typeof args[0] === "object" && !isElement(args[0])) Object.assign(params, args[0]); 18788 else [ 18789 "title", 18790 "html", 18791 "icon" 18792 ].forEach((name, index) => { 18793 const arg = args[index]; 18794 if (typeof arg === "string" || isElement(arg)) params[name] = arg; 18795 else if (arg !== void 0) error(`Unexpected type of ${name}! Expected "string" or "Element", got ${typeof arg}`); 18796 }); 18797 return params; 18798 }; 18799 /** 18800 * Main method to create a new SweetAlert2 popup 18801 * 18802 * @this {new (...args: any[]) => any} 18803 * @param {...SweetAlertOptions} args 18804 * @returns {Promise<SweetAlertResult>} 18805 */ 18806 function fire(...args) { 18807 return new this(...args); 18808 } 18809 /** 18810 * Returns an extended version of `Swal` containing `params` as defaults. 18811 * Useful for reusing Swal configuration. 18812 * 18813 * For example: 18814 * 18815 * Before: 18816 * const textPromptOptions = { input: 'text', showCancelButton: true } 18817 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) 18818 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) 18819 * 18820 * After: 18821 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) 18822 * const {value: firstName} = await TextPrompt('What is your first name?') 18823 * const {value: lastName} = await TextPrompt('What is your last name?') 18824 * 18825 * @param {SweetAlertOptions} mixinParams 18826 * @returns {SweetAlert} 18827 * @this {typeof import('../SweetAlert.js').SweetAlert} 18828 */ 18829 function mixin(mixinParams) { 18830 class MixinSwal extends this { 18831 /** 18832 * @param {any} params 18833 * @param {any} priorityMixinParams 18834 */ 18835 _main(params, priorityMixinParams) { 18836 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams)); 18837 } 18838 } 18839 return MixinSwal; 18840 } 18841 /** 18842 * If `timer` parameter is set, returns number of milliseconds of timer remained. 18843 * Otherwise, returns undefined. 18844 * 18845 * @returns {number | undefined} 18846 */ 18847 const getTimerLeft = () => { 18848 return globalState.timeout && globalState.timeout.getTimerLeft(); 18849 }; 18850 /** 18851 * Stop timer. Returns number of milliseconds of timer remained. 18852 * If `timer` parameter isn't set, returns undefined. 18853 * 18854 * @returns {number | undefined} 18855 */ 18856 const stopTimer = () => { 18857 if (globalState.timeout) { 18858 stopTimerProgressBar(); 18859 return globalState.timeout.stop(); 18860 } 18861 }; 18862 /** 18863 * Resume timer. Returns number of milliseconds of timer remained. 18864 * If `timer` parameter isn't set, returns undefined. 18865 * 18866 * @returns {number | undefined} 18867 */ 18868 const resumeTimer = () => { 18869 if (globalState.timeout) { 18870 const remaining = globalState.timeout.start(); 18871 animateTimerProgressBar(remaining); 18872 return remaining; 18873 } 18874 }; 18875 /** 18876 * Resume timer. Returns number of milliseconds of timer remained. 18877 * If `timer` parameter isn't set, returns undefined. 18878 * 18879 * @returns {number | undefined} 18880 */ 18881 const toggleTimer = () => { 18882 const timer = globalState.timeout; 18883 return timer && (timer.running ? stopTimer() : resumeTimer()); 18884 }; 18885 /** 18886 * Increase timer. Returns number of milliseconds of an updated timer. 18887 * If `timer` parameter isn't set, returns undefined. 18888 * 18889 * @param {number} ms 18890 * @returns {number | undefined} 18891 */ 18892 const increaseTimer = (ms) => { 18893 if (globalState.timeout) {
18894 const remaining = globalState.timeout.increase(ms); 18895 animateTimerProgressBar(remaining, true); 18896 return remaining; 18897 } 18898 }; 18899 /** 18900 * Check if timer is running. Returns true if timer is running 18901 * or false if timer is paused or stopped. 18902 * If `timer` parameter isn't set, returns undefined 18903 * 18904 * @returns {boolean} 18905 */ 18906 const isTimerRunning = () => { 18907 return Boolean(globalState.timeout && globalState.timeout.isRunning()); 18908 }; 18909 let bodyClickListenerAdded = false; 18910 /** @type {Record<string, any>} */ 18911 const clickHandlers = {}; 18912 /** 18913 * @this {any} 18914 * @param {string} attr 18915 */ 18916 function bindClickHandler(attr = "data-swal-template") { 18917 clickHandlers[attr] = this; 18918 if (!bodyClickListenerAdded) { 18919 document.body.addEventListener("click", bodyClickListener); 18920 bodyClickListenerAdded = true; 18921 } 18922 } 18923 /** 18924 * @param {MouseEvent} event 18925 */ 18926 const bodyClickListener = (event) => { 18927 for (let el = event.target; el && el !== document; el = el.parentNode) for (const attr in clickHandlers) { 18928 const template = el.getAttribute && el.getAttribute(attr); 18929 if (template) { 18930 clickHandlers[attr].fire({ template }); 18931 return; 18932 } 18933 } 18934 }; 18935 class EventEmitter { 18936 constructor() { 18937 /** @type {Events} */ 18938 this.events = {}; 18939 } 18940 /** 18941 * @param {string} eventName 18942 * @returns {EventHandlers} 18943 */ 18944 _getHandlersByEventName(eventName) { 18945 if (typeof this.events[eventName] === "undefined") this.events[eventName] = []; 18946 return this.events[eventName]; 18947 } 18948 /** 18949 * @param {string} eventName 18950 * @param {EventHandler} eventHandler 18951 */ 18952 on(eventName, eventHandler) { 18953 const currentHandlers = this._getHandlersByEventName(eventName); 18954 if (!currentHandlers.includes(eventHandler)) currentHandlers.push(eventHandler); 18955 } 18956 /** 18957 * @param {string} eventName 18958 * @param {EventHandler} eventHandler 18959 */ 18960 once(eventName, eventHandler) { 18961 /** 18962 * @param {...any} args 18963 */ 18964 const onceFn = (...args) => { 18965 this.removeListener(eventName, onceFn); 18966 eventHandler.apply(this, args); 18967 }; 18968 this.on(eventName, onceFn); 18969 } 18970 /** 18971 * @param {string} eventName 18972 * @param {...any} args 18973 */ 18974 emit(eventName, ...args) { 18975 this._getHandlersByEventName(eventName).forEach( 18976 /** 18977 * @param {EventHandler} eventHandler 18978 */ 18979 (eventHandler) => { 18980 try { 18981 eventHandler.apply(this, args); 18982 } catch (error) { 18983 console.error(error); 18984 } 18985 } 18986 ); 18987 } 18988 /** 18989 * @param {string} eventName 18990 * @param {EventHandler} eventHandler 18991 */ 18992 removeListener(eventName, eventHandler) { 18993 const currentHandlers = this._getHandlersByEventName(eventName); 18994 const index = currentHandlers.indexOf(eventHandler); 18995 if (index > -1) currentHandlers.splice(index, 1); 18996 } 18997 /** 18998 * @param {string} eventName 18999 */ 19000 removeAllListeners(eventName) { 19001 if (this.events[eventName] !== void 0) this.events[eventName].length = 0; 19002 } 19003 reset() { 19004 this.events = {}; 19005 } 19006 } 19007 globalState.eventEmitter = new EventEmitter(); 19008 /** 19009 * @param {string} eventName 19010 * @param {EventHandler} eventHandler 19011 */ 19012 const on = (eventName, eventHandler) => { 19013 if (globalState.eventEmitter) globalState.eventEmitter.on(eventName, eventHandler); 19014 }; 19015 /** 19016 * @param {string} eventName 19017 * @param {EventHandler} eventHandler 19018 */ 19019 const once = (eventName, eventHandler) => { 19020 if (globalState.eventEmitter) globalState.eventEmitter.once(eventName, eventHandler); 19021 }; 19022 /** 19023 * @param {string} [eventName] 19024 * @param {EventHandler} [eventHandler] 19025 */ 19026 const off = (eventName, eventHandler) => { 19027 if (!globalState.eventEmitter) return; 19028 if (!eventName) { 19029 globalState.eventEmitter.reset(); 19030 return; 19031 } 19032 if (eventHandler) globalState.eventEmitter.removeListener(eventName, eventHandler); 19033 else globalState.eventEmitter.removeAllListeners(eventName); 19034 }; 19035 var staticMethods = /*#__PURE__*/ Object.freeze({ 19036 __proto__: null, 19037 argsToParams, 19038 bindClickHandler, 19039 clickCancel, 19040 clickConfirm, 19041 clickDeny, 19042 enableLoading: showLoading, 19043 fire, 19044 getActions, 19045 getCancelButton, 19046 getCloseButton, 19047 getConfirmButton, 19048 getContainer, 19049 getDenyButton, 19050 getFocusableElements, 19051 getFooter, 19052 getHtmlContainer, 19053 getIcon, 19054 getIconContent, 19055 getImage, 19056 getInputLabel, 19057 getLoader, 19058 getPopup, 19059 getProgressSteps, 19060 getTimerLeft, 19061 getTimerProgressBar, 19062 getTitle, 19063 getValidationMessage, 19064 increaseTimer, 19065 isDeprecatedParameter, 19066 isLoading, 19067 isTimerRunning, 19068 isUpdatableParameter, 19069 isValidParameter, 19070 isVisible, 19071 mixin, 19072 off, 19073 on, 19074 once, 19075 resumeTimer, 19076 showLoading, 19077 stopTimer, 19078 toggleTimer 19079 }); 19080 class Timer { 19081 /** 19082 * @param {() => void} callback 19083 * @param {number} delay 19084 */ 19085 constructor(callback, delay) { 19086 this.callback = callback; 19087 this.remaining = delay; 19088 this.running = false;
19089 this.start(); 19090 } 19091 /** 19092 * @returns {number} 19093 */ 19094 start() { 19095 if (!this.running) { 19096 this.running = true; 19097 this.started = /* @__PURE__ */ new Date(); 19098 this.id = setTimeout(this.callback, this.remaining); 19099 } 19100 return this.remaining; 19101 } 19102 /** 19103 * @returns {number} 19104 */ 19105 stop() { 19106 if (this.started && this.running) { 19107 this.running = false; 19108 clearTimeout(this.id); 19109 this.remaining -= (/* @__PURE__ */ new Date()).getTime() - this.started.getTime(); 19110 } 19111 return this.remaining; 19112 } 19113 /** 19114 * @param {number} n 19115 * @returns {number} 19116 */ 19117 increase(n) { 19118 const running = this.running; 19119 if (running) this.stop(); 19120 this.remaining += n; 19121 if (running) this.start(); 19122 return this.remaining; 19123 } 19124 /** 19125 * @returns {number} 19126 */ 19127 getTimerLeft() { 19128 if (this.running) { 19129 this.stop(); 19130 this.start(); 19131 } 19132 return this.remaining; 19133 } 19134 /** 19135 * @returns {boolean} 19136 */ 19137 isRunning() { 19138 return this.running; 19139 } 19140 } 19141 const swalStringParams = [ 19142 "swal-title", 19143 "swal-html", 19144 "swal-footer" 19145 ]; 19146 /** 19147 * @param {SweetAlertOptions} params 19148 * @returns {SweetAlertOptions} 19149 */ 19150 const getTemplateParams = (params) => { 19151 const template = typeof params.template === "string" ? document.querySelector(params.template) : params.template; 19152 if (!template) return {}; 19153 /** @type {DocumentFragment} */ 19154 const templateContent = template.content; 19155 showWarningsForElements(templateContent); 19156 return Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams)); 19157 }; 19158 /** 19159 * @param {DocumentFragment} templateContent 19160 * @returns {Record<string, string | boolean | number>} 19161 */ 19162 const getSwalParams = (templateContent) => { 19163 /** @type {Record<string, string | boolean | number>} */ 19164 const result = {}; 19165 Array.from(templateContent.querySelectorAll("swal-param")).forEach((param) => { 19166 showWarningsForAttributes(param, ["name", "value"]); 19167 const paramName = param.getAttribute("name"); 19168 const value = param.getAttribute("value"); 19169 if (!paramName || !value) return; 19170 if (paramName in defaultParams && typeof defaultParams[paramName] === "boolean") result[paramName] = value !== "false"; 19171 else if (paramName in defaultParams && typeof defaultParams[paramName] === "object") result[paramName] = JSON.parse(value); 19172 else result[paramName] = value; 19173 }); 19174 return result; 19175 }; 19176 /** 19177 * @param {DocumentFragment} templateContent 19178 * @returns {Record<string, () => void>} 19179 */ 19180 const getSwalFunctionParams = (templateContent) => { 19181 /** @type {Record<string, () => void>} */ 19182 const result = {}; 19183 Array.from(templateContent.querySelectorAll("swal-function-param")).forEach((param) => { 19184 const paramName = param.getAttribute("name"); 19185 const value = param.getAttribute("value"); 19186 if (!paramName || !value) return; 19187 result[paramName] = new Function(`return ${value}`)(); 19188 }); 19189 return result; 19190 }; 19191 /** 19192 * @param {DocumentFragment} templateContent 19193 * @returns {Record<string, string | boolean>} 19194 */ 19195 const getSwalButtons = (templateContent) => { 19196 /** @type {Record<string, string | boolean>} */ 19197 const result = {}; 19198 Array.from(templateContent.querySelectorAll("swal-button")).forEach((button) => { 19199 showWarningsForAttributes(button, [ 19200 "type", 19201 "color", 19202 "aria-label" 19203 ]); 19204 const type = button.getAttribute("type"); 19205 if (!type || ![ 19206 "confirm", 19207 "cancel", 19208 "deny" 19209 ].includes(type)) return; 19210 result[`${type}ButtonText`] = button.innerHTML; 19211 result[`show${capitalizeFirstLetter(type)}Button`] = true; 19212 const color = button.getAttribute("color"); 19213 if (color !== null) result[`${type}ButtonColor`] = color; 19214 const ariaLabel = button.getAttribute("aria-label"); 19215 if (ariaLabel !== null) result[`${type}ButtonAriaLabel`] = ariaLabel; 19216 }); 19217 return result; 19218 }; 19219 /** 19220 * @param {DocumentFragment} templateContent 19221 * @returns {Pick<SweetAlertOptions, 'imageUrl' | 'imageWidth' | 'imageHeight' | 'imageAlt'>} 19222 */ 19223 const getSwalImage = (templateContent) => { 19224 const result = {}; 19225 /** @type {HTMLElement | null} */ 19226 const image = templateContent.querySelector("swal-image"); 19227 if (image) { 19228 showWarningsForAttributes(image, [ 19229 "src", 19230 "width", 19231 "height", 19232 "alt" 19233 ]); 19234 const src = image.getAttribute("src"); 19235 if (src !== null) result.imageUrl = src || void 0; 19236 const width = image.getAttribute("width"); 19237 if (width !== null) result.imageWidth = width || void 0; 19238 const height = image.getAttribute("height"); 19239 if (height !== null) result.imageHeight = height || void 0; 19240 const alt = image.getAttribute("alt"); 19241 if (alt !== null) result.imageAlt = alt || void 0; 19242 } 19243 return result; 19244 }; 19245 /** 19246 * @param {DocumentFragment} templateContent 19247 * @returns {object} 19248 */ 19249 const getSwalIcon = (templateContent) => { 19250 const result = {}; 19251 /** @type {HTMLElement | null} */ 19252 const icon = templateContent.querySelector("swal-icon"); 19253 if (icon) { 19254 showWarningsForAttributes(icon, ["type", "color"]); 19255 if (icon.hasAttribute("type")) result.icon = icon.getAttribute("type"); 19256 if (icon.hasAttribute("color")) result.iconColor = icon.getAttribute("color"); 19257 result.iconHtml = icon.innerHTML; 19258 } 19259 return result; 19260 }; 19261 /** 19262 * @param {DocumentFragment} templateContent 19263 * @returns {object} 19264 */ 19265 const getSwalInput = (templateContent) => { 19266 /** @type {Record<string, any>} */ 19267 const result = {}; 19268 /** @type {HTMLElement | null} */ 19269 const input = templateContent.querySelector("swal-input"); 19270 if (input) { 19271 showWarningsForAttributes(input, [ 19272 "type", 19273 "label", 19274 "placeholder", 19275 "value" 19276 ]); 19277 result.input = input.getAttribute("type") || "text"; 19278 if (input.hasAttribute("label")) result.inputLabel = input.getAttribute("label"); 19279 if (input.hasAttribute("placeholder")) result.inputPlaceholder = input.getAttribute("placeholder"); 19280 if (input.hasAttribute("value")) result.inputValue = input.getAttribute("value"); 19281 } 19282 /** @type {HTMLElement[]} */ 19283 const inputOptions = Array.from(templateContent.querySelectorAll("swal-input-option")); 19284 if (inputOptions.length) { 19285 result.inputOptions = {}; 19286 inputOptions.forEach((option) => { 19287 showWarningsForAttributes(option, ["value"]); 19288 const optionValue = option.getAttribute("value"); 19289 if (!optionValue) return; 19290 const optionName = option.innerHTML; 19291 result.inputOptions[optionValue] = optionName; 19292 }); 19293 } 19294 return result; 19295 }; 19296 /** 19297 * @param {DocumentFragment} templateContent 19298 * @param {string[]} paramNames 19299 * @returns {Record<string, string>} 19300 */ 19301 const getSwalStringParams = (templateContent, paramNames) => { 19302 /** @type {Record<string, string>} */ 19303 const result = {}; 19304 for (const i in paramNames) { 19305 const paramName = paramNames[i]; 19306 /** @type {HTMLElement | null} */ 19307 const tag = templateContent.querySelector(paramName); 19308 if (tag) { 19309 showWarningsForAttributes(tag, []); 19310 result[paramName.replace(/^swal-/, "")] = tag.innerHTML.trim(); 19311 } 19312 } 19313 return result; 19314 }; 19315 /** 19316 * @param {DocumentFragment} templateContent 19317 */ 19318 const showWarningsForElements = (templateContent) => { 19319 const allowedElements = swalStringParams.concat([ 19320 "swal-param", 19321 "swal-function-param", 19322 "swal-button", 19323 "swal-image", 19324 "swal-icon", 19325 "swal-input", 19326 "swal-input-option" 19327 ]);
19328 Array.from(templateContent.children).forEach((el) => { 19329 const tagName = el.tagName.toLowerCase(); 19330 if (!allowedElements.includes(tagName)) warn(`Unrecognized element <${tagName}>`); 19331 }); 19332 }; 19333 /** 19334 * @param {HTMLElement} el 19335 * @param {string[]} allowedAttributes 19336 */ 19337 const showWarningsForAttributes = (el, allowedAttributes) => { 19338 Array.from(el.attributes).forEach((attribute) => { 19339 if (allowedAttributes.indexOf(attribute.name) === -1) warn([`Unrecognized attribute "${attribute.name}" on <${el.tagName.toLowerCase()}>.`, `${allowedAttributes.length ? `Allowed attributes are: ${allowedAttributes.join(", ")}` : "To set the value, use HTML within the element."}`]); 19340 }); 19341 }; 19342 const SHOW_CLASS_TIMEOUT = 10; 19343 /** 19344 * Open popup, add necessary classes and styles, fix scrollbar 19345 * 19346 * @param {SweetAlertOptions} params 19347 */ 19348 const openPopup = (params) => { 19349 var _globalState$eventEmi, _globalState$eventEmi2; 19350 const container = getContainer(); 19351 const popup = getPopup(); 19352 if (!container || !popup) return; 19353 if (typeof params.willOpen === "function") params.willOpen(popup); 19354 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit("willOpen", popup); 19355 const initialBodyOverflow = window.getComputedStyle(document.body).overflowY; 19356 addClasses(container, popup, params); 19357 setTimeout(() => { 19358 setScrollingVisibility(container, popup); 19359 }, SHOW_CLASS_TIMEOUT); 19360 if (isModal()) { 19361 fixScrollContainer(container, params.scrollbarPadding !== void 0 ? params.scrollbarPadding : false, initialBodyOverflow); 19362 setAriaHidden(); 19363 } 19364 if (isIOS && params.backdrop === false && popup.scrollHeight > container.clientHeight) container.style.pointerEvents = "auto"; 19365 if (!isToast() && !globalState.previousActiveElement) globalState.previousActiveElement = document.activeElement; 19366 if (typeof params.didOpen === "function") { 19367 const didOpen = params.didOpen; 19368 setTimeout(() => didOpen(popup)); 19369 } 19370 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit("didOpen", popup); 19371 }; 19372 /** 19373 * @param {Event} event 19374 */ 19375 const swalOpenAnimationFinished = (event) => { 19376 const popup = getPopup(); 19377 if (!popup || event.target !== popup) return; 19378 const container = getContainer(); 19379 if (!container) return; 19380 popup.removeEventListener("animationend", swalOpenAnimationFinished); 19381 popup.removeEventListener("transitionend", swalOpenAnimationFinished); 19382 container.style.overflowY = "auto"; 19383 removeClass(container, swalClasses["no-transition"]); 19384 }; 19385 /** 19386 * @param {HTMLElement} container 19387 * @param {HTMLElement} popup 19388 */ 19389 const setScrollingVisibility = (container, popup) => { 19390 if (hasCssAnimation(popup)) { 19391 container.style.overflowY = "hidden"; 19392 popup.addEventListener("animationend", swalOpenAnimationFinished); 19393 popup.addEventListener("transitionend", swalOpenAnimationFinished); 19394 } else container.style.overflowY = "auto"; 19395 }; 19396 /** 19397 * @param {HTMLElement} container 19398 * @param {boolean} scrollbarPadding 19399 * @param {string} initialBodyOverflow 19400 */ 19401 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => { 19402 iOSfix(); 19403 if (scrollbarPadding && initialBodyOverflow !== "hidden") replaceScrollbarWithPadding(initialBodyOverflow); 19404 setTimeout(() => { 19405 container.scrollTop = 0; 19406 }); 19407 }; 19408 /** 19409 * @param {HTMLElement} container 19410 * @param {HTMLElement} popup 19411 * @param {SweetAlertOptions} params 19412 */ 19413 const addClasses = (container, popup, params) => { 19414 var _params$showClass; 19415 if ((_params$showClass = params.showClass) !== null && _params$showClass !== void 0 && _params$showClass.backdrop) addClass(container, params.showClass.backdrop); 19416 if (params.animation) { 19417 popup.style.setProperty("opacity", "0", "important"); 19418 show(popup, "grid"); 19419 setTimeout(() => { 19420 var _params$showClass2; 19421 if ((_params$showClass2 = params.showClass) !== null && _params$showClass2 !== void 0 && _params$showClass2.popup) addClass(popup, params.showClass.popup); 19422 popup.style.removeProperty("opacity"); 19423 }, SHOW_CLASS_TIMEOUT); 19424 } else show(popup, "grid"); 19425 addClass([document.documentElement, document.body], swalClasses.shown); 19426 if (params.heightAuto && params.backdrop && !params.toast) addClass([document.documentElement, document.body], swalClasses["height-auto"]); 19427 }; 19428 var defaultInputValidators = { 19429 /** 19430 * @param {string} string 19431 * @param {string} [validationMessage] 19432 * @returns {Promise<string | void>} 19433 */ 19434 email: (string, validationMessage) => { 19435 return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || "Invalid email address"); 19436 }, 19437 /** 19438 * @param {string} string 19439 * @param {string} [validationMessage] 19440 * @returns {Promise<string | void>} 19441 */ 19442 url: (string, validationMessage) => { 19443 return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || "Invalid URL"); 19444 } 19445 }; 19446 /** 19447 * @param {SweetAlertOptions} params 19448 */ 19449 function setDefaultInputValidators(params) { 19450 if (params.inputValidator) return; 19451 if (params.input === "email") params.inputValidator = defaultInputValidators["email"]; 19452 if (params.input === "url") params.inputValidator = defaultInputValidators["url"]; 19453 } 19454 /** 19455 * @param {SweetAlertOptions} params 19456 */ 19457 function validateCustomTargetElement(params) { 19458 if (!params.target || typeof params.target === "string" && !document.querySelector(params.target) || typeof params.target !== "string" && !params.target.appendChild) {
19459 warn("Target parameter is not valid, defaulting to \"body\""); 19460 params.target = "body"; 19461 } 19462 } 19463 /** 19464 * Set type, text and actions on popup 19465 * 19466 * @param {SweetAlertOptions} params 19467 */ 19468 function setParameters(params) { 19469 setDefaultInputValidators(params); 19470 if (params.showLoaderOnConfirm && !params.preConfirm) warn("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"); 19471 validateCustomTargetElement(params); 19472 if (typeof params.title === "string") params.title = params.title.split("\n").join("<br />"); 19473 init(params); 19474 } 19475 /** @type {SweetAlert} */ 19476 let currentInstance; 19477 var _promise = /*#__PURE__*/ new WeakMap(); 19478 class SweetAlert { 19479 /** 19480 * @param {...(SweetAlertOptions | string)} args 19481 * @this {SweetAlert} 19482 */ 19483 constructor(...args) { 19484 /** 19485 * @type {Promise<SweetAlertResult>} 19486 */ 19487 _classPrivateFieldInitSpec(this, _promise, Promise.resolve({ 19488 isConfirmed: false, 19489 isDenied: false, 19490 isDismissed: true 19491 })); 19492 if (typeof window === "undefined") return; 19493 currentInstance = this; 19494 const outerParams = Object.freeze(this.constructor.argsToParams(args)); 19495 /** @type {Readonly<SweetAlertOptions>} */ 19496 this.params = outerParams; 19497 /** @type {boolean} */ 19498 this.isAwaitingPromise = false; 19499 _classPrivateFieldSet2(_promise, this, this._main(currentInstance.params)); 19500 } 19501 /** 19502 * @param {any} userParams 19503 * @param {any} mixinParams 19504 */ 19505 _main(userParams, mixinParams = {}) { 19506 showWarningsForParams(Object.assign({}, mixinParams, userParams)); 19507 if (globalState.currentInstance) { 19508 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(globalState.currentInstance); 19509 const { isAwaitingPromise } = globalState.currentInstance; 19510 globalState.currentInstance._destroy(); 19511 if (!isAwaitingPromise) swalPromiseResolve({ isDismissed: true }); 19512 if (isModal()) unsetAriaHidden(); 19513 } 19514 globalState.currentInstance = currentInstance; 19515 const innerParams = prepareParams(userParams, mixinParams); 19516 setParameters(innerParams); 19517 Object.freeze(innerParams); 19518 if (globalState.timeout) { 19519 globalState.timeout.stop(); 19520 delete globalState.timeout; 19521 } 19522 clearTimeout(globalState.restoreFocusTimeout); 19523 const domCache = populateDomCache(currentInstance); 19524 render(currentInstance, innerParams); 19525 privateProps.innerParams.set(currentInstance, innerParams); 19526 return swalPromise(currentInstance, domCache, innerParams); 19527 } 19528 /** 19529 * @param {any} onFulfilled 19530 */ 19531 then(onFulfilled) { 19532 return _classPrivateFieldGet2(_promise, this).then(onFulfilled); 19533 } 19534 /** 19535 * @param {any} onFinally 19536 */ 19537 finally(onFinally) { 19538 return _classPrivateFieldGet2(_promise, this).finally(onFinally); 19539 } 19540 } 19541 /** 19542 * @param {SweetAlert} instance 19543 * @param {DomCache} domCache 19544 * @param {SweetAlertOptions} innerParams 19545 * @returns {Promise<SweetAlertResult>} 19546 */ 19547 const swalPromise = (instance, domCache, innerParams) => { 19548 return new Promise((resolve, reject) => { 19549 /** 19550 * @param {DismissReason} dismiss 19551 */ 19552 const dismissWith = (dismiss) => { 19553 instance.close({ 19554 isDismissed: true, 19555 dismiss, 19556 isConfirmed: false, 19557 isDenied: false 19558 }); 19559 }; 19560 privateMethods.swalPromiseResolve.set(instance, resolve); 19561 privateMethods.swalPromiseReject.set(instance, reject); 19562 domCache.confirmButton.onclick = () => { 19563 handleConfirmButtonClick(instance); 19564 }; 19565 domCache.denyButton.onclick = () => { 19566 handleDenyButtonClick(instance); 19567 }; 19568 domCache.cancelButton.onclick = () => { 19569 handleCancelButtonClick(instance, dismissWith); 19570 }; 19571 domCache.closeButton.onclick = () => { 19572 dismissWith(DismissReason.close); 19573 }; 19574 handlePopupClick(innerParams, domCache, dismissWith); 19575 addKeydownHandler(globalState, innerParams, dismissWith); 19576 handleInputOptionsAndValue(instance, innerParams); 19577 openPopup(innerParams); 19578 setupTimer(globalState, innerParams, dismissWith); 19579 initFocus(domCache, innerParams); 19580 setTimeout(() => { 19581 domCache.container.scrollTop = 0; 19582 }); 19583 }); 19584 }; 19585 /** 19586 * @param {SweetAlertOptions} userParams 19587 * @param {SweetAlertOptions} mixinParams 19588 * @returns {SweetAlertOptions} 19589 */ 19590 const prepareParams = (userParams, mixinParams) => { 19591 const templateParams = getTemplateParams(userParams); 19592 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); 19593 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass); 19594 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass); 19595 if (params.animation === false) { 19596 params.showClass = { backdrop: "swal2-noanimation" }; 19597 params.hideClass = {}; 19598 } 19599 return params; 19600 }; 19601 /** 19602 * @param {SweetAlert} instance 19603 * @returns {DomCache} 19604 */ 19605 const populateDomCache = (instance) => { 19606 const domCache = ( /** @type {DomCache} */ { 19607 popup: getPopup(), 19608 container: getContainer(), 19609 actions: getActions(), 19610 confirmButton: getConfirmButton(),
19611 denyButton: getDenyButton(), 19612 cancelButton: getCancelButton(), 19613 loader: getLoader(), 19614 closeButton: getCloseButton(), 19615 validationMessage: getValidationMessage(), 19616 progressSteps: getProgressSteps() 19617 }); 19618 privateProps.domCache.set(instance, domCache); 19619 return domCache; 19620 }; 19621 /** 19622 * @param {GlobalState} globalState 19623 * @param {SweetAlertOptions} innerParams 19624 * @param {(dismiss: DismissReason) => void} dismissWith 19625 */ 19626 const setupTimer = (globalState, innerParams, dismissWith) => { 19627 const timerProgressBar = getTimerProgressBar(); 19628 hide(timerProgressBar); 19629 if (innerParams.timer) { 19630 globalState.timeout = new Timer(() => { 19631 dismissWith("timer"); 19632 delete globalState.timeout; 19633 }, innerParams.timer); 19634 if (innerParams.timerProgressBar && timerProgressBar) { 19635 show(timerProgressBar); 19636 applyCustomClass(timerProgressBar, innerParams, "timerProgressBar"); 19637 setTimeout(() => { 19638 if (globalState.timeout && globalState.timeout.running) animateTimerProgressBar( 19639 /** @type {number} */ 19640 innerParams.timer 19641 ); 19642 }); 19643 } 19644 } 19645 }; 19646 /** 19647 * Initialize focus in the popup: 19648 * 19649 * 1. If `toast` is `true`, don't steal focus from the document. 19650 * 2. Else if there is an [autofocus] element, focus it. 19651 * 3. Else if `focusConfirm` is `true` and confirm button is visible, focus it. 19652 * 4. Else if `focusDeny` is `true` and deny button is visible, focus it. 19653 * 5. Else if `focusCancel` is `true` and cancel button is visible, focus it. 19654 * 6. Else focus the first focusable element in a popup (if any). 19655 * 19656 * @param {DomCache} domCache 19657 * @param {SweetAlertOptions} innerParams 19658 */ 19659 const initFocus = (domCache, innerParams) => { 19660 if (innerParams.toast) return; 19661 if (!callIfFunction(innerParams.allowEnterKey)) { 19662 warnAboutDeprecation("allowEnterKey", "preConfirm: () => false"); 19663 domCache.popup.focus(); 19664 return; 19665 } 19666 if (focusAutofocus(domCache)) return; 19667 if (focusButton(domCache, innerParams)) return; 19668 setFocus(-1, 1); 19669 }; 19670 /** 19671 * @param {DomCache} domCache 19672 * @returns {boolean} 19673 */ 19674 const focusAutofocus = (domCache) => { 19675 const autofocusElements = Array.from(domCache.popup.querySelectorAll("[autofocus]")); 19676 for (const autofocusElement of autofocusElements) if (autofocusElement instanceof HTMLElement && isVisible$1(autofocusElement)) { 19677 autofocusElement.focus(); 19678 return true; 19679 } 19680 return false; 19681 }; 19682 /** 19683 * @param {DomCache} domCache 19684 * @param {SweetAlertOptions} innerParams 19685 * @returns {boolean} 19686 */ 19687 const focusButton = (domCache, innerParams) => { 19688 if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) { 19689 domCache.denyButton.focus(); 19690 return true; 19691 } 19692 if (innerParams.focusCancel && isVisible$1(domCache.cancelButton)) { 19693 domCache.cancelButton.focus(); 19694 return true; 19695 } 19696 if (innerParams.focusConfirm && isVisible$1(domCache.confirmButton)) { 19697 domCache.confirmButton.focus(); 19698 return true; 19699 } 19700 return false; 19701 }; 19702 SweetAlert.prototype.disableButtons = disableButtons; 19703 SweetAlert.prototype.enableButtons = enableButtons; 19704 SweetAlert.prototype.getInput = getInput; 19705 SweetAlert.prototype.disableInput = disableInput; 19706 SweetAlert.prototype.enableInput = enableInput; 19707 SweetAlert.prototype.hideLoading = hideLoading; 19708 SweetAlert.prototype.disableLoading = hideLoading; 19709 SweetAlert.prototype.showValidationMessage = showValidationMessage; 19710 SweetAlert.prototype.resetValidationMessage = resetValidationMessage; 19711 SweetAlert.prototype.close = close; 19712 SweetAlert.prototype.closePopup = close; 19713 SweetAlert.prototype.closeModal = close; 19714 SweetAlert.prototype.closeToast = close; 19715 SweetAlert.prototype.rejectPromise = rejectPromise; 19716 SweetAlert.prototype.update = update; 19717 SweetAlert.prototype._destroy = _destroy; 19718 Object.assign(SweetAlert, staticMethods); 19719 Object.keys(instanceMethods).forEach((key) => { 19720 /** 19721 * @param {...(SweetAlertOptions | string | undefined)} args 19722 * @returns {SweetAlertResult | Promise<SweetAlertResult> | undefined} 19723 */ 19724 SweetAlert[key] = function(...args) { 19725 if (currentInstance && currentInstance[key]) return currentInstance[key](...args); 19726 }; 19727 }); 19728 SweetAlert.DismissReason = DismissReason; 19729 SweetAlert.version = "11.26.25"; 19730 const Swal = SweetAlert; 19731 Swal.default = Swal; 19732 return Swal; 19733 })); 19734 if (typeof exports !== "undefined" && exports.Sweetalert2) exports.swal = exports.sweetAlert = exports.Swal = exports.SweetAlert = exports.Sweetalert2; 19735 "undefined" != typeof document && function(e, t) { 19736 var n = e.createElement("style"); 19737 if (e.getElementsByTagName("head")[0].appendChild(n), n.styleSheet) n.styleSheet.disabled || (n.styleSheet.cssText = t); 19738 else try { 19739 n.innerHTML = t; 19740 } catch (e) { 19741 n.innerText = t; 19742 } 19743 }(document,
vendor: 30,262 bytes, line 19743
19743":root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:auto}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:var(--swal2-action-button-transition);border:none;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:var(--swal2-background)}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:var(--swal2-input-background);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:var(--swal2-input-background);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:var(--swal2-background);color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;zoom:var(--swal2-icon-zoom);border:.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#f8bb86;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#3fc3ee;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#87adbd;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:auto}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}");
19743 19744 })))(), 1); 19745 async function apmButton(paypal, containerSelector, options, currency = "EUR") { 19746 if (!paypal || !paypal.Buttons || !paypal.FUNDING) throw new Error("paypal is not loaded properly"); 19747 currentOrder.id = null; 19748 let gomusOrderToken; 19749 await paypal.Buttons({ 19750 style: { label: "pay" }, 19751 createOrder: async (data, actions) => { 19752 const response = await new CreateGomusOrderService(data.paymentSource).call(); 19753 if (response.isOk()) { 19754 gomusOrderToken = response.value.order.token; 19755 return response.value.meta.payment_result.id; 19756 } else throw new PaymentError(response.error.message); 19757 }, 19758 onApprove: async (data, actions) => { 19759 if ((await capturePaypalOrder(shop.client, gomusOrderToken, data.orderID)).isOk()) window.location.replace(shop.urls.checkoutSuccess(gomusOrderToken)); 19760 else throw new PaymentError("Something went wrong"); 19761 }, 19762 onCancel(data, actions) { 19763 console.log(data); 19764 }, 19765 onError(err) { 19766 const message = err.message || "Something went wrong"; 19767 window.location.replace(shop.urls.checkoutFailure(message)); 19768 }, 19769 ...options 19770 }).render(containerSelector); 19771 } 19772 async function apmFields(paypal, containerSelector, options) { 19773 if (!paypal || !paypal.PaymentFields || !paypal.FUNDING) throw new Error("paypal is not loaded properly"); 19774 await paypal.PaymentFields({ 19775 style: { 19776 variables: { 19777 fontFamily: "'Helvetica Neue', Arial, sans-serif", 19778 fontSizeBase: "0.9375rem", 19779 fontSizeSm: "0.93rem", 19780 fontSizeM: "0.93rem", 19781 fontSizeLg: "1.0625rem", 19782 textColor: "#2c2e2f", 19783 colorTextPlaceholder: "#2c2e2f", 19784 colorBackground: "#fff", 19785 colorInfo: "#0dcaf0", 19786 colorDanger: "#d20000", 19787 borderRadius: "0.2rem", 19788 borderColor: "#dfe1e5", 19789 borderWidth: "1px", 19790 borderFocusColor: "black", 19791 spacingUnit: "10px" 19792 }, 19793 rules: { 19794 ".Input": {}, 19795 ".Input:hover": {}, 19796 ".Input:focus": {}, 19797 ".Input:active": {}, 19798 ".Input--invalid": {}, 19799 ".Label": {}, 19800 ".Error": { marginTop: "2px" } 19801 } 19802 }, 19803 fields: { name: { value: "" } }, 19804 ...options 19805 }).render(containerSelector); 19806 } 19807 //#endregion 19808 //#region src/components/paypal/payment-methods/bancontact/Bancontact.svelte 19809 var root$64 = /* @__PURE__ */ from_html(`<div id="bancontact-fields"></div> <div id="bancontact-btn"></div>`, 1); 19810 function Bancontact($$anchor, $$props) { 19811 push($$props, true); 19812 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19813 let mounted = false; 19814 onMount(async () => { 19815 if (mounted) return; 19816 mounted = true; 19817 await new Promise((resolve) => setTimeout(resolve, 100)); 19818 await apmFields(paypal(), "#bancontact-fields", { fundingSource: paypal().FUNDING.BANCONTACT }); 19819 await apmButton(paypal(), "#bancontact-btn", { fundingSource: paypal().FUNDING.BANCONTACT }); 19820 }); 19821 var $$exports = { 19822 get paypal() { 19823 return paypal(); 19824 }, 19825 set paypal($$value = getContext("paypalScript").paypal) { 19826 paypal($$value); 19827 flushSync(); 19828 } 19829 }; 19830 var fragment = root$64(); 19831 next(2); 19832 append($$anchor, fragment); 19833 return pop($$exports); 19834 } 19835 create_custom_element(Bancontact, { paypal: {} }, [], [], { mode: "open" }); 19836 //#endregion 19837 //#region src/components/paypal/payment-methods/loadPaypalScript.ts 19838 async function loadPaypalScript(clientId, { currency = "EUR", locale = "de", enableAllFundings = false } = {}) { 19839 const ret = await loadScript({ 19840 clientId, 19841 components: "buttons,payment-fields,marks,funding-eligibility,card-fields,applepay,googlepay,messages", 19842 dataPartnerAttributionId: "gomus_SP_PPCP", 19843 currency, 19844 locale: { 19845 en: "en_US", 19846 fr: "fr_FR", 19847 de: "de_DE" 19848 }[locale], 19849 debug: false, 19850 ...enableAllFundings && { enableFunding: "ideal,card,paylater,bancontact,blik,eps,multibanco,mybank,p24,trustly" } 19851 }); 19852 if (!ret) throw new Error("Error loading PayPal script"); 19853 return ret; 19854 } 19855 //#endregion 19856 //#region src/components/paypal/payment-methods/blik/Blik.svelte 19857 var root$63 = /* @__PURE__ */ from_html(`<div id="blik-fields"></div> <div id="blik-btn"></div>`, 1); 19858 function Blik($$anchor, $$props) { 19859 push($$props, true); 19860 let mounted = false;
19861 user_effect(() => { 19862 if (shop.payment_modes?.["pay_pal"].client_id) loadPaypalScript(shop.payment_modes["pay_pal"].client_id, { locale: "PLN" }).then((paypal) => { 19863 if (mounted) return; 19864 mounted = true; 19865 apmFields(paypal, "#blik-fields", { fundingSource: paypal.FUNDING?.BLIK }); 19866 apmButton(paypal, "#blik-btn", { fundingSource: paypal.FUNDING?.BLIK }, "PLN"); 19867 }); 19868 }); 19869 var fragment = root$63(); 19870 next(2); 19871 append($$anchor, fragment); 19872 pop(); 19873 } 19874 create_custom_element(Blik, {}, [], [], { mode: "open" }); 19875 //#endregion 19876 //#region src/components/paypal/payment-methods/eps/Eps.svelte 19877 var root$62 = /* @__PURE__ */ from_html(`<div id="eps-fields"></div> <div id="eps-btn"></div>`, 1); 19878 function Eps($$anchor, $$props) { 19879 push($$props, true); 19880 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19881 let mounted = false; 19882 onMount(async () => { 19883 if (mounted) return; 19884 mounted = true; 19885 await new Promise((resolve) => setTimeout(resolve, 100)); 19886 await apmFields(paypal(), "#eps-fields", { fundingSource: paypal().FUNDING?.EPS }); 19887 await apmButton(paypal(), "#eps-btn", { fundingSource: paypal().FUNDING?.EPS }); 19888 }); 19889 var $$exports = { 19890 get paypal() { 19891 return paypal(); 19892 }, 19893 set paypal($$value = getContext("paypalScript").paypal) { 19894 paypal($$value); 19895 flushSync(); 19896 } 19897 }; 19898 var fragment = root$62(); 19899 next(2); 19900 append($$anchor, fragment); 19901 return pop($$exports); 19902 } 19903 create_custom_element(Eps, { paypal: {} }, [], [], { mode: "open" }); 19904 //#endregion 19905 //#region src/components/paypal/payment-methods/multibanco/Multibanco.svelte 19906 var root$61 = /* @__PURE__ */ from_html(`<div id="multibanco-fields"></div> <div id="multibanco-btn"></div>`, 1); 19907 function Multibanco($$anchor, $$props) { 19908 push($$props, true); 19909 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19910 let mounted = false; 19911 onMount(async () => { 19912 if (mounted) return; 19913 mounted = true; 19914 await new Promise((resolve) => setTimeout(resolve, 100)); 19915 await apmFields(paypal(), "#multibanco-fields", { fundingSource: paypal().FUNDING?.MULTIBANCO }); 19916 await apmButton(paypal(), "#multibanco-btn", { fundingSource: paypal().FUNDING?.MULTIBANCO }); 19917 }); 19918 var $$exports = { 19919 get paypal() { 19920 return paypal(); 19921 }, 19922 set paypal($$value = getContext("paypalScript").paypal) { 19923 paypal($$value); 19924 flushSync(); 19925 } 19926 }; 19927 var fragment = root$61(); 19928 next(2); 19929 append($$anchor, fragment); 19930 return pop($$exports); 19931 } 19932 create_custom_element(Multibanco, { paypal: {} }, [], [], { mode: "open" }); 19933 //#endregion 19934 //#region src/components/paypal/payment-methods/mybank/MyBank.svelte 19935 var root$60 = /* @__PURE__ */ from_html(`<div id="mybank-fields"></div> <div id="mybank-btn"></div>`, 1); 19936 function MyBank($$anchor, $$props) { 19937 push($$props, true); 19938 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19939 let mounted = false; 19940 onMount(async () => { 19941 if (mounted) return; 19942 mounted = true; 19943 await new Promise((resolve) => setTimeout(resolve, 100)); 19944 await apmFields(paypal(), "#mybank-fields", { fundingSource: paypal().FUNDING?.MYBANK }); 19945 await apmButton(paypal(), "#mybank-btn", { fundingSource: paypal().FUNDING?.MYBANK }); 19946 }); 19947 var $$exports = { 19948 get paypal() { 19949 return paypal(); 19950 }, 19951 set paypal($$value = getContext("paypalScript").paypal) { 19952 paypal($$value); 19953 flushSync(); 19954 } 19955 }; 19956 var fragment = root$60(); 19957 next(2); 19958 append($$anchor, fragment); 19959 return pop($$exports); 19960 } 19961 create_custom_element(MyBank, { paypal: {} }, [], [], { mode: "open" }); 19962 //#endregion 19963 //#region src/components/paypal/payment-methods/p24/P24.svelte 19964 var root$59 = /* @__PURE__ */ from_html(`<div id="p24-fields"></div> <div id="p24-btn"></div>`, 1); 19965 function P24($$anchor, $$props) { 19966 push($$props, true); 19967 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19968 let mounted = false; 19969 onMount(async () => { 19970 if (mounted) return; 19971 mounted = true; 19972 await new Promise((resolve) => setTimeout(resolve, 100)); 19973 await apmFields(paypal(), "#p24-fields", { fundingSource: paypal().FUNDING?.P24 }); 19974 await apmButton(paypal(), "#p24-btn", { fundingSource: paypal().FUNDING?.P24 }); 19975 }); 19976 var $$exports = { 19977 get paypal() { 19978 return paypal(); 19979 }, 19980 set paypal($$value = getContext("paypalScript").paypal) { 19981 paypal($$value); 19982 flushSync(); 19983 } 19984 }; 19985 var fragment = root$59(); 19986 next(2); 19987 append($$anchor, fragment); 19988 return pop($$exports); 19989 }
19990 create_custom_element(P24, { paypal: {} }, [], [], { mode: "open" }); 19991 //#endregion 19992 //#region src/components/paypal/payment-methods/trustly/Trustly.svelte 19993 var root$58 = /* @__PURE__ */ from_html(`<div id="trustly-fields"></div> <div id="trustly-btn"></div>`, 1); 19994 function Trustly($$anchor, $$props) { 19995 push($$props, true); 19996 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 19997 let mounted = false; 19998 onMount(async () => { 19999 if (mounted) return; 20000 mounted = true; 20001 await new Promise((resolve) => setTimeout(resolve, 100)); 20002 await apmFields(paypal(), "#trustly-fields", { fundingSource: paypal().FUNDING?.TRUSTLY }); 20003 await apmButton(paypal(), "#trustly-btn", { fundingSource: paypal().FUNDING?.TRUSTLY }); 20004 }); 20005 var $$exports = { 20006 get paypal() { 20007 return paypal(); 20008 }, 20009 set paypal($$value = getContext("paypalScript").paypal) { 20010 paypal($$value); 20011 flushSync(); 20012 } 20013 }; 20014 var fragment = root$58(); 20015 next(2); 20016 append($$anchor, fragment); 20017 return pop($$exports); 20018 } 20019 create_custom_element(Trustly, { paypal: {} }, [], [], { mode: "open" }); 20020 proxy({ 20021 shop: "edge", 20022 env: "production", 20023 locale: "en", 20024 styles: "edge" 20025 }); 20026 var onStoryBook = proxy({ value: false }); 20027 //#endregion 20028 //#region src/components/paypal/lib/approvePaypalOrder.ts 20029 var captureOrderPath = "/api/v4/payments/paypal/capture/"; 20030 async function approvePaypalOrder(gomusOrderToken, paypalOrderId, { fetch } = { fetch: false }) { 20031 if (fetch) await (await fetch(`${shop.apiUrl}${captureOrderPath}${gomusOrderToken}/${paypalOrderId}`, { method: "post" })).json(); 20032 if (!onStoryBook.value) window.location.replace(window.location.origin + `/#/checkout/success?ORDERID=${gomusOrderToken}`); 20033 else console.warn("Payment Successful"); 20034 } 20035 //#endregion 20036 //#region src/components/paypal/payment-methods/card/Card.svelte 20037 var root$57 = /* @__PURE__ */ from_html(`<form class="card-container svelte-1vsxutp"><input autocomplete="on" name="email" placeholder="Email" type="email" required="" class="svelte-1vsxutp"/> <div id="card-name-field-container" class="svelte-1vsxutp"></div> <div id="card-number-field-container" class="svelte-1vsxutp"></div> <div id="card-expiry-field-container" class="svelte-1vsxutp"></div> <div id="card-cvv-field-container" class="svelte-1vsxutp"></div> <button id="card-field-submit-button" type="submit" class="svelte-1vsxutp">Pay now with Card</button> <div class="acdc-container svelte-1vsxutp"></div> <p id="result-message" class="svelte-1vsxutp"></p></form>`); 20038 var $$css = { 20039 hash: "svelte-1vsxutp", 20040 code: ".svelte-1vsxutp {box-sizing:border-box;}.card-container.svelte-1vsxutp {display:flex;flex-direction:column;justify-items:stretch;}\n input[type='email'].svelte-1vsxutp,\n button.svelte-1vsxutp {border:1px solid #909697;border-radius:4px;box-sizing:border-box;background:#ffffff;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:18px;line-height:24px;padding:20px 12px;margin:0.375rem;}input[type='email'].svelte-1vsxutp::-moz-placeholder {color:#687173;}input[type='email'].svelte-1vsxutp::placeholder {color:#687173;}button.svelte-1vsxutp:not(.does-not-exist)::-moz-placeholder {color:#687173;}button.svelte-1vsxutp:not(.does-not-exist)::placeholder {color:#687173;}input[type='email'].svelte-1vsxutp:focus,button.svelte-1vsxutp:not(.does-not-exist):focus {border-color:#000000;box-shadow:0 0 0 2px #000000 inset,\n 0 0 0 6px rgba(0, 0, 0, 0.16);outline:none;}button.svelte-1vsxutp {font-weight:bold;background-color:#000aff;color:#fff;cursor:pointer;}button.svelte-1vsxutp:disabled {background-color:#666;color:white;}" 20041 }; 20042 function Card($$anchor, $$props) { 20043 push($$props, true); 20044 append_styles$1($$anchor, $$css); 20045 let mounted = false; 20046 let cardField; 20047 let gomusOrderToken; 20048 let cardValid = /* @__PURE__ */ state(false); 20049 let customerData = /* @__PURE__ */ state(proxy({})); 20050 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 20051 let enabled = shop.payment_modes?.["pay_pal"]?.settings?.acdc_enabled; 20052 user_effect(() => { 20053 if (enabled) { 20054 if (mounted) return; 20055 mounted = true; 20056 loadCard(); 20057 } 20058 }); 20059 function validateEmail(email) { 20060 return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email); 20061 } 20062 let isCustomerFormValid = /* @__PURE__ */ user_derived(() => validateEmail(get$2(customerData).email) && get$2(cardValid)); 20063 async function loadCard() { 20064 cardField = paypal().CardFields({ 20065 createOrder: createOrderCallback, 20066 onApprove: onApproveCallback, 20067 inputEvents: { 20068 onChange: (data) => set(cardValid, data.isFormValid, true), 20069 onFocus: (data) => set(cardValid, data.isFormValid, true), 20070 onBlur: (data) => set(cardValid, data.isFormValid, true), 20071 onInputSubmitRequest: (data) => set(cardValid, data.isFormValid, true) 20072 }, 20073 style: { 20074 input: { 20075 "font-size": "16px", 20076 "font-family": "courier, monospace", 20077 "font-weight": "lighter", 20078 color: "#ccc" 20079 }, 20080 ".invalid": { color: "purple" } 20081 } 20082 }); 20083 if (cardField.isEligible()) { 20084 const styles = { style: { 20085 input: { color: "blue" }, 20086 ".invalid": { color: "purple" } 20087 } }; 20088 Promise.all([ 20089 cardField.NameField(styles).render("#card-name-field-container"), 20090 cardField.NumberField(styles).render("#card-number-field-container"), 20091 cardField.CVVField(styles).render("#card-cvv-field-container"), 20092 cardField.ExpiryField(styles).render("#card-expiry-field-container") 20093 ]); 20094 } 20095 async function createOrderCallback(data, _actions) { 20096 resultMessage("");
20097 try { 20098 const response = await new CreateGomusOrderService(data.paymentSource).call(); 20099 if (response.isErr()) return response.error.message; 20100 else { 20101 gomusOrderToken = response.value.order.token; 20102 gomusOrderToken = response.order.token; 20103 const orderData = response.order; 20104 console.log({ response }); 20105 if (response.value.meta.payment_result.id) return response.value.meta.payment_result.id; 20106 else { 20107 const errorDetail = orderData?.details?.[0]; 20108 const errorMessage = errorDetail ? `${errorDetail.issue} ${errorDetail.description} (${orderData.debug_id})` : JSON.stringify(orderData); 20109 throw new Error(errorMessage); 20110 } 20111 } 20112 } catch (error) { 20113 console.error(error); 20114 resultMessage(`Could not initiate PayPal Checkout...<br><br>${error}`); 20115 } 20116 } 20117 async function onApproveCallback(data, _actions) { 20118 try { 20119 const orderData = await approvePaypalOrder(gomusOrderToken, data.orderID, { fetch: true }); 20120 const transaction = orderData?.purchase_units?.[0]?.payments?.captures?.[0] || orderData?.purchase_units?.[0]?.payments?.authorizations?.[0]; 20121 const errorDetail = orderData?.details?.[0]; 20122 if (errorDetail || !transaction || transaction.status === "DECLINED") { 20123 let errorMessage; 20124 if (transaction) errorMessage = `Transaction ${transaction.status}: ${transaction.id}`; 20125 else if (errorDetail) errorMessage = `${errorDetail.description} (${orderData.debug_id})`; 20126 else errorMessage = JSON.stringify(orderData); 20127 throw new Error(errorMessage); 20128 } else { 20129 resultMessage(`<!--Transaction ${transaction.status}: ${transaction.id}<br><br>See console for all available details-->`); 20130 import_sweetalert2_all.default.fire("Capture result", JSON.stringify(orderData, null, 2)); 20131 } 20132 } catch (error) { 20133 console.error(error); 20134 resultMessage(`Sorry, your transaction could not be processed...<br><br>${error}`); 20135 } 20136 } 20137 function resultMessage(message) { 20138 const container = document.querySelector("#result-message"); 20139 container.innerHTML = message; 20140 } 20141 } 20142 function submit(event) { 20143 event.preventDefault(); 20144 cardField.submit({ billingAddress: { 20145 email_address: get$2(customerData).email, 20146 countryCode: "DE" 20147 } }).then(() => { 20148 console.log("Payment submitted successfully"); 20149 }).catch((reason) => { 20150 console.error("SUBMIT FAILED", reason); 20151 }); 20152 } 20153 var $$exports = { 20154 get paypal() { 20155 return paypal(); 20156 }, 20157 set paypal($$value = getContext("paypalScript").paypal) { 20158 paypal($$value); 20159 flushSync(); 20160 } 20161 }; 20162 var form = root$57(); 20163 var input = child(form); 20164 remove_input_defaults(input); 20165 var button = sibling(input, 10); 20166 next(4); 20167 reset(form); 20168 template_effect(() => button.disabled = !get$2(isCustomerFormValid)); 20169 event("submit", form, submit); 20170 bind_value(input, () => get$2(customerData).email, ($$value) => get$2(customerData).email = $$value); 20171 append($$anchor, form); 20172 return pop($$exports); 20173 } 20174 create_custom_element(Card, { paypal: {} }, [], [], { mode: "open" }); 20175 //#endregion 20176 //#region src/components/paypal/payment-methods/ideal/Ideal.svelte 20177 var root$56 = /* @__PURE__ */ from_html(`<div id="ideal-fields"></div> <div id="ideal-btn"></div>`, 1); 20178 function Ideal($$anchor, $$props) { 20179 push($$props, true); 20180 const paypal = prop($$props, "paypal", 23, () => getContext("paypalScript").paypal); 20181 console.log({ paypal: paypal() }); 20182 let mounted = false; 20183 onMount(async () => { 20184 if (mounted) return; 20185 mounted = true; 20186 await new Promise((resolve) => setTimeout(resolve, 100)); 20187 console.log("Ideal Mounted"); 20188 await apmFields(paypal(), "#ideal-fields", { fundingSource: paypal().FUNDING.IDEAL }); 20189 await apmButton(paypal(), "#ideal-btn", { fundingSource: paypal().FUNDING.IDEAL }); 20190 }); 20191 var $$exports = { 20192 get paypal() { 20193 return paypal(); 20194 }, 20195 set paypal($$value = getContext("paypalScript").paypal) { 20196 paypal($$value); 20197 flushSync(); 20198 } 20199 }; 20200 var fragment = root$56(); 20201 next(2); 20202 append($$anchor, fragment); 20203 return pop($$exports); 20204 }
20205 create_custom_element(Ideal, { paypal: {} }, [], [], { mode: "open" }); 20206 //#endregion 20207 //#region src/components/paypal/GomusPaypal.svelte 20208 function GomusPaypal($$anchor, $$props) { 20209 push($$props, true); 20210 let paypal = prop($$props, "paypal", 7); 20211 const fundingSources = { 20212 paypal: { 20213 name: "PayPal", 20214 component: Paypal 20215 }, 20216 ideal: { 20217 name: "iDeal", 20218 component: Ideal 20219 }, 20220 bancontact: { 20221 name: "Bancontact", 20222 component: Bancontact 20223 }, 20224 blik: { 20225 name: "Blik", 20226 component: Blik 20227 }, 20228 eps: { 20229 name: "Eps", 20230 component: Eps 20231 }, 20232 multibanco: { 20233 name: "Multibanco", 20234 component: Multibanco 20235 }, 20236 mybank: { 20237 name: "MyBank", 20238 component: MyBank 20239 }, 20240 p24: { 20241 name: "P24", 20242 component: P24 20243 }, 20244 trustly: { 20245 name: "Trustly", 20246 component: Trustly 20247 }, 20248 applepay: { 20249 name: "Apple Pay", 20250 component: ApplePay 20251 }, 20252 googlepay: { 20253 name: "Google Pay", 20254 component: GooglePay 20255 }, 20256 card: { 20257 name: "Card", 20258 component: Card 20259 } 20260 }; 20261 function isElligible(name) { 20262 if (name !== "googlepay") return paypal()?.isFundingEligible?.(name); 20263 return true; 20264 } 20265 setContext("paypalScript", { paypal: paypal() }); 20266 var $$exports = { 20267 get paypal() { 20268 return paypal(); 20269 }, 20270 set paypal($$value) { 20271 paypal($$value); 20272 flushSync(); 20273 } 20274 }; 20275 var fragment = comment(); 20276 each(first_child(fragment), 17, () => Object.keys(fundingSources).filter(isElligible), index$1, ($$anchor, fs) => { 20277 PaymentMethod($$anchor, { 20278 get name() { 20279 return fundingSources[get$2(fs)].name; 20280 }, 20281 get icon() { 20282 return get$2(fs); 20283 }, 20284 children: ($$anchor, $$slotProps) => { 20285 var fragment_2 = comment(); 20286 component(first_child(fragment_2), () => fundingSources[get$2(fs)].component, ($$anchor, $$component) => { 20287 $$component($$anchor, {}); 20288 }); 20289 append($$anchor, fragment_2); 20290 }, 20291 $$slots: { default: true } 20292 }); 20293 }); 20294 append($$anchor, fragment); 20295 return pop($$exports); 20296 } 20297 create_custom_element(GomusPaypal, { paypal: {} }, [], [], { mode: "open" }); 20298 //#endregion 20299 //#region src/components/paypal/Wrapper.svelte 20300 function Wrapper($$anchor, $$props) { 20301 push($$props, true); 20302 let borderRadius = prop($$props, "borderRadius", 7, "4"), height = prop($$props, "height", 7, void 0); 20303 let paypal = /* @__PURE__ */ state(void 0); 20304 user_effect(() => { 20305 if (shop.payment_modes?.pay_pal) loadPaypalScript(shop.payment_modes?.pay_pal?.settings.client_id, { 20306 locale: shop.locale, 20307 currency: shop.currency 20308 }).then((p) => { 20309 set(paypal, p, true); 20310 }); 20311 }); 20312 var $$exports = { 20313 get borderRadius() { 20314 return borderRadius(); 20315 }, 20316 set borderRadius($$value = "4") { 20317 borderRadius($$value); 20318 flushSync(); 20319 }, 20320 get height() { 20321 return height(); 20322 }, 20323 set height($$value = void 0) { 20324 height($$value); 20325 flushSync(); 20326 } 20327 }; 20328 var fragment = comment(); 20329 var node = first_child(fragment); 20330 var consequent = ($$anchor) => { 20331 { 20332 let $0 = /* @__PURE__ */ user_derived(() => parseInt(borderRadius(), 10)); 20333 let $1 = /* @__PURE__ */ user_derived(() => height() ? parseInt(height(), 10) : void 0); 20334 PaypalExpress($$anchor, { 20335 get paypal() { 20336 return get$2(paypal); 20337 }, 20338 get borderRadius() { 20339 return get$2($0); 20340 }, 20341 get height() { 20342 return get$2($1); 20343 } 20344 }); 20345 } 20346 }; 20347 if_block(node, ($$render) => { 20348 if (get$2(paypal)) $$render(consequent); 20349 }); 20350 append($$anchor, fragment); 20351 return pop($$exports); 20352 } 20353 customElements.define("gomus-paypal", create_custom_element(Wrapper, { 20354 borderRadius: {}, 20355 height: {} 20356 }, [], [])); 20357 //#endregion 20358 //#region src/lib/helpers/context.svelte.ts 20359 function createSetDetails(KEY) { 20360 return function(host, details) { 20361 if (host) host.addEventListener(KEY, (e) => { 20362 e.stopPropagation(); 20363 e.detail.value = details; 20364 }); 20365 else throw new Error("(createSetDetails) Host is undefined, You are probably trying to use this in a non-web-component context."); 20366 }; 20367 } 20368 var DetailsWrapper = class DetailsWrapper { 20369 host; 20370 KEY; 20371 pollDuration; 20372 #data = /* @__PURE__ */ state(proxy({ value: void 0 })); 20373 error = false;
20374 constructor(host, KEY, pollDuration = 1e3) { 20375 this.host = host; 20376 this.KEY = KEY; 20377 this.pollDuration = pollDuration; 20378 } 20379 static static(data) { 20380 const ret = new DetailsWrapper(null, null); 20381 ret.value = data; 20382 return ret; 20383 } 20384 load() { 20385 pollUntilTruthy(() => { 20386 this.host.dispatchEvent(new CustomEvent(this.KEY, { 20387 detail: this, 20388 bubbles: true 20389 })); 20390 return this.value; 20391 }, this.pollDuration).then(() => {}, () => { 20392 this.error = true; 20393 console.warn("(createGetDetails) could not load data for:", this.KEY); 20394 }); 20395 } 20396 get value() { 20397 return get$2(this.#data).value; 20398 } 20399 set value(newValue) { 20400 get$2(this.#data).value = newValue; 20401 } 20402 }; 20403 function createGetDetails(KEY) { 20404 return function(host, options = { pollDuration: 1e3 }) { 20405 if (host) { 20406 const details = new DetailsWrapper(host, KEY, options.pollDuration); 20407 details.load(options.pollDuration); 20408 return details; 20409 } else throw new Error("(createGetDetails) Host is undefined, You are probably trying to use this in a non-web-component context."); 20410 }; 20411 } 20412 //#endregion 20413 //#region src/config/configStore.svelte.ts 20414 var defaultConfig = { 20415 urls: {}, 20416 navigateTo: (url) => { 20417 window.location.assign(url); 20418 }, 20419 forms: {}, 20420 fields: {}, 20421 quantityStepper: true 20422 }; 20423 var ConfigStoreSvelte = class { 20424 defaultConfig = assign$1(defaultConfig, window.customOptions); 20425 override = this.defaultConfig; 20426 #options = /* @__PURE__ */ state(proxy(this.defaultConfig)); 20427 get options() { 20428 return get$2(this.#options); 20429 } 20430 set options(value) { 20431 set(this.#options, value, true); 20432 } 20433 constructor() { 20434 this.update(); 20435 } 20436 update() { 20437 const merged = assign$1(this.defaultConfig, this.override); 20438 merged.forms = Object.keys({ 20439 ...this.defaultConfig.forms, 20440 ...this.override.forms 20441 }).reduce((acc, key) => { 20442 acc[key] = { 20443 ...this.defaultConfig.forms[key], 20444 ...this.override.forms[key] 20445 }; 20446 return acc; 20447 }, {}); 20448 this.options = merged; 20449 } 20450 get config() { 20451 return this.options; 20452 } 20453 define(options) { 20454 this.override = assign$1(this.override, options); 20455 this.update(); 20456 return this; 20457 } 20458 default(options) { 20459 this.defaultConfig = assign$1(this.defaultConfig, options); 20460 this.update(); 20461 return this; 20462 } 20463 }; 20464 var configStore = new ConfigStoreSvelte(); 20465 //#endregion 20466 //#region src/components/annualTicketPersonalization/lib/PersonalizationDetails.svelte.ts 20467 var PersonalizationDetails = class { 20468 #token = /* @__PURE__ */ state(); 20469 get token() { 20470 return get$2(this.#token); 20471 } 20472 set token(value) { 20473 set(this.#token, value, true); 20474 } 20475 #ticketSaleId = /* @__PURE__ */ state(); 20476 get ticketSaleId() { 20477 return get$2(this.#ticketSaleId); 20478 } 20479 set ticketSaleId(value) { 20480 set(this.#ticketSaleId, value, true); 20481 } 20482 get order() { 20483 if (!this.token) return; 20484 return snapshot(shop.annualOrder(this.token)); 20485 } 20486 get ticketSale() { 20487 if (this.ticketSaleId) return snapshot(this.order?.ticket_sales.find((ts) => ts.id == this.ticketSaleId)); 20488 } 20489 get isBmcTicket() { 20490 return this.ticketSale?.is_bmc_ticket || false; 20491 } 20492 goToPersonalization(ticketSale) { 20493 if (configStore.config.urls.annualTicketPersonalizationForm) return configStore.config.urls.annualTicketPersonalizationForm(this.token, ticketSale.id); 20494 else return shop.urls.annualTicketPersonalizationForm(this.token, ticketSale.id); 20495 } 20496 }; 20497 var KEY$5 = "go-annual-ticket-personalization"; 20498 var setPersonalizationDetails = createSetDetails(KEY$5); 20499 var getPersonalizationDetails = createGetDetails(KEY$5); 20500 //#endregion 20501 //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalization.svelte 20502 var root$55 = /* @__PURE__ */ from_html(`<li><a> </a></li>`); 20503 var root_1$19 = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`); 20504 function AnnualTicketPersonalization($$anchor, $$props) { 20505 push($$props, true); 20506 let token = prop($$props, "token", 7); 20507 const details = new PersonalizationDetails(); 20508 setPersonalizationDetails($$props.$$host, details); 20509 user_effect(() => { 20510 details.token = token(); 20511 }); 20512 let order = /* @__PURE__ */ user_derived(() => details.order); 20513 var $$exports = { 20514 details, 20515 get token() { 20516 return token(); 20517 }, 20518 set token($$value) { 20519 token($$value); 20520 flushSync(); 20521 } 20522 }; 20523 var fragment = comment(); 20524 var node = first_child(fragment); 20525 var consequent_1 = ($$anchor) => { 20526 var fragment_1 = comment(); 20527 each(first_child(fragment_1), 17, () => get$2(order).ticket_sales, (ticketSale) => ticketSale.id, ($$anchor, ticketSale) => { 20528 var ul = root_1$19(); 20529 var li = child(ul); 20530 var text = child(li, true); 20531 reset(li); 20532 var li_1 = sibling(li, 2); 20533 var text_1 = child(li_1, true); 20534 reset(li_1); 20535 var node_2 = sibling(li_1, 2); 20536 var consequent = ($$anchor) => { 20537 var li_2 = root$55(); 20538 var a = child(li_2); 20539 var text_2 = child(a, true); 20540 reset(a); 20541 reset(li_2); 20542 template_effect(($0, $1) => { 20543 set_attribute(a, "href", $0); 20544 set_text(text_2, $1); 20545 }, [() => details.goToPersonalization(get$2(ticketSale)), () => shop.t("ticket.annual.personalization.list.personalize.add")]); 20546 append($$anchor, li_2); 20547 }; 20548 if_block(node_2, ($$render) => { 20549 if (get$2(ticketSale).status == "not_ready_to_send") $$render(consequent); 20550 }); 20551 reset(ul); 20552 template_effect(($0) => { 20553 set_attribute(ul, "data-ticket-sale-id", get$2(ticketSale).id); 20554 set_text(text, get$2(ticketSale).title); 20555 set_text(text_1, $0); 20556 }, [() =>
20556 shop.t("ticket.annual.personalization.detail.title", { count: get$2(ticketSale).personalizations.length })]); 20557 append($$anchor, ul); 20558 }); 20559 append($$anchor, fragment_1); 20560 }; 20561 if_block(node, ($$render) => { 20562 if (get$2(order)) $$render(consequent_1); 20563 }); 20564 append($$anchor, fragment); 20565 return pop($$exports); 20566 } 20567 customElements.define("go-annual-ticket-personalization", create_custom_element(AnnualTicketPersonalization, { token: { 20568 attribute: "token", 20569 reflect: true, 20570 type: "String" 20571 } }, [], ["details"])); 20572 //#endregion 20573 //#region src/components/forms/lib/allFields.ts 20574 var allFields = { 20575 salutation: { 20576 key: "salutation", 20577 apiKey: "customer_salutation_id", 20578 type: "select", 20579 label: "user.registration.form.customer_salutation_id", 20580 placeholder: "", 20581 description: "", 20582 autocomplete: "honorific-prefix", 20583 options: () => shop.customerSalutations.map((s) => ({ 20584 label: s.salutation, 20585 value: s.id 20586 })) 20587 }, 20588 firstName: { 20589 key: "firstName", 20590 apiKey: "name", 20591 type: "text", 20592 label: "user.registration.form.name", 20593 placeholder: "", 20594 description: "", 20595 autocomplete: "given-name" 20596 }, 20597 lastName: { 20598 key: "lastName", 20599 apiKey: "surname", 20600 type: "text", 20601 label: "user.registration.form.surname", 20602 placeholder: "", 20603 description: "", 20604 autocomplete: "family-name" 20605 }, 20606 email: { 20607 key: "email", 20608 apiKey: "email", 20609 type: "email", 20610 label: "user.registration.form.email", 20611 placeholder: "", 20612 description: "", 20613 autocomplete: "email", 20614 validator: string().email("user.fieldErrors.emailValid") 20615 }, 20616 confirmEmail: { 20617 key: "confirmEmail", 20618 apiKey: "email_confirmation", 20619 type: "email", 20620 label: "user.registration.form.confirmEmail", 20621 placeholder: "", 20622 description: "", 20623 autocomplete: "email", 20624 validator: string().email("user.fieldErrors.emailValid") 20625 }, 20626 password: { 20627 key: "password", 20628 apiKey: "password", 20629 type: "password", 20630 label: "user.registration.form.password", 20631 placeholder: "", 20632 description: "", 20633 autocomplete: "current-password" 20634 }, 20635 currentPassword: { 20636 key: "current_password", 20637 apiKey: "current_password", 20638 type: "password", 20639 label: "user.registration.form.password", 20640 placeholder: "", 20641 description: "", 20642 autocomplete: "current-password" 20643 }, 20644 newPassword: { 20645 key: "password", 20646 apiKey: "password", 20647 type: "password", 20648 label: "user.registration.form.password", 20649 placeholder: "", 20650 description: "", 20651 autocomplete: "new-password", 20652 validator: string().min(6, "user.fieldErrors.passwordTooShort") 20653 }, 20654 confirmPassword: { 20655 key: "confirmPassword", 20656 apiKey: "password_confirmation", 20657 type: "password", 20658 label: "user.registration.form.confirmPassword", 20659 placeholder: "", 20660 description: "", 20661 autocomplete: "new-password" 20662 }, 20663 addressee: { 20664 key: "addressee", 20665 apiKey: "addr_addressat", 20666 type: "text", 20667 label: "user.registration.form.adressat", 20668 placeholder: "", 20669 description: "", 20670 autocomplete: "name" 20671 }, 20672 street: { 20673 key: "street", 20674 apiKey: "addr_street", 20675 type: "text", 20676 label: "user.registration.form.street", 20677 placeholder: "", 20678 description: "", 20679 autocomplete: "street-address" 20680 }, 20681 postcode: { 20682 key: "postcode", 20683 apiKey: "addr_zip", 20684 type: "text", 20685 label: "user.registration.form.plz", 20686 placeholder: "", 20687 description: "", 20688 autocomplete: "postal-code" 20689 }, 20690 city: { 20691 key: "city", 20692 apiKey: "addr_city", 20693 type: "text", 20694 label: "user.registration.form.city", 20695 placeholder: "", 20696 description: "", 20697 autocomplete: "address-level2" 20698 }, 20699 country: { 20700 key: "country", 20701 apiKey: "addr_country_id", 20702 type: "select", 20703 label: "user.registration.form.country", 20704 placeholder: "", 20705 description: "", 20706 autocomplete: "country", 20707 options: () => shop.countries.map((c) => ({ 20708 label: c.name, 20709 value: c.id 20710 })) 20711 }, 20712 language: { 20713 key: "language", 20714 apiKey: "language_id", 20715 type: "select", 20716 label: "user.registration.form.language", 20717 placeholder: "", 20718 description: "", 20719 autocomplete: "language", 20720 options: () => shop.locales.map((c) => ({ 20721 label: shop.t(`languages.${c.locale}`), 20722 value: c.id 20723 })) 20724 }, 20725 acceptTerms: { 20726 key: "acceptTerms", 20727 apiKey: "terms", 20728 type: "checkbox", 20729 label: "user.registration.form.accept", 20730 placeholder: "", 20731 description: "", 20732 autocomplete: "off" 20733 }, 20734 startAt: { 20735 apiKey: "start_at", 20736 key: "startAt", 20737 type: "date", 20738 label: "ticket.annual.personalization.list.startAt.update", 20739 placeholder: "", 20740 description: "", 20741 autocomplete: "off", 20742 validator: string().date() 20743 }, 20744 token: { 20745 key: "token", 20746 apiKey: "id", 20747 type: "text", 20748 label: "cart.coupon.form.code", 20749 placeholder: "", 20750 description: "", 20751 autocomplete: "off" 20752 }, 20753 photo: { 20754 key: "photo", 20755 apiKey: "file", 20756 type: "file", 20757 label: "ticket.annual.personalization.form.photo", 20758 placeholder: "", 20759 description: "", 20760 autocomplete: "off", 20761 validator: _instanceof(File) 20762 }, 20763 withdrawalFirstName: { 20764 key: "withdrawalFirstName", 20765 apiKey: "first_name", 20766 type: "text", 20767 label: "user.registration.form.name", 20768 placeholder: "", 20769 description: "", 20770 autocomplete: "given-name" 20771 }, 20772 withdrawalLastName: { 20773 key: "withdrawalLastName", 20774 apiKey: "last_name", 20775 type: "text", 20776 label: "user.registration.form.surname", 20777 placeholder: "", 20778 description: "", 20779 autocomplete: "family-name" 20780 }, 20781 orderNumber: { 20782 key: "orderNumber", 20783 apiKey: "order_id", 20784 type: "text", 20785 label: "withdrawal.form.orderNumber", 20786 placeholder: "", 20787 description: "", 20788 autocomplete: "off" 20789 }, 20790 withdrawalNote: { 20791 key: "withdrawalNote", 20792 apiKey: "note", 20793 type: "textarea", 20794 label: "withdrawal.form.note", 20795 placeholder: "", 20796 description: "", 20797 autocomplete: "off" 20798 }, 20799 paymentMode: { 20800 key: "paymentMode", 20801 apiKey: "payment_mode_id", 20802 type: "paymentMode", 20803 label: "cart.paymentMode.label", 20804 placeholder: "", 20805 description: "", 20806 autocomplete: "off", 20807 options: () => { 20808 return (shop.payment_modes ? Object.values(shop.payment_modes) : []).map((m) => ({ 20809 value: String(m.id), 20810 label: m.name 20811 })); 20812 } 20813 } 20814 }; 20815 //#endregion
20816 //#region src/components/forms/lib/Field.svelte.ts 20817 function createField(data, required) { 20818 return { 20819 ...data, 20820 errors: data.errors || [], 20821 value: data.value ?? defaultValue(data.type), 20822 options: data.options, 20823 autocomplete: data.autocomplete ?? "", 20824 placeholder: data.placeholder ?? "", 20825 description: data.description, 20826 apiErrors: data.apiErrors ?? [], 20827 mounted: data.mounted ?? false, 20828 required, 20829 validate() { 20830 validateField(this); 20831 } 20832 }; 20833 } 20834 function defaultValue(fieldType) { 20835 if (fieldType === "checkbox") return false; 20836 else if (fieldType === "file") return null; 20837 else return ""; 20838 } 20839 function validateField(field) { 20840 field.errors = []; 20841 if (!field.validator) { 20842 if (field.required) { 20843 if (field.value === false || field.value === "" || field.value === null || field.value === void 0) field.errors = [`common.fieldErrors.required`]; 20844 } 20845 return; 20846 } 20847 const validation = field.validator.safeParse(field.value); 20848 if (!validation.success) field.errors = validation.error.format()._errors; 20849 else field.errors = []; 20850 } 20851 //#endregion 20852 //#region src/components/forms/lib/Forms.svelte.ts 20853 var Forms = class Forms { 20854 static #requiredApiKeysMap = {}; 20855 static defineForm(options) { 20856 configStore.default({ forms: { [options.id]: { 20857 fields: options.fields, 20858 submitLabel: options.submitLabel 20859 } } }); 20860 } 20861 static defineFields(fields) { 20862 configStore.default({ fields }); 20863 } 20864 static __init = Forms.defineFields(allFields); 20865 static setRequiredApiKeys(formId, requiredApiKeys) { 20866 Forms.#requiredApiKeysMap[formId] = requiredApiKeys; 20867 } 20868 static getFormOptions(formId) { 20869 return configStore.config.forms[formId]; 20870 } 20871 static createField(key, required) { 20872 const init = Forms.getFieldInit(key); 20873 if (!init) throw new Error(`(formFields) Field "${key}" not found`); 20874 return createField(init, required); 20875 } 20876 static getFormFields(formId) { 20877 return formFields(formId); 20878 } 20879 static getFieldInit(key) { 20880 return configStore.config.fields[key]; 20881 } 20882 }; 20883 /** 20884 * Retrieves the fields for a specified form based on its identifier. 20885 * 20886 */ 20887 function formFields(formId) { 20888 const definition = configStore.config.forms[formId]; 20889 if (!definition) throw new Error(`(formFields) Form ${formId} not found`); 20890 const fields = definition.fields; 20891 if (!fields) { 20892 console.warn("(formFields) No fields defined for form", formId); 20893 return []; 20894 } 20895 return fields; 20896 } 20897 /** 20898 * Calculates the number of fields that are mounted and have errors. 20899 * Also validates that confirmation fields match their corresponding fields. 20900 * 20901 * @param {Field[] | undefined} fields - The list of fields to evaluate. Each field should have a `mounted` and an `errors` property. 20902 * @return {number} The count of fields that are mounted and contain errors. Returns 0 if no fields are provided. 20903 */ 20904 function errors(fields) { 20905 if (!fields) return 0; 20906 return fields.filter((f) => f.mounted && (f.errors?.length || f.apiErrors?.length)).length; 20907 } 20908 //#endregion 20909 //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalizationForm.svelte 20910 function AnnualTicketPersonalizationForm($$anchor, $$props) { 20911 push($$props, true); 20912 let token = prop($$props, "token", 7), ticketSaleId = prop($$props, "ticketSaleId", 7); 20913 let form; 20914 const details = new PersonalizationDetails(); 20915 setPersonalizationDetails($$props.$$host, details); 20916 user_effect(() => { 20917 details.token = token(); 20918 details.ticketSaleId = ticketSaleId(); 20919 }); 20920 Forms.defineForm({ 20921 id: "ticketPersonalization", 20922 fields: [{ 20923 key: "startAt", 20924 required: true 20925 }] 20926 }); 20927 async function submitPersonalization() { 20928 if (!form) return; 20929 const personalizationsCount = details.ticketSale.personalizations.length; 20930 const forms = document.querySelectorAll("go-form:not([form-id=\"ticketPersonalization\"])"); 20931 const personalizationForms = iterate(personalizationsCount, (acc, index) => { 20932 const detail = forms[index - 1].details; 20933 acc.push(detail); 20934 return acc; 20935 }, []); 20936 personalizationForms.forEach((details) => { 20937 details.fields.forEach((f) => { 20938 details.validateField(f); 20939 }); 20940 }); 20941 if (!iterate(personalizationsCount, (acc, index) => { 20942 return personalizationForms[index - 1].isValid; 20943 }, false)) return; 20944 if (details.ticketSale?.photo_mandatory === "mandatory") { 20945 const uploads = personalizationForms.map(async (detail, index) => { 20946 const personalizationId = details.ticketSale.personalizations[index].id; 20947 const file = detail.fields.find((f) => f.key === "photo")?.value; 20948 if (!(file instanceof File)) return { 20949 ok: false, 20950 error: "ticket.annual.personalization.photo.missing" 20951 }; 20952 const result = await shop.uploadPersonalizationPhoto(token(), personalizationId, file); 20953 if (result.error) return { 20954 ok: false, 20955 error: result.error.error ?? "ticket.annual.personalization.photo.upload_failed" 20956 }; 20957 return { 20958 ok: true, 20959 error: "" 20960 }; 20961 }); 20962 const firstFailure = (await Promise.all(uploads)).find((r) => !r.ok); 20963 if (firstFailure) { 20964 form.details.apiErrors = [firstFailure.error]; 20965 return; 20966 } 20967 } 20968 const body = { personalization: { 20969 ticket_sale_id: details.ticketSaleId, 20970 start_at: form.details.formData.start_at, 20971 personalizations: personalizationForms.map((detail, index) => { 20972 const customer = omit$1(detail.formData, ["email_confirmation"]); 20973 return { 20974 id: details.ticketSale?.personalizations[index].id, 20975 customer 20976 }; 20977 }) 20978 } }; 20979 const result = await shop.finalizePersonalizations(token(), body); 20980 if (result.error) { 20981 form.details.apiErrors = [result.error.error]; 20982 return; 20983 } 20984 const beforeSubmit = configStore.config.forms.personalization?.beforeSubmit; 20985 if (beforeSubmit) beforeSubmit(body); 20986 if (configStore.config.urls.annualTicketPersonalizationFormSubmit?.()) configStore.config.navigateTo(configStore.config.urls.annualTicketPersonalizationFormSubmit()); 20987 } 20988 let templateForm = null; 20989 let templateBlueprint = null; 20990 let templateAnchor = null; 20991 let renderedCount = 0; 20992 function stripRuntimeMarkup(root) { 20993 root.querySelectorAll("go-field").forEach((field) => field.replaceChildren()); 20994 } 20995 function ensureTemplate() { 20996 if (templateForm) return true; 20997 templateForm = $$props.$$host.querySelector("go-personalization-form"); 20998 if (!templateForm) {
20999 console.warn("[personalization] No <go-personalization-form> supplied"); 21000 return false; 21001 } 21002 templateBlueprint = templateForm.cloneNode(true); 21003 stripRuntimeMarkup(templateBlueprint); 21004 templateAnchor = new Comment("go-personalization-form-anchor"); 21005 templateForm.after(templateAnchor); 21006 return true; 21007 } 21008 function syncPersonalizationForms(count) { 21009 if (!ensureTemplate() || !templateForm || !templateBlueprint || !templateAnchor) return; 21010 const wrapper = templateForm.parentElement; 21011 if (!wrapper) return; 21012 const target = Math.max(count, 1); 21013 const forms = Array.from(wrapper.querySelectorAll("go-personalization-form")); 21014 while (forms.length < target) { 21015 const clone = templateBlueprint.cloneNode(true); 21016 stripRuntimeMarkup(clone); 21017 wrapper.insertBefore(clone, templateAnchor); 21018 forms.push(clone); 21019 } 21020 while (forms.length > target) { 21021 const candidate = forms.pop(); 21022 if (candidate && candidate !== templateForm) candidate.remove(); 21023 } 21024 const personalizations = details.ticketSale?.personalizations ?? []; 21025 forms.forEach((form, index) => { 21026 const personalization = personalizations[index]; 21027 if (personalization) form.dataset.personalizationId = String(personalization.id); 21028 }); 21029 renderedCount = target; 21030 } 21031 onMount(() => { 21032 ensureTemplate(); 21033 $$props.$$host.addEventListener("go-submit", submitPersonalization); 21034 form = document.querySelector("go-form[form-id=\"ticketPersonalization\"]"); 21035 }); 21036 user_effect(() => { 21037 if (!details.ticketSale) return; 21038 const count = details.ticketSale?.personalizations.length ?? 1; 21039 if (count !== renderedCount) syncPersonalizationForms(count); 21040 }); 21041 return pop({ 21042 details, 21043 get token() { 21044 return token(); 21045 }, 21046 set token($$value) { 21047 token($$value); 21048 flushSync(); 21049 }, 21050 get ticketSaleId() { 21051 return ticketSaleId(); 21052 }, 21053 set ticketSaleId($$value) { 21054 ticketSaleId($$value); 21055 flushSync(); 21056 } 21057 }); 21058 } 21059 customElements.define("go-annual-ticket-personalization-form", create_custom_element(AnnualTicketPersonalizationForm, { 21060 token: { 21061 attribute: "token", 21062 reflect: true, 21063 type: "String" 21064 }, 21065 ticketSaleId: { 21066 attribute: "ticket-sale-id", 21067 reflect: true, 21068 type: "Number" 21069 } 21070 }, [], ["details"])); 21071 //#endregion 21072 //#region src/components/forms/ui/generic/FormDetails.svelte.ts 21073 var FormDetails = class { 21074 formId; 21075 form; 21076 #apiErrors = /* @__PURE__ */ state(proxy([])); 21077 #isValid = /* @__PURE__ */ user_derived(() => errors(this.fields) == 0); 21078 get isValid() { 21079 return get$2(this.#isValid); 21080 } 21081 set isValid(value) { 21082 set(this.#isValid, value); 21083 } 21084 #successMessage = /* @__PURE__ */ state(); 21085 get successMessage() { 21086 return get$2(this.#successMessage); 21087 } 21088 set successMessage(value) { 21089 set(this.#successMessage, value, true); 21090 } 21091 get formData() { 21092 function coerce(x) { 21093 if (isNumber(x) || isBoolean(x)) return x; 21094 if (x === "true" || x === "false") return x === "true"; 21095 if (!Number.isNaN(+x) && x.trim() !== "") return +x; 21096 return x; 21097 } 21098 const validFields = this.fields.filter((f) => f !== void 0).filter((f) => f.type !== "file").filter((f) => f.value !== ""); 21099 return Object.fromEntries(validFields.map((f) => [f.apiKey, coerce(f.value)])); 21100 } 21101 fieldValue(key) { 21102 return this.fields.find((f) => f.key === key)?.value; 21103 } 21104 get apiErrors() { 21105 return get$2(this.#apiErrors); 21106 } 21107 /** 21108 * Sets API errors for the current instance. 21109 * 21110 * The API returns errors in very different shapes, this method should consume all those shapes 21111 * 21112 * @param {string[] | Record<string, string[]>} errors - Errors passed as an array or an object where keys are API field keys and values are arrays of error messages. If an array is provided, it assigns the errors directly. If an object is provided, it maps the errors to the respective fields based on their API keys. 21113 */ 21114 set apiErrors(errors) { 21115 this.fields.forEach((f) => f.apiErrors = []); 21116 if (isArray(errors)) { 21117 set(this.#apiErrors, errors, true); 21118 return; 21119 } 21120 if (errors.errors && isArray(errors.errors)) set(this.#apiErrors, errors.errors, true); 21121 if (isString(errors.error)) { 21122 set(this.#apiErrors, [errors.error], true); 21123 return; 21124 } 21125 for (const [key, value] of Object.entries(errors)) { 21126 if (key === "full_messages") continue; 21127 if (key === "success") continue; 21128 if (key === "errors") continue; 21129 const field = this.fields.find((f) => f.apiKey === key); 21130 if (!field) { 21131 console.error(`(set apiErrors) Field with API key ${key} not found`); 21132 continue; 21133 } 21134 field.apiErrors = value; 21135 } 21136 } 21137 validateForm() { 21138 this.fields.forEach((f) => this.validateField(f)); 21139 } 21140 validateField(field) { 21141 field.validate(); 21142 if (field.apiKey === "password_confirmation") { 21143 const passwordField = this.fields.find((f) => f.apiKey === "password"); 21144 if (!passwordField || passwordField && field.value !== passwordField.value) field.errors.push("user.fieldErrors.passwordMatch"); 21145 } else if (field.apiKey === "email_confirmation") { 21146 const emailField = this.fields.find((f) => f.apiKey === "email"); 21147 if (!emailField || emailField && field.value !== emailField.value) field.errors.push("user.fieldErrors.emailMatch"); 21148 } 21149 } 21150 /** 21151 * The list of fields associated with form in the config. 21152 */ 21153 get fields() { 21154 const parent = this.form.closest("go-form"); 21155 return Array.from(this.form.querySelectorAll("go-field")).filter((fe) => fe.closest("go-form") === parent).map((fe) => fe.getField?.()).filter((f) => f); 21156 } 21157 toString() { 21158 return `Form: ${this.formId}, Fields: [${this.fields.map((f) => f.key).join(", ")}], Data: ${JSON.stringify(this.formData)}`; 21159 } 21160 /** 21161 * Populates the fields of the current instance with the corresponding values from the provided data object. 21162 * Filters the fields by matching their `apiKey` to keys in the data object and updates their `value`. 21163 * 21164 * @param {Record<string, any>}
21164 data - An object containing key-value pairs where keys represent the `apiKey` of fields and values represent the data to be filled into each field. 21165 */ 21166 fill(data) { 21167 const fs = this.fields; 21168 Object.entries(data).forEach(([key, val]) => { 21169 const f = fs.find((f) => f.apiKey === key); 21170 if (!f) { 21171 console.warn(`(FormDetails.fill) Field with API key ${key} not found.`); 21172 return; 21173 } 21174 if (f.type === "select") { 21175 if (!f.options?.().find((o) => o.value === val)) throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`); 21176 } 21177 if (f.type === "checkbox") { 21178 if (![true, false].includes(val)) throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`); 21179 } 21180 f.value = val; 21181 }); 21182 } 21183 constructor(formId, form) { 21184 this.formId = formId; 21185 this.form = form; 21186 } 21187 }; 21188 var KEY$4 = "go-form-details"; 21189 var setDetails$1 = createSetDetails(KEY$4); 21190 var getDetails$1 = createGetDetails(KEY$4); 21191 //#endregion 21192 //#region src/lib/helpers/wrapInElement.ts 21193 function wrapInElement(host, tag, props) { 21194 const first = host.firstElementChild || void 0; 21195 if (host.children?.length === 1 && first?.tagName.toLowerCase() === tag) return first; 21196 const element = document.createElement(tag); 21197 if (props) Object.entries(props).forEach(([key, value]) => { 21198 if (typeof value === "boolean") { 21199 if (value) element.setAttribute(key, ""); 21200 } else element.setAttribute(key, value); 21201 }); 21202 const frag = document.createDocumentFragment(); 21203 while (host.firstChild) frag.appendChild(host.firstChild); 21204 element.appendChild(frag); 21205 host.replaceChildren(element); 21206 return element; 21207 } 21208 //#endregion 21209 //#region src/components/forms/ui/generic/Form.svelte 21210 var root$54 = /* @__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> </go-submit>`, 3); 21211 function Form($$anchor, $$props) { 21212 push($$props, true); 21213 let formId = prop($$props, "formId", 7), custom = prop($$props, "custom", 7); 21214 const details = new FormDetails(formId(), $$props.$$host); 21215 setDetails$1($$props.$$host, details); 21216 async function handleSubmit(event) { 21217 event.preventDefault(); 21218 event.stopPropagation(); 21219 details.validateForm(); 21220 details?.form?.dispatchEvent(new Event("go-after-validation", event)); 21221 if (details.isValid) { 21222 details.apiErrors = {}; 21223 details?.form?.dispatchEvent(new Event("go-submit", event)); 21224 $$props.$$host.dispatchEvent(new Event("submit", { 21225 bubbles: true, 21226 composed: true 21227 })); 21228 } 21229 } 21230 onMount(() => { 21231 const form = wrapInElement($$props.$$host, "form", { novalidate: true }); 21232 form.addEventListener("submit", handleSubmit); 21233 details.form = form; 21234 }); 21235 var $$exports = { 21236 details, 21237 get formId() { 21238 return formId(); 21239 }, 21240 set formId($$value) { 21241 formId($$value); 21242 flushSync(); 21243 }, 21244 get custom() { 21245 return custom(); 21246 }, 21247 set custom($$value) { 21248 custom($$value); 21249 flushSync(); 21250 } 21251 }; 21252 var fragment = comment(); 21253 var node = first_child(fragment); 21254 var consequent = ($$anchor) => { 21255 var fragment_1 = root$54(); 21256 var go_submit = sibling(sibling(first_child(fragment_1), 2), 2); 21257 var text = child(go_submit, true); 21258 reset(go_submit); 21259 template_effect(($0) => set_text(text, $0), [() => shop.t(Forms.getFormOptions(formId())?.submitLabel || "Submit")]); 21260 append($$anchor, fragment_1); 21261 }; 21262 if_block(node, ($$render) => { 21263 if (!custom()) $$render(consequent); 21264 }); 21265 append($$anchor, fragment); 21266 return pop($$exports); 21267 } 21268 customElements.define("go-form", create_custom_element(Form, { 21269 formId: { 21270 attribute: "form-id", 21271 reflect: true, 21272 type: "String" 21273 }, 21274 custom: { 21275 attribute: "custom", 21276 reflect: true, 21277 type: "Boolean" 21278 } 21279 }, [], ["details"])); 21280 //#endregion 21281 //#region src/components/auth/passwordReset/PasswordReset.svelte 21282 var root$53 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2); 21283 function PasswordReset($$anchor, $$props) { 21284 push($$props, true); 21285 let custom = prop($$props, "custom", 7, false); 21286 Forms.defineForm({ 21287 id: "passwordReset", 21288 submitLabel: "user.passwordReset.actions.requestPasswordReset", 21289 fields: [{ 21290 key: "email", 21291 required: true 21292 }] 21293 }); 21294 async function passwordReset(event) { 21295 const details = event.target.details; 21296 const result = await shop.passwordReset(details.formData); 21297 if (result.data) { 21298 $$props.$$host.dispatchEvent(new Event("go-success", { 21299 bubbles: true, 21300 composed: true 21301 })); 21302 details.successMessage = result.data.message; 21303 details.apiErrors = []; 21304 } else details.apiErrors = result.error.errors; 21305 } 21306 var $$exports = { 21307 get custom() { 21308 return custom(); 21309 }, 21310 set custom($$value = false) { 21311 custom($$value); 21312 flushSync(); 21313 } 21314 }; 21315 var go_form = root$53(); 21316 set_custom_element_data(go_form, "formId", "passwordReset"); 21317 template_effect(() => set_custom_element_data(go_form, "custom", custom())); 21318 event("submit", go_form, passwordReset); 21319 append($$anchor, go_form); 21320 return pop($$exports); 21321 } 21322 customElements.define("go-password-reset", create_custom_element
21322(PasswordReset, { custom: {} }, [], [])); 21323 //#endregion 21324 //#region src/components/auth/signIn/SignIn.svelte 21325 function SignIn($$anchor, $$props) { 21326 push($$props, true); 21327 Forms.defineForm({ 21328 id: "signIn", 21329 submitLabel: "common.actions.login", 21330 fields: [{ 21331 key: "email", 21332 required: true 21333 }, { 21334 key: "password", 21335 required: true 21336 }] 21337 }); 21338 let custom = prop($$props, "custom", 7, false); 21339 async function signIn(event) { 21340 const details = event.target.details; 21341 const result = await shop.signIn(details.formData); 21342 if (result.data) $$props.$$host.dispatchEvent(new Event("go-success", { 21343 bubbles: true, 21344 composed: true 21345 })); 21346 else details.apiErrors = result.error.errors; 21347 } 21348 wrapInElement($$props.$$host, "go-form", { 21349 "form-id": "signIn", 21350 custom: custom() 21351 }); 21352 $$props.$$host.addEventListener("submit", signIn); 21353 return pop({ 21354 get custom() { 21355 return custom(); 21356 }, 21357 set custom($$value = false) { 21358 custom($$value); 21359 flushSync(); 21360 } 21361 }); 21362 } 21363 customElements.define("go-sign-in", create_custom_element(SignIn, { custom: { 21364 attribute: "custom", 21365 reflect: true, 21366 type: "Boolean" 21367 } }, [], [])); 21368 //#endregion 21369 //#region src/components/auth/signUp/SignUp.svelte 21370 function SignUp($$anchor, $$props) { 21371 push($$props, true); 21372 let custom = prop($$props, "custom", 7, false); 21373 Forms.defineForm({ 21374 id: "signUp", 21375 submitLabel: "common.actions.register", 21376 fields: [ 21377 { 21378 key: "firstName", 21379 required: true 21380 }, 21381 { 21382 key: "lastName", 21383 required: true 21384 }, 21385 { 21386 key: "email", 21387 required: true 21388 }, 21389 { 21390 key: "confirmEmail", 21391 required: true 21392 }, 21393 { 21394 key: "newPassword", 21395 required: true 21396 }, 21397 { 21398 key: "confirmPassword", 21399 required: true 21400 }, 21401 { 21402 key: "acceptTerms", 21403 required: true 21404 } 21405 ] 21406 }); 21407 async function signUp(event) { 21408 const details = event.target.details; 21409 const result = await shop.signUp(details.formData, false); 21410 if (result.data) $$props.$$host.dispatchEvent(new Event("go-success", { 21411 bubbles: true, 21412 composed: true 21413 })); 21414 else details.apiErrors = result.error.errors; 21415 } 21416 wrapInElement($$props.$$host, "go-form", { 21417 "form-id": "signUp", 21418 custom: custom() 21419 }); 21420 $$props.$$host.addEventListener("submit", signUp); 21421 return pop({ 21422 get custom() { 21423 return custom(); 21424 }, 21425 set custom($$value = false) { 21426 custom($$value); 21427 flushSync(); 21428 } 21429 }); 21430 } 21431 customElements.define("go-sign-up", create_custom_element(SignUp, { custom: { 21432 attribute: "custom", 21433 reflect: true, 21434 type: "Boolean" 21435 } }, [], [])); 21436 //#endregion 21437 //#region src/components/cart/components/utils.ts 21438 function getQuantity(value, fallback) { 21439 if (typeof value === "number" && Number.isFinite(value)) return value; 21440 if (value && typeof value === "object") { 21441 const total = Object.values(value).reduce((sum, num) => { 21442 return typeof num === "number" && Number.isFinite(num) ? sum + num : sum; 21443 }, 0); 21444 if (total > 0) return total; 21445 } 21446 return fallback; 21447 } 21448 //#endregion 21449 //#region src/components/cart/components/lib.ts 21450 function resolveQuantitySource(attrs) { 21451 return "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities; 21452 } 21453 function resolveApiQuantity(attrs) { 21454 return getQuantity(resolveQuantitySource(attrs), 0); 21455 } 21456 function createDisplayCart(baseCart, apiItems) { 21457 const displayCart = createCart(); 21458 const echoed = new Set(apiItems.map((i) => i.attributes.coupon).filter(Boolean).map((c) => c.toUpperCase())); 21459 baseCart.coupons.forEach((coupon) => displayCart.addCoupon({ 21460 ...coupon, 21461 applied: coupon.kind !== "actionToken" || echoed.has(coupon.code) 21462 })); 21463 apiItems.forEach((apiItem) => { 21464 const attrs = apiItem.attributes; 21465 const ref = attrs.uuid; 21466 const itemInBaseCart = baseCart.items.find((i) => i.uuid === ref); 21467 if (!itemInBaseCart) { 21468 console.error("(go-cart) Ignoring unmatched cart line", { 21469 type: apiItem.type, 21470 attrs 21471 }); 21472 return; 21473 } 21474 displayCart.addItem(createDisplayCartItem(itemInBaseCart, attrs)); 21475 });
21476 return displayCart; 21477 } 21478 function createDisplayCartItem(cartItem, attrs) { 21479 const quantity = resolveApiQuantity(attrs); 21480 const displayPrice = attrs.price_cents ?? cartItem.product.price_cents; 21481 const originalPrice = cartItem.product.price_cents; 21482 const discounted = displayPrice < originalPrice; 21483 return createCartItem({ 21484 ...cartItem.product, 21485 price_cents: displayPrice 21486 }, { 21487 quantity, 21488 time: cartItem.time, 21489 mantle: cartItem.mantle, 21490 display: { 21491 discounted, 21492 reference_uuid: cartItem.uuid, 21493 originalPrice 21494 } 21495 }); 21496 } 21497 //#endregion 21498 //#region src/components/cart/components/CartDetails.svelte.ts 21499 var CartDetails = class { 21500 #displayCart = /* @__PURE__ */ state(); 21501 get displayCart() { 21502 return get$2(this.#displayCart); 21503 } 21504 set displayCart(value) { 21505 set(this.#displayCart, value, true); 21506 } 21507 #preview = /* @__PURE__ */ state(false); 21508 get preview() { 21509 return get$2(this.#preview); 21510 } 21511 set preview(value) { 21512 set(this.#preview, value, true); 21513 } 21514 get totalPriceCents() { 21515 return this.displayCart?.amountToPayCents ?? 0; 21516 } 21517 get subtotalPriceCents() { 21518 return shop.cart?.totalPriceCents ?? 0; 21519 } 21520 get discountedAmountCents() { 21521 return Math.max(0, this.subtotalPriceCents - this.totalPriceCents); 21522 } 21523 get isDiscounted() { 21524 return this.discountedAmountCents > 0; 21525 } 21526 async calculateDisplayCart() { 21527 const mc = shop.cart; 21528 if (!mc) return; 21529 try { 21530 const { items, coupons } = mc.orderData(); 21531 const response = await shop.createCart({ 21532 items, 21533 coupons 21534 }); 21535 if (response?.data) { 21536 this.displayCart = createDisplayCart(mc, response.data.items ?? []); 21537 return; 21538 } 21539 console.error("(go-cart) Unable to fetch discounted cart data", response?.error); 21540 this.displayCart = mc; 21541 } catch (error) { 21542 console.error("(go-cart) Unable to fetch discounted cart data", error); 21543 this.displayCart = mc; 21544 } 21545 } 21546 }; 21547 var KEY$3 = "go-cart-details"; 21548 var setCartDetails = createSetDetails(KEY$3); 21549 var getCartDetails = createGetDetails(KEY$3); 21550 //#endregion 21551 //#region src/components/cart/components/itemTitles/Coupon.svelte 21552 var root$52 = /* @__PURE__ */ from_html(`<span class="go-cart-item-title" data-testid="cart-item-title"> </span>`); 21553 function Coupon($$anchor, $$props) { 21554 push($$props, true); 21555 let cartItem = prop($$props, "cartItem", 7); 21556 var $$exports = { 21557 get cartItem() { 21558 return cartItem(); 21559 }, 21560 set cartItem($$value) { 21561 cartItem($$value); 21562 flushSync(); 21563 } 21564 }; 21565 var span = root$52(); 21566 var text = child(span, true); 21567 reset(span); 21568 template_effect(() => set_text(text, cartItem().product.title)); 21569 append($$anchor, span); 21570 return pop($$exports); 21571 } 21572 create_custom_element(Coupon, { cartItem: {} }, [], [], { mode: "open" }); 21573 //#endregion 21574 //#region src/components/cart/components/itemTitles/Event.svelte 21575 var root$51 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span><span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1); 21576 var root_1$18 = /* @__PURE__ */ from_html(`<span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span><span class="go-cart-item-title-ticket-title"> </span></span><!>`, 1); 21577 function Event$2($$anchor, $$props) { 21578 push($$props, true); 21579 let cartItem = prop($$props, "cartItem", 7);
21580 if (!isEventTicket(cartItem().product)) throw new Error("Product is not an event ticket"); 21581 const product = cartItem().product; 21582 var $$exports = { 21583 get cartItem() { 21584 return cartItem(); 21585 }, 21586 set cartItem($$value) { 21587 cartItem($$value); 21588 flushSync(); 21589 } 21590 }; 21591 var fragment = root_1$18(); 21592 var span = first_child(fragment); 21593 var span_1 = child(span); 21594 var text = child(span_1, true); 21595 reset(span_1); 21596 var span_2 = sibling(span_1); 21597 var text_1 = child(span_2, true); 21598 reset(span_2); 21599 reset(span); 21600 var node = sibling(span); 21601 var consequent = ($$anchor) => { 21602 var fragment_1 = root$51(); 21603 var span_3 = first_child(fragment_1); 21604 var text_2 = child(span_3, true); 21605 reset(span_3); 21606 var span_4 = sibling(span_3); 21607 var text_3 = child(span_4, true); 21608 reset(span_4); 21609 template_effect(($0, $1) => { 21610 set_text(text_2, $0); 21611 set_text(text_3, $1); 21612 }, [() => formatDate(cartItem().time, { 21613 month: "numeric", 21614 day: "numeric" 21615 }, shop.locale), () => formatTime(cartItem().time)]); 21616 append($$anchor, fragment_1); 21617 }; 21618 if_block(node, ($$render) => { 21619 if (cartItem().time) $$render(consequent); 21620 }); 21621 template_effect(() => { 21622 set_text(text, product.event_title); 21623 set_text(text_1, product.title); 21624 }); 21625 append($$anchor, fragment); 21626 return pop($$exports); 21627 } 21628 create_custom_element(Event$2, { cartItem: {} }, [], [], { mode: "open" }); 21629 //#endregion 21630 //#region src/components/cart/components/itemTitles/Ticket.svelte 21631 var root$50 = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`); 21632 var root_1$17 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1); 21633 var root_2$12 = /* @__PURE__ */ from_html(`<span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!>`, 1); 21634 function Ticket($$anchor, $$props) { 21635 push($$props, true); 21636 let cartItem = prop($$props, "cartItem", 7); 21637 var $$exports = { 21638 get cartItem() { 21639 return cartItem(); 21640 }, 21641 set cartItem($$value) { 21642 cartItem($$value); 21643 flushSync(); 21644 } 21645 }; 21646 var fragment = root_2$12(); 21647 var span = first_child(fragment); 21648 var text = child(span, true); 21649 reset(span); 21650 var node = sibling(span, 2); 21651 var consequent_1 = ($$anchor) => { 21652 var fragment_1 = root_1$17(); 21653 var span_1 = first_child(fragment_1); 21654 var text_1 = child(span_1, true); 21655 reset(span_1); 21656 var node_1 = sibling(span_1, 2); 21657 var consequent = ($$anchor) => { 21658 var span_2 = root$50(); 21659 var text_2 = child(span_2, true); 21660 reset(span_2); 21661 template_effect(($0) => set_text(text_2, $0), [() => formatTime(cartItem().time)]); 21662 append($$anchor, span_2); 21663 }; 21664 if_block(node_1, ($$render) => { 21665 if (cartItem().product.type === "Ticket" && cartItem().product.subtype === "timeslot") $$render(consequent); 21666 }); 21667 template_effect(($0) => set_text(text_1, $0), [() => formatDate(cartItem().time, { 21668 month: "numeric", 21669 day: "numeric" 21670 }, shop.locale)]); 21671 append($$anchor, fragment_1); 21672 }; 21673 if_block(node, ($$render) => { 21674 if (cartItem().time) $$render(consequent_1); 21675 }); 21676 template_effect(() => set_text(text, cartItem().product.title)); 21677 append($$anchor, fragment); 21678 return pop($$exports); 21679 } 21680 create_custom_element(Ticket, { cartItem: {} }, [], [], { mode: "open" }); 21681 //#endregion 21682 //#region src/lib/models/cart/quantityStepper.ts 21683 /** `+`: from below the order minimum jump to it (at least `1`); otherwise step up by one. Capped at `max`. */ 21684 function increment(value, { min, max }) { 21685 const target = value < min ? Math.max(min, 1) : value + 1; 21686 return target > max ? value : target; 21687 } 21688 /** `â`: from the order minimum drop straight to `floor` (skipping the invalid band); otherwise step down by one. */ 21689 function decrement(value, { min, floor = 0 }) { 21690 return value <= min ? floor : value - 1; 21691 } 21692 /** Clamp a typed value into `{floor} ⪠[min, max]`: `â¤0` â `floor`, `0<v<min` rounds up to `min`, `>max` â `max`. */ 21693 function clampTyped(raw, { min, max, floor = 0 }) { 21694 if (!Number.isFinite(raw) || raw <= 0) return floor; 21695 let v = Math.floor(raw); 21696 if (v < min) v = min; 21697 if (v > max) v = max; 21698 return v; 21699 }
21700 /** Whether `value` is a committable quantity for these bounds. */ 21701 function isValid(value, { min, max, floor = 0 }) { 21702 if (value < 0 || value > max) return false; 21703 return value === floor || value >= min; 21704 } 21705 /** Whether `+` can change the value (false â the button is `aria-disabled`). */ 21706 function canIncrement(value, bounds) { 21707 return increment(value, bounds) > value; 21708 } 21709 /** Whether `â` can change the value (false â the button is `aria-disabled`). */ 21710 function canDecrement(value, { floor = 0 }) { 21711 return value > floor; 21712 } 21713 //#endregion 21714 //#region src/components/shared/quantityStepper/QuantityStepper.svelte 21715 var root$49 = /* @__PURE__ */ from_html(`<div class="go-quantity-stepper" role="group"><button type="button" class="go-quantity-stepper-button go-quantity-stepper-decrement" tabindex="-1"><span aria-hidden="true">â</span></button> <input class="go-quantity-stepper-value" type="text" role="spinbutton" inputmode="numeric" autocomplete="off"/> <button type="button" class="go-quantity-stepper-button go-quantity-stepper-increment" tabindex="-1"><span aria-hidden="true">+</span></button></div>`); 21716 function QuantityStepper($$anchor, $$props) { 21717 const inputId = props_id(); 21718 push($$props, true); 21719 let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), floor = prop($$props, "floor", 7, 0), label = prop($$props, "label", 7), decreaseLabel = prop($$props, "decreaseLabel", 7), increaseLabel = prop($$props, "increaseLabel", 7), onChange = prop($$props, "onChange", 7); 21720 const bounds = /* @__PURE__ */ user_derived(() => ({ 21721 min: min(), 21722 max: max(), 21723 floor: floor() 21724 })); 21725 let inputEl; 21726 let invalid = /* @__PURE__ */ state(false); 21727 const decDisabled = /* @__PURE__ */ user_derived(() => !canDecrement(value(), get$2(bounds))); 21728 const incDisabled = /* @__PURE__ */ user_derived(() => !canIncrement(value(), get$2(bounds))); 21729 function emit(next) { 21730 if (next !== value()) onChange()(next); 21731 } 21732 function stepDown() { 21733 if (canDecrement(value(), get$2(bounds))) emit(decrement(value(), get$2(bounds))); 21734 } 21735 function stepUp() { 21736 if (canIncrement(value(), get$2(bounds))) emit(increment(value(), get$2(bounds))); 21737 } 21738 function commitTyped() { 21739 const next = clampTyped(parseInt(inputEl.value, 10), get$2(bounds)); 21740 set(invalid, false); 21741 inputEl.value = String(next); 21742 emit(next); 21743 } 21744 function onInput() { 21745 const raw = inputEl.value.trim(); 21746 set(invalid, !(/^\d+$/.test(raw) && isValid(parseInt(raw, 10), get$2(bounds)))); 21747 } 21748 function onKeydown(e) { 21749 switch (e.key) { 21750 case "ArrowUp": 21751 e.preventDefault(); 21752 stepUp(); 21753 break; 21754 case "ArrowDown": 21755 e.preventDefault(); 21756 stepDown(); 21757 break; 21758 case "Home": 21759 e.preventDefault(); 21760 emit(floor()); 21761 break; 21762 case "End": 21763 e.preventDefault(); 21764 emit(max()); 21765 break; 21766 case "Enter": 21767 e.preventDefault(); 21768 commitTyped(); 21769 break; 21770 } 21771 } 21772 var $$exports = { 21773 get value() { 21774 return value(); 21775 }, 21776 set value($$value) { 21777 value($$value); 21778 flushSync(); 21779 }, 21780 get min() { 21781 return min(); 21782 }, 21783 set min($$value) { 21784 min($$value); 21785 flushSync(); 21786 }, 21787 get max() { 21788 return max(); 21789 }, 21790 set max($$value) { 21791 max($$value); 21792 flushSync(); 21793 }, 21794 get floor() { 21795 return floor(); 21796 }, 21797 set floor($$value = 0) { 21798 floor($$value); 21799 flushSync(); 21800 }, 21801 get label() { 21802 return label(); 21803 }, 21804 set label($$value) { 21805 label($$value); 21806 flushSync(); 21807 }, 21808 get decreaseLabel() { 21809 return decreaseLabel(); 21810 }, 21811 set decreaseLabel($$value) { 21812 decreaseLabel($$value); 21813 flushSync(); 21814 }, 21815 get increaseLabel() { 21816 return increaseLabel(); 21817 }, 21818 set increaseLabel($$value) { 21819 increaseLabel($$value); 21820 flushSync(); 21821 }, 21822 get onChange() { 21823 return onChange(); 21824 }, 21825 set onChange($$value) { 21826 onChange($$value); 21827 flushSync(); 21828 } 21829 }; 21830 var div = root$49(); 21831 var button = child(div); 21832 var input = sibling(button, 2); 21833 remove_input_defaults(input); 21834 bind_this(input, ($$value) => inputEl = $$value, () => inputEl); 21835 var button_1 = sibling(input, 2); 21836 reset(div); 21837 template_effect(() => { 21838 set_attribute(div, "aria-label", label()); 21839 set_attribute(button, "title", decreaseLabel()); 21840 set_attribute(button, "aria-controls", inputId); 21841 set_attribute(button, "aria-disabled", get$2(decDisabled)); 21842 set_attribute(input, "id", inputId); 21843 set_attribute(input, "aria-label", label()); 21844 set_value(input, value()); 21845 set_attribute(input, "aria-valuenow", value()); 21846 set_attribute(input, "aria-valuemin", floor()); 21847 set_attribute(input, "aria-valuemax", max()); 21848 set_attribute(input, "aria-invalid", get$2(invalid) ? "true" : void 0); 21849 set_attribute(button_1, "title", increaseLabel()); 21850 set_attribute(button_1, "aria-controls", inputId); 21851 set_attribute(button_1, "aria-disabled", get$2(incDisabled)); 21852 }); 21853 delegated("click", button, stepDown); 21854 delegated("input", input, onInput); 21855 delegated("change", input, commitTyped); 21856 event("blur", input, commitTyped); 21857 delegated("keydown", input, onKeydown); 21858 delegated("click", button_1, stepUp); 21859 append($$anchor, div); 21860 return pop($$exports); 21861 } 21862 delegate([ 21863 "click", 21864 "input", 21865 "change", 21866 "keydown" 21867 ]);
21868 create_custom_element(QuantityStepper, { 21869 value: {}, 21870 min: {}, 21871 max: {}, 21872 floor: {}, 21873 label: {}, 21874 decreaseLabel: {}, 21875 increaseLabel: {}, 21876 onChange: {} 21877 }, [], [], { mode: "open" }); 21878 //#endregion 21879 //#region src/lib/models/cart/selectOptions.ts 21880 function generateQuantityOptions(from, to, options = { floor: 0 }) { 21881 const { floor } = options; 21882 if (to === 0 || to === floor) return [option(floor)]; 21883 if (to < from) return from > floor ? [option(from)] : []; 21884 const start = Math.max(from, floor); 21885 const result = [option(floor)]; 21886 for (let q = start; q <= to; q++) { 21887 if (q === floor) continue; 21888 result.push(option(q)); 21889 } 21890 return result; 21891 } 21892 function option(value) { 21893 return { 21894 value, 21895 label: value.toString() 21896 }; 21897 } 21898 //#endregion 21899 //#region src/components/shared/quantityStepper/QuantityControl.svelte 21900 var root$48 = /* @__PURE__ */ from_html(`<option> </option>`); 21901 var root_1$16 = /* @__PURE__ */ from_html(`<select class="go-quantity-select"></select>`); 21902 function QuantityControl($$anchor, $$props) { 21903 push($$props, true); 21904 /** Current committed quantity. */ 21905 /** Current committed quantity. */ 21906 /** Order minimum (min_persons); the stepper skips the `1..min-1` band. */ 21907 /** Capacity ceiling. */ 21908 /** Accessible name (product / sub-ticket title) for either control. */ 21909 /** Lowest option the legacy select offers â see generateQuantityOptions. Ignored when not deselectable. */ 21910 /** 21911 * Whether the visitor can drop the line to the deselect value (`0` on the stepper, 21912 * `floor` on the select). `false` â mantle sub-rows â makes `min` (the sub-ticket's 21913 * `min_persons`) a hard bottom on both controls: the backend does not enforce it, 21914 * so the UI must (Angular-shop parity). 21915 */ 21916 /** Emits the next committed quantity. The control never mutates anything itself. */ 21917 let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), label = prop($$props, "label", 7), floor = prop($$props, "floor", 7, 0), deselectable = prop($$props, "deselectable", 7, true), onChange = prop($$props, "onChange", 7); 21918 const useStepper = /* @__PURE__ */ user_derived(() => configStore.config.quantityStepper); 21919 var $$exports = { 21920 get value() { 21921 return value(); 21922 }, 21923 set value($$value) { 21924 value($$value); 21925 flushSync(); 21926 }, 21927 get min() { 21928 return min(); 21929 }, 21930 set min($$value) { 21931 min($$value); 21932 flushSync(); 21933 }, 21934 get max() { 21935 return max(); 21936 }, 21937 set max($$value) { 21938 max($$value); 21939 flushSync(); 21940 }, 21941 get label() { 21942 return label(); 21943 }, 21944 set label($$value) { 21945 label($$value); 21946 flushSync(); 21947 }, 21948 get floor() { 21949 return floor(); 21950 }, 21951 set floor($$value = 0) { 21952 floor($$value); 21953 flushSync(); 21954 }, 21955 get deselectable() { 21956 return deselectable(); 21957 }, 21958 set deselectable($$value = true) { 21959 deselectable($$value); 21960 flushSync(); 21961 }, 21962 get onChange() { 21963 return onChange(); 21964 }, 21965 set onChange($$value) { 21966 onChange($$value); 21967 flushSync(); 21968 } 21969 }; 21970 var fragment = comment(); 21971 var node = first_child(fragment); 21972 var consequent = ($$anchor) => { 21973 { 21974 let $0 = /* @__PURE__ */ user_derived(() => deselectable() ? 0 : min()); 21975 let $1 = /* @__PURE__ */ user_derived(() => shop.t("quantity.decrease")); 21976 let $2 = /* @__PURE__ */ user_derived(() => shop.t("quantity.increase")); 21977 QuantityStepper($$anchor, { 21978 get value() { 21979 return value(); 21980 }, 21981 get min() { 21982 return min(); 21983 }, 21984 get max() { 21985 return max(); 21986 }, 21987 get floor() { 21988 return get$2($0); 21989 }, 21990 get label() { 21991 return label(); 21992 }, 21993 get decreaseLabel() { 21994 return get$2($1); 21995 }, 21996 get increaseLabel() { 21997 return get$2($2); 21998 }, 21999 get onChange() { 22000 return onChange(); 22001 } 22002 }); 22003 } 22004 }; 22005 var alternate = ($$anchor) => { 22006 var select = root_1$16(); 22007 each(select, 21, () => generateQuantityOptions(min(), max(), { floor: deselectable() ? floor() : min() }), (q) => q.value, ($$anchor, q) => { 22008 var option = root$48(); 22009 var text = child(option, true); 22010 reset(option); 22011 var option_value = {}; 22012 template_effect(() => {
22013 set_selected(option, value() === get$2(q).value); 22014 set_text(text, get$2(q).label); 22015 if (option_value !== (option_value = get$2(q).value)) option.value = (option.__value = get$2(q).value) ?? ""; 22016 }); 22017 append($$anchor, option); 22018 }); 22019 reset(select); 22020 template_effect(() => set_attribute(select, "aria-label", label())); 22021 delegated("change", select, (e) => onChange()(parseInt(e.target.value, 10))); 22022 append($$anchor, select); 22023 }; 22024 if_block(node, ($$render) => { 22025 if (get$2(useStepper)) $$render(consequent); 22026 else $$render(alternate, -1); 22027 }); 22028 append($$anchor, fragment); 22029 return pop($$exports); 22030 } 22031 delegate(["change"]); 22032 create_custom_element(QuantityControl, { 22033 value: {}, 22034 min: {}, 22035 max: {}, 22036 label: {}, 22037 floor: {}, 22038 deselectable: {}, 22039 onChange: {} 22040 }, [], [], { mode: "open" }); 22041 //#endregion 22042 //#region ../../node_modules/.pnpm/[email protected]/node_modules/dompurify/dist/purify.es.mjs 22043 /*! @license DOMPurify 3.4.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.7/LICENSE */ 22044 function _arrayLikeToArray(r, a) { 22045 (null == a || a > r.length) && (a = r.length); 22046 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 22047 return n; 22048 } 22049 function _arrayWithHoles(r) { 22050 if (Array.isArray(r)) return r; 22051 } 22052 function _iterableToArrayLimit(r, l) { 22053 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 22054 if (null != t) { 22055 var e, n, i, u, a = [], f = true, o = false; 22056 try { 22057 if (i = (t = t.call(r)).next, 0 === l); 22058 else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 22059 } catch (r) { 22060 o = true, n = r; 22061 } finally { 22062 try { 22063 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 22064 } finally { 22065 if (o) throw n; 22066 } 22067 } 22068 return a; 22069 } 22070 } 22071 function _nonIterableRest() { 22072 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 22073 } 22074 function _slicedToArray(r, e) { 22075 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 22076 } 22077 function _unsupportedIterableToArray(r, a) { 22078 if (r) { 22079 if ("string" == typeof r) return _arrayLikeToArray(r, a); 22080 var t = {}.toString.call(r).slice(8, -1); 22081 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 22082 } 22083 } 22084 var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 22085 var freeze = Object.freeze, seal = Object.seal, create = Object.create; 22086 var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct; 22087 if (!freeze) freeze = function freeze(x) { 22088 return x; 22089 }; 22090 if (!seal) seal = function seal(x) { 22091 return x; 22092 }; 22093 if (!apply) apply = function apply(func, thisArg) { 22094 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key]; 22095 return func.apply(thisArg, args); 22096 }; 22097 if (!construct) construct = function construct(Func) { 22098 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2]; 22099 return new Func(...args); 22100 }; 22101 var arrayForEach = unapply(Array.prototype.forEach); 22102 var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf); 22103 var arrayPop = unapply(Array.prototype.pop); 22104 var arrayPush = unapply(Array.prototype.push); 22105 var arraySplice = unapply(Array.prototype.splice); 22106 var arrayIsArray = Array.isArray; 22107 var stringToLowerCase = unapply(String.prototype.toLowerCase); 22108 var stringToString = unapply(String.prototype.toString); 22109 var stringMatch = unapply(String.prototype.match); 22110 var stringReplace = unapply(String.prototype.replace); 22111 var stringIndexOf = unapply(String.prototype.indexOf); 22112 var stringTrim = unapply(String.prototype.trim); 22113 var numberToString = unapply(Number.prototype.toString); 22114 var booleanToString = unapply(Boolean.prototype.toString); 22115 var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString); 22116 var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString); 22117 var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); 22118 var objectToString = unapply(Object.prototype.toString); 22119 var regExpTest = unapply(RegExp.prototype.test); 22120 var typeErrorCreate = unconstruct(TypeError); 22121 /** 22122 * Creates a new function that calls the given function with a specified thisArg and arguments. 22123 * 22124 * @param func - The function to be wrapped and called. 22125 * @returns A new function that calls the given function with a specified thisArg and arguments. 22126 */ 22127 function unapply(func) { 22128 return function(thisArg) { 22129 if (thisArg instanceof RegExp) thisArg.lastIndex = 0; 22130 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3]; 22131 return apply(func, thisArg, args); 22132 }; 22133 } 22134 /** 22135 * Creates a new function that constructs an instance of the given constructor function with the provided arguments. 22136 * 22137 * @param func - The constructor function to be wrapped and called. 22138 * @returns A new function that constructs an instance of the given constructor function with the provided arguments. 22139 */ 22140 function unconstruct(Func) { 22141 return function() { 22142 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4;
vendor: 5,264 bytes, lines 22142-22388
22142 _key4++) args[_key4] = arguments[_key4]; 22143 return construct(Func, args); 22144 }; 22145 } 22146 /** 22147 * Add properties to a lookup table 22148 * 22149 * @param set - The set to which elements will be added. 22150 * @param array - The array containing elements to be added to the set. 22151 * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set. 22152 * @returns The modified set with added elements. 22153 */ 22154 function addToSet(set, array) { 22155 let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; 22156 if (setPrototypeOf) setPrototypeOf(set, null); 22157 if (!arrayIsArray(array)) return set; 22158 let l = array.length; 22159 while (l--) { 22160 let element = array[l]; 22161 if (typeof element === "string") { 22162 const lcElement = transformCaseFunc(element); 22163 if (lcElement !== element) { 22164 if (!isFrozen(array)) array[l] = lcElement; 22165 element = lcElement; 22166 } 22167 } 22168 set[element] = true; 22169 } 22170 return set; 22171 } 22172 /** 22173 * Clean up an array to harden against CSPP 22174 * 22175 * @param array - The array to be cleaned. 22176 * @returns The cleaned version of the array 22177 */ 22178 function cleanArray(array) { 22179 for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null; 22180 return array; 22181 } 22182 /** 22183 * Shallow clone an object 22184 * 22185 * @param object - The object to be cloned. 22186 * @returns A new object that copies the original. 22187 */ 22188 function clone(object) { 22189 const newObject = create(null); 22190 for (const _ref2 of entries(object)) { 22191 var _ref3 = _slicedToArray(_ref2, 2); 22192 const property = _ref3[0]; 22193 const value = _ref3[1]; 22194 if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value); 22195 else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value); 22196 else newObject[property] = value; 22197 } 22198 return newObject; 22199 } 22200 /** 22201 * Convert non-node values into strings without depending on direct property access. 22202 * 22203 * @param value - The value to stringify. 22204 * @returns A string representation of the provided value. 22205 */ 22206 function stringifyValue(value) { 22207 switch (typeof value) { 22208 case "string": return value; 22209 case "number": return numberToString(value); 22210 case "boolean": return booleanToString(value); 22211 case "bigint": return bigintToString ? bigintToString(value) : "0"; 22212 case "symbol": return symbolToString ? symbolToString(value) : "Symbol()"; 22213 case "undefined": return objectToString(value); 22214 case "function": 22215 case "object": { 22216 if (value === null) return objectToString(value); 22217 const valueAsRecord = value; 22218 const valueToString = lookupGetter(valueAsRecord, "toString"); 22219 if (typeof valueToString === "function") { 22220 const stringified = valueToString(valueAsRecord); 22221 return typeof stringified === "string" ? stringified : objectToString(stringified); 22222 } 22223 return objectToString(value); 22224 } 22225 default: return objectToString(value); 22226 } 22227 } 22228 /** 22229 * This method automatically checks if the prop is function or getter and behaves accordingly. 22230 * 22231 * @param object - The object to look up the getter function in its prototype chain. 22232 * @param prop - The property name for which to find the getter function. 22233 * @returns The getter function found in the prototype chain or a fallback function. 22234 */ 22235 function lookupGetter(object, prop) { 22236 while (object !== null) { 22237 const desc = getOwnPropertyDescriptor(object, prop); 22238 if (desc) { 22239 if (desc.get) return unapply(desc.get); 22240 if (typeof desc.value === "function") return unapply(desc.value); 22241 } 22242 object = getPrototypeOf(object); 22243 } 22244 function fallbackValue() { 22245 return null; 22246 } 22247 return fallbackValue; 22248 } 22249 function isRegex(value) { 22250 try { 22251 regExpTest(value, ""); 22252 return true; 22253 } catch (_unused) { 22254 return false; 22255 } 22256 } 22257 var html$1 = freeze([ 22258 "a", 22259 "abbr", 22260 "acronym", 22261 "address", 22262 "area", 22263 "article", 22264 "aside", 22265 "audio", 22266 "b", 22267 "bdi", 22268 "bdo", 22269 "big", 22270 "blink", 22271 "blockquote", 22272 "body", 22273 "br", 22274 "button", 22275 "canvas", 22276 "caption", 22277 "center", 22278 "cite", 22279 "code", 22280 "col", 22281 "colgroup", 22282 "content", 22283 "data", 22284 "datalist", 22285 "dd", 22286 "decorator", 22287 "del", 22288 "details", 22289 "dfn", 22290 "dialog", 22291 "dir", 22292 "div", 22293 "dl", 22294 "dt", 22295 "element", 22296 "em", 22297 "fieldset", 22298 "figcaption", 22299 "figure", 22300 "font", 22301 "footer", 22302 "form", 22303 "h1", 22304 "h2", 22305 "h3", 22306 "h4", 22307 "h5", 22308 "h6", 22309 "head", 22310 "header", 22311 "hgroup", 22312 "hr", 22313 "html", 22314 "i", 22315 "img", 22316 "input", 22317 "ins", 22318 "kbd", 22319 "label", 22320 "legend", 22321 "li", 22322 "main", 22323 "map", 22324 "mark", 22325 "marquee", 22326 "menu", 22327 "menuitem", 22328 "meter", 22329 "nav", 22330 "nobr", 22331 "ol", 22332 "optgroup", 22333 "option", 22334 "output", 22335 "p", 22336 "picture", 22337 "pre", 22338 "progress", 22339 "q", 22340 "rp", 22341 "rt", 22342 "ruby", 22343 "s", 22344 "samp", 22345 "search", 22346 "section", 22347 "select", 22348 "shadow", 22349 "slot", 22350 "small", 22351 "source", 22352 "spacer", 22353 "span", 22354 "strike", 22355 "strong", 22356 "style", 22357 "sub", 22358 "summary", 22359 "sup", 22360 "table", 22361 "tbody", 22362 "td", 22363 "template", 22364 "textarea", 22365 "tfoot", 22366 "th", 22367 "thead", 22368 "time", 22369 "tr", 22370 "track", 22371 "tt", 22372 "u", 22373 "ul", 22374 "var", 22375 "video", 22376 "wbr" 22377 ]); 22378 var svg$1 = freeze([ 22379 "svg", 22380 "a", 22381 "altglyph", 22382 "altglyphdef", 22383 "altglyphitem", 22384 "animatecolor", 22385 "animatemotion", 22386 "animatetransform", 22387 "circle", 22388 "clippath",
22389 "defs", 22390 "desc", 22391 "ellipse", 22392 "enterkeyhint", 22393 "exportparts", 22394 "filter", 22395 "font", 22396 "g", 22397 "glyph", 22398 "glyphref", 22399 "hkern", 22400 "image", 22401 "inputmode", 22402 "line", 22403 "lineargradient", 22404 "marker", 22405 "mask", 22406 "metadata", 22407 "mpath", 22408 "part", 22409 "path", 22410 "pattern", 22411 "polygon", 22412 "polyline", 22413 "radialgradient", 22414 "rect", 22415 "stop", 22416 "style", 22417 "switch", 22418 "symbol", 22419 "text", 22420 "textpath", 22421 "title", 22422 "tref", 22423 "tspan", 22424 "view", 22425 "vkern" 22426 ]); 22427 var svgFilters = freeze([ 22428 "feBlend", 22429 "feColorMatrix", 22430 "feComponentTransfer", 22431 "feComposite", 22432 "feConvolveMatrix", 22433 "feDiffuseLighting", 22434 "feDisplacementMap", 22435 "feDistantLight", 22436 "feDropShadow", 22437 "feFlood", 22438 "feFuncA", 22439 "feFuncB", 22440 "feFuncG", 22441 "feFuncR", 22442 "feGaussianBlur", 22443 "feImage", 22444 "feMerge", 22445 "feMergeNode", 22446 "feMorphology", 22447 "feOffset", 22448 "fePointLight", 22449 "feSpecularLighting", 22450 "feSpotLight", 22451 "feTile", 22452 "feTurbulence" 22453 ]); 22454 var svgDisallowed = freeze([ 22455 "animate", 22456 "color-profile", 22457 "cursor", 22458 "discard", 22459 "font-face", 22460 "font-face-format", 22461 "font-face-name", 22462 "font-face-src", 22463 "font-face-uri", 22464 "foreignobject", 22465 "hatch", 22466 "hatchpath", 22467 "mesh", 22468 "meshgradient", 22469 "meshpatch", 22470 "meshrow", 22471 "missing-glyph", 22472 "script", 22473 "set", 22474 "solidcolor", 22475 "unknown", 22476 "use" 22477 ]); 22478 var mathMl$1 = freeze([ 22479 "math", 22480 "menclose", 22481 "merror", 22482 "mfenced", 22483 "mfrac", 22484 "mglyph", 22485 "mi", 22486 "mlabeledtr", 22487 "mmultiscripts", 22488 "mn", 22489 "mo", 22490 "mover", 22491 "mpadded", 22492 "mphantom", 22493 "mroot", 22494 "mrow", 22495 "ms", 22496 "mspace", 22497 "msqrt", 22498 "mstyle", 22499 "msub", 22500 "msup", 22501 "msubsup", 22502 "mtable", 22503 "mtd", 22504 "mtext", 22505 "mtr", 22506 "munder", 22507 "munderover", 22508 "mprescripts" 22509 ]); 22510 var mathMlDisallowed = freeze([ 22511 "maction", 22512 "maligngroup", 22513 "malignmark", 22514 "mlongdiv", 22515 "mscarries", 22516 "mscarry", 22517 "msgroup", 22518 "mstack", 22519 "msline", 22520 "msrow", 22521 "semantics", 22522 "annotation", 22523 "annotation-xml", 22524 "mprescripts", 22525 "none" 22526 ]); 22527 var text = freeze(["#text"]); 22528 var html = freeze([ 22529 "accept", 22530 "action", 22531 "align", 22532 "alt", 22533 "autocapitalize", 22534 "autocomplete", 22535 "autopictureinpicture", 22536 "autoplay", 22537 "background", 22538 "bgcolor", 22539 "border", 22540 "capture", 22541 "cellpadding", 22542 "cellspacing", 22543 "checked", 22544 "cite", 22545 "class", 22546 "clear", 22547 "color", 22548 "cols", 22549 "colspan", 22550 "command", 22551 "commandfor", 22552 "controls", 22553 "controlslist", 22554 "coords", 22555 "crossorigin", 22556 "datetime", 22557 "decoding", 22558 "default", 22559 "dir", 22560 "disabled", 22561 "disablepictureinpicture", 22562 "disableremoteplayback", 22563 "download", 22564 "draggable", 22565 "enctype", 22566 "enterkeyhint",
22567 "exportparts", 22568 "face", 22569 "for", 22570 "headers", 22571 "height", 22572 "hidden", 22573 "high", 22574 "href", 22575 "hreflang", 22576 "id", 22577 "inert", 22578 "inputmode", 22579 "integrity", 22580 "ismap", 22581 "kind", 22582 "label", 22583 "lang", 22584 "list", 22585 "loading", 22586 "loop", 22587 "low", 22588 "max", 22589 "maxlength", 22590 "media", 22591 "method", 22592 "min", 22593 "minlength", 22594 "multiple", 22595 "muted", 22596 "name", 22597 "nonce", 22598 "noshade", 22599 "novalidate", 22600 "nowrap", 22601 "open", 22602 "optimum", 22603 "part", 22604 "pattern", 22605 "placeholder", 22606 "playsinline", 22607 "popover", 22608 "popovertarget", 22609 "popovertargetaction", 22610 "poster", 22611 "preload", 22612 "pubdate", 22613 "radiogroup", 22614 "readonly", 22615 "rel", 22616 "required", 22617 "rev", 22618 "reversed", 22619 "role", 22620 "rows", 22621 "rowspan", 22622 "spellcheck", 22623 "scope", 22624 "selected", 22625 "shape", 22626 "size", 22627 "sizes", 22628 "slot", 22629 "span", 22630 "srclang", 22631 "start", 22632 "src", 22633 "srcset", 22634 "step", 22635 "style", 22636 "summary", 22637 "tabindex", 22638 "title", 22639 "translate", 22640 "type", 22641 "usemap", 22642 "valign", 22643 "value", 22644 "width", 22645 "wrap", 22646 "xmlns" 22647 ]); 22648 var svg = freeze([ 22649 "accent-height", 22650 "accumulate", 22651 "additive", 22652 "alignment-baseline", 22653 "amplitude", 22654 "ascent", 22655 "attributename", 22656 "attributetype", 22657 "azimuth", 22658 "basefrequency", 22659 "baseline-shift", 22660 "begin", 22661 "bias", 22662 "by", 22663 "class", 22664 "clip", 22665 "clippathunits", 22666 "clip-path", 22667 "clip-rule", 22668 "color", 22669 "color-interpolation", 22670 "color-interpolation-filters", 22671 "color-profile", 22672 "color-rendering", 22673 "cx", 22674 "cy", 22675 "d", 22676 "dx", 22677 "dy", 22678 "diffuseconstant", 22679 "direction", 22680 "display", 22681 "divisor", 22682 "dur", 22683 "edgemode", 22684 "elevation", 22685 "end", 22686 "exponent", 22687 "fill", 22688 "fill-opacity", 22689 "fill-rule", 22690 "filter", 22691 "filterunits", 22692 "flood-color", 22693 "flood-opacity", 22694 "font-family", 22695 "font-size", 22696 "font-size-adjust", 22697 "font-stretch", 22698 "font-style", 22699 "font-variant", 22700 "font-weight", 22701 "fx", 22702 "fy", 22703 "g1", 22704 "g2", 22705 "glyph-name", 22706 "glyphref", 22707 "gradientunits", 22708 "gradienttransform", 22709 "height", 22710 "href", 22711 "id", 22712 "image-rendering", 22713 "in", 22714 "in2", 22715 "intercept", 22716 "k", 22717 "k1", 22718 "k2", 22719 "k3", 22720 "k4", 22721 "kerning", 22722 "keypoints", 22723 "keysplines", 22724 "keytimes", 22725 "lang", 22726 "lengthadjust", 22727 "letter-spacing", 22728 "kernelmatrix", 22729 "kernelunitlength", 22730 "lighting-color", 22731 "local", 22732 "marker-end", 22733 "marker-mid", 22734 "marker-start", 22735 "markerheight", 22736 "markerunits", 22737 "markerwidth", 22738 "maskcontentunits", 22739 "maskunits", 22740 "max", 22741 "mask", 22742 "mask-type", 22743 "media", 22744 "method", 22745 "mode", 22746 "min", 22747 "name", 22748 "numoctaves", 22749 "offset", 22750 "operator", 22751 "opacity", 22752 "order", 22753 "orient", 22754 "orientation", 22755 "origin", 22756 "overflow", 22757 "paint-order", 22758 "path", 22759 "pathlength", 22760 "patterncontentunits", 22761 "patterntransform", 22762 "patternunits", 22763 "points", 22764 "preservealpha", 22765 "preserveaspectratio", 22766 "primitiveunits", 22767 "r", 22768 "rx", 22769 "ry", 22770 "radius", 22771 "refx", 22772 "refy", 22773 "repeatcount", 22774 "repeatdur", 22775 "restart", 22776 "result", 22777 "rotate", 22778 "scale", 22779 "seed", 22780 "shape-rendering", 22781 "slope", 22782 "specularconstant", 22783 "specularexponent", 22784 "spreadmethod", 22785 "startoffset", 22786 "stddeviation", 22787 "stitchtiles", 22788 "stop-color", 22789 "stop-opacity", 22790 "stroke-dasharray", 22791 "stroke-dashoffset", 22792 "stroke-linecap", 22793 "stroke-linejoin", 22794 "stroke-miterlimit", 22795 "stroke-opacity", 22796 "stroke", 22797 "stroke-width", 22798 "style", 22799 "surfacescale", 22800 "systemlanguage", 22801 "tabindex", 22802 "tablevalues", 22803 "targetx", 22804 "targety", 22805 "transform", 22806 "transform-origin", 22807 "text-anchor", 22808 "text-decoration", 22809 "text-rendering", 22810 "textlength", 22811 "type", 22812 "u1", 22813 "u2", 22814 "unicode", 22815 "values", 22816 "viewbox", 22817 "visibility", 22818 "version", 22819 "vert-adv-y", 22820 "vert-origin-x", 22821 "vert-origin-y", 22822 "width", 22823 "word-spacing", 22824 "wrap", 22825 "writing-mode", 22826 "xchannelselector", 22827 "ychannelselector", 22828 "x", 22829 "x1", 22830 "x2", 22831 "xmlns", 22832 "y", 22833 "y1", 22834 "y2", 22835 "z", 22836 "zoomandpan" 22837 ]); 22838 var mathMl = freeze([ 22839 "accent", 22840 "accentunder", 22841 "align", 22842 "bevelled", 22843 "close", 22844 "columnalign", 22845 "columnlines", 22846 "columnspacing", 22847 "columnspan", 22848 "denomalign", 22849 "depth", 22850 "dir", 22851 "display", 22852 "displaystyle", 22853 "encoding", 22854 "fence", 22855 "frame", 22856 "height", 22857 "href", 22858 "id", 22859 "largeop", 22860 "length", 22861 "linethickness", 22862 "lquote", 22863 "lspace", 22864 "mathbackground", 22865 "mathcolor", 22866 "mathsize", 22867 "mathvariant", 22868 "maxsize", 22869 "minsize", 22870 "movablelimits", 22871 "notation", 22872 "numalign", 22873 "open", 22874 "rowalign", 22875 "rowlines",
vendor: 5,035 bytes, lines 22876-23007
22876 "rowspacing", 22877 "rowspan", 22878 "rspace", 22879 "rquote", 22880 "scriptlevel", 22881 "scriptminsize", 22882 "scriptsizemultiplier", 22883 "selection", 22884 "separator", 22885 "separators", 22886 "stretchy", 22887 "subscriptshift", 22888 "supscriptshift", 22889 "symmetric", 22890 "voffset", 22891 "width", 22892 "xmlns" 22893 ]); 22894 var xml = freeze([ 22895 "xlink:href", 22896 "xml:id", 22897 "xlink:title", 22898 "xml:space", 22899 "xmlns:xlink" 22900 ]); 22901 var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g); 22902 var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g); 22903 var TMPLIT_EXPR = seal(/\${[\w\W]*/g); 22904 var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); 22905 var ARIA_ATTR = seal(/^aria-[\-\w]+$/); 22906 var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i); 22907 var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); 22908 var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g); 22909 var DOCTYPE_NAME = seal(/^html$/i); 22910 var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); 22911 var NODE_TYPE = { 22912 element: 1, 22913 attribute: 2, 22914 text: 3, 22915 cdataSection: 4, 22916 entityReference: 5, 22917 entityNode: 6, 22918 progressingInstruction: 7, 22919 comment: 8, 22920 document: 9, 22921 documentType: 10, 22922 documentFragment: 11, 22923 notation: 12 22924 }; 22925 var getGlobal = function getGlobal() { 22926 return typeof window === "undefined" ? null : window; 22927 }; 22928 /** 22929 * Creates a no-op policy for internal use only. 22930 * Don't export this function outside this module! 22931 * @param trustedTypes The policy factory. 22932 * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix). 22933 * @return The policy created (or null, if Trusted Types 22934 * are not supported or creating the policy failed). 22935 */ 22936 var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) { 22937 if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null; 22938 let suffix = null; 22939 const ATTR_NAME = "data-tt-policy-suffix"; 22940 if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME); 22941 const policyName = "dompurify" + (suffix ? "#" + suffix : ""); 22942 try { 22943 return trustedTypes.createPolicy(policyName, { 22944 createHTML(html) { 22945 return html; 22946 }, 22947 createScriptURL(scriptUrl) { 22948 return scriptUrl; 22949 } 22950 }); 22951 } catch (_) { 22952 console.warn("TrustedTypes policy " + policyName + " could not be created."); 22953 return null; 22954 } 22955 }; 22956 var _createHooksMap = function _createHooksMap() { 22957 return { 22958 afterSanitizeAttributes: [], 22959 afterSanitizeElements: [], 22960 afterSanitizeShadowDOM: [], 22961 beforeSanitizeAttributes: [], 22962 beforeSanitizeElements: [], 22963 beforeSanitizeShadowDOM: [], 22964 uponSanitizeAttribute: [], 22965 uponSanitizeElement: [], 22966 uponSanitizeShadowNode: [] 22967 }; 22968 }; 22969 function createDOMPurify() { 22970 let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); 22971 const DOMPurify = (root) => createDOMPurify(root); 22972 DOMPurify.version = "3.4.7"; 22973 DOMPurify.removed = []; 22974 if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) { 22975 DOMPurify.isSupported = false; 22976 return DOMPurify; 22977 } 22978 let document = window.document; 22979 const originalDocument = document; 22980 const currentScript = originalDocument.currentScript; 22981 window.DocumentFragment; 22982 const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter; 22983 window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap); 22984 window.HTMLFormElement; 22985 const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; 22986 const ElementPrototype = Element.prototype; 22987 const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); 22988 const remove = lookupGetter(ElementPrototype, "remove"); 22989 const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); 22990 const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); 22991 const getParentNode = lookupGetter(ElementPrototype, "parentNode"); 22992 const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot"); 22993 const getAttributes = lookupGetter(ElementPrototype, "attributes"); 22994 const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null; 22995 const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null; 22996 if (typeof HTMLTemplateElement === "function") { 22997 const template = document.createElement("template"); 22998 if (template.content && template.content.ownerDocument) document = template.content.ownerDocument; 22999 } 23000 let trustedTypesPolicy; 23001 let emptyHTML = ""; 23002 const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; 23003 const importNode = originalDocument.importNode; 23004 let hooks = _createHooksMap(); 23005 /** 23006 * Expose whether this browser supports running the full DOMPurify. 23007 */
23008 DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; 23009 const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT; 23010 let IS_ALLOWED_URI$1 = IS_ALLOWED_URI
vendor: 4,285 bytes, lines 23010-23185
23010; 23011 /** 23012 * We consider the elements and attributes below to be safe. Ideally 23013 * don't add any new ones but feel free to remove unwanted ones. 23014 */ 23015 let ALLOWED_TAGS = null; 23016 const DEFAULT_ALLOWED_TAGS = addToSet({}, [ 23017 ...html$1, 23018 ...svg$1, 23019 ...svgFilters, 23020 ...mathMl$1, 23021 ...text 23022 ]); 23023 let ALLOWED_ATTR = null; 23024 const DEFAULT_ALLOWED_ATTR = addToSet({}, [ 23025 ...html, 23026 ...svg, 23027 ...mathMl, 23028 ...xml 23029 ]); 23030 let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { 23031 tagNameCheck: { 23032 writable: true, 23033 configurable: false, 23034 enumerable: true, 23035 value: null 23036 }, 23037 attributeNameCheck: { 23038 writable: true, 23039 configurable: false, 23040 enumerable: true, 23041 value: null 23042 }, 23043 allowCustomizedBuiltInElements: { 23044 writable: true, 23045 configurable: false, 23046 enumerable: true, 23047 value: false 23048 } 23049 })); 23050 let FORBID_TAGS = null; 23051 let FORBID_ATTR = null; 23052 const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, { 23053 tagCheck: { 23054 writable: true, 23055 configurable: false, 23056 enumerable: true, 23057 value: null 23058 }, 23059 attributeCheck: { 23060 writable: true, 23061 configurable: false, 23062 enumerable: true, 23063 value: null 23064 } 23065 })); 23066 let ALLOW_ARIA_ATTR = true; 23067 let ALLOW_DATA_ATTR = true; 23068 let ALLOW_UNKNOWN_PROTOCOLS = false; 23069 let ALLOW_SELF_CLOSE_IN_ATTR = true; 23070 let SAFE_FOR_TEMPLATES = false; 23071 let SAFE_FOR_XML = true; 23072 let WHOLE_DOCUMENT = false; 23073 let SET_CONFIG = false; 23074 let FORCE_BODY = false; 23075 let RETURN_DOM = false; 23076 let RETURN_DOM_FRAGMENT = false; 23077 let RETURN_TRUSTED_TYPE = false; 23078 let SANITIZE_DOM = true; 23079 let SANITIZE_NAMED_PROPS = false; 23080 const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; 23081 let KEEP_CONTENT = true; 23082 let IN_PLACE = false; 23083 let USE_PROFILES = {}; 23084 let FORBID_CONTENTS = null; 23085 const DEFAULT_FORBID_CONTENTS = addToSet({}, [ 23086 "annotation-xml", 23087 "audio", 23088 "colgroup", 23089 "desc", 23090 "foreignobject", 23091 "head", 23092 "iframe", 23093 "math", 23094 "mi", 23095 "mn", 23096 "mo", 23097 "ms", 23098 "mtext", 23099 "noembed", 23100 "noframes", 23101 "noscript", 23102 "plaintext", 23103 "script", 23104 "style", 23105 "svg", 23106 "template", 23107 "thead", 23108 "title", 23109 "video", 23110 "xmp" 23111 ]); 23112 let DATA_URI_TAGS = null; 23113 const DEFAULT_DATA_URI_TAGS = addToSet({}, [ 23114 "audio", 23115 "video", 23116 "img", 23117 "source", 23118 "image", 23119 "track" 23120 ]); 23121 let URI_SAFE_ATTRIBUTES = null; 23122 const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [ 23123 "alt", 23124 "class", 23125 "for", 23126 "id", 23127 "label", 23128 "name", 23129 "pattern", 23130 "placeholder", 23131 "role", 23132 "summary", 23133 "title", 23134 "value", 23135 "style", 23136 "xmlns" 23137 ]); 23138 const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; 23139 const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; 23140 const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; 23141 let NAMESPACE = HTML_NAMESPACE; 23142 let IS_EMPTY_INPUT = false; 23143 let ALLOWED_NAMESPACES = null; 23144 const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [ 23145 MATHML_NAMESPACE, 23146 SVG_NAMESPACE, 23147 HTML_NAMESPACE 23148 ], stringToString); 23149 let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [ 23150 "mi", 23151 "mo", 23152 "mn", 23153 "ms", 23154 "mtext" 23155 ]); 23156 let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]); 23157 const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [ 23158 "title", 23159 "style", 23160 "font", 23161 "a", 23162 "script" 23163 ]); 23164 let PARSER_MEDIA_TYPE = null; 23165 const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; 23166 const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; 23167 let transformCaseFunc = null; 23168 let CONFIG = null; 23169 const formElement = document.createElement("form"); 23170 const isRegexOrFunction = function isRegexOrFunction(testValue) { 23171 return testValue instanceof RegExp || testValue instanceof Function; 23172 }; 23173 /** 23174 * _parseConfig 23175 * 23176 * @param cfg optional config literal 23177 */ 23178 const _parseConfig = function _parseConfig() { 23179 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 23180 if (CONFIG && CONFIG === cfg) return; 23181 if (!cfg || typeof cfg !== "object") cfg = {}; 23182 cfg = clone(cfg); 23183 PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE; 23184 transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; 23185 ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS")
23185&& arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; 23186 ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
23187 ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; 23188 URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES; 23189 DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS; 23190 FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; 23191 FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({}); 23192 FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({}); 23193 USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false; 23194 ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; 23195 ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; 23196 ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; 23197 ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; 23198 SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; 23199 SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; 23200 WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; 23201 RETURN_DOM = cfg.RETURN_DOM || false; 23202 RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; 23203 RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; 23204 FORCE_BODY = cfg.FORCE_BODY || false; 23205 SANITIZE_DOM = cfg.SANITIZE_DOM !== false; 23206 SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; 23207 KEEP_CONTENT = cfg.KEEP_CONTENT !== false; 23208 IN_PLACE = cfg.IN_PLACE || false; 23209 IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; 23210 NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE; 23211 MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, [ 23212 "mi", 23213 "mo", 23214 "mn", 23215 "ms", 23216 "mtext" 23217 ]); 23218 HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]); 23219 const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null); 23220 CUSTOM_ELEMENT_HANDLING = create(null); 23221 if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; 23222 if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; 23223 if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; 23224 if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false; 23225 if (RETURN_DOM_FRAGMENT) RETURN_DOM = true; 23226 if (USE_PROFILES) { 23227 ALLOWED_TAGS = addToSet({}, text); 23228 ALLOWED_ATTR = create(null); 23229 if (USE_PROFILES.html === true) { 23230 addToSet(ALLOWED_TAGS, html$1); 23231 addToSet(ALLOWED_ATTR, html); 23232 } 23233 if (USE_PROFILES.svg === true) { 23234 addToSet(ALLOWED_TAGS, svg$1); 23235 addToSet(ALLOWED_ATTR, svg); 23236 addToSet(ALLOWED_ATTR, xml); 23237 } 23238 if (USE_PROFILES.svgFilters === true) { 23239 addToSet(ALLOWED_TAGS, svgFilters); 23240 addToSet(ALLOWED_ATTR, svg); 23241 addToSet(ALLOWED_ATTR, xml); 23242 } 23243 if (USE_PROFILES.mathMl === true) { 23244 addToSet(ALLOWED_TAGS, mathMl$1); 23245 addToSet(ALLOWED_ATTR, mathMl); 23246 addToSet(ALLOWED_ATTR, xml); 23247 } 23248 } 23249 EXTRA_ELEMENT_HANDLING.tagCheck = null; 23250 EXTRA_ELEMENT_HANDLING.attributeCheck = null; 23251 if (objectHasOwnProperty(cfg, "ADD_TAGS")) { 23252 if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS; 23253 else if (arrayIsArray(cfg.ADD_TAGS)) { 23254 if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS); 23255 addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); 23256 } 23257 } 23258 if (objectHasOwnProperty(cfg, "ADD_ATTR")) { 23259 if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR; 23260 else if (arrayIsArray(cfg.ADD_ATTR)) { 23261 if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR); 23262 addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); 23263 } 23264 } 23265 if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); 23266 if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) { 23267 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS); 23268 addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); 23269 } 23270 if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) { 23271 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS); 23272 addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc); 23273 } 23274 if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true; 23275 if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [ 23276 "html", 23277 "head", 23278 "body" 23279 ]); 23280 if (ALLOWED_TAGS.table) { 23281 addToSet(ALLOWED_TAGS, ["tbody"]); 23282 delete FORBID_TAGS.tbody; 23283 } 23284 if (cfg.TRUSTED_TYPES_POLICY) { 23285 if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook."); 23286 if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook."); 23287 trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; 23288 emptyHTML = trustedTypesPolicy.createHTML(""); 23289 } else { 23290 if (trustedTypesPolicy === void 0) trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); 23291 if (trustedTypesPolicy !== null && typeof emptyHTML === "string") emptyHTML = trustedTypesPolicy.createHTML(""); 23292 } 23293 if ((hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) && ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS); 23294 if (hooks.uponSanitizeAttribute.length > 0 && ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR); 23295 if (freeze) freeze(cfg); 23296 CONFIG = cfg; 23297 }; 23298 const ALL_SVG_TAGS = addToSet({}, [ 23299 ...svg$1, 23300 ...svgFilters, 23301 ...svgDisallowed 23302 ]); 23303 const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); 23304 /** 23305 * @param element a DOM element whose namespace is being checked 23306 * @returns Return false if the element has a 23307 * namespace that a spec-compliant parser would never 23308 * return. Return true otherwise. 23309 */ 23310 const _checkValidNamespace = function _checkValidNamespace(element) { 23311 let parent = getParentNode(element); 23312 if (!parent || !parent.tagName) parent = { 23313 namespaceURI: NAMESPACE, 23314 tagName: "template" 23315 }; 23316 const tagName = stringToLowerCase(element.tagName); 23317 const parentTagName = stringToLowerCase(parent.tagName); 23318 if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
vendor: 6,307 bytes, lines 23319-23465
23319 if (element.namespaceURI === SVG_NAMESPACE) { 23320 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg"; 23321 if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); 23322 return Boolean(ALL_SVG_TAGS[tagName]); 23323 } 23324 if (element.namespaceURI === MATHML_NAMESPACE) { 23325 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math"; 23326 if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; 23327 return Boolean(ALL_MATHML_TAGS[tagName]); 23328 } 23329 if (element.namespaceURI === HTML_NAMESPACE) { 23330 if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false; 23331 if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false; 23332 return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); 23333 } 23334 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true; 23335 return false; 23336 }; 23337 /** 23338 * _forceRemove 23339 * 23340 * @param node a DOM node 23341 */ 23342 const _forceRemove = function _forceRemove(node) { 23343 arrayPush(DOMPurify.removed, { element: node }); 23344 try { 23345 getParentNode(node).removeChild(node); 23346 } catch (_) { 23347 remove(node); 23348 } 23349 }; 23350 /** 23351 * _removeAttribute 23352 * 23353 * @param name an Attribute name 23354 * @param element a DOM node 23355 */ 23356 const _removeAttribute = function _removeAttribute(name, element) { 23357 try { 23358 arrayPush(DOMPurify.removed, { 23359 attribute: element.getAttributeNode(name), 23360 from: element 23361 }); 23362 } catch (_) { 23363 arrayPush(DOMPurify.removed, { 23364 attribute: null, 23365 from: element 23366 }); 23367 } 23368 element.removeAttribute(name); 23369 if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try { 23370 _forceRemove(element); 23371 } catch (_) {} 23372 else try { 23373 element.setAttribute(name, ""); 23374 } catch (_) {} 23375 }; 23376 /** 23377 * _initDocument 23378 * 23379 * @param dirty - a string of dirty markup 23380 * @return a DOM, filled with the dirty markup 23381 */ 23382 const _initDocument = function _initDocument(dirty) { 23383 let doc = null; 23384 let leadingWhitespace = null; 23385 if (FORCE_BODY) dirty = "<remove></remove>" + dirty; 23386 else { 23387 const matches = stringMatch(dirty, /^[\r\n\t ]+/); 23388 leadingWhitespace = matches && matches[0]; 23389 } 23390 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>"; 23391 const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; 23392 if (NAMESPACE === HTML_NAMESPACE) try { 23393 doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); 23394 } catch (_) {} 23395 if (!doc || !doc.documentElement) { 23396 doc = implementation.createDocument(NAMESPACE, "template", null); 23397 try { 23398 doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; 23399 } catch (_) {} 23400 } 23401 const body = doc.body || doc.documentElement; 23402 if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); 23403 if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; 23404 return WHOLE_DOCUMENT ? doc.documentElement : body; 23405 }; 23406 /** 23407 * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. 23408 * 23409 * @param root The root element or node to start traversing on. 23410 * @return The created NodeIterator 23411 */ 23412 const _createNodeIterator = function _createNodeIterator(root) { 23413 return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null); 23414 }; 23415 /** 23416 * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the 23417 * character data of an element subtree. Used as the final safety net for 23418 * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions 23419 * which only form after text-node normalization (e.g. fragments split across 23420 * stripped elements) cannot survive into a template-evaluating framework. 23421 * 23422 * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data` 23423 * in place rather than round-tripping through innerHTML. This preserves 23424 * descendant node references (important for IN_PLACE callers), avoids a 23425 * serialize/reparse cycle, and reads literal character data â which means 23426 * `<%...%>` in text content matches the ERB regex against its real bytes 23427 * instead of the HTML-entity-escaped form innerHTML would produce. 23428 * 23429 * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for 23430 * attributes is performed during the per-node `_sanitizeAttributes` pass. 23431 * 23432 * @param node The root element whose character data should be scrubbed. 23433 */ 23434 const _scrubTemplateExpressions = function _scrubTemplateExpressions(node) { 23435 node.normalize(); 23436 const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null); 23437 let currentNode = walker.nextNode(); 23438 while (currentNode) { 23439 let data = currentNode.data; 23440 arrayForEach([ 23441 MUSTACHE_EXPR$1, 23442 ERB_EXPR$1, 23443 TMPLIT_EXPR$1 23444 ], (expr) => { 23445 data = stringReplace(data, expr, " "); 23446 }); 23447 currentNode.data = data; 23448 currentNode = walker.nextNode(); 23449 } 23450 }; 23451 /** 23452 * _isClobbered 23453 * 23454 * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML 23455 * interface with [LegacyOverrideBuiltIns]; a descendant element with a 23456 * `name` attribute matching a prototype property shadows that property 23457 * on direct reads. We use this check at the IN_PLACE entry-point and 23458 * during attribute sanitization to refuse clobbered forms. 23459 * 23460 * @param element element to check for clobbering attacks 23461 * @return true if clobbered, false if safe 23462 */ 23463 const _isClobbered = function _isClobbered(element) { 23464 const realTagName = getNodeName ? getNodeName(element) : null; 23465 if (typeof realTagName !== "string") return false;
23466 if (transformCaseFunc(realTagName) !== "form") return false; 23467 return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element); 23468 }; 23469 /** 23470 * Checks whether the given value is a DocumentFragment from any realm. 23471 * 23472 * The realm-independent replacement reads `nodeType` through the cached 23473 * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE 23474 * constant (11). nodeType is a numeric value resolved from the node's 23475 * internal slot, identical across realms for the same kind of node. 23476 * 23477 * @param value object to check 23478 * @return true if value is a DocumentFragment-shaped node from any realm 23479 */ 23480 const _isDocumentFragment = function _isDocumentFragment(value) { 23481 if (!getNodeType || typeof value !== "object" || value === null) return false; 23482 try { 23483 return getNodeType(value) === NODE_TYPE.documentFragment; 23484 } catch (_) { 23485 return false; 23486 } 23487 }; 23488 /** 23489 * Checks whether the given object is a DOM node, including nodes that 23490 * originate from a different window/realm (e.g. an iframe's 23491 * contentDocument). The previous `value instanceof Node` check was 23492 * realm-bound: nodes from a different window failed it, causing 23493 * sanitize() to silently stringify them and reset IN_PLACE to false, 23494 * returning the original node unsanitized. See GHSA-4w3q-35jp-p934. 23495 * 23496 * @param value object to check whether it's a DOM node 23497 * @return true if value is a DOM node from any realm 23498 */ 23499 const _isNode = function _isNode(value) { 23500 if (!getNodeType || typeof value !== "object" || value === null) return false; 23501 try { 23502 return typeof getNodeType(value) === "number"; 23503 } catch (_) { 23504 return false; 23505 } 23506 }; 23507 function _executeHooks(hooks, currentNode, data) { 23508 arrayForEach(hooks, (hook) => { 23509 hook.call(DOMPurify, currentNode, data, CONFIG); 23510 }); 23511 } 23512 /** 23513 * _sanitizeElements 23514 * 23515 * @protect nodeName 23516 * @protect textContent 23517 * @protect removeChild 23518 * @param currentNode to check for permission to exist 23519 * @return true if node was killed, false if left alive 23520 */ 23521 const _sanitizeElements = function _sanitizeElements(currentNode) { 23522 let content = null; 23523 _executeHooks(hooks.beforeSanitizeElements, currentNode, null); 23524 if (_isClobbered(currentNode)) { 23525 _forceRemove(currentNode); 23526 return true; 23527 } 23528 const tagName = transformCaseFunc(currentNode.nodeName); 23529 _executeHooks(hooks.uponSanitizeElement, currentNode, { 23530 tagName, 23531 allowedTags: ALLOWED_TAGS 23532 }); 23533 if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) { 23534 _forceRemove(currentNode); 23535 return true; 23536 } 23537 if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) { 23538 _forceRemove(currentNode); 23539 return true; 23540 } 23541 if (currentNode.nodeType === NODE_TYPE.progressingInstruction) { 23542 _forceRemove(currentNode); 23543 return true; 23544 } 23545 if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) { 23546 _forceRemove(currentNode); 23547 return true; 23548 } 23549 if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) { 23550 if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { 23551 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false; 23552 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
23553 } 23554 if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { 23555 const parentNode = getParentNode(currentNode); 23556 const childNodes = getChildNodes(currentNode); 23557 if (childNodes && parentNode) { 23558 const childCount = childNodes.length; 23559 for (let i = childCount - 1; i >= 0; --i) { 23560 const childClone = cloneNode(childNodes[i], true); 23561 parentNode.insertBefore(childClone, getNextSibling(currentNode)); 23562 } 23563 } 23564 } 23565 _forceRemove(currentNode); 23566 return true; 23567 } 23568 if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) { 23569 _forceRemove(currentNode); 23570 return true; 23571 } 23572 if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { 23573 _forceRemove(currentNode); 23574 return true; 23575 } 23576 if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { 23577 content = currentNode.textContent; 23578 arrayForEach([ 23579 MUSTACHE_EXPR$1, 23580 ERB_EXPR$1, 23581 TMPLIT_EXPR$1 23582 ], (expr) => { 23583 content = stringReplace(content, expr, " "); 23584 }); 23585 if (currentNode.textContent !== content) { 23586 arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() }); 23587 currentNode.textContent = content; 23588 } 23589 } 23590 _executeHooks(hooks.afterSanitizeElements, currentNode, null); 23591 return false; 23592 }; 23593 /** 23594 * _isValidAttribute 23595 * 23596 * @param lcTag Lowercase tag name of containing element. 23597 * @param lcName Lowercase attribute name. 23598 * @param value Attribute value. 23599 * @return Returns true if `value` is valid, otherwise false. 23600 */ 23601 const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) { 23602 if (FORBID_ATTR[lcName]) return false; 23603 if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false; 23604 const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag); 23605 if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)); 23606 else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)); 23607 else if (!nameIsPermitted || FORBID_ATTR[lcName]) if (_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, lcTag)) || 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))); 23608 else return false; 23609 else if (URI_SAFE_ATTRIBUTES[lcName]); 23610 else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))); 23611 else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]); 23612 else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))); 23613 else if (value) return false; 23614 return true; 23615 }; 23616 const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [ 23617 "annotation-xml", 23618 "color-profile", 23619 "font-face", 23620 "font-face-format", 23621 "font-face-name", 23622 "font-face-src", 23623 "font-face-uri", 23624 "missing-glyph" 23625 ]); 23626 /** 23627 * _isBasicCustomElement 23628 * checks if at least one dash is included in tagName, and it's not the first char 23629 * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name 23630 * 23631 * @param tagName name of the tag of the node to sanitize 23632 * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false. 23633 */ 23634 const _isBasicCustomElement = function _isBasicCustomElement(tagName) { 23635 return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName); 23636 }; 23637 /** 23638 * _sanitizeAttributes 23639 * 23640 * @protect attributes 23641 * @protect nodeName 23642 * @protect removeAttribute 23643 * @protect setAttribute 23644 * 23645 * @param currentNode to sanitize 23646 */ 23647 const _sanitizeAttributes = function _sanitizeAttributes(currentNode) { 23648 _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null); 23649 const attributes = currentNode.attributes; 23650 if (!attributes || _isClobbered(currentNode)) return; 23651 const hookEvent = { 23652 attrName: "", 23653 attrValue: "", 23654 keepAttr: true, 23655 allowedAttributes: ALLOWED_ATTR, 23656 forceKeepAttr: void 0 23657 }; 23658 let l = attributes.length; 23659 while (l--) { 23660 const attr = attributes[l]; 23661 const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value; 23662 const lcName = transformCaseFunc(name); 23663 const initValue = attrValue; 23664 let value = name === "value" ? initValue : stringTrim(initValue); 23665 hookEvent.attrName = lcName; 23666 hookEvent.attrValue = value; 23667 hookEvent.keepAttr = true; 23668 hookEvent.forceKeepAttr = void 0; 23669 _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent); 23670 value = hookEvent.attrValue;
23671 if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) { 23672 _removeAttribute(name, currentNode); 23673 value = SANITIZE_NAMED_PROPS_PREFIX + value; 23674 } 23675 if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) { 23676 _removeAttribute(name, currentNode); 23677 continue; 23678 } 23679 if (lcName === "attributename" && stringMatch(value, "href")) { 23680 _removeAttribute(name, currentNode); 23681 continue; 23682 } 23683 if (hookEvent.forceKeepAttr) continue; 23684 if (!hookEvent.keepAttr) { 23685 _removeAttribute(name, currentNode); 23686 continue; 23687 } 23688 if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { 23689 _removeAttribute(name, currentNode); 23690 continue; 23691 } 23692 if (SAFE_FOR_TEMPLATES) arrayForEach([ 23693 MUSTACHE_EXPR$1, 23694 ERB_EXPR$1, 23695 TMPLIT_EXPR$1 23696 ], (expr) => { 23697 value = stringReplace(value, expr, " "); 23698 }); 23699 const lcTag = transformCaseFunc(currentNode.nodeName); 23700 if (!_isValidAttribute(lcTag, lcName, value)) { 23701 _removeAttribute(name, currentNode); 23702 continue; 23703 } 23704 if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") if (namespaceURI); 23705 else switch (trustedTypes.getAttributeType(lcTag, lcName)) { 23706 case "TrustedHTML": 23707 value = trustedTypesPolicy.createHTML(value); 23708 break; 23709 case "TrustedScriptURL": 23710 value = trustedTypesPolicy.createScriptURL(value); 23711 break; 23712 } 23713 if (value !== initValue) try { 23714 if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value); 23715 else currentNode.setAttribute(name, value); 23716 if (_isClobbered(currentNode)) _forceRemove(currentNode); 23717 else arrayPop(DOMPurify.removed); 23718 } catch (_) { 23719 _removeAttribute(name, currentNode); 23720 } 23721 } 23722 _executeHooks(hooks.afterSanitizeAttributes, currentNode, null); 23723 }; 23724 /** 23725 * _sanitizeShadowDOM 23726 * 23727 * @param fragment to iterate over recursively 23728 */ 23729 const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) { 23730 let shadowNode = null; 23731 const shadowIterator = _createNodeIterator(fragment); 23732 _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null); 23733 while (shadowNode = shadowIterator.nextNode()) { 23734 _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null); 23735 _sanitizeElements(shadowNode); 23736 _sanitizeAttributes(shadowNode); 23737 if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content); 23738 if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) { 23739 const innerSr = getShadowRoot ? getShadowRoot(shadowNode) : shadowNode.shadowRoot; 23740 if (_isDocumentFragment(innerSr)) { 23741 _sanitizeAttachedShadowRoots2(innerSr); 23742 _sanitizeShadowDOM2(innerSr); 23743 } 23744 } 23745 } 23746 _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null); 23747 }; 23748 /** 23749 * _sanitizeAttachedShadowRoots 23750 * 23751 * Walks `root` and feeds every attached shadow root we encounter into 23752 * the existing _sanitizeShadowDOM pipeline. The default node iterator 23753 * does not descend into shadow trees, so nodes inside an attached 23754 * shadow root would otherwise be skipped entirely. 23755 * 23756 * Two real input paths put attached shadow roots in front of us: 23757 * 1. IN_PLACE on a DOM node that already has shadow roots attached. 23758 * 2. DOM-node input where importNode(dirty, true) deep-clones the 23759 * shadow root because it was created with `clonable: true`. 23760 * 23761 * This pass runs once, up front, so the main iteration loop (and the 23762 * existing _sanitizeShadowDOM template-content recursion) stay 23763 * untouched â string-input paths are not affected. 23764 * 23765 * @param root the subtree root to walk for attached shadow roots 23766 */ 23767 const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root) { 23768 const nodeType = getNodeType ? getNodeType(root) : root.nodeType; 23769 if (nodeType === NODE_TYPE.element) { 23770 const sr = getShadowRoot ? getShadowRoot(root) : root.shadowRoot; 23771 if (_isDocumentFragment(sr)) { 23772 _sanitizeAttachedShadowRoots2(sr); 23773 _sanitizeShadowDOM2(sr); 23774 } 23775 } 23776 const childNodes = getChildNodes ? getChildNodes(root) : root.childNodes; 23777 if (!childNodes) return; 23778 const snapshot = []; 23779 arrayForEach(childNodes, (child) => { 23780 arrayPush(snapshot, child); 23781 }); 23782 for (const child of snapshot) _sanitizeAttachedShadowRoots2(child); 23783 if (nodeType === NODE_TYPE.element) { 23784 const rootName = getNodeName ? getNodeName(root) : null; 23785 if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") { 23786 const content = root.content; 23787 if (_isDocumentFragment(content)) _sanitizeAttachedShadowRoots2(content); 23788 } 23789 } 23790 }; 23791 DOMPurify.sanitize = function(dirty) { 23792 let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 23793 let body = null; 23794 let importedNode = null; 23795 let currentNode = null; 23796 let returnNode = null; 23797 IS_EMPTY_INPUT = !dirty; 23798 if (IS_EMPTY_INPUT) dirty = "<!-->"; 23799 if (typeof dirty !== "string" && !_isNode(dirty)) {
23800 dirty = stringifyValue(dirty); 23801 if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting"); 23802 } 23803 if (!DOMPurify.isSupported) return dirty; 23804 if (!SET_CONFIG) _parseConfig(cfg); 23805 DOMPurify.removed = []; 23806 if (typeof dirty === "string") IN_PLACE = false; 23807 if (IN_PLACE) { 23808 const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName; 23809 if (typeof nn === "string") { 23810 const tagName = transformCaseFunc(nn); 23811 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place"); 23812 } 23813 if (_isClobbered(dirty)) throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place"); 23814 _sanitizeAttachedShadowRoots2(dirty); 23815 } else if (_isNode(dirty)) { 23816 body = _initDocument("<!---->"); 23817 importedNode = body.ownerDocument.importNode(dirty, true); 23818 if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode; 23819 else if (importedNode.nodeName === "HTML") body = importedNode; 23820 else body.appendChild(importedNode); 23821 _sanitizeAttachedShadowRoots2(importedNode); 23822 } else { 23823 if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; 23824 body = _initDocument(dirty); 23825 if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ""; 23826 } 23827 if (body && FORCE_BODY) _forceRemove(body.firstChild); 23828 const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); 23829 while (currentNode = nodeIterator.nextNode()) { 23830 _sanitizeElements(currentNode); 23831 _sanitizeAttributes(currentNode); 23832 if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content); 23833 } 23834 if (IN_PLACE) { 23835 if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions(dirty); 23836 return dirty; 23837 } 23838 if (RETURN_DOM) { 23839 if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions(body); 23840 if (RETURN_DOM_FRAGMENT) { 23841 returnNode = createDocumentFragment.call(body.ownerDocument); 23842 while (body.firstChild) returnNode.appendChild(body.firstChild); 23843 } else returnNode = body; 23844 if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true); 23845 return returnNode; 23846 } 23847 let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; 23848 if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML; 23849 if (SAFE_FOR_TEMPLATES) arrayForEach([ 23850 MUSTACHE_EXPR$1, 23851 ERB_EXPR$1, 23852 TMPLIT_EXPR$1 23853 ], (expr) => { 23854 serializedHTML = stringReplace(serializedHTML, expr, " "); 23855 }); 23856 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; 23857 }; 23858 DOMPurify.setConfig = function() { 23859 _parseConfig(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}); 23860 SET_CONFIG = true; 23861 }; 23862 DOMPurify.clearConfig = function() { 23863 CONFIG = null; 23864 SET_CONFIG = false; 23865 }; 23866 DOMPurify.isValidAttribute = function(tag, attr, value) { 23867 if (!CONFIG) _parseConfig({}); 23868 return _isValidAttribute(transformCaseFunc(tag), transformCaseFunc(attr), value); 23869 }; 23870 DOMPurify.addHook = function(entryPoint, hookFunction) { 23871 if (typeof hookFunction !== "function") return; 23872 arrayPush(hooks[entryPoint], hookFunction); 23873 }; 23874 DOMPurify.removeHook = function(entryPoint, hookFunction) { 23875 if (hookFunction !== void 0) { 23876 const index = arrayLastIndexOf(hooks[entryPoint], hookFunction); 23877 return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0]; 23878 } 23879 return arrayPop(hooks[entryPoint]); 23880 }; 23881 DOMPurify.removeHooks = function(entryPoint) { 23882 hooks[entryPoint] = []; 23883 }; 23884 DOMPurify.removeAllHooks = function() { 23885 hooks = _createHooksMap(); 23886 }; 23887 return DOMPurify; 23888 } 23889 var purify = createDOMPurify(); 23890 //#endregion 23891 //#region src/components/cart/components/SubRow.svelte 23892 var root$47 = /* @__PURE__ */ from_html(`<span class="go-sub-ticket-description"></span>`); 23893 var root_1$15 = /* @__PURE__ */ from_html(`<span class="go-sub-ticket-quantity"> </span>`); 23894 var root_2$11 = /* @__PURE__ */ from_html(`<li><span class="go-sub-ticket-title"> </span> <!> <!></li>`); 23895 function SubRow($$anchor, $$props) { 23896 push($$props, true); 23897 /** Capacity-aware ceiling from CapacityManager.subTicketMaxes; the combination max when absent. */ 23898 let sub = prop($$props, "sub", 7), quantity = prop($$props, "quantity", 7), max = prop($$props, "max", 23, () =>
23898 sub().max_persons), onChange = prop($$props, "onChange", 7), preview = prop($$props, "preview", 7, false); 23899 const fixed = /* @__PURE__ */ user_derived(() => sub().min_persons === sub().max_persons); 23900 var $$exports = { 23901 get sub() { 23902 return sub(); 23903 }, 23904 set sub($$value) { 23905 sub($$value); 23906 flushSync(); 23907 }, 23908 get quantity() { 23909 return quantity(); 23910 }, 23911 set quantity($$value) { 23912 quantity($$value); 23913 flushSync(); 23914 }, 23915 get max() { 23916 return max(); 23917 }, 23918 set max($$value = sub.max_persons) { 23919 max($$value); 23920 flushSync(); 23921 }, 23922 get onChange() { 23923 return onChange(); 23924 }, 23925 set onChange($$value) { 23926 onChange($$value); 23927 flushSync(); 23928 }, 23929 get preview() { 23930 return preview(); 23931 }, 23932 set preview($$value = false) { 23933 preview($$value); 23934 flushSync(); 23935 } 23936 }; 23937 var li = root_2$11(); 23938 var span = child(li); 23939 var text = child(span, true); 23940 reset(span); 23941 var node = sibling(span, 2); 23942 var consequent = ($$anchor) => { 23943 var span_1 = root$47(); 23944 html$2(span_1, () => purify.sanitize(sub().description), true); 23945 reset(span_1); 23946 append($$anchor, span_1); 23947 }; 23948 if_block(node, ($$render) => { 23949 if (sub().description) $$render(consequent); 23950 }); 23951 var node_1 = sibling(node, 2); 23952 var consequent_1 = ($$anchor) => { 23953 var span_2 = root_1$15(); 23954 var text_1 = child(span_2, true); 23955 reset(span_2); 23956 template_effect(() => { 23957 set_attribute(span_2, "data-testid", `sub-ticket-${sub().id ?? ""}-quantity`); 23958 set_text(text_1, quantity()); 23959 }); 23960 append($$anchor, span_2); 23961 }; 23962 var alternate = ($$anchor) => { 23963 { 23964 let $0 = /* @__PURE__ */ user_derived(() => sub().title || shop.t("cart.content.table.edit")); 23965 QuantityControl($$anchor, { 23966 get value() { 23967 return quantity(); 23968 }, 23969 get min() { 23970 return sub().min_persons; 23971 }, 23972 get max() { 23973 return max(); 23974 }, 23975 get label() { 23976 return get$2($0); 23977 }, 23978 deselectable: false, 23979 get onChange() { 23980 return onChange(); 23981 } 23982 }); 23983 } 23984 }; 23985 if_block(node_1, ($$render) => { 23986 if (preview() || get$2(fixed)) $$render(consequent_1); 23987 else $$render(alternate, -1); 23988 }); 23989 reset(li); 23990 template_effect(() => { 23991 set_class(li, 1, clsx([ 23992 "go-sub-ticket", 23993 get$2(fixed) && "is-fixed", 23994 preview() && "is-preview", 23995 quantity() === 0 && "is-empty" 23996 ])); 23997 set_attribute(li, "data-testid", `sub-ticket-${sub().id ?? ""}`); 23998 set_text(text, sub().title); 23999 }); 24000 append($$anchor, li); 24001 return pop($$exports); 24002 } 24003 create_custom_element(SubRow, { 24004 sub: {}, 24005 quantity: {}, 24006 max: {}, 24007 onChange: {}, 24008 preview: {} 24009 }, [], [], { mode: "open" }); 24010 //#endregion 24011 //#region src/components/cart/components/Item.svelte 24012 var root$46 = /* @__PURE__ */ from_html(`<s class="go-cart-item-price-original"> </s> <span class="go-cart-item-price-discounted"> </span>`, 1); 24013 var root_1$14 = /* @__PURE__ */ from_html(`<span class="go-cart-item-price-discounted"> </span>`); 24014 var root_2$10 = /* @__PURE__ */ from_html(`<span> </span>`); 24015 var root_3$7 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button class="go-cart-remove">â¨</button></li>`); 24016 var root_4$4 = /* @__PURE__ */ from_html(`<ul class="go-sub-tickets" role="list"></ul>`); 24017 var root_5$2 = /* @__PURE__ */ from_html(`<article class="go-cart-item-content"><ul><li class="go-cart-item-title-container"><!></li> <li class="go-cart-item-price"><!></li> <li class="go-cart-item-count"><!></li> <!> <li class="go-cart-item-sum"> </li></ul></article> <!>`, 1); 24018 function Item$1($$anchor, $$props) { 24019 push($$props, true); 24020 let displayItem = prop($$props, "displayItem", 7), displayCart = prop($$props, "displayCart", 7), preview = prop($$props, "preview", 7); 24021 let capacity = /* @__PURE__ */ state(void 0); 24022 let subMaxes = /* @__PURE__ */ state(proxy({})); 24023 const itemInMaincart = /* @__PURE__ */ user_derived(() => shop.cart?.items.find((item) => item.uuid === (displayItem().display?.reference_uuid ?? displayItem().uuid))); 24024 const mantleProduct = /* @__PURE__ */ user_derived(() => isMantleTicket(displayItem().product) ? displayItem().product : null); 24025 const emptyCart = createCart(); 24026 user_effect(() => { 24027 shop.cart?.items.map((i) => i.quantity);
24028 shop.cart?.items.forEach((i) => i.mantle && Object.values(i.mantle.composition)); 24029 untrack(() => { 24030 set(capacity, shop.capacityManager.capacity(displayCart(), displayItem(), emptyCart), true); 24031 set(subMaxes, get$2(itemInMaincart) ? shop.capacityManager.subTicketMaxes(shop.cart, get$2(itemInMaincart), emptyCart) : {}, true); 24032 }); 24033 }); 24034 function updateQuantity(nextLineQuantity) { 24035 if (!get$2(itemInMaincart)) { 24036 console.error("(CartItem) Could not find main item for line", displayItem()); 24037 return; 24038 } 24039 get$2(itemInMaincart).quantity = Math.max(0, get$2(itemInMaincart).quantity - displayItem().quantity + nextLineQuantity); 24040 } 24041 function del() { 24042 if (!get$2(itemInMaincart)) { 24043 console.error("(CartItem) Could not find main item for line", displayItem()); 24044 return; 24045 } 24046 const newQuantity = Math.max(0, get$2(itemInMaincart).quantity - displayItem().quantity); 24047 if (newQuantity === 0) shop.cart?.deleteItem(get$2(itemInMaincart)); 24048 else get$2(itemInMaincart).quantity = newQuantity; 24049 } 24050 function updateSub(subId, quantity) { 24051 if (!get$2(itemInMaincart)) { 24052 console.error("(CartItem) Could not find main item for line", displayItem()); 24053 return; 24054 } 24055 if (get$2(itemInMaincart).mantle) get$2(itemInMaincart).mantle.composition[subId] = quantity; 24056 } 24057 var $$exports = { 24058 get displayItem() { 24059 return displayItem(); 24060 }, 24061 set displayItem($$value) { 24062 displayItem($$value); 24063 flushSync(); 24064 }, 24065 get displayCart() { 24066 return displayCart(); 24067 }, 24068 set displayCart($$value) { 24069 displayCart($$value); 24070 flushSync(); 24071 }, 24072 get preview() { 24073 return preview(); 24074 }, 24075 set preview($$value) { 24076 preview($$value); 24077 flushSync(); 24078 } 24079 }; 24080 var fragment = comment(); 24081 var node = first_child(fragment); 24082 var consequent_7 = ($$anchor) => { 24083 var fragment_1 = root_5$2(); 24084 var article = first_child(fragment_1); 24085 var ul = child(article); 24086 var li = child(ul); 24087 var node_1 = child(li); 24088 var consequent = ($$anchor) => { 24089 Ticket($$anchor, { get cartItem() { 24090 return displayItem(); 24091 } }); 24092 }; 24093 var consequent_1 = ($$anchor) => { 24094 Event$2($$anchor, { get cartItem() { 24095 return displayItem(); 24096 } }); 24097 }; 24098 var consequent_2 = ($$anchor) => { 24099 Coupon($$anchor, { get cartItem() { 24100 return displayItem(); 24101 } }); 24102 }; 24103 if_block(node_1, ($$render) => { 24104 if (displayItem().product.type === "Ticket") $$render(consequent); 24105 else if (displayItem().product.type === "Event") $$render(consequent_1, 1); 24106 else if (displayItem().product.type === "Coupon") $$render(consequent_2, 2); 24107 }); 24108 reset(li); 24109 var li_1 = sibling(li, 2); 24110 var node_2 = child(li_1); 24111 var consequent_3 = ($$anchor) => { 24112 var fragment_5 = root$46(); 24113 var s = first_child(fragment_5); 24114 var text = child(s, true); 24115 reset(s); 24116 var span = sibling(s, 2); 24117 var text_1 = child(span, true); 24118 reset(span); 24119 template_effect(($0, $1) => { 24120 set_text(text, $0); 24121 set_text(text_1, $1); 24122 }, [() => formatCurrency(displayItem().display.originalPrice), () => formatCurrency(displayItem().final_price_cents)]); 24123 append($$anchor, fragment_5); 24124 }; 24125 var alternate = ($$anchor) => { 24126 var span_1 = root_1$14(); 24127 var text_2 = child(span_1, true); 24128 reset(span_1); 24129 template_effect(($0) => set_text(text_2, $0), [() => formatCurrency(displayItem().final_price_cents)]); 24130 append($$anchor, span_1); 24131 }; 24132 if_block(node_2, ($$render) => { 24133 if (displayItem().display?.discounted) $$render(consequent_3); 24134 else $$render(alternate, -1); 24135 }); 24136 reset(li_1); 24137 var li_2 = sibling(li_1, 2); 24138 var node_3 = child(li_2); 24139 var consequent_4 = ($$anchor) => { 24140 var span_2 = root_2$10(); 24141 var text_3 = child(span_2, true); 24142 reset(span_2); 24143 template_effect(() => set_text(text_3, displayItem().quantity)); 24144 append($$anchor, span_2); 24145 }; 24146 var alternate_1 = ($$anchor) => { 24147 { 24148 let $0 = /* @__PURE__ */ user_derived(() => displayItem().quantity ?? 0); 24149 QuantityControl($$anchor, { 24150 get value() { 24151 return get$2($0); 24152 }, 24153 get min() { 24154 return get$2(capacity).min; 24155 }, 24156 get max() { 24157 return get$2(capacity).max; 24158 }, 24159 get label() {
24160 return displayItem().product.title; 24161 }, 24162 floor: 1, 24163 onChange: updateQuantity 24164 }); 24165 } 24166 }; 24167 if_block(node_3, ($$render) => { 24168 if (preview()) $$render(consequent_4); 24169 else $$render(alternate_1, -1); 24170 }); 24171 reset(li_2); 24172 var node_4 = sibling(li_2, 2); 24173 var consequent_5 = ($$anchor) => { 24174 var li_3 = root_3$7(); 24175 var button = child(li_3); 24176 reset(li_3); 24177 template_effect(($0) => set_attribute(button, "aria-label", $0), [() => shop.t("cart.item.remove")]); 24178 delegated("click", button, del); 24179 append($$anchor, li_3); 24180 }; 24181 if_block(node_4, ($$render) => { 24182 if (!preview()) $$render(consequent_5); 24183 }); 24184 var li_4 = sibling(node_4, 2); 24185 var text_4 = child(li_4, true); 24186 reset(li_4); 24187 reset(ul); 24188 reset(article); 24189 var node_5 = sibling(article, 2); 24190 var consequent_6 = ($$anchor) => { 24191 var ul_1 = root_4$4(); 24192 each(ul_1, 21, () => subTicketDefs(get$2(mantleProduct)), (sub) => sub.id, ($$anchor, sub) => { 24193 { 24194 let $0 = /* @__PURE__ */ user_derived(() => displayItem().mantle?.composition?.[get$2(sub).id] ?? 0); 24195 SubRow($$anchor, { 24196 get sub() { 24197 return get$2(sub); 24198 }, 24199 get preview() { 24200 return preview(); 24201 }, 24202 get quantity() { 24203 return get$2($0); 24204 }, 24205 get max() { 24206 return get$2(subMaxes)[get$2(sub).id]; 24207 }, 24208 onChange: (q) => updateSub(get$2(sub).id, q) 24209 }); 24210 } 24211 }); 24212 reset(ul_1); 24213 template_effect(() => set_attribute(ul_1, "aria-label", get$2(mantleProduct).title)); 24214 append($$anchor, ul_1); 24215 }; 24216 if_block(node_5, ($$render) => { 24217 if (get$2(mantleProduct)) $$render(consequent_6); 24218 }); 24219 template_effect(($0) => set_text(text_4, $0), [() => formatCurrency(displayItem().total_price_cents)]); 24220 append($$anchor, fragment_1); 24221 }; 24222 if_block(node, ($$render) => { 24223 if (get$2(capacity)) $$render(consequent_7); 24224 }); 24225 append($$anchor, fragment); 24226 return pop($$exports); 24227 } 24228 delegate(["click"]); 24229 create_custom_element(Item$1, { 24230 displayItem: {}, 24231 displayCart: {}, 24232 preview: {} 24233 }, [], [], { mode: "open" }); 24234 //#endregion 24235 //#region src/components/cart/components/CartItems.svelte 24236 var root$45 = /* @__PURE__ */ from_html(`<li class="go-cart-header-remove"></li>`); 24237 var root_1$13 = /* @__PURE__ */ from_html(`<li class="go-cart-item"><!></li>`); 24238 var root_2$9 = /* @__PURE__ */ from_html(`<ol data-testid="cart-items"><li class="go-cart-header"><ul><li class="go-cart-header-title"> </li> <li class="go-cart-header-price"> </li> <li class="go-cart-header-count"> </li> <!> <li class="go-cart-header-sum"> </li></ul></li> <!></ol>`); 24239 function CartItems($$anchor, $$props) { 24240 push($$props, true); 24241 const _details = getCartDetails($$props.$$host); 24242 const details = /* @__PURE__ */ user_derived(() => _details.value); 24243 var fragment = comment(); 24244 var node = first_child(fragment); 24245 var consequent_1 = ($$anchor) => { 24246 var ol = root_2$9(); 24247 var li = child(ol); 24248 var ul = child(li); 24249 var li_1 = child(ul); 24250 var text = child(li_1, true); 24251 reset(li_1); 24252 var li_2 = sibling(li_1, 2); 24253 var text_1 = child(li_2, true); 24254 reset(li_2); 24255 var li_3 = sibling(li_2, 2); 24256 var text_2 = child(li_3, true); 24257 reset(li_3); 24258 var node_1 = sibling(li_3, 2); 24259 var consequent = ($$anchor) => { 24260 append($$anchor, root$45()); 24261 }; 24262 if_block(node_1, ($$render) => { 24263 if (!get$2(details).preview) $$render(consequent); 24264 }); 24265 var li_5 = sibling(node_1, 2); 24266 var text_3 = child(li_5, true); 24267 reset(li_5); 24268 reset(ul); 24269 reset(li); 24270 each(sibling(li, 2), 17, () => get$2(details).displayCart.items, (item) => item.uuid, ($$anchor, item) => { 24271 var li_6 = root_1$13(); 24272 Item$1(child(li_6), { 24273 get displayItem() { 24274 return get$2(item); 24275 }, 24276 get displayCart() { 24277 return get$2(details).displayCart; 24278 }, 24279 get preview() { 24280 return get$2(details).preview; 24281 } 24282 }); 24283 reset(li_6); 24284 append($$anchor, li_6); 24285 }); 24286 reset(ol); 24287 template_effect(($0, $1, $2, $3) => { 24288 set_text(text, $0); 24289 set_text(text_1, $1); 24290 set_text(text_2, $2); 24291 set_text(text_3, $3); 24292 }, [ 24293 () => shop.t("cart.content.table.desc"), 24294 () => shop.t("cart.content.table.price"), 24295 () => shop.t("cart.content.table.quantity"), 24296 () => shop.t("cart.content.table.total") 24297 ]); 24298 append($$anchor, ol); 24299 }; 24300 if_block(node, ($$render) => { 24301 if (get$2(details) && get$2(details).displayCart && get$2(details).displayCart.items.length) $$render(consequent_1); 24302 }); 24303 append($$anchor, fragment); 24304 pop(); 24305 }
24306 customElements.define("go-cart-items", create_custom_element(CartItems, {}, [], [])); 24307 //#endregion 24308 //#region src/components/cart/components/CartCoupons.svelte 24309 var root$44 = /* @__PURE__ */ from_html(`<li class="go-cart-coupon-remove-cell"><button class="go-cart-remove go-cart-coupon-remove">â¨</button></li>`); 24310 var root_1$12 = /* @__PURE__ */ from_html(`<li><article class="go-cart-coupon-content"><ul><li class="go-cart-coupon-code"> </li> <!></ul></article></li>`); 24311 var root_2$8 = /* @__PURE__ */ from_html(`<ol data-testid="cart-coupons"></ol>`); 24312 function CartCoupons($$anchor, $$props) { 24313 push($$props, true); 24314 const _details = getCartDetails($$props.$$host); 24315 const details = /* @__PURE__ */ user_derived(() => _details.value); 24316 var fragment = comment(); 24317 var node = first_child(fragment); 24318 var consequent_1 = ($$anchor) => { 24319 var ol = root_2$8(); 24320 each(ol, 21, () => get$2(details).displayCart.coupons, (coupon) => coupon.code, ($$anchor, coupon) => { 24321 var li = root_1$12(); 24322 let classes; 24323 var article = child(li); 24324 var ul = child(article); 24325 var li_1 = child(ul); 24326 var text = child(li_1, true); 24327 reset(li_1);
24328 var node_1 = sibling(li_1, 2); 24329 var consequent = ($$anchor) => { 24330 var li_2 = root$44(); 24331 var button = child(li_2); 24332 reset(li_2); 24333 template_effect(($0) => set_attribute(button, "aria-label", $0), [() => shop.t("cart.coupons.remove")]); 24334 delegated("click", button, () => shop.cart?.removeCoupon(get$2(coupon).code)); 24335 append($$anchor, li_2); 24336 }; 24337 if_block(node_1, ($$render) => { 24338 if (!get$2(details).preview) $$render(consequent); 24339 }); 24340 reset(ul); 24341 reset(article); 24342 reset(li); 24343 template_effect(() => { 24344 classes = set_class(li, 1, "go-cart-coupon", null, classes, { "go-cart-coupon-inactive": !get$2(coupon).applied }); 24345 set_text(text, get$2(coupon).code); 24346 }); 24347 append($$anchor, li); 24348 }); 24349 reset(ol); 24350 append($$anchor, ol); 24351 }; 24352 if_block(node, ($$render) => { 24353 if (get$2(details) && get$2(details).displayCart && get$2(details).displayCart.coupons.length > 0) $$render(consequent_1); 24354 }); 24355 append($$anchor, fragment); 24356 pop(); 24357 } 24358 delegate(["click"]); 24359 customElements.define("go-cart-coupons", create_custom_element(CartCoupons, {}, [], [])); 24360 //#endregion 24361 //#region src/components/cart/components/CartTotalAmount.svelte 24362 var root$43 = /* @__PURE__ */ from_html(`<span class="go-cart-total-amount" data-testid="cart-total-amount"> </span>`); 24363 function CartTotalAmount($$anchor, $$props) { 24364 push($$props, true); 24365 const _details = getCartDetails($$props.$$host); 24366 const details = /* @__PURE__ */ user_derived(() => _details.value); 24367 var fragment = comment(); 24368 var node = first_child(fragment); 24369 var consequent = ($$anchor) => { 24370 var span = root$43(); 24371 var text = child(span, true); 24372 reset(span); 24373 template_effect(($0) => set_text(text, $0), [() => formatCurrency(get$2(details).totalPriceCents)]); 24374 append($$anchor, span); 24375 }; 24376 if_block(node, ($$render) => { 24377 if (get$2(details) && get$2(details).displayCart && get$2(details).displayCart.items.length) $$render(consequent); 24378 }); 24379 append($$anchor, fragment); 24380 pop(); 24381 } 24382 customElements.define("go-cart-total-amount", create_custom_element(CartTotalAmount, {}, [], [])); 24383 //#endregion 24384 //#region src/components/cart/components/Cart.svelte 24385 function Cart($$anchor, $$props) { 24386 push($$props, true); 24387 const preview = prop($$props, "preview", 7, false); 24388 const details = new CartDetails(); 24389 setCartDetails($$props.$$host, details); 24390 user_effect(() => { 24391 details.preview = preview(); 24392 }); 24393 user_effect(() => { 24394 if (!shop.cart) return; 24395 shop.cart.items.map((i) => i.uuid + ":" + i.quantity + ":" + i.time); 24396 shop.cart.coupons.map((c) => c.code).join("|"); 24397 shop.cart.items.forEach((i) => i.mantle && Object.values(i.mantle.composition)); 24398 untrack(() => details.calculateDisplayCart()); 24399 }); 24400 async function flushCoupons() { 24401 const els = $$props.$$host.querySelectorAll("go-coupon-redemption"); 24402 let ok = true; 24403 for (const el of els) { 24404 const result = await el.flush?.(); 24405 if (result && !result.success) ok = false; 24406 } 24407 return ok; 24408 } 24409 $$props.$$host.addEventListener("click", async (e) => { 24410 const submit = e.target.closest("go-submit"); 24411 if (!submit) return; 24412 const innerForm = submit.closest("go-form"); 24413 if (innerForm && $$props.$$host.contains(innerForm)) return; 24414 const ok = await flushCoupons(); 24415 if (!ok) return; 24416 $$props.$$host.dispatchEvent(new CustomEvent("go-submit", { 24417 detail: { ok }, 24418 bubbles: true, 24419 composed: true 24420 })); 24421 }); 24422 return pop({ 24423 get preview() { 24424 return preview(); 24425 }, 24426 set preview($$value = false) { 24427 preview($$value); 24428 flushSync(); 24429 } 24430 }); 24431 } 24432 customElements.define("go-cart", create_custom_element(Cart, { preview: { 24433 attribute: "preview", 24434 reflect: true, 24435 type: "Boolean" 24436 } }, [], [])); 24437 //#endregion 24438 //#region src/components/cart/components/CartSubtotalAmount.svelte 24439 var root$42 = /* @__PURE__ */ from_html(`<span class="go-cart-subtotal-amount" data-testid="cart-subtotal-amount"> </span>`); 24440 function CartSubtotalAmount($$anchor, $$props) { 24441 push($$props, true); 24442 const _details = getCartDetails($$props.$$host); 24443 const details = /* @__PURE__ */ user_derived(() => _details.value); 24444 var fragment = comment(); 24445 var node = first_child(fragment); 24446 var consequent = ($$anchor) => { 24447 var span = root$42(); 24448 var text = child(span, true); 24449 reset(span); 24450 template_effect(($0) => set_text(text, $0), [() => formatCurrency(get$2(details).subtotalPriceCents)]); 24451 append($$anchor, span); 24452 }; 24453 if_block(node, ($$render) => { 24454 if (get$2(details) && shop.cart?.items.length) $$render(consequent); 24455 }); 24456 append($$anchor, fragment); 24457 pop(); 24458 } 24459 customElements.define("go-cart-subtotal-amount", create_custom_element
24459(CartSubtotalAmount, {}, [], [])); 24460 //#endregion 24461 //#region src/components/cart/components/CartDiscountedAmount.svelte 24462 var root$41 = /* @__PURE__ */ from_html(`<span class="go-cart-discounted-amount" data-testid="cart-discounted-amount"><span class="go-cart-discounted-amount-sign">â</span> </span>`); 24463 function CartDiscountedAmount($$anchor, $$props) { 24464 push($$props, true); 24465 const _details = getCartDetails($$props.$$host); 24466 const details = /* @__PURE__ */ user_derived(() => _details.value); 24467 var fragment = comment(); 24468 var node = first_child(fragment); 24469 var consequent = ($$anchor) => { 24470 var span = root$41(); 24471 var text = sibling(child(span), 1, true); 24472 reset(span); 24473 template_effect(($0) => set_text(text, $0), [() => formatCurrency(get$2(details).discountedAmountCents)]); 24474 append($$anchor, span); 24475 }; 24476 if_block(node, ($$render) => { 24477 if (get$2(details) && get$2(details).discountedAmountCents > 0) $$render(consequent); 24478 }); 24479 append($$anchor, fragment); 24480 pop(); 24481 } 24482 customElements.define("go-cart-discounted-amount", create_custom_element(CartDiscountedAmount, {}, [], [])); 24483 //#endregion 24484 //#region src/components/cart/components/CartEmpty.svelte 24485 function CartEmpty($$anchor, $$props) { 24486 push($$props, true); 24487 wrapInElement($$props.$$host, "go-if", { when: "data.cart.items.length === 0" }); 24488 pop(); 24489 } 24490 customElements.define("go-cart-empty", create_custom_element(CartEmpty, {}, [], [])); 24491 //#endregion 24492 //#region src/components/cart/components/CartCounter.svelte 24493 function CartCounter($$anchor, $$props) { 24494 push($$props, true); 24495 let cartCounter = /* @__PURE__ */ user_derived(() => shop.cart?.items.length); 24496 next(); 24497 var text = text$1(); 24498 template_effect(() => set_text(text, get$2(cartCounter))); 24499 append($$anchor, text); 24500 pop(); 24501 } 24502 customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], [])); 24503 //#endregion 24504 //#region src/components/checkoutForm/CheckoutForm.svelte 24505 function CheckoutForm($$anchor, $$props) { 24506 push($$props, true); 24507 let custom = prop($$props, "custom", 7, false); 24508 let cart = /* @__PURE__ */ user_derived(() => shop.cart); 24509 Forms.defineForm({ 24510 id: "checkoutGuest", 24511 submitLabel: "cart.detail.actions.checkout", 24512 fields: [ 24513 { 24514 key: "firstName", 24515 required: true 24516 }, 24517 { 24518 key: "lastName", 24519 required: true 24520 }, 24521 { 24522 key: "email", 24523 required: true 24524 }, 24525 { 24526 key: "confirmEmail", 24527 required: true 24528 }, 24529 { 24530 key: "acceptTerms", 24531 required: true 24532 }, 24533 { 24534 key: "paymentMode", 24535 required: true 24536 } 24537 ] 24538 }); 24539 wrapInElement($$props.$$host, "go-form", { 24540 "form-id": "checkoutGuest", 24541 custom: custom() 24542 }); 24543 $$props.$$host.addEventListener("submit", async (e) => { 24544 const form = e.target; 24545 if (!get$2(cart)) return; 24546 const auth = await shop.signUp(form.details.formData, true); 24547 if (auth.error) { 24548 form.details.apiErrors = auth.error.errors; 24549 return; 24550 } 24551 const paymentMode = form.details.fieldValue("paymentMode"); 24552 get$2(cart).paymentModeId = paymentMode == null ? void 0 : String(paymentMode); 24553 const checkout = await shop.checkout(get$2(cart).orderData()); 24554 if (checkout.error) { 24555 form.details.apiErrors = checkout.error; 24556 return; 24557 } 24558 const beforeSubmit = configStore.config.forms.checkoutGuest?.beforeSubmit; 24559 if (beforeSubmit) await beforeSubmit(form.details.formData); 24560 // Custom patch: providers like Computop return meta.payment_data (POST form) 24561 // instead of meta.payment_url â mirror the Angular checkout.process handling. 24562 const meta = checkout.data.meta; 24563 if (meta.payment_url) { 24564 configStore.config.navigateTo?.(meta.payment_url); 24565 } else if (meta.payment_data) { 24566 const paymentForm = document.createElement("form"); 24567 paymentForm.method = "post"; 24568 paymentForm.action = meta.payment_data.url; 24569 for (const [key, value] of Object.entries(meta.payment_data.params || {})) { 24570 const input = document.createElement("input"); 24571 input.type = "hidden"; 24572 input.name = key; 24573 input.value = value; 24574 paymentForm.appendChild(input); 24575 } 24576 document.body.appendChild(paymentForm); 24577 paymentForm.submit(); 24578 } 24579 }); 24580 return pop({ 24581 get custom() { 24582 return custom(); 24583 }, 24584 set custom($$value = false) { 24585 custom($$value); 24586 flushSync(); 24587 } 24588 }); 24589 } 24590 customElements.define("go-checkout-form", create_custom_element
24590(CheckoutForm, { custom: {} }, [], [])); 24591 //#endregion 24592 //#region src/components/couponRedemption/lib.ts 24593 var APPLY_ORDER_DISCOUNT = "TokenActions::ApplyOrderDiscount"; 24594 async function redeem(token) { 24595 if (!shop.cart) throw new Error("(go-coupon-redemption): cart not found"); 24596 const cart = shop.cart; 24597 const couponSale = await shop.asyncFetch(() => shop.getCouponSaleByBarcode(token)); 24598 if (!couponSale?.is_valid) return fail([shop.t("cart.coupon.form.errors.notValid")]); 24599 if (couponSale.value_action === APPLY_ORDER_DISCOUNT) { 24600 cart.addCoupon({ 24601 code: token, 24602 kind: "actionToken" 24603 }); 24604 return { success: true }; 24605 } 24606 if (couponSale.is_voucher_for) return applyVoucher(token, couponSale); 24607 if (couponSale.value_cents && couponSale.value_cents > 0) return applyValueCoupon(token, couponSale.value_cents); 24608 return fail([shop.t("cart.coupon.form.errors.notValid")]); 24609 } 24610 function applyValueCoupon(token, valueCents) { 24611 shop.cart.addCoupon({ 24612 code: token, 24613 kind: "valueVoucher", 24614 valueCents 24615 }); 24616 return { success: true }; 24617 } 24618 async function applyVoucher(token, couponSale) { 24619 const ticket = (await shop.asyncFetch(() => shop.tickets({ "by_ticket_ids[]": [couponSale.is_voucher_for] }))).find((t) => t.id === couponSale.is_voucher_for); 24620 if (!ticket) return fail([shop.t("cart.coupon.form.errors.error")]); 24621 const voucherTicket = { 24622 ...ticket, 24623 price_cents: 0 24624 }; 24625 shop.cart.addItem(createCartItem(createUITicket(voucherTicket), { quantity: 1 })); 24626 shop.cart.addCoupon({ 24627 code: token, 24628 kind: "serviceVoucher" 24629 }); 24630 return { success: true }; 24631 } 24632 function fail(errors) { 24633 return { 24634 success: false, 24635 errors 24636 }; 24637 } 24638 //#endregion 24639 //#region src/components/couponRedemption/CouponRedemption.svelte 24640 var root$40 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2); 24641 function CouponRedemption($$anchor, $$props) { 24642 push($$props, true); 24643 Forms.defineForm({ 24644 id: "couponRedemption", 24645 submitLabel: "cart.coupon.form.submit", 24646 fields: [{ 24647 key: "token", 24648 required: true 24649 }] 24650 }); 24651 async function runRedeem(form) { 24652 const field = form.details.fields.find((f) => f.key === "token"); 24653 const token = (form.details.fieldValue("token") ?? "").trim().toUpperCase(); 24654 if (!token) return { success: true }; 24655 const result = await redeem(token); 24656 if (!result.success) { 24657 form.details.apiErrors = result.errors; 24658 return result; 24659 } 24660 if (field) field.value = ""; 24661 form.dispatchEvent(new Event("go-success", { 24662 bubbles: true, 24663 composed: true 24664 })); 24665 return result; 24666 } 24667 async function redeem$1(event) { 24668 await runRedeem(event.target); 24669 } 24670 async function flush() { 24671 const form = $$props.$$host.querySelector("go-form"); 24672 if (!form?.details) return { success: true }; 24673 return runRedeem(form); 24674 } 24675 var $$exports = { flush }; 24676 var go_form = root$40(); 24677 set_custom_element_data(go_form, "formId", "couponRedemption"); 24678 event("submit", go_form, redeem$1); 24679 append($$anchor, go_form); 24680 return pop($$exports); 24681 } 24682 customElements.define("go-coupon-redemption", create_custom_element(CouponRedemption, {}, [], ["flush"])); 24683 //#endregion 24684 //#region src/components/donations/lib/donation.svelte.ts 24685 var GoDonation = class { 24686 #campaign = /* @__PURE__ */ state(); 24687 get campaign() { 24688 return get$2(this.#campaign); 24689 } 24690 set campaign(value) { 24691 set(this.#campaign, value, true); 24692 } 24693 #amount = /* @__PURE__ */ state(); 24694 get amount() { 24695 return get$2(this.#amount); 24696 } 24697 set amount(value) { 24698 set(this.#amount, value, true); 24699 } 24700 selectCampaign = (selectedCampaign) => { 24701 this.campaign = selectedCampaign; 24702 document.getElementsByClassName("donation-actions")[0]?.scrollIntoView(); 24703 }; 24704 addDonationToCart = () => { 24705 if (this.amount === void 0 || this.campaign === void 0) return; 24706 const donationObject = { 24707 value: this.amount, 24708 campaign_id: this.campaign.id 24709 }; 24710 let currentDonationsLocalStorage = JSON.parse(localStorage.getItem("201600627v4donations") || "[]"); 24711 if (sum(currentDonationsLocalStorage.filter((d) => d.campaign_id = donationObject.campaign_id), (d) => d.value) + donationObject.value > this.campaign.guest_limit && this.campaign.guest_limit > 0 && (!shop.currentUser?.isAuthenticated || shop.currentUser.isGuest)) this.skipDonation(); 24712 else { 24713 currentDonationsLocalStorage.push(donationObject); 24714 localStorage.setItem("201600627v4donations", JSON.stringify(currentDonationsLocalStorage)); 24715 localStorage.setItem("skipDonation", "true"); 24716 window.location.assign(shop.urls.cart()); 24717 } 24718 }; 24719 skipDonation = () => { 24720 localStorage.setItem("skipDonation", "true"); 24721 window.location.assign(shop.urls.cart()); 24722 }; 24723 }; 24724 var goDonation = new GoDonation(); 24725 //#endregion 24726 //#region src/components/donations/components/DonationCampaign.svelte 24727 var root$39 = /* @__PURE__ */ from_html(`<img alt="logo"/>`); 24728 var root_1$11 = /* @__PURE__ */ from_html(`<div role="button" tabindex="0"><div class="donation-image"><!></div> <div class="donation-info"><p class="donation-info-title"> </p> <p class="donation-info-description"> </p></div></div>`); 24729 function DonationCampaign($$anchor, $$props) { 24730 push($$props, true); 24731 let campaign = prop($$props, "campaign", 7); 24732 const translations = /* @__PURE__ */ user_derived(() => campaign().translations); 24733 var $$exports = { 24734 get campaign() { 24735 return campaign(); 24736 }, 24737 set campaign($$value) { 24738 campaign($$value); 24739 flushSync(); 24740 } 24741 }; 24742 var div = root_1$11(); 24743 let classes; 24744 var div_1 = child(div); 24745 var node = child(div_1); 24746 var consequent = ($$anchor) => { 24747 var img = root$39(); 24748 template_effect(($0) => set_attribute(img, "src", $0), [() => campaign().picture.thumbnail.replace("thumbnail", "article_3x2")]); 24749 append($$anchor, img); 24750 }; 24751 if_block(node, ($$render) => { 24752 if (campaign().picture.thumbnail) $$render(consequent); 24753 }); 24754 reset(div_1); 24755 var div_2 = sibling(div_1, 2); 24756 var p = child(div_2); 24757 var text = child(p, true); 24758 reset(p); 24759 var p_1 = sibling(p, 2); 24760 var text_1 = child(p_1, true); 24761 reset(p_1); 24762 reset(div_2); 24763 reset(div); 24764 template_effect(() => { 24765 classes = set_class(div, 1, "go-donation-campaign", null, classes, { selected: goDonation.campaign?.id === campaign()?.id }); 24766 set_text(text, get$2(translations)["donations.headline"]); 24767 set_text(text_1, get$2(translations)["donations.shop.info"]); 24768 }); 24769 delegated("click", div, () =>
24769 goDonation.selectCampaign(campaign())); 24770 delegated("keydown", div, (e) => { 24771 if (e.key === "Enter") goDonation.selectCampaign(campaign()); 24772 }); 24773 append($$anchor, div); 24774 return pop($$exports); 24775 } 24776 delegate(["click", "keydown"]); 24777 create_custom_element(DonationCampaign, { campaign: {} }, [], [], { mode: "open" }); 24778 //#endregion 24779 //#region src/lib/helpers/utils.ts 24780 function currency(value, currency) { 24781 if (currency == "CHF") return new Intl.NumberFormat("de-CH", { 24782 style: "currency", 24783 currency 24784 }).format(value); 24785 else return new Intl.NumberFormat("de-DE", { 24786 style: "currency", 24787 currency 24788 }).format(value); 24789 } 24790 /** 24791 * Parses a comma-separated string of IDs into an array of positive numbers. 24792 * 24793 * This function takes a string containing comma-separated values and converts 24794 * them into an array of positive integers. Invalid values (non-numeric, zero, 24795 * or negative numbers) are filtered out. 24796 * 24797 * @param ids - A comma-separated string of IDs (e.g., "1,2,3" or "10, 20, 30") 24798 * @returns An array of positive numbers if valid IDs are found, undefined otherwise 24799 * 24800 * @example 24801 * ```ts 24802 * parseIds("1,2,3") // Returns [1, 2, 3] 24803 * parseIds("10, 20, 30") // Returns [10, 20, 30] (handles whitespace) 24804 * parseIds("1,abc,3") // Returns [1, 3] (filters out invalid values) 24805 * parseIds("0,-1,2") // Returns [2] (filters out zero and negative numbers) 24806 * parseIds("") // Returns undefined 24807 * parseIds(undefined) // Returns undefined 24808 * parseIds("abc,def") // Returns undefined (no valid IDs) 24809 * ``` 24810 */ 24811 function parseIds(ids) { 24812 if (!ids) return; 24813 const parsed = ids.split(",").map((id) => id.trim()).map(Number).filter((num) => !isNaN(num) && num > 0); 24814 return parsed.length > 0 ? parsed : void 0; 24815 } 24816 //#endregion 24817 //#region src/components/donations/components/DonationSelector.svelte 24818 var root$38 = /* @__PURE__ */ from_html(`<button> </button>`); 24819 var root_1$10 = /* @__PURE__ */ from_html(`<form id="donationForm" action="" novalidate=""><div class="donation-custom form-group"><label for="donation-custom-amount"> </label> <input class="form-control" id="donation-custom-amount" type="number" min="1"/></div></form>`); 24820 var root_2$7 = /* @__PURE__ */ from_html(`<div class="donation-selection"><h3> </h3> <div class="donation-options"></div> <!></div>`); 24821 function DonationSelector($$anchor, $$props) { 24822 push($$props, true); 24823 const guestMaxLimit = goDonation.campaign?.guest_limit / 100; 24824 let customAmount = /* @__PURE__ */ state(void 0); 24825 function selectAmount(amount) { 24826 goDonation.amount = amount; 24827 set(customAmount, null); 24828 } 24829 function handleCustomInput(e) { 24830 const form = document.getElementById("donationForm"); 24831 if (form.checkValidity()) goDonation.amount = e.target.valueAsNumber * 100; 24832 else { 24833 goDonation.amount = void 0; 24834 form.reportValidity(); 24835 } 24836 } 24837 var div = root_2$7(); 24838 var h3 = child(div); 24839 var text = child(h3, true); 24840 reset(h3); 24841 var div_1 = sibling(h3, 2); 24842 each(div_1, 20, () => goDonation.campaign?.options, (option) => option, ($$anchor, option) => { 24843 var button = root$38(); 24844 let classes; 24845 var text_1 = child(button, true); 24846 reset(button); 24847 template_effect(($0) => { 24848 classes = set_class(button, 1, "btn btn-default", null, classes, { selected: goDonation.amount === option }); 24849 set_text(text_1, $0); 24850 }, [() => currency(option / 100, shop.currency)]); 24851 delegated("click", button, () => selectAmount(option)); 24852 append($$anchor, button); 24853 }); 24854 reset(div_1); 24855 var node = sibling(div_1, 2); 24856 var consequent = ($$anchor) => { 24857 var form_1 = root_1$10(); 24858 var div_2 = child(form_1); 24859 var label = child(div_2); 24860 var text_2 = child(label, true); 24861 reset(label); 24862 var input = sibling(label, 2); 24863 remove_input_defaults(input); 24864 reset(div_2); 24865 reset(form_1); 24866 template_effect(($0, $1) => { 24867 set_text(text_2, $0); 24868 set_attribute(input, "max", guestMaxLimit); 24869 set_attribute(input, "placeholder", $1); 24870 set_value(input, get$2(customAmount)); 24871 }, [() => shop.t("donations.selection.custom.label"), () => shop.t("donations.selection.custom.input.placeholder")]); 24872 delegated("input", input, handleCustomInput);
24873 append($$anchor, form_1); 24874 }; 24875 if_block(node, ($$render) => { 24876 if (goDonation.campaign?.free_donations) $$render(consequent); 24877 }); 24878 reset(div); 24879 template_effect(($0) => set_text(text, $0), [() => shop.t("donations.selection.title")]); 24880 append($$anchor, div); 24881 pop(); 24882 } 24883 delegate(["click", "input"]); 24884 create_custom_element(DonationSelector, {}, [], [], { mode: "open" }); 24885 //#endregion 24886 //#region src/components/donations/components/Donations.svelte 24887 var root$37 = /* @__PURE__ */ from_html(`<div class="go-donations-list"><!> <!> <div class="donation-actions"><button class="btn btn-default"> </button> <button class="btn btn-primary"> </button></div></div>`); 24888 function Donations($$anchor, $$props) { 24889 push($$props, false); 24890 onMount(() => { 24891 if (shop.donations?.campaigns?.length == 1) goDonation.selectCampaign(shop.donations?.campaigns[0]); 24892 }); 24893 init$1(); 24894 var fragment = comment(); 24895 var node = first_child(fragment); 24896 var consequent_1 = ($$anchor) => { 24897 var div = root$37(); 24898 var node_1 = child(div); 24899 each(node_1, 1, () => shop?.donations?.campaigns, (campaign) => campaign.id, ($$anchor, campaign) => { 24900 DonationCampaign($$anchor, { get campaign() { 24901 return get$2(campaign); 24902 } }); 24903 }); 24904 var node_2 = sibling(node_1, 2); 24905 var consequent = ($$anchor) => { 24906 DonationSelector($$anchor, {}); 24907 }; 24908 if_block(node_2, ($$render) => { 24909 if (goDonation.campaign) $$render(consequent); 24910 }); 24911 var div_1 = sibling(node_2, 2); 24912 var button = child(div_1); 24913 var text = child(button, true); 24914 reset(button); 24915 var button_1 = sibling(button, 2); 24916 var text_1 = child(button_1, true); 24917 reset(button_1); 24918 reset(div_1); 24919 reset(div); 24920 template_effect(($0, $1) => { 24921 set_text(text, $0); 24922 button_1.disabled = !goDonation.amount; 24923 set_text(text_1, $1); 24924 }, [() => shop.t("donations.actions.continueWithoutDonation"), () => shop.t("donations.actions.addToCart")]); 24925 delegated("click", button, function(...$$args) { 24926 goDonation.skipDonation?.apply(this, $$args); 24927 }); 24928 delegated("click", button_1, function(...$$args) { 24929 goDonation.addDonationToCart?.apply(this, $$args); 24930 }); 24931 append($$anchor, div); 24932 }; 24933 if_block(node, ($$render) => { 24934 if (shop.donations && shop.donations.campaigns) $$render(consequent_1); 24935 }); 24936 append($$anchor, fragment); 24937 pop(); 24938 } 24939 delegate(["click"]); 24940 customElements.define("go-donations", create_custom_element(Donations, {}, [], [])); 24941 //#endregion 24942 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/is.js 24943 function isFunction$1(value) { 24944 return typeof value === "function"; 24945 } 24946 function isObject(value) { 24947 return value !== null && typeof value === "object"; 24948 } 24949 var CLASS_VALUE_PRIMITIVE_TYPES = [ 24950 "string", 24951 "number", 24952 "bigint", 24953 "boolean" 24954 ]; 24955 function isClassValue(value) { 24956 if (value === null || value === void 0) return true; 24957 if (CLASS_VALUE_PRIMITIVE_TYPES.includes(typeof value)) return true; 24958 if (Array.isArray(value)) return value.every((item) => isClassValue(item)); 24959 if (typeof value === "object") { 24960 if (Object.getPrototypeOf(value) !== Object.prototype) return false; 24961 return true; 24962 } 24963 return false; 24964 } 24965 //#endregion 24966 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/box/box-extras.svelte.js 24967 var BoxSymbol = Symbol("box"); 24968 var isWritableSymbol = Symbol("is-writable"); 24969 function boxWith(getter, setter) { 24970 const derived = /* @__PURE__ */ user_derived(getter); 24971 if (setter) return { 24972 [BoxSymbol]: true, 24973 [isWritableSymbol]: true, 24974 get current() { 24975 return get$2(derived); 24976 }, 24977 set current(v) { 24978 setter(v); 24979 } 24980 }; 24981 return { 24982 [BoxSymbol]: true, 24983 get current() { 24984 return getter(); 24985 } 24986 }; 24987 } 24988 /** 24989 * @returns Whether the value is a Box 24990 * 24991 * @see {@link https://runed.dev/docs/functions/box} 24992 */ 24993 function isBox(value) { 24994 return isObject(value) && BoxSymbol in value; 24995 } 24996 function boxFrom(value) { 24997 if (isBox(value)) return value; 24998 if (isFunction$1(value)) return boxWith(value); 24999 return simpleBox(value); 25000 } 25001 function simpleBox(initialValue) { 25002 let current = /* @__PURE__ */ state(proxy(initialValue)); 25003 return { 25004 [BoxSymbol]: true, 25005 [isWritableSymbol]: true, 25006 get current() { 25007 return get$2(current); 25008 }, 25009 set current(v) { 25010 set(current, v, true); 25011 } 25012 }; 25013 } 25014 //#endregion 25015 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/compose-handlers.js 25016 /** 25017 * Composes event handlers into a single function that can be called with an event. 25018 * If the previous handler cancels the event using `event.preventDefault()`, the handlers 25019 * that follow will not be called. 25020 */ 25021 function composeHandlers(...handlers) { 25022 return function(e) { 25023 for (const handler of handlers) { 25024 if (!handler) continue; 25025 if (e.defaultPrevented) return; 25026 if (typeof handler === "function") handler.call(this, e); 25027 else handler.current?.call(this, e); 25028 } 25029 }; 25030 } 25031 //#endregion 25032 //#region ../../node_modules/.pnpm/[email protected]/node_modules/inline-style-parser/esm/index.mjs 25033 var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; 25034 var NEWLINE_REGEX = /\n/g; 25035 var WHITESPACE_REGEX = /^\s*/; 25036 var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
25037 var COLON_REGEX = /^:\s*/; 25038 var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; 25039 var SEMICOLON_REGEX = /^[;\s]*/; 25040 var TRIM_REGEX = /^\s+|\s+$/g; 25041 var NEWLINE = "\n"; 25042 var FORWARD_SLASH = "/"; 25043 var ASTERISK = "*"; 25044 var EMPTY_STRING = ""; 25045 var TYPE_COMMENT = "comment"; 25046 var TYPE_DECLARATION = "declaration"; 25047 /** 25048 * @param {String} style 25049 * @param {Object} [options] 25050 * @return {Object[]} 25051 * @throws {TypeError} 25052 * @throws {Error} 25053 */ 25054 function index(style, options) { 25055 if (typeof style !== "string") throw new TypeError("First argument must be a string"); 25056 if (!style) return []; 25057 options = options || {}; 25058 /** 25059 * Positional. 25060 */ 25061 var lineno = 1; 25062 var column = 1; 25063 /** 25064 * Update lineno and column based on `str`. 25065 * 25066 * @param {String} str 25067 */ 25068 function updatePosition(str) { 25069 var lines = str.match(NEWLINE_REGEX); 25070 if (lines) lineno += lines.length; 25071 var i = str.lastIndexOf(NEWLINE); 25072 column = ~i ? str.length - i : column + str.length; 25073 } 25074 /** 25075 * Mark position and patch `node.position`. 25076 * 25077 * @return {Function} 25078 */ 25079 function position() { 25080 var start = { 25081 line: lineno, 25082 column 25083 }; 25084 return function(node) { 25085 node.position = new Position(start); 25086 whitespace(); 25087 return node; 25088 }; 25089 } 25090 /** 25091 * Store position information for a node. 25092 * 25093 * @constructor 25094 * @property {Object} start 25095 * @property {Object} end 25096 * @property {undefined|String} source 25097 */ 25098 function Position(start) { 25099 this.start = start; 25100 this.end = { 25101 line: lineno, 25102 column 25103 }; 25104 this.source = options.source; 25105 } 25106 /** 25107 * Non-enumerable source string. 25108 */ 25109 Position.prototype.content = style; 25110 /** 25111 * Error `msg`. 25112 * 25113 * @param {String} msg 25114 * @throws {Error} 25115 */ 25116 function error(msg) { 25117 var err = /* @__PURE__ */ new Error(options.source + ":" + lineno + ":" + column + ": " + msg); 25118 err.reason = msg; 25119 err.filename = options.source; 25120 err.line = lineno; 25121 err.column = column; 25122 err.source = style; 25123 if (options.silent); 25124 else throw err; 25125 } 25126 /** 25127 * Match `re` and return captures. 25128 * 25129 * @param {RegExp} re 25130 * @return {undefined|Array} 25131 */ 25132 function match(re) { 25133 var m = re.exec(style); 25134 if (!m) return; 25135 var str = m[0]; 25136 updatePosition(str); 25137 style = style.slice(str.length); 25138 return m; 25139 } 25140 /** 25141 * Parse whitespace. 25142 */ 25143 function whitespace() { 25144 match(WHITESPACE_REGEX); 25145 } 25146 /** 25147 * Parse comments. 25148 * 25149 * @param {Object[]} [rules] 25150 * @return {Object[]} 25151 */ 25152 function comments(rules) { 25153 var c; 25154 rules = rules || []; 25155 while (c = comment()) if (c !== false) rules.push(c); 25156 return rules; 25157 } 25158 /** 25159 * Parse comment. 25160 * 25161 * @return {Object} 25162 * @throws {Error} 25163 */ 25164 function comment() { 25165 var pos = position(); 25166 if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return; 25167 var i = 2; 25168 while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) ++i; 25169 i += 2; 25170 if (EMPTY_STRING === style.charAt(i - 1)) return error("End of comment missing"); 25171 var str = style.slice(2, i - 2); 25172 column += 2; 25173 updatePosition(str); 25174 style = style.slice(i); 25175 column += 2; 25176 return pos({ 25177 type: TYPE_COMMENT, 25178 comment: str 25179 }); 25180 } 25181 /** 25182 * Parse declaration. 25183 * 25184 * @return {Object} 25185 * @throws {Error} 25186 */ 25187 function declaration() { 25188 var pos = position(); 25189 var prop = match(PROPERTY_REGEX); 25190 if (!prop) return; 25191 comment(); 25192 if (!match(COLON_REGEX)) return error("property missing ':'"); 25193 var val = match(VALUE_REGEX); 25194 var ret = pos({ 25195 type: TYPE_DECLARATION, 25196 property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)), 25197 value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING 25198 }); 25199 match(SEMICOLON_REGEX); 25200 return ret; 25201 } 25202 /** 25203 * Parse declarations. 25204 * 25205 * @return {Object[]} 25206 */ 25207 function declarations() { 25208 var decls = []; 25209 comments(decls); 25210 var decl; 25211 while (decl = declaration()) if (decl !== false) { 25212 decls.push(decl); 25213 comments(decls); 25214 } 25215 return decls; 25216 } 25217 whitespace(); 25218 return declarations(); 25219 } 25220 /** 25221 * Trim `str`. 25222 * 25223 * @param {String} str 25224 * @return {String} 25225 */ 25226 function trim(str) { 25227 return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING; 25228 } 25229 //#endregion 25230 //#region ../../node_modules/.pnpm/[email protected]/node_modules/style-to-object/esm/index.mjs 25231 /** 25232 * Parses inline style to object. 25233 * 25234 * @param style - Inline style. 25235 * @param iterator - Iterator. 25236 * @returns - Style object or null. 25237 * 25238 * @example Parsing inline style to object: 25239 * 25240 * ```js 25241 * import parse from 'style-to-object'; 25242 * parse('line-height: 42;'); // { 'line-height': '42' } 25243 * ``` 25244 */ 25245 function StyleToObject(style, iterator) { 25246 let styleObject = null; 25247 if (!style || typeof style !== "string") return styleObject; 25248 const declarations = index(style); 25249 const hasIterator = typeof iterator === "function"; 25250 declarations.forEach((declaration) => { 25251 if (declaration.type !== "declaration") return; 25252 const { property, value } = declaration; 25253 if (hasIterator) iterator(property, value, declaration); 25254 else if (value) { 25255 styleObject = styleObject || {}; 25256 styleObject[property] = value; 25257 } 25258 }); 25259 return styleObject; 25260 } 25261 //#endregion 25262 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/strings.js 25263 var NUMBER_CHAR_RE = /\d/; 25264 var STR_SPLITTERS = [ 25265 "-", 25266 "_", 25267 "/", 25268 "." 25269 ]; 25270 function isUppercase(char = "") { 25271 if (NUMBER_CHAR_RE.test(char)) return void 0; 25272 return char !== char.toLowerCase(); 25273 } 25274 function splitByCase(str) { 25275 const parts = []; 25276 let buff = ""; 25277 let previousUpper; 25278 let previousSplitter; 25279 for (const char of str) { 25280 const isSplitter = STR_SPLITTERS.includes(char); 25281 if (isSplitter === true) { 25282 parts.push(buff); 25283 buff = ""; 25284 previousUpper = void 0; 25285 continue; 25286 } 25287 const isUpper = isUppercase(char); 25288 if (previousSplitter === false) { 25289 if (previousUpper === false && isUpper === true) { 25290 parts.push(buff); 25291 buff = char; 25292 previousUpper = isUpper; 25293 continue; 25294 } 25295 if (previousUpper === true && isUpper === false && buff.length > 1) { 25296 const lastChar = buff.at(-1); 25297 parts.push(buff.slice(0, Math.max(0, buff.length - 1))); 25298 buff = lastChar + char; 25299 previousUpper = isUpper; 25300 continue; 25301 } 25302 } 25303 buff += char; 25304 previousUpper = isUpper; 25305 previousSplitter = isSplitter; 25306 } 25307 parts.push(buff); 25308 return parts; 25309 } 25310 function pascalCase(str) { 25311 if (!str) return ""; 25312 return splitByCase(str).map((p) => upperFirst(p)).join(""); 25313 } 25314 function camelCase(str) { 25315 return lowerFirst(pascalCase(str || "")); 25316 } 25317 function upperFirst(str) { 25318 return str ? str[0].toUpperCase() + str.slice(1) : ""; 25319 } 25320 function lowerFirst(str) { 25321 return str ? str[0].toLowerCase() + str.slice(1) : ""; 25322 } 25323 //#endregion 25324 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/css-to-style-obj.js 25325 function cssToStyleObj(css) { 25326 if (!css) return {};
25327 const styleObj = {}; 25328 function iterator(name, value) { 25329 if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) { 25330 styleObj[pascalCase(name)] = value; 25331 return; 25332 } 25333 if (name.startsWith("--")) { 25334 styleObj[name] = value; 25335 return; 25336 } 25337 styleObj[camelCase(name)] = value; 25338 } 25339 StyleToObject(css, iterator); 25340 return styleObj; 25341 } 25342 //#endregion 25343 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/execute-callbacks.js 25344 /** 25345 * Executes an array of callback functions with the same arguments. 25346 * @template T The types of the arguments that the callback functions take. 25347 * @param callbacks array of callback functions to execute. 25348 * @returns A new function that executes all of the original callback functions with the same arguments. 25349 */ 25350 function executeCallbacks(...callbacks) { 25351 return (...args) => { 25352 for (const callback of callbacks) if (typeof callback === "function") callback(...args); 25353 }; 25354 } 25355 //#endregion 25356 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/style-to-css.js 25357 function createParser(matcher, replacer) { 25358 const regex = RegExp(matcher, "g"); 25359 return (str) => { 25360 if (typeof str !== "string") throw new TypeError(`expected an argument of type string, but got ${typeof str}`); 25361 if (!str.match(regex)) return str; 25362 return str.replace(regex, replacer); 25363 }; 25364 } 25365 var camelToKebab = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`); 25366 function styleToCSS(styleObj) { 25367 if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) throw new TypeError(`expected an argument of type object, but got ${typeof styleObj}`); 25368 return Object.keys(styleObj).map((property) => `${camelToKebab(property)}: ${styleObj[property]};`).join("\n"); 25369 } 25370 //#endregion 25371 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/style.js 25372 function styleToString(style = {}) { 25373 return styleToCSS(style).replace("\n", " "); 25374 } 25375 var EVENT_LIST_SET = new Set([ 25376 "onabort", 25377 "onanimationcancel", 25378 "onanimationend", 25379 "onanimationiteration", 25380 "onanimationstart", 25381 "onauxclick", 25382 "onbeforeinput", 25383 "onbeforetoggle", 25384 "onblur", 25385 "oncancel", 25386 "oncanplay", 25387 "oncanplaythrough", 25388 "onchange", 25389 "onclick", 25390 "onclose", 25391 "oncompositionend", 25392 "oncompositionstart", 25393 "oncompositionupdate", 25394 "oncontextlost", 25395 "oncontextmenu", 25396 "oncontextrestored", 25397 "oncopy", 25398 "oncuechange", 25399 "oncut", 25400 "ondblclick", 25401 "ondrag", 25402 "ondragend", 25403 "ondragenter", 25404 "ondragleave", 25405 "ondragover", 25406 "ondragstart", 25407 "ondrop", 25408 "ondurationchange", 25409 "onemptied", 25410 "onended", 25411 "onerror", 25412 "onfocus", 25413 "onfocusin", 25414 "onfocusout", 25415 "onformdata", 25416 "ongotpointercapture", 25417 "oninput", 25418 "oninvalid", 25419 "onkeydown", 25420 "onkeypress", 25421 "onkeyup", 25422 "onload", 25423 "onloadeddata", 25424 "onloadedmetadata", 25425 "onloadstart", 25426 "onlostpointercapture", 25427 "onmousedown", 25428 "onmouseenter", 25429 "onmouseleave", 25430 "onmousemove", 25431 "onmouseout", 25432 "onmouseover", 25433 "onmouseup", 25434 "onpaste", 25435 "onpause", 25436 "onplay", 25437 "onplaying", 25438 "onpointercancel", 25439 "onpointerdown", 25440 "onpointerenter", 25441 "onpointerleave", 25442 "onpointermove", 25443 "onpointerout", 25444 "onpointerover", 25445 "onpointerup", 25446 "onprogress", 25447 "onratechange", 25448 "onreset", 25449 "onresize", 25450 "onscroll", 25451 "onscrollend", 25452 "onsecuritypolicyviolation", 25453 "onseeked", 25454 "onseeking", 25455 "onselect", 25456 "onselectionchange", 25457 "onselectstart", 25458 "onslotchange", 25459 "onstalled", 25460 "onsubmit", 25461 "onsuspend", 25462 "ontimeupdate", 25463 "ontoggle", 25464 "ontouchcancel", 25465 "ontouchend", 25466 "ontouchmove", 25467 "ontouchstart", 25468 "ontransitioncancel", 25469 "ontransitionend", 25470 "ontransitionrun", 25471 "ontransitionstart", 25472 "onvolumechange", 25473 "onwaiting", 25474 "onwebkitanimationend", 25475 "onwebkitanimationiteration", 25476 "onwebkitanimationstart", 25477 "onwebkittransitionend", 25478 "onwheel" 25479 ]); 25480 //#endregion 25481 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/merge-props.js 25482 /** 25483 * Modified from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/utils/src/mergeProps.ts (see NOTICE.txt for source) 25484 */ 25485 function isEventHandler(key) { 25486 return EVENT_LIST_SET.has(key); 25487 } 25488 /** 25489 * Given a list of prop objects, merges them into a single object. 25490 * - Automatically composes event handlers (e.g. `onclick`, `oninput`, etc.) 25491 * - Chains regular functions with the same name so they are called in order 25492 * - Merges class strings with `clsx` 25493 * - Merges style objects and converts them to strings 25494 * - Handles a bug with Svelte where setting the `hidden` attribute to `false` doesn't remove it 25495 * - Overrides other values with the last one 25496 */ 25497 function mergeProps(...args) { 25498 const result = { ...args[0] }; 25499 for (let i = 1; i < args.length; i++) { 25500 const props = args[i]; 25501 if (!props) continue; 25502 for (const key of Object.keys(props)) { 25503 const a = result[key]; 25504 const b = props[key]; 25505 const aIsFunction = typeof a === "function"; 25506 const bIsFunction = typeof b === "function"; 25507 if (aIsFunction && typeof bIsFunction && isEventHandler(key)) result[key] = composeHandlers(a, b); 25508 else if (aIsFunction && bIsFunction) result[key] = executeCallbacks(a, b); 25509 else if (key === "class") { 25510 const aIsClassValue = isClassValue(a); 25511 const bIsClassValue = isClassValue(b); 25512 if (aIsClassValue && bIsClassValue) result[key] = clsx$1(a, b); 25513 else if (aIsClassValue) result[key] = clsx$1(a); 25514 else if (bIsClassValue) result[key] = clsx$1(b); 25515 } else if (key === "style") { 25516 const aIsObject = typeof a === "object"; 25517 const bIsObject = typeof b === "object"; 25518 const aIsString = typeof a === "string"; 25519 const bIsString = typeof b === "string"; 25520 if (aIsObject && bIsObject) result[key] = { 25521 ...a, 25522 ...b 25523 }; 25524 else if (aIsObject && bIsString) { 25525 const parsedStyle = cssToStyleObj(b); 25526 result[key] = { 25527 ...a, 25528 ...parsedStyle 25529 }; 25530 } else if (aIsString && bIsObject) result[key] = { 25531 ...cssToStyleObj(a), 25532 ...b 25533 }; 25534 else if (aIsString && bIsString) { 25535 const parsedStyleA = cssToStyleObj(a); 25536 const parsedStyleB = cssToStyleObj(b); 25537 result[key] = { 25538 ...parsedStyleA, 25539 ...parsedStyleB 25540 }; 25541 } else if (aIsObject) result[key] = a; 25542 else if (bIsObject) result[key] = b; 25543 else if (aIsString) result[key] = a; 25544 else if (bIsString) result[key] = b; 25545 } else result[key] = b !== void 0 ? b : a; 25546 } 25547 for (const key of Object.getOwnPropertySymbols(props)) { 25548 const a = result[key]; 25549 const b = props[key]; 25550 result[key] = b !== void 0 ? b : a; 25551 } 25552 } 25553 if (typeof result.style === "object") result.style = styleToString(result.style).replaceAll("\n", " "); 25554 if (result.hidden === false) { 25555 result.hidden = void 0; 25556 delete result.hidden; 25557 } 25558 if (result.disabled === false) { 25559 result.disabled = void 0; 25560 delete result.disabled; 25561 } 25562 return result; 25563 } 25564 //#endregion 25565 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/sr-only-styles.js 25566 var srOnlyStyles = { 25567 position: "absolute", 25568 width: "1px", 25569 height: "1px", 25570 padding: "0", 25571 margin: "-1px", 25572 overflow: "hidden", 25573 clip: "rect(0, 0, 0, 0)", 25574 whiteSpace: "nowrap", 25575 borderWidth: "0", 25576 transform: "translateX(-100%)" 25577 }; 25578 var srOnlyStylesString = styleToString(srOnlyStyles); 25579 //#endregion 25580 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/internal/configurable-globals.js 25581 var defaultWindow = typeof window !== "undefined" ? window : void 0; 25582 typeof window !== "undefined" && window.document; 25583 typeof window !== "undefined" && window.navigator; 25584 typeof window !== "undefined" && window.location; 25585 //#endregion 25586 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/internal/utils/dom.js 25587 /** 25588 * Handles getting the active element in a document or shadow root.
25589 * If the active element is within a shadow root, it will traverse the shadow root 25590 * to find the active element. 25591 * If not, it will return the active element in the document. 25592 * 25593 * @param document A document or shadow root to get the active element from. 25594 * @returns The active element in the document or shadow root. 25595 */ 25596 function getActiveElement$1(document) { 25597 let activeElement = document.activeElement; 25598 while (activeElement?.shadowRoot) { 25599 const node = activeElement.shadowRoot.activeElement; 25600 if (node === activeElement) break; 25601 else activeElement = node; 25602 } 25603 return activeElement; 25604 } 25605 //#endregion 25606 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/svelte/src/reactivity/map.js 25607 /** @import { Source } from '#client' */ 25608 /** 25609 * A reactive version of the built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object. 25610 * Reading contents of the map (by iterating, or by reading `map.size` or calling `map.get(...)` or `map.has(...)` as in the [tic-tac-toe example](https://svelte.dev/playground/0b0ff4aa49c9443f9b47fe5203c78293) below) in an [effect](https://svelte.dev/docs/svelte/$effect) or [derived](https://svelte.dev/docs/svelte/$derived) 25611 * will cause it to be re-evaluated as necessary when the map is updated. 25612 * 25613 * Note that values in a reactive map are _not_ made [deeply reactive](https://svelte.dev/docs/svelte/$state#Deep-state). 25614 * 25615 * ```svelte 25616 * <script> 25617 * import { SvelteMap } from 'svelte/reactivity'; 25618 * import { result } from './game.js'; 25619 * 25620 * let board = new SvelteMap(); 25621 * let player = $state('x'); 25622 * let winner = $derived(result(board)); 25623 * 25624 * function reset() { 25625 * player = 'x'; 25626 * board.clear(); 25627 * } 25628 * <\/script> 25629 * 25630 * <div class="board"> 25631 * {#each Array(9), i} 25632 * <button 25633 * disabled={board.has(i) || winner} 25634 * onclick={() => { 25635 * board.set(i, player); 25636 * player = player === 'x' ? 'o' : 'x'; 25637 * }} 25638 * >{board.get(i)}</button> 25639 * {/each} 25640 * </div> 25641 * 25642 * {#if winner} 25643 * <p>{winner} wins!</p> 25644 * <button onclick={reset}>reset</button> 25645 * {:else} 25646 * <p>{player} is next</p> 25647 * {/if} 25648 * ``` 25649 * 25650 * @template K 25651 * @template V 25652 * @extends {Map<K, V>} 25653 */ 25654 var SvelteMap = class extends Map { 25655 /** @type {Map<K, Source<number>>} */ 25656 #sources = /* @__PURE__ */ new Map(); 25657 #version = /* @__PURE__ */ state(0); 25658 #size = /* @__PURE__ */ state(0); 25659 #update_version = update_version || -1; 25660 /** 25661 * @param {Iterable<readonly [K, V]> | null | undefined} [value] 25662 */ 25663 constructor(value) { 25664 super(); 25665 if (value) { 25666 for (var [key, v] of value) super.set(key, v); 25667 this.#size.v = super.size; 25668 } 25669 } 25670 /** 25671 * If the source is being created inside the same reaction as the SvelteMap instance, 25672 * we use `state` so that it will not be a dependency of the reaction. Otherwise we 25673 * use `source` so it will be. 25674 * 25675 * @template T 25676 * @param {T} value 25677 * @returns {Source<T>} 25678 */ 25679 #source(value) { 25680 return update_version === this.#update_version ? /* @__PURE__ */ state(value) : source(value); 25681 } 25682 /** @param {K} key */ 25683 has(key) { 25684 var sources = this.#sources; 25685 var s = sources.get(key); 25686 if (s === void 0) if (super.has(key)) { 25687 s = this.#source(0); 25688 sources.set(key, s); 25689 } else { 25690 get$2(this.#version); 25691 return false; 25692 } 25693 get$2(s); 25694 return true; 25695 } 25696 /** 25697 * @param {(value: V, key: K, map: Map<K, V>) => void} callbackfn 25698 * @param {any} [this_arg] 25699 */ 25700 forEach(callbackfn, this_arg) { 25701 this.#read_all(); 25702 super.forEach(callbackfn, this_arg); 25703 } 25704 /** @param {K} key */ 25705 get(key) { 25706 var sources = this.#sources; 25707 var s = sources.get(key); 25708 if (s === void 0) if (super.has(key)) { 25709 s = this.#source(0); 25710 sources.set(key, s); 25711 } else { 25712 get$2(this.#version); 25713 return; 25714 } 25715 get$2(s); 25716 return super.get(key); 25717 } 25718 /** 25719 * @param {K} key 25720 * @param {V} value 25721 * */ 25722 set(key, value) { 25723 var sources = this.#sources; 25724 var s = sources.get(key); 25725 var prev_res = super.get(key); 25726 var res = super.set(key, value); 25727 var version = this.#version; 25728 if (s === void 0) { 25729 s = this.#source(0); 25730 sources.set(key, s); 25731 set(this.#size, super.size); 25732 increment$1(version); 25733 } else if (prev_res !== value) { 25734 increment$1(s); 25735 var v_reactions = version.reactions === null ? null : new Set(version.reactions); 25736 if (v_reactions === null || !s.reactions?.every((r) => v_reactions.has(r))) increment$1(version); 25737 } 25738 return res; 25739 } 25740 /** @param {K} key */ 25741 delete(key) { 25742 var sources = this.#sources; 25743 var s = sources.get(key); 25744 var res = super.delete(key); 25745 if (s !== void 0) { 25746 sources.delete(key); 25747 set(s, -1); 25748 } 25749 if (res) { 25750 set(this.#size, super.size); 25751 increment$1(this.#version); 25752 } 25753 return res; 25754 } 25755 clear() { 25756 if (super.size === 0) return; 25757 super.clear(); 25758 var sources = this.#sources; 25759 set(this.#size, 0); 25760 for (var s of sources.values()) set(s, -1); 25761 increment$1(this.#version); 25762 sources.clear(); 25763 } 25764 #read_all() { 25765 get$2(this.#version); 25766 var sources = this.#sources; 25767 if (this.#size.v !== sources.size) { 25768 for (var key of super.keys()) if (!sources.has(key)) { 25769 var s = this.#source(0); 25770 sources.set(key, s); 25771 } 25772 } 25773 for ([, s] of this.#sources) get$2(s); 25774 } 25775 keys() { 25776 get$2(this.#version); 25777 return super.keys(); 25778 } 25779 values() { 25780 this.#read_all(); 25781 return super.values(); 25782 } 25783 entries() { 25784 this.#read_all(); 25785 return super.entries(); 25786 } 25787 [Symbol.iterator]() { 25788 return this.entries(); 25789 } 25790 get size() { 25791 get$2(this.#size); 25792 return super.size; 25793 } 25794 }; 25795 //#endregion 25796 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/utilities/active-element/active-element.svelte.js 25797 var ActiveElement = class { 25798 #document; 25799 #subscribe; 25800 constructor(options = {}) { 25801 const { window = defaultWindow, document = window?.document } = options; 25802 if (window === void 0) return; 25803 this.#document = document; 25804 this.#subscribe = createSubscriber((update) => { 25805 const cleanupFocusIn = on(window, "focusin", update); 25806 const cleanupFocusOut = on(window, "focusout", update); 25807 return () => { 25808 cleanupFocusIn(); 25809 cleanupFocusOut(); 25810 }; 25811 }); 25812 } 25813 get current() { 25814 this.#subscribe?.(); 25815 if (!this.#document) return null; 25816 return getActiveElement$1(this.#document); 25817 } 25818 }; 25819 new ActiveElement(); 25820 //#endregion 25821 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/internal/utils/is.js 25822 function isFunction(value) { 25823 return typeof value === "function"; 25824 } 25825 //#endregion 25826 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/utilities/context/context.js 25827 var Context = class { 25828 #name; 25829 #key; 25830 /** 25831 * @param name The name of the context. 25832 * This is used for generating the context key and error messages. 25833 */ 25834 constructor(name) { 25835 this.#name = name; 25836 this.#key = Symbol(name); 25837 } 25838 /** 25839 * The key used to get and set the context. 25840 * 25841 * It is not recommended to use this value directly. 25842 * Instead, use the methods provided by this class. 25843 */ 25844 get key() { 25845 return this.#key; 25846 } 25847 /** 25848 * Checks whether this has been set in the context of a parent component. 25849 * 25850 * Must be called during component initialisation. 25851 */ 25852 exists() { 25853 return hasContext(this.#key); 25854 } 25855 /** 25856 * Retrieves the context that belongs to the closest parent component. 25857 * 25858 * Must be called during component initialisation. 25859 * 25860 * @throws An error if the context does not exist. 25861 */ 25862 get() { 25863 const context = getContext(this.#key); 25864 if (context === void 0) throw new Error(`Context "${this.#name}" not found`); 25865 return context; 25866 } 25867 /** 25868 * Retrieves the context that belongs to the closest parent component, 25869 * or the given fallback value if the context does not exist. 25870 * 25871 * Must be called during component initialisation. 25872 */ 25873 getOr(fallback) { 25874 const context = getContext(this.#key); 25875 if (context === void 0) return fallback; 25876 return context; 25877 } 25878 /** 25879 * Associates the given value with the current component and returns it. 25880 * 25881 * Must be called during component initialisation. 25882 */ 25883 set(context) { 25884 return setContext(this.#key, context); 25885 } 25886 }; 25887 //#endregion 25888 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/utilities/watch/watch.svelte.js 25889 function runEffect(flush, effect) { 25890 switch (flush) { 25891 case "post": 25892 user_effect(effect); 25893 break; 25894 case "pre": 25895 user_pre_effect(effect); 25896 break; 25897 } 25898 } 25899 function runWatcher(sources, flush, effect, options = {}) { 25900 const { lazy = false } = options; 25901 let active = !lazy; 25902 let previousValues = Array.isArray(sources) ? [] : void 0; 25903 runEffect(flush, () => { 25904 const values = Array.isArray(sources) ? sources.map((source) => source()) : sources(); 25905 if (!active) { 25906 active = true; 25907 previousValues = values; 25908 return; 25909 } 25910 const cleanup = untrack(() => effect(values, previousValues)); 25911 previousValues = values; 25912 return cleanup; 25913 }); 25914 } 25915 function runWatcherOnce(sources, flush, effect) { 25916 const cleanupRoot = effect_root(() => { 25917 let stop = false;
25918 runWatcher(sources, flush, (values, previousValues) => { 25919 if (stop) { 25920 cleanupRoot(); 25921 return; 25922 } 25923 const cleanup = effect(values, previousValues); 25924 stop = true; 25925 return cleanup; 25926 }, { lazy: true }); 25927 }); 25928 user_effect(() => { 25929 return cleanupRoot; 25930 }); 25931 } 25932 function watch(sources, effect, options) { 25933 runWatcher(sources, "post", effect, options); 25934 } 25935 function watchPre(sources, effect, options) { 25936 runWatcher(sources, "pre", effect, options); 25937 } 25938 watch.pre = watchPre; 25939 function watchOnce(source, effect) { 25940 runWatcherOnce(source, "post", effect); 25941 } 25942 function watchOncePre(source, effect) { 25943 runWatcherOnce(source, "pre", effect); 25944 } 25945 watchOnce.pre = watchOncePre; 25946 //#endregion 25947 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/internal/utils/get.js 25948 function get$1(value) { 25949 if (isFunction(value)) return value(); 25950 return value; 25951 } 25952 //#endregion 25953 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/utilities/element-size/element-size.svelte.js 25954 var ElementSize = class { 25955 #size = { 25956 width: 0, 25957 height: 0 25958 }; 25959 #observed = false; 25960 #options; 25961 #node; 25962 #window; 25963 #width = /* @__PURE__ */ user_derived(() => { 25964 get$2(this.#subscribe)?.(); 25965 return this.getSize().width; 25966 }); 25967 #height = /* @__PURE__ */ user_derived(() => { 25968 get$2(this.#subscribe)?.(); 25969 return this.getSize().height; 25970 }); 25971 #subscribe = /* @__PURE__ */ user_derived(() => { 25972 const node$ = get$1(this.#node); 25973 if (!node$) return; 25974 return createSubscriber((update) => { 25975 if (!this.#window) return; 25976 const observer = new this.#window.ResizeObserver((entries) => { 25977 this.#observed = true; 25978 for (const entry of entries) { 25979 const boxSize = this.#options.box === "content-box" ? entry.contentBoxSize : entry.borderBoxSize; 25980 const boxSizeArr = Array.isArray(boxSize) ? boxSize : [boxSize]; 25981 this.#size.width = boxSizeArr.reduce((acc, size) => Math.max(acc, size.inlineSize), 0); 25982 this.#size.height = boxSizeArr.reduce((acc, size) => Math.max(acc, size.blockSize), 0); 25983 } 25984 update(); 25985 }); 25986 observer.observe(node$); 25987 return () => { 25988 this.#observed = false; 25989 observer.disconnect(); 25990 }; 25991 }); 25992 }); 25993 constructor(node, options = { box: "border-box" }) { 25994 this.#window = options.window ?? defaultWindow; 25995 this.#options = options; 25996 this.#node = node; 25997 this.#size = { 25998 width: 0, 25999 height: 0 26000 }; 26001 } 26002 calculateSize() { 26003 const element = get$1(this.#node); 26004 if (!element || !this.#window) return; 26005 const offsetWidth = element.offsetWidth; 26006 const offsetHeight = element.offsetHeight; 26007 if (this.#options.box === "border-box") return { 26008 width: offsetWidth, 26009 height: offsetHeight 26010 }; 26011 const style = this.#window.getComputedStyle(element); 26012 const paddingWidth = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); 26013 const paddingHeight = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); 26014 const borderWidth = parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth); 26015 const borderHeight = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 26016 return { 26017 width: offsetWidth - paddingWidth - borderWidth, 26018 height: offsetHeight - paddingHeight - borderHeight 26019 }; 26020 } 26021 getSize() { 26022 return this.#observed ? this.#size : this.calculateSize() ?? this.#size; 26023 } 26024 get current() { 26025 get$2(this.#subscribe)?.(); 26026 return this.getSize(); 26027 } 26028 get width() { 26029 return get$2(this.#width); 26030 } 26031 get height() { 26032 return get$2(this.#height); 26033 } 26034 }; 26035 //#endregion 26036 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plugin-svelte_1f96119c3718044e5b928abd417f4834/node_modules/runed/dist/utilities/resource/resource.svelte.js 26037 function debounce$1(fn, delay) { 26038 let timeoutId; 26039 let lastResolve = null; 26040 return (...args) => { 26041 return new Promise((resolve) => { 26042 if (lastResolve) lastResolve(void 0); 26043 lastResolve = resolve; 26044 clearTimeout(timeoutId); 26045 timeoutId = setTimeout(async () => { 26046 const result = await fn(...args); 26047 if (lastResolve) { 26048 lastResolve(result); 26049 lastResolve = null; 26050 } 26051 }, delay); 26052 }); 26053 }; 26054 } 26055 function throttle(fn, delay) { 26056 let lastRun = 0; 26057 let lastPromise = null; 26058 return (...args) => { 26059 const now = Date.now(); 26060 if (lastRun && now - lastRun < delay) return lastPromise ?? Promise.resolve(void 0); 26061 lastRun = now; 26062 lastPromise = fn(...args); 26063 return lastPromise; 26064 }; 26065 } 26066 function runResource(source, fetcher, options = {}, effectFn) { 26067 const { lazy = false, once = false, initialValue, debounce: debounceTime, throttle: throttleTime } = options; 26068 let current = /* @__PURE__ */ state(proxy(initialValue)); 26069 let loading = /* @__PURE__ */ state(false); 26070 let error = /* @__PURE__ */ state(void 0); 26071 let cleanupFns = /* @__PURE__ */ state(proxy([])); 26072 const runCleanup = () => {
26073 get$2(cleanupFns).forEach((fn) => fn()); 26074 set(cleanupFns, [], true); 26075 }; 26076 const onCleanup = (fn) => { 26077 set(cleanupFns, [...get$2(cleanupFns), fn], true); 26078 }; 26079 const baseFetcher = async (value, previousValue, refetching = false) => { 26080 try { 26081 set(loading, true); 26082 set(error, void 0); 26083 runCleanup(); 26084 const controller = new AbortController(); 26085 onCleanup(() => controller.abort()); 26086 const result = await fetcher(value, previousValue, { 26087 data: get$2(current), 26088 refetching, 26089 onCleanup, 26090 signal: controller.signal 26091 }); 26092 set(current, result, true); 26093 return result; 26094 } catch (e) { 26095 if (!(e instanceof DOMException && e.name === "AbortError")) set(error, e, true); 26096 return; 26097 } finally { 26098 set(loading, false); 26099 } 26100 }; 26101 const runFetcher = debounceTime ? debounce$1(baseFetcher, debounceTime) : throttleTime ? throttle(baseFetcher, throttleTime) : baseFetcher; 26102 const sources = Array.isArray(source) ? source : [source]; 26103 let prevValues; 26104 effectFn((values, previousValues) => { 26105 if (once && prevValues) return; 26106 prevValues = values; 26107 runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? previousValues : previousValues?.[0]); 26108 }, { lazy }); 26109 return { 26110 get current() { 26111 return get$2(current); 26112 }, 26113 get loading() { 26114 return get$2(loading); 26115 }, 26116 get error() { 26117 return get$2(error); 26118 }, 26119 mutate: (value) => { 26120 set(current, value, true); 26121 }, 26122 refetch: (info) => { 26123 const values = sources.map((s) => s()); 26124 return runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? values : values[0], info ?? true); 26125 } 26126 }; 26127 } 26128 function resource(source, fetcher, options) { 26129 return runResource(source, fetcher, options, (fn, options) => { 26130 const sources = Array.isArray(source) ? source : [source]; 26131 const getters = () => sources.map((s) => s()); 26132 watch(getters, (values, previousValues) => { 26133 fn(values, previousValues ?? []); 26134 }, options); 26135 }); 26136 } 26137 function resourcePre(source, fetcher, options) { 26138 return runResource(source, fetcher, options, (fn, options) => { 26139 const sources = Array.isArray(source) ? source : [source]; 26140 const getter = () => sources.map((s) => s()); 26141 watch.pre(getter, (values, previousValues) => { 26142 fn(values, previousValues ?? []); 26143 }, options); 26144 }); 26145 } 26146 resource.pre = resourcePre; 26147 //#endregion 26148 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/on-destroy-effect.svelte.js 26149 function onDestroyEffect(fn) { 26150 user_effect(() => { 26151 return () => { 26152 fn(); 26153 }; 26154 }); 26155 } 26156 //#endregion 26157 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/after-sleep.js 26158 /** 26159 * A utility function that executes a callback after a specified number of milliseconds. 26160 */ 26161 function afterSleep(ms, cb) { 26162 return setTimeout(cb, ms); 26163 } 26164 //#endregion 26165 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/after-tick.js 26166 function afterTick(fn) { 26167 tick().then(fn); 26168 } 26169 //#endregion 26170 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/dom.js 26171 var ELEMENT_NODE = 1; 26172 var DOCUMENT_NODE = 9; 26173 var DOCUMENT_FRAGMENT_NODE = 11; 26174 function isHTMLElement$2(node) { 26175 return isObject(node) && node.nodeType === ELEMENT_NODE && typeof node.nodeName === "string"; 26176 } 26177 function isDocument(node) { 26178 return isObject(node) && node.nodeType === DOCUMENT_NODE; 26179 } 26180 function isWindow(node) { 26181 return isObject(node) && node.constructor?.name === "VisualViewport"; 26182 } 26183 function isNode$1(node) { 26184 return isObject(node) && node.nodeType !== void 0; 26185 } 26186 function isShadowRoot$1(node) { 26187 return isNode$1(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node;
26188 } 26189 function contains$1(parent, child) { 26190 if (!parent || !child) return false; 26191 if (!isHTMLElement$2(parent) || !isHTMLElement$2(child)) return false; 26192 const rootNode = child.getRootNode?.(); 26193 if (parent === child) return true; 26194 if (parent.contains(child)) return true; 26195 if (rootNode && isShadowRoot$1(rootNode)) { 26196 let next = child; 26197 while (next) { 26198 if (parent === next) return true; 26199 next = next.parentNode || next.host; 26200 } 26201 } 26202 return false; 26203 } 26204 function getDocument(node) { 26205 if (isDocument(node)) return node; 26206 if (isWindow(node)) return node.document; 26207 return node?.ownerDocument ?? document; 26208 } 26209 function getWindow$1(node) { 26210 if (isShadowRoot$1(node)) return getWindow$1(node.host); 26211 if (isDocument(node)) return node.defaultView ?? window; 26212 if (isHTMLElement$2(node)) return node.ownerDocument?.defaultView ?? window; 26213 return window; 26214 } 26215 function getActiveElement(rootNode) { 26216 let activeElement = rootNode.activeElement; 26217 while (activeElement?.shadowRoot) { 26218 const el = activeElement.shadowRoot.activeElement; 26219 if (el === activeElement) break; 26220 else activeElement = el; 26221 } 26222 return activeElement; 26223 } 26224 //#endregion 26225 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/dom-context.svelte.js 26226 var DOMContext = class { 26227 element; 26228 #root = /* @__PURE__ */ user_derived(() => { 26229 if (!this.element.current) return document; 26230 return this.element.current.getRootNode() ?? document; 26231 }); 26232 get root() { 26233 return get$2(this.#root); 26234 } 26235 set root(value) { 26236 set(this.#root, value); 26237 } 26238 constructor(element) { 26239 if (typeof element === "function") this.element = boxWith(element); 26240 else this.element = element; 26241 } 26242 getDocument = () => { 26243 return getDocument(this.root); 26244 }; 26245 getWindow = () => { 26246 return this.getDocument().defaultView ?? window; 26247 }; 26248 getActiveElement = () => { 26249 return getActiveElement(this.root); 26250 }; 26251 isActiveElement = (node) => { 26252 return node === this.getActiveElement(); 26253 }; 26254 getElementById(id) { 26255 return this.root.getElementById(id); 26256 } 26257 querySelector = (selector) => { 26258 if (!this.root) return null; 26259 return this.root.querySelector(selector); 26260 }; 26261 querySelectorAll = (selector) => { 26262 if (!this.root) return []; 26263 return this.root.querySelectorAll(selector); 26264 }; 26265 setTimeout = (callback, delay) => { 26266 return this.getWindow().setTimeout(callback, delay); 26267 }; 26268 clearTimeout = (timeoutId) => { 26269 return this.getWindow().clearTimeout(timeoutId); 26270 }; 26271 }; 26272 //#endregion 26273 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@sveltejs+vite-plu_30a9f2c917609fd3cb2070420016a0e2/node_modules/svelte-toolbelt/dist/utils/attach-ref.js 26274 /** 26275 * Creates a Svelte Attachment that attaches a DOM element to a ref. 26276 * The ref can be either a WritableBox or a callback function. 26277 * 26278 * @param ref - Either a WritableBox to store the element in, or a callback function that receives the element 26279 * @param onChange - Optional callback that fires when the ref changes 26280 * @returns An object with a spreadable attachment key that should be spread onto the element 26281 * 26282 * @example 26283 * // Using with WritableBox 26284 * const ref = box<HTMLDivElement | null>(null); 26285 * <div {...attachRef(ref)}>Content</div> 26286 * 26287 * @example 26288 * // Using with callback 26289 * <div {...attachRef((node) => myNode = node)}>Content</div> 26290 * 26291 * @example 26292 * // Using with onChange 26293 * <div {...attachRef(ref, (node) => console.log(node))}>Content</div> 26294 */ 26295 function attachRef(ref, onChange) { 26296 return { [createAttachmentKey()]: (node) => { 26297 if (isBox(ref)) { 26298 ref.current = node; 26299 untrack(() => onChange?.(node)); 26300 return () => { 26301 if ("isConnected" in node && node.isConnected) return; 26302 ref.current = null; 26303 onChange?.(null); 26304 }; 26305 } 26306 ref(node); 26307 untrack(() => onChange?.(node)); 26308 return () => { 26309 if ("isConnected" in node && node.isConnected) return; 26310 ref(null); 26311 onChange?.(null); 26312 }; 26313 } }; 26314 } 26315 //#endregion 26316 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/attrs.js 26317 function boolToStr(condition) { 26318 return condition ? "true" : "false"; 26319 } 26320 function boolToStrTrueOrUndef(condition) { 26321 return condition ? "true" : void 0; 26322 } 26323 function boolToEmptyStrOrUndef(condition) { 26324 return condition ? "" : void 0; 26325 } 26326 function getDataOpenClosed(condition) { 26327 return condition ? "open" : "closed"; 26328 } 26329 function getDataTransitionAttrs(state) { 26330 if (state === "starting") return { "data-starting-style": "" }; 26331 if (state === "ending") return { "data-ending-style": "" }; 26332 return {}; 26333 } 26334 var BitsAttrs = class { 26335 #variant; 26336 #prefix; 26337 attrs; 26338 constructor(config) { 26339 this.#variant = config.getVariant ? config.getVariant() : null; 26340 this.#prefix = this.#variant ? `data-${this.#variant}-` : `data-${config.component}-`; 26341 this.getAttr = this.getAttr.bind(this); 26342 this.selector = this.selector.bind(this); 26343 this.attrs = Object.fromEntries(config.parts.map((part) => [part, this.getAttr(part)])); 26344 } 26345 getAttr(part, variantOverride) { 26346 if (variantOverride) return `data-${variantOverride}-${part}`; 26347 return `${this.#prefix}${part}`; 26348 } 26349 selector(part, variantOverride) { 26350 return `[${this.getAttr(part, variantOverride)}]`; 26351 } 26352 }; 26353 function createBitsAttrs(config) { 26354 const bitsAttrs = new BitsAttrs(config); 26355 return { 26356 ...bitsAttrs.attrs, 26357 selector: bitsAttrs.selector, 26358 getAttr: bitsAttrs.getAttr 26359 }; 26360 } 26361 //#endregion 26362 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/kbd-constants.js 26363 var ARROW_DOWN = "ArrowDown"; 26364 var ARROW_LEFT = "ArrowLeft"; 26365 var ARROW_RIGHT = "ArrowRight"; 26366 var ARROW_UP = "ArrowUp"; 26367 var BACKSPACE = "Backspace"; 26368 var ENTER = "Enter"; 26369 //#endregion 26370 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/is.js 26371 var isBrowser = typeof document !== "undefined"; 26372 var isIOS = getIsIOS(); 26373 function getIsIOS() { 26374 return isBrowser && window?.navigator?.userAgent && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent)); 26375 } 26376 function isHTMLElement$1(element) { 26377 return element instanceof HTMLElement; 26378 } 26379 function isElement$1(element) { 26380 return element instanceof Element; 26381 } 26382 function isElementOrSVGElement(element) { 26383 return element instanceof Element || element instanceof SVGElement; 26384 } 26385 function isNumberString(value) { 26386 return !Number.isNaN(Number(value)) && !Number.isNaN(Number.parseFloat(value)); 26387 } 26388 function isNull(value) { 26389 return value === null; 26390 } 26391 function isTouch(e) { 26392 return e.pointerType === "touch"; 26393 } 26394 function isNotNull(value) { 26395 return value !== null; 26396 } 26397 //#endregion 26398 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/animations-complete.js 26399 var AnimationsComplete = class { 26400 #opts; 26401 #currentFrame = null; 26402 #observer = null; 26403 #runId = 0; 26404 constructor(opts) { 26405 this.#opts = opts; 26406 onDestroyEffect(() => this.#cleanup()); 26407 } 26408 #cleanup() { 26409 if (this.#currentFrame !== null) { 26410 window.cancelAnimationFrame(this.#currentFrame); 26411 this.#currentFrame = null; 26412 } 26413 this.#observer?.disconnect(); 26414 this.#observer = null; 26415 this.#runId++; 26416 } 26417 run(fn) { 26418 this.#cleanup(); 26419 const node = this.#opts.ref.current; 26420 if (!node) return; 26421 if (typeof node.getAnimations !== "function") { 26422 this.#executeCallback(fn); 26423 return; 26424 } 26425 const runId = this.#runId; 26426 const executeIfCurrent = () => { 26427 if (runId !== this.#runId) return; 26428 this.#executeCallback(fn); 26429 }; 26430 const waitForAnimations = () => { 26431 if (runId !== this.#runId) return; 26432 const animations = node.getAnimations(); 26433 if (animations.length === 0) { 26434 executeIfCurrent(); 26435 return; 26436 } 26437 Promise.all(animations.map((animation) => animation.finished)).then(() => { 26438 executeIfCurrent(); 26439 }).catch(() => { 26440 if (runId !== this.#runId) return; 26441 if (node.getAnimations().some((animation) => animation.pending || animation.playState !== "finished")) { 26442 waitForAnimations(); 26443 return; 26444 } 26445 executeIfCurrent(); 26446 }); 26447 }; 26448 const requestWaitForAnimations = () => { 26449 this.#currentFrame = window.requestAnimationFrame(() => { 26450 this.#currentFrame = null; 26451 waitForAnimations(); 26452 }); 26453 }; 26454 if (!this.#opts.afterTick.current) { 26455 requestWaitForAnimations(); 26456 return; 26457 } 26458 this.#currentFrame = window.requestAnimationFrame(() => { 26459 this.#currentFrame = null; 26460 const startingStyleAttr = "data-starting-style"; 26461 if (!node.hasAttribute(startingStyleAttr)) { 26462 requestWaitForAnimations(); 26463 return; 26464 } 26465 this.#observer = new MutationObserver(() => { 26466 if (runId !== this.#runId) return; 26467 if (node.hasAttribute(startingStyleAttr)) return; 26468 this.#observer?.disconnect(); 26469 this.#observer = null; 26470 requestWaitForAnimations(); 26471 }); 26472 this.#observer.observe(node, { 26473 attributes: true, 26474 attributeFilter: [startingStyleAttr] 26475 }); 26476 }); 26477 } 26478 #executeCallback(fn) { 26479 const execute = () => { 26480 fn(); 26481 }; 26482 if (this.#opts.afterTick) afterTick(execute); 26483 else execute(); 26484 } 26485 }; 26486 //#endregion 26487 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/presence-manager.svelte.js 26488 var PresenceManager = class { 26489 #opts; 26490 #enabled; 26491 #afterAnimations; 26492 #shouldRender = /* @__PURE__ */ state(false); 26493 #transitionStatus = /* @__PURE__ */ state(void 0); 26494 #hasMounted = false;
26495 #transitionFrame = null; 26496 constructor(opts) { 26497 this.#opts = opts; 26498 set(this.#shouldRender, opts.open.current, true); 26499 this.#enabled = opts.enabled ?? true; 26500 this.#afterAnimations = new AnimationsComplete({ 26501 ref: this.#opts.ref, 26502 afterTick: this.#opts.open 26503 }); 26504 onDestroyEffect(() => this.#clearTransitionFrame()); 26505 watch(() => this.#opts.open.current, (isOpen) => { 26506 if (!this.#hasMounted) { 26507 this.#hasMounted = true; 26508 return; 26509 } 26510 this.#clearTransitionFrame(); 26511 if (!isOpen && this.#opts.shouldSkipExitAnimation?.()) { 26512 set(this.#shouldRender, false); 26513 set(this.#transitionStatus, void 0); 26514 this.#opts.onComplete?.(); 26515 return; 26516 } 26517 if (isOpen) set(this.#shouldRender, true); 26518 set(this.#transitionStatus, isOpen ? "starting" : "ending", true); 26519 if (isOpen) this.#transitionFrame = window.requestAnimationFrame(() => { 26520 this.#transitionFrame = null; 26521 if (this.#opts.open.current) set(this.#transitionStatus, void 0); 26522 }); 26523 if (!this.#enabled) { 26524 if (!isOpen) set(this.#shouldRender, false); 26525 set(this.#transitionStatus, void 0); 26526 this.#opts.onComplete?.(); 26527 return; 26528 } 26529 this.#afterAnimations.run(() => { 26530 if (isOpen === this.#opts.open.current) { 26531 if (!this.#opts.open.current) set(this.#shouldRender, false); 26532 set(this.#transitionStatus, void 0); 26533 this.#opts.onComplete?.(); 26534 } 26535 }); 26536 }); 26537 } 26538 get shouldRender() { 26539 return get$2(this.#shouldRender); 26540 } 26541 get transitionStatus() { 26542 return get$2(this.#transitionStatus); 26543 } 26544 #clearTransitionFrame() { 26545 if (this.#transitionFrame === null) return; 26546 window.cancelAnimationFrame(this.#transitionFrame); 26547 this.#transitionFrame = null; 26548 } 26549 }; 26550 //#endregion 26551 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/noop.js 26552 /** 26553 * A no operation function (does nothing) 26554 */ 26555 function noop() {} 26556 //#endregion 26557 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/create-id.js 26558 function createId(prefixOrUid, uid) { 26559 if (uid === void 0) return `bits-${prefixOrUid}`; 26560 return `bits-${prefixOrUid}-${uid}`; 26561 } 26562 //#endregion 26563 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/config/bits-config.js 26564 var BitsConfigContext = new Context("BitsConfig"); 26565 /** 26566 * Gets the current Bits UI configuration state from the context. 26567 * 26568 * Returns a default configuration (where all values are `undefined`) if no configuration is found. 26569 */ 26570 function getBitsConfig() { 26571 const fallback = new BitsConfigState(null, {}); 26572 return BitsConfigContext.getOr(fallback).opts; 26573 } 26574 /** 26575 * Configuration state that inherits from parent configurations. 26576 * 26577 * @example 26578 * Config resolution: 26579 * ``` 26580 * Level 1: { defaultPortalTo: "#some-element", theme: "dark" } 26581 * Level 2: { spacing: "large" } // inherits defaultPortalTo="#some-element", theme="dark" 26582 * Level 3: { theme: "light" } // inherits defaultPortalTo="#some-element", spacing="large", overrides theme="light" 26583 * ``` 26584 */ 26585 var BitsConfigState = class { 26586 opts; 26587 constructor(parent, opts) { 26588 const resolveConfigOption = createConfigResolver(parent, opts); 26589 this.opts = { 26590 defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo), 26591 defaultLocale: resolveConfigOption((config) => config.defaultLocale) 26592 }; 26593 } 26594 }; 26595 /** 26596 * Returns a config resolver that resolves a given config option's value. 26597 * 26598 * The resolver creates reactive boxes that resolve config option values using this priority: 26599 * 1. Current level's value (if defined) 26600 * 2. Parent level's value (if defined and current is undefined) 26601 * 3. `undefined` (if no value is found in either parent or child) 26602 * 26603 * @param parent - Parent configuration state (null if this is root level) 26604 * @param currentOpts - Current level's configuration options 26605 * 26606 * @example 26607 * ```typescript 26608 * // Given this hierarchy: 26609 * // Root: { defaultPortalTo: "#some-element" } 26610 * // Child: { someOtherProp: "value" } // no defaultPortalTo specified 26611 * 26612 * const resolveConfigOption = createConfigResolver(parent, opts);
26613 * const portalTo = resolveConfigOption(config => config.defaultPortalTo); 26614 * 26615 * // portalTo.current === "#some-element" (inherited from parent) 26616 * // even when child didn't specify `defaultPortalTo` 26617 * ``` 26618 */ 26619 function createConfigResolver(parent, currentOpts) { 26620 return (getter) => { 26621 return boxWith(() => { 26622 const value = getter(currentOpts)?.current; 26623 if (value !== void 0) return value; 26624 if (parent === null) return void 0; 26625 return getter(parent.opts)?.current; 26626 }); 26627 }; 26628 } 26629 //#endregion 26630 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/config/prop-resolvers.js 26631 /** 26632 * Creates a generic prop resolver that follows a standard priority chain: 26633 * 1. The getter's prop value (if defined) 26634 * 2. The config default value (if no getter prop value is defined) 26635 * 3. The fallback value (if no config value found) 26636 */ 26637 function createPropResolver(configOption, fallback) { 26638 return (getProp) => { 26639 const config = getBitsConfig(); 26640 return boxWith(() => { 26641 const propValue = getProp(); 26642 if (propValue !== void 0) return propValue; 26643 const option = configOption(config).current; 26644 if (option !== void 0) return option; 26645 return fallback; 26646 }); 26647 }; 26648 } 26649 /** 26650 * Resolves a locale value using the prop, the config default, or a fallback. 26651 * 26652 * Default value: `"en"` 26653 */ 26654 var resolveLocaleProp = createPropResolver((config) => config.defaultLocale, "en"); 26655 //#endregion 26656 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/events.js 26657 /** 26658 * Creates a typed event dispatcher and listener pair for custom events 26659 * @template T - The type of data that will be passed in the event detail 26660 * @param eventName - The name of the custom event 26661 * @param options - CustomEvent options (bubbles, cancelable, etc.) 26662 */ 26663 var CustomEventDispatcher = class { 26664 eventName; 26665 options; 26666 constructor(eventName, options = { 26667 bubbles: true, 26668 cancelable: true 26669 }) { 26670 this.eventName = eventName; 26671 this.options = options; 26672 } 26673 createEvent(detail) { 26674 return new CustomEvent(this.eventName, { 26675 ...this.options, 26676 detail 26677 }); 26678 } 26679 dispatch(element, detail) { 26680 const event = this.createEvent(detail); 26681 element.dispatchEvent(event); 26682 return event; 26683 } 26684 listen(element, callback, options) { 26685 const handler = (event) => { 26686 callback(event); 26687 }; 26688 return on(element, this.eventName, handler, options); 26689 } 26690 }; 26691 //#endregion 26692 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/debounce.js 26693 function debounce(fn, wait = 500) { 26694 let timeout = null; 26695 const debounced = (...args) => { 26696 if (timeout !== null) clearTimeout(timeout); 26697 timeout = setTimeout(() => { 26698 fn(...args); 26699 }, wait); 26700 }; 26701 debounced.destroy = () => { 26702 if (timeout !== null) { 26703 clearTimeout(timeout); 26704 timeout = null; 26705 } 26706 }; 26707 return debounced; 26708 } 26709 //#endregion 26710 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/elements.js 26711 function isOrContainsTarget(node, target) { 26712 return node === target || node.contains(target); 26713 } 26714 function getOwnerDocument(el) { 26715 return el?.ownerDocument ?? document; 26716 } 26717 //#endregion 26718 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/dom.js 26719 /** 26720 * Determines if the click event truly occurred outside the content node. 26721 * This was added to handle password managers and other elements that may be injected 26722 * into the DOM but visually appear inside the content. 26723 */ 26724 function isClickTrulyOutside(event, contentNode) { 26725 const { clientX, clientY } = event; 26726 const rect = contentNode.getBoundingClientRect(); 26727 return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom; 26728 } 26729 //#endregion 26730 //#region ../../node_modules/.pnpm/[email protected]/node_modules/tabbable/dist/index.esm.js 26731 /*! 26732 * tabbable 6.4.0 26733 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 26734 */ 26735 var candidateSelectors = [ 26736 "input:not([inert]):not([inert] *)", 26737 "select:not([inert]):not([inert] *)", 26738 "textarea:not([inert]):not([inert] *)", 26739 "a[href]:not([inert]):not([inert] *)", 26740 "button:not([inert]):not([inert] *)",
26741 "[tabindex]:not(slot):not([inert]):not([inert] *)", 26742 "audio[controls]:not([inert]):not([inert] *)", 26743 "video[controls]:not([inert]):not([inert] *)", 26744 "[contenteditable]:not([contenteditable=\"false\"]):not([inert]):not([inert] *)", 26745 "details>summary:first-of-type:not([inert]):not([inert] *)", 26746 "details:not([inert]):not([inert] *)" 26747 ]; 26748 var candidateSelector = /* #__PURE__ */ candidateSelectors.join(","); 26749 var NoElement = typeof Element === "undefined"; 26750 var matches = NoElement ? function() {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 26751 var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) { 26752 var _element$getRootNode; 26753 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 26754 } : function(element) { 26755 return element === null || element === void 0 ? void 0 : element.ownerDocument; 26756 }; 26757 /** 26758 * Determines if a node is inert or in an inert ancestor. 26759 * @param {Node} [node] 26760 * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to 26761 * see if any of them are inert. If false, only `node` itself is considered. 26762 * @returns {boolean} True if inert itself or by way of being in an inert ancestor. 26763 * False if `node` is falsy. 26764 */ 26765 var _isInert = function isInert(node, lookUp) { 26766 var _node$getAttribute; 26767 if (lookUp === void 0) lookUp = true; 26768 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert"); 26769 return inertAtt === "" || inertAtt === "true" || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode)); 26770 }; 26771 /** 26772 * Determines if a node's content is editable. 26773 * @param {Element} [node] 26774 * @returns True if it's content-editable; false if it's not or `node` is falsy. 26775 */ 26776 var isContentEditable = function isContentEditable(node) { 26777 var _node$getAttribute2; 26778 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable"); 26779 return attValue === "" || attValue === "true"; 26780 }; 26781 /** 26782 * @param {Element} el container to check in 26783 * @param {boolean} includeContainer add container to check 26784 * @param {(node: Element) => boolean} filter filter candidates 26785 * @returns {Element[]} 26786 */ 26787 var getCandidates = function getCandidates(el, includeContainer, filter) { 26788 if (_isInert(el)) return []; 26789 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 26790 if (includeContainer && matches.call(el, candidateSelector)) candidates.unshift(el); 26791 candidates = candidates.filter(filter); 26792 return candidates; 26793 }; 26794 /** 26795 * @callback GetShadowRoot 26796 * @param {Element} element to check for shadow root 26797 * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available. 26798 */ 26799 /** 26800 * @callback ShadowRootFilter 26801 * @param {Element} shadowHostNode the element which contains shadow content 26802 * @returns {boolean} true if a shadow root could potentially contain valid candidates. 26803 */ 26804 /** 26805 * @typedef {Object} CandidateScope 26806 * @property {Element} scopeParent contains inner candidates 26807 * @property {Element[]} candidates list of candidates found in the scope parent 26808 */ 26809 /** 26810 * @typedef {Object} IterativeOptions 26811 * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not; 26812 * if a function, implies shadow support is enabled and either returns the shadow root of an element 26813 * or a boolean stating if it has an undisclosed shadow root 26814 * @property {(node: Element) => boolean} filter filter candidates 26815 * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list 26816 * @property {ShadowRootFilter} shadowRootFilter filter shadow roots; 26817 */ 26818 /** 26819 * @param {Element[]} elements list of element containers to match candidates from 26820 * @param {boolean} includeContainer add container list to check 26821 * @param {IterativeOptions} options 26822 * @returns {Array.<Element|CandidateScope>} 26823 */
26824 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 26825 var candidates = []; 26826 var elementsToCheck = Array.from(elements); 26827 while (elementsToCheck.length) { 26828 var element = elementsToCheck.shift(); 26829 if (_isInert(element, false)) continue; 26830 if (element.tagName === "SLOT") { 26831 var assigned = element.assignedElements(); 26832 var nestedCandidates = _getCandidatesIteratively(assigned.length ? assigned : element.children, true, options); 26833 if (options.flatten) candidates.push.apply(candidates, nestedCandidates); 26834 else candidates.push({ 26835 scopeParent: element, 26836 candidates: nestedCandidates 26837 }); 26838 } else { 26839 if (matches.call(element, candidateSelector) && options.filter(element) && (includeContainer || !elements.includes(element))) candidates.push(element); 26840 var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element); 26841 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 26842 if (shadowRoot && validShadowRoot) { 26843 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 26844 if (options.flatten) candidates.push.apply(candidates, _nestedCandidates); 26845 else candidates.push({ 26846 scopeParent: element, 26847 candidates: _nestedCandidates 26848 }); 26849 } else elementsToCheck.unshift.apply(elementsToCheck, element.children); 26850 } 26851 } 26852 return candidates; 26853 }; 26854 /** 26855 * @private 26856 * Determines if the node has an explicitly specified `tabindex` attribute. 26857 * @param {HTMLElement} node 26858 * @returns {boolean} True if so; false if not. 26859 */ 26860 var hasTabIndex = function hasTabIndex(node) { 26861 return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); 26862 }; 26863 /** 26864 * Determine the tab index of a given node. 26865 * @param {HTMLElement} node 26866 * @returns {number} Tab order (negative, 0, or positive number). 26867 * @throws {Error} If `node` is falsy. 26868 */ 26869 var getTabIndex = function getTabIndex(node) { 26870 if (!node) throw new Error("No node provided"); 26871 if (node.tabIndex < 0) { 26872 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) return 0; 26873 } 26874 return node.tabIndex; 26875 }; 26876 /** 26877 * Determine the tab index of a given node __for sort order purposes__. 26878 * @param {HTMLElement} node 26879 * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default, 26880 * has tabIndex -1, but needs to be sorted by document order in order for its content to be 26881 * inserted into the correct sort position. 26882 * @returns {number} Tab order (negative, 0, or positive number). 26883 */ 26884 var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) { 26885 var tabIndex = getTabIndex(node); 26886 if (tabIndex < 0 && isScope && !hasTabIndex(node)) return 0; 26887 return tabIndex; 26888 }; 26889 var sortOrderedTabbables = function sortOrderedTabbables(a, b) { 26890 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; 26891 }; 26892 var isInput = function isInput(node) { 26893 return node.tagName === "INPUT"; 26894 }; 26895 var isHiddenInput = function isHiddenInput(node) { 26896 return isInput(node) && node.type === "hidden"; 26897 }; 26898 var isDetailsWithSummary = function isDetailsWithSummary(node) { 26899 return node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) { 26900 return child.tagName === "SUMMARY"; 26901 }); 26902 }; 26903 var getCheckedRadio = function getCheckedRadio(nodes, form) { 26904 for (var i = 0; i < nodes.length; i++) if (nodes[i].checked && nodes[i].form === form) return nodes[i]; 26905 }; 26906 var isTabbableRadio = function isTabbableRadio(node) { 26907 if (!node.name) return true; 26908 var radioScope = node.form || getRootNode(node); 26909 var queryRadios = function queryRadios(name) { 26910 return radioScope.querySelectorAll("input[type=\"radio\"][name=\"" + name + "\"]"); 26911 }; 26912 var radioSet; 26913 if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") radioSet = queryRadios(window.CSS.escape(node.name)); 26914 else try { 26915 radioSet = queryRadios(node.name); 26916 } catch (err) { 26917 console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message); 26918 return false;
26919 } 26920 var checked = getCheckedRadio(radioSet, node.form); 26921 return !checked || checked === node; 26922 }; 26923 var isRadio = function isRadio(node) { 26924 return isInput(node) && node.type === "radio"; 26925 }; 26926 var isNonTabbableRadio = function isNonTabbableRadio(node) { 26927 return isRadio(node) && !isTabbableRadio(node); 26928 }; 26929 var isNodeAttached = function isNodeAttached(node) { 26930 var _nodeRoot; 26931 var nodeRoot = node && getRootNode(node); 26932 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 26933 var attached = false; 26934 if (nodeRoot && nodeRoot !== node) { 26935 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 26936 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); 26937 while (!attached && nodeRootHost) { 26938 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 26939 nodeRoot = getRootNode(nodeRootHost); 26940 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 26941 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 26942 } 26943 } 26944 return attached; 26945 }; 26946 var isZeroArea = function isZeroArea(node) { 26947 var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; 26948 return width === 0 && height === 0; 26949 }; 26950 var isHidden = function isHidden(node, _ref) { 26951 var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; 26952 if (displayCheck === "full-native") { 26953 if ("checkVisibility" in node) return !node.checkVisibility({ 26954 checkOpacity: false, 26955 opacityProperty: false, 26956 contentVisibilityAuto: true, 26957 visibilityProperty: true, 26958 checkVisibilityCSS: true 26959 }); 26960 } 26961 if (getComputedStyle(node).visibility === "hidden") return true; 26962 var nodeUnderDetails = matches.call(node, "details>summary:first-of-type") ? node.parentElement : node; 26963 if (matches.call(nodeUnderDetails, "details:not([open]) *")) return true; 26964 if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") { 26965 if (typeof getShadowRoot === "function") { 26966 var originalNode = node; 26967 while (node) { 26968 var parentElement = node.parentElement; 26969 var rootNode = getRootNode(node); 26970 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) return isZeroArea(node); 26971 else if (node.assignedSlot) node = node.assignedSlot; 26972 else if (!parentElement && rootNode !== node.ownerDocument) node = rootNode.host; 26973 else node = parentElement; 26974 } 26975 node = originalNode; 26976 } 26977 if (isNodeAttached(node)) return !node.getClientRects().length; 26978 if (displayCheck !== "legacy-full") return true; 26979 } else if (displayCheck === "non-zero-area") return isZeroArea(node); 26980 return false; 26981 }; 26982 var isDisabledFromFieldset = function isDisabledFromFieldset(node) { 26983 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 26984 var parentNode = node.parentElement; 26985 while (parentNode) { 26986 if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { 26987 for (var i = 0; i < parentNode.children.length; i++) { 26988 var child = parentNode.children.item(i); 26989 if (child.tagName === "LEGEND") return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node); 26990 } 26991 return true; 26992 } 26993 parentNode = parentNode.parentElement; 26994 } 26995 } 26996 return false; 26997 }; 26998 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) { 26999 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) return false;
27000 return true; 27001 }; 27002 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) { 27003 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) return false; 27004 return true; 27005 }; 27006 var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) { 27007 var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); 27008 if (isNaN(tabIndex) || tabIndex >= 0) return true; 27009 return false; 27010 }; 27011 /** 27012 * @param {Array.<Element|CandidateScope>} candidates 27013 * @returns Element[] 27014 */ 27015 var _sortByOrder = function sortByOrder(candidates) { 27016 var regularTabbables = []; 27017 var orderedTabbables = []; 27018 candidates.forEach(function(item, i) { 27019 var isScope = !!item.scopeParent; 27020 var element = isScope ? item.scopeParent : item; 27021 var candidateTabindex = getSortOrderTabIndex(element, isScope); 27022 var elements = isScope ? _sortByOrder(item.candidates) : element; 27023 if (candidateTabindex === 0) isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 27024 else orderedTabbables.push({ 27025 documentOrder: i, 27026 tabIndex: candidateTabindex, 27027 item, 27028 isScope, 27029 content: elements 27030 }); 27031 }); 27032 return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { 27033 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 27034 return acc; 27035 }, []).concat(regularTabbables); 27036 }; 27037 var tabbable = function tabbable(container, options) { 27038 options = options || {}; 27039 var candidates; 27040 if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, { 27041 filter: isNodeMatchingSelectorTabbable.bind(null, options), 27042 flatten: false, 27043 getShadowRoot: options.getShadowRoot, 27044 shadowRootFilter: isShadowRootTabbable 27045 }); 27046 else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 27047 return _sortByOrder(candidates); 27048 }; 27049 var focusable = function focusable(container, options) { 27050 options = options || {}; 27051 var candidates; 27052 if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, { 27053 filter: isNodeMatchingSelectorFocusable.bind(null, options), 27054 flatten: true, 27055 getShadowRoot: options.getShadowRoot 27056 }); 27057 else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); 27058 return candidates; 27059 }; 27060 var isTabbable = function isTabbable(node, options) { 27061 options = options || {}; 27062 if (!node) throw new Error("No node provided"); 27063 if (matches.call(node, candidateSelector) === false) return false; 27064 return isNodeMatchingSelectorTabbable(options, node); 27065 }; 27066 var focusableCandidateSelector = /* #__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(","); 27067 var isFocusable = function isFocusable(node, options) { 27068 options = options || {}; 27069 if (!node) throw new Error("No node provided"); 27070 if (matches.call(node, focusableCandidateSelector) === false) return false; 27071 return isNodeMatchingSelectorFocusable(options, node); 27072 }; 27073 //#endregion 27074 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/arrays.js 27075 /** 27076 * Splits an array into chunks of a given size. 27077 * @param arr The array to split. 27078 * @param size The size of each chunk. 27079 * @returns An array of arrays, where each sub-array has `size` elements from the original array. 27080 * @example ```ts 27081 * const arr = [1, 2, 3, 4, 5, 6, 7, 8]; 27082 * const chunks = chunk(arr, 3); 27083 * // chunks = [[1, 2, 3], [4, 5, 6], [7, 8]] 27084 * ``` 27085 */ 27086 function chunk(arr, size) { 27087 if (size <= 0) return []; 27088 const result = []; 27089 for (let i = 0; i < arr.length; i += size) result.push(arr.slice(i, i + size)); 27090 return result; 27091 } 27092 /** 27093 * Checks if the given index is valid for the given array. 27094 * 27095 * @param index - The index to check 27096 * @param arr - The array to check 27097 */ 27098 function isValidIndex(index, arr) { 27099 return index >= 0 && index < arr.length; 27100 } 27101 //#endregion 27102 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/menu/menu.svelte.js 27103 var CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger"; 27104 var CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content"; 27105 new Context("Menu.Root"); 27106 new Context("Menu.Root | Menu.Sub"); 27107 new Context("Menu.Content"); 27108 new Context("Menu.Group | Menu.RadioGroup"); 27109 new Context("Menu.RadioGroup"); 27110 new Context("Menu.CheckboxGroup"); 27111 new CustomEventDispatcher("bitsmenuopen", { 27112 bubbles: false, 27113 cancelable: true 27114 }); 27115 createBitsAttrs({ 27116 component: "menu", 27117 parts: [ 27118 "trigger", 27119 "content", 27120 "sub-trigger", 27121 "item", 27122 "group", 27123 "group-heading", 27124 "checkbox-group", 27125 "checkbox-item", 27126 "radio-group", 27127 "radio-item", 27128 "separator", 27129 "sub-content", 27130 "arrow" 27131 ] 27132 }); 27133 //#endregion 27134 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js 27135 globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map(); 27136 var DismissibleLayerState = class DismissibleLayerState { 27137 static create(opts) { 27138 return new DismissibleLayerState(opts); 27139 } 27140 opts; 27141 #interactOutsideProp; 27142 #behaviorType; 27143 #interceptedEvents = { pointerdown: false }; 27144 #isResponsibleLayer = false;
27145 #isFocusInsideDOMTree = false; 27146 #documentObj = void 0; 27147 #onFocusOutside; 27148 #unsubClickListener = noop; 27149 constructor(opts) { 27150 this.opts = opts; 27151 this.#behaviorType = opts.interactOutsideBehavior; 27152 this.#interactOutsideProp = opts.onInteractOutside; 27153 this.#onFocusOutside = opts.onFocusOutside; 27154 user_effect(() => { 27155 this.#documentObj = getOwnerDocument(this.opts.ref.current); 27156 }); 27157 let unsubEvents = noop; 27158 const cleanup = () => { 27159 this.#resetState(); 27160 globalThis.bitsDismissableLayers.delete(this); 27161 this.#handleInteractOutside.destroy(); 27162 unsubEvents(); 27163 }; 27164 watch([() => this.opts.enabled.current, () => this.opts.ref.current], () => { 27165 if (!this.opts.enabled.current || !this.opts.ref.current) return; 27166 afterSleep(1, () => { 27167 if (!this.opts.ref.current) return; 27168 globalThis.bitsDismissableLayers.set(this, this.#behaviorType); 27169 unsubEvents(); 27170 unsubEvents = this.#addEventListeners(); 27171 }); 27172 return cleanup; 27173 }); 27174 onDestroyEffect(() => { 27175 this.#resetState.destroy(); 27176 globalThis.bitsDismissableLayers.delete(this); 27177 this.#handleInteractOutside.destroy(); 27178 this.#unsubClickListener(); 27179 unsubEvents(); 27180 }); 27181 } 27182 #handleFocus = (event) => { 27183 if (event.defaultPrevented) return; 27184 if (!this.opts.ref.current) return; 27185 afterTick(() => { 27186 if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return; 27187 if (event.target && !this.#isFocusInsideDOMTree) this.#onFocusOutside.current?.(event); 27188 }); 27189 }; 27190 #addEventListeners() { 27191 return executeCallbacks( 27192 /** 27193 * CAPTURE INTERACTION START 27194 * mark interaction-start event as intercepted. 27195 * mark responsible layer during interaction start 27196 * to avoid checking if is responsible layer during interaction end 27197 * when a new floating element may have been opened. 27198 */ 27199 on(this.#documentObj, "pointerdown", executeCallbacks(this.#markInterceptedEvent, this.#markResponsibleLayer), { capture: true }), 27200 /** 27201 * BUBBLE INTERACTION START 27202 * Mark interaction-start event as non-intercepted. Debounce `onInteractOutsideStart` 27203 * to avoid prematurely checking if other events were intercepted. 27204 */ 27205 on(this.#documentObj, "pointerdown", executeCallbacks(this.#markNonInterceptedEvent, this.#handleInteractOutside)), 27206 /** 27207 * HANDLE FOCUS OUTSIDE 27208 */ 27209 on(this.#documentObj, "focusin", this.#handleFocus) 27210 ); 27211 } 27212 #handleDismiss = (e) => { 27213 let event = e; 27214 if (event.defaultPrevented) event = createWrappedEvent(e); 27215 this.#interactOutsideProp.current(e); 27216 }; 27217 #handleInteractOutside = debounce((e) => { 27218 if (!this.opts.ref.current) { 27219 this.#unsubClickListener(); 27220 return; 27221 } 27222 const isEventValid = this.opts.isValidEvent.current(e, this.opts.ref.current) || isValidEvent(e, this.opts.ref.current); 27223 if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) { 27224 this.#unsubClickListener(); 27225 return; 27226 } 27227 let event = e; 27228 if (event.defaultPrevented) event = createWrappedEvent(event); 27229 if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") { 27230 this.#unsubClickListener(); 27231 return; 27232 } 27233 if (e.pointerType === "touch") { 27234 this.#unsubClickListener(); 27235 this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true }); 27236 } else this.#interactOutsideProp.current(event); 27237 }, 10); 27238 #markInterceptedEvent = (e) => { 27239 this.#interceptedEvents[e.type] = true; 27240 }; 27241 #markNonInterceptedEvent = (e) => { 27242 this.#interceptedEvents[e.type] = false; 27243 }; 27244 #markResponsibleLayer = () => { 27245 if (!this.opts.ref.current) return; 27246 this.#isResponsibleLayer = isResponsibleLayer(this.opts.ref.current); 27247 }; 27248 #isTargetWithinLayer = (target) => { 27249 if (!this.opts.ref.current) return false; 27250 return isOrContainsTarget(this.opts.ref.current, target); 27251 }; 27252 #resetState = debounce(() => { 27253 for (const eventType in this.#interceptedEvents) this.#interceptedEvents[eventType] = false; 27254 this.#isResponsibleLayer = false; 27255 }, 20); 27256 #isAnyEventIntercepted() { 27257 return Object.values(this.#interceptedEvents).some(Boolean); 27258 } 27259 #onfocuscapture = () => { 27260 this.#isFocusInsideDOMTree = true; 27261 }; 27262 #onblurcapture = () => { 27263 this.#isFocusInsideDOMTree = false;
27264 }; 27265 props = { 27266 onfocuscapture: this.#onfocuscapture, 27267 onblurcapture: this.#onblurcapture 27268 }; 27269 }; 27270 function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) { 27271 return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore"); 27272 } 27273 function isResponsibleLayer(node) { 27274 const layersArr = [...globalThis.bitsDismissableLayers]; 27275 /** 27276 * We first check if we can find a top layer with `close` or `ignore`. 27277 * If that top layer was found and matches the provided node, then the node is 27278 * responsible for the outside interaction. Otherwise, we know that all layers defer so 27279 * the first layer is the responsible one. 27280 */ 27281 const topMostLayer = getTopMostDismissableLayer(layersArr); 27282 if (topMostLayer) return topMostLayer[0].opts.ref.current === node; 27283 const [firstLayerNode] = layersArr[0]; 27284 return firstLayerNode.opts.ref.current === node; 27285 } 27286 function isValidEvent(e, node) { 27287 const target = e.target; 27288 if (!isElementOrSVGElement(target)) return false; 27289 const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`)); 27290 const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`)); 27291 if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false; 27292 if ("button" in e && e.button === 0 && targetIsContextMenuTrigger && nodeIsContextMenu) return true; 27293 if (targetIsContextMenuTrigger && nodeIsContextMenu) return false; 27294 return getOwnerDocument(target).documentElement.contains(target) && !isOrContainsTarget(node, target) && isClickTrulyOutside(e, node); 27295 } 27296 function createWrappedEvent(e) { 27297 const capturedCurrentTarget = e.currentTarget; 27298 const capturedTarget = e.target; 27299 let newEvent; 27300 if (e instanceof PointerEvent) newEvent = new PointerEvent(e.type, e); 27301 else newEvent = new PointerEvent("pointerdown", e); 27302 let isPrevented = false; 27303 return new Proxy(newEvent, { get: (target, prop) => { 27304 if (prop === "currentTarget") return capturedCurrentTarget; 27305 if (prop === "target") return capturedTarget; 27306 if (prop === "preventDefault") return () => { 27307 isPrevented = true; 27308 if (typeof target.preventDefault === "function") target.preventDefault(); 27309 }; 27310 if (prop === "defaultPrevented") return isPrevented; 27311 if (prop in target) return target[prop]; 27312 return e[prop]; 27313 } }); 27314 } 27315 //#endregion 27316 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte 27317 function Dismissible_layer($$anchor, $$props) { 27318 push($$props, true); 27319 let interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), onInteractOutside = prop($$props, "onInteractOutside", 7, noop), onFocusOutside = prop($$props, "onFocusOutside", 7, noop), id = prop($$props, "id", 7), children = prop($$props, "children", 7), enabled = prop($$props, "enabled", 7), isValidEvent = prop($$props, "isValidEvent", 7, () => false), ref = prop($$props, "ref", 7); 27320 const dismissibleLayerState = DismissibleLayerState.create({ 27321 id: boxWith(() => id()), 27322 interactOutsideBehavior: boxWith(() => interactOutsideBehavior()), 27323 onInteractOutside: boxWith(() => onInteractOutside()), 27324 enabled: boxWith(() => enabled()), 27325 onFocusOutside: boxWith(() => onFocusOutside()), 27326 isValidEvent: boxWith(() => isValidEvent()), 27327 ref: ref() 27328 }); 27329 var $$exports = { 27330 get interactOutsideBehavior() { 27331 return interactOutsideBehavior(); 27332 }, 27333 set interactOutsideBehavior($$value = "close") { 27334 interactOutsideBehavior($$value); 27335 flushSync(); 27336 }, 27337 get onInteractOutside() { 27338 return onInteractOutside(); 27339 }, 27340 set onInteractOutside($$value = noop) { 27341 onInteractOutside($$value); 27342 flushSync(); 27343 }, 27344 get onFocusOutside() { 27345 return onFocusOutside(); 27346 }, 27347 set onFocusOutside($$value = noop) { 27348 onFocusOutside($$value); 27349 flushSync(); 27350 }, 27351 get id() { 27352 return id(); 27353 }, 27354 set id($$value) { 27355 id($$value); 27356 flushSync(); 27357 }, 27358 get children() { 27359 return children(); 27360 }, 27361 set children($$value) { 27362 children($$value); 27363 flushSync(); 27364 }, 27365 get enabled() { 27366 return enabled(); 27367 }, 27368 set enabled($$value) { 27369 enabled($$value); 27370 flushSync(); 27371 }, 27372 get isValidEvent() { 27373 return isValidEvent(); 27374 }, 27375 set isValidEvent($$value = () => false) { 27376 isValidEvent($$value); 27377 flushSync(); 27378 }, 27379 get ref() { 27380 return ref(); 27381 }, 27382 set ref($$value) { 27383 ref($$value); 27384 flushSync(); 27385 } 27386 }; 27387 var fragment = comment(); 27388 snippet(first_child(fragment), () => children() ?? noop$1, () => ({ props: dismissibleLayerState.props })); 27389 append($$anchor, fragment); 27390 return pop($$exports); 27391 }
27392 create_custom_element(Dismissible_layer, { 27393 interactOutsideBehavior: {}, 27394 onInteractOutside: {}, 27395 onFocusOutside: {}, 27396 id: {}, 27397 children: {}, 27398 enabled: {}, 27399 isValidEvent: {}, 27400 ref: {} 27401 }, [], [], { mode: "open" }); 27402 //#endregion 27403 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js 27404 globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map(); 27405 var EscapeLayerState = class EscapeLayerState { 27406 static create(opts) { 27407 return new EscapeLayerState(opts); 27408 } 27409 opts; 27410 domContext; 27411 constructor(opts) { 27412 this.opts = opts; 27413 this.domContext = new DOMContext(this.opts.ref); 27414 let unsubEvents = noop; 27415 watch(() => opts.enabled.current, (enabled) => { 27416 if (enabled) { 27417 globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior); 27418 unsubEvents = this.#addEventListener(); 27419 } 27420 return () => { 27421 unsubEvents(); 27422 globalThis.bitsEscapeLayers.delete(this); 27423 }; 27424 }); 27425 } 27426 #addEventListener = () => { 27427 return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false }); 27428 }; 27429 #onkeydown = (e) => { 27430 if (e.key !== "Escape" || !isResponsibleEscapeLayer(this)) return; 27431 const clonedEvent = new KeyboardEvent(e.type, e); 27432 e.preventDefault(); 27433 const behaviorType = this.opts.escapeKeydownBehavior.current; 27434 if (behaviorType !== "close" && behaviorType !== "defer-otherwise-close") return; 27435 this.opts.onEscapeKeydown.current(clonedEvent); 27436 }; 27437 }; 27438 function isResponsibleEscapeLayer(instance) { 27439 const layersArr = [...globalThis.bitsEscapeLayers]; 27440 /** 27441 * We first check if we can find a top layer with `close` or `ignore`. 27442 * If that top layer was found and matches the provided node, then the node is 27443 * responsible for the escape. Otherwise, we know that all layers defer so 27444 * the first layer is the responsible one. 27445 */ 27446 const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore"); 27447 if (topMostLayer) return topMostLayer[0] === instance; 27448 const [firstLayerNode] = layersArr[0]; 27449 return firstLayerNode === instance; 27450 } 27451 //#endregion 27452 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/escape-layer/escape-layer.svelte 27453 function Escape_layer($$anchor, $$props) { 27454 push($$props, true); 27455 let escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7, "close"), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7, noop), children = prop($$props, "children", 7), enabled = prop($$props, "enabled", 7), ref = prop($$props, "ref", 7); 27456 EscapeLayerState.create({ 27457 escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior()), 27458 onEscapeKeydown: boxWith(() => onEscapeKeydown()), 27459 enabled: boxWith(() => enabled()), 27460 ref: ref() 27461 }); 27462 var $$exports = { 27463 get escapeKeydownBehavior() { 27464 return escapeKeydownBehavior(); 27465 }, 27466 set escapeKeydownBehavior($$value = "close") { 27467 escapeKeydownBehavior($$value); 27468 flushSync(); 27469 }, 27470 get onEscapeKeydown() { 27471 return onEscapeKeydown(); 27472 }, 27473 set onEscapeKeydown($$value = noop) { 27474 onEscapeKeydown($$value); 27475 flushSync(); 27476 }, 27477 get children() { 27478 return children(); 27479 }, 27480 set children($$value) { 27481 children($$value); 27482 flushSync(); 27483 }, 27484 get enabled() { 27485 return enabled(); 27486 }, 27487 set enabled($$value) { 27488 enabled($$value); 27489 flushSync(); 27490 }, 27491 get ref() { 27492 return ref(); 27493 }, 27494 set ref($$value) { 27495 ref($$value); 27496 flushSync(); 27497 } 27498 }; 27499 var fragment = comment(); 27500 snippet(first_child(fragment), () => children() ?? noop$1); 27501 append($$anchor, fragment); 27502 return pop($$exports); 27503 } 27504 create_custom_element(Escape_layer, { 27505 escapeKeydownBehavior: {}, 27506 onEscapeKeydown: {}, 27507 children: {}, 27508 enabled: {}, 27509 ref: {} 27510 }, [], [], { mode: "open" }); 27511 //#endregion 27512 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope-manager.js 27513 var FocusScopeManager = class FocusScopeManager { 27514 static instance; 27515 #scopeStack = simpleBox([]); 27516 #focusHistory = /* @__PURE__ */ new WeakMap(); 27517 #preFocusHistory = /* @__PURE__ */ new WeakMap(); 27518 static getInstance() { 27519 if (!this.instance) this.instance = new FocusScopeManager(); 27520 return this.instance; 27521 } 27522 register(scope) { 27523 const current = this.getActive(); 27524 if (current && current !== scope) current.pause(); 27525 const activeElement = document.activeElement; 27526 if (activeElement && activeElement !== document.body) this.#preFocusHistory.set(scope, activeElement); 27527 this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope); 27528 this.#scopeStack.current.unshift(scope); 27529 } 27530 unregister(scope) { 27531 this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope); 27532 const next = this.getActive(); 27533 if (next) next.resume(); 27534 } 27535 getActive() { 27536 return this.#scopeStack.current[0]; 27537 } 27538 setFocusMemory(scope, element) { 27539 this.#focusHistory.set(scope, element); 27540 } 27541 getFocusMemory(scope) { 27542 return this.#focusHistory.get(scope); 27543 } 27544 isActiveScope(scope) { 27545 return this.getActive() === scope; 27546 } 27547 setPreFocusMemory(scope, element) { 27548 this.#preFocusHistory.set(scope, element); 27549 } 27550 getPreFocusMemory(scope) { 27551 return this.#preFocusHistory.get(scope); 27552 } 27553 clearPreFocusMemory(scope) { 27554 this.#preFocusHistory.delete(scope); 27555 } 27556 }; 27557 //#endregion 27558 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte.js 27559 var FocusScope = class FocusScope { 27560 #paused = false;
27561 #container = null; 27562 #manager = FocusScopeManager.getInstance(); 27563 #cleanupFns = []; 27564 #opts; 27565 constructor(opts) { 27566 this.#opts = opts; 27567 } 27568 get paused() { 27569 return this.#paused; 27570 } 27571 pause() { 27572 this.#paused = true; 27573 } 27574 resume() { 27575 this.#paused = false; 27576 } 27577 #cleanup() { 27578 for (const fn of this.#cleanupFns) fn(); 27579 this.#cleanupFns = []; 27580 } 27581 mount(container) { 27582 if (this.#container) this.unmount(); 27583 this.#container = container; 27584 this.#manager.register(this); 27585 this.#setupEventListeners(); 27586 this.#handleOpenAutoFocus(); 27587 } 27588 unmount() { 27589 if (!this.#container) return; 27590 this.#cleanup(); 27591 this.#handleCloseAutoFocus(); 27592 this.#manager.unregister(this); 27593 this.#manager.clearPreFocusMemory(this); 27594 this.#container = null; 27595 } 27596 #handleOpenAutoFocus() { 27597 if (!this.#container) return; 27598 const event = new CustomEvent("focusScope.onOpenAutoFocus", { 27599 bubbles: false, 27600 cancelable: true 27601 }); 27602 this.#opts.onOpenAutoFocus.current(event); 27603 if (!event.defaultPrevented) requestAnimationFrame(() => { 27604 if (!this.#container) return; 27605 const firstTabbable = this.#getFirstTabbable(); 27606 if (firstTabbable) { 27607 firstTabbable.focus(); 27608 this.#manager.setFocusMemory(this, firstTabbable); 27609 } else this.#container.focus(); 27610 }); 27611 } 27612 #handleCloseAutoFocus() { 27613 const event = new CustomEvent("focusScope.onCloseAutoFocus", { 27614 bubbles: false, 27615 cancelable: true 27616 }); 27617 this.#opts.onCloseAutoFocus.current?.(event); 27618 if (!event.defaultPrevented) { 27619 const preFocusedElement = this.#manager.getPreFocusMemory(this); 27620 if (preFocusedElement && document.contains(preFocusedElement)) try { 27621 preFocusedElement.focus(); 27622 } catch { 27623 document.body.focus(); 27624 } 27625 } 27626 } 27627 #setupEventListeners() { 27628 if (!this.#container || !this.#opts.trap.current) return; 27629 const container = this.#container; 27630 const doc = container.ownerDocument; 27631 const handleFocus = (e) => { 27632 if (this.#paused || !this.#manager.isActiveScope(this)) return; 27633 const target = e.target; 27634 if (!target) return; 27635 if (container.contains(target)) this.#manager.setFocusMemory(this, target); 27636 else { 27637 const lastFocused = this.#manager.getFocusMemory(this); 27638 if (lastFocused && container.contains(lastFocused) && isFocusable(lastFocused)) { 27639 e.preventDefault(); 27640 lastFocused.focus(); 27641 } else { 27642 const firstTabbable = this.#getFirstTabbable(); 27643 const firstFocusable = this.#getAllFocusables()[0]; 27644 (firstTabbable || firstFocusable || container).focus(); 27645 } 27646 } 27647 }; 27648 const handleKeydown = (e) => { 27649 if (!this.#opts.loop || this.#paused || e.key !== "Tab") return; 27650 if (!this.#manager.isActiveScope(this)) return; 27651 const tabbables = this.#getTabbables(); 27652 if (tabbables.length === 0) return; 27653 const first = tabbables[0]; 27654 const last = tabbables[tabbables.length - 1]; 27655 if (!e.shiftKey && doc.activeElement === last) { 27656 e.preventDefault(); 27657 first.focus(); 27658 } else if (e.shiftKey && doc.activeElement === first) { 27659 e.preventDefault(); 27660 last.focus(); 27661 } 27662 }; 27663 this.#cleanupFns.push(on(doc, "focusin", handleFocus, { capture: true }), on(container, "keydown", handleKeydown)); 27664 const observer = new MutationObserver(() => { 27665 const lastFocused = this.#manager.getFocusMemory(this); 27666 if (lastFocused && !container.contains(lastFocused)) { 27667 const firstTabbable = this.#getFirstTabbable(); 27668 const firstFocusable = this.#getAllFocusables()[0]; 27669 const elementToFocus = firstTabbable || firstFocusable; 27670 if (elementToFocus) { 27671 elementToFocus.focus(); 27672 this.#manager.setFocusMemory(this, elementToFocus); 27673 } else container.focus(); 27674 } 27675 }); 27676 observer.observe(container, { 27677 childList: true, 27678 subtree: true 27679 }); 27680 this.#cleanupFns.push(() => observer.disconnect()); 27681 } 27682 #getTabbables() { 27683 if (!this.#container) return []; 27684 return tabbable(this.#container, { 27685 includeContainer: false, 27686 getShadowRoot: true 27687 }); 27688 } 27689 #getFirstTabbable() { 27690 return this.#getTabbables()[0] || null; 27691 } 27692 #getAllFocusables() { 27693 if (!this.#container) return []; 27694 return focusable(this.#container, { 27695 includeContainer: false, 27696 getShadowRoot: true 27697 }); 27698 } 27699 static use(opts) { 27700 let scope = null; 27701 watch([() => opts.ref.current, () => opts.enabled.current], ([ref, enabled]) => { 27702 if (ref && enabled) { 27703 if (!scope) scope = new FocusScope(opts); 27704 scope.mount(ref); 27705 } else if (scope) { 27706 scope.unmount(); 27707 scope = null; 27708 } 27709 }); 27710 onDestroyEffect(() => { 27711 scope?.unmount(); 27712 }); 27713 return { get props() { 27714 return { tabindex: -1 }; 27715 } }; 27716 } 27717 }; 27718 //#endregion 27719 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte 27720 function Focus_scope($$anchor, $$props) { 27721 push($$props, true); 27722 let enabled = prop($$props, "enabled", 7, false), trapFocus = prop($$props, "trapFocus", 7, false), loop = prop($$props, "loop", 7, false), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7, noop), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7, noop), focusScope = prop($$props, "focusScope", 7), ref = prop($$props, "ref", 7); 27723 const focusScopeState = FocusScope.use({ 27724 enabled: boxWith(() => enabled()), 27725 trap: boxWith(() => trapFocus()), 27726 loop: loop(), 27727 onCloseAutoFocus: boxWith(() => onCloseAutoFocus()), 27728 onOpenAutoFocus: boxWith(() => onOpenAutoFocus()), 27729 ref: ref() 27730 }); 27731 var $$exports = { 27732 get enabled() { 27733 return enabled(); 27734 }, 27735 set enabled($$value = false) { 27736 enabled($$value); 27737 flushSync(); 27738 }, 27739 get trapFocus() { 27740 return trapFocus(); 27741 }, 27742 set trapFocus($$value = false) { 27743 trapFocus($$value); 27744 flushSync(); 27745 }, 27746 get loop() { 27747 return loop(); 27748 }, 27749 set loop($$value = false) { 27750 loop($$value); 27751 flushSync(); 27752 }, 27753 get onCloseAutoFocus() { 27754 return onCloseAutoFocus(); 27755 }, 27756 set onCloseAutoFocus($$value = noop) { 27757 onCloseAutoFocus($$value); 27758 flushSync(); 27759 }, 27760 get onOpenAutoFocus() { 27761 return onOpenAutoFocus(); 27762 }, 27763 set onOpenAutoFocus($$value = noop) { 27764 onOpenAutoFocus($$value); 27765 flushSync(); 27766 }, 27767 get focusScope() { 27768 return focusScope(); 27769 }, 27770 set focusScope($$value) { 27771 focusScope($$value); 27772 flushSync(); 27773 }, 27774 get ref() { 27775 return ref(); 27776 }, 27777 set ref($$value) { 27778 ref($$value); 27779 flushSync(); 27780 } 27781 }; 27782 var fragment = comment(); 27783 snippet(first_child(fragment), () => focusScope() ?? noop$1, () => ({ props: focusScopeState.props })); 27784 append($$anchor, fragment); 27785 return pop($$exports); 27786 }
27787 create_custom_element(Focus_scope, { 27788 enabled: {}, 27789 trapFocus: {}, 27790 loop: {}, 27791 onCloseAutoFocus: {}, 27792 onOpenAutoFocus: {}, 27793 focusScope: {}, 27794 ref: {} 27795 }, [], [], { mode: "open" }); 27796 //#endregion 27797 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js 27798 var noopPointer = () => {}; 27799 globalThis.bitsTextSelectionLayers ??= /* @__PURE__ */ new Map(); 27800 var TextSelectionLayerState = class TextSelectionLayerState { 27801 static create(opts) { 27802 return new TextSelectionLayerState(opts); 27803 } 27804 opts; 27805 domContext; 27806 #unsubSelectionLock = noop; 27807 #enabledSnapshot = false; 27808 #onPointerDownSnapshot = noopPointer; 27809 #onPointerUpSnapshot = noopPointer; 27810 constructor(opts) { 27811 this.opts = opts; 27812 this.domContext = new DOMContext(opts.ref); 27813 let unsubEvents = noop; 27814 watch(() => [ 27815 this.opts.enabled.current, 27816 this.opts.onPointerDown.current, 27817 this.opts.onPointerUp.current 27818 ], ([enabled, onPointerDown, onPointerUp]) => { 27819 this.#enabledSnapshot = enabled; 27820 this.#onPointerDownSnapshot = onPointerDown; 27821 this.#onPointerUpSnapshot = onPointerUp; 27822 if (enabled) { 27823 globalThis.bitsTextSelectionLayers.set(this, this.opts.enabled); 27824 unsubEvents(); 27825 unsubEvents = this.#addEventListeners(); 27826 } 27827 return () => { 27828 this.#enabledSnapshot = false; 27829 unsubEvents(); 27830 this.#resetSelectionLock(); 27831 globalThis.bitsTextSelectionLayers.delete(this); 27832 }; 27833 }); 27834 } 27835 #addEventListeners() { 27836 return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", composeHandlers(this.#resetSelectionLock, this.#pointerupUserHandler))); 27837 } 27838 #pointerupUserHandler = (e) => { 27839 this.#onPointerUpSnapshot(e); 27840 }; 27841 #pointerdown = (e) => { 27842 const node = this.opts.ref.current; 27843 const target = e.target; 27844 if (!isHTMLElement$1(node) || !isHTMLElement$1(target) || !this.#enabledSnapshot) return; 27845 /** 27846 * We only lock user-selection overflow if layer is the top most layer and 27847 * pointerdown occurred inside the node. You are still allowed to select text 27848 * outside the node provided pointerdown occurs outside the node. 27849 */ 27850 if (!isHighestLayer(this) || !contains$1(node, target)) return; 27851 this.#onPointerDownSnapshot(e); 27852 if (e.defaultPrevented) return; 27853 this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body); 27854 }; 27855 #resetSelectionLock = () => { 27856 this.#unsubSelectionLock(); 27857 this.#unsubSelectionLock = noop; 27858 }; 27859 }; 27860 var getUserSelect = (node) => node.style.userSelect || node.style.webkitUserSelect; 27861 function preventTextSelectionOverflow(node, body) { 27862 const originalBodyUserSelect = getUserSelect(body); 27863 const originalNodeUserSelect = getUserSelect(node); 27864 setUserSelect(body, "none"); 27865 setUserSelect(node, "text"); 27866 return () => { 27867 setUserSelect(body, originalBodyUserSelect); 27868 setUserSelect(node, originalNodeUserSelect); 27869 }; 27870 } 27871 function setUserSelect(node, value) { 27872 node.style.userSelect = value; 27873 node.style.webkitUserSelect = value; 27874 } 27875 function isHighestLayer(instance) { 27876 const layersArr = [...globalThis.bitsTextSelectionLayers]; 27877 if (!layersArr.length) return false; 27878 const highestLayer = layersArr.at(-1); 27879 if (!highestLayer) return false; 27880 return highestLayer[0] === instance; 27881 } 27882 //#endregion 27883 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte 27884 function Text_selection_layer($$anchor, $$props) { 27885 push($$props, true); 27886 let preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7, true), onPointerDown = prop($$props, "onPointerDown", 7, noop), onPointerUp = prop($$props, "onPointerUp", 7, noop), id = prop($$props, "id", 7), children = prop($$props, "children", 7), enabled = prop($$props, "enabled", 7), ref = prop($$props, "ref", 7); 27887 TextSelectionLayerState.create({ 27888 id: boxWith(() => id()), 27889 onPointerDown: boxWith(() => onPointerDown()), 27890 onPointerUp: boxWith(() => onPointerUp()), 27891 enabled: boxWith(() => enabled() && preventOverflowTextSelection()), 27892 ref: ref() 27893 }); 27894 var $$exports = { 27895 get preventOverflowTextSelection() { 27896 return preventOverflowTextSelection(); 27897 }, 27898 set preventOverflowTextSelection($$value = true) { 27899 preventOverflowTextSelection($$value); 27900 flushSync(); 27901 }, 27902 get onPointerDown() { 27903 return onPointerDown(); 27904 }, 27905 set onPointerDown($$value = noop) { 27906 onPointerDown($$value); 27907 flushSync(); 27908 }, 27909 get onPointerUp() { 27910 return onPointerUp(); 27911 }, 27912 set onPointerUp($$value = noop) { 27913 onPointerUp($$value); 27914 flushSync(); 27915 }, 27916 get id() { 27917 return id(); 27918 }, 27919 set id($$value) { 27920 id($$value); 27921 flushSync(); 27922 }, 27923 get children() { 27924 return children(); 27925 }, 27926 set children($$value) { 27927 children($$value); 27928 flushSync(); 27929 }, 27930 get enabled() { 27931 return enabled(); 27932 }, 27933 set enabled($$value) { 27934 enabled($$value); 27935 flushSync(); 27936 }, 27937 get ref() { 27938 return ref(); 27939 }, 27940 set ref($$value) { 27941 ref($$value); 27942 flushSync(); 27943 } 27944 }; 27945 var fragment = comment(); 27946 snippet(first_child(fragment), () => children() ?? noop$1); 27947 append($$anchor, fragment); 27948 return pop($$exports); 27949 }
27950 create_custom_element(Text_selection_layer, { 27951 preventOverflowTextSelection: {}, 27952 onPointerDown: {}, 27953 onPointerUp: {}, 27954 id: {}, 27955 children: {}, 27956 enabled: {}, 27957 ref: {} 27958 }, [], [], { mode: "open" }); 27959 //#endregion 27960 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/use-id.js 27961 globalThis.bitsIdCounter ??= { current: 0 }; 27962 /** 27963 * Generates a unique ID based on a global counter. 27964 */ 27965 function useId(prefix = "bits") { 27966 globalThis.bitsIdCounter.current++; 27967 return `${prefix}-${globalThis.bitsIdCounter.current}`; 27968 } 27969 //#endregion 27970 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/shared-state.svelte.js 27971 var SharedState = class { 27972 #factory; 27973 #subscribers = 0; 27974 #state = /* @__PURE__ */ state(); 27975 #scope; 27976 constructor(factory) { 27977 this.#factory = factory; 27978 } 27979 #dispose() { 27980 this.#subscribers -= 1; 27981 if (this.#scope && this.#subscribers <= 0) { 27982 this.#scope(); 27983 set(this.#state, void 0); 27984 this.#scope = void 0; 27985 } 27986 } 27987 get(...args) { 27988 this.#subscribers += 1; 27989 if (get$2(this.#state) === void 0) this.#scope = effect_root(() => { 27990 set(this.#state, this.#factory(...args), true); 27991 }); 27992 user_effect(() => { 27993 return () => { 27994 this.#dispose(); 27995 }; 27996 }); 27997 return get$2(this.#state); 27998 } 27999 }; 28000 //#endregion 28001 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/body-scroll-lock.svelte.js 28002 var lockMap = new SvelteMap(); 28003 var initialBodyStyle = /* @__PURE__ */ state(null); 28004 var stopTouchMoveListener = null; 28005 var cleanupTimeoutId = null; 28006 var isInCleanupTransition = false; 28007 var anyLocked = boxWith(() => { 28008 for (const value of lockMap.values()) if (value) return true; 28009 return false; 28010 }); 28011 /** 28012 * We track the time we scheduled the cleanup to prevent race conditions 28013 * when multiple locks are created/destroyed in the same tick, ensuring 28014 * only the last one to schedule the cleanup will run. 28015 * 28016 * reference: https://github.com/huntabyte/bits-ui/issues/1639 28017 */ 28018 var cleanupScheduledAt = null; 28019 var bodyLockStackCount = new SharedState(() => { 28020 function resetBodyStyle() { 28021 document.body.setAttribute("style", get$2(initialBodyStyle) ?? ""); 28022 document.body.style.removeProperty("--scrollbar-width"); 28023 isIOS && stopTouchMoveListener?.(); 28024 set(initialBodyStyle, null); 28025 } 28026 function cancelPendingCleanup() { 28027 if (cleanupTimeoutId === null) return; 28028 window.clearTimeout(cleanupTimeoutId); 28029 cleanupTimeoutId = null; 28030 } 28031 function scheduleCleanupIfNoNewLocks(delay, callback) { 28032 cancelPendingCleanup(); 28033 isInCleanupTransition = true; 28034 cleanupScheduledAt = Date.now(); 28035 const currentCleanupId = cleanupScheduledAt; 28036 /** 28037 * We schedule the cleanup to run after a delay to allow new locks to register 28038 * that might have been added in the same tick as the current cleanup. 28039 * 28040 * If a new lock is added in the same tick, the cleanup will be cancelled and 28041 * a new cleanup will be scheduled. 28042 * 28043 * This is to prevent the cleanup from running too early and resetting the body 28044 * style before the new lock has had a chance to apply its styles. 28045 */ 28046 const cleanupFn = () => { 28047 cleanupTimeoutId = null; 28048 if (cleanupScheduledAt !== currentCleanupId) return; 28049 if (!isAnyLocked(lockMap)) { 28050 isInCleanupTransition = false; 28051 callback(); 28052 } else isInCleanupTransition = false; 28053 }; 28054 const actualDelay = delay === null ? 24 : delay; 28055 cleanupTimeoutId = window.setTimeout(cleanupFn, actualDelay); 28056 } 28057 function ensureInitialStyleCaptured() { 28058 if (get$2(initialBodyStyle) === null && lockMap.size === 0 && !isInCleanupTransition) set(initialBodyStyle, document.body.getAttribute("style"), true); 28059 } 28060 watch(() => anyLocked.current, () => { 28061 if (!anyLocked.current) return; 28062 ensureInitialStyleCaptured(); 28063 isInCleanupTransition = false;
28064 const htmlStyle = getComputedStyle(document.documentElement); 28065 const bodyStyle = getComputedStyle(document.body); 28066 const hasStableGutter = htmlStyle.scrollbarGutter?.includes("stable") || bodyStyle.scrollbarGutter?.includes("stable"); 28067 const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 28068 const config = { 28069 padding: Number.parseInt(bodyStyle.paddingRight ?? "0", 10) + verticalScrollbarWidth, 28070 margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10) 28071 }; 28072 if (verticalScrollbarWidth > 0 && !hasStableGutter) { 28073 document.body.style.paddingRight = `${config.padding}px`; 28074 document.body.style.marginRight = `${config.margin}px`; 28075 document.body.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`); 28076 } 28077 document.body.style.overflow = "hidden"; 28078 if (isIOS) stopTouchMoveListener = on(document, "touchmove", (e) => { 28079 if (e.target !== document.documentElement) return; 28080 if (e.touches.length > 1) return; 28081 e.preventDefault(); 28082 }, { passive: false }); 28083 /** 28084 * We ensure pointer-events: none is applied _after_ DOM updates, so that any focus/ 28085 * interaction changes from opening overlays/menus complete _before_ we block pointer 28086 * events. 28087 * 28088 * this avoids race conditions where pointer-events could be set too early and break 28089 * focus/interaction. 28090 */ 28091 afterTick(() => { 28092 document.body.style.pointerEvents = "none"; 28093 document.body.style.overflow = "hidden"; 28094 }); 28095 }); 28096 onDestroyEffect(() => { 28097 return () => { 28098 stopTouchMoveListener?.(); 28099 }; 28100 }); 28101 return { 28102 get lockMap() { 28103 return lockMap; 28104 }, 28105 resetBodyStyle, 28106 scheduleCleanupIfNoNewLocks, 28107 cancelPendingCleanup, 28108 ensureInitialStyleCaptured 28109 }; 28110 }); 28111 var BodyScrollLock = class { 28112 #id = useId(); 28113 #initialState; 28114 #restoreScrollDelay = () => null; 28115 #countState; 28116 locked; 28117 constructor(initialState, restoreScrollDelay = () => null) { 28118 this.#initialState = initialState; 28119 this.#restoreScrollDelay = restoreScrollDelay; 28120 this.#countState = bodyLockStackCount.get(); 28121 if (!this.#countState) return; 28122 /** 28123 * Since a new lock is being created, we cancel any pending cleanup to 28124 * prevent the cleanup from running too early and resetting the body style 28125 * before the new lock has had a chance to apply its styles. 28126 * 28127 * reference: https://github.com/huntabyte/bits-ui/issues/1639 28128 */ 28129 this.#countState.cancelPendingCleanup(); 28130 this.#countState.ensureInitialStyleCaptured(); 28131 this.#countState.lockMap.set(this.#id, this.#initialState ?? false); 28132 this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v)); 28133 onDestroyEffect(() => { 28134 this.#countState.lockMap.delete(this.#id); 28135 if (isAnyLocked(this.#countState.lockMap)) return; 28136 const restoreScrollDelay = this.#restoreScrollDelay(); 28137 /** 28138 * We schedule the cleanup to run after a delay to handle same-tick 28139 * destroy/create scenarios. 28140 * 28141 * reference: https://github.com/huntabyte/bits-ui/issues/1639 28142 */ 28143 this.#countState.scheduleCleanupIfNoNewLocks(restoreScrollDelay, () => { 28144 this.#countState.resetBodyStyle(); 28145 }); 28146 }); 28147 } 28148 }; 28149 function isAnyLocked(map) { 28150 for (const [_, value] of map) if (value) return true; 28151 return false; 28152 } 28153 //#endregion 28154 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/scroll-lock/scroll-lock.svelte 28155 function Scroll_lock($$anchor, $$props) { 28156 push($$props, true); 28157 let preventScroll = prop($$props, "preventScroll", 7, true), restoreScrollDelay = prop($$props, "restoreScrollDelay", 7, null); 28158 if (preventScroll()) new BodyScrollLock(preventScroll(), () => restoreScrollDelay()); 28159 return pop({ 28160 get preventScroll() { 28161 return preventScroll(); 28162 }, 28163 set preventScroll($$value = true) { 28164 preventScroll($$value); 28165 flushSync(); 28166 }, 28167 get restoreScrollDelay() { 28168 return restoreScrollDelay(); 28169 }, 28170 set restoreScrollDelay($$value = null) { 28171 restoreScrollDelay($$value); 28172 flushSync(); 28173 } 28174 }); 28175 }
28176 create_custom_element(Scroll_lock, { 28177 preventScroll: {}, 28178 restoreScrollDelay: {} 28179 }, [], [], { mode: "open" }); 28180 //#endregion 28181 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/announcer.js 28182 /** 28183 * Creates or gets an announcer element which is used to announce messages to screen readers. 28184 * Within the date components, we use this to announce when the values of the individual segments 28185 * change, as without it we get inconsistent behavior across screen readers. 28186 */ 28187 function initAnnouncer(doc) { 28188 if (!isBrowser || !doc) return null; 28189 let el = doc.querySelector("[data-bits-announcer]"); 28190 /** 28191 * Creates a log element for assertive or polite announcements. 28192 */ 28193 const createLog = (kind) => { 28194 const log = doc.createElement("div"); 28195 log.role = "log"; 28196 log.ariaLive = kind; 28197 log.setAttribute("aria-relevant", "additions"); 28198 return log; 28199 }; 28200 if (!isHTMLElement$1(el)) { 28201 const div = doc.createElement("div"); 28202 div.style.cssText = srOnlyStylesString; 28203 div.setAttribute("data-bits-announcer", ""); 28204 div.appendChild(createLog("assertive")); 28205 div.appendChild(createLog("polite")); 28206 el = div; 28207 doc.body.insertBefore(el, doc.body.firstChild); 28208 } 28209 /** 28210 * Retrieves the log element for assertive or polite announcements. 28211 */ 28212 const getLog = (kind) => { 28213 if (!isHTMLElement$1(el)) return null; 28214 const log = el.querySelector(`[aria-live="${kind}"]`); 28215 if (!isHTMLElement$1(log)) return null; 28216 return log; 28217 }; 28218 return { getLog }; 28219 } 28220 /** 28221 * Creates an announcer object that can be used to make `aria-live` announcements to screen readers. 28222 */ 28223 function getAnnouncer(doc) { 28224 const announcer = initAnnouncer(doc); 28225 /** 28226 * Announces a message to screen readers using the specified kind of announcement. 28227 */ 28228 function announce(value, kind = "assertive", timeout = 7500) { 28229 if (!announcer || !isBrowser || !doc) return; 28230 const log = announcer.getLog(kind); 28231 const content = doc.createElement("div"); 28232 if (typeof value === "number") value = value.toString(); 28233 else if (value === null) value = "Empty"; 28234 else value = value.trim(); 28235 content.innerText = value; 28236 if (kind === "assertive") log?.replaceChildren(content); 28237 else log?.appendChild(content); 28238 return setTimeout(() => { 28239 content.remove(); 28240 }, timeout); 28241 } 28242 return { announce }; 28243 } 28244 //#endregion 28245 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/utils.js 28246 var defaultDateDefaults = { 28247 defaultValue: void 0, 28248 granularity: "day" 28249 }; 28250 /** 28251 * A helper function used throughout the various date builders 28252 * to generate a default `DateValue` using the `defaultValue`, 28253 * `defaultPlaceholder`, `minValue`, `maxValue`, and `granularity` props. 28254 * 28255 * It's important to match the `DateValue` type being used 28256 * elsewhere in the builder, so they behave according to the 28257 * behavior the user expects based on the props they've provided. 28258 * 28259 */ 28260 function getDefaultDate(opts) { 28261 const { defaultValue, granularity, minValue, maxValue } = { 28262 ...defaultDateDefaults, 28263 ...opts 28264 }; 28265 if (Array.isArray(defaultValue) && defaultValue.length) return defaultValue[defaultValue.length - 1]; 28266 if (defaultValue && !Array.isArray(defaultValue)) return defaultValue; 28267 else { 28268 let date = /* @__PURE__ */ new Date(); 28269 if (minValue && date < minValue.toDate($ad063034c8620db8$export$aa8b41735afcabd2())) date = minValue.toDate($ad063034c8620db8$export$aa8b41735afcabd2()); 28270 else if (maxValue && date > maxValue.toDate($ad063034c8620db8$export$aa8b41735afcabd2())) date = maxValue.toDate($ad063034c8620db8$export$aa8b41735afcabd2()); 28271 const year = date.getFullYear();
28272 const month = date.getMonth() + 1; 28273 const day = date.getDate(); 28274 if ([ 28275 "hour", 28276 "minute", 28277 "second" 28278 ].includes(granularity ?? "day")) return new $2aaf608024c21ca1$export$ca871e8dbb80966f(year, month, day, 0, 0, 0); 28279 return new $2aaf608024c21ca1$export$99faa760c7908e4f(year, month, day); 28280 } 28281 } 28282 /** 28283 * Given a date string and a reference `DateValue` object, parse the 28284 * string to the same type as the reference object. 28285 * 28286 * Useful for parsing strings from data attributes, which are always 28287 * strings, to the same type being used by the date component. 28288 */ 28289 function parseStringToDateValue(dateStr, referenceVal) { 28290 let dateValue; 28291 if (referenceVal instanceof $2aaf608024c21ca1$export$d3b7288e7994edea) dateValue = $58246871e4652552$export$fd7893f06e92a6a4(dateStr); 28292 else if (referenceVal instanceof $2aaf608024c21ca1$export$ca871e8dbb80966f) dateValue = $58246871e4652552$export$588937bcd60ade55(dateStr); 28293 else dateValue = $58246871e4652552$export$6b862160d295c8e(dateStr); 28294 return dateValue.calendar !== referenceVal.calendar ? $d07e34cce18680fd$export$b4a036af3fc0b032(dateValue, referenceVal.calendar) : dateValue; 28295 } 28296 /** 28297 * Given a `DateValue` object, convert it to a native `Date` object. 28298 * If a timezone is provided, the date will be converted to that timezone. 28299 * If no timezone is provided, the date will be converted to the local timezone. 28300 */ 28301 function toDate(dateValue, tz = $ad063034c8620db8$export$aa8b41735afcabd2()) { 28302 if (dateValue instanceof $2aaf608024c21ca1$export$d3b7288e7994edea) return dateValue.toDate(); 28303 else return dateValue.toDate(tz); 28304 } 28305 function getDateValueType(date) { 28306 if (date instanceof $2aaf608024c21ca1$export$99faa760c7908e4f) return "date"; 28307 if (date instanceof $2aaf608024c21ca1$export$ca871e8dbb80966f) return "datetime"; 28308 if (date instanceof $2aaf608024c21ca1$export$d3b7288e7994edea) return "zoneddatetime"; 28309 throw new Error("Unknown date type"); 28310 } 28311 function parseAnyDateValue(value, type) { 28312 switch (type) { 28313 case "date": return $58246871e4652552$export$6b862160d295c8e(value); 28314 case "datetime": return $58246871e4652552$export$588937bcd60ade55(value); 28315 case "zoneddatetime": return $58246871e4652552$export$fd7893f06e92a6a4(value); 28316 default: throw new Error(`Unknown date type: ${type}`); 28317 } 28318 } 28319 function isCalendarDateTime(dateValue) { 28320 return dateValue instanceof $2aaf608024c21ca1$export$ca871e8dbb80966f; 28321 } 28322 function isZonedDateTime(dateValue) { 28323 return dateValue instanceof $2aaf608024c21ca1$export$d3b7288e7994edea; 28324 } 28325 function hasTime(dateValue) { 28326 return isCalendarDateTime(dateValue) || isZonedDateTime(dateValue); 28327 } 28328 /** 28329 * Given a date, return the number of days in the month. 28330 */ 28331 function getDaysInMonth(date) { 28332 if (date instanceof Date) { 28333 const year = date.getFullYear();
28334 const month = date.getMonth() + 1; 28335 /** 28336 * By using zero as the day, we get the 28337 * last day of the previous month, which 28338 * is the month we originally passed in. 28339 */ 28340 return new Date(year, month, 0).getDate(); 28341 } else return date.set({ day: 100 }).day; 28342 } 28343 /** 28344 * Determine if a date is before the reference date. 28345 * @param dateToCompare - is this date before the `referenceDate` 28346 * @param referenceDate - is the `dateToCompare` before this date 28347 * 28348 * @see {@link isBeforeOrSame} for inclusive 28349 */ 28350 function isBefore(dateToCompare, referenceDate) { 28351 return dateToCompare.compare(referenceDate) < 0; 28352 } 28353 /** 28354 * Determine if a date is after the reference date. 28355 * @param dateToCompare - is this date after the `referenceDate` 28356 * @param referenceDate - is the `dateToCompare` after this date 28357 * 28358 * @see {@link isAfterOrSame} for inclusive 28359 */ 28360 function isAfter(dateToCompare, referenceDate) { 28361 return dateToCompare.compare(referenceDate) > 0; 28362 } 28363 function getLastFirstDayOfWeek(date, firstDayOfWeek, locale) { 28364 const day = $ad063034c8620db8$export$2061056d06d7cdf7(date, locale); 28365 if (firstDayOfWeek > day) return date.subtract({ days: day + 7 - firstDayOfWeek }); 28366 if (firstDayOfWeek === day) return date; 28367 return date.subtract({ days: day - firstDayOfWeek }); 28368 } 28369 function getNextLastDayOfWeek(date, firstDayOfWeek, locale) { 28370 const day = $ad063034c8620db8$export$2061056d06d7cdf7(date, locale); 28371 const lastDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1; 28372 if (day === lastDayOfWeek) return date; 28373 if (day > lastDayOfWeek) return date.add({ days: 7 - day + lastDayOfWeek }); 28374 return date.add({ days: lastDayOfWeek - day }); 28375 } 28376 //#endregion 28377 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/field/parts.js 28378 var DATE_SEGMENT_PARTS = [ 28379 "day", 28380 "month", 28381 "year" 28382 ]; 28383 var EDITABLE_TIME_SEGMENT_PARTS = [ 28384 "hour", 28385 "minute", 28386 "second", 28387 "dayPeriod" 28388 ]; 28389 var NON_EDITABLE_SEGMENT_PARTS = ["literal", "timeZoneName"]; 28390 var EDITABLE_SEGMENT_PARTS = [...DATE_SEGMENT_PARTS, ...EDITABLE_TIME_SEGMENT_PARTS]; 28391 var ALL_SEGMENT_PARTS = [...EDITABLE_SEGMENT_PARTS, ...NON_EDITABLE_SEGMENT_PARTS]; 28392 var ALL_TIME_SEGMENT_PARTS = [...EDITABLE_TIME_SEGMENT_PARTS, ...NON_EDITABLE_SEGMENT_PARTS]; 28393 ALL_SEGMENT_PARTS.filter((part) => part !== "literal"); 28394 ALL_TIME_SEGMENT_PARTS.filter((part) => part !== "literal"); 28395 //#endregion 28396 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/placeholders.js 28397 var supportedLocales = [ 28398 "ach", 28399 "af", 28400 "am", 28401 "an", 28402 "ar", 28403 "ast", 28404 "az", 28405 "be", 28406 "bg", 28407 "bn", 28408 "br", 28409 "bs", 28410 "ca", 28411 "cak", 28412 "ckb", 28413 "cs", 28414 "cy", 28415 "da", 28416 "de", 28417 "dsb", 28418 "el", 28419 "en", 28420 "eo", 28421 "es", 28422 "et", 28423 "eu", 28424 "fa", 28425 "ff", 28426 "fi", 28427 "fr", 28428 "fy", 28429 "ga", 28430 "gd", 28431 "gl", 28432 "he", 28433 "hr", 28434 "hsb", 28435 "hu", 28436 "ia", 28437 "id", 28438 "it", 28439 "ja", 28440 "ka", 28441 "kk", 28442 "kn", 28443 "ko", 28444 "lb", 28445 "lo", 28446 "lt", 28447 "lv", 28448 "meh", 28449 "ml", 28450 "ms", 28451 "nl", 28452 "nn", 28453 "no", 28454 "oc", 28455 "pl", 28456 "pt", 28457 "rm", 28458 "ro", 28459 "ru", 28460 "sc", 28461 "scn", 28462 "sk", 28463 "sl", 28464 "sr", 28465 "sv", 28466 "szl", 28467 "tg", 28468 "th", 28469 "tr", 28470 "uk", 28471 "zh-CN", 28472 "zh-TW" 28473 ]; 28474 var placeholderFields = [ 28475 "year", 28476 "month", 28477 "day" 28478 ]; 28479 var placeholders = { 28480 ach: { 28481 year: "mwaka", 28482 month: "dwe", 28483 day: "nino" 28484 }, 28485 af: { 28486 year: "jjjj", 28487 month: "mm", 28488 day: "dd" 28489 }, 28490 am: { 28491 year: "áááá", 28492 month: "áá", 28493 day: "áá" 28494 }, 28495 an: { 28496 year: "aaaa", 28497 month: "mm", 28498 day: "dd" 28499 }, 28500 ar: { 28501 year: "Ø³ÙØ©", 28502 month: "Ø´ÙØ±", 28503 day: "ÙÙÙ " 28504 }, 28505 ast: { 28506 year: "aaaa", 28507 month: "mm", 28508 day: "dd" 28509 }, 28510 az: { 28511 year: "iiii", 28512 month: "aa", 28513 day: "gg" 28514 }, 28515 be: { 28516 year: "гггг", 28517 month: "мм", 28518 day: "дд" 28519 }, 28520 bg: { 28521 year: "гггг", 28522 month: "мм", 28523 day: "дд" 28524 }, 28525 bn: { 28526 year: "yyyy", 28527 month: "মিমি", 28528 day: "dd" 28529 }, 28530 br: { 28531 year: "bbbb", 28532 month: "mm", 28533 day: "dd" 28534 }, 28535 bs: { 28536 year: "gggg", 28537 month: "mm", 28538 day: "dd" 28539 }, 28540 ca: { 28541 year: "aaaa", 28542 month: "mm", 28543 day: "dd" 28544 }, 28545 cak: { 28546 year: "jjjj", 28547 month: "ii", 28548 day: "q'q'" 28549 }, 28550 ckb: { 28551 year: "ساڵ", 28552 month: "٠اÙÚ¯", 28553 day: "ÚÛÚ" 28554 }, 28555 cs: { 28556 year: "rrrr", 28557 month: "mm", 28558 day: "dd" 28559 }, 28560 cy: { 28561 year: "bbbb", 28562 month: "mm", 28563 day: "dd" 28564 }, 28565 da: { 28566 year: "åååå", 28567 month: "mm", 28568 day: "dd" 28569 }, 28570 de: { 28571 year: "jjjj", 28572 month: "mm", 28573 day: "tt" 28574 }, 28575 dsb: { 28576 year: "llll", 28577 month: "mm", 28578 day: "źź" 28579 }, 28580 el: { 28581 year: "εεεε", 28582 month: "μμ", 28583 day: "ηη" 28584 }, 28585 en: { 28586 year: "yyyy", 28587 month: "mm", 28588 day: "dd" 28589 }, 28590 eo: { 28591 year: "jjjj", 28592 month: "mm", 28593 day: "tt" 28594 }, 28595 es: { 28596 year: "aaaa", 28597 month: "mm", 28598 day: "dd" 28599 }, 28600 et: { 28601 year: "aaaa", 28602 month: "kk", 28603 day: "pp" 28604 }, 28605 eu: { 28606 year: "uuuu", 28607 month: "hh", 28608 day: "ee" 28609 }, 28610 fa: { 28611 year: "ساÙ", 28612 month: "٠اÙ", 28613 day: "Ø±ÙØ²" 28614 }, 28615 ff: { 28616 year: "hhhh", 28617 month: "ll", 28618 day: "ññ" 28619 }, 28620 fi: { 28621 year: "vvvv", 28622 month: "kk", 28623 day: "pp" 28624 }, 28625 fr: { 28626 year: "aaaa", 28627 month: "mm", 28628 day: "jj" 28629 }, 28630 fy: { 28631 year: "jjjj", 28632 month: "mm", 28633 day: "dd" 28634 }, 28635 ga: { 28636 year: "bbbb", 28637 month: "mm", 28638 day: "ll" 28639 }, 28640 gd: { 28641 year: "bbbb", 28642 month: "mm", 28643 day: "ll" 28644 }, 28645 gl: { 28646 year: "aaaa", 28647 month: "mm", 28648 day: "dd" 28649 }, 28650 he: { 28651 year: "×©× ×", 28652 month: "×××ש", 28653 day: "×××" 28654 }, 28655 hr: { 28656 year: "gggg", 28657 month: "mm", 28658 day: "dd" 28659 }, 28660 hsb: { 28661 year: "llll", 28662 month: "mm", 28663 day: "dd" 28664 }, 28665 hu: { 28666 year: "éééé", 28667 month: "hh", 28668 day: "nn" 28669 }, 28670 ia: { 28671 year: "aaaa", 28672 month: "mm", 28673 day: "dd" 28674 }, 28675 id: { 28676 year: "tttt", 28677 month: "bb", 28678 day: "hh" 28679 }, 28680 it: { 28681 year: "aaaa", 28682 month: "mm", 28683 day: "gg" 28684 }, 28685 ja: { 28686 year: " å¹´ ", 28687 month: "æ", 28688 day: "æ¥" 28689 }, 28690 ka: { 28691 year: "á¬á¬á¬á¬", 28692 month: "áá", 28693 day: "á á " 28694 }, 28695 kk: { 28696 year: "жжжж", 28697 month: "аа", 28698 day: "кк" 28699 }, 28700 kn: { 28701 year: "ವವವವ", 28702 month: "ಮಿಮà³", 28703 day: "ದಿದಿ" 28704 }, 28705 ko: { 28706 year: "ì°ë", 28707 month: "ì", 28708 day: "ì¼" 28709 }, 28710 lb: { 28711 year: "jjjj", 28712 month: "mm", 28713 day: "dd" 28714 }, 28715 lo: { 28716 year: "àºàºàºàº", 28717 month: "àºàº", 28718 day: "ວວ" 28719 }, 28720 lt: { 28721 year: "mmmm", 28722 month: "mm", 28723 day: "dd" 28724 }, 28725 lv: { 28726 year: "gggg", 28727 month: "mm", 28728 day: "dd" 28729 }, 28730 meh: { 28731 year: "aaaa", 28732 month: "mm", 28733 day: "dd" 28734 }, 28735 ml: { 28736 year: "വർഷà´", 28737 month: "മാസà´", 28738 day: "à´¤àµà´¯à´¤à´¿" 28739 }, 28740 ms: { 28741 year: "tttt", 28742 month: "mm", 28743 day: "hh" 28744 }, 28745 nl: { 28746 year: "jjjj", 28747 month: "mm", 28748 day: "dd" 28749 }, 28750 nn: { 28751 year: "åååå", 28752 month: "mm", 28753 day: "dd" 28754 }, 28755 no: { 28756 year: "åååå", 28757 month: "mm", 28758 day: "dd" 28759 }, 28760 oc: { 28761 year: "aaaa", 28762 month: "mm", 28763 day: "jj" 28764 }, 28765 pl: { 28766 year: "rrrr", 28767 month: "mm", 28768 day: "dd" 28769 }, 28770 pt: { 28771 year: "aaaa", 28772 month: "mm", 28773 day: "dd" 28774 }, 28775 rm: { 28776 year: "oooo", 28777 month: "mm", 28778 day: "dd" 28779 }, 28780 ro: { 28781 year: "aaaa", 28782 month: "ll", 28783 day: "zz" 28784 }, 28785 ru: { 28786 year: "гггг", 28787 month: "мм", 28788 day: "дд" 28789 }, 28790 sc: { 28791 year: "aaaa", 28792 month: "mm", 28793 day: "dd" 28794 }, 28795 scn: { 28796 year: "aaaa", 28797 month: "mm", 28798 day: "jj" 28799 }, 28800 sk: { 28801 year: "rrrr", 28802 month: "mm", 28803 day: "dd" 28804 }, 28805 sl: { 28806 year: "llll", 28807 month: "mm", 28808 day: "dd" 28809 }, 28810 sr: { 28811 year: "гггг", 28812 month: "мм", 28813 day: "дд" 28814 }, 28815 sv: { 28816 year: "åååå", 28817 month: "mm", 28818 day: "dd" 28819 }, 28820 szl: { 28821 year: "rrrr", 28822 month: "mm", 28823 day: "dd" 28824 }, 28825 tg: { 28826 year: "ÑÑÑÑ", 28827 month: "мм", 28828 day: "ÑÑ" 28829 }, 28830 th: { 28831 year: "à¸à¸à¸à¸", 28832 month: "à¸à¸", 28833 day: "วว" 28834 }, 28835 tr: { 28836 year: "yyyy", 28837 month: "aa", 28838 day: "gg" 28839 }, 28840 uk: { 28841 year: "ÑÑÑÑ", 28842 month: "мм", 28843 day: "дд" 28844 }, 28845 "zh-CN": { 28846 year: "å¹´", 28847 month: "æ", 28848 day: "æ¥" 28849 }, 28850 "zh-TW": { 28851 year: "å¹´", 28852 month: "æ", 28853 day: "æ¥" 28854 } 28855 }; 28856 function getPlaceholderObj(locale) { 28857 if (!isSupportedLocale(locale)) { 28858 const localeLanguage = getLocaleLanguage(locale); 28859 if (!isSupportedLocale(localeLanguage)) return placeholders.en; 28860 else return placeholders[localeLanguage]; 28861 } else return placeholders[locale]; 28862 } 28863 function getPlaceholder(field, value, locale) { 28864 if (isPlaceholderField(field)) return getPlaceholderObj(locale)[field]; 28865 if (isDefaultField(field)) return value; 28866 if (isTimeField(field)) return "ââ"; 28867 return ""; 28868 } 28869 function isSupportedLocale(locale) { 28870 return supportedLocales.includes(locale); 28871 } 28872 function isPlaceholderField(field) { 28873 return placeholderFields.includes(field); 28874 } 28875 function isTimeField(field) { 28876 return field === "hour" || field === "minute" || field === "second"; 28877 } 28878 function isDefaultField(field) { 28879 return field === "era" || field === "dayPeriod"; 28880 } 28881 function getLocaleLanguage(locale) { 28882 if (Intl.Locale) return new Intl.Locale(locale).language; 28883 return locale.split("-")[0]; 28884 } 28885 //#endregion 28886 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/field/helpers.js 28887 function initializeSegmentValues(granularity) { 28888 const calendarDateTimeGranularities = [ 28889 "hour", 28890 "minute", 28891 "second" 28892 ];
28893 const initialParts = EDITABLE_SEGMENT_PARTS.map((part) => { 28894 if (part === "dayPeriod") return [part, "AM"]; 28895 return [part, null]; 28896 }).filter(([key]) => { 28897 if (key === "literal" || key === null) return false; 28898 if (granularity === "day") return !calendarDateTimeGranularities.includes(key); 28899 else return true; 28900 }); 28901 return Object.fromEntries(initialParts); 28902 } 28903 function createContentObj(props) { 28904 const { segmentValues, formatter, locale, dateRef } = props; 28905 const content = Object.keys(segmentValues).reduce((obj, part) => { 28906 if (!isSegmentPart(part)) return obj; 28907 if ("hour" in segmentValues && part === "dayPeriod") { 28908 const value = segmentValues[part]; 28909 if (!isNull(value)) obj[part] = value; 28910 else obj[part] = getPlaceholder(part, "AM", locale); 28911 } else obj[part] = getPartContent(part); 28912 return obj; 28913 }, {}); 28914 function getPartContent(part) { 28915 if ("hour" in segmentValues) { 28916 const value = segmentValues[part]; 28917 const leadingZero = typeof value === "string" && value?.startsWith("0"); 28918 const intValue = value !== null ? Number.parseInt(value) : null; 28919 if (value === "0" && part !== "year") return "0"; 28920 else if (!isNull(value) && !isNull(intValue)) { 28921 const formatted = formatter.part(dateRef.set({ [part]: value }), part, { hourCycle: props.hourCycle === 24 ? "h23" : void 0 }); 28922 /** 28923 * If we're operating in a 12 hour clock and the part is an hour, we handle 28924 * the conversion to 12 hour format with 2 digit hours and leading zeros here. 28925 */ 28926 const is12HourMode = props.hourCycle === 12 || props.hourCycle === void 0 && getDefaultHourCycle(locale) === 12; 28927 if (part === "hour" && is12HourMode) { 28928 /** 28929 * If the value is over 12, we convert to 12 hour format and add leading 28930 * zeroes if the value is less than 10. 28931 */ 28932 if (intValue > 12) { 28933 const hour = intValue - 12; 28934 if (hour === 0) return "12"; 28935 else if (hour < 10) return `0${hour}`; 28936 else return `${hour}`; 28937 } 28938 /** 28939 * If the value is 0, we convert to 12, since 0 is not a valid 12 hour time. 28940 */ 28941 if (intValue === 0) return "12"; 28942 /** 28943 * If the value is less than 10, we add a leading zero to the value. 28944 */ 28945 if (intValue < 10) return `0${intValue}`; 28946 /** 28947 * Otherwise, we don't need to do anything to the value. 28948 */ 28949 return `${intValue}`; 28950 } 28951 if (part === "year") return `${value}`; 28952 if (leadingZero && formatted.length === 1) return `0${formatted}`; 28953 return formatted; 28954 } else return getPlaceholder(part, "", locale); 28955 } else { 28956 if (isDateSegmentPart(part)) { 28957 const value = segmentValues[part]; 28958 const leadingZero = typeof value === "string" && value?.startsWith("0"); 28959 if (value === "0") return "0"; 28960 else if (!isNull(value)) { 28961 const formatted = formatter.part(dateRef.set({ [part]: value }), part); 28962 if (part === "year") return `${value}`; 28963 if (leadingZero && formatted.length === 1) return `0${formatted}`; 28964 return formatted; 28965 } else return getPlaceholder(part, "", locale); 28966 } 28967 return ""; 28968 } 28969 } 28970 return content; 28971 } 28972 function createContentArr(props) { 28973 const { granularity, dateRef, formatter, contentObj, hideTimeZone, hourCycle } = props; 28974 return formatter.toParts(dateRef, getOptsByGranularity(granularity, hourCycle)).map((part) => { 28975 if ([ 28976 "literal", 28977 "dayPeriod", 28978 "timeZoneName", 28979 null 28980 ].includes(part.type) || !isSegmentPart(part.type)) return { 28981 part: part.type, 28982 value: part.value 28983 }; 28984 return { 28985 part: part.type, 28986 value: contentObj[part.type] 28987 }; 28988 }).filter((segment) => { 28989 if (isNull(segment.part) || isNull(segment.value)) return false; 28990 if (segment.part === "timeZoneName" && (!isZonedDateTime(dateRef) || hideTimeZone)) return false; 28991 return true; 28992 }); 28993 } 28994 function createContent(props) { 28995 const contentObj = createContentObj(props); 28996 return { 28997 obj: contentObj, 28998 arr: createContentArr({ 28999 contentObj, 29000 ...props 29001 }) 29002 }; 29003 } 29004 function getOptsByGranularity(granularity, hourCycle) { 29005 const opts = { 29006 year: "numeric", 29007 month: "2-digit", 29008 day: "2-digit", 29009 hour: "2-digit", 29010 minute: "2-digit", 29011 second: "2-digit", 29012 timeZoneName: "short", 29013 hourCycle: hourCycle === 24 ? "h23" : void 0, 29014 hour12: hourCycle === 24 ? false : void 0 29015 }; 29016 if (granularity === "day") { 29017 delete opts.second; 29018 delete opts.hour; 29019 delete opts.minute; 29020 delete opts.timeZoneName; 29021 } 29022 if (granularity === "hour") delete opts.minute; 29023 if (granularity === "minute") delete opts.second; 29024 return opts; 29025 } 29026 function initSegmentStates() { 29027 return EDITABLE_SEGMENT_PARTS.reduce((acc, key) => { 29028 acc[key] = { 29029 lastKeyZero: false, 29030 hasLeftFocus: true, 29031 updating: null 29032 }; 29033 return acc; 29034 }, {}); 29035 } 29036 function isDateSegmentPart(part) { 29037 return DATE_SEGMENT_PARTS.includes(part); 29038 } 29039 function isSegmentPart(part) { 29040 return EDITABLE_SEGMENT_PARTS.includes(part); 29041 } 29042 function isAnySegmentPart(part) { 29043 return ALL_SEGMENT_PARTS.includes(part); 29044 } 29045 /** 29046 * Get the segments being used/ are rendered in the DOM. 29047 * We're using this to determine when to set the value of 29048 * the date picker, which is when all the segments have 29049 * been filled. 29050 */ 29051 function getUsedSegments(fieldNode) { 29052 if (!isBrowser || !fieldNode) return []; 29053 return getSegments(fieldNode).map((el) => el.dataset.segment).filter((part) => { 29054 return EDITABLE_SEGMENT_PARTS.includes(part); 29055 }); 29056 } 29057 function getValueFromSegments(props) { 29058 const { segmentObj, fieldNode, dateRef } = props; 29059 const usedSegments = getUsedSegments(fieldNode); 29060 let date = dateRef; 29061 for (const part of usedSegments) if ("hour" in segmentObj) { 29062 const value = segmentObj[part]; 29063 if (isNull(value)) continue; 29064 date = date.set({ [part]: segmentObj[part] }); 29065 } else if (isDateSegmentPart(part)) { 29066 const value = segmentObj[part]; 29067 if (isNull(value)) continue; 29068 date = date.set({ [part]: segmentObj[part] }); 29069 } 29070 return date; 29071 }
29072 /** 29073 * Check if all the segments being used have been filled. 29074 * We use this to determine when we should set the value 29075 * store of the date field(s). 29076 * 29077 * @param segmentValues - The current `SegmentValueObj` 29078 * @param fieldNode - The id of the date field 29079 */ 29080 function areAllSegmentsFilled(segmentValues, fieldNode) { 29081 const usedSegments = getUsedSegments(fieldNode); 29082 for (const part of usedSegments) if ("hour" in segmentValues) { 29083 if (segmentValues[part] === null) return false; 29084 } else if (isDateSegmentPart(part)) { 29085 if (segmentValues[part] === null) return false; 29086 } 29087 return true; 29088 } 29089 /** 29090 * Determines if the provided object is a valid `DateAndTimeSegmentObj` 29091 * by checking if it has the correct keys and values for each key. 29092 */ 29093 function isDateAndTimeSegmentObj(obj) { 29094 if (typeof obj !== "object" || obj === null) return false; 29095 return Object.entries(obj).every(([key, value]) => { 29096 return (EDITABLE_TIME_SEGMENT_PARTS.includes(key) || DATE_SEGMENT_PARTS.includes(key)) && (key === "dayPeriod" ? value === "AM" || value === "PM" || value === null : typeof value === "string" || typeof value === "number" || value === null); 29097 }); 29098 } 29099 /** 29100 * Infer the granularity to use based on the 29101 * value and granularity props. 29102 */ 29103 function inferGranularity(value, granularity) { 29104 if (granularity) return granularity; 29105 if (hasTime(value)) return "minute"; 29106 return "day"; 29107 } 29108 function isAcceptableSegmentKey(key) { 29109 if ([ 29110 "Enter", 29111 "ArrowUp", 29112 "ArrowDown", 29113 "ArrowLeft", 29114 "ArrowRight", 29115 "Backspace", 29116 " " 29117 ].includes(key)) return true; 29118 if (isNumberString(key)) return true; 29119 return false; 29120 } 29121 /** 29122 * Determines if the element with the provided id is the first focusable 29123 * segment in the date field with the provided fieldId. 29124 * 29125 * @param id - The id of the element to check if it's the first segment 29126 * @param fieldNode - The id of the date field associated with the segment 29127 */ 29128 function isFirstSegment(id, fieldNode) { 29129 if (!isBrowser) return false; 29130 const segments = getSegments(fieldNode); 29131 return segments.length ? segments[0].id === id : false; 29132 } 29133 /** 29134 * Creates or updates a description element for a date field 29135 * which enables screen readers to read the date field's value. 29136 * 29137 * This element is hidden from view, and is portalled to the body 29138 * so it can be associated via `aria-describedby` and read by 29139 * screen readers as the user interacts with the date field. 29140 */ 29141 function setDescription(props) { 29142 const { id, formatter, value, doc } = props; 29143 if (!isBrowser) return; 29144 const valueString = formatter.selectedDate(value); 29145 const el = doc.getElementById(id); 29146 if (!el) { 29147 const div = doc.createElement("div"); 29148 div.style.cssText = styleToString({ display: "none" }); 29149 div.id = id; 29150 div.innerText = `Selected Date: ${valueString}`; 29151 doc.body.appendChild(div); 29152 } else el.innerText = `Selected Date: ${valueString}`; 29153 } 29154 /** 29155 * Removes the description element for the date field with 29156 * the provided ID. This function should be called when the 29157 * date field is unmounted. 29158 */ 29159 function removeDescriptionElement(id, doc) { 29160 if (!isBrowser) return; 29161 const el = doc.getElementById(id); 29162 if (!el) return; 29163 doc.body.removeChild(el); 29164 } 29165 function getDefaultHourCycle(locale) { 29166 return new Intl.DateTimeFormat(locale, { hour: "numeric" }).formatToParts(/* @__PURE__ */ new Date("2023-01-01T13:00:00")).find((part) => part.type === "hour")?.value === "1" ? 12 : 24; 29167 } 29168 //#endregion 29169 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/field/segments.js 29170 /** 29171 * Handles segment navigation based on the provided keyboard event and field ID. 29172 * 29173 * @param e - The keyboard event 29174 * @param fieldNode - The ID of the field we're navigating within 29175 */ 29176 function handleSegmentNavigation(e, fieldNode) { 29177 const currentTarget = e.currentTarget; 29178 if (!isHTMLElement$1(currentTarget)) return; 29179 const { prev, next } = getPrevNextSegments(currentTarget, fieldNode); 29180 if (e.key === "ArrowLeft") { 29181 if (!prev) return; 29182 prev.focus(); 29183 } else if (e.key === "ArrowRight") { 29184 if (!next) return; 29185 next.focus(); 29186 } 29187 } 29188 /** 29189 * Retrieves the next segment in the list of segments relative to the provided node. 29190 * 29191 * @param node - The node we're starting from 29192 * @param segments - The list of candidate segments to navigate through 29193 */ 29194 function getNextSegment(node, segments) { 29195 const index = segments.indexOf(node); 29196 if (index === segments.length - 1 || index === -1) return null; 29197 return segments[index + 1]; 29198 } 29199 /** 29200 * Retrieves the previous segment in the list of segments relative to the provided node. 29201 * 29202 * @param node - The node we're starting from 29203 * @param segments - The list of candidate segments to navigate through 29204 */ 29205 function getPrevSegment(node, segments) { 29206 const index = segments.indexOf(node); 29207 if (index === 0 || index === -1) return null; 29208 return segments[index - 1]; 29209 } 29210 /**
29211 * Retrieves an object containing the next and previous segments relative to the current node. 29212 * 29213 * @param startingNode - The node we're starting from 29214 * @param fieldNode - The ID of the field we're navigating within 29215 */ 29216 function getPrevNextSegments(startingNode, fieldNode) { 29217 const segments = getSegments(fieldNode); 29218 if (!segments.length) return { 29219 next: null, 29220 prev: null 29221 }; 29222 return { 29223 next: getNextSegment(startingNode, segments), 29224 prev: getPrevSegment(startingNode, segments) 29225 }; 29226 } 29227 /** 29228 * Shifts the focus to the next segment in the list of segments 29229 * within the field identified by the provided ID. 29230 */ 29231 function moveToNextSegment(e, fieldNode) { 29232 const node = e.currentTarget; 29233 if (!isHTMLElement$1(node)) return; 29234 const { next } = getPrevNextSegments(node, fieldNode); 29235 if (!next) return; 29236 next.focus(); 29237 } 29238 /** 29239 * Shifts the focus to the previous segment in the list of segments 29240 * within the field identified by the provided ID. If this is the first 29241 * segment, focus will not be shifted. 29242 */ 29243 function moveToPrevSegment(e, fieldNode) { 29244 const node = e.currentTarget; 29245 if (!isHTMLElement$1(node)) return; 29246 const { prev } = getPrevNextSegments(node, fieldNode); 29247 if (!prev) return; 29248 prev.focus(); 29249 } 29250 function isSegmentNavigationKey(key) { 29251 if (key === "ArrowRight" || key === "ArrowLeft") return true; 29252 return false; 29253 } 29254 /** 29255 * Retrieves all the interactive segments within the field identified by the provided ID. 29256 */ 29257 function getSegments(fieldNode) { 29258 if (!fieldNode) return []; 29259 return Array.from(fieldNode.querySelectorAll("[data-segment]")).filter((el) => { 29260 if (!isHTMLElement$1(el)) return false; 29261 const segment = el.dataset.segment; 29262 if (segment === "trigger") return true; 29263 if (!isAnySegmentPart(segment) || segment === "literal") return false; 29264 return true; 29265 }); 29266 } 29267 /** 29268 * Get the first interactive segment within the field identified by the provided ID. 29269 */ 29270 function getFirstSegment(fieldNode) { 29271 return getSegments(fieldNode)[0]; 29272 } 29273 //#endregion 29274 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/formatter.js 29275 var defaultPartOptions = { 29276 year: "numeric", 29277 month: "numeric",
29278 day: "numeric", 29279 hour: "numeric", 29280 minute: "numeric", 29281 second: "numeric" 29282 }; 29283 /** 29284 * Creates a wrapper around the `DateFormatter`, which is 29285 * an improved version of the {@link Intl.DateTimeFormat} API, 29286 * that is used internally by the various date builders to 29287 * easily format dates in a consistent way. 29288 * 29289 * @see [DateFormatter](https://react-spectrum.adobe.com/internationalized/date/DateFormatter.html) 29290 */ 29291 function createFormatter(opts) { 29292 let locale = opts.initialLocale; 29293 function setLocale(newLocale) { 29294 locale = newLocale; 29295 } 29296 function getLocale() { 29297 return locale; 29298 } 29299 function custom(date, options) { 29300 return new $12a3c853105e5a70$export$ad991b66133851cf(locale, options).format(date); 29301 } 29302 function selectedDate(date, includeTime = true) { 29303 if (hasTime(date) && includeTime) return custom(toDate(date), { 29304 dateStyle: "long", 29305 timeStyle: "long" 29306 }); 29307 else return custom(toDate(date), { dateStyle: "long" }); 29308 } 29309 function fullMonthAndYear(date) { 29310 if (typeof opts.monthFormat.current !== "function" && typeof opts.yearFormat.current !== "function") return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { 29311 month: opts.monthFormat.current, 29312 year: opts.yearFormat.current 29313 }).format(date); 29314 return `${typeof opts.monthFormat.current === "function" ? opts.monthFormat.current(date.getMonth() + 1) : new $12a3c853105e5a70$export$ad991b66133851cf(locale, { month: opts.monthFormat.current }).format(date)} ${typeof opts.yearFormat.current === "function" ? opts.yearFormat.current(date.getFullYear()) : new $12a3c853105e5a70$export$ad991b66133851cf(locale, { year: opts.yearFormat.current }).format(date)}`; 29315 } 29316 function fullMonth(date) { 29317 return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { month: "long" }).format(date); 29318 } 29319 function fullYear(date) { 29320 return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { year: "numeric" }).format(date); 29321 } 29322 function toParts(date, options) { 29323 if (isZonedDateTime(date)) return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { 29324 ...options, 29325 timeZone: date.timeZone 29326 }).formatToParts(toDate(date)); 29327 else return new $12a3c853105e5a70$export$ad991b66133851cf(locale, options).formatToParts(toDate(date)); 29328 } 29329 function dayOfWeek(date, length = "narrow") { 29330 return new $12a3c853105e5a70$export$ad991b66133851cf(locale, { weekday: length }).format(date); 29331 } 29332 function dayPeriod(date, hourCycle = void 0) { 29333 if (new $12a3c853105e5a70$export$ad991b66133851cf(locale, { 29334 hour: "numeric", 29335 minute: "numeric", 29336 hourCycle: hourCycle === 24 ? "h23" : void 0 29337 }).formatToParts(date).find((p) => p.type === "dayPeriod")?.value === "PM") return "PM"; 29338 return "AM"; 29339 } 29340 function part(dateObj, type, options = {}) { 29341 const part = toParts(dateObj, { 29342 ...defaultPartOptions, 29343 ...options 29344 }).find((p) => p.type === type); 29345 return part ? part.value : ""; 29346 } 29347 return { 29348 setLocale, 29349 getLocale, 29350 fullMonth, 29351 fullYear, 29352 fullMonthAndYear, 29353 toParts, 29354 custom, 29355 part, 29356 dayPeriod, 29357 selectedDate, 29358 dayOfWeek 29359 }; 29360 } 29361 //#endregion 29362 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/date-time/calendar-helpers.svelte.js 29363 function isCalendarDayNode(node) { 29364 if (!isHTMLElement$1(node)) return false; 29365 if (!node.hasAttribute("data-bits-day")) return false; 29366 return true; 29367 } 29368 /** 29369 * Retrieves an array of date values representing the days between 29370 * the provided start and end dates. 29371 */ 29372 function getDaysBetween(start, end) { 29373 const days = []; 29374 let dCurrent = start.add({ days: 1 }); 29375 const dEnd = end; 29376 while (dCurrent.compare(dEnd) < 0) { 29377 days.push(dCurrent); 29378 dCurrent = dCurrent.add({ days: 1 }); 29379 } 29380 return days; 29381 } 29382 /** 29383 * Creates a calendar month object. 29384 * 29385 * @remarks
29386 * Given a date, this function returns an object containing 29387 * the necessary values to render a calendar month, including 29388 * the month's date (the first day of that month), which can be 29389 * used to render the name of the month, an array of all dates 29390 * in that month, and an array of weeks. Each week is an array 29391 * of dates, useful for rendering an accessible calendar grid 29392 * using a loop and table elements. 29393 * 29394 */ 29395 function createMonth(props) { 29396 const { dateObj, weekStartsOn, fixedWeeks, locale } = props; 29397 const daysInMonth = getDaysInMonth(dateObj); 29398 const datesArray = Array.from({ length: daysInMonth }, (_, i) => dateObj.set({ day: i + 1 })); 29399 const firstDayOfMonth = $ad063034c8620db8$export$a5a3b454ada2268e(dateObj); 29400 const lastDayOfMonth = $ad063034c8620db8$export$a2258d9c4118825c(dateObj); 29401 const lastSunday = weekStartsOn !== void 0 ? getLastFirstDayOfWeek(firstDayOfMonth, weekStartsOn, "en-US") : getLastFirstDayOfWeek(firstDayOfMonth, 0, locale); 29402 const nextSaturday = weekStartsOn !== void 0 ? getNextLastDayOfWeek(lastDayOfMonth, weekStartsOn, "en-US") : getNextLastDayOfWeek(lastDayOfMonth, 0, locale); 29403 const lastMonthDays = getDaysBetween(lastSunday.subtract({ days: 1 }), firstDayOfMonth); 29404 const nextMonthDays = getDaysBetween(lastDayOfMonth, nextSaturday.add({ days: 1 })); 29405 const totalDays = lastMonthDays.length + datesArray.length + nextMonthDays.length; 29406 if (fixedWeeks && totalDays < 42) { 29407 const extraDays = 42 - totalDays; 29408 let startFrom = nextMonthDays[nextMonthDays.length - 1]; 29409 if (!startFrom) startFrom = dateObj.add({ months: 1 }).set({ day: 1 }); 29410 let length = extraDays; 29411 if (nextMonthDays.length === 0) { 29412 length = extraDays - 1; 29413 nextMonthDays.push(startFrom); 29414 } 29415 const extraDaysArray = Array.from({ length }, (_, i) => { 29416 const incr = i + 1; 29417 return startFrom.add({ days: incr }); 29418 }); 29419 nextMonthDays.push(...extraDaysArray); 29420 } 29421 const allDays = lastMonthDays.concat(datesArray, nextMonthDays); 29422 return { 29423 value: dateObj, 29424 dates: allDays, 29425 weeks: chunk(allDays, 7) 29426 }; 29427 } 29428 function createMonths(props) { 29429 const { numberOfMonths, dateObj, ...monthProps } = props; 29430 const months = []; 29431 if (!numberOfMonths || numberOfMonths === 1) { 29432 months.push(createMonth({ 29433 ...monthProps, 29434 dateObj 29435 })); 29436 return months; 29437 } 29438 months.push(createMonth({ 29439 ...monthProps, 29440 dateObj 29441 })); 29442 for (let i = 1; i < numberOfMonths; i++) { 29443 const nextMonth = dateObj.add({ months: i }); 29444 months.push(createMonth({ 29445 ...monthProps, 29446 dateObj: nextMonth 29447 })); 29448 } 29449 return months; 29450 } 29451 function getSelectableCells(calendarNode) { 29452 if (!calendarNode) return []; 29453 return Array.from(calendarNode.querySelectorAll(`[data-bits-day]:not([data-disabled]):not([data-outside-visible-months])`)).filter((el) => isHTMLElement$1(el)); 29454 } 29455 /** 29456 * A helper function to extract the date from the `data-value` 29457 * attribute of a date cell and set it as the placeholder value. 29458 * 29459 * Shared between the calendar and range calendar builders. 29460 * 29461 * @param node - The node to extract the date from. 29462 * @param placeholder - The placeholder value store which will be set to the extracted date. 29463 */ 29464 function setPlaceholderToNodeValue(node, placeholder) { 29465 const cellValue = node.getAttribute("data-value"); 29466 if (!cellValue) return; 29467 placeholder.current = parseStringToDateValue(cellValue, placeholder.current); 29468 } 29469 /** 29470 * Shared logic for shifting focus between cells in the 29471 * calendar and range calendar. 29472 */ 29473 function shiftCalendarFocus({ node, add, placeholder, calendarNode, isPrevButtonDisabled, isNextButtonDisabled, months, numberOfMonths }) { 29474 const candidateCells = getSelectableCells(calendarNode); 29475 if (!candidateCells.length) return; 29476 const nextIndex = candidateCells.indexOf(node) + add; 29477 /** 29478 * If the next cell is within the bounds of the displayed cells, 29479 * easy day, we just focus it. 29480 */ 29481 if (isValidIndex(nextIndex, candidateCells)) { 29482 const nextCell = candidateCells[nextIndex]; 29483 setPlaceholderToNodeValue(nextCell, placeholder); 29484 return nextCell.focus(); 29485 } 29486 /** 29487 * When the next cell falls outside the displayed cells range, 29488 * we update the focus to the previous or next month based on the 29489 * direction, and then focus on the relevant cell. 29490 */ 29491 if (nextIndex < 0) { 29492 /** 29493 * To handle negative indices, we rewind by one month, 29494 * retrieve candidate cells for that month, and shift focus 29495 * by the difference between the nextIndex starting from the end 29496 * of the array. 29497 */ 29498 if (isPrevButtonDisabled) return; 29499 const firstMonth = months[0]?.value; 29500 if (!firstMonth) return; 29501 placeholder.current = firstMonth.subtract({ months: numberOfMonths }); 29502 afterTick(() => { 29503 const newCandidateCells = getSelectableCells(calendarNode); 29504 if (!newCandidateCells.length) return; 29505 /** 29506 * Starting at the end of the array, shift focus by the diff 29507 * between the nextIndex and the length of the array, since the 29508 * nextIndex is negative. 29509 */ 29510 const newIndex = newCandidateCells.length - Math.abs(nextIndex); 29511 if (isValidIndex(newIndex, newCandidateCells)) { 29512 const newCell = newCandidateCells[newIndex]; 29513 setPlaceholderToNodeValue(newCell, placeholder); 29514 return newCell.focus(); 29515 } 29516 }); 29517 } 29518 if (nextIndex >= candidateCells.length) { 29519 /** 29520 * Since we're in the positive index range, we need to go forward 29521 * a month, refetch the candidate cells within that month, and then 29522 * starting at the beginning of the array, shift focus by the nextIndex 29523 * amount. 29524 */ 29525 if (isNextButtonDisabled) return; 29526 const firstMonth = months[0]?.value; 29527 if (!firstMonth) return; 29528 placeholder.current = firstMonth.add({ months: numberOfMonths }); 29529 afterTick(() => { 29530 const newCandidateCells = getSelectableCells(calendarNode); 29531 if (!newCandidateCells.length) return; 29532 /** 29533 * We need to determine how far into the next month we need to go 29534 * to get the next index. So if we only went over the previous month 29535 * by one, we need to go into the next month by 1 to get the right index. 29536 */ 29537 const newIndex = nextIndex - candidateCells.length; 29538 if (isValidIndex(newIndex, newCandidateCells)) return newCandidateCells[newIndex].focus(); 29539 }); 29540 } 29541 } 29542 var ARROW_KEYS = [ 29543 ARROW_DOWN, 29544 ARROW_UP, 29545 ARROW_LEFT, 29546 ARROW_RIGHT 29547 ]; 29548 var SELECT_KEYS = [ENTER, " "]; 29549 /** 29550 * Shared keyboard event handler for the calendar and range calendar. 29551 */ 29552 function handleCalendarKeydown({ event, handleCellClick, shiftFocus, placeholderValue }) { 29553 const currentCell = event.target; 29554 if (!isCalendarDayNode(currentCell)) return; 29555 if (!ARROW_KEYS.includes(event.key) && !SELECT_KEYS.includes(event.key)) return; 29556 event.preventDefault(); 29557 const kbdFocusMap = { 29558 [ARROW_DOWN]: 7, 29559 [ARROW_UP]: -7, 29560 [ARROW_LEFT]: -1, 29561 [ARROW_RIGHT]: 1 29562 }; 29563 if (ARROW_KEYS.includes(event.key)) { 29564 const add = kbdFocusMap[event.key]; 29565 if (add !== void 0) shiftFocus(currentCell, add); 29566 } 29567 if (SELECT_KEYS.includes(event.key)) {
29568 const cellValue = currentCell.getAttribute("data-value"); 29569 if (!cellValue) return; 29570 handleCellClick(event, parseStringToDateValue(cellValue, placeholderValue)); 29571 } 29572 } 29573 function handleCalendarNextPage({ months, setMonths, numberOfMonths, pagedNavigation, weekStartsOn, locale, fixedWeeks, setPlaceholder }) { 29574 const firstMonth = months[0]?.value; 29575 if (!firstMonth) return; 29576 if (pagedNavigation) setPlaceholder(firstMonth.add({ months: numberOfMonths })); 29577 else { 29578 const targetDate = firstMonth.add({ months: 1 }); 29579 const newMonths = createMonths({ 29580 dateObj: targetDate, 29581 weekStartsOn, 29582 locale, 29583 fixedWeeks, 29584 numberOfMonths 29585 }); 29586 setPlaceholder(targetDate); 29587 setMonths(newMonths); 29588 } 29589 } 29590 function handleCalendarPrevPage({ months, setMonths, numberOfMonths, pagedNavigation, weekStartsOn, locale, fixedWeeks, setPlaceholder }) { 29591 const firstMonth = months[0]?.value; 29592 if (!firstMonth) return; 29593 if (pagedNavigation) setPlaceholder(firstMonth.subtract({ months: numberOfMonths })); 29594 else { 29595 const targetDate = firstMonth.subtract({ months: 1 }); 29596 const newMonths = createMonths({ 29597 dateObj: targetDate, 29598 weekStartsOn, 29599 locale, 29600 fixedWeeks, 29601 numberOfMonths 29602 }); 29603 setPlaceholder(targetDate); 29604 setMonths(newMonths); 29605 } 29606 } 29607 function getWeekdays({ months, formatter, weekdayFormat }) { 29608 if (!months.length) return []; 29609 const firstWeek = months[0].weeks[0]; 29610 if (!firstWeek) return []; 29611 return firstWeek.map((date) => formatter.dayOfWeek(toDate(date), weekdayFormat)); 29612 } 29613 /** 29614 * Updates the displayed months based on changes in the options values, 29615 * which determines the month to show in the calendar. 29616 */ 29617 function useMonthViewOptionsSync(props) { 29618 user_effect(() => { 29619 const weekStartsOn = props.weekStartsOn.current; 29620 const locale = props.locale.current; 29621 const fixedWeeks = props.fixedWeeks.current; 29622 const numberOfMonths = props.numberOfMonths.current; 29623 untrack(() => { 29624 const placeholder = props.placeholder.current; 29625 if (!placeholder) return; 29626 const defaultMonthProps = { 29627 weekStartsOn, 29628 locale, 29629 fixedWeeks, 29630 numberOfMonths 29631 }; 29632 props.setMonths(createMonths({ 29633 ...defaultMonthProps, 29634 dateObj: placeholder 29635 })); 29636 }); 29637 }); 29638 } 29639 /** 29640 * Creates an accessible heading element for the calendar. 29641 * Returns a function that removes the heading element. 29642 */ 29643 function createAccessibleHeading({ calendarNode, label, accessibleHeadingId }) { 29644 const doc = getDocument(calendarNode); 29645 const div = doc.createElement("div"); 29646 div.style.cssText = styleToString({ 29647 border: "0px", 29648 clip: "rect(0px, 0px, 0px, 0px)", 29649 clipPath: "inset(50%)", 29650 height: "1px", 29651 margin: "-1px", 29652 overflow: "hidden", 29653 padding: "0px", 29654 position: "absolute", 29655 whiteSpace: "nowrap", 29656 width: "1px" 29657 }); 29658 const h2 = doc.createElement("div"); 29659 h2.textContent = label; 29660 h2.id = accessibleHeadingId; 29661 h2.role = "heading"; 29662 h2.ariaLevel = "2"; 29663 calendarNode.insertBefore(div, calendarNode.firstChild); 29664 div.appendChild(h2); 29665 return () => { 29666 const h2 = doc.getElementById(accessibleHeadingId); 29667 if (!h2) return; 29668 div.parentElement?.removeChild(div); 29669 h2.remove(); 29670 }; 29671 } 29672 function useMonthViewPlaceholderSync({ placeholder, getVisibleMonths, weekStartsOn, locale, fixedWeeks, numberOfMonths, setMonths }) { 29673 user_effect(() => { 29674 placeholder.current; 29675 untrack(() => { 29676 /** 29677 * If the placeholder's month is already in this visible months, 29678 * we don't need to do anything. 29679 */ 29680 if (getVisibleMonths().some((month) => $ad063034c8620db8$export$a18c89cbd24170ff(month, placeholder.current))) return; 29681 setMonths(createMonths({ 29682 weekStartsOn: weekStartsOn.current, 29683 locale: locale.current, 29684 fixedWeeks: fixedWeeks.current, 29685 numberOfMonths: numberOfMonths.current, 29686 dateObj: placeholder.current 29687 })); 29688 }); 29689 }); 29690 } 29691 function getIsNextButtonDisabled({ maxValue, months, disabled }) { 29692 if (!maxValue || !months.length) return false; 29693 if (disabled) return true; 29694 const lastMonthInView = months[months.length - 1]?.value; 29695 if (!lastMonthInView) return false;
29696 return isAfter(lastMonthInView.add({ months: 1 }).set({ day: 1 }), maxValue); 29697 } 29698 function getIsPrevButtonDisabled({ minValue, months, disabled }) { 29699 if (!minValue || !months.length) return false; 29700 if (disabled) return true; 29701 const firstMonthInView = months[0]?.value; 29702 if (!firstMonthInView) return false; 29703 return isBefore(firstMonthInView.subtract({ months: 1 }).set({ day: 35 }), minValue); 29704 } 29705 function getCalendarHeadingValue({ months, locale, formatter }) { 29706 if (!months.length) return ""; 29707 if (locale !== formatter.getLocale()) formatter.setLocale(locale); 29708 if (months.length === 1) { 29709 const month = toDate(months[0].value); 29710 return `${formatter.fullMonthAndYear(month)}`; 29711 } 29712 const startMonth = toDate(months[0].value); 29713 const endMonth = toDate(months[months.length - 1].value); 29714 const startMonthName = formatter.fullMonth(startMonth); 29715 const endMonthName = formatter.fullMonth(endMonth); 29716 const startMonthYear = formatter.fullYear(startMonth); 29717 const endMonthYear = formatter.fullYear(endMonth); 29718 return startMonthYear === endMonthYear ? `${startMonthName} - ${endMonthName} ${endMonthYear}` : `${startMonthName} ${startMonthYear} - ${endMonthName} ${endMonthYear}`; 29719 } 29720 function getCalendarElementProps({ fullCalendarLabel, id, isInvalid, disabled, readonly }) { 29721 return { 29722 id, 29723 role: "application", 29724 "aria-label": fullCalendarLabel, 29725 "data-invalid": boolToEmptyStrOrUndef(isInvalid), 29726 "data-disabled": boolToEmptyStrOrUndef(disabled), 29727 "data-readonly": boolToEmptyStrOrUndef(readonly) 29728 }; 29729 } 29730 function pickerOpenFocus(e) { 29731 const nodeToFocus = getDocument(e.target).querySelector("[data-bits-day][data-focused]"); 29732 if (nodeToFocus) { 29733 e.preventDefault(); 29734 nodeToFocus?.focus(); 29735 } 29736 } 29737 function getFirstNonDisabledDateInView(calendarRef) { 29738 if (!isBrowser) return; 29739 const daysInView = Array.from(calendarRef.querySelectorAll("[data-bits-day]:not([aria-disabled=true])")); 29740 if (daysInView.length === 0) return; 29741 const element = daysInView[0]; 29742 const value = element?.getAttribute("data-value"); 29743 const type = element?.getAttribute("data-type"); 29744 if (!value || !type) return; 29745 return parseAnyDateValue(value, type); 29746 } 29747 /** 29748 * Ensures the placeholder is not set to a disabled date,
29749 * which would prevent the user from entering the Calendar 29750 * via the keyboard. 29751 */ 29752 function useEnsureNonDisabledPlaceholder({ ref, placeholder, defaultPlaceholder, minValue, maxValue, isDateDisabled }) { 29753 function isDisabled(date) { 29754 if (isDateDisabled.current(date)) return true; 29755 if (minValue.current && isBefore(date, minValue.current)) return true; 29756 if (maxValue.current && isBefore(maxValue.current, date)) return true; 29757 return false; 29758 } 29759 watch(() => ref.current, () => { 29760 if (!ref.current) return; 29761 /** 29762 * If the placeholder is still the default placeholder and it's a disabled date, find 29763 * the first available date in the calendar view and set it as the placeholder. 29764 * 29765 * This prevents the placeholder from being a disabled date and no date being tabbable 29766 * preventing the user from entering the Calendar. If all dates in the view are 29767 * disabled, currently that is considered an error on the developer's part and should 29768 * be handled by them. 29769 * 29770 * Perhaps in the future we can introduce a dev-only log message to prevent this from 29771 * being a silent error. 29772 */ 29773 if (placeholder.current && $ad063034c8620db8$export$ea39ec197993aef0(placeholder.current, defaultPlaceholder) && isDisabled(defaultPlaceholder)) placeholder.current = getFirstNonDisabledDateInView(ref.current) ?? defaultPlaceholder; 29774 }); 29775 } 29776 function getDateWithPreviousTime(date, prev) { 29777 if (!date || !prev) return date; 29778 if (hasTime(date) && hasTime(prev)) return date.set({ 29779 hour: prev.hour, 29780 minute: prev.minute, 29781 millisecond: prev.millisecond, 29782 second: prev.second 29783 }); 29784 return date; 29785 } 29786 var calendarAttrs = createBitsAttrs({ 29787 component: "calendar", 29788 parts: [ 29789 "root", 29790 "grid", 29791 "cell", 29792 "next-button", 29793 "prev-button", 29794 "day", 29795 "grid-body", 29796 "grid-head", 29797 "grid-row", 29798 "head-cell", 29799 "header", 29800 "heading", 29801 "month-select", 29802 "year-select" 29803 ] 29804 }); 29805 function getDefaultYears(opts) { 29806 const currentYear = (/* @__PURE__ */ new Date()).getFullYear(); 29807 const latestYear = Math.max(opts.placeholderYear, currentYear); 29808 let minYear; 29809 let maxYear; 29810 if (opts.minValue) minYear = opts.minValue.year; 29811 else { 29812 const initialMinYear = latestYear - 100; 29813 minYear = opts.placeholderYear < initialMinYear ? opts.placeholderYear - 10 : initialMinYear; 29814 } 29815 if (opts.maxValue) maxYear = opts.maxValue.year; 29816 else maxYear = latestYear + 10; 29817 if (minYear > maxYear) minYear = maxYear; 29818 const totalYears = maxYear - minYear + 1; 29819 return Array.from({ length: totalYears }, (_, i) => minYear + i); 29820 } 29821 //#endregion 29822 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/calendar.svelte.js 29823 var CalendarRootContext = new Context("Calendar.Root | RangeCalender.Root"); 29824 var CalendarRootState = class CalendarRootState { 29825 static create(opts) { 29826 return CalendarRootContext.set(new CalendarRootState(opts)); 29827 } 29828 opts; 29829 #visibleMonths = /* @__PURE__ */ user_derived(() => this.months.map((month) => month.value)); 29830 get visibleMonths() { 29831 return get$2(this.#visibleMonths); 29832 } 29833 set visibleMonths(value) { 29834 set(this.#visibleMonths, value); 29835 } 29836 formatter; 29837 accessibleHeadingId = useId(); 29838 domContext; 29839 attachment; 29840 #months = /* @__PURE__ */ state(proxy([])); 29841 get months() { 29842 return get$2(this.#months); 29843 } 29844 set months(value) { 29845 set(this.#months, value, true); 29846 } 29847 announcer; 29848 constructor(opts) { 29849 this.opts = opts; 29850 this.attachment = attachRef(this.opts.ref); 29851 this.domContext = new DOMContext(opts.ref); 29852 this.announcer = getAnnouncer(null); 29853 this.formatter = createFormatter({ 29854 initialLocale: this.opts.locale.current, 29855 monthFormat: this.opts.monthFormat, 29856 yearFormat: this.opts.yearFormat 29857 }); 29858 this.setMonths = this.setMonths.bind(this); 29859 this.nextPage = this.nextPage.bind(this); 29860 this.prevPage = this.prevPage.bind(this); 29861 this.prevYear = this.prevYear.bind(this); 29862 this.nextYear = this.nextYear.bind(this); 29863 this.setYear = this.setYear.bind(this); 29864 this.setMonth = this.setMonth.bind(this); 29865 this.isOutsideVisibleMonths = this.isOutsideVisibleMonths.bind(this); 29866 this.isDateDisabled = this.isDateDisabled.bind(this); 29867 this.isDateSelected = this.isDateSelected.bind(this); 29868 this.shiftFocus = this.shiftFocus.bind(this); 29869 this.handleCellClick = this.handleCellClick.bind(this); 29870 this.handleMultipleUpdate = this.handleMultipleUpdate.bind(this); 29871 this.handleSingleUpdate = this.handleSingleUpdate.bind(this); 29872 this.onkeydown = this.onkeydown.bind(this); 29873 this.getBitsAttr = this.getBitsAttr.bind(this); 29874 onMount(() => { 29875 this.announcer = getAnnouncer(this.domContext.getDocument()); 29876 }); 29877 this.months = createMonths({ 29878 dateObj: this.opts.placeholder.current, 29879 weekStartsOn: this.opts.weekStartsOn.current, 29880 locale: this.opts.locale.current, 29881 fixedWeeks: this.opts.fixedWeeks.current, 29882 numberOfMonths: this.opts.numberOfMonths.current 29883 }); 29884 this.#setupInitialFocusEffect(); 29885 this.#setupAccessibleHeadingEffect(); 29886 this.#setupFormatterEffect(); 29887 /** 29888 * Updates the displayed months based on changes in the placeholder value. 29889 */ 29890 useMonthViewPlaceholderSync({ 29891 placeholder: this.opts.placeholder, 29892 getVisibleMonths: () => this.visibleMonths, 29893 weekStartsOn: this.opts.weekStartsOn, 29894 locale: this.opts.locale, 29895 fixedWeeks: this.opts.fixedWeeks, 29896 numberOfMonths: this.opts.numberOfMonths, 29897 setMonths: (months) => this.months = months 29898 }); 29899 /** 29900 * Updates the displayed months based on changes in the options values, 29901 * which determines the month to show in the calendar. 29902 */ 29903 useMonthViewOptionsSync({ 29904 fixedWeeks: this.opts.fixedWeeks, 29905 locale: this.opts.locale, 29906 numberOfMonths: this.opts.numberOfMonths, 29907 placeholder: this.opts.placeholder, 29908 setMonths: this.setMonths, 29909 weekStartsOn: this.opts.weekStartsOn 29910 }); 29911 /** 29912 * Update the accessible heading's text content when the `fullCalendarLabel` 29913 * changes. 29914 */ 29915 watch(() =>
29915 this.fullCalendarLabel, (label) => { 29916 const node = this.domContext.getElementById(this.accessibleHeadingId); 29917 if (!node) return; 29918 node.textContent = label; 29919 }); 29920 /** 29921 * Synchronize the placeholder value with the current value. 29922 */ 29923 watch(() => this.opts.value.current, () => { 29924 const value = this.opts.value.current; 29925 if (Array.isArray(value) && value.length) { 29926 const lastValue = value[value.length - 1]; 29927 if (lastValue && this.opts.placeholder.current !== lastValue) this.opts.placeholder.current = lastValue; 29928 } else if (!Array.isArray(value) && value && this.opts.placeholder.current !== value) this.opts.placeholder.current = value; 29929 }); 29930 useEnsureNonDisabledPlaceholder({ 29931 placeholder: opts.placeholder, 29932 defaultPlaceholder: opts.defaultPlaceholder, 29933 isDateDisabled: opts.isDateDisabled, 29934 maxValue: opts.maxValue, 29935 minValue: opts.minValue, 29936 ref: opts.ref 29937 }); 29938 } 29939 setMonths(months) { 29940 this.months = months; 29941 } 29942 #weekdays = /* @__PURE__ */ user_derived( 29943 /** 29944 * This derived state holds an array of localized day names for the current 29945 * locale and calendar view. It dynamically syncs with the 'weekStartsOn' option, 29946 * updating its content when the option changes. Using this state to render the 29947 * calendar's days of the week is strongly recommended, as it guarantees that 29948 * the days are correctly formatted for the current locale and calendar view. 29949 */ 29950 () => { 29951 return getWeekdays({ 29952 months: this.months, 29953 formatter: this.formatter, 29954 weekdayFormat: this.opts.weekdayFormat.current 29955 }); 29956 } 29957 ); 29958 get weekdays() { 29959 return get$2(this.#weekdays); 29960 } 29961 set weekdays(value) { 29962 set(this.#weekdays, value); 29963 } 29964 #initialPlaceholderYear = /* @__PURE__ */ user_derived(() => untrack(() => this.opts.placeholder.current.year)); 29965 get initialPlaceholderYear() { 29966 return get$2(this.#initialPlaceholderYear); 29967 } 29968 set initialPlaceholderYear(value) { 29969 set(this.#initialPlaceholderYear, value); 29970 } 29971 #defaultYears = /* @__PURE__ */ user_derived(() => { 29972 return getDefaultYears({ 29973 minValue: this.opts.minValue.current, 29974 maxValue: this.opts.maxValue.current, 29975 placeholderYear: this.initialPlaceholderYear 29976 }); 29977 }); 29978 get defaultYears() { 29979 return get$2(this.#defaultYears); 29980 } 29981 set defaultYears(value) { 29982 set(this.#defaultYears, value); 29983 } 29984 #setupInitialFocusEffect() { 29985 user_effect(() => { 29986 if (untrack(() => this.opts.initialFocus.current)) { 29987 const firstFocusedDay = this.opts.ref.current?.querySelector(`[data-focused]`); 29988 if (firstFocusedDay) firstFocusedDay.focus(); 29989 } 29990 }); 29991 } 29992 #setupAccessibleHeadingEffect() { 29993 user_effect(() => { 29994 if (!this.opts.ref.current) return; 29995 return createAccessibleHeading({ 29996 calendarNode: this.opts.ref.current, 29997 label: this.fullCalendarLabel, 29998 accessibleHeadingId: this.accessibleHeadingId 29999 }); 30000 }); 30001 } 30002 #setupFormatterEffect() { 30003 user_pre_effect(() => { 30004 if (this.formatter.getLocale() === this.opts.locale.current) return; 30005 this.formatter.setLocale(this.opts.locale.current); 30006 }); 30007 } 30008 /** 30009 * Navigates to the next page of the calendar. 30010 */ 30011 nextPage() { 30012 handleCalendarNextPage({ 30013 fixedWeeks: this.opts.fixedWeeks.current, 30014 locale: this.opts.locale.current, 30015 numberOfMonths: this.opts.numberOfMonths.current, 30016 pagedNavigation: this.opts.pagedNavigation.current, 30017 setMonths: this.setMonths, 30018 setPlaceholder: (date) => this.opts.placeholder.current = date, 30019 weekStartsOn: this.opts.weekStartsOn.current, 30020 months: this.months 30021 }); 30022 } 30023 /** 30024 * Navigates to the previous page of the calendar. 30025 */ 30026 prevPage() { 30027 handleCalendarPrevPage({ 30028 fixedWeeks: this.opts.fixedWeeks.current, 30029 locale: this.opts.locale.current, 30030 numberOfMonths: this.opts.numberOfMonths.current, 30031 pagedNavigation: this.opts.pagedNavigation.current, 30032 setMonths: this.setMonths, 30033 setPlaceholder: (date) => this.opts.placeholder.current = date, 30034 weekStartsOn: this.opts.weekStartsOn.current, 30035 months: this.months 30036 }); 30037 } 30038 nextYear() { 30039 this.opts.placeholder.current = this.opts.placeholder.current.add({ years: 1 }); 30040 } 30041 prevYear() { 30042 this.opts.placeholder.current = this.opts.placeholder.current.subtract({ years: 1 }); 30043 } 30044 setYear(year) { 30045 this.opts.placeholder.current = this.opts.placeholder.current.set({ year }); 30046 } 30047 setMonth(month) { 30048 this.opts.placeholder.current = this.opts.placeholder.current.set({ month }); 30049 } 30050 #isNextButtonDisabled = /* @__PURE__ */ user_derived(() => { 30051 return getIsNextButtonDisabled({ 30052 maxValue: this.opts.maxValue.current, 30053 months: this.months, 30054 disabled: this.opts.disabled.current 30055 }); 30056 }); 30057 get isNextButtonDisabled() { 30058 return get$2(this.#isNextButtonDisabled); 30059 } 30060 set isNextButtonDisabled(value) { 30061 set(this.#isNextButtonDisabled, value); 30062 } 30063 #isPrevButtonDisabled = /* @__PURE__ */ user_derived(() => { 30064 return getIsPrevButtonDisabled({ 30065 minValue: this.opts.minValue.current, 30066 months: this.months, 30067 disabled: this.opts.disabled.current 30068 }); 30069 }); 30070 get isPrevButtonDisabled() { 30071 return get$2(this.#isPrevButtonDisabled); 30072 } 30073 set isPrevButtonDisabled(value) { 30074 set(this.#isPrevButtonDisabled, value); 30075 } 30076 #isInvalid = /* @__PURE__ */ user_derived(() => { 30077 const value = this.opts.value.current; 30078 const isDateDisabled = this.opts.isDateDisabled.current; 30079 const isDateUnavailable = this.opts.isDateUnavailable.current; 30080 if (Array.isArray(value)) { 30081 if (!value.length) return false;
30082 for (const date of value) { 30083 if (isDateDisabled(date)) return true; 30084 if (isDateUnavailable(date)) return true; 30085 } 30086 } else { 30087 if (!value) return false; 30088 if (isDateDisabled(value)) return true; 30089 if (isDateUnavailable(value)) return true; 30090 } 30091 return false; 30092 }); 30093 get isInvalid() { 30094 return get$2(this.#isInvalid); 30095 } 30096 set isInvalid(value) { 30097 set(this.#isInvalid, value); 30098 } 30099 #headingValue = /* @__PURE__ */ user_derived(() => { 30100 this.opts.monthFormat.current; 30101 this.opts.yearFormat.current; 30102 return getCalendarHeadingValue({ 30103 months: this.months, 30104 formatter: this.formatter, 30105 locale: this.opts.locale.current 30106 }); 30107 }); 30108 get headingValue() { 30109 return get$2(this.#headingValue); 30110 } 30111 set headingValue(value) { 30112 set(this.#headingValue, value); 30113 } 30114 #fullCalendarLabel = /* @__PURE__ */ user_derived(() => { 30115 return `${this.opts.calendarLabel.current} ${this.headingValue}`; 30116 }); 30117 get fullCalendarLabel() { 30118 return get$2(this.#fullCalendarLabel); 30119 } 30120 set fullCalendarLabel(value) { 30121 set(this.#fullCalendarLabel, value); 30122 } 30123 isOutsideVisibleMonths(date) { 30124 return !this.visibleMonths.some((month) => $ad063034c8620db8$export$a18c89cbd24170ff(date, month)); 30125 } 30126 isDateDisabled(date) { 30127 if (this.opts.isDateDisabled.current(date) || this.opts.disabled.current) return true; 30128 const minValue = this.opts.minValue.current; 30129 const maxValue = this.opts.maxValue.current; 30130 if (minValue && isBefore(date, minValue)) return true; 30131 if (maxValue && isBefore(maxValue, date)) return true; 30132 return false; 30133 } 30134 isDateSelected(date) { 30135 const value = this.opts.value.current; 30136 if (Array.isArray(value)) return value.some((d) => $ad063034c8620db8$export$ea39ec197993aef0(d, date)); 30137 else if (!value) return false; 30138 return $ad063034c8620db8$export$ea39ec197993aef0(value, date); 30139 } 30140 shiftFocus(node, add) { 30141 return shiftCalendarFocus({ 30142 node, 30143 add, 30144 placeholder: this.opts.placeholder, 30145 calendarNode: this.opts.ref.current, 30146 isPrevButtonDisabled: this.isPrevButtonDisabled, 30147 isNextButtonDisabled: this.isNextButtonDisabled, 30148 months: this.months, 30149 numberOfMonths: this.opts.numberOfMonths.current 30150 }); 30151 } 30152 #isMultipleSelectionValid(selectedDates) { 30153 if (this.opts.type.current !== "multiple") return true; 30154 if (!this.opts.maxDays.current) return true; 30155 const selectedCount = selectedDates.length; 30156 if (this.opts.maxDays.current && selectedCount > this.opts.maxDays.current) return false; 30157 return true; 30158 } 30159 handleCellClick(_, date) { 30160 if (this.opts.readonly.current || this.opts.isDateDisabled.current?.(date) || this.opts.isDateUnavailable.current?.(date)) return; 30161 const prev = this.opts.value.current; 30162 if (this.opts.type.current === "multiple") { 30163 if (Array.isArray(prev) || prev === void 0) this.opts.value.current = this.handleMultipleUpdate(prev, date); 30164 } else if (!Array.isArray(prev)) { 30165 const next = this.handleSingleUpdate(prev, date); 30166 if (!next) this.announcer.announce("Selected date is now empty.", "polite", 5e3); 30167 else this.announcer.announce(`Selected Date: ${this.formatter.selectedDate(next, false)}`, "polite"); 30168 this.opts.value.current = getDateWithPreviousTime(next, prev); 30169 if (next !== void 0) this.opts.onDateSelect?.current?.(); 30170 } 30171 } 30172 handleMultipleUpdate(prev, date) { 30173 if (!prev) { 30174 const newSelection = [date]; 30175 return this.#isMultipleSelectionValid(newSelection) ? newSelection : [date]; 30176 } 30177 if (!Array.isArray(prev)) return; 30178 const index = prev.findIndex((d) => $ad063034c8620db8$export$ea39ec197993aef0(d, date)); 30179 const preventDeselect = this.opts.preventDeselect.current; 30180 if (index === -1) { 30181 const newSelection = [...prev, date]; 30182 if (this.#isMultipleSelectionValid(newSelection)) return newSelection; 30183 else return [date]; 30184 } else if (preventDeselect) return prev; 30185 else { 30186 const next = prev.filter((d) => !$ad063034c8620db8$export$ea39ec197993aef0(d, date)); 30187 if (!next.length) { 30188 this.opts.placeholder.current = date; 30189 return; 30190 } 30191 return next; 30192 } 30193 } 30194 handleSingleUpdate(prev, date) { 30195 if (Array.isArray(prev)) {} 30196 if (!prev) return date; 30197 if (!this.opts.preventDeselect.current && $ad063034c8620db8$export$ea39ec197993aef0(prev, date)) { 30198 this.opts.placeholder.current = date; 30199 return; 30200 } 30201 return date; 30202 } 30203 onkeydown(event) { 30204 handleCalendarKeydown({ 30205 event, 30206 handleCellClick: this.handleCellClick, 30207 shiftFocus: this.shiftFocus, 30208 placeholderValue: this.opts.placeholder.current 30209 }); 30210 } 30211 #snippetProps = /* @__PURE__ */ user_derived(() => ({ 30212 months: this.months, 30213 weekdays: this.weekdays 30214 })); 30215 get snippetProps() { 30216 return get$2(this.#snippetProps); 30217 } 30218 set snippetProps(value) { 30219 set(this.#snippetProps, value); 30220 } 30221 getBitsAttr = (part) => { 30222 return calendarAttrs.getAttr(part); 30223 }; 30224 #props = /* @__PURE__ */ user_derived(() => ({ 30225 ...getCalendarElementProps({ 30226 fullCalendarLabel: this.fullCalendarLabel, 30227 id: this.opts.id.current, 30228 isInvalid: this.isInvalid, 30229 disabled: this.opts.disabled.current, 30230 readonly: this.opts.readonly.current 30231 }), 30232 [this.getBitsAttr("root")]: "", 30233 onkeydown: this.onkeydown, 30234 ...this.attachment 30235 })); 30236 get props() { 30237 return get$2(this.#props); 30238 } 30239 set props(value) { 30240 set(this.#props, value); 30241 } 30242 }; 30243 var CalendarHeadingState = class CalendarHeadingState { 30244 static create(opts) { 30245 return new CalendarHeadingState(opts, CalendarRootContext.get()); 30246 } 30247 opts; 30248 root; 30249 attachment; 30250 constructor(opts, root) { 30251 this.opts = opts; 30252 this.root = root; 30253 this.attachment = attachRef(this.opts.ref); 30254 } 30255 #props = /* @__PURE__ */ user_derived(() => ({ 30256 id: this.opts.id.current, 30257 "aria-hidden": boolToStrTrueOrUndef(true), 30258 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30259 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30260 [this.root.getBitsAttr("heading")]: "", 30261 ...this.attachment 30262 })); 30263 get props() { 30264 return get$2(this.#props); 30265 } 30266 set props(value) { 30267 set(this.#props, value); 30268 } 30269 }; 30270 var CalendarCellContext = new Context("Calendar.Cell | RangeCalendar.Cell"); 30271 var CalendarCellState = class CalendarCellState { 30272 static create(opts) { 30273 return CalendarCellContext.set(new CalendarCellState(opts, CalendarRootContext.get())); 30274 } 30275 opts; 30276 root; 30277 #cellDate = /* @__PURE__ */ user_derived(() => toDate(this.opts.date.current)); 30278 get cellDate() { 30279 return get$2(this.#cellDate); 30280 } 30281 set cellDate(value) { 30282 set(this.#cellDate, value); 30283 } 30284 #isUnavailable = /* @__PURE__ */ user_derived(() => this.root.opts.isDateUnavailable.current(this.opts.date.current)); 30285 get isUnavailable() { 30286 return get$2(this.#isUnavailable); 30287 } 30288 set isUnavailable(value) { 30289 set(this.#isUnavailable, value); 30290 } 30291 #isDateToday = /* @__PURE__ */ user_derived(() => $ad063034c8620db8$export$629b0a497aa65267(this.opts.date.current, $ad063034c8620db8$export$aa8b41735afcabd2())); 30292 get isDateToday() { 30293 return get$2(this.#isDateToday); 30294 } 30295 set isDateToday(value) { 30296 set(this.#isDateToday, value); 30297 } 30298 #isOutsideMonth = /* @__PURE__ */ user_derived(() => !$ad063034c8620db8$export$a18c89cbd24170ff(this.opts.date.current, this.opts.month.current)); 30299 get isOutsideMonth() { 30300 return get$2(this.#isOutsideMonth); 30301 } 30302 set isOutsideMonth(value) { 30303 set(this.#isOutsideMonth, value); 30304 } 30305 #isOutsideVisibleMonths = /* @__PURE__ */ user_derived(() => this.root.isOutsideVisibleMonths(this.opts.date.current)); 30306 get isOutsideVisibleMonths() { 30307 return get$2(this.#isOutsideVisibleMonths); 30308 } 30309 set isOutsideVisibleMonths(value) { 30310 set(this.#isOutsideVisibleMonths, value); 30311 } 30312 #isDisabled = /* @__PURE__ */ user_derived(() => this.root.isDateDisabled(this.opts.date.current) || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current); 30313 get isDisabled() { 30314 return get$2(this.#isDisabled); 30315 } 30316 set isDisabled(value) { 30317 set(this.#isDisabled, value); 30318 } 30319 #isFocusedDate = /* @__PURE__ */ user_derived(() => $ad063034c8620db8$export$ea39ec197993aef0(this.opts.date.current, this.root.opts.placeholder.current)); 30320 get isFocusedDate() { 30321 return get$2(this.#isFocusedDate); 30322 } 30323 set isFocusedDate(value) { 30324 set(this.#isFocusedDate, value); 30325 } 30326 #isSelectedDate = /* @__PURE__ */ user_derived(() => this.root.isDateSelected(this.opts.date.current));
30327 get isSelectedDate() { 30328 return get$2(this.#isSelectedDate); 30329 } 30330 set isSelectedDate(value) { 30331 set(this.#isSelectedDate, value); 30332 } 30333 #labelText = /* @__PURE__ */ user_derived(() => this.root.formatter.custom(this.cellDate, { 30334 weekday: "long", 30335 month: "long", 30336 day: "numeric", 30337 year: "numeric" 30338 })); 30339 get labelText() { 30340 return get$2(this.#labelText); 30341 } 30342 set labelText(value) { 30343 set(this.#labelText, value); 30344 } 30345 attachment; 30346 constructor(opts, root) { 30347 this.opts = opts; 30348 this.root = root; 30349 this.attachment = attachRef(this.opts.ref); 30350 } 30351 #snippetProps = /* @__PURE__ */ user_derived(() => ({ 30352 disabled: this.isDisabled, 30353 unavailable: this.isUnavailable, 30354 selected: this.isSelectedDate, 30355 day: `${this.opts.date.current.day}` 30356 })); 30357 get snippetProps() { 30358 return get$2(this.#snippetProps); 30359 } 30360 set snippetProps(value) { 30361 set(this.#snippetProps, value); 30362 } 30363 #ariaDisabled = /* @__PURE__ */ user_derived(() => { 30364 return this.isDisabled || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current || this.isUnavailable; 30365 }); 30366 get ariaDisabled() { 30367 return get$2(this.#ariaDisabled); 30368 } 30369 set ariaDisabled(value) { 30370 set(this.#ariaDisabled, value); 30371 } 30372 #sharedDataAttrs = /* @__PURE__ */ user_derived(() => ({ 30373 "data-unavailable": boolToEmptyStrOrUndef(this.isUnavailable), 30374 "data-today": this.isDateToday ? "" : void 0, 30375 "data-outside-month": this.isOutsideMonth ? "" : void 0, 30376 "data-outside-visible-months": this.isOutsideVisibleMonths ? "" : void 0, 30377 "data-focused": this.isFocusedDate ? "" : void 0, 30378 "data-selected": boolToEmptyStrOrUndef(this.isSelectedDate), 30379 "data-value": this.opts.date.current.toString(), 30380 "data-type": getDateValueType(this.opts.date.current), 30381 "data-disabled": boolToEmptyStrOrUndef(this.isDisabled || this.isOutsideMonth && this.root.opts.disableDaysOutsideMonth.current) 30382 })); 30383 get sharedDataAttrs() { 30384 return get$2(this.#sharedDataAttrs); 30385 } 30386 set sharedDataAttrs(value) { 30387 set(this.#sharedDataAttrs, value); 30388 } 30389 #props = /* @__PURE__ */ user_derived(() => ({ 30390 id: this.opts.id.current, 30391 role: "gridcell", 30392 "aria-selected": boolToStr(this.isSelectedDate), 30393 "aria-disabled": boolToStr(this.ariaDisabled), 30394 ...this.sharedDataAttrs, 30395 [this.root.getBitsAttr("cell")]: "", 30396 ...this.attachment 30397 })); 30398 get props() { 30399 return get$2(this.#props); 30400 } 30401 set props(value) { 30402 set(this.#props, value); 30403 } 30404 }; 30405 var CalendarDayState = class CalendarDayState { 30406 static create(opts) { 30407 return new CalendarDayState(opts, CalendarCellContext.get()); 30408 } 30409 opts; 30410 cell; 30411 attachment; 30412 constructor(opts, cell) { 30413 this.opts = opts; 30414 this.cell = cell; 30415 this.onclick = this.onclick.bind(this); 30416 this.attachment = attachRef(this.opts.ref); 30417 } 30418 #tabindex = /* @__PURE__ */ user_derived(() => this.cell.isOutsideMonth && this.cell.root.opts.disableDaysOutsideMonth.current || this.cell.isDisabled ? void 0 : this.cell.isFocusedDate ? 0 : -1); 30419 onclick(e) { 30420 if (this.cell.isDisabled) return; 30421 this.cell.root.handleCellClick(e, this.cell.opts.date.current); 30422 } 30423 #snippetProps = /* @__PURE__ */ user_derived(() => ({ 30424 disabled: this.cell.isDisabled, 30425 unavailable: this.cell.isUnavailable, 30426 selected: this.cell.isSelectedDate, 30427 day: `${this.cell.opts.date.current.day}` 30428 })); 30429 get snippetProps() { 30430 return get$2(this.#snippetProps); 30431 } 30432 set snippetProps(value) { 30433 set(this.#snippetProps, value); 30434 } 30435 #props = /* @__PURE__ */ user_derived(() => ({ 30436 id: this.opts.id.current, 30437 role: "button", 30438 "aria-label": this.cell.labelText, 30439 "aria-disabled": boolToStr(this.cell.ariaDisabled), 30440 ...this.cell.sharedDataAttrs, 30441 tabindex: get$2(this.#tabindex), 30442 [this.cell.root.getBitsAttr("day")]: "", 30443 "data-bits-day": "", 30444 onclick: this.onclick, 30445 ...this.attachment 30446 })); 30447 get props() { 30448 return get$2(this.#props); 30449 } 30450 set props(value) { 30451 set(this.#props, value); 30452 } 30453 }; 30454 var CalendarNextButtonState = class CalendarNextButtonState { 30455 static create(opts) { 30456 return new CalendarNextButtonState(opts, CalendarRootContext.get()); 30457 } 30458 opts; 30459 root; 30460 #isDisabled = /* @__PURE__ */ user_derived(() => this.root.isNextButtonDisabled); 30461 get isDisabled() { 30462 return get$2(this.#isDisabled); 30463 } 30464 set isDisabled(value) { 30465 set(this.#isDisabled, value); 30466 } 30467 attachment; 30468 constructor(opts, root) { 30469 this.opts = opts; 30470 this.root = root; 30471 this.onclick = this.onclick.bind(this); 30472 this.attachment = attachRef(this.opts.ref); 30473 } 30474 onclick(_) { 30475 if (this.isDisabled) return; 30476 this.root.nextPage(); 30477 } 30478 #props = /* @__PURE__ */ user_derived(() => ({ 30479 id: this.opts.id.current, 30480 role: "button", 30481 type: "button", 30482 "aria-label": "Next", 30483 "aria-disabled": boolToStr(this.isDisabled), 30484 "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), 30485 disabled: this.isDisabled, 30486 [this.root.getBitsAttr("next-button")]: "", 30487 onclick: this.onclick, 30488 ...this.attachment 30489 })); 30490 get props() { 30491 return get$2(this.#props); 30492 } 30493 set props(value) { 30494 set(this.#props, value); 30495 } 30496 }; 30497 var CalendarPrevButtonState = class CalendarPrevButtonState { 30498 static create(opts) { 30499 return new CalendarPrevButtonState(opts, CalendarRootContext.get()); 30500 } 30501 opts; 30502 root; 30503 #isDisabled = /* @__PURE__ */ user_derived(() => this.root.isPrevButtonDisabled); 30504 get isDisabled() { 30505 return get$2(this.#isDisabled); 30506 } 30507 set isDisabled(value) { 30508 set(this.#isDisabled, value); 30509 } 30510 attachment; 30511 constructor(opts, root) { 30512 this.opts = opts; 30513 this.root = root; 30514 this.onclick = this.onclick.bind(this); 30515 this.attachment = attachRef(this.opts.ref); 30516 } 30517 onclick(_) { 30518 if (this.isDisabled) return; 30519 this.root.prevPage(); 30520 } 30521 #props = /* @__PURE__ */ user_derived(() => ({ 30522 id: this.opts.id.current, 30523 role: "button", 30524 type: "button", 30525 "aria-label": "Previous", 30526 "aria-disabled": boolToStr(this.isDisabled), 30527 "data-disabled": boolToEmptyStrOrUndef(this.isDisabled), 30528 disabled: this.isDisabled, 30529 [this.root.getBitsAttr("prev-button")]: "", 30530 onclick: this.onclick, 30531 ...this.attachment 30532 })); 30533 get props() { 30534 return get$2(this.#props); 30535 } 30536 set props(value) { 30537 set(this.#props, value); 30538 } 30539 }; 30540 var CalendarGridState = class CalendarGridState { 30541 static create(opts) { 30542 return new CalendarGridState(opts, CalendarRootContext.get()); 30543 } 30544 opts; 30545 root; 30546 attachment; 30547 constructor(opts, root) { 30548 this.opts = opts; 30549 this.root = root; 30550 this.attachment = attachRef(this.opts.ref); 30551 } 30552 #props = /* @__PURE__ */ user_derived(() => ({ 30553 id: this.opts.id.current, 30554 tabindex: -1, 30555 role: "grid", 30556 "aria-readonly": boolToStr(this.root.opts.readonly.current), 30557 "aria-disabled": boolToStr(this.root.opts.disabled.current), 30558 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30559 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30560 [this.root.getBitsAttr("grid")]: "", 30561 ...this.attachment 30562 })); 30563 get props() { 30564 return get$2(this.#props); 30565 } 30566 set props(value) { 30567 set(this.#props, value); 30568 } 30569 }; 30570 var CalendarGridBodyState = class CalendarGridBodyState { 30571 static create(opts) { 30572 return new CalendarGridBodyState(opts, CalendarRootContext.get()); 30573 } 30574 opts; 30575 root; 30576 attachment; 30577 constructor(opts, root) { 30578 this.opts = opts; 30579 this.root = root; 30580 this.attachment = attachRef(this.opts.ref); 30581 } 30582 #props = /* @__PURE__ */ user_derived(() => ({ 30583 id: this.opts.id.current, 30584 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30585 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30586 [this.root.getBitsAttr("grid-body")]: "", 30587 ...this.attachment 30588 })); 30589 get props() { 30590 return get$2(this.#props); 30591 } 30592 set props(value) { 30593 set(this.#props, value); 30594 } 30595 }; 30596 var CalendarGridHeadState = class CalendarGridHeadState { 30597 static create(opts) { 30598 return new CalendarGridHeadState(opts, CalendarRootContext.get()); 30599 } 30600 opts; 30601 root; 30602 attachment; 30603 constructor(opts, root) { 30604 this.opts = opts; 30605 this.root = root; 30606 this.attachment = attachRef(this.opts.ref); 30607 } 30608 #props = /* @__PURE__ */ user_derived(() => ({ 30609 id: this.opts.id.current, 30610 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30611 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30612 [this.root.getBitsAttr("grid-head")]: "", 30613 ...this.attachment 30614 })); 30615 get props() { 30616 return get$2(this.#props); 30617 } 30618 set props(value) { 30619 set(this.#props, value); 30620 } 30621 }; 30622 var CalendarGridRowState = class CalendarGridRowState { 30623 static create(opts) { 30624 return new CalendarGridRowState(opts, CalendarRootContext.get()); 30625 } 30626 opts; 30627 root; 30628 attachment; 30629 constructor(opts, root) { 30630 this.opts = opts; 30631 this.root = root; 30632 this.attachment = attachRef(this.opts.ref); 30633 } 30634 #props = /* @__PURE__ */ user_derived(() => ({ 30635 id: this.opts.id.current, 30636 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30637 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30638 [this.root.getBitsAttr("grid-row")]: "", 30639 ...this.attachment 30640 })); 30641 get props() { 30642 return get$2(this.#props); 30643 } 30644 set props(value) { 30645 set(this.#props, value); 30646 } 30647 }; 30648 var CalendarHeadCellState = class CalendarHeadCellState { 30649 static create(opts) { 30650 return new CalendarHeadCellState(opts, CalendarRootContext.get()); 30651 } 30652 opts; 30653 root; 30654 attachment; 30655 constructor(opts, root) { 30656 this.opts = opts; 30657 this.root = root; 30658 this.attachment = attachRef(this.opts.ref); 30659 } 30660 #props = /* @__PURE__ */ user_derived(() => ({ 30661 id: this.opts.id.current, 30662 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30663 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30664 [this.root.getBitsAttr("head-cell")]: "", 30665 ...this.attachment 30666 })); 30667 get props() { 30668 return get$2(this.#props); 30669 } 30670 set props(value) { 30671 set(this.#props, value); 30672 } 30673 }; 30674 var CalendarHeaderState = class CalendarHeaderState { 30675 static create(opts) { 30676 return new CalendarHeaderState(opts, CalendarRootContext.get()); 30677 } 30678 opts; 30679 root; 30680 attachment; 30681 constructor(opts, root) { 30682 this.opts = opts; 30683 this.root = root; 30684 this.attachment = attachRef(this.opts.ref); 30685 } 30686 #props = /* @__PURE__ */ user_derived(() => ({ 30687 id: this.opts.id.current, 30688 "data-disabled": boolToEmptyStrOrUndef(this.root.opts.disabled.current), 30689 "data-readonly": boolToEmptyStrOrUndef(this.root.opts.readonly.current), 30690 [this.root.getBitsAttr("header")]: "", 30691 ...this.attachment 30692 })); 30693 get props() { 30694 return get$2(this.#props); 30695 } 30696 set props(value) { 30697 set(this.#props, value); 30698 } 30699 }; 30700 //#endregion 30701 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar.svelte 30702 var rest_excludes$25 = new Set([ 30703 "$$slots", 30704 "$$events", 30705 "$$legacy", 30706 "$$host", 30707 "child", 30708 "children", 30709 "id", 30710 "ref", 30711 "value", 30712 "onValueChange", 30713 "placeholder", 30714 "onPlaceholderChange", 30715 "weekdayFormat", 30716 "weekStartsOn", 30717 "pagedNavigation", 30718 "isDateDisabled", 30719 "isDateUnavailable", 30720 "fixedWeeks", 30721 "numberOfMonths", 30722 "locale", 30723 "calendarLabel", 30724 "disabled", 30725 "readonly", 30726 "minValue", 30727 "maxValue", 30728 "preventDeselect", 30729 "type", 30730 "disableDaysOutsideMonth", 30731 "initialFocus", 30732 "maxDays", 30733 "monthFormat", 30734 "yearFormat" 30735 ]); 30736 var root$36 = /* @__PURE__ */ from_html(`<div><!></div>`); 30737 function Calendar$1($$anchor, $$props) { 30738 push($$props, true); 30739 let child$18 = prop($$props, "child", 7), children = prop($$props, "children", 7), id = prop($$props, "id", 23, useId), ref = prop($$props, "ref", 15, null), value = prop($$props, "value", 15), onValueChange = prop($$props, "onValueChange", 7, noop), placeholder = prop($$props, "placeholder", 15), onPlaceholderChange = prop($$props, "onPlaceholderChange", 7, noop), weekdayFormat = prop($$props, "weekdayFormat", 7, "narrow"), weekStartsOn = prop($$props, "weekStartsOn", 7), pagedNavigation = prop($$props, "pagedNavigation", 7, false), isDateDisabled = prop($$props, "isDateDisabled", 7, () => false), isDateUnavailable = prop($$props, "isDateUnavailable", 7, () => false), fixedWeeks = prop($$props, "fixedWeeks", 7, false), numberOfMonths = prop($$props, "numberOfMonths", 7, 1), locale = prop($$props, "locale", 7), calendarLabel = prop($$props, "calendarLabel", 7, "Event"), disabled = prop($$props, "disabled", 7, false), readonly = prop($$props, "readonly", 7, false), minValue = prop($$props, "minValue", 7, void 0), maxValue = prop($$props, "maxValue", 7, void 0), preventDeselect = prop($$props, "preventDeselect", 7, false), type = prop($$props, "type", 7), disableDaysOutsideMonth = prop($$props, "disableDaysOutsideMonth", 7, true), initialFocus = prop($$props, "initialFocus", 7, false), maxDays = prop($$props, "maxDays", 7), monthFormat = prop($$props, "monthFormat", 7, "long"), yearFormat = prop($$props, "yearFormat", 7, "numeric"), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$25); 30740 const defaultPlaceholder = getDefaultDate({ 30741 defaultValue: value(), 30742 minValue: minValue(), 30743 maxValue: maxValue() 30744 }); 30745 function handleDefaultPlaceholder() { 30746 if (placeholder() !== void 0) return; 30747 placeholder(defaultPlaceholder); 30748 } 30749 handleDefaultPlaceholder(); 30750 watch.pre(() => placeholder(), () => { 30751 handleDefaultPlaceholder(); 30752 }); 30753 function handleDefaultValue() { 30754 if (value() !== void 0) return; 30755 value(type() === "single" ? void 0 : []); 30756 } 30757 handleDefaultValue(); 30758 watch.pre(() => value(), () => { 30759 handleDefaultValue(); 30760 }); 30761 const rootState = CalendarRootState.create({ 30762 id: boxWith(() => id()), 30763 ref: boxWith(() => ref(), (v) => ref(v)), 30764 weekdayFormat: boxWith(() => weekdayFormat()), 30765 weekStartsOn: boxWith(() => weekStartsOn()), 30766 pagedNavigation: boxWith(() => pagedNavigation()), 30767 isDateDisabled: boxWith(() => isDateDisabled()), 30768 isDateUnavailable: boxWith(() => isDateUnavailable()), 30769 fixedWeeks: boxWith(() => fixedWeeks()), 30770 numberOfMonths: boxWith(() => numberOfMonths()), 30771 locale: resolveLocaleProp(() => locale()), 30772 calendarLabel: boxWith(() => calendarLabel()), 30773 readonly: boxWith(() => readonly()), 30774 disabled: boxWith(() => disabled()), 30775 minValue: boxWith(() => minValue()), 30776 maxValue: boxWith(() => maxValue()), 30777 disableDaysOutsideMonth: boxWith(() => disableDaysOutsideMonth()), 30778 initialFocus: boxWith(() => initialFocus()), 30779 maxDays: boxWith(() => maxDays()), 30780 placeholder: boxWith(() => placeholder(), (v) => { 30781 placeholder(v); 30782 onPlaceholderChange()(v); 30783 }), 30784 preventDeselect: boxWith(() => preventDeselect()), 30785 value: boxWith(() => value(), (v) => { 30786 value(v); 30787 onValueChange()(v); 30788 }), 30789 type: boxWith(() => type()), 30790 monthFormat: boxWith(() => monthFormat()), 30791 yearFormat: boxWith(() => yearFormat()), 30792 defaultPlaceholder 30793 }); 30794 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, rootState.props)); 30795 var $$exports = { 30796 get child() { 30797 return child$18(); 30798 }, 30799 set child($$value) { 30800 child$18($$value); 30801 flushSync(); 30802 }, 30803 get children() { 30804 return children(); 30805 }, 30806 set children($$value) { 30807 children($$value); 30808 flushSync(); 30809 }, 30810 get id() { 30811 return id(); 30812 }, 30813 set id($$value = useId()) { 30814 id($$value); 30815 flushSync(); 30816 }, 30817 get ref() { 30818 return ref(); 30819 }, 30820 set ref($$value = null) { 30821 ref($$value); 30822 flushSync(); 30823 }, 30824 get value() { 30825 return value(); 30826 }, 30827 set value($$value) { 30828 value($$value); 30829 flushSync(); 30830 }, 30831 get onValueChange() { 30832 return onValueChange(); 30833 }, 30834 set onValueChange($$value = noop) { 30835 onValueChange($$value); 30836 flushSync(); 30837 }, 30838 get placeholder() { 30839 return placeholder(); 30840 }, 30841 set placeholder($$value) { 30842 placeholder($$value); 30843 flushSync(); 30844 }, 30845 get onPlaceholderChange() { 30846 return onPlaceholderChange(); 30847 }, 30848 set onPlaceholderChange($$value = noop) { 30849 onPlaceholderChange($$value); 30850 flushSync(); 30851 }, 30852 get weekdayFormat() { 30853 return weekdayFormat(); 30854 }, 30855 set weekdayFormat($$value = "narrow") { 30856 weekdayFormat($$value); 30857 flushSync(); 30858 }, 30859 get weekStartsOn() { 30860 return weekStartsOn(); 30861 }, 30862 set weekStartsOn($$value) { 30863 weekStartsOn($$value); 30864 flushSync(); 30865 }, 30866 get p
30866agedNavigation() { 30867 return pagedNavigation(); 30868 }, 30869 set pagedNavigation($$value = false) { 30870 pagedNavigation($$value); 30871 flushSync(); 30872 }, 30873 get isDateDisabled() { 30874 return isDateDisabled(); 30875 }, 30876 set isDateDisabled($$value = () => false) { 30877 isDateDisabled($$value); 30878 flushSync(); 30879 }, 30880 get isDateUnavailable() { 30881 return isDateUnavailable(); 30882 }, 30883 set isDateUnavailable($$value = () => false) { 30884 isDateUnavailable($$value); 30885 flushSync(); 30886 }, 30887 get fixedWeeks() { 30888 return fixedWeeks(); 30889 }, 30890 set fixedWeeks($$value = false) { 30891 fixedWeeks($$value); 30892 flushSync(); 30893 }, 30894 get numberOfMonths() { 30895 return numberOfMonths(); 30896 }, 30897 set numberOfMonths($$value = 1) { 30898 numberOfMonths($$value); 30899 flushSync(); 30900 }, 30901 get locale() { 30902 return locale(); 30903 }, 30904 set locale($$value) { 30905 locale($$value); 30906 flushSync(); 30907 }, 30908 get calendarLabel() { 30909 return calendarLabel(); 30910 }, 30911 set calendarLabel($$value = "Event") { 30912 calendarLabel($$value); 30913 flushSync(); 30914 }, 30915 get disabled() { 30916 return disabled(); 30917 }, 30918 set disabled($$value = false) { 30919 disabled($$value); 30920 flushSync(); 30921 }, 30922 get readonly() { 30923 return readonly(); 30924 }, 30925 set readonly($$value = false) { 30926 readonly($$value); 30927 flushSync(); 30928 }, 30929 get minValue() { 30930 return minValue(); 30931 }, 30932 set minValue($$value = void 0) { 30933 minValue($$value); 30934 flushSync(); 30935 }, 30936 get maxValue() { 30937 return maxValue(); 30938 }, 30939 set maxValue($$value = void 0) { 30940 maxValue($$value); 30941 flushSync(); 30942 }, 30943 get preventDeselect() { 30944 return preventDeselect(); 30945 }, 30946 set preventDeselect($$value = false) { 30947 preventDeselect($$value); 30948 flushSync(); 30949 }, 30950 get type() { 30951 return type(); 30952 }, 30953 set type($$value) { 30954 type($$value); 30955 flushSync(); 30956 }, 30957 get disableDaysOutsideMonth() { 30958 return disableDaysOutsideMonth(); 30959 }, 30960 set disableDaysOutsideMonth($$value = true) { 30961 disableDaysOutsideMonth($$value); 30962 flushSync(); 30963 }, 30964 get initialFocus() { 30965 return initialFocus(); 30966 }, 30967 set initialFocus($$value = false) { 30968 initialFocus($$value); 30969 flushSync(); 30970 }, 30971 get maxDays() { 30972 return maxDays(); 30973 }, 30974 set maxDays($$value) { 30975 maxDays($$value); 30976 flushSync(); 30977 }, 30978 get monthFormat() { 30979 return monthFormat(); 30980 }, 30981 set monthFormat($$value = "long") { 30982 monthFormat($$value); 30983 flushSync(); 30984 }, 30985 get yearFormat() { 30986 return yearFormat(); 30987 }, 30988 set yearFormat($$value = "numeric") { 30989 yearFormat($$value); 30990 flushSync(); 30991 } 30992 }; 30993 var fragment = comment(); 30994 var node = first_child(fragment); 30995 var consequent = ($$anchor) => { 30996 var fragment_1 = comment(); 30997 var node_1 = first_child(fragment_1); 30998 { 30999 let $0 = /* @__PURE__ */ user_derived(() => ({ 31000 props: get$2(mergedProps), 31001 ...rootState.snippetProps 31002 })); 31003 snippet(node_1, child$18, () => get$2($0)); 31004 } 31005 append($$anchor, fragment_1); 31006 }; 31007 var alternate = ($$anchor) => { 31008 var div = root$36(); 31009 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 31010 snippet(child(div), () => children() ?? noop$1, () => rootState.snippetProps); 31011 reset(div); 31012 append($$anchor, div); 31013 }; 31014 if_block(node, ($$render) => { 31015 if (child$18()) $$render(consequent); 31016 else $$render(alternate, -1); 31017 }); 31018 append($$anchor, fragment); 31019 return pop($$exports); 31020 } 31021 create_custom_element(Calendar$1, { 31022 child: {}, 31023 children: {}, 31024 id: {}, 31025 ref: {}, 31026 value: {}, 31027 onValueChange: {}, 31028 placeholder: {}, 31029 onPlaceholderChange: {}, 31030 weekdayFormat: {}, 31031 weekStartsOn: {}, 31032 pagedNavigation: {}, 31033 isDateDisabled: {}, 31034 isDateUnavailable: {}, 31035 fixedWeeks: {}, 31036 numberOfMonths: {}, 31037 locale: {}, 31038 calendarLabel: {}, 31039 disabled: {}, 31040 readonly: {}, 31041 minValue: {}, 31042 maxValue: {}, 31043 preventDeselect: {}, 31044 type: {}, 31045 disableDaysOutsideMonth: {}, 31046 initialFocus: {}, 31047 maxDays: {}, 31048 monthFormat: {}, 31049 yearFormat: {} 31050 }, [], [], { mode: "open" }); 31051 //#endregion 31052 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-day.svelte 31053 var rest_excludes$24 = new Set([ 31054 "$$slots", 31055 "$$events", 31056 "$$legacy", 31057 "$$host", 31058 "children", 31059 "child", 31060 "ref", 31061 "id" 31062 ]); 31063 var root$35 = /* @__PURE__ */ from_html(`<div><!></div>`); 31064 function Calendar_day($$anchor, $$props) { 31065 const uid = props_id(); 31066 push($$props, true); 31067 let children = prop($$props, "children", 7), child$17 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () =>
31067 createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$24); 31068 const dayState = CalendarDayState.create({ 31069 id: boxWith(() => id()), 31070 ref: boxWith(() => ref(), (v) => ref(v)) 31071 }); 31072 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, dayState.props)); 31073 var $$exports = { 31074 get children() { 31075 return children(); 31076 }, 31077 set children($$value) { 31078 children($$value); 31079 flushSync(); 31080 }, 31081 get child() { 31082 return child$17(); 31083 }, 31084 set child($$value) { 31085 child$17($$value); 31086 flushSync(); 31087 }, 31088 get ref() { 31089 return ref(); 31090 }, 31091 set ref($$value = null) { 31092 ref($$value); 31093 flushSync(); 31094 }, 31095 get id() { 31096 return id(); 31097 }, 31098 set id($$value = createId(uid)) { 31099 id($$value); 31100 flushSync(); 31101 } 31102 }; 31103 var fragment = comment(); 31104 var node = first_child(fragment); 31105 var consequent = ($$anchor) => { 31106 var fragment_1 = comment(); 31107 var node_1 = first_child(fragment_1); 31108 { 31109 let $0 = /* @__PURE__ */ user_derived(() => ({ 31110 props: get$2(mergedProps), 31111 ...dayState.snippetProps 31112 })); 31113 snippet(node_1, child$17, () => get$2($0)); 31114 } 31115 append($$anchor, fragment_1); 31116 }; 31117 var alternate_1 = ($$anchor) => { 31118 var div = root$35(); 31119 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 31120 var node_2 = child(div); 31121 var consequent_1 = ($$anchor) => { 31122 var fragment_2 = comment(); 31123 snippet(first_child(fragment_2), () => children() ?? noop$1, () => dayState.snippetProps); 31124 append($$anchor, fragment_2); 31125 }; 31126 var alternate = ($$anchor) => { 31127 var text = text$1(); 31128 template_effect(() => set_text(text, dayState.cell.opts.date.current.day)); 31129 append($$anchor, text); 31130 }; 31131 if_block(node_2, ($$render) => { 31132 if (children()) $$render(consequent_1); 31133 else $$render(alternate, -1); 31134 }); 31135 reset(div); 31136 append($$anchor, div); 31137 }; 31138 if_block(node, ($$render) => { 31139 if (child$17()) $$render(consequent); 31140 else $$render(alternate_1, -1); 31141 }); 31142 append($$anchor, fragment); 31143 return pop($$exports); 31144 } 31145 create_custom_element(Calendar_day, { 31146 children: {}, 31147 child: {}, 31148 ref: {}, 31149 id: {} 31150 }, [], [], { mode: "open" }); 31151 //#endregion 31152 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-grid.svelte 31153 var rest_excludes$23 = new Set([ 31154 "$$slots", 31155 "$$events", 31156 "$$legacy", 31157 "$$host", 31158 "children", 31159 "child", 31160 "ref", 31161 "id" 31162 ]); 31163 var root$34 = /* @__PURE__ */ from_html(`<table><!></table>`); 31164 function Calendar_grid($$anchor, $$props) { 31165 const uid = props_id(); 31166 push($$props, true); 31167 let children = prop($$props, "children", 7), child$16 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$23); 31168 const gridState = CalendarGridState.create({ 31169 id: boxWith(() => id()), 31170 ref: boxWith(() => ref(), (v) => ref(v)) 31171 }); 31172 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, gridState.props)); 31173 var $$exports = { 31174 get children() { 31175 return children(); 31176 }, 31177 set children($$value) { 31178 children($$value); 31179 flushSync(); 31180 }, 31181 get child() { 31182 return child$16(); 31183 }, 31184 set child($$value) { 31185 child$16($$value); 31186 flushSync(); 31187 }, 31188 get ref() { 31189 return ref(); 31190 }, 31191 set ref($$value = null) { 31192 ref($$value); 31193 flushSync(); 31194 }, 31195 get id() { 31196 return id(); 31197 }, 31198 set id($$value = createId(uid)) { 31199 id($$value); 31200 flushSync(); 31201 } 31202 }; 31203 var fragment = comment(); 31204 var node = first_child(fragment); 31205 var consequent = ($$anchor) => { 31206 var fragment_1 = comment(); 31207 snippet(first_child(fragment_1), child$16, () => ({ props: get$2(mergedProps) })); 31208 append($$anchor, fragment_1); 31209 }; 31210 var alternate = ($$anchor) => { 31211 var table = root$34(); 31212 attribute_effect(table, () => ({ ...get$2(mergedProps) })); 31213 snippet(child(table), () => children() ?? noop$1); 31214 reset(table); 31215 append($$anchor, table); 31216 }; 31217 if_block(node, ($$render) => { 31218 if (child$16()) $$render(consequent); 31219 else $$render(alternate, -1); 31220 }); 31221 append($$anchor, fragment); 31222 return pop($$exports); 31223 }
31224 create_custom_element(Calendar_grid, { 31225 children: {}, 31226 child: {}, 31227 ref: {}, 31228 id: {} 31229 }, [], [], { mode: "open" }); 31230 //#endregion 31231 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-body.svelte 31232 var rest_excludes$22 = new Set([ 31233 "$$slots", 31234 "$$events", 31235 "$$legacy", 31236 "$$host", 31237 "children", 31238 "child", 31239 "ref", 31240 "id" 31241 ]); 31242 var root$33 = /* @__PURE__ */ from_html(`<tbody><!></tbody>`); 31243 function Calendar_grid_body($$anchor, $$props) { 31244 const uid = props_id(); 31245 push($$props, true); 31246 let children = prop($$props, "children", 7), child$15 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$22); 31247 const gridBodyState = CalendarGridBodyState.create({ 31248 id: boxWith(() => id()), 31249 ref: boxWith(() => ref(), (v) => ref(v)) 31250 }); 31251 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, gridBodyState.props)); 31252 var $$exports = { 31253 get children() { 31254 return children(); 31255 }, 31256 set children($$value) { 31257 children($$value); 31258 flushSync(); 31259 }, 31260 get child() { 31261 return child$15(); 31262 }, 31263 set child($$value) { 31264 child$15($$value); 31265 flushSync(); 31266 }, 31267 get ref() { 31268 return ref(); 31269 }, 31270 set ref($$value = null) { 31271 ref($$value); 31272 flushSync(); 31273 }, 31274 get id() { 31275 return id(); 31276 }, 31277 set id($$value = createId(uid)) { 31278 id($$value); 31279 flushSync(); 31280 } 31281 }; 31282 var fragment = comment(); 31283 var node = first_child(fragment); 31284 var consequent = ($$anchor) => { 31285 var fragment_1 = comment(); 31286 snippet(first_child(fragment_1), child$15, () => ({ props: get$2(mergedProps) })); 31287 append($$anchor, fragment_1); 31288 }; 31289 var alternate = ($$anchor) => { 31290 var tbody = root$33(); 31291 attribute_effect(tbody, () => ({ ...get$2(mergedProps) })); 31292 snippet(child(tbody), () => children() ?? noop$1); 31293 reset(tbody); 31294 append($$anchor, tbody); 31295 }; 31296 if_block(node, ($$render) => { 31297 if (child$15()) $$render(consequent); 31298 else $$render(alternate, -1); 31299 }); 31300 append($$anchor, fragment); 31301 return pop($$exports); 31302 } 31303 create_custom_element(Calendar_grid_body, { 31304 children: {}, 31305 child: {}, 31306 ref: {}, 31307 id: {} 31308 }, [], [], { mode: "open" }); 31309 //#endregion 31310 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-cell.svelte 31311 var rest_excludes$21 = new Set([ 31312 "$$slots", 31313 "$$events", 31314 "$$legacy", 31315 "$$host", 31316 "children", 31317 "child", 31318 "ref", 31319 "id", 31320 "date", 31321 "month" 31322 ]); 31323 var root$32 = /* @__PURE__ */ from_html(`<td><!></td>`); 31324 function Calendar_cell($$anchor, $$props) { 31325 const uid = props_id(); 31326 push($$props, true); 31327 let children = prop($$props, "children", 7), child$14 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), date = prop($$props, "date", 7), month = prop($$props, "month", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$21); 31328 const cellState = CalendarCellState.create({ 31329 id: boxWith(() => id()), 31330 ref: boxWith(() => ref(), (v) => ref(v)), 31331 date: boxWith(() => date()), 31332 month: boxWith(() => month()) 31333 }); 31334 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, cellState.props)); 31335 var $$exports = { 31336 get children() { 31337 return children(); 31338 }, 31339 set children($$value) { 31340 children($$value); 31341 flushSync(); 31342 }, 31343 get child() { 31344 return child$14(); 31345 }, 31346 set child($$value) { 31347 child$14($$value); 31348 flushSync(); 31349 }, 31350 get ref() { 31351 return ref(); 31352 }, 31353 set ref($$value = null) { 31354 ref($$value); 31355 flushSync(); 31356 }, 31357 get id() { 31358 return id(); 31359 }, 31360 set id($$value = createId(uid)) { 31361 id($$value); 31362 flushSync(); 31363 }, 31364 get date() { 31365 return date(); 31366 }, 31367 set date($$value) { 31368 date($$value); 31369 flushSync(); 31370 }, 31371 get month() { 31372 return month(); 31373 }, 31374 set month($$value) { 31375 month($$value); 31376 flushSync(); 31377 } 31378 }; 31379 var fragment = comment(); 31380 var node = first_child(fragment); 31381 var consequent = ($$anchor) => { 31382 var fragment_1 = comment();
31383 var node_1 = first_child(fragment_1); 31384 { 31385 let $0 = /* @__PURE__ */ user_derived(() => ({ 31386 props: get$2(mergedProps), 31387 ...cellState.snippetProps 31388 })); 31389 snippet(node_1, child$14, () => get$2($0)); 31390 } 31391 append($$anchor, fragment_1); 31392 }; 31393 var alternate = ($$anchor) => { 31394 var td = root$32(); 31395 attribute_effect(td, () => ({ ...get$2(mergedProps) })); 31396 snippet(child(td), () => children() ?? noop$1, () => cellState.snippetProps); 31397 reset(td); 31398 append($$anchor, td); 31399 }; 31400 if_block(node, ($$render) => { 31401 if (child$14()) $$render(consequent); 31402 else $$render(alternate, -1); 31403 }); 31404 append($$anchor, fragment); 31405 return pop($$exports); 31406 } 31407 create_custom_element(Calendar_cell, { 31408 children: {}, 31409 child: {}, 31410 ref: {}, 31411 id: {}, 31412 date: {}, 31413 month: {} 31414 }, [], [], { mode: "open" }); 31415 //#endregion 31416 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-head.svelte 31417 var rest_excludes$20 = new Set([ 31418 "$$slots", 31419 "$$events", 31420 "$$legacy", 31421 "$$host", 31422 "children", 31423 "child", 31424 "ref", 31425 "id" 31426 ]); 31427 var root$31 = /* @__PURE__ */ from_html(`<thead><!></thead>`); 31428 function Calendar_grid_head($$anchor, $$props) { 31429 const uid = props_id(); 31430 push($$props, true); 31431 let children = prop($$props, "children", 7), child$13 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$20); 31432 const gridHeadState = CalendarGridHeadState.create({ 31433 id: boxWith(() => id()), 31434 ref: boxWith(() => ref(), (v) => ref(v)) 31435 }); 31436 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, gridHeadState.props)); 31437 var $$exports = { 31438 get children() { 31439 return children(); 31440 }, 31441 set children($$value) { 31442 children($$value); 31443 flushSync(); 31444 }, 31445 get child() { 31446 return child$13(); 31447 }, 31448 set child($$value) { 31449 child$13($$value); 31450 flushSync(); 31451 }, 31452 get ref() { 31453 return ref(); 31454 }, 31455 set ref($$value = null) { 31456 ref($$value); 31457 flushSync(); 31458 }, 31459 get id() { 31460 return id(); 31461 }, 31462 set id($$value = createId(uid)) { 31463 id($$value); 31464 flushSync(); 31465 } 31466 }; 31467 var fragment = comment(); 31468 var node = first_child(fragment); 31469 var consequent = ($$anchor) => { 31470 var fragment_1 = comment(); 31471 snippet(first_child(fragment_1), child$13, () => ({ props: get$2(mergedProps) })); 31472 append($$anchor, fragment_1); 31473 }; 31474 var alternate = ($$anchor) => { 31475 var thead = root$31(); 31476 attribute_effect(thead, () => ({ ...get$2(mergedProps) })); 31477 snippet(child(thead), () => children() ?? noop$1); 31478 reset(thead); 31479 append($$anchor, thead); 31480 }; 31481 if_block(node, ($$render) => { 31482 if (child$13()) $$render(consequent); 31483 else $$render(alternate, -1); 31484 }); 31485 append($$anchor, fragment); 31486 return pop($$exports); 31487 } 31488 create_custom_element(Calendar_grid_head, { 31489 children: {}, 31490 child: {}, 31491 ref: {}, 31492 id: {} 31493 }, [], [], { mode: "open" }); 31494 //#endregion 31495 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-head-cell.svelte 31496 var rest_excludes$19 = new Set([ 31497 "$$slots", 31498 "$$events", 31499 "$$legacy", 31500 "$$host", 31501 "children", 31502 "child", 31503 "ref", 31504 "id" 31505 ]); 31506 var root$30 = /* @__PURE__ */ from_html(`<th><!></th>`); 31507 function Calendar_head_cell($$anchor, $$props) { 31508 const uid = props_id(); 31509 push($$props, true); 31510 let children = prop($$props, "children", 7), child$12 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$19); 31511 const headCellState = CalendarHeadCellState.create({ 31512 id: boxWith(() => id()), 31513 ref: boxWith(() => ref(), (v) => ref(v)) 31514 }); 31515 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, headCellState.props)); 31516 var $$exports = { 31517 get children() { 31518 return children(); 31519 }, 31520 set children($$value) { 31521 children($$value); 31522 flushSync(); 31523 }, 31524 get child() { 31525 return child$12(); 31526 }, 31527 set child($$value) { 31528 child$12($$value); 31529 flushSync(); 31530 }, 31531 get ref() { 31532 return ref(); 31533 }, 31534 set ref($$value = null) { 31535 ref($$value); 31536 flushSync(); 31537 }, 31538 get id() { 31539 return id(); 31540 },
31541 set id($$value = createId(uid)) { 31542 id($$value); 31543 flushSync(); 31544 } 31545 }; 31546 var fragment = comment(); 31547 var node = first_child(fragment); 31548 var consequent = ($$anchor) => { 31549 var fragment_1 = comment(); 31550 snippet(first_child(fragment_1), child$12, () => ({ props: get$2(mergedProps) })); 31551 append($$anchor, fragment_1); 31552 }; 31553 var alternate = ($$anchor) => { 31554 var th = root$30(); 31555 attribute_effect(th, () => ({ ...get$2(mergedProps) })); 31556 snippet(child(th), () => children() ?? noop$1); 31557 reset(th); 31558 append($$anchor, th); 31559 }; 31560 if_block(node, ($$render) => { 31561 if (child$12()) $$render(consequent); 31562 else $$render(alternate, -1); 31563 }); 31564 append($$anchor, fragment); 31565 return pop($$exports); 31566 } 31567 create_custom_element(Calendar_head_cell, { 31568 children: {}, 31569 child: {}, 31570 ref: {}, 31571 id: {} 31572 }, [], [], { mode: "open" }); 31573 //#endregion 31574 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-grid-row.svelte 31575 var rest_excludes$18 = new Set([ 31576 "$$slots", 31577 "$$events", 31578 "$$legacy", 31579 "$$host", 31580 "children", 31581 "child", 31582 "ref", 31583 "id" 31584 ]); 31585 var root$29 = /* @__PURE__ */ from_html(`<tr><!></tr>`); 31586 function Calendar_grid_row($$anchor, $$props) { 31587 const uid = props_id(); 31588 push($$props, true); 31589 let children = prop($$props, "children", 7), child$11 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$18); 31590 const gridRowState = CalendarGridRowState.create({ 31591 id: boxWith(() => id()), 31592 ref: boxWith(() => ref(), (v) => ref(v)) 31593 }); 31594 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, gridRowState.props)); 31595 var $$exports = { 31596 get children() { 31597 return children(); 31598 }, 31599 set children($$value) { 31600 children($$value); 31601 flushSync(); 31602 }, 31603 get child() { 31604 return child$11(); 31605 }, 31606 set child($$value) { 31607 child$11($$value); 31608 flushSync(); 31609 }, 31610 get ref() { 31611 return ref(); 31612 }, 31613 set ref($$value = null) { 31614 ref($$value); 31615 flushSync(); 31616 }, 31617 get id() { 31618 return id(); 31619 }, 31620 set id($$value = createId(uid)) { 31621 id($$value); 31622 flushSync(); 31623 } 31624 }; 31625 var fragment = comment(); 31626 var node = first_child(fragment); 31627 var consequent = ($$anchor) => { 31628 var fragment_1 = comment(); 31629 snippet(first_child(fragment_1), child$11, () => ({ props: get$2(mergedProps) })); 31630 append($$anchor, fragment_1); 31631 }; 31632 var alternate = ($$anchor) => { 31633 var tr = root$29(); 31634 attribute_effect(tr, () => ({ ...get$2(mergedProps) })); 31635 snippet(child(tr), () => children() ?? noop$1); 31636 reset(tr); 31637 append($$anchor, tr); 31638 }; 31639 if_block(node, ($$render) => { 31640 if (child$11()) $$render(consequent); 31641 else $$render(alternate, -1); 31642 }); 31643 append($$anchor, fragment); 31644 return pop($$exports); 31645 } 31646 create_custom_element(Calendar_grid_row, { 31647 children: {}, 31648 child: {}, 31649 ref: {}, 31650 id: {} 31651 }, [], [], { mode: "open" }); 31652 //#endregion 31653 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-header.svelte 31654 var rest_excludes$17 = new Set([ 31655 "$$slots", 31656 "$$events", 31657 "$$legacy", 31658 "$$host", 31659 "children", 31660 "child", 31661 "ref", 31662 "id" 31663 ]); 31664 var root$28 = /* @__PURE__ */ from_html(`<header><!></header>`); 31665 function Calendar_header($$anchor, $$props) { 31666 const uid = props_id(); 31667 push($$props, true); 31668 let children = prop($$props, "children", 7), child$10 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$17); 31669 const headerState = CalendarHeaderState.create({ 31670 id: boxWith(() => id()), 31671 ref: boxWith(() => ref(), (v) => ref(v)) 31672 }); 31673 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, headerState.props)); 31674 var $$exports = { 31675 get children() { 31676 return children(); 31677 }, 31678 set children($$value) { 31679 children($$value); 31680 flushSync(); 31681 }, 31682 get child() { 31683 return child$10(); 31684 }, 31685 set child($$value) { 31686 child$10($$value); 31687 flushSync(); 31688 }, 31689 get ref() { 31690 return ref(); 31691 }, 31692 set ref($$value = null) { 31693 ref($$value); 31694 flushSync(); 31695 }, 31696 get id() { 31697 return id(); 31698 },
31699 set id($$value = createId(uid)) { 31700 id($$value); 31701 flushSync(); 31702 } 31703 }; 31704 var fragment = comment(); 31705 var node = first_child(fragment); 31706 var consequent = ($$anchor) => { 31707 var fragment_1 = comment(); 31708 snippet(first_child(fragment_1), child$10, () => ({ props: get$2(mergedProps) })); 31709 append($$anchor, fragment_1); 31710 }; 31711 var alternate = ($$anchor) => { 31712 var header = root$28(); 31713 attribute_effect(header, () => ({ ...get$2(mergedProps) })); 31714 snippet(child(header), () => children() ?? noop$1); 31715 reset(header); 31716 append($$anchor, header); 31717 }; 31718 if_block(node, ($$render) => { 31719 if (child$10()) $$render(consequent); 31720 else $$render(alternate, -1); 31721 }); 31722 append($$anchor, fragment); 31723 return pop($$exports); 31724 } 31725 create_custom_element(Calendar_header, { 31726 children: {}, 31727 child: {}, 31728 ref: {}, 31729 id: {} 31730 }, [], [], { mode: "open" }); 31731 //#endregion 31732 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-heading.svelte 31733 var rest_excludes$16 = new Set([ 31734 "$$slots", 31735 "$$events", 31736 "$$legacy", 31737 "$$host", 31738 "children", 31739 "child", 31740 "ref", 31741 "id" 31742 ]); 31743 var root$27 = /* @__PURE__ */ from_html(`<div><!></div>`); 31744 function Calendar_heading($$anchor, $$props) { 31745 const uid = props_id(); 31746 push($$props, true); 31747 let children = prop($$props, "children", 7), child$9 = prop($$props, "child", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$16); 31748 const headingState = CalendarHeadingState.create({ 31749 id: boxWith(() => id()), 31750 ref: boxWith(() => ref(), (v) => ref(v)) 31751 }); 31752 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, headingState.props)); 31753 var $$exports = { 31754 get children() { 31755 return children(); 31756 }, 31757 set children($$value) { 31758 children($$value); 31759 flushSync(); 31760 }, 31761 get child() { 31762 return child$9(); 31763 }, 31764 set child($$value) { 31765 child$9($$value); 31766 flushSync(); 31767 }, 31768 get ref() { 31769 return ref(); 31770 }, 31771 set ref($$value = null) { 31772 ref($$value); 31773 flushSync(); 31774 }, 31775 get id() { 31776 return id(); 31777 }, 31778 set id($$value = createId(uid)) { 31779 id($$value); 31780 flushSync(); 31781 } 31782 }; 31783 var fragment = comment(); 31784 var node = first_child(fragment); 31785 var consequent = ($$anchor) => { 31786 var fragment_1 = comment(); 31787 snippet(first_child(fragment_1), child$9, () => ({ 31788 props: get$2(mergedProps), 31789 headingValue: headingState.root.headingValue 31790 })); 31791 append($$anchor, fragment_1); 31792 }; 31793 var alternate_1 = ($$anchor) => { 31794 var div = root$27(); 31795 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 31796 var node_2 = child(div); 31797 var consequent_1 = ($$anchor) => { 31798 var fragment_2 = comment(); 31799 snippet(first_child(fragment_2), () => children() ?? noop$1, () => ({ headingValue: headingState.root.headingValue })); 31800 append($$anchor, fragment_2); 31801 }; 31802 var alternate = ($$anchor) => { 31803 var text = text$1(); 31804 template_effect(() => set_text(text, headingState.root.headingValue)); 31805 append($$anchor, text); 31806 }; 31807 if_block(node_2, ($$render) => { 31808 if (children()) $$render(consequent_1); 31809 else $$render(alternate, -1); 31810 }); 31811 reset(div); 31812 append($$anchor, div); 31813 }; 31814 if_block(node, ($$render) => { 31815 if (child$9()) $$render(consequent); 31816 else $$render(alternate_1, -1); 31817 }); 31818 append($$anchor, fragment); 31819 return pop($$exports); 31820 } 31821 create_custom_element(Calendar_heading, { 31822 children: {}, 31823 child: {}, 31824 ref: {}, 31825 id: {} 31826 }, [], [], { mode: "open" }); 31827 //#endregion 31828 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-next-button.svelte 31829 var rest_excludes$15 = new Set([ 31830 "$$slots", 31831 "$$events", 31832 "$$legacy", 31833 "$$host", 31834 "children", 31835 "child", 31836 "id", 31837 "ref", 31838 "tabindex" 31839 ]); 31840 var root$26 = /* @__PURE__ */ from_html(`<button><!></button>`); 31841 function Calendar_next_button($$anchor, $$props) { 31842 const uid = props_id(); 31843 push($$props, true); 31844 let children = prop($$props, "children", 7), child$8 = prop($$props, "child", 7), id = prop($$props, "id", 23, () =>
31844 createId(uid)), ref = prop($$props, "ref", 15, null), tabindex = prop($$props, "tabindex", 7, 0), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$15); 31845 const nextButtonState = CalendarNextButtonState.create({ 31846 id: boxWith(() => id()), 31847 ref: boxWith(() => ref(), (v) => ref(v)) 31848 }); 31849 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, nextButtonState.props, { tabindex: tabindex() })); 31850 var $$exports = { 31851 get children() { 31852 return children(); 31853 }, 31854 set children($$value) { 31855 children($$value); 31856 flushSync(); 31857 }, 31858 get child() { 31859 return child$8(); 31860 }, 31861 set child($$value) { 31862 child$8($$value); 31863 flushSync(); 31864 }, 31865 get id() { 31866 return id(); 31867 }, 31868 set id($$value = createId(uid)) { 31869 id($$value); 31870 flushSync(); 31871 }, 31872 get ref() { 31873 return ref(); 31874 }, 31875 set ref($$value = null) { 31876 ref($$value); 31877 flushSync(); 31878 }, 31879 get tabindex() { 31880 return tabindex(); 31881 }, 31882 set tabindex($$value = 0) { 31883 tabindex($$value); 31884 flushSync(); 31885 } 31886 }; 31887 var fragment = comment(); 31888 var node = first_child(fragment); 31889 var consequent = ($$anchor) => { 31890 var fragment_1 = comment(); 31891 snippet(first_child(fragment_1), child$8, () => ({ props: get$2(mergedProps) })); 31892 append($$anchor, fragment_1); 31893 }; 31894 var alternate = ($$anchor) => { 31895 var button = root$26(); 31896 attribute_effect(button, () => ({ ...get$2(mergedProps) })); 31897 snippet(child(button), () => children() ?? noop$1); 31898 reset(button); 31899 append($$anchor, button); 31900 }; 31901 if_block(node, ($$render) => { 31902 if (child$8()) $$render(consequent); 31903 else $$render(alternate, -1); 31904 }); 31905 append($$anchor, fragment); 31906 return pop($$exports); 31907 } 31908 create_custom_element(Calendar_next_button, { 31909 children: {}, 31910 child: {}, 31911 id: {}, 31912 ref: {}, 31913 tabindex: {} 31914 }, [], [], { mode: "open" }); 31915 //#endregion 31916 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/calendar/components/calendar-prev-button.svelte 31917 var rest_excludes$14 = new Set([ 31918 "$$slots", 31919 "$$events", 31920 "$$legacy", 31921 "$$host", 31922 "children", 31923 "child", 31924 "id", 31925 "ref", 31926 "tabindex" 31927 ]); 31928 var root$25 = /* @__PURE__ */ from_html(`<button><!></button>`); 31929 function Calendar_prev_button($$anchor, $$props) { 31930 const uid = props_id(); 31931 push($$props, true); 31932 let children = prop($$props, "children", 7), child$7 = prop($$props, "child", 7), id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), tabindex = prop($$props, "tabindex", 7, 0), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$14); 31933 const prevButtonState = CalendarPrevButtonState.create({ 31934 id: boxWith(() => id()), 31935 ref: boxWith(() => ref(), (v) => ref(v)) 31936 }); 31937 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, prevButtonState.props, { tabindex: tabindex() })); 31938 var $$exports = { 31939 get children() { 31940 return children(); 31941 }, 31942 set children($$value) { 31943 children($$value); 31944 flushSync(); 31945 }, 31946 get child() { 31947 return child$7(); 31948 }, 31949 set child($$value) { 31950 child$7($$value); 31951 flushSync(); 31952 }, 31953 get id() { 31954 return id(); 31955 }, 31956 set id($$value = createId(uid)) { 31957 id($$value); 31958 flushSync(); 31959 }, 31960 get ref() { 31961 return ref(); 31962 }, 31963 set ref($$value = null) { 31964 ref($$value); 31965 flushSync(); 31966 }, 31967 get tabindex() { 31968 return tabindex(); 31969 }, 31970 set tabindex($$value = 0) { 31971 tabindex($$value); 31972 flushSync(); 31973 } 31974 }; 31975 var fragment = comment(); 31976 var node = first_child(fragment); 31977 var consequent = ($$anchor) => { 31978 var fragment_1 = comment(); 31979 snippet(first_child(fragment_1), child$7, () => ({ props: get$2(mergedProps) })); 31980 append($$anchor, fragment_1); 31981 }; 31982 var alternate = ($$anchor) => { 31983 var button = root$25(); 31984 attribute_effect(button, () => ({ ...get$2(mergedProps) })); 31985 snippet(child(button), () => children() ?? noop$1); 31986 reset(button); 31987 append($$anchor, button); 31988 }; 31989 if_block(node, ($$render) => { 31990 if (child$7()) $$render(consequent); 31991 else $$render(alternate, -1); 31992 }); 31993 append($$anchor, fragment); 31994 return pop($$exports); 31995 }
31996 create_custom_element(Calendar_prev_button, { 31997 children: {}, 31998 child: {}, 31999 id: {}, 32000 ref: {}, 32001 tabindex: {} 32002 }, [], [], { mode: "open" }); 32003 //#endregion 32004 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/hidden-input.svelte 32005 var rest_excludes$13 = new Set([ 32006 "$$slots", 32007 "$$events", 32008 "$$legacy", 32009 "$$host", 32010 "value" 32011 ]); 32012 var root$24 = /* @__PURE__ */ from_html(`<input/>`); 32013 function Hidden_input($$anchor, $$props) { 32014 push($$props, true); 32015 let value = prop($$props, "value", 15), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$13); 32016 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, { 32017 "aria-hidden": "true", 32018 tabindex: -1, 32019 style: { 32020 ...srOnlyStyles, 32021 position: "absolute", 32022 top: "0", 32023 left: "0" 32024 } 32025 })); 32026 var $$exports = { 32027 get value() { 32028 return value(); 32029 }, 32030 set value($$value) { 32031 value($$value); 32032 flushSync(); 32033 } 32034 }; 32035 var fragment = comment(); 32036 var node = first_child(fragment); 32037 var consequent = ($$anchor) => { 32038 var input = root$24(); 32039 attribute_effect(input, () => ({ 32040 ...get$2(mergedProps), 32041 value: value() 32042 }), void 0, void 0, void 0, void 0, true); 32043 append($$anchor, input); 32044 }; 32045 var alternate = ($$anchor) => { 32046 var input_1 = root$24(); 32047 attribute_effect(input_1, () => ({ ...get$2(mergedProps) }), void 0, void 0, void 0, void 0, true); 32048 bind_value(input_1, value); 32049 append($$anchor, input_1); 32050 }; 32051 if_block(node, ($$render) => { 32052 if (get$2(mergedProps).type === "checkbox") $$render(consequent); 32053 else $$render(alternate, -1); 32054 }); 32055 append($$anchor, fragment); 32056 return pop($$exports); 32057 } 32058 create_custom_element(Hidden_input, { value: {} }, [], [], { mode: "open" }); 32059 //#endregion 32060 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 32061 /** 32062 * Custom positioning reference element. 32063 * @see https://floating-ui.com/docs/virtual-elements 32064 */ 32065 var sides = [ 32066 "top", 32067 "right", 32068 "bottom", 32069 "left" 32070 ]; 32071 var min$1 = Math.min; 32072 var max$1 = Math.max; 32073 var round = Math.round; 32074 var floor = Math.floor; 32075 var createCoords = (v) => ({ 32076 x: v, 32077 y: v 32078 }); 32079 var oppositeSideMap = { 32080 left: "right", 32081 right: "left", 32082 bottom: "top", 32083 top: "bottom" 32084 }; 32085 function clamp(start, value, end) { 32086 return max$1(start, min$1(value, end)); 32087 } 32088 function evaluate$1(value, param) { 32089 return typeof value === "function" ? value(param) : value; 32090 } 32091 function getSide$1(placement) { 32092 return placement.split("-")[0]; 32093 } 32094 function getAlignment(placement) { 32095 return placement.split("-")[1]; 32096 } 32097 function getOppositeAxis(axis) { 32098 return axis === "x" ? "y" : "x"; 32099 } 32100 function getAxisLength(axis) { 32101 return axis === "y" ? "height" : "width"; 32102 } 32103 function getSideAxis(placement) { 32104 const firstChar = placement[0]; 32105 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 32106 } 32107 function getAlignmentAxis(placement) { 32108 return getOppositeAxis(getSideAxis(placement)); 32109 } 32110 function getAlignmentSides(placement, rects, rtl) { 32111 if (rtl === void 0) rtl = false; 32112 const alignment = getAlignment(placement); 32113 const alignmentAxis = getAlignmentAxis(placement); 32114 const length = getAxisLength(alignmentAxis); 32115 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 32116 if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 32117 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 32118 } 32119 function getExpandedPlacements(placement) { 32120 const oppositePlacement = getOppositePlacement(placement); 32121 return [ 32122 getOppositeAlignmentPlacement(placement), 32123 oppositePlacement, 32124 getOppositeAlignmentPlacement(oppositePlacement) 32125 ]; 32126 } 32127 function getOppositeAlignmentPlacement(placement) { 32128 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 32129 } 32130 var lrPlacement = ["left", "right"]; 32131 var rlPlacement = ["right", "left"]; 32132 var tbPlacement = ["top", "bottom"]; 32133 var btPlacement = ["bottom", "top"]; 32134 function getSideList(side, isStart, rtl) { 32135 switch (side) { 32136 case "top": 32137 case "bottom": 32138 if (rtl) return isStart ? rlPlacement : lrPlacement; 32139 return isStart ? lrPlacement : rlPlacement;
vendor: 7,540 bytes, lines 32140-32370
32140 case "left": 32141 case "right": return isStart ? tbPlacement : btPlacement; 32142 default: return []; 32143 } 32144 } 32145 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 32146 const alignment = getAlignment(placement); 32147 let list = getSideList(getSide$1(placement), direction === "start", rtl); 32148 if (alignment) { 32149 list = list.map((side) => side + "-" + alignment); 32150 if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement)); 32151 } 32152 return list; 32153 } 32154 function getOppositePlacement(placement) { 32155 const side = getSide$1(placement); 32156 return oppositeSideMap[side] + placement.slice(side.length); 32157 } 32158 function expandPaddingObject(padding) { 32159 return { 32160 top: 0, 32161 right: 0, 32162 bottom: 0, 32163 left: 0, 32164 ...padding 32165 }; 32166 } 32167 function getPaddingObject(padding) { 32168 return typeof padding !== "number" ? expandPaddingObject(padding) : { 32169 top: padding, 32170 right: padding, 32171 bottom: padding, 32172 left: padding 32173 }; 32174 } 32175 function rectToClientRect(rect) { 32176 const { x, y, width, height } = rect; 32177 return { 32178 width, 32179 height, 32180 top: y, 32181 left: x, 32182 right: x + width, 32183 bottom: y + height, 32184 x, 32185 y 32186 }; 32187 } 32188 //#endregion 32189 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@floating-ui/core/dist/floating-ui.core.mjs 32190 function computeCoordsFromPlacement(_ref, placement, rtl) { 32191 let { reference, floating } = _ref; 32192 const sideAxis = getSideAxis(placement); 32193 const alignmentAxis = getAlignmentAxis(placement); 32194 const alignLength = getAxisLength(alignmentAxis); 32195 const side = getSide$1(placement); 32196 const isVertical = sideAxis === "y"; 32197 const commonX = reference.x + reference.width / 2 - floating.width / 2; 32198 const commonY = reference.y + reference.height / 2 - floating.height / 2; 32199 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 32200 let coords; 32201 switch (side) { 32202 case "top": 32203 coords = { 32204 x: commonX, 32205 y: reference.y - floating.height 32206 }; 32207 break; 32208 case "bottom": 32209 coords = { 32210 x: commonX, 32211 y: reference.y + reference.height 32212 }; 32213 break; 32214 case "right": 32215 coords = { 32216 x: reference.x + reference.width, 32217 y: commonY 32218 }; 32219 break; 32220 case "left": 32221 coords = { 32222 x: reference.x - floating.width, 32223 y: commonY 32224 }; 32225 break; 32226 default: coords = { 32227 x: reference.x, 32228 y: reference.y 32229 }; 32230 } 32231 switch (getAlignment(placement)) { 32232 case "start": 32233 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 32234 break; 32235 case "end": 32236 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 32237 break; 32238 } 32239 return coords; 32240 } 32241 /** 32242 * Resolves with an object of overflow side offsets that determine how much the 32243 * element is overflowing a given clipping boundary on each side. 32244 * - positive = overflowing the boundary by that number of pixels 32245 * - negative = how many pixels left before it will overflow 32246 * - 0 = lies flush with the boundary 32247 * @see https://floating-ui.com/docs/detectOverflow 32248 */ 32249 async function detectOverflow(state, options) { 32250 var _await$platform$isEle; 32251 if (options === void 0) options = {}; 32252 const { x, y, platform, rects, elements, strategy } = state; 32253 const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate$1(options, state); 32254 const paddingObject = getPaddingObject(padding); 32255 const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext]; 32256 const clippingClientRect = rectToClientRect(await platform.getClippingRect({ 32257 element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)), 32258 boundary, 32259 rootBoundary, 32260 strategy 32261 })); 32262 const rect = elementContext === "floating" ? { 32263 x, 32264 y, 32265 width: rects.floating.width, 32266 height: rects.floating.height 32267 } : rects.reference; 32268 const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); 32269 const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || { 32270 x: 1, 32271 y: 1 32272 } : { 32273 x: 1, 32274 y: 1 32275 }; 32276 const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ 32277 elements, 32278 rect, 32279 offsetParent, 32280 strategy 32281 }) : rect); 32282 return { 32283 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 32284 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 32285 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 32286 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 32287 }; 32288 } 32289 var MAX_RESET_COUNT = 50; 32290 /** 32291 * Computes the `x` and `y` coordinates that will place the floating element 32292 * next to a given reference element. 32293 * 32294 * This export does not have any `platform` interface logic. You will need to 32295 * write one for the platform you are using Floating UI with. 32296 */ 32297 var computePosition$1 = async (reference, floating, config) => { 32298 const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config; 32299 const platformWithDetectOverflow = platform.detectOverflow ? platform : { 32300 ...platform, 32301 detectOverflow 32302 }; 32303 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); 32304 let rects = await platform.getElementRects({ 32305 reference, 32306 floating, 32307 strategy 32308 }); 32309 let { x, y } = computeCoordsFromPlacement(rects, placement, rtl); 32310 let statefulPlacement = placement; 32311 let resetCount = 0; 32312 const middlewareData = {}; 32313 for (let i = 0; i < middleware.length; i++) { 32314 const currentMiddleware = middleware[i]; 32315 if (!currentMiddleware) continue; 32316 const { name, fn } = currentMiddleware; 32317 const { x: nextX, y: nextY, data, reset } = await fn({ 32318 x, 32319 y, 32320 initialPlacement: placement, 32321 placement: statefulPlacement, 32322 strategy, 32323 middlewareData, 32324 rects, 32325 platform: platformWithDetectOverflow, 32326 elements: { 32327 reference, 32328 floating 32329 } 32330 }); 32331 x = nextX != null ? nextX : x; 32332 y = nextY != null ? nextY : y; 32333 middlewareData[name] = { 32334 ...middlewareData[name], 32335 ...data 32336 }; 32337 if (reset && resetCount < MAX_RESET_COUNT) { 32338 resetCount++; 32339 if (typeof reset === "object") { 32340 if (reset.placement) statefulPlacement = reset.placement; 32341 if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({ 32342 reference, 32343 floating, 32344 strategy 32345 }) : reset.rects; 32346 ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 32347 } 32348 i = -1; 32349 } 32350 } 32351 return { 32352 x, 32353 y, 32354 placement: statefulPlacement, 32355 strategy, 32356 middlewareData 32357 }; 32358 }; 32359 /** 32360 * Provides data to position an inner element of the floating element so that it 32361 * appears centered to the reference element. 32362 * @see https://floating-ui.com/docs/arrow 32363 */ 32364 var arrow$1 = (options) => ({ 32365 name: "arrow", 32366 options, 32367 async fn(state) { 32368 const { x, y, placement, rects, platform, elements, middlewareData } = state; 32369 const { element, padding = 0 } = evaluate$1(options, state) || {}; 32370 if (element == null) return {};
vendor: 15,821 bytes, lines 32371-32739
32371 const paddingObject = getPaddingObject(padding); 32372 const coords = { 32373 x, 32374 y 32375 }; 32376 const axis = getAlignmentAxis(placement); 32377 const length = getAxisLength(axis); 32378 const arrowDimensions = await platform.getDimensions(element); 32379 const isYAxis = axis === "y"; 32380 const minProp = isYAxis ? "top" : "left"; 32381 const maxProp = isYAxis ? "bottom" : "right"; 32382 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 32383 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 32384 const startDiff = coords[axis] - rects.reference[axis]; 32385 const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); 32386 let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; 32387 if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length]; 32388 const centerToReference = endDiff / 2 - startDiff / 2; 32389 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 32390 const minPadding = min$1(paddingObject[minProp], largestPossiblePadding); 32391 const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding); 32392 const min$1$1 = minPadding; 32393 const max = clientSize - arrowDimensions[length] - maxPadding; 32394 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 32395 const offset = clamp(min$1$1, center, max); 32396 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 32397 const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max : 0; 32398 return { 32399 [axis]: coords[axis] + alignmentOffset, 32400 data: { 32401 [axis]: offset, 32402 centerOffset: center - offset - alignmentOffset, 32403 ...shouldAddOffset && { alignmentOffset } 32404 }, 32405 reset: shouldAddOffset 32406 }; 32407 } 32408 }); 32409 /** 32410 * Optimizes the visibility of the floating element by flipping the `placement` 32411 * in order to keep it in view when the preferred placement(s) will overflow the 32412 * clipping boundary. Alternative to `autoPlacement`. 32413 * @see https://floating-ui.com/docs/flip 32414 */ 32415 var flip$1 = function(options) { 32416 if (options === void 0) options = {}; 32417 return { 32418 name: "flip", 32419 options, 32420 async fn(state) { 32421 var _middlewareData$arrow, _middlewareData$flip; 32422 const { placement, middlewareData, rects, initialPlacement, platform, elements } = state; 32423 const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate$1(options, state); 32424 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {}; 32425 const side = getSide$1(placement); 32426 const initialSideAxis = getSideAxis(initialPlacement); 32427 const isBasePlacement = getSide$1(initialPlacement) === initialPlacement; 32428 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 32429 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 32430 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 32431 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 32432 const placements = [initialPlacement, ...fallbackPlacements]; 32433 const overflow = await platform.detectOverflow(state, detectOverflowOptions); 32434 const overflows = []; 32435 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 32436 if (checkMainAxis) overflows.push(overflow[side]); 32437 if (checkCrossAxis) { 32438 const sides = getAlignmentSides(placement, rects, rtl); 32439 overflows.push(overflow[sides[0]], overflow[sides[1]]); 32440 } 32441 overflowsData = [...overflowsData, { 32442 placement, 32443 overflows 32444 }]; 32445 if (!overflows.every((side) => side <= 0)) { 32446 var _middlewareData$flip2, _overflowsData$filter; 32447 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 32448 const nextPlacement = placements[nextIndex]; 32449 if (nextPlacement) { 32450 if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return { 32451 data: { 32452 index: nextIndex, 32453 overflows: overflowsData 32454 }, 32455 reset: { placement: nextPlacement } 32456 }; 32457 } 32458 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 32459 if (!resetPlacement) switch (fallbackStrategy) { 32460 case "bestFit": { 32461 var _overflowsData$filter2; 32462 const placement = (_overflowsData$filter2 = overflowsData.filter((d) => { 32463 if (hasFallbackAxisSideDirection) { 32464 const currentSideAxis = getSideAxis(d.placement); 32465 return currentSideAxis === initialSideAxis || currentSideAxis === "y"; 32466 } 32467 return true; 32468 }).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 32469 if (placement) resetPlacement = placement; 32470 break; 32471 } 32472 case "initialPlacement": 32473 resetPlacement = initialPlacement; 32474 break; 32475 } 32476 if (placement !== resetPlacement) return { reset: { placement: resetPlacement } }; 32477 } 32478 return {}; 32479 } 32480 }; 32481 }; 32482 function getSideOffsets(overflow, rect) { 32483 return { 32484 top: overflow.top - rect.height, 32485 right: overflow.right - rect.width, 32486 bottom: overflow.bottom - rect.height, 32487 left: overflow.left - rect.width 32488 }; 32489 } 32490 function isAnySideFullyClipped(overflow) { 32491 return sides.some((side) => overflow[side] >= 0); 32492 } 32493 /** 32494 * Provides data to hide the floating element in applicable situations, such as 32495 * when it is not in the same clipping context as the reference element. 32496 * @see https://floating-ui.com/docs/hide 32497 */ 32498 var hide$1 = function(options) { 32499 if (options === void 0) options = {}; 32500 return { 32501 name: "hide", 32502 options, 32503 async fn(state) { 32504 const { rects, platform } = state; 32505 const { strategy = "referenceHidden", ...detectOverflowOptions } = evaluate$1(options, state); 32506 switch (strategy) { 32507 case "referenceHidden": { 32508 const offsets = getSideOffsets(await platform.detectOverflow(state, { 32509 ...detectOverflowOptions, 32510 elementContext: "reference" 32511 }), rects.reference); 32512 return { data: { 32513 referenceHiddenOffsets: offsets, 32514 referenceHidden: isAnySideFullyClipped(offsets) 32515 } }; 32516 } 32517 case "escaped": { 32518 const offsets = getSideOffsets(await platform.detectOverflow(state, { 32519 ...detectOverflowOptions, 32520 altBoundary: true 32521 }), rects.floating); 32522 return { data: { 32523 escapedOffsets: offsets, 32524 escaped: isAnySideFullyClipped(offsets) 32525 } }; 32526 } 32527 default: return {}; 32528 } 32529 } 32530 }; 32531 }; 32532 var originSides = /*#__PURE__*/ new Set(["left", "top"]); 32533 async function convertValueToCoords(state, options) { 32534 const { placement, platform, elements } = state; 32535 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 32536 const side = getSide$1(placement); 32537 const alignment = getAlignment(placement); 32538 const isVertical = getSideAxis(placement) === "y"; 32539 const mainAxisMulti = originSides.has(side) ? -1 : 1; 32540 const crossAxisMulti = rtl && isVertical ? -1 : 1; 32541 const rawValue = evaluate$1(options, state); 32542 let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? { 32543 mainAxis: rawValue, 32544 crossAxis: 0, 32545 alignmentAxis: null 32546 } : { 32547 mainAxis: rawValue.mainAxis || 0, 32548 crossAxis: rawValue.crossAxis || 0, 32549 alignmentAxis: rawValue.alignmentAxis 32550 }; 32551 if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 32552 return isVertical ? { 32553 x: crossAxis * crossAxisMulti, 32554 y: mainAxis * mainAxisMulti 32555 } : { 32556 x: mainAxis * mainAxisMulti, 32557 y: crossAxis * crossAxisMulti 32558 }; 32559 } 32560 /** 32561 * Modifies the placement by translating the floating element along the 32562 * specified axes. 32563 * A number (shorthand for `mainAxis` or distance), or an axes configuration 32564 * object may be passed. 32565 * @see https://floating-ui.com/docs/offset 32566 */ 32567 var offset$1 = function(options) { 32568 if (options === void 0) options = 0; 32569 return { 32570 name: "offset", 32571 options, 32572 async fn(state) { 32573 var _middlewareData$offse, _middlewareData$arrow; 32574 const { x, y, placement, middlewareData } = state; 32575 const diffCoords = await convertValueToCoords(state, options); 32576 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {}; 32577 return { 32578 x: x + diffCoords.x, 32579 y: y + diffCoords.y, 32580 data: { 32581 ...diffCoords, 32582 placement 32583 } 32584 }; 32585 } 32586 }; 32587 }; 32588 /** 32589 * Optimizes the visibility of the floating element by shifting it in order to 32590 * keep it in view when it will overflow the clipping boundary. 32591 * @see https://floating-ui.com/docs/shift 32592 */ 32593 var shift$1 = function(options) { 32594 if (options === void 0) options = {}; 32595 return { 32596 name: "shift", 32597 options, 32598 async fn(state) { 32599 const { x, y, placement, platform } = state; 32600 const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => { 32601 let { x, y } = _ref; 32602 return { 32603 x, 32604 y 32605 }; 32606 } }, ...detectOverflowOptions } = evaluate$1(options, state); 32607 const coords = { 32608 x, 32609 y 32610 }; 32611 const overflow = await platform.detectOverflow(state, detectOverflowOptions); 32612 const crossAxis = getSideAxis(getSide$1(placement)); 32613 const mainAxis = getOppositeAxis(crossAxis); 32614 let mainAxisCoord = coords[mainAxis]; 32615 let crossAxisCoord = coords[crossAxis]; 32616 if (checkMainAxis) { 32617 const minSide = mainAxis === "y" ? "top" : "left"; 32618 const maxSide = mainAxis === "y" ? "bottom" : "right"; 32619 const min = mainAxisCoord + overflow[minSide]; 32620 const max = mainAxisCoord - overflow[maxSide]; 32621 mainAxisCoord = clamp(min, mainAxisCoord, max); 32622 } 32623 if (checkCrossAxis) { 32624 const minSide = crossAxis === "y" ? "top" : "left"; 32625 const maxSide = crossAxis === "y" ? "bottom" : "right"; 32626 const min = crossAxisCoord + overflow[minSide]; 32627 const max = crossAxisCoord - overflow[maxSide]; 32628 crossAxisCoord = clamp(min, crossAxisCoord, max); 32629 } 32630 const limitedCoords = limiter.fn({ 32631 ...state, 32632 [mainAxis]: mainAxisCoord, 32633 [crossAxis]: crossAxisCoord 32634 }); 32635 return { 32636 ...limitedCoords, 32637 data: { 32638 x: limitedCoords.x - x, 32639 y: limitedCoords.y - y, 32640 enabled: { 32641 [mainAxis]: checkMainAxis, 32642 [crossAxis]: checkCrossAxis 32643 } 32644 } 32645 }; 32646 } 32647 }; 32648 }; 32649 /** 32650 * Built-in `limiter` that will stop `shift()` at a certain point. 32651 */ 32652 var limitShift$1 = function(options) { 32653 if (options === void 0) options = {}; 32654 return { 32655 options, 32656 fn(state) { 32657 const { x, y, placement, rects, middlewareData } = state; 32658 const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = evaluate$1(options, state); 32659 const coords = { 32660 x, 32661 y 32662 }; 32663 const crossAxis = getSideAxis(placement); 32664 const mainAxis = getOppositeAxis(crossAxis); 32665 let mainAxisCoord = coords[mainAxis]; 32666 let crossAxisCoord = coords[crossAxis]; 32667 const rawOffset = evaluate$1(offset, state); 32668 const computedOffset = typeof rawOffset === "number" ? { 32669 mainAxis: rawOffset, 32670 crossAxis: 0 32671 } : { 32672 mainAxis: 0, 32673 crossAxis: 0, 32674 ...rawOffset 32675 }; 32676 if (checkMainAxis) { 32677 const len = mainAxis === "y" ? "height" : "width"; 32678 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 32679 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 32680 if (mainAxisCoord < limitMin) mainAxisCoord = limitMin; 32681 else if (mainAxisCoord > limitMax) mainAxisCoord = limitMax; 32682 } 32683 if (checkCrossAxis) { 32684 var _middlewareData$offse, _middlewareData$offse2; 32685 const len = mainAxis === "y" ? "width" : "height"; 32686 const isOriginSide = originSides.has(getSide$1(placement)); 32687 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 32688 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 32689 if (crossAxisCoord < limitMin) crossAxisCoord = limitMin; 32690 else if (crossAxisCoord > limitMax) crossAxisCoord = limitMax; 32691 } 32692 return { 32693 [mainAxis]: mainAxisCoord, 32694 [crossAxis]: crossAxisCoord 32695 }; 32696 } 32697 }; 32698 }; 32699 /** 32700 * Provides data that allows you to change the size of the floating element â 32701 * for instance, prevent it from overflowing the clipping boundary or match the 32702 * width of the reference element. 32703 * @see https://floating-ui.com/docs/size 32704 */ 32705 var size$1 = function(options) { 32706 if (options === void 0) options = {}; 32707 return { 32708 name: "size", 32709 options, 32710 async fn(state) { 32711 var _state$middlewareData, _state$middlewareData2; 32712 const { placement, rects, platform, elements } = state; 32713 const { apply = () => {}, ...detectOverflowOptions } = evaluate$1(options, state); 32714 const overflow = await platform.detectOverflow(state, detectOverflowOptions); 32715 const side = getSide$1(placement); 32716 const alignment = getAlignment(placement); 32717 const isYAxis = getSideAxis(placement) === "y"; 32718 const { width, height } = rects.floating; 32719 let heightSide; 32720 let widthSide; 32721 if (side === "top" || side === "bottom") { 32722 heightSide = side; 32723 widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 32724 } else { 32725 widthSide = side; 32726 heightSide = alignment === "end" ? "top" : "bottom"; 32727 } 32728 const maximumClippingHeight = height - overflow.top - overflow.bottom; 32729 const maximumClippingWidth = width - overflow.left - overflow.right; 32730 const overflowAvailableHeight = min$1(height - overflow[heightSide], maximumClippingHeight); 32731 const overflowAvailableWidth = min$1(width - overflow[widthSide], maximumClippingWidth); 32732 const noShift = !state.middlewareData.shift; 32733 let availableHeight = overflowAvailableHeight; 32734 let availableWidth = overflowAvailableWidth; 32735 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) availableWidth = maximumClippingWidth; 32736 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) availableHeight = maximumClippingHeight; 32737 if (noShift && !alignment) { 32738 const xMin = max$1(overflow.left, 0); 32739 const xMax = max$1(overflow.right, 0);
32740 const yMin = max$1(overflow.top, 0); 32741 const yMax = max$1(overflow.bottom, 0); 32742 if (isYAxis) availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)); 32743 else availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)); 32744 } 32745 await apply({ 32746 ...state, 32747 availableWidth, 32748 availableHeight 32749 }); 32750 const nextDimensions = await platform.getDimensions(elements.floating); 32751 if (width !== nextDimensions.width || height !== nextDimensions.height) return { reset: { rects: true } }; 32752 return {}; 32753 } 32754 }; 32755 }; 32756 //#endregion 32757 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 32758 function hasWindow() { 32759 return typeof window !== "undefined"; 32760 } 32761 function getNodeName(node) { 32762 if (isNode(node)) return (node.nodeName || "").toLowerCase(); 32763 return "#document"; 32764 } 32765 function getWindow(node) { 32766 var _node$ownerDocument; 32767 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 32768 } 32769 function getDocumentElement(node) { 32770 var _ref; 32771 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 32772 } 32773 function isNode(value) { 32774 if (!hasWindow()) return false; 32775 return value instanceof Node || value instanceof getWindow(value).Node; 32776 } 32777 function isElement(value) { 32778 if (!hasWindow()) return false; 32779 return value instanceof Element || value instanceof getWindow(value).Element; 32780 } 32781 function isHTMLElement(value) { 32782 if (!hasWindow()) return false; 32783 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 32784 } 32785 function isShadowRoot(value) { 32786 if (!hasWindow() || typeof ShadowRoot === "undefined") return false; 32787 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 32788 } 32789 function isOverflowElement(element) { 32790 const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element); 32791 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 32792 } 32793 function isTableElement(element) { 32794 return /^(table|td|th)$/.test(getNodeName(element)); 32795 } 32796 function isTopLayer(element) { 32797 try { 32798 if (element.matches(":popover-open")) return true; 32799 } catch (_e) {} 32800 try { 32801 return element.matches(":modal"); 32802 } catch (_e) { 32803 return false; 32804 } 32805 } 32806 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 32807 var containRe = /paint|layout|strict|content/; 32808 var isNotNone = (value) => !!value && value !== "none"; 32809 var isWebKitValue; 32810 function isContainingBlock(elementOrCss) { 32811 const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss; 32812 return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || ""); 32813 } 32814 function getContainingBlock(element) { 32815 let currentNode = getParentNode(element); 32816 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 32817 if (isContainingBlock(currentNode)) return currentNode; 32818 else if (isTopLayer(currentNode)) return null; 32819 currentNode = getParentNode(currentNode); 32820 } 32821 return null; 32822 } 32823 function isWebKit() { 32824 if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 32825 return isWebKitValue; 32826 } 32827 function isLastTraversableNode(node) { 32828 return /^(html|body|#document)$/.test(getNodeName(node)); 32829 } 32830 function getComputedStyle$1(element) { 32831 return getWindow(element).getComputedStyle(element); 32832 } 32833 function getNodeScroll(element) { 32834 if (isElement(element)) return { 32835 scrollLeft: element.scrollLeft, 32836 scrollTop: element.scrollTop 32837 }; 32838 return { 32839 scrollLeft: element.scrollX, 32840 scrollTop: element.scrollY 32841 }; 32842 } 32843 function getParentNode(node) { 32844 if (getNodeName(node) === "html") return node; 32845 const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node); 32846 return isShadowRoot(result) ? result.host : result; 32847 } 32848 function getNearestOverflowAncestor(node) { 32849 const parentNode = getParentNode(node); 32850 if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body; 32851 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode; 32852 return getNearestOverflowAncestor(parentNode); 32853 } 32854 function getOverflowAncestors(node, list, traverseIframes) { 32855 var _node$ownerDocument2; 32856 if (list === void 0) list = []; 32857 if (traverseIframes === void 0) traverseIframes = true; 32858 const scrollableAncestor = getNearestOverflowAncestor(node);
vendor: 19,520 bytes, lines 32859-33324
32859 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 32860 const win = getWindow(scrollableAncestor); 32861 if (isBody) { 32862 const frameElement = getFrameElement(win); 32863 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 32864 } else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 32865 } 32866 function getFrameElement(win) { 32867 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 32868 } 32869 //#endregion 32870 //#region ../../node_modules/.pnpm/@[email protected]/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 32871 function getCssDimensions(element) { 32872 const css = getComputedStyle$1(element); 32873 let width = parseFloat(css.width) || 0; 32874 let height = parseFloat(css.height) || 0; 32875 const hasOffset = isHTMLElement(element); 32876 const offsetWidth = hasOffset ? element.offsetWidth : width; 32877 const offsetHeight = hasOffset ? element.offsetHeight : height; 32878 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 32879 if (shouldFallback) { 32880 width = offsetWidth; 32881 height = offsetHeight; 32882 } 32883 return { 32884 width, 32885 height, 32886 $: shouldFallback 32887 }; 32888 } 32889 function unwrapElement(element) { 32890 return !isElement(element) ? element.contextElement : element; 32891 } 32892 function getScale(element) { 32893 const domElement = unwrapElement(element); 32894 if (!isHTMLElement(domElement)) return createCoords(1); 32895 const rect = domElement.getBoundingClientRect(); 32896 const { width, height, $ } = getCssDimensions(domElement); 32897 let x = ($ ? round(rect.width) : rect.width) / width; 32898 let y = ($ ? round(rect.height) : rect.height) / height; 32899 if (!x || !Number.isFinite(x)) x = 1; 32900 if (!y || !Number.isFinite(y)) y = 1; 32901 return { 32902 x, 32903 y 32904 }; 32905 } 32906 var noOffsets = /*#__PURE__*/ createCoords(0); 32907 function getVisualOffsets(element) { 32908 const win = getWindow(element); 32909 if (!isWebKit() || !win.visualViewport) return noOffsets; 32910 return { 32911 x: win.visualViewport.offsetLeft, 32912 y: win.visualViewport.offsetTop 32913 }; 32914 } 32915 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 32916 if (isFixed === void 0) isFixed = false; 32917 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false; 32918 return isFixed; 32919 } 32920 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 32921 if (includeScale === void 0) includeScale = false; 32922 if (isFixedStrategy === void 0) isFixedStrategy = false; 32923 const clientRect = element.getBoundingClientRect(); 32924 const domElement = unwrapElement(element); 32925 let scale = createCoords(1); 32926 if (includeScale) if (offsetParent) { 32927 if (isElement(offsetParent)) scale = getScale(offsetParent); 32928 } else scale = getScale(element); 32929 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 32930 let x = (clientRect.left + visualOffsets.x) / scale.x; 32931 let y = (clientRect.top + visualOffsets.y) / scale.y; 32932 let width = clientRect.width / scale.x; 32933 let height = clientRect.height / scale.y; 32934 if (domElement) { 32935 const win = getWindow(domElement); 32936 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 32937 let currentWin = win; 32938 let currentIFrame = getFrameElement(currentWin); 32939 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 32940 const iframeScale = getScale(currentIFrame); 32941 const iframeRect = currentIFrame.getBoundingClientRect(); 32942 const css = getComputedStyle$1(currentIFrame); 32943 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 32944 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 32945 x *= iframeScale.x; 32946 y *= iframeScale.y; 32947 width *= iframeScale.x; 32948 height *= iframeScale.y; 32949 x += left; 32950 y += top; 32951 currentWin = getWindow(currentIFrame); 32952 currentIFrame = getFrameElement(currentWin); 32953 } 32954 } 32955 return rectToClientRect({ 32956 width, 32957 height, 32958 x, 32959 y 32960 }); 32961 } 32962 function getWindowScrollBarX(element, rect) { 32963 const leftScroll = getNodeScroll(element).scrollLeft; 32964 if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 32965 return rect.left + leftScroll; 32966 } 32967 function getHTMLOffset(documentElement, scroll) { 32968 const htmlRect = documentElement.getBoundingClientRect(); 32969 return { 32970 x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect), 32971 y: htmlRect.top + scroll.scrollTop 32972 }; 32973 } 32974 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 32975 let { elements, rect, offsetParent, strategy } = _ref; 32976 const isFixed = strategy === "fixed"; 32977 const documentElement = getDocumentElement(offsetParent); 32978 const topLayer = elements ? isTopLayer(elements.floating) : false; 32979 if (offsetParent === documentElement || topLayer && isFixed) return rect; 32980 let scroll = { 32981 scrollLeft: 0, 32982 scrollTop: 0 32983 }; 32984 let scale = createCoords(1); 32985 const offsets = createCoords(0); 32986 const isOffsetParentAnElement = isHTMLElement(offsetParent); 32987 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 32988 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent); 32989 if (isOffsetParentAnElement) { 32990 const offsetRect = getBoundingClientRect(offsetParent); 32991 scale = getScale(offsetParent); 32992 offsets.x = offsetRect.x + offsetParent.clientLeft; 32993 offsets.y = offsetRect.y + offsetParent.clientTop; 32994 } 32995 } 32996 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 32997 return { 32998 width: rect.width * scale.x, 32999 height: rect.height * scale.y, 33000 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 33001 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 33002 }; 33003 } 33004 function getClientRects(element) { 33005 return Array.from(element.getClientRects()); 33006 } 33007 function getDocumentRect(element) { 33008 const html = getDocumentElement(element); 33009 const scroll = getNodeScroll(element); 33010 const body = element.ownerDocument.body; 33011 const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 33012 const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 33013 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 33014 const y = -scroll.scrollTop; 33015 if (getComputedStyle$1(body).direction === "rtl") x += max$1(html.clientWidth, body.clientWidth) - width; 33016 return { 33017 width, 33018 height, 33019 x, 33020 y 33021 }; 33022 } 33023 var SCROLLBAR_MAX = 25; 33024 function getViewportRect(element, strategy) { 33025 const win = getWindow(element); 33026 const html = getDocumentElement(element); 33027 const visualViewport = win.visualViewport; 33028 let width = html.clientWidth; 33029 let height = html.clientHeight; 33030 let x = 0; 33031 let y = 0; 33032 if (visualViewport) { 33033 width = visualViewport.width; 33034 height = visualViewport.height; 33035 const visualViewportBased = isWebKit(); 33036 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 33037 x = visualViewport.offsetLeft; 33038 y = visualViewport.offsetTop; 33039 } 33040 } 33041 const windowScrollbarX = getWindowScrollBarX(html); 33042 if (windowScrollbarX <= 0) { 33043 const doc = html.ownerDocument; 33044 const body = doc.body; 33045 const bodyStyles = getComputedStyle(body); 33046 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 33047 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 33048 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth; 33049 } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX; 33050 return { 33051 width, 33052 height, 33053 x, 33054 y 33055 }; 33056 } 33057 function getInnerBoundingClientRect(element, strategy) { 33058 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 33059 const top = clientRect.top + element.clientTop; 33060 const left = clientRect.left + element.clientLeft; 33061 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 33062 return { 33063 width: element.clientWidth * scale.x, 33064 height: element.clientHeight * scale.y, 33065 x: left * scale.x, 33066 y: top * scale.y 33067 }; 33068 } 33069 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 33070 let rect; 33071 if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy); 33072 else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element)); 33073 else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy); 33074 else { 33075 const visualOffsets = getVisualOffsets(element); 33076 rect = { 33077 x: clippingAncestor.x - visualOffsets.x, 33078 y: clippingAncestor.y - visualOffsets.y, 33079 width: clippingAncestor.width, 33080 height: clippingAncestor.height 33081 }; 33082 } 33083 return rectToClientRect(rect); 33084 } 33085 function hasFixedPositionAncestor(element, stopNode) { 33086 const parentNode = getParentNode(element); 33087 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false; 33088 return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 33089 } 33090 function getClippingElementAncestors(element, cache) { 33091 const cachedResult = cache.get(element); 33092 if (cachedResult) return cachedResult; 33093 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 33094 let currentContainingBlockComputedStyle = null; 33095 const elementIsFixed = getComputedStyle$1(element).position === "fixed"; 33096 let currentNode = elementIsFixed ? getParentNode(element) : element; 33097 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 33098 const computedStyle = getComputedStyle$1(currentNode); 33099 const currentNodeIsContaining = isContainingBlock(currentNode); 33100 if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null; 33101 if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode); 33102 else currentContainingBlockComputedStyle = computedStyle; 33103 currentNode = getParentNode(currentNode); 33104 } 33105 cache.set(element, result); 33106 return result; 33107 } 33108 function getClippingRect(_ref) { 33109 let { element, boundary, rootBoundary, strategy } = _ref; 33110 const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary]; 33111 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 33112 let top = firstRect.top; 33113 let right = firstRect.right; 33114 let bottom = firstRect.bottom; 33115 let left = firstRect.left; 33116 for (let i = 1; i < clippingAncestors.length; i++) { 33117 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 33118 top = max$1(rect.top, top); 33119 right = min$1(rect.right, right); 33120 bottom = min$1(rect.bottom, bottom); 33121 left = max$1(rect.left, left); 33122 } 33123 return { 33124 width: right - left, 33125 height: bottom - top, 33126 x: left, 33127 y: top 33128 }; 33129 } 33130 function getDimensions(element) { 33131 const { width, height } = getCssDimensions(element); 33132 return { 33133 width, 33134 height 33135 }; 33136 } 33137 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 33138 const isOffsetParentAnElement = isHTMLElement(offsetParent); 33139 const documentElement = getDocumentElement(offsetParent); 33140 const isFixed = strategy === "fixed"; 33141 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 33142 let scroll = { 33143 scrollLeft: 0, 33144 scrollTop: 0 33145 }; 33146 const offsets = createCoords(0); 33147 function setLeftRTLScrollbarOffset() { 33148 offsets.x = getWindowScrollBarX(documentElement); 33149 } 33150 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 33151 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent); 33152 if (isOffsetParentAnElement) { 33153 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 33154 offsets.x = offsetRect.x + offsetParent.clientLeft; 33155 offsets.y = offsetRect.y + offsetParent.clientTop; 33156 } else if (documentElement) setLeftRTLScrollbarOffset(); 33157 } 33158 if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset(); 33159 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 33160 return { 33161 x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x, 33162 y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y, 33163 width: rect.width, 33164 height: rect.height 33165 }; 33166 } 33167 function isStaticPositioned(element) { 33168 return getComputedStyle$1(element).position === "static"; 33169 } 33170 function getTrueOffsetParent(element, polyfill) { 33171 if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null; 33172 if (polyfill) return polyfill(element); 33173 let rawOffsetParent = element.offsetParent; 33174 if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body; 33175 return rawOffsetParent; 33176 } 33177 function getOffsetParent(element, polyfill) { 33178 const win = getWindow(element); 33179 if (isTopLayer(element)) return win; 33180 if (!isHTMLElement(element)) { 33181 let svgOffsetParent = getParentNode(element); 33182 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 33183 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent; 33184 svgOffsetParent = getParentNode(svgOffsetParent); 33185 } 33186 return win; 33187 } 33188 let offsetParent = getTrueOffsetParent(element, polyfill); 33189 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill); 33190 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win; 33191 return offsetParent || getContainingBlock(element) || win; 33192 } 33193 var getElementRects = async function(data) { 33194 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 33195 const getDimensionsFn = this.getDimensions; 33196 const floatingDimensions = await getDimensionsFn(data.floating); 33197 return { 33198 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 33199 floating: { 33200 x: 0, 33201 y: 0, 33202 width: floatingDimensions.width, 33203 height: floatingDimensions.height 33204 } 33205 }; 33206 }; 33207 function isRTL(element) { 33208 return getComputedStyle$1(element).direction === "rtl"; 33209 } 33210 var platform = { 33211 convertOffsetParentRelativeRectToViewportRelativeRect, 33212 getDocumentElement, 33213 getClippingRect, 33214 getOffsetParent, 33215 getElementRects, 33216 getClientRects, 33217 getDimensions, 33218 getScale, 33219 isElement, 33220 isRTL 33221 }; 33222 function rectsAreEqual(a, b) { 33223 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 33224 } 33225 function observeMove(element, onMove) { 33226 let io = null; 33227 let timeoutId; 33228 const root = getDocumentElement(element); 33229 function cleanup() { 33230 var _io; 33231 clearTimeout(timeoutId); 33232 (_io = io) == null || _io.disconnect(); 33233 io = null; 33234 } 33235 function refresh(skip, threshold) { 33236 if (skip === void 0) skip = false; 33237 if (threshold === void 0) threshold = 1; 33238 cleanup(); 33239 const elementRectForRootMargin = element.getBoundingClientRect(); 33240 const { left, top, width, height } = elementRectForRootMargin; 33241 if (!skip) onMove(); 33242 if (!width || !height) return; 33243 const insetTop = floor(top); 33244 const insetRight = floor(root.clientWidth - (left + width)); 33245 const insetBottom = floor(root.clientHeight - (top + height)); 33246 const insetLeft = floor(left); 33247 const options = { 33248 rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px", 33249 threshold: max$1(0, min$1(1, threshold)) || 1 33250 }; 33251 let isFirstUpdate = true; 33252 function handleObserve(entries) { 33253 const ratio = entries[0].intersectionRatio; 33254 if (ratio !== threshold) { 33255 if (!isFirstUpdate) return refresh(); 33256 if (!ratio) timeoutId = setTimeout(() => { 33257 refresh(false, 1e-7); 33258 }, 1e3); 33259 else refresh(false, ratio); 33260 } 33261 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh(); 33262 isFirstUpdate = false; 33263 } 33264 try { 33265 io = new IntersectionObserver(handleObserve, { 33266 ...options, 33267 root: root.ownerDocument 33268 }); 33269 } catch (_e) { 33270 io = new IntersectionObserver(handleObserve, options); 33271 } 33272 io.observe(element); 33273 } 33274 refresh(true); 33275 return cleanup; 33276 } 33277 /** 33278 * Automatically updates the position of the floating element when necessary. 33279 * Should only be called when the floating element is mounted on the DOM or 33280 * visible on the screen. 33281 * @returns cleanup function that should be invoked when the floating element is 33282 * removed from the DOM or hidden from the screen. 33283 * @see https://floating-ui.com/docs/autoUpdate 33284 */ 33285 function autoUpdate(reference, floating, update, options) { 33286 if (options === void 0) options = {}; 33287 const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === "function", layoutShift = typeof IntersectionObserver === "function", animationFrame = false } = options; 33288 const referenceEl = unwrapElement(reference); 33289 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 33290 ancestors.forEach((ancestor) => { 33291 ancestorScroll && ancestor.addEventListener("scroll", update, { passive: true }); 33292 ancestorResize && ancestor.addEventListener("resize", update); 33293 }); 33294 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 33295 let reobserveFrame = -1; 33296 let resizeObserver = null; 33297 if (elementResize) { 33298 resizeObserver = new ResizeObserver((_ref) => { 33299 let [firstEntry] = _ref; 33300 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 33301 resizeObserver.unobserve(floating); 33302 cancelAnimationFrame(reobserveFrame); 33303 reobserveFrame = requestAnimationFrame(() => { 33304 var _resizeObserver; 33305 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 33306 }); 33307 } 33308 update(); 33309 }); 33310 if (referenceEl && !animationFrame) resizeObserver.observe(referenceEl); 33311 if (floating) resizeObserver.observe(floating); 33312 } 33313 let frameId; 33314 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 33315 if (animationFrame) frameLoop(); 33316 function frameLoop() { 33317 const nextRefRect = getBoundingClientRect(reference); 33318 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) update(); 33319 prevRefRect = nextRefRect; 33320 frameId = requestAnimationFrame(frameLoop); 33321 } 33322 update(); 33323 return () => { 33324 var _resizeObserver2;
33325 ancestors.forEach((ancestor) => { 33326 ancestorScroll && ancestor.removeEventListener("scroll", update); 33327 ancestorResize && ancestor.removeEventListener("resize", update); 33328 }); 33329 cleanupIo?.(); 33330 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 33331 resizeObserver = null; 33332 if (animationFrame) cancelAnimationFrame(frameId); 33333 }; 33334 } 33335 /** 33336 * Modifies the placement by translating the floating element along the 33337 * specified axes. 33338 * A number (shorthand for `mainAxis` or distance), or an axes configuration 33339 * object may be passed. 33340 * @see https://floating-ui.com/docs/offset 33341 */ 33342 var offset = offset$1; 33343 /** 33344 * Optimizes the visibility of the floating element by shifting it in order to 33345 * keep it in view when it will overflow the clipping boundary. 33346 * @see https://floating-ui.com/docs/shift 33347 */ 33348 var shift = shift$1; 33349 /** 33350 * Optimizes the visibility of the floating element by flipping the `placement` 33351 * in order to keep it in view when the preferred placement(s) will overflow the 33352 * clipping boundary. Alternative to `autoPlacement`. 33353 * @see https://floating-ui.com/docs/flip 33354 */ 33355 var flip = flip$1; 33356 /** 33357 * Provides data that allows you to change the size of the floating element â 33358 * for instance, prevent it from overflowing the clipping boundary or match the 33359 * width of the reference element. 33360 * @see https://floating-ui.com/docs/size 33361 */ 33362 var size = size$1; 33363 /** 33364 * Provides data to hide the floating element in applicable situations, such as 33365 * when it is not in the same clipping context as the reference element. 33366 * @see https://floating-ui.com/docs/hide 33367 */ 33368 var hide = hide$1; 33369 /** 33370 * Provides data to position an inner element of the floating element so that it 33371 * appears centered to the reference element. 33372 * @see https://floating-ui.com/docs/arrow 33373 */ 33374 var arrow = arrow$1; 33375 /** 33376 * Built-in `limiter` that will stop `shift()` at a certain point. 33377 */ 33378 var limitShift = limitShift$1; 33379 /** 33380 * Computes the `x` and `y` coordinates that will place the floating element 33381 * next to a given reference element. 33382 */ 33383 var computePosition = (reference, floating, options) => { 33384 const cache = /* @__PURE__ */ new Map(); 33385 const mergedOptions = { 33386 platform, 33387 ...options 33388 }; 33389 const platformWithCache = { 33390 ...mergedOptions.platform, 33391 _c: cache 33392 }; 33393 return computePosition$1(reference, floating, { 33394 ...mergedOptions, 33395 platform: platformWithCache 33396 }); 33397 }; 33398 //#endregion 33399 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/floating-svelte/floating-utils.svelte.js 33400 function get(valueOrGetValue) { 33401 return typeof valueOrGetValue === "function" ? valueOrGetValue() : valueOrGetValue; 33402 } 33403 function getDPR(element) { 33404 if (typeof window === "undefined") return 1; 33405 return (element.ownerDocument.defaultView || window).devicePixelRatio || 1; 33406 } 33407 function roundByDPR(element, value) { 33408 const dpr = getDPR(element); 33409 return Math.round(value * dpr) / dpr; 33410 } 33411 function getFloatingContentCSSVars(name) { 33412 return { 33413 [`--bits-${name}-content-transform-origin`]: `var(--bits-floating-transform-origin)`, 33414 [`--bits-${name}-content-available-width`]: `var(--bits-floating-available-width)`, 33415 [`--bits-${name}-content-available-height`]: `var(--bits-floating-available-height)`, 33416 [`--bits-${name}-anchor-width`]: `var(--bits-floating-anchor-width)`, 33417 [`--bits-${name}-anchor-height`]: `var(--bits-floating-anchor-height)` 33418 }; 33419 } 33420 //#endregion 33421 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/floating-svelte/use-floating.svelte.js 33422 function useFloating(options) { 33423 /** Options */ 33424 const whileElementsMountedOption = options.whileElementsMounted; 33425 const openOption = /* @__PURE__ */ user_derived(() => get(options.open) ?? true); 33426 const middlewareOption = /* @__PURE__ */ user_derived(() => get(options.middleware)); 33427 const transformOption = /* @__PURE__ */ user_derived(() => get(options.transform) ?? true); 33428 const placementOption = /* @__PURE__ */ user_derived(() => get(options.placement) ?? "bottom"); 33429 const strategyOption = /* @__PURE__ */ user_derived(() => get(options.strategy) ?? "absolute"); 33430 const sideOffsetOption = /* @__PURE__ */ user_derived(() => get(options.sideOffset) ?? 0); 33431 const alignOffsetOption = /* @__PURE__ */ user_derived(() => get(options.alignOffset) ?? 0); 33432 const reference = options.reference; 33433 /** State */ 33434 let x = /* @__PURE__ */ state(0); 33435 let y = /* @__PURE__ */ state(0); 33436 const floating = simpleBox(null); 33437 let strategy = /* @__PURE__ */ state(proxy(get$2(strategyOption))); 33438 let placement = /* @__PURE__ */ state(proxy(get$2(placementOption))); 33439 let middlewareData = /* @__PURE__ */ state(proxy({})); 33440 let isPositioned = /* @__PURE__ */ state(false); 33441 let hasWhileMountedPosition = false;
33442 let updateRequestId = 0; 33443 const floatingStyles = /* @__PURE__ */ user_derived(() => { 33444 const xVal = floating.current ? roundByDPR(floating.current, get$2(x)) : get$2(x); 33445 const yVal = floating.current ? roundByDPR(floating.current, get$2(y)) : get$2(y); 33446 if (get$2(transformOption)) return { 33447 position: get$2(strategy), 33448 left: "0", 33449 top: "0", 33450 transform: `translate(${xVal}px, ${yVal}px)`, 33451 ...floating.current && getDPR(floating.current) >= 1.5 && { willChange: "transform" } 33452 }; 33453 return { 33454 position: get$2(strategy), 33455 left: `${xVal}px`, 33456 top: `${yVal}px` 33457 }; 33458 }); 33459 /** Effects */ 33460 let whileElementsMountedCleanup; 33461 function update() { 33462 if (reference.current === null || floating.current === null) return; 33463 const referenceNode = reference.current; 33464 const floatingNode = floating.current; 33465 const requestId = ++updateRequestId; 33466 computePosition(referenceNode, floatingNode, { 33467 middleware: get$2(middlewareOption), 33468 placement: get$2(placementOption), 33469 strategy: get$2(strategyOption) 33470 }).then((position) => { 33471 if (requestId !== updateRequestId) return; 33472 if (reference.current !== referenceNode || floating.current !== floatingNode) return; 33473 if (isReferenceHidden(referenceNode)) { 33474 set(middlewareData, { 33475 ...get$2(middlewareData), 33476 hide: { 33477 ...get$2(middlewareData).hide, 33478 referenceHidden: true 33479 } 33480 }, true); 33481 return; 33482 } 33483 if (!get$2(openOption) && get$2(x) !== 0 && get$2(y) !== 0) { 33484 const maxExpectedOffset = Math.max(Math.abs(get$2(sideOffsetOption)), Math.abs(get$2(alignOffsetOption)), 15); 33485 if (position.x <= maxExpectedOffset && position.y <= maxExpectedOffset) return; 33486 } 33487 set(x, position.x, true); 33488 set(y, position.y, true); 33489 set(strategy, position.strategy, true); 33490 set(placement, position.placement, true); 33491 set(middlewareData, position.middlewareData, true); 33492 set(isPositioned, true); 33493 }); 33494 } 33495 function cleanup() { 33496 if (typeof whileElementsMountedCleanup === "function") { 33497 whileElementsMountedCleanup(); 33498 whileElementsMountedCleanup = void 0; 33499 } 33500 updateRequestId++; 33501 } 33502 function attach() { 33503 cleanup(); 33504 if (whileElementsMountedOption === void 0) { 33505 update(); 33506 return; 33507 } 33508 if (!get$2(openOption)) return; 33509 if (reference.current === null || floating.current === null) return; 33510 whileElementsMountedCleanup = whileElementsMountedOption(reference.current, floating.current, update); 33511 } 33512 function reset() { 33513 if (!get$2(openOption) && floating.current === null) set(isPositioned, false); 33514 } 33515 function trackWhileMountedDeps() { 33516 return [ 33517 get$2(middlewareOption), 33518 get$2(placementOption), 33519 get$2(strategyOption), 33520 get$2(sideOffsetOption), 33521 get$2(alignOffsetOption), 33522 get$2(openOption) 33523 ]; 33524 } 33525 user_effect(() => { 33526 if (whileElementsMountedOption !== void 0) return; 33527 if (!get$2(openOption)) return; 33528 update(); 33529 }); 33530 user_effect(attach); 33531 user_effect(() => { 33532 if (whileElementsMountedOption === void 0) return; 33533 trackWhileMountedDeps(); 33534 if (!get$2(openOption)) { 33535 hasWhileMountedPosition = false; 33536 return; 33537 } 33538 if (!get$2(isPositioned)) { 33539 hasWhileMountedPosition = false; 33540 return; 33541 } 33542 if (!hasWhileMountedPosition) { 33543 hasWhileMountedPosition = true; 33544 return; 33545 } 33546 update(); 33547 }); 33548 user_effect(reset); 33549 user_effect(() => cleanup); 33550 return { 33551 floating, 33552 reference, 33553 get strategy() { 33554 return get$2(strategy); 33555 }, 33556 get placement() { 33557 return get$2(placement); 33558 }, 33559 get middlewareData() { 33560 return get$2(middlewareData); 33561 }, 33562 get isPositioned() { 33563 return get$2(isPositioned); 33564 }, 33565 get floatingStyles() { 33566 return get$2(floatingStyles); 33567 }, 33568 get update() { 33569 return update; 33570 } 33571 }; 33572 } 33573 function isReferenceHidden(node) { 33574 if (!(node instanceof Element)) return false; 33575 if (!node.isConnected) return true; 33576 if (node instanceof HTMLElement && node.hidden) return true; 33577 return node.getClientRects().length === 0; 33578 } 33579 //#endregion 33580 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js 33581 var OPPOSITE_SIDE = { 33582 top: "bottom", 33583 right: "left", 33584 bottom: "top", 33585 left: "right" 33586 }; 33587 var FloatingRootContext = new Context("Floating.Root"); 33588 var FloatingContentContext = new Context("Floating.Content"); 33589 var FloatingTooltipRootContext = new Context("Floating.Root"); 33590 var FloatingRootState = class FloatingRootState { 33591 static create(tooltip = false) { 33592 return tooltip ? FloatingTooltipRootContext.set(new FloatingRootState()) : FloatingRootContext.set(new FloatingRootState()); 33593 } 33594 anchorNode = simpleBox(null); 33595 customAnchorNode = simpleBox(null); 33596 triggerNode = simpleBox(null); 33597 constructor() { 33598 user_effect(() => { 33599 if (this.customAnchorNode.current) if (typeof this.customAnchorNode.current === "string") this.anchorNode.current = document.querySelector(this.customAnchorNode.current); 33600 else this.anchorNode.current = this.customAnchorNode.current; 33601 else this.anchorNode.current = this.triggerNode.current; 33602 }); 33603 } 33604 }; 33605 var FloatingContentState = class FloatingContentState { 33606 static create(opts, tooltip = false) { 33607 return tooltip ? FloatingContentContext.set(new FloatingContentState(
33607opts, FloatingTooltipRootContext.get())) : FloatingContentContext.set(new FloatingContentState(opts, FloatingRootContext.get())); 33608 } 33609 opts; 33610 root; 33611 contentRef = simpleBox(null); 33612 wrapperRef = simpleBox(null); 33613 arrowRef = simpleBox(null); 33614 contentAttachment = attachRef(this.contentRef); 33615 wrapperAttachment = attachRef(this.wrapperRef); 33616 arrowAttachment = attachRef(this.arrowRef); 33617 arrowId = simpleBox(useId()); 33618 #transformedStyle = /* @__PURE__ */ user_derived(() => { 33619 if (typeof this.opts.style === "string") return cssToStyleObj(this.opts.style); 33620 if (!this.opts.style) return {}; 33621 }); 33622 #updatePositionStrategy = void 0; 33623 #arrowSize = new ElementSize(() => this.arrowRef.current ?? void 0); 33624 #arrowWidth = /* @__PURE__ */ user_derived(() => this.#arrowSize?.width ?? 0); 33625 #arrowHeight = /* @__PURE__ */ user_derived(() => this.#arrowSize?.height ?? 0); 33626 #desiredPlacement = /* @__PURE__ */ user_derived(() => this.opts.side?.current + (this.opts.align.current !== "center" ? `-${this.opts.align.current}` : "")); 33627 #boundary = /* @__PURE__ */ user_derived(() => Array.isArray(this.opts.collisionBoundary.current) ? this.opts.collisionBoundary.current : [this.opts.collisionBoundary.current]); 33628 #hasExplicitBoundaries = /* @__PURE__ */ user_derived(() => get$2(this.#boundary).length > 0); 33629 get hasExplicitBoundaries() { 33630 return get$2(this.#hasExplicitBoundaries); 33631 } 33632 set hasExplicitBoundaries(value) { 33633 set(this.#hasExplicitBoundaries, value); 33634 } 33635 #detectOverflowOptions = /* @__PURE__ */ user_derived(() => ({ 33636 padding: this.opts.collisionPadding.current, 33637 boundary: get$2(this.#boundary).filter(isNotNull), 33638 altBoundary: this.hasExplicitBoundaries 33639 })); 33640 get detectOverflowOptions() { 33641 return get$2(this.#detectOverflowOptions); 33642 } 33643 set detectOverflowOptions(value) { 33644 set(this.#detectOverflowOptions, value); 33645 } 33646 #availableWidth = /* @__PURE__ */ state(void 0); 33647 #availableHeight = /* @__PURE__ */ state(void 0); 33648 #anchorWidth = /* @__PURE__ */ state(void 0); 33649 #anchorHeight = /* @__PURE__ */ state(void 0); 33650 #middleware = /* @__PURE__ */ user_derived(() => [ 33651 offset({ 33652 mainAxis: this.opts.sideOffset.current + get$2(this.#arrowHeight), 33653 alignmentAxis: this.opts.alignOffset.current 33654 }), 33655 this.opts.avoidCollisions.current && shift({ 33656 mainAxis: true, 33657 crossAxis: false, 33658 limiter: this.opts.sticky.current === "partial" ? limitShift() : void 0, 33659 ...this.detectOverflowOptions 33660 }), 33661 this.opts.avoidCollisions.current && flip({ ...this.detectOverflowOptions }), 33662 size({ 33663 ...this.detectOverflowOptions, 33664 apply: ({ rects, availableWidth, availableHeight }) => { 33665 const { width: anchorWidth, height: anchorHeight } = rects.reference; 33666 set(this.#availableWidth, availableWidth, true); 33667 set(this.#availableHeight, availableHeight, true); 33668 set(this.#anchorWidth, anchorWidth, true); 33669 set(this.#anchorHeight, anchorHeight, true); 33670 } 33671 }), 33672 this.arrowRef.current && arrow({ 33673 element: this.arrowRef.current, 33674 padding: this.opts.arrowPadding.current 33675 }), 33676 transformOrigin({ 33677 arrowWidth: get$2(this.#arrowWidth), 33678 arrowHeight: get$2(this.#arrowHeight) 33679 }), 33680 this.opts.hideWhenDetached.current && hide({ 33681 strategy: "referenceHidden", 33682 ...this.detectOverflowOptions 33683 })
33684 ].filter(Boolean)); 33685 get middleware() { 33686 return get$2(this.#middleware); 33687 } 33688 set middleware(value) { 33689 set(this.#middleware, value); 33690 } 33691 floating; 33692 #placedSide = /* @__PURE__ */ user_derived(() => getSideFromPlacement(this.floating.placement)); 33693 get placedSide() { 33694 return get$2(this.#placedSide); 33695 } 33696 set placedSide(value) { 33697 set(this.#placedSide, value); 33698 } 33699 #placedAlign = /* @__PURE__ */ user_derived(() => getAlignFromPlacement(this.floating.placement)); 33700 get placedAlign() { 33701 return get$2(this.#placedAlign); 33702 } 33703 set placedAlign(value) { 33704 set(this.#placedAlign, value); 33705 } 33706 #arrowX = /* @__PURE__ */ user_derived(() => this.floating.middlewareData.arrow?.x ?? 0); 33707 get arrowX() { 33708 return get$2(this.#arrowX); 33709 } 33710 set arrowX(value) { 33711 set(this.#arrowX, value); 33712 } 33713 #arrowY = /* @__PURE__ */ user_derived(() => this.floating.middlewareData.arrow?.y ?? 0); 33714 get arrowY() { 33715 return get$2(this.#arrowY); 33716 } 33717 set arrowY(value) { 33718 set(this.#arrowY, value); 33719 } 33720 #cannotCenterArrow = /* @__PURE__ */ user_derived(() => this.floating.middlewareData.arrow?.centerOffset !== 0); 33721 get cannotCenterArrow() { 33722 return get$2(this.#cannotCenterArrow); 33723 } 33724 set cannotCenterArrow(value) { 33725 set(this.#cannotCenterArrow, value); 33726 } 33727 #contentZIndex = /* @__PURE__ */ state(); 33728 get contentZIndex() { 33729 return get$2(this.#contentZIndex); 33730 } 33731 set contentZIndex(value) { 33732 set(this.#contentZIndex, value, true); 33733 } 33734 #arrowBaseSide = /* @__PURE__ */ user_derived(() => OPPOSITE_SIDE[this.placedSide]); 33735 get arrowBaseSide() { 33736 return get$2(this.#arrowBaseSide); 33737 } 33738 set arrowBaseSide(value) { 33739 set(this.#arrowBaseSide, value); 33740 } 33741 #wrapperProps = /* @__PURE__ */ user_derived(() => ({ 33742 id: this.opts.wrapperId.current, 33743 "data-bits-floating-content-wrapper": "", 33744 style: { 33745 ...this.floating.floatingStyles, 33746 transform: this.floating.isPositioned ? this.floating.floatingStyles.transform : "translate(0, -200%)", 33747 minWidth: "max-content", 33748 zIndex: this.contentZIndex, 33749 "--bits-floating-transform-origin": `${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`, 33750 "--bits-floating-available-width": `${get$2(this.#availableWidth)}px`, 33751 "--bits-floating-available-height": `${get$2(this.#availableHeight)}px`, 33752 "--bits-floating-anchor-width": `${get$2(this.#anchorWidth)}px`, 33753 "--bits-floating-anchor-height": `${get$2(this.#anchorHeight)}px`, 33754 ...this.floating.middlewareData.hide?.referenceHidden && { 33755 visibility: "hidden", 33756 "pointer-events": "none" 33757 }, 33758 ...get$2(this.#transformedStyle) 33759 }, 33760 dir: this.opts.dir.current, 33761 ...this.wrapperAttachment 33762 })); 33763 get wrapperProps() { 33764 return get$2(this.#wrapperProps); 33765 } 33766 set wrapperProps(value) { 33767 set(this.#wrapperProps, value); 33768 } 33769 #props = /* @__PURE__ */ user_derived(() => ({ 33770 "data-side": this.placedSide, 33771 "data-align": this.placedAlign, 33772 style: styleToString({ ...get$2(this.#transformedStyle) }), 33773 ...this.contentAttachment 33774 })); 33775 get props() { 33776 return get$2(this.#props); 33777 } 33778 set props(value) { 33779 set(this.#props, value); 33780 } 33781 #arrowStyle = /* @__PURE__ */ user_derived(() => ({ 33782 position: "absolute", 33783 left: this.arrowX ? `${this.arrowX}px` : void 0, 33784 top: this.arrowY ? `${this.arrowY}px` : void 0, 33785 [this.arrowBaseSide]: 0, 33786 "transform-origin": { 33787 top: "", 33788 right: "0 0", 33789 bottom: "center 0", 33790 left: "100% 0" 33791 }[this.placedSide], 33792 transform: { 33793 top: "translateY(100%)", 33794 right: "translateY(50%) rotate(90deg) translateX(-50%)", 33795 bottom: "rotate(180deg)", 33796 left: "translateY(50%) rotate(-90deg) translateX(50%)" 33797 }[this.placedSide], 33798 visibility: this.cannotCenterArrow ? "hidden" : void 0 33799 })); 33800 get arrowStyle() { 33801 return get$2(this.#arrowStyle); 33802 } 33803 set arrowStyle(value) { 33804 set(this.#arrowStyle, value); 33805 } 33806 constructor(opts, root) { 33807 this.opts = opts; 33808 this.root = root; 33809 this.#updatePositionStrategy = opts.updatePositionStrategy; 33810 if (opts.customAnchor) this.root.customAnchorNode.current = opts.customAnchor.current; 33811 watch(() => opts.customAnchor.current, (customAnchor) => { 33812 this.root.customAnchorNode.current = customAnchor; 33813 }); 33814 this.floating = useFloating({ 33815 strategy: () => this.opts.strategy.current, 33816 placement: () => get$2(this.#desiredPlacement), 33817 middleware: () => this.middleware, 33818 reference: this.root.anchorNode, 33819 whileElementsMounted: (...args) => { 33820 return autoUpdate(...args, { animationFrame: this.#updatePositionStrategy?.current === "always" }); 33821 }, 33822 open: () => this.opts.enabled.current, 33823 sideOffset: () => this.opts.sideOffset.current, 33824 alignOffset: () => this.opts.alignOffset.current 33825 }); 33826 user_effect(() => { 33827 if (!this.floating.isPositioned) return; 33828 this.opts.onPlaced?.current(); 33829 }); 33830 watch(() => this.contentRef.current, (contentNode) => { 33831 if (!contentNode || !this.opts.enabled.current) return; 33832 const win = getWindow$1(contentNode); 33833 const rafId = win.requestAnimationFrame(() => { 33834 if (this.contentRef.current !== contentNode || !this.opts.enabled.current) return; 33835 const zIndex = win.getComputedStyle(contentNode).zIndex; 33836 if (zIndex !== this.contentZIndex) this.contentZIndex = zIndex; 33837 }); 33838 return () => { 33839 win.cancelAnimationFrame(rafId); 33840 }; 33841 }); 33842 user_effect(() => { 33843 this.floating.floating.current = this.wrapperRef.current; 33844 }); 33845 } 33846 }; 33847 var FloatingAnchorState = class FloatingAnchorState { 33848 static create(opts, tooltip = false) { 33849 return tooltip ? new FloatingAnchorState(opts, FloatingTooltipRootContext.get()) : new FloatingAnchorState(opts, FloatingRootContext.get()); 33850 } 33851 opts; 33852 root; 33853 constructor(opts, root) { 33854 this.opts = opts; 33855 this.root = root; 33856 if (opts.virtualEl && opts.virtualEl.current) root.triggerNode = boxFrom(opts.virtualEl.current); 33857 else root.triggerNode = opts.ref; 33858 } 33859 }; 33860 function transformOrigin(options) { 33861 return { 33862 name: "transformOrigin", 33863 options, 33864 fn(data) { 33865 const { placement, rects, middlewareData } = data; 33866 const isArrowHidden = middlewareData.arrow?.centerOffset !== 0; 33867 const arrowWidth = isArrowHidden ? 0 : options.arrowWidth; 33868 const arrowHeight = isArrowHidden ? 0 : options.arrowHeight; 33869 const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement); 33870 const noArrowAlign = { 33871 start: "0%", 33872 center: "50%", 33873 end: "100%" 33874 }[placedAlign]; 33875 const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2; 33876 const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2; 33877 let x = ""; 33878 let y = ""; 33879 if (placedSide === "bottom") { 33880 x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; 33881 y = `${-arrowHeight}px`; 33882 } else if (placedSide === "top") { 33883 x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`; 33884 y = `${rects.floating.height + arrowHeight}px`; 33885 } else if (placedSide === "right") { 33886 x = `${-arrowHeight}px`; 33887 y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; 33888 } else if (placedSide === "left") { 33889 x = `${rects.floating.width + arrowHeight}px`; 33890 y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`; 33891 } 33892 return { data: { 33893 x, 33894 y 33895 } }; 33896 } 33897 }; 33898 } 33899 function getSideAndAlignFromPlacement(placement) { 33900 const [side, align = "center"] = placement.split("-"); 33901 return [side, align]; 33902 } 33903 function getSideFromPlacement(placement) { 33904 return getSideAndAlignFromPlacement(placement)[0]; 33905 } 33906 function getAlignFromPlacement(placement) { 33907 return getSideAndAlignFromPlacement(placement)[1]; 33908 } 33909 //#endregion 33910 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer.svelte 33911 function Floating_layer($$anchor, $$props) { 33912 push($$props, true); 33913 let children = prop($$props, "children", 7), tooltip = prop($$props, "tooltip", 7, false); 33914 FloatingRootState.create(tooltip()); 33915 var $$exports = { 33916 get children() { 33917 return children(); 33918 }, 33919 set children($$value) { 33920 children($$value); 33921 flushSync(); 33922 }, 33923 get tooltip() { 33924 return tooltip(); 33925 }, 33926 set tooltip($$value = false) { 33927 tooltip($$value); 33928 flushSync(); 33929 } 33930 }; 33931 var fragment = comment(); 33932 snippet(first_child(fragment), () => children() ?? noop$1); 33933 append($$anchor, fragment); 33934 return pop($$exports); 33935 }
33936 create_custom_element(Floating_layer, { 33937 children: {}, 33938 tooltip: {} 33939 }, [], [], { mode: "open" }); 33940 //#endregion 33941 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte 33942 function Floating_layer_anchor($$anchor, $$props) { 33943 push($$props, true); 33944 let id = prop($$props, "id", 7), children = prop($$props, "children", 7), virtualEl = prop($$props, "virtualEl", 7), ref = prop($$props, "ref", 7), tooltip = prop($$props, "tooltip", 7, false); 33945 FloatingAnchorState.create({ 33946 id: boxWith(() => id()), 33947 virtualEl: boxWith(() => virtualEl()), 33948 ref: ref() 33949 }, tooltip()); 33950 var $$exports = { 33951 get id() { 33952 return id(); 33953 }, 33954 set id($$value) { 33955 id($$value); 33956 flushSync(); 33957 }, 33958 get children() { 33959 return children(); 33960 }, 33961 set children($$value) { 33962 children($$value); 33963 flushSync(); 33964 }, 33965 get virtualEl() { 33966 return virtualEl(); 33967 }, 33968 set virtualEl($$value) { 33969 virtualEl($$value); 33970 flushSync(); 33971 }, 33972 get ref() { 33973 return ref(); 33974 }, 33975 set ref($$value) { 33976 ref($$value); 33977 flushSync(); 33978 }, 33979 get tooltip() { 33980 return tooltip(); 33981 }, 33982 set tooltip($$value = false) { 33983 tooltip($$value); 33984 flushSync(); 33985 } 33986 }; 33987 var fragment = comment(); 33988 snippet(first_child(fragment), () => children() ?? noop$1); 33989 append($$anchor, fragment); 33990 return pop($$exports); 33991 } 33992 create_custom_element(Floating_layer_anchor, { 33993 id: {}, 33994 children: {}, 33995 virtualEl: {}, 33996 ref: {}, 33997 tooltip: {} 33998 }, [], [], { mode: "open" }); 33999 //#endregion 34000 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content.svelte 34001 function Floating_layer_content($$anchor, $$props) { 34002 push($$props, true); 34003 let content = prop($$props, "content", 7), side = prop($$props, "side", 7, "bottom"), sideOffset = prop($$props, "sideOffset", 7, 0), align = prop($$props, "align", 7, "center"), alignOffset = prop($$props, "alignOffset", 7, 0), id = prop($$props, "id", 7), arrowPadding = prop($$props, "arrowPadding", 7, 0), avoidCollisions = prop($$props, "avoidCollisions", 7, true), collisionBoundary = prop($$props, "collisionBoundary", 23, () => []), collisionPadding = prop($$props, "collisionPadding", 7, 0), hideWhenDetached = prop($$props, "hideWhenDetached", 7, false), onPlaced = prop($$props, "onPlaced", 7, () => {}), sticky = prop($$props, "sticky", 7, "partial"), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7, "optimized"), strategy = prop($$props, "strategy", 7, "fixed"), dir = prop($$props, "dir", 7, "ltr"), style = prop($$props, "style", 23, () => ({})), wrapperId = prop($$props, "wrapperId", 23, useId), customAnchor = prop($$props, "customAnchor", 7, null), enabled = prop($$props, "enabled", 7), tooltip = prop($$props, "tooltip", 7, false); 34004 const contentState = FloatingContentState.create({ 34005 side: boxWith(() => side()), 34006 sideOffset: boxWith(() => sideOffset()), 34007 align: boxWith(() => align()), 34008 alignOffset: boxWith(() => alignOffset()), 34009 id: boxWith(() => id()), 34010 arrowPadding: boxWith(() => arrowPadding()), 34011 avoidCollisions: boxWith(() => avoidCollisions()), 34012 collisionBoundary: boxWith(() => collisionBoundary()), 34013 collisionPadding: boxWith(() => collisionPadding()), 34014 hideWhenDetached: boxWith(() => hideWhenDetached()), 34015 onPlaced: boxWith(() => onPlaced()), 34016 sticky: boxWith(() => sticky()), 34017 updatePositionStrategy: boxWith(() => updatePositionStrategy()), 34018 strategy: boxWith(() => strategy()), 34019 dir: boxWith(() => dir()), 34020 style: boxWith(() => style()), 34021 enabled: boxWith(() => enabled()), 34022 wrapperId: boxWith(() => wrapperId()), 34023 customAnchor: boxWith(() => customAnchor()) 34024 }, tooltip()); 34025 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(contentState.wrapperProps, { style: { pointerEvents: "auto" } })); 34026 var $$exports = { 34027 get content() { 34028 return content(); 34029 }, 34030 set content($$value) { 34031 content($$value); 34032 flushSync(); 34033 }, 34034 get side() { 34035 return side(); 34036 }, 34037 set side($$value = "bottom") { 34038 side($$value); 34039 flushSync(); 34040 }, 34041 get sideOffset() { 34042 return sideOffset(); 34043 }, 34044 set sideOffset($$value = 0) { 34045 sideOffset($$value); 34046 flushSync(); 34047 }, 34048 get align() { 34049 return align(); 34050 }, 34051 set align($$value = "center") { 34052 align($$value); 34053 flushSync(); 34054 }, 34055 get alignOffset() { 34056 return alignOffset(); 34057 }, 34058 set alignOffset($$value = 0) { 34059 alignOffset($$value); 34060 flushSync(); 34061 }, 34062 get id() { 34063 return id(); 34064 }, 34065 set id($$value) { 34066 id($$value); 34067 flushSync(); 34068 }, 34069 get arrowPadding() { 34070 return arrowPadding(); 34071 }, 34072 set arrowPadding($$value = 0) { 34073 arrowPadding($$value); 34074 flushSync(); 34075 }, 34076 get avoidCollisions() { 34077 return avoidCollisions(); 34078 }, 34079 set avoidCollisions($$value = true) { 34080 avoidCollisions($$value); 34081 flushSync(); 34082 }, 34083 get collisionBoundary() { 34084 return collisionBoundary(); 34085 }, 34086 set collisionBoundary($$value = []) { 34087 collisionBoundary($$value); 34088 flushSync(); 34089 }, 34090 get collisionPadding() { 34091 return collisionPadding(); 34092 }, 34093 set collisionPadding($$value = 0) { 34094 collisionPadding($$value); 34095 flushSync(); 34096 }, 34097 get hideWhenDetached() { 34098 return hideWhenDetached(); 34099 }, 34100 set hideWhenDetached($$value = false) { 34101 hideWhenDetached($$value); 34102 flushSync(); 34103 }, 34104 get onPlaced() { 34105 return onPlaced(); 34106 }, 34107 set onPlaced($$value = () => {}) { 34108 onPlaced($$value); 34109 flushSync(); 34110 }, 34111 get sticky() { 34112 return sticky(); 34113 }, 34114 set sticky($$value = "partial") { 34115 sticky($$value); 34116 flushSync(); 34117 }, 34118 get updatePositionStrategy() { 34119 return updatePositionStrategy(); 34120 }, 34121 set updatePositionStrategy($$value = "optimized") { 34122 updatePositionStrategy($$value); 34123 flushSync(); 34124 }, 34125 get strategy() { 34126 return strategy(); 34127 }, 34128 set strategy($$value = "fixed") { 34129 strategy($$value); 34130 flushSync(); 34131 }, 34132 get dir() { 34133 return dir(); 34134 }, 34135 set dir($$value = "ltr") { 34136 dir($$value); 34137 flushSync(); 34138 }, 34139 get style() { 34140 return style(); 34141 }, 34142 set style($$value = {}) { 34143 style($$value); 34144 flushSync(); 34145 }, 34146 get wrapperId() { 34147 return wrapperId(); 34148 }, 34149 set wrapperId($$value = useId()) { 34150 wrapperId($$value); 34151 flushSync(); 34152 }, 34153 get customAnchor() { 34154 return customAnchor(); 34155 }, 34156 set customAnchor($$value = null) { 34157 customAnchor($$value); 34158 flushSync(); 34159 }, 34160 get enabled() { 34161 return enabled(); 34162 }, 34163 set enabled($$value) { 34164 enabled($$value); 34165 flushSync(); 34166 }, 34167 get tooltip() { 34168 return tooltip(); 34169 }, 34170 set tooltip($$value = false) { 34171 tooltip($$value); 34172 flushSync(); 34173 } 34174 }; 34175 var fragment = comment(); 34176 snippet(first_child(fragment), () => content() ?? noop$1, () => ({ 34177 props: contentState.props, 34178 wrapperProps: get$2(mergedProps) 34179 })); 34180 append($$anchor, fragment); 34181 return pop($$exports); 34182 }
34183 create_custom_element(Floating_layer_content, { 34184 content: {}, 34185 side: {}, 34186 sideOffset: {}, 34187 align: {}, 34188 alignOffset: {}, 34189 id: {}, 34190 arrowPadding: {}, 34191 avoidCollisions: {}, 34192 collisionBoundary: {}, 34193 collisionPadding: {}, 34194 hideWhenDetached: {}, 34195 onPlaced: {}, 34196 sticky: {}, 34197 updatePositionStrategy: {}, 34198 strategy: {}, 34199 dir: {}, 34200 style: {}, 34201 wrapperId: {}, 34202 customAnchor: {}, 34203 enabled: {}, 34204 tooltip: {} 34205 }, [], [], { mode: "open" }); 34206 //#endregion 34207 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content-static.svelte 34208 function Floating_layer_content_static($$anchor, $$props) { 34209 push($$props, true); 34210 let content = prop($$props, "content", 7), onPlaced = prop($$props, "onPlaced", 7); 34211 onMount(() => { 34212 onPlaced()?.(); 34213 }); 34214 var $$exports = { 34215 get content() { 34216 return content(); 34217 }, 34218 set content($$value) { 34219 content($$value); 34220 flushSync(); 34221 }, 34222 get onPlaced() { 34223 return onPlaced(); 34224 }, 34225 set onPlaced($$value) { 34226 onPlaced($$value); 34227 flushSync(); 34228 } 34229 }; 34230 var fragment = comment(); 34231 snippet(first_child(fragment), () => content() ?? noop$1, () => ({ 34232 props: {}, 34233 wrapperProps: {} 34234 })); 34235 append($$anchor, fragment); 34236 return pop($$exports); 34237 } 34238 create_custom_element(Floating_layer_content_static, { 34239 content: {}, 34240 onPlaced: {} 34241 }, [], [], { mode: "open" }); 34242 //#endregion 34243 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-content.svelte 34244 var rest_excludes$12 = new Set([ 34245 "$$slots", 34246 "$$events", 34247 "$$legacy", 34248 "$$host", 34249 "content", 34250 "isStatic", 34251 "onPlaced" 34252 ]); 34253 function Popper_content($$anchor, $$props) { 34254 push($$props, true); 34255 let content = prop($$props, "content", 7), isStatic = prop($$props, "isStatic", 7, false), onPlaced = prop($$props, "onPlaced", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$12); 34256 var $$exports = { 34257 get content() { 34258 return content(); 34259 }, 34260 set content($$value) { 34261 content($$value); 34262 flushSync(); 34263 }, 34264 get isStatic() { 34265 return isStatic(); 34266 }, 34267 set isStatic($$value = false) { 34268 isStatic($$value); 34269 flushSync(); 34270 }, 34271 get onPlaced() { 34272 return onPlaced(); 34273 }, 34274 set onPlaced($$value) { 34275 onPlaced($$value); 34276 flushSync(); 34277 } 34278 }; 34279 var fragment = comment(); 34280 var node = first_child(fragment); 34281 var consequent = ($$anchor) => { 34282 Floating_layer_content_static($$anchor, { 34283 get content() { 34284 return content(); 34285 }, 34286 get onPlaced() { 34287 return onPlaced(); 34288 } 34289 }); 34290 }; 34291 var alternate = ($$anchor) => { 34292 Floating_layer_content($$anchor, spread_props({ 34293 get content() { 34294 return content(); 34295 }, 34296 get onPlaced() { 34297 return onPlaced(); 34298 } 34299 }, () => restProps)); 34300 }; 34301 if_block(node, ($$render) => { 34302 if (isStatic()) $$render(consequent); 34303 else $$render(alternate, -1); 34304 }); 34305 append($$anchor, fragment); 34306 return pop($$exports); 34307 } 34308 create_custom_element(Popper_content, { 34309 content: {}, 34310 isStatic: {}, 34311 onPlaced: {} 34312 }, [], [], { mode: "open" }); 34313 //#endregion 34314 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-inner.svelte 34315 var rest_excludes$11 = new Set([ 34316 "$$slots", 34317 "$$events", 34318 "$$legacy", 34319 "$$host", 34320 "popper", 34321 "onEscapeKeydown", 34322 "escapeKeydownBehavior", 34323 "preventOverflowTextSelection", 34324 "id", 34325 "onPointerDown", 34326 "onPointerUp", 34327 "side", 34328 "sideOffset", 34329 "align", 34330 "alignOffset", 34331 "arrowPadding", 34332 "avoidCollisions", 34333 "collisionBoundary", 34334 "collisionPadding", 34335 "sticky", 34336 "hideWhenDetached", 34337 "updatePositionStrategy", 34338 "strategy", 34339 "dir", 34340 "preventScroll", 34341 "wrapperId", 34342 "style", 34343 "onPlaced", 34344 "onInteractOutside", 34345 "onCloseAutoFocus", 34346 "onOpenAutoFocus", 34347 "onFocusOutside", 34348 "interactOutsideBehavior", 34349 "loop", 34350 "trapFocus", 34351 "isValidEvent", 34352 "customAnchor", 34353 "isStatic", 34354 "enabled", 34355 "ref", 34356 "tooltip", 34357 "contentPointerEvents" 34358 ]); 34359 var root$23 = /* @__PURE__ */ from_html(`<!> <!>`, 1); 34360 function Popper_layer_inner($$anchor, $$props) { 34361 push($$props, true);
34362 let popper = prop($$props, "popper", 7), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7), escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7), preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7), id = prop($$props, "id", 7), onPointerDown = prop($$props, "onPointerDown", 7), onPointerUp = prop($$props, "onPointerUp", 7), side = prop($$props, "side", 7), sideOffset = prop($$props, "sideOffset", 7), align = prop($$props, "align", 7), alignOffset = prop($$props, "alignOffset", 7), arrowPadding = prop($$props, "arrowPadding", 7), avoidCollisions = prop($$props, "avoidCollisions", 7), collisionBoundary = prop($$props, "collisionBoundary", 7), collisionPadding = prop($$props, "collisionPadding", 7), sticky = prop($$props, "sticky", 7), hideWhenDetached = prop($$props, "hideWhenDetached", 7), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7), strategy = prop($$props, "strategy", 7), dir = prop($$props, "dir", 7), preventScroll = prop($$props, "preventScroll", 7), wrapperId = prop($$props, "wrapperId", 7), style = prop($$props, "style", 7), onPlaced = prop($$props, "onPlaced", 7), onInteractOutside = prop($$props, "onInteractOutside", 7), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), onFocusOutside = prop($$props, "onFocusOutside", 7), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), loop = prop($$props, "loop", 7), trapFocus = prop($$props, "trapFocus", 7, true), isValidEvent = prop($$props, "isValidEvent", 7, () => false), customAnchor = prop($$props, "customAnchor", 7, null), isStatic = prop($$props, "isStatic", 7, false), enabled = prop($$props, "enabled", 7), ref = prop($$props, "ref", 7), tooltip = prop($$props, "tooltip", 7, false), contentPointerEvents = prop($$props, "contentPointerEvents", 7, "auto"), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$11); 34363 const resolvedPreventScroll = /* @__PURE__ */ user_derived(() => preventScroll() ?? true); 34364 const effectiveStrategy = /* @__PURE__ */ user_derived(() => strategy() ?? (get$2(resolvedPreventScroll) ? "fixed" : "absolute")); 34365 var $$exports = { 34366 get popper() { 34367 return popper(); 34368 }, 34369 set popper($$value) { 34370 popper($$value); 34371 flushSync(); 34372 }, 34373 get onEscapeKeydown() { 34374 return onEscapeKeydown(); 34375 }, 34376 set onEscapeKeydown($$value) { 34377 onEscapeKeydown($$value); 34378 flushSync(); 34379 }, 34380 get escapeKeydownBehavior() { 34381 return escapeKeydownBehavior(); 34382 }, 34383 set escapeKeydownBehavior($$value) { 34384 escapeKeydownBehavior($$value); 34385 flushSync(); 34386 }, 34387 get preventOverflowTextSelection() { 34388 return preventOverflowTextSelection(); 34389 }, 34390 set preventOverflowTextSelection($$value) { 34391 preventOverflowTextSelection($$value); 34392 flushSync(); 34393 }, 34394 get id() { 34395 return id(); 34396 }, 34397 set id($$value) { 34398 id($$value); 34399 flushSync(); 34400 }, 34401 get onPointerDown() { 34402 return onPointerDown(); 34403 }, 34404 set onPointerDown($$value) { 34405 onPointerDown($$value); 34406 flushSync(); 34407 }, 34408 get onPointerUp() { 34409 return onPointerUp(); 34410 }, 34411 set onPointerUp($$value) { 34412 onPointerUp($$value); 34413 flushSync(); 34414 }, 34415 get side() { 34416 return side(); 34417 }, 34418 set side($$value) { 34419 side($$value); 34420 flushSync(); 34421 }, 34422 get sideOffset() { 34423 return sideOffset(); 34424 }, 34425 set sideOffset($$value) { 34426 sideOffset($$value); 34427 flushSync(); 34428 }, 34429 get align() { 34430 return align(); 34431 }, 34432 set align($$value) { 34433 align($$value); 34434 flushSync(); 34435 }, 34436 get alignOffset() { 34437 return alignOffset(); 34438 }, 34439 set alignOffset($$value) { 34440 alignOffset($$value); 34441 flushSync(); 34442 }, 34443 get arrowPadding() { 34444 return arrowPadding(); 34445 }, 34446 set arrowPadding($$value) { 34447 arrowPadding($$value); 34448 flushSync(); 34449 }, 34450 get avoidCollisions() { 34451 return avoidCollisions(); 34452 }, 34453 set avoidCollisions($$value) { 34454 avoidCollisions($$value); 34455 flushSync(); 34456 }, 34457 get collisionBoundary() { 34458 return collisionBoundary(); 34459 }, 34460 set collisionBoundary($$value) { 34461 collisionBoundary($$value); 34462 flushSync(); 34463 }, 34464 get collisionPadding() { 34465 return collisionPadding(); 34466 }, 34467 set collisionPadding($$value) { 34468 collisionPadding($$value); 34469 flushSync(); 34470 }, 34471 get sticky() { 34472 return sticky(); 34473 }, 34474 set sticky($$value) { 34475 sticky($$value); 34476 flushSync(); 34477 }, 34478 get hideWhenDetached() { 34479 return hideWhenDetached(); 34480 }, 34481 set hideWhenDetached($$value) { 34482 hideWhenDetached($$value); 34483 flushSync(); 34484 }, 34485 get updatePositionStrategy() { 34486 return updatePositionStrategy(); 34487 }, 34488 set updatePositionStrategy($$value) { 34489 updatePositionStrategy($$value); 34490 flushSync(); 34491 }, 34492 get strategy() { 34493 return strategy(); 34494 }, 34495 set strategy($$value) { 34496 strategy($$value); 34497 flushSync(); 34498 }, 34499 get dir() { 34500 return dir(); 34501 }, 34502 set dir($$value) { 34503 dir($$value); 34504 flushSync(); 34505 }, 34506 get preventScroll() { 34507 return preventScroll(); 34508 }, 34509 set preventScroll($$value) { 34510 preventScroll($$value); 34511 flushSync(); 34512 }, 34513 get wrapperId() { 34514 return wrapperId(); 34515 }, 34516 set wrapperId($$value) { 34517 wrapperId($$value); 34518 flushSync(); 34519 }, 34520 get style() { 34521 return style(); 34522 }, 34523 set style($$value) { 34524 style($$value); 34525 flushSync(); 34526 }, 34527 get onPlaced() { 34528 return onPlaced(); 34529 }, 34530 set onPlaced($$value) { 34531 onPlaced($$value); 34532 flushSync(); 34533 }, 34534 get onInteractOutside() { 34535 return onInteractOutside(); 34536 }, 34537 set onInteractOutside($$value) { 34538 onInteractOutside($$value); 34539 flushSync(); 34540 }, 34541 get onCloseAutoFocus() { 34542 return onCloseAutoFocus(); 34543 }, 34544 set onCloseAutoFocus($$value) { 34545 onCloseAutoFocus($$value); 34546 flushSync(); 34547 }, 34548 get onOpenAutoFocus() { 34549 return onOpenAutoFocus(); 34550 }, 34551 set onOpenAutoFocus($$value) { 34552 onOpenAutoFocus($$value); 34553 flushSync(); 34554 }, 34555 get onFocusOutside() { 34556 return onFocusOutside(); 34557 }, 34558 set onFocusOutside($$value) { 34559 onFocusOutside($$value); 34560 flushSync(); 34561 }, 34562 get interactOutsideBehavior() { 34563 return interactOutsideBehavior(); 34564 }, 34565 set interactOutsideBehavior($$value = "close") { 34566 interactOutsideBehavior($$value); 34567 flushSync(); 34568 }, 34569 get loop() { 34570 return loop(); 34571 }, 34572 set loop($$value) { 34573 loop($$value); 34574 flushSync(); 34575 }, 34576 get trapFocus() { 34577 return trapFocus(); 34578 }, 34579 set trapFocus($$value = true) { 34580 trapFocus($$value); 34581 flushSync(); 34582 }, 34583 get isValidEvent() { 34584 return isValidEvent(); 34585 }, 34586 set isValidEvent($$value = () => false) { 34587 isValidEvent($$value); 34588 flushSync(); 34589 }, 34590 get customAnchor() { 34591 return customAnchor(); 34592 }, 34593 set customAnchor($$value = null) { 34594 customAnchor($$value); 34595 flushSync(); 34596 }, 34597 get isStatic() { 34598 return isStatic(); 34599 }, 34600 set isStatic($$value = false) { 34601 isStatic($$value); 34602 flushSync(); 34603 }, 34604 get enabled() { 34605 return enabled(); 34606 }, 34607 set enabled($$value) { 34608 enabled($$value); 34609 flushSync(); 34610 }, 34611 get ref() { 34612 return ref(); 34613 }, 34614 set ref($$value) { 34615 ref($$value); 34616 flushSync(); 34617 }, 34618 get tooltip() { 34619 return tooltip(); 34620 }, 34621 set tooltip($$value = false) { 34622 tooltip($$value); 34623 flushSync(); 34624 }, 34625 get contentPointerEvents() { 34626 return contentPointerEvents(); 34627 }, 34628 set contentPointerEvents($$value = "auto") { 34629 contentPointerEvents($$value); 34630 flushSync(); 34631 } 34632 }; 34633 {
34634 const content = ($$anchor, $$arg0) => { 34635 let floatingProps = () => $$arg0?.().props; 34636 let wrapperProps = () => $$arg0?.().wrapperProps; 34637 var fragment_1 = root$23(); 34638 var node = first_child(fragment_1); 34639 var consequent = ($$anchor) => { 34640 Scroll_lock($$anchor, { get preventScroll() { 34641 return get$2(resolvedPreventScroll); 34642 } }); 34643 }; 34644 var consequent_1 = ($$anchor) => { 34645 Scroll_lock($$anchor, { get preventScroll() { 34646 return get$2(resolvedPreventScroll); 34647 } }); 34648 }; 34649 if_block(node, ($$render) => { 34650 if ($$props.forceMount && enabled()) $$render(consequent); 34651 else if (!$$props.forceMount) $$render(consequent_1, 1); 34652 }); 34653 var node_1 = sibling(node, 2); 34654 { 34655 const focusScope = ($$anchor, $$arg0) => { 34656 let focusScopeProps = () => $$arg0?.().props; 34657 Escape_layer($$anchor, { 34658 get onEscapeKeydown() { 34659 return onEscapeKeydown(); 34660 }, 34661 get escapeKeydownBehavior() { 34662 return escapeKeydownBehavior(); 34663 }, 34664 get enabled() { 34665 return enabled(); 34666 }, 34667 get ref() { 34668 return ref(); 34669 }, 34670 children: ($$anchor, $$slotProps) => { 34671 { 34672 const children = ($$anchor, $$arg0) => { 34673 let dismissibleProps = () => $$arg0?.().props; 34674 Text_selection_layer($$anchor, { 34675 get id() { 34676 return id(); 34677 }, 34678 get preventOverflowTextSelection() { 34679 return preventOverflowTextSelection(); 34680 }, 34681 get onPointerDown() { 34682 return onPointerDown(); 34683 }, 34684 get onPointerUp() { 34685 return onPointerUp(); 34686 }, 34687 get enabled() { 34688 return enabled(); 34689 }, 34690 get ref() { 34691 return ref(); 34692 }, 34693 children: ($$anchor, $$slotProps) => { 34694 var fragment_7 = comment(); 34695 var node_2 = first_child(fragment_7); 34696 { 34697 let $0 = /* @__PURE__ */ user_derived(() => ({ 34698 props: mergeProps(restProps, floatingProps(), dismissibleProps(), focusScopeProps(), { style: { pointerEvents: contentPointerEvents() } }), 34699 wrapperProps: wrapperProps() 34700 })); 34701 snippet(node_2, () => popper() ?? noop$1, () => get$2($0)); 34702 } 34703 append($$anchor, fragment_7); 34704 }, 34705 $$slots: { default: true } 34706 }); 34707 }; 34708 Dismissible_layer($$anchor, { 34709 get id() { 34710 return id(); 34711 }, 34712 get onInteractOutside() { 34713 return onInteractOutside(); 34714 }, 34715 get onFocusOutside() { 34716 return onFocusOutside(); 34717 }, 34718 get interactOutsideBehavior() { 34719 return interactOutsideBehavior(); 34720 }, 34721 get isValidEvent() { 34722 return isValidEvent(); 34723 }, 34724 get enabled() { 34725 return enabled(); 34726 }, 34727 get ref() { 34728 return ref(); 34729 }, 34730 children, 34731 $$slots: { default: true } 34732 }); 34733 } 34734 }, 34735 $$slots: { default: true } 34736 }); 34737 }; 34738 Focus_scope(node_1, { 34739 get onOpenAutoFocus() { 34740 return onOpenAutoFocus(); 34741 }, 34742 get onCloseAutoFocus() { 34743 return onCloseAutoFocus(); 34744 }, 34745 get loop() { 34746 return loop(); 34747 }, 34748 get enabled() { 34749 return enabled(); 34750 }, 34751 get trapFocus() { 34752 return trapFocus(); 34753 }, 34754 get forceMount() { 34755 return $$props.forceMount; 34756 }, 34757 get ref() { 34758 return ref(); 34759 }, 34760 focusScope, 34761 $$slots: { focusScope: true } 34762 }); 34763 } 34764 append($$anchor, fragment_1); 34765 }; 34766 Popper_content($$anchor, { 34767 get isStatic() { 34768 return isStatic(); 34769 }, 34770 get id() { 34771 return id(); 34772 }, 34773 get side() { 34774 return side(); 34775 }, 34776 get sideOffset() { 34777 return sideOffset(); 34778 }, 34779 get align() { 34780 return align(); 34781 }, 34782 get alignOffset() { 34783 return alignOffset(); 34784 }, 34785 get arrowPadding() { 34786 return arrowPadding(); 34787 }, 34788 get avoidCollisions() { 34789 return avoidCollisions(); 34790 }, 34791 get collisionBoundary() { 34792 return collisionBoundary(); 34793 }, 34794 get collisionPadding() { 34795 return collisionPadding(); 34796 }, 34797 get sticky() { 34798 return sticky(); 34799 }, 34800 get hideWhenDetached() { 34801 return hideWhenDetached(); 34802 }, 34803 get updatePositionStrategy() { 34804 return updatePositionStrategy(); 34805 }, 34806 get strategy() { 34807 return get$2(effectiveStrategy); 34808 }, 34809 get dir() { 34810 return dir(); 34811 }, 34812 get wrapperId() { 34813 return wrapperId(); 34814 }, 34815 get style() { 34816 return style(); 34817 }, 34818 get onPlaced() { 34819 return onPlaced(); 34820 }, 34821 get customAnchor() { 34822 return customAnchor(); 34823 }, 34824 get enabled() { 34825 return enabled(); 34826 }, 34827 get tooltip() { 34828 return tooltip(); 34829 }, 34830 content, 34831 $$slots: { content: true } 34832 }); 34833 } 34834 return pop($$exports); 34835 }
34836 create_custom_element(Popper_layer_inner, { 34837 popper: {}, 34838 onEscapeKeydown: {}, 34839 escapeKeydownBehavior: {}, 34840 preventOverflowTextSelection: {}, 34841 id: {}, 34842 onPointerDown: {}, 34843 onPointerUp: {}, 34844 side: {}, 34845 sideOffset: {}, 34846 align: {}, 34847 alignOffset: {}, 34848 arrowPadding: {}, 34849 avoidCollisions: {}, 34850 collisionBoundary: {}, 34851 collisionPadding: {}, 34852 sticky: {}, 34853 hideWhenDetached: {}, 34854 updatePositionStrategy: {}, 34855 strategy: {}, 34856 dir: {}, 34857 preventScroll: {}, 34858 wrapperId: {}, 34859 style: {}, 34860 onPlaced: {}, 34861 onInteractOutside: {}, 34862 onCloseAutoFocus: {}, 34863 onOpenAutoFocus: {}, 34864 onFocusOutside: {}, 34865 interactOutsideBehavior: {}, 34866 loop: {}, 34867 trapFocus: {}, 34868 isValidEvent: {}, 34869 customAnchor: {}, 34870 isStatic: {}, 34871 enabled: {}, 34872 ref: {}, 34873 tooltip: {}, 34874 contentPointerEvents: {} 34875 }, [], [], { mode: "open" }); 34876 //#endregion 34877 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer.svelte 34878 var rest_excludes$10 = new Set([ 34879 "$$slots", 34880 "$$events", 34881 "$$legacy", 34882 "$$host", 34883 "popper", 34884 "open", 34885 "onEscapeKeydown", 34886 "escapeKeydownBehavior", 34887 "preventOverflowTextSelection", 34888 "id", 34889 "onPointerDown", 34890 "onPointerUp", 34891 "side", 34892 "sideOffset", 34893 "align", 34894 "alignOffset", 34895 "arrowPadding", 34896 "avoidCollisions", 34897 "collisionBoundary", 34898 "collisionPadding", 34899 "sticky", 34900 "hideWhenDetached", 34901 "updatePositionStrategy", 34902 "strategy", 34903 "dir", 34904 "preventScroll", 34905 "wrapperId", 34906 "style", 34907 "onPlaced", 34908 "onInteractOutside", 34909 "onCloseAutoFocus", 34910 "onOpenAutoFocus", 34911 "onFocusOutside", 34912 "interactOutsideBehavior", 34913 "loop", 34914 "trapFocus", 34915 "isValidEvent", 34916 "customAnchor", 34917 "isStatic", 34918 "ref", 34919 "shouldRender" 34920 ]); 34921 function Popper_layer($$anchor, $$props) { 34922 push($$props, true); 34923 let popper = prop($$props, "popper", 7), open = prop($$props, "open", 7), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7), escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7), preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7), id = prop($$props, "id", 7), onPointerDown = prop($$props, "onPointerDown", 7), onPointerUp = prop($$props, "onPointerUp", 7), side = prop($$props, "side", 7), sideOffset = prop($$props, "sideOffset", 7), align = prop($$props, "align", 7), alignOffset = prop($$props, "alignOffset", 7), arrowPadding = prop($$props, "arrowPadding", 7), avoidCollisions = prop($$props, "avoidCollisions", 7), collisionBoundary = prop($$props, "collisionBoundary", 7), collisionPadding = prop($$props, "collisionPadding", 7), sticky = prop($$props, "sticky", 7), hideWhenDetached = prop($$props, "hideWhenDetached", 7), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7), strategy = prop($$props, "strategy", 7), dir = prop($$props, "dir", 7), preventScroll = prop($$props, "preventScroll", 7), wrapperId = prop($$props, "wrapperId", 7), style = prop($$props, "style", 7), onPlaced = prop($$props, "onPlaced", 7), onInteractOutside = prop($$props, "onInteractOutside", 7), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), onFocusOutside = prop($$props, "onFocusOutside", 7), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), loop = prop($$props, "loop", 7), trapFocus = prop($$props, "trapFocus", 7, true), isValidEvent = prop($$props, "isValidEvent", 7, () => false), customAnchor = prop($$props, "customAnchor", 7, null), isStatic = prop($$props, "isStatic", 7, false), ref = prop($$props, "ref", 7), shouldRender = prop($$props, "shouldRender", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$10); 34924 var $$exports = { 34925 get popper() { 34926 return popper(); 34927 }, 34928 set popper($$value) { 34929 popper($$value); 34930 flushSync(); 34931 }, 34932 get open() { 34933 return open(); 34934 }, 34935 set open($$value) { 34936 open($$value); 34937 flushSync(); 34938 }, 34939 get onEscapeKeydown() { 34940 return onEscapeKeydown(); 34941 }, 34942 set onEscapeKeydown($$value) {
34943 onEscapeKeydown($$value); 34944 flushSync(); 34945 }, 34946 get escapeKeydownBehavior() { 34947 return escapeKeydownBehavior(); 34948 }, 34949 set escapeKeydownBehavior($$value) { 34950 escapeKeydownBehavior($$value); 34951 flushSync(); 34952 }, 34953 get preventOverflowTextSelection() { 34954 return preventOverflowTextSelection(); 34955 }, 34956 set preventOverflowTextSelection($$value) { 34957 preventOverflowTextSelection($$value); 34958 flushSync(); 34959 }, 34960 get id() { 34961 return id(); 34962 }, 34963 set id($$value) { 34964 id($$value); 34965 flushSync(); 34966 }, 34967 get onPointerDown() { 34968 return onPointerDown(); 34969 }, 34970 set onPointerDown($$value) { 34971 onPointerDown($$value); 34972 flushSync(); 34973 }, 34974 get onPointerUp() { 34975 return onPointerUp(); 34976 }, 34977 set onPointerUp($$value) { 34978 onPointerUp($$value); 34979 flushSync(); 34980 }, 34981 get side() { 34982 return side(); 34983 }, 34984 set side($$value) { 34985 side($$value); 34986 flushSync(); 34987 }, 34988 get sideOffset() { 34989 return sideOffset(); 34990 }, 34991 set sideOffset($$value) { 34992 sideOffset($$value); 34993 flushSync(); 34994 }, 34995 get align() { 34996 return align(); 34997 }, 34998 set align($$value) { 34999 align($$value); 35000 flushSync(); 35001 }, 35002 get alignOffset() { 35003 return alignOffset(); 35004 }, 35005 set alignOffset($$value) { 35006 alignOffset($$value); 35007 flushSync(); 35008 }, 35009 get arrowPadding() { 35010 return arrowPadding(); 35011 }, 35012 set arrowPadding($$value) { 35013 arrowPadding($$value); 35014 flushSync(); 35015 }, 35016 get avoidCollisions() { 35017 return avoidCollisions(); 35018 }, 35019 set avoidCollisions($$value) { 35020 avoidCollisions($$value); 35021 flushSync(); 35022 }, 35023 get collisionBoundary() { 35024 return collisionBoundary(); 35025 }, 35026 set collisionBoundary($$value) { 35027 collisionBoundary($$value); 35028 flushSync(); 35029 }, 35030 get collisionPadding() { 35031 return collisionPadding(); 35032 }, 35033 set collisionPadding($$value) { 35034 collisionPadding($$value); 35035 flushSync(); 35036 }, 35037 get sticky() { 35038 return sticky(); 35039 }, 35040 set sticky($$value) { 35041 sticky($$value); 35042 flushSync(); 35043 }, 35044 get hideWhenDetached() { 35045 return hideWhenDetached(); 35046 }, 35047 set hideWhenDetached($$value) { 35048 hideWhenDetached($$value); 35049 flushSync(); 35050 }, 35051 get updatePositionStrategy() { 35052 return updatePositionStrategy(); 35053 }, 35054 set updatePositionStrategy($$value) { 35055 updatePositionStrategy($$value); 35056 flushSync(); 35057 }, 35058 get strategy() { 35059 return strategy(); 35060 }, 35061 set strategy($$value) { 35062 strategy($$value); 35063 flushSync(); 35064 }, 35065 get dir() { 35066 return dir(); 35067 }, 35068 set dir($$value) { 35069 dir($$value); 35070 flushSync(); 35071 }, 35072 get preventScroll() { 35073 return preventScroll(); 35074 }, 35075 set preventScroll($$value) { 35076 preventScroll($$value); 35077 flushSync(); 35078 }, 35079 get wrapperId() { 35080 return wrapperId(); 35081 }, 35082 set wrapperId($$value) { 35083 wrapperId($$value); 35084 flushSync(); 35085 }, 35086 get style() { 35087 return style(); 35088 }, 35089 set style($$value) { 35090 style($$value); 35091 flushSync(); 35092 }, 35093 get onPlaced() { 35094 return onPlaced(); 35095 }, 35096 set onPlaced($$value) { 35097 onPlaced($$value); 35098 flushSync(); 35099 }, 35100 get onInteractOutside() { 35101 return onInteractOutside(); 35102 }, 35103 set onInteractOutside($$value) { 35104 onInteractOutside($$value); 35105 flushSync(); 35106 }, 35107 get onCloseAutoFocus() { 35108 return onCloseAutoFocus(); 35109 }, 35110 set onCloseAutoFocus($$value) { 35111 onCloseAutoFocus($$value); 35112 flushSync(); 35113 }, 35114 get onOpenAutoFocus() { 35115 return onOpenAutoFocus(); 35116 }, 35117 set onOpenAutoFocus($$value) { 35118 onOpenAutoFocus($$value); 35119 flushSync(); 35120 }, 35121 get onFocusOutside() { 35122 return onFocusOutside(); 35123 }, 35124 set onFocusOutside($$value) { 35125 onFocusOutside($$value); 35126 flushSync(); 35127 }, 35128 get interactOutsideBehavior() { 35129 return interactOutsideBehavior(); 35130 }, 35131 set interactOutsideBehavior($$value = "close") { 35132 interactOutsideBehavior($$value); 35133 flushSync(); 35134 }, 35135 get loop() { 35136 return loop(); 35137 }, 35138 set loop($$value) { 35139 loop($$value); 35140 flushSync(); 35141 }, 35142 get trapFocus() { 35143 return trapFocus(); 35144 }, 35145 set trapFocus($$value = true) { 35146 trapFocus($$value); 35147 flushSync(); 35148 }, 35149 get isValidEvent() { 35150 return isValidEvent(); 35151 }, 35152 set isValidEvent($$value = () => false) { 35153 isValidEvent($$value); 35154 flushSync(); 35155 }, 35156 get customAnchor() { 35157 return customAnchor(); 35158 }, 35159 set customAnchor($$value = null) { 35160 customAnchor($$value); 35161 flushSync(); 35162 }, 35163 get isStatic() { 35164 return isStatic(); 35165 }, 35166 set isStatic($$value = false) { 35167 isStatic($$value); 35168 flushSync(); 35169 }, 35170 get ref() { 35171 return ref(); 35172 }, 35173 set ref($$value) { 35174 ref($$value); 35175 flushSync(); 35176 }, 35177 get shouldRender() { 35178 return shouldRender(); 35179 }, 35180 set shouldRender($$value) { 35181 shouldRender($$value); 35182 flushSync(); 35183 } 35184 }; 35185 var fragment = comment(); 35186 var node = first_child(fragment); 35187 var consequent = ($$anchor) => { 35188 Popper_layer_inner($$anchor, spread_props({ 35189 get popper() { 35190 return popper(); 35191 },
35192 get onEscapeKeydown() { 35193 return onEscapeKeydown(); 35194 }, 35195 get escapeKeydownBehavior() { 35196 return escapeKeydownBehavior(); 35197 }, 35198 get preventOverflowTextSelection() { 35199 return preventOverflowTextSelection(); 35200 }, 35201 get id() { 35202 return id(); 35203 }, 35204 get onPointerDown() { 35205 return onPointerDown(); 35206 }, 35207 get onPointerUp() { 35208 return onPointerUp(); 35209 }, 35210 get side() { 35211 return side(); 35212 }, 35213 get sideOffset() { 35214 return sideOffset(); 35215 }, 35216 get align() { 35217 return align(); 35218 }, 35219 get alignOffset() { 35220 return alignOffset(); 35221 }, 35222 get arrowPadding() { 35223 return arrowPadding(); 35224 }, 35225 get avoidCollisions() { 35226 return avoidCollisions(); 35227 }, 35228 get collisionBoundary() { 35229 return collisionBoundary(); 35230 }, 35231 get collisionPadding() { 35232 return collisionPadding(); 35233 }, 35234 get sticky() { 35235 return sticky(); 35236 }, 35237 get hideWhenDetached() { 35238 return hideWhenDetached(); 35239 }, 35240 get updatePositionStrategy() { 35241 return updatePositionStrategy(); 35242 }, 35243 get strategy() { 35244 return strategy(); 35245 }, 35246 get dir() { 35247 return dir(); 35248 }, 35249 get preventScroll() { 35250 return preventScroll(); 35251 }, 35252 get wrapperId() { 35253 return wrapperId(); 35254 }, 35255 get style() { 35256 return style(); 35257 }, 35258 get onPlaced() { 35259 return onPlaced(); 35260 }, 35261 get customAnchor() { 35262 return customAnchor(); 35263 }, 35264 get isStatic() { 35265 return isStatic(); 35266 }, 35267 get enabled() { 35268 return open(); 35269 }, 35270 get onInteractOutside() { 35271 return onInteractOutside(); 35272 }, 35273 get onCloseAutoFocus() { 35274 return onCloseAutoFocus(); 35275 }, 35276 get onOpenAutoFocus() { 35277 return onOpenAutoFocus(); 35278 }, 35279 get interactOutsideBehavior() { 35280 return interactOutsideBehavior(); 35281 }, 35282 get loop() { 35283 return loop(); 35284 }, 35285 get trapFocus() { 35286 return trapFocus(); 35287 }, 35288 get isValidEvent() { 35289 return isValidEvent(); 35290 }, 35291 get onFocusOutside() { 35292 return onFocusOutside(); 35293 }, 35294 forceMount: false, 35295 get ref() { 35296 return ref(); 35297 } 35298 }, () => restProps)); 35299 }; 35300 if_block(node, ($$render) => { 35301 if (shouldRender()) $$render(consequent); 35302 }); 35303 append($$anchor, fragment); 35304 return pop($$exports); 35305 } 35306 create_custom_element(Popper_layer, { 35307 popper: {}, 35308 open: {}, 35309 onEscapeKeydown: {}, 35310 escapeKeydownBehavior: {}, 35311 preventOverflowTextSelection: {}, 35312 id: {}, 35313 onPointerDown: {}, 35314 onPointerUp: {}, 35315 side: {}, 35316 sideOffset: {}, 35317 align: {}, 35318 alignOffset: {}, 35319 arrowPadding: {}, 35320 avoidCollisions: {}, 35321 collisionBoundary: {}, 35322 collisionPadding: {}, 35323 sticky: {}, 35324 hideWhenDetached: {}, 35325 updatePositionStrategy: {}, 35326 strategy: {}, 35327 dir: {}, 35328 preventScroll: {}, 35329 wrapperId: {}, 35330 style: {}, 35331 onPlaced: {}, 35332 onInteractOutside: {}, 35333 onCloseAutoFocus: {}, 35334 onOpenAutoFocus: {}, 35335 onFocusOutside: {}, 35336 interactOutsideBehavior: {}, 35337 loop: {}, 35338 trapFocus: {}, 35339 isValidEvent: {}, 35340 customAnchor: {}, 35341 isStatic: {}, 35342 ref: {}, 35343 shouldRender: {} 35344 }, [], [], { mode: "open" }); 35345 //#endregion 35346 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-force-mount.svelte 35347 var rest_excludes$9 = new Set([ 35348 "$$slots", 35349 "$$events", 35350 "$$legacy", 35351 "$$host", 35352 "popper", 35353 "onEscapeKeydown", 35354 "escapeKeydownBehavior", 35355 "preventOverflowTextSelection", 35356 "id", 35357 "onPointerDown", 35358 "onPointerUp", 35359 "side", 35360 "sideOffset", 35361 "align", 35362 "alignOffset", 35363 "arrowPadding", 35364 "avoidCollisions", 35365 "collisionBoundary", 35366 "collisionPadding", 35367 "sticky", 35368 "hideWhenDetached", 35369 "updatePositionStrategy", 35370 "strategy", 35371 "dir", 35372 "preventScroll", 35373 "wrapperId", 35374 "style", 35375 "onPlaced", 35376 "onInteractOutside", 35377 "onCloseAutoFocus", 35378 "onOpenAutoFocus", 35379 "onFocusOutside", 35380 "interactOutsideBehavior", 35381 "loop", 35382 "trapFocus", 35383 "isValidEvent", 35384 "customAnchor", 35385 "isStatic", 35386 "enabled" 35387 ]); 35388 function Popper_layer_force_mount($$anchor, $$props) { 35389 push($$props, true);
35390 let popper = prop($$props, "popper", 7), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7), escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7), preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7), id = prop($$props, "id", 7), onPointerDown = prop($$props, "onPointerDown", 7), onPointerUp = prop($$props, "onPointerUp", 7), side = prop($$props, "side", 7), sideOffset = prop($$props, "sideOffset", 7), align = prop($$props, "align", 7), alignOffset = prop($$props, "alignOffset", 7), arrowPadding = prop($$props, "arrowPadding", 7), avoidCollisions = prop($$props, "avoidCollisions", 7), collisionBoundary = prop($$props, "collisionBoundary", 7), collisionPadding = prop($$props, "collisionPadding", 7), sticky = prop($$props, "sticky", 7), hideWhenDetached = prop($$props, "hideWhenDetached", 7), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7), strategy = prop($$props, "strategy", 7), dir = prop($$props, "dir", 7), preventScroll = prop($$props, "preventScroll", 7), wrapperId = prop($$props, "wrapperId", 7), style = prop($$props, "style", 7), onPlaced = prop($$props, "onPlaced", 7), onInteractOutside = prop($$props, "onInteractOutside", 7), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), onFocusOutside = prop($$props, "onFocusOutside", 7), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), loop = prop($$props, "loop", 7), trapFocus = prop($$props, "trapFocus", 7, true), isValidEvent = prop($$props, "isValidEvent", 7, () => false), customAnchor = prop($$props, "customAnchor", 7, null), isStatic = prop($$props, "isStatic", 7, false), enabled = prop($$props, "enabled", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$9); 35391 var $$exports = { 35392 get popper() { 35393 return popper(); 35394 }, 35395 set popper($$value) { 35396 popper($$value); 35397 flushSync(); 35398 }, 35399 get onEscapeKeydown() { 35400 return onEscapeKeydown(); 35401 }, 35402 set onEscapeKeydown($$value) { 35403 onEscapeKeydown($$value); 35404 flushSync(); 35405 }, 35406 get escapeKeydownBehavior() { 35407 return escapeKeydownBehavior(); 35408 }, 35409 set escapeKeydownBehavior($$value) { 35410 escapeKeydownBehavior($$value); 35411 flushSync(); 35412 }, 35413 get preventOverflowTextSelection() { 35414 return preventOverflowTextSelection(); 35415 }, 35416 set preventOverflowTextSelection($$value) { 35417 preventOverflowTextSelection($$value); 35418 flushSync(); 35419 }, 35420 get id() { 35421 return id(); 35422 }, 35423 set id($$value) { 35424 id($$value); 35425 flushSync(); 35426 }, 35427 get onPointerDown() { 35428 return onPointerDown(); 35429 }, 35430 set onPointerDown($$value) { 35431 onPointerDown($$value); 35432 flushSync(); 35433 }, 35434 get onPointerUp() { 35435 return onPointerUp(); 35436 }, 35437 set onPointerUp($$value) { 35438 onPointerUp($$value); 35439 flushSync(); 35440 }, 35441 get side() { 35442 return side(); 35443 }, 35444 set side($$value) { 35445 side($$value); 35446 flushSync(); 35447 }, 35448 get sideOffset() { 35449 return sideOffset(); 35450 }, 35451 set sideOffset($$value) { 35452 sideOffset($$value); 35453 flushSync(); 35454 }, 35455 get align() { 35456 return align(); 35457 }, 35458 set align($$value) { 35459 align($$value); 35460 flushSync(); 35461 }, 35462 get alignOffset() { 35463 return alignOffset(); 35464 }, 35465 set alignOffset($$value) { 35466 alignOffset($$value); 35467 flushSync(); 35468 }, 35469 get arrowPadding() { 35470 return arrowPadding(); 35471 }, 35472 set arrowPadding($$value) { 35473 arrowPadding($$value); 35474 flushSync(); 35475 }, 35476 get avoidCollisions() { 35477 return avoidCollisions(); 35478 }, 35479 set avoidCollisions($$value) { 35480 avoidCollisions($$value); 35481 flushSync(); 35482 }, 35483 get collisionBoundary() { 35484 return collisionBoundary(); 35485 }, 35486 set collisionBoundary($$value) { 35487 collisionBoundary($$value); 35488 flushSync(); 35489 }, 35490 get collisionPadding() { 35491 return collisionPadding(); 35492 }, 35493 set collisionPadding($$value) { 35494 collisionPadding($$value); 35495 flushSync(); 35496 }, 35497 get sticky() { 35498 return sticky(); 35499 }, 35500 set sticky($$value) { 35501 sticky($$value); 35502 flushSync(); 35503 }, 35504 get hideWhenDetached() { 35505 return hideWhenDetached(); 35506 }, 35507 set hideWhenDetached($$value) { 35508 hideWhenDetached($$value); 35509 flushSync(); 35510 }, 35511 get updatePositionStrategy() { 35512 return updatePositionStrategy(); 35513 }, 35514 set updatePositionStrategy($$value) { 35515 updatePositionStrategy($$value); 35516 flushSync(); 35517 }, 35518 get strategy() { 35519 return strategy(); 35520 }, 35521 set strategy($$value) { 35522 strategy($$value); 35523 flushSync(); 35524 }, 35525 get dir() { 35526 return dir(); 35527 }, 35528 set dir($$value) { 35529 dir($$value); 35530 flushSync(); 35531 }, 35532 get preventScroll() { 35533 return preventScroll(); 35534 }, 35535 set preventScroll($$value) { 35536 preventScroll($$value); 35537 flushSync(); 35538 }, 35539 get wrapperId() { 35540 return wrapperId(); 35541 }, 35542 set wrapperId($$value) { 35543 wrapperId($$value); 35544 flushSync(); 35545 }, 35546 get style() { 35547 return style(); 35548 }, 35549 set style($$value) { 35550 style($$value); 35551 flushSync(); 35552 }, 35553 get onPlaced() { 35554 return onPlaced(); 35555 }, 35556 set onPlaced($$value) { 35557 onPlaced($$value); 35558 flushSync(); 35559 }, 35560 get onInteractOutside() { 35561 return onInteractOutside(); 35562 }, 35563 set onInteractOutside($$value) { 35564 onInteractOutside($$value); 35565 flushSync(); 35566 }, 35567 get onCloseAutoFocus() { 35568 return onCloseAutoFocus(); 35569 }, 35570 set onCloseAutoFocus($$value) { 35571 onCloseAutoFocus($$value); 35572 flushSync(); 35573 }, 35574 get onOpenAutoFocus() { 35575 return onOpenAutoFocus(); 35576 }, 35577 set onOpenAutoFocus($$value) { 35578 onOpenAutoFocus($$value); 35579 flushSync(); 35580 }, 35581 get onFocusOutside() { 35582 return onFocusOutside(); 35583 }, 35584 set onFocusOutside($$value) { 35585 onFocusOutside($$value); 35586 flushSync(); 35587 }, 35588 get interactOutsideBehavior() { 35589 return interactOutsideBehavior(); 35590 }, 35591 set interactOutsideBehavior($$value = "close") { 35592 interactOutsideBehavior($$value); 35593 flushSync(); 35594 }, 35595 get loop() { 35596 return loop(); 35597 }, 35598 set loop($$value) { 35599 loop($$value); 35600 flushSync(); 35601 }, 35602 get trapFocus() { 35603 return trapFocus(); 35604 }, 35605 set trapFocus($$value = true) { 35606 trapFocus($$value); 35607 flushSync(); 35608 }, 35609 get isValidEvent() { 35610 return isValidEvent(); 35611 }, 35612 set isValidEvent($$value = () => false) { 35613 isValidEvent($$value); 35614 flushSync(); 35615 }, 35616 get customAnchor() { 35617 return customAnchor(); 35618 }, 35619 set customAnchor($$value = null) { 35620 customAnchor($$value); 35621 flushSync(); 35622 }, 35623 get isStatic() { 35624 return isStatic(); 35625 }, 35626 set isStatic($$value = false) { 35627 isStatic($$value); 35628 flushSync(); 35629 }, 35630 get enabled() { 35631 return enabled(); 35632 }, 35633 set enabled($$value) { 35634 enabled($$value); 35635 flushSync(); 35636 } 35637 }; 35638 Popper_layer_inner($$anchor, spread_props({ 35639 get popper() { 35640 return popper(); 35641 },
35642 get onEscapeKeydown() { 35643 return onEscapeKeydown(); 35644 }, 35645 get escapeKeydownBehavior() { 35646 return escapeKeydownBehavior(); 35647 }, 35648 get preventOverflowTextSelection() { 35649 return preventOverflowTextSelection(); 35650 }, 35651 get id() { 35652 return id(); 35653 }, 35654 get onPointerDown() { 35655 return onPointerDown(); 35656 }, 35657 get onPointerUp() { 35658 return onPointerUp(); 35659 }, 35660 get side() { 35661 return side(); 35662 }, 35663 get sideOffset() { 35664 return sideOffset(); 35665 }, 35666 get align() { 35667 return align(); 35668 }, 35669 get alignOffset() { 35670 return alignOffset(); 35671 }, 35672 get arrowPadding() { 35673 return arrowPadding(); 35674 }, 35675 get avoidCollisions() { 35676 return avoidCollisions(); 35677 }, 35678 get collisionBoundary() { 35679 return collisionBoundary(); 35680 }, 35681 get collisionPadding() { 35682 return collisionPadding(); 35683 }, 35684 get sticky() { 35685 return sticky(); 35686 }, 35687 get hideWhenDetached() { 35688 return hideWhenDetached(); 35689 }, 35690 get updatePositionStrategy() { 35691 return updatePositionStrategy(); 35692 }, 35693 get strategy() { 35694 return strategy(); 35695 }, 35696 get dir() { 35697 return dir(); 35698 }, 35699 get preventScroll() { 35700 return preventScroll(); 35701 }, 35702 get wrapperId() { 35703 return wrapperId(); 35704 }, 35705 get style() { 35706 return style(); 35707 }, 35708 get onPlaced() { 35709 return onPlaced(); 35710 }, 35711 get customAnchor() { 35712 return customAnchor(); 35713 }, 35714 get isStatic() { 35715 return isStatic(); 35716 }, 35717 get enabled() { 35718 return enabled(); 35719 }, 35720 get onInteractOutside() { 35721 return onInteractOutside(); 35722 }, 35723 get onCloseAutoFocus() { 35724 return onCloseAutoFocus(); 35725 }, 35726 get onOpenAutoFocus() { 35727 return onOpenAutoFocus(); 35728 }, 35729 get interactOutsideBehavior() { 35730 return interactOutsideBehavior(); 35731 }, 35732 get loop() { 35733 return loop(); 35734 }, 35735 get trapFocus() { 35736 return trapFocus(); 35737 }, 35738 get isValidEvent() { 35739 return isValidEvent(); 35740 }, 35741 get onFocusOutside() { 35742 return onFocusOutside(); 35743 } 35744 }, () => restProps, { forceMount: true })); 35745 return pop($$exports); 35746 } 35747 create_custom_element(Popper_layer_force_mount, { 35748 popper: {}, 35749 onEscapeKeydown: {}, 35750 escapeKeydownBehavior: {}, 35751 preventOverflowTextSelection: {}, 35752 id: {}, 35753 onPointerDown: {}, 35754 onPointerUp: {}, 35755 side: {}, 35756 sideOffset: {}, 35757 align: {}, 35758 alignOffset: {}, 35759 arrowPadding: {}, 35760 avoidCollisions: {}, 35761 collisionBoundary: {}, 35762 collisionPadding: {}, 35763 sticky: {}, 35764 hideWhenDetached: {}, 35765 updatePositionStrategy: {}, 35766 strategy: {}, 35767 dir: {}, 35768 preventScroll: {}, 35769 wrapperId: {}, 35770 style: {}, 35771 onPlaced: {}, 35772 onInteractOutside: {}, 35773 onCloseAutoFocus: {}, 35774 onOpenAutoFocus: {}, 35775 onFocusOutside: {}, 35776 interactOutsideBehavior: {}, 35777 loop: {}, 35778 trapFocus: {}, 35779 isValidEvent: {}, 35780 customAnchor: {}, 35781 isStatic: {}, 35782 enabled: {} 35783 }, [], [], { mode: "open" }); 35784 //#endregion 35785 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-field/date-field.svelte.js 35786 var dateFieldAttrs = createBitsAttrs({ 35787 component: "date-field", 35788 parts: [ 35789 "input", 35790 "label", 35791 "segment" 35792 ] 35793 }); 35794 var SEGMENT_CONFIGS = { 35795 day: { 35796 min: 1, 35797 max: (root) => { 35798 const segmentMonthValue = root.segmentValues.month; 35799 const placeholder = root.value.current ?? root.placeholder.current; 35800 return segmentMonthValue ? getDaysInMonth(placeholder.set({ month: Number.parseInt(segmentMonthValue) })) : getDaysInMonth(placeholder); 35801 }, 35802 cycle: 1, 35803 padZero: true 35804 }, 35805 month: { 35806 min: 1, 35807 max: 12, 35808 cycle: 1, 35809 padZero: true, 35810 getAnnouncement: (month, root) => { 35811 if (!root.placeholder.current) return ""; 35812 return `${month} - ${root.formatter.fullMonth(toDate(root.placeholder.current.set({ month })))}`; 35813 } 35814 }, 35815 year: { 35816 min: 1, 35817 max: 9999, 35818 cycle: 1, 35819 padZero: false 35820 }, 35821 hour: { 35822 min: (root) => root.hourCycle.current === 12 ? 1 : 0, 35823 max: (root) => { 35824 if (root.hourCycle.current === 24) return 23; 35825 if (root.hourCycle.current === 12) return 12; 35826 return getDefaultHourCycle(root.locale.current) === 12 ? 12 : 23; 35827 }, 35828 cycle: 1, 35829 canBeZero: true, 35830 padZero: true 35831 }, 35832 minute: { 35833 min: 0, 35834 max: 59, 35835 cycle: 1, 35836 canBeZero: true, 35837 padZero: true 35838 }, 35839 second: { 35840 min: 0, 35841 max: 59, 35842 cycle: 1, 35843 canBeZero: true, 35844 padZero: true 35845 } 35846 }; 35847 var DateFieldRootContext = new Context("DateField.Root"); 35848 var DateFieldRootState = class DateFieldRootState { 35849 static create(opts, rangeRoot) {
35850 return DateFieldRootContext.set(new DateFieldRootState(opts, rangeRoot)); 35851 } 35852 value; 35853 placeholder; 35854 validate; 35855 minValue; 35856 maxValue; 35857 disabled; 35858 readonly; 35859 granularity; 35860 readonlySegments; 35861 hourCycle; 35862 locale; 35863 hideTimeZone; 35864 required; 35865 onInvalid; 35866 errorMessageId; 35867 isInvalidProp; 35868 descriptionId = useId(); 35869 formatter; 35870 initialSegments; 35871 #segmentValues = /* @__PURE__ */ state(); 35872 get segmentValues() { 35873 return get$2(this.#segmentValues); 35874 } 35875 set segmentValues(value) { 35876 set(this.#segmentValues, value, true); 35877 } 35878 announcer; 35879 #readonlySegmentsSet = /* @__PURE__ */ user_derived(() => new Set(this.readonlySegments.current)); 35880 get readonlySegmentsSet() { 35881 return get$2(this.#readonlySegmentsSet); 35882 } 35883 set readonlySegmentsSet(value) { 35884 set(this.#readonlySegmentsSet, value); 35885 } 35886 segmentStates = initSegmentStates(); 35887 #fieldNode = /* @__PURE__ */ state(null); 35888 #labelNode = /* @__PURE__ */ state(null); 35889 #descriptionNode = /* @__PURE__ */ state(null); 35890 get descriptionNode() { 35891 return get$2(this.#descriptionNode); 35892 } 35893 set descriptionNode(value) { 35894 set(this.#descriptionNode, value, true); 35895 } 35896 #validationNode = /* @__PURE__ */ state(null); 35897 get validationNode() { 35898 return get$2(this.#validationNode); 35899 } 35900 set validationNode(value) { 35901 set(this.#validationNode, value, true); 35902 } 35903 states = initSegmentStates(); 35904 #dayPeriodNode = /* @__PURE__ */ state(null); 35905 get dayPeriodNode() { 35906 return get$2(this.#dayPeriodNode); 35907 } 35908 set dayPeriodNode(value) { 35909 set(this.#dayPeriodNode, value, true); 35910 } 35911 rangeRoot = void 0; 35912 #name = /* @__PURE__ */ state(""); 35913 get name() { 35914 return get$2(this.#name); 35915 } 35916 set name(value) { 35917 set(this.#name, value, true); 35918 } 35919 domContext = new DOMContext(() => null); 35920 constructor(props, rangeRoot) { 35921 this.rangeRoot = rangeRoot; 35922 /** 35923 * Since the `DateFieldRootState` can be used in two contexts, as a standalone 35924 * field or as a field within a `DateRangeField` component, we handle assigning 35925 * the props based on that context. 35926 */ 35927 this.value = props.value; 35928 this.placeholder = rangeRoot ? rangeRoot.opts.placeholder : props.placeholder; 35929 this.validate = rangeRoot ? simpleBox(void 0) : props.validate; 35930 this.minValue = rangeRoot ? rangeRoot.opts.minValue : props.minValue; 35931 this.maxValue = rangeRoot ? rangeRoot.opts.maxValue : props.maxValue; 35932 this.disabled = rangeRoot ? rangeRoot.opts.disabled : props.disabled; 35933 this.readonly = rangeRoot ? rangeRoot.opts.readonly : props.readonly; 35934 this.granularity = rangeRoot ? rangeRoot.opts.granularity : props.granularity; 35935 this.readonlySegments = rangeRoot ? rangeRoot.opts.readonlySegments : props.readonlySegments; 35936 this.hourCycle = rangeRoot ? rangeRoot.opts.hourCycle : props.hourCycle; 35937 this.locale = rangeRoot ? rangeRoot.opts.locale : props.locale; 35938 this.hideTimeZone = rangeRoot ? rangeRoot.opts.hideTimeZone : props.hideTimeZone; 35939 this.required = rangeRoot ? rangeRoot.opts.required : props.required; 35940 this.onInvalid = rangeRoot ? rangeRoot.opts.onInvalid : props.onInvalid; 35941 this.errorMessageId = rangeRoot ? rangeRoot.opts.errorMessageId : props.errorMessageId; 35942 this.isInvalidProp = props.isInvalidProp; 35943 this.formatter = createFormatter({ 35944 initialLocale: this.locale.current, 35945 monthFormat: boxWith(() => "long"), 35946 yearFormat: boxWith(() => "numeric") 35947 }); 35948 this.initialSegments = initializeSegmentValues(this.inferredGranularity); 35949 this.segmentValues = this.initialSegments; 35950 this.announcer = getAnnouncer(null); 35951 this.getFieldNode = this.getFieldNode.bind(this); 35952 this.updateSegment = this.updateSegment.bind(this); 35953 this.handleSegmentClick = this.handleSegmentClick.bind(this); 35954 this.getBaseSegmentAttrs = this.getBaseSegmentAttrs.bind(this); 35955 user_effect(() => { 35956 untrack(() => { 35957 this.initialSegments = initializeSegmentValues(this.inferredGranularity); 35958 }); 35959 }); 35960 onMount(() => { 35961 this.announcer = getAnnouncer(this.domContext.getDocument()); 35962 }); 35963 onDestroyEffect(() => { 35964 if (rangeRoot) return; 35965 removeDescriptionElement(this.descriptionId, this.domContext.getDocument()); 35966 }); 35967 user_effect(() => { 35968 if (rangeRoot) return; 35969 if (this.formatter.getLocale() === this.locale.current) return; 35970 this.formatter.setLocale(this.locale.current); 35971 }); 35972 user_effect(() => { 35973 if (rangeRoot) return; 35974 if (this.value.current) setDescription({ 35975 id: untrack(() => this.descriptionId), 35976 formatter: this.formatter, 35977 value: this.value.current, 35978 doc: this.domContext.getDocument() 35979 }); 35980 const placeholder = untrack(() => this.placeholder.current); 35981 if (this.value.current && placeholder !== this.value.current) untrack(() => { 35982 if (this.value.current) this.placeholder.current = this.value.current; 35983 }); 35984 }); 35985 if (this.value.current) this.syncSegmentValues(this.value.current); 35986 user_effect(() => { 35987 this.locale.current; 35988 if (this.value.current) this.syncSegmentValues(this.value.current); 35989 this.#clearUpdating(); 35990 }); 35991 user_effect(() => { 35992 if (this.value.current === void 0) this.segmentValues = initializeSegmentValues(this.inferredGranularity); 35993 }); 35994 watch(() => this.validationStatus, () => { 35995 if (this.validationStatus !== false) this.onInvalid.current?.(this.validationStatus.reason, this.validationStatus.message); 35996 }); 35997 } 35998 setName(name) { 35999 this.name = name; 36000 } 36001 /** 36002 * Sets the field node for the `DateFieldRootState` instance. We use this method so we can 36003 * keep `#fieldNode` private to prevent accidental usage of the incorrect field node. 36004 */ 36005 setFieldNode(node) { 36006 set(this.#fieldNode, node, true); 36007 } 36008 /** 36009 * Gets the correct field node for the date field regardless of whether it's being 36010 * used in a standalone context or within a `DateRangeField` component. 36011 */ 36012 getFieldNode() { 36013 /** If we're not within a DateRangeField, we return this field. */ 36014 if (!this.rangeRoot) return get$2(this.#fieldNode); 36015 else 36016 /** 36017 * Otherwise, we return the rangeRoot's field node which 36018 * contains both start and end fields. 36019 */ 36020 return this.rangeRoot.fieldNode; 36021 } 36022 /** 36023 * Sets the label node for the `DateFieldRootState` instance. We use this method so we can 36024 * keep `#labelNode` private to prevent accidental usage of the incorrect label node. 36025 */ 36026 setLabelNode(node) { 36027 set(this.#labelNode, node, true); 36028 } 36029 /** 36030 * Gets the correct label node for the date field regardless of whether it's being used in 36031 * a standalone context or within a `DateRangeField` component. 36032 */ 36033 getLabelNode() { 36034 /** If we're not within a DateRangeField, we return this field. */ 36035 if (!this.rangeRoot) return get$2(this.#labelNode); 36036 /** Otherwise we return the rangeRoot's label node. */ 36037 return this.rangeRoot.labelNode; 36038 } 36039 #clearUpdating() { 36040 this.states.day.updating = null; 36041 this.states.month.updating = null; 36042 this.states.year.updating = null; 36043 this.states.hour.updating = null; 36044 this.states.minute.updating = null; 36045 this.states.dayPeriod.updating = null; 36046 } 36047 setValue(value) { 36048 this.value.current = value; 36049 } 36050 syncSegmentValues(value) { 36051 const dateValues = DATE_SEGMENT_PARTS.map((part) => { 36052 const partValue = value[part]; 36053 if (part === "month") { 36054 if (this.states.month.updating) return [part, this.states.month.updating]; 36055 if (partValue < 10) return [part, `0${partValue}`]; 36056 } 36057 if (part === "day") { 36058 if (this.states.day.updating) return [part, this.states.day.updating]; 36059 if (partValue < 10) return [part, `0${partValue}`]; 36060 } 36061 if (part === "year") { 36062 if (this.states.year.updating) return [part, this.states.year.updating]; 36063 const diff = 4 - `${partValue}`.length; 36064 if (diff > 0) return [part, `${"0".repeat(diff)}${partValue}`]; 36065 } 36066 return [part, `${partValue}`]; 36067 }); 36068 if ("hour" in value) { 36069 const timeValues = EDITABLE_TIME_SEGMENT_PARTS.map((part) => { 36070 if (part === "dayPeriod") if (this.states.dayPeriod.updating) return [part, this.states.dayPeriod.updating]; 36071 else return [part, this.formatter.dayPeriod(toDate(value))]; 36072 else if (part === "hour") { 36073 if (this.states.hour.updating) return [part, this.states.hour.updating]; 36074 if (value[part] !== void 0 && value[part] < 10) return [part, `0${value[part]}`]; 36075 if (value[part] === 0) { 36076 /** 36077 * If we're rendering a `dayPeriod` segment, we're operating in a 36078 * 12-hour clock, so we never allow the displayed hour to be 0. 36079 */ 36080 if (this.dayPeriodNode) return [part, "12"]; 36081 } 36082 } else if (part === "minute") { 36083 if (this.states.minute.updating) return [part, this.states.minute.updating]; 36084 if (value[part] !== void 0 && value[part] < 10) return [part, `0${value[part]}`]; 36085 } else if (part === "second") { 36086 if (this.states.second.updating) return [part, this.states.second.updating]; 36087 if (value[part] !== void 0 && value[part] < 10) return [part, `0${value[part]}`]; 36088 } 36089 return [part, `${value[part]}`]; 36090 }); 36091 const mergedSegmentValues = [...dateValues, ...timeValues]; 36092 this.segmentValues = Object.fromEntries(mergedSegmentValues); 36093 this.#clearUpdating(); 36094 return; 36095 }
36096 this.segmentValues = Object.fromEntries(dateValues); 36097 } 36098 #validationStatus = /* @__PURE__ */ user_derived(() => { 36099 const value = this.value.current; 36100 if (!value) return false; 36101 const msg = this.validate.current?.(value); 36102 if (msg) return { 36103 reason: "custom", 36104 message: msg 36105 }; 36106 const minValue = this.minValue.current; 36107 if (minValue && isBefore(value, minValue)) return { reason: "min" }; 36108 const maxValue = this.maxValue.current; 36109 if (maxValue && isBefore(maxValue, value)) return { reason: "max" }; 36110 return false; 36111 }); 36112 get validationStatus() { 36113 return get$2(this.#validationStatus); 36114 } 36115 set validationStatus(value) { 36116 set(this.#validationStatus, value); 36117 } 36118 #isInvalid = /* @__PURE__ */ user_derived(() => { 36119 if (this.validationStatus === false) return false; 36120 if (this.isInvalidProp.current) return true; 36121 return true; 36122 }); 36123 get isInvalid() { 36124 return get$2(this.#isInvalid); 36125 } 36126 set isInvalid(value) { 36127 set(this.#isInvalid, value); 36128 } 36129 #inferredGranularity = /* @__PURE__ */ user_derived(() => { 36130 const granularity = this.granularity.current; 36131 if (granularity) return granularity; 36132 return inferGranularity(this.placeholder.current, this.granularity.current); 36133 }); 36134 get inferredGranularity() { 36135 return get$2(this.#inferredGranularity); 36136 } 36137 set inferredGranularity(value) { 36138 set(this.#inferredGranularity, value); 36139 } 36140 #dateRef = /* @__PURE__ */ user_derived(() => this.value.current !== void 0 ? this.value.current : this.placeholder.current); 36141 get dateRef() { 36142 return get$2(this.#dateRef); 36143 } 36144 set dateRef(value) { 36145 set(this.#dateRef, value); 36146 } 36147 #allSegmentContent = /* @__PURE__ */ user_derived(() => { 36148 return createContent({ 36149 segmentValues: this.segmentValues, 36150 formatter: this.formatter, 36151 locale: this.locale.current, 36152 granularity: this.inferredGranularity, 36153 dateRef: this.dateRef, 36154 hideTimeZone: this.hideTimeZone.current, 36155 hourCycle: this.hourCycle.current 36156 }); 36157 }); 36158 get allSegmentContent() { 36159 return get$2(this.#allSegmentContent); 36160 } 36161 set allSegmentContent(value) { 36162 set(this.#allSegmentContent, value); 36163 } 36164 #segmentContents = /* @__PURE__ */ user_derived(() => this.allSegmentContent.arr); 36165 get segmentContents() { 36166 return get$2(this.#segmentContents); 36167 } 36168 set segmentContents(value) { 36169 set(this.#segmentContents, value); 36170 } 36171 sharedSegmentAttrs = { 36172 role: "spinbutton", 36173 contenteditable: "true", 36174 tabindex: 0, 36175 spellcheck: false, 36176 inputmode: "numeric", 36177 autocorrect: "off", 36178 enterkeyhint: "next", 36179 style: { caretColor: "transparent" }, 36180 onbeforeinput: (e) => { 36181 if (!e.data || e.data.length <= 1) e.preventDefault(); 36182 } 36183 }; 36184 #getLabelledBy(segmentId) { 36185 return `${segmentId} ${this.getLabelNode()?.id ?? ""}`; 36186 } 36187 updateSegment(part, cb) { 36188 const disabled = this.disabled.current; 36189 const readonly = this.readonly.current; 36190 const readonlySegmentsSet = this.readonlySegmentsSet; 36191 if (disabled || readonly || readonlySegmentsSet.has(part)) return; 36192 const prev = this.segmentValues; 36193 let newSegmentValues = prev; 36194 const dateRef = this.placeholder.current; 36195 if (isDateAndTimeSegmentObj(prev)) { 36196 const pVal = prev[part]; 36197 const castCb = cb; 36198 if (part === "month") { 36199 const next = castCb(pVal); 36200 this.states.month.updating = next; 36201 if (next !== null && prev.day !== null) { 36202 const daysInMonth = getDaysInMonth(toDate(dateRef.set({ month: Number.parseInt(next) }))); 36203 if (Number.parseInt(prev.day) > daysInMonth) prev.day = `${daysInMonth}`; 36204 } 36205 newSegmentValues = { 36206 ...prev, 36207 [part]: next 36208 }; 36209 } else if (part === "dayPeriod") { 36210 const next = castCb(pVal); 36211 this.states.dayPeriod.updating = next; 36212 const date = this.value.current; 36213 if (date && "hour" in date) { 36214 const trueHour = date.hour; 36215 if (next === "AM") { 36216 if (trueHour >= 12) prev.hour = `${trueHour - 12}`; 36217 } else if (next === "PM") { 36218 if (trueHour < 12) prev.hour = `${trueHour + 12}`; 36219 } 36220 } 36221 newSegmentValues = { 36222 ...prev, 36223 [part]: next 36224 }; 36225 } else if (part === "hour") { 36226 const next = castCb(pVal); 36227 this.states.hour.updating = next; 36228 if (next !== null && prev.dayPeriod !== null) { 36229 const dayPeriod = this.formatter.dayPeriod(toDate(dateRef.set({ hour: Number.parseInt(next) })), this.hourCycle.current); 36230 if (dayPeriod === "AM" || dayPeriod === "PM") prev.dayPeriod = dayPeriod; 36231 } 36232 newSegmentValues = { 36233 ...prev, 36234 [part]: next 36235 }; 36236 } else if (part === "minute") { 36237 const next = castCb(pVal); 36238 this.states.minute.updating = next; 36239 newSegmentValues = { 36240 ...prev, 36241 [part]: next 36242 }; 36243 } else if (part === "second") { 36244 const next = castCb(pVal); 36245 this.states.second.updating = next; 36246 newSegmentValues = { 36247 ...prev, 36248 [part]: next 36249 }; 36250 } else if (part === "year") { 36251 const next = castCb(pVal); 36252 this.states.year.updating = next; 36253 newSegmentValues = { 36254 ...prev, 36255 [part]: next 36256 }; 36257 } else if (part === "day") { 36258 const next = castCb(pVal); 36259 this.states.day.updating = next; 36260 newSegmentValues = { 36261 ...prev, 36262 [part]: next 36263 }; 36264 } else { 36265 const next = castCb(pVal); 36266 newSegmentValues = { 36267 ...prev, 36268 [part]: next 36269 }; 36270 } 36271 } else if (isDateSegmentPart(part)) { 36272 const pVal = prev[part]; 36273 const castCb = cb; 36274 const next = castCb(pVal); 36275 if (part === "month" && next !== null && prev.day !== null) { 36276 this.states.month.updating = next; 36277 const daysInMonth = getDaysInMonth(toDate(dateRef.set({ month: Number.parseInt(next) }))); 36278 if (Number.parseInt(prev.day) > daysInMonth) prev.day = `${daysInMonth}`; 36279 newSegmentValues = { 36280 ...prev, 36281 [part]: next 36282 }; 36283 } else if (part === "year") { 36284 const next = castCb(pVal); 36285 this.states.year.updating = next; 36286 newSegmentValues = { 36287 ...prev, 36288 [part]: next 36289 }; 36290 } else if (part === "day") { 36291 const next = castCb(pVal); 36292 this.states.day.updating = next; 36293 newSegmentValues = { 36294 ...prev, 36295 [part]: next 36296 }; 36297 } else newSegmentValues = { 36298 ...prev, 36299 [part]: next 36300 }; 36301 } 36302 this.segmentValues = newSegmentValues; 36303 if (areAllSegmentsFilled(newSegmentValues, get$2(this.#fieldNode))) this.setValue(getValueFromSegments({ 36304 segmentObj: newSegmentValues, 36305 fieldNode: get$2(this.#fieldNode), 36306 dateRef: this.placeholder.current 36307 })); 36308 else { 36309 this.setValue(void 0); 36310 this.segmentValues = newSegmentValues; 36311 } 36312 } 36313 handleSegmentClick(e) { 36314 if (this.disabled.current) e.preventDefault(); 36315 } 36316 getBaseSegmentAttrs(part, segmentId) { 36317 const inReadonlySegments = this.readonlySegmentsSet.has(part); 36318 const defaultAttrs = { 36319 "aria-invalid": boolToStrTrueOrUndef(this.isInvalid), 36320 "aria-disabled": boolToStr(this.disabled.current), 36321 "aria-readonly": boolToStr(this.readonly.current || inReadonlySegments), 36322 "data-invalid": boolToEmptyStrOrUndef(this.isInvalid), 36323 "data-disabled": boolToEmptyStrOrUndef(this.disabled.current), 36324 "data-readonly": boolToEmptyStrOrUndef(this.readonly.current || inReadonlySegments), 36325 "data-segment": `${part}`, 36326 [dateFieldAttrs.segment]: "" 36327 }; 36328 if (part === "literal") return defaultAttrs; 36329 const descriptionId = this.descriptionNode?.id; 36330 const hasDescription = isFirstSegment(segmentId, get$2(this.#fieldNode)) && descriptionId; 36331 const errorMsgId = this.errorMessageId?.current; 36332 const describedBy = hasDescription ? `${descriptionId} ${this.isInvalid && errorMsgId ? errorMsgId : ""}` : void 0; 36333 const contenteditable = !(this.readonly.current || inReadonlySegments || this.disabled.current); 36334 return { 36335 ...defaultAttrs, 36336 "aria-labelledby": this.#getLabelledBy(segmentId), 36337 contenteditable: contenteditable ? "true" : void 0, 36338 "aria-describedby": describedBy, 36339 tabindex: this.disabled.current ? void 0 : 0 36340 }; 36341 } 36342 }; 36343 var DateFieldInputState = class DateFieldInputState { 36344 static create(opts) { 36345 return new DateFieldInputState(opts, DateFieldRootContext.get()); 36346 } 36347 opts; 36348 root; 36349 domContext; 36350 attachment; 36351 constructor(opts, root) { 36352 this.opts = opts; 36353 this.root = root; 36354 this.domContext = new DOMContext(opts.ref); 36355 this.root.domContext = this.domContext; 36356 this.attachment = attachRef(opts.ref, (v) => this.root.setFieldNode(v)); 36357 watch(() => this.opts.name.current, (v) => { 36358 this.root.setName(v); 36359 }); 36360 } 36361 #ariaDescribedBy = /* @__PURE__ */ user_derived(() => { 36362 if (!isBrowser) return void 0; 36363 if (!this.domContext.getElementById(this.root.descriptionId)) return void 0; 36364 return this.root.descriptionId; 36365 }); 36366 #props = /* @__PURE__ */ user_derived(() => ({ 36367 id: this.opts.id.current, 36368 role: "group", 36369 "aria-labelledby": this.root.getLabelNode()?.id ?? void 0, 36370 "aria-describedby": get$2(this.#ariaDescribedBy), 36371 "aria-disabled": boolToStr(this.root.disabled.current), 36372 "data-invalid": this.root.isInvalid ? "" : void 0, 36373 "data-disabled": boolToEmptyStrOrUndef(this.root.disabled.current), 36374 [dateFieldAttrs.input]: "", 36375 ...this.attachment 36376 })); 36377 get props() { 36378 return get$2(this.#props); 36379 } 36380 set props(value) { 36381 set(this.#props, value); 36382 } 36383 }; 36384 var DateFieldHiddenInputState = class DateFieldHiddenInputState { 36385 static create() { 36386 return new DateFieldHiddenInputState(DateFieldRootContext.get()); 36387 } 36388 root; 36389 #shouldRender = /* @__PURE__ */ user_derived(() => this.root.name !== ""); 36390 get shouldRender() { 36391 return get$2(this.#shouldRender); 36392 } 36393 set shouldRender(value) { 36394 set(this.#shouldRender, value); 36395 } 36396 #isoValue = /* @__PURE__ */ user_derived(() => this.root.value.current ? this.root.value.current.toString() : ""); 36397 get isoValue() { 36398 return get$2(this.#isoValue); 36399 } 36400 set isoValue(value) { 36401 set(this.#isoValue, value); 36402 } 36403 constructor(root) { 36404 this.root = root; 36405 } 36406 #props = /* @__PURE__ */ user_derived(() => { 36407 return { 36408 name: this.root.name, 36409 value: this.isoValue, 36410 required: this.root.required.current 36411 }; 36412 }); 36413 get props() { 36414 return get$2(this.#props); 36415 } 36416 set props(value) { 36417 set(this.#props, value); 36418 } 36419 }; 36420 var DateFieldLabelState = class DateFieldLabelState { 36421 static create(opts) { 36422 return new DateFieldLabelState(opts, DateFieldRootContext.get()); 36423 } 36424 opts; 36425 root; 36426 attachment; 36427 constructor(opts, root) { 36428 this.opts = opts; 36429 this.root = root; 36430 this.onclick = this.onclick.bind(this); 36431 this.attachment = attachRef(opts.ref, (v) => this.root.setLabelNode(v)); 36432 } 36433 onclick(_) { 36434 if (this.root.disabled.current) return; 36435 const firstSegment = getFirstSegment(this.root.getFieldNode()); 36436 if (!firstSegment) return; 36437 firstSegment.focus(); 36438 } 36439 #props = /* @__PURE__ */ user_derived(() => ({ 36440 id: this.opts.id.current, 36441 "data-invalid": boolToEmptyStrOrUndef(this.root.isInvalid), 36442 "data-disabled": boolToEmptyStrOrUndef(this.root.disabled.current), 36443 [dateFieldAttrs.label]: "", 36444 onclick: this.onclick, 36445 ...this.attachment 36446 })); 36447 get props() { 36448 return get$2(this.#props); 36449 } 36450 set props(value) { 36451 set(this.#props, value); 36452 } 36453 }; 36454 var BaseNumericSegmentState = class { 36455 opts; 36456 root; 36457 announcer; 36458 part; 36459 config; 36460 attachment; 36461 constructor(opts, root, part, config) { 36462 this.opts = opts; 36463 this.root = root; 36464 this.part = part; 36465 this.config = config; 36466 this.announcer = root.announcer; 36467 this.onkeydown = this.onkeydown.bind(this); 36468 this.onfocusout = this.onfocusout.bind(this); 36469 this.attachment = attachRef(opts.ref); 36470 } 36471 #getMax() { 36472 return typeof this.config.max === "function" ? this.config.max(this.root) : this.config.max; 36473 } 36474 #getMin() { 36475 return typeof this.config.min === "function" ? this.config.min(this.root) : this.config.min; 36476 } 36477 #getAnnouncement(value) { 36478 if (this.config.getAnnouncement) return this.config.getAnnouncement(value, this.root); 36479 return value; 36480 } 36481 #formatValue(value, forDisplay = true) { 36482 const str = String(value); 36483 if (forDisplay && this.config.padZero && str.length === 1) return `0${value}`; 36484 return str; 36485 } 36486 onkeydown(e) { 36487 const placeholder = this.root.value.current ?? this.root.placeholder.current; 36488 if (e.ctrlKey || e.metaKey || this.root.disabled.current) return; 36489 if ((this.part === "hour" || this.part === "minute" || this.part === "second") && !(this.part in placeholder)) return; 36490 if (e.key !== "Tab") e.preventDefault();
36491 if (!isAcceptableSegmentKey(e.key)) return; 36492 if (isArrowUp(e.key)) { 36493 this.#handleArrowUp(placeholder); 36494 return; 36495 } 36496 if (isArrowDown(e.key)) { 36497 this.#handleArrowDown(placeholder); 36498 return; 36499 } 36500 if (isNumberString(e.key)) { 36501 this.#handleNumberKey(e); 36502 return; 36503 } 36504 if (isBackspace(e.key)) { 36505 this.#handleBackspace(e); 36506 return; 36507 } 36508 if (isSegmentNavigationKey(e.key)) handleSegmentNavigation(e, this.root.getFieldNode()); 36509 } 36510 #handleArrowUp(placeholder) { 36511 const stateKey = this.part; 36512 if (stateKey in this.root.states) this.root.states[stateKey].hasLeftFocus = false; 36513 this.root.updateSegment(this.part, (prev) => { 36514 if (prev === null) { 36515 const next = placeholder[this.part]; 36516 this.announcer.announce(this.#getAnnouncement(next)); 36517 return this.#formatValue(next); 36518 } 36519 const next = placeholder.set({ [this.part]: Number.parseInt(prev) }).cycle(this.part, this.config.cycle)[this.part]; 36520 this.announcer.announce(this.#getAnnouncement(next)); 36521 return this.#formatValue(next); 36522 }); 36523 } 36524 #handleArrowDown(placeholder) { 36525 const stateKey = this.part; 36526 if (stateKey in this.root.states) this.root.states[stateKey].hasLeftFocus = false; 36527 this.root.updateSegment(this.part, (prev) => { 36528 if (prev === null) { 36529 const next = placeholder[this.part]; 36530 this.announcer.announce(this.#getAnnouncement(next)); 36531 return this.#formatValue(next); 36532 } 36533 const next = placeholder.set({ [this.part]: Number.parseInt(prev) }).cycle(this.part, -this.config.cycle)[this.part]; 36534 this.announcer.announce(this.#getAnnouncement(next)); 36535 return this.#formatValue(next); 36536 }); 36537 } 36538 #handleNumberKey(e) { 36539 const num = Number.parseInt(e.key); 36540 let moveToNext = false; 36541 const max = this.#getMax(); 36542 const maxStart = Math.floor(max / 10); 36543 const numIsZero = num === 0; 36544 const stateKey = this.part; 36545 this.root.updateSegment(this.part, (prev) => { 36546 if (stateKey in this.root.states && this.root.states[stateKey].hasLeftFocus) { 36547 prev = null; 36548 this.root.states[stateKey].hasLeftFocus = false; 36549 } 36550 if (prev === null) { 36551 if (numIsZero) { 36552 if (stateKey in this.root.states) this.root.states[stateKey].lastKeyZero = true; 36553 this.announcer.announce("0"); 36554 return "0"; 36555 } 36556 if (stateKey in this.root.states && (this.root.states[stateKey].lastKeyZero || num > maxStart)) moveToNext = true; 36557 if (stateKey in this.root.states) this.root.states[stateKey].lastKeyZero = false; 36558 if (moveToNext && String(num).length === 1) { 36559 this.announcer.announce(num); 36560 return `0${num}`; 36561 } 36562 return `${num}`; 36563 } 36564 if (stateKey in this.root.states && this.root.states[stateKey].lastKeyZero) { 36565 if (num !== 0) { 36566 moveToNext = true; 36567 this.root.states[stateKey].lastKeyZero = false; 36568 return `0${num}`; 36569 } 36570 if (this.part === "hour" && num === 0 && this.root.hourCycle.current === 24) { 36571 moveToNext = true; 36572 this.root.states[stateKey].lastKeyZero = false; 36573 return `00`; 36574 } 36575 if ((this.part === "minute" || this.part === "second") && num === 0) { 36576 moveToNext = true; 36577 this.root.states[stateKey].lastKeyZero = false; 36578 return "00"; 36579 } 36580 return prev; 36581 } 36582 const total = Number.parseInt(prev + num.toString()); 36583 if (total > max) { 36584 moveToNext = true; 36585 return `0${num}`; 36586 } 36587 moveToNext = true; 36588 return `${total}`; 36589 }); 36590 if (moveToNext) moveToNextSegment(e, this.root.getFieldNode()); 36591 } 36592 #handleBackspace(e) { 36593 const stateKey = this.part; 36594 if (stateKey in this.root.states) this.root.states[stateKey].hasLeftFocus = false; 36595 let moveToPrev = false; 36596 this.root.updateSegment(this.part, (prev) => { 36597 if (prev === null) { 36598 moveToPrev = true; 36599 this.announcer.announce(null); 36600 return null; 36601 } 36602 if (prev.length === 2 && prev.startsWith("0")) { 36603 this.announcer.announce(null); 36604 return null; 36605 } 36606 const str = prev.toString(); 36607 if (str.length === 1) { 36608 this.announcer.announce(null); 36609 return null; 36610 } 36611 const next = Number.parseInt(str.slice(0, -1)); 36612 this.announcer.announce(this.#getAnnouncement(next)); 36613 return `${next}`; 36614 }); 36615 if (moveToPrev) moveToPrevSegment(e, this.root.getFieldNode()); 36616 } 36617 onfocusout(_) { 36618 const stateKey = this.part; 36619 if (stateKey in this.root.states) this.root.states[stateKey].hasLeftFocus = true; 36620 if (this.config.padZero) this.root.updateSegment(this.part, (prev) => { 36621 if (prev && prev.length === 1) return `0${prev}`; 36622 return prev; 36623 }); 36624 } 36625 getSegmentProps() { 36626 const segmentValues = this.root.segmentValues; 36627 const placeholder = this.root.placeholder.current; 36628 const isEmpty = segmentValues[this.part] === null; 36629 let date = placeholder; 36630 if (segmentValues[this.part]) date = placeholder.set({ [this.part]: Number.parseInt(segmentValues[this.part]) }); 36631 const valueNow = date[this.part]; 36632 const valueMin = this.#getMin(); 36633 const valueMax = this.#getMax(); 36634 let valueText = isEmpty ? "Empty" : `${valueNow}`; 36635 if (this.part === "hour" && "dayPeriod" in segmentValues && segmentValues.dayPeriod) valueText = isEmpty ? "Empty" : `${valueNow} ${segmentValues.dayPeriod}`; 36636 return { 36637 "aria-label": `${this.part}, `, 36638 "aria-valuemin": valueMin, 36639 "aria-valuemax": valueMax, 36640 "aria-valuenow": valueNow, 36641 "aria-valuetext": valueText 36642 }; 36643 } 36644 #props = /* @__PURE__ */ user_derived(() => { 36645 return { 36646 ...this.root.sharedSegmentAttrs, 36647 id: this.opts.id.current,
36648 ...this.getSegmentProps(), 36649 onkeydown: this.onkeydown, 36650 onfocusout: this.onfocusout, 36651 onclick: this.root.handleSegmentClick, 36652 ...this.root.getBaseSegmentAttrs(this.part, this.opts.id.current), 36653 ...this.attachment 36654 }; 36655 }); 36656 get props() { 36657 return get$2(this.#props); 36658 } 36659 set props(value) { 36660 set(this.#props, value); 36661 } 36662 }; 36663 var DateFieldYearSegmentState = class extends BaseNumericSegmentState { 36664 #pressedKeys = []; 36665 #backspaceCount = 0; 36666 constructor(opts, root) { 36667 super(opts, root, "year", SEGMENT_CONFIGS.year); 36668 } 36669 onkeydown(e) { 36670 if (e.ctrlKey || e.metaKey || this.root.disabled.current) return; 36671 if (e.key !== "Tab") e.preventDefault(); 36672 if (!isAcceptableSegmentKey(e.key)) return; 36673 if (isArrowUp(e.key)) { 36674 this.#resetBackspaceCount(); 36675 super.onkeydown(e); 36676 return; 36677 } 36678 if (isArrowDown(e.key)) { 36679 this.#resetBackspaceCount(); 36680 super.onkeydown(e); 36681 return; 36682 } 36683 if (isNumberString(e.key)) { 36684 this.#handleYearNumberKey(e); 36685 return; 36686 } 36687 if (isBackspace(e.key)) { 36688 this.#handleYearBackspace(e); 36689 return; 36690 } 36691 if (isSegmentNavigationKey(e.key)) handleSegmentNavigation(e, this.root.getFieldNode()); 36692 } 36693 #resetBackspaceCount() { 36694 this.#backspaceCount = 0; 36695 } 36696 #incrementBackspaceCount() { 36697 this.#backspaceCount++; 36698 } 36699 #handleYearNumberKey(e) { 36700 this.#pressedKeys.push(e.key); 36701 let moveToNext = false; 36702 const num = Number.parseInt(e.key); 36703 this.root.updateSegment("year", (prev) => { 36704 if (this.root.states.year.hasLeftFocus) { 36705 prev = null; 36706 this.root.states.year.hasLeftFocus = false; 36707 } 36708 if (prev === null) { 36709 this.announcer.announce(num); 36710 return `000${num}`; 36711 } 36712 const str = prev.toString() + num.toString(); 36713 const mergedInt = Number.parseInt(str); 36714 if (String(mergedInt).length < 4) { 36715 if (this.#backspaceCount > 0 && this.#pressedKeys.length <= this.#backspaceCount && str.length <= 4) { 36716 this.announcer.announce(mergedInt); 36717 return str; 36718 } 36719 this.announcer.announce(mergedInt); 36720 return prependYearZeros(mergedInt); 36721 } 36722 this.announcer.announce(mergedInt); 36723 moveToNext = true; 36724 const mergedIntStr = `${mergedInt}`; 36725 if (mergedIntStr.length > 4) return mergedIntStr.slice(0, 4); 36726 return mergedIntStr; 36727 }); 36728 if (this.#pressedKeys.length === 4 || this.#pressedKeys.length === this.#backspaceCount) moveToNext = true; 36729 if (moveToNext) moveToNextSegment(e, this.root.getFieldNode()); 36730 } 36731 #handleYearBackspace(e) { 36732 this.#pressedKeys = []; 36733 this.#incrementBackspaceCount(); 36734 let moveToPrev = false; 36735 this.root.updateSegment("year", (prev) => { 36736 this.root.states.year.hasLeftFocus = false; 36737 if (prev === null) { 36738 moveToPrev = true; 36739 this.announcer.announce(null); 36740 return null; 36741 } 36742 const str = prev.toString(); 36743 if (str.length === 1) { 36744 this.announcer.announce(null); 36745 return null; 36746 } 36747 const next = str.slice(0, -1); 36748 this.announcer.announce(next); 36749 return `${next}`; 36750 }); 36751 if (moveToPrev) moveToPrevSegment(e, this.root.getFieldNode()); 36752 } 36753 onfocusout(_) { 36754 this.root.states.year.hasLeftFocus = true; 36755 this.#pressedKeys = []; 36756 this.#resetBackspaceCount(); 36757 this.root.updateSegment("year", (prev) => { 36758 if (prev && prev.length !== 4) return prependYearZeros(Number.parseInt(prev)); 36759 return prev; 36760 }); 36761 } 36762 }; 36763 var DateFieldDaySegmentState = class extends BaseNumericSegmentState { 36764 constructor(opts, root) { 36765 super(opts, root, "day", SEGMENT_CONFIGS.day); 36766 } 36767 }; 36768 var DateFieldMonthSegmentState = class extends BaseNumericSegmentState { 36769 constructor(opts, root) { 36770 super(opts, root, "month", SEGMENT_CONFIGS.month); 36771 } 36772 }; 36773 var DateFieldHourSegmentState = class extends BaseNumericSegmentState { 36774 constructor(opts, root) { 36775 super(opts, root, "hour", SEGMENT_CONFIGS.hour); 36776 } 36777 onkeydown(e) { 36778 if (isNumberString(e.key)) { 36779 const oldUpdateSegment = this.root.updateSegment.bind(this.root); 36780 this.root.updateSegment = (part, cb) => { 36781 const result = oldUpdateSegment(part, cb); 36782 if (part === "hour" && "hour" in this.root.segmentValues) { 36783 if (this.root.segmentValues.hour === "0" && this.root.dayPeriodNode && this.root.hourCycle.current !== 24) this.root.segmentValues.hour = "12"; 36784 } 36785 return result; 36786 }; 36787 } 36788 super.onkeydown(e); 36789 this.root.updateSegment = this.root.updateSegment.bind(this.root); 36790 } 36791 }; 36792 var DateFieldMinuteSegmentState = class extends BaseNumericSegmentState { 36793 constructor(opts, root) { 36794 super(opts, root, "minute", SEGMENT_CONFIGS.minute); 36795 } 36796 }; 36797 var DateFieldSecondSegmentState = class extends BaseNumericSegmentState { 36798 constructor(opts, root) { 36799 super(opts, root, "second", SEGMENT_CONFIGS.second); 36800 } 36801 }; 36802 var DateFieldDayPeriodSegmentState = class DateFieldDayPeriodSegmentState { 36803 static create(opts) {
36804 return new DateFieldDayPeriodSegmentState(opts, DateFieldRootContext.get()); 36805 } 36806 opts; 36807 root; 36808 attachment; 36809 #announcer; 36810 constructor(opts, root) { 36811 this.opts = opts; 36812 this.root = root; 36813 this.#announcer = this.root.announcer; 36814 this.onkeydown = this.onkeydown.bind(this); 36815 this.attachment = attachRef(opts.ref, (v) => this.root.dayPeriodNode = v); 36816 } 36817 onkeydown(e) { 36818 if (e.ctrlKey || e.metaKey || this.root.disabled.current) return; 36819 if (e.key !== "Tab") e.preventDefault(); 36820 if (!isAcceptableDayPeriodKey(e.key)) return; 36821 if (isArrowUp(e.key) || isArrowDown(e.key)) { 36822 this.root.updateSegment("dayPeriod", (prev) => { 36823 if (prev === "AM") { 36824 const next = "PM"; 36825 this.#announcer.announce(next); 36826 return next; 36827 } 36828 const next = "AM"; 36829 this.#announcer.announce(next); 36830 return next; 36831 }); 36832 return; 36833 } 36834 if (isBackspace(e.key)) { 36835 this.root.states.dayPeriod.hasLeftFocus = false; 36836 this.root.updateSegment("dayPeriod", () => { 36837 const next = "AM"; 36838 this.#announcer.announce(next); 36839 return next; 36840 }); 36841 } 36842 if (e.key === "A" || e.key === "P" || "a") this.root.updateSegment("dayPeriod", () => { 36843 const next = e.key === "A" || e.key === "a" ? "AM" : "PM"; 36844 this.#announcer.announce(next); 36845 return next; 36846 }); 36847 if (isSegmentNavigationKey(e.key)) handleSegmentNavigation(e, this.root.getFieldNode()); 36848 } 36849 #props = /* @__PURE__ */ user_derived(() => { 36850 const segmentValues = this.root.segmentValues; 36851 if (!("dayPeriod" in segmentValues)) return; 36852 const valueMin = 0; 36853 const valueMax = 12; 36854 const valueNow = segmentValues.dayPeriod === "AM" ? 0 : 12; 36855 const valueText = segmentValues.dayPeriod ?? "AM"; 36856 return { 36857 ...this.root.sharedSegmentAttrs, 36858 id: this.opts.id.current, 36859 inputmode: "text", 36860 "aria-label": "AM/PM", 36861 "aria-valuemin": valueMin, 36862 "aria-valuemax": valueMax, 36863 "aria-valuenow": valueNow, 36864 "aria-valuetext": valueText, 36865 onkeydown: this.onkeydown, 36866 onclick: this.root.handleSegmentClick, 36867 ...this.root.getBaseSegmentAttrs("dayPeriod", this.opts.id.current), 36868 ...this.attachment 36869 }; 36870 }); 36871 get props() { 36872 return get$2(this.#props); 36873 } 36874 set props(value) { 36875 set(this.#props, value); 36876 } 36877 }; 36878 var DateFieldLiteralSegmentState = class DateFieldLiteralSegmentState { 36879 static create(opts) { 36880 return new DateFieldLiteralSegmentState(opts, DateFieldRootContext.get()); 36881 } 36882 opts; 36883 root; 36884 attachment; 36885 constructor(opts, root) { 36886 this.opts = opts; 36887 this.root = root; 36888 this.attachment = attachRef(opts.ref); 36889 } 36890 #props = /* @__PURE__ */ user_derived(() => ({ 36891 id: this.opts.id.current, 36892 "aria-hidden": boolToStrTrueOrUndef(true), 36893 ...this.root.getBaseSegmentAttrs("literal", this.opts.id.current), 36894 ...this.attachment 36895 })); 36896 get props() { 36897 return get$2(this.#props); 36898 } 36899 set props(value) { 36900 set(this.#props, value); 36901 } 36902 }; 36903 var DateFieldTimeZoneSegmentState = class DateFieldTimeZoneSegmentState { 36904 static create(opts) { 36905 return new DateFieldTimeZoneSegmentState(opts, DateFieldRootContext.get()); 36906 } 36907 opts; 36908 root; 36909 attachment; 36910 constructor(opts, root) { 36911 this.opts = opts; 36912 this.root = root; 36913 this.onkeydown = this.onkeydown.bind(this); 36914 this.attachment = attachRef(opts.ref); 36915 } 36916 onkeydown(e) { 36917 if (e.key !== "Tab") e.preventDefault(); 36918 if (this.root.disabled.current) return; 36919 if (isSegmentNavigationKey(e.key)) handleSegmentNavigation(e, this.root.getFieldNode()); 36920 } 36921 #props = /* @__PURE__ */ user_derived(() => ({ 36922 role: "textbox", 36923 id: this.opts.id.current, 36924 "aria-label": "timezone, ", 36925 style: { caretColor: "transparent" }, 36926 onkeydown: this.onkeydown, 36927 ...this.root.getBaseSegmentAttrs("timeZoneName", this.opts.id.current), 36928 "data-readonly": boolToEmptyStrOrUndef(true), 36929 ...this.attachment 36930 })); 36931 get props() { 36932 return get$2(this.#props); 36933 } 36934 set props(value) { 36935 set(this.#props, value); 36936 } 36937 }; 36938 var DateFieldSegmentState = class { 36939 static create(part, opts) { 36940 const root = DateFieldRootContext.get(); 36941 switch (part) {
36942 case "day": return new DateFieldDaySegmentState(opts, root); 36943 case "month": return new DateFieldMonthSegmentState(opts, root); 36944 case "year": return new DateFieldYearSegmentState(opts, root); 36945 case "hour": return new DateFieldHourSegmentState(opts, root); 36946 case "minute": return new DateFieldMinuteSegmentState(opts, root); 36947 case "second": return new DateFieldSecondSegmentState(opts, root); 36948 case "dayPeriod": return new DateFieldDayPeriodSegmentState(opts, root); 36949 case "literal": return new DateFieldLiteralSegmentState(opts, root); 36950 case "timeZoneName": return new DateFieldTimeZoneSegmentState(opts, root); 36951 } 36952 } 36953 }; 36954 function isAcceptableDayPeriodKey(key) { 36955 return isAcceptableSegmentKey(key) || key === "A" || key === "P" || key === "a" || key === "p"; 36956 } 36957 function isArrowUp(key) { 36958 return key === ARROW_UP; 36959 } 36960 function isArrowDown(key) { 36961 return key === ARROW_DOWN; 36962 } 36963 function isBackspace(key) { 36964 return key === BACKSPACE; 36965 } 36966 function prependYearZeros(year) { 36967 const diff = 4 - String(year).length; 36968 return `${"0".repeat(diff)}${year}`; 36969 } 36970 //#endregion 36971 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-field/components/date-field-hidden-input.svelte 36972 function Date_field_hidden_input($$anchor, $$props) { 36973 push($$props, false); 36974 const hiddenInputState = DateFieldHiddenInputState.create(); 36975 init$1(); 36976 var fragment = comment(); 36977 var node = first_child(fragment); 36978 var consequent = ($$anchor) => { 36979 Hidden_input($$anchor, spread_props(() => hiddenInputState.props)); 36980 }; 36981 if_block(node, ($$render) => { 36982 if (hiddenInputState.shouldRender) $$render(consequent); 36983 }); 36984 append($$anchor, fragment); 36985 pop(); 36986 } 36987 create_custom_element(Date_field_hidden_input, {}, [], [], { mode: "open" }); 36988 //#endregion 36989 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-field/components/date-field-input.svelte 36990 var rest_excludes$8 = new Set([ 36991 "$$slots", 36992 "$$events", 36993 "$$legacy", 36994 "$$host", 36995 "id", 36996 "ref", 36997 "name", 36998 "children", 36999 "child" 37000 ]); 37001 var root$22 = /* @__PURE__ */ from_html(`<div><!></div>`); 37002 var root_1$9 = /* @__PURE__ */ from_html(`<!> <!>`, 1); 37003 function Date_field_input($$anchor, $$props) { 37004 const uid = props_id(); 37005 push($$props, true); 37006 let id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), name = prop($$props, "name", 7, ""), children = prop($$props, "children", 7), child$6 = prop($$props, "child", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$8); 37007 const inputState = DateFieldInputState.create({ 37008 id: boxWith(() => id()), 37009 ref: boxWith(() => ref(), (v) => ref(v)), 37010 name: boxWith(() => name()) 37011 }); 37012 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, inputState.props)); 37013 var $$exports = { 37014 get id() { 37015 return id(); 37016 }, 37017 set id($$value = createId(uid)) { 37018 id($$value); 37019 flushSync(); 37020 }, 37021 get ref() { 37022 return ref(); 37023 }, 37024 set ref($$value = null) { 37025 ref($$value); 37026 flushSync(); 37027 }, 37028 get name() { 37029 return name(); 37030 }, 37031 set name($$value = "") { 37032 name($$value); 37033 flushSync(); 37034 }, 37035 get children() { 37036 return children(); 37037 }, 37038 set children($$value) { 37039 children($$value); 37040 flushSync(); 37041 }, 37042 get child() { 37043 return child$6(); 37044 }, 37045 set child($$value) { 37046 child$6($$value); 37047 flushSync(); 37048 } 37049 }; 37050 var fragment = root_1$9(); 37051 var node = first_child(fragment); 37052 var consequent = ($$anchor) => { 37053 var fragment_1 = comment(); 37054 snippet(first_child(fragment_1), child$6, () => ({ 37055 props: get$2(mergedProps), 37056 segments: inputState.root.segmentContents 37057 })); 37058 append($$anchor, fragment_1); 37059 }; 37060 var alternate = ($$anchor) => { 37061 var div = root$22(); 37062 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 37063 snippet(child(div), () => children() ?? noop$1, () => ({ segments: inputState.root.segmentContents })); 37064 reset(div); 37065 append($$anchor, div); 37066 }; 37067 if_block(node, ($$render) => { 37068 if (child$6()) $$render(consequent); 37069 else $$render(alternate, -1); 37070 }); 37071 Date_field_hidden_input(sibling(node, 2), {}); 37072 append($$anchor, fragment); 37073 return pop($$exports); 37074 }
37075 create_custom_element(Date_field_input, { 37076 id: {}, 37077 ref: {}, 37078 name: {}, 37079 children: {}, 37080 child: {} 37081 }, [], [], { mode: "open" }); 37082 //#endregion 37083 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-field/components/date-field-label.svelte 37084 var rest_excludes$7 = new Set([ 37085 "$$slots", 37086 "$$events", 37087 "$$legacy", 37088 "$$host", 37089 "id", 37090 "ref", 37091 "children", 37092 "child" 37093 ]); 37094 var root$21 = /* @__PURE__ */ from_html(`<div><!></div>`); 37095 function Date_field_label($$anchor, $$props) { 37096 const uid = props_id(); 37097 push($$props, true); 37098 let id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), children = prop($$props, "children", 7), child$5 = prop($$props, "child", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$7); 37099 const labelState = DateFieldLabelState.create({ 37100 id: boxWith(() => id()), 37101 ref: boxWith(() => ref(), (v) => ref(v)) 37102 }); 37103 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, labelState.props)); 37104 var $$exports = { 37105 get id() { 37106 return id(); 37107 }, 37108 set id($$value = createId(uid)) { 37109 id($$value); 37110 flushSync(); 37111 }, 37112 get ref() { 37113 return ref(); 37114 }, 37115 set ref($$value = null) { 37116 ref($$value); 37117 flushSync(); 37118 }, 37119 get children() { 37120 return children(); 37121 }, 37122 set children($$value) { 37123 children($$value); 37124 flushSync(); 37125 }, 37126 get child() { 37127 return child$5(); 37128 }, 37129 set child($$value) { 37130 child$5($$value); 37131 flushSync(); 37132 } 37133 }; 37134 var fragment = comment(); 37135 var node = first_child(fragment); 37136 var consequent = ($$anchor) => { 37137 var fragment_1 = comment(); 37138 snippet(first_child(fragment_1), child$5, () => ({ props: get$2(mergedProps) })); 37139 append($$anchor, fragment_1); 37140 }; 37141 var alternate = ($$anchor) => { 37142 var div = root$21(); 37143 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 37144 snippet(child(div), () => children() ?? noop$1); 37145 reset(div); 37146 append($$anchor, div); 37147 }; 37148 if_block(node, ($$render) => { 37149 if (child$5()) $$render(consequent); 37150 else $$render(alternate, -1); 37151 }); 37152 append($$anchor, fragment); 37153 return pop($$exports); 37154 } 37155 create_custom_element(Date_field_label, { 37156 id: {}, 37157 ref: {}, 37158 children: {}, 37159 child: {} 37160 }, [], [], { mode: "open" }); 37161 //#endregion 37162 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-field/components/date-field-segment.svelte 37163 var rest_excludes$6 = new Set([ 37164 "$$slots", 37165 "$$events", 37166 "$$legacy", 37167 "$$host", 37168 "id", 37169 "ref", 37170 "children", 37171 "child", 37172 "part" 37173 ]); 37174 var root$20 = /* @__PURE__ */ from_html(`<span><!></span>`); 37175 function Date_field_segment($$anchor, $$props) { 37176 const uid = props_id(); 37177 push($$props, true); 37178 let id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), children = prop($$props, "children", 7), child$4 = prop($$props, "child", 7), part = prop($$props, "part", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$6); 37179 const segmentState = DateFieldSegmentState.create(part(), { 37180 id: boxWith(() => id()), 37181 ref: boxWith(() => ref(), (v) => ref(v)) 37182 }); 37183 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, segmentState.props)); 37184 var $$exports = { 37185 get id() { 37186 return id(); 37187 }, 37188 set id($$value = createId(uid)) { 37189 id($$value); 37190 flushSync(); 37191 }, 37192 get ref() { 37193 return ref(); 37194 }, 37195 set ref($$value = null) { 37196 ref($$value); 37197 flushSync(); 37198 }, 37199 get children() { 37200 return children(); 37201 }, 37202 set children($$value) { 37203 children($$value); 37204 flushSync(); 37205 }, 37206 get child() { 37207 return child$4(); 37208 }, 37209 set child($$value) { 37210 child$4($$value); 37211 flushSync(); 37212 }, 37213 get part() { 37214 return part(); 37215 }, 37216 set part($$value) { 37217 part($$value); 37218 flushSync(); 37219 } 37220 }; 37221 var fragment = comment(); 37222 var node = first_child(fragment); 37223 var consequent = ($$anchor) => { 37224 var fragment_1 = comment(); 37225 snippet(first_child(fragment_1), child$4, () => ({ props: get$2(mergedProps) })); 37226 append($$anchor, fragment_1); 37227 }; 37228 var alternate = ($$anchor) => { 37229 var span = root$20(); 37230 attribute_effect(span, () => ({ ...get$2(mergedProps) })); 37231 snippet(child(span), () => children() ?? noop$1); 37232 reset(span); 37233 append($$anchor, span); 37234 }; 37235 if_block(node, ($$render) => { 37236 if (child$4()) $$render(consequent); 37237 else $$render(alternate, -1); 37238 }); 37239 append($$anchor, fragment); 37240 return pop($$exports); 37241 }
37242 create_custom_element(Date_field_segment, { 37243 id: {}, 37244 ref: {}, 37245 children: {}, 37246 child: {}, 37247 part: {} 37248 }, [], [], { mode: "open" }); 37249 //#endregion 37250 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-picker/date-picker.svelte.js 37251 var DatePickerRootContext = new Context("DatePicker.Root"); 37252 var DatePickerRootState = class DatePickerRootState { 37253 static create(opts) { 37254 return DatePickerRootContext.set(new DatePickerRootState(opts)); 37255 } 37256 opts; 37257 constructor(opts) { 37258 this.opts = opts; 37259 } 37260 }; 37261 //#endregion 37262 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/internal/safe-polygon.svelte.js 37263 function isPointInPolygon(point, polygon) { 37264 const [x, y] = point; 37265 let isInside = false; 37266 const length = polygon.length; 37267 for (let i = 0, j = length - 1; i < length; j = i++) { 37268 const [xi, yi] = polygon[i] ?? [0, 0]; 37269 const [xj, yj] = polygon[j] ?? [0, 0]; 37270 if (yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi) isInside = !isInside; 37271 } 37272 return isInside; 37273 } 37274 function isInsideRect(point, rect) { 37275 return point[0] >= rect.left && point[0] <= rect.right && point[1] >= rect.top && point[1] <= rect.bottom; 37276 } 37277 function getSide(triggerRect, contentRect) { 37278 const triggerCenterX = triggerRect.left + triggerRect.width / 2; 37279 const triggerCenterY = triggerRect.top + triggerRect.height / 2; 37280 const contentCenterX = contentRect.left + contentRect.width / 2; 37281 const contentCenterY = contentRect.top + contentRect.height / 2; 37282 const deltaX = contentCenterX - triggerCenterX; 37283 const deltaY = contentCenterY - triggerCenterY; 37284 if (Math.abs(deltaX) > Math.abs(deltaY)) return deltaX > 0 ? "right" : "left"; 37285 return deltaY > 0 ? "bottom" : "top"; 37286 } 37287 /** 37288 * Creates a safe polygon area that allows users to move their cursor between 37289 * the trigger and floating content without closing it. 37290 */ 37291 var SafePolygon = class { 37292 #opts; 37293 #buffer; 37294 #transitIntentTimeout; 37295 #exitPoint = null; 37296 #exitTarget = null; 37297 #transitTargets = []; 37298 #trackedTriggerNode = null; 37299 #leaveFallbackRafId = null; 37300 #transitIntentTimeoutId = null; 37301 #cancelLeaveFallback() { 37302 if (this.#leaveFallbackRafId !== null) { 37303 cancelAnimationFrame(this.#leaveFallbackRafId); 37304 this.#leaveFallbackRafId = null; 37305 } 37306 } 37307 #scheduleLeaveFallback() { 37308 this.#cancelLeaveFallback(); 37309 this.#leaveFallbackRafId = requestAnimationFrame(() => { 37310 this.#leaveFallbackRafId = null; 37311 if (!this.#exitPoint || !this.#exitTarget) return; 37312 this.#clearTracking(); 37313 this.#opts.onPointerExit(); 37314 }); 37315 } 37316 #cancelTransitIntentTimeout() { 37317 if (this.#transitIntentTimeoutId !== null) { 37318 clearTimeout(this.#transitIntentTimeoutId); 37319 this.#transitIntentTimeoutId = null; 37320 } 37321 } 37322 #scheduleTransitIntentTimeout() { 37323 if (this.#transitIntentTimeout === null) return; 37324 this.#cancelTransitIntentTimeout(); 37325 this.#transitIntentTimeoutId = window.setTimeout(() => { 37326 this.#transitIntentTimeoutId = null; 37327 if (!this.#exitPoint || !this.#exitTarget) return; 37328 this.#clearTracking(); 37329 this.#opts.onPointerExit(); 37330 }, this.#transitIntentTimeout); 37331 } 37332 constructor(opts) { 37333 this.#opts = opts; 37334 this.#buffer = opts.buffer ?? 1; 37335 const transitIntentTimeout = opts.transitIntentTimeout; 37336 this.#transitIntentTimeout = typeof transitIntentTimeout === "number" && transitIntentTimeout > 0 ? transitIntentTimeout : null; 37337 watch([ 37338 opts.triggerNode, 37339 opts.contentNode, 37340 opts.enabled 37341 ], ([triggerNode, contentNode, enabled]) => { 37342 if (!triggerNode || !contentNode || !enabled) { 37343 this.#trackedTriggerNode = null; 37344 this.#clearTracking(); 37345 return; 37346 } 37347 if (this.#trackedTriggerNode && this.#trackedTriggerNode !== triggerNode) this.#clearTracking(); 37348 this.#trackedTriggerNode = triggerNode; 37349 const doc = getDocument(triggerNode); 37350 const handlePointerMove = (e) => { 37351 this.#onPointerMove([e.clientX, e.clientY], triggerNode, contentNode); 37352 }; 37353 const handleTriggerLeave = (e) => { 37354 const target = e.relatedTarget; 37355 if (isElement$1(target) && contentNode.contains(target)) return; 37356 const ignoredTargets = this.#opts.ignoredTargets?.() ?? []; 37357 if (isElement$1(target) && ignoredTargets.some((n) => n === target || n.contains(target))) return; 37358 this.#transitTargets = isElement$1(target) && ignoredTargets.length > 0 ? ignoredTargets.filter((n) => target.contains(n)) : []; 37359 this.#exitPoint = [e.clientX, e.clientY]; 37360 this.#exitTarget = "content"; 37361 this.#scheduleLeaveFallback(); 37362 }; 37363 const handleTriggerEnter = () => { 37364 this.#clearTracking(); 37365 }; 37366 const handleContentEnter = () => { 37367 this.#clearTracking(); 37368 }; 37369 const handleContentLeave = (e) => { 37370 const target = e.relatedTarget; 37371 if (isElement$1(target) && triggerNode.contains(target)) return; 37372 this.#exitPoint = [e.clientX, e.clientY]; 37373 this.#exitTarget = "trigger"; 37374 this.#scheduleLeaveFallback(); 37375 }; 37376 return [ 37377 on(doc, "pointermove", handlePointerMove), 37378 on(triggerNode, "pointerleave", handleTriggerLeave), 37379 on(triggerNode, "pointerenter", handleTriggerEnter), 37380 on(contentNode, "pointerenter", handleContentEnter), 37381 on(contentNode, "pointerleave", handleContentLeave) 37382 ].reduce((acc, cleanup) => () => { 37383 acc(); 37384 cleanup(); 37385 }, () => {}); 37386 }); 37387 } 37388 #onPointerMove(clientPoint, triggerNode, contentNode) { 37389 if (!this.#exitPoint || !this.#exitTarget) return; 37390 this.#cancelLeaveFallback(); 37391 this.#scheduleTransitIntentTimeout(); 37392 const triggerRect = triggerNode.getBoundingClientRect(); 37393 const contentRect = contentNode.getBoundingClientRect(); 37394 if (this.#exitTarget === "content" && isInsideRect(clientPoint, contentRect)) { 37395 this.#clearTracking(); 37396 return; 37397 } 37398 if (this.#exitTarget === "trigger" && isInsideRect(clientPoint, triggerRect)) { 37399 this.#clearTracking(); 37400 return; 37401 } 37402 if (this.#exitTarget === "content" && this.#transitTargets.length > 0) for (const transitTarget of this.#transitTargets) { 37403 const transitRect = transitTarget.getBoundingClientRect(); 37404 if (isInsideRect(clientPoint, transitRect)) return; 37405 const transitSide = getSide(triggerRect, transitRect); 37406 const transitCorridor = this.#getCorridorPolygon(triggerRect, transitRect, transitSide); 37407 if (transitCorridor && isPointInPolygon(clientPoint, transitCorridor)) return; 37408 } 37409 const side = getSide(triggerRect, contentRect); 37410 const corridorPoly = this.#getCorridorPolygon(triggerRect, contentRect, side); 37411 if (corridorPoly && isPointInPolygon(clientPoint, corridorPoly)) return; 37412 const targetRect = this.#exitTarget === "content" ? contentRect : triggerRect; 37413 if (isPointInPolygon(clientPoint, this.#getSafePolygon(this.#exitPoint, targetRect, side, this.#exitTarget))) return; 37414 this.#clearTracking(); 37415 this.#opts.onPointerExit(); 37416 } 37417 #clearTracking() { 37418 this.#exitPoint = null; 37419 this.#exitTarget = null; 37420 this.#transitTargets = []; 37421 this.#cancelLeaveFallback(); 37422 this.#cancelTransitIntentTimeout(); 37423 } 37424 /**
37425 * Creates a rectangular corridor between trigger and content 37426 * This prevents closing when cursor is in the gap between them 37427 */ 37428 #getCorridorPolygon(triggerRect, contentRect, side) { 37429 const buffer = this.#buffer; 37430 switch (side) { 37431 case "top": return [ 37432 [Math.min(triggerRect.left, contentRect.left) - buffer, triggerRect.top], 37433 [Math.min(triggerRect.left, contentRect.left) - buffer, contentRect.bottom], 37434 [Math.max(triggerRect.right, contentRect.right) + buffer, contentRect.bottom], 37435 [Math.max(triggerRect.right, contentRect.right) + buffer, triggerRect.top] 37436 ]; 37437 case "bottom": return [ 37438 [Math.min(triggerRect.left, contentRect.left) - buffer, triggerRect.bottom], 37439 [Math.min(triggerRect.left, contentRect.left) - buffer, contentRect.top], 37440 [Math.max(triggerRect.right, contentRect.right) + buffer, contentRect.top], 37441 [Math.max(triggerRect.right, contentRect.right) + buffer, triggerRect.bottom] 37442 ]; 37443 case "left": return [ 37444 [triggerRect.left, Math.min(triggerRect.top, contentRect.top) - buffer], 37445 [contentRect.right, Math.min(triggerRect.top, contentRect.top) - buffer], 37446 [contentRect.right, Math.max(triggerRect.bottom, contentRect.bottom) + buffer], 37447 [triggerRect.left, Math.max(triggerRect.bottom, contentRect.bottom) + buffer] 37448 ]; 37449 case "right": return [ 37450 [triggerRect.right, Math.min(triggerRect.top, contentRect.top) - buffer], 37451 [contentRect.left, Math.min(triggerRect.top, contentRect.top) - buffer], 37452 [contentRect.left, Math.max(triggerRect.bottom, contentRect.bottom) + buffer], 37453 [triggerRect.right, Math.max(triggerRect.bottom, contentRect.bottom) + buffer] 37454 ]; 37455 } 37456 } 37457 /** 37458 * Creates a triangular/trapezoidal safe zone from the exit point to the target 37459 */ 37460 #getSafePolygon(exitPoint, targetRect, side, exitTarget) { 37461 const buffer = this.#buffer * 4; 37462 const [x, y] = exitPoint; 37463 switch (exitTarget === "trigger" ? this.#flipSide(side) : side) { 37464 case "top": return [ 37465 [x - buffer, y + buffer], 37466 [x + buffer, y + buffer], 37467 [targetRect.right + buffer, targetRect.bottom], 37468 [targetRect.right + buffer, targetRect.top], 37469 [targetRect.left - buffer, targetRect.top], 37470 [targetRect.left - buffer, targetRect.bottom] 37471 ]; 37472 case "bottom": return [ 37473 [x - buffer, y - buffer], 37474 [x + buffer, y - buffer], 37475 [targetRect.right + buffer, targetRect.top], 37476 [targetRect.right + buffer, targetRect.bottom], 37477 [targetRect.left - buffer, targetRect.bottom], 37478 [targetRect.left - buffer, targetRect.top] 37479 ]; 37480 case "left": return [ 37481 [x + buffer, y - buffer], 37482 [x + buffer, y + buffer], 37483 [targetRect.right, targetRect.bottom + buffer], 37484 [targetRect.left, targetRect.bottom + buffer], 37485 [targetRect.left, targetRect.top - buffer], 37486 [targetRect.right, targetRect.top - buffer] 37487 ]; 37488 case "right": return [ 37489 [x - buffer, y - buffer], 37490 [x - buffer, y + buffer], 37491 [targetRect.left, targetRect.bottom + buffer], 37492 [targetRect.right, targetRect.bottom + buffer], 37493 [targetRect.right, targetRect.top - buffer], 37494 [targetRect.left, targetRect.top - buffer] 37495 ]; 37496 } 37497 } 37498 #flipSide(side) { 37499 switch (side) { 37500 case "top": return "bottom"; 37501 case "bottom": return "top"; 37502 case "left": return "right"; 37503 case "right": return "left"; 37504 } 37505 } 37506 }; 37507 //#endregion 37508 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/popover/popover.svelte.js 37509 var popoverAttrs = createBitsAttrs({ 37510 component: "popover", 37511 parts: [ 37512 "root", 37513 "trigger", 37514 "content", 37515 "close", 37516 "overlay" 37517 ] 37518 }); 37519 var PopoverRootContext = new Context("Popover.Root"); 37520 var PopoverRootState = class PopoverRootState { 37521 static create(opts) { 37522 return PopoverRootContext.set(new PopoverRootState(opts)); 37523 } 37524 opts; 37525 #contentNode = /* @__PURE__ */ state(null); 37526 get contentNode() { 37527 return get$2(this.#contentNode); 37528 } 37529 set contentNode(value) { 37530 set(this.#contentNode, value, true); 37531 } 37532 contentPresence; 37533 #triggerNode = /* @__PURE__ */ state(null); 37534 get triggerNode() { 37535 return get$2(this.#triggerNode); 37536 } 37537 set triggerNode(value) { 37538 set(this.#triggerNode, value, true); 37539 } 37540 #overlayNode = /* @__PURE__ */ state(null); 37541 get overlayNode() { 37542 return get$2(this.#overlayNode); 37543 } 37544 set overlayNode(value) { 37545 set(this.#overlayNode, value, true); 37546 } 37547 overlayPresence; 37548 #openedViaHover = /* @__PURE__ */ state(false); 37549 get openedViaHover() { 37550 return get$2(this.#openedViaHover); 37551 } 37552 set openedViaHover(value) { 37553 set(this.#openedViaHover, value, true); 37554 } 37555 #hasInteractedWithContent = /* @__PURE__ */ state(false); 37556 get hasInteractedWithContent() { 37557 return get$2(this.#hasInteractedWithContent); 37558 } 37559 set hasInteractedWithContent(value) { 37560 set(this.#hasInteractedWithContent, value, true); 37561 } 37562 #hoverCooldown = /* @__PURE__ */ state(false); 37563 get hoverCooldown() { 37564 return get$2(this.#hoverCooldown); 37565 } 37566 set hoverCooldown(value) { 37567 set(this.#hoverCooldown, value, true); 37568 } 37569 #closeDelay = /* @__PURE__ */ state(0); 37570 get closeDelay() { 37571 return get$2(this.#closeDelay); 37572 } 37573 set closeDelay(value) { 37574 set(this.#closeDelay, value, true); 37575 } 37576 #closeTimeout = null; 37577 #domContext = null; 37578 constructor(opts) { 37579 this.opts = opts; 37580 this.contentPresence = new PresenceManager({ 37581 ref: boxWith(() => this.contentNode), 37582 open: this.opts.open, 37583 onComplete: () => { 37584 this.opts.onOpenChangeComplete.current(this.opts.open.current); 37585 } 37586 }); 37587 this.overlayPresence = new PresenceManager({ 37588 ref: boxWith(() => this.overlayNode), 37589 open: this.opts.open 37590 }); 37591 watch(() => this.opts.open.current, (isOpen) => { 37592 if (!isOpen) { 37593 this.openedViaHover = false;
37594 this.hasInteractedWithContent = false; 37595 this.#clearCloseTimeout(); 37596 } 37597 }); 37598 } 37599 setDomContext(ctx) { 37600 this.#domContext = ctx; 37601 } 37602 #clearCloseTimeout() { 37603 if (this.#closeTimeout !== null && this.#domContext) { 37604 this.#domContext.clearTimeout(this.#closeTimeout); 37605 this.#closeTimeout = null; 37606 } 37607 } 37608 toggleOpen() { 37609 this.#clearCloseTimeout(); 37610 this.opts.open.current = !this.opts.open.current; 37611 } 37612 handleClose() { 37613 this.#clearCloseTimeout(); 37614 if (!this.opts.open.current) return; 37615 this.opts.open.current = false; 37616 } 37617 handleHoverOpen() { 37618 this.#clearCloseTimeout(); 37619 if (this.opts.open.current) return; 37620 this.openedViaHover = true; 37621 this.opts.open.current = true; 37622 } 37623 handleHoverClose() { 37624 if (!this.opts.open.current) return; 37625 if (this.openedViaHover && !this.hasInteractedWithContent) this.opts.open.current = false; 37626 } 37627 handleDelayedHoverClose() { 37628 if (!this.opts.open.current) return; 37629 if (!this.openedViaHover || this.hasInteractedWithContent) return; 37630 this.#clearCloseTimeout(); 37631 if (this.closeDelay <= 0) this.opts.open.current = false; 37632 else if (this.#domContext) this.#closeTimeout = this.#domContext.setTimeout(() => { 37633 if (this.openedViaHover && !this.hasInteractedWithContent) this.opts.open.current = false; 37634 this.#closeTimeout = null; 37635 }, this.closeDelay); 37636 } 37637 cancelDelayedClose() { 37638 this.#clearCloseTimeout(); 37639 } 37640 markInteraction() { 37641 this.hasInteractedWithContent = true; 37642 this.#clearCloseTimeout(); 37643 } 37644 }; 37645 var PopoverTriggerState = class PopoverTriggerState { 37646 static create(opts) { 37647 return new PopoverTriggerState(opts, PopoverRootContext.get()); 37648 } 37649 opts; 37650 root; 37651 attachment; 37652 domContext; 37653 #openTimeout = null; 37654 #closeTimeout = null; 37655 #isHovering = /* @__PURE__ */ state(false); 37656 constructor(opts, root) { 37657 this.opts = opts; 37658 this.root = root; 37659 this.attachment = attachRef(this.opts.ref, (v) => this.root.triggerNode = v); 37660 this.domContext = new DOMContext(opts.ref); 37661 this.root.setDomContext(this.domContext); 37662 this.onclick = this.onclick.bind(this); 37663 this.onkeydown = this.onkeydown.bind(this); 37664 this.onpointerenter = this.onpointerenter.bind(this); 37665 this.onpointerleave = this.onpointerleave.bind(this); 37666 watch(() => this.opts.closeDelay.current, (delay) => { 37667 this.root.closeDelay = delay; 37668 }); 37669 } 37670 #clearOpenTimeout() { 37671 if (this.#openTimeout !== null) { 37672 this.domContext.clearTimeout(this.#openTimeout); 37673 this.#openTimeout = null; 37674 } 37675 } 37676 #clearCloseTimeout() { 37677 if (this.#closeTimeout !== null) { 37678 this.domContext.clearTimeout(this.#closeTimeout); 37679 this.#closeTimeout = null; 37680 } 37681 } 37682 #clearAllTimeouts() { 37683 this.#clearOpenTimeout(); 37684 this.#clearCloseTimeout(); 37685 } 37686 onpointerenter(e) { 37687 if (this.opts.disabled.current) return; 37688 if (!this.opts.openOnHover.current) return; 37689 if (isTouch(e)) return; 37690 set(this.#isHovering, true); 37691 this.#clearCloseTimeout(); 37692 this.root.cancelDelayedClose(); 37693 if (this.root.opts.open.current || this.root.hoverCooldown) return; 37694 const delay = this.opts.openDelay.current; 37695 if (delay <= 0) this.root.handleHoverOpen(); 37696 else this.#openTimeout = this.domContext.setTimeout(() => { 37697 this.root.handleHoverOpen(); 37698 this.#openTimeout = null; 37699 }, delay); 37700 } 37701 onpointerleave(e) { 37702 if (this.opts.disabled.current) return; 37703 if (!this.opts.openOnHover.current) return; 37704 if (isTouch(e)) return; 37705 set(this.#isHovering, false); 37706 this.#clearOpenTimeout(); 37707 this.root.hoverCooldown = false; 37708 } 37709 onclick(e) { 37710 if (this.opts.disabled.current) return; 37711 if (e.button !== 0) return; 37712 this.#clearAllTimeouts(); 37713 if (get$2(this.#isHovering) && this.root.opts.open.current && this.root.openedViaHover) { 37714 this.root.openedViaHover = false; 37715 this.root.hasInteractedWithContent = true; 37716 return; 37717 } 37718 if (get$2(this.#isHovering) && this.opts.openOnHover.current && this.root.opts.open.current) this.root.hoverCooldown = true; 37719 if (this.root.hoverCooldown && !this.root.opts.open.current) this.root.hoverCooldown = false; 37720 this.root.toggleOpen(); 37721 } 37722 onkeydown(e) { 37723 if (this.opts.disabled.current) return; 37724 if (!(e.key === "Enter" || e.key === " ")) return; 37725 e.preventDefault(); 37726 this.#clearAllTimeouts(); 37727 this.root.toggleOpen(); 37728 }
37729 #getAriaControls() { 37730 if (this.root.opts.open.current && this.root.contentNode?.id) return this.root.contentNode?.id; 37731 } 37732 #props = /* @__PURE__ */ user_derived(() => ({ 37733 id: this.opts.id.current, 37734 "aria-haspopup": "dialog", 37735 "aria-expanded": boolToStr(this.root.opts.open.current), 37736 "data-state": getDataOpenClosed(this.root.opts.open.current), 37737 "aria-controls": this.#getAriaControls(), 37738 [popoverAttrs.trigger]: "", 37739 disabled: this.opts.disabled.current, 37740 onkeydown: this.onkeydown, 37741 onclick: this.onclick, 37742 onpointerenter: this.onpointerenter, 37743 onpointerleave: this.onpointerleave, 37744 ...this.attachment 37745 })); 37746 get props() { 37747 return get$2(this.#props); 37748 } 37749 set props(value) { 37750 set(this.#props, value); 37751 } 37752 }; 37753 var PopoverContentState = class PopoverContentState { 37754 static create(opts) { 37755 return new PopoverContentState(opts, PopoverRootContext.get()); 37756 } 37757 opts; 37758 root; 37759 attachment; 37760 constructor(opts, root) { 37761 this.opts = opts; 37762 this.root = root; 37763 this.attachment = attachRef(this.opts.ref, (v) => this.root.contentNode = v); 37764 this.onpointerdown = this.onpointerdown.bind(this); 37765 this.onfocusin = this.onfocusin.bind(this); 37766 this.onpointerenter = this.onpointerenter.bind(this); 37767 this.onpointerleave = this.onpointerleave.bind(this); 37768 new SafePolygon({ 37769 triggerNode: () => this.root.triggerNode, 37770 contentNode: () => this.root.contentNode, 37771 enabled: () => this.root.opts.open.current && this.root.openedViaHover && !this.root.hasInteractedWithContent, 37772 onPointerExit: () => { 37773 this.root.handleDelayedHoverClose(); 37774 } 37775 }); 37776 } 37777 onpointerdown(_) { 37778 this.root.markInteraction(); 37779 } 37780 onfocusin(e) { 37781 const target = e.target; 37782 if (isElement$1(target) && isTabbable(target)) this.root.markInteraction(); 37783 } 37784 onpointerenter(e) { 37785 if (isTouch(e)) return; 37786 this.root.cancelDelayedClose(); 37787 } 37788 onpointerleave(e) { 37789 if (isTouch(e)) return; 37790 } 37791 onInteractOutside = (e) => { 37792 this.opts.onInteractOutside.current(e); 37793 if (e.defaultPrevented) return; 37794 if (!isElement$1(e.target)) return; 37795 const closestTrigger = e.target.closest(popoverAttrs.selector("trigger")); 37796 if (closestTrigger && closestTrigger === this.root.triggerNode) return; 37797 if (this.opts.customAnchor.current) { 37798 if (isElement$1(this.opts.customAnchor.current)) { 37799 if (this.opts.customAnchor.current.contains(e.target)) return; 37800 } else if (typeof this.opts.customAnchor.current === "string") { 37801 const el = document.querySelector(this.opts.customAnchor.current); 37802 if (el && el.contains(e.target)) return; 37803 } 37804 } 37805 this.root.handleClose(); 37806 }; 37807 onEscapeKeydown = (e) => { 37808 this.opts.onEscapeKeydown.current(e); 37809 if (e.defaultPrevented) return; 37810 this.root.handleClose(); 37811 }; 37812 get shouldRender() { 37813 return this.root.contentPresence.shouldRender; 37814 } 37815 get shouldTrapFocus() { 37816 if (this.root.openedViaHover && !this.root.hasInteractedWithContent) return false; 37817 return true; 37818 } 37819 #snippetProps = /* @__PURE__ */ user_derived(() => ({ open: this.root.opts.open.current })); 37820 get snippetProps() { 37821 return get$2(this.#snippetProps); 37822 } 37823 set snippetProps(value) { 37824 set(this.#snippetProps, value); 37825 } 37826 #props = /* @__PURE__ */ user_derived(() => ({ 37827 id: this.opts.id.current, 37828 tabindex: -1, 37829 "data-state": getDataOpenClosed(this.root.opts.open.current), 37830 ...getDataTransitionAttrs(this.root.contentPresence.transitionStatus), 37831 [popoverAttrs.content]: "", 37832 style: { 37833 pointerEvents: "auto", 37834 contain: "layout style" 37835 }, 37836 onpointerdown: this.onpointerdown, 37837 onfocusin: this.onfocusin, 37838 onpointerenter: this.onpointerenter, 37839 onpointerleave: this.onpointerleave, 37840 ...this.attachment 37841 })); 37842 get props() { 37843 return get$2(this.#props); 37844 } 37845 set props(value) { 37846 set(this.#props, value); 37847 } 37848 popperProps = { 37849 onInteractOutside: this.onInteractOutside, 37850 onEscapeKeydown: this.onEscapeKeydown 37851 }; 37852 }; 37853 //#endregion 37854 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-picker/components/date-picker.svelte 37855 function Date_picker($$anchor, $$props) { 37856 push($$props, true); 37857 let open = prop($$props, "open", 15, false), onOpenChange = prop($$props, "onOpenChange", 7, noop), onOpenChangeComplete = prop($$props, "onOpenChangeComplete", 7, noop), value = prop($$props, "value", 15), onValueChange = prop($$props, "onValueChange", 7, noop), placeholder = prop($$props, "placeholder", 15), onPlaceholderChange = prop($$props, "onPlaceholderChange", 7, noop), isDateUnavailable = prop($$props, "isDateUnavailable", 7, () => false), validate = prop($$props, "validate", 7, noop), onInvalid = prop($$props, "onInvalid", 7, noop), minValue = prop($$props, "minValue", 7), maxValue = prop($$props, "maxValue", 7), disabled = prop($$props, "disabled", 7, false), readonly = prop($$props, "readonly", 7, false), granularity = prop($$props, "granularity", 7), readonlySegments = prop($$props, "readonlySegments", 23, () => []), hourCycle = prop($$props, "hourCycle", 7), locale = prop($$props, "locale", 7), hideTimeZone = prop($$props, "hideTimeZone", 7, false), required = prop($$props, "required", 7, false), calendarLabel = prop($$props, "calendarLabel", 7, "Event"), disableDaysOutsideMonth = prop($$props, "disableDaysOutsideMonth", 7, true), preventDeselect = prop($$props, "preventDeselect", 7, false), pagedNavigation = prop($$props, "pagedNavigation", 7, false), weekStartsOn = prop($$props, "weekStartsOn", 7), weekdayFormat = prop($$props, "weekdayFormat", 7, "narrow"), isDateDisabled = prop($$props, "isDateDisabled", 7, () => false), fixedWeeks = prop($$props, "fixedWeeks", 7, false), numberOfMonths = prop($$props, "numberOfMonths", 7, 1), closeOnDateSelect = prop($$props, "closeOnDateSelect", 7, true), initialFocus = prop($$props, "initialFocus", 7, false), errorMessageId = prop($$props, "errorMessageId", 7), children = prop($$props, "children", 7), monthFormat = prop($$props, "monthFormat", 7, "long"), yearFormat = prop($$props, "yearFormat", 7, "numeric"); 37858 const defaultPlaceholder = getDefaultDate({ 37859 granularity: granularity(), 37860 defaultValue: value(), 37861 minValue: minValue(), 37862 maxValue: maxValue() 37863 }); 37864 function handleDefaultPlaceholder() { 37865 if (placeholder() !== void 0) return; 37866 placeholder(defaultPlaceholder); 37867 } 37868 handleDefaultPlaceholder(); 37869 /**
37870 * Covers an edge case where when a spread props object is reassigned, 37871 * the props are reset to their default values, which would make placeholder 37872 * undefined which causes errors to be thrown. 37873 */ 37874 watch.pre(() => placeholder(), () => { 37875 handleDefaultPlaceholder(); 37876 }); 37877 function onDateSelect() { 37878 if (closeOnDateSelect()) open(false); 37879 } 37880 const pickerRootState = DatePickerRootState.create({ 37881 open: boxWith(() => open(), (v) => { 37882 open(v); 37883 onOpenChange()(v); 37884 }), 37885 value: boxWith(() => value(), (v) => { 37886 value(v); 37887 onValueChange()(v); 37888 }), 37889 placeholder: boxWith(() => placeholder(), (v) => { 37890 placeholder(v); 37891 onPlaceholderChange()(v); 37892 }), 37893 isDateUnavailable: boxWith(() => isDateUnavailable()), 37894 minValue: boxWith(() => minValue()), 37895 maxValue: boxWith(() => maxValue()), 37896 disabled: boxWith(() => disabled()), 37897 readonly: boxWith(() => readonly()), 37898 granularity: boxWith(() => granularity()), 37899 readonlySegments: boxWith(() => readonlySegments()), 37900 hourCycle: boxWith(() => hourCycle()), 37901 locale: resolveLocaleProp(() => locale()), 37902 hideTimeZone: boxWith(() => hideTimeZone()), 37903 required: boxWith(() => required()), 37904 calendarLabel: boxWith(() => calendarLabel()), 37905 disableDaysOutsideMonth: boxWith(() => disableDaysOutsideMonth()), 37906 preventDeselect: boxWith(() => preventDeselect()), 37907 pagedNavigation: boxWith(() => pagedNavigation()), 37908 weekStartsOn: boxWith(() => weekStartsOn()), 37909 weekdayFormat: boxWith(() => weekdayFormat()), 37910 isDateDisabled: boxWith(() => isDateDisabled()), 37911 fixedWeeks: boxWith(() => fixedWeeks()), 37912 numberOfMonths: boxWith(() => numberOfMonths()), 37913 initialFocus: boxWith(() => initialFocus()), 37914 onDateSelect: boxWith(() => onDateSelect), 37915 defaultPlaceholder, 37916 monthFormat: boxWith(() => monthFormat()), 37917 yearFormat: boxWith(() => yearFormat()) 37918 }); 37919 PopoverRootState.create({ 37920 open: pickerRootState.opts.open, 37921 onOpenChangeComplete: boxWith(() => onOpenChangeComplete()) 37922 }); 37923 DateFieldRootState.create({ 37924 value: pickerRootState.opts.value, 37925 disabled: pickerRootState.opts.disabled, 37926 readonly: pickerRootState.opts.readonly, 37927 readonlySegments: pickerRootState.opts.readonlySegments, 37928 validate: boxWith(() => validate()), 37929 onInvalid: boxWith(() => onInvalid()), 37930 minValue: pickerRootState.opts.minValue, 37931 maxValue: pickerRootState.opts.maxValue, 37932 granularity: pickerRootState.opts.granularity, 37933 hideTimeZone: pickerRootState.opts.hideTimeZone, 37934 hourCycle: pickerRootState.opts.hourCycle, 37935 locale: pickerRootState.opts.locale, 37936 required: pickerRootState.opts.required, 37937 placeholder: pickerRootState.opts.placeholder, 37938 errorMessageId: boxWith(() => errorMessageId()), 37939 isInvalidProp: boxWith(() => void 0) 37940 }); 37941 var $$exports = { 37942 get open() { 37943 return open(); 37944 }, 37945 set open($$value = false) { 37946 open($$value); 37947 flushSync(); 37948 }, 37949 get onOpenChange() { 37950 return onOpenChange(); 37951 }, 37952 set onOpenChange($$value = noop) { 37953 onOpenChange($$value); 37954 flushSync(); 37955 }, 37956 get onOpenChangeComplete() { 37957 return onOpenChangeComplete(); 37958 }, 37959 set onOpenChangeComplete($$value = noop) { 37960 onOpenChangeComplete($$value); 37961 flushSync(); 37962 }, 37963 get value() { 37964 return value(); 37965 }, 37966 set value($$value) { 37967 value($$value); 37968 flushSync(); 37969 }, 37970 get onValueChange() { 37971 return onValueChange(); 37972 }, 37973 set onValueChange($$value = noop) { 37974 onValueChange($$value); 37975 flushSync(); 37976 }, 37977 get placeholder() { 37978 return placeholder(); 37979 }, 37980 set placeholder($$value) { 37981 placeholder($$value); 37982 flushSync(); 37983 }, 37984 get onPlaceholderChange() { 37985 return onPlaceholderChange(); 37986 }, 37987 set onPlaceholderChange($$value = noop) { 37988 onPlaceholderChange($$value); 37989 flushSync(); 37990 }, 37991 get isDateUnavailable() { 37992 return isDateUnavailable(); 37993 }, 37994 set isDateUnavailable($$value = () => false) { 37995 isDateUnavailable($$value); 37996 flushSync(); 37997 }, 37998 get validate() { 37999 return validate(); 38000 }, 38001 set validate($$value = noop) { 38002 validate($$value); 38003 flushSync(); 38004 }, 38005 get onInvalid() { 38006 return onInvalid(); 38007 }, 38008 set onInvalid($$value = noop) { 38009 onInvalid($$value); 38010 flushSync(); 38011 }, 38012 get minValue() { 38013 return minValue(); 38014 }, 38015 set minValue($$value) { 38016 minValue($$value); 38017 flushSync(); 38018 }, 38019 get maxValue() { 38020 return maxValue(); 38021 }, 38022 set maxValue($$value) { 38023 maxValue($$value); 38024 flushSync(); 38025 }, 38026 get disabled() { 38027 return disabled(); 38028 }, 38029 set disabled($$value = false) { 38030 disabled($$value); 38031 flushSync(); 38032 }, 38033 get readonly() { 38034 return readonly(); 38035 }, 38036 set readonly($$value = false) { 38037 readonly($$value); 38038 flushSync(); 38039 }, 38040 get granularity() { 38041 return granularity(); 38042 }, 38043 set granularity($$value) { 38044 granularity($$value); 38045 flushSync(); 38046 }, 38047 get readonlySegments() { 38048 return readonlySegments(); 38049 }, 38050 set readonlySegments($$value = []) { 38051 readonlySegments($$value); 38052 flushSync(); 38053 }, 38054 get hourCycle() { 38055 return hourCycle(); 38056 }, 38057 set hourCycle($$value) { 38058 hourCycle($$value); 38059 flushSync(); 38060 }, 38061 get locale() { 38062 return locale(); 38063 }, 38064 set locale($$value) { 38065 locale($$value); 38066 flushSync(); 38067 }, 38068 get hideTimeZone() { 38069 return hideTimeZone(); 38070 }, 38071 set hideTimeZone($$value = false) { 38072 hideTimeZone($$value); 38073 flushSync(); 38074 }, 38075 get required() { 38076 return required(); 38077 }, 38078 set required($$value = false) { 38079 required($$value); 38080 flushSync(); 38081 }, 38082 get calendarLabel() { 38083 return calendarLabel(); 38084 }, 38085 set calendarLabel($$value = "Event") { 38086 calendarLabel($$value); 38087 flushSync(); 38088 }, 38089 get disableDaysOutsideMonth() { 38090 return disableDaysOutsideMonth(); 38091 }, 38092 set disableDaysOutsideMonth($$value = true) { 38093 disableDaysOutsideMonth($$value); 38094 flushSync(); 38095 }, 38096 get preventDeselect() { 38097 return preventDeselect(); 38098 }, 38099 set preventDeselect($$value = false) { 38100 preventDeselect($$value); 38101 flushSync(); 38102 }, 38103 get pagedNavigation() { 38104 return pagedNavigation(); 38105 }, 38106 set pagedNavigation($$value = false) { 38107 pagedNavigation($$value); 38108 flushSync(); 38109 }, 38110 get weekStartsOn() { 38111 return weekStartsOn(); 38112 }, 38113 set weekStartsOn($$value) { 38114 weekStartsOn($$value); 38115 flushSync(); 38116 }, 38117 get weekdayFormat() { 38118 return weekdayFormat(); 38119 }, 38120 set weekdayFormat($$value = "narrow") { 38121 weekdayFormat($$value); 38122 flushSync(); 38123 }, 38124 get isDateDisabled() { 38125 return isDateDisabled(); 38126 }, 38127 set isDateDisabled($$value = () => false) { 38128 isDateDisabled($$value); 38129 flushSync(); 38130 }, 38131 get fixedWeeks() { 38132 return fixedWeeks(); 38133 }, 38134 set fixedWeeks($$value = false) { 38135 fixedWeeks($$value); 38136 flushSync(); 38137 }, 38138 get numberOfMonths() { 38139 return numberOfMonths(); 38140 }, 38141 set numberOfMonths($$value = 1) { 38142 numberOfMonths($$value); 38143 flushSync(); 38144 }, 38145 get closeOnDateSelect() { 38146 return closeOnDateSelect(); 38147 }, 38148 set closeOnDateSelect($$value = true) { 38149 closeOnDateSelect($$value); 38150 flushSync(); 38151 }, 38152 get initialFocus() { 38153 return initialFocus(); 38154 }, 38155 set initialFocus($$value = false) { 38156 initialFocus($$value); 38157 flushSync(); 38158 }, 38159 get errorMessageId() { 38160 return errorMessageId(); 38161 }, 38162 set errorMessageId($$value) { 38163 errorMessageId($$value); 38164 flushSync(); 38165 }, 38166 get children() { 38167 return children(); 38168 }, 38169 set children($$value) { 38170 children($$value); 38171 flushSync(); 38172 }, 38173 get monthFormat() { 38174 return monthFormat(); 38175 }, 38176 set monthFormat($$value = "long") { 38177 monthFormat($$value); 38178 flushSync(); 38179 }, 38180 get yearFormat() { 38181 return yearFormat(); 38182 }, 38183 set yearFormat($$value = "numeric") { 38184 yearFormat($$value); 38185 flushSync(); 38186 } 38187 }; 38188 var fragment = comment(); 38189 component(first_child(fragment), () => Floating_layer, ($$anchor, FloatingLayer_Root) => { 38190 FloatingLayer_Root($$anchor, { 38191 children: ($$anchor, $$slotProps) => { 38192 var fragment_1 = comment(); 38193 snippet(first_child(fragment_1), () => children() ?? noop$1); 38194 append($$anchor, fragment_1); 38195 }, 38196 $$slots: { default: true } 38197 }); 38198 }); 38199 append($$anchor, fragment); 38200 return pop($$exports); 38201 }
38202 create_custom_element(Date_picker, { 38203 open: {}, 38204 onOpenChange: {}, 38205 onOpenChangeComplete: {}, 38206 value: {}, 38207 onValueChange: {}, 38208 placeholder: {}, 38209 onPlaceholderChange: {}, 38210 isDateUnavailable: {}, 38211 validate: {}, 38212 onInvalid: {}, 38213 minValue: {}, 38214 maxValue: {}, 38215 disabled: {}, 38216 readonly: {}, 38217 granularity: {}, 38218 readonlySegments: {}, 38219 hourCycle: {}, 38220 locale: {}, 38221 hideTimeZone: {}, 38222 required: {}, 38223 calendarLabel: {}, 38224 disableDaysOutsideMonth: {}, 38225 preventDeselect: {}, 38226 pagedNavigation: {}, 38227 weekStartsOn: {}, 38228 weekdayFormat: {}, 38229 isDateDisabled: {}, 38230 fixedWeeks: {}, 38231 numberOfMonths: {}, 38232 closeOnDateSelect: {}, 38233 initialFocus: {}, 38234 errorMessageId: {}, 38235 children: {}, 38236 monthFormat: {}, 38237 yearFormat: {} 38238 }, [], [], { mode: "open" }); 38239 //#endregion 38240 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-picker/components/date-picker-calendar.svelte 38241 var rest_excludes$5 = new Set([ 38242 "$$slots", 38243 "$$events", 38244 "$$legacy", 38245 "$$host", 38246 "children", 38247 "child", 38248 "id", 38249 "ref" 38250 ]); 38251 var root$19 = /* @__PURE__ */ from_html(`<div><!></div>`); 38252 function Date_picker_calendar($$anchor, $$props) { 38253 const uid = props_id(); 38254 push($$props, true); 38255 let children = prop($$props, "children", 7), child$3 = prop($$props, "child", 7), id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$5); 38256 const datePickerRootState = DatePickerRootContext.get(); 38257 const calendarState = CalendarRootState.create({ 38258 id: boxWith(() => id()), 38259 ref: boxWith(() => ref(), (v) => ref(v)), 38260 calendarLabel: datePickerRootState.opts.calendarLabel, 38261 fixedWeeks: datePickerRootState.opts.fixedWeeks, 38262 isDateDisabled: datePickerRootState.opts.isDateDisabled, 38263 isDateUnavailable: datePickerRootState.opts.isDateUnavailable, 38264 locale: datePickerRootState.opts.locale, 38265 numberOfMonths: datePickerRootState.opts.numberOfMonths, 38266 pagedNavigation: datePickerRootState.opts.pagedNavigation, 38267 preventDeselect: datePickerRootState.opts.preventDeselect, 38268 readonly: datePickerRootState.opts.readonly, 38269 type: boxWith(() => "single"), 38270 weekStartsOn: datePickerRootState.opts.weekStartsOn, 38271 weekdayFormat: datePickerRootState.opts.weekdayFormat, 38272 disabled: datePickerRootState.opts.disabled, 38273 disableDaysOutsideMonth: datePickerRootState.opts.disableDaysOutsideMonth, 38274 maxValue: datePickerRootState.opts.maxValue, 38275 minValue: datePickerRootState.opts.minValue, 38276 placeholder: datePickerRootState.opts.placeholder, 38277 value: datePickerRootState.opts.value, 38278 onDateSelect: datePickerRootState.opts.onDateSelect, 38279 initialFocus: datePickerRootState.opts.initialFocus, 38280 defaultPlaceholder: datePickerRootState.opts.defaultPlaceholder, 38281 maxDays: boxWith(() => void 0), 38282 monthFormat: datePickerRootState.opts.monthFormat, 38283 yearFormat: datePickerRootState.opts.yearFormat 38284 }); 38285 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, calendarState.props)); 38286 var $$exports = { 38287 get children() { 38288 return children(); 38289 }, 38290 set children($$value) { 38291 children($$value); 38292 flushSync(); 38293 }, 38294 get child() { 38295 return child$3(); 38296 }, 38297 set child($$value) { 38298 child$3($$value); 38299 flushSync(); 38300 }, 38301 get id() { 38302 return id(); 38303 }, 38304 set id($$value = createId(uid)) { 38305 id($$value); 38306 flushSync(); 38307 }, 38308 get ref() { 38309 return ref(); 38310 }, 38311 set ref($$value = null) { 38312 ref($$value); 38313 flushSync(); 38314 } 38315 }; 38316 var fragment = comment(); 38317 var node = first_child(fragment); 38318 var consequent = ($$anchor) => { 38319 var fragment_1 = comment(); 38320 var node_1 = first_child(fragment_1); 38321 { 38322 let $0 = /* @__PURE__ */ user_derived(() => ({ 38323 props: get$2(mergedProps), 38324 ...calendarState.snippetProps 38325 })); 38326 snippet(node_1, child$3, () => get$2($0)); 38327 } 38328 append($$anchor, fragment_1); 38329 }; 38330 var alternate = ($$anchor) => { 38331 var div = root$19(); 38332 attribute_effect(div, () => ({ ...get$2(mergedProps) })); 38333 snippet(child(div), () => children() ?? noop$1, () => calendarState.snippetProps); 38334 reset(div); 38335 append($$anchor, div); 38336 }; 38337 if_block(node, ($$render) => { 38338 if (child$3()) $$render(consequent); 38339 else $$render(alternate, -1); 38340 }); 38341 append($$anchor, fragment); 38342 return pop($$exports); 38343 }
38344 create_custom_element(Date_picker_calendar, { 38345 children: {}, 38346 child: {}, 38347 id: {}, 38348 ref: {} 38349 }, [], [], { mode: "open" }); 38350 //#endregion 38351 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/popover/components/popover-content.svelte 38352 var rest_excludes$4 = new Set([ 38353 "$$slots", 38354 "$$events", 38355 "$$legacy", 38356 "$$host", 38357 "child", 38358 "children", 38359 "ref", 38360 "id", 38361 "forceMount", 38362 "onOpenAutoFocus", 38363 "onCloseAutoFocus", 38364 "onEscapeKeydown", 38365 "onInteractOutside", 38366 "trapFocus", 38367 "preventScroll", 38368 "customAnchor", 38369 "style" 38370 ]); 38371 var root$18 = /* @__PURE__ */ from_html(`<div><div><!></div></div>`); 38372 function Popover_content($$anchor, $$props) { 38373 const uid = props_id(); 38374 push($$props, true); 38375 let child$2 = prop($$props, "child", 7), children = prop($$props, "children", 7), ref = prop($$props, "ref", 15, null), id = prop($$props, "id", 23, () => createId(uid)), forceMount = prop($$props, "forceMount", 7, false), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7, noop), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7, noop), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7, noop), onInteractOutside = prop($$props, "onInteractOutside", 7, noop), trapFocus = prop($$props, "trapFocus", 7, true), preventScroll = prop($$props, "preventScroll", 7, false), customAnchor = prop($$props, "customAnchor", 7, null), style = prop($$props, "style", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$4); 38376 const contentState = PopoverContentState.create({ 38377 id: boxWith(() => id()), 38378 ref: boxWith(() => ref(), (v) => ref(v)), 38379 onInteractOutside: boxWith(() => onInteractOutside()), 38380 onEscapeKeydown: boxWith(() => onEscapeKeydown()), 38381 customAnchor: boxWith(() => customAnchor()) 38382 }); 38383 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, contentState.props)); 38384 const effectiveTrapFocus = /* @__PURE__ */ user_derived(() => trapFocus() && contentState.shouldTrapFocus); 38385 function handleOpenAutoFocus(e) { 38386 if (!contentState.shouldTrapFocus) e.preventDefault(); 38387 onOpenAutoFocus()(e); 38388 } 38389 var $$exports = { 38390 get child() { 38391 return child$2(); 38392 }, 38393 set child($$value) { 38394 child$2($$value); 38395 flushSync(); 38396 }, 38397 get children() { 38398 return children(); 38399 }, 38400 set children($$value) { 38401 children($$value); 38402 flushSync(); 38403 }, 38404 get ref() { 38405 return ref(); 38406 }, 38407 set ref($$value = null) { 38408 ref($$value); 38409 flushSync(); 38410 }, 38411 get id() { 38412 return id(); 38413 }, 38414 set id($$value = createId(uid)) { 38415 id($$value); 38416 flushSync(); 38417 }, 38418 get forceMount() { 38419 return forceMount(); 38420 }, 38421 set forceMount($$value = false) { 38422 forceMount($$value); 38423 flushSync(); 38424 }, 38425 get onOpenAutoFocus() { 38426 return onOpenAutoFocus(); 38427 }, 38428 set onOpenAutoFocus($$value = noop) { 38429 onOpenAutoFocus($$value); 38430 flushSync(); 38431 }, 38432 get onCloseAutoFocus() { 38433 return onCloseAutoFocus(); 38434 }, 38435 set onCloseAutoFocus($$value = noop) { 38436 onCloseAutoFocus($$value); 38437 flushSync(); 38438 }, 38439 get onEscapeKeydown() { 38440 return onEscapeKeydown(); 38441 }, 38442 set onEscapeKeydown($$value = noop) { 38443 onEscapeKeydown($$value); 38444 flushSync(); 38445 }, 38446 get onInteractOutside() { 38447 return onInteractOutside(); 38448 }, 38449 set onInteractOutside($$value = noop) { 38450 onInteractOutside($$value); 38451 flushSync(); 38452 }, 38453 get trapFocus() { 38454 return trapFocus(); 38455 }, 38456 set trapFocus($$value = true) { 38457 trapFocus($$value); 38458 flushSync(); 38459 }, 38460 get preventScroll() { 38461 return preventScroll(); 38462 }, 38463 set preventScroll($$value = false) { 38464 preventScroll($$value); 38465 flushSync(); 38466 }, 38467 get customAnchor() { 38468 return customAnchor(); 38469 }, 38470 set customAnchor($$value = null) { 38471 customAnchor($$value); 38472 flushSync(); 38473 }, 38474 get style() { 38475 return style(); 38476 }, 38477 set style($$value) { 38478 style($$value); 38479 flushSync(); 38480 } 38481 }; 38482 var fragment = comment(); 38483 var node = first_child(fragment); 38484 var consequent_1 = ($$anchor) => { 38485 { 38486 const popper = ($$anchor, $$arg0) => { 38487 let props = () => $$arg0?.().props; 38488 let wrapperProps = () => $$arg0?.().wrapperProps; 38489 const finalProps = /* @__PURE__ */ user_derived(() => mergeProps(props(), { style: getFloatingContentCSSVars("popover") }, { style: style() })); 38490 var fragment_2 = comment();
38491 var node_1 = first_child(fragment_2); 38492 var consequent = ($$anchor) => { 38493 var fragment_3 = comment(); 38494 var node_2 = first_child(fragment_3); 38495 { 38496 let $0 = /* @__PURE__ */ user_derived(() => ({ 38497 props: get$2(finalProps), 38498 wrapperProps: wrapperProps(), 38499 ...contentState.snippetProps 38500 })); 38501 snippet(node_2, child$2, () => get$2($0)); 38502 } 38503 append($$anchor, fragment_3); 38504 }; 38505 var alternate = ($$anchor) => { 38506 var div = root$18(); 38507 attribute_effect(div, () => ({ ...wrapperProps() })); 38508 var div_1 = child(div); 38509 attribute_effect(div_1, () => ({ ...get$2(finalProps) })); 38510 snippet(child(div_1), () => children() ?? noop$1); 38511 reset(div_1); 38512 reset(div); 38513 append($$anchor, div); 38514 }; 38515 if_block(node_1, ($$render) => { 38516 if (child$2()) $$render(consequent); 38517 else $$render(alternate, -1); 38518 }); 38519 append($$anchor, fragment_2); 38520 }; 38521 Popper_layer_force_mount($$anchor, spread_props(() => get$2(mergedProps), () => contentState.popperProps, { 38522 get ref() { 38523 return contentState.opts.ref; 38524 }, 38525 get enabled() { 38526 return contentState.root.opts.open.current; 38527 }, 38528 get id() { 38529 return id(); 38530 }, 38531 get trapFocus() { 38532 return get$2(effectiveTrapFocus); 38533 }, 38534 get preventScroll() { 38535 return preventScroll(); 38536 }, 38537 loop: true, 38538 forceMount: true, 38539 get customAnchor() { 38540 return customAnchor(); 38541 }, 38542 onOpenAutoFocus: handleOpenAutoFocus, 38543 get onCloseAutoFocus() { 38544 return onCloseAutoFocus(); 38545 }, 38546 get shouldRender() { 38547 return contentState.shouldRender; 38548 }, 38549 popper, 38550 $$slots: { popper: true } 38551 })); 38552 } 38553 }; 38554 var consequent_3 = ($$anchor) => { 38555 { 38556 const popper = ($$anchor, $$arg0) => { 38557 let props = () => $$arg0?.().props; 38558 let wrapperProps = () => $$arg0?.().wrapperProps; 38559 const finalProps = /* @__PURE__ */ user_derived(() => mergeProps(props(), { style: getFloatingContentCSSVars("popover") }, { style: style() })); 38560 var fragment_5 = comment(); 38561 var node_4 = first_child(fragment_5); 38562 var consequent_2 = ($$anchor) => { 38563 var fragment_6 = comment(); 38564 var node_5 = first_child(fragment_6); 38565 { 38566 let $0 = /* @__PURE__ */ user_derived(() => ({ 38567 props: get$2(finalProps), 38568 wrapperProps: wrapperProps(), 38569 ...contentState.snippetProps 38570 })); 38571 snippet(node_5, child$2, () => get$2($0)); 38572 } 38573 append($$anchor, fragment_6); 38574 }; 38575 var alternate_1 = ($$anchor) => { 38576 var div_2 = root$18(); 38577 attribute_effect(div_2, () => ({ ...wrapperProps() })); 38578 var div_3 = child(div_2); 38579 attribute_effect(div_3, () => ({ ...get$2(finalProps) })); 38580 snippet(child(div_3), () => children() ?? noop$1); 38581 reset(div_3); 38582 reset(div_2); 38583 append($$anchor, div_2); 38584 }; 38585 if_block(node_4, ($$render) => { 38586 if (child$2()) $$render(consequent_2); 38587 else $$render(alternate_1, -1); 38588 }); 38589 append($$anchor, fragment_5); 38590 }; 38591 Popper_layer($$anchor, spread_props(() => get$2(mergedProps), () => contentState.popperProps, { 38592 get ref() { 38593 return contentState.opts.ref; 38594 }, 38595 get open() { 38596 return contentState.root.opts.open.current; 38597 }, 38598 get id() { 38599 return id(); 38600 }, 38601 get trapFocus() { 38602 return get$2(effectiveTrapFocus); 38603 }, 38604 get preventScroll() { 38605 return preventScroll(); 38606 }, 38607 loop: true, 38608 forceMount: false, 38609 get customAnchor() { 38610 return customAnchor(); 38611 }, 38612 onOpenAutoFocus: handleOpenAutoFocus, 38613 get onCloseAutoFocus() { 38614 return onCloseAutoFocus(); 38615 }, 38616 get shouldRender() { 38617 return contentState.shouldRender; 38618 }, 38619 popper, 38620 $$slots: { popper: true } 38621 })); 38622 } 38623 }; 38624 if_block(node, ($$render) => { 38625 if (forceMount()) $$render(consequent_1); 38626 else if (!forceMount()) $$render(consequent_3, 1); 38627 }); 38628 append($$anchor, fragment); 38629 return pop($$exports); 38630 } 38631 create_custom_element(Popover_content, { 38632 child: {}, 38633 children: {}, 38634 ref: {}, 38635 id: {}, 38636 forceMount: {}, 38637 onOpenAutoFocus: {}, 38638 onCloseAutoFocus: {},
38639 onEscapeKeydown: {}, 38640 onInteractOutside: {}, 38641 trapFocus: {}, 38642 preventScroll: {}, 38643 customAnchor: {}, 38644 style: {} 38645 }, [], [], { mode: "open" }); 38646 //#endregion 38647 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-picker/components/date-picker-content.svelte 38648 var rest_excludes$3 = new Set([ 38649 "$$slots", 38650 "$$events", 38651 "$$legacy", 38652 "$$host", 38653 "ref", 38654 "onOpenAutoFocus" 38655 ]); 38656 function Date_picker_content($$anchor, $$props) { 38657 push($$props, true); 38658 let ref = prop($$props, "ref", 15, null), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$3); 38659 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps({ onOpenAutoFocus: onOpenAutoFocus() }, { onOpenAutoFocus: pickerOpenFocus })); 38660 var $$exports = { 38661 get ref() { 38662 return ref(); 38663 }, 38664 set ref($$value = null) { 38665 ref($$value); 38666 flushSync(); 38667 }, 38668 get onOpenAutoFocus() { 38669 return onOpenAutoFocus(); 38670 }, 38671 set onOpenAutoFocus($$value) { 38672 onOpenAutoFocus($$value); 38673 flushSync(); 38674 } 38675 }; 38676 Popover_content($$anchor, spread_props(() => get$2(mergedProps), () => restProps, { 38677 get ref() { 38678 return ref(); 38679 }, 38680 set ref($$value) { 38681 ref($$value); 38682 } 38683 })); 38684 return pop($$exports); 38685 } 38686 create_custom_element(Date_picker_content, { 38687 ref: {}, 38688 onOpenAutoFocus: {} 38689 }, [], [], { mode: "open" }); 38690 //#endregion 38691 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/popover/components/popover-trigger.svelte 38692 var rest_excludes$2 = new Set([ 38693 "$$slots", 38694 "$$events", 38695 "$$legacy", 38696 "$$host", 38697 "children", 38698 "child", 38699 "id", 38700 "ref", 38701 "type", 38702 "disabled", 38703 "openOnHover", 38704 "openDelay", 38705 "closeDelay" 38706 ]); 38707 var root$17 = /* @__PURE__ */ from_html(`<button><!></button>`); 38708 function Popover_trigger($$anchor, $$props) { 38709 const uid = props_id(); 38710 push($$props, true); 38711 let children = prop($$props, "children", 7), child$1 = prop($$props, "child", 7), id = prop($$props, "id", 23, () => createId(uid)), ref = prop($$props, "ref", 15, null), type = prop($$props, "type", 7, "button"), disabled = prop($$props, "disabled", 7, false), openOnHover = prop($$props, "openOnHover", 7, false), openDelay = prop($$props, "openDelay", 7, 700), closeDelay = prop($$props, "closeDelay", 7, 300), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$2); 38712 const triggerState = PopoverTriggerState.create({ 38713 id: boxWith(() => id()), 38714 ref: boxWith(() => ref(), (v) => ref(v)), 38715 disabled: boxWith(() => Boolean(disabled())), 38716 openOnHover: boxWith(() => openOnHover()), 38717 openDelay: boxWith(() => openDelay()), 38718 closeDelay: boxWith(() => closeDelay()) 38719 }); 38720 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps(restProps, triggerState.props, { type: type() })); 38721 var $$exports = { 38722 get children() { 38723 return children(); 38724 }, 38725 set children($$value) { 38726 children($$value); 38727 flushSync(); 38728 }, 38729 get child() { 38730 return child$1(); 38731 }, 38732 set child($$value) { 38733 child$1($$value); 38734 flushSync(); 38735 }, 38736 get id() { 38737 return id(); 38738 }, 38739 set id($$value = createId(uid)) { 38740 id($$value); 38741 flushSync(); 38742 }, 38743 get ref() { 38744 return ref(); 38745 }, 38746 set ref($$value = null) { 38747 ref($$value); 38748 flushSync(); 38749 }, 38750 get type() { 38751 return type(); 38752 }, 38753 set type($$value = "button") { 38754 type($$value); 38755 flushSync(); 38756 }, 38757 get disabled() { 38758 return disabled(); 38759 }, 38760 set disabled($$value = false) { 38761 disabled($$value); 38762 flushSync(); 38763 }, 38764 get openOnHover() { 38765 return openOnHover(); 38766 }, 38767 set openOnHover($$value = false) { 38768 openOnHover($$value); 38769 flushSync(); 38770 }, 38771 get openDelay() { 38772 return openDelay(); 38773 }, 38774 set openDelay($$value = 700) { 38775 openDelay($$value); 38776 flushSync(); 38777 }, 38778 get closeDelay() { 38779 return closeDelay(); 38780 }, 38781 set closeDelay($$value = 300) { 38782 closeDelay($$value); 38783 flushSync(); 38784 } 38785 }; 38786 Floating_layer_anchor($$anchor, { 38787 get id() { 38788 return id(); 38789 }, 38790 get ref() { 38791 return triggerState.opts.ref; 38792 }, 38793 children: ($$anchor, $$slotProps) => { 38794 var fragment_1 = comment(); 38795 var node = first_child(fragment_1); 38796 var consequent = ($$anchor) => { 38797 var fragment_2 = comment(); 38798 snippet(first_child(fragment_2), child$1, () => ({ props: get$2(mergedProps) })); 38799 append($$anchor, fragment_2); 38800 }; 38801 var alternate = ($$anchor) => { 38802 var button = root$17(); 38803 attribute_effect(button, () => ({ ...get$2(mergedProps) })); 38804 snippet(child(button), () => children() ?? noop$1); 38805 reset(button); 38806 append($$anchor, button); 38807 }; 38808 if_block(node, ($$render) => { 38809 if (child$1()) $$render(consequent); 38810 else $$render(alternate, -1); 38811 }); 38812 append($$anchor, fragment_1); 38813 }, 38814 $$slots: { default: true } 38815 }); 38816 return pop($$exports); 38817 }
38818 create_custom_element(Popover_trigger, { 38819 children: {}, 38820 child: {}, 38821 id: {}, 38822 ref: {}, 38823 type: {}, 38824 disabled: {}, 38825 openOnHover: {}, 38826 openDelay: {}, 38827 closeDelay: {} 38828 }, [], [], { mode: "open" }); 38829 //#endregion 38830 //#region ../../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@opentelemetry+api@1_83c2510af1aa7554f33aa32ca276e681/node_modules/bits-ui/dist/bits/date-picker/components/date-picker-trigger.svelte 38831 var rest_excludes$1 = new Set([ 38832 "$$slots", 38833 "$$events", 38834 "$$legacy", 38835 "$$host", 38836 "ref", 38837 "onkeydown" 38838 ]); 38839 function Date_picker_trigger($$anchor, $$props) { 38840 push($$props, true); 38841 let ref = prop($$props, "ref", 15, null), onkeydown = prop($$props, "onkeydown", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes$1); 38842 function onKeydown(e) { 38843 if (isSegmentNavigationKey(e.key)) { 38844 const dateFieldInputNode = e.currentTarget.closest(dateFieldAttrs.selector("input")); 38845 if (!dateFieldInputNode) return; 38846 handleSegmentNavigation(e, dateFieldInputNode); 38847 } 38848 } 38849 const mergedProps = /* @__PURE__ */ user_derived(() => mergeProps({ onkeydown: onkeydown() }, { onkeydown: onKeydown })); 38850 var $$exports = { 38851 get ref() { 38852 return ref(); 38853 }, 38854 set ref($$value = null) { 38855 ref($$value); 38856 flushSync(); 38857 }, 38858 get onkeydown() { 38859 return onkeydown(); 38860 }, 38861 set onkeydown($$value) { 38862 onkeydown($$value); 38863 flushSync(); 38864 } 38865 }; 38866 Popover_trigger($$anchor, spread_props(() => restProps, { "data-segment": "trigger" }, () => get$2(mergedProps), { 38867 get ref() { 38868 return ref(); 38869 }, 38870 set ref($$value) { 38871 ref($$value); 38872 } 38873 })); 38874 return pop($$exports); 38875 } 38876 create_custom_element(Date_picker_trigger, { 38877 ref: {}, 38878 onkeydown: {} 38879 }, [], [], { mode: "open" }); 38880 //#endregion 38881 //#region src/components/forms/ui/generic/DatePicker.svelte 38882 var root$16 = /* @__PURE__ */ from_html(`<!> <!>`, 1); 38883 var root_1$8 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1); 38884 function DatePicker_1($$anchor, $$props) { 38885 push($$props, true); 38886 let dateString = prop($$props, "dateString", 15), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7), labelText = prop($$props, "labelText", 7); 38887 let date = /* @__PURE__ */ state(proxy($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2()))); 38888 const uniqueId = "go-" + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); 38889 user_effect(() => { 38890 dateString(get$2(date).toString()); 38891 }); 38892 var $$exports = { 38893 get dateString() { 38894 return dateString(); 38895 }, 38896 set dateString($$value) { 38897 dateString($$value); 38898 flushSync(); 38899 }, 38900 get labelClass() { 38901 return labelClass(); 38902 }, 38903 set labelClass($$value) { 38904 labelClass($$value); 38905 flushSync(); 38906 }, 38907 get inputClass() { 38908 return inputClass(); 38909 }, 38910 set inputClass($$value) { 38911 inputClass($$value); 38912 flushSync(); 38913 }, 38914 get labelText() { 38915 return labelText(); 38916 }, 38917 set labelText($$value) { 38918 labelText($$value); 38919 flushSync(); 38920 } 38921 }; 38922 var fragment = comment(); 38923 var node = first_child(fragment); 38924 { 38925 let $0 = /* @__PURE__ */ user_derived(() => shop.locale || "de"); 38926 component(node, () => Date_picker, ($$anchor, DatePicker_Root) => { 38927 DatePicker_Root($$anchor, { 38928 get locale() { 38929 return get$2($0); 38930 }, 38931 weekStartsOn: 1, 38932 isDateDisabled: (date) => date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0, 38933 get value() { 38934 return get$2(date); 38935 }, 38936 set value($$value) { 38937 set(date, $$value, true); 38938 }, 38939 children: ($$anchor, $$slotProps) => { 38940 var fragment_1 = root_1$8();
38941 var node_1 = first_child(fragment_1); 38942 component(node_1, () => Date_field_label, ($$anchor, DatePicker_Label) => { 38943 DatePicker_Label($$anchor, { 38944 get id() { 38945 return uniqueId; 38946 }, 38947 get class() { 38948 return `go-datepicker-label ${labelClass() ?? ""}`; 38949 }, 38950 children: ($$anchor, $$slotProps) => { 38951 var fragment_2 = comment(); 38952 var node_2 = first_child(fragment_2); 38953 var consequent = ($$anchor) => { 38954 var fragment_3 = comment(); 38955 snippet(first_child(fragment_3), labelText); 38956 append($$anchor, fragment_3); 38957 }; 38958 if_block(node_2, ($$render) => { 38959 if (labelText()) $$render(consequent); 38960 }); 38961 append($$anchor, fragment_2); 38962 }, 38963 $$slots: { default: true } 38964 }); 38965 }); 38966 var node_4 = sibling(node_1, 2); 38967 { 38968 const children = ($$anchor, $$arg0) => { 38969 let segments = () => $$arg0?.().segments; 38970 var fragment_4 = root$16(); 38971 var node_5 = first_child(fragment_4); 38972 each(node_5, 17, segments, index$1, ($$anchor, $$item) => { 38973 let part = () => get$2($$item).part; 38974 let value = () => get$2($$item).value; 38975 var fragment_5 = comment(); 38976 component(first_child(fragment_5), () => Date_field_segment, ($$anchor, DatePicker_Segment) => { 38977 DatePicker_Segment($$anchor, { 38978 get part() { 38979 return part(); 38980 }, 38981 children: ($$anchor, $$slotProps) => { 38982 next(); 38983 var text = text$1(); 38984 template_effect(() => set_text(text, value())); 38985 append($$anchor, text); 38986 }, 38987 $$slots: { default: true } 38988 }); 38989 }); 38990 append($$anchor, fragment_5); 38991 }); 38992 component(sibling(node_5, 2), () => Date_picker_trigger, ($$anchor, DatePicker_Trigger) => { 38993 DatePicker_Trigger($$anchor, { 38994 get "aria-labelledby"() { 38995 return uniqueId; 38996 }, 38997 class: "go-calendar-button" 38998 }); 38999 }); 39000 append($$anchor, fragment_4); 39001 }; 39002 component(node_4, () => Date_field_input, ($$anchor, DatePicker_Input) => { 39003 DatePicker_Input($$anchor, { 39004 get class() { 39005 return `go-datepicker-input ${inputClass() ?? ""}`; 39006 }, 39007 children, 39008 $$slots: { default: true } 39009 }); 39010 }); 39011 } 39012 component(sibling(node_4, 2), () => Date_picker_content, ($$anchor, DatePicker_Content) => { 39013 DatePicker_Content($$anchor, { 39014 children: ($$anchor, $$slotProps) => { 39015 var fragment_7 = comment(); 39016 var node_9 = first_child(fragment_7); 39017 { 39018 const children = ($$anchor, $$arg0) => { 39019 let months = () => $$arg0?.().months; 39020 let weekdays = () => $$arg0?.().weekdays; 39021 var fragment_8 = root$16();
39022 var node_10 = first_child(fragment_8); 39023 component(node_10, () => Calendar_header, ($$anchor, DatePicker_Header) => { 39024 DatePicker_Header($$anchor, { 39025 children: ($$anchor, $$slotProps) => { 39026 var fragment_9 = root_1$8(); 39027 var node_11 = first_child(fragment_9); 39028 component(node_11, () => Calendar_prev_button, ($$anchor, DatePicker_PrevButton) => { 39029 DatePicker_PrevButton($$anchor, { class: "go-datepicker-previous" }); 39030 }); 39031 var node_12 = sibling(node_11, 2); 39032 component(node_12, () => Calendar_heading, ($$anchor, DatePicker_Heading) => { 39033 DatePicker_Heading($$anchor, { class: "go-datepicker-selected-month" }); 39034 }); 39035 component(sibling(node_12, 2), () => Calendar_next_button, ($$anchor, DatePicker_NextButton) => { 39036 DatePicker_NextButton($$anchor, { class: "go-datepicker-next" }); 39037 }); 39038 append($$anchor, fragment_9); 39039 }, 39040 $$slots: { default: true } 39041 }); 39042 }); 39043 each(sibling(node_10, 2), 16, months, (month) => month, ($$anchor, month) => { 39044 var fragment_10 = comment(); 39045 component(first_child(fragment_10), () => Calendar_grid, ($$anchor, DatePicker_Grid) => { 39046 DatePicker_Grid($$anchor, { 39047 children: ($$anchor, $$slotProps) => { 39048 var fragment_11 = root$16();
39049 var node_16 = first_child(fragment_11); 39050 component(node_16, () => Calendar_grid_head, ($$anchor, DatePicker_GridHead) => { 39051 DatePicker_GridHead($$anchor, { 39052 children: ($$anchor, $$slotProps) => { 39053 var fragment_12 = comment(); 39054 component(first_child(fragment_12), () => Calendar_grid_row, ($$anchor, DatePicker_GridRow) => { 39055 DatePicker_GridRow($$anchor, { 39056 children: ($$anchor, $$slotProps) => { 39057 var fragment_13 = comment(); 39058 each(first_child(fragment_13), 17, weekdays, index$1, ($$anchor, day) => { 39059 var fragment_14 = comment(); 39060 component(first_child(fragment_14), () => Calendar_head_cell, ($$anchor, DatePicker_HeadCell) => { 39061 DatePicker_HeadCell($$anchor, { 39062 children: ($$anchor, $$slotProps) => { 39063 next(); 39064 var text_1 = text$1(); 39065 template_effect(() => set_text(text_1, get$2(day))); 39066 append($$anchor, text_1); 39067 }, 39068 $$slots: { default: true } 39069 }); 39070 }); 39071 append($$anchor, fragment_14); 39072 }); 39073 append($$anchor, fragment_13); 39074 }, 39075 $$slots: { default: true } 39076 }); 39077 }); 39078 append($$anchor, fragment_12); 39079 }, 39080 $$slots: { default: true } 39081 }); 39082 }); 39083 component(sibling(node_16, 2), () => Calendar_grid_body, ($$anchor, DatePicker_GridBody) => { 39084 DatePicker_GridBody($$anchor, { 39085 children: ($$anchor, $$slotProps) => { 39086 var fragment_16 = comment(); 39087 each(first_child(fragment_16), 16, () => month.weeks, (weekDates) => weekDates, ($$anchor, weekDates) => { 39088 var fragment_17 = comment(); 39089 component(first_child(fragment_17), () => Calendar_grid_row, ($$anchor, DatePicker_GridRow_1) => { 39090 DatePicker_GridRow_1($$anchor, { 39091 children: ($$anchor, $$slotProps) => { 39092 var fragment_18 = comment(); 39093 each(first_child(fragment_18), 16, () => weekDates, (date) => date, ($$anchor, date, $$index_2, $$array) => { 39094 var fragment_19 = comment(); 39095 component(first_child(fragment_19), () => Calendar_cell, ($$anchor, DatePicker_Cell) => { 39096 DatePicker_Cell($$anchor, { 39097 get date() { 39098 return date; 39099 }, 39100 get month() { 39101 return month.value; 39102 }, 39103 children: ($$anchor, $$slotProps) => { 39104 var fragment_20 = comment(); 39105 component(first_child(fragment_20), () => Calendar_day, ($$anchor, DatePicker_Day) => { 39106 DatePicker_Day($$anchor, {}); 39107 }); 39108 append($$anchor, fragment_20); 39109 }, 39110 $$slots: { default: true } 39111 }); 39112 }); 39113 append($$anchor, fragment_19); 39114 }); 39115 append($$anchor, fragment_18); 39116 }, 39117 $$slots: { default: true } 39118 }); 39119 }); 39120 append($$anchor, fragment_17); 39121 }); 39122 append($$anchor, fragment_16); 39123 }, 39124 $$slots: { default: true } 39125 }); 39126 }); 39127 append($$anchor, fragment_11); 39128 }, 39129 $$slots: { default: true } 39130 }); 39131 }); 39132 append($$anchor, fragment_10); 39133 }); 39134 append($$anchor, fragment_8); 39135 }; 39136 component(node_9, () => Date_picker_calendar, ($$anchor, DatePicker_Calendar) => { 39137 DatePicker_Calendar($$anchor, { 39138 children, 39139 $$slots: { default: true } 39140 }); 39141 }); 39142 } 39143 append($$anchor, fragment_7); 39144 }, 39145 $$slots: { default: true } 39146 }); 39147 }); 39148 append($$anchor, fragment_1); 39149 }, 39150 $$slots: { default: true } 39151 }); 39152 }); 39153 } 39154 append($$anchor, fragment); 39155 return pop($$exports); 39156 }
39157 create_custom_element(DatePicker_1, { 39158 dateString: {}, 39159 labelClass: {}, 39160 inputClass: {}, 39161 labelText: {} 39162 }, [], [], { mode: "open" }); 39163 //#endregion 39164 //#region src/components/forms/ui/generic/InputAndLabel.svelte 39165 var rest_excludes = new Set([ 39166 "$$slots", 39167 "$$events", 39168 "$$legacy", 39169 "$$host", 39170 "field", 39171 "describedByIds", 39172 "labelClass", 39173 "inputClass", 39174 "host" 39175 ]); 39176 var root$15 = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidden="true">*</span>`); 39177 var root_1$7 = /* @__PURE__ */ from_html(` <!>`, 1); 39178 var root_2$6 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1); 39179 var root_3$6 = /* @__PURE__ */ from_html(`<label><!></label> <textarea></textarea>`, 1); 39180 var root_4$3 = /* @__PURE__ */ from_html(`<figure role="status" aria-live="polite"><img class="go-file-preview"/> <figcaption class="go-file-preview-caption"> </figcaption></figure>`); 39181 var root_5$1 = /* @__PURE__ */ from_html(`<label><!></label> <input/> <!>`, 1); 39182 var root_6$1 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`); 39183 var root_7$1 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1); 39184 var root_8$1 = /* @__PURE__ */ from_html(`<option disabled="" hidden="" selected=""> </option> <!>`, 1); 39185 var select_content = /* @__PURE__ */ from_html(`<!>`, 1); 39186 var root_9$1 = /* @__PURE__ */ from_html(`<label><!></label> <select><!></select>`, 1); 39187 var root_10$1 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`); 39188 var root_11 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`); 39189 var root_12 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-name"> </span>`); 39190 var root_13 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`); 39191 var root_14 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`); 39192 var root_15 = /* @__PURE__ */ from_html(`<label> <input/></label>`); 39193 var root_16 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`); 39194 function InputAndLabel($$anchor, $$props) { 39195 push($$props, true); 39196 const labelText = ($$anchor) => { 39197 next(); 39198 var fragment = root_1$7(); 39199 var text = first_child(fragment); 39200 var node = sibling(text); 39201 var consequent = ($$anchor) => { 39202 append($$anchor, root$15()); 39203 }; 39204 if_block(node, ($$render) => { 39205 if (field().required) $$render(consequent); 39206 }); 39207 template_effect(() => set_text(text, `${get$2(label) ?? ""} `)); 39208 append($$anchor, fragment); 39209 }; 39210 const input = ($$anchor) => { 39211 var fragment_1 = root_2$6(); 39212 var label_1 = first_child(fragment_1); 39213 labelText(child(label_1)); 39214 reset(label_1); 39215 var input_1 = sibling(label_1, 2); 39216 attribute_effect(input_1, () => ({ 39217 ...get$2(fieldAttributes), 39218 ...restProps, 39219 class: inputClass(), 39220 placeholder: field().placeholder, 39221 type: field().type, 39222 name: field().key 39223 }), void 0, void 0, void 0, void 0, true); 39224 template_effect(() => { 39225 set_class(label_1, 1, clsx(labelClass())); 39226 set_attribute(label_1, "for", get$2(inputId)); 39227 }); 39228 bind_value(input_1, () => field().value, ($$value) => field(field().value = $$value, true)); 39229 append($$anchor, fragment_1); 39230 }; 39231 const textarea = ($$anchor) => { 39232 var fragment_2 = root_3$6(); 39233 var label_2 = first_child(fragment_2); 39234 labelText(child(label_2)); 39235 reset(label_2); 39236 var textarea_1 = sibling(label_2, 2); 39237 remove_textarea_child(textarea_1); 39238 attribute_effect(textarea_1, () => ({ 39239 ...get$2(fieldAttributes), 39240 ...restProps, 39241 class: inputClass(), 39242 placeholder: field().placeholder, 39243 name: field().key 39244 })); 39245 template_effect(() => { 39246 set_class(label_2, 1, clsx(labelClass())); 39247 set_attribute(label_2, "for", get$2(inputId)); 39248 }); 39249 bind_value(textarea_1, () => field().value, ($$value) => field(field().value = $$value, true)); 39250 append($$anchor, fragment_2); 39251 }; 39252 const file = ($$anchor) => { 39253 var fragment_3 = root_5$1(); 39254 var label_3 = first_child(fragment_3); 39255 labelText(child(label_3)); 39256 reset(label_3); 39257 var input_2 = sibling(label_3, 2); 39258 var event_handler = (e) => { 39259 const files = e.currentTarget.files; 39260 field(field().value = files && files[0] ? files[0] : null, true); 39261 if (get$2(details)) get$2(details).validateField(field()); 39262 else field().validate(); 39263 }; 39264 attribute_effect(input_2, () => ({ 39265 ...get$2(fieldAttributes), 39266 ...restProps, 39267 class: inputClass(), 39268 type: "file", 39269 accept: "image/*", 39270 name: field().key, 39271 onchange: event_handler 39272 }), void 0, void 0, void 0, void 0, true); 39273 var node_4 = sibling(input_2, 2); 39274 var consequent_1 = ($$anchor) => { 39275 var figure = root_4$3(); 39276 var img = child(figure); 39277 var figcaption = sibling(img, 2); 39278 var text_1 = child(figcaption, true); 39279 reset(figcaption); 39280 reset(figure); 39281 template_effect(($0) => { 39282 set_attribute(figure, "data-field-preview", field().key); 39283 set_attribute(img, "src", get$2(filePreviewUrl)); 39284 set_attribute(img, "alt", $0); 39285 set_text(text_1, field().value.name); 39286 }, [() => shop.t("forms.file.preview_alt") || "User uploaded photo"]); 39287 append($$anchor, figure); 39288 }; 39289 if_block(node_4, ($$render) => { 39290 if (get$2(filePreviewUrl) && field().value instanceof File) $$render(consequent_1); 39291 }); 39292 template_effect(() => { 39293 set_class(label_3, 1, clsx(labelClass())); 39294 set_attribute(label_3, "for", get$2(inputId)); 39295 }); 39296 append($$anchor, fragment_3); 39297 }; 39298 const checkbox = ($$anchor) => { 39299 var label_4 = root_6$1(); 39300 var input_3 = child(label_4); 39301 attribute_effect(input_3, () => ({ 39302 ...get$2(fieldAttributes), 39303 ...restProps, 39304 name: field().key, 39305 type: "checkbox", 39306 value: "true" 39307 }), void 0, void 0, void 0, void 0, true); 39308 var span_1 = sibling(input_3, 2); 39309 labelText(child(span_1)); 39310 reset(span_1); 39311 reset(label_4); 39312 template_effect(() => { 39313 set_class(label_4, 1, clsx(labelClass())); 39314 set_attribute(label_4, "for", get$2(inputId)); 39315 }); 39316 bind_checked(input_3, () => { 39317 return field().value === true; 39318 }, (value) => { 39319 field(field().value = value, true); 39320 }); 39321 append($$anchor, label_4); 39322 }; 39323 const select = ($$anchor) => { 39324 var fragment_4 = root_9$1(); 39325 var label_5 = first_child(fragment_4); 39326 labelText(child(label_5)); 39327 reset(label_5); 39328 var select_1 = sibling(label_5, 2); 39329 attribute_effect(select_1, () => ({ 39330 ...get$2(fieldAttributes), 39331 ...restProps, 39332 name: field().key, 39333 class: inputClass() 39334 })); 39335 customizable_select(select_1, () => { 39336 var anchor = child(select_1); 39337 var fragment_5 = select_content(); 39338 var node_7 = first_child(fragment_5); 39339 var consequent_2 = ($$anchor) => { 39340 var fragment_6 = root_8$1(); 39341 var option_1 = first_child(fragment_6); 39342 var text_2 = child(option_1, true); 39343 reset(option_1); 39344 option_1.value = option_1.__value = ""; 39345 each(sibling(option_1, 2), 17, () => field().options(), (option) => option.value, ($$anchor, option) => { 39346 var fragment_7 = root_7$1(); 39347 var option_2 = sibling(first_child(fragment_7), 2); 39348 var text_3 = child(option_2, true); 39349 reset(option_2); 39350 var option_2_value = {}; 39351 template_effect(() => { 39352 set_text(text_3, get$2(option).label); 39353 if (option_2_value !== (option_2_value = get$2(option).value)) option_2.value = (option_2.__value = get$2(option).value) ?? ""; 39354 }); 39355 append($$anchor, fragment_7); 39356 }); 39357 template_effect(($0) => set_text(text_2, $0), [() => shop.t("common.choose")]); 39358 append($$anchor, fragment_6); 39359 }; 39360 if_block(node_7, ($$render) => { 39361 if (field().options) $$render(consequent_2); 39362 }); 39363 append(anchor, fragment_5); 39364 }); 39365 template_effect(() => { 39366 set_class(label_5, 1, clsx(labelClass())); 39367 set_attribute(label_5, "for", get$2(inputId)); 39368 }); 39369 bind_select_value(select_1, () => field().value, ($$value) =>
39369 field(field().value = $$value, true)); 39370 append($$anchor, fragment_4); 39371 }; 39372 const date = ($$anchor) => { 39373 DatePicker_1($$anchor, { 39374 get labelClass() { 39375 return labelClass(); 39376 }, 39377 get inputClass() { 39378 return inputClass(); 39379 }, 39380 get labelText() { 39381 return labelText; 39382 }, 39383 get dateString() { 39384 return field().value; 39385 }, 39386 set dateString($$value) { 39387 field(field().value = $$value, true); 39388 } 39389 }); 39390 }; 39391 const paymentMode = ($$anchor) => { 39392 const modes = /* @__PURE__ */ user_derived(() => shop.payment_modes ? Object.values(shop.payment_modes) : []); 39393 var fieldset = root_14(); 39394 var legend = child(fieldset); 39395 labelText(child(legend)); 39396 reset(legend); 39397 each(sibling(legend, 2), 17, () => get$2(modes), (mode) => mode.id, ($$anchor, mode) => { 39398 var label_6 = root_13(); 39399 var input_4 = child(label_6); 39400 remove_input_defaults(input_4); 39401 var node_11 = sibling(input_4, 2); 39402 var consequent_3 = ($$anchor) => { 39403 var span_2 = root_11(); 39404 each(span_2, 20, () => get$2(mode).icons, (icon) => icon, ($$anchor, icon) => { 39405 const url = /* @__PURE__ */ user_derived(() => CDN_PATH + icon + ".svg"); 39406 var img_1 = root_10$1(); 39407 template_effect(() => { 39408 set_class(img_1, 1, clsx(icon)); 39409 set_attribute(img_1, "src", get$2(url)); 39410 set_attribute(img_1, "alt", icon + " icon"); 39411 }); 39412 append($$anchor, img_1); 39413 }); 39414 reset(span_2); 39415 append($$anchor, span_2); 39416 }; 39417 var alternate = ($$anchor) => { 39418 var span_3 = root_12(); 39419 var text_4 = child(span_3, true); 39420 reset(span_3); 39421 template_effect(() => set_text(text_4, get$2(mode).name)); 39422 append($$anchor, span_3); 39423 }; 39424 if_block(node_11, ($$render) => { 39425 if (get$2(mode).icons.length > 0) $$render(consequent_3); 39426 else $$render(alternate, -1); 39427 }); 39428 reset(label_6); 39429 template_effect(($0, $1, $2) => { 39430 set_attribute(input_4, "name", field().key); 39431 set_value(input_4, $0); 39432 set_checked(input_4, $1); 39433 set_attribute(input_4, "hidden", get$2(modes).length === 1); 39434 set_attribute(input_4, "aria-label", $2); 39435 }, [ 39436 () => String(get$2(mode).id), 39437 () => field().value === String(get$2(mode).id), 39438 () => shop.t(`cart.paymentMode.ariaLabel.${get$2(mode).name.toLowerCase()}`) 39439 ]); 39440 delegated("change", input_4, () => { 39441 field(field().value = String(get$2(mode).id), true); 39442 }); 39443 append($$anchor, label_6); 39444 }); 39445 reset(fieldset); 39446 template_effect(() => { 39447 set_attribute(fieldset, "aria-required", field().required); 39448 set_attribute(fieldset, "aria-invalid", field().errors.length > 0); 39449 }); 39450 append($$anchor, fieldset); 39451 }; 39452 const radio = ($$anchor) => { 39453 var fieldset_1 = root_16(); 39454 var legend_1 = child(fieldset_1); 39455 labelText(child(legend_1)); 39456 reset(legend_1); 39457 var node_13 = sibling(legend_1, 2); 39458 var consequent_4 = ($$anchor) => { 39459 var fragment_9 = comment(); 39460 each(first_child(fragment_9), 17, () => field().options(), (option) => option.value, ($$anchor, option) => { 39461 var label_7 = root_15(); 39462 var text_5 = child(label_7); 39463 var input_5 = sibling(text_5); 39464 attribute_effect(input_5, () => ({ 39465 ...get$2(fieldAttributes), 39466 ...restProps, 39467 class: inputClass(), 39468 type: "radio" 39469 }), void 0, void 0, void 0, void 0, true); 39470 reset(label_7); 39471 template_effect(() => { 39472 set_class(label_7, 1, clsx(labelClass())); 39473 set_attribute(label_7, "for", get$2(inputId) + get$2(option).value); 39474 set_text(text_5, `${get$2(option).label ?? ""} `); 39475 }); 39476 bind_value(input_5, () => field().value, ($$value) => field(field().value = $$value, true)); 39477 append($$anchor, label_7); 39478 }); 39479 append($$anchor, fragment_9); 39480 }; 39481 if_block(node_13, ($$render) => { 39482 if (field().options) $$render(consequent_4); 39483 }); 39484 reset(fieldset_1); 39485 append($$anchor, fieldset_1); 39486 }; 39487 let field = prop($$props, "field", 15), describedByIds = prop($$props, "describedByIds", 7), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7), host = prop($$props, "host", 7), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes);
39488 const _details = getDetails$1(host()); 39489 const details = /* @__PURE__ */ user_derived(() => _details.value); 39490 const map = { 39491 input, 39492 text: input, 39493 email: input, 39494 password: input, 39495 search: input, 39496 tel: input, 39497 url: input, 39498 number: input, 39499 checkbox, 39500 select, 39501 radio, 39502 date, 39503 file, 39504 textarea, 39505 paymentMode 39506 }; 39507 const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]); 39508 let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`); 39509 function onblur() { 39510 if (field().type === "checkbox") return; 39511 if (field().value) if (get$2(details)) get$2(details).validateField(field()); 39512 else field().validate(); 39513 } 39514 const fieldAttributes = /* @__PURE__ */ user_derived(() => ({ 39515 id: get$2(inputId), 39516 "aria-describedby": describedByIds(), 39517 "aria-required": field().required, 39518 "aria-invalid": field().errors.length > 0, 39519 autocomplete: field().autocomplete, 39520 onblur 39521 })); 39522 let label = /* @__PURE__ */ user_derived(() => shop.t(field().label) || field().label); 39523 const CDN_PATH = `https://cdn.shop.platform.gomus.de/`; 39524 user_effect(() => { 39525 if (field().type !== "paymentMode") return; 39526 const modes = shop.payment_modes ? Object.values(shop.payment_modes) : []; 39527 if (modes.length === 1 && field().value === "") field(field().value = String(modes[0].id), true); 39528 }); 39529 let filePreviewUrl = /* @__PURE__ */ state(null); 39530 user_effect(() => { 39531 const value = field().value; 39532 if (value instanceof File && value.type.startsWith("image/")) { 39533 const url = URL.createObjectURL(value); 39534 set(filePreviewUrl, url, true); 39535 return () => { 39536 URL.revokeObjectURL(url); 39537 set(filePreviewUrl, null); 39538 }; 39539 } 39540 set(filePreviewUrl, null); 39541 }); 39542 var $$exports = { 39543 get field() { 39544 return field(); 39545 }, 39546 set field($$value) { 39547 field($$value); 39548 flushSync(); 39549 }, 39550 get describedByIds() { 39551 return describedByIds(); 39552 }, 39553 set describedByIds($$value) { 39554 describedByIds($$value); 39555 flushSync(); 39556 }, 39557 get labelClass() { 39558 return labelClass(); 39559 }, 39560 set labelClass($$value) { 39561 labelClass($$value); 39562 flushSync(); 39563 }, 39564 get inputClass() { 39565 return inputClass(); 39566 }, 39567 set inputClass($$value) { 39568 inputClass($$value); 39569 flushSync(); 39570 }, 39571 get host() { 39572 return host(); 39573 }, 39574 set host($$value) { 39575 host($$value); 39576 flushSync(); 39577 } 39578 }; 39579 var fragment_10 = comment(); 39580 var node_15 = first_child(fragment_10); 39581 var consequent_5 = ($$anchor) => { 39582 var fragment_11 = comment(); 39583 snippet(first_child(fragment_11), () => get$2(snippet$1)); 39584 append($$anchor, fragment_11); 39585 }; 39586 if_block(node_15, ($$render) => { 39587 if (get$2(snippet$1)) $$render(consequent_5); 39588 }); 39589 append($$anchor, fragment_10); 39590 return pop($$exports); 39591 } 39592 delegate(["change"]); 39593 create_custom_element(InputAndLabel, { 39594 field: {}, 39595 describedByIds: {}, 39596 labelClass: {}, 39597 inputClass: {}, 39598 host: {} 39599 }, [], [], { mode: "open" }); 39600 //#endregion 39601 //#region src/components/forms/ui/generic/Field.svelte 39602 var root$14 = /* @__PURE__ */ from_html(`<span> </span>`); 39603 var root_1$6 = /* @__PURE__ */ from_html(`<li> </li>`); 39604 var root_2$5 = /* @__PURE__ */ from_html(`<ul class="go-field-errors"></ul>`); 39605 var root_3$5 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1); 39606 function Field($$anchor, $$props) { 39607 push($$props, true); 39608 let key = prop($$props, "key", 7), required = prop($$props, "required", 7, false), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7); 39609 let field = /* @__PURE__ */ state(proxy(Forms.createField(key(), required()))); 39610 const _details = getDetails$1($$props.$$host); 39611 const details = /* @__PURE__ */ user_derived(() => _details.value); 39612 const getField = () => get$2(field); 39613 let allErrors = /* @__PURE__ */ user_derived(() => get$2(field) ? [...get$2(field).errors, ...get$2(field).apiErrors].map((e) => shop.t(e)) : []); 39614 let hasDescription = /* @__PURE__ */ user_derived(() => get$2(field)?.description); 39615 let hasErrors = /* @__PURE__ */ user_derived(() => get$2(allErrors).length > 0); 39616 let descriptionId = /* @__PURE__ */ user_derived(() => `go-description-${key()}-${Math.floor(Math.random() * 100)}`); 39617 let errorsId = /* @__PURE__ */ user_derived(() => `go-errors-${key()}-${Math.floor(Math.random() * 100)}`); 39618 let describedByIds = /* @__PURE__ */ user_derived(() => [get$2(hasDescription) && get$2(descriptionId), get$2(hasErrors) && get$2(errorsId)].filter(
39618Boolean).join(" ") || void 0); 39619 user_effect(() => { 39620 $$props.$$host.classList.toggle("go-field", true); 39621 $$props.$$host.classList.toggle("is-invalid", get$2(allErrors).length > 0); 39622 }); 39623 $$props.$$host.dataset.testid = key(); 39624 user_effect(() => { 39625 if (!get$2(field)) return; 39626 get$2(field).mounted = true; 39627 get$2(field).value; 39628 untrack(() => { 39629 if (get$2(field)?.errors.length) get$2(details).validateField(get$2(field)); 39630 }); 39631 }); 39632 var $$exports = { 39633 getField, 39634 get key() { 39635 return key(); 39636 }, 39637 set key($$value) { 39638 key($$value); 39639 flushSync(); 39640 }, 39641 get required() { 39642 return required(); 39643 }, 39644 set required($$value = false) { 39645 required($$value); 39646 flushSync(); 39647 }, 39648 get labelClass() { 39649 return labelClass(); 39650 }, 39651 set labelClass($$value) { 39652 labelClass($$value); 39653 flushSync(); 39654 }, 39655 get inputClass() { 39656 return inputClass(); 39657 }, 39658 set inputClass($$value) { 39659 inputClass($$value); 39660 flushSync(); 39661 } 39662 }; 39663 var fragment = root_3$5(); 39664 var node = first_child(fragment); 39665 InputAndLabel(node, { 39666 get describedByIds() { 39667 return get$2(describedByIds); 39668 }, 39669 get labelClass() { 39670 return labelClass(); 39671 }, 39672 get inputClass() { 39673 return inputClass(); 39674 }, 39675 host: $$props.$$host, 39676 get field() { 39677 return get$2(field); 39678 }, 39679 set field($$value) { 39680 set(field, $$value, true); 39681 } 39682 }); 39683 var node_1 = sibling(node, 2); 39684 var consequent = ($$anchor) => { 39685 var span = root$14(); 39686 var text = child(span, true); 39687 reset(span); 39688 template_effect(() => { 39689 set_attribute(span, "id", get$2(descriptionId)); 39690 set_text(text, get$2(field).description); 39691 }); 39692 append($$anchor, span); 39693 }; 39694 if_block(node_1, ($$render) => { 39695 if (get$2(hasDescription)) $$render(consequent); 39696 }); 39697 var node_2 = sibling(node_1, 2); 39698 var consequent_1 = ($$anchor) => { 39699 var ul = root_2$5(); 39700 each(ul, 21, () => get$2(allErrors), index$1, ($$anchor, error) => { 39701 var li = root_1$6(); 39702 var text_1 = child(li, true); 39703 reset(li); 39704 template_effect(() => set_text(text_1, get$2(error))); 39705 append($$anchor, li); 39706 }); 39707 reset(ul); 39708 template_effect(() => set_attribute(ul, "id", get$2(errorsId))); 39709 append($$anchor, ul); 39710 }; 39711 if_block(node_2, ($$render) => { 39712 if (get$2(hasErrors)) $$render(consequent_1); 39713 }); 39714 append($$anchor, fragment); 39715 return pop($$exports); 39716 } 39717 customElements.define("go-field", create_custom_element(Field, { 39718 key: { 39719 attribute: "key", 39720 reflect: true, 39721 type: "String" 39722 }, 39723 required: { 39724 attribute: "required", 39725 reflect: true, 39726 type: "Boolean" 39727 }, 39728 labelClass: { 39729 attribute: "label-class", 39730 reflect: true, 39731 type: "String" 39732 }, 39733 inputClass: { 39734 attribute: "input-class", 39735 reflect: true, 39736 type: "String" 39737 } 39738 }, [], ["getField"])); 39739 //#endregion 39740 //#region src/components/forms/ui/generic/AllFields.svelte 39741 var root$13 = /* @__PURE__ */ from_html(`<go-field></go-field>`, 2); 39742 function AllFields($$anchor, $$props) { 39743 push($$props, true); 39744 let _details = getDetails$1($$props.$$host); 39745 let details = /* @__PURE__ */ user_derived(() => _details.value); 39746 let allFields = /* @__PURE__ */ user_derived(() => get$2(details) ? Forms.getFormFields(get$2(details)?.formId) : []); 39747 var fragment = comment(); 39748 each(first_child(fragment), 17, () => get$2(allFields), (field) => field.key, ($$anchor, field) => { 39749 var go_field = root$13(); 39750 template_effect(() => set_custom_element_data(go_field, "key", get$2(field).key)); 39751 template_effect(() => set_custom_element_data(go_field, "required", get$2(field).required)); 39752 append($$anchor, go_field); 39753 }); 39754 append($$anchor, fragment); 39755 pop(); 39756 } 39757 customElements.define("go-all-fields", create_custom_element(AllFields, {}, [], [])); 39758 //#endregion 39759 //#region src/components/forms/ui/generic/ErrorsFeedback.svelte 39760 var root$12 = /* @__PURE__ */ from_html(`<p aria-hidden="true"> </p>`); 39761 var root_1$5 = /* @__PURE__ */ from_html(`<li> </li>`); 39762 var root_2$4 = /* @__PURE__ */ from_html(`<ul class="go-error-feedback-api-errors"></ul>`); 39763 var root_3$4 = /* @__PURE__ */ from_html(`<div><p aria-live="assertive" class="sr-only"><!></p> <!> <!></div>`); 39764 function ErrorsFeedback($$anchor, $$props) { 39765 push($$props, true);
39766 const _details = getDetails$1($$props.$$host); 39767 const details = /* @__PURE__ */ user_derived(() => _details.value); 39768 user_effect(() => { 39769 get$2(details)?.form?.addEventListener("go-after-validation", () => { 39770 set(errorsOnSubmit, errors(get$2(details)?.fields), true); 39771 }); 39772 }); 39773 let errorsRealtime = /* @__PURE__ */ state(0); 39774 setInterval(() => { 39775 set(errorsRealtime, errors(get$2(details)?.fields) || 0, true); 39776 }, 100); 39777 let numErrors = /* @__PURE__ */ user_derived(() => get$2(errorsRealtime) + (get$2(details)?.apiErrors?.length || 0)); 39778 let errorsOnSubmit = /* @__PURE__ */ state(-1); 39779 user_effect(() => { 39780 $$props.$$host.classList.toggle("is-invalid", get$2(numErrors) > 0); 39781 $$props.$$host.classList.toggle("go-feedback", true); 39782 $$props.$$host.setAttribute("data-num-errors", get$2(numErrors).toString()); 39783 }); 39784 var div = root_3$4(); 39785 var p = child(div); 39786 var node = child(p); 39787 var consequent = ($$anchor) => { 39788 var text = text$1(); 39789 template_effect(($0) => set_text(text, $0), [() => shop.t("forms.errorSummary", { count: get$2(errorsOnSubmit) })]); 39790 append($$anchor, text); 39791 }; 39792 if_block(node, ($$render) => { 39793 if (get$2(errorsOnSubmit) > 0) $$render(consequent); 39794 }); 39795 reset(p); 39796 var node_1 = sibling(p, 2); 39797 var consequent_1 = ($$anchor) => { 39798 var p_1 = root$12(); 39799 var text_1 = child(p_1, true); 39800 reset(p_1); 39801 template_effect(($0) => set_text(text_1, $0), [() => shop.t("forms.errorSummary", { count: get$2(errorsRealtime) })]); 39802 append($$anchor, p_1); 39803 }; 39804 if_block(node_1, ($$render) => { 39805 if (get$2(errorsRealtime) > 0) $$render(consequent_1); 39806 }); 39807 var node_2 = sibling(node_1, 2); 39808 var consequent_2 = ($$anchor) => { 39809 var ul = root_2$4(); 39810 each(ul, 21, () => get$2(details)?.apiErrors, index$1, ($$anchor, error) => { 39811 var li = root_1$5(); 39812 var text_2 = child(li, true); 39813 reset(li); 39814 template_effect(() => set_text(text_2, get$2(error))); 39815 append($$anchor, li); 39816 }); 39817 reset(ul); 39818 append($$anchor, ul); 39819 }; 39820 var d = /* @__PURE__ */ user_derived(() => get$2(details) && isArray(get$2(details).apiErrors) && get$2(details).apiErrors.length > 0); 39821 if_block(node_2, ($$render) => { 39822 if (get$2(d)) $$render(consequent_2); 39823 }); 39824 reset(div); 39825 append($$anchor, div); 39826 pop(); 39827 } 39828 customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], [])); 39829 //#endregion 39830 //#region src/components/forms/ui/generic/FormFeedback.svelte 39831 var root$11 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`); 39832 function FormFeedback($$anchor, $$props) { 39833 var div = root$11(); 39834 slot(child(div), $$props, "default", {}, null); 39835 reset(div); 39836 append($$anchor, div); 39837 } 39838 customElements.define("go-form-feedback", create_custom_element(FormFeedback, {}, ["default"], [])); 39839 //#endregion 39840 //#region src/components/forms/ui/generic/Submit.svelte 39841 function Submit($$anchor, $$props) { 39842 push($$props, true); 39843 let buttonClass = prop($$props, "buttonClass", 7, ""); 39844 onMount(() => { 39845 wrapInElement($$props.$$host, "button", { 39846 type: "submit", 39847 class: buttonClass() 39848 }); 39849 }); 39850 return pop({ 39851 get buttonClass() { 39852 return buttonClass(); 39853 }, 39854 set buttonClass($$value = "") { 39855 buttonClass($$value); 39856 flushSync(); 39857 } 39858 }); 39859 } 39860 customElements.define("go-submit", create_custom_element(Submit, { buttonClass: { 39861 attribute: "button-class", 39862 reflect: true, 39863 type: "String" 39864 } }, [], [])); 39865 //#endregion 39866 //#region src/components/forms/ui/generic/SuccessFeedback.svelte 39867 var root$10 = /* @__PURE__ */ from_html(`<div aria-live="assertive"> </div>`); 39868 function SuccessFeedback($$anchor, $$props) { 39869 push($$props, true); 39870 const _details = getDetails$1($$props.$$host); 39871 const details = /* @__PURE__ */ user_derived(() => _details.value); 39872 var fragment = comment(); 39873 var node = first_child(fragment); 39874 var consequent = ($$anchor) => { 39875 var div = root$10(); 39876 let classes; 39877 var text = child(div, true); 39878 reset(div); 39879 template_effect(() => { 39880 classes = set_class(div, 1, "go-success-feedback go-feedback", null, classes, { "is-successful": get$2(details).successMessage }); 39881 set_text(text, get$2(details)?.successMessage); 39882 }); 39883 append($$anchor, div); 39884 }; 39885 if_block(node, ($$render) => { 39886 if (get$2(details)?.successMessage) $$render(consequent); 39887 }); 39888 append($$anchor, fragment); 39889 pop(); 39890 } 39891 customElements.define("go-success-feedback", create_custom_element
39891(SuccessFeedback, {}, [], [])); 39892 //#endregion 39893 //#region ../../node_modules/.pnpm/[email protected]/node_modules/expr-eval/dist/index.mjs 39894 var INUMBER = "INUMBER"; 39895 var IOP1 = "IOP1"; 39896 var IOP2 = "IOP2"; 39897 var IOP3 = "IOP3"; 39898 var IVAR = "IVAR"; 39899 var IVARNAME = "IVARNAME"; 39900 var IFUNCALL = "IFUNCALL"; 39901 var IFUNDEF = "IFUNDEF"; 39902 var IEXPR = "IEXPR"; 39903 var IEXPREVAL = "IEXPREVAL"; 39904 var IMEMBER = "IMEMBER"; 39905 var IENDSTATEMENT = "IENDSTATEMENT"; 39906 var IARRAY = "IARRAY"; 39907 function Instruction(type, value) { 39908 this.type = type; 39909 this.value = value !== void 0 && value !== null ? value : 0; 39910 } 39911 Instruction.prototype.toString = function() { 39912 switch (this.type) { 39913 case INUMBER: 39914 case IOP1: 39915 case IOP2: 39916 case IOP3: 39917 case IVAR: 39918 case IVARNAME: 39919 case IENDSTATEMENT: return this.value; 39920 case IFUNCALL: return "CALL " + this.value; 39921 case IFUNDEF: return "DEF " + this.value; 39922 case IARRAY: return "ARRAY " + this.value; 39923 case IMEMBER: return "." + this.value; 39924 default: return "Invalid Instruction"; 39925 } 39926 }; 39927 function unaryInstruction(value) { 39928 return new Instruction(IOP1, value); 39929 } 39930 function binaryInstruction(value) { 39931 return new Instruction(IOP2, value); 39932 } 39933 function ternaryInstruction(value) { 39934 return new Instruction(IOP3, value); 39935 } 39936 function simplify(tokens, unaryOps, binaryOps, ternaryOps, values) { 39937 var nstack = []; 39938 var newexpression = []; 39939 var n1, n2, n3; 39940 var f; 39941 for (var i = 0; i < tokens.length; i++) { 39942 var item = tokens[i]; 39943 var type = item.type; 39944 if (type === INUMBER || type === IVARNAME) if (Array.isArray(item.value)) nstack.push.apply(nstack, simplify(item.value.map(function(x) { 39945 return new Instruction(INUMBER, x); 39946 }).concat(new Instruction(IARRAY, item.value.length)), unaryOps, binaryOps, ternaryOps, values)); 39947 else nstack.push(item); 39948 else if (type === IVAR && values.hasOwnProperty(item.value)) { 39949 item = new Instruction(INUMBER, values[item.value]); 39950 nstack.push(item); 39951 } else if (type === IOP2 && nstack.length > 1) { 39952 n2 = nstack.pop(); 39953 n1 = nstack.pop(); 39954 f = binaryOps[item.value]; 39955 item = new Instruction(INUMBER, f(n1.value, n2.value)); 39956 nstack.push(item); 39957 } else if (type === IOP3 && nstack.length > 2) { 39958 n3 = nstack.pop(); 39959 n2 = nstack.pop(); 39960 n1 = nstack.pop(); 39961 if (item.value === "?") nstack.push(n1.value ? n2.value : n3.value); 39962 else { 39963 f = ternaryOps[item.value]; 39964 item = new Instruction(INUMBER, f(n1.value, n2.value, n3.value)); 39965 nstack.push(item); 39966 } 39967 } else if (type === IOP1 && nstack.length > 0) { 39968 n1 = nstack.pop(); 39969 f = unaryOps[item.value]; 39970 item = new Instruction(INUMBER, f(n1.value)); 39971 nstack.push(item); 39972 } else if (type === IEXPR) { 39973 while (nstack.length > 0) newexpression.push(nstack.shift()); 39974 newexpression.push(new Instruction(IEXPR, simplify(item.value, unaryOps, binaryOps, ternaryOps, values))); 39975 } else if (type === IMEMBER && nstack.length > 0) { 39976 n1 = nstack.pop(); 39977 nstack.push(new Instruction(INUMBER, n1.value[item.value])); 39978 } else { 39979 while (nstack.length > 0) newexpression.push(nstack.shift()); 39980 newexpression.push(item); 39981 } 39982 } 39983 while (nstack.length > 0) newexpression.push(nstack.shift()); 39984 return newexpression; 39985 } 39986 function substitute(tokens, variable, expr) { 39987 var newexpression = []; 39988 for (var i = 0; i < tokens.length; i++) { 39989 var item = tokens[i]; 39990 var type = item.type; 39991 if (type === IVAR && item.value === variable) for (var j = 0; j < expr.tokens.length; j++) { 39992 var expritem = expr.tokens[j]; 39993 var replitem; 39994 if (expritem.type === IOP1) replitem = unaryInstruction(expritem.value); 39995 else if (expritem.type === IOP2) replitem = binaryInstruction(expritem.value); 39996 else if (expritem.type === IOP3) replitem = ternaryInstruction(expritem.value); 39997 else replitem = new Instruction(expritem.type, expritem.value); 39998 newexpression.push(replitem); 39999 } 40000 else if (type === IEXPR) newexpression.push(new Instruction(IEXPR, substitute(item.value, variable, expr))); 40001 else newexpression.push(item); 40002 } 40003 return newexpression; 40004 } 40005 function evaluate(tokens, expr, values) { 40006 var nstack = []; 40007 var n1, n2, n3; 40008 var f, args, argCount; 40009 if (isExpressionEvaluator(tokens)) return resolveExpression(tokens, values); 40010 var numTokens = tokens.length; 40011 for (var i = 0; i < numTokens; i++) { 40012 var item = tokens[i]; 40013 var type = item.type; 40014 if (type === INUMBER || type === IVARNAME) nstack.push(item.value); 40015 else if (type === IOP2) { 40016 n2 = nstack.pop(); 40017 n1 = nstack.pop(); 40018 if (item.value === "and") nstack.push(n1 ? !!evaluate(n2, expr, values) : false); 40019 else if (item.value === "or") nstack.push(n1 ? true : !!evaluate(n2, expr, values)); 40020 else if (item.value === "=") { 40021 f = expr.binaryOps[item.value]; 40022 nstack.push(f(n1, evaluate(n2, expr, values), values)); 40023 } else { 40024 f = expr.binaryOps[item.value]; 40025 nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values))); 40026 } 40027 } else if (type === IOP3) { 40028 n3 = nstack.pop(); 40029 n2 = nstack.pop(); 40030 n1 = nstack.pop(); 40031 if (item.value === "?") nstack.push(evaluate(n1 ? n2 : n3, expr, values)); 40032 else { 40033 f = expr.ternaryOps[item.value]; 40034 nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values), resolveExpression(n3, values))); 40035 } 40036 } else if (type === IVAR) if (item.value in expr.functions) nstack.push(expr.functions[item.value]); 40037 else if (item.value in expr.unaryOps && expr.parser.isOperatorEnabled(item.value)) nstack.push(expr.unaryOps[item.value]); 40038 else { 40039 var v = values[item.value]; 40040 if (v !== void 0) nstack.push(v); 40041 else throw new Error("undefined variable: " + item.value); 40042 } 40043 else if (type === IOP1) { 40044 n1 = nstack.pop(); 40045 f = expr.unaryOps[item.value]; 40046 nstack.push(f(resolveExpression(n1, values))); 40047 } else if (type === IFUNCALL) { 40048 argCount = item.value; 40049 args = []; 40050 while (argCount-- > 0) args.unshift(resolveExpression(nstack.pop(), values)); 40051 f = nstack.pop(); 40052 if (f.apply && f.call) nstack.push(f.apply(void 0, args)); 40053 else throw new Error(f + " is not a function"); 40054 } else if (type === IFUNDEF) nstack.push((function() { 40055 var n2 = nstack.pop(); 40056 var args = []; 40057 var argCount = item.value; 40058 while (argCount-- > 0) args.unshift(nstack.pop()); 40059 var n1 = nstack.pop(); 40060 var f = function() { 40061 var scope = Object.assign({}, values); 40062 for (var i = 0, len = args.length; i < len; i++) scope[args[i]] = arguments[i]; 40063 return evaluate(n2, expr, scope); 40064 }; 40065 Object.defineProperty(f, "name", { 40066 value: n1, 40067 writable: false 40068 });
40069 values[n1] = f; 40070 return f; 40071 })()); 40072 else if (type === IEXPR) nstack.push(createExpressionEvaluator(item, expr)); 40073 else if (type === IEXPREVAL) nstack.push(item); 40074 else if (type === IMEMBER) { 40075 n1 = nstack.pop(); 40076 nstack.push(n1[item.value]); 40077 } else if (type === IENDSTATEMENT) nstack.pop(); 40078 else if (type === IARRAY) { 40079 argCount = item.value; 40080 args = []; 40081 while (argCount-- > 0) args.unshift(nstack.pop()); 40082 nstack.push(args); 40083 } else throw new Error("invalid Expression"); 40084 } 40085 if (nstack.length > 1) throw new Error("invalid Expression (parity)"); 40086 return nstack[0] === 0 ? 0 : resolveExpression(nstack[0], values); 40087 } 40088 function createExpressionEvaluator(token, expr, values) { 40089 if (isExpressionEvaluator(token)) return token; 40090 return { 40091 type: IEXPREVAL, 40092 value: function(scope) { 40093 return evaluate(token.value, expr, scope); 40094 } 40095 }; 40096 } 40097 function isExpressionEvaluator(n) { 40098 return n && n.type === IEXPREVAL; 40099 } 40100 function resolveExpression(n, values) { 40101 return isExpressionEvaluator(n) ? n.value(values) : n; 40102 } 40103 function expressionToString(tokens, toJS) { 40104 var nstack = []; 40105 var n1, n2, n3; 40106 var f, args, argCount; 40107 for (var i = 0; i < tokens.length; i++) { 40108 var item = tokens[i]; 40109 var type = item.type; 40110 if (type === INUMBER) if (typeof item.value === "number" && item.value < 0) nstack.push("(" + item.value + ")"); 40111 else if (Array.isArray(item.value)) nstack.push("[" + item.value.map(escapeValue).join(", ") + "]"); 40112 else nstack.push(escapeValue(item.value)); 40113 else if (type === IOP2) { 40114 n2 = nstack.pop(); 40115 n1 = nstack.pop(); 40116 f = item.value; 40117 if (toJS) if (f === "^") nstack.push("Math.pow(" + n1 + ", " + n2 + ")"); 40118 else if (f === "and") nstack.push("(!!" + n1 + " && !!" + n2 + ")"); 40119 else if (f === "or") nstack.push("(!!" + n1 + " || !!" + n2 + ")"); 40120 else if (f === "||") nstack.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }((" + n1 + "),(" + n2 + ")))"); 40121 else if (f === "==") nstack.push("(" + n1 + " === " + n2 + ")"); 40122 else if (f === "!=") nstack.push("(" + n1 + " !== " + n2 + ")"); 40123 else if (f === "[") nstack.push(n1 + "[(" + n2 + ") | 0]"); 40124 else nstack.push("(" + n1 + " " + f + " " + n2 + ")"); 40125 else if (f === "[") nstack.push(n1 + "[" + n2 + "]"); 40126 else nstack.push("(" + n1 + " " + f + " " + n2 + ")"); 40127 } else if (type === IOP3) { 40128 n3 = nstack.pop(); 40129 n2 = nstack.pop(); 40130 n1 = nstack.pop(); 40131 f = item.value; 40132 if (f === "?") nstack.push("(" + n1 + " ? " + n2 + " : " + n3 + ")"); 40133 else throw new Error("invalid Expression"); 40134 } else if (type === IVAR || type === IVARNAME) nstack.push(item.value); 40135 else if (type === IOP1) { 40136 n1 = nstack.pop(); 40137 f = item.value; 40138 if (f === "-" || f === "+") nstack.push("(" + f + n1 + ")"); 40139 else if (toJS) if (f === "not") nstack.push("(!" + n1 + ")"); 40140 else if (f === "!") nstack.push("fac(" + n1 + ")"); 40141 else nstack.push(f + "(" + n1 + ")"); 40142 else if (f === "!") nstack.push("(" + n1 + "!)"); 40143 else nstack.push("(" + f + " " + n1 + ")"); 40144 } else if (type === IFUNCALL) { 40145 argCount = item.value; 40146 args = []; 40147 while (argCount-- > 0) args.unshift(nstack.pop()); 40148 f = nstack.pop(); 40149 nstack.push(f + "(" + args.join(", ") + ")"); 40150 } else if (type === IFUNDEF) { 40151 n2 = nstack.pop(); 40152 argCount = item.value; 40153 args = []; 40154 while (argCount-- > 0) args.unshift(nstack.pop()); 40155 n1 = nstack.pop(); 40156 if (toJS) nstack.push("(" + n1 + " = function(" + args.join(", ") + ") { return " + n2 + " })"); 40157 else nstack.push("(" + n1 + "(" + args.join(", ") + ") = " + n2 + ")"); 40158 } else if (type === IMEMBER) { 40159 n1 = nstack.pop(); 40160 nstack.push(n1 + "." + item.value); 40161 } else if (type === IARRAY) { 40162 argCount = item.value; 40163 args = []; 40164 while (argCount-- > 0) args.unshift(nstack.pop()); 40165 nstack.push("[" + args.join(", ") + "]"); 40166 } else if (type === IEXPR) nstack.push("(" + expressionToString(item.value, toJS) + ")"); 40167 else if (type === IENDSTATEMENT); 40168 else throw new Error("invalid Expression"); 40169 } 40170 if (nstack.length > 1) if (toJS) nstack = [nstack.join(",")]; 40171 else nstack = [nstack.join(";")]; 40172 return String(nstack[0]); 40173 } 40174 function escapeValue(v) { 40175 if (typeof v === "string") return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); 40176 return v; 40177 } 40178 function contains(array, obj) { 40179 for (var i = 0; i < array.length; i++) if (array[i] === obj) return true; 40180 return false;
40181 } 40182 function getSymbols(tokens, symbols, options) { 40183 options = options || {}; 40184 var withMembers = !!options.withMembers; 40185 var prevVar = null; 40186 for (var i = 0; i < tokens.length; i++) { 40187 var item = tokens[i]; 40188 if (item.type === IVAR || item.type === IVARNAME) if (!withMembers && !contains(symbols, item.value)) symbols.push(item.value); 40189 else if (prevVar !== null) { 40190 if (!contains(symbols, prevVar)) symbols.push(prevVar); 40191 prevVar = item.value; 40192 } else prevVar = item.value; 40193 else if (item.type === IMEMBER && withMembers && prevVar !== null) prevVar += "." + item.value; 40194 else if (item.type === IEXPR) getSymbols(item.value, symbols, options); 40195 else if (prevVar !== null) { 40196 if (!contains(symbols, prevVar)) symbols.push(prevVar); 40197 prevVar = null; 40198 } 40199 } 40200 if (prevVar !== null && !contains(symbols, prevVar)) symbols.push(prevVar); 40201 } 40202 function Expression(tokens, parser) { 40203 this.tokens = tokens; 40204 this.parser = parser; 40205 this.unaryOps = parser.unaryOps; 40206 this.binaryOps = parser.binaryOps; 40207 this.ternaryOps = parser.ternaryOps; 40208 this.functions = parser.functions; 40209 } 40210 Expression.prototype.simplify = function(values) { 40211 values = values || {}; 40212 return new Expression(simplify(this.tokens, this.unaryOps, this.binaryOps, this.ternaryOps, values), this.parser); 40213 }; 40214 Expression.prototype.substitute = function(variable, expr) { 40215 if (!(expr instanceof Expression)) expr = this.parser.parse(String(expr)); 40216 return new Expression(substitute(this.tokens, variable, expr), this.parser); 40217 }; 40218 Expression.prototype.evaluate = function(values) { 40219 values = values || {}; 40220 return evaluate(this.tokens, this, values); 40221 }; 40222 Expression.prototype.toString = function() { 40223 return expressionToString(this.tokens, false); 40224 }; 40225 Expression.prototype.symbols = function(options) { 40226 options = options || {}; 40227 var vars = []; 40228 getSymbols(this.tokens, vars, options); 40229 return vars; 40230 }; 40231 Expression.prototype.variables = function(options) { 40232 options = options || {}; 40233 var vars = []; 40234 getSymbols(this.tokens, vars, options); 40235 var functions = this.functions; 40236 return vars.filter(function(name) { 40237 return !(name in functions); 40238 }); 40239 }; 40240 Expression.prototype.toJSFunction = function(param, variables) { 40241 var expr = this; 40242 var f = new Function(param, "with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return " + expressionToString(this.simplify(variables).tokens, true) + "; }"); 40243 return function() { 40244 return f.apply(expr, arguments); 40245 }; 40246 }; 40247 var TEOF = "TEOF"; 40248 var TOP = "TOP"; 40249 var TNUMBER = "TNUMBER"; 40250 var TSTRING = "TSTRING"; 40251 var TPAREN = "TPAREN"; 40252 var TBRACKET = "TBRACKET"; 40253 var TCOMMA = "TCOMMA"; 40254 var TNAME = "TNAME"; 40255 var TSEMICOLON = "TSEMICOLON"; 40256 function Token(type, value, index) { 40257 this.type = type; 40258 this.value = value; 40259 this.index = index; 40260 } 40261 Token.prototype.toString = function() { 40262 return this.type + ": " + this.value; 40263 }; 40264 function TokenStream(parser, expression) { 40265 this.pos = 0; 40266 this.current = null; 40267 this.unaryOps = parser.unaryOps; 40268 this.binaryOps = parser.binaryOps; 40269 this.ternaryOps = parser.ternaryOps; 40270 this.consts = parser.consts; 40271 this.expression = expression; 40272 this.savedPosition = 0; 40273 this.savedCurrent = null; 40274 this.options = parser.options; 40275 this.parser = parser; 40276 } 40277 TokenStream.prototype.newToken = function(type, value, pos) { 40278 return new Token(type, value, pos != null ? pos : this.pos); 40279 }; 40280 TokenStream.prototype.save = function() { 40281 this.savedPosition = this.pos; 40282 this.savedCurrent = this.current; 40283 }; 40284 TokenStream.prototype.restore = function() { 40285 this.pos = this.savedPosition; 40286 this.current = this.savedCurrent; 40287 }; 40288 TokenStream.prototype.next = function() { 40289 if (this.pos >= this.expression.length) return this.newToken(TEOF, "EOF"); 40290 if (this.isWhitespace() || this.isComment()) return this.next(); 40291 else if (this.isRadixInteger() || this.isNumber() || this.isOperator() || this.isString() || this.isParen() || this.isBracket() || this.isComma() || this.isSemicolon() || this.isNamedOp() || this.isConst() || this.isName()) return this.current; 40292 else this.parseError("Unknown character \"" + this.expression.charAt(this.pos) + "\""); 40293 }; 40294 TokenStream.prototype.isString = function() { 40295 var r = false;
40296 var startPos = this.pos; 40297 var quote = this.expression.charAt(startPos); 40298 if (quote === "'" || quote === "\"") { 40299 var index = this.expression.indexOf(quote, startPos + 1); 40300 while (index >= 0 && this.pos < this.expression.length) { 40301 this.pos = index + 1; 40302 if (this.expression.charAt(index - 1) !== "\\") { 40303 var rawString = this.expression.substring(startPos + 1, index); 40304 this.current = this.newToken(TSTRING, this.unescape(rawString), startPos); 40305 r = true; 40306 break; 40307 } 40308 index = this.expression.indexOf(quote, index + 1); 40309 } 40310 } 40311 return r; 40312 }; 40313 TokenStream.prototype.isParen = function() { 40314 var c = this.expression.charAt(this.pos); 40315 if (c === "(" || c === ")") { 40316 this.current = this.newToken(TPAREN, c); 40317 this.pos++; 40318 return true; 40319 } 40320 return false; 40321 }; 40322 TokenStream.prototype.isBracket = function() { 40323 var c = this.expression.charAt(this.pos); 40324 if ((c === "[" || c === "]") && this.isOperatorEnabled("[")) { 40325 this.current = this.newToken(TBRACKET, c); 40326 this.pos++; 40327 return true; 40328 } 40329 return false; 40330 }; 40331 TokenStream.prototype.isComma = function() { 40332 if (this.expression.charAt(this.pos) === ",") { 40333 this.current = this.newToken(TCOMMA, ","); 40334 this.pos++; 40335 return true; 40336 } 40337 return false; 40338 }; 40339 TokenStream.prototype.isSemicolon = function() { 40340 if (this.expression.charAt(this.pos) === ";") { 40341 this.current = this.newToken(TSEMICOLON, ";"); 40342 this.pos++; 40343 return true; 40344 } 40345 return false; 40346 }; 40347 TokenStream.prototype.isConst = function() { 40348 var startPos = this.pos; 40349 var i = startPos; 40350 for (; i < this.expression.length; i++) { 40351 var c = this.expression.charAt(i); 40352 if (c.toUpperCase() === c.toLowerCase()) { 40353 if (i === this.pos || c !== "_" && c !== "." && (c < "0" || c > "9")) break; 40354 } 40355 } 40356 if (i > startPos) { 40357 var str = this.expression.substring(startPos, i); 40358 if (str in this.consts) { 40359 this.current = this.newToken(TNUMBER, this.consts[str]); 40360 this.pos += str.length; 40361 return true; 40362 } 40363 } 40364 return false; 40365 }; 40366 TokenStream.prototype.isNamedOp = function() { 40367 var startPos = this.pos; 40368 var i = startPos; 40369 for (; i < this.expression.length; i++) { 40370 var c = this.expression.charAt(i); 40371 if (c.toUpperCase() === c.toLowerCase()) { 40372 if (i === this.pos || c !== "_" && (c < "0" || c > "9")) break; 40373 } 40374 } 40375 if (i > startPos) { 40376 var str = this.expression.substring(startPos, i); 40377 if (this.isOperatorEnabled(str) && (str in this.binaryOps || str in this.unaryOps || str in this.ternaryOps)) { 40378 this.current = this.newToken(TOP, str); 40379 this.pos += str.length; 40380 return true; 40381 } 40382 } 40383 return false; 40384 }; 40385 TokenStream.prototype.isName = function() { 40386 var startPos = this.pos; 40387 var i = startPos; 40388 var hasLetter = false; 40389 for (; i < this.expression.length; i++) { 40390 var c = this.expression.charAt(i); 40391 if (c.toUpperCase() === c.toLowerCase()) { 40392 if (i === this.pos && (c === "$" || c === "_")) { 40393 if (c === "_") hasLetter = true; 40394 continue; 40395 } else if (i === this.pos || !hasLetter || c !== "_" && (c < "0" || c > "9")) break; 40396 } else hasLetter = true; 40397 } 40398 if (hasLetter) { 40399 var str = this.expression.substring(startPos, i); 40400 this.current = this.newToken(TNAME, str); 40401 this.pos += str.length; 40402 return true; 40403 } 40404 return false; 40405 }; 40406 TokenStream.prototype.isWhitespace = function() { 40407 var r = false; 40408 var c = this.expression.charAt(this.pos); 40409 while (c === " " || c === " " || c === "\n" || c === "\r") { 40410 r = true; 40411 this.pos++; 40412 if (this.pos >= this.expression.length) break; 40413 c = this.expression.charAt(this.pos); 40414 } 40415 return r; 40416 }; 40417 var codePointPattern = /^[0-9a-f]{4}$/i; 40418 TokenStream.prototype.unescape = function(v) { 40419 var index = v.indexOf("\\"); 40420 if (index < 0) return v; 40421 var buffer = v.substring(0, index); 40422 while (index >= 0) { 40423 var c = v.charAt(++index); 40424 switch (c) { 40425 case "'": 40426 buffer += "'"; 40427 break; 40428 case "\"": 40429 buffer += "\""; 40430 break; 40431 case "\\": 40432 buffer += "\\"; 40433 break; 40434 case "/": 40435 buffer += "/"; 40436 break; 40437 case "b": 40438 buffer += "\b"; 40439 break; 40440 case "f": 40441 buffer += "\f"; 40442 break; 40443 case "n": 40444 buffer += "\n"; 40445 break; 40446 case "r": 40447 buffer += "\r"; 40448 break; 40449 case "t": 40450 buffer += " "; 40451 break; 40452 case "u": 40453 var codePoint = v.substring(index + 1, index + 5); 40454 if (!codePointPattern.test(codePoint)) this.parseError("Illegal escape sequence: \\u" + codePoint); 40455 buffer += String.fromCharCode(parseInt(codePoint, 16)); 40456 index += 4; 40457 break; 40458 default: throw this.parseError("Illegal escape sequence: \"\\" + c + "\""); 40459 } 40460 ++index; 40461 var backslash = v.indexOf("\\", index); 40462 buffer += v.substring(index, backslash < 0 ? v.length : backslash); 40463 index = backslash; 40464 } 40465 return buffer; 40466 }; 40467 TokenStream.prototype.isComment = function() { 40468 if (this.expression.charAt(this.pos) === "/" && this.expression.charAt(this.pos + 1) === "*") { 40469 this.pos = this.expression.indexOf("*/", this.pos) + 2; 40470 if (this.pos === 1) this.pos = this.expression.length; 40471 return true; 40472 } 40473 return false;
40474 }; 40475 TokenStream.prototype.isRadixInteger = function() { 40476 var pos = this.pos; 40477 if (pos >= this.expression.length - 2 || this.expression.charAt(pos) !== "0") return false; 40478 ++pos; 40479 var radix; 40480 var validDigit; 40481 if (this.expression.charAt(pos) === "x") { 40482 radix = 16; 40483 validDigit = /^[0-9a-f]$/i; 40484 ++pos; 40485 } else if (this.expression.charAt(pos) === "b") { 40486 radix = 2; 40487 validDigit = /^[01]$/i; 40488 ++pos; 40489 } else return false; 40490 var valid = false; 40491 var startPos = pos; 40492 while (pos < this.expression.length) { 40493 var c = this.expression.charAt(pos); 40494 if (validDigit.test(c)) { 40495 pos++; 40496 valid = true; 40497 } else break; 40498 } 40499 if (valid) { 40500 this.current = this.newToken(TNUMBER, parseInt(this.expression.substring(startPos, pos), radix)); 40501 this.pos = pos; 40502 } 40503 return valid; 40504 }; 40505 TokenStream.prototype.isNumber = function() { 40506 var valid = false; 40507 var pos = this.pos; 40508 var startPos = pos; 40509 var resetPos = pos; 40510 var foundDot = false; 40511 var foundDigits = false; 40512 var c; 40513 while (pos < this.expression.length) { 40514 c = this.expression.charAt(pos); 40515 if (c >= "0" && c <= "9" || !foundDot && c === ".") { 40516 if (c === ".") foundDot = true; 40517 else foundDigits = true; 40518 pos++; 40519 valid = foundDigits; 40520 } else break; 40521 } 40522 if (valid) resetPos = pos; 40523 if (c === "e" || c === "E") { 40524 pos++; 40525 var acceptSign = true; 40526 var validExponent = false; 40527 while (pos < this.expression.length) { 40528 c = this.expression.charAt(pos); 40529 if (acceptSign && (c === "+" || c === "-")) acceptSign = false; 40530 else if (c >= "0" && c <= "9") { 40531 validExponent = true; 40532 acceptSign = false; 40533 } else break; 40534 pos++; 40535 } 40536 if (!validExponent) pos = resetPos; 40537 } 40538 if (valid) { 40539 this.current = this.newToken(TNUMBER, parseFloat(this.expression.substring(startPos, pos))); 40540 this.pos = pos; 40541 } else this.pos = resetPos; 40542 return valid; 40543 }; 40544 TokenStream.prototype.isOperator = function() { 40545 var startPos = this.pos; 40546 var c = this.expression.charAt(this.pos); 40547 if (c === "+" || c === "-" || c === "*" || c === "/" || c === "%" || c === "^" || c === "?" || c === ":" || c === ".") this.current = this.newToken(TOP, c); 40548 else if (c === "â" || c === "â¢") this.current = this.newToken(TOP, "*"); 40549 else if (c === ">") if (this.expression.charAt(this.pos + 1) === "=") { 40550 this.current = this.newToken(TOP, ">="); 40551 this.pos++; 40552 } else this.current = this.newToken(TOP, ">"); 40553 else if (c === "<") if (this.expression.charAt(this.pos + 1) === "=") { 40554 this.current = this.newToken(TOP, "<="); 40555 this.pos++; 40556 } else this.current = this.newToken(TOP, "<"); 40557 else if (c === "|") if (this.expression.charAt(this.pos + 1) === "|") { 40558 this.current = this.newToken(TOP, "||"); 40559 this.pos++; 40560 } else return false; 40561 else if (c === "=") if (this.expression.charAt(this.pos + 1) === "=") { 40562 this.current = this.newToken(TOP, "=="); 40563 this.pos++; 40564 } else this.current = this.newToken(TOP, c); 40565 else if (c === "!") if (this.expression.charAt(this.pos + 1) === "=") { 40566 this.current = this.newToken(TOP, "!="); 40567 this.pos++; 40568 } else this.current = this.newToken(TOP, c); 40569 else return false; 40570 this.pos++; 40571 if (this.isOperatorEnabled(this.current.value)) return true; 40572 else { 40573 this.pos = startPos; 40574 return false; 40575 } 40576 }; 40577 TokenStream.prototype.isOperatorEnabled = function(op) { 40578 return this.parser.isOperatorEnabled(op); 40579 }; 40580 TokenStream.prototype.getCoordinates = function() { 40581 var line = 0; 40582 var column; 40583 var newline = -1; 40584 do { 40585 line++; 40586 column = this.pos - newline; 40587 newline = this.expression.indexOf("\n", newline + 1); 40588 } while (newline >= 0 && newline < this.pos); 40589 return { 40590 line, 40591 column 40592 }; 40593 }; 40594 TokenStream.prototype.parseError = function(msg) { 40595 var coords = this.getCoordinates(); 40596 throw new Error("parse error [" + coords.line + ":" + coords.column + "]: " + msg); 40597 }; 40598 function ParserState(parser, tokenStream, options) { 40599 this.parser = parser; 40600 this.tokens = tokenStream; 40601 this.current = null; 40602 this.nextToken = null; 40603 this.next(); 40604 this.savedCurrent = null; 40605 this.savedNextToken = null; 40606 this.allowMemberAccess = options.allowMemberAccess !== false; 40607 } 40608 ParserState.prototype.next = function() { 40609 this.current = this.nextToken; 40610 return this.nextToken = this.tokens.next(); 40611 }; 40612 ParserState.prototype.tokenMatches = function(token, value) { 40613 if (typeof value === "undefined") return true; 40614 else if (Array.isArray(value)) return contains(value, token.value); 40615 else if (typeof value === "function") return value(token); 40616 else return token.value === value; 40617 }; 40618 ParserState.prototype.save = function() { 40619 this.savedCurrent = this.current; 40620 this.savedNextToken = this.nextToken; 40621 this.tokens.save(); 40622 }; 40623 ParserState.prototype.restore = function() {
40624 this.tokens.restore(); 40625 this.current = this.savedCurrent; 40626 this.nextToken = this.savedNextToken; 40627 }; 40628 ParserState.prototype.accept = function(type, value) { 40629 if (this.nextToken.type === type && this.tokenMatches(this.nextToken, value)) { 40630 this.next(); 40631 return true; 40632 } 40633 return false; 40634 }; 40635 ParserState.prototype.expect = function(type, value) { 40636 if (!this.accept(type, value)) { 40637 var coords = this.tokens.getCoordinates(); 40638 throw new Error("parse error [" + coords.line + ":" + coords.column + "]: Expected " + (value || type)); 40639 } 40640 }; 40641 ParserState.prototype.parseAtom = function(instr) { 40642 var unaryOps = this.tokens.unaryOps; 40643 function isPrefixOperator(token) { 40644 return token.value in unaryOps; 40645 } 40646 if (this.accept(TNAME) || this.accept(TOP, isPrefixOperator)) instr.push(new Instruction(IVAR, this.current.value)); 40647 else if (this.accept(TNUMBER)) instr.push(new Instruction(INUMBER, this.current.value)); 40648 else if (this.accept(TSTRING)) instr.push(new Instruction(INUMBER, this.current.value)); 40649 else if (this.accept(TPAREN, "(")) { 40650 this.parseExpression(instr); 40651 this.expect(TPAREN, ")"); 40652 } else if (this.accept(TBRACKET, "[")) if (this.accept(TBRACKET, "]")) instr.push(new Instruction(IARRAY, 0)); 40653 else { 40654 var argCount = this.parseArrayList(instr); 40655 instr.push(new Instruction(IARRAY, argCount)); 40656 } 40657 else throw new Error("unexpected " + this.nextToken); 40658 }; 40659 ParserState.prototype.parseExpression = function(instr) { 40660 var exprInstr = []; 40661 if (this.parseUntilEndStatement(instr, exprInstr)) return; 40662 this.parseVariableAssignmentExpression(exprInstr); 40663 if (this.parseUntilEndStatement(instr, exprInstr)) return; 40664 this.pushExpression(instr, exprInstr); 40665 }; 40666 ParserState.prototype.pushExpression = function(instr, exprInstr) { 40667 for (var i = 0, len = exprInstr.length; i < len; i++) instr.push(exprInstr[i]); 40668 }; 40669 ParserState.prototype.parseUntilEndStatement = function(instr, exprInstr) { 40670 if (!this.accept(TSEMICOLON)) return false; 40671 if (this.nextToken && this.nextToken.type !== TEOF && !(this.nextToken.type === TPAREN && this.nextToken.value === ")")) exprInstr.push(new Instruction(IENDSTATEMENT)); 40672 if (this.nextToken.type !== TEOF) this.parseExpression(exprInstr); 40673 instr.push(new Instruction(IEXPR, exprInstr)); 40674 return true; 40675 }; 40676 ParserState.prototype.parseArrayList = function(instr) { 40677 var argCount = 0; 40678 while (!this.accept(TBRACKET, "]")) { 40679 this.parseExpression(instr); 40680 ++argCount; 40681 while (this.accept(TCOMMA)) { 40682 this.parseExpression(instr); 40683 ++argCount; 40684 } 40685 } 40686 return argCount; 40687 }; 40688 ParserState.prototype.parseVariableAssignmentExpression = function(instr) { 40689 this.parseConditionalExpression(instr); 40690 while (this.accept(TOP, "=")) { 40691 var varName = instr.pop(); 40692 var varValue = []; 40693 var lastInstrIndex = instr.length - 1; 40694 if (varName.type === IFUNCALL) { 40695 if (!this.tokens.isOperatorEnabled("()=")) throw new Error("function definition is not permitted"); 40696 for (var i = 0, len = varName.value + 1; i < len; i++) { 40697 var index = lastInstrIndex - i; 40698 if (instr[index].type === IVAR) instr[index] = new Instruction(IVARNAME, instr[index].value); 40699 } 40700 this.parseVariableAssignmentExpression(varValue); 40701 instr.push(new Instruction(IEXPR, varValue)); 40702 instr.push(new Instruction(IFUNDEF, varName.value)); 40703 continue; 40704 } 40705 if (varName.type !== IVAR && varName.type !== IMEMBER) throw new Error("expected variable for assignment"); 40706 this.parseVariableAssignmentExpression(varValue); 40707 instr.push(new Instruction(IVARNAME, varName.value)); 40708 instr.push(new Instruction(IEXPR, varValue)); 40709 instr.push(binaryInstruction("=")); 40710 } 40711 }; 40712 ParserState.prototype.parseConditionalExpression = function(instr) { 40713 this.parseOrExpression(instr); 40714 while (this.accept(TOP, "?")) { 40715 var trueBranch = []; 40716 var falseBranch = []; 40717 this.parseConditionalExpression(trueBranch); 40718 this.expect(TOP, ":"); 40719 this.parseConditionalExpression(falseBranch); 40720 instr.push(new Instruction(IEXPR, trueBranch)); 40721 instr.push(new Instruction(IEXPR, falseBranch)); 40722 instr.push(ternaryInstruction("?")); 40723 } 40724 }; 40725 ParserState.prototype.parseOrExpression = function(instr) { 40726 this.parseAndExpression(instr); 40727 while (this.accept(TOP, "or")) { 40728 var falseBranch = []; 40729 this.parseAndExpression(falseBranch); 40730 instr.push(new Instruction(IEXPR, falseBranch)); 40731 instr.push(binaryInstruction("or")); 40732 } 40733 }; 40734 ParserState.prototype.parseAndExpression = function(instr) { 40735 this.parseComparison(instr); 40736 while (this.accept(TOP, "and")) { 40737 var trueBranch = []; 40738 this.parseComparison(trueBranch); 40739 instr.push(new Instruction(IEXPR, trueBranch)); 40740 instr.push(binaryInstruction("and")); 40741 } 40742 }; 40743 var COMPARISON_OPERATORS = [ 40744 "==", 40745 "!=", 40746 "<", 40747 "<=", 40748 ">=", 40749 ">", 40750 "in" 40751 ]; 40752 ParserState.prototype.parseComparison = function(instr) { 40753 this.parseAddSub(instr); 40754 while (this.accept(TOP, COMPARISON_OPERATORS)) { 40755 var op = this.current; 40756 this.parseAddSub(instr); 40757 instr.push(binaryInstruction(op.value)); 40758 } 40759 };
vendor: 2,103 bytes, lines 40760-40829
40760 var ADD_SUB_OPERATORS = [ 40761 "+", 40762 "-", 40763 "||" 40764 ]; 40765 ParserState.prototype.parseAddSub = function(instr) { 40766 this.parseTerm(instr); 40767 while (this.accept(TOP, ADD_SUB_OPERATORS)) { 40768 var op = this.current; 40769 this.parseTerm(instr); 40770 instr.push(binaryInstruction(op.value)); 40771 } 40772 }; 40773 var TERM_OPERATORS = [ 40774 "*", 40775 "/", 40776 "%" 40777 ]; 40778 ParserState.prototype.parseTerm = function(instr) { 40779 this.parseFactor(instr); 40780 while (this.accept(TOP, TERM_OPERATORS)) { 40781 var op = this.current; 40782 this.parseFactor(instr); 40783 instr.push(binaryInstruction(op.value)); 40784 } 40785 }; 40786 ParserState.prototype.parseFactor = function(instr) { 40787 var unaryOps = this.tokens.unaryOps; 40788 function isPrefixOperator(token) { 40789 return token.value in unaryOps; 40790 } 40791 this.save(); 40792 if (this.accept(TOP, isPrefixOperator)) { 40793 if (this.current.value !== "-" && this.current.value !== "+") { 40794 if (this.nextToken.type === TPAREN && this.nextToken.value === "(") { 40795 this.restore(); 40796 this.parseExponential(instr); 40797 return; 40798 } else if (this.nextToken.type === TSEMICOLON || this.nextToken.type === TCOMMA || this.nextToken.type === TEOF || this.nextToken.type === TPAREN && this.nextToken.value === ")") { 40799 this.restore(); 40800 this.parseAtom(instr); 40801 return; 40802 } 40803 } 40804 var op = this.current; 40805 this.parseFactor(instr); 40806 instr.push(unaryInstruction(op.value)); 40807 } else this.parseExponential(instr); 40808 }; 40809 ParserState.prototype.parseExponential = function(instr) { 40810 this.parsePostfixExpression(instr); 40811 while (this.accept(TOP, "^")) { 40812 this.parseFactor(instr); 40813 instr.push(binaryInstruction("^")); 40814 } 40815 }; 40816 ParserState.prototype.parsePostfixExpression = function(instr) { 40817 this.parseFunctionCall(instr); 40818 while (this.accept(TOP, "!")) instr.push(unaryInstruction("!")); 40819 }; 40820 ParserState.prototype.parseFunctionCall = function(instr) { 40821 var unaryOps = this.tokens.unaryOps; 40822 function isPrefixOperator(token) { 40823 return token.value in unaryOps; 40824 } 40825 if (this.accept(TOP, isPrefixOperator)) { 40826 var op = this.current; 40827 this.parseAtom(instr); 40828 instr.push(unaryInstruction(op.value)); 40829 } else {
40830 this.parseMemberExpression(instr); 40831 while (this.accept(TPAREN, "(")) if (this.accept(TPAREN, ")")) instr.push(new Instruction(IFUNCALL, 0)); 40832 else { 40833 var argCount = this.parseArgumentList(instr); 40834 instr.push(new Instruction(IFUNCALL, argCount)); 40835 } 40836 } 40837 }; 40838 ParserState.prototype.parseArgumentList = function(instr) { 40839 var argCount = 0; 40840 while (!this.accept(TPAREN, ")")) { 40841 this.parseExpression(instr); 40842 ++argCount; 40843 while (this.accept(TCOMMA)) { 40844 this.parseExpression(instr); 40845 ++argCount; 40846 } 40847 } 40848 return argCount; 40849 }; 40850 ParserState.prototype.parseMemberExpression = function(instr) { 40851 this.parseAtom(instr); 40852 while (this.accept(TOP, ".") || this.accept(TBRACKET, "[")) { 40853 var op = this.current; 40854 if (op.value === ".") { 40855 if (!this.allowMemberAccess) throw new Error("unexpected \".\", member access is not permitted"); 40856 this.expect(TNAME); 40857 instr.push(new Instruction(IMEMBER, this.current.value)); 40858 } else if (op.value === "[") { 40859 if (!this.tokens.isOperatorEnabled("[")) throw new Error("unexpected \"[]\", arrays are disabled"); 40860 this.parseExpression(instr); 40861 this.expect(TBRACKET, "]"); 40862 instr.push(binaryInstruction("[")); 40863 } else throw new Error("unexpected symbol: " + op.value); 40864 } 40865 }; 40866 function add(a, b) { 40867 return Number(a) + Number(b); 40868 } 40869 function sub(a, b) { 40870 return a - b; 40871 } 40872 function mul(a, b) { 40873 return a * b; 40874 } 40875 function div(a, b) { 40876 return a / b; 40877 } 40878 function mod(a, b) { 40879 return a % b; 40880 } 40881 function concat(a, b) { 40882 if (Array.isArray(a) && Array.isArray(b)) return a.concat(b); 40883 return "" + a + b; 40884 } 40885 function equal(a, b) { 40886 return a === b; 40887 } 40888 function notEqual(a, b) { 40889 return a !== b; 40890 } 40891 function greaterThan(a, b) { 40892 return a > b; 40893 } 40894 function lessThan(a, b) { 40895 return a < b; 40896 } 40897 function greaterThanEqual(a, b) { 40898 return a >= b; 40899 } 40900 function lessThanEqual(a, b) { 40901 return a <= b; 40902 } 40903 function andOperator(a, b) { 40904 return Boolean(a && b); 40905 } 40906 function orOperator(a, b) { 40907 return Boolean(a || b); 40908 } 40909 function inOperator(a, b) { 40910 return contains(b, a); 40911 } 40912 function sinh(a) { 40913 return (Math.exp(a) - Math.exp(-a)) / 2; 40914 } 40915 function cosh(a) { 40916 return (Math.exp(a) + Math.exp(-a)) / 2; 40917 } 40918 function tanh(a) { 40919 if (a === Infinity) return 1; 40920 if (a === -Infinity) return -1; 40921 return (Math.exp(a) - Math.exp(-a)) / (Math.exp(a) + Math.exp(-a)); 40922 } 40923 function asinh(a) { 40924 if (a === -Infinity) return a; 40925 return Math.log(a + Math.sqrt(a * a + 1)); 40926 } 40927 function acosh(a) { 40928 return Math.log(a + Math.sqrt(a * a - 1)); 40929 } 40930 function atanh(a) { 40931 return Math.log((1 + a) / (1 - a)) / 2; 40932 } 40933 function log10(a) { 40934 return Math.log(a) * Math.LOG10E; 40935 } 40936 function neg(a) { 40937 return -a; 40938 } 40939 function not(a) { 40940 return !a; 40941 } 40942 function trunc(a) { 40943 return a < 0 ? Math.ceil(a) : Math.floor(a); 40944 } 40945 function random(a) { 40946 return Math.random() * (a || 1); 40947 } 40948 function factorial(a) { 40949 return gamma(a + 1); 40950 } 40951 function isInteger(value) { 40952 return isFinite(value) && value === Math.round(value); 40953 } 40954 var GAMMA_G = 4.7421875; 40955 var GAMMA_P = [ 40956 .9999999999999971, 40957 57.15623566586292, 40958 -59.59796035547549, 40959 14.136097974741746, 40960 -.4919138160976202, 40961 3399464998481189e-20, 40962 4652362892704858e-20, 40963 -9837447530487956e-20, 40964 .0001580887032249125, 40965 -.00021026444172410488, 40966 .00021743961811521265, 40967 -.0001643181065367639, 40968 8441822398385275e-20, 40969 -26190838401581408e-21, 40970 36899182659531625e-22 40971 ]; 40972 function gamma(n) { 40973 var t, x; 40974 if (isInteger(n)) { 40975 if (n <= 0) return isFinite(n) ? Infinity : NaN; 40976 if (n > 171) return Infinity; 40977 var value = n - 2; 40978 var res = n - 1; 40979 while (value > 1) { 40980 res *= value; 40981 value--; 40982 } 40983 if (res === 0) res = 1; 40984 return res; 40985 } 40986 if (n < .5) return Math.PI / (Math.sin(Math.PI * n) * gamma(1 - n)); 40987 if (n >= 171.35) return Infinity; 40988 if (n > 85) { 40989 var twoN = n * n; 40990 var threeN = twoN * n; 40991 var fourN = threeN * n; 40992 var fiveN = fourN * n; 40993 return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n)); 40994 } 40995 --n; 40996 x = GAMMA_P[0]; 40997 for (var i = 1; i < GAMMA_P.length; ++i) x += GAMMA_P[i] / (n + i); 40998 t = n + GAMMA_G + .5; 40999 return Math.sqrt(2 * Math.PI) * Math.pow(t, n + .5) * Math.exp(-t) * x; 41000 } 41001 function stringOrArrayLength(s) { 41002 if (Array.isArray(s)) return s.length; 41003 return String(s).length; 41004 } 41005 function hypot() { 41006 var sum = 0; 41007 var larg = 0; 41008 for (var i = 0; i < arguments.length; i++) { 41009 var arg = Math.abs(arguments[i]); 41010 var div; 41011 if (larg < arg) { 41012 div = larg / arg; 41013 sum = sum * div * div + 1; 41014 larg = arg; 41015 } else if (arg > 0) { 41016 div = arg / larg; 41017 sum += div * div; 41018 } else sum += arg; 41019 } 41020 return larg === Infinity ? Infinity : larg * Math.sqrt(sum); 41021 } 41022 function condition(cond, yep, nope) { 41023 return cond ? yep : nope; 41024 }
41025 /** 41026 * Decimal adjustment of a number. 41027 * From @escopecz. 41028 * 41029 * @param {Number} value The number. 41030 * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base). 41031 * @return {Number} The adjusted value. 41032 */ 41033 function roundTo(value, exp) { 41034 if (typeof exp === "undefined" || +exp === 0) return Math.round(value); 41035 value = +value; 41036 exp = -+exp; 41037 if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) return NaN; 41038 value = value.toString().split("e"); 41039 value = Math.round(+(value[0] + "e" + (value[1] ? +value[1] - exp : -exp))); 41040 value = value.toString().split("e"); 41041 return +(value[0] + "e" + (value[1] ? +value[1] + exp : exp)); 41042 } 41043 function setVar(name, value, variables) { 41044 if (variables) variables[name] = value; 41045 return value; 41046 } 41047 function arrayIndex(array, index) { 41048 return array[index | 0]; 41049 } 41050 function max(array) { 41051 if (arguments.length === 1 && Array.isArray(array)) return Math.max.apply(Math, array); 41052 else return Math.max.apply(Math, arguments); 41053 } 41054 function min(array) { 41055 if (arguments.length === 1 && Array.isArray(array)) return Math.min.apply(Math, array); 41056 else return Math.min.apply(Math, arguments); 41057 } 41058 function arrayMap(f, a) { 41059 if (typeof f !== "function") throw new Error("First argument to map is not a function"); 41060 if (!Array.isArray(a)) throw new Error("Second argument to map is not an array"); 41061 return a.map(function(x, i) { 41062 return f(x, i); 41063 }); 41064 } 41065 function arrayFold(f, init, a) { 41066 if (typeof f !== "function") throw new Error("First argument to fold is not a function"); 41067 if (!Array.isArray(a)) throw new Error("Second argument to fold is not an array"); 41068 return a.reduce(function(acc, x, i) { 41069 return f(acc, x, i); 41070 }, init); 41071 } 41072 function arrayFilter(f, a) { 41073 if (typeof f !== "function") throw new Error("First argument to filter is not a function"); 41074 if (!Array.isArray(a)) throw new Error("Second argument to filter is not an array"); 41075 return a.filter(function(x, i) { 41076 return f(x, i); 41077 }); 41078 } 41079 function stringOrArrayIndexOf(target, s) { 41080 if (!(Array.isArray(s) || typeof s === "string")) throw new Error("Second argument to indexOf is not a string or array"); 41081 return s.indexOf(target); 41082 } 41083 function arrayJoin(sep, a) { 41084 if (!Array.isArray(a)) throw new Error("Second argument to join is not an array"); 41085 return a.join(sep); 41086 } 41087 function sign(x) { 41088 return (x > 0) - (x < 0) || +x; 41089 } 41090 var ONE_THIRD = 1 / 3; 41091 function cbrt(x) { 41092 return x < 0 ? -Math.pow(-x, ONE_THIRD) : Math.pow(x, ONE_THIRD); 41093 } 41094 function expm1(x) { 41095 return Math.exp(x) - 1; 41096 } 41097 function log1p(x) { 41098 return Math.log(1 + x); 41099 } 41100 function log2(x) { 41101 return Math.log(x) / Math.LN2; 41102 } 41103 function Parser(options) { 41104 this.options = options || {}; 41105 this.unaryOps = { 41106 sin: Math.sin, 41107 cos: Math.cos, 41108 tan: Math.tan, 41109 asin: Math.asin, 41110 acos: Math.acos, 41111 atan: Math.atan, 41112 sinh: Math.sinh || sinh, 41113 cosh: Math.cosh || cosh, 41114 tanh: Math.tanh || tanh, 41115 asinh: Math.asinh || asinh, 41116 acosh: Math.acosh || acosh, 41117 atanh: Math.atanh || atanh, 41118 sqrt: Math.sqrt, 41119 cbrt: Math.cbrt || cbrt, 41120 log: Math.log, 41121 log2: Math.log2 || log2, 41122 ln: Math.log, 41123 lg: Math.log10 || log10, 41124 log10: Math.log10 || log10, 41125 expm1: Math.expm1 || expm1, 41126 log1p: Math.log1p || log1p, 41127 abs: Math.abs, 41128 ceil: Math.ceil, 41129 floor: Math.floor, 41130 round: Math.round, 41131 trunc: Math.trunc || trunc, 41132 "-": neg, 41133 "+": Number, 41134 exp: Math.exp, 41135 not, 41136 length: stringOrArrayLength, 41137 "!": factorial, 41138 sign: Math.sign || sign 41139 }; 41140 this.binaryOps = { 41141 "+": add, 41142 "-": sub, 41143 "*": mul, 41144 "/": div, 41145 "%": mod, 41146 "^": Math.pow, 41147 "||": concat, 41148 "==": equal, 41149 "!=": notEqual, 41150 ">": greaterThan, 41151 "<": lessThan, 41152 ">=": greaterThanEqual, 41153 "<=": lessThanEqual, 41154 and: andOperator, 41155 or: orOperator, 41156 "in": inOperator, 41157 "=": setVar, 41158 "[": arrayIndex 41159 }; 41160 this.ternaryOps = { "?": condition }; 41161 this.functions = { 41162 random, 41163 fac: factorial, 41164 min, 41165 max, 41166 hypot: Math.hypot || hypot, 41167 pyt: Math.hypot || hypot, 41168 pow: Math.pow, 41169 atan2: Math.atan2, 41170 "if": condition, 41171 gamma,
41172 roundTo, 41173 map: arrayMap, 41174 fold: arrayFold, 41175 filter: arrayFilter, 41176 indexOf: stringOrArrayIndexOf, 41177 join: arrayJoin 41178 }; 41179 this.consts = { 41180 E: Math.E, 41181 PI: Math.PI, 41182 "true": true, 41183 "false": false 41184 }; 41185 } 41186 Parser.prototype.parse = function(expr) { 41187 var instr = []; 41188 var parserState = new ParserState(this, new TokenStream(this, expr), { allowMemberAccess: this.options.allowMemberAccess }); 41189 parserState.parseExpression(instr); 41190 parserState.expect(TEOF, "EOF"); 41191 return new Expression(instr, this); 41192 }; 41193 Parser.prototype.evaluate = function(expr, variables) { 41194 return this.parse(expr).evaluate(variables); 41195 }; 41196 var sharedParser = new Parser(); 41197 Parser.parse = function(expr) { 41198 return sharedParser.parse(expr); 41199 }; 41200 Parser.evaluate = function(expr, variables) { 41201 return sharedParser.parse(expr).evaluate(variables); 41202 }; 41203 var optionNameMap = { 41204 "+": "add", 41205 "-": "subtract", 41206 "*": "multiply", 41207 "/": "divide", 41208 "%": "remainder", 41209 "^": "power", 41210 "!": "factorial", 41211 "<": "comparison", 41212 ">": "comparison", 41213 "<=": "comparison", 41214 ">=": "comparison", 41215 "==": "comparison", 41216 "!=": "comparison", 41217 "||": "concatenate", 41218 "and": "logical", 41219 "or": "logical", 41220 "not": "logical", 41221 "?": "conditional", 41222 ":": "conditional", 41223 "=": "assignment", 41224 "[": "array", 41225 "()=": "fndef" 41226 }; 41227 function getOptionName(op) { 41228 return optionNameMap.hasOwnProperty(op) ? optionNameMap[op] : op; 41229 } 41230 Parser.prototype.isOperatorEnabled = function(op) { 41231 var optionName = getOptionName(op); 41232 var operators = this.options.operators || {}; 41233 return !(optionName in operators) || !!operators[optionName]; 41234 }; 41235 /*! 41236 Based on ndef.parser, by Raphael Graf([email protected]) 41237 http://www.undefined.ch/mparser/index.html 41238 41239 Ported to JavaScript and modified by Matthew Crumley ([email protected], http://silentmatt.com/) 41240 41241 You are free to use and modify this code in anyway you find useful. Please leave this comment in the code 41242 to acknowledge its original source. If you feel like it, I enjoy hearing about projects that use my code, 41243 but don't feel like you have to let me know or ask permission. 41244 */ 41245 //#endregion 41246 //#region src/components/if/expression.ts 41247 var OPTIONAL_CHAIN_PATH_REGEX = /\b[$A-Za-z_][$\w]*(?:(?:\?\.)|\.)[$A-Za-z_][$\w]*(?:(?:\?\.)[$A-Za-z_][$\w]*|(?:\.)[$A-Za-z_][$\w]*)*/g; 41248 var LENGTH_ACCESS_REGEX = /\b([$A-Za-z_][$\w]*(?:\.[$A-Za-z_][$\w]*)*)\.length\b/g; 41249 var OPTIONAL_LENGTH_ACCESS_REGEX = /(__optional\("[^"]+"\))\.length\b/g; 41250 var parser = new Parser({ 41251 allowMemberAccess: true, 41252 operators: { 41253 assignment: false, 41254 fndef: false 41255 } 41256 }); 41257 var expressionCache = /* @__PURE__ */ new Map(); 41258 function normalizeExpression(expression) { 41259 return expression.replace(OPTIONAL_CHAIN_PATH_REGEX, (chain) => { 41260 if (!chain.includes("?.")) return chain; 41261 return `__optional("${chain.replace(/\?\./g, ".")}")`; 41262 }).replace(LENGTH_ACCESS_REGEX, (_, basePath) => `__length(${basePath})`).replace(OPTIONAL_LENGTH_ACCESS_REGEX, (_, optionalPath) => `__length(${optionalPath})`).replaceAll("!==", "!=").replaceAll("===", "==").replaceAll("&&", " and ").replaceAll("||", " or ").replace(/!\s*(?!=)/g, "not "); 41263 } 41264 function parseExpression(expression) { 41265 const cached = expressionCache.get(expression); 41266 if (cached) return cached; 41267 const parsed = parser.parse(normalizeExpression(expression)); 41268 expressionCache.set(expression, parsed); 41269 return parsed; 41270 } 41271 function evaluateExpression(expression, data) { 41272 if (expression === void 0 || expression === null) return expression; 41273 if (typeof expression !== "string") return expression; 41274 const scope = { 41275 data, 41276 undefined: void 0, 41277 null: null 41278 }; 41279 scope.__optional = (path) => { 41280 return path.split(".").reduce((current, key) => { 41281 if (current === null || current === void 0) return; 41282 return current[key]; 41283 }, scope); 41284 }; 41285 scope.__length = (value) => { 41286 if (value === null || value === void 0) return; 41287 if (typeof value === "string" || Array.isArray(value)) return value.length; 41288 if (typeof value === "object" && "length" in value) { 41289 const length = value.length; 41290 return typeof length === "number" ? length : void 0; 41291 } 41292 }; 41293 try { 41294 const parsedExpression = parseExpression(expression); 41295 for (const symbol of parsedExpression.symbols()) { 41296 if (scope[symbol] !== void 0) continue; 41297 const value = globalThis[symbol]; 41298 if (typeof value === "function") scope[symbol] = value; 41299 } 41300 return parsedExpression.evaluate(scope); 41301 } catch (error) { 41302 console.error(`Error while evaluating when (${expression}) in go-if: ${error.message}`); 41303 } 41304 } 41305 //#endregion 41306 //#region src/components/ticketSelection/filters/types.ts 41307 var FILTER_NAMES = [ 41308 "ticket:timeslot", 41309 "ticket:day", 41310 "ticket:annual", 41311 "event:admission", 41312 "event:admission:day", 41313 "event:admission:timeslot", 41314 "event:price", 41315 "events:admission", 41316 "events:admission:day", 41317 "events:admission:timeslot", 41318 "events:price", 41319 "coupon" 41320 ]; 41321 //#endregion 41322 //#region src/components/ticketSelection/filters/_helpers.ts 41323 var TWO_HOURS_MS = 7200 * 1e3; 41324 /** 41325 * When a segment opts into content attributes (with-content), batch-fetch 41326 * tickets/content for the given tickets and merge each entry's `content` onto 41327 * the matching ticket by id (mirrors the legacy `ticket.content = item.content`). 41328 * Mutates the tickets in place; call before adding them to the preCart so the
41329 * content is present on first render. No-op â and no request â when the segment 41330 * hasn't enabled the feature or there are no tickets to enrich. 41331 * 41332 * Best-effort: the content is an optional, additive sidecar, so a failed or 41333 * absent fetch degrades to "no info buttons" and must never empty the ticket 41334 * list (see audit finding IB-01). Note this does NOT cover a hung request â a 41335 * never-settling fetch is a separate core-infra concern (IB-05). 41336 */ 41337 async function enrichTicketsWithContent(segment, tickets) { 41338 if (!segment.withContent) return; 41339 const ids = tickets.map((t) => t.id).filter((id) => typeof id === "number"); 41340 if (!ids.length) return; 41341 try { 41342 const entries = await shop.asyncFetch(() => shop.ticketsContent(ids)) ?? []; 41343 const byId = new Map(entries.map((e) => [e.id, e.content])); 41344 for (const ticket of tickets) { 41345 if (typeof ticket.id !== "number") continue; 41346 const content = byId.get(ticket.id); 41347 if (content) ticket.content = content; 41348 } 41349 } catch {} 41350 } 41351 /** 41352 * Load quotas fetched by a filter's loadTimeslots into the shared quota store and 41353 * record which ticket ids this selection loaded for its picker. timeslotsOn() reads 41354 * tsd.timeslotTicketIds, so only these tickets' slots render â a foreign 41355 * segment/selection sharing the store can't leak in. Appends, so multiple active 41356 * filters accumulate within one render pass (<go-timeslots> resets the list first). 41357 */ 41358 function loadPickerQuotas(tsd, quotas) { 41359 shop.capacityManager.addQuotas(quotas); 41360 tsd.timeslotTicketIds = [...tsd.timeslotTicketIds, ...Object.values(quotas).flatMap((q) => q.ticket_ids)]; 41361 } 41362 function filterDatesInWindow(dates, selectedDate, selectedTime) { 41363 const selectedMs = Date.parse(selectedTime); 41364 return dates.filter((d) => { 41365 const datePart = d.start_time.slice(0, 10); 41366 const startMs = Date.parse(d.start_time); 41367 return datePart === selectedDate && startMs >= selectedMs && startMs <= selectedMs + TWO_HOURS_MS && (d.seats?.available ?? 0) > 0; 41368 }); 41369 } 41370 async function loadEventsTimeslots(tsd) { 41371 if (!tsd?.selectedDate) return; 41372 const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41373 by_bookable: true, 41374 valid_at: tsd.selectedDate.toString(), 41375 "by_ticket_types[]": ["time_slot"], 41376 "by_museum_ids[]": tsd.museumIds, 41377 "by_exhibition_ids[]": tsd.exhibitionIds, 41378 "by_ticket_ids[]": tsd.ticketIds, 41379 "by_ticket_group_ids[]": tsd.ticketGroupIds 41380 })); 41381 loadPickerQuotas(tsd, quotas); 41382 } 41383 //#endregion 41384 //#region src/components/ticketSelection/filters/registry.ts 41385 var REGISTRY = { 41386 "ticket:timeslot": { 41387 name: "ticket:timeslot", 41388 calendarEndpoint: "tickets", 41389 apiToken: "time_slot", 41390 requires: [{ 41391 kind: "tsd", 41392 field: "selectedDate" 41393 }, { 41394 kind: "tsd", 41395 field: "selectedTimeslot" 41396 }], 41397 isCalendarVisible: () => true, 41398 isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate), 41399 isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot), 41400 async loadTimeslots(tsd) { 41401 if (!tsd?.selectedDate) return; 41402 const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41403 by_bookable: true, 41404 valid_at: tsd.selectedDate.toString(), 41405 by_ticket_type: "time_slot", 41406 "by_museum_ids[]": tsd.museumIds, 41407 "by_exhibition_ids[]": tsd.exhibitionIds, 41408 "by_ticket_ids[]": tsd.ticketIds, 41409 "by_ticket_group_ids[]": tsd.ticketGroupIds 41410 })); 41411 loadPickerQuotas(tsd, quotas); 41412 }, 41413 async loadProducts(segment) { 41414 const tsd = segment.ticketSelectionDetails; 41415 if (!tsd?.selectedDate || !tsd.selectedTimeslot) return; 41416 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41417 by_bookable: true, 41418 valid_at: tsd.selectedDate.toString(), 41419 by_ticket_type: "time_slot", 41420 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41421 "by_exhibition_ids[]": tsd.exhibitionIds, 41422 "by_ticket_ids[]": tsd.ticketIds, 41423 "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds 41424 })); 41425 shop.capacityManager.addQuotas(quotas); 41426 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime); 41427 await enrichTicketsWithContent(segment, uiTickets); 41428 for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime })); 41429 } 41430 }, 41431 "ticket:day": { 41432 name: "ticket:day", 41433 calendarEndpoint: "tickets", 41434 apiToken: "normal", 41435 requires: [{
41436 kind: "tsd", 41437 field: "selectedDate" 41438 }], 41439 isCalendarVisible: () => true, 41440 isTimeslotsVisible: () => false, 41441 isTicketsVisible: (tsd) => Boolean(tsd.selectedDate), 41442 async loadTimeslots() {}, 41443 async loadProducts(segment) { 41444 const tsd = segment.ticketSelectionDetails; 41445 if (!tsd?.selectedDate) return; 41446 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41447 by_bookable: true, 41448 valid_at: tsd.selectedDate.toString(), 41449 "by_ticket_types[]": ["normal"], 41450 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41451 "by_exhibition_ids[]": tsd.exhibitionIds, 41452 "by_ticket_ids[]": tsd.ticketIds, 41453 "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds 41454 })); 41455 shop.capacityManager.addQuotas(quotas); 41456 const firstQuota = Object.values(quotas)[0]; 41457 const timeslot = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0; 41458 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, timeslot), timeslot); 41459 await enrichTicketsWithContent(segment, uiTickets); 41460 for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: timeslot })); 41461 } 41462 }, 41463 "ticket:annual": { 41464 name: "ticket:annual", 41465 calendarEndpoint: null, 41466 apiToken: "annual", 41467 requires: [], 41468 isCalendarVisible: () => false, 41469 isTimeslotsVisible: () => false, 41470 isTicketsVisible: () => true, 41471 async loadTimeslots() {}, 41472 async loadProducts(segment) { 41473 const tsd = segment.ticketSelectionDetails; 41474 if (!tsd) return; 41475 const tickets = await shop.asyncFetch(() => shop.tickets({ 41476 by_bookable: true, 41477 "by_ticket_types[]": ["annual"], 41478 "by_ticket_ids[]": tsd.ticketIds, 41479 "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds 41480 })); 41481 const uiTickets = Object.values(tickets).map((t) => createUITicket(t)); 41482 await enrichTicketsWithContent(segment, uiTickets); 41483 for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket)); 41484 } 41485 }, 41486 "event:admission": { 41487 name: "event:admission", 41488 calendarEndpoint: "events", 41489 requires: [{ 41490 kind: "tsd", 41491 field: "eventIds" 41492 }, { 41493 kind: "tsd", 41494 field: "selectedDate" 41495 }], 41496 isCalendarVisible: () => true, 41497 isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate), 41498 isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot), 41499 async loadTimeslots(tsd) { 41500 if (!tsd?.eventIds?.length || !tsd.selectedDate) return; 41501 const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0])); 41502 if (!event.tickets?.length) return; 41503 const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41504 "by_ticket_ids[]": event.tickets, 41505 by_bookable: true, 41506 valid_at: tsd.selectedDate.toString() 41507 })); 41508 loadPickerQuotas(tsd, quotas); 41509 }, 41510 async loadProducts(segment) { 41511 const tsd = segment.ticketSelectionDetails; 41512 if (!tsd?.eventIds?.length || !tsd.selectedDate) return; 41513 const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0])); 41514 if (!event.tickets?.length) return; 41515 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41516 "by_ticket_ids[]": event.tickets, 41517 by_bookable: true, 41518 valid_at: tsd.selectedDate.toString() 41519 })); 41520 shop.capacityManager.addQuotas(quotas); 41521 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime); 41522 await enrichTicketsWithContent(segment, uiTickets); 41523 for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime })); 41524 } 41525 }, 41526 "event:admission:day": { 41527 name: "event:admission:day", 41528 calendarEndpoint: "events", 41529 requires: [{ 41530 kind: "tsd", 41531 field: "eventIds" 41532 }, { 41533 kind: "tsd", 41534 field: "selectedDate" 41535 }], 41536 isCalendarVisible: () => true, 41537 isTimeslotsVisible: () => false, 41538 isTicketsVisible: (tsd) => Boolean(tsd.selectedDate), 41539 async loadTimeslots() {}, 41540 async loadProducts(segment) { 41541 const tsd = segment.ticketSelectionDetails; 41542 if (!tsd?.eventIds?.length || !tsd.selectedDate) return; 41543 const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0])); 41544 if (!event.tickets?.length) return; 41545 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41546 "by_ticket_ids[]": event.tickets,
41547 "by_ticket_types[]": ["normal"], 41548 by_bookable: true, 41549 valid_at: tsd.selectedDate.toString() 41550 })); 41551 shop.capacityManager.addQuotas(quotas); 41552 const firstQuota = Object.values(quotas)[0]; 41553 const time = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0; 41554 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, time), time); 41555 await enrichTicketsWithContent(segment, uiTickets); 41556 for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time })); 41557 } 41558 }, 41559 "event:admission:timeslot": { 41560 name: "event:admission:timeslot", 41561 calendarEndpoint: "events", 41562 requires: [ 41563 { 41564 kind: "tsd", 41565 field: "eventIds" 41566 }, 41567 { 41568 kind: "tsd", 41569 field: "selectedDate" 41570 }, 41571 { 41572 kind: "tsd", 41573 field: "selectedTimeslot" 41574 } 41575 ], 41576 isCalendarVisible: () => true, 41577 isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate), 41578 isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot), 41579 async loadTimeslots(tsd) { 41580 if (!tsd?.eventIds?.length || !tsd.selectedDate) return; 41581 const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0])); 41582 if (!event.tickets?.length) return; 41583 const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41584 "by_ticket_ids[]": event.tickets, 41585 by_ticket_type: "time_slot", 41586 by_bookable: true, 41587 valid_at: tsd.selectedDate.toString() 41588 })); 41589 loadPickerQuotas(tsd, quotas); 41590 }, 41591 async loadProducts(segment) { 41592 const tsd = segment.ticketSelectionDetails; 41593 if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return; 41594 const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0])); 41595 if (!event.tickets?.length) return; 41596 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41597 "by_ticket_ids[]": event.tickets, 41598 by_ticket_type: "time_slot", 41599 by_bookable: true, 41600 valid_at: tsd.selectedDate.toString() 41601 })); 41602 shop.capacityManager.addQuotas(quotas); 41603 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime); 41604 await enrichTicketsWithContent(segment, uiTickets); 41605 for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: tsd.selectedTime })); 41606 } 41607 }, 41608 "event:price": { 41609 name: "event:price", 41610 calendarEndpoint: "events", 41611 requires: [{ 41612 kind: "tsd", 41613 field: "eventIds" 41614 }, { 41615 kind: "segment", 41616 field: "dateId" 41617 }], 41618 isCalendarVisible: () => false, 41619 isTimeslotsVisible: () => false, 41620 isTicketsVisible: (tsd) => Boolean(tsd.eventIds?.length), 41621 loadTimeslots: async () => {}, 41622 async loadProducts(segment) { 41623 const tsd = segment.ticketSelectionDetails; 41624 if (!tsd?.eventIds?.length || segment.dateId === void 0) return; 41625 const date = await shop.asyncFetch(() => shop.getEventDetailsOnDate(tsd.eventIds[0], segment.dateId)); 41626 if (!date.prices?.length) return; 41627 for (const price of date.prices) { 41628 const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title }); 41629 segment.preCart.addItem(createCartItem(ticket, { time: date.start_time })); 41630 } 41631 if (date.seats) shop.capacityManager.addSeats(date.id, date.seats); 41632 } 41633 }, 41634 "events:admission": { 41635 name: "events:admission", 41636 calendarEndpoint: "events", 41637 requires: [{ 41638 kind: "tsd", 41639 field: "selectedDate" 41640 }, { 41641 kind: "tsd", 41642 field: "selectedTimeslot" 41643 }], 41644 isCalendarVisible: () => true, 41645 isTimeslotsVisible: () => true, 41646 isTicketsVisible: () => true, 41647 loadTimeslots: (tsd) => loadEventsTimeslots(tsd), 41648 async loadProducts(segment) { 41649 const tsd = segment.ticketSelectionDetails; 41650 if (!tsd?.selectedDate || !tsd.selectedTime) return; 41651 const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({ 41652 by_bookable: true, 41653 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41654 "by_exhibition_ids[]": tsd.exhibitionIds, 41655 "by_event_ids[]": tsd.eventIds, 41656 "by_language_ids[]": segment.languageIds, 41657 "by_catch_word_ids[]": segment.catchWordIds, 41658 start_at: tsd.selectedDate.toString(), 41659 per_page: segment.limit || 30 41660 })), tsd.selectedDate.toString(), tsd.selectedTime); 41661 for (const date of dates) { 41662 if (!date.event_id || !date.start_time) continue; 41663 const event = await shop.asyncFetch(() => shop.getEvent(date.event_id)); 41664 if (!event?.tickets?.length) continue; 41665 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41666 "by_ticket_ids[]": event.tickets, 41667 by_bookable: true, 41668 valid_at: date.start_time.slice(0, 10) 41669 })); 41670 shop.capacityManager.addQuotas(quotas); 41671 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, date.start_time), date.start_time); 41672 await enrichTicketsWithContent(segment, uiTickets); 41673 for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: date.start_time })); 41674 } 41675 } 41676 }, 41677 "events:admission:day": { 41678 name: "events:admission:day", 41679 calendarEndpoint: "events", 41680 requires: [{
41681 kind: "tsd", 41682 field: "selectedDate" 41683 }, { 41684 kind: "tsd", 41685 field: "selectedTimeslot" 41686 }], 41687 isCalendarVisible: () => true, 41688 isTimeslotsVisible: () => true, 41689 isTicketsVisible: () => true, 41690 loadTimeslots: (tsd) => loadEventsTimeslots(tsd), 41691 async loadProducts(segment) { 41692 const tsd = segment.ticketSelectionDetails; 41693 if (!tsd?.selectedDate || !tsd.selectedTime) return; 41694 const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({ 41695 by_bookable: true, 41696 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41697 "by_exhibition_ids[]": tsd.exhibitionIds, 41698 "by_event_ids[]": tsd.eventIds, 41699 "by_language_ids[]": segment.languageIds, 41700 "by_catch_word_ids[]": segment.catchWordIds, 41701 start_at: tsd.selectedDate.toString(), 41702 per_page: segment.limit || 30 41703 })), tsd.selectedDate.toString(), tsd.selectedTime); 41704 for (const date of dates) { 41705 if (!date.event_id || !date.start_time) continue; 41706 const event = await shop.asyncFetch(() => shop.getEvent(date.event_id)); 41707 if (!event?.tickets?.length) continue; 41708 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41709 "by_ticket_ids[]": event.tickets, 41710 "by_ticket_types[]": ["normal"], 41711 by_bookable: true, 41712 valid_at: date.start_time.slice(0, 10) 41713 })); 41714 shop.capacityManager.addQuotas(quotas); 41715 const firstQuota = Object.values(quotas)[0]; 41716 const time = firstQuota ? Object.keys(firstQuota.capacities)[0] : date.start_time; 41717 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, time), time); 41718 await enrichTicketsWithContent(segment, uiTickets); 41719 for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time })); 41720 } 41721 } 41722 }, 41723 "events:admission:timeslot": { 41724 name: "events:admission:timeslot", 41725 calendarEndpoint: "events", 41726 requires: [{ 41727 kind: "tsd", 41728 field: "selectedDate" 41729 }, { 41730 kind: "tsd", 41731 field: "selectedTimeslot" 41732 }], 41733 isCalendarVisible: () => true, 41734 isTimeslotsVisible: () => true, 41735 isTicketsVisible: () => true, 41736 loadTimeslots: (tsd) => loadEventsTimeslots(tsd), 41737 async loadProducts(segment) { 41738 const tsd = segment.ticketSelectionDetails; 41739 if (!tsd?.selectedDate || !tsd.selectedTime) return; 41740 const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({ 41741 by_bookable: true, 41742 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41743 "by_exhibition_ids[]": tsd.exhibitionIds, 41744 "by_event_ids[]": tsd.eventIds, 41745 "by_language_ids[]": segment.languageIds, 41746 "by_catch_word_ids[]": segment.catchWordIds, 41747 start_at: tsd.selectedDate.toString(), 41748 per_page: segment.limit || 30 41749 })), tsd.selectedDate.toString(), tsd.selectedTime); 41750 for (const date of dates) { 41751 if (!date.event_id || !date.start_time) continue; 41752 const event = await shop.asyncFetch(() => shop.getEvent(date.event_id)); 41753 if (!event?.tickets?.length) continue; 41754 const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({ 41755 "by_ticket_ids[]": event.tickets, 41756 by_ticket_type: "time_slot", 41757 by_bookable: true, 41758 valid_at: date.start_time.slice(0, 10) 41759 })); 41760 shop.capacityManager.addQuotas(quotas); 41761 const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, date.start_time), date.start_time); 41762 await enrichTicketsWithContent(segment, uiTickets); 41763 for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: date.start_time })); 41764 } 41765 } 41766 }, 41767 "events:price": { 41768 name: "events:price", 41769 calendarEndpoint: "events", 41770 requires: [{ 41771 kind: "tsd", 41772 field: "selectedDate" 41773 }, { 41774 kind: "tsd", 41775 field: "selectedTimeslot" 41776 }], 41777 isCalendarVisible: () => true, 41778 isTimeslotsVisible: () => true, 41779 isTicketsVisible: () => true, 41780 loadTimeslots: (tsd) => loadEventsTimeslots(tsd), 41781 async loadProducts(segment) { 41782 const tsd = segment.ticketSelectionDetails; 41783 if (!tsd?.selectedDate || !tsd.selectedTime) return; 41784 const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({ 41785 by_bookable: true, 41786 "by_museum_ids[]": segment.museumIds ?? tsd.museumIds, 41787 "by_exhibition_ids[]": tsd.exhibitionIds, 41788 "by_event_ids[]": tsd.eventIds, 41789 "by_language_ids[]": segment.languageIds, 41790 "by_catch_word_ids[]": segment.catchWordIds, 41791 start_at: tsd.selectedDate.toString(), 41792 per_page: segment.limit || 30 41793 })), tsd.selectedDate.toString(), tsd.selectedTime); 41794 const query = segment.query; 41795 for (const date of dates) { 41796 if (!date.prices?.length) continue; 41797 const prices = query ? date.prices.filter((p) => p.title?.includes(query)) : date.prices; 41798 for (const price of prices) { 41799 const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title }); 41800 segment.preCart.addItem(createCartItem(ticket, { time: date.start_time })); 41801 } 41802 if (date.seats) shop.capacityManager.addSeats(date.id, date.seats); 41803 } 41804 } 41805 }, 41806 coupon: { 41807 name: "coupon", 41808 calendarEndpoint: null, 41809 requires: [], 41810 isCalendarVisible: () => false, 41811 isTimeslotsVisible: () => false, 41812 isTicketsVisible: () => true, 41813 loadTimeslots: async () => {}, 41814 async loadProducts(segment) { 41815 const coupons = await shop.asyncFetch(() => shop.getCoupons()); 41816 for (const coupon of coupons ?? []) segment.preCart.addItem(createCartItem(createUICoupon(coupon))); 41817 } 41818 } 41819 }; 41820 function getFilter(name) {
41821 const filter = REGISTRY[name]; 41822 if (!filter) console.warn(`[ticket-selection] Unknown filter "${name}". Valid filters: ${FILTER_NAMES.join(", ")}`); 41823 return filter; 41824 } 41825 var validFilterNames = FILTER_NAMES; 41826 //#endregion 41827 //#region src/components/ticketSelection/TicketSelectionDetails.svelte.ts 41828 var lastUId = 0; 41829 var TicketSelectionDetails = class { 41830 uid = lastUId++; 41831 #filters = /* @__PURE__ */ state(); 41832 get filters() { 41833 return get$2(this.#filters); 41834 } 41835 set filters(value) { 41836 set(this.#filters, value, true); 41837 } 41838 #eventIds = /* @__PURE__ */ state(); 41839 get eventIds() { 41840 return get$2(this.#eventIds); 41841 } 41842 set eventIds(value) { 41843 set(this.#eventIds, value, true); 41844 } 41845 #museumIds = /* @__PURE__ */ state(); 41846 get museumIds() { 41847 return get$2(this.#museumIds); 41848 } 41849 set museumIds(value) { 41850 set(this.#museumIds, value, true); 41851 } 41852 #exhibitionIds = /* @__PURE__ */ state(); 41853 get exhibitionIds() { 41854 return get$2(this.#exhibitionIds); 41855 } 41856 set exhibitionIds(value) { 41857 set(this.#exhibitionIds, value, true); 41858 } 41859 #ticketIds = /* @__PURE__ */ state(); 41860 get ticketIds() { 41861 return get$2(this.#ticketIds); 41862 } 41863 set ticketIds(value) { 41864 set(this.#ticketIds, value, true); 41865 } 41866 #ticketGroupIds = /* @__PURE__ */ state(); 41867 get ticketGroupIds() { 41868 return get$2(this.#ticketGroupIds); 41869 } 41870 set ticketGroupIds(value) { 41871 set(this.#ticketGroupIds, value, true); 41872 } 41873 #selectedDate = /* @__PURE__ */ state(); 41874 get selectedDate() { 41875 return get$2(this.#selectedDate); 41876 } 41877 set selectedDate(value) { 41878 set(this.#selectedDate, value, true); 41879 } 41880 #selectedTimeslot = /* @__PURE__ */ state(); 41881 get selectedTimeslot() { 41882 return get$2(this.#selectedTimeslot); 41883 } 41884 set selectedTimeslot(value) { 41885 set(this.#selectedTimeslot, value, true); 41886 } 41887 timeslotTicketIds = []; 41888 #selectedTime = /* @__PURE__ */ user_derived(() => this.selectedTimeslot); 41889 get selectedTime() { 41890 return get$2(this.#selectedTime); 41891 } 41892 set selectedTime(value) { 41893 set(this.#selectedTime, value); 41894 } 41895 #ticketSegments = /* @__PURE__ */ state(proxy([])); 41896 get ticketSegments() { 41897 return get$2(this.#ticketSegments); 41898 } 41899 set ticketSegments(value) { 41900 set(this.#ticketSegments, value, true); 41901 } 41902 #preCarts = /* @__PURE__ */ user_derived(() => this.ticketSegments.map((tg) => tg.preCart)); 41903 get preCarts() { 41904 return get$2(this.#preCarts); 41905 } 41906 set preCarts(value) { 41907 set(this.#preCarts, value); 41908 } 41909 #timeslotDetails = /* @__PURE__ */ state(); 41910 get timeslotDetails() { 41911 return get$2(this.#timeslotDetails); 41912 } 41913 set timeslotDetails(value) { 41914 set(this.#timeslotDetails, value, true); 41915 } 41916 addTicketSegment(ticketGroup) { 41917 this.ticketSegments.push(ticketGroup); 41918 } 41919 get isCalendarVisible() { 41920 return Boolean(this.filters?.some((f) => getFilter(f).isCalendarVisible(this))); 41921 } 41922 get isTimeslotsVisible() { 41923 return Boolean(this.filters?.some((f) => getFilter(f).isTimeslotsVisible(this))); 41924 } 41925 get isTicketsVisible() { 41926 return Boolean(this.filters?.some((f) => getFilter(f).isTicketsVisible(this))); 41927 } 41928 }; 41929 var KEY$2 = "go-ticket-selection"; 41930 var setTicketSelectionDetails = createSetDetails(KEY$2); 41931 var getTicketSelectionDetails = createGetDetails(KEY$2); 41932 //#endregion 41933 //#region src/components/if/If.svelte 41934 function If($$anchor, $$props) { 41935 push($$props, true); 41936 let when = prop($$props, "when", 7), then = prop($$props, "then", 7, "show"); 41937 const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host); 41938 const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value); 41939 const _personalizationDetails = getPersonalizationDetails($$props.$$host); 41940 const personalizationDetails = /* @__PURE__ */ user_derived(() => _personalizationDetails.value); 41941 const _formDetails = getDetails$1($$props.$$host); 41942 const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value); 41943 const _cartView = getCartDetails($$props.$$host); 41944 const cartView = /* @__PURE__ */ user_derived(() => _cartView.value); 41945 let data = /* @__PURE__ */ user_derived(() => ({ 41946 ticketSelection: get$2(ticketSelectionDetails),
41947 personalizationDetails: get$2(personalizationDetails), 41948 formData: get$2(formDetails)?.formData, 41949 cart: shop.cart, 41950 cartView: get$2(cartView) 41951 })); 41952 const _setData = (_data) => { 41953 set(data, _data); 41954 }; 41955 const _getData = () => { 41956 return get$2(data); 41957 }; 41958 let evaluatedWhen = /* @__PURE__ */ user_derived(() => evaluateExpression(when(), get$2(data))); 41959 let content = null; 41960 user_effect(() => { 41961 const host = $$props.$$host; 41962 if (get$2(evaluatedWhen) && then() === "show") { 41963 if (content) { 41964 host.appendChild(content); 41965 content = null; 41966 } 41967 } else if (!content && host.childNodes.length > 0) { 41968 content = document.createDocumentFragment(); 41969 while (host.firstChild) content.appendChild(host.firstChild); 41970 } 41971 }); 41972 return pop({ 41973 _setData, 41974 _getData, 41975 get when() { 41976 return when(); 41977 }, 41978 set when($$value) { 41979 when($$value); 41980 flushSync(); 41981 }, 41982 get then() { 41983 return then(); 41984 }, 41985 set then($$value = "show") { 41986 then($$value); 41987 flushSync(); 41988 } 41989 }); 41990 } 41991 customElements.define("go-if", create_custom_element(If, { 41992 when: { 41993 attribute: "when", 41994 reflect: true, 41995 type: "String" 41996 }, 41997 then: { 41998 attribute: "then", 41999 reflect: true, 42000 type: "String" 42001 } 42002 }, [], ["_setData", "_getData"])); 42003 //#endregion 42004 //#region src/components/init/GomusInit.svelte 42005 function GomusInit($$anchor, $$props) { 42006 push($$props, true); 42007 let apiUrl = prop($$props, "apiUrl", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7); 42008 locale(locale() || localStorage.getItem("lang") || "en"); 42009 user_effect(() => { 42010 if (shopDomain() !== shop.shopDomain || apiUrl() !== shop.apiUrl || locale() !== shop.locale) { 42011 shop.load(apiUrl(), shopDomain(), locale()); 42012 console.warn("shop loaded due to prop change"); 42013 } 42014 }); 42015 return pop({ 42016 get apiUrl() { 42017 return apiUrl(); 42018 }, 42019 set apiUrl($$value) { 42020 apiUrl($$value); 42021 flushSync(); 42022 }, 42023 get shopDomain() { 42024 return shopDomain(); 42025 }, 42026 set shopDomain($$value) { 42027 shopDomain($$value); 42028 flushSync(); 42029 }, 42030 get locale() { 42031 return locale(); 42032 }, 42033 set locale($$value) { 42034 locale($$value); 42035 flushSync(); 42036 } 42037 }); 42038 } 42039 customElements.define("gomus-init", create_custom_element(GomusInit, { 42040 apiUrl: { 42041 attribute: "api-url", 42042 type: "String" 42043 }, 42044 shopDomain: { 42045 attribute: "shop-domain", 42046 type: "String" 42047 }, 42048 locale: { 42049 attribute: "locale", 42050 type: "String" 42051 } 42052 }, [], [])); 42053 //#endregion 42054 //#region src/components/init/Init.svelte 42055 function Init($$anchor, $$props) { 42056 push($$props, true); 42057 let apiDomain = prop($$props, "apiDomain", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7); 42058 let apiUrl = `https://${apiDomain()}`; 42059 var $$exports = { 42060 get apiDomain() { 42061 return apiDomain(); 42062 }, 42063 set apiDomain($$value) { 42064 apiDomain($$value); 42065 flushSync(); 42066 }, 42067 get shopDomain() { 42068 return shopDomain(); 42069 }, 42070 set shopDomain($$value) { 42071 shopDomain($$value); 42072 flushSync(); 42073 }, 42074 get locale() { 42075 return locale(); 42076 }, 42077 set locale($$value) { 42078 locale($$value); 42079 flushSync(); 42080 } 42081 }; 42082 GomusInit($$anchor, { 42083 get apiUrl() { 42084 return apiUrl; 42085 }, 42086 get shopDomain() { 42087 return shopDomain(); 42088 }, 42089 get locale() { 42090 return locale(); 42091 } 42092 }); 42093 return pop($$exports); 42094 } 42095 customElements.define("go-init", create_custom_element(Init, { 42096 apiDomain: { 42097 attribute: "api-domain", 42098 type: "String" 42099 }, 42100 shopDomain: { 42101 attribute: "shop-domain", 42102 type: "String" 42103 }, 42104 locale: { 42105 attribute: "locale", 42106 type: "String" 42107 } 42108 }, [], [])); 42109 //#endregion 42110 //#region src/components/link/Link.svelte 42111 function Link($$anchor, $$props) { 42112 push($$props, true); 42113 const to = prop($$props, "to", 7); 42114 const href = /* @__PURE__ */ user_derived(() => configStore.config.urls[to()]); 42115 const a = wrapInElement($$props.$$host, "a"); 42116 user_effect(() => { 42117 if (!get$2(href)) { 42118 console.warn(`[go-link] No URL found for route "${to()}".`); 42119 a.removeAttribute("href"); 42120 return; 42121 } 42122 a.setAttribute("href", get$2(href)()); 42123 }); 42124 a.addEventListener("click", (e) => { 42125 e.preventDefault(); 42126 if (!configStore.config.urls[to()]) { 42127 console.warn(`[go-link] No URL found for route "${to()}". You can define it with go.config.urls.${to()} = () => 'https://example.com/my-route'`); 42128 return; 42129 } 42130 configStore.config.navigateTo(configStore.config.urls[to()]()); 42131 }); 42132 return pop({ 42133 get to() { 42134 return to(); 42135 }, 42136 set to($$value) { 42137 to($$value); 42138 flushSync(); 42139 } 42140 }); 42141 }
42142 customElements.define("go-link", create_custom_element(Link, { to: { 42143 attribute: "to", 42144 reflect: true, 42145 type: "String" 42146 } }, [], [])); 42147 //#endregion 42148 //#region src/components/membershipActivation/MembershipActivation.svelte 42149 function MembershipActivation($$anchor, $$props) { 42150 push($$props, true); 42151 let custom = prop($$props, "custom", 7, false); 42152 Forms.defineForm({ 42153 id: "membershipActivation", 42154 submitLabel: "membership.activation.actions.submit", 42155 fields: [{ 42156 key: "email", 42157 required: true 42158 }] 42159 }); 42160 async function onSubmit(event) { 42161 const details = event.target.details; 42162 if ((await shop.activateMembership(details.formData)).response?.ok) $$props.$$host.dispatchEvent(new Event("go-success", { 42163 bubbles: true, 42164 composed: true 42165 })); 42166 else details.apiErrors = [shop.t("membership.activation.form.errors.requestFailed")]; 42167 } 42168 wrapInElement($$props.$$host, "go-form", { 42169 "form-id": "membershipActivation", 42170 custom: custom() 42171 }); 42172 $$props.$$host.addEventListener("submit", onSubmit); 42173 return pop({ 42174 get custom() { 42175 return custom(); 42176 }, 42177 set custom($$value = false) { 42178 custom($$value); 42179 flushSync(); 42180 } 42181 }); 42182 } 42183 customElements.define("go-membership-activation", create_custom_element(MembershipActivation, { custom: { 42184 attribute: "custom", 42185 reflect: true, 42186 type: "Boolean" 42187 } }, [], [])); 42188 //#endregion 42189 //#region src/components/order/lib/OrderDetails.svelte.ts 42190 var OrderDetails = class { 42191 #token = /* @__PURE__ */ state(); 42192 get token() { 42193 return get$2(this.#token); 42194 } 42195 set token(value) { 42196 set(this.#token, value, true); 42197 } 42198 constructor(token) { 42199 this.token = token; 42200 } 42201 get order() { 42202 if (!this.token) return; 42203 return snapshot(shop.order(this.token)); 42204 } 42205 downloadLink(item, barcodeId) { 42206 if (!this.order?.is_valid) return; 42207 switch (item.type) { 42208 case "Event": return `${shop.apiUrl}/api/v4/orders/${this.order.id}/events/${item.attributes.id}.pdf?locale=${shop.locale}&token=${this.token}`; 42209 case "Ticket": 42210 if (item.attributes.ticket_type === "annual" && !item.attributes.is_voucher) if (configStore.config.urls.annualTicketPersonalizationList?.()) return configStore.config.urls.annualTicketPersonalizationList(this.token); 42211 else return shop.urls?.annualTicketPersonalizationList(this.token); 42212 else return `${shop.apiUrl}/api/v4/orders/${this.order.id}/tickets/${item.attributes.id}.pdf?locale=${shop.locale}&token=${this.token}&barcode_id=${barcodeId}`; 42213 break; 42214 default: break; 42215 } 42216 } 42217 }; 42218 var KEY$1 = "go-order-details"; 42219 var setDetails = createSetDetails(KEY$1); 42220 var getDetails = createGetDetails(KEY$1); 42221 //#endregion 42222 //#region src/components/order/components/Order.svelte 42223 function Order($$anchor, $$props) { 42224 push($$props, true); 42225 let token = prop($$props, "token", 7); 42226 const orderDetails = new OrderDetails(token()); 42227 setDetails($$props.$$host, orderDetails); 42228 onMount(() => { 42229 shop.cart.clearItems(); 42230 if (shop.auth.isGuest()) shop.auth.signOut(); 42231 }); 42232 return pop({ 42233 orderDetails, 42234 get token() { 42235 return token(); 42236 }, 42237 set token($$value) { 42238 token($$value); 42239 flushSync(); 42240 } 42241 }); 42242 } 42243 customElements.define("go-order", create_custom_element(Order, { token: { 42244 attribute: "token", 42245 reflect: true, 42246 type: "String" 42247 } }, [], ["orderDetails"])); 42248 //#endregion 42249 //#region src/components/order/components/subcomponents/breakdown/items/Event.svelte 42250 var root$9 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1); 42251 var root_1$4 = /* @__PURE__ */ from_html(`<br/> <span class="go-order-item-quantities"> </span>`, 1); 42252 var root_2$3 = /* @__PURE__ */ from_html(`<a aria-label="iCal link"> </a>`); 42253 var root_3$3 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count">1</li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!> <!> <a class="go-ticket-download" target="_blank" rel="noopener noreferrer"> </a></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"></li> <li class="go-order-breakdown-ical"><!></li></ul></article></li>`); 42254 function Event$1($$anchor, $$props) { 42255 push($$props, true); 42256 let item = prop($$props, "item", 7), orderDetails = prop($$props, "orderDetails", 7); 42257 var $$exports = { 42258 get item() { 42259 return item(); 42260 }, 42261 set item($$value) { 42262 item($$value); 42263 flushSync(); 42264 }, 42265 get orderDetails() { 42266 return orderDetails(); 42267 }, 42268 set orderDetails($$value) { 42269 orderDetails($$value); 42270 flushSync(); 42271 } 42272 }; 42273 var li = root_3$3(); 42274 var article = child(li); 42275 var ul = child(article); 42276 var li_1 = sibling(child(ul), 2); 42277 var span = child(li_1); 42278 var text = child(span, true); 42279 reset(span);
42280 var node = sibling(span, 2); 42281 var consequent = ($$anchor) => { 42282 var fragment = root$9(); 42283 var span_1 = first_child(fragment); 42284 var text_1 = child(span_1, true); 42285 reset(span_1); 42286 var span_2 = sibling(span_1, 2); 42287 var text_2 = child(span_2, true); 42288 reset(span_2); 42289 template_effect(($0, $1) => { 42290 set_text(text_1, $0); 42291 set_text(text_2, $1); 42292 }, [() => formatDate(item().attributes.start_time, { 42293 month: "numeric", 42294 day: "numeric" 42295 }, shop.locale), () => formatTime(item().attributes.start_time)]); 42296 append($$anchor, fragment); 42297 }; 42298 if_block(node, ($$render) => { 42299 if (item().attributes.start_time) $$render(consequent); 42300 }); 42301 var node_1 = sibling(node, 2); 42302 each(node_1, 17, () => item().attributes.quantities, (scalePrice) => scalePrice.id, ($$anchor, scalePrice) => { 42303 var fragment_1 = root_1$4(); 42304 var span_3 = sibling(first_child(fragment_1), 2); 42305 var text_3 = child(span_3); 42306 reset(span_3); 42307 template_effect(() => set_text(text_3, `${get$2(scalePrice).quantity ?? ""} x ${get$2(scalePrice).title ?? ""}`)); 42308 append($$anchor, fragment_1); 42309 }); 42310 var a = sibling(node_1, 2); 42311 var text_4 = child(a, true); 42312 reset(a); 42313 reset(li_1); 42314 var li_2 = sibling(li_1, 2); 42315 var text_5 = child(li_2, true); 42316 reset(li_2); 42317 var li_3 = sibling(li_2, 4); 42318 var node_2 = child(li_3); 42319 var consequent_1 = ($$anchor) => { 42320 var a_1 = root_2$3(); 42321 var text_6 = child(a_1, true); 42322 reset(a_1); 42323 template_effect(($0) => { 42324 set_attribute(a_1, "href", shop.apiUrl + item().attributes.ical_url); 42325 set_text(text_6, $0); 42326 }, [() => shop.t("common.calendar")]); 42327 append($$anchor, a_1); 42328 }; 42329 if_block(node_2, ($$render) => { 42330 if (item().attributes.ical_url) $$render(consequent_1); 42331 }); 42332 reset(li_3); 42333 reset(ul); 42334 reset(article); 42335 reset(li); 42336 template_effect(($0, $1, $2) => { 42337 set_text(text, item().attributes.title); 42338 set_attribute(a, "href", $0); 42339 set_text(text_4, $1); 42340 set_text(text_5, $2); 42341 }, [ 42342 () => orderDetails().downloadLink(item()), 42343 () => shop.t("common.download"), 42344 () =>
42344 formatCurrency$1(item().price_cents) 42345 ]); 42346 append($$anchor, li); 42347 return pop($$exports); 42348 } 42349 create_custom_element(Event$1, { 42350 item: {}, 42351 orderDetails: {} 42352 }, [], [], { mode: "open" }); 42353 //#endregion 42354 //#region src/components/order/components/subcomponents/breakdown/items/TicketSale.svelte 42355 var root$8 = /* @__PURE__ */ from_html(`<br/> <span class="go-order-item-quantities" data-testid="order-sub-ticket"> </span>`, 1); 42356 var root_1$3 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date"> </span> <span class="go-cart-item-time"> </span>`, 1); 42357 var root_2$2 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date"> </span>`); 42358 var root_3$2 = /* @__PURE__ */ from_html(`<!> <br/> <a class="go-ticket-download" target="_blank" rel="noopener noreferrer"> </a>`, 1); 42359 var root_4$2 = /* @__PURE__ */ from_html(`<br/> <a class="go-ticket-personalization"> </a>`, 1); 42360 var root_5 = /* @__PURE__ */ from_html(`<a aria-label="passbook link"><img alt="apple wallet icon"/></a>`); 42361 var root_6 = /* @__PURE__ */ from_html(`<a aria-label="iCal link"> </a>`); 42362 var root_7 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count"></li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!> <!></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"><!></li> <li class="go-order-breakdown-ical"><!></li></ul></article></li>`); 42363 var root_8 = /* @__PURE__ */ from_html(`<a class="go-ticket-download" target="_blank" rel="noopener noreferrer"> </a>`); 42364 var root_9 = /* @__PURE__ */ from_html(`<a class="go-ticket-personalization"> </a>`); 42365 var root_10 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count"> </li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"></li></ul></article></li>`); 42366 function TicketSale($$anchor, $$props) { 42367 push($$props, true); 42368 const APPLE_WALLET_CDN_PATH = `https://cdn.shop.platform.gomus.de/apple_wallet_${shop.locale}.svg`; 42369 let item = prop($$props, "item", 7), orderDetails = prop($$props, "orderDetails", 7); 42370 const subTicketSales = /* @__PURE__ */ user_derived(() => (item().attributes.sub_ticket_sales ?? []).filter((s) => s.quantity > 0)); 42371 var $$exports = { 42372 get item() { 42373 return item(); 42374 }, 42375 set item($$value) { 42376 item($$value); 42377 flushSync(); 42378 }, 42379 get orderDetails() { 42380 return orderDetails(); 42381 }, 42382 set orderDetails($$value) { 42383 orderDetails($$value); 42384 flushSync(); 42385 } 42386 }; 42387 var fragment = comment(); 42388 var node = first_child(fragment); 42389 var consequent_5 = ($$anchor) => { 42390 var fragment_1 = comment(); 42391 each(first_child(fragment_1), 17, () => ({ length: item().attributes.quantity }), index$1, ($$anchor, $$item, index) => { 42392 var li = root_7(); 42393 var article = child(li); 42394 var ul = child(article); 42395 var li_1 = child(ul); 42396 li_1.textContent = "1"; 42397 var li_2 = sibling(li_1, 2); 42398 var span = child(li_2); 42399 var text = child(span, true); 42400 reset(span); 42401 var node_2 = sibling(span, 2); 42402 each(node_2, 17, () => get$2(subTicketSales), (sub) => sub.id, ($$anchor, sub) => { 42403 var fragment_2 = root$8(); 42404 var span_1 = sibling(first_child(fragment_2), 2); 42405 var text_1 = child(span_1); 42406 reset(span_1); 42407 template_effect(() => set_text(text_1, `${get$2(sub).quantity ?? ""} x ${get$2(sub).title ?? ""}`)); 42408 append($$anchor, fragment_2); 42409 }); 42410 var node_3 = sibling(node_2, 2); 42411 var consequent_2 = ($$anchor) => { 42412 const barcodeId = /* @__PURE__ */ user_derived(() => item().attributes.barcodes[index]?.id); 42413 var fragment_3 = root_3$2(); 42414 var node_4 = first_child(fragment_3); 42415 var consequent = ($$anchor) => { 42416 var fragment_4 = root_1$3(); 42417 var span_2 = first_child(fragment_4); 42418 var text_2 = child(span_2, true); 42419 reset(span_2); 42420 var span_3 = sibling(span_2, 2); 42421 var text_3 = child(span_3, true); 42422 reset(span_3); 42423 template_effect(($0, $1) => { 42424 set_text(text_2, $0); 42425 set_text(text_3, $1); 42426 }, [() => formatDate(item().attributes.start_time, { 42427 month: "numeric", 42428 day: "numeric" 42429 }, shop.locale), () => formatTime(item().attributes.start_time)]); 42430 append($$anchor, fragment_4); 42431 }; 42432 var consequent_1 = ($$anchor) => { 42433 var span_4 = root_2$2(); 42434 var text_4 = child(span_4, true); 42435 reset(span_4); 42436 template_effect(($0) => set_text(text_4, $0), [() => formatDate(item().attributes.start_time, { 42437 month: "numeric", 42438 day: "numeric" 42439 }, shop.locale)]); 42440 append($$anchor, span_4); 42441 }; 42442 if_block(node_4, ($$render) => { 42443 if (item().attributes.ticket_type === "time_slot") $$render(consequent); 42444 else if (item().attributes.ticket_type === "normal") $$render(consequent_1, 1); 42445 }); 42446 var a = sibling(node_4, 4); 42447 var text_5 = child(a, true); 42448 reset(a); 42449 template_effect(($0, $1) => { 42450 set_attribute(a, "href", $0); 42451 set_text(text_5, $1); 42452 }, [() =>
42452 orderDetails().downloadLink(item(), get$2(barcodeId)), () => shop.t("common.download")]); 42453 append($$anchor, fragment_3); 42454 }; 42455 var alternate = ($$anchor) => { 42456 var fragment_5 = root_4$2(); 42457 var a_1 = sibling(first_child(fragment_5), 2); 42458 var text_6 = child(a_1, true); 42459 reset(a_1); 42460 template_effect(($0, $1) => { 42461 set_attribute(a_1, "href", $0); 42462 set_text(text_6, $1); 42463 }, [() => orderDetails().downloadLink(item()), () => shop.t("common.personalize")]); 42464 append($$anchor, fragment_5); 42465 }; 42466 if_block(node_3, ($$render) => { 42467 if (item().attributes.ticket_type == "time_slot" || item().attributes.ticket_type == "normal") $$render(consequent_2); 42468 else $$render(alternate, -1); 42469 }); 42470 reset(li_2); 42471 var li_3 = sibling(li_2, 2); 42472 var text_7 = child(li_3, true); 42473 reset(li_3); 42474 var li_4 = sibling(li_3, 2); 42475 var node_5 = child(li_4); 42476 var consequent_3 = ($$anchor) => { 42477 var a_2 = root_5(); 42478 var img = child(a_2); 42479 reset(a_2); 42480 template_effect(() => { 42481 set_attribute(a_2, "href", shop.apiUrl + item().attributes.barcodes[index]?.passbook_url); 42482 set_attribute(img, "src", APPLE_WALLET_CDN_PATH); 42483 }); 42484 append($$anchor, a_2); 42485 }; 42486 if_block(node_5, ($$render) => { 42487 if (item().attributes.barcodes[index] && item().attributes.barcodes[index]?.passbook_url) $$render(consequent_3); 42488 }); 42489 reset(li_4); 42490 var li_5 = sibling(li_4, 2); 42491 var node_6 = child(li_5); 42492 var consequent_4 = ($$anchor) => { 42493 var a_3 = root_6(); 42494 var text_8 = child(a_3, true); 42495 reset(a_3); 42496 template_effect(($0) => { 42497 set_attribute(a_3, "href", shop.apiUrl + item().attributes.ical_url); 42498 set_text(text_8, $0); 42499 }, [() => shop.t("common.calendar")]); 42500 append($$anchor, a_3); 42501 }; 42502 if_block(node_6, ($$render) => { 42503 if (item().attributes.ical_url) $$render(consequent_4); 42504 }); 42505 reset(li_5); 42506 reset(ul); 42507 reset(article); 42508 reset(li); 42509 template_effect(($0) => { 42510 set_text(text, item().attributes.title); 42511 set_text(text_7, $0); 42512 }, [() =>
42512 formatCurrency$1(item().price_cents)]); 42513 append($$anchor, li); 42514 }); 42515 append($$anchor, fragment_1); 42516 }; 42517 var alternate_2 = ($$anchor) => { 42518 var li_6 = root_10(); 42519 var article_1 = child(li_6); 42520 var ul_1 = child(article_1); 42521 var li_7 = child(ul_1); 42522 var text_9 = child(li_7, true); 42523 reset(li_7); 42524 var li_8 = sibling(li_7, 2); 42525 var span_5 = child(li_8); 42526 var text_10 = child(span_5, true); 42527 reset(span_5); 42528 var node_7 = sibling(span_5, 2); 42529 var consequent_6 = ($$anchor) => { 42530 var a_4 = root_8(); 42531 var text_11 = child(a_4, true); 42532 reset(a_4); 42533 template_effect(($0, $1) => { 42534 set_attribute(a_4, "href", $0); 42535 set_text(text_11, $1); 42536 }, [() => orderDetails().downloadLink(item()), () => shop.t("common.download")]); 42537 append($$anchor, a_4); 42538 }; 42539 var alternate_1 = ($$anchor) => { 42540 var a_5 = root_9(); 42541 var text_12 = child(a_5, true); 42542 reset(a_5); 42543 template_effect(($0, $1) => { 42544 set_attribute(a_5, "href", $0); 42545 set_text(text_12, $1); 42546 }, [() => orderDetails().downloadLink(item()), () => shop.t("common.personalize")]); 42547 append($$anchor, a_5); 42548 }; 42549 if_block(node_7, ($$render) => { 42550 if (item().attributes.is_voucher) $$render(consequent_6); 42551 else $$render(alternate_1, -1); 42552 }); 42553 reset(li_8); 42554 var li_9 = sibling(li_8, 2); 42555 var text_13 = child(li_9, true); 42556 reset(li_9); 42557 next(2); 42558 reset(ul_1); 42559 reset(article_1); 42560 reset(li_6); 42561 template_effect(($0) => { 42562 set_text(text_9, item().attributes.quantity); 42563 set_text(text_10, item().attributes.title); 42564 set_text(text_13, $0); 42565 }, [() =>
42565 formatCurrency$1(item().price_cents)]); 42566 append($$anchor, li_6); 42567 }; 42568 if_block(node, ($$render) => { 42569 if (item().attributes.ticket_type == "time_slot" || item().attributes.ticket_type == "normal") $$render(consequent_5); 42570 else $$render(alternate_2, -1); 42571 }); 42572 append($$anchor, fragment); 42573 return pop($$exports); 42574 } 42575 create_custom_element(TicketSale, { 42576 item: {}, 42577 orderDetails: {} 42578 }, [], [], { mode: "open" }); 42579 //#endregion 42580 //#region src/components/order/components/subcomponents/breakdown/Breakdown.svelte 42581 var root$7 = /* @__PURE__ */ from_html(`<ol><li class="data-go-order-breakdown-header"><ul><li class="go-order-breakdown-header-count"> </li> <li class="go-order-breakdown-header-product"> </li> <li class="go-order-breakdown-header-price"> </li> <li class="go-order-breakdown-header-passbook"></li></ul></li> <!> <li class="go-order-breakdown-footer"><ul><li class="go-cart-footer-title"></li> <li class="go-cart-footer-count"></li> <li class="go-cart-footer-price"> </li> <li class="go-cart-footer-passbook"></li></ul></li></ol>`); 42582 function Breakdown($$anchor, $$props) { 42583 push($$props, true); 42584 const _orderDetails = getDetails($$props.$$host); 42585 const orderDetails = /* @__PURE__ */ user_derived(() => _orderDetails.value); 42586 let order = /* @__PURE__ */ user_derived(() => get$2(orderDetails)?.order); 42587 var fragment = comment(); 42588 var node = first_child(fragment); 42589 var consequent_2 = ($$anchor) => { 42590 var ol = root$7(); 42591 var li = child(ol); 42592 var ul = child(li); 42593 var li_1 = child(ul); 42594 var text = child(li_1, true); 42595 reset(li_1); 42596 var li_2 = sibling(li_1, 2); 42597 var text_1 = child(li_2, true); 42598 reset(li_2); 42599 var li_3 = sibling(li_2, 2); 42600 var text_2 = child(li_3, true); 42601 reset(li_3); 42602 next(2); 42603 reset(ul); 42604 reset(li); 42605 var node_1 = sibling(li, 2); 42606 each(node_1, 17, () => get$2(order).items, (item) => item.id, ($$anchor, item) => { 42607 var fragment_1 = comment(); 42608 var node_2 = first_child(fragment_1); 42609 var consequent = ($$anchor) => { 42610 TicketSale($$anchor, { 42611 get item() { 42612 return get$2(item); 42613 }, 42614 get orderDetails() { 42615 return get$2(orderDetails); 42616 } 42617 }); 42618 }; 42619 var consequent_1 = ($$anchor) => { 42620 Event$1($$anchor, { 42621 get item() { 42622 return get$2(item); 42623 }, 42624 get orderDetails() { 42625 return get$2(orderDetails); 42626 } 42627 }); 42628 }; 42629 if_block(node_2, ($$render) => { 42630 if (get$2(item).type === "Ticket") $$render(consequent); 42631 else if (get$2(item).type === "Event") $$render(consequent_1, 1); 42632 }); 42633 append($$anchor, fragment_1); 42634 }); 42635 var li_4 = sibling(node_1, 2); 42636 var ul_1 = child(li_4); 42637 var li_5 = sibling(child(ul_1), 4); 42638 var text_3 = child(li_5, true); 42639 reset(li_5); 42640 next(2); 42641 reset(ul_1); 42642 reset(li_4); 42643 reset(ol); 42644 template_effect(($0, $1, $2, $3) => { 42645 set_text(text, $0); 42646 set_text(text_1, $1); 42647 set_text(text_2, $2); 42648 set_text(text_3, $3); 42649 }, [ 42650 () => shop.t("common.table.count"), 42651 () => shop.t("common.table.product"), 42652 () => shop.t("common.table.price"), 42653 () => shop.t("common.table.total", { value: formatCurrency$1(get$2(order).total_price_cents) }) 42654 ]); 42655 append($$anchor, ol); 42656 }; 42657 if_block(node, ($$render) => { 42658 if (get$2(order) && get$2(orderDetails)) $$render(consequent_2); 42659 }); 42660 append($$anchor, fragment); 42661 pop(); 42662 } 42663 customElements.define("go-order-breakdown", create_custom_element(Breakdown, {}, [], [])); 42664 //#endregion 42665 //#region src/components/order/components/subcomponents/invoiceId/InvoiceId.svelte 42666 function InvoiceId($$anchor, $$props) { 42667 push($$props, true); 42668 const _orderDetails = getDetails($$props.$$host); 42669 const orderDetails = /* @__PURE__ */ user_derived(() => _orderDetails.value); 42670 let order = /* @__PURE__ */ user_derived(() => get$2(orderDetails)?.order); 42671 next(); 42672 var text = text$1(); 42673 template_effect(() => set_text(text, get$2(order)?.id)); 42674 append($$anchor, text); 42675 pop(); 42676 } 42677 customElements.define("go-order-invoice-id", create_custom_element(InvoiceId, {}, [], [])); 42678 //#endregion 42679 //#region src/components/profile/password/Password.svelte 42680 var root$6 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2); 42681 function Password($$anchor, $$props) { 42682 push($$props, false); 42683 Forms.defineForm({ 42684 id: "passwordResetForm", 42685 fields: [ 42686 { 42687 key: "currentPassword", 42688 required: true 42689 }, 42690 { 42691 key: "password", 42692 required: true 42693 }, 42694 { 42695 key: "confirmPassword", 42696 required: true 42697 } 42698 ] 42699 }); 42700 async function submit(event) { 42701 const details = event.target.details; 42702 const result = await shop.updatePassword(details.formData); 42703 if (result.data) { 42704 details.successMessage = shop.t("user.passwordSuccess.desc.title"); 42705 details.apiErrors = []; 42706 } else details.apiErrors = result.error?.errors || result.error || result.errors; 42707 } 42708 init$1(); 42709 var go_form = root$6(); 42710 set_custom_element_data(go_form, "formId", "passwordResetForm"); 42711 event("submit", go_form, submit); 42712 append($$anchor, go_form); 42713 pop(); 42714 } 42715 customElements.define("go-profile-password", create_custom_element
42715(Password, {}, [], [])); 42716 //#endregion 42717 //#region src/components/profile/details/Details.svelte 42718 var root$5 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2); 42719 function Details$2($$anchor, $$props) { 42720 push($$props, true); 42721 Forms.defineForm({ 42722 id: "accountDetailsForm", 42723 fields: [ 42724 { 42725 key: "salutation", 42726 required: false 42727 }, 42728 { 42729 key: "firstName", 42730 required: true 42731 }, 42732 { 42733 key: "lastName", 42734 required: true 42735 }, 42736 { 42737 key: "email", 42738 required: true 42739 }, 42740 { 42741 key: "confirmEmail", 42742 required: true 42743 }, 42744 { 42745 key: "language", 42746 required: true 42747 } 42748 ] 42749 }); 42750 let form = /* @__PURE__ */ state(void 0); 42751 const user = /* @__PURE__ */ user_derived(() => shop.getCustomer()); 42752 onMount(async () => { 42753 await shop.waitForAllFetches(); 42754 await pollUntilTruthy(() => get$2(form).details); 42755 await pollUntilTruthy(() => get$2(user).data); 42756 get$2(form).details.fill(get$2(user).data); 42757 }); 42758 var go_form = root$5(); 42759 set_custom_element_data(go_form, "formId", "accountDetailsForm"); 42760 bind_this(go_form, ($$value) => set(form, $$value), () => get$2(form)); 42761 append($$anchor, go_form); 42762 pop(); 42763 } 42764 customElements.define("go-profile-details", create_custom_element(Details$2, {}, [], [])); 42765 //#endregion 42766 //#region src/components/profile/overview/Overview.svelte 42767 var root$4 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1); 42768 function Overview($$anchor, $$props) { 42769 push($$props, true); 42770 const user = /* @__PURE__ */ user_derived(() => shop.getCustomer()); 42771 const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data); 42772 var fragment = comment(); 42773 var node = first_child(fragment); 42774 var consequent = ($$anchor) => { 42775 var fragment_1 = root$4(); 42776 var div = first_child(fragment_1); 42777 var text = child(div); 42778 reset(div); 42779 var div_1 = sibling(div, 2); 42780 var text_1 = child(div_1, true); 42781 reset(div_1); 42782 template_effect(() => { 42783 set_text(text, `${get$2(data).name ?? ""} 42784 ${get$2(data).surname ?? ""}`); 42785 set_text(text_1, get$2(data).email); 42786 }); 42787 append($$anchor, fragment_1); 42788 }; 42789 var alternate = ($$anchor) => { 42790 var text_2 = text$1(); 42791 template_effect(($0) => set_text(text_2, $0), [() => shop.t("user.login.desc.text")]); 42792 append($$anchor, text_2); 42793 }; 42794 if_block(node, ($$render) => { 42795 if (get$2(data)) $$render(consequent); 42796 else $$render(alternate, -1); 42797 }); 42798 append($$anchor, fragment); 42799 pop(); 42800 } 42801 customElements.define("go-profile-overview", create_custom_element(Overview, {}, [], [])); 42802 //#endregion 42803 //#region src/components/ticketSelection/TicketSelection.svelte 42804 function TicketSelection($$anchor, $$props) { 42805 push($$props, true); 42806 function parseFilters(value) { 42807 if (!value) return void 0; 42808 const out = []; 42809 for (const raw of value.split(",")) { 42810 const t = raw.trim(); 42811 if (!t) continue; 42812 if (validFilterNames.includes(t)) out.push(t); 42813 else console.warn(`[go-ticket-selection] Unknown filter "${t}". Valid filters: ${validFilterNames.join(", ")}`); 42814 } 42815 return out.length ? out : void 0; 42816 } 42817 let filters = prop($$props, "filters", 7), eventIds = prop($$props, "eventIds", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), selectedDate = prop($$props, "selectedDate", 7), selectedTimeslot = prop($$props, "selectedTimeslot", 7), ticketIds = prop($$props, "ticketIds", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7); 42818 const details = new TicketSelectionDetails(); 42819 user_effect(() => { 42820 if ($$props.$$host.hasAttribute("mode")) console.warn("[go-ticket-selection] `mode` attribute is deprecated and ignored. Use `filters` instead, e.g. filters=\"ticket:timeslot\"."); 42821 }); 42822 user_effect(() => { 42823 details.filters = parseFilters(filters()); 42824 details.eventIds = parseIds(eventIds()); 42825 details.museumIds = parseIds(museumIds()); 42826 details.exhibitionIds = parseIds(exhibitionIds()); 42827 details.ticketIds = parseIds(ticketIds()); 42828 details.ticketGroupIds = parseIds(ticketGroupIds()); 42829 details.selectedTimeslot = selectedTimeslot();
42830 if (selectedDate()) details.selectedDate = $58246871e4652552$export$6b862160d295c8e(selectedDate()); 42831 }); 42832 user_effect(() => { 42833 if (details.selectedDate) untrack(() => { 42834 selectedDate(details.selectedDate.toString()); 42835 }); 42836 }); 42837 user_effect(() => { 42838 details.selectedTimeslot; 42839 untrack(() => { 42840 selectedTimeslot(details.selectedTimeslot); 42841 }); 42842 }); 42843 setTicketSelectionDetails($$props.$$host, details); 42844 return pop({ 42845 details, 42846 get filters() { 42847 return filters(); 42848 }, 42849 set filters($$value) { 42850 filters($$value); 42851 flushSync(); 42852 }, 42853 get eventIds() { 42854 return eventIds(); 42855 }, 42856 set eventIds($$value) { 42857 eventIds($$value); 42858 flushSync(); 42859 }, 42860 get museumIds() { 42861 return museumIds(); 42862 }, 42863 set museumIds($$value) { 42864 museumIds($$value); 42865 flushSync(); 42866 }, 42867 get exhibitionIds() { 42868 return exhibitionIds(); 42869 }, 42870 set exhibitionIds($$value) { 42871 exhibitionIds($$value); 42872 flushSync(); 42873 }, 42874 get selectedDate() { 42875 return selectedDate(); 42876 }, 42877 set selectedDate($$value) { 42878 selectedDate($$value); 42879 flushSync(); 42880 }, 42881 get selectedTimeslot() { 42882 return selectedTimeslot(); 42883 }, 42884 set selectedTimeslot($$value) { 42885 selectedTimeslot($$value); 42886 flushSync(); 42887 }, 42888 get ticketIds() { 42889 return ticketIds(); 42890 }, 42891 set ticketIds($$value) { 42892 ticketIds($$value); 42893 flushSync(); 42894 }, 42895 get ticketGroupIds() { 42896 return ticketGroupIds(); 42897 }, 42898 set ticketGroupIds($$value) { 42899 ticketGroupIds($$value); 42900 flushSync(); 42901 } 42902 }); 42903 } 42904 customElements.define("go-ticket-selection", create_custom_element(TicketSelection, { 42905 filters: { 42906 attribute: "filters", 42907 reflect: true, 42908 type: "String" 42909 }, 42910 eventIds: { 42911 attribute: "event-ids", 42912 reflect: true, 42913 type: "String" 42914 }, 42915 ticketIds: { 42916 attribute: "ticket-ids", 42917 reflect: true, 42918 type: "String" 42919 }, 42920 ticketGroupIds: { 42921 attribute: "ticket-group-ids", 42922 reflect: true, 42923 type: "String" 42924 }, 42925 museumIds: { 42926 attribute: "museum-ids", 42927 reflect: true, 42928 type: "String" 42929 }, 42930 exhibitionIds: { 42931 attribute: "exhibition-ids", 42932 reflect: true, 42933 type: "String" 42934 }, 42935 selectedDate: { 42936 attribute: "selected-date", 42937 reflect: true, 42938 type: "String" 42939 }, 42940 selectedTimeslot: { 42941 attribute: "selected-timeslot", 42942 reflect: true, 42943 type: "String" 42944 } 42945 }, [], ["details"])); 42946 //#endregion 42947 //#region src/components/ticketSelection/subcomponents/tickets/Tickets.svelte 42948 function Tickets($$anchor, $$props) { 42949 push($$props, true); 42950 const _tsd = getTicketSelectionDetails($$props.$$host); 42951 const tsd = /* @__PURE__ */ user_derived(() => _tsd.value); 42952 user_effect(() => { 42953 $$props.$$host.style.display = get$2(tsd)?.isTicketsVisible ? "block" : "none"; 42954 $$props.$$host.classList.toggle("is-hidden", !get$2(tsd)?.isTicketsVisible); 42955 $$props.$$host.classList.toggle("is-visible", get$2(tsd)?.isTicketsVisible); 42956 }); 42957 pop(); 42958 } 42959 customElements.define("go-tickets", create_custom_element(Tickets, {}, [], [])); 42960 //#endregion 42961 //#region src/components/ticketSelection/subcomponents/tickets/TicketsEmpty.svelte 42962 function TicketsEmpty($$anchor, $$props) { 42963 push($$props, true); 42964 const _tsd = getTicketSelectionDetails($$props.$$host); 42965 const tsd = /* @__PURE__ */ user_derived(() => _tsd.value); 42966 const numTickets = /* @__PURE__ */ user_derived(() => sum(get$2(tsd)?.preCarts || [], (pc) => pc.items.length)); 42967 const isVisible = /* @__PURE__ */ user_derived(() => !get$2(tsd)?.isTicketsVisible || get$2(tsd)?.isTicketsVisible && get$2(numTickets) === 0); 42968 user_effect(() => { 42969 $$props.$$host.style.display = get$2(isVisible) ? "block" : "none"; 42970 $$props.$$host.classList.toggle("is-hidden", !get$2(isVisible)); 42971 $$props.$$host.classList.toggle("is-visible", get$2(isVisible)); 42972 }); 42973 pop(); 42974 } 42975 customElements.define("go-tickets-empty", create_custom_element(TicketsEmpty, {}, [], [])); 42976 //#endregion 42977 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/TicketsSum.svelte 42978 function TicketsSum($$anchor, $$props) { 42979 push($$props, true); 42980 const _tsd = getTicketSelectionDetails($$props.$$host); 42981 const tsd = /* @__PURE__ */ user_derived(() => _tsd.value); 42982 let val = /* @__PURE__ */ user_derived(() =>
42982 sum(get$2(tsd)?.preCarts || [], (c) => c.totalPriceCents)); 42983 next(); 42984 var text = text$1(); 42985 template_effect(($0) => set_text(text, $0), [() => formatCurrency(get$2(val))]); 42986 append($$anchor, text); 42987 pop(); 42988 } 42989 customElements.define("go-tickets-sum", create_custom_element(TicketsSum, {}, [], [])); 42990 //#endregion 42991 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.ts 42992 var SegmentDetails = class { 42993 #ticketSelectionDetails; 42994 get ticketSelectionDetails() { 42995 return get$2(this.#ticketSelectionDetails); 42996 } 42997 set ticketSelectionDetails(value) { 42998 set(this.#ticketSelectionDetails, value); 42999 } 43000 #preCart = /* @__PURE__ */ state(proxy(createCart())); 43001 get preCart() { 43002 return get$2(this.#preCart); 43003 } 43004 set preCart(value) { 43005 set(this.#preCart, value, true); 43006 } 43007 #filters = /* @__PURE__ */ state(); 43008 get filters() { 43009 return get$2(this.#filters); 43010 } 43011 set filters(value) { 43012 set(this.#filters, value, true); 43013 } 43014 #dateId = /* @__PURE__ */ state(); 43015 get dateId() { 43016 return get$2(this.#dateId); 43017 } 43018 set dateId(value) { 43019 set(this.#dateId, value, true); 43020 } 43021 #limit = /* @__PURE__ */ state(); 43022 get limit() { 43023 return get$2(this.#limit); 43024 } 43025 set limit(value) { 43026 set(this.#limit, value, true); 43027 } 43028 #query = /* @__PURE__ */ state(); 43029 get query() { 43030 return get$2(this.#query); 43031 } 43032 set query(value) { 43033 set(this.#query, value, true); 43034 } 43035 #ticketGroupIds = /* @__PURE__ */ state(proxy([])); 43036 get ticketGroupIds() { 43037 return get$2(this.#ticketGroupIds); 43038 } 43039 set ticketGroupIds(value) { 43040 set(this.#ticketGroupIds, value, true); 43041 } 43042 #languageIds = /* @__PURE__ */ state(proxy([])); 43043 get languageIds() { 43044 return get$2(this.#languageIds); 43045 } 43046 set languageIds(value) { 43047 set(this.#languageIds, value, true); 43048 } 43049 #catchWordIds = /* @__PURE__ */ state(proxy([])); 43050 get catchWordIds() { 43051 return get$2(this.#catchWordIds); 43052 } 43053 set catchWordIds(value) { 43054 set(this.#catchWordIds, value, true); 43055 } 43056 #museumIds = /* @__PURE__ */ state(proxy([])); 43057 get museumIds() { 43058 return get$2(this.#museumIds); 43059 } 43060 set museumIds(value) { 43061 set(this.#museumIds, value, true); 43062 } 43063 #withContent = /* @__PURE__ */ state(false); 43064 get withContent() { 43065 return get$2(this.#withContent); 43066 } 43067 set withContent(value) { 43068 set(this.#withContent, value, true); 43069 } 43070 constructor(filters, tsdWrapper) { 43071 this.filters = filters === void 0 ? void 0 : Array.isArray(filters) ? filters : [filters]; 43072 this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value); 43073 } 43074 get effectiveFilters() { 43075 if (this.filters?.length) return this.filters; 43076 return this.ticketSelectionDetails?.filters ?? []; 43077 } 43078 clear() { 43079 this.preCart = createCart([]); 43080 } 43081 toString() { 43082 return JSON.stringify({ 43083 filters: this.effectiveFilters, 43084 preCart: this.preCart.toString() 43085 }); 43086 } 43087 async loadTickets() { 43088 this.preCart = createCart(); 43089 const filters = this.effectiveFilters.filter((f) => f !== "custom"); 43090 await Promise.all(filters.map((f) => getFilter(f).loadProducts(this))); 43091 } 43092 }; 43093 var KEY = "go-ticket-segment"; 43094 var setSegmentDetails = createSetDetails(KEY); 43095 var getSegmentDetails = createGetDetails(KEY); 43096 //#endregion 43097 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegment.svelte 43098 function TicketSegment($$anchor, $$props) { 43099 push($$props, true); 43100 const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7), museumIds = prop($$props, "museumIds", 7), withContent = prop($$props, "withContent", 7); 43101 function parseFilters(value) { 43102 if (!value) return void 0; 43103 const out = value.split(",").map((s) => s.trim()).filter(Boolean); 43104 return out.length ? out : void 0; 43105 } 43106 const tsdWrapper = getTicketSelectionDetails($$props.$$host); 43107 const tsd = tsdWrapper.value; 43108 const details = new SegmentDetails(parseFilters(filters()), tsdWrapper); 43109 setSegmentDetails($$props.$$host, details); 43110 user_effect(() => { 43111 details.filters = parseFilters(filters()); 43112 details.dateId = dateId(); 43113 details.query = query(); 43114 details.limit = limit(); 43115 details.ticketGroupIds = parseIds(ticketGroupIds()); 43116 details.languageIds = parseIds(languageIds()); 43117 details.catchWordIds = parseIds(catchWordIds()); 43118 details.museumIds = parseIds(museumIds()); 43119 details.withContent = Boolean(withContent()); 43120 }); 43121 user_effect(() => { 43122 details.dateId; 43123 details.filters; 43124 details.ticketGroupIds; 43125 details.museumIds; 43126 details.languageIds; 43127 details.catchWordIds; 43128 details.query; 43129 details.limit; 43130 details.withContent; 43131 tsd?.filters; 43132 tsd?.selectedTimeslot; 43133 tsd?.selectedTime; 43134 tsd?.selectedDate; 43135 tsd?.museumIds; 43136 untrack(() => { 43137 details.loadTickets(); 43138 }); 43139 }); 43140 user_effect(() => { 43141 if (!tsd) return; 43142 untrack(() => tsd?.addTicketSegment(details)); 43143 }); 43144 const numTickets = /* @__PURE__ */ user_derived(() => details.preCart.items.length); 43145 user_effect(() => { 43146 $$props.$$host.classList.toggle("is-empty", get$2(numTickets) === 0); 43147 }); 43148 return pop({ 43149 details, 43150 get filters() { 43151 return filters(); 43152 }, 43153 set filters($$value) { 43154 filters($$value); 43155 flushSync(); 43156 }, 43157 get dateId() { 43158 return dateId(); 43159 }, 43160 set dateId($$value) { 43161 dateId($$value); 43162 flushSync(); 43163 }, 43164 get query() { 43165 return query(); 43166 }, 43167 set query($$value) { 43168 query($$value); 43169 flushSync(); 43170 }, 43171 get limit() { 43172 return limit(); 43173 }, 43174 set limit($$value) { 43175 limit($$value); 43176 flushSync(); 43177 }, 43178 get ticketGroupIds() { 43179 return ticketGroupIds(); 43180 }, 43181 set ticketGroupIds($$value) { 43182 ticketGroupIds($$value); 43183 flushSync(); 43184 }, 43185 get languageIds() { 43186 return languageIds(); 43187 }, 43188 set languageIds($$value) { 43189 languageIds($$value); 43190 flushSync(); 43191 }, 43192 get catchWordIds() { 43193 return catchWordIds(); 43194 }, 43195 set catchWordIds($$value) { 43196 catchWordIds($$value); 43197 flushSync(); 43198 }, 43199 get museumIds() { 43200 return museumIds(); 43201 }, 43202 set museumIds($$value) { 43203 museumIds($$value); 43204 flushSync(); 43205 }, 43206 get withContent() { 43207 return withContent(); 43208 }, 43209 set withContent($$value) { 43210 withContent($$value); 43211 flushSync(); 43212 } 43213 }); 43214 } 43215 customElements.define("go-ticket-segment", create_custom_element
43215(TicketSegment, { 43216 catchWordIds: { 43217 attribute: "catch-word-ids", 43218 reflect: true, 43219 type: "String" 43220 }, 43221 dateId: { 43222 attribute: "date-id", 43223 reflect: true, 43224 type: "Number" 43225 }, 43226 filters: { 43227 attribute: "filters", 43228 reflect: true, 43229 type: "String" 43230 }, 43231 languageIds: { 43232 attribute: "language-ids", 43233 reflect: true, 43234 type: "String" 43235 }, 43236 limit: { 43237 attribute: "limit", 43238 reflect: true, 43239 type: "Number" 43240 }, 43241 query: { 43242 attribute: "query", 43243 reflect: true, 43244 type: "String" 43245 }, 43246 ticketGroupIds: { 43247 attribute: "ticket-group-ids", 43248 reflect: true, 43249 type: "String" 43250 }, 43251 museumIds: { 43252 attribute: "museum-ids", 43253 reflect: true, 43254 type: "String" 43255 }, 43256 withContent: { 43257 attribute: "with-content", 43258 reflect: true, 43259 type: "Boolean" 43260 } 43261 }, [], ["details"])); 43262 //#endregion 43263 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegmentEmpty.svelte 43264 function TicketSegmentEmpty($$anchor, $$props) { 43265 push($$props, true); 43266 const tsd = getTicketSelectionDetails($$props.$$host).value; 43267 const details = getSegmentDetails($$props.$$host).value; 43268 const numTickets = /* @__PURE__ */ user_derived(() => details?.preCart.items.length); 43269 const isVisible = /* @__PURE__ */ user_derived(() => !tsd?.isTicketsVisible || tsd?.isTicketsVisible && get$2(numTickets) === 0); 43270 user_effect(() => { 43271 $$props.$$host.style.display = get$2(isVisible) ? "block" : "none"; 43272 $$props.$$host.classList.toggle("is-hidden", !get$2(isVisible)); 43273 $$props.$$host.classList.toggle("is-visible", get$2(isVisible)); 43274 }); 43275 pop(); 43276 } 43277 customElements.define("go-ticket-segment-empty", create_custom_element(TicketSegmentEmpty, {}, [], [])); 43278 //#endregion 43279 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/Item.svelte 43280 var root$3 = /* @__PURE__ */ from_html(`<span class="go-tickets-item-title-event-title"> </span> <span class="go-tickets-item-title-product-title"> </span>`, 1); 43281 var root_1$2 = /* @__PURE__ */ from_html(`<li class="go-tickets-item-info"><button type="button" data-testid="ticket-info-toggle"></button></li>`); 43282 var root_2$1 = /* @__PURE__ */ from_html(`<li class="go-ticket-additional-info" data-testid="ticket-additional-info"> </li>`); 43283 var root_3$1 = /* @__PURE__ */ from_html(`<ul class="go-sub-tickets" role="list"></ul>`); 43284 var root_4$1 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-tickets-item-title"><!></li> <!> <li class="go-tickets-item-description" data-go-tickets-description=""></li> <!> <li class="go-tickets-item-price" data-go-tickets-price=""> </li> <li class="go-tickets-item-quality" data-go-tickets-quality=""><!></li></ul></article> <!></li>`); 43285 function Item($$anchor, $$props) { 43286 const uid = props_id(); 43287 push($$props, true); 43288 const scaled_title = ($$anchor) => { 43289 var fragment = root$3(); 43290 var span = first_child(fragment); 43291 var text = child(span); 43292 reset(span); 43293 var span_1 = sibling(span, 2); 43294 var text_1 = child(span_1, true); 43295 reset(span_1); 43296 template_effect(($0) => { 43297 set_text(text, `${item().product.event_title ?? ""} - ${$0 ?? ""}`); 43298 set_text(text_1, item().product.title); 43299 }, [() => formatTime(item().time)]); 43300 append($$anchor, fragment); 43301 }; 43302 const default_title = ($$anchor) => { 43303 next(); 43304 var text_2 = text$1(); 43305 template_effect(() => set_text(text_2, item().product.title)); 43306 append($$anchor, text_2); 43307 }; 43308 let item = prop($$props, "item", 7), details = prop($$props, "details", 7); 43309 let capacity = /* @__PURE__ */ state(void 0); 43310 let subMaxes = /* @__PURE__ */ state(proxy({})); 43311 const mantleProduct = /* @__PURE__ */ user_derived(() => isMantleTicket(item().product) ? item().product : null); 43312 let infoExpanded = /* @__PURE__ */ state(false); 43313 const reductionReason = /* @__PURE__ */ user_derived(() => item().product?.content?.reduction_reason); 43314 const infoPanelId = `go-ticket-info-${uid}`; 43315 user_effect(() => { 43316 details().preCart.items.map((i) => i.quantity); 43317 details().preCart.items.forEach((i) => i.mantle && Object.values(i.mantle.composition)); 43318 shop.cart?.items.map((i) => i.quantity);
43319 shop.cart?.items.forEach((i) => i.mantle && Object.values(i.mantle.composition)); 43320 untrack(() => { 43321 set(capacity, shop.capacityManager.capacity(shop.cart, item(), details().preCart), true); 43322 set(subMaxes, shop.capacityManager.subTicketMaxes(shop.cart, item(), details().preCart), true); 43323 }); 43324 }); 43325 function updateSub(subId, quantity) { 43326 if (item().mantle) item().mantle.composition[subId] = quantity; 43327 } 43328 let titleSnippet = default_title; 43329 if (isEventTicket(item().product)) titleSnippet = scaled_title; 43330 var $$exports = { 43331 get item() { 43332 return item(); 43333 }, 43334 set item($$value) { 43335 item($$value); 43336 flushSync(); 43337 }, 43338 get details() { 43339 return details(); 43340 }, 43341 set details($$value) { 43342 details($$value); 43343 flushSync(); 43344 } 43345 }; 43346 var fragment_2 = comment(); 43347 var node = first_child(fragment_2); 43348 var consequent_3 = ($$anchor) => { 43349 var li = root_4$1(); 43350 var article = child(li); 43351 var ul = child(article); 43352 var li_1 = child(ul); 43353 var node_1 = child(li_1); 43354 titleSnippet(node_1); 43355 reset(li_1); 43356 var node_2 = sibling(li_1, 2); 43357 var consequent = ($$anchor) => { 43358 var li_2 = root_1$2(); 43359 var button = child(li_2); 43360 reset(li_2); 43361 template_effect(($0) => { 43362 set_class(button, 1, clsx(["go-ticket-info-icon", get$2(infoExpanded) && "is-active"])); 43363 set_attribute(button, "aria-expanded", get$2(infoExpanded)); 43364 set_attribute(button, "aria-controls", infoPanelId); 43365 set_attribute(button, "aria-label", $0); 43366 }, [() => shop.t("ticket.list.additionalInfo")]); 43367 delegated("click", button, () => set(infoExpanded, !get$2(infoExpanded))); 43368 append($$anchor, li_2); 43369 }; 43370 if_block(node_2, ($$render) => { 43371 if (get$2(reductionReason)) $$render(consequent); 43372 }); 43373 var li_3 = sibling(node_2, 2); 43374 html$2(li_3, () => purify.sanitize(item().product.description), true); 43375 reset(li_3); 43376 var node_3 = sibling(li_3, 2); 43377 var consequent_1 = ($$anchor) => { 43378 var li_4 = root_2$1(); 43379 var text_3 = child(li_4, true); 43380 reset(li_4); 43381 template_effect(($0) => { 43382 set_attribute(li_4, "id", infoPanelId); 43383 set_attribute(li_4, "hidden", !get$2(infoExpanded)); 43384 set_text(text_3, $0); 43385 }, [() => shop.t(get$2(reductionReason))]); 43386 append($$anchor, li_4); 43387 }; 43388 if_block(node_3, ($$render) => { 43389 if (get$2(reductionReason)) $$render(consequent_1); 43390 }); 43391 var li_5 = sibling(node_3, 2); 43392 var text_4 = child(li_5, true); 43393 reset(li_5); 43394 var li_6 = sibling(li_5, 2); 43395 QuantityControl(child(li_6), { 43396 get value() { 43397 return item().quantity; 43398 }, 43399 get min() { 43400 return get$2(capacity).min; 43401 }, 43402 get max() { 43403 return get$2(capacity).max; 43404 }, 43405 get label() { 43406 return item().product.title; 43407 }, 43408 onChange: (q) => item().quantity = q 43409 }); 43410 reset(li_6); 43411 reset(ul); 43412 reset(article); 43413 var node_5 = sibling(article, 2); 43414 var consequent_2 = ($$anchor) => { 43415 var ul_1 = root_3$1(); 43416 each(ul_1, 21, () => subTicketDefs(get$2(mantleProduct)), (sub) => sub.id, ($$anchor, sub) => { 43417 { 43418 let $0 = /* @__PURE__ */ user_derived(() => item().mantle?.composition?.[get$2(sub).id] ?? 0); 43419 SubRow($$anchor, { 43420 get sub() { 43421 return get$2(sub); 43422 }, 43423 get quantity() { 43424 return get$2($0); 43425 }, 43426 get max() { 43427 return get$2(subMaxes)[get$2(sub).id]; 43428 }, 43429 onChange: (q) => updateSub(get$2(sub).id, q) 43430 }); 43431 } 43432 }); 43433 reset(ul_1); 43434 template_effect(() => set_attribute(ul_1, "aria-label", get$2(mantleProduct).title)); 43435 append($$anchor, ul_1); 43436 }; 43437 if_block(node_5, ($$render) => { 43438 if (get$2(mantleProduct) && item().quantity > 0) $$render(consequent_2); 43439 }); 43440 reset(li); 43441 template_effect(() => { 43442 set_class(article, 1, clsx(["go-tickets-item", get$2(capacity).bookedOut && "is-booked-out"])); 43443 set_attribute(article, "data-testid", item().uuid); 43444 set_text(text_4, item().price_formatted); 43445 }); 43446 append($$anchor, li); 43447 }; 43448 if_block(node, ($$render) => { 43449 if (get$2(capacity) && !get$2(capacity).unavailable) $$render(consequent_3); 43450 }); 43451 append($$anchor, fragment_2); 43452 return pop($$exports); 43453 } 43454 delegate(["click"]);
43455 create_custom_element(Item, { 43456 item: {}, 43457 details: {} 43458 }, [], [], { mode: "open" }); 43459 //#endregion 43460 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/Body.svelte 43461 var root$2 = /* @__PURE__ */ from_html(`<ol class="go-tickets" data-testid="tickets"><li class="go-tickets-header" data-go-tickets-header="" data-testid="tickets-header"><ul><li class="go-tickets-header-title" data-go-tickets-title=""> </li> <li class="go-tickets-header-description" data-go-tickets-description=""> </li> <li class="go-tickets-header-price" data-go-tickets-price=""> </li> <li class="go-tickets-header-quality" data-go-tickets-quality=""> </li></ul></li> <!></ol>`); 43462 function Body($$anchor, $$props) { 43463 push($$props, true); 43464 const _details = getSegmentDetails($$props.$$host); 43465 const details = /* @__PURE__ */ user_derived(() => _details.value); 43466 const anyItems = /* @__PURE__ */ user_derived(() => get$2(details)?.preCart?.items.length && get$2(details)?.preCart?.items.length > 0); 43467 var fragment = comment(); 43468 var node = first_child(fragment); 43469 var consequent = ($$anchor) => { 43470 var ol = root$2(); 43471 var li = child(ol); 43472 var ul = child(li); 43473 var li_1 = child(ul); 43474 var text = child(li_1, true); 43475 reset(li_1); 43476 var li_2 = sibling(li_1, 2); 43477 var text_1 = child(li_2, true); 43478 reset(li_2); 43479 var li_3 = sibling(li_2, 2); 43480 var text_2 = child(li_3, true); 43481 reset(li_3); 43482 var li_4 = sibling(li_3, 2); 43483 var text_3 = child(li_4, true); 43484 reset(li_4); 43485 reset(ul); 43486 reset(li); 43487 each(sibling(li, 2), 17, () => get$2(details).preCart.items, (ci) => ci.uuid, ($$anchor, ci) => { 43488 Item($$anchor, { 43489 get item() { 43490 return get$2(ci); 43491 }, 43492 get details() { 43493 return get$2(details); 43494 } 43495 }); 43496 }); 43497 reset(ol); 43498 template_effect(($0, $1, $2, $3) => { 43499 set_text(text, $0); 43500 set_text(text_1, $1); 43501 set_text(text_2, $2); 43502 set_text(text_3, $3); 43503 }, [ 43504 () => shop.t("product.detail.table.title"), 43505 () => shop.t("product.detail.table.desc"), 43506 () => shop.t("product.detail.table.price"), 43507 () => shop.t("product.detail.table.quantity") 43508 ]); 43509 append($$anchor, ol); 43510 }; 43511 if_block(node, ($$render) => { 43512 if (get$2(anyItems) && get$2(details)) $$render(consequent); 43513 }); 43514 append($$anchor, fragment); 43515 pop(); 43516 } 43517 customElements.define("go-ticket-segment-body", create_custom_element(Body, {}, [], [])); 43518 //#endregion 43519 //#region src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/Sum.svelte 43520 function Sum($$anchor, $$props) { 43521 push($$props, true); 43522 const _details = getSegmentDetails($$props.$$host); 43523 const details = /* @__PURE__ */ user_derived(() => _details.value); 43524 next(); 43525 var text = text$1(); 43526 template_effect(() => set_text(text, get$2(details)?.preCart.totalFormatted)); 43527 append($$anchor, text); 43528 pop(); 43529 } 43530 customElements.define("go-ticket-segment-sum", create_custom_element(Sum, {}, [], [])); 43531 //#endregion 43532 //#region src/components/ticketSelection/subcomponents/timeslots/lib/lib.svelte.ts 43533 var Details$1 = class { 43534 #tsd; 43535 get tsd() { 43536 return get$2(this.#tsd); 43537 } 43538 set tsd(value) { 43539 set(this.#tsd, value); 43540 } 43541 #timeslots = /* @__PURE__ */ state(proxy([])); 43542 get timeslots() { 43543 return get$2(this.#timeslots); 43544 } 43545 set timeslots(value) { 43546 set(this.#timeslots, value, true); 43547 } 43548 constructor(tsdWrapper) { 43549 if (!tsdWrapper) return; 43550 this.#tsd = /* @__PURE__ */ user_derived(() => tsdWrapper.value); 43551 if (this.tsd) this.tsd.timeslotDetails = this; 43552 } 43553 get boockedOutCount() { 43554 return this.timeslots.filter((t) => t.capacity == 0).length; 43555 } 43556 recalculateCapacities() { 43557 const date = this.tsd?.selectedDate; 43558 if (!date) { 43559 this.timeslots = []; 43560 return; 43561 } 43562 const quotaManager = shop.capacityManager.quotaManager; 43563 quotaManager.clearPrecart(); 43564 for (const item of shop.cart?.items ?? []) { 43565 const product = item.product; 43566 if (isUITicket(product)) quotaManager.setPrecartItemQuantity(product.id, item.quantity ?? 0); 43567 } 43568 this.timeslots = quotaManager.timeslotsOn(date, this.tsd?.timeslotTicketIds).map((x) => ({ 43569 ...x, 43570 startAt: x.timeSlot, 43571 timeFormatted: x.timeSlot.substring(11, 16), 43572 available: x.capacity > 0 43573 })); 43574 } 43575 }; 43576 //#endregion 43577 //#region src/components/ticketSelection/subcomponents/timeslots/Timeslots.svelte 43578 var root$1 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`); 43579 var root_1$1 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots"></ul>`); 43580 function Timeslots($$anchor, $$props) { 43581 push($$props, true); 43582 const binding_group = [];
43583 const details = new Details$1(getTicketSelectionDetails($$props.$$host)); 43584 user_effect(() => { 43585 const tsd = details.tsd; 43586 if (!tsd) return; 43587 const filters = tsd.filters; 43588 const date = tsd.selectedDate; 43589 untrack(async () => { 43590 tsd.timeslotTicketIds = []; 43591 if (filters?.length && date) await Promise.all(filters.map((f) => getFilter(f).loadTimeslots(tsd))); 43592 details.recalculateCapacities(); 43593 }); 43594 }); 43595 user_effect(() => { 43596 shop.cart?.items.map((i) => i.quantity); 43597 untrack(() => details.recalculateCapacities()); 43598 }); 43599 const dispatchTimeslotSelect = (target, selected) => { 43600 if (!target || !("dispatchEvent" in target)) return; 43601 target.dispatchEvent(new CustomEvent("go-timeslot-select", { 43602 detail: { selected }, 43603 bubbles: true, 43604 composed: true 43605 })); 43606 }; 43607 const change = (e) => { 43608 dispatchTimeslotSelect(e.target, details.tsd?.selectedTimeslot); 43609 }; 43610 user_effect(() => { 43611 const tsd = details.tsd; 43612 if (!tsd) return; 43613 const slots = details.timeslots; 43614 if (slots.length !== 1) return; 43615 const only = slots[0]; 43616 if (!only.available) return; 43617 if (tsd.selectedTimeslot === only.startAt) return; 43618 tsd.selectedTimeslot = only.startAt; 43619 dispatchTimeslotSelect($$props.$$host, only.startAt); 43620 }); 43621 var $$exports = { details }; 43622 var fragment = comment(); 43623 var node = first_child(fragment); 43624 var consequent = ($$anchor) => { 43625 var ul = root_1$1(); 43626 each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor, timeslot) => { 43627 const unavailable = /* @__PURE__ */ user_derived(() => timeslot.totalCapacity === 0); 43628 const soldOut = /* @__PURE__ */ user_derived(() => !get$2(unavailable) && timeslot.capacity === 0); 43629 const disabled = /* @__PURE__ */ user_derived(() => get$2(unavailable) || get$2(soldOut) || !timeslot.available); 43630 const selected = /* @__PURE__ */ user_derived(() => details.tsd?.selectedTimeslot === timeslot.startAt); 43631 var li = root$1(); 43632 var label = child(li); 43633 var text = child(label); 43634 var input = sibling(text); 43635 remove_input_defaults(input); 43636 var input_value; 43637 reset(label); 43638 reset(li); 43639 template_effect(() => { 43640 set_class(li, 1, clsx({ 43641 "go-timeslot": true, 43642 "is-unavailable": get$2(unavailable), 43643 "is-sold-out": get$2(soldOut), 43644 "is-disabled": get$2(disabled), 43645 "is-selected": get$2(selected) 43646 })); 43647 set_text(text, `${timeslot.timeFormatted ?? ""} `); 43648 input.disabled = get$2(disabled); 43649 set_attribute(input, "aria-disabled", get$2(disabled)); 43650 if (input_value !== (input_value = timeslot.startAt)) input.value = (input.__value = timeslot.startAt) ?? ""; 43651 }); 43652 delegated("change", input, change); 43653 bind_group(binding_group, [], input, () => { 43654 timeslot.startAt; 43655 return details.tsd.selectedTimeslot; 43656 }, ($$value) => details.tsd.selectedTimeslot = $$value); 43657 append($$anchor, li); 43658 }); 43659 reset(ul); 43660 append($$anchor, ul); 43661 }; 43662 if_block(node, ($$render) => { 43663 if (details.tsd?.isTimeslotsVisible) $$render(consequent); 43664 }); 43665 append($$anchor, fragment); 43666 return pop($$exports); 43667 } 43668 delegate(["change"]); 43669 customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"])); 43670 //#endregion 43671 //#region src/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.ts 43672 var Calendar = class { 43673 #details = /* @__PURE__ */ state(); 43674 get details() { 43675 return get$2(this.#details); 43676 } 43677 set details(value) { 43678 set(this.#details, value, true); 43679 } 43680 #startAt = /* @__PURE__ */ state(proxy($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2()))); 43681 get startAt() { 43682 return get$2(this.#startAt); 43683 } 43684 set startAt(value) { 43685 set(this.#startAt, value, true); 43686 } 43687 #selected = /* @__PURE__ */ state(void 0); 43688 get selected() { 43689 return get$2(this.#selected); 43690 } 43691 set selected(value) { 43692 set(this.#selected, value, true); 43693 } 43694 get endpoint() { 43695 return (this.details?.filters?.map((f) => getFilter(f).calendarEndpoint).filter(Boolean) ?? [])[0] ?? null; 43696 } 43697 get dates() { 43698 if (!this.details) return void 0; 43699 switch (this.endpoint) { 43700 case "tickets": return this.ticketsDates(); 43701 case "events": return this.eventsDates(); 43702 default: return; 43703 } 43704 } 43705 isDateDisabled(date) { 43706 if (this.dates) return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0 || this.dates[date.toString()] == "unavailable"; 43707 return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0; 43708 } 43709 isDateUnavailable(date) { 43710 return this.dates?.[date.toString()] == "fully_booked"; 43711 } 43712 get apiFilters() { 43713 return this.details?.filters?.map((f) =>
43713 getFilter(f).apiToken).filter(Boolean); 43714 } 43715 params(startAt) { 43716 if (!this.details) return {}; 43717 return { 43718 by_bookable: true, 43719 "by_ticket_types[]": this.apiFilters, 43720 "by_ticket_ids[]": this.details.ticketIds, 43721 "by_ticket_group_ids[]": this.details.ticketGroupIds, 43722 "by_museum_ids[]": this.details.museumIds, 43723 "by_exhibition_ids[]": this.details.exhibitionIds, 43724 "by_event_ids[]": this.details.eventIds, 43725 depth: "availability_status", 43726 start_at: startAt.toString(), 43727 end_at: startAt.add({ months: 1 }).toString() 43728 }; 43729 } 43730 fetchPeriod() { 43731 const thisMonth = this.startAt.set({ day: 1 }); 43732 return [ 43733 thisMonth.subtract({ months: 1 }), 43734 thisMonth, 43735 thisMonth.add({ months: 1 }), 43736 thisMonth.add({ months: 2 }) 43737 ]; 43738 } 43739 eventsDates() { 43740 const method = shop.calendar.bind(shop); 43741 return this.fetchPeriod().reduce((prev, startAt) => assign$1(prev, method(this.params(startAt))), {}); 43742 } 43743 ticketsDates() { 43744 const method = shop.ticketsCalendar.bind(shop); 43745 return this.fetchPeriod().reduce((prev, startAt) => assign$1(prev, method(this.params(startAt))), {}); 43746 } 43747 }; 43748 //#endregion 43749 //#region src/components/ticketSelection/subcomponents/calendar/components/CalendarUI.svelte 43750 var root_1 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1); 43751 var root_2 = /* @__PURE__ */ from_html(`<div> </div>`); 43752 var root_3 = /* @__PURE__ */ from_html(`<!> <!>`, 1); 43753 var root_4 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`); 43754 function CalendarUI($$anchor, $$props) { 43755 push($$props, true); 43756 let calendarClass = prop($$props, "calendarClass", 7); 43757 let root = /* @__PURE__ */ state(void 0); 43758 const details = calendarClass(); 43759 user_effect(() => { 43760 get$2(root)?.dispatchEvent(new CustomEvent("go-date-select", { 43761 detail: { selected: calendarClass().selected }, 43762 bubbles: true 43763 })); 43764 }); 43765 var $$exports = { 43766 details, 43767 get calendarClass() { 43768 return calendarClass(); 43769 }, 43770 set calendarClass($$value) { 43771 calendarClass($$value); 43772 flushSync(); 43773 } 43774 }; 43775 var div = root_4(); 43776 var node = child(div); 43777 { 43778 const children = ($$anchor, $$arg0) => { 43779 let months = () => $$arg0?.().months; 43780 let weekdays = () => $$arg0?.().weekdays; 43781 var fragment = root_3();
43782 var node_1 = first_child(fragment); 43783 component(node_1, () => Calendar_header, ($$anchor, Calendar_Header) => { 43784 Calendar_Header($$anchor, { 43785 children: ($$anchor, $$slotProps) => { 43786 var fragment_1 = root_1(); 43787 var node_2 = first_child(fragment_1); 43788 component(node_2, () => Calendar_prev_button, ($$anchor, Calendar_PrevButton) => { 43789 Calendar_PrevButton($$anchor, { 43790 class: "go-calendar-prev-button", 43791 children: ($$anchor, $$slotProps) => { 43792 next(); 43793 append($$anchor, text$1("Prev")); 43794 }, 43795 $$slots: { default: true } 43796 }); 43797 }); 43798 var node_3 = sibling(node_2, 2); 43799 component(node_3, () => Calendar_heading, ($$anchor, Calendar_Heading) => { 43800 Calendar_Heading($$anchor, { class: "go-calendar-heading" }); 43801 }); 43802 component(sibling(node_3, 2), () => Calendar_next_button, ($$anchor, Calendar_NextButton) => { 43803 Calendar_NextButton($$anchor, { 43804 class: "go-calendar-next-button", 43805 children: ($$anchor, $$slotProps) => { 43806 next(); 43807 append($$anchor, text$1("Next")); 43808 }, 43809 $$slots: { default: true } 43810 }); 43811 }); 43812 append($$anchor, fragment_1); 43813 }, 43814 $$slots: { default: true } 43815 }); 43816 }); 43817 each(sibling(node_1, 2), 17, months, index$1, ($$anchor, month) => { 43818 var fragment_2 = comment(); 43819 component(first_child(fragment_2), () => Calendar_grid, ($$anchor, Calendar_Grid) => { 43820 Calendar_Grid($$anchor, { 43821 class: "go-calendar-grid", 43822 children: ($$anchor, $$slotProps) => { 43823 var fragment_3 = root_3(); 43824 var node_7 = first_child(fragment_3); 43825 component(node_7, () => Calendar_grid_head, ($$anchor, Calendar_GridHead) => { 43826 Calendar_GridHead($$anchor, { 43827 class: "go-calendar-grid-head", 43828 children: ($$anchor, $$slotProps) => { 43829 var fragment_4 = comment(); 43830 component(first_child(fragment_4), () => Calendar_grid_row, ($$anchor, Calendar_GridRow) => { 43831 Calendar_GridRow($$anchor, { 43832 class: "go-calendar-grid-row", 43833 children: ($$anchor, $$slotProps) => { 43834 var fragment_5 = comment(); 43835 each(first_child(fragment_5), 17, weekdays, index$1, ($$anchor, day, i, $$array) => { 43836 var fragment_6 = comment(); 43837 component(first_child(fragment_6), () => Calendar_head_cell, ($$anchor, Calendar_HeadCell) => { 43838 Calendar_HeadCell($$anchor, { 43839 children: ($$anchor, $$slotProps) => { 43840 var div_1 = root_2(); 43841 var text_2 = child(div_1, true); 43842 reset(div_1); 43843 template_effect(($0) => set_text(text_2, $0), [() => get$2(day).slice(0, 2)]); 43844 append($$anchor, div_1); 43845 }, 43846 $$slots: { default: true } 43847 }); 43848 }); 43849 append($$anchor, fragment_6); 43850 }); 43851 append($$anchor, fragment_5); 43852 }, 43853 $$slots: { default: true } 43854 }); 43855 }); 43856 append($$anchor, fragment_4); 43857 }, 43858 $$slots: { default: true } 43859 }); 43860 }); 43861 component(sibling(node_7, 2), () => Calendar_grid_body, ($$anchor, Calendar_GridBody) => { 43862 Calendar_GridBody($$anchor, { 43863 class: "go-calendar-grid-body", 43864 children: ($$anchor, $$slotProps) => { 43865 var fragment_7 = comment(); 43866 each(first_child(fragment_7), 17, () => get$2(month).weeks, index$1, ($$anchor, weekDates, i, $$array_1) => { 43867 var fragment_8 = comment(); 43868 component(first_child(fragment_8), () => Calendar_grid_row, ($$anchor, Calendar_GridRow_1) => { 43869 Calendar_GridRow_1($$anchor, { 43870 class: "go-calendar-grid-row", 43871 children: ($$anchor, $$slotProps) => { 43872 var fragment_9 = comment(); 43873 each(first_child(fragment_9), 17, () => get$2(weekDates), index$1, ($$anchor, date, i, $$array_2) => { 43874 var fragment_10 = comment(); 43875 component(first_child(fragment_10), () => Calendar_cell, ($$anchor, Calendar_Cell) => { 43876 Calendar_Cell($$anchor, { 43877 get date() { 43878 return get$2(date); 43879 }, 43880 get month() { 43881 return get$2(month).value; 43882 }, 43883 class: "go-calendar-cell", 43884 children: ($$anchor, $$slotProps) => { 43885 var fragment_11 = comment();
43886 var node_16 = first_child(fragment_11); 43887 { 43888 let $0 = /* @__PURE__ */ user_derived(() => ({ 43889 "go-calendar-day": true, 43890 "is-unavailable": calendarClass().isDateUnavailable(get$2(date)), 43891 "is-disabled": calendarClass().isDateDisabled(get$2(date)), 43892 "is-selected": calendarClass().selected?.compare(get$2(date)) === 0 43893 })); 43894 component(node_16, () => Calendar_day, ($$anchor, Calendar_Day) => { 43895 Calendar_Day($$anchor, { 43896 get class() { 43897 return get$2($0); 43898 }, 43899 children: ($$anchor, $$slotProps) => { 43900 next(); 43901 var text_3 = text$1(); 43902 template_effect(() => set_text(text_3, get$2(date).day)); 43903 append($$anchor, text_3); 43904 }, 43905 $$slots: { default: true } 43906 }); 43907 }); 43908 } 43909 append($$anchor, fragment_11); 43910 }, 43911 $$slots: { default: true } 43912 }); 43913 }); 43914 append($$anchor, fragment_10); 43915 }); 43916 append($$anchor, fragment_9); 43917 }, 43918 $$slots: { default: true } 43919 }); 43920 }); 43921 append($$anchor, fragment_8); 43922 }); 43923 append($$anchor, fragment_7); 43924 }, 43925 $$slots: { default: true } 43926 }); 43927 }); 43928 append($$anchor, fragment_3); 43929 }, 43930 $$slots: { default: true } 43931 }); 43932 }); 43933 append($$anchor, fragment_2); 43934 }); 43935 append($$anchor, fragment); 43936 }; 43937 component(node, () => Calendar$1, ($$anchor, Calendar_Root) => { 43938 Calendar_Root($$anchor, { 43939 weekdayFormat: "long", 43940 fixedWeeks: true, 43941 preventDeselect: true, 43942 type: "single", 43943 get locale() { 43944 return shop.locale; 43945 }, 43946 isDateDisabled: (date) => calendarClass().isDateDisabled(date), 43947 isDateUnavailable: (date) => calendarClass().isDateUnavailable(date),
43948 disableDaysOutsideMonth: false, 43949 class: "go-calendar-root", 43950 get value() { 43951 return calendarClass().selected; 43952 }, 43953 set value($$value) { 43954 calendarClass().selected = $$value; 43955 }, 43956 get placeholder() { 43957 return calendarClass().startAt; 43958 }, 43959 set placeholder($$value) { 43960 calendarClass().startAt = $$value; 43961 }, 43962 children, 43963 $$slots: { default: true } 43964 }); 43965 }); 43966 } 43967 reset(div); 43968 bind_this(div, ($$value) => set(root, $$value), () => get$2(root)); 43969 append($$anchor, div); 43970 return pop($$exports); 43971 } 43972 create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], { mode: "open" }); 43973 //#endregion 43974 //#region src/components/ticketSelection/subcomponents/calendar/components/Calendar.svelte 43975 function Calendar_1($$anchor, $$props) { 43976 push($$props, true); 43977 const ticketsCalendar = new Calendar(); 43978 const details = ticketsCalendar; 43979 const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host); 43980 const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value); 43981 user_effect(() => { 43982 ticketsCalendar.details = get$2(ticketSelectionDetails); 43983 }); 43984 $$props.$$host.addEventListener("go-date-select", (e) => { 43985 if (get$2(ticketSelectionDetails)) { 43986 get$2(ticketSelectionDetails).selectedDate = e.detail.selected; 43987 get$2(ticketSelectionDetails).selectedTimeslot = void 0; 43988 } 43989 }); 43990 var $$exports = { details }; 43991 var fragment = comment(); 43992 var node = first_child(fragment); 43993 var consequent = ($$anchor) => { 43994 CalendarUI($$anchor, { get calendarClass() { 43995 return ticketsCalendar; 43996 } }); 43997 }; 43998 if_block(node, ($$render) => { 43999 if (get$2(ticketSelectionDetails)?.isCalendarVisible) $$render(consequent); 44000 }); 44001 append($$anchor, fragment); 44002 return pop($$exports); 44003 } 44004 customElements.define("go-calendar", create_custom_element(Calendar_1, {}, [], ["details"])); 44005 //#endregion 44006 //#region src/components/ticketSelection/subcomponents/addToCartButton/AddToCartButton.svelte.ts 44007 var Details = class { 44008 #ticketSelectionDetails; 44009 get ticketSelectionDetails() { 44010 return get$2(this.#ticketSelectionDetails); 44011 } 44012 set ticketSelectionDetails(value) { 44013 set(this.#ticketSelectionDetails, value); 44014 } 44015 constructor(tsdWrapper) { 44016 if (!tsdWrapper) return; 44017 this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value); 44018 } 44019 addToCart() { 44020 if (!shop.cart) { 44021 console.error("cart not found"); 44022 return; 44023 } 44024 if (!this.ticketSelectionDetails) { 44025 console.error("ticket selection details not found"); 44026 return; 44027 } 44028 const preCarts = this.ticketSelectionDetails.preCarts; 44029 const newItems = preCarts.flatMap((pc) => { 44030 return pc.nonEmptyItems.map((i) => { 44031 const time = i.product.ticket_type != "annual" ? i.time : void 0; 44032 return createCartItem(i.product, { 44033 quantity: i.quantity, 44034 time, 44035 mantle: i.mantle && { composition: { ...i.mantle.composition } } 44036 }); 44037 }); 44038 }); 44039 shop.cart.addItems(newItems); 44040 preCarts.forEach((pc) => pc.items.forEach((i) => i.quantity = 0)); 44041 if (configStore.config.urls.cart) configStore.config.navigateTo(configStore.config.urls.cart()); 44042 } 44043 anyTicketsSelected() { 44044 if (!this.ticketSelectionDetails) return false; 44045 return this.ticketSelectionDetails.preCarts.some((cart) => cart.items.some((item) => item.quantity > 0)); 44046 } 44047 }; 44048 //#endregion 44049 //#region src/components/ticketSelection/subcomponents/addToCartButton/AddToCartButton.svelte 44050 var root = /* @__PURE__ */ from_html(`<button data-add-to-cart-button="" data-testid="go-add-to-cart-button__button"> </button>`); 44051 function AddToCartButton($$anchor, $$props) { 44052 push($$props, true); 44053 const details = new Details(getTicketSelectionDetails($$props.$$host)); 44054 var $$exports = { details }; 44055 var button = root(); 44056 var text = child(button, true); 44057 reset(button); 44058 template_effect(($0, $1, $2) => { 44059 button.disabled = $0; 44060 set_attribute(button, "data-x", $1); 44061 set_text(text, $2); 44062 }, [ 44063 () => !details.anyTicketsSelected(), 44064 () => !details.anyTicketsSelected(), 44065 () => shop.t("common.actions.cart") 44066 ]); 44067 delegated("click", button, () => details.addToCart()); 44068 append($$anchor, button); 44069 return pop($$exports); 44070 } 44071 delegate(["click"]); 44072 customElements.define("go-add-to-cart-button", create_custom_element
44072(AddToCartButton, {}, [], ["details"])); 44073 //#endregion 44074 //#region src/components/withdrawal/Withdrawal.svelte 44075 function Withdrawal($$anchor, $$props) { 44076 push($$props, true); 44077 let custom = prop($$props, "custom", 7, false); 44078 Forms.defineForm({ 44079 id: "withdrawal", 44080 submitLabel: "withdrawal.actions.submit", 44081 fields: [ 44082 { 44083 key: "withdrawalFirstName", 44084 required: true 44085 }, 44086 { 44087 key: "withdrawalLastName", 44088 required: true 44089 }, 44090 { 44091 key: "email", 44092 required: true 44093 }, 44094 { 44095 key: "orderNumber", 44096 required: true 44097 }, 44098 { 44099 key: "withdrawalNote", 44100 required: false 44101 } 44102 ] 44103 }); 44104 async function onSubmit(event) { 44105 const details = event.target.details; 44106 const result = await shop.withdrawal(details.formData); 44107 if (result.response?.ok) $$props.$$host.dispatchEvent(new Event("go-success", { 44108 bubbles: true, 44109 composed: true 44110 })); 44111 else details.apiErrors = result.error?.errors ?? [shop.t("withdrawal.form.errors.requestFailed")]; 44112 } 44113 wrapInElement($$props.$$host, "go-form", { 44114 "form-id": "withdrawal", 44115 custom: custom() 44116 }); 44117 $$props.$$host.addEventListener("submit", onSubmit); 44118 return pop({ 44119 get custom() { 44120 return custom(); 44121 }, 44122 set custom($$value = false) { 44123 custom($$value); 44124 flushSync(); 44125 } 44126 }); 44127 } 44128 customElements.define("go-withdrawal-form", create_custom_element(Withdrawal, { custom: { 44129 attribute: "custom", 44130 reflect: true, 44131 type: "Boolean" 44132 } }, [], [])); 44133 //#endregion 44134 //#region src/go/go.ts 44135 var initPromise = null; 44136 async function ensureShopReady() { 44137 if (initPromise) return initPromise; 44138 if (!shop.client) throw new Error("[go.api] Shop not initialized â call go.init({ shop, api, locale }) first."); 44139 } 44140 async function initGo(window) { 44141 const stub = window.go; 44142 let q = stub && stub._queue || []; 44143 console.log(q); 44144 for (const command of q) { 44145 if (command.method === "load") continue; 44146 try { 44147 await go[command.method](command.options); 44148 } catch (e) { 44149 console.error(e); 44150 } 44151 } 44152 window.go = go; 44153 if (stub) stub._queue = null; 44154 } 44155 var go = { 44156 loaded: true, 44157 config: (options) => { 44158 configStore.define(options); 44159 }, 44160 init: async (options) => { 44161 try { 44162 initPromise = shop.load("https://" + options.api, options.shop, options.locale); 44163 await initPromise; 44164 } catch (e) { 44165 initPromise = null; 44166 throw e; 44167 } 44168 }, 44169 api: { 44170 getCustomer: async () => { 44171 await ensureShopReady(); 44172 return shop.asyncFetch(() => shop.getCustomer()); 44173 }, 44174 getOrders: async (params) => { 44175 await ensureShopReady(); 44176 return shop.asyncFetch(() => shop.getOrders(params)); 44177 } 44178 } 44179 }; 44180 (async () => { 44181 await initGo(window); 44182 })(); 44183 //#endregion 44184})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.