1/** @returns {void} */ 2function noop() {} 3 4const identity = (x) => x; 5 6/** 7 * @template T 8 * @template S 9 * @param {T} tar 10 * @param {S} src 11 * @returns {T & S} 12 */ 13function assign(tar, src) { 14 // @ts-ignore 15 for (const k in src) tar[k] = src[k]; 16 return /** @type {T & S} */ (tar); 17} 18 19// Adapted from https://github.com/then/is-promise/blob/master/index.js 20// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE 21/** 22 * @param {any} value 23 * @returns {value is PromiseLike<any>} 24 */ 25function is_promise(value) { 26 return ( 27 !!value && 28 (typeof value === 'object' || typeof value === 'function') && 29 typeof (/** @type {any} */ (value).then) === 'function' 30 ); 31} 32 33/** @returns {void} */ 34function add_location(element, file, line, column, char) { 35 element.__svelte_meta = { 36 loc: { file, line, column, char } 37 }; 38} 39 40function run(fn) { 41 return fn(); 42} 43 44function blank_object() { 45 return Object.create(null); 46} 47 48/** 49 * @param {Function[]} fns 50 * @returns {void} 51 */ 52function run_all(fns) { 53 fns.forEach(run); 54} 55 56/** 57 * @param {any} thing 58 * @returns {thing is Function} 59 */ 60function is_function(thing) { 61 return typeof thing === 'function'; 62} 63 64/** @returns {boolean} */ 65function safe_not_equal(a, b) { 66 return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function'; 67} 68 69let src_url_equal_anchor; 70 71/** 72 * @param {string} element_src 73 * @param {string} url 74 * @returns {boolean} 75 */ 76function src_url_equal(element_src, url) { 77 if (element_src === url) return true; 78 if (!src_url_equal_anchor) { 79 src_url_equal_anchor = document.createElement('a'); 80 } 81 // This is actually faster than doing URL(..).href 82 src_url_equal_anchor.href = url; 83 return element_src === src_url_equal_anchor.href; 84} 85 86/** @param {string} srcset */ 87function split_srcset(srcset) { 88 return srcset.split(',').map((src) =>
88 src.trim().split(' ').filter(Boolean)); 89} 90 91/** 92 * @param {HTMLSourceElement | HTMLImageElement} element_srcset 93 * @param {string | undefined | null} srcset 94 * @returns {boolean} 95 */ 96function srcset_url_equal(element_srcset, srcset) { 97 const element_urls = split_srcset(element_srcset.srcset); 98 const urls = split_srcset(srcset || ''); 99 100 return ( 101 urls.length === element_urls.length && 102 urls.every( 103 ([url, width], i) => 104 width === element_urls[i][1] && 105 // We need to test both ways because Vite will create an a full URL with 106 // `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the 107 // relative URLs inside srcset are not automatically resolved to absolute URLs by 108 // browsers (in contrast to img.src). This means both SSR and DOM code could 109 // contain relative or absolute URLs. 110 (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0])) 111 ) 112 ); 113} 114 115/** @returns {boolean} */ 116function not_equal(a, b) { 117 return a != a ? b == b : a !== b; 118} 119 120/** @returns {boolean} */ 121function is_empty(obj) { 122 return Object.keys(obj).length === 0; 123} 124 125/** @returns {void} */ 126function validate_store(store, name) { 127 if (store != null && typeof store.subscribe !== 'function') { 128 throw new Error(`'${name}' is not a store with a 'subscribe' method`); 129 } 130} 131 132function subscribe(store, ...callbacks) { 133 if (store == null) { 134 for (const callback of callbacks) { 135 callback(undefined); 136 } 137 return noop; 138 } 139 const unsub = store.subscribe(...callbacks); 140 return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; 141} 142 143/** 144 * Get the current value from a store by subscribing and immediately unsubscribing. 145 * 146 * https://svelte.dev/docs/svelte-store#get 147 * @template T 148 * @param {import('../store/public.js').Readable<T>} store 149 * @returns {T} 150 */ 151function get_store_value(store) { 152 let value; 153 subscribe(store, (_) => (value = _))(); 154 return value; 155} 156 157/** @returns {void} */ 158function component_subscribe(component, store, callback) { 159 component.$$.on_destroy.push(subscribe(store, callback)); 160} 161 162function create_slot(definition, ctx, $$scope, fn) { 163 if (definition) { 164 const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); 165 return definition[0](slot_ctx); 166 } 167} 168 169function get_slot_context(definition, ctx, $$scope, fn) { 170 return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; 171} 172 173function get_slot_changes(definition, $$scope, dirty, fn) { 174 if (definition[2] && fn) { 175 const lets = definition[2](fn(dirty)); 176 if ($$scope.dirty === undefined) { 177 return lets; 178 } 179 if (typeof lets === 'object') { 180 const merged = []; 181 const len = Math.max($$scope.dirty.length, lets.length); 182 for (let i = 0; i < len; i += 1) { 183 merged[i] = $$scope.dirty[i] | lets[i]; 184 } 185 return merged; 186 } 187 return $$scope.dirty | lets; 188 } 189 return $$scope.dirty; 190} 191 192/** @returns {void} */ 193function update_slot_base( 194 slot, 195 slot_definition, 196 ctx, 197 $$scope, 198 slot_changes, 199 get_slot_context_fn 200) { 201 if (slot_changes) { 202 const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); 203 slot.p(slot_context, slot_changes); 204 } 205} 206 207/** @returns {void} */ 208function update_slot( 209 slot, 210 slot_definition, 211 ctx, 212 $$scope, 213 dirty, 214 get_slot_changes_fn, 215 get_slot_context_fn 216) { 217 const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); 218 update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn); 219} 220 221/** @returns {any[] | -1} */ 222function get_all_dirty_from_scope($$scope) { 223 if ($$scope.ctx.length > 32) { 224 const dirty = []; 225 const length = $$scope.ctx.length / 32; 226 for (let i = 0; i < length; i++) { 227 dirty[i] = -1; 228 } 229 return dirty; 230 } 231 return -1; 232} 233 234/** @returns {{}} */ 235function exclude_internal_props(props) { 236 const result = {}; 237 for (const k in props) if (k[0] !== '$') result[k] = props[k]; 238 return result; 239} 240 241/** @returns {{}} */ 242function compute_rest_props(props, keys) { 243 const rest = {}; 244 keys = new Set(keys); 245 for (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k]; 246 return rest; 247} 248
249/** @returns {{}} */ 250function compute_slots(slots) { 251 const result = {}; 252 for (const key in slots) { 253 result[key] = true; 254 } 255 return result; 256} 257 258/** @returns {(this: any, ...args: any[]) => void} */ 259function once(fn) { 260 let ran = false; 261 return function (...args) { 262 if (ran) return; 263 ran = true; 264 fn.call(this, ...args); 265 }; 266} 267 268function null_to_empty(value) { 269 return value == null ? '' : value; 270} 271 272function set_store_value(store, ret, value) { 273 store.set(value); 274 return ret; 275} 276 277const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); 278 279function action_destroyer(action_result) { 280 return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; 281} 282 283/** @param {number | string} value 284 * @returns {[number, string]} 285 */ 286function split_css_unit(value) { 287 const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); 288 return split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px']; 289} 290 291const contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable']; 292 293const is_client = typeof window !== 'undefined'; 294 295/** @type {() => number} */ 296let now = is_client ? () => window.performance.now() : () => Date.now(); 297 298let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop; 299 300// used internally for testing 301/** @returns {void} */ 302function set_now(fn) { 303 now = fn; 304} 305 306/** @returns {void} */ 307function set_raf(fn) { 308 raf = fn; 309} 310 311const tasks = new Set(); 312 313/** 314 * @param {number} now 315 * @returns {void} 316 */ 317function run_tasks(now) { 318 tasks.forEach((task) => { 319 if (!task.c(now)) { 320 tasks.delete(task); 321 task.f(); 322 } 323 }); 324 if (tasks.size !== 0) raf(run_tasks); 325} 326 327/** 328 * For testing purposes only! 329 * @returns {void} 330 */ 331function clear_loops() { 332 tasks.clear(); 333} 334 335/** 336 * Creates a new task that runs on each raf frame 337 * until it returns a falsy value or is aborted 338 * @param {import('./private.js').TaskCallback} callback 339 * @returns {import('./private.js').Task} 340 */ 341function loop(callback) { 342 /** @type {import('./private.js').TaskEntry} */ 343 let task; 344 if (tasks.size === 0) raf(run_tasks); 345 return { 346 promise: new Promise((fulfill) => { 347 tasks.add((task = { c: callback, f: fulfill })); 348 }), 349 abort() { 350 tasks.delete(task); 351 } 352 }; 353} 354 355/** @type {typeof globalThis} */ 356const globals = 357 typeof window !== 'undefined' 358 ? window 359 : typeof globalThis !== 'undefined' 360 ? globalThis 361 : // @ts-ignore Node typings have this 362 global; 363 364/** 365 * Resize observer singleton. 366 * One listener per element only! 367 * https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ 368 */ 369class ResizeObserverSingleton { 370 /** 371 * @private 372 * @readonly 373 * @type {WeakMap<Element, import('./private.js').Listener>} 374 */ 375 _listeners = 'WeakMap' in globals ? new WeakMap() : undefined; 376 377 /** 378 * @private 379 * @type {ResizeObserver} 380 */ 381 _observer = undefined; 382 383 /** @type {ResizeObserverOptions} */ 384 options; 385 386 /** @param {ResizeObserverOptions} options */ 387 constructor(options) { 388 this.options = options; 389 } 390 391 /** 392 * @param {Element} element 393 * @param {import('./private.js').Listener} listener 394 * @returns {() => void} 395 */ 396 observe(element, listener) { 397 this._listeners.set(element, listener); 398 this._getObserver().observe(element, this.options); 399 return () => { 400 this._listeners.delete(element); 401 this._observer.unobserve(element); // this line can probably be removed 402 }; 403 } 404 405 /** 406 * @private 407 */ 408 _getObserver() { 409 return ( 410 this._observer ?? 411 (this._observer = new ResizeObserver((entries) => { 412 for (const entry of entries) { 413 ResizeObserverSingleton.entries.set(entry.target, entry); 414 this._listeners.get(entry.target)?.(entry); 415 } 416 })) 417 ); 418 } 419} 420 421// Needs to be written like this to pass the tree-shake-test 422ResizeObserverSingleton.entries = 'WeakMap' in globals ? new WeakMap() : undefined; 423 424// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM 425// at the end of hydration without touching the remaining nodes. 426let is_hydrating = false; 427 428/** 429 * @returns {void} 430 */ 431function start_hydrating() { 432 is_hydrating = true; 433} 434 435/** 436 * @returns {void} 437 */ 438function end_hydrating() { 439 is_hydrating = false;
440} 441 442/** 443 * @param {number} low 444 * @param {number} high 445 * @param {(index: number) => number} key 446 * @param {number} value 447 * @returns {number} 448 */ 449function upper_bound(low, high, key, value) { 450 // Return first index of value larger than input value in the range [low, high) 451 while (low < high) { 452 const mid = low + ((high - low) >> 1); 453 if (key(mid) <= value) { 454 low = mid + 1; 455 } else { 456 high = mid; 457 } 458 } 459 return low; 460} 461 462/** 463 * @param {NodeEx} target 464 * @returns {void} 465 */ 466function init_hydrate(target) { 467 if (target.hydrate_init) return; 468 target.hydrate_init = true; 469 // We know that all children have claim_order values since the unclaimed have been detached if target is not <head> 470 471 let children = /** @type {ArrayLike<NodeEx2>} */ (target.childNodes); 472 // If target is <head>, there may be children without claim_order 473 if (target.nodeName === 'HEAD') { 474 const my_children = []; 475 for (let i = 0; i < children.length; i++) { 476 const node = children[i]; 477 if (node.claim_order !== undefined) { 478 my_children.push(node); 479 } 480 } 481 children = my_children; 482 } 483 /* 484 * Reorder claimed children optimally. 485 * We can reorder claimed children optimally by finding the longest subsequence of 486 * nodes that are already claimed in order and only moving the rest. The longest 487 * subsequence of nodes that are claimed in order can be found by 488 * computing the longest increasing subsequence of .claim_order values. 489 * 490 * This algorithm is optimal in generating the least amount of reorder operations 491 * possible. 492 * 493 * Proof: 494 * We know that, given a set of reordering operations, the nodes that do not move 495 * always form an increasing subsequence, since they do not move among each other 496 * meaning that they must be already ordered among each other. Thus, the maximal 497 * set of nodes that do not move form a longest increasing subsequence. 498 */ 499 // Compute longest increasing subsequence 500 // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j 501 const m = new Int32Array(children.length + 1); 502 // Predecessor indices + 1 503 const p = new Int32Array(children.length); 504 m[0] = -1; 505 let longest = 0; 506 for (let i = 0; i < children.length; i++) { 507 const current = children[i].claim_order; 508 // Find the largest subsequence length such that it ends in a value less than our current value 509 // upper_bound returns first greater value, so we subtract one 510 // with fast path for when we are on the current longest subsequence 511 const seq_len = 512 (longest > 0 && children[m[longest]].claim_order <= current 513 ? longest + 1 514 : upper_bound(1, longest, (idx) => children[m[idx]].claim_order, current)) - 1; 515 p[i] = m[seq_len] + 1; 516 const new_len = seq_len + 1; 517 // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence. 518 m[new_len] = i; 519 longest = Math.max(new_len, longest); 520 } 521 // The longest increasing subsequence of nodes (initially reversed) 522 523 /** 524 * @type {NodeEx2[]} 525 */ 526 const lis = []; 527 // The rest of the nodes, nodes that will be moved 528 529 /** 530 * @type {NodeEx2[]} 531 */ 532 const to_move = []; 533 let last = children.length - 1; 534 for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) { 535 lis.push(children[cur - 1]); 536 for (; last >= cur; last--) { 537 to_move.push(children[last]); 538 } 539 last--; 540 } 541 for (; last >= 0; last--) { 542 to_move.push(children[last]); 543 } 544 lis.reverse(); 545 // We sort the nodes being moved to guarantee that their insertion order matches the claim order 546 to_move.sort((a, b) => a.claim_order - b.claim_order); 547 // Finally, we move the nodes 548 for (let i = 0, j = 0; i < to_move.length; i++) { 549 while (j < lis.length && to_move[i].claim_order >= lis[j].claim_order) { 550 j++; 551 } 552 const anchor = j < lis.length ? lis[j] : null; 553 target.insertBefore(to_move[i], anchor); 554 } 555} 556 557/** 558 * @param {Node} target 559 * @param {Node} node 560 * @returns {void} 561 */ 562function append(target, node) { 563 target.appendChild(node); 564} 565 566/** 567 * @param {Node} target 568 * @param {string} style_sheet_id 569 * @param {string} styles 570 * @returns {void} 571 */ 572function append_styles(target, style_sheet_id, styles) { 573 const append_styles_to = get_root_for_style(target); 574 if (!append_styles_to.getElementById(style_sheet_id)) { 575 const style = element('style'); 576 style.id = style_sheet_id; 577 style.textContent = styles; 578 append_stylesheet(append_styles_to, style); 579 } 580} 581 582/** 583 * @param {Node} node 584 * @returns {ShadowRoot | Document} 585 */ 586function get_root_for_style(node) { 587 if (!node) return document; 588 const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; 589 if (root && /** @type {ShadowRoot} */ (root).host) { 590 return /** @type {ShadowRoot} */ (root); 591 } 592 return node.ownerDocument; 593} 594
595/** 596 * @param {Node} node 597 * @returns {CSSStyleSheet} 598 */ 599function append_empty_stylesheet(node) { 600 const style_element = element('style'); 601 // For transitions to work without 'style-src: unsafe-inline' Content Security Policy, 602 // these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API. 603 // Using the hash for the empty string (for an empty tag) works in all browsers except Safari. 604 // So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */. 605 // The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari. 606 style_element.textContent = '/* empty */'; 607 append_stylesheet(get_root_for_style(node), style_element); 608 return style_element.sheet; 609} 610 611/** 612 * @param {ShadowRoot | Document} node 613 * @param {HTMLStyleElement} style 614 * @returns {CSSStyleSheet} 615 */ 616function append_stylesheet(node, style) { 617 append(/** @type {Document} */ (node).head || node, style); 618 return style.sheet; 619} 620 621/** 622 * @param {NodeEx} target 623 * @param {NodeEx} node 624 * @returns {void} 625 */ 626function append_hydration(target, node) { 627 if (is_hydrating) { 628 init_hydrate(target); 629 if ( 630 target.actual_end_child === undefined || 631 (target.actual_end_child !== null && target.actual_end_child.parentNode !== target) 632 ) { 633 target.actual_end_child = target.firstChild; 634 } 635 // Skip nodes of undefined ordering 636 while (target.actual_end_child !== null && target.actual_end_child.claim_order === undefined) { 637 target.actual_end_child = target.actual_end_child.nextSibling; 638 } 639 if (node !== target.actual_end_child) { 640 // We only insert if the ordering of this node should be modified or the parent node is not target 641 if (node.claim_order !== undefined || node.parentNode !== target) { 642 target.insertBefore(node, target.actual_end_child); 643 } 644 } else { 645 target.actual_end_child = node.nextSibling; 646 } 647 } else if (node.parentNode !== target || node.nextSibling !== null) { 648 target.appendChild(node); 649 } 650} 651 652/** 653 * @param {Node} target 654 * @param {Node} node 655 * @param {Node} [anchor] 656 * @returns {void} 657 */ 658function insert(target, node, anchor) { 659 target.insertBefore(node, anchor || null); 660} 661 662/** 663 * @param {NodeEx} target 664 * @param {NodeEx} node 665 * @param {NodeEx} [anchor] 666 * @returns {void} 667 */ 668function insert_hydration(target, node, anchor) { 669 if (is_hydrating && !anchor) { 670 append_hydration(target, node); 671 } else if (node.parentNode !== target || node.nextSibling != anchor) { 672 target.insertBefore(node, anchor || null); 673 } 674} 675 676/** 677 * @param {Node} node 678 * @returns {void} 679 */ 680function detach(node) { 681 if (node.parentNode) { 682 node.parentNode.removeChild(node); 683 } 684} 685 686/** 687 * @returns {void} */ 688function destroy_each(iterations, detaching) { 689 for (let i = 0; i < iterations.length; i += 1) { 690 if (iterations[i]) iterations[i].d(detaching); 691 } 692} 693 694/** 695 * @template {keyof HTMLElementTagNameMap} K 696 * @param {K} name 697 * @returns {HTMLElementTagNameMap[K]} 698 */ 699function element(name) { 700 return document.createElement(name); 701} 702 703/** 704 * @template {keyof HTMLElementTagNameMap} K 705 * @param {K} name 706 * @param {string} is 707 * @returns {HTMLElementTagNameMap[K]} 708 */ 709function element_is(name, is) { 710 return document.createElement(name, { is }); 711} 712 713/** 714 * @template T 715 * @template {keyof T} K 716 * @param {T} obj 717 * @param {K[]} exclude 718 * @returns {Pick<T, Exclude<keyof T, K>>} 719 */ 720function object_without_properties(obj, exclude) { 721 const target = /** @type {Pick<T, Exclude<keyof T, K>>} */ ({}); 722 for (const k in obj) { 723 if ( 724 has_prop(obj, k) && 725 // @ts-ignore 726 exclude.indexOf(k) === -1 727 ) { 728 // @ts-ignore 729 target[k] = obj[k]; 730 } 731 } 732 return target; 733} 734 735/** 736 * @template {keyof SVGElementTagNameMap} K 737 * @param {K} name 738 * @returns {SVGElement} 739 */ 740function svg_element(name) { 741 return document.createElementNS('http://www.w3.org/2000/svg', name); 742} 743 744/** 745 * @param {string} data 746 * @returns {Text} 747 */ 748function text(data) { 749 return document.createTextNode(data); 750} 751 752/** 753 * @returns {Text} */ 754function space() { 755 return text(' '); 756} 757 758/** 759 * @returns {Text} */ 760function empty() { 761 return text(''); 762} 763 764/** 765 * @param {string} content 766 * @returns {Comment} 767 */ 768function comment(content) { 769 return document.createComment(content); 770} 771 772/** 773 * @param {EventTarget} node 774 * @param {string} event 775 * @param {EventListenerOrEventListenerObject} handler 776 * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options] 777 * @returns {() => void} 778 */ 779function listen(node, event, handler, options) { 780 node.addEventListener(event, handler, options); 781 return () => node.removeEventListener(event, handler, options); 782} 783 784/** 785 * @returns {(event: any) => any} */ 786function prevent_default(fn) { 787 return function (event) { 788 event.preventDefault(); 789 // @ts-ignore
790 return fn.call(this, event); 791 }; 792} 793 794/** 795 * @returns {(event: any) => any} */ 796function stop_propagation(fn) { 797 return function (event) { 798 event.stopPropagation(); 799 // @ts-ignore 800 return fn.call(this, event); 801 }; 802} 803 804/** 805 * @returns {(event: any) => any} */ 806function stop_immediate_propagation(fn) { 807 return function (event) { 808 event.stopImmediatePropagation(); 809 // @ts-ignore 810 return fn.call(this, event); 811 }; 812} 813 814/** 815 * @returns {(event: any) => void} */ 816function self(fn) { 817 return function (event) { 818 // @ts-ignore 819 if (event.target === this) fn.call(this, event); 820 }; 821} 822 823/** 824 * @returns {(event: any) => void} */ 825function trusted(fn) { 826 return function (event) { 827 // @ts-ignore 828 if (event.isTrusted) fn.call(this, event); 829 }; 830} 831 832/** 833 * @param {Element} node 834 * @param {string} attribute 835 * @param {string} [value] 836 * @returns {void} 837 */ 838function attr(node, attribute, value) { 839 if (value == null) node.removeAttribute(attribute); 840 else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); 841} 842/** 843 * List of attributes that should always be set through the attr method, 844 * because updating them through the property setter doesn't work reliably. 845 * In the example of `width`/`height`, the problem is that the setter only 846 * accepts numeric values, but the attribute can also be set to a string like `50%`. 847 * If this list becomes too big, rethink this approach. 848 */ 849const always_set_through_set_attribute = ['width', 'height']; 850 851/** 852 * @param {Element & ElementCSSInlineStyle} node 853 * @param {{ [x: string]: string }} attributes 854 * @returns {void} 855 */ 856function set_attributes(node, attributes) { 857 // @ts-ignore 858 const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); 859 for (const key in attributes) { 860 if (attributes[key] == null) { 861 node.removeAttribute(key); 862 } else if (key === 'style') { 863 node.style.cssText = attributes[key]; 864 } else if (key === '__value') { 865 /** @type {any} */ (node).value = node[key] = attributes[key]; 866 } else if ( 867 descriptors[key] && 868 descriptors[key].set && 869 always_set_through_set_attribute.indexOf(key) === -1 870 ) { 871 node[key] = attributes[key]; 872 } else { 873 attr(node, key, attributes[key]); 874 } 875 } 876} 877 878/** 879 * @param {Element & ElementCSSInlineStyle} node 880 * @param {{ [x: string]: string }} attributes 881 * @returns {void} 882 */ 883function set_svg_attributes(node, attributes) { 884 for (const key in attributes) { 885 attr(node, key, attributes[key]); 886 } 887} 888 889/** 890 * @param {Record<string, unknown>} data_map 891 * @returns {void} 892 */ 893function set_custom_element_data_map(node, data_map) { 894 Object.keys(data_map).forEach((key) => { 895 set_custom_element_data(node, key, data_map[key]); 896 }); 897} 898 899/** 900 * @returns {void} */ 901function set_custom_element_data(node, prop, value) { 902 const lower = prop.toLowerCase(); // for backwards compatibility with existing behavior we do lowercase first 903 if (lower in node) { 904 node[lower] = typeof node[lower] === 'boolean' && value === '' ? true : value; 905 } else if (prop in node) { 906 node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value; 907 } else { 908 attr(node, prop, value); 909 } 910} 911 912/** 913 * @param {string} tag 914 */ 915function set_dynamic_element_data(tag) { 916 return /-/.test(tag) ? set_custom_element_data_map : set_attributes; 917} 918 919/** 920 * @returns {void} 921 */ 922function xlink_attr(node, attribute, value) { 923 node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value); 924} 925 926/** 927 * @param {HTMLElement} node 928 * @returns {string} 929 */ 930function get_svelte_dataset(node) { 931 return node.dataset.svelteH; 932} 933 934/** 935 * @returns {unknown[]} */ 936function get_binding_group_value(group, __value, checked) { 937 const value = new Set(); 938 for (let i = 0; i < group.length; i += 1) { 939 if (group[i].checked) value.add(group[i].__value); 940 } 941 if (!checked) { 942 value.delete(__value); 943 } 944 return Array.from(value); 945} 946 947/** 948 * @param {HTMLInputElement[]} group 949 * @returns {{ p(...inputs: HTMLInputElement[]): void; r(): void; }} 950 */ 951function init_binding_group(group) { 952 /** 953 * @type {HTMLInputElement[]} */ 954 let _inputs; 955 return { 956 /* push */ p(...inputs) {
957 _inputs = inputs; 958 _inputs.forEach((input) => group.push(input)); 959 }, 960 /* remove */ r() { 961 _inputs.forEach((input) => group.splice(group.indexOf(input), 1)); 962 } 963 }; 964} 965 966/** 967 * @param {number[]} indexes 968 * @returns {{ u(new_indexes: number[]): void; p(...inputs: HTMLInputElement[]): void; r: () => void; }} 969 */ 970function init_binding_group_dynamic(group, indexes) { 971 /** 972 * @type {HTMLInputElement[]} */ 973 let _group = get_binding_group(group); 974 975 /** 976 * @type {HTMLInputElement[]} */ 977 let _inputs; 978 979 function get_binding_group(group) { 980 for (let i = 0; i < indexes.length; i++) { 981 group = group[indexes[i]] = group[indexes[i]] || []; 982 } 983 return group; 984 } 985 986 /** 987 * @returns {void} */ 988 function push() { 989 _inputs.forEach((input) => _group.push(input)); 990 } 991 992 /** 993 * @returns {void} */ 994 function remove() { 995 _inputs.forEach((input) => _group.splice(_group.indexOf(input), 1)); 996 } 997 return { 998 /* update */ u(new_indexes) { 999 indexes = new_indexes; 1000 const new_group = get_binding_group(group); 1001 if (new_group !== _group) { 1002 remove(); 1003 _group = new_group; 1004 push(); 1005 } 1006 }, 1007 /* push */ p(...inputs) { 1008 _inputs = inputs; 1009 push(); 1010 }, 1011 /* remove */ r: remove 1012 }; 1013} 1014 1015/** @returns {number} */ 1016function to_number(value) { 1017 return value === '' ? null : +value; 1018} 1019 1020/** @returns {any[]} */ 1021function time_ranges_to_array(ranges) { 1022 const array = []; 1023 for (let i = 0; i < ranges.length; i += 1) { 1024 array.push({ start: ranges.start(i), end: ranges.end(i) }); 1025 } 1026 return array; 1027} 1028 1029/** 1030 * @param {Element} element 1031 * @returns {ChildNode[]} 1032 */ 1033function children(element) { 1034 return Array.from(element.childNodes); 1035} 1036 1037/** 1038 * @param {ChildNodeArray} nodes 1039 * @returns {void} 1040 */ 1041function init_claim_info(nodes) { 1042 if (nodes.claim_info === undefined) { 1043 nodes.claim_info = { last_index: 0, total_claimed: 0 }; 1044 } 1045} 1046 1047/** 1048 * @template {ChildNodeEx} R 1049 * @param {ChildNodeArray} nodes 1050 * @param {(node: ChildNodeEx) => node is R} predicate 1051 * @param {(node: ChildNodeEx) => ChildNodeEx | undefined} process_node 1052 * @param {() => R} create_node 1053 * @param {boolean} dont_update_last_index 1054 * @returns {R} 1055 */ 1056function claim_node(nodes, predicate, process_node, create_node, dont_update_last_index = false) { 1057 // Try to find nodes in an order such that we lengthen the longest increasing subsequence 1058 init_claim_info(nodes); 1059 const result_node = (() => { 1060 // We first try to find an element after the previous one 1061 for (let i = nodes.claim_info.last_index; i < nodes.length; i++) { 1062 const node = nodes[i]; 1063 if (predicate(node)) { 1064 const replacement = process_node(node); 1065 if (replacement === undefined) { 1066 nodes.splice(i, 1); 1067 } else { 1068 nodes[i] = replacement; 1069 } 1070 if (!dont_update_last_index) { 1071 nodes.claim_info.last_index = i; 1072 } 1073 return node; 1074 } 1075 } 1076 // Otherwise, we try to find one before 1077 // We iterate in reverse so that we don't go too far back 1078 for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) { 1079 const node = nodes[i]; 1080 if (predicate(node)) { 1081 const replacement = process_node(node); 1082 if (replacement === undefined) { 1083 nodes.splice(i, 1); 1084 } else { 1085 nodes[i] = replacement; 1086 } 1087 if (!dont_update_last_index) { 1088 nodes.claim_info.last_index = i; 1089 } else if (replacement === undefined) { 1090 // Since we spliced before the last_index, we decrease it 1091 nodes.claim_info.last_index--; 1092 } 1093 return node; 1094 } 1095 } 1096 // If we can't find any matching node, we create a new one 1097 return create_node(); 1098 })(); 1099 result_node.claim_order = nodes.claim_info.total_claimed; 1100 nodes.claim_info.total_claimed += 1; 1101 return result_node; 1102} 1103 1104/** 1105 * @param {ChildNodeArray} nodes 1106 * @param {string} name 1107 * @param {{ [key: string]: boolean }} attributes 1108 * @param {(name: string) => Element | SVGElement} create_element 1109 * @returns {Element | SVGElement} 1110 */ 1111function claim_element_base(nodes, name, attributes, create_element) { 1112 return claim_node( 1113 nodes, 1114 /** @returns {node is Element | SVGElement} */ 1115 (node) => node.nodeName === name, 1116 /** @param {Element} node */ 1117 (node) => { 1118 const remove = []; 1119 for (let j = 0; j < node.attributes.length; j++) {
1120 const attribute = node.attributes[j]; 1121 if (!attributes[attribute.name]) { 1122 remove.push(attribute.name); 1123 } 1124 } 1125 remove.forEach((v) => node.removeAttribute(v)); 1126 return undefined; 1127 }, 1128 () => create_element(name) 1129 ); 1130} 1131 1132/** 1133 * @param {ChildNodeArray} nodes 1134 * @param {string} name 1135 * @param {{ [key: string]: boolean }} attributes 1136 * @returns {Element | SVGElement} 1137 */ 1138function claim_element(nodes, name, attributes) { 1139 return claim_element_base(nodes, name, attributes, element); 1140} 1141 1142/** 1143 * @param {ChildNodeArray} nodes 1144 * @param {string} name 1145 * @param {{ [key: string]: boolean }} attributes 1146 * @returns {Element | SVGElement} 1147 */ 1148function claim_svg_element(nodes, name, attributes) { 1149 return claim_element_base(nodes, name, attributes, svg_element); 1150} 1151 1152/** 1153 * @param {ChildNodeArray} nodes 1154 * @returns {Text} 1155 */ 1156function claim_text(nodes, data) { 1157 return claim_node( 1158 nodes, 1159 /** @returns {node is Text} */ 1160 (node) => node.nodeType === 3, 1161 /** @param {Text} node */ 1162 (node) => { 1163 const data_str = '' + data; 1164 if (node.data.startsWith(data_str)) { 1165 if (node.data.length !== data_str.length) { 1166 return node.splitText(data_str.length); 1167 } 1168 } else { 1169 node.data = data_str; 1170 } 1171 }, 1172 () => text(data), 1173 true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements 1174 ); 1175} 1176 1177/** 1178 * @returns {Text} */ 1179function claim_space(nodes) { 1180 return claim_text(nodes, ' '); 1181} 1182 1183/** 1184 * @param {ChildNodeArray} nodes 1185 * @returns {Comment} 1186 */ 1187function claim_comment(nodes, data) { 1188 return claim_node( 1189 nodes, 1190 /** @returns {node is Comment} */ 1191 (node) => node.nodeType === 8, 1192 /** @param {Comment} node */ 1193 (node) => { 1194 node.data = '' + data; 1195 return undefined; 1196 }, 1197 () => comment(data), 1198 true 1199 ); 1200} 1201 1202function get_comment_idx(nodes, text, start) { 1203 for (let i = start; i < nodes.length; i += 1) { 1204 const node = nodes[i]; 1205 if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) { 1206 return i; 1207 } 1208 } 1209 return -1; 1210} 1211 1212/** 1213 * @param {boolean} is_svg 1214 * @returns {HtmlTagHydration} 1215 */ 1216function claim_html_tag(nodes, is_svg) { 1217 // find html opening tag 1218 const start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0); 1219 const end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1); 1220 if (start_index === -1 || end_index === -1) { 1221 return new HtmlTagHydration(is_svg); 1222 } 1223 1224 init_claim_info(nodes); 1225 const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1); 1226 detach(html_tag_nodes[0]); 1227 detach(html_tag_nodes[html_tag_nodes.length - 1]); 1228 const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1); 1229 for (const n of claimed_nodes) { 1230 n.claim_order = nodes.claim_info.total_claimed; 1231 nodes.claim_info.total_claimed += 1; 1232 } 1233 return new HtmlTagHydration(is_svg, claimed_nodes); 1234} 1235 1236/** 1237 * @param {Text} text 1238 * @param {unknown} data 1239 * @returns {void} 1240 */ 1241function set_data(text, data) { 1242 data = '' + data; 1243 if (text.data === data) return; 1244 text.data = /** @type {string} */ (data); 1245} 1246 1247/** 1248 * @param {Text} text 1249 * @param {unknown} data 1250 * @returns {void} 1251 */ 1252function set_data_contenteditable(text, data) { 1253 data = '' + data; 1254 if (text.wholeText === data) return; 1255 text.data = /** @type {string} */ (data); 1256} 1257 1258/** 1259 * @param {Text} text 1260 * @param {unknown} data 1261 * @param {string} attr_value 1262 * @returns {void} 1263 */ 1264function set_data_maybe_contenteditable(text, data, attr_value) { 1265 if (~contenteditable_truthy_values.indexOf(attr_value)) { 1266 set_data_contenteditable(text, data); 1267 } else { 1268 set_data(text, data); 1269 } 1270} 1271 1272/** 1273 * @returns {void} */ 1274function set_input_value(input, value) { 1275 input.value = value == null ? '' : value; 1276} 1277 1278/** 1279 * @returns {void} */ 1280function set_input_type(input, type) { 1281 try { 1282 input.type = type; 1283 } catch (e) { 1284 // do nothing 1285 } 1286} 1287 1288/** 1289 * @returns {void} */ 1290function set_style(node, key, value, important) { 1291 if (value == null) { 1292 node.style.removeProperty(key); 1293 } else { 1294 node.style.setProperty(key, value, important ? 'important' : ''); 1295 } 1296} 1297 1298/** 1299 * @returns {void} */ 1300function select_option(select, value, mounting) { 1301 for (let i = 0; i < select.options.length; i += 1) { 1302 const option = select.options[i]; 1303 if (option.__value === value) { 1304 option.selected = true; 1305 return; 1306 } 1307 } 1308 if (!mounting || value !== undefined) { 1309 select.selectedIndex = -1; // no option should be selected 1310 } 1311} 1312 1313/** 1314 * @returns {void} */ 1315function select_options(select, value) { 1316 for (let i = 0; i < select.options.length; i += 1) { 1317 const option = select.options[i]; 1318 option.selected = ~value.indexOf(option.__value); 1319 } 1320} 1321 1322function select_value(select) { 1323 const selected_option = select.querySelector(':checked'); 1324 return selected_option && selected_option.__value; 1325} 1326 1327function select_multiple_value(select) { 1328 return [].map.call(select.querySelectorAll(':checked'), (option) => option.__value); 1329} 1330// unfortunately this can't be a constant as that wouldn't be tree-shakeable 1331// so we cache the result instead 1332 1333/** 1334 * @type {boolean} */ 1335let crossorigin; 1336 1337/** 1338 * @returns {boolean} */ 1339function is_crossorigin() { 1340 if (crossorigin === undefined) { 1341 crossorigin = false;
1342 try { 1343 if (typeof window !== 'undefined' && window.parent) { 1344 void window.parent.document; 1345 } 1346 } catch (error) { 1347 crossorigin = true; 1348 } 1349 } 1350 return crossorigin; 1351} 1352 1353/** 1354 * @param {HTMLElement} node 1355 * @param {() => void} fn 1356 * @returns {() => void} 1357 */ 1358function add_iframe_resize_listener(node, fn) { 1359 const computed_style = getComputedStyle(node); 1360 if (computed_style.position === 'static') { 1361 node.style.position = 'relative'; 1362 } 1363 const iframe = element('iframe'); 1364 iframe.setAttribute( 1365 'style', 1366 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' + 1367 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;' 1368 ); 1369 iframe.setAttribute('aria-hidden', 'true'); 1370 iframe.tabIndex = -1; 1371 const crossorigin = is_crossorigin(); 1372 1373 /** 1374 * @type {() => void} 1375 */ 1376 let unsubscribe; 1377 if (crossorigin) { 1378 iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>"; 1379 unsubscribe = listen( 1380 window, 1381 'message', 1382 /** @param {MessageEvent} event */ (event) => { 1383 if (event.source === iframe.contentWindow) fn(); 1384 } 1385 ); 1386 } else { 1387 iframe.src = 'about:blank'; 1388 iframe.onload = () => { 1389 unsubscribe = listen(iframe.contentWindow, 'resize', fn); 1390 // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous) 1391 // see https://github.com/sveltejs/svelte/issues/4233 1392 fn(); 1393 }; 1394 } 1395 append(node, iframe); 1396 return () => { 1397 if (crossorigin) { 1398 unsubscribe(); 1399 } else if (unsubscribe && iframe.contentWindow) { 1400 unsubscribe(); 1401 } 1402 detach(iframe); 1403 }; 1404} 1405const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ 1406 box: 'content-box' 1407}); 1408const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ 1409 box: 'border-box' 1410}); 1411const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton( 1412 { box: 'device-pixel-content-box' } 1413); 1414 1415/** 1416 * @returns {void} */ 1417function toggle_class(element, name, toggle) { 1418 // The `!!` is required because an `undefined` flag means flipping the current state. 1419 element.classList.toggle(name, !!toggle); 1420} 1421 1422/** 1423 * @template T 1424 * @param {string} type 1425 * @param {T} [detail] 1426 * @param {{ bubbles?: boolean, cancelable?: boolean }} [options] 1427 * @returns {CustomEvent<T>} 1428 */ 1429function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { 1430 return new CustomEvent(type, { detail, bubbles, cancelable }); 1431} 1432 1433/** 1434 * @param {string} selector 1435 * @param {HTMLElement} parent 1436 * @returns {ChildNodeArray} 1437 */ 1438function query_selector_all(selector, parent = document.body) { 1439 return Array.from(parent.querySelectorAll(selector)); 1440} 1441 1442/** 1443 * @param {string} nodeId 1444 * @param {HTMLElement} head 1445 * @returns {any[]} 1446 */ 1447function head_selector(nodeId, head) { 1448 const result = []; 1449 let started = 0; 1450 for (const node of head.childNodes) { 1451 if (node.nodeType === 8 /* comment node */) { 1452 const comment = node.textContent.trim(); 1453 if (comment === `HEAD_${nodeId}_END`) { 1454 started -= 1; 1455 result.push(node); 1456 } else if (comment === `HEAD_${nodeId}_START`) { 1457 started += 1; 1458 result.push(node); 1459 } 1460 } else if (started > 0) { 1461 result.push(node); 1462 } 1463 } 1464 return result; 1465} 1466/** */ 1467class HtmlTag { 1468 /** 1469 * @private 1470 * @default false 1471 */ 1472 is_svg = false; 1473 /** parent for creating node */ 1474 e = undefined; 1475 /** html tag nodes */ 1476 n = undefined; 1477 /** target */ 1478 t = undefined; 1479 /** anchor */ 1480 a = undefined; 1481 constructor(is_svg = false) { 1482 this.is_svg = is_svg; 1483 this.e = this.n = null; 1484 } 1485 1486 /** 1487 * @param {string} html 1488 * @returns {void} 1489 */ 1490 c(html) { 1491 this.h(html); 1492 } 1493 1494 /** 1495 * @param {string} html 1496 * @param {HTMLElement | SVGElement} target 1497 * @param {HTMLElement | SVGElement} anchor 1498 * @returns {void} 1499 */ 1500 m(html, target, anchor = null) { 1501 if (!this.e) { 1502 if (this.is_svg) 1503 this.e = svg_element(/** @type {keyof SVGElementTagNameMap} */ (target.nodeName)); 1504 /** #7364 target for <template>
1504 may be provided as #document-fragment(11) */ else 1505 this.e = element( 1506 /** @type {keyof HTMLElementTagNameMap} */ ( 1507 target.nodeType === 11 ? 'TEMPLATE' : target.nodeName 1508 ) 1509 ); 1510 this.t = 1511 target.tagName !== 'TEMPLATE' 1512 ? target 1513 : /** @type {HTMLTemplateElement} */ (target).content; 1514 this.c(html); 1515 } 1516 this.i(anchor); 1517 } 1518 1519 /** 1520 * @param {string} html 1521 * @returns {void} 1522 */ 1523 h(html) { 1524 this.e.innerHTML = html; 1525 this.n = Array.from( 1526 this.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes 1527 ); 1528 } 1529 1530 /** 1531 * @returns {void} */ 1532 i(anchor) { 1533 for (let i = 0; i < this.n.length; i += 1) { 1534 insert(this.t, this.n[i], anchor); 1535 } 1536 } 1537 1538 /** 1539 * @param {string} html 1540 * @returns {void} 1541 */ 1542 p(html) { 1543 this.d(); 1544 this.h(html); 1545 this.i(this.a); 1546 } 1547 1548 /** 1549 * @returns {void} */ 1550 d() { 1551 this.n.forEach(detach); 1552 } 1553} 1554 1555class HtmlTagHydration extends HtmlTag { 1556 /** @type {Element[]} hydration claimed nodes */ 1557 l = undefined; 1558 1559 constructor(is_svg = false, claimed_nodes) { 1560 super(is_svg); 1561 this.e = this.n = null; 1562 this.l = claimed_nodes; 1563 } 1564 1565 /** 1566 * @param {string} html 1567 * @returns {void} 1568 */ 1569 c(html) { 1570 if (this.l) { 1571 this.n = this.l; 1572 } else { 1573 super.c(html); 1574 } 1575 } 1576 1577 /** 1578 * @returns {void} */ 1579 i(anchor) { 1580 for (let i = 0; i < this.n.length; i += 1) { 1581 insert_hydration(this.t, this.n[i], anchor); 1582 } 1583 } 1584} 1585 1586/** 1587 * @param {NamedNodeMap} attributes 1588 * @returns {{}} 1589 */ 1590function attribute_to_object(attributes) { 1591 const result = {}; 1592 for (const attribute of attributes) { 1593 result[attribute.name] = attribute.value; 1594 } 1595 return result; 1596} 1597 1598/** 1599 * @param {HTMLElement} element 1600 * @returns {{}} 1601 */ 1602function get_custom_elements_slots(element) { 1603 const result = {}; 1604 element.childNodes.forEach( 1605 /** @param {Element} node */ (node) => { 1606 result[node.slot || 'default'] = true; 1607 } 1608 ); 1609 return result; 1610} 1611 1612function construct_svelte_component(component, props) { 1613 return new component(props); 1614} 1615 1616/** 1617 * @typedef {Node & { 1618 * claim_order?: number; 1619 * hydrate_init?: true; 1620 * actual_end_child?: NodeEx; 1621 * childNodes: NodeListOf<NodeEx>; 1622 * }} NodeEx 1623 */ 1624 1625/** @typedef {ChildNode & NodeEx} ChildNodeEx */ 1626 1627/** @typedef {NodeEx & { claim_order: number }} NodeEx2 */ 1628 1629/** 1630 * @typedef {ChildNodeEx[] & { 1631 * claim_info?: { 1632 * last_index: number; 1633 * total_claimed: number; 1634 * }; 1635 * }} ChildNodeArray 1636 */ 1637 1638// we need to store the information for multiple documents because a Svelte application could also contain iframes 1639// https://github.com/sveltejs/svelte/issues/3624 1640/** @type {Map<Document | ShadowRoot, import('./private.d.ts').StyleInformation>} */ 1641const managed_styles = new Map(); 1642 1643let active = 0; 1644 1645// https://github.com/darkskyapp/string-hash/blob/master/index.js 1646/** 1647 * @param {string} str 1648 * @returns {number} 1649 */ 1650function hash(str) { 1651 let hash = 5381; 1652 let i = str.length; 1653 while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); 1654 return hash >>> 0; 1655} 1656 1657/** 1658 * @param {Document | ShadowRoot} doc 1659 * @param {Element & ElementCSSInlineStyle} node 1660 * @returns {{ stylesheet: any; rules: {}; }} 1661 */ 1662function create_style_information(doc, node) { 1663 const info = { stylesheet: append_empty_stylesheet(node), rules: {} }; 1664 managed_styles.set(doc, info); 1665 return info; 1666} 1667 1668/** 1669 * @param {Element & ElementCSSInlineStyle} node 1670 * @param {number} a 1671 * @param {number} b 1672 * @param {number} duration 1673 * @param {number} delay 1674 * @param {(t: number) => number} ease 1675 * @param {(t: number, u: number) => string} fn 1676 * @param {number} uid 1677 * @returns {string} 1678 */ 1679function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { 1680 const step = 16.666 / duration; 1681 let keyframes = '{\n'; 1682 for (let p = 0; p <= 1; p += step) { 1683 const t = a + (b - a) * ease(p); 1684 keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`; 1685 } 1686 const rule = keyframes + `100% {${fn(b, 1 - b)}}\n}`; 1687 const name = `__svelte_${hash(rule)}_${uid}`; 1688 const doc = get_root_for_style(node); 1689 const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node); 1690 if (!rules[name]) { 1691 rules[name] = true; 1692 stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); 1693 } 1694 const animation = node.style.animation || ''; 1695 node.style.animation = `${ 1696 animation ? `${animation}, ` : '' 1697 }${name} ${duration}ms linear ${delay}ms 1 both`; 1698 active += 1; 1699 return name; 1700} 1701
vendor: 4,301 bytes, lines 1702-1865
1702/** 1703 * @param {Element & ElementCSSInlineStyle} node 1704 * @param {string} [name] 1705 * @returns {void} 1706 */ 1707function delete_rule(node, name) { 1708 const previous = (node.style.animation || '').split(', '); 1709 const next = previous.filter( 1710 name 1711 ? (anim) => anim.indexOf(name) < 0 // remove specific animation 1712 : (anim) => anim.indexOf('__svelte') === -1 // remove all Svelte animations 1713 ); 1714 const deleted = previous.length - next.length; 1715 if (deleted) { 1716 node.style.animation = next.join(', '); 1717 active -= deleted; 1718 if (!active) clear_rules(); 1719 } 1720} 1721 1722/** @returns {void} */ 1723function clear_rules() { 1724 raf(() => { 1725 if (active) return; 1726 managed_styles.forEach((info) => { 1727 const { ownerNode } = info.stylesheet; 1728 // there is no ownerNode if it runs on jsdom. 1729 if (ownerNode) detach(ownerNode); 1730 }); 1731 managed_styles.clear(); 1732 }); 1733} 1734 1735/** 1736 * @param {Element & ElementCSSInlineStyle} node 1737 * @param {import('./private.js').PositionRect} from 1738 * @param {import('./private.js').AnimationFn} fn 1739 */ 1740function create_animation(node, from, fn, params) { 1741 if (!from) return noop; 1742 const to = node.getBoundingClientRect(); 1743 if ( 1744 from.left === to.left && 1745 from.right === to.right && 1746 from.top === to.top && 1747 from.bottom === to.bottom 1748 ) 1749 return noop; 1750 const { 1751 delay = 0, 1752 duration = 300, 1753 easing = identity, 1754 // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation? 1755 start: start_time = now() + delay, 1756 // @ts-ignore todo: 1757 end = start_time + duration, 1758 tick = noop, 1759 css 1760 } = fn(node, { from, to }, params); 1761 let running = true; 1762 let started = false; 1763 let name; 1764 /** @returns {void} */ 1765 function start() { 1766 if (css) { 1767 name = create_rule(node, 0, 1, duration, delay, easing, css); 1768 } 1769 if (!delay) { 1770 started = true; 1771 } 1772 } 1773 /** @returns {void} */ 1774 function stop() { 1775 if (css) delete_rule(node, name); 1776 running = false; 1777 } 1778 loop((now) => { 1779 if (!started && now >= start_time) { 1780 started = true; 1781 } 1782 if (started && now >= end) { 1783 tick(1, 0); 1784 stop(); 1785 } 1786 if (!running) { 1787 return false; 1788 } 1789 if (started) { 1790 const p = now - start_time; 1791 const t = 0 + 1 * easing(p / duration); 1792 tick(t, 1 - t); 1793 } 1794 return true; 1795 }); 1796 start(); 1797 tick(0, 1); 1798 return stop; 1799} 1800 1801/** 1802 * @param {Element & ElementCSSInlineStyle} node 1803 * @returns {void} 1804 */ 1805function fix_position(node) { 1806 const style = getComputedStyle(node); 1807 if (style.position !== 'absolute' && style.position !== 'fixed') { 1808 const { width, height } = style; 1809 const a = node.getBoundingClientRect(); 1810 node.style.position = 'absolute'; 1811 node.style.width = width; 1812 node.style.height = height; 1813 add_transform(node, a); 1814 } 1815} 1816 1817/** 1818 * @param {Element & ElementCSSInlineStyle} node 1819 * @param {import('./private.js').PositionRect} a 1820 * @returns {void} 1821 */ 1822function add_transform(node, a) { 1823 const b = node.getBoundingClientRect(); 1824 if (a.left !== b.left || a.top !== b.top) { 1825 const style = getComputedStyle(node); 1826 const transform = style.transform === 'none' ? '' : style.transform; 1827 node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`; 1828 } 1829} 1830 1831let current_component; 1832 1833/** @returns {void} */ 1834function set_current_component(component) { 1835 current_component = component; 1836} 1837 1838function get_current_component() { 1839 if (!current_component) throw new Error('Function called outside component initialization'); 1840 return current_component; 1841} 1842 1843/** 1844 * Schedules a callback to run immediately before the component is updated after any state change. 1845 * 1846 * The first time the callback runs will be before the initial `onMount` 1847 * 1848 * https://svelte.dev/docs/svelte#beforeupdate 1849 * @param {() => any} fn 1850 * @returns {void} 1851 */ 1852function beforeUpdate(fn) { 1853 get_current_component().$$.before_update.push(fn); 1854} 1855 1856/** 1857 * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. 1858 * It must be called during the component's initialisation (but doesn't need to live *inside* the component; 1859 * it can be called from an external module). 1860 * 1861 * If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted. 1862 * 1863 * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api). 1864 * 1865 * https://svelte.dev/docs/svelte#onmount
1866 * @template T 1867 * @param {() => import('./private.js').NotFunction<T> | Promise<import('./private.js').NotFunction<T>> | (() => any)} fn 1868 * @returns {void} 1869 */ 1870function onMount(fn) { 1871 get_current_component().$$.on_mount.push(fn); 1872} 1873 1874/** 1875 * Schedules a callback to run immediately after the component has been updated. 1876 * 1877 * The first time the callback runs will be after the initial `onMount` 1878 * 1879 * https://svelte.dev/docs/svelte#afterupdate 1880 * @param {() => any} fn 1881 * @returns {void} 1882 */ 1883function afterUpdate(fn) { 1884 get_current_component().$$.after_update.push(fn); 1885} 1886 1887/** 1888 * Schedules a callback to run immediately before the component is unmounted. 1889 * 1890 * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the 1891 * only one that runs inside a server-side component. 1892 * 1893 * https://svelte.dev/docs/svelte#ondestroy 1894 * @param {() => any} fn 1895 * @returns {void} 1896 */ 1897function onDestroy(fn) { 1898 get_current_component().$$.on_destroy.push(fn); 1899} 1900 1901/** 1902 * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname). 1903 * Event dispatchers are functions that can take two arguments: `name` and `detail`. 1904 * 1905 * Component events created with `createEventDispatcher` create a 1906 * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). 1907 * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture). 1908 * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) 1909 * property and can contain any type of data. 1910 * 1911 * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument: 1912 * ```ts 1913 * const dispatch = createEventDispatcher<{ 1914 * loaded: never; // does not take a detail argument 1915 * change: string; // takes a detail argument of type string, which is required 1916 * optional: number | null; // takes an optional detail argument of type number 1917 * }>(); 1918 * ``` 1919 * 1920 * https://svelte.dev/docs/svelte#createeventdispatcher 1921 * @template {Record<string, any>} [EventMap=any] 1922 * @returns {import('./public.js').EventDispatcher<EventMap>} 1923 */ 1924function createEventDispatcher() { 1925 const component = get_current_component(); 1926 return (type, detail, { cancelable = false } = {}) => { 1927 const callbacks = component.$$.callbacks[type]; 1928 if (callbacks) { 1929 // TODO are there situations where events could be dispatched 1930 // in a server (non-DOM) environment? 1931 const event = custom_event(/** @type {string} */ (type), detail, { cancelable }); 1932 callbacks.slice().forEach((fn) => { 1933 fn.call(component, event); 1934 }); 1935 return !event.defaultPrevented; 1936 } 1937 return true; 1938 }; 1939} 1940 1941/** 1942 * Associates an arbitrary `context` object with the current component and the specified `key` 1943 * and returns that object. The context is then available to children of the component 1944 * (including slotted content) with `getContext`. 1945 * 1946 * Like lifecycle functions, this must be called during component initialisation. 1947 * 1948 * https://svelte.dev/docs/svelte#setcontext 1949 * @template T 1950 * @param {any} key 1951 * @param {T} context 1952 * @returns {T} 1953 */ 1954function setContext(key, context) { 1955 get_current_component().$$.context.set(key, context); 1956 return context; 1957} 1958 1959/** 1960 * Retrieves the context that belongs to the closest parent component with the specified `key`. 1961 * Must be called during component initialisation. 1962 * 1963 * https://svelte.dev/docs/svelte#getcontext 1964 * @template T 1965 * @param {any} key 1966 * @returns {T} 1967 */ 1968function getContext(key) { 1969 return get_current_component().$$.context.get(key); 1970} 1971 1972/** 1973 * Retrieves the whole context map that belongs to the closest parent component. 1974 * Must be called during component initialisation. Useful, for example, if you 1975 * programmatically create a component and want to pass the existing context to it. 1976 * 1977 * https://svelte.dev/docs/svelte#getallcontexts 1978 * @template {Map<any, any>} [T=Map<any, any>] 1979 * @returns {T} 1980 */ 1981function getAllContexts() { 1982 return get_current_component().$$.context; 1983} 1984 1985/** 1986 * Checks whether a given `key` has been set in the context of a parent component. 1987 * Must be called during component initialisation. 1988 * 1989 * https://svelte.dev/docs/svelte#hascontext 1990 * @param {any} key 1991 * @returns {boolean} 1992 */
1993function hasContext(key) { 1994 return get_current_component().$$.context.has(key); 1995} 1996 1997// TODO figure out if we still want to support 1998// shorthand events, or if we want to implement 1999// a real bubbling mechanism 2000/** 2001 * @param component 2002 * @param event 2003 * @returns {void} 2004 */ 2005function bubble(component, event) { 2006 const callbacks = component.$$.callbacks[event.type]; 2007 if (callbacks) { 2008 // @ts-ignore 2009 callbacks.slice().forEach((fn) => fn.call(this, event)); 2010 } 2011} 2012 2013const dirty_components = []; 2014const intros = { enabled: false }; 2015const binding_callbacks = []; 2016 2017let render_callbacks = []; 2018 2019const flush_callbacks = []; 2020 2021const resolved_promise = /* @__PURE__ */ Promise.resolve(); 2022 2023let update_scheduled = false; 2024 2025/** @returns {void} */ 2026function schedule_update() { 2027 if (!update_scheduled) { 2028 update_scheduled = true; 2029 resolved_promise.then(flush); 2030 } 2031} 2032 2033/** @returns {Promise<void>} */ 2034function tick() { 2035 schedule_update(); 2036 return resolved_promise; 2037} 2038 2039/** @returns {void} */ 2040function add_render_callback(fn) { 2041 render_callbacks.push(fn); 2042} 2043 2044/** @returns {void} */ 2045function add_flush_callback(fn) { 2046 flush_callbacks.push(fn); 2047} 2048 2049// flush() calls callbacks in this order: 2050// 1. All beforeUpdate callbacks, in order: parents before children 2051// 2. All bind:this callbacks, in reverse order: children before parents. 2052// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT 2053// for afterUpdates called during the initial onMount, which are called in 2054// reverse order: children before parents. 2055// Since callbacks might update component values, which could trigger another 2056// call to flush(), the following steps guard against this: 2057// 1. During beforeUpdate, any updated components will be added to the 2058// dirty_components array and will cause a reentrant call to flush(). Because 2059// the flush index is kept outside the function, the reentrant call will pick 2060// up where the earlier call left off and go through all dirty components. The 2061// current_component value is saved and restored so that the reentrant call will 2062// not interfere with the "parent" flush() call. 2063// 2. bind:this callbacks cannot trigger new flush() calls. 2064// 3. During afterUpdate, any updated components will NOT have their afterUpdate 2065// callback called a second time; the seen_callbacks set, outside the flush() 2066// function, guarantees this behavior. 2067const seen_callbacks = new Set(); 2068 2069let flushidx = 0; // Do *not* move this inside the flush() function 2070 2071/** @returns {void} */ 2072function flush() { 2073 // Do not reenter flush while dirty components are updated, as this can 2074 // result in an infinite loop. Instead, let the inner flush handle it. 2075 // Reentrancy is ok afterwards for bindings etc. 2076 if (flushidx !== 0) { 2077 return; 2078 } 2079 const saved_component = current_component; 2080 do { 2081 // first, call beforeUpdate functions 2082 // and update components 2083 try { 2084 while (flushidx < dirty_components.length) { 2085 const component = dirty_components[flushidx]; 2086 flushidx++; 2087 set_current_component(component); 2088 update(component.$$); 2089 } 2090 } catch (e) { 2091 // reset dirty state to not end up in a deadlocked state and then rethrow 2092 dirty_components.length = 0; 2093 flushidx = 0; 2094 throw e; 2095 } 2096 set_current_component(null); 2097 dirty_components.length = 0; 2098 flushidx = 0; 2099 while (binding_callbacks.length) binding_callbacks.pop()(); 2100 // then, once components are updated, call 2101 // afterUpdate functions. This may cause 2102 // subsequent updates... 2103 for (let i = 0; i < render_callbacks.length; i += 1) { 2104 const callback = render_callbacks[i]; 2105 if (!seen_callbacks.has(callback)) { 2106 // ...so guard against infinite loops 2107 seen_callbacks.add(callback); 2108 callback(); 2109 } 2110 } 2111 render_callbacks.length = 0; 2112 } while (dirty_components.length); 2113 while (flush_callbacks.length) { 2114 flush_callbacks.pop()(); 2115 } 2116 update_scheduled = false; 2117 seen_callbacks.clear(); 2118 set_current_component(saved_component); 2119} 2120 2121/** @returns {void} */ 2122function update($$) { 2123 if ($$.fragment !== null) { 2124 $$.update(); 2125 run_all($$.before_update); 2126 const dirty = $$.dirty; 2127 $$.dirty = [-1]; 2128 $$.fragment && $$.fragment.p($$.ctx, dirty); 2129 $$.after_update.forEach(add_render_callback); 2130 } 2131} 2132 2133/** 2134 * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`. 2135 * @param {Function[]} fns 2136 * @returns {void} 2137 */ 2138function flush_render_callbacks(fns) { 2139 const filtered = []; 2140 const targets = []; 2141 render_callbacks.forEach((c) => (fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)));
vendor: 4,536 bytes, lines 2142-2370
2142 targets.forEach((c) => c()); 2143 render_callbacks = filtered; 2144} 2145 2146/** 2147 * @type {Promise<void> | null} 2148 */ 2149let promise; 2150 2151/** 2152 * @returns {Promise<void>} 2153 */ 2154function wait() { 2155 if (!promise) { 2156 promise = Promise.resolve(); 2157 promise.then(() => { 2158 promise = null; 2159 }); 2160 } 2161 return promise; 2162} 2163 2164/** 2165 * @param {Element} node 2166 * @param {INTRO | OUTRO | boolean} direction 2167 * @param {'start' | 'end'} kind 2168 * @returns {void} 2169 */ 2170function dispatch(node, direction, kind) { 2171 node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`)); 2172} 2173 2174const outroing = new Set(); 2175 2176/** 2177 * @type {Outro} 2178 */ 2179let outros; 2180 2181/** 2182 * @returns {void} */ 2183function group_outros() { 2184 outros = { 2185 r: 0, 2186 c: [], 2187 p: outros // parent group 2188 }; 2189} 2190 2191/** 2192 * @returns {void} */ 2193function check_outros() { 2194 if (!outros.r) { 2195 run_all(outros.c); 2196 } 2197 outros = outros.p; 2198} 2199 2200/** 2201 * @param {import('./private.js').Fragment} block 2202 * @param {0 | 1} [local] 2203 * @returns {void} 2204 */ 2205function transition_in(block, local) { 2206 if (block && block.i) { 2207 outroing.delete(block); 2208 block.i(local); 2209 } 2210} 2211 2212/** 2213 * @param {import('./private.js').Fragment} block 2214 * @param {0 | 1} local 2215 * @param {0 | 1} [detach] 2216 * @param {() => void} [callback] 2217 * @returns {void} 2218 */ 2219function transition_out(block, local, detach, callback) { 2220 if (block && block.o) { 2221 if (outroing.has(block)) return; 2222 outroing.add(block); 2223 outros.c.push(() => { 2224 outroing.delete(block); 2225 if (callback) { 2226 if (detach) block.d(1); 2227 callback(); 2228 } 2229 }); 2230 block.o(local); 2231 } else if (callback) { 2232 callback(); 2233 } 2234} 2235 2236/** 2237 * @type {import('../transition/public.js').TransitionConfig} 2238 */ 2239const null_transition = { duration: 0 }; 2240 2241/** 2242 * @param {Element & ElementCSSInlineStyle} node 2243 * @param {TransitionFn} fn 2244 * @param {any} params 2245 * @returns {{ start(): void; invalidate(): void; end(): void; }} 2246 */ 2247function create_in_transition(node, fn, params) { 2248 /** 2249 * @type {TransitionOptions} */ 2250 const options = { direction: 'in' }; 2251 let config = fn(node, params, options); 2252 let running = false; 2253 let animation_name; 2254 let task; 2255 let uid = 0; 2256 2257 /** 2258 * @returns {void} */ 2259 function cleanup() { 2260 if (animation_name) delete_rule(node, animation_name); 2261 } 2262 2263 /** 2264 * @returns {void} */ 2265 function go() { 2266 const { 2267 delay = 0, 2268 duration = 300, 2269 easing = identity, 2270 tick = noop, 2271 css 2272 } = config || null_transition; 2273 if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++); 2274 tick(0, 1); 2275 const start_time = now() + delay; 2276 const end_time = start_time + duration; 2277 if (task) task.abort(); 2278 running = true; 2279 add_render_callback(() => dispatch(node, true, 'start')); 2280 task = loop((now) => { 2281 if (running) { 2282 if (now >= end_time) { 2283 tick(1, 0); 2284 dispatch(node, true, 'end'); 2285 cleanup(); 2286 return (running = false); 2287 } 2288 if (now >= start_time) { 2289 const t = easing((now - start_time) / duration); 2290 tick(t, 1 - t); 2291 } 2292 } 2293 return running; 2294 }); 2295 } 2296 let started = false; 2297 return { 2298 start() { 2299 if (started) return; 2300 started = true; 2301 delete_rule(node); 2302 if (is_function(config)) { 2303 config = config(options); 2304 wait().then(go); 2305 } else { 2306 go(); 2307 } 2308 }, 2309 invalidate() { 2310 started = false; 2311 }, 2312 end() { 2313 if (running) { 2314 cleanup(); 2315 running = false; 2316 } 2317 } 2318 }; 2319} 2320 2321/** 2322 * @param {Element & ElementCSSInlineStyle} node 2323 * @param {TransitionFn} fn 2324 * @param {any} params 2325 * @returns {{ end(reset: any): void; }} 2326 */ 2327function create_out_transition(node, fn, params) { 2328 /** @type {TransitionOptions} */ 2329 const options = { direction: 'out' }; 2330 let config = fn(node, params, options); 2331 let running = true; 2332 let animation_name; 2333 const group = outros; 2334 group.r += 1; 2335 /** @type {boolean} */ 2336 let original_inert_value; 2337 2338 /** 2339 * @returns {void} */ 2340 function go() { 2341 const { 2342 delay = 0, 2343 duration = 300, 2344 easing = identity, 2345 tick = noop, 2346 css 2347 } = config || null_transition; 2348 2349 if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css); 2350 2351 const start_time = now() + delay; 2352 const end_time = start_time + duration; 2353 add_render_callback(() => dispatch(node, false, 'start')); 2354 2355 if ('inert' in node) { 2356 original_inert_value = /** @type {HTMLElement} */ (node).inert; 2357 node.inert = true; 2358 } 2359 2360 loop((now) => { 2361 if (running) { 2362 if (now >= end_time) { 2363 tick(0, 1); 2364 dispatch(node, false, 'end'); 2365 if (!--group.r) { 2366 // this will result in `end()` being called, 2367 // so we don't need to clean up here 2368 run_all(group.c); 2369 } 2370 return false;
2371 } 2372 if (now >= start_time) { 2373 const t = easing((now - start_time) / duration); 2374 tick(1 - t, t); 2375 } 2376 } 2377 return running; 2378 }); 2379 } 2380 2381 if (is_function(config)) { 2382 wait().then(() => { 2383 // @ts-ignore 2384 config = config(options); 2385 go(); 2386 }); 2387 } else { 2388 go(); 2389 } 2390 2391 return { 2392 end(reset) { 2393 if (reset && 'inert' in node) { 2394 node.inert = original_inert_value; 2395 } 2396 if (reset && config.tick) { 2397 config.tick(1, 0); 2398 } 2399 if (running) { 2400 if (animation_name) delete_rule(node, animation_name); 2401 running = false; 2402 } 2403 } 2404 }; 2405} 2406 2407/** 2408 * @param {Element & ElementCSSInlineStyle} node 2409 * @param {TransitionFn} fn 2410 * @param {any} params 2411 * @param {boolean} intro 2412 * @returns {{ run(b: 0 | 1): void; end(): void; }} 2413 */ 2414function create_bidirectional_transition(node, fn, params, intro) { 2415 /** 2416 * @type {TransitionOptions} */ 2417 const options = { direction: 'both' }; 2418 let config = fn(node, params, options); 2419 let t = intro ? 0 : 1; 2420 2421 /** 2422 * @type {Program | null} */ 2423 let running_program = null; 2424 2425 /** 2426 * @type {PendingProgram | null} */ 2427 let pending_program = null; 2428 let animation_name = null; 2429 2430 /** @type {boolean} */ 2431 let original_inert_value; 2432 2433 /** 2434 * @returns {void} */ 2435 function clear_animation() { 2436 if (animation_name) delete_rule(node, animation_name); 2437 } 2438 2439 /** 2440 * @param {PendingProgram} program 2441 * @param {number} duration 2442 * @returns {Program} 2443 */ 2444 function init(program, duration) { 2445 const d = /** @type {Program['d']} */ (program.b - t); 2446 duration *= Math.abs(d); 2447 return { 2448 a: t, 2449 b: program.b, 2450 d, 2451 duration, 2452 start: program.start, 2453 end: program.start + duration, 2454 group: program.group 2455 }; 2456 } 2457 2458 /** 2459 * @param {INTRO | OUTRO} b 2460 * @returns {void} 2461 */ 2462 function go(b) { 2463 const { 2464 delay = 0, 2465 duration = 300, 2466 easing = identity, 2467 tick = noop, 2468 css 2469 } = config || null_transition; 2470 2471 /** 2472 * @type {PendingProgram} */ 2473 const program = { 2474 start: now() + delay, 2475 b 2476 }; 2477 2478 if (!b) { 2479 // @ts-ignore todo: improve typings 2480 program.group = outros; 2481 outros.r += 1; 2482 } 2483 2484 if ('inert' in node) { 2485 if (b) { 2486 if (original_inert_value !== undefined) { 2487 // aborted/reversed outro — restore previous inert value 2488 node.inert = original_inert_value; 2489 } 2490 } else { 2491 original_inert_value = /** @type {HTMLElement} */ (node).inert; 2492 node.inert = true; 2493 } 2494 } 2495 2496 if (running_program || pending_program) { 2497 pending_program = program; 2498 } else { 2499 // if this is an intro, and there's a delay, we need to do 2500 // an initial tick and/or apply CSS animation immediately 2501 if (css) { 2502 clear_animation(); 2503 animation_name = create_rule(node, t, b, duration, delay, easing, css); 2504 } 2505 if (b) tick(0, 1); 2506 running_program = init(program, duration); 2507 add_render_callback(() => dispatch(node, b, 'start')); 2508 loop((now) => { 2509 if (pending_program && now > pending_program.start) { 2510 running_program = init(pending_program, duration); 2511 pending_program = null; 2512 dispatch(node, running_program.b, 'start'); 2513 if (css) { 2514 clear_animation(); 2515 animation_name = create_rule( 2516 node, 2517 t, 2518 running_program.b, 2519 running_program.duration, 2520 0, 2521 easing, 2522 config.css 2523 ); 2524 } 2525 } 2526 if (running_program) { 2527 if (now >= running_program.end) { 2528 tick((t = running_program.b), 1 - t); 2529 dispatch(node, running_program.b, 'end'); 2530 if (!pending_program) { 2531 // we're done 2532 if (running_program.b) { 2533 // intro — we can tidy up immediately 2534 clear_animation(); 2535 } else { 2536 // outro — needs to be coordinated 2537 if (!--running_program.group.r) run_all(running_program.group.c); 2538 } 2539 } 2540 running_program = null; 2541 } else if (now >= running_program.start) { 2542 const p = now - running_program.start; 2543 t = running_program.a + running_program.d * easing(p / running_program.duration); 2544 tick(t, 1 - t); 2545 } 2546 } 2547 return !!(running_program || pending_program); 2548 }); 2549 } 2550 } 2551 return { 2552 run(b) { 2553 if (is_function(config)) { 2554 wait().then(() => { 2555 const opts = { direction: b ? 'in' : 'out' }; 2556 // @ts-ignore 2557 config = config(opts); 2558 go(b); 2559 }); 2560 } else { 2561 go(b); 2562 } 2563 }, 2564 end() { 2565 clear_animation(); 2566 running_program = pending_program = null; 2567 } 2568 }; 2569} 2570 2571/** @typedef {1} INTRO */ 2572/** @typedef {0} OUTRO */ 2573/** @typedef {{ direction: 'in' | 'out' | 'both' }} TransitionOptions */ 2574/** @typedef {(node: Element, params: any, options: TransitionOptions) => import('../transition/public.js').TransitionConfig} TransitionFn */ 2575 2576/** 2577 * @typedef {Object} Outro 2578 * @property {number} r 2579 * @property {Function[]} c 2580 * @property {Object} p 2581 */ 2582 2583/** 2584 * @typedef {Object} PendingProgram 2585 * @property {number} start 2586 * @property {INTRO|OUTRO} b 2587 * @property {Outro} [group] 2588 */ 2589
2590/** 2591 * @typedef {Object} Program 2592 * @property {number} a 2593 * @property {INTRO|OUTRO} b 2594 * @property {1|-1} d 2595 * @property {number} duration 2596 * @property {number} start 2597 * @property {number} end 2598 * @property {Outro} [group] 2599 */ 2600 2601/** 2602 * @template T 2603 * @param {Promise<T>} promise 2604 * @param {import('./private.js').PromiseInfo<T>} info 2605 * @returns {boolean} 2606 */ 2607function handle_promise(promise, info) { 2608 const token = (info.token = {}); 2609 /** 2610 * @param {import('./private.js').FragmentFactory} type 2611 * @param {0 | 1 | 2} index 2612 * @param {number} [key] 2613 * @param {any} [value] 2614 * @returns {void} 2615 */ 2616 function update(type, index, key, value) { 2617 if (info.token !== token) return; 2618 info.resolved = value; 2619 let child_ctx = info.ctx; 2620 if (key !== undefined) { 2621 child_ctx = child_ctx.slice(); 2622 child_ctx[key] = value; 2623 } 2624 const block = type && (info.current = type)(child_ctx); 2625 let needs_flush = false; 2626 if (info.block) { 2627 if (info.blocks) { 2628 info.blocks.forEach((block, i) => { 2629 if (i !== index && block) { 2630 group_outros(); 2631 transition_out(block, 1, 1, () => { 2632 if (info.blocks[i] === block) { 2633 info.blocks[i] = null; 2634 } 2635 }); 2636 check_outros(); 2637 } 2638 }); 2639 } else { 2640 info.block.d(1); 2641 } 2642 block.c(); 2643 transition_in(block, 1); 2644 block.m(info.mount(), info.anchor); 2645 needs_flush = true; 2646 } 2647 info.block = block; 2648 if (info.blocks) info.blocks[index] = block; 2649 if (needs_flush) { 2650 flush(); 2651 } 2652 } 2653 if (is_promise(promise)) { 2654 const current_component = get_current_component(); 2655 promise.then( 2656 (value) => { 2657 set_current_component(current_component); 2658 update(info.then, 1, info.value, value); 2659 set_current_component(null); 2660 }, 2661 (error) => { 2662 set_current_component(current_component); 2663 update(info.catch, 2, info.error, error); 2664 set_current_component(null); 2665 if (!info.hasCatch) { 2666 throw error; 2667 } 2668 } 2669 ); 2670 // if we previously had a then/catch block, destroy it 2671 if (info.current !== info.pending) { 2672 update(info.pending, 0); 2673 return true; 2674 } 2675 } else { 2676 if (info.current !== info.then) { 2677 update(info.then, 1, info.value, promise); 2678 return true; 2679 } 2680 info.resolved = /** @type {T} */ (promise); 2681 } 2682} 2683 2684/** @returns {void} */ 2685function update_await_block_branch(info, ctx, dirty) { 2686 const child_ctx = ctx.slice(); 2687 const { resolved } = info; 2688 if (info.current === info.then) { 2689 child_ctx[info.value] = resolved; 2690 } 2691 if (info.current === info.catch) { 2692 child_ctx[info.error] = resolved; 2693 } 2694 info.block.p(child_ctx, dirty); 2695} 2696 2697// general each functions: 2698 2699function ensure_array_like(array_like_or_iterator) { 2700 return array_like_or_iterator?.length !== undefined 2701 ? array_like_or_iterator 2702 : Array.from(array_like_or_iterator); 2703} 2704 2705// keyed each functions: 2706 2707/** @returns {void} */ 2708function destroy_block(block, lookup) { 2709 block.d(1); 2710 lookup.delete(block.key); 2711} 2712 2713/** @returns {void} */ 2714function outro_and_destroy_block(block, lookup) { 2715 transition_out(block, 1, 1, () => { 2716 lookup.delete(block.key); 2717 }); 2718} 2719 2720/** @returns {void} */ 2721function fix_and_destroy_block(block, lookup) { 2722 block.f(); 2723 destroy_block(block, lookup); 2724} 2725 2726/** @returns {void} */ 2727function fix_and_outro_and_destroy_block(block, lookup) { 2728 block.f(); 2729 outro_and_destroy_block(block, lookup); 2730} 2731 2732/** @returns {any[]} */ 2733function update_keyed_each( 2734 old_blocks, 2735 dirty, 2736 get_key, 2737 dynamic, 2738 ctx, 2739 list, 2740 lookup, 2741 node, 2742 destroy, 2743 create_each_block, 2744 next, 2745 get_context 2746) { 2747 let o = old_blocks.length; 2748 let n = list.length; 2749 let i = o; 2750 const old_indexes = {}; 2751 while (i--) old_indexes[old_blocks[i].key] = i; 2752 const new_blocks = []; 2753 const new_lookup = new Map(); 2754 const deltas = new Map(); 2755 const updates = []; 2756 i = n; 2757 while (i--) { 2758 const child_ctx = get_context(ctx, list, i); 2759 const key = get_key(child_ctx); 2760 let block = lookup.get(key); 2761 if (!block) { 2762 block = create_each_block(key, child_ctx); 2763 block.c(); 2764 } else if (dynamic) { 2765 // defer updates until all the DOM shuffling is done 2766 updates.push(() => block.p(child_ctx, dirty)); 2767 } 2768 new_lookup.set(key, (new_blocks[i] = block)); 2769 if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); 2770 } 2771 const will_move = new Set(); 2772 const did_move = new Set(); 2773 /** @returns {void} */ 2774 function insert(block) { 2775 transition_in(block, 1); 2776 block.m(node, next); 2777 lookup.set(block.key, block); 2778 next = block.first; 2779 n--; 2780 } 2781 while (o && n) { 2782 const new_block = new_blocks[n - 1]; 2783 const old_block = old_blocks[o - 1]; 2784 const new_key = new_block.key; 2785 const old_key = old_block.key; 2786 if (new_block === old_block) { 2787 // do nothing 2788 next = new_block.first; 2789 o--; 2790 n--; 2791 } else if (!new_lookup.has(old_key)) { 2792 // remove old block 2793 destroy(old_block, lookup); 2794 o--; 2795 } else if (!lookup.has(new_key) || will_move.has(new_key)) { 2796 insert(new_block); 2797 } else if (did_move.has(old_key)) { 2798 o--; 2799 } else if (deltas.get(new_key) > deltas.get(old_key)) { 2800 did_move.add(new_key); 2801 insert(new_block); 2802 } else { 2803 will_move.add(old_key); 2804 o--; 2805 } 2806 } 2807 while (o--) { 2808 const old_block = old_blocks[o]; 2809 if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); 2810 } 2811 while (n) insert(new_blocks[n - 1]); 2812 run_all(updates); 2813 return new_blocks; 2814} 2815 2816/** @returns {void} */ 2817function validate_each_keys(ctx, list, get_context, get_key) { 2818 const keys = new Map(); 2819 for (let i = 0; i < list.length; i++) { 2820 const key = get_key(get_context(ctx, list, i)); 2821 if (keys.has(key)) { 2822 let value = ''; 2823 try { 2824 value = `with value '${String(key)}' `; 2825 } catch (e) { 2826 // can't stringify 2827 } 2828 throw new Error( 2829 `Cannot have duplicate keys in a keyed each: Keys at index ${keys.get( 2830 key 2831 )} and ${i} ${value}are duplicates` 2832 ); 2833 } 2834 keys.set(key, i); 2835 } 2836} 2837 2838/** @returns {{}} */ 2839function get_spread_update(levels, updates) { 2840 const update = {}; 2841 const to_null_out = {}; 2842 const accounted_for = { $$scope: 1 }; 2843 let i = levels.length; 2844 while (i--) { 2845 const o = levels[i]; 2846 const n = updates[i]; 2847 if (n) { 2848 for (const key in o) { 2849 if (!(key in n)) to_null_out[key] = 1; 2850 } 2851 for (const key in n) { 2852 if (!accounted_for[key]) { 2853 update[key] = n[key]; 2854 accounted_for[key] = 1; 2855 } 2856 } 2857 levels[i] = n; 2858 } else { 2859 for (const key in o) { 2860 accounted_for[key] = 1; 2861 } 2862 } 2863 } 2864 for (const key in to_null_out) { 2865 if (!(key in update)) update[key] = undefined; 2866 } 2867 return update; 2868} 2869 2870function get_spread_object(spread_props) { 2871 return typeof spread_props === 'object' && spread_props !== null ? spread_props : {}; 2872} 2873 2874const _boolean_attributes = /** @type {const} */ ([ 2875 'allowfullscreen', 2876 'allowpaymentrequest', 2877 'async', 2878 'autofocus',
2879 'autoplay', 2880 'checked', 2881 'controls', 2882 'default', 2883 'defer', 2884 'disabled', 2885 'formnovalidate', 2886 'hidden', 2887 'inert', 2888 'ismap', 2889 'loop', 2890 'multiple', 2891 'muted', 2892 'nomodule', 2893 'novalidate', 2894 'open', 2895 'playsinline', 2896 'readonly', 2897 'required', 2898 'reversed', 2899 'selected' 2900]); 2901 2902/** 2903 * List of HTML boolean attributes (e.g. `<input disabled>`). 2904 * Source: https://html.spec.whatwg.org/multipage/indices.html 2905 * 2906 * @type {Set<string>} 2907 */ 2908const boolean_attributes = new Set([..._boolean_attributes]); 2909 2910/** @typedef {typeof _boolean_attributes[number]} BooleanAttributes */ 2911 2912/** regex of all html void element names */ 2913const void_element_names = 2914 /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/; 2915 2916/** 2917 * @param {string} name 2918 * @returns {boolean} 2919 */ 2920function is_void(name) { 2921 return void_element_names.test(name) || name.toLowerCase() === '!doctype'; 2922} 2923 2924const invalid_attribute_name_character = 2925 /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u; 2926// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 2927// https://infra.spec.whatwg.org/#noncharacter 2928 2929/** @returns {string} */ 2930function spread(args, attrs_to_add) { 2931 const attributes = Object.assign({}, ...args); 2932 if (attrs_to_add) { 2933 const classes_to_add = attrs_to_add.classes; 2934 const styles_to_add = attrs_to_add.styles; 2935 if (classes_to_add) { 2936 if (attributes.class == null) { 2937 attributes.class = classes_to_add; 2938 } else { 2939 attributes.class += ' ' + classes_to_add; 2940 } 2941 } 2942 if (styles_to_add) { 2943 if (attributes.style == null) { 2944 attributes.style = style_object_to_string(styles_to_add); 2945 } else { 2946 attributes.style = style_object_to_string( 2947 merge_ssr_styles(attributes.style, styles_to_add) 2948 ); 2949 } 2950 } 2951 } 2952 let str = ''; 2953 Object.keys(attributes).forEach((name) => { 2954 if (invalid_attribute_name_character.test(name)) return; 2955 const value = attributes[name]; 2956 if (value === true) str += ' ' + name; 2957 else if (boolean_attributes.has(name.toLowerCase())) { 2958 if (value) str += ' ' + name; 2959 } else if (value != null) { 2960 str += ` ${name}="${value}"`; 2961 } 2962 }); 2963 return str; 2964} 2965 2966/** @returns {{}} */ 2967function merge_ssr_styles(style_attribute, style_directive) { 2968 const style_object = {}; 2969 for (const individual_style of style_attribute.split(';')) { 2970 const colon_index = individual_style.indexOf(':'); 2971 const name = individual_style.slice(0, colon_index).trim(); 2972 const value = individual_style.slice(colon_index + 1).trim(); 2973 if (!name) continue; 2974 style_object[name] = value; 2975 } 2976 for (const name in style_directive) { 2977 const value = style_directive[name]; 2978 if (value) { 2979 style_object[name] = value; 2980 } else { 2981 delete style_object[name]; 2982 } 2983 } 2984 return style_object; 2985} 2986 2987const ATTR_REGEX = /[&"]/g; 2988const CONTENT_REGEX = /[&<]/g; 2989 2990/** 2991 * Note: this method is performance sensitive and has been optimized 2992 * https://github.com/sveltejs/svelte/pull/5701 2993 * @param {unknown} value 2994 * @returns {string} 2995 */ 2996function escape(value, is_attr = false) { 2997 const str = String(value); 2998 const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX; 2999 pattern.lastIndex = 0; 3000 let escaped = ''; 3001 let last = 0; 3002 while (pattern.test(str)) { 3003 const i = pattern.lastIndex - 1; 3004 const ch = str[i]; 3005 escaped += str.substring(last, i) + (ch === '&' ? '&' : ch === '"' ? '"' : '<'); 3006 last = i + 1; 3007 } 3008 return escaped + str.substring(last); 3009} 3010 3011function escape_attribute_value(value) { 3012 // keep booleans, null, and undefined for the sake of `spread` 3013 const should_escape = typeof value === 'string' || (value && typeof value === 'object'); 3014 return should_escape ? escape(value, true) : value; 3015} 3016 3017/** @returns {{}} */ 3018function escape_object(obj) { 3019 const result = {}; 3020 for (const key in obj) { 3021 result[key] = escape_attribute_value(obj[key]); 3022 } 3023 return result; 3024} 3025 3026/** @returns {string} */ 3027function each(items, fn) { 3028 items = ensure_array_like(items); 3029 let str = ''; 3030 for (let i = 0; i < items.length; i += 1) { 3031 str += fn(items[i], i); 3032 } 3033 return str; 3034} 3035 3036const missing_component = { 3037 $$render: () => '' 3038}; 3039 3040function validate_component(component, name) { 3041 if (!component || !component.$$render) { 3042 if (name === 'svelte:component') name += ' this={...}'; 3043 throw new Error( 3044 `<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than
3044imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.` 3045 ); 3046 } 3047 return component; 3048} 3049 3050/** @returns {string} */ 3051function debug(file, line, column, values) { 3052 console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console 3053 console.log(values); // eslint-disable-line no-console 3054 return ''; 3055} 3056 3057let on_destroy; 3058 3059/** @returns {{ render: (props?: {}, { $$slots, context }?: { $$slots?: {}; context?: Map<any, any>; }) => { html: any; css: { code: string; map: any; }; head: string; }; $$render: (result: any, props: any, bindings: any, slots: any, context: any) => any; }} */ 3060function create_ssr_component(fn) { 3061 function $$render(result, props, bindings, slots, context) { 3062 const parent_component = current_component; 3063 const $$ = { 3064 on_destroy, 3065 context: new Map(context || (parent_component ? parent_component.$$.context : [])), 3066 // these will be immediately discarded 3067 on_mount: [], 3068 before_update: [], 3069 after_update: [], 3070 callbacks: blank_object() 3071 }; 3072 set_current_component({ $$ }); 3073 const html = fn(result, props, bindings, slots); 3074 set_current_component(parent_component); 3075 return html; 3076 } 3077 return { 3078 render: (props = {}, { $$slots = {}, context = new Map() } = {}) => { 3079 on_destroy = []; 3080 const result = { title: '', head: '', css: new Set() }; 3081 const html = $$render(result, props, {}, $$slots, context); 3082 run_all(on_destroy); 3083 return { 3084 html, 3085 css: { 3086 code: Array.from(result.css) 3087 .map((css) => css.code) 3088 .join('\n'), 3089 map: null // TODO 3090 }, 3091 head: result.title + result.head 3092 }; 3093 }, 3094 $$render 3095 }; 3096} 3097 3098/** @returns {string} */ 3099function add_attribute(name, value, boolean) { 3100 if (value == null || (boolean && !value)) return ''; 3101 const assignment = boolean && value === true ? '' : `="${escape(value, true)}"`; 3102 return ` ${name}${assignment}`; 3103} 3104 3105/** @returns {string} */ 3106function add_classes(classes) { 3107 return classes ? ` class="${classes}"` : ''; 3108} 3109 3110/** @returns {string} */ 3111function style_object_to_string(style_object) { 3112 return Object.keys(style_object) 3113 .filter((key) => style_object[key]) 3114 .map((key) => `${key}: ${escape_attribute_value(style_object[key])};`) 3115 .join(' '); 3116} 3117 3118/** @returns {string} */ 3119function add_styles(style_object) { 3120 const styles = style_object_to_string(style_object); 3121 return styles ? ` style="${styles}"` : ''; 3122} 3123 3124/** @returns {void} */ 3125function bind(component, name, callback) { 3126 const index = component.$$.props[name]; 3127 if (index !== undefined) { 3128 component.$$.bound[index] = callback; 3129 callback(component.$$.ctx[index]); 3130 } 3131} 3132 3133/** @returns {void} */ 3134function create_component(block) { 3135 block && block.c(); 3136} 3137 3138/** @returns {void} */ 3139function claim_component(block, parent_nodes) { 3140 block && block.l(parent_nodes); 3141} 3142 3143/** @returns {void} */ 3144function mount_component(component, target, anchor) { 3145 const { fragment, after_update } = component.$$; 3146 fragment && fragment.m(target, anchor); 3147 // onMount happens before the initial afterUpdate 3148 add_render_callback(() => { 3149 const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); 3150 // if the component was destroyed immediately 3151 // it will update the `$$.on_destroy` reference to `null`. 3152 // the destructured on_destroy may still reference to the old array 3153 if (component.$$.on_destroy) { 3154 component.$$.on_destroy.push(...new_on_destroy); 3155 } else { 3156 // Edge case - component was destroyed immediately, 3157 // most likely as a result of a binding initialising 3158 run_all(new_on_destroy); 3159 } 3160 component.$$.on_mount = []; 3161 }); 3162 after_update.forEach(add_render_callback); 3163} 3164 3165/** @returns {void} */ 3166function destroy_component(component, detaching) { 3167 const $$ = component.$$; 3168 if ($$.fragment !== null) { 3169 flush_render_callbacks($$.after_update); 3170 run_all($$.on_destroy); 3171 $$.fragment && $$.fragment.d(detaching); 3172 // TODO null out other refs, including component.$$ (but need to 3173 // preserve final state?) 3174 $$.on_destroy = $$.fragment = null; 3175 $$.ctx = []; 3176 } 3177} 3178 3179/** @returns {void} */ 3180function make_dirty(component, i) { 3181 if (component.$$.dirty[0] === -1) { 3182 dirty_components.push(component); 3183 schedule_update(); 3184 component.$$.dirty.fill(0); 3185 } 3186 component.$$.dirty[(i / 31) | 0] |= 1 << i % 31; 3187} 3188 3189// TODO: Document the other params 3190/** 3191 * @param {SvelteComponent} component 3192 * @param {import('./public.js').ComponentConstructorOptions} options 3193 * 3194 * @param {import('./utils.js')['not_equal']} not_equal Used to compare props and state values. 3195 * @param {(target: Element | ShadowRoot) => void} [append_styles] Function that appends styles to the DOM when the component is first initialised. 3196 * This will be the `add_css` function from the compiled component. 3197 * 3198 * @returns {void} 3199 */ 3200function init( 3201 component, 3202 options, 3203 instance, 3204 create_fragment, 3205 not_equal, 3206 props, 3207 append_styles = null, 3208 dirty = [-1] 3209) { 3210 const parent_component = current_component; 3211 set_current_component(component); 3212 /** @type {import('./private.js').T$$} */ 3213 const $$ = (component.$$ = { 3214 fragment: null, 3215 ctx: [], 3216 // state 3217 props,
3218 update: noop, 3219 not_equal, 3220 bound: blank_object(), 3221 // lifecycle 3222 on_mount: [], 3223 on_destroy: [], 3224 on_disconnect: [], 3225 before_update: [], 3226 after_update: [], 3227 context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), 3228 // everything else 3229 callbacks: blank_object(), 3230 dirty, 3231 skip_bound: false, 3232 root: options.target || parent_component.$$.root 3233 }); 3234 append_styles && append_styles($$.root); 3235 let ready = false; 3236 $$.ctx = instance 3237 ? instance(component, options.props || {}, (i, ret, ...rest) => { 3238 const value = rest.length ? rest[0] : ret; 3239 if ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) { 3240 if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); 3241 if (ready) make_dirty(component, i); 3242 } 3243 return ret; 3244 }) 3245 : []; 3246 $$.update(); 3247 ready = true; 3248 run_all($$.before_update); 3249 // `false` as a special case of no DOM component 3250 $$.fragment = create_fragment ? create_fragment($$.ctx) : false; 3251 if (options.target) { 3252 if (options.hydrate) { 3253 start_hydrating(); 3254 // TODO: what is the correct type here? 3255 // @ts-expect-error 3256 const nodes = children(options.target); 3257 $$.fragment && $$.fragment.l(nodes); 3258 nodes.forEach(detach); 3259 } else { 3260 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 3261 $$.fragment && $$.fragment.c(); 3262 } 3263 if (options.intro) transition_in(component.$$.fragment); 3264 mount_component(component, options.target, options.anchor); 3265 end_hydrating(); 3266 flush(); 3267 } 3268 set_current_component(parent_component); 3269} 3270 3271let SvelteElement; 3272 3273if (typeof HTMLElement === 'function') { 3274 SvelteElement = class extends HTMLElement { 3275 /** The Svelte component constructor */ 3276 $$ctor; 3277 /** Slots */ 3278 $$s; 3279 /** The Svelte component instance */ 3280 $$c; 3281 /** Whether or not the custom element is connected */ 3282 $$cn = false; 3283 /** Component props data */ 3284 $$d = {}; 3285 /** `true` if currently in the process of reflecting component props back to attributes */ 3286 $$r = false; 3287 /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */ 3288 $$p_d = {}; 3289 /** @type {Record<string, Function[]>} Event listeners */ 3290 $$l = {}; 3291 /** @type {Map<Function, Function>} Event listener unsubscribe functions */ 3292 $$l_u = new Map(); 3293 3294 constructor($$componentCtor, $$slots, use_shadow_dom) { 3295 super(); 3296 this.$$ctor = $$componentCtor; 3297 this.$$s = $$slots; 3298 if (use_shadow_dom) { 3299 this.attachShadow({ mode: 'open' }); 3300 } 3301 } 3302 3303 addEventListener(type, listener, options) { 3304 // We can't determine upfront if the event is a custom event or not, so we have to 3305 // listen to both. If someone uses a custom event with the same name as a regular 3306 // browser event, this fires twice - we can't avoid that. 3307 this.$$l[type] = this.$$l[type] || []; 3308 this.$$l[type].push(listener); 3309 if (this.$$c) { 3310 const unsub = this.$$c.$on(type, listener); 3311 this.$$l_u.set(listener, unsub); 3312 } 3313 super.addEventListener(type, listener, options); 3314 } 3315 3316 removeEventListener(type, listener, options) { 3317 super.removeEventListener(type, listener, options); 3318 if (this.$$c) { 3319 const unsub = this.$$l_u.get(listener); 3320 if (unsub) { 3321 unsub(); 3322 this.$$l_u.delete(listener); 3323 } 3324 } 3325 } 3326 3327 async connectedCallback() { 3328 this.$$cn = true; 3329 if (!this.$$c) { 3330 // We wait one tick to let possible child slot elements be created/mounted 3331 await Promise.resolve(); 3332 if (!this.$$cn) { 3333 return; 3334 } 3335 function create_slot(name) { 3336 return () => { 3337 let node; 3338 const obj = { 3339 c: function create() { 3340 node = element('slot'); 3341 if (name !== 'default') { 3342 attr(node, 'name', name); 3343 } 3344 }, 3345 /** 3346 * @param {HTMLElement} target 3347 * @param {HTMLElement} [anchor] 3348 */ 3349 m: function mount(target, anchor) { 3350 insert(target, node, anchor); 3351 }, 3352 d: function destroy(detaching) { 3353 if (detaching) { 3354 detach(node); 3355 } 3356 } 3357 }; 3358 return obj; 3359 }; 3360 } 3361 const $$slots = {}; 3362 const existing_slots = get_custom_elements_slots(this); 3363 for (const name of this.$$s) { 3364 if (name in existing_slots) { 3365 $$slots[name] = [create_slot(name)]; 3366 } 3367 } 3368 for (const attribute of this.attributes) { 3369 // this.$$data takes precedence over this.attributes 3370 const name = this.$$g_p(attribute.name); 3371 if (!(name in this.$$d)) { 3372 this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp'); 3373 } 3374 } 3375 this.$$c = new this.$$ctor({ 3376 target: this.shadowRoot || this, 3377 props: { 3378 ...this.$$d, 3379 $$slots, 3380 $$scope: { 3381 ctx: [] 3382 } 3383 } 3384 }); 3385 3386 // Reflect component props as attributes 3387 const reflect_attributes = () => { 3388 this.$$r = true; 3389 for (const key in this.$$p_d) { 3390 this.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]]; 3391 if (this.$$p_d[key].reflect) { 3392 const attribute_value = get_custom_element_value( 3393 key, 3394 this.$$d[key], 3395 this.$$p_d, 3396 'toAttribute' 3397 ); 3398 if (attribute_value == null) { 3399 this.removeAttribute(this.$$p_d[key].attribute || key); 3400 } else { 3401 this.setAttribute(this.$$p_d[key].attribute || key, attribute_value); 3402 } 3403 } 3404 } 3405 this.$$r = false;
3406 }; 3407 this.$$c.$$.after_update.push(reflect_attributes); 3408 reflect_attributes(); // once initially because after_update is added too late for first render 3409 3410 for (const type in this.$$l) { 3411 for (const listener of this.$$l[type]) { 3412 const unsub = this.$$c.$on(type, listener); 3413 this.$$l_u.set(listener, unsub); 3414 } 3415 } 3416 this.$$l = {}; 3417 } 3418 } 3419 3420 // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte 3421 // and setting attributes through setAttribute etc, this is helpful 3422 attributeChangedCallback(attr, _oldValue, newValue) { 3423 if (this.$$r) return; 3424 attr = this.$$g_p(attr); 3425 this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp'); 3426 this.$$c?.$set({ [attr]: this.$$d[attr] }); 3427 } 3428 3429 disconnectedCallback() { 3430 this.$$cn = false; 3431 // In a microtask, because this could be a move within the DOM 3432 Promise.resolve().then(() => { 3433 if (!this.$$cn) { 3434 this.$$c.$destroy(); 3435 this.$$c = undefined; 3436 } 3437 }); 3438 } 3439 3440 $$g_p(attribute_name) { 3441 return ( 3442 Object.keys(this.$$p_d).find( 3443 (key) => 3444 this.$$p_d[key].attribute === attribute_name || 3445 (!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name) 3446 ) || attribute_name 3447 ); 3448 } 3449 }; 3450} 3451 3452/** 3453 * @param {string} prop 3454 * @param {any} value 3455 * @param {Record<string, CustomElementPropDefinition>} props_definition 3456 * @param {'toAttribute' | 'toProp'} [transform] 3457 */ 3458function get_custom_element_value(prop, value, props_definition, transform) { 3459 const type = props_definition[prop]?.type; 3460 value = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value; 3461 if (!transform || !props_definition[prop]) { 3462 return value; 3463 } else if (transform === 'toAttribute') { 3464 switch (type) { 3465 case 'Object': 3466 case 'Array': 3467 return value == null ? null : JSON.stringify(value); 3468 case 'Boolean': 3469 return value ? '' : null; 3470 case 'Number': 3471 return value == null ? null : value; 3472 default: 3473 return value; 3474 } 3475 } else { 3476 switch (type) { 3477 case 'Object': 3478 case 'Array': 3479 return value && JSON.parse(value); 3480 case 'Boolean': 3481 return value; // conversion already handled above 3482 case 'Number': 3483 return value != null ? +value : value; 3484 default: 3485 return value; 3486 } 3487 } 3488} 3489 3490/** 3491 * @internal 3492 * 3493 * Turn a Svelte component into a custom element. 3494 * @param {import('./public.js').ComponentType} Component A Svelte component constructor 3495 * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe 3496 * @param {string[]} slots The slots to create 3497 * @param {string[]} accessors Other accessors besides the ones for props the component has 3498 * @param {boolean} use_shadow_dom Whether to use shadow DOM 3499 * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend] 3500 */ 3501function create_custom_element( 3502 Component, 3503 props_definition, 3504 slots, 3505 accessors, 3506 use_shadow_dom, 3507 extend 3508) { 3509 let Class = class extends SvelteElement { 3510 constructor() { 3511 super(Component, slots, use_shadow_dom); 3512 this.$$p_d = props_definition; 3513 } 3514 static get observedAttributes() { 3515 return Object.keys(props_definition).map((key) => 3516 (props_definition[key].attribute || key).toLowerCase() 3517 ); 3518 } 3519 }; 3520 Object.keys(props_definition).forEach((prop) => { 3521 Object.defineProperty(Class.prototype, prop, { 3522 get() { 3523 return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop]; 3524 }, 3525 set(value) { 3526 value = get_custom_element_value(prop, value, props_definition); 3527 this.$$d[prop] = value; 3528 this.$$c?.$set({ [prop]: value }); 3529 } 3530 }); 3531 }); 3532 accessors.forEach((accessor) => { 3533 Object.defineProperty(Class.prototype, accessor, { 3534 get() { 3535 return this.$$c?.[accessor]; 3536 } 3537 }); 3538 }); 3539 if (extend) { 3540 // @ts-expect-error - assigning here is fine 3541 Class = extend(Class); 3542 } 3543 Component.element = /** @type {any} */ (Class); 3544 return Class; 3545} 3546 3547/** 3548 * Base class for Svelte components. Used when dev=false. 3549 * 3550 * @template {Record<string, any>} [Props=any] 3551 * @template {Record<string, any>} [Events=any] 3552 */ 3553class SvelteComponent { 3554 /** 3555 * ### PRIVATE API 3556 * 3557 * Do not use, may change at any time 3558 * 3559 * @type {any} 3560 */ 3561 $$ = undefined; 3562 /** 3563 * ### PRIVATE API 3564 * 3565 * Do not use, may change at any time 3566 * 3567 * @type {any} 3568 */ 3569 $$set = undefined; 3570 3571 /** @returns {void} */ 3572 $destroy() { 3573 destroy_component(this, 1); 3574 this.$destroy = noop; 3575 } 3576 3577 /**
3578 * @template {Extract<keyof Events, string>} K 3579 * @param {K} type 3580 * @param {((e: Events[K]) => void) | null | undefined} callback 3581 * @returns {() => void} 3582 */ 3583 $on(type, callback) { 3584 if (!is_function(callback)) { 3585 return noop; 3586 } 3587 const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); 3588 callbacks.push(callback); 3589 return () => { 3590 const index = callbacks.indexOf(callback); 3591 if (index !== -1) callbacks.splice(index, 1); 3592 }; 3593 } 3594 3595 /** 3596 * @param {Partial<Props>} props 3597 * @returns {void} 3598 */ 3599 $set(props) { 3600 if (this.$$set && !is_empty(props)) { 3601 this.$$.skip_bound = true; 3602 this.$$set(props); 3603 this.$$.skip_bound = false; 3604 } 3605 } 3606} 3607 3608/** 3609 * @typedef {Object} CustomElementPropDefinition 3610 * @property {string} [attribute] 3611 * @property {boolean} [reflect] 3612 * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type] 3613 */ 3614 3615// generated during release, do not modify 3616 3617/** 3618 * The current version, as set in package.json. 3619 * 3620 * https://svelte.dev/docs/svelte-compiler#svelte-version 3621 * @type {string} 3622 */ 3623const VERSION = '4.2.2'; 3624 3625/** 3626 * @template T 3627 * @param {string} type 3628 * @param {T} [detail] 3629 * @returns {void} 3630 */ 3631function dispatch_dev(type, detail) { 3632 document.dispatchEvent(custom_event(type, { version: VERSION, ...detail }, { bubbles: true })); 3633} 3634 3635/** 3636 * @param {Node} target 3637 * @param {Node} node 3638 * @returns {void} 3639 */ 3640function append_dev(target, node) { 3641 dispatch_dev('SvelteDOMInsert', { target, node }); 3642 append(target, node); 3643} 3644 3645/** 3646 * @param {Node} target 3647 * @param {Node} node 3648 * @returns {void} 3649 */ 3650function append_hydration_dev(target, node) { 3651 dispatch_dev('SvelteDOMInsert', { target, node }); 3652 append_hydration(target, node); 3653} 3654 3655/** 3656 * @param {Node} target 3657 * @param {Node} node 3658 * @param {Node} [anchor] 3659 * @returns {void} 3660 */ 3661function insert_dev(target, node, anchor) { 3662 dispatch_dev('SvelteDOMInsert', { target, node, anchor }); 3663 insert(target, node, anchor); 3664} 3665 3666/** @param {Node} target 3667 * @param {Node} node 3668 * @param {Node} [anchor] 3669 * @returns {void} 3670 */ 3671function insert_hydration_dev(target, node, anchor) { 3672 dispatch_dev('SvelteDOMInsert', { target, node, anchor }); 3673 insert_hydration(target, node, anchor); 3674} 3675 3676/** 3677 * @param {Node} node 3678 * @returns {void} 3679 */ 3680function detach_dev(node) { 3681 dispatch_dev('SvelteDOMRemove', { node }); 3682 detach(node); 3683} 3684 3685/** 3686 * @param {Node} before 3687 * @param {Node} after 3688 * @returns {void} 3689 */ 3690function detach_between_dev(before, after) { 3691 while (before.nextSibling && before.nextSibling !== after) { 3692 detach_dev(before.nextSibling); 3693 } 3694} 3695 3696/** 3697 * @param {Node} after 3698 * @returns {void} 3699 */ 3700function detach_before_dev(after) { 3701 while (after.previousSibling) { 3702 detach_dev(after.previousSibling); 3703 } 3704} 3705 3706/** 3707 * @param {Node} before 3708 * @returns {void} 3709 */ 3710function detach_after_dev(before) { 3711 while (before.nextSibling) { 3712 detach_dev(before.nextSibling); 3713 } 3714} 3715 3716/** 3717 * @param {Node} node 3718 * @param {string} event 3719 * @param {EventListenerOrEventListenerObject} handler 3720 * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options] 3721 * @param {boolean} [has_prevent_default] 3722 * @param {boolean} [has_stop_propagation] 3723 * @param {boolean} [has_stop_immediate_propagation] 3724 * @returns {() => void} 3725 */ 3726function listen_dev( 3727 node, 3728 event, 3729 handler, 3730 options, 3731 has_prevent_default, 3732 has_stop_propagation, 3733 has_stop_immediate_propagation 3734) { 3735 const modifiers = 3736 options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : []; 3737 if (has_prevent_default) modifiers.push('preventDefault'); 3738 if (has_stop_propagation) modifiers.push('stopPropagation'); 3739 if (has_stop_immediate_propagation) modifiers.push('stopImmediatePropagation'); 3740 dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); 3741 const dispose = listen(node, event, handler, options); 3742 return () => { 3743 dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); 3744 dispose(); 3745 }; 3746} 3747 3748/** 3749 * @param {Element} node 3750 * @param {string} attribute 3751 * @param {string} [value] 3752 * @returns {void} 3753 */ 3754function attr_dev(node, attribute, value) { 3755 attr(node, attribute, value); 3756 if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); 3757 else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); 3758} 3759 3760/** 3761 * @param {Element} node 3762 * @param {string} property 3763 * @param {any} [value] 3764 * @returns {void} 3765 */ 3766function prop_dev(node, property, value) { 3767 node[property] = value; 3768 dispatch_dev('SvelteDOMSetProperty', { node, property, value }); 3769} 3770 3771/** 3772 * @param {HTMLElement} node 3773 * @param {string} property 3774 * @param {any} [value] 3775 * @returns {void} 3776 */ 3777function dataset_dev(node, property, value) { 3778 node.dataset[property] = value; 3779 dispatch_dev('SvelteDOMSetDataset', { node, property, value }); 3780} 3781 3782/** 3783 * @param {Text} text 3784 * @param {unknown} data 3785 * @returns {void} 3786 */ 3787function set_data_dev(text, data) { 3788 data = '' + data; 3789 if (text.data === data) return; 3790 dispatch_dev('SvelteDOMSetData', { node: text, data }); 3791 text.data = /** @type {string} */ (data); 3792} 3793 3794/** 3795 * @param {Text} text 3796 * @param {unknown} data 3797 * @returns {void} 3798 */ 3799function set_data_contenteditable_dev(text, data) { 3800 data = '' + data; 3801 if (text.wholeText === data) return; 3802 dispatch_dev('SvelteDOMSetData', { node: text, data }); 3803 text.data = /** @type {string} */ (data); 3804} 3805 3806/** 3807 * @param {Text} text 3808 * @param {unknown} data 3809 * @param {string} attr_value 3810 * @returns {void} 3811 */ 3812function set_data_maybe_contenteditable_dev(text, data, attr_value) { 3813 if (~contenteditable_truthy_values.indexOf(attr_value)) { 3814 set_data_contenteditable_dev(text, data); 3815 } else { 3816 set_data_dev(text, data); 3817 } 3818} 3819 3820function ensure_array_like_dev(arg) { 3821 if ( 3822 typeof arg !== 'string' && 3823 !(arg && typeof arg === 'object' && 'length' in arg) && 3824 !(typeof Symbol === 'function' && arg && Symbol.iterator in arg) 3825 ) { 3826 throw new Error('{#each}
3826 only works with iterable values.'); 3827 } 3828 return ensure_array_like(arg); 3829} 3830 3831/** 3832 * @returns {void} */ 3833function validate_slots(name, slot, keys) { 3834 for (const slot_key of Object.keys(slot)) { 3835 if (!~keys.indexOf(slot_key)) { 3836 console.warn(`<${name}> received an unexpected slot "${slot_key}".`); 3837 } 3838 } 3839} 3840 3841/** 3842 * @param {unknown} tag 3843 * @returns {void} 3844 */ 3845function validate_dynamic_element(tag) { 3846 const is_string = typeof tag === 'string'; 3847 if (tag && !is_string) { 3848 throw new Error('<svelte:element> expects "this" attribute to be a string.'); 3849 } 3850} 3851 3852/** 3853 * @param {undefined | string} tag 3854 * @returns {void} 3855 */ 3856function validate_void_dynamic_element(tag) { 3857 if (tag && is_void(tag)) { 3858 console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`); 3859 } 3860} 3861 3862function construct_svelte_component_dev(component, props) { 3863 const error_message = 'this={...} of <svelte:component> should specify a Svelte component.'; 3864 try { 3865 const instance = new component(props); 3866 if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) { 3867 throw new Error(error_message); 3868 } 3869 return instance; 3870 } catch (err) { 3871 const { message } = err; 3872 if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) { 3873 throw new Error(error_message); 3874 } else { 3875 throw err; 3876 } 3877 } 3878} 3879 3880/** 3881 * Base class for Svelte components with some minor dev-enhancements. Used when dev=true. 3882 * 3883 * Can be used to create strongly typed Svelte components. 3884 * 3885 * #### Example: 3886 * 3887 * You have component library on npm called `component-library`, from which 3888 * you export a component called `MyComponent`. For Svelte+TypeScript users, 3889 * you want to provide typings. Therefore you create a `index.d.ts`: 3890 * ```ts 3891 * import { SvelteComponent } from "svelte"; 3892 * export class MyComponent extends SvelteComponent<{foo: string}> {} 3893 * ``` 3894 * Typing this makes it possible for IDEs like VS Code with the Svelte extension 3895 * to provide intellisense and to use the component like this in a Svelte file 3896 * with TypeScript: 3897 * ```svelte 3898 * <script lang="ts"> 3899 * import { MyComponent } from "component-library"; 3900 * </script> 3901 * <MyComponent foo={'bar'} /> 3902 * ``` 3903 * @template {Record<string, any>} [Props=any] 3904 * @template {Record<string, any>} [Events=any] 3905 * @template {Record<string, any>} [Slots=any] 3906 * @extends {SvelteComponent<Props, Events>} 3907 */ 3908class SvelteComponentDev extends SvelteComponent { 3909 /** 3910 * For type checking capabilities only. 3911 * Does not exist at runtime. 3912 * ### DO NOT USE! 3913 * 3914 * @type {Props} 3915 */ 3916 $$prop_def; 3917 /** 3918 * For type checking capabilities only. 3919 * Does not exist at runtime. 3920 * ### DO NOT USE! 3921 * 3922 * @type {Events} 3923 */ 3924 $$events_def; 3925 /** 3926 * For type checking capabilities only. 3927 * Does not exist at runtime. 3928 * ### DO NOT USE! 3929 * 3930 * @type {Slots} 3931 */ 3932 $$slot_def; 3933 3934 /** @param {import('./public.js').ComponentConstructorOptions<Props>} options */ 3935 constructor(options) { 3936 if (!options || (!options.target && !options.$$inline)) { 3937 throw new Error("'target' is a required option"); 3938 } 3939 super(); 3940 } 3941 3942 /** @returns {void} */ 3943 $destroy() { 3944 super.$destroy(); 3945 this.$destroy = () => { 3946 console.warn('Component was already destroyed'); // eslint-disable-line no-console 3947 }; 3948 } 3949 3950 /** @returns {void} */ 3951 $capture_state() {} 3952 3953 /** @returns {void} */ 3954 $inject_state() {} 3955} 3956/** 3957 * @template {Record<string, any>} [Props=any] 3958 * @template {Record<string, any>} [Events=any] 3959 * @template {Record<string, any>} [Slots=any] 3960 * @deprecated Use `SvelteComponent` instead. See PR for more information: https://github.com/sveltejs/svelte/pull/8512 3961 * @extends {SvelteComponentDev<Props, Events, Slots>} 3962 */ 3963class SvelteComponentTyped extends SvelteComponentDev {} 3964 3965/** @returns {() => void} */ 3966function loop_guard(timeout) { 3967 const start = Date.now(); 3968 return () => { 3969 if (Date.now() - start > timeout) { 3970 throw new Error('Infinite loop detected'); 3971 } 3972 }; 3973} 3974 3975export { HtmlTag, HtmlTagHydration, ResizeObserverSingleton, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_iframe_resize_listener, add_location, add_render_callback, add_styles, add_transform, afterUpdate, append, append_dev, append_empty_stylesheet, append_hydration, append_hydration_dev, append_styles, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_comment, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, comment, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, construct_svelte_component_dev, contenteditable_truthy_values, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_custom_element, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, end_hydrating, ensure_array_like, ensure_array_like_dev, escape, escape_attribute_value, escape_object, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, flush_render_callbacks, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_current_component, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_spread_object, get_spread_update, get_store_value, get_svelte_dataset, globals, group_outros, handle_promise, hasContext, has_prop, head_selector, identity, init, init_binding_group, init_binding_group_dynamic, insert, insert_dev, insert_hydration, insert_hydration_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, is_void, listen, listen_dev, loop, loop_guard, merge_ssr_styles, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, resize_observer_border_box, resize_observer_content_box, resize_observer_device_pixel_content_box, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_custom_element_data_map, set_data, set_data_contenteditable, set_data_contenteditable_dev, set_data_dev, set_data_maybe_contenteditable, set_data_maybe_contenteditable_dev, set_dynamic_element_data, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, split_css_unit, spread, src_url_equal, srcset_url_equal, start_hydrating, stop_immediate_propagation, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, trusted, update_await_block_branch, update_keyed_each, update_slot, update_slot_base, validate_component, validate_dynamic_element, validate_each_keys, validate_slots, validate_store, validate_void_dynamic_element, xlink_attr };
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.