1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DTkwnBNG.js","./DoAznfuf.js","./CBXdQHRi.js","./CUmg6egw.js","./BKuo3gKP.js","./DfYX__j4.js","./B5tSuCsr.js","./TextContent.BUU2a75h.css","./DOmxYH01.js","./C6GPsR-8.js","./CEkLH7OR.js","./Df2PSNAy.js","./Bhs-h9c6.js","./BSJSoR_5.js","./espais.DmQqPKJC.css","./K1Q6EdSe.js","./entitat.oIsat2N_.css","./BX5ySEyc.js","./contacte.xMzCZkV4.css","./D2003eD7.js","./B0bk_Oly.js","./Bt12qBFB.js","./default.DQLQdbEM.css","./BOr1IfOc.js"])))=>i.map(i=>d[i]); 2var __defProp = Object.defineProperty; 3var __typeError = (msg) => { 4 throw TypeError(msg); 5}; 6var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 7var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 8var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); 9var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); 10var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); 11var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); 12var _e, _t, _r, _o, _s, _n, _a2, _a, _client, _client2, _client3, _client4, _client5, _httpRequest, _client6, _httpRequest2, _client7, _httpRequest3, _client8, _httpRequest4, _client9, _client10, _httpRequest5, _client11, _httpRequest6, _client12, _httpRequest7, _client13, _httpRequest8, _client14, _httpRequest9, _client15, _httpRequest10, _client16, _httpRequest11, _client17, _httpRequest12, _clientConfig, _httpRequest13, _clientConfig2, _httpRequest14; 13(function polyfill() { 14 const relList = document.createElement("link").relList; 15 if (relList && relList.supports && relList.supports("modulepreload")) { 16 return; 17 } 18 for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { 19 processPreload(link); 20 } 21 new MutationObserver((mutations) => { 22 for (const mutation of mutations) { 23 if (mutation.type !== "childList") { 24 continue; 25 } 26 for (const node of mutation.addedNodes) { 27 if (node.tagName === "LINK" && node.rel === "modulepreload") 28 processPreload(node); 29 } 30 } 31 }).observe(document, { childList: true, subtree: true }); 32 function getFetchOpts(link) { 33 const fetchOpts = {}; 34 if (link.integrity) fetchOpts.integrity = link.integrity; 35 if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; 36 if (link.crossOrigin === "use-credentials") 37 fetchOpts.credentials = "include"; 38 else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; 39 else fetchOpts.credentials = "same-origin"; 40 return fetchOpts; 41 } 42 function processPreload(link) { 43 if (link.ep) 44 return; 45 link.ep = true; 46 const fetchOpts = getFetchOpts(link); 47 fetch(link.href, fetchOpts); 48 } 49})(); 50/** 51* @vue/shared v3.5.14 52* (c) 2018-present Yuxi (Evan) You and Vue contributors 53* @license MIT
vendor: 4,250 bytes, lines 54-175
54**/ 55/*! #__NO_SIDE_EFFECTS__ */ 56// @__NO_SIDE_EFFECTS__ 57function makeMap(str) { 58 const map2 = /* @__PURE__ */ Object.create(null); 59 for (const key of str.split(",")) map2[key] = 1; 60 return (val) => val in map2; 61} 62const EMPTY_OBJ = {}; 63const EMPTY_ARR = []; 64const NOOP = () => { 65}; 66const NO = () => false; 67const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter 68(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); 69const isModelListener = (key) => key.startsWith("onUpdate:"); 70const extend = Object.assign; 71const remove = (arr, el) => { 72 const i2 = arr.indexOf(el); 73 if (i2 > -1) { 74 arr.splice(i2, 1); 75 } 76}; 77const hasOwnProperty$1 = Object.prototype.hasOwnProperty; 78const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); 79const isArray$3 = Array.isArray; 80const isMap = (val) => toTypeString(val) === "[object Map]"; 81const isSet = (val) => toTypeString(val) === "[object Set]"; 82const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 83const isFunction$1 = (val) => typeof val === "function"; 84const isString = (val) => typeof val === "string"; 85const isSymbol = (val) => typeof val === "symbol"; 86const isObject = (val) => val !== null && typeof val === "object"; 87const isPromise$1 = (val) => { 88 return (isObject(val) || isFunction$1(val)) && isFunction$1(val.then) && isFunction$1(val.catch); 89}; 90const objectToString = Object.prototype.toString; 91const toTypeString = (value) => objectToString.call(value); 92const toRawType = (value) => { 93 return toTypeString(value).slice(8, -1); 94}; 95const isPlainObject$3 = (val) => toTypeString(val) === "[object Object]"; 96const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 97const isReservedProp = /* @__PURE__ */ makeMap( 98 // the leading comma is intentional so empty string "" is also included 99 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 100); 101const cacheStringFunction = (fn) => { 102 const cache = /* @__PURE__ */ Object.create(null); 103 return (str) => { 104 const hit = cache[str]; 105 return hit || (cache[str] = fn(str)); 106 }; 107}; 108const camelizeRE = /-(\w)/g; 109const camelize = cacheStringFunction( 110 (str) => { 111 return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : ""); 112 } 113); 114const hyphenateRE = /\B([A-Z])/g; 115const hyphenate = cacheStringFunction( 116 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 117); 118const capitalize = cacheStringFunction((str) => { 119 return str.charAt(0).toUpperCase() + str.slice(1); 120}); 121const toHandlerKey = cacheStringFunction( 122 (str) => { 123 const s2 = str ? `on${capitalize(str)}` : ``; 124 return s2; 125 } 126); 127const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 128const invokeArrayFns = (fns, ...arg) => { 129 for (let i2 = 0; i2 < fns.length; i2++) { 130 fns[i2](...arg); 131 } 132}; 133const def = (obj, key, value, writable = false) => { 134 Object.defineProperty(obj, key, { 135 configurable: true, 136 enumerable: false, 137 writable, 138 value 139 }); 140}; 141const looseToNumber = (val) => { 142 const n2 = parseFloat(val); 143 return isNaN(n2) ? val : n2; 144}; 145const toNumber = (val) => { 146 const n2 = isString(val) ? Number(val) : NaN; 147 return isNaN(n2) ? val : n2; 148}; 149let _globalThis$2; 150const getGlobalThis = () => { 151 return _globalThis$2 || (_globalThis$2 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 152}; 153function normalizeStyle(value) { 154 if (isArray$3(value)) { 155 const res = {}; 156 for (let i2 = 0; i2 < value.length; i2++) { 157 const item = value[i2]; 158 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); 159 if (normalized) { 160 for (const key in normalized) { 161 res[key] = normalized[key]; 162 } 163 } 164 } 165 return res; 166 } else if (isString(value) || isObject(value)) { 167 return value; 168 } 169} 170const listDelimiterRE = /;(?![^(]*\))/g; 171const propertyDelimiterRE = /:([^]+)/; 172const styleCommentRE = /\/\*[^]*?\*\//g; 173function parseStringStyle(cssText) { 174 const ret = {}; 175 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEac
vendor: 14,388 bytes, lines 175-778
175h((item) => { 176 if (item) { 177 const tmp = item.split(propertyDelimiterRE); 178 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 179 } 180 }); 181 return ret; 182} 183function normalizeClass(value) { 184 let res = ""; 185 if (isString(value)) { 186 res = value; 187 } else if (isArray$3(value)) { 188 for (let i2 = 0; i2 < value.length; i2++) { 189 const normalized = normalizeClass(value[i2]); 190 if (normalized) { 191 res += normalized + " "; 192 } 193 } 194 } else if (isObject(value)) { 195 for (const name in value) { 196 if (value[name]) { 197 res += name + " "; 198 } 199 } 200 } 201 return res.trim(); 202} 203const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 204const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 205function includeBooleanAttr(value) { 206 return !!value || value === ""; 207} 208const isRef$1 = (val) => { 209 return !!(val && val["__v_isRef"] === true); 210}; 211const toDisplayString = (val) => { 212 return isString(val) ? val : val == null ? "" : isArray$3(val) || isObject(val) && (val.toString === objectToString || !isFunction$1(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); 213}; 214const replacer = (_key, val) => { 215 if (isRef$1(val)) { 216 return replacer(_key, val.value); 217 } else if (isMap(val)) { 218 return { 219 [`Map(${val.size})`]: [...val.entries()].reduce( 220 (entries, [key, val2], i2) => { 221 entries[stringifySymbol(key, i2) + " =>"] = val2; 222 return entries; 223 }, 224 {} 225 ) 226 }; 227 } else if (isSet(val)) { 228 return { 229 [`Set(${val.size})`]: [...val.values()].map((v2) => stringifySymbol(v2)) 230 }; 231 } else if (isSymbol(val)) { 232 return stringifySymbol(val); 233 } else if (isObject(val) && !isArray$3(val) && !isPlainObject$3(val)) { 234 return String(val); 235 } 236 return val; 237}; 238const stringifySymbol = (v2, i2 = "") => { 239 var _a3; 240 return ( 241 // Symbol.description in es2019+ so we need to cast here to pass 242 // the lib: es2016 check 243 isSymbol(v2) ? `Symbol(${(_a3 = v2.description) != null ? _a3 : i2})` : v2 244 ); 245}; 246/** 247* @vue/reactivity v3.5.14 248* (c) 2018-present Yuxi (Evan) You and Vue contributors 249* @license MIT 250**/ 251let activeEffectScope; 252class EffectScope { 253 constructor(detached = false) { 254 this.detached = detached; 255 this._active = true; 256 this._on = 0; 257 this.effects = []; 258 this.cleanups = []; 259 this._isPaused = false; 260 this.parent = activeEffectScope; 261 if (!detached && activeEffectScope) { 262 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 263 this 264 ) - 1; 265 } 266 } 267 get active() { 268 return this._active; 269 } 270 pause() { 271 if (this._active) { 272 this._isPaused = true; 273 let i2, l2; 274 if (this.scopes) { 275 for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { 276 this.scopes[i2].pause(); 277 } 278 } 279 for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { 280 this.effects[i2].pause(); 281 } 282 } 283 } 284 /** 285 * Resumes the effect scope, including all child scopes and effects. 286 */ 287 resume() { 288 if (this._active) { 289 if (this._isPaused) { 290 this._isPaused = false; 291 let i2, l2; 292 if (this.scopes) { 293 for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { 294 this.scopes[i2].resume(); 295 } 296 } 297 for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { 298 this.effects[i2].resume(); 299 } 300 } 301 } 302 } 303 run(fn) { 304 if (this._active) { 305 const currentEffectScope = activeEffectScope; 306 try { 307 activeEffectScope = this; 308 return fn(); 309 } finally { 310 activeEffectScope = currentEffectScope; 311 } 312 } 313 } 314 /** 315 * This should only be called on non-detached scopes 316 * @internal 317 */ 318 on() { 319 if (++this._on === 1) { 320 this.prevScope = activeEffectScope; 321 activeEffectScope = this; 322 } 323 } 324 /** 325 * This should only be called on non-detached scopes 326 * @internal 327 */ 328 off() { 329 if (this._on > 0 && --this._on === 0) { 330 activeEffectScope = this.prevScope; 331 this.prevScope = void 0; 332 } 333 } 334 stop(fromParent) { 335 if (this._active) { 336 this._active = false; 337 let i2, l2; 338 for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { 339 this.effects[i2].stop(); 340 } 341 this.effects.length = 0; 342 for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { 343 this.cleanups[i2](); 344 } 345 this.cleanups.length = 0; 346 if (this.scopes) { 347 for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { 348 this.scopes[i2].stop(true); 349 } 350 this.scopes.length = 0; 351 } 352 if (!this.detached && this.parent && !fromParent) { 353 const last2 = this.parent.scopes.pop(); 354 if (last2 && last2 !== this) { 355 this.parent.scopes[this.index] = last2; 356 last2.index = this.index; 357 } 358 } 359 this.parent = void 0; 360 } 361 } 362} 363function effectScope(detached) { 364 return new EffectScope(detached); 365} 366function getCurrentScope() { 367 return activeEffectScope; 368} 369function onScopeDispose(fn, failSilently = false) { 370 if (activeEffectScope) { 371 activeEffectScope.cleanups.push(fn); 372 } 373} 374let activeSub; 375const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); 376class ReactiveEffect { 377 constructor(fn) { 378 this.fn = fn; 379 this.deps = void 0; 380 this.depsTail = void 0; 381 this.flags = 1 | 4; 382 this.next = void 0; 383 this.cleanup = void 0; 384 this.scheduler = void 0; 385 if (activeEffectScope && activeEffectScope.active) { 386 activeEffectScope.effects.push(this); 387 } 388 } 389 pause() { 390 this.flags |= 64; 391 } 392 resume() { 393 if (this.flags & 64) { 394 this.flags &= -65; 395 if (pausedQueueEffects.has(this)) { 396 pausedQueueEffects.delete(this); 397 this.trigger(); 398 } 399 } 400 } 401 /** 402 * @internal 403 */ 404 notify() { 405 if (this.flags & 2 && !(this.flags & 32)) { 406 return; 407 } 408 if (!(this.flags & 8)) { 409 batch(this); 410 } 411 } 412 run() { 413 if (!(this.flags & 1)) { 414 return this.fn(); 415 } 416 this.flags |= 2; 417 cleanupEffect(this); 418 prepareDeps(this); 419 const prevEffect = activeSub; 420 const prevShouldTrack = shouldTrack; 421 activeSub = this; 422 shouldTrack = true; 423 try { 424 return this.fn(); 425 } finally { 426 cleanupDeps(this); 427 activeSub = prevEffect; 428 shouldTrack = prevShouldTrack; 429 this.flags &= -3; 430 } 431 } 432 stop() { 433 if (this.flags & 1) { 434 for (let link = this.deps; link; link = link.nextDep) { 435 removeSub(link); 436 } 437 this.deps = this.depsTail = void 0; 438 cleanupEffect(this); 439 this.onStop && this.onStop(); 440 this.flags &= -2; 441 } 442 } 443 trigger() { 444 if (this.flags & 64) { 445 pausedQueueEffects.add(this); 446 } else if (this.scheduler) { 447 this.scheduler(); 448 } else { 449 this.runIfDirty(); 450 } 451 } 452 /** 453 * @internal 454 */ 455 runIfDirty() { 456 if (isDirty(this)) { 457 this.run(); 458 } 459 } 460 get dirty() { 461 return isDirty(this); 462 } 463} 464let batchDepth = 0; 465let batchedSub; 466let batchedComputed; 467function batch(sub2, isComputed2 = false) { 468 sub2.flags |= 8; 469 if (isComputed2) { 470 sub2.next = batchedComputed; 471 batchedComputed = sub2; 472 return; 473 } 474 sub2.next = batchedSub; 475 batchedSub = sub2; 476} 477function startBatch() { 478 batchDepth++; 479} 480function endBatch() { 481 if (--batchDepth > 0) { 482 return; 483 } 484 if (batchedComputed) { 485 let e2 = batchedComputed; 486 batchedComputed = void 0; 487 while (e2) { 488 const next = e2.next; 489 e2.next = void 0; 490 e2.flags &= -9; 491 e2 = next; 492 } 493 } 494 let error; 495 while (batchedSub) { 496 let e2 = batchedSub; 497 batchedSub = void 0; 498 while (e2) { 499 const next = e2.next; 500 e2.next = void 0; 501 e2.flags &= -9; 502 if (e2.flags & 1) { 503 try { 504 ; 505 e2.trigger(); 506 } catch (err) { 507 if (!error) error = err; 508 } 509 } 510 e2 = next; 511 } 512 } 513 if (error) throw error; 514} 515function prepareDeps(sub2) { 516 for (let link = sub2.deps; link; link = link.nextDep) { 517 link.version = -1; 518 link.prevActiveLink = link.dep.activeLink; 519 link.dep.activeLink = link; 520 } 521} 522function cleanupDeps(sub2) { 523 let head; 524 let tail = sub2.depsTail; 525 let link = tail; 526 while (link) { 527 const prev = link.prevDep; 528 if (link.version === -1) { 529 if (link === tail) tail = prev; 530 removeSub(link); 531 removeDep(link); 532 } else { 533 head = link; 534 } 535 link.dep.activeLink = link.prevActiveLink; 536 link.prevActiveLink = void 0; 537 link = prev; 538 } 539 sub2.deps = head; 540 sub2.depsTail = tail; 541} 542function isDirty(sub2) { 543 for (let link = sub2.deps; link; link = link.nextDep) { 544 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) { 545 return true; 546 } 547 } 548 if (sub2._dirty) { 549 return true; 550 } 551 return false; 552} 553function refreshComputed(computed2) { 554 if (computed2.flags & 4 && !(computed2.flags & 16)) { 555 return; 556 } 557 computed2.flags &= -17; 558 if (computed2.globalVersion === globalVersion) { 559 return; 560 } 561 computed2.globalVersion = globalVersion; 562 if (!computed2.isSSR && computed2.flags & 128 && (!computed2.deps && !computed2._dirty || !isDirty(computed2))) { 563 return; 564 } 565 computed2.flags |= 2; 566 const dep = computed2.dep; 567 const prevSub = activeSub; 568 const prevShouldTrack = shouldTrack; 569 activeSub = computed2; 570 shouldTrack = true; 571 try { 572 prepareDeps(computed2); 573 const value = computed2.fn(computed2._value); 574 if (dep.version === 0 || hasChanged(value, computed2._value)) { 575 computed2.flags |= 128; 576 computed2._value = value; 577 dep.version++; 578 } 579 } catch (err) { 580 dep.version++; 581 throw err; 582 } finally { 583 activeSub = prevSub; 584 shouldTrack = prevShouldTrack; 585 cleanupDeps(computed2); 586 computed2.flags &= -3; 587 } 588} 589function removeSub(link, soft = false) { 590 const { dep, prevSub, nextSub } = link; 591 if (prevSub) { 592 prevSub.nextSub = nextSub; 593 link.prevSub = void 0; 594 } 595 if (nextSub) { 596 nextSub.prevSub = prevSub; 597 link.nextSub = void 0; 598 } 599 if (dep.subs === link) { 600 dep.subs = prevSub; 601 if (!prevSub && dep.computed) { 602 dep.computed.flags &= -5; 603 for (let l2 = dep.computed.deps; l2; l2 = l2.nextDep) { 604 removeSub(l2, true); 605 } 606 } 607 } 608 if (!soft && !--dep.sc && dep.map) { 609 dep.map.delete(dep.key); 610 } 611} 612function removeDep(link) { 613 const { prevDep, nextDep } = link; 614 if (prevDep) { 615 prevDep.nextDep = nextDep; 616 link.prevDep = void 0; 617 } 618 if (nextDep) { 619 nextDep.prevDep = prevDep; 620 link.nextDep = void 0; 621 } 622} 623let shouldTrack = true; 624const trackStack = []; 625function pauseTracking() { 626 trackStack.push(shouldTrack); 627 shouldTrack = false; 628} 629function resetTracking() { 630 const last2 = trackStack.pop(); 631 shouldTrack = last2 === void 0 ? true : last2; 632} 633function cleanupEffect(e2) { 634 const { cleanup } = e2; 635 e2.cleanup = void 0; 636 if (cleanup) { 637 const prevSub = activeSub; 638 activeSub = void 0; 639 try { 640 cleanup(); 641 } finally { 642 activeSub = prevSub; 643 } 644 } 645} 646let globalVersion = 0; 647class Link { 648 constructor(sub2, dep) { 649 this.sub = sub2; 650 this.dep = dep; 651 this.version = dep.version; 652 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; 653 } 654} 655class Dep { 656 constructor(computed2) { 657 this.computed = computed2; 658 this.version = 0; 659 this.activeLink = void 0; 660 this.subs = void 0; 661 this.map = void 0; 662 this.key = void 0; 663 this.sc = 0; 664 } 665 track(debugInfo) { 666 if (!activeSub || !shouldTrack || activeSub === this.computed) { 667 return; 668 } 669 let link = this.activeLink; 670 if (link === void 0 || link.sub !== activeSub) { 671 link = this.activeLink = new Link(activeSub, this); 672 if (!activeSub.deps) { 673 activeSub.deps = activeSub.depsTail = link; 674 } else { 675 link.prevDep = activeSub.depsTail; 676 activeSub.depsTail.nextDep = link; 677 activeSub.depsTail = link; 678 } 679 addSub(link); 680 } else if (link.version === -1) { 681 link.version = this.version; 682 if (link.nextDep) { 683 const next = link.nextDep; 684 next.prevDep = link.prevDep; 685 if (link.prevDep) { 686 link.prevDep.nextDep = next; 687 } 688 link.prevDep = activeSub.depsTail; 689 link.nextDep = void 0; 690 activeSub.depsTail.nextDep = link; 691 activeSub.depsTail = link; 692 if (activeSub.deps === link) { 693 activeSub.deps = next; 694 } 695 } 696 } 697 return link; 698 } 699 trigger(debugInfo) { 700 this.version++; 701 globalVersion++; 702 this.notify(debugInfo); 703 } 704 notify(debugInfo) { 705 startBatch(); 706 try { 707 if (false) ; 708 for (let link = this.subs; link; link = link.prevSub) { 709 if (link.sub.notify()) { 710 ; 711 link.sub.dep.notify(); 712 } 713 } 714 } finally { 715 endBatch(); 716 } 717 } 718} 719function addSub(link) { 720 link.dep.sc++; 721 if (link.sub.flags & 4) { 722 const computed2 = link.dep.computed; 723 if (computed2 && !link.dep.subs) { 724 computed2.flags |= 4 | 16; 725 for (let l2 = computed2.deps; l2; l2 = l2.nextDep) { 726 addSub(l2); 727 } 728 } 729 const currentTail = link.dep.subs; 730 if (currentTail !== link) { 731 link.prevSub = currentTail; 732 if (currentTail) currentTail.nextSub = link; 733 } 734 link.dep.subs = link; 735 } 736} 737const targetMap = /* @__PURE__ */ new WeakMap(); 738const ITERATE_KEY = Symbol( 739 "" 740); 741const MAP_KEY_ITERATE_KEY = Symbol( 742 "" 743); 744const ARRAY_ITERATE_KEY = Symbol( 745 "" 746); 747function track(target, type, key) { 748 if (shouldTrack && activeSub) { 749 let depsMap = targetMap.get(target); 750 if (!depsMap) { 751 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 752 } 753 let dep = depsMap.get(key); 754 if (!dep) { 755 depsMap.set(key, dep = new Dep()); 756 dep.map = depsMap; 757 dep.key = key; 758 } 759 { 760 dep.track(); 761 } 762 } 763} 764function trigger(target, type, key, newValue, oldValue, oldTarget) { 765 const depsMap = targetMap.get(target); 766 if (!depsMap) { 767 globalVersion++; 768 return; 769 } 770 const run = (dep) => { 771 if (dep) { 772 { 773 dep.trigger(); 774 } 775 } 776 }; 777 startBatch(); 778 if (type === "clear") {
vendor: 5,226 bytes, lines 779-959
779 depsMap.forEach(run); 780 } else { 781 const targetIsArray = isArray$3(target); 782 const isArrayIndex = targetIsArray && isIntegerKey(key); 783 if (targetIsArray && key === "length") { 784 const newLength = Number(newValue); 785 depsMap.forEach((dep, key2) => { 786 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) { 787 run(dep); 788 } 789 }); 790 } else { 791 if (key !== void 0 || depsMap.has(void 0)) { 792 run(depsMap.get(key)); 793 } 794 if (isArrayIndex) { 795 run(depsMap.get(ARRAY_ITERATE_KEY)); 796 } 797 switch (type) { 798 case "add": 799 if (!targetIsArray) { 800 run(depsMap.get(ITERATE_KEY)); 801 if (isMap(target)) { 802 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 803 } 804 } else if (isArrayIndex) { 805 run(depsMap.get("length")); 806 } 807 break; 808 case "delete": 809 if (!targetIsArray) { 810 run(depsMap.get(ITERATE_KEY)); 811 if (isMap(target)) { 812 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 813 } 814 } 815 break; 816 case "set": 817 if (isMap(target)) { 818 run(depsMap.get(ITERATE_KEY)); 819 } 820 break; 821 } 822 } 823 } 824 endBatch(); 825} 826function getDepFromReactive(object, key) { 827 const depMap = targetMap.get(object); 828 return depMap && depMap.get(key); 829} 830function reactiveReadArray(array) { 831 const raw = toRaw(array); 832 if (raw === array) return raw; 833 track(raw, "iterate", ARRAY_ITERATE_KEY); 834 return isShallow(array) ? raw : raw.map(toReactive); 835} 836function shallowReadArray(arr) { 837 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); 838 return arr; 839} 840const arrayInstrumentations = { 841 __proto__: null, 842 [Symbol.iterator]() { 843 return iterator$1(this, Symbol.iterator, toReactive); 844 }, 845 concat(...args) { 846 return reactiveReadArray(this).concat( 847 ...args.map((x2) => isArray$3(x2) ? reactiveReadArray(x2) : x2) 848 ); 849 }, 850 entries() { 851 return iterator$1(this, "entries", (value) => { 852 value[1] = toReactive(value[1]); 853 return value; 854 }); 855 }, 856 every(fn, thisArg) { 857 return apply(this, "every", fn, thisArg, void 0, arguments); 858 }, 859 filter(fn, thisArg) { 860 return apply(this, "filter", fn, thisArg, (v2) => v2.map(toReactive), arguments); 861 }, 862 find(fn, thisArg) { 863 return apply(this, "find", fn, thisArg, toReactive, arguments); 864 }, 865 findIndex(fn, thisArg) { 866 return apply(this, "findIndex", fn, thisArg, void 0, arguments); 867 }, 868 findLast(fn, thisArg) { 869 return apply(this, "findLast", fn, thisArg, toReactive, arguments); 870 }, 871 findLastIndex(fn, thisArg) { 872 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments); 873 }, 874 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement 875 forEach(fn, thisArg) { 876 return apply(this, "forEach", fn, thisArg, void 0, arguments); 877 }, 878 includes(...args) { 879 return searchProxy(this, "includes", args); 880 }, 881 indexOf(...args) { 882 return searchProxy(this, "indexOf", args); 883 }, 884 join(separator) { 885 return reactiveReadArray(this).join(separator); 886 }, 887 // keys() iterator only reads `length`, no optimisation required 888 lastIndexOf(...args) { 889 return searchProxy(this, "lastIndexOf", args); 890 }, 891 map(fn, thisArg) { 892 return apply(this, "map", fn, thisArg, void 0, arguments); 893 }, 894 pop() { 895 return noTracking(this, "pop"); 896 }, 897 push(...args) { 898 return noTracking(this, "push", args); 899 }, 900 reduce(fn, ...args) { 901 return reduce(this, "reduce", fn, args); 902 }, 903 reduceRight(fn, ...args) { 904 return reduce(this, "reduceRight", fn, args); 905 }, 906 shift() { 907 return noTracking(this, "shift"); 908 }, 909 // slice could use ARRAY_ITERATE but also seems to beg for range tracking 910 some(fn, thisArg) { 911 return apply(this, "some", fn, thisArg, void 0, arguments); 912 }, 913 splice(...args) { 914 return noTracking(this, "splice", args); 915 }, 916 toReversed() { 917 return reactiveReadArray(this).toReversed(); 918 }, 919 toSorted(comparer) { 920 return reactiveReadArray(this).toSorted(comparer); 921 }, 922 toSpliced(...args) { 923 return reactiveReadArray(this).toSpliced(...args); 924 }, 925 unshift(...args) { 926 return noTracking(this, "unshift", args); 927 }, 928 values() { 929 return iterator$1(this, "values", toReactive); 930 } 931}; 932function iterator$1(self2, method, wrapValue) { 933 const arr = shallowReadArray(self2); 934 const iter = arr[method](); 935 if (arr !== self2 && !isShallow(self2)) { 936 iter._next = iter.next; 937 iter.next = () => { 938 const result = iter._next(); 939 if (result.value) { 940 result.value = wrapValue(result.value); 941 } 942 return result; 943 }; 944 } 945 return iter; 946} 947const arrayProto = Array.prototype; 948function apply(self2, method, fn, thisArg, wrappedRetFn, args) { 949 const arr = shallowReadArray(self2); 950 const needsWrap = arr !== self2 && !isShallow(self2); 951 const methodFn = arr[method]; 952 if (methodFn !== arrayProto[method]) { 953 const result2 = methodFn.apply(self2, args); 954 return needsWrap ? toReactive(result2) : result2; 955 } 956 let wrappedFn = fn; 957 if (arr !== self2) { 958 if (needsWrap) { 959 wrappedFn = function(item, index) {
vendor: 4,183 bytes, lines 960-1087
960 return fn.call(this, toReactive(item), index, self2); 961 }; 962 } else if (fn.length > 2) { 963 wrappedFn = function(item, index) { 964 return fn.call(this, item, index, self2); 965 }; 966 } 967 } 968 const result = methodFn.call(arr, wrappedFn, thisArg); 969 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; 970} 971function reduce(self2, method, fn, args) { 972 const arr = shallowReadArray(self2); 973 let wrappedFn = fn; 974 if (arr !== self2) { 975 if (!isShallow(self2)) { 976 wrappedFn = function(acc, item, index) { 977 return fn.call(this, acc, toReactive(item), index, self2); 978 }; 979 } else if (fn.length > 3) { 980 wrappedFn = function(acc, item, index) { 981 return fn.call(this, acc, item, index, self2); 982 }; 983 } 984 } 985 return arr[method](wrappedFn, ...args); 986} 987function searchProxy(self2, method, args) { 988 const arr = toRaw(self2); 989 track(arr, "iterate", ARRAY_ITERATE_KEY); 990 const res = arr[method](...args); 991 if ((res === -1 || res === false) && isProxy(args[0])) { 992 args[0] = toRaw(args[0]); 993 return arr[method](...args); 994 } 995 return res; 996} 997function noTracking(self2, method, args = []) { 998 pauseTracking(); 999 startBatch(); 1000 const res = toRaw(self2)[method].apply(self2, args); 1001 endBatch(); 1002 resetTracking(); 1003 return res; 1004} 1005const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 1006const builtInSymbols = new Set( 1007 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 1008); 1009function hasOwnProperty(key) { 1010 if (!isSymbol(key)) key = String(key); 1011 const obj = toRaw(this); 1012 track(obj, "has", key); 1013 return obj.hasOwnProperty(key); 1014} 1015class BaseReactiveHandler { 1016 constructor(_isReadonly = false, _isShallow = false) { 1017 this._isReadonly = _isReadonly; 1018 this._isShallow = _isShallow; 1019 } 1020 get(target, key, receiver) { 1021 if (key === "__v_skip") return target["__v_skip"]; 1022 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 1023 if (key === "__v_isReactive") { 1024 return !isReadonly2; 1025 } else if (key === "__v_isReadonly") { 1026 return isReadonly2; 1027 } else if (key === "__v_isShallow") { 1028 return isShallow2; 1029 } else if (key === "__v_raw") { 1030 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 1031 // this means the receiver is a user proxy of the reactive proxy 1032 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 1033 return target; 1034 } 1035 return; 1036 } 1037 const targetIsArray = isArray$3(target); 1038 if (!isReadonly2) { 1039 let fn; 1040 if (targetIsArray && (fn = arrayInstrumentations[key])) { 1041 return fn; 1042 } 1043 if (key === "hasOwnProperty") { 1044 return hasOwnProperty; 1045 } 1046 } 1047 const res = Reflect.get( 1048 target, 1049 key, 1050 // if this is a proxy wrapping a ref, return methods using the raw ref 1051 // as receiver so that we don't have to call `toRaw` on the ref in all 1052 // its class methods 1053 isRef(target) ? target : receiver 1054 ); 1055 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 1056 return res; 1057 } 1058 if (!isReadonly2) { 1059 track(target, "get", key); 1060 } 1061 if (isShallow2) { 1062 return res; 1063 } 1064 if (isRef(res)) { 1065 return targetIsArray && isIntegerKey(key) ? res : res.value; 1066 } 1067 if (isObject(res)) { 1068 return isReadonly2 ? readonly(res) : reactive(res); 1069 } 1070 return res; 1071 } 1072} 1073class MutableReactiveHandler extends BaseReactiveHandler { 1074 constructor(isShallow2 = false) { 1075 super(false, isShallow2); 1076 } 1077 set(target, key, value, receiver) { 1078 let oldValue = target[key]; 1079 if (!this._isShallow) { 1080 const isOldValueReadonly = isReadonly(oldValue); 1081 if (!isShallow(value) && !isReadonly(value)) { 1082 oldValue = toRaw(oldValue); 1083 value = toRaw(value); 1084 } 1085 if (!isArray$3(target) && isRef(oldValue) && !isRef(value)) { 1086 if (isOldValueReadonly) { 1087 return false;
vendor: 4,174 bytes, lines 1088-1225
1088 } else { 1089 oldValue.value = value; 1090 return true; 1091 } 1092 } 1093 } 1094 const hadKey = isArray$3(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 1095 const result = Reflect.set( 1096 target, 1097 key, 1098 value, 1099 isRef(target) ? target : receiver 1100 ); 1101 if (target === toRaw(receiver)) { 1102 if (!hadKey) { 1103 trigger(target, "add", key, value); 1104 } else if (hasChanged(value, oldValue)) { 1105 trigger(target, "set", key, value); 1106 } 1107 } 1108 return result; 1109 } 1110 deleteProperty(target, key) { 1111 const hadKey = hasOwn(target, key); 1112 target[key]; 1113 const result = Reflect.deleteProperty(target, key); 1114 if (result && hadKey) { 1115 trigger(target, "delete", key, void 0); 1116 } 1117 return result; 1118 } 1119 has(target, key) { 1120 const result = Reflect.has(target, key); 1121 if (!isSymbol(key) || !builtInSymbols.has(key)) { 1122 track(target, "has", key); 1123 } 1124 return result; 1125 } 1126 ownKeys(target) { 1127 track( 1128 target, 1129 "iterate", 1130 isArray$3(target) ? "length" : ITERATE_KEY 1131 ); 1132 return Reflect.ownKeys(target); 1133 } 1134} 1135class ReadonlyReactiveHandler extends BaseReactiveHandler { 1136 constructor(isShallow2 = false) { 1137 super(true, isShallow2); 1138 } 1139 set(target, key) { 1140 return true; 1141 } 1142 deleteProperty(target, key) { 1143 return true; 1144 } 1145} 1146const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 1147const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 1148const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); 1149const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 1150const toShallow = (value) => value; 1151const getProto = (v2) => Reflect.getPrototypeOf(v2); 1152function createIterableMethod(method, isReadonly2, isShallow2) { 1153 return function(...args) { 1154 const target = this["__v_raw"]; 1155 const rawTarget = toRaw(target); 1156 const targetIsMap = isMap(rawTarget); 1157 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1158 const isKeyOnly = method === "keys" && targetIsMap; 1159 const innerIterator = target[method](...args); 1160 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1161 !isReadonly2 && track( 1162 rawTarget, 1163 "iterate", 1164 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1165 ); 1166 return { 1167 // iterator protocol 1168 next() { 1169 const { value, done } = innerIterator.next(); 1170 return done ? { value, done } : { 1171 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1172 done 1173 }; 1174 }, 1175 // iterable protocol 1176 [Symbol.iterator]() { 1177 return this; 1178 } 1179 }; 1180 }; 1181} 1182function createReadonlyMethod(type) { 1183 return function(...args) { 1184 return type === "delete" ? false : type === "clear" ? void 0 : this; 1185 }; 1186} 1187function createInstrumentations(readonly2, shallow) { 1188 const instrumentations = { 1189 get(key) { 1190 const target = this["__v_raw"]; 1191 const rawTarget = toRaw(target); 1192 const rawKey = toRaw(key); 1193 if (!readonly2) { 1194 if (hasChanged(key, rawKey)) { 1195 track(rawTarget, "get", key); 1196 } 1197 track(rawTarget, "get", rawKey); 1198 } 1199 const { has } = getProto(rawTarget); 1200 const wrap = shallow ? toShallow : readonly2 ? toReadonly : toReactive; 1201 if (has.call(rawTarget, key)) { 1202 return wrap(target.get(key)); 1203 } else if (has.call(rawTarget, rawKey)) { 1204 return wrap(target.get(rawKey)); 1205 } else if (target !== rawTarget) { 1206 target.get(key); 1207 } 1208 }, 1209 get size() { 1210 const target = this["__v_raw"]; 1211 !readonly2 && track(toRaw(target), "iterate", ITERATE_KEY); 1212 return Reflect.get(target, "size", target); 1213 }, 1214 has(key) { 1215 const target = this["__v_raw"]; 1216 const rawTarget = toRaw(target); 1217 const rawKey = toRaw(key); 1218 if (!readonly2) { 1219 if (hasChanged(key, rawKey)) { 1220 track(rawTarget, "has", key); 1221 } 1222 track(rawTarget, "has", rawKey); 1223 } 1224 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 1225 },
vendor: 15,290 bytes, lines 1226-1782
1226 forEach(callback, thisArg) { 1227 const observed = this; 1228 const target = observed["__v_raw"]; 1229 const rawTarget = toRaw(target); 1230 const wrap = shallow ? toShallow : readonly2 ? toReadonly : toReactive; 1231 !readonly2 && track(rawTarget, "iterate", ITERATE_KEY); 1232 return target.forEach((value, key) => { 1233 return callback.call(thisArg, wrap(value), wrap(key), observed); 1234 }); 1235 } 1236 }; 1237 extend( 1238 instrumentations, 1239 readonly2 ? { 1240 add: createReadonlyMethod("add"), 1241 set: createReadonlyMethod("set"), 1242 delete: createReadonlyMethod("delete"), 1243 clear: createReadonlyMethod("clear") 1244 } : { 1245 add(value) { 1246 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1247 value = toRaw(value); 1248 } 1249 const target = toRaw(this); 1250 const proto = getProto(target); 1251 const hadKey = proto.has.call(target, value); 1252 if (!hadKey) { 1253 target.add(value); 1254 trigger(target, "add", value, value); 1255 } 1256 return this; 1257 }, 1258 set(key, value) { 1259 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1260 value = toRaw(value); 1261 } 1262 const target = toRaw(this); 1263 const { has, get } = getProto(target); 1264 let hadKey = has.call(target, key); 1265 if (!hadKey) { 1266 key = toRaw(key); 1267 hadKey = has.call(target, key); 1268 } 1269 const oldValue = get.call(target, key); 1270 target.set(key, value); 1271 if (!hadKey) { 1272 trigger(target, "add", key, value); 1273 } else if (hasChanged(value, oldValue)) { 1274 trigger(target, "set", key, value); 1275 } 1276 return this; 1277 }, 1278 delete(key) { 1279 const target = toRaw(this); 1280 const { has, get } = getProto(target); 1281 let hadKey = has.call(target, key); 1282 if (!hadKey) { 1283 key = toRaw(key); 1284 hadKey = has.call(target, key); 1285 } 1286 get ? get.call(target, key) : void 0; 1287 const result = target.delete(key); 1288 if (hadKey) { 1289 trigger(target, "delete", key, void 0); 1290 } 1291 return result; 1292 }, 1293 clear() { 1294 const target = toRaw(this); 1295 const hadItems = target.size !== 0; 1296 const result = target.clear(); 1297 if (hadItems) { 1298 trigger( 1299 target, 1300 "clear", 1301 void 0, 1302 void 0 1303 ); 1304 } 1305 return result; 1306 } 1307 } 1308 ); 1309 const iteratorMethods = [ 1310 "keys", 1311 "values", 1312 "entries", 1313 Symbol.iterator 1314 ]; 1315 iteratorMethods.forEach((method) => { 1316 instrumentations[method] = createIterableMethod(method, readonly2, shallow); 1317 }); 1318 return instrumentations; 1319} 1320function createInstrumentationGetter(isReadonly2, shallow) { 1321 const instrumentations = createInstrumentations(isReadonly2, shallow); 1322 return (target, key, receiver) => { 1323 if (key === "__v_isReactive") { 1324 return !isReadonly2; 1325 } else if (key === "__v_isReadonly") { 1326 return isReadonly2; 1327 } else if (key === "__v_raw") { 1328 return target; 1329 } 1330 return Reflect.get( 1331 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1332 key, 1333 receiver 1334 ); 1335 }; 1336} 1337const mutableCollectionHandlers = { 1338 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1339}; 1340const shallowCollectionHandlers = { 1341 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1342}; 1343const readonlyCollectionHandlers = { 1344 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1345}; 1346const shallowReadonlyCollectionHandlers = { 1347 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1348}; 1349const reactiveMap = /* @__PURE__ */ new WeakMap(); 1350const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1351const readonlyMap = /* @__PURE__ */ new WeakMap(); 1352const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1353function targetTypeMap(rawType) { 1354 switch (rawType) { 1355 case "Object": 1356 case "Array": 1357 return 1; 1358 case "Map": 1359 case "Set": 1360 case "WeakMap": 1361 case "WeakSet": 1362 return 2; 1363 default: 1364 return 0; 1365 } 1366} 1367function getTargetType(value) { 1368 return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); 1369} 1370function reactive(target) { 1371 if (isReadonly(target)) { 1372 return target; 1373 } 1374 return createReactiveObject( 1375 target, 1376 false, 1377 mutableHandlers, 1378 mutableCollectionHandlers, 1379 reactiveMap 1380 ); 1381} 1382function shallowReactive(target) { 1383 return createReactiveObject( 1384 target, 1385 false, 1386 shallowReactiveHandlers, 1387 shallowCollectionHandlers, 1388 shallowReactiveMap 1389 ); 1390} 1391function readonly(target) { 1392 return createReactiveObject( 1393 target, 1394 true, 1395 readonlyHandlers, 1396 readonlyCollectionHandlers, 1397 readonlyMap 1398 ); 1399} 1400function shallowReadonly(target) { 1401 return createReactiveObject( 1402 target, 1403 true, 1404 shallowReadonlyHandlers, 1405 shallowReadonlyCollectionHandlers, 1406 shallowReadonlyMap 1407 ); 1408} 1409function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1410 if (!isObject(target)) { 1411 return target; 1412 } 1413 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1414 return target; 1415 } 1416 const targetType = getTargetType(target); 1417 if (targetType === 0) { 1418 return target; 1419 } 1420 const existingProxy = proxyMap.get(target); 1421 if (existingProxy) { 1422 return existingProxy; 1423 } 1424 const proxy = new Proxy( 1425 target, 1426 targetType === 2 ? collectionHandlers : baseHandlers 1427 ); 1428 proxyMap.set(target, proxy); 1429 return proxy; 1430} 1431function isReactive(value) { 1432 if (isReadonly(value)) { 1433 return isReactive(value["__v_raw"]); 1434 } 1435 return !!(value && value["__v_isReactive"]); 1436} 1437function isReadonly(value) { 1438 return !!(value && value["__v_isReadonly"]); 1439} 1440function isShallow(value) { 1441 return !!(value && value["__v_isShallow"]); 1442} 1443function isProxy(value) { 1444 return value ? !!value["__v_raw"] : false; 1445} 1446function toRaw(observed) { 1447 const raw = observed && observed["__v_raw"]; 1448 return raw ? toRaw(raw) : observed; 1449} 1450function markRaw(value) { 1451 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) { 1452 def(value, "__v_skip", true); 1453 } 1454 return value; 1455} 1456const toReactive = (value) => isObject(value) ? reactive(value) : value; 1457const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1458function isRef(r2) { 1459 return r2 ? r2["__v_isRef"] === true : false; 1460} 1461function ref(value) { 1462 return createRef(value, false); 1463} 1464function shallowRef(value) { 1465 return createRef(value, true); 1466} 1467function createRef(rawValue, shallow) { 1468 if (isRef(rawValue)) { 1469 return rawValue; 1470 } 1471 return new RefImpl(rawValue, shallow); 1472} 1473class RefImpl { 1474 constructor(value, isShallow2) { 1475 this.dep = new Dep(); 1476 this["__v_isRef"] = true; 1477 this["__v_isShallow"] = false; 1478 this._rawValue = isShallow2 ? value : toRaw(value); 1479 this._value = isShallow2 ? value : toReactive(value); 1480 this["__v_isShallow"] = isShallow2; 1481 } 1482 get value() { 1483 { 1484 this.dep.track(); 1485 } 1486 return this._value; 1487 } 1488 set value(newValue) { 1489 const oldValue = this._rawValue; 1490 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue); 1491 newValue = useDirectValue ? newValue : toRaw(newValue); 1492 if (hasChanged(newValue, oldValue)) { 1493 this._rawValue = newValue; 1494 this._value = useDirectValue ? newValue : toReactive(newValue); 1495 { 1496 this.dep.trigger(); 1497 } 1498 } 1499 } 1500} 1501function unref(ref2) { 1502 return isRef(ref2) ? ref2.value : ref2; 1503} 1504function toValue(source) { 1505 return isFunction$1(source) ? source() : unref(source); 1506} 1507const shallowUnwrapHandlers = { 1508 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), 1509 set: (target, key, value, receiver) => { 1510 const oldValue = target[key]; 1511 if (isRef(oldValue) && !isRef(value)) { 1512 oldValue.value = value; 1513 return true; 1514 } else { 1515 return Reflect.set(target, key, value, receiver); 1516 } 1517 } 1518}; 1519function proxyRefs(objectWithRefs) { 1520 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1521} 1522function toRefs(object) { 1523 const ret = isArray$3(object) ? new Array(object.length) : {}; 1524 for (const key in object) { 1525 ret[key] = propertyToRef(object, key); 1526 } 1527 return ret; 1528} 1529class ObjectRefImpl { 1530 constructor(_object, _key, _defaultValue) { 1531 this._object = _object; 1532 this._key = _key; 1533 this._defaultValue = _defaultValue; 1534 this["__v_isRef"] = true; 1535 this._value = void 0; 1536 } 1537 get value() { 1538 const val = this._object[this._key]; 1539 return this._value = val === void 0 ? this._defaultValue : val; 1540 } 1541 set value(newVal) { 1542 this._object[this._key] = newVal; 1543 } 1544 get dep() { 1545 return getDepFromReactive(toRaw(this._object), this._key); 1546 } 1547} 1548class GetterRefImpl { 1549 constructor(_getter) { 1550 this._getter = _getter; 1551 this["__v_isRef"] = true; 1552 this["__v_isReadonly"] = true; 1553 this._value = void 0; 1554 } 1555 get value() { 1556 return this._value = this._getter(); 1557 } 1558} 1559function toRef(source, key, defaultValue) { 1560 if (isRef(source)) { 1561 return source; 1562 } else if (isFunction$1(source)) { 1563 return new GetterRefImpl(source); 1564 } else if (isObject(source) && arguments.length > 1) { 1565 return propertyToRef(source, key, defaultValue); 1566 } else { 1567 return ref(source); 1568 } 1569} 1570function propertyToRef(source, key, defaultValue) { 1571 const val = source[key]; 1572 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); 1573} 1574class ComputedRefImpl { 1575 constructor(fn, setter, isSSR) { 1576 this.fn = fn; 1577 this.setter = setter; 1578 this._value = void 0; 1579 this.dep = new Dep(this); 1580 this.__v_isRef = true; 1581 this.deps = void 0; 1582 this.depsTail = void 0; 1583 this.flags = 16; 1584 this.globalVersion = globalVersion - 1; 1585 this.next = void 0; 1586 this.effect = this; 1587 this["__v_isReadonly"] = !setter; 1588 this.isSSR = isSSR; 1589 } 1590 /** 1591 * @internal 1592 */ 1593 notify() { 1594 this.flags |= 16; 1595 if (!(this.flags & 8) && // avoid infinite self recursion 1596 activeSub !== this) { 1597 batch(this, true); 1598 return true; 1599 } 1600 } 1601 get value() { 1602 const link = this.dep.track(); 1603 refreshComputed(this); 1604 if (link) { 1605 link.version = this.dep.version; 1606 } 1607 return this._value; 1608 } 1609 set value(newValue) { 1610 if (this.setter) { 1611 this.setter(newValue); 1612 } 1613 } 1614} 1615function computed$1(getterOrOptions, debugOptions, isSSR = false) { 1616 let getter; 1617 let setter; 1618 if (isFunction$1(getterOrOptions)) { 1619 getter = getterOrOptions; 1620 } else { 1621 getter = getterOrOptions.get; 1622 setter = getterOrOptions.set; 1623 } 1624 const cRef = new ComputedRefImpl(getter, setter, isSSR); 1625 return cRef; 1626} 1627const INITIAL_WATCHER_VALUE = {}; 1628const cleanupMap = /* @__PURE__ */ new WeakMap(); 1629let activeWatcher = void 0; 1630function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { 1631 if (owner) { 1632 let cleanups = cleanupMap.get(owner); 1633 if (!cleanups) cleanupMap.set(owner, cleanups = []); 1634 cleanups.push(cleanupFn); 1635 } 1636} 1637function watch$1(source, cb, options = EMPTY_OBJ) { 1638 const { immediate, deep, once: once2, scheduler, augmentJob, call } = options; 1639 const reactiveGetter = (source2) => { 1640 if (deep) return source2; 1641 if (isShallow(source2) || deep === false || deep === 0) 1642 return traverse(source2, 1); 1643 return traverse(source2); 1644 }; 1645 let effect2; 1646 let getter; 1647 let cleanup; 1648 let boundCleanup; 1649 let forceTrigger = false; 1650 let isMultiSource = false; 1651 if (isRef(source)) { 1652 getter = () => source.value; 1653 forceTrigger = isShallow(source); 1654 } else if (isReactive(source)) { 1655 getter = () => reactiveGetter(source); 1656 forceTrigger = true; 1657 } else if (isArray$3(source)) { 1658 isMultiSource = true; 1659 forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); 1660 getter = () => source.map((s2) => { 1661 if (isRef(s2)) { 1662 return s2.value; 1663 } else if (isReactive(s2)) { 1664 return reactiveGetter(s2); 1665 } else if (isFunction$1(s2)) { 1666 return call ? call(s2, 2) : s2(); 1667 } else ; 1668 }); 1669 } else if (isFunction$1(source)) { 1670 if (cb) { 1671 getter = call ? () => call(source, 2) : source; 1672 } else { 1673 getter = () => { 1674 if (cleanup) { 1675 pauseTracking(); 1676 try { 1677 cleanup(); 1678 } finally { 1679 resetTracking(); 1680 } 1681 } 1682 const currentEffect = activeWatcher; 1683 activeWatcher = effect2; 1684 try { 1685 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); 1686 } finally { 1687 activeWatcher = currentEffect; 1688 } 1689 }; 1690 } 1691 } else { 1692 getter = NOOP; 1693 } 1694 if (cb && deep) { 1695 const baseGetter = getter; 1696 const depth = deep === true ? Infinity : deep; 1697 getter = () => traverse(baseGetter(), depth); 1698 } 1699 const scope = getCurrentScope(); 1700 const watchHandle = () => { 1701 effect2.stop(); 1702 if (scope && scope.active) { 1703 remove(scope.effects, effect2); 1704 } 1705 }; 1706 if (once2 && cb) { 1707 const _cb = cb; 1708 cb = (...args) => { 1709 _cb(...args); 1710 watchHandle(); 1711 }; 1712 } 1713 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 1714 const job = (immediateFirstRun) => { 1715 if (!(effect2.flags & 1) || !effect2.dirty && !immediateFirstRun) { 1716 return; 1717 } 1718 if (cb) { 1719 const newValue = effect2.run(); 1720 if (deep || forceTrigger || (isMultiSource ? newValue.some((v2, i2) => hasChanged(v2, oldValue[i2])) : hasChanged(newValue, oldValue))) { 1721 if (cleanup) { 1722 cleanup(); 1723 } 1724 const currentWatcher = activeWatcher; 1725 activeWatcher = effect2; 1726 try { 1727 const args = [ 1728 newValue, 1729 // pass undefined as the old value when it's changed for the first time 1730 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 1731 boundCleanup 1732 ]; 1733 call ? call(cb, 3, args) : ( 1734 // @ts-expect-error 1735 cb(...args) 1736 ); 1737 oldValue = newValue; 1738 } finally { 1739 activeWatcher = currentWatcher; 1740 } 1741 } 1742 } else { 1743 effect2.run(); 1744 } 1745 }; 1746 if (augmentJob) { 1747 augmentJob(job); 1748 } 1749 effect2 = new ReactiveEffect(getter); 1750 effect2.scheduler = scheduler ? () => scheduler(job, false) : job; 1751 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect2); 1752 cleanup = effect2.onStop = () => { 1753 const cleanups = cleanupMap.get(effect2); 1754 if (cleanups) { 1755 if (call) { 1756 call(cleanups, 4); 1757 } else { 1758 for (const cleanup2 of cleanups) cleanup2(); 1759 } 1760 cleanupMap.delete(effect2); 1761 } 1762 }; 1763 if (cb) { 1764 if (immediate) { 1765 job(true); 1766 } else { 1767 oldValue = effect2.run(); 1768 } 1769 } else if (scheduler) { 1770 scheduler(job.bind(null, true), true); 1771 } else { 1772 effect2.run(); 1773 } 1774 watchHandle.pause = effect2.pause.bind(effect2); 1775 watchHandle.resume = effect2.resume.bind(effect2); 1776 watchHandle.stop = watchHandle; 1777 return watchHandle; 1778} 1779function traverse(value, depth = Infinity, seen2) { 1780 if (depth <= 0 || !isObject(value) || value["__v_skip"]) { 1781 return value; 1782 }
vendor: 4,938 bytes, lines 1783-1950
1783 seen2 = seen2 || /* @__PURE__ */ new Set(); 1784 if (seen2.has(value)) { 1785 return value; 1786 } 1787 seen2.add(value); 1788 depth--; 1789 if (isRef(value)) { 1790 traverse(value.value, depth, seen2); 1791 } else if (isArray$3(value)) { 1792 for (let i2 = 0; i2 < value.length; i2++) { 1793 traverse(value[i2], depth, seen2); 1794 } 1795 } else if (isSet(value) || isMap(value)) { 1796 value.forEach((v2) => { 1797 traverse(v2, depth, seen2); 1798 }); 1799 } else if (isPlainObject$3(value)) { 1800 for (const key in value) { 1801 traverse(value[key], depth, seen2); 1802 } 1803 for (const key of Object.getOwnPropertySymbols(value)) { 1804 if (Object.prototype.propertyIsEnumerable.call(value, key)) { 1805 traverse(value[key], depth, seen2); 1806 } 1807 } 1808 } 1809 return value; 1810} 1811/** 1812* @vue/runtime-core v3.5.14 1813* (c) 2018-present Yuxi (Evan) You and Vue contributors 1814* @license MIT 1815**/ 1816const stack = []; 1817let isWarning = false; 1818function warn$1(msg, ...args) { 1819 if (isWarning) return; 1820 isWarning = true; 1821 pauseTracking(); 1822 const instance = stack.length ? stack[stack.length - 1].component : null; 1823 const appWarnHandler = instance && instance.appContext.config.warnHandler; 1824 const trace = getComponentTrace(); 1825 if (appWarnHandler) { 1826 callWithErrorHandling( 1827 appWarnHandler, 1828 instance, 1829 11, 1830 [ 1831 // eslint-disable-next-line no-restricted-syntax 1832 msg + args.map((a2) => { 1833 var _a3, _b; 1834 return (_b = (_a3 = a2.toString) == null ? void 0 : _a3.call(a2)) != null ? _b : JSON.stringify(a2); 1835 }).join(""), 1836 instance && instance.proxy, 1837 trace.map( 1838 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 1839 ).join("\n"), 1840 trace 1841 ] 1842 ); 1843 } else { 1844 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 1845 if (trace.length && // avoid spamming console during tests 1846 true) { 1847 warnArgs.push(` 1848`, ...formatTrace(trace)); 1849 } 1850 console.warn(...warnArgs); 1851 } 1852 resetTracking(); 1853 isWarning = false; 1854} 1855function getComponentTrace() { 1856 let currentVNode = stack[stack.length - 1]; 1857 if (!currentVNode) { 1858 return []; 1859 } 1860 const normalizedStack = []; 1861 while (currentVNode) { 1862 const last2 = normalizedStack[0]; 1863 if (last2 && last2.vnode === currentVNode) { 1864 last2.recurseCount++; 1865 } else { 1866 normalizedStack.push({ 1867 vnode: currentVNode, 1868 recurseCount: 0 1869 }); 1870 } 1871 const parentInstance = currentVNode.component && currentVNode.component.parent; 1872 currentVNode = parentInstance && parentInstance.vnode; 1873 } 1874 return normalizedStack; 1875} 1876function formatTrace(trace) { 1877 const logs = []; 1878 trace.forEach((entry2, i2) => { 1879 logs.push(...i2 === 0 ? [] : [` 1880`], ...formatTraceEntry(entry2)); 1881 }); 1882 return logs; 1883} 1884function formatTraceEntry({ vnode, recurseCount }) { 1885 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 1886 const isRoot = vnode.component ? vnode.component.parent == null : false; 1887 const open2 = ` at <${formatComponentName( 1888 vnode.component, 1889 vnode.type, 1890 isRoot 1891 )}`; 1892 const close = `>` + postfix; 1893 return vnode.props ? [open2, ...formatProps(vnode.props), close] : [open2 + close]; 1894} 1895function formatProps(props) { 1896 const res = []; 1897 const keys = Object.keys(props); 1898 keys.slice(0, 3).forEach((key) => { 1899 res.push(...formatProp(key, props[key])); 1900 }); 1901 if (keys.length > 3) { 1902 res.push(` ...`); 1903 } 1904 return res; 1905} 1906function formatProp(key, value, raw) { 1907 if (isString(value)) { 1908 value = JSON.stringify(value); 1909 return raw ? value : [`${key}=${value}`]; 1910 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 1911 return raw ? value : [`${key}=${value}`]; 1912 } else if (isRef(value)) { 1913 value = formatProp(key, toRaw(value.value), true); 1914 return raw ? value : [`${key}=Ref<`, value, `>`]; 1915 } else if (isFunction$1(value)) { 1916 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 1917 } else { 1918 value = toRaw(value); 1919 return raw ? value : [`${key}=`, value]; 1920 } 1921} 1922function callWithErrorHandling(fn, instance, type, args) { 1923 try { 1924 return args ? fn(...args) : fn(); 1925 } catch (err) { 1926 handleError(err, instance, type); 1927 } 1928} 1929function callWithAsyncErrorHandling(fn, instance, type, args) { 1930 if (isFunction$1(fn)) { 1931 const res = callWithErrorHandling(fn, instance, type, args); 1932 if (res && isPromise$1(res)) { 1933 res.catch((err) => { 1934 handleError(err, instance, type); 1935 }); 1936 } 1937 return res; 1938 } 1939 if (isArray$3(fn)) { 1940 const values = []; 1941 for (let i2 = 0; i2 < fn.length; i2++) { 1942 values.push(callWithAsyncErrorHandling(fn[i2], instance, type, args)); 1943 } 1944 return values; 1945 } 1946} 1947function handleError(err, instance, type, throwInDev = true) { 1948 const contextVNode = instance ? instance.vnode : null; 1949 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; 1950 if (instance) {
vendor: 6,467 bytes, lines 1951-2195
1951 let cur = instance.parent; 1952 const exposedInstance = instance.proxy; 1953 const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`; 1954 while (cur) { 1955 const errorCapturedHooks = cur.ec; 1956 if (errorCapturedHooks) { 1957 for (let i2 = 0; i2 < errorCapturedHooks.length; i2++) { 1958 if (errorCapturedHooks[i2](err, exposedInstance, errorInfo) === false) { 1959 return; 1960 } 1961 } 1962 } 1963 cur = cur.parent; 1964 } 1965 if (errorHandler) { 1966 pauseTracking(); 1967 callWithErrorHandling(errorHandler, null, 10, [ 1968 err, 1969 exposedInstance, 1970 errorInfo 1971 ]); 1972 resetTracking(); 1973 return; 1974 } 1975 } 1976 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); 1977} 1978function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { 1979 if (throwInProd) { 1980 throw err; 1981 } else { 1982 console.error(err); 1983 } 1984} 1985const queue = []; 1986let flushIndex = -1; 1987const pendingPostFlushCbs = []; 1988let activePostFlushCbs = null; 1989let postFlushIndex = 0; 1990const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 1991let currentFlushPromise = null; 1992function nextTick(fn) { 1993 const p2 = currentFlushPromise || resolvedPromise; 1994 return fn ? p2.then(this ? fn.bind(this) : fn) : p2; 1995} 1996function findInsertionIndex$1(id) { 1997 let start = flushIndex + 1; 1998 let end = queue.length; 1999 while (start < end) { 2000 const middle = start + end >>> 1; 2001 const middleJob = queue[middle]; 2002 const middleJobId = getId(middleJob); 2003 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) { 2004 start = middle + 1; 2005 } else { 2006 end = middle; 2007 } 2008 } 2009 return start; 2010} 2011function queueJob(job) { 2012 if (!(job.flags & 1)) { 2013 const jobId = getId(job); 2014 const lastJob = queue[queue.length - 1]; 2015 if (!lastJob || // fast path when the job id is larger than the tail 2016 !(job.flags & 2) && jobId >= getId(lastJob)) { 2017 queue.push(job); 2018 } else { 2019 queue.splice(findInsertionIndex$1(jobId), 0, job); 2020 } 2021 job.flags |= 1; 2022 queueFlush(); 2023 } 2024} 2025function queueFlush() { 2026 if (!currentFlushPromise) { 2027 currentFlushPromise = resolvedPromise.then(flushJobs); 2028 } 2029} 2030function queuePostFlushCb(cb) { 2031 if (!isArray$3(cb)) { 2032 if (activePostFlushCbs && cb.id === -1) { 2033 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); 2034 } else if (!(cb.flags & 1)) { 2035 pendingPostFlushCbs.push(cb); 2036 cb.flags |= 1; 2037 } 2038 } else { 2039 pendingPostFlushCbs.push(...cb); 2040 } 2041 queueFlush(); 2042} 2043function flushPreFlushCbs(instance, seen2, i2 = flushIndex + 1) { 2044 for (; i2 < queue.length; i2++) { 2045 const cb = queue[i2]; 2046 if (cb && cb.flags & 2) { 2047 if (instance && cb.id !== instance.uid) { 2048 continue; 2049 } 2050 queue.splice(i2, 1); 2051 i2--; 2052 if (cb.flags & 4) { 2053 cb.flags &= -2; 2054 } 2055 cb(); 2056 if (!(cb.flags & 4)) { 2057 cb.flags &= -2; 2058 } 2059 } 2060 } 2061} 2062function flushPostFlushCbs(seen2) { 2063 if (pendingPostFlushCbs.length) { 2064 const deduped = [...new Set(pendingPostFlushCbs)].sort( 2065 (a2, b) => getId(a2) - getId(b) 2066 ); 2067 pendingPostFlushCbs.length = 0; 2068 if (activePostFlushCbs) { 2069 activePostFlushCbs.push(...deduped); 2070 return; 2071 } 2072 activePostFlushCbs = deduped; 2073 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 2074 const cb = activePostFlushCbs[postFlushIndex]; 2075 if (cb.flags & 4) { 2076 cb.flags &= -2; 2077 } 2078 if (!(cb.flags & 8)) cb(); 2079 cb.flags &= -2; 2080 } 2081 activePostFlushCbs = null; 2082 postFlushIndex = 0; 2083 } 2084} 2085const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id; 2086function flushJobs(seen2) { 2087 try { 2088 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 2089 const job = queue[flushIndex]; 2090 if (job && !(job.flags & 8)) { 2091 if (false) ; 2092 if (job.flags & 4) { 2093 job.flags &= ~1; 2094 } 2095 callWithErrorHandling( 2096 job, 2097 job.i, 2098 job.i ? 15 : 14 2099 ); 2100 if (!(job.flags & 4)) { 2101 job.flags &= ~1; 2102 } 2103 } 2104 } 2105 } finally { 2106 for (; flushIndex < queue.length; flushIndex++) { 2107 const job = queue[flushIndex]; 2108 if (job) { 2109 job.flags &= -2; 2110 } 2111 } 2112 flushIndex = -1; 2113 queue.length = 0; 2114 flushPostFlushCbs(); 2115 currentFlushPromise = null; 2116 if (queue.length || pendingPostFlushCbs.length) { 2117 flushJobs(); 2118 } 2119 } 2120} 2121let currentRenderingInstance = null; 2122let currentScopeId = null; 2123function setCurrentRenderingInstance(instance) { 2124 const prev = currentRenderingInstance; 2125 currentRenderingInstance = instance; 2126 currentScopeId = instance && instance.type.__scopeId || null; 2127 return prev; 2128} 2129function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 2130 if (!ctx) return fn; 2131 if (fn._n) { 2132 return fn; 2133 } 2134 const renderFnWithContext = (...args) => { 2135 if (renderFnWithContext._d) { 2136 setBlockTracking(-1); 2137 } 2138 const prevInstance = setCurrentRenderingInstance(ctx); 2139 let res; 2140 try { 2141 res = fn(...args); 2142 } finally { 2143 setCurrentRenderingInstance(prevInstance); 2144 if (renderFnWithContext._d) { 2145 setBlockTracking(1); 2146 } 2147 } 2148 return res; 2149 }; 2150 renderFnWithContext._n = true; 2151 renderFnWithContext._c = true; 2152 renderFnWithContext._d = true; 2153 return renderFnWithContext; 2154} 2155function withDirectives(vnode, directives) { 2156 if (currentRenderingInstance === null) { 2157 return vnode; 2158 } 2159 const instance = getComponentPublicInstance(currentRenderingInstance); 2160 const bindings = vnode.dirs || (vnode.dirs = []); 2161 for (let i2 = 0; i2 < directives.length; i2++) { 2162 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i2]; 2163 if (dir) { 2164 if (isFunction$1(dir)) { 2165 dir = { 2166 mounted: dir, 2167 updated: dir 2168 }; 2169 } 2170 if (dir.deep) { 2171 traverse(value); 2172 } 2173 bindings.push({ 2174 dir, 2175 instance, 2176 value, 2177 oldValue: void 0, 2178 arg, 2179 modifiers 2180 }); 2181 } 2182 } 2183 return vnode; 2184} 2185function invokeDirectiveHook(vnode, prevVNode, instance, name) { 2186 const bindings = vnode.dirs; 2187 const oldBindings = prevVNode && prevVNode.dirs; 2188 for (let i2 = 0; i2 < bindings.length; i2++) { 2189 const binding = bindings[i2]; 2190 if (oldBindings) { 2191 binding.oldValue = oldBindings[i2].value; 2192 } 2193 let hook = binding.dir[name]; 2194 if (hook) { 2195 pauseTracking();
2196 callWithAsyncErrorHandling(hook, instance, 8, [ 2197 vnode.el, 2198 binding, 2199 vnode, 2200 prevVNode 2201 ]); 2202 resetTracking(); 2203 } 2204 } 2205} 2206const TeleportEndKey = Symbol("_vte"); 2207const isTeleport = (type) => type.__isTeleport; 2208const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 2209const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 2210const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 2211const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 2212const resolveTarget = (props, select) => { 2213 const targetSelector = props && props.to; 2214 if (isString(targetSelector)) { 2215 if (!select) { 2216 return null; 2217 } else { 2218 const target = select(targetSelector); 2219 return target; 2220 } 2221 } else { 2222 return targetSelector; 2223 } 2224}; 2225const TeleportImpl = { 2226 name: "Teleport", 2227 __isTeleport: true, 2228 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 2229 const { 2230 mc: mountChildren, 2231 pc: patchChildren, 2232 pbc: patchBlockChildren, 2233 o: { insert, querySelector, createText, createComment } 2234 } = internals; 2235 const disabled = isTeleportDisabled(n2.props); 2236 let { shapeFlag, children, dynamicChildren } = n2; 2237 if (n1 == null) { 2238 const placeholder = n2.el = createText(""); 2239 const mainAnchor = n2.anchor = createText(""); 2240 insert(placeholder, container, anchor); 2241 insert(mainAnchor, container, anchor); 2242 const mount = (container2, anchor2) => { 2243 if (shapeFlag & 16) { 2244 if (parentComponent && parentComponent.isCE) { 2245 parentComponent.ce._teleportTarget = container2; 2246 } 2247 mountChildren( 2248 children, 2249 container2, 2250 anchor2, 2251 parentComponent, 2252 parentSuspense, 2253 namespace, 2254 slotScopeIds, 2255 optimized 2256 ); 2257 } 2258 }; 2259 const mountToTarget = () => { 2260 const target = n2.target = resolveTarget(n2.props, querySelector); 2261 const targetAnchor = prepareAnchor(target, n2, createText, insert); 2262 if (target) { 2263 if (namespace !== "svg" && isTargetSVG(target)) { 2264 namespace = "svg"; 2265 } else if (namespace !== "mathml" && isTargetMathML(target)) { 2266 namespace = "mathml"; 2267 } 2268 if (!disabled) { 2269 mount(target, targetAnchor); 2270 updateCssVars(n2, false); 2271 } 2272 } 2273 }; 2274 if (disabled) { 2275 mount(container, mainAnchor); 2276 updateCssVars(n2, true); 2277 } 2278 if (isTeleportDeferred(n2.props)) { 2279 queuePostRenderEffect(() => { 2280 mountToTarget(); 2281 n2.el.__isMounted = true; 2282 }, parentSuspense); 2283 } else { 2284 mountToTarget(); 2285 } 2286 } else { 2287 if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { 2288 queuePostRenderEffect(() => { 2289 TeleportImpl.process( 2290 n1, 2291 n2, 2292 container, 2293 anchor, 2294 parentComponent, 2295 parentSuspense, 2296 namespace, 2297 slotScopeIds, 2298 optimized, 2299 internals 2300 ); 2301 delete n1.el.__isMounted; 2302 }, parentSuspense); 2303 return; 2304 } 2305 n2.el = n1.el; 2306 n2.targetStart = n1.targetStart; 2307 const mainAnchor = n2.anchor = n1.anchor; 2308 const target = n2.target = n1.target; 2309 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 2310 const wasDisabled = isTeleportDisabled(n1.props); 2311 const currentContainer = wasDisabled ? container : target; 2312 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 2313 if (namespace === "svg" || isTargetSVG(target)) { 2314 namespace = "svg"; 2315 } else if (namespace === "mathml" || isTargetMathML(target)) { 2316 namespace = "mathml"; 2317 } 2318 if (dynamicChildren) { 2319 patchBlockChildren( 2320 n1.dynamicChildren, 2321 dynamicChildren, 2322 currentContainer, 2323 parentComponent, 2324 parentSuspense, 2325 namespace, 2326 slotScopeIds 2327 ); 2328 traverseStaticChildren(n1, n2, true); 2329 } else if (!optimized) { 2330 patchChildren( 2331 n1, 2332 n2, 2333 currentContainer, 2334 currentAnchor, 2335 parentComponent, 2336 parentSuspense, 2337 namespace, 2338 slotScopeIds, 2339 false 2340 ); 2341 } 2342 if (disabled) { 2343 if (!wasDisabled) { 2344 moveTeleport( 2345 n2, 2346 container, 2347 mainAnchor, 2348 internals, 2349 1 2350 ); 2351 } else { 2352 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 2353 n2.props.to = n1.props.to; 2354 } 2355 } 2356 } else { 2357 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 2358 const nextTarget = n2.target = resolveTarget( 2359 n2.props, 2360 querySelector 2361 ); 2362 if (nextTarget) { 2363 moveTeleport( 2364 n2, 2365 nextTarget, 2366 null, 2367 internals, 2368 0 2369 ); 2370 } 2371 } else if (wasDisabled) { 2372 moveTeleport( 2373 n2, 2374 target, 2375 targetAnchor, 2376 internals, 2377 1 2378 ); 2379 } 2380 } 2381 updateCssVars(n2, disabled); 2382 } 2383 }, 2384 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 2385 const { 2386 shapeFlag, 2387 children, 2388 anchor, 2389 targetStart, 2390 targetAnchor, 2391 target, 2392 props 2393 } = vnode; 2394 if (target) {
vendor: 10,737 bytes, lines 2395-2765
2395 hostRemove(targetStart); 2396 hostRemove(targetAnchor); 2397 } 2398 doRemove && hostRemove(anchor); 2399 if (shapeFlag & 16) { 2400 const shouldRemove = doRemove || !isTeleportDisabled(props); 2401 for (let i2 = 0; i2 < children.length; i2++) { 2402 const child = children[i2]; 2403 unmount( 2404 child, 2405 parentComponent, 2406 parentSuspense, 2407 shouldRemove, 2408 !!child.dynamicChildren 2409 ); 2410 } 2411 } 2412 }, 2413 move: moveTeleport, 2414 hydrate: hydrateTeleport 2415}; 2416function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 2417 if (moveType === 0) { 2418 insert(vnode.targetAnchor, container, parentAnchor); 2419 } 2420 const { el, anchor, shapeFlag, children, props } = vnode; 2421 const isReorder = moveType === 2; 2422 if (isReorder) { 2423 insert(el, container, parentAnchor); 2424 } 2425 if (!isReorder || isTeleportDisabled(props)) { 2426 if (shapeFlag & 16) { 2427 for (let i2 = 0; i2 < children.length; i2++) { 2428 move( 2429 children[i2], 2430 container, 2431 parentAnchor, 2432 2 2433 ); 2434 } 2435 } 2436 } 2437 if (isReorder) { 2438 insert(anchor, container, parentAnchor); 2439 } 2440} 2441function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 2442 o: { nextSibling, parentNode, querySelector, insert, createText } 2443}, hydrateChildren) { 2444 const target = vnode.target = resolveTarget( 2445 vnode.props, 2446 querySelector 2447 ); 2448 if (target) { 2449 const disabled = isTeleportDisabled(vnode.props); 2450 const targetNode = target._lpa || target.firstChild; 2451 if (vnode.shapeFlag & 16) { 2452 if (disabled) { 2453 vnode.anchor = hydrateChildren( 2454 nextSibling(node), 2455 vnode, 2456 parentNode(node), 2457 parentComponent, 2458 parentSuspense, 2459 slotScopeIds, 2460 optimized 2461 ); 2462 vnode.targetStart = targetNode; 2463 vnode.targetAnchor = targetNode && nextSibling(targetNode); 2464 } else { 2465 vnode.anchor = nextSibling(node); 2466 let targetAnchor = targetNode; 2467 while (targetAnchor) { 2468 if (targetAnchor && targetAnchor.nodeType === 8) { 2469 if (targetAnchor.data === "teleport start anchor") { 2470 vnode.targetStart = targetAnchor; 2471 } else if (targetAnchor.data === "teleport anchor") { 2472 vnode.targetAnchor = targetAnchor; 2473 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 2474 break; 2475 } 2476 } 2477 targetAnchor = nextSibling(targetAnchor); 2478 } 2479 if (!vnode.targetAnchor) { 2480 prepareAnchor(target, vnode, createText, insert); 2481 } 2482 hydrateChildren( 2483 targetNode && nextSibling(targetNode), 2484 vnode, 2485 target, 2486 parentComponent, 2487 parentSuspense, 2488 slotScopeIds, 2489 optimized 2490 ); 2491 } 2492 } 2493 updateCssVars(vnode, disabled); 2494 } 2495 return vnode.anchor && nextSibling(vnode.anchor); 2496} 2497const Teleport = TeleportImpl; 2498function updateCssVars(vnode, isDisabled) { 2499 const ctx = vnode.ctx; 2500 if (ctx && ctx.ut) { 2501 let node, anchor; 2502 if (isDisabled) { 2503 node = vnode.el; 2504 anchor = vnode.anchor; 2505 } else { 2506 node = vnode.targetStart; 2507 anchor = vnode.targetAnchor; 2508 } 2509 while (node && node !== anchor) { 2510 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 2511 node = node.nextSibling; 2512 } 2513 ctx.ut(); 2514 } 2515} 2516function prepareAnchor(target, vnode, createText, insert) { 2517 const targetStart = vnode.targetStart = createText(""); 2518 const targetAnchor = vnode.targetAnchor = createText(""); 2519 targetStart[TeleportEndKey] = targetAnchor; 2520 if (target) { 2521 insert(targetStart, target); 2522 insert(targetAnchor, target); 2523 } 2524 return targetAnchor; 2525} 2526const leaveCbKey = Symbol("_leaveCb"); 2527const enterCbKey = Symbol("_enterCb"); 2528function useTransitionState() { 2529 const state = { 2530 isMounted: false, 2531 isLeaving: false, 2532 isUnmounting: false, 2533 leavingVNodes: /* @__PURE__ */ new Map() 2534 }; 2535 onMounted(() => { 2536 state.isMounted = true; 2537 }); 2538 onBeforeUnmount(() => { 2539 state.isUnmounting = true; 2540 }); 2541 return state; 2542} 2543const TransitionHookValidator = [Function, Array]; 2544const BaseTransitionPropsValidators = { 2545 mode: String, 2546 appear: Boolean, 2547 persisted: Boolean, 2548 // enter 2549 onBeforeEnter: TransitionHookValidator, 2550 onEnter: TransitionHookValidator, 2551 onAfterEnter: TransitionHookValidator, 2552 onEnterCancelled: TransitionHookValidator, 2553 // leave 2554 onBeforeLeave: TransitionHookValidator, 2555 onLeave: TransitionHookValidator, 2556 onAfterLeave: TransitionHookValidator, 2557 onLeaveCancelled: TransitionHookValidator, 2558 // appear 2559 onBeforeAppear: TransitionHookValidator, 2560 onAppear: TransitionHookValidator, 2561 onAfterAppear: TransitionHookValidator, 2562 onAppearCancelled: TransitionHookValidator 2563}; 2564const recursiveGetSubtree = (instance) => { 2565 const subTree = instance.subTree; 2566 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 2567}; 2568const BaseTransitionImpl = { 2569 name: `BaseTransition`, 2570 props: BaseTransitionPropsValidators, 2571 setup(props, { slots }) { 2572 const instance = getCurrentInstance(); 2573 const state = useTransitionState(); 2574 return () => { 2575 const children = slots.default && getTransitionRawChildren(slots.default(), true); 2576 if (!children || !children.length) { 2577 return; 2578 } 2579 const child = findNonCommentChild(children); 2580 const rawProps = toRaw(props); 2581 const { mode } = rawProps; 2582 if (state.isLeaving) { 2583 return emptyPlaceholder(child); 2584 } 2585 const innerChild = getInnerChild$1(child); 2586 if (!innerChild) { 2587 return emptyPlaceholder(child); 2588 } 2589 let enterHooks = resolveTransitionHooks( 2590 innerChild, 2591 rawProps, 2592 state, 2593 instance, 2594 // #11061, ensure enterHooks is fresh after clone 2595 (hooks) => enterHooks = hooks 2596 ); 2597 if (innerChild.type !== Comment) { 2598 setTransitionHooks(innerChild, enterHooks); 2599 } 2600 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); 2601 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) { 2602 let leavingHooks = resolveTransitionHooks( 2603 oldInnerChild, 2604 rawProps, 2605 state, 2606 instance 2607 ); 2608 setTransitionHooks(oldInnerChild, leavingHooks); 2609 if (mode === "out-in" && innerChild.type !== Comment) { 2610 state.isLeaving = true; 2611 leavingHooks.afterLeave = () => { 2612 state.isLeaving = false; 2613 if (!(instance.job.flags & 8)) { 2614 instance.update(); 2615 } 2616 delete leavingHooks.afterLeave; 2617 oldInnerChild = void 0; 2618 }; 2619 return emptyPlaceholder(child); 2620 } else if (mode === "in-out" && innerChild.type !== Comment) { 2621 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 2622 const leavingVNodesCache = getLeavingNodesForType( 2623 state, 2624 oldInnerChild 2625 ); 2626 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 2627 el[leaveCbKey] = () => { 2628 earlyRemove(); 2629 el[leaveCbKey] = void 0; 2630 delete enterHooks.delayedLeave; 2631 oldInnerChild = void 0; 2632 }; 2633 enterHooks.delayedLeave = () => { 2634 delayedLeave(); 2635 delete enterHooks.delayedLeave; 2636 oldInnerChild = void 0; 2637 }; 2638 }; 2639 } else { 2640 oldInnerChild = void 0; 2641 } 2642 } else if (oldInnerChild) { 2643 oldInnerChild = void 0; 2644 } 2645 return child; 2646 }; 2647 } 2648}; 2649function findNonCommentChild(children) { 2650 let child = children[0]; 2651 if (children.length > 1) { 2652 for (const c2 of children) { 2653 if (c2.type !== Comment) { 2654 child = c2; 2655 break; 2656 } 2657 } 2658 } 2659 return child; 2660} 2661const BaseTransition = BaseTransitionImpl; 2662function getLeavingNodesForType(state, vnode) { 2663 const { leavingVNodes } = state; 2664 let leavingVNodesCache = leavingVNodes.get(vnode.type); 2665 if (!leavingVNodesCache) { 2666 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 2667 leavingVNodes.set(vnode.type, leavingVNodesCache); 2668 } 2669 return leavingVNodesCache; 2670} 2671function resolveTransitionHooks(vnode, props, state, instance, postClone) { 2672 const { 2673 appear, 2674 mode, 2675 persisted = false, 2676 onBeforeEnter, 2677 onEnter, 2678 onAfterEnter, 2679 onEnterCancelled, 2680 onBeforeLeave, 2681 onLeave, 2682 onAfterLeave, 2683 onLeaveCancelled, 2684 onBeforeAppear, 2685 onAppear, 2686 onAfterAppear, 2687 onAppearCancelled 2688 } = props; 2689 const key = String(vnode.key); 2690 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 2691 const callHook2 = (hook, args) => { 2692 hook && callWithAsyncErrorHandling( 2693 hook, 2694 instance, 2695 9, 2696 args 2697 ); 2698 }; 2699 const callAsyncHook = (hook, args) => { 2700 const done = args[1]; 2701 callHook2(hook, args); 2702 if (isArray$3(hook)) { 2703 if (hook.every((hook2) => hook2.length <= 1)) done(); 2704 } else if (hook.length <= 1) { 2705 done(); 2706 } 2707 }; 2708 const hooks = { 2709 mode, 2710 persisted, 2711 beforeEnter(el) { 2712 let hook = onBeforeEnter; 2713 if (!state.isMounted) { 2714 if (appear) { 2715 hook = onBeforeAppear || onBeforeEnter; 2716 } else { 2717 return; 2718 } 2719 } 2720 if (el[leaveCbKey]) { 2721 el[leaveCbKey]( 2722 true 2723 /* cancelled */ 2724 ); 2725 } 2726 const leavingVNode = leavingVNodesCache[key]; 2727 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 2728 leavingVNode.el[leaveCbKey](); 2729 } 2730 callHook2(hook, [el]); 2731 }, 2732 enter(el) { 2733 let hook = onEnter; 2734 let afterHook = onAfterEnter; 2735 let cancelHook = onEnterCancelled; 2736 if (!state.isMounted) { 2737 if (appear) { 2738 hook = onAppear || onEnter; 2739 afterHook = onAfterAppear || onAfterEnter; 2740 cancelHook = onAppearCancelled || onEnterCancelled; 2741 } else { 2742 return; 2743 } 2744 } 2745 let called = false; 2746 const done = el[enterCbKey] = (cancelled) => { 2747 if (called) return; 2748 called = true; 2749 if (cancelled) { 2750 callHook2(cancelHook, [el]); 2751 } else { 2752 callHook2(afterHook, [el]); 2753 } 2754 if (hooks.delayedLeave) { 2755 hooks.delayedLeave(); 2756 } 2757 el[enterCbKey] = void 0; 2758 }; 2759 if (hook) { 2760 callAsyncHook(hook, [el, done]); 2761 } else { 2762 done(); 2763 } 2764 }, 2765 leave(el, remove2) {
vendor: 2,272 bytes, lines 2766-2854
2766 const key2 = String(vnode.key); 2767 if (el[enterCbKey]) { 2768 el[enterCbKey]( 2769 true 2770 /* cancelled */ 2771 ); 2772 } 2773 if (state.isUnmounting) { 2774 return remove2(); 2775 } 2776 callHook2(onBeforeLeave, [el]); 2777 let called = false; 2778 const done = el[leaveCbKey] = (cancelled) => { 2779 if (called) return; 2780 called = true; 2781 remove2(); 2782 if (cancelled) { 2783 callHook2(onLeaveCancelled, [el]); 2784 } else { 2785 callHook2(onAfterLeave, [el]); 2786 } 2787 el[leaveCbKey] = void 0; 2788 if (leavingVNodesCache[key2] === vnode) { 2789 delete leavingVNodesCache[key2]; 2790 } 2791 }; 2792 leavingVNodesCache[key2] = vnode; 2793 if (onLeave) { 2794 callAsyncHook(onLeave, [el, done]); 2795 } else { 2796 done(); 2797 } 2798 }, 2799 clone(vnode2) { 2800 const hooks2 = resolveTransitionHooks( 2801 vnode2, 2802 props, 2803 state, 2804 instance, 2805 postClone 2806 ); 2807 if (postClone) postClone(hooks2); 2808 return hooks2; 2809 } 2810 }; 2811 return hooks; 2812} 2813function emptyPlaceholder(vnode) { 2814 if (isKeepAlive(vnode)) { 2815 vnode = cloneVNode(vnode); 2816 vnode.children = null; 2817 return vnode; 2818 } 2819} 2820function getInnerChild$1(vnode) { 2821 if (!isKeepAlive(vnode)) { 2822 if (isTeleport(vnode.type) && vnode.children) { 2823 return findNonCommentChild(vnode.children); 2824 } 2825 return vnode; 2826 } 2827 if (vnode.component) { 2828 return vnode.component.subTree; 2829 } 2830 const { shapeFlag, children } = vnode; 2831 if (children) { 2832 if (shapeFlag & 16) { 2833 return children[0]; 2834 } 2835 if (shapeFlag & 32 && isFunction$1(children.default)) { 2836 return children.default(); 2837 } 2838 } 2839} 2840function setTransitionHooks(vnode, hooks) { 2841 if (vnode.shapeFlag & 6 && vnode.component) { 2842 vnode.transition = hooks; 2843 setTransitionHooks(vnode.component.subTree, hooks); 2844 } else if (vnode.shapeFlag & 128) { 2845 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 2846 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 2847 } else { 2848 vnode.transition = hooks; 2849 } 2850} 2851function getTransitionRawChildren(children, keepComment = false, parentKey) { 2852 let ret = []; 2853 let keyedFragmentCount = 0; 2854 for (let i2 = 0; i2 < children.length; i2++) {
2855 let child = children[i2]; 2856 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i2); 2857 if (child.type === Fragment) { 2858 if (child.patchFlag & 128) keyedFragmentCount++; 2859 ret = ret.concat( 2860 getTransitionRawChildren(child.children, keepComment, key) 2861 ); 2862 } else if (keepComment || child.type !== Comment) { 2863 ret.push(key != null ? cloneVNode(child, { key }) : child); 2864 } 2865 } 2866 if (keyedFragmentCount > 1) { 2867 for (let i2 = 0; i2 < ret.length; i2++) { 2868 ret[i2].patchFlag = -2; 2869 } 2870 } 2871 return ret; 2872} 2873/*! #__NO_SIDE_EFFECTS__ */ 2874// @__NO_SIDE_EFFECTS__ 2875function defineComponent(options, extraOptions) { 2876 return isFunction$1(options) ? ( 2877 // #8236: extend call and options.name access are considered side-effects 2878 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 2879 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 2880 ) : options; 2881} 2882function markAsyncBoundary(instance) { 2883 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 2884} 2885function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 2886 if (isArray$3(rawRef)) { 2887 rawRef.forEach( 2888 (r2, i2) => setRef( 2889 r2, 2890 oldRawRef && (isArray$3(oldRawRef) ? oldRawRef[i2] : oldRawRef), 2891 parentSuspense, 2892 vnode, 2893 isUnmount 2894 ) 2895 ); 2896 return; 2897 } 2898 if (isAsyncWrapper(vnode) && !isUnmount) { 2899 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { 2900 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); 2901 } 2902 return; 2903 } 2904 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 2905 const value = isUnmount ? null : refValue; 2906 const { i: owner, r: ref3 } = rawRef; 2907 const oldRef = oldRawRef && oldRawRef.r; 2908 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 2909 const setupState = owner.setupState; 2910 const rawSetupState = toRaw(setupState); 2911 const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => { 2912 return hasOwn(rawSetupState, key); 2913 }; 2914 if (oldRef != null && oldRef !== ref3) { 2915 if (isString(oldRef)) { 2916 refs[oldRef] = null; 2917 if (canSetSetupRef(oldRef)) { 2918 setupState[oldRef] = null; 2919 } 2920 } else if (isRef(oldRef)) { 2921 oldRef.value = null; 2922 } 2923 } 2924 if (isFunction$1(ref3)) { 2925 callWithErrorHandling(ref3, owner, 12, [value, refs]); 2926 } else { 2927 const _isString = isString(ref3); 2928 const _isRef = isRef(ref3); 2929 if (_isString || _isRef) { 2930 const doSet = () => { 2931 if (rawRef.f) { 2932 const existing = _isString ? canSetSetupRef(ref3) ? setupState[ref3] : refs[ref3] : ref3.value; 2933 if (isUnmount) { 2934 isArray$3(existing) && remove(existing, refValue); 2935 } else { 2936 if (!isArray$3(existing)) { 2937 if (_isString) { 2938 refs[ref3] = [refValue]; 2939 if (canSetSetupRef(ref3)) { 2940 setupState[ref3] = refs[ref3]; 2941 } 2942 } else { 2943 ref3.value = [refValue]; 2944 if (rawRef.k) refs[rawRef.k] = ref3.value; 2945 } 2946 } else if (!existing.includes(refValue)) { 2947 existing.push(refValue); 2948 } 2949 } 2950 } else if (_isString) { 2951 refs[ref3] = value; 2952 if (canSetSetupRef(ref3)) { 2953 setupState[ref3] = value; 2954 } 2955 } else if (_isRef) { 2956 ref3.value = value; 2957 if (rawRef.k) refs[rawRef.k] = value; 2958 } else ; 2959 }; 2960 if (value) { 2961 doSet.id = -1; 2962 queuePostRenderEffect(doSet, parentSuspense); 2963 } else { 2964 doSet(); 2965 } 2966 } 2967 } 2968} 2969let hasLoggedMismatchError = false; 2970const logMismatchError = () => { 2971 if (hasLoggedMismatchError) { 2972 return; 2973 } 2974 console.error("Hydration completed but contains mismatches."); 2975 hasLoggedMismatchError = true; 2976}; 2977const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 2978const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 2979const getContainerType = (container) => { 2980 if (container.nodeType !== 1) return void 0; 2981 if (isSVGContainer(container)) return "svg"; 2982 if (isMathMLContainer(container)) return "mathml"; 2983 return void 0; 2984}; 2985const isComment = (node) => node.nodeType === 8; 2986function createHydrationFunctions(rendererInternals) { 2987 const { 2988 mt: mountComponent, 2989 p: patch, 2990 o: { 2991 patchProp: patchProp2, 2992 createText, 2993 nextSibling, 2994 parentNode, 2995 remove: remove2, 2996 insert, 2997 createComment 2998 } 2999 } = rendererInternals; 3000 const hydrate = (vnode, container) => { 3001 if (!container.hasChildNodes()) { 3002 patch(null, vnode, container); 3003 flushPostFlushCbs(); 3004 container._vnode = vnode; 3005 return; 3006 } 3007 hydrateNode(container.firstChild, vnode, null, null, null); 3008 flushPostFlushCbs(); 3009 container._vnode = vnode; 3010 }; 3011 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 3012 optimized = optimized || !!vnode.dynamicChildren; 3013 const isFragmentStart = isComment(node) && node.data === "["; 3014 const onMismatch = () => handleMismatch( 3015 node, 3016 vnode, 3017 parentComponent, 3018 parentSuspense, 3019 slotScopeIds, 3020 isFragmentStart 3021 ); 3022 const { type, ref: ref3, shapeFlag, patchFlag } = vnode; 3023 let domType = node.nodeType; 3024 vnode.el = node; 3025 if (patchFlag === -2) { 3026 optimized = false;
vendor: 4,941 bytes, lines 3027-3182
3027 vnode.dynamicChildren = null; 3028 } 3029 let nextNode = null; 3030 switch (type) { 3031 case Text: 3032 if (domType !== 3) { 3033 if (vnode.children === "") { 3034 insert(vnode.el = createText(""), parentNode(node), node); 3035 nextNode = node; 3036 } else { 3037 nextNode = onMismatch(); 3038 } 3039 } else { 3040 if (node.data !== vnode.children) { 3041 logMismatchError(); 3042 node.data = vnode.children; 3043 } 3044 nextNode = nextSibling(node); 3045 } 3046 break; 3047 case Comment: 3048 if (isTemplateNode(node)) { 3049 nextNode = nextSibling(node); 3050 replaceNode( 3051 vnode.el = node.content.firstChild, 3052 node, 3053 parentComponent 3054 ); 3055 } else if (domType !== 8 || isFragmentStart) { 3056 nextNode = onMismatch(); 3057 } else { 3058 nextNode = nextSibling(node); 3059 } 3060 break; 3061 case Static: 3062 if (isFragmentStart) { 3063 node = nextSibling(node); 3064 domType = node.nodeType; 3065 } 3066 if (domType === 1 || domType === 3) { 3067 nextNode = node; 3068 const needToAdoptContent = !vnode.children.length; 3069 for (let i2 = 0; i2 < vnode.staticCount; i2++) { 3070 if (needToAdoptContent) 3071 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 3072 if (i2 === vnode.staticCount - 1) { 3073 vnode.anchor = nextNode; 3074 } 3075 nextNode = nextSibling(nextNode); 3076 } 3077 return isFragmentStart ? nextSibling(nextNode) : nextNode; 3078 } else { 3079 onMismatch(); 3080 } 3081 break; 3082 case Fragment: 3083 if (!isFragmentStart) { 3084 nextNode = onMismatch(); 3085 } else { 3086 nextNode = hydrateFragment( 3087 node, 3088 vnode, 3089 parentComponent, 3090 parentSuspense, 3091 slotScopeIds, 3092 optimized 3093 ); 3094 } 3095 break; 3096 default: 3097 if (shapeFlag & 1) { 3098 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 3099 nextNode = onMismatch(); 3100 } else { 3101 nextNode = hydrateElement( 3102 node, 3103 vnode, 3104 parentComponent, 3105 parentSuspense, 3106 slotScopeIds, 3107 optimized 3108 ); 3109 } 3110 } else if (shapeFlag & 6) { 3111 vnode.slotScopeIds = slotScopeIds; 3112 const container = parentNode(node); 3113 if (isFragmentStart) { 3114 nextNode = locateClosingAnchor(node); 3115 } else if (isComment(node) && node.data === "teleport start") { 3116 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 3117 } else { 3118 nextNode = nextSibling(node); 3119 } 3120 mountComponent( 3121 vnode, 3122 container, 3123 null, 3124 parentComponent, 3125 parentSuspense, 3126 getContainerType(container), 3127 optimized 3128 ); 3129 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { 3130 let subTree; 3131 if (isFragmentStart) { 3132 subTree = createVNode(Fragment); 3133 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 3134 } else { 3135 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 3136 } 3137 subTree.el = node; 3138 vnode.component.subTree = subTree; 3139 } 3140 } else if (shapeFlag & 64) { 3141 if (domType !== 8) { 3142 nextNode = onMismatch(); 3143 } else { 3144 nextNode = vnode.type.hydrate( 3145 node, 3146 vnode, 3147 parentComponent, 3148 parentSuspense, 3149 slotScopeIds, 3150 optimized, 3151 rendererInternals, 3152 hydrateChildren 3153 ); 3154 } 3155 } else if (shapeFlag & 128) { 3156 nextNode = vnode.type.hydrate( 3157 node, 3158 vnode, 3159 parentComponent, 3160 parentSuspense, 3161 getContainerType(parentNode(node)), 3162 slotScopeIds, 3163 optimized, 3164 rendererInternals, 3165 hydrateNode 3166 ); 3167 } else ; 3168 } 3169 if (ref3 != null) { 3170 setRef(ref3, null, parentSuspense, vnode); 3171 } 3172 return nextNode; 3173 }; 3174 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 3175 optimized = optimized || !!vnode.dynamicChildren; 3176 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 3177 const forcePatch = type === "input" || type === "option"; 3178 if (forcePatch || patchFlag !== -1) { 3179 if (dirs) { 3180 invokeDirectiveHook(vnode, null, parentComponent, "created"); 3181 } 3182 let needCallTransitionHooks = false;
vendor: 18,114 bytes, lines 3183-3798
3183 if (isTemplateNode(el)) { 3184 needCallTransitionHooks = needTransition( 3185 null, 3186 // no need check parentSuspense in hydration 3187 transition 3188 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 3189 const content = el.content.firstChild; 3190 if (needCallTransitionHooks) { 3191 transition.beforeEnter(content); 3192 } 3193 replaceNode(content, el, parentComponent); 3194 vnode.el = el = content; 3195 } 3196 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 3197 !(props && (props.innerHTML || props.textContent))) { 3198 let next = hydrateChildren( 3199 el.firstChild, 3200 vnode, 3201 el, 3202 parentComponent, 3203 parentSuspense, 3204 slotScopeIds, 3205 optimized 3206 ); 3207 while (next) { 3208 if (!isMismatchAllowed( 3209 el, 3210 1 3211 /* CHILDREN */ 3212 )) { 3213 logMismatchError(); 3214 } 3215 const cur = next; 3216 next = next.nextSibling; 3217 remove2(cur); 3218 } 3219 } else if (shapeFlag & 8) { 3220 let clientText = vnode.children; 3221 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { 3222 clientText = clientText.slice(1); 3223 } 3224 if (el.textContent !== clientText) { 3225 if (!isMismatchAllowed( 3226 el, 3227 0 3228 /* TEXT */ 3229 )) { 3230 logMismatchError(); 3231 } 3232 el.textContent = vnode.children; 3233 } 3234 } 3235 if (props) { 3236 if (forcePatch || !optimized || patchFlag & (16 | 32)) { 3237 const isCustomElement = el.tagName.includes("-"); 3238 for (const key in props) { 3239 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 3240 key[0] === "." || isCustomElement) { 3241 patchProp2(el, key, null, props[key], void 0, parentComponent); 3242 } 3243 } 3244 } else if (props.onClick) { 3245 patchProp2( 3246 el, 3247 "onClick", 3248 null, 3249 props.onClick, 3250 void 0, 3251 parentComponent 3252 ); 3253 } else if (patchFlag & 4 && isReactive(props.style)) { 3254 for (const key in props.style) props.style[key]; 3255 } 3256 } 3257 let vnodeHooks; 3258 if (vnodeHooks = props && props.onVnodeBeforeMount) { 3259 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 3260 } 3261 if (dirs) { 3262 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 3263 } 3264 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 3265 queueEffectWithSuspense(() => { 3266 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 3267 needCallTransitionHooks && transition.enter(el); 3268 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 3269 }, parentSuspense); 3270 } 3271 } 3272 return el.nextSibling; 3273 }; 3274 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 3275 optimized = optimized || !!parentVNode.dynamicChildren; 3276 const children = parentVNode.children; 3277 const l2 = children.length; 3278 for (let i2 = 0; i2 < l2; i2++) { 3279 const vnode = optimized ? children[i2] : children[i2] = normalizeVNode(children[i2]); 3280 const isText = vnode.type === Text; 3281 if (node) { 3282 if (isText && !optimized) { 3283 if (i2 + 1 < l2 && normalizeVNode(children[i2 + 1]).type === Text) { 3284 insert( 3285 createText( 3286 node.data.slice(vnode.children.length) 3287 ), 3288 container, 3289 nextSibling(node) 3290 ); 3291 node.data = vnode.children; 3292 } 3293 } 3294 node = hydrateNode( 3295 node, 3296 vnode, 3297 parentComponent, 3298 parentSuspense, 3299 slotScopeIds, 3300 optimized 3301 ); 3302 } else if (isText && !vnode.children) { 3303 insert(vnode.el = createText(""), container); 3304 } else { 3305 if (!isMismatchAllowed( 3306 container, 3307 1 3308 /* CHILDREN */ 3309 )) { 3310 logMismatchError(); 3311 } 3312 patch( 3313 null, 3314 vnode, 3315 container, 3316 null, 3317 parentComponent, 3318 parentSuspense, 3319 getContainerType(container), 3320 slotScopeIds 3321 ); 3322 } 3323 } 3324 return node; 3325 }; 3326 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 3327 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 3328 if (fragmentSlotScopeIds) { 3329 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 3330 } 3331 const container = parentNode(node); 3332 const next = hydrateChildren( 3333 nextSibling(node), 3334 vnode, 3335 container, 3336 parentComponent, 3337 parentSuspense, 3338 slotScopeIds, 3339 optimized 3340 ); 3341 if (next && isComment(next) && next.data === "]") { 3342 return nextSibling(vnode.anchor = next); 3343 } else { 3344 logMismatchError(); 3345 insert(vnode.anchor = createComment(`]`), container, next); 3346 return next; 3347 } 3348 }; 3349 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 3350 if (!isMismatchAllowed( 3351 node.parentElement, 3352 1 3353 /* CHILDREN */ 3354 )) { 3355 logMismatchError(); 3356 } 3357 vnode.el = null; 3358 if (isFragment) { 3359 const end = locateClosingAnchor(node); 3360 while (true) { 3361 const next2 = nextSibling(node); 3362 if (next2 && next2 !== end) { 3363 remove2(next2); 3364 } else { 3365 break; 3366 } 3367 } 3368 } 3369 const next = nextSibling(node); 3370 const container = parentNode(node); 3371 remove2(node); 3372 patch( 3373 null, 3374 vnode, 3375 container, 3376 next, 3377 parentComponent, 3378 parentSuspense, 3379 getContainerType(container), 3380 slotScopeIds 3381 ); 3382 if (parentComponent) { 3383 parentComponent.vnode.el = vnode.el; 3384 updateHOCHostEl(parentComponent, vnode.el); 3385 } 3386 return next; 3387 }; 3388 const locateClosingAnchor = (node, open2 = "[", close = "]") => { 3389 let match = 0; 3390 while (node) { 3391 node = nextSibling(node); 3392 if (node && isComment(node)) { 3393 if (node.data === open2) match++; 3394 if (node.data === close) { 3395 if (match === 0) { 3396 return nextSibling(node); 3397 } else { 3398 match--; 3399 } 3400 } 3401 } 3402 } 3403 return node; 3404 }; 3405 const replaceNode = (newNode, oldNode, parentComponent) => { 3406 const parentNode2 = oldNode.parentNode; 3407 if (parentNode2) { 3408 parentNode2.replaceChild(newNode, oldNode); 3409 } 3410 let parent = parentComponent; 3411 while (parent) { 3412 if (parent.vnode.el === oldNode) { 3413 parent.vnode.el = parent.subTree.el = newNode; 3414 } 3415 parent = parent.parent; 3416 } 3417 }; 3418 const isTemplateNode = (node) => { 3419 return node.nodeType === 1 && node.tagName === "TEMPLATE"; 3420 }; 3421 return [hydrate, hydrateNode]; 3422} 3423const allowMismatchAttr = "data-allow-mismatch"; 3424const MismatchTypeString = { 3425 [ 3426 0 3427 /* TEXT */ 3428 ]: "text", 3429 [ 3430 1 3431 /* CHILDREN */ 3432 ]: "children", 3433 [ 3434 2 3435 /* CLASS */ 3436 ]: "class", 3437 [ 3438 3 3439 /* STYLE */ 3440 ]: "style", 3441 [ 3442 4 3443 /* ATTRIBUTE */ 3444 ]: "attribute" 3445}; 3446function isMismatchAllowed(el, allowedType) { 3447 if (allowedType === 0 || allowedType === 1) { 3448 while (el && !el.hasAttribute(allowMismatchAttr)) { 3449 el = el.parentElement; 3450 } 3451 } 3452 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 3453 if (allowedAttr == null) { 3454 return false; 3455 } else if (allowedAttr === "") { 3456 return true; 3457 } else { 3458 const list = allowedAttr.split(","); 3459 if (allowedType === 0 && list.includes("children")) { 3460 return true; 3461 } 3462 return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); 3463 } 3464} 3465getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1)); 3466getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id)); 3467function forEachElement(node, cb) { 3468 if (isComment(node) && node.data === "[") { 3469 let depth = 1; 3470 let next = node.nextSibling; 3471 while (next) { 3472 if (next.nodeType === 1) { 3473 const result = cb(next); 3474 if (result === false) { 3475 break; 3476 } 3477 } else if (isComment(next)) { 3478 if (next.data === "]") { 3479 if (--depth === 0) break; 3480 } else if (next.data === "[") { 3481 depth++; 3482 } 3483 } 3484 next = next.nextSibling; 3485 } 3486 } else { 3487 cb(node); 3488 } 3489} 3490const isAsyncWrapper = (i2) => !!i2.type.__asyncLoader; 3491/*! #__NO_SIDE_EFFECTS__ */ 3492// @__NO_SIDE_EFFECTS__ 3493function defineAsyncComponent(source) { 3494 if (isFunction$1(source)) { 3495 source = { loader: source }; 3496 } 3497 const { 3498 loader, 3499 loadingComponent, 3500 errorComponent, 3501 delay = 200, 3502 hydrate: hydrateStrategy, 3503 timeout, 3504 // undefined = never times out 3505 suspensible = true, 3506 onError: userOnError 3507 } = source; 3508 let pendingRequest = null; 3509 let resolvedComp; 3510 let retries = 0; 3511 const retry = () => { 3512 retries++; 3513 pendingRequest = null; 3514 return load(); 3515 }; 3516 const load = () => { 3517 let thisRequest; 3518 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 3519 err = err instanceof Error ? err : new Error(String(err)); 3520 if (userOnError) { 3521 return new Promise((resolve2, reject) => { 3522 const userRetry = () => resolve2(retry()); 3523 const userFail = () => reject(err); 3524 userOnError(err, userRetry, userFail, retries + 1); 3525 }); 3526 } else { 3527 throw err; 3528 } 3529 }).then((comp) => { 3530 if (thisRequest !== pendingRequest && pendingRequest) { 3531 return pendingRequest; 3532 } 3533 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 3534 comp = comp.default; 3535 } 3536 resolvedComp = comp; 3537 return comp; 3538 })); 3539 }; 3540 return /* @__PURE__ */ defineComponent({ 3541 name: "AsyncComponentWrapper", 3542 __asyncLoader: load, 3543 __asyncHydrate(el, instance, hydrate) { 3544 const doHydrate = hydrateStrategy ? () => { 3545 const teardown = hydrateStrategy( 3546 hydrate, 3547 (cb) => forEachElement(el, cb) 3548 ); 3549 if (teardown) { 3550 (instance.bum || (instance.bum = [])).push(teardown); 3551 } 3552 } : hydrate; 3553 if (resolvedComp) { 3554 doHydrate(); 3555 } else { 3556 load().then(() => !instance.isUnmounted && doHydrate()); 3557 } 3558 }, 3559 get __asyncResolved() { 3560 return resolvedComp; 3561 }, 3562 setup() { 3563 const instance = currentInstance; 3564 markAsyncBoundary(instance); 3565 if (resolvedComp) { 3566 return () => createInnerComp(resolvedComp, instance); 3567 } 3568 const onError = (err) => { 3569 pendingRequest = null; 3570 handleError( 3571 err, 3572 instance, 3573 13, 3574 !errorComponent 3575 ); 3576 }; 3577 if (suspensible && instance.suspense || isInSSRComponentSetup) { 3578 return load().then((comp) => { 3579 return () => createInnerComp(comp, instance); 3580 }).catch((err) => { 3581 onError(err); 3582 return () => errorComponent ? createVNode(errorComponent, { 3583 error: err 3584 }) : null; 3585 }); 3586 } 3587 const loaded = ref(false); 3588 const error = ref(); 3589 const delayed = ref(!!delay); 3590 if (delay) { 3591 setTimeout(() => { 3592 delayed.value = false; 3593 }, delay); 3594 } 3595 if (timeout != null) { 3596 setTimeout(() => { 3597 if (!loaded.value && !error.value) { 3598 const err = new Error( 3599 `Async component timed out after ${timeout}ms.` 3600 ); 3601 onError(err); 3602 error.value = err; 3603 } 3604 }, timeout); 3605 } 3606 load().then(() => { 3607 loaded.value = true; 3608 if (instance.parent && isKeepAlive(instance.parent.vnode)) { 3609 instance.parent.update(); 3610 } 3611 }).catch((err) => { 3612 onError(err); 3613 error.value = err; 3614 }); 3615 return () => { 3616 if (loaded.value && resolvedComp) { 3617 return createInnerComp(resolvedComp, instance); 3618 } else if (error.value && errorComponent) { 3619 return createVNode(errorComponent, { 3620 error: error.value 3621 }); 3622 } else if (loadingComponent && !delayed.value) { 3623 return createVNode(loadingComponent); 3624 } 3625 }; 3626 } 3627 }); 3628} 3629function createInnerComp(comp, parent) { 3630 const { ref: ref22, props, children, ce } = parent.vnode; 3631 const vnode = createVNode(comp, props, children); 3632 vnode.ref = ref22; 3633 vnode.ce = ce; 3634 delete parent.vnode.ce; 3635 return vnode; 3636} 3637const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 3638const KeepAliveImpl = { 3639 name: `KeepAlive`, 3640 // Marker for special handling inside the renderer. We are not using a === 3641 // check directly on KeepAlive in the renderer, because importing it directly 3642 // would prevent it from being tree-shaken. 3643 __isKeepAlive: true, 3644 props: { 3645 include: [String, RegExp, Array], 3646 exclude: [String, RegExp, Array], 3647 max: [String, Number] 3648 }, 3649 setup(props, { slots }) { 3650 const instance = getCurrentInstance(); 3651 const sharedContext = instance.ctx; 3652 if (!sharedContext.renderer) { 3653 return () => { 3654 const children = slots.default && slots.default(); 3655 return children && children.length === 1 ? children[0] : children; 3656 }; 3657 } 3658 const cache = /* @__PURE__ */ new Map(); 3659 const keys = /* @__PURE__ */ new Set(); 3660 let current = null; 3661 const parentSuspense = instance.suspense; 3662 const { 3663 renderer: { 3664 p: patch, 3665 m: move, 3666 um: _unmount, 3667 o: { createElement } 3668 } 3669 } = sharedContext; 3670 const storageContainer = createElement("div"); 3671 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 3672 const instance2 = vnode.component; 3673 move(vnode, container, anchor, 0, parentSuspense); 3674 patch( 3675 instance2.vnode, 3676 vnode, 3677 container, 3678 anchor, 3679 instance2, 3680 parentSuspense, 3681 namespace, 3682 vnode.slotScopeIds, 3683 optimized 3684 ); 3685 queuePostRenderEffect(() => { 3686 instance2.isDeactivated = false; 3687 if (instance2.a) { 3688 invokeArrayFns(instance2.a); 3689 } 3690 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 3691 if (vnodeHook) { 3692 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 3693 } 3694 }, parentSuspense); 3695 }; 3696 sharedContext.deactivate = (vnode) => { 3697 const instance2 = vnode.component; 3698 invalidateMount(instance2.m); 3699 invalidateMount(instance2.a); 3700 move(vnode, storageContainer, null, 1, parentSuspense); 3701 queuePostRenderEffect(() => { 3702 if (instance2.da) { 3703 invokeArrayFns(instance2.da); 3704 } 3705 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 3706 if (vnodeHook) { 3707 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 3708 } 3709 instance2.isDeactivated = true; 3710 }, parentSuspense); 3711 }; 3712 function unmount(vnode) { 3713 resetShapeFlag(vnode); 3714 _unmount(vnode, instance, parentSuspense, true); 3715 } 3716 function pruneCache(filter2) { 3717 cache.forEach((vnode, key) => { 3718 const name = getComponentName(vnode.type); 3719 if (name && !filter2(name)) { 3720 pruneCacheEntry(key); 3721 } 3722 }); 3723 } 3724 function pruneCacheEntry(key) { 3725 const cached = cache.get(key); 3726 if (cached && (!current || !isSameVNodeType(cached, current))) { 3727 unmount(cached); 3728 } else if (current) { 3729 resetShapeFlag(current); 3730 } 3731 cache.delete(key); 3732 keys.delete(key); 3733 } 3734 watch( 3735 () => [props.include, props.exclude], 3736 ([include, exclude]) => { 3737 include && pruneCache((name) => matches(include, name)); 3738 exclude && pruneCache((name) => !matches(exclude, name)); 3739 }, 3740 // prune post-render after `current` has been updated 3741 { flush: "post", deep: true } 3742 ); 3743 let pendingCacheKey = null; 3744 const cacheSubtree = () => { 3745 if (pendingCacheKey != null) { 3746 if (isSuspense(instance.subTree.type)) { 3747 queuePostRenderEffect(() => { 3748 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 3749 }, instance.subTree.suspense); 3750 } else { 3751 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 3752 } 3753 } 3754 }; 3755 onMounted(cacheSubtree); 3756 onUpdated(cacheSubtree); 3757 onBeforeUnmount(() => { 3758 cache.forEach((cached) => { 3759 const { subTree, suspense } = instance; 3760 const vnode = getInnerChild(subTree); 3761 if (cached.type === vnode.type && cached.key === vnode.key) { 3762 resetShapeFlag(vnode); 3763 const da = vnode.component.da; 3764 da && queuePostRenderEffect(da, suspense); 3765 return; 3766 } 3767 unmount(cached); 3768 }); 3769 }); 3770 return () => { 3771 pendingCacheKey = null; 3772 if (!slots.default) { 3773 return current = null; 3774 } 3775 const children = slots.default(); 3776 const rawVNode = children[0]; 3777 if (children.length > 1) { 3778 current = null; 3779 return children; 3780 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 3781 current = null; 3782 return rawVNode; 3783 } 3784 let vnode = getInnerChild(rawVNode); 3785 if (vnode.type === Comment) { 3786 current = null; 3787 return vnode; 3788 } 3789 const comp = vnode.type; 3790 const name = getComponentName( 3791 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 3792 ); 3793 const { include, exclude, max } = props; 3794 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 3795 vnode.shapeFlag &= -257; 3796 current = vnode; 3797 return rawVNode; 3798 }
vendor: 1,495 bytes, lines 3799-3848
3799 const key = vnode.key == null ? comp : vnode.key; 3800 const cachedVNode = cache.get(key); 3801 if (vnode.el) { 3802 vnode = cloneVNode(vnode); 3803 if (rawVNode.shapeFlag & 128) { 3804 rawVNode.ssContent = vnode; 3805 } 3806 } 3807 pendingCacheKey = key; 3808 if (cachedVNode) { 3809 vnode.el = cachedVNode.el; 3810 vnode.component = cachedVNode.component; 3811 if (vnode.transition) { 3812 setTransitionHooks(vnode, vnode.transition); 3813 } 3814 vnode.shapeFlag |= 512; 3815 keys.delete(key); 3816 keys.add(key); 3817 } else { 3818 keys.add(key); 3819 if (max && keys.size > parseInt(max, 10)) { 3820 pruneCacheEntry(keys.values().next().value); 3821 } 3822 } 3823 vnode.shapeFlag |= 256; 3824 current = vnode; 3825 return isSuspense(rawVNode.type) ? rawVNode : vnode; 3826 }; 3827 } 3828}; 3829const KeepAlive = KeepAliveImpl; 3830function matches(pattern, name) { 3831 if (isArray$3(pattern)) { 3832 return pattern.some((p2) => matches(p2, name)); 3833 } else if (isString(pattern)) { 3834 return pattern.split(",").includes(name); 3835 } else if (isRegExp(pattern)) { 3836 pattern.lastIndex = 0; 3837 return pattern.test(name); 3838 } 3839 return false; 3840} 3841function onActivated(hook, target) { 3842 registerKeepAliveHook(hook, "a", target); 3843} 3844function onDeactivated(hook, target) { 3845 registerKeepAliveHook(hook, "da", target); 3846} 3847function registerKeepAliveHook(hook, type, target = currentInstance) { 3848 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
vendor: 3,788 bytes, lines 3849-3977
3849 let current = target; 3850 while (current) { 3851 if (current.isDeactivated) { 3852 return; 3853 } 3854 current = current.parent; 3855 } 3856 return hook(); 3857 }); 3858 injectHook(type, wrappedHook, target); 3859 if (target) { 3860 let current = target.parent; 3861 while (current && current.parent) { 3862 if (isKeepAlive(current.parent.vnode)) { 3863 injectToKeepAliveRoot(wrappedHook, type, target, current); 3864 } 3865 current = current.parent; 3866 } 3867 } 3868} 3869function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 3870 const injected = injectHook( 3871 type, 3872 hook, 3873 keepAliveRoot, 3874 true 3875 /* prepend */ 3876 ); 3877 onUnmounted(() => { 3878 remove(keepAliveRoot[type], injected); 3879 }, target); 3880} 3881function resetShapeFlag(vnode) { 3882 vnode.shapeFlag &= -257; 3883 vnode.shapeFlag &= -513; 3884} 3885function getInnerChild(vnode) { 3886 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 3887} 3888function injectHook(type, hook, target = currentInstance, prepend = false) { 3889 if (target) { 3890 const hooks = target[type] || (target[type] = []); 3891 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 3892 pauseTracking(); 3893 const reset = setCurrentInstance(target); 3894 const res = callWithAsyncErrorHandling(hook, target, type, args); 3895 reset(); 3896 resetTracking(); 3897 return res; 3898 }); 3899 if (prepend) { 3900 hooks.unshift(wrappedHook); 3901 } else { 3902 hooks.push(wrappedHook); 3903 } 3904 return wrappedHook; 3905 } 3906} 3907const createHook = (lifecycle) => (hook, target = currentInstance) => { 3908 if (!isInSSRComponentSetup || lifecycle === "sp") { 3909 injectHook(lifecycle, (...args) => hook(...args), target); 3910 } 3911}; 3912const onBeforeMount = createHook("bm"); 3913const onMounted = createHook("m"); 3914const onBeforeUpdate = createHook( 3915 "bu" 3916); 3917const onUpdated = createHook("u"); 3918const onBeforeUnmount = createHook( 3919 "bum" 3920); 3921const onUnmounted = createHook("um"); 3922const onServerPrefetch = createHook( 3923 "sp" 3924); 3925const onRenderTriggered = createHook("rtg"); 3926const onRenderTracked = createHook("rtc"); 3927function onErrorCaptured(hook, target = currentInstance) { 3928 injectHook("ec", hook, target); 3929} 3930const COMPONENTS = "components"; 3931function resolveComponent(name, maybeSelfReference) { 3932 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 3933} 3934const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 3935function resolveDynamicComponent(component) { 3936 if (isString(component)) { 3937 return resolveAsset(COMPONENTS, component, false) || component; 3938 } else { 3939 return component || NULL_DYNAMIC_COMPONENT; 3940 } 3941} 3942function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 3943 const instance = currentRenderingInstance || currentInstance; 3944 if (instance) { 3945 const Component = instance.type; 3946 { 3947 const selfName = getComponentName( 3948 Component, 3949 false 3950 ); 3951 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 3952 return Component; 3953 } 3954 } 3955 const res = ( 3956 // local registration 3957 // check instance[type] first which is resolved for options API 3958 resolve(instance[type] || Component[type], name) || // global registration 3959 resolve(instance.appContext[type], name) 3960 ); 3961 if (!res && maybeSelfReference) { 3962 return Component; 3963 } 3964 return res; 3965 } 3966} 3967function resolve(registry, name) { 3968 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 3969} 3970function renderList(source, renderItem, cache, index) { 3971 let ret; 3972 const cached = cache; 3973 const sourceIsArray = isArray$3(source); 3974 if (sourceIsArray || isString(source)) { 3975 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 3976 let needsWrap = false; 3977 let isReadonlySource = false;
3978 if (sourceIsReactiveArray) { 3979 needsWrap = !isShallow(source); 3980 isReadonlySource = isReadonly(source); 3981 source = shallowReadArray(source); 3982 } 3983 ret = new Array(source.length); 3984 for (let i2 = 0, l2 = source.length; i2 < l2; i2++) { 3985 ret[i2] = renderItem( 3986 needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i2])) : toReactive(source[i2]) : source[i2], 3987 i2, 3988 void 0, 3989 cached 3990 ); 3991 } 3992 } else if (typeof source === "number") { 3993 ret = new Array(source); 3994 for (let i2 = 0; i2 < source; i2++) { 3995 ret[i2] = renderItem(i2 + 1, i2, void 0, cached); 3996 } 3997 } else if (isObject(source)) { 3998 if (source[Symbol.iterator]) { 3999 ret = Array.from( 4000 source, 4001 (item, i2) => renderItem(item, i2, void 0, cached) 4002 ); 4003 } else { 4004 const keys = Object.keys(source); 4005 ret = new Array(keys.length); 4006 for (let i2 = 0, l2 = keys.length; i2 < l2; i2++) { 4007 const key = keys[i2]; 4008 ret[i2] = renderItem(source[key], key, i2, cached); 4009 } 4010 } 4011 } else { 4012 ret = []; 4013 } 4014 return ret; 4015}
vendor: 14,953 bytes, lines 4016-4526
4016function renderSlot(slots, name, props = {}, fallback, noSlotted) { 4017 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 4018 return openBlock(), createBlock( 4019 Fragment, 4020 null, 4021 [createVNode("slot", props, fallback)], 4022 64 4023 ); 4024 } 4025 let slot = slots[name]; 4026 if (slot && slot._c) { 4027 slot._d = false; 4028 } 4029 openBlock(); 4030 const validSlotContent = slot && ensureValidVNode(slot(props)); 4031 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch 4032 // key attached in the `createSlots` helper, respect that 4033 validSlotContent && validSlotContent.key; 4034 const rendered = createBlock( 4035 Fragment, 4036 { 4037 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content 4038 "" 4039 }, 4040 validSlotContent || [], 4041 validSlotContent && slots._ === 1 ? 64 : -2 4042 ); 4043 if (rendered.scopeId) { 4044 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 4045 } 4046 if (slot && slot._c) { 4047 slot._d = true; 4048 } 4049 return rendered; 4050} 4051function ensureValidVNode(vnodes) { 4052 return vnodes.some((child) => { 4053 if (!isVNode(child)) return true; 4054 if (child.type === Comment) return false; 4055 if (child.type === Fragment && !ensureValidVNode(child.children)) 4056 return false; 4057 return true; 4058 }) ? vnodes : null; 4059} 4060const getPublicInstance = (i2) => { 4061 if (!i2) return null; 4062 if (isStatefulComponent(i2)) return getComponentPublicInstance(i2); 4063 return getPublicInstance(i2.parent); 4064}; 4065const publicPropertiesMap = ( 4066 // Move PURE marker to new line to workaround compiler discarding it 4067 // due to type annotation 4068 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 4069 $: (i2) => i2, 4070 $el: (i2) => i2.vnode.el, 4071 $data: (i2) => i2.data, 4072 $props: (i2) => i2.props, 4073 $attrs: (i2) => i2.attrs, 4074 $slots: (i2) => i2.slots, 4075 $refs: (i2) => i2.refs, 4076 $parent: (i2) => getPublicInstance(i2.parent), 4077 $root: (i2) => getPublicInstance(i2.root), 4078 $host: (i2) => i2.ce, 4079 $emit: (i2) => i2.emit, 4080 $options: (i2) => resolveMergedOptions(i2), 4081 $forceUpdate: (i2) => i2.f || (i2.f = () => { 4082 queueJob(i2.update); 4083 }), 4084 $nextTick: (i2) => i2.n || (i2.n = nextTick.bind(i2.proxy)), 4085 $watch: (i2) => instanceWatch.bind(i2) 4086 }) 4087); 4088const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 4089const PublicInstanceProxyHandlers = { 4090 get({ _: instance }, key) { 4091 if (key === "__v_skip") { 4092 return true; 4093 } 4094 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 4095 let normalizedProps; 4096 if (key[0] !== "$") { 4097 const n2 = accessCache[key]; 4098 if (n2 !== void 0) { 4099 switch (n2) { 4100 case 1: 4101 return setupState[key]; 4102 case 2: 4103 return data[key]; 4104 case 4: 4105 return ctx[key]; 4106 case 3: 4107 return props[key]; 4108 } 4109 } else if (hasSetupBinding(setupState, key)) { 4110 accessCache[key] = 1; 4111 return setupState[key]; 4112 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 4113 accessCache[key] = 2; 4114 return data[key]; 4115 } else if ( 4116 // only cache other properties when instance has declared (thus stable) 4117 // props 4118 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 4119 ) { 4120 accessCache[key] = 3; 4121 return props[key]; 4122 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 4123 accessCache[key] = 4; 4124 return ctx[key]; 4125 } else if (shouldCacheAccess) { 4126 accessCache[key] = 0; 4127 } 4128 } 4129 const publicGetter = publicPropertiesMap[key]; 4130 let cssModule, globalProperties; 4131 if (publicGetter) { 4132 if (key === "$attrs") { 4133 track(instance.attrs, "get", ""); 4134 } 4135 return publicGetter(instance); 4136 } else if ( 4137 // css module (injected by vue-loader) 4138 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 4139 ) { 4140 return cssModule; 4141 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 4142 accessCache[key] = 4; 4143 return ctx[key]; 4144 } else if ( 4145 // global properties 4146 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 4147 ) { 4148 { 4149 return globalProperties[key]; 4150 } 4151 } else ; 4152 }, 4153 set({ _: instance }, key, value) { 4154 const { data, setupState, ctx } = instance; 4155 if (hasSetupBinding(setupState, key)) { 4156 setupState[key] = value; 4157 return true; 4158 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 4159 data[key] = value; 4160 return true; 4161 } else if (hasOwn(instance.props, key)) { 4162 return false; 4163 } 4164 if (key[0] === "$" && key.slice(1) in instance) { 4165 return false; 4166 } else { 4167 { 4168 ctx[key] = value; 4169 } 4170 } 4171 return true; 4172 }, 4173 has({ 4174 _: { data, setupState, accessCache, ctx, appContext, propsOptions } 4175 }, key) { 4176 let normalizedProps; 4177 return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); 4178 }, 4179 defineProperty(target, key, descriptor) { 4180 if (descriptor.get != null) { 4181 target._.accessCache[key] = 0; 4182 } else if (hasOwn(descriptor, "value")) { 4183 this.set(target, key, descriptor.value, null); 4184 } 4185 return Reflect.defineProperty(target, key, descriptor); 4186 } 4187}; 4188function normalizePropsOrEmits(props) { 4189 return isArray$3(props) ? props.reduce( 4190 (normalized, p2) => (normalized[p2] = null, normalized), 4191 {} 4192 ) : props; 4193} 4194function withAsyncContext(getAwaitable) { 4195 const ctx = getCurrentInstance(); 4196 let awaitable = getAwaitable(); 4197 unsetCurrentInstance(); 4198 if (isPromise$1(awaitable)) { 4199 awaitable = awaitable.catch((e2) => { 4200 setCurrentInstance(ctx); 4201 throw e2; 4202 }); 4203 } 4204 return [awaitable, () => setCurrentInstance(ctx)]; 4205} 4206let shouldCacheAccess = true; 4207function applyOptions(instance) { 4208 const options = resolveMergedOptions(instance); 4209 const publicThis = instance.proxy; 4210 const ctx = instance.ctx; 4211 shouldCacheAccess = false; 4212 if (options.beforeCreate) { 4213 callHook$1(options.beforeCreate, instance, "bc"); 4214 } 4215 const { 4216 // state 4217 data: dataOptions, 4218 computed: computedOptions, 4219 methods, 4220 watch: watchOptions, 4221 provide: provideOptions, 4222 inject: injectOptions, 4223 // lifecycle 4224 created, 4225 beforeMount, 4226 mounted, 4227 beforeUpdate, 4228 updated, 4229 activated, 4230 deactivated, 4231 beforeDestroy, 4232 beforeUnmount, 4233 destroyed, 4234 unmounted, 4235 render, 4236 renderTracked, 4237 renderTriggered, 4238 errorCaptured, 4239 serverPrefetch, 4240 // public API 4241 expose, 4242 inheritAttrs, 4243 // assets 4244 components, 4245 directives, 4246 filters 4247 } = options; 4248 const checkDuplicateProperties = null; 4249 if (injectOptions) { 4250 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 4251 } 4252 if (methods) { 4253 for (const key in methods) { 4254 const methodHandler = methods[key]; 4255 if (isFunction$1(methodHandler)) { 4256 { 4257 ctx[key] = methodHandler.bind(publicThis); 4258 } 4259 } 4260 } 4261 } 4262 if (dataOptions) { 4263 const data = dataOptions.call(publicThis, publicThis); 4264 if (!isObject(data)) ; 4265 else { 4266 instance.data = reactive(data); 4267 } 4268 } 4269 shouldCacheAccess = true; 4270 if (computedOptions) { 4271 for (const key in computedOptions) { 4272 const opt = computedOptions[key]; 4273 const get = isFunction$1(opt) ? opt.bind(publicThis, publicThis) : isFunction$1(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 4274 const set = !isFunction$1(opt) && isFunction$1(opt.set) ? opt.set.bind(publicThis) : NOOP; 4275 const c2 = computed({ 4276 get, 4277 set 4278 }); 4279 Object.defineProperty(ctx, key, { 4280 enumerable: true, 4281 configurable: true, 4282 get: () => c2.value, 4283 set: (v2) => c2.value = v2 4284 }); 4285 } 4286 } 4287 if (watchOptions) { 4288 for (const key in watchOptions) { 4289 createWatcher(watchOptions[key], ctx, publicThis, key); 4290 } 4291 } 4292 if (provideOptions) { 4293 const provides = isFunction$1(provideOptions) ? provideOptions.call(publicThis) : provideOptions; 4294 Reflect.ownKeys(provides).forEach((key) => { 4295 provide(key, provides[key]); 4296 }); 4297 } 4298 if (created) { 4299 callHook$1(created, instance, "c"); 4300 } 4301 function registerLifecycleHook(register, hook) { 4302 if (isArray$3(hook)) { 4303 hook.forEach((_hook) => register(_hook.bind(publicThis))); 4304 } else if (hook) { 4305 register(hook.bind(publicThis)); 4306 } 4307 } 4308 registerLifecycleHook(onBeforeMount, beforeMount); 4309 registerLifecycleHook(onMounted, mounted); 4310 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 4311 registerLifecycleHook(onUpdated, updated); 4312 registerLifecycleHook(onActivated, activated); 4313 registerLifecycleHook(onDeactivated, deactivated); 4314 registerLifecycleHook(onErrorCaptured, errorCaptured); 4315 registerLifecycleHook(onRenderTracked, renderTracked); 4316 registerLifecycleHook(onRenderTriggered, renderTriggered); 4317 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 4318 registerLifecycleHook(onUnmounted, unmounted); 4319 registerLifecycleHook(onServerPrefetch, serverPrefetch); 4320 if (isArray$3(expose)) { 4321 if (expose.length) { 4322 const exposed = instance.exposed || (instance.exposed = {}); 4323 expose.forEach((key) => { 4324 Object.defineProperty(exposed, key, { 4325 get: () => publicThis[key], 4326 set: (val) => publicThis[key] = val 4327 }); 4328 }); 4329 } else if (!instance.exposed) { 4330 instance.exposed = {}; 4331 } 4332 } 4333 if (render && instance.render === NOOP) { 4334 instance.render = render; 4335 } 4336 if (inheritAttrs != null) { 4337 instance.inheritAttrs = inheritAttrs; 4338 } 4339 if (components) instance.components = components; 4340 if (directives) instance.directives = directives; 4341 if (serverPrefetch) { 4342 markAsyncBoundary(instance); 4343 } 4344} 4345function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 4346 if (isArray$3(injectOptions)) { 4347 injectOptions = normalizeInject(injectOptions); 4348 } 4349 for (const key in injectOptions) { 4350 const opt = injectOptions[key]; 4351 let injected; 4352 if (isObject(opt)) { 4353 if ("default" in opt) { 4354 injected = inject( 4355 opt.from || key, 4356 opt.default, 4357 true 4358 ); 4359 } else { 4360 injected = inject(opt.from || key); 4361 } 4362 } else { 4363 injected = inject(opt); 4364 } 4365 if (isRef(injected)) { 4366 Object.defineProperty(ctx, key, { 4367 enumerable: true, 4368 configurable: true, 4369 get: () => injected.value, 4370 set: (v2) => injected.value = v2 4371 }); 4372 } else { 4373 ctx[key] = injected; 4374 } 4375 } 4376} 4377function callHook$1(hook, instance, type) { 4378 callWithAsyncErrorHandling( 4379 isArray$3(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy), 4380 instance, 4381 type 4382 ); 4383} 4384function createWatcher(raw, ctx, publicThis, key) { 4385 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 4386 if (isString(raw)) { 4387 const handler = ctx[raw]; 4388 if (isFunction$1(handler)) { 4389 { 4390 watch(getter, handler); 4391 } 4392 } 4393 } else if (isFunction$1(raw)) { 4394 { 4395 watch(getter, raw.bind(publicThis)); 4396 } 4397 } else if (isObject(raw)) { 4398 if (isArray$3(raw)) { 4399 raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key)); 4400 } else { 4401 const handler = isFunction$1(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 4402 if (isFunction$1(handler)) { 4403 watch(getter, handler, raw); 4404 } 4405 } 4406 } else ; 4407} 4408function resolveMergedOptions(instance) { 4409 const base = instance.type; 4410 const { mixins, extends: extendsOptions } = base; 4411 const { 4412 mixins: globalMixins, 4413 optionsCache: cache, 4414 config: { optionMergeStrategies } 4415 } = instance.appContext; 4416 const cached = cache.get(base); 4417 let resolved; 4418 if (cached) { 4419 resolved = cached; 4420 } else if (!globalMixins.length && !mixins && !extendsOptions) { 4421 { 4422 resolved = base; 4423 } 4424 } else { 4425 resolved = {}; 4426 if (globalMixins.length) { 4427 globalMixins.forEach( 4428 (m) => mergeOptions$1(resolved, m, optionMergeStrategies, true) 4429 ); 4430 } 4431 mergeOptions$1(resolved, base, optionMergeStrategies); 4432 } 4433 if (isObject(base)) { 4434 cache.set(base, resolved); 4435 } 4436 return resolved; 4437} 4438function mergeOptions$1(to, from2, strats, asMixin = false) { 4439 const { mixins, extends: extendsOptions } = from2; 4440 if (extendsOptions) { 4441 mergeOptions$1(to, extendsOptions, strats, true); 4442 } 4443 if (mixins) { 4444 mixins.forEach( 4445 (m) => mergeOptions$1(to, m, strats, true) 4446 ); 4447 } 4448 for (const key in from2) { 4449 if (asMixin && key === "expose") ; 4450 else { 4451 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 4452 to[key] = strat ? strat(to[key], from2[key]) : from2[key]; 4453 } 4454 } 4455 return to; 4456} 4457const internalOptionMergeStrats = { 4458 data: mergeDataFn, 4459 props: mergeEmitsOrPropsOptions, 4460 emits: mergeEmitsOrPropsOptions, 4461 // objects 4462 methods: mergeObjectOptions, 4463 computed: mergeObjectOptions, 4464 // lifecycle 4465 beforeCreate: mergeAsArray, 4466 created: mergeAsArray, 4467 beforeMount: mergeAsArray, 4468 mounted: mergeAsArray, 4469 beforeUpdate: mergeAsArray, 4470 updated: mergeAsArray, 4471 beforeDestroy: mergeAsArray, 4472 beforeUnmount: mergeAsArray, 4473 destroyed: mergeAsArray, 4474 unmounted: mergeAsArray, 4475 activated: mergeAsArray, 4476 deactivated: mergeAsArray, 4477 errorCaptured: mergeAsArray, 4478 serverPrefetch: mergeAsArray, 4479 // assets 4480 components: mergeObjectOptions, 4481 directives: mergeObjectOptions, 4482 // watch 4483 watch: mergeWatchOptions, 4484 // provide / inject 4485 provide: mergeDataFn, 4486 inject: mergeInject 4487}; 4488function mergeDataFn(to, from2) { 4489 if (!from2) { 4490 return to; 4491 } 4492 if (!to) { 4493 return from2; 4494 } 4495 return function mergedDataFn() { 4496 return extend( 4497 isFunction$1(to) ? to.call(this, this) : to, 4498 isFunction$1(from2) ? from2.call(this, this) : from2 4499 ); 4500 }; 4501} 4502function mergeInject(to, from2) { 4503 return mergeObjectOptions(normalizeInject(to), normalizeInject(from2)); 4504} 4505function normalizeInject(raw) { 4506 if (isArray$3(raw)) { 4507 const res = {}; 4508 for (let i2 = 0; i2 < raw.length; i2++) { 4509 res[raw[i2]] = raw[i2]; 4510 } 4511 return res; 4512 } 4513 return raw; 4514} 4515function mergeAsArray(to, from2) { 4516 return to ? [...new Set([].concat(to, from2))] : from2; 4517} 4518function mergeObjectOptions(to, from2) { 4519 return to ? extend(/* @__PURE__ */ Object.create(null), to, from2) : from2; 4520} 4521function mergeEmitsOrPropsOptions(to, from2) { 4522 if (to) { 4523 if (isArray$3(to) && isArray$3(from2)) { 4524 return [.../* @__PURE__ */ new Set([...to, ...from2])]; 4525 } 4526 return extend(
vendor: 6,162 bytes, lines 4527-4733
4527 /* @__PURE__ */ Object.create(null), 4528 normalizePropsOrEmits(to), 4529 normalizePropsOrEmits(from2 != null ? from2 : {}) 4530 ); 4531 } else { 4532 return from2; 4533 } 4534} 4535function mergeWatchOptions(to, from2) { 4536 if (!to) return from2; 4537 if (!from2) return to; 4538 const merged = extend(/* @__PURE__ */ Object.create(null), to); 4539 for (const key in from2) { 4540 merged[key] = mergeAsArray(to[key], from2[key]); 4541 } 4542 return merged; 4543} 4544function createAppContext() { 4545 return { 4546 app: null, 4547 config: { 4548 isNativeTag: NO, 4549 performance: false, 4550 globalProperties: {}, 4551 optionMergeStrategies: {}, 4552 errorHandler: void 0, 4553 warnHandler: void 0, 4554 compilerOptions: {} 4555 }, 4556 mixins: [], 4557 components: {}, 4558 directives: {}, 4559 provides: /* @__PURE__ */ Object.create(null), 4560 optionsCache: /* @__PURE__ */ new WeakMap(), 4561 propsCache: /* @__PURE__ */ new WeakMap(), 4562 emitsCache: /* @__PURE__ */ new WeakMap() 4563 }; 4564} 4565let uid$1 = 0; 4566function createAppAPI(render, hydrate) { 4567 return function createApp2(rootComponent, rootProps = null) { 4568 if (!isFunction$1(rootComponent)) { 4569 rootComponent = extend({}, rootComponent); 4570 } 4571 if (rootProps != null && !isObject(rootProps)) { 4572 rootProps = null; 4573 } 4574 const context = createAppContext(); 4575 const installedPlugins = /* @__PURE__ */ new WeakSet(); 4576 const pluginCleanupFns = []; 4577 let isMounted = false; 4578 const app = context.app = { 4579 _uid: uid$1++, 4580 _component: rootComponent, 4581 _props: rootProps, 4582 _container: null, 4583 _context: context, 4584 _instance: null, 4585 version, 4586 get config() { 4587 return context.config; 4588 }, 4589 set config(v2) { 4590 }, 4591 use(plugin2, ...options) { 4592 if (installedPlugins.has(plugin2)) ; 4593 else if (plugin2 && isFunction$1(plugin2.install)) { 4594 installedPlugins.add(plugin2); 4595 plugin2.install(app, ...options); 4596 } else if (isFunction$1(plugin2)) { 4597 installedPlugins.add(plugin2); 4598 plugin2(app, ...options); 4599 } else ; 4600 return app; 4601 }, 4602 mixin(mixin) { 4603 { 4604 if (!context.mixins.includes(mixin)) { 4605 context.mixins.push(mixin); 4606 } 4607 } 4608 return app; 4609 }, 4610 component(name, component) { 4611 if (!component) { 4612 return context.components[name]; 4613 } 4614 context.components[name] = component; 4615 return app; 4616 }, 4617 directive(name, directive) { 4618 if (!directive) { 4619 return context.directives[name]; 4620 } 4621 context.directives[name] = directive; 4622 return app; 4623 }, 4624 mount(rootContainer, isHydrate, namespace) { 4625 if (!isMounted) { 4626 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 4627 vnode.appContext = context; 4628 if (namespace === true) { 4629 namespace = "svg"; 4630 } else if (namespace === false) { 4631 namespace = void 0; 4632 } 4633 if (isHydrate && hydrate) { 4634 hydrate(vnode, rootContainer); 4635 } else { 4636 render(vnode, rootContainer, namespace); 4637 } 4638 isMounted = true; 4639 app._container = rootContainer; 4640 rootContainer.__vue_app__ = app; 4641 return getComponentPublicInstance(vnode.component); 4642 } 4643 }, 4644 onUnmount(cleanupFn) { 4645 pluginCleanupFns.push(cleanupFn); 4646 }, 4647 unmount() { 4648 if (isMounted) { 4649 callWithAsyncErrorHandling( 4650 pluginCleanupFns, 4651 app._instance, 4652 16 4653 ); 4654 render(null, app._container); 4655 delete app._container.__vue_app__; 4656 } 4657 }, 4658 provide(key, value) { 4659 context.provides[key] = value; 4660 return app; 4661 }, 4662 runWithContext(fn) { 4663 const lastApp = currentApp; 4664 currentApp = app; 4665 try { 4666 return fn(); 4667 } finally { 4668 currentApp = lastApp; 4669 } 4670 } 4671 }; 4672 return app; 4673 }; 4674} 4675let currentApp = null; 4676function provide(key, value) { 4677 if (!currentInstance) ; 4678 else { 4679 let provides = currentInstance.provides; 4680 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 4681 if (parentProvides === provides) { 4682 provides = currentInstance.provides = Object.create(parentProvides); 4683 } 4684 provides[key] = value; 4685 } 4686} 4687function inject(key, defaultValue, treatDefaultAsFactory = false) { 4688 const instance = currentInstance || currentRenderingInstance; 4689 if (instance || currentApp) { 4690 const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 4691 if (provides && key in provides) { 4692 return provides[key]; 4693 } else if (arguments.length > 1) { 4694 return treatDefaultAsFactory && isFunction$1(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 4695 } else ; 4696 } 4697} 4698function hasInjectionContext() { 4699 return !!(currentInstance || currentRenderingInstance || currentApp); 4700} 4701const internalObjectProto = {}; 4702const createInternalObject = () => Object.create(internalObjectProto); 4703const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 4704function initProps(instance, rawProps, isStateful, isSSR = false) { 4705 const props = {}; 4706 const attrs = createInternalObject(); 4707 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 4708 setFullProps(instance, rawProps, props, attrs); 4709 for (const key in instance.propsOptions[0]) { 4710 if (!(key in props)) { 4711 props[key] = void 0; 4712 } 4713 } 4714 if (isStateful) { 4715 instance.props = isSSR ? props : shallowReactive(props); 4716 } else { 4717 if (!instance.type.props) { 4718 instance.props = attrs; 4719 } else { 4720 instance.props = props; 4721 } 4722 } 4723 instance.attrs = attrs; 4724} 4725function updateProps(instance, rawProps, rawPrevProps, optimized) { 4726 const { 4727 props, 4728 attrs, 4729 vnode: { patchFlag } 4730 } = instance; 4731 const rawCurrentProps = toRaw(props); 4732 const [options] = instance.propsOptions; 4733 let hasAttrsChanged = false;
vendor: 4,458 bytes, lines 4734-4886
4734 if ( 4735 // always force full diff in dev 4736 // - #1942 if hmr is enabled with sfc component 4737 // - vite#872 non-sfc component used by sfc component 4738 (optimized || patchFlag > 0) && !(patchFlag & 16) 4739 ) { 4740 if (patchFlag & 8) { 4741 const propsToUpdate = instance.vnode.dynamicProps; 4742 for (let i2 = 0; i2 < propsToUpdate.length; i2++) { 4743 let key = propsToUpdate[i2]; 4744 if (isEmitListener(instance.emitsOptions, key)) { 4745 continue; 4746 } 4747 const value = rawProps[key]; 4748 if (options) { 4749 if (hasOwn(attrs, key)) { 4750 if (value !== attrs[key]) { 4751 attrs[key] = value; 4752 hasAttrsChanged = true; 4753 } 4754 } else { 4755 const camelizedKey = camelize(key); 4756 props[camelizedKey] = resolvePropValue( 4757 options, 4758 rawCurrentProps, 4759 camelizedKey, 4760 value, 4761 instance, 4762 false 4763 ); 4764 } 4765 } else { 4766 if (value !== attrs[key]) { 4767 attrs[key] = value; 4768 hasAttrsChanged = true; 4769 } 4770 } 4771 } 4772 } 4773 } else { 4774 if (setFullProps(instance, rawProps, props, attrs)) { 4775 hasAttrsChanged = true; 4776 } 4777 let kebabKey; 4778 for (const key in rawCurrentProps) { 4779 if (!rawProps || // for camelCase 4780 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 4781 // and converted to camelCase (#955) 4782 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 4783 if (options) { 4784 if (rawPrevProps && // for camelCase 4785 (rawPrevProps[key] !== void 0 || // for kebab-case 4786 rawPrevProps[kebabKey] !== void 0)) { 4787 props[key] = resolvePropValue( 4788 options, 4789 rawCurrentProps, 4790 key, 4791 void 0, 4792 instance, 4793 true 4794 ); 4795 } 4796 } else { 4797 delete props[key]; 4798 } 4799 } 4800 } 4801 if (attrs !== rawCurrentProps) { 4802 for (const key in attrs) { 4803 if (!rawProps || !hasOwn(rawProps, key) && true) { 4804 delete attrs[key]; 4805 hasAttrsChanged = true; 4806 } 4807 } 4808 } 4809 } 4810 if (hasAttrsChanged) { 4811 trigger(instance.attrs, "set", ""); 4812 } 4813} 4814function setFullProps(instance, rawProps, props, attrs) { 4815 const [options, needCastKeys] = instance.propsOptions; 4816 let hasAttrsChanged = false; 4817 let rawCastValues; 4818 if (rawProps) { 4819 for (let key in rawProps) { 4820 if (isReservedProp(key)) { 4821 continue; 4822 } 4823 const value = rawProps[key]; 4824 let camelKey; 4825 if (options && hasOwn(options, camelKey = camelize(key))) { 4826 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 4827 props[camelKey] = value; 4828 } else { 4829 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 4830 } 4831 } else if (!isEmitListener(instance.emitsOptions, key)) { 4832 if (!(key in attrs) || value !== attrs[key]) { 4833 attrs[key] = value; 4834 hasAttrsChanged = true; 4835 } 4836 } 4837 } 4838 } 4839 if (needCastKeys) { 4840 const rawCurrentProps = toRaw(props); 4841 const castValues = rawCastValues || EMPTY_OBJ; 4842 for (let i2 = 0; i2 < needCastKeys.length; i2++) { 4843 const key = needCastKeys[i2]; 4844 props[key] = resolvePropValue( 4845 options, 4846 rawCurrentProps, 4847 key, 4848 castValues[key], 4849 instance, 4850 !hasOwn(castValues, key) 4851 ); 4852 } 4853 } 4854 return hasAttrsChanged; 4855} 4856function resolvePropValue(options, props, key, value, instance, isAbsent) { 4857 const opt = options[key]; 4858 if (opt != null) { 4859 const hasDefault = hasOwn(opt, "default"); 4860 if (hasDefault && value === void 0) { 4861 const defaultValue = opt.default; 4862 if (opt.type !== Function && !opt.skipFactory && isFunction$1(defaultValue)) { 4863 const { propsDefaults } = instance; 4864 if (key in propsDefaults) { 4865 value = propsDefaults[key]; 4866 } else { 4867 const reset = setCurrentInstance(instance); 4868 value = propsDefaults[key] = defaultValue.call( 4869 null, 4870 props 4871 ); 4872 reset(); 4873 } 4874 } else { 4875 value = defaultValue; 4876 } 4877 if (instance.ce) { 4878 instance.ce._setProp(key, value); 4879 } 4880 } 4881 if (opt[ 4882 0 4883 /* shouldCast */ 4884 ]) { 4885 if (isAbsent && !hasDefault) { 4886 value = false;
vendor: 15,408 bytes, lines 4887-5422
4887 } else if (opt[ 4888 1 4889 /* shouldCastTrue */ 4890 ] && (value === "" || value === hyphenate(key))) { 4891 value = true; 4892 } 4893 } 4894 } 4895 return value; 4896} 4897const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 4898function normalizePropsOptions(comp, appContext, asMixin = false) { 4899 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 4900 const cached = cache.get(comp); 4901 if (cached) { 4902 return cached; 4903 } 4904 const raw = comp.props; 4905 const normalized = {}; 4906 const needCastKeys = []; 4907 let hasExtends = false; 4908 if (!isFunction$1(comp)) { 4909 const extendProps = (raw2) => { 4910 hasExtends = true; 4911 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 4912 extend(normalized, props); 4913 if (keys) needCastKeys.push(...keys); 4914 }; 4915 if (!asMixin && appContext.mixins.length) { 4916 appContext.mixins.forEach(extendProps); 4917 } 4918 if (comp.extends) { 4919 extendProps(comp.extends); 4920 } 4921 if (comp.mixins) { 4922 comp.mixins.forEach(extendProps); 4923 } 4924 } 4925 if (!raw && !hasExtends) { 4926 if (isObject(comp)) { 4927 cache.set(comp, EMPTY_ARR); 4928 } 4929 return EMPTY_ARR; 4930 } 4931 if (isArray$3(raw)) { 4932 for (let i2 = 0; i2 < raw.length; i2++) { 4933 const normalizedKey = camelize(raw[i2]); 4934 if (validatePropName(normalizedKey)) { 4935 normalized[normalizedKey] = EMPTY_OBJ; 4936 } 4937 } 4938 } else if (raw) { 4939 for (const key in raw) { 4940 const normalizedKey = camelize(key); 4941 if (validatePropName(normalizedKey)) { 4942 const opt = raw[key]; 4943 const prop = normalized[normalizedKey] = isArray$3(opt) || isFunction$1(opt) ? { type: opt } : extend({}, opt); 4944 const propType = prop.type; 4945 let shouldCast = false; 4946 let shouldCastTrue = true; 4947 if (isArray$3(propType)) { 4948 for (let index = 0; index < propType.length; ++index) { 4949 const type = propType[index]; 4950 const typeName = isFunction$1(type) && type.name; 4951 if (typeName === "Boolean") { 4952 shouldCast = true; 4953 break; 4954 } else if (typeName === "String") { 4955 shouldCastTrue = false; 4956 } 4957 } 4958 } else { 4959 shouldCast = isFunction$1(propType) && propType.name === "Boolean"; 4960 } 4961 prop[ 4962 0 4963 /* shouldCast */ 4964 ] = shouldCast; 4965 prop[ 4966 1 4967 /* shouldCastTrue */ 4968 ] = shouldCastTrue; 4969 if (shouldCast || hasOwn(prop, "default")) { 4970 needCastKeys.push(normalizedKey); 4971 } 4972 } 4973 } 4974 } 4975 const res = [normalized, needCastKeys]; 4976 if (isObject(comp)) { 4977 cache.set(comp, res); 4978 } 4979 return res; 4980} 4981function validatePropName(key) { 4982 if (key[0] !== "$" && !isReservedProp(key)) { 4983 return true; 4984 } 4985 return false; 4986} 4987const isInternalKey = (key) => key[0] === "_" || key === "$stable"; 4988const normalizeSlotValue = (value) => isArray$3(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 4989const normalizeSlot$2 = (key, rawSlot, ctx) => { 4990 if (rawSlot._n) { 4991 return rawSlot; 4992 } 4993 const normalized = withCtx((...args) => { 4994 if (false) ; 4995 return normalizeSlotValue(rawSlot(...args)); 4996 }, ctx); 4997 normalized._c = false; 4998 return normalized; 4999}; 5000const normalizeObjectSlots = (rawSlots, slots, instance) => { 5001 const ctx = rawSlots._ctx; 5002 for (const key in rawSlots) { 5003 if (isInternalKey(key)) continue; 5004 const value = rawSlots[key]; 5005 if (isFunction$1(value)) { 5006 slots[key] = normalizeSlot$2(key, value, ctx); 5007 } else if (value != null) { 5008 const normalized = normalizeSlotValue(value); 5009 slots[key] = () => normalized; 5010 } 5011 } 5012}; 5013const normalizeVNodeSlots = (instance, children) => { 5014 const normalized = normalizeSlotValue(children); 5015 instance.slots.default = () => normalized; 5016}; 5017const assignSlots = (slots, children, optimized) => { 5018 for (const key in children) { 5019 if (optimized || !isInternalKey(key)) { 5020 slots[key] = children[key]; 5021 } 5022 } 5023}; 5024const initSlots = (instance, children, optimized) => { 5025 const slots = instance.slots = createInternalObject(); 5026 if (instance.vnode.shapeFlag & 32) { 5027 const type = children._; 5028 if (type) { 5029 assignSlots(slots, children, optimized); 5030 if (optimized) { 5031 def(slots, "_", type, true); 5032 } 5033 } else { 5034 normalizeObjectSlots(children, slots); 5035 } 5036 } else if (children) { 5037 normalizeVNodeSlots(instance, children); 5038 } 5039}; 5040const updateSlots = (instance, children, optimized) => { 5041 const { vnode, slots } = instance; 5042 let needDeletionCheck = true; 5043 let deletionComparisonTarget = EMPTY_OBJ; 5044 if (vnode.shapeFlag & 32) { 5045 const type = children._; 5046 if (type) { 5047 if (optimized && type === 1) { 5048 needDeletionCheck = false; 5049 } else { 5050 assignSlots(slots, children, optimized); 5051 } 5052 } else { 5053 needDeletionCheck = !children.$stable; 5054 normalizeObjectSlots(children, slots); 5055 } 5056 deletionComparisonTarget = children; 5057 } else if (children) { 5058 normalizeVNodeSlots(instance, children); 5059 deletionComparisonTarget = { default: 1 }; 5060 } 5061 if (needDeletionCheck) { 5062 for (const key in slots) { 5063 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 5064 delete slots[key]; 5065 } 5066 } 5067 } 5068}; 5069const queuePostRenderEffect = queueEffectWithSuspense; 5070function createRenderer(options) { 5071 return baseCreateRenderer(options); 5072} 5073function createHydrationRenderer(options) { 5074 return baseCreateRenderer(options, createHydrationFunctions); 5075} 5076function baseCreateRenderer(options, createHydrationFns) { 5077 const target = getGlobalThis(); 5078 target.__VUE__ = true; 5079 const { 5080 insert: hostInsert, 5081 remove: hostRemove, 5082 patchProp: hostPatchProp, 5083 createElement: hostCreateElement, 5084 createText: hostCreateText, 5085 createComment: hostCreateComment, 5086 setText: hostSetText, 5087 setElementText: hostSetElementText, 5088 parentNode: hostParentNode, 5089 nextSibling: hostNextSibling, 5090 setScopeId: hostSetScopeId = NOOP, 5091 insertStaticContent: hostInsertStaticContent 5092 } = options; 5093 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!n2.dynamicChildren) => { 5094 if (n1 === n2) { 5095 return; 5096 } 5097 if (n1 && !isSameVNodeType(n1, n2)) { 5098 anchor = getNextHostNode(n1); 5099 unmount(n1, parentComponent, parentSuspense, true); 5100 n1 = null; 5101 } 5102 if (n2.patchFlag === -2) { 5103 optimized = false; 5104 n2.dynamicChildren = null; 5105 } 5106 const { type, ref: ref3, shapeFlag } = n2; 5107 switch (type) { 5108 case Text: 5109 processText(n1, n2, container, anchor); 5110 break; 5111 case Comment: 5112 processCommentNode(n1, n2, container, anchor); 5113 break; 5114 case Static: 5115 if (n1 == null) { 5116 mountStaticNode(n2, container, anchor, namespace); 5117 } 5118 break; 5119 case Fragment: 5120 processFragment( 5121 n1, 5122 n2, 5123 container, 5124 anchor, 5125 parentComponent, 5126 parentSuspense, 5127 namespace, 5128 slotScopeIds, 5129 optimized 5130 ); 5131 break; 5132 default: 5133 if (shapeFlag & 1) { 5134 processElement( 5135 n1, 5136 n2, 5137 container, 5138 anchor, 5139 parentComponent, 5140 parentSuspense, 5141 namespace, 5142 slotScopeIds, 5143 optimized 5144 ); 5145 } else if (shapeFlag & 6) { 5146 processComponent( 5147 n1, 5148 n2, 5149 container, 5150 anchor, 5151 parentComponent, 5152 parentSuspense, 5153 namespace, 5154 slotScopeIds, 5155 optimized 5156 ); 5157 } else if (shapeFlag & 64) { 5158 type.process( 5159 n1, 5160 n2, 5161 container, 5162 anchor, 5163 parentComponent, 5164 parentSuspense, 5165 namespace, 5166 slotScopeIds, 5167 optimized, 5168 internals 5169 ); 5170 } else if (shapeFlag & 128) { 5171 type.process( 5172 n1, 5173 n2, 5174 container, 5175 anchor, 5176 parentComponent, 5177 parentSuspense, 5178 namespace, 5179 slotScopeIds, 5180 optimized, 5181 internals 5182 ); 5183 } else ; 5184 } 5185 if (ref3 != null && parentComponent) { 5186 setRef(ref3, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 5187 } 5188 }; 5189 const processText = (n1, n2, container, anchor) => { 5190 if (n1 == null) { 5191 hostInsert( 5192 n2.el = hostCreateText(n2.children), 5193 container, 5194 anchor 5195 ); 5196 } else { 5197 const el = n2.el = n1.el; 5198 if (n2.children !== n1.children) { 5199 hostSetText(el, n2.children); 5200 } 5201 } 5202 }; 5203 const processCommentNode = (n1, n2, container, anchor) => { 5204 if (n1 == null) { 5205 hostInsert( 5206 n2.el = hostCreateComment(n2.children || ""), 5207 container, 5208 anchor 5209 ); 5210 } else { 5211 n2.el = n1.el; 5212 } 5213 }; 5214 const mountStaticNode = (n2, container, anchor, namespace) => { 5215 [n2.el, n2.anchor] = hostInsertStaticContent( 5216 n2.children, 5217 container, 5218 anchor, 5219 namespace, 5220 n2.el, 5221 n2.anchor 5222 ); 5223 }; 5224 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 5225 let next; 5226 while (el && el !== anchor) { 5227 next = hostNextSibling(el); 5228 hostInsert(el, container, nextSibling); 5229 el = next; 5230 } 5231 hostInsert(anchor, container, nextSibling); 5232 }; 5233 const removeStaticNode = ({ el, anchor }) => { 5234 let next; 5235 while (el && el !== anchor) { 5236 next = hostNextSibling(el); 5237 hostRemove(el); 5238 el = next; 5239 } 5240 hostRemove(anchor); 5241 }; 5242 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5243 if (n2.type === "svg") { 5244 namespace = "svg"; 5245 } else if (n2.type === "math") { 5246 namespace = "mathml"; 5247 } 5248 if (n1 == null) { 5249 mountElement( 5250 n2, 5251 container, 5252 anchor, 5253 parentComponent, 5254 parentSuspense, 5255 namespace, 5256 slotScopeIds, 5257 optimized 5258 ); 5259 } else { 5260 patchElement( 5261 n1, 5262 n2, 5263 parentComponent, 5264 parentSuspense, 5265 namespace, 5266 slotScopeIds, 5267 optimized 5268 ); 5269 } 5270 }; 5271 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5272 let el; 5273 let vnodeHook; 5274 const { props, shapeFlag, transition, dirs } = vnode; 5275 el = vnode.el = hostCreateElement( 5276 vnode.type, 5277 namespace, 5278 props && props.is, 5279 props 5280 ); 5281 if (shapeFlag & 8) { 5282 hostSetElementText(el, vnode.children); 5283 } else if (shapeFlag & 16) { 5284 mountChildren( 5285 vnode.children, 5286 el, 5287 null, 5288 parentComponent, 5289 parentSuspense, 5290 resolveChildrenNamespace(vnode, namespace), 5291 slotScopeIds, 5292 optimized 5293 ); 5294 } 5295 if (dirs) { 5296 invokeDirectiveHook(vnode, null, parentComponent, "created"); 5297 } 5298 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 5299 if (props) { 5300 for (const key in props) { 5301 if (key !== "value" && !isReservedProp(key)) { 5302 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 5303 } 5304 } 5305 if ("value" in props) { 5306 hostPatchProp(el, "value", null, props.value, namespace); 5307 } 5308 if (vnodeHook = props.onVnodeBeforeMount) { 5309 invokeVNodeHook(vnodeHook, parentComponent, vnode); 5310 } 5311 } 5312 if (dirs) { 5313 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 5314 } 5315 const needCallTransitionHooks = needTransition(parentSuspense, transition); 5316 if (needCallTransitionHooks) { 5317 transition.beforeEnter(el); 5318 } 5319 hostInsert(el, container, anchor); 5320 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 5321 queuePostRenderEffect(() => { 5322 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 5323 needCallTransitionHooks && transition.enter(el); 5324 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 5325 }, parentSuspense); 5326 } 5327 }; 5328 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 5329 if (scopeId) { 5330 hostSetScopeId(el, scopeId); 5331 } 5332 if (slotScopeIds) { 5333 for (let i2 = 0; i2 < slotScopeIds.length; i2++) { 5334 hostSetScopeId(el, slotScopeIds[i2]); 5335 } 5336 } 5337 if (parentComponent) { 5338 let subTree = parentComponent.subTree; 5339 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 5340 const parentVNode = parentComponent.vnode; 5341 setScopeId( 5342 el, 5343 parentVNode, 5344 parentVNode.scopeId, 5345 parentVNode.slotScopeIds, 5346 parentComponent.parent 5347 ); 5348 } 5349 } 5350 }; 5351 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 5352 for (let i2 = start; i2 < children.length; i2++) { 5353 const child = children[i2] = optimized ? cloneIfMounted(children[i2]) : normalizeVNode(children[i2]); 5354 patch( 5355 null, 5356 child, 5357 container, 5358 anchor, 5359 parentComponent, 5360 parentSuspense, 5361 namespace, 5362 slotScopeIds, 5363 optimized 5364 ); 5365 } 5366 }; 5367 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5368 const el = n2.el = n1.el; 5369 let { patchFlag, dynamicChildren, dirs } = n2; 5370 patchFlag |= n1.patchFlag & 16; 5371 const oldProps = n1.props || EMPTY_OBJ; 5372 const newProps = n2.props || EMPTY_OBJ; 5373 let vnodeHook; 5374 parentComponent && toggleRecurse(parentComponent, false); 5375 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 5376 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 5377 } 5378 if (dirs) { 5379 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 5380 } 5381 parentComponent && toggleRecurse(parentComponent, true); 5382 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 5383 hostSetElementText(el, ""); 5384 } 5385 if (dynamicChildren) { 5386 patchBlockChildren( 5387 n1.dynamicChildren, 5388 dynamicChildren, 5389 el, 5390 parentComponent, 5391 parentSuspense, 5392 resolveChildrenNamespace(n2, namespace), 5393 slotScopeIds 5394 ); 5395 } else if (!optimized) { 5396 patchChildren( 5397 n1, 5398 n2, 5399 el, 5400 null, 5401 parentComponent, 5402 parentSuspense, 5403 resolveChildrenNamespace(n2, namespace), 5404 slotScopeIds, 5405 false 5406 ); 5407 } 5408 if (patchFlag > 0) { 5409 if (patchFlag & 16) { 5410 patchProps(el, oldProps, newProps, parentComponent, namespace); 5411 } else { 5412 if (patchFlag & 2) { 5413 if (oldProps.class !== newProps.class) { 5414 hostPatchProp(el, "class", null, newProps.class, namespace); 5415 } 5416 } 5417 if (patchFlag & 4) { 5418 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 5419 } 5420 if (patchFlag & 8) { 5421 const propsToUpdate = n2.dynamicProps; 5422 for (let i2 = 0; i2 < propsToUpdate.length; i2++) {
vendor: 4,703 bytes, lines 5423-5546
5423 const key = propsToUpdate[i2]; 5424 const prev = oldProps[key]; 5425 const next = newProps[key]; 5426 if (next !== prev || key === "value") { 5427 hostPatchProp(el, key, prev, next, namespace, parentComponent); 5428 } 5429 } 5430 } 5431 } 5432 if (patchFlag & 1) { 5433 if (n1.children !== n2.children) { 5434 hostSetElementText(el, n2.children); 5435 } 5436 } 5437 } else if (!optimized && dynamicChildren == null) { 5438 patchProps(el, oldProps, newProps, parentComponent, namespace); 5439 } 5440 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 5441 queuePostRenderEffect(() => { 5442 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 5443 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 5444 }, parentSuspense); 5445 } 5446 }; 5447 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 5448 for (let i2 = 0; i2 < newChildren.length; i2++) { 5449 const oldVNode = oldChildren[i2]; 5450 const newVNode = newChildren[i2]; 5451 const container = ( 5452 // oldVNode may be an errored async setup() component inside Suspense 5453 // which will not have a mounted element 5454 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 5455 // of the Fragment itself so it can move its children. 5456 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 5457 // which also requires the correct parent container 5458 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 5459 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( 5460 // In other cases, the parent container is not actually used so we 5461 // just pass the block element here to avoid a DOM parentNode call. 5462 fallbackContainer 5463 ) 5464 ); 5465 patch( 5466 oldVNode, 5467 newVNode, 5468 container, 5469 null, 5470 parentComponent, 5471 parentSuspense, 5472 namespace, 5473 slotScopeIds, 5474 true 5475 ); 5476 } 5477 }; 5478 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 5479 if (oldProps !== newProps) { 5480 if (oldProps !== EMPTY_OBJ) { 5481 for (const key in oldProps) { 5482 if (!isReservedProp(key) && !(key in newProps)) { 5483 hostPatchProp( 5484 el, 5485 key, 5486 oldProps[key], 5487 null, 5488 namespace, 5489 parentComponent 5490 ); 5491 } 5492 } 5493 } 5494 for (const key in newProps) { 5495 if (isReservedProp(key)) continue; 5496 const next = newProps[key]; 5497 const prev = oldProps[key]; 5498 if (next !== prev && key !== "value") { 5499 hostPatchProp(el, key, prev, next, namespace, parentComponent); 5500 } 5501 } 5502 if ("value" in newProps) { 5503 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 5504 } 5505 } 5506 }; 5507 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5508 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 5509 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 5510 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 5511 if (fragmentSlotScopeIds) { 5512 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 5513 } 5514 if (n1 == null) { 5515 hostInsert(fragmentStartAnchor, container, anchor); 5516 hostInsert(fragmentEndAnchor, container, anchor); 5517 mountChildren( 5518 // #10007 5519 // such fragment like `<></>` will be compiled into 5520 // a fragment which doesn't have a children. 5521 // In this case fallback to an empty array 5522 n2.children || [], 5523 container, 5524 fragmentEndAnchor, 5525 parentComponent, 5526 parentSuspense, 5527 namespace, 5528 slotScopeIds, 5529 optimized 5530 ); 5531 } else { 5532 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 5533 // of renderSlot() with no valid children 5534 n1.dynamicChildren) { 5535 patchBlockChildren( 5536 n1.dynamicChildren, 5537 dynamicChildren, 5538 container, 5539 parentComponent, 5540 parentSuspense, 5541 namespace, 5542 slotScopeIds 5543 ); 5544 if ( 5545 // #2080 if the stable fragment has a key, it's a <template v-for> that may 5546 // get moved around. Make sure all root level vnodes inherit el.
vendor: 12,405 bytes, lines 5547-5987
5547 // #2134 or if it's a component root, it may also get moved around 5548 // as the component is being moved. 5549 n2.key != null || parentComponent && n2 === parentComponent.subTree 5550 ) { 5551 traverseStaticChildren( 5552 n1, 5553 n2, 5554 true 5555 /* shallow */ 5556 ); 5557 } 5558 } else { 5559 patchChildren( 5560 n1, 5561 n2, 5562 container, 5563 fragmentEndAnchor, 5564 parentComponent, 5565 parentSuspense, 5566 namespace, 5567 slotScopeIds, 5568 optimized 5569 ); 5570 } 5571 } 5572 }; 5573 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5574 n2.slotScopeIds = slotScopeIds; 5575 if (n1 == null) { 5576 if (n2.shapeFlag & 512) { 5577 parentComponent.ctx.activate( 5578 n2, 5579 container, 5580 anchor, 5581 namespace, 5582 optimized 5583 ); 5584 } else { 5585 mountComponent( 5586 n2, 5587 container, 5588 anchor, 5589 parentComponent, 5590 parentSuspense, 5591 namespace, 5592 optimized 5593 ); 5594 } 5595 } else { 5596 updateComponent(n1, n2, optimized); 5597 } 5598 }; 5599 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 5600 const instance = initialVNode.component = createComponentInstance( 5601 initialVNode, 5602 parentComponent, 5603 parentSuspense 5604 ); 5605 if (isKeepAlive(initialVNode)) { 5606 instance.ctx.renderer = internals; 5607 } 5608 { 5609 setupComponent(instance, false, optimized); 5610 } 5611 if (instance.asyncDep) { 5612 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 5613 if (!initialVNode.el) { 5614 const placeholder = instance.subTree = createVNode(Comment); 5615 processCommentNode(null, placeholder, container, anchor); 5616 } 5617 } else { 5618 setupRenderEffect( 5619 instance, 5620 initialVNode, 5621 container, 5622 anchor, 5623 parentSuspense, 5624 namespace, 5625 optimized 5626 ); 5627 } 5628 }; 5629 const updateComponent = (n1, n2, optimized) => { 5630 const instance = n2.component = n1.component; 5631 if (shouldUpdateComponent(n1, n2, optimized)) { 5632 if (instance.asyncDep && !instance.asyncResolved) { 5633 updateComponentPreRender(instance, n2, optimized); 5634 return; 5635 } else { 5636 instance.next = n2; 5637 instance.update(); 5638 } 5639 } else { 5640 n2.el = n1.el; 5641 instance.vnode = n2; 5642 } 5643 }; 5644 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 5645 const componentUpdateFn = () => { 5646 if (!instance.isMounted) { 5647 let vnodeHook; 5648 const { el, props } = initialVNode; 5649 const { bm, m, parent, root, type } = instance; 5650 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 5651 toggleRecurse(instance, false); 5652 if (bm) { 5653 invokeArrayFns(bm); 5654 } 5655 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 5656 invokeVNodeHook(vnodeHook, parent, initialVNode); 5657 } 5658 toggleRecurse(instance, true); 5659 if (el && hydrateNode) { 5660 const hydrateSubTree = () => { 5661 instance.subTree = renderComponentRoot(instance); 5662 hydrateNode( 5663 el, 5664 instance.subTree, 5665 instance, 5666 parentSuspense, 5667 null 5668 ); 5669 }; 5670 if (isAsyncWrapperVNode && type.__asyncHydrate) { 5671 type.__asyncHydrate( 5672 el, 5673 instance, 5674 hydrateSubTree 5675 ); 5676 } else { 5677 hydrateSubTree(); 5678 } 5679 } else { 5680 if (root.ce) { 5681 root.ce._injectChildStyle(type); 5682 } 5683 const subTree = instance.subTree = renderComponentRoot(instance); 5684 patch( 5685 null, 5686 subTree, 5687 container, 5688 anchor, 5689 instance, 5690 parentSuspense, 5691 namespace 5692 ); 5693 initialVNode.el = subTree.el; 5694 } 5695 if (m) { 5696 queuePostRenderEffect(m, parentSuspense); 5697 } 5698 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 5699 const scopedInitialVNode = initialVNode; 5700 queuePostRenderEffect( 5701 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 5702 parentSuspense 5703 ); 5704 } 5705 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 5706 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 5707 } 5708 instance.isMounted = true; 5709 initialVNode = container = anchor = null; 5710 } else { 5711 let { next, bu, u: u2, parent, vnode } = instance; 5712 { 5713 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 5714 if (nonHydratedAsyncRoot) { 5715 if (next) { 5716 next.el = vnode.el; 5717 updateComponentPreRender(instance, next, optimized); 5718 } 5719 nonHydratedAsyncRoot.asyncDep.then(() => { 5720 if (!instance.isUnmounted) { 5721 componentUpdateFn(); 5722 } 5723 }); 5724 return; 5725 } 5726 } 5727 let originNext = next; 5728 let vnodeHook; 5729 toggleRecurse(instance, false); 5730 if (next) { 5731 next.el = vnode.el; 5732 updateComponentPreRender(instance, next, optimized); 5733 } else { 5734 next = vnode; 5735 } 5736 if (bu) { 5737 invokeArrayFns(bu); 5738 } 5739 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 5740 invokeVNodeHook(vnodeHook, parent, next, vnode); 5741 } 5742 toggleRecurse(instance, true); 5743 const nextTree = renderComponentRoot(instance); 5744 const prevTree = instance.subTree; 5745 instance.subTree = nextTree; 5746 patch( 5747 prevTree, 5748 nextTree, 5749 // parent may have changed if it's in a teleport 5750 hostParentNode(prevTree.el), 5751 // anchor may have changed if it's in a fragment 5752 getNextHostNode(prevTree), 5753 instance, 5754 parentSuspense, 5755 namespace 5756 ); 5757 next.el = nextTree.el; 5758 if (originNext === null) { 5759 updateHOCHostEl(instance, nextTree.el); 5760 } 5761 if (u2) { 5762 queuePostRenderEffect(u2, parentSuspense); 5763 } 5764 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 5765 queuePostRenderEffect( 5766 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 5767 parentSuspense 5768 ); 5769 } 5770 } 5771 }; 5772 instance.scope.on(); 5773 const effect2 = instance.effect = new ReactiveEffect(componentUpdateFn); 5774 instance.scope.off(); 5775 const update = instance.update = effect2.run.bind(effect2); 5776 const job = instance.job = effect2.runIfDirty.bind(effect2); 5777 job.i = instance; 5778 job.id = instance.uid; 5779 effect2.scheduler = () => queueJob(job); 5780 toggleRecurse(instance, true); 5781 update(); 5782 }; 5783 const updateComponentPreRender = (instance, nextVNode, optimized) => { 5784 nextVNode.component = instance; 5785 const prevProps = instance.vnode.props; 5786 instance.vnode = nextVNode; 5787 instance.next = null; 5788 updateProps(instance, nextVNode.props, prevProps, optimized); 5789 updateSlots(instance, nextVNode.children, optimized); 5790 pauseTracking(); 5791 flushPreFlushCbs(instance); 5792 resetTracking(); 5793 }; 5794 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 5795 const c1 = n1 && n1.children; 5796 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 5797 const c2 = n2.children; 5798 const { patchFlag, shapeFlag } = n2; 5799 if (patchFlag > 0) { 5800 if (patchFlag & 128) { 5801 patchKeyedChildren( 5802 c1, 5803 c2, 5804 container, 5805 anchor, 5806 parentComponent, 5807 parentSuspense, 5808 namespace, 5809 slotScopeIds, 5810 optimized 5811 ); 5812 return; 5813 } else if (patchFlag & 256) { 5814 patchUnkeyedChildren( 5815 c1, 5816 c2, 5817 container, 5818 anchor, 5819 parentComponent, 5820 parentSuspense, 5821 namespace, 5822 slotScopeIds, 5823 optimized 5824 ); 5825 return; 5826 } 5827 } 5828 if (shapeFlag & 8) { 5829 if (prevShapeFlag & 16) { 5830 unmountChildren(c1, parentComponent, parentSuspense); 5831 } 5832 if (c2 !== c1) { 5833 hostSetElementText(container, c2); 5834 } 5835 } else { 5836 if (prevShapeFlag & 16) { 5837 if (shapeFlag & 16) { 5838 patchKeyedChildren( 5839 c1, 5840 c2, 5841 container, 5842 anchor, 5843 parentComponent, 5844 parentSuspense, 5845 namespace, 5846 slotScopeIds, 5847 optimized 5848 ); 5849 } else { 5850 unmountChildren(c1, parentComponent, parentSuspense, true); 5851 } 5852 } else { 5853 if (prevShapeFlag & 8) { 5854 hostSetElementText(container, ""); 5855 } 5856 if (shapeFlag & 16) { 5857 mountChildren( 5858 c2, 5859 container, 5860 anchor, 5861 parentComponent, 5862 parentSuspense, 5863 namespace, 5864 slotScopeIds, 5865 optimized 5866 ); 5867 } 5868 } 5869 } 5870 }; 5871 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5872 c1 = c1 || EMPTY_ARR; 5873 c2 = c2 || EMPTY_ARR; 5874 const oldLength = c1.length; 5875 const newLength = c2.length; 5876 const commonLength = Math.min(oldLength, newLength); 5877 let i2; 5878 for (i2 = 0; i2 < commonLength; i2++) { 5879 const nextChild = c2[i2] = optimized ? cloneIfMounted(c2[i2]) : normalizeVNode(c2[i2]); 5880 patch( 5881 c1[i2], 5882 nextChild, 5883 container, 5884 null, 5885 parentComponent, 5886 parentSuspense, 5887 namespace, 5888 slotScopeIds, 5889 optimized 5890 ); 5891 } 5892 if (oldLength > newLength) { 5893 unmountChildren( 5894 c1, 5895 parentComponent, 5896 parentSuspense, 5897 true, 5898 false, 5899 commonLength 5900 ); 5901 } else { 5902 mountChildren( 5903 c2, 5904 container, 5905 anchor, 5906 parentComponent, 5907 parentSuspense, 5908 namespace, 5909 slotScopeIds, 5910 optimized, 5911 commonLength 5912 ); 5913 } 5914 }; 5915 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 5916 let i2 = 0; 5917 const l2 = c2.length; 5918 let e1 = c1.length - 1; 5919 let e2 = l2 - 1; 5920 while (i2 <= e1 && i2 <= e2) { 5921 const n1 = c1[i2]; 5922 const n2 = c2[i2] = optimized ? cloneIfMounted(c2[i2]) : normalizeVNode(c2[i2]); 5923 if (isSameVNodeType(n1, n2)) { 5924 patch( 5925 n1, 5926 n2, 5927 container, 5928 null, 5929 parentComponent, 5930 parentSuspense, 5931 namespace, 5932 slotScopeIds, 5933 optimized 5934 ); 5935 } else { 5936 break; 5937 } 5938 i2++; 5939 } 5940 while (i2 <= e1 && i2 <= e2) { 5941 const n1 = c1[e1]; 5942 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 5943 if (isSameVNodeType(n1, n2)) { 5944 patch( 5945 n1, 5946 n2, 5947 container, 5948 null, 5949 parentComponent, 5950 parentSuspense, 5951 namespace, 5952 slotScopeIds, 5953 optimized 5954 ); 5955 } else { 5956 break; 5957 } 5958 e1--; 5959 e2--; 5960 } 5961 if (i2 > e1) { 5962 if (i2 <= e2) { 5963 const nextPos = e2 + 1; 5964 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 5965 while (i2 <= e2) { 5966 patch( 5967 null, 5968 c2[i2] = optimized ? cloneIfMounted(c2[i2]) : normalizeVNode(c2[i2]), 5969 container, 5970 anchor, 5971 parentComponent, 5972 parentSuspense, 5973 namespace, 5974 slotScopeIds, 5975 optimized 5976 ); 5977 i2++; 5978 } 5979 } 5980 } else if (i2 > e2) { 5981 while (i2 <= e1) { 5982 unmount(c1[i2], parentComponent, parentSuspense, true); 5983 i2++; 5984 } 5985 } else { 5986 const s1 = i2; 5987 const s2 = i2;
vendor: 4,648 bytes, lines 5988-6140
5988 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 5989 for (i2 = s2; i2 <= e2; i2++) { 5990 const nextChild = c2[i2] = optimized ? cloneIfMounted(c2[i2]) : normalizeVNode(c2[i2]); 5991 if (nextChild.key != null) { 5992 keyToNewIndexMap.set(nextChild.key, i2); 5993 } 5994 } 5995 let j2; 5996 let patched = 0; 5997 const toBePatched = e2 - s2 + 1; 5998 let moved = false; 5999 let maxNewIndexSoFar = 0; 6000 const newIndexToOldIndexMap = new Array(toBePatched); 6001 for (i2 = 0; i2 < toBePatched; i2++) newIndexToOldIndexMap[i2] = 0; 6002 for (i2 = s1; i2 <= e1; i2++) { 6003 const prevChild = c1[i2]; 6004 if (patched >= toBePatched) { 6005 unmount(prevChild, parentComponent, parentSuspense, true); 6006 continue; 6007 } 6008 let newIndex; 6009 if (prevChild.key != null) { 6010 newIndex = keyToNewIndexMap.get(prevChild.key); 6011 } else { 6012 for (j2 = s2; j2 <= e2; j2++) { 6013 if (newIndexToOldIndexMap[j2 - s2] === 0 && isSameVNodeType(prevChild, c2[j2])) { 6014 newIndex = j2; 6015 break; 6016 } 6017 } 6018 } 6019 if (newIndex === void 0) { 6020 unmount(prevChild, parentComponent, parentSuspense, true); 6021 } else { 6022 newIndexToOldIndexMap[newIndex - s2] = i2 + 1; 6023 if (newIndex >= maxNewIndexSoFar) { 6024 maxNewIndexSoFar = newIndex; 6025 } else { 6026 moved = true; 6027 } 6028 patch( 6029 prevChild, 6030 c2[newIndex], 6031 container, 6032 null, 6033 parentComponent, 6034 parentSuspense, 6035 namespace, 6036 slotScopeIds, 6037 optimized 6038 ); 6039 patched++; 6040 } 6041 } 6042 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 6043 j2 = increasingNewIndexSequence.length - 1; 6044 for (i2 = toBePatched - 1; i2 >= 0; i2--) { 6045 const nextIndex = s2 + i2; 6046 const nextChild = c2[nextIndex]; 6047 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor; 6048 if (newIndexToOldIndexMap[i2] === 0) { 6049 patch( 6050 null, 6051 nextChild, 6052 container, 6053 anchor, 6054 parentComponent, 6055 parentSuspense, 6056 namespace, 6057 slotScopeIds, 6058 optimized 6059 ); 6060 } else if (moved) { 6061 if (j2 < 0 || i2 !== increasingNewIndexSequence[j2]) { 6062 move(nextChild, container, anchor, 2); 6063 } else { 6064 j2--; 6065 } 6066 } 6067 } 6068 } 6069 }; 6070 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 6071 const { el, type, transition, children, shapeFlag } = vnode; 6072 if (shapeFlag & 6) { 6073 move(vnode.component.subTree, container, anchor, moveType); 6074 return; 6075 } 6076 if (shapeFlag & 128) { 6077 vnode.suspense.move(container, anchor, moveType); 6078 return; 6079 } 6080 if (shapeFlag & 64) { 6081 type.move(vnode, container, anchor, internals); 6082 return; 6083 } 6084 if (type === Fragment) { 6085 hostInsert(el, container, anchor); 6086 for (let i2 = 0; i2 < children.length; i2++) { 6087 move(children[i2], container, anchor, moveType); 6088 } 6089 hostInsert(vnode.anchor, container, anchor); 6090 return; 6091 } 6092 if (type === Static) { 6093 moveStaticNode(vnode, container, anchor); 6094 return; 6095 } 6096 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 6097 if (needTransition2) { 6098 if (moveType === 0) { 6099 transition.beforeEnter(el); 6100 hostInsert(el, container, anchor); 6101 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 6102 } else { 6103 const { leave, delayLeave, afterLeave } = transition; 6104 const remove22 = () => { 6105 if (vnode.ctx.isUnmounted) { 6106 hostRemove(el); 6107 } else { 6108 hostInsert(el, container, anchor); 6109 } 6110 }; 6111 const performLeave = () => { 6112 leave(el, () => { 6113 remove22(); 6114 afterLeave && afterLeave(); 6115 }); 6116 }; 6117 if (delayLeave) { 6118 delayLeave(el, remove22, performLeave); 6119 } else { 6120 performLeave(); 6121 } 6122 } 6123 } else { 6124 hostInsert(el, container, anchor); 6125 } 6126 }; 6127 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 6128 const { 6129 type, 6130 props, 6131 ref: ref3, 6132 children, 6133 dynamicChildren, 6134 shapeFlag, 6135 patchFlag, 6136 dirs, 6137 cacheIndex 6138 } = vnode; 6139 if (patchFlag === -2) { 6140 optimized = false;
vendor: 23,096 bytes, lines 6141-6983
6141 } 6142 if (ref3 != null) { 6143 pauseTracking(); 6144 setRef(ref3, null, parentSuspense, vnode, true); 6145 resetTracking(); 6146 } 6147 if (cacheIndex != null) { 6148 parentComponent.renderCache[cacheIndex] = void 0; 6149 } 6150 if (shapeFlag & 256) { 6151 parentComponent.ctx.deactivate(vnode); 6152 return; 6153 } 6154 const shouldInvokeDirs = shapeFlag & 1 && dirs; 6155 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 6156 let vnodeHook; 6157 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 6158 invokeVNodeHook(vnodeHook, parentComponent, vnode); 6159 } 6160 if (shapeFlag & 6) { 6161 unmountComponent(vnode.component, parentSuspense, doRemove); 6162 } else { 6163 if (shapeFlag & 128) { 6164 vnode.suspense.unmount(parentSuspense, doRemove); 6165 return; 6166 } 6167 if (shouldInvokeDirs) { 6168 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 6169 } 6170 if (shapeFlag & 64) { 6171 vnode.type.remove( 6172 vnode, 6173 parentComponent, 6174 parentSuspense, 6175 internals, 6176 doRemove 6177 ); 6178 } else if (dynamicChildren && // #5154 6179 // when v-once is used inside a block, setBlockTracking(-1) marks the 6180 // parent block with hasOnce: true 6181 // so that it doesn't take the fast path during unmount - otherwise 6182 // components nested in v-once are never unmounted. 6183 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 6184 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 6185 unmountChildren( 6186 dynamicChildren, 6187 parentComponent, 6188 parentSuspense, 6189 false, 6190 true 6191 ); 6192 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 6193 unmountChildren(children, parentComponent, parentSuspense); 6194 } 6195 if (doRemove) { 6196 remove2(vnode); 6197 } 6198 } 6199 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 6200 queuePostRenderEffect(() => { 6201 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 6202 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 6203 }, parentSuspense); 6204 } 6205 }; 6206 const remove2 = (vnode) => { 6207 const { type, el, anchor, transition } = vnode; 6208 if (type === Fragment) { 6209 { 6210 removeFragment(el, anchor); 6211 } 6212 return; 6213 } 6214 if (type === Static) { 6215 removeStaticNode(vnode); 6216 return; 6217 } 6218 const performRemove = () => { 6219 hostRemove(el); 6220 if (transition && !transition.persisted && transition.afterLeave) { 6221 transition.afterLeave(); 6222 } 6223 }; 6224 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 6225 const { leave, delayLeave } = transition; 6226 const performLeave = () => leave(el, performRemove); 6227 if (delayLeave) { 6228 delayLeave(vnode.el, performRemove, performLeave); 6229 } else { 6230 performLeave(); 6231 } 6232 } else { 6233 performRemove(); 6234 } 6235 }; 6236 const removeFragment = (cur, end) => { 6237 let next; 6238 while (cur !== end) { 6239 next = hostNextSibling(cur); 6240 hostRemove(cur); 6241 cur = next; 6242 } 6243 hostRemove(end); 6244 }; 6245 const unmountComponent = (instance, parentSuspense, doRemove) => { 6246 const { 6247 bum, 6248 scope, 6249 job, 6250 subTree, 6251 um, 6252 m, 6253 a: a2, 6254 parent, 6255 slots: { __: slotCacheKeys } 6256 } = instance; 6257 invalidateMount(m); 6258 invalidateMount(a2); 6259 if (bum) { 6260 invokeArrayFns(bum); 6261 } 6262 if (parent && isArray$3(slotCacheKeys)) { 6263 slotCacheKeys.forEach((v2) => { 6264 parent.renderCache[v2] = void 0; 6265 }); 6266 } 6267 scope.stop(); 6268 if (job) { 6269 job.flags |= 8; 6270 unmount(subTree, instance, parentSuspense, doRemove); 6271 } 6272 if (um) { 6273 queuePostRenderEffect(um, parentSuspense); 6274 } 6275 queuePostRenderEffect(() => { 6276 instance.isUnmounted = true; 6277 }, parentSuspense); 6278 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) { 6279 parentSuspense.deps--; 6280 if (parentSuspense.deps === 0) { 6281 parentSuspense.resolve(); 6282 } 6283 } 6284 }; 6285 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 6286 for (let i2 = start; i2 < children.length; i2++) { 6287 unmount(children[i2], parentComponent, parentSuspense, doRemove, optimized); 6288 } 6289 }; 6290 const getNextHostNode = (vnode) => { 6291 if (vnode.shapeFlag & 6) { 6292 return getNextHostNode(vnode.component.subTree); 6293 } 6294 if (vnode.shapeFlag & 128) { 6295 return vnode.suspense.next(); 6296 } 6297 const el = hostNextSibling(vnode.anchor || vnode.el); 6298 const teleportEnd = el && el[TeleportEndKey]; 6299 return teleportEnd ? hostNextSibling(teleportEnd) : el; 6300 }; 6301 let isFlushing = false; 6302 const render = (vnode, container, namespace) => { 6303 if (vnode == null) { 6304 if (container._vnode) { 6305 unmount(container._vnode, null, null, true); 6306 } 6307 } else { 6308 patch( 6309 container._vnode || null, 6310 vnode, 6311 container, 6312 null, 6313 null, 6314 null, 6315 namespace 6316 ); 6317 } 6318 container._vnode = vnode; 6319 if (!isFlushing) { 6320 isFlushing = true; 6321 flushPreFlushCbs(); 6322 flushPostFlushCbs(); 6323 isFlushing = false; 6324 } 6325 }; 6326 const internals = { 6327 p: patch, 6328 um: unmount, 6329 m: move, 6330 r: remove2, 6331 mt: mountComponent, 6332 mc: mountChildren, 6333 pc: patchChildren, 6334 pbc: patchBlockChildren, 6335 n: getNextHostNode, 6336 o: options 6337 }; 6338 let hydrate; 6339 let hydrateNode; 6340 if (createHydrationFns) { 6341 [hydrate, hydrateNode] = createHydrationFns( 6342 internals 6343 ); 6344 } 6345 return { 6346 render, 6347 hydrate, 6348 createApp: createAppAPI(render, hydrate) 6349 }; 6350} 6351function resolveChildrenNamespace({ type, props }, currentNamespace) { 6352 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 6353} 6354function toggleRecurse({ effect: effect2, job }, allowed) { 6355 if (allowed) { 6356 effect2.flags |= 32; 6357 job.flags |= 4; 6358 } else { 6359 effect2.flags &= -33; 6360 job.flags &= -5; 6361 } 6362} 6363function needTransition(parentSuspense, transition) { 6364 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 6365} 6366function traverseStaticChildren(n1, n2, shallow = false) { 6367 const ch1 = n1.children; 6368 const ch2 = n2.children; 6369 if (isArray$3(ch1) && isArray$3(ch2)) { 6370 for (let i2 = 0; i2 < ch1.length; i2++) { 6371 const c1 = ch1[i2]; 6372 let c2 = ch2[i2]; 6373 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 6374 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 6375 c2 = ch2[i2] = cloneIfMounted(ch2[i2]); 6376 c2.el = c1.el; 6377 } 6378 if (!shallow && c2.patchFlag !== -2) 6379 traverseStaticChildren(c1, c2); 6380 } 6381 if (c2.type === Text) { 6382 c2.el = c1.el; 6383 } 6384 if (c2.type === Comment && !c2.el) { 6385 c2.el = c1.el; 6386 } 6387 } 6388 } 6389} 6390function getSequence(arr) { 6391 const p2 = arr.slice(); 6392 const result = [0]; 6393 let i2, j2, u2, v2, c2; 6394 const len = arr.length; 6395 for (i2 = 0; i2 < len; i2++) { 6396 const arrI = arr[i2]; 6397 if (arrI !== 0) { 6398 j2 = result[result.length - 1]; 6399 if (arr[j2] < arrI) { 6400 p2[i2] = j2; 6401 result.push(i2); 6402 continue; 6403 } 6404 u2 = 0; 6405 v2 = result.length - 1; 6406 while (u2 < v2) { 6407 c2 = u2 + v2 >> 1; 6408 if (arr[result[c2]] < arrI) { 6409 u2 = c2 + 1; 6410 } else { 6411 v2 = c2; 6412 } 6413 } 6414 if (arrI < arr[result[u2]]) { 6415 if (u2 > 0) { 6416 p2[i2] = result[u2 - 1]; 6417 } 6418 result[u2] = i2; 6419 } 6420 } 6421 } 6422 u2 = result.length; 6423 v2 = result[u2 - 1]; 6424 while (u2-- > 0) { 6425 result[u2] = v2; 6426 v2 = p2[v2]; 6427 } 6428 return result; 6429} 6430function locateNonHydratedAsyncRoot(instance) { 6431 const subComponent = instance.subTree.component; 6432 if (subComponent) { 6433 if (subComponent.asyncDep && !subComponent.asyncResolved) { 6434 return subComponent; 6435 } else { 6436 return locateNonHydratedAsyncRoot(subComponent); 6437 } 6438 } 6439} 6440function invalidateMount(hooks) { 6441 if (hooks) { 6442 for (let i2 = 0; i2 < hooks.length; i2++) 6443 hooks[i2].flags |= 8; 6444 } 6445} 6446const ssrContextKey = Symbol.for("v-scx"); 6447const useSSRContext = () => { 6448 { 6449 const ctx = inject(ssrContextKey); 6450 return ctx; 6451 } 6452}; 6453function watchEffect(effect2, options) { 6454 return doWatch(effect2, null, options); 6455} 6456function watch(source, cb, options) { 6457 return doWatch(source, cb, options); 6458} 6459function doWatch(source, cb, options = EMPTY_OBJ) { 6460 const { immediate, deep, flush, once: once2 } = options; 6461 const baseWatchOptions = extend({}, options); 6462 const runsImmediately = cb && immediate || !cb && flush !== "post"; 6463 let ssrCleanup; 6464 if (isInSSRComponentSetup) { 6465 if (flush === "sync") { 6466 const ctx = useSSRContext(); 6467 ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []); 6468 } else if (!runsImmediately) { 6469 const watchStopHandle = () => { 6470 }; 6471 watchStopHandle.stop = NOOP; 6472 watchStopHandle.resume = NOOP; 6473 watchStopHandle.pause = NOOP; 6474 return watchStopHandle; 6475 } 6476 } 6477 const instance = currentInstance; 6478 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 6479 let isPre = false; 6480 if (flush === "post") { 6481 baseWatchOptions.scheduler = (job) => { 6482 queuePostRenderEffect(job, instance && instance.suspense); 6483 }; 6484 } else if (flush !== "sync") { 6485 isPre = true; 6486 baseWatchOptions.scheduler = (job, isFirstRun) => { 6487 if (isFirstRun) { 6488 job(); 6489 } else { 6490 queueJob(job); 6491 } 6492 }; 6493 } 6494 baseWatchOptions.augmentJob = (job) => { 6495 if (cb) { 6496 job.flags |= 4; 6497 } 6498 if (isPre) { 6499 job.flags |= 2; 6500 if (instance) { 6501 job.id = instance.uid; 6502 job.i = instance; 6503 } 6504 } 6505 }; 6506 const watchHandle = watch$1(source, cb, baseWatchOptions); 6507 if (isInSSRComponentSetup) { 6508 if (ssrCleanup) { 6509 ssrCleanup.push(watchHandle); 6510 } else if (runsImmediately) { 6511 watchHandle(); 6512 } 6513 } 6514 return watchHandle; 6515} 6516function instanceWatch(source, value, options) { 6517 const publicThis = this.proxy; 6518 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 6519 let cb; 6520 if (isFunction$1(value)) { 6521 cb = value; 6522 } else { 6523 cb = value.handler; 6524 options = value; 6525 } 6526 const reset = setCurrentInstance(this); 6527 const res = doWatch(getter, cb.bind(publicThis), options); 6528 reset(); 6529 return res; 6530} 6531function createPathGetter(ctx, path) { 6532 const segments = path.split("."); 6533 return () => { 6534 let cur = ctx; 6535 for (let i2 = 0; i2 < segments.length && cur; i2++) { 6536 cur = cur[segments[i2]]; 6537 } 6538 return cur; 6539 }; 6540} 6541const getModelModifiers = (props, modelName) => { 6542 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 6543}; 6544function emit(instance, event, ...rawArgs) { 6545 if (instance.isUnmounted) return; 6546 const props = instance.vnode.props || EMPTY_OBJ; 6547 let args = rawArgs; 6548 const isModelListener2 = event.startsWith("update:"); 6549 const modifiers = isModelListener2 && getModelModifiers(props, event.slice(7)); 6550 if (modifiers) { 6551 if (modifiers.trim) { 6552 args = rawArgs.map((a2) => isString(a2) ? a2.trim() : a2); 6553 } 6554 if (modifiers.number) { 6555 args = rawArgs.map(looseToNumber); 6556 } 6557 } 6558 let handlerName; 6559 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 6560 props[handlerName = toHandlerKey(camelize(event))]; 6561 if (!handler && isModelListener2) { 6562 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 6563 } 6564 if (handler) { 6565 callWithAsyncErrorHandling( 6566 handler, 6567 instance, 6568 6, 6569 args 6570 ); 6571 } 6572 const onceHandler = props[handlerName + `Once`]; 6573 if (onceHandler) { 6574 if (!instance.emitted) { 6575 instance.emitted = {}; 6576 } else if (instance.emitted[handlerName]) { 6577 return; 6578 } 6579 instance.emitted[handlerName] = true; 6580 callWithAsyncErrorHandling( 6581 onceHandler, 6582 instance, 6583 6, 6584 args 6585 ); 6586 } 6587} 6588function normalizeEmitsOptions(comp, appContext, asMixin = false) { 6589 const cache = appContext.emitsCache; 6590 const cached = cache.get(comp); 6591 if (cached !== void 0) { 6592 return cached; 6593 } 6594 const raw = comp.emits; 6595 let normalized = {}; 6596 let hasExtends = false; 6597 if (!isFunction$1(comp)) { 6598 const extendEmits = (raw2) => { 6599 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 6600 if (normalizedFromExtend) { 6601 hasExtends = true; 6602 extend(normalized, normalizedFromExtend); 6603 } 6604 }; 6605 if (!asMixin && appContext.mixins.length) { 6606 appContext.mixins.forEach(extendEmits); 6607 } 6608 if (comp.extends) { 6609 extendEmits(comp.extends); 6610 } 6611 if (comp.mixins) { 6612 comp.mixins.forEach(extendEmits); 6613 } 6614 } 6615 if (!raw && !hasExtends) { 6616 if (isObject(comp)) { 6617 cache.set(comp, null); 6618 } 6619 return null; 6620 } 6621 if (isArray$3(raw)) { 6622 raw.forEach((key) => normalized[key] = null); 6623 } else { 6624 extend(normalized, raw); 6625 } 6626 if (isObject(comp)) { 6627 cache.set(comp, normalized); 6628 } 6629 return normalized; 6630} 6631function isEmitListener(options, key) { 6632 if (!options || !isOn(key)) { 6633 return false; 6634 } 6635 key = key.slice(2).replace(/Once$/, ""); 6636 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 6637} 6638function markAttrsAccessed() { 6639} 6640function renderComponentRoot(instance) { 6641 const { 6642 type: Component, 6643 vnode, 6644 proxy, 6645 withProxy, 6646 propsOptions: [propsOptions], 6647 slots, 6648 attrs, 6649 emit: emit2, 6650 render, 6651 renderCache, 6652 props, 6653 data, 6654 setupState, 6655 ctx, 6656 inheritAttrs 6657 } = instance; 6658 const prev = setCurrentRenderingInstance(instance); 6659 let result; 6660 let fallthroughAttrs; 6661 try { 6662 if (vnode.shapeFlag & 4) { 6663 const proxyToUse = withProxy || proxy; 6664 const thisProxy = false ? new Proxy(proxyToUse, { 6665 get(target, key, receiver) { 6666 warn$1( 6667 `Property '${String( 6668 key 6669 )}' was accessed via 'this'. Avoid using 'this' in templates.` 6670 ); 6671 return Reflect.get(target, key, receiver); 6672 } 6673 }) : proxyToUse; 6674 result = normalizeVNode( 6675 render.call( 6676 thisProxy, 6677 proxyToUse, 6678 renderCache, 6679 false ? shallowReadonly(props) : props, 6680 setupState, 6681 data, 6682 ctx 6683 ) 6684 ); 6685 fallthroughAttrs = attrs; 6686 } else { 6687 const render2 = Component; 6688 if (false) ; 6689 result = normalizeVNode( 6690 render2.length > 1 ? render2( 6691 false ? shallowReadonly(props) : props, 6692 false ? { 6693 get attrs() { 6694 markAttrsAccessed(); 6695 return shallowReadonly(attrs); 6696 }, 6697 slots, 6698 emit: emit2 6699 } : { attrs, slots, emit: emit2 } 6700 ) : render2( 6701 false ? shallowReadonly(props) : props, 6702 null 6703 ) 6704 ); 6705 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 6706 } 6707 } catch (err) { 6708 blockStack.length = 0; 6709 handleError(err, instance, 1); 6710 result = createVNode(Comment); 6711 } 6712 let root = result; 6713 if (fallthroughAttrs && inheritAttrs !== false) { 6714 const keys = Object.keys(fallthroughAttrs); 6715 const { shapeFlag } = root; 6716 if (keys.length) { 6717 if (shapeFlag & (1 | 6)) { 6718 if (propsOptions && keys.some(isModelListener)) { 6719 fallthroughAttrs = filterModelListeners( 6720 fallthroughAttrs, 6721 propsOptions 6722 ); 6723 } 6724 root = cloneVNode(root, fallthroughAttrs, false, true); 6725 } 6726 } 6727 } 6728 if (vnode.dirs) { 6729 root = cloneVNode(root, null, false, true); 6730 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 6731 } 6732 if (vnode.transition) { 6733 setTransitionHooks(root, vnode.transition); 6734 } 6735 { 6736 result = root; 6737 } 6738 setCurrentRenderingInstance(prev); 6739 return result; 6740} 6741function filterSingleRoot(children, recurse = true) { 6742 let singleRoot; 6743 for (let i2 = 0; i2 < children.length; i2++) { 6744 const child = children[i2]; 6745 if (isVNode(child)) { 6746 if (child.type !== Comment || child.children === "v-if") { 6747 if (singleRoot) { 6748 return; 6749 } else { 6750 singleRoot = child; 6751 } 6752 } 6753 } else { 6754 return; 6755 } 6756 } 6757 return singleRoot; 6758} 6759const getFunctionalFallthrough = (attrs) => { 6760 let res; 6761 for (const key in attrs) { 6762 if (key === "class" || key === "style" || isOn(key)) { 6763 (res || (res = {}))[key] = attrs[key]; 6764 } 6765 } 6766 return res; 6767}; 6768const filterModelListeners = (attrs, props) => { 6769 const res = {}; 6770 for (const key in attrs) { 6771 if (!isModelListener(key) || !(key.slice(9) in props)) { 6772 res[key] = attrs[key]; 6773 } 6774 } 6775 return res; 6776}; 6777function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 6778 const { props: prevProps, children: prevChildren, component } = prevVNode; 6779 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 6780 const emits = component.emitsOptions; 6781 if (nextVNode.dirs || nextVNode.transition) { 6782 return true; 6783 } 6784 if (optimized && patchFlag >= 0) { 6785 if (patchFlag & 1024) { 6786 return true; 6787 } 6788 if (patchFlag & 16) { 6789 if (!prevProps) { 6790 return !!nextProps; 6791 } 6792 return hasPropsChanged(prevProps, nextProps, emits); 6793 } else if (patchFlag & 8) { 6794 const dynamicProps = nextVNode.dynamicProps; 6795 for (let i2 = 0; i2 < dynamicProps.length; i2++) { 6796 const key = dynamicProps[i2]; 6797 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 6798 return true; 6799 } 6800 } 6801 } 6802 } else { 6803 if (prevChildren || nextChildren) { 6804 if (!nextChildren || !nextChildren.$stable) { 6805 return true; 6806 } 6807 } 6808 if (prevProps === nextProps) { 6809 return false; 6810 } 6811 if (!prevProps) { 6812 return !!nextProps; 6813 } 6814 if (!nextProps) { 6815 return true; 6816 } 6817 return hasPropsChanged(prevProps, nextProps, emits); 6818 } 6819 return false; 6820} 6821function hasPropsChanged(prevProps, nextProps, emitsOptions) { 6822 const nextKeys = Object.keys(nextProps); 6823 if (nextKeys.length !== Object.keys(prevProps).length) { 6824 return true; 6825 } 6826 for (let i2 = 0; i2 < nextKeys.length; i2++) { 6827 const key = nextKeys[i2]; 6828 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 6829 return true; 6830 } 6831 } 6832 return false; 6833} 6834function updateHOCHostEl({ vnode, parent }, el) { 6835 while (parent) { 6836 const root = parent.subTree; 6837 if (root.suspense && root.suspense.activeBranch === vnode) { 6838 root.el = vnode.el; 6839 } 6840 if (root === vnode) { 6841 (vnode = parent.vnode).el = el; 6842 parent = parent.parent; 6843 } else { 6844 break; 6845 } 6846 } 6847} 6848const isSuspense = (type) => type.__isSuspense; 6849let suspenseId = 0; 6850const SuspenseImpl = { 6851 name: "Suspense", 6852 // In order to make Suspense tree-shakable, we need to avoid importing it 6853 // directly in the renderer. The renderer checks for the __isSuspense flag 6854 // on a vnode's type and calls the `process` method, passing in renderer 6855 // internals. 6856 __isSuspense: true, 6857 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 6858 if (n1 == null) { 6859 mountSuspense( 6860 n2, 6861 container, 6862 anchor, 6863 parentComponent, 6864 parentSuspense, 6865 namespace, 6866 slotScopeIds, 6867 optimized, 6868 rendererInternals 6869 ); 6870 } else { 6871 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 6872 n2.suspense = n1.suspense; 6873 n2.suspense.vnode = n2; 6874 n2.el = n1.el; 6875 return; 6876 } 6877 patchSuspense( 6878 n1, 6879 n2, 6880 container, 6881 anchor, 6882 parentComponent, 6883 namespace, 6884 slotScopeIds, 6885 optimized, 6886 rendererInternals 6887 ); 6888 } 6889 }, 6890 hydrate: hydrateSuspense, 6891 normalize: normalizeSuspenseChildren 6892}; 6893const Suspense = SuspenseImpl; 6894function triggerEvent(vnode, name) { 6895 const eventListener = vnode.props && vnode.props[name]; 6896 if (isFunction$1(eventListener)) { 6897 eventListener(); 6898 } 6899} 6900function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 6901 const { 6902 p: patch, 6903 o: { createElement } 6904 } = rendererInternals; 6905 const hiddenContainer = createElement("div"); 6906 const suspense = vnode.suspense = createSuspenseBoundary( 6907 vnode, 6908 parentSuspense, 6909 parentComponent, 6910 container, 6911 hiddenContainer, 6912 anchor, 6913 namespace, 6914 slotScopeIds, 6915 optimized, 6916 rendererInternals 6917 ); 6918 patch( 6919 null, 6920 suspense.pendingBranch = vnode.ssContent, 6921 hiddenContainer, 6922 null, 6923 parentComponent, 6924 suspense, 6925 namespace, 6926 slotScopeIds 6927 ); 6928 if (suspense.deps > 0) { 6929 triggerEvent(vnode, "onPending"); 6930 triggerEvent(vnode, "onFallback"); 6931 patch( 6932 null, 6933 vnode.ssFallback, 6934 container, 6935 anchor, 6936 parentComponent, 6937 null, 6938 // fallback tree will not have suspense context 6939 namespace, 6940 slotScopeIds 6941 ); 6942 setActiveBranch(suspense, vnode.ssFallback); 6943 } else { 6944 suspense.resolve(false, true); 6945 } 6946} 6947function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 6948 const suspense = n2.suspense = n1.suspense; 6949 suspense.vnode = n2; 6950 n2.el = n1.el; 6951 const newBranch = n2.ssContent; 6952 const newFallback = n2.ssFallback; 6953 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 6954 if (pendingBranch) { 6955 suspense.pendingBranch = newBranch; 6956 if (isSameVNodeType(newBranch, pendingBranch)) { 6957 patch( 6958 pendingBranch, 6959 newBranch, 6960 suspense.hiddenContainer, 6961 null, 6962 parentComponent, 6963 suspense, 6964 namespace, 6965 slotScopeIds, 6966 optimized 6967 ); 6968 if (suspense.deps <= 0) { 6969 suspense.resolve(); 6970 } else if (isInFallback) { 6971 if (!isHydrating) { 6972 patch( 6973 activeBranch, 6974 newFallback, 6975 container, 6976 anchor, 6977 parentComponent, 6978 null, 6979 // fallback tree will not have suspense context 6980 namespace, 6981 slotScopeIds, 6982 optimized 6983 );
vendor: 1,065 bytes, lines 6984-7024
6984 setActiveBranch(suspense, newFallback); 6985 } 6986 } 6987 } else { 6988 suspense.pendingId = suspenseId++; 6989 if (isHydrating) { 6990 suspense.isHydrating = false; 6991 suspense.activeBranch = pendingBranch; 6992 } else { 6993 unmount(pendingBranch, parentComponent, suspense); 6994 } 6995 suspense.deps = 0; 6996 suspense.effects.length = 0; 6997 suspense.hiddenContainer = createElement("div"); 6998 if (isInFallback) { 6999 patch( 7000 null, 7001 newBranch, 7002 suspense.hiddenContainer, 7003 null, 7004 parentComponent, 7005 suspense, 7006 namespace, 7007 slotScopeIds, 7008 optimized 7009 ); 7010 if (suspense.deps <= 0) { 7011 suspense.resolve(); 7012 } else { 7013 patch( 7014 activeBranch, 7015 newFallback, 7016 container, 7017 anchor, 7018 parentComponent, 7019 null, 7020 // fallback tree will not have suspense context 7021 namespace, 7022 slotScopeIds, 7023 optimized 7024 );
7025 setActiveBranch(suspense, newFallback); 7026 } 7027 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 7028 patch( 7029 activeBranch, 7030 newBranch, 7031 container, 7032 anchor, 7033 parentComponent, 7034 suspense, 7035 namespace, 7036 slotScopeIds, 7037 optimized 7038 ); 7039 suspense.resolve(true); 7040 } else { 7041 patch( 7042 null, 7043 newBranch, 7044 suspense.hiddenContainer, 7045 null, 7046 parentComponent, 7047 suspense, 7048 namespace, 7049 slotScopeIds, 7050 optimized 7051 ); 7052 if (suspense.deps <= 0) { 7053 suspense.resolve(); 7054 } 7055 } 7056 } 7057 } else { 7058 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 7059 patch( 7060 activeBranch, 7061 newBranch, 7062 container, 7063 anchor, 7064 parentComponent, 7065 suspense, 7066 namespace, 7067 slotScopeIds, 7068 optimized 7069 ); 7070 setActiveBranch(suspense, newBranch); 7071 } else { 7072 triggerEvent(n2, "onPending"); 7073 suspense.pendingBranch = newBranch; 7074 if (newBranch.shapeFlag & 512) { 7075 suspense.pendingId = newBranch.component.suspenseId; 7076 } else { 7077 suspense.pendingId = suspenseId++; 7078 } 7079 patch( 7080 null, 7081 newBranch, 7082 suspense.hiddenContainer, 7083 null, 7084 parentComponent, 7085 suspense, 7086 namespace, 7087 slotScopeIds, 7088 optimized 7089 ); 7090 if (suspense.deps <= 0) { 7091 suspense.resolve(); 7092 } else { 7093 const { timeout, pendingId } = suspense; 7094 if (timeout > 0) { 7095 setTimeout(() => { 7096 if (suspense.pendingId === pendingId) { 7097 suspense.fallback(newFallback); 7098 } 7099 }, timeout); 7100 } else if (timeout === 0) { 7101 suspense.fallback(newFallback); 7102 } 7103 } 7104 } 7105 } 7106} 7107function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 7108 const { 7109 p: patch, 7110 m: move, 7111 um: unmount, 7112 n: next, 7113 o: { parentNode, remove: remove2 } 7114 } = rendererInternals; 7115 let parentSuspenseId; 7116 const isSuspensible = isVNodeSuspensible(vnode); 7117 if (isSuspensible) { 7118 if (parentSuspense && parentSuspense.pendingBranch) { 7119 parentSuspenseId = parentSuspense.pendingId; 7120 parentSuspense.deps++; 7121 } 7122 } 7123 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 7124 const initialAnchor = anchor; 7125 const suspense = { 7126 vnode, 7127 parent: parentSuspense, 7128 parentComponent, 7129 namespace, 7130 container, 7131 hiddenContainer, 7132 deps: 0, 7133 pendingId: suspenseId++, 7134 timeout: typeof timeout === "number" ? timeout : -1, 7135 activeBranch: null, 7136 pendingBranch: null, 7137 isInFallback: !isHydrating, 7138 isHydrating, 7139 isUnmounted: false, 7140 effects: [], 7141 resolve(resume = false, sync = false) { 7142 const { 7143 vnode: vnode2, 7144 activeBranch, 7145 pendingBranch, 7146 pendingId, 7147 effects, 7148 parentComponent: parentComponent2, 7149 container: container2 7150 } = suspense; 7151 let delayEnter = false; 7152 if (suspense.isHydrating) { 7153 suspense.isHydrating = false; 7154 } else if (!resume) { 7155 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 7156 if (delayEnter) { 7157 activeBranch.transition.afterLeave = () => { 7158 if (pendingId === suspense.pendingId) { 7159 move( 7160 pendingBranch, 7161 container2, 7162 anchor === initialAnchor ? next(activeBranch) : anchor, 7163 0 7164 ); 7165 queuePostFlushCb(effects); 7166 } 7167 }; 7168 } 7169 if (activeBranch) { 7170 if (parentNode(activeBranch.el) === container2) { 7171 anchor = next(activeBranch); 7172 } 7173 unmount(activeBranch, parentComponent2, suspense, true); 7174 } 7175 if (!delayEnter) { 7176 move(pendingBranch, container2, anchor, 0); 7177 } 7178 }
7179 setActiveBranch(suspense, pendingBranch); 7180 suspense.pendingBranch = null; 7181 suspense.isInFallback = false; 7182 let parent = suspense.parent; 7183 let hasUnresolvedAncestor = false; 7184 while (parent) { 7185 if (parent.pendingBranch) { 7186 parent.effects.push(...effects); 7187 hasUnresolvedAncestor = true; 7188 break; 7189 } 7190 parent = parent.parent; 7191 } 7192 if (!hasUnresolvedAncestor && !delayEnter) { 7193 queuePostFlushCb(effects); 7194 } 7195 suspense.effects = []; 7196 if (isSuspensible) { 7197 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 7198 parentSuspense.deps--; 7199 if (parentSuspense.deps === 0 && !sync) { 7200 parentSuspense.resolve(); 7201 } 7202 } 7203 } 7204 triggerEvent(vnode2, "onResolve"); 7205 }, 7206 fallback(fallbackVNode) { 7207 if (!suspense.pendingBranch) { 7208 return; 7209 } 7210 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 7211 triggerEvent(vnode2, "onFallback"); 7212 const anchor2 = next(activeBranch); 7213 const mountFallback = () => { 7214 if (!suspense.isInFallback) { 7215 return; 7216 } 7217 patch( 7218 null, 7219 fallbackVNode, 7220 container2, 7221 anchor2, 7222 parentComponent2, 7223 null, 7224 // fallback tree will not have suspense context 7225 namespace2, 7226 slotScopeIds, 7227 optimized 7228 ); 7229 setActiveBranch(suspense, fallbackVNode); 7230 }; 7231 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 7232 if (delayEnter) { 7233 activeBranch.transition.afterLeave = mountFallback; 7234 } 7235 suspense.isInFallback = true; 7236 unmount( 7237 activeBranch, 7238 parentComponent2, 7239 null, 7240 // no suspense so unmount hooks fire now 7241 true 7242 // shouldRemove 7243 ); 7244 if (!delayEnter) { 7245 mountFallback(); 7246 } 7247 },
vendor: 5,423 bytes, lines 7248-7432
7248 move(container2, anchor2, type) { 7249 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 7250 suspense.container = container2; 7251 }, 7252 next() { 7253 return suspense.activeBranch && next(suspense.activeBranch); 7254 }, 7255 registerDep(instance, setupRenderEffect, optimized2) { 7256 const isInPendingSuspense = !!suspense.pendingBranch; 7257 if (isInPendingSuspense) { 7258 suspense.deps++; 7259 } 7260 const hydratedEl = instance.vnode.el; 7261 instance.asyncDep.catch((err) => { 7262 handleError(err, instance, 0); 7263 }).then((asyncSetupResult) => { 7264 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 7265 return; 7266 } 7267 instance.asyncResolved = true; 7268 const { vnode: vnode2 } = instance; 7269 handleSetupResult(instance, asyncSetupResult); 7270 if (hydratedEl) { 7271 vnode2.el = hydratedEl; 7272 } 7273 const placeholder = !hydratedEl && instance.subTree.el; 7274 setupRenderEffect( 7275 instance, 7276 vnode2, 7277 // component may have been moved before resolve. 7278 // if this is not a hydration, instance.subTree will be the comment 7279 // placeholder. 7280 parentNode(hydratedEl || instance.subTree.el), 7281 // anchor will not be used if this is hydration, so only need to 7282 // consider the comment placeholder case. 7283 hydratedEl ? null : next(instance.subTree), 7284 suspense, 7285 namespace, 7286 optimized2 7287 ); 7288 if (placeholder) { 7289 remove2(placeholder); 7290 } 7291 updateHOCHostEl(instance, vnode2.el); 7292 if (isInPendingSuspense && --suspense.deps === 0) { 7293 suspense.resolve(); 7294 } 7295 }); 7296 }, 7297 unmount(parentSuspense2, doRemove) { 7298 suspense.isUnmounted = true; 7299 if (suspense.activeBranch) { 7300 unmount( 7301 suspense.activeBranch, 7302 parentComponent, 7303 parentSuspense2, 7304 doRemove 7305 ); 7306 } 7307 if (suspense.pendingBranch) { 7308 unmount( 7309 suspense.pendingBranch, 7310 parentComponent, 7311 parentSuspense2, 7312 doRemove 7313 ); 7314 } 7315 } 7316 }; 7317 return suspense; 7318} 7319function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 7320 const suspense = vnode.suspense = createSuspenseBoundary( 7321 vnode, 7322 parentSuspense, 7323 parentComponent, 7324 node.parentNode, 7325 // eslint-disable-next-line no-restricted-globals 7326 document.createElement("div"), 7327 null, 7328 namespace, 7329 slotScopeIds, 7330 optimized, 7331 rendererInternals, 7332 true 7333 ); 7334 const result = hydrateNode( 7335 node, 7336 suspense.pendingBranch = vnode.ssContent, 7337 parentComponent, 7338 suspense, 7339 slotScopeIds, 7340 optimized 7341 ); 7342 if (suspense.deps === 0) { 7343 suspense.resolve(false, true); 7344 } 7345 return result; 7346} 7347function normalizeSuspenseChildren(vnode) { 7348 const { shapeFlag, children } = vnode; 7349 const isSlotChildren = shapeFlag & 32; 7350 vnode.ssContent = normalizeSuspenseSlot( 7351 isSlotChildren ? children.default : children 7352 ); 7353 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 7354} 7355function normalizeSuspenseSlot(s2) { 7356 let block; 7357 if (isFunction$1(s2)) { 7358 const trackBlock = isBlockTreeEnabled && s2._c; 7359 if (trackBlock) { 7360 s2._d = false; 7361 openBlock(); 7362 } 7363 s2 = s2(); 7364 if (trackBlock) { 7365 s2._d = true; 7366 block = currentBlock; 7367 closeBlock(); 7368 } 7369 } 7370 if (isArray$3(s2)) { 7371 const singleChild = filterSingleRoot(s2); 7372 s2 = singleChild; 7373 } 7374 s2 = normalizeVNode(s2); 7375 if (block && !s2.dynamicChildren) { 7376 s2.dynamicChildren = block.filter((c2) => c2 !== s2); 7377 } 7378 return s2; 7379} 7380function queueEffectWithSuspense(fn, suspense) { 7381 if (suspense && suspense.pendingBranch) { 7382 if (isArray$3(fn)) { 7383 suspense.effects.push(...fn); 7384 } else { 7385 suspense.effects.push(fn); 7386 } 7387 } else { 7388 queuePostFlushCb(fn); 7389 } 7390} 7391function setActiveBranch(suspense, branch) { 7392 suspense.activeBranch = branch; 7393 const { vnode, parentComponent } = suspense; 7394 let el = branch.el; 7395 while (!el && branch.component) { 7396 branch = branch.component.subTree; 7397 el = branch.el; 7398 } 7399 vnode.el = el; 7400 if (parentComponent && parentComponent.subTree === vnode) { 7401 parentComponent.vnode.el = el; 7402 updateHOCHostEl(parentComponent, el); 7403 } 7404} 7405function isVNodeSuspensible(vnode) { 7406 const suspensible = vnode.props && vnode.props.suspensible; 7407 return suspensible != null && suspensible !== false; 7408} 7409const Fragment = Symbol.for("v-fgt"); 7410const Text = Symbol.for("v-txt"); 7411const Comment = Symbol.for("v-cmt"); 7412const Static = Symbol.for("v-stc"); 7413const blockStack = []; 7414let currentBlock = null; 7415function openBlock(disableTracking = false) { 7416 blockStack.push(currentBlock = disableTracking ? null : []); 7417} 7418function closeBlock() { 7419 blockStack.pop(); 7420 currentBlock = blockStack[blockStack.length - 1] || null; 7421} 7422let isBlockTreeEnabled = 1; 7423function setBlockTracking(value, inVOnce = false) { 7424 isBlockTreeEnabled += value; 7425 if (value < 0 && currentBlock && inVOnce) { 7426 currentBlock.hasOnce = true; 7427 } 7428} 7429function setupBlock(vnode) { 7430 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 7431 closeBlock(); 7432 if (isBlockTreeEnabled > 0 && currentBlock) {
vendor: 9,753 bytes, lines 7433-7747
7433 currentBlock.push(vnode); 7434 } 7435 return vnode; 7436} 7437function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 7438 return setupBlock( 7439 createBaseVNode( 7440 type, 7441 props, 7442 children, 7443 patchFlag, 7444 dynamicProps, 7445 shapeFlag, 7446 true 7447 ) 7448 ); 7449} 7450function createBlock(type, props, children, patchFlag, dynamicProps) { 7451 return setupBlock( 7452 createVNode( 7453 type, 7454 props, 7455 children, 7456 patchFlag, 7457 dynamicProps, 7458 true 7459 ) 7460 ); 7461} 7462function isVNode(value) { 7463 return value ? value.__v_isVNode === true : false; 7464} 7465function isSameVNodeType(n1, n2) { 7466 return n1.type === n2.type && n1.key === n2.key; 7467} 7468const normalizeKey = ({ key }) => key != null ? key : null; 7469const normalizeRef = ({ 7470 ref: ref3, 7471 ref_key, 7472 ref_for 7473}) => { 7474 if (typeof ref3 === "number") { 7475 ref3 = "" + ref3; 7476 } 7477 return ref3 != null ? isString(ref3) || isRef(ref3) || isFunction$1(ref3) ? { i: currentRenderingInstance, r: ref3, k: ref_key, f: !!ref_for } : ref3 : null; 7478}; 7479function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 7480 const vnode = { 7481 __v_isVNode: true, 7482 __v_skip: true, 7483 type, 7484 props, 7485 key: props && normalizeKey(props), 7486 ref: props && normalizeRef(props), 7487 scopeId: currentScopeId, 7488 slotScopeIds: null, 7489 children, 7490 component: null, 7491 suspense: null, 7492 ssContent: null, 7493 ssFallback: null, 7494 dirs: null, 7495 transition: null, 7496 el: null, 7497 anchor: null, 7498 target: null, 7499 targetStart: null, 7500 targetAnchor: null, 7501 staticCount: 0, 7502 shapeFlag, 7503 patchFlag, 7504 dynamicProps, 7505 dynamicChildren: null, 7506 appContext: null, 7507 ctx: currentRenderingInstance 7508 }; 7509 if (needFullChildrenNormalization) { 7510 normalizeChildren(vnode, children); 7511 if (shapeFlag & 128) { 7512 type.normalize(vnode); 7513 } 7514 } else if (children) { 7515 vnode.shapeFlag |= isString(children) ? 8 : 16; 7516 } 7517 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 7518 !isBlockNode && // has current parent block 7519 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 7520 // component nodes also should always be patched, because even if the 7521 // component doesn't need to update, it needs to persist the instance on to 7522 // the next vnode so that it can be properly unmounted later. 7523 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 7524 // vnode should not be considered dynamic due to handler caching. 7525 vnode.patchFlag !== 32) { 7526 currentBlock.push(vnode); 7527 } 7528 return vnode; 7529} 7530const createVNode = _createVNode; 7531function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 7532 if (!type || type === NULL_DYNAMIC_COMPONENT) { 7533 type = Comment; 7534 } 7535 if (isVNode(type)) { 7536 const cloned = cloneVNode( 7537 type, 7538 props, 7539 true 7540 /* mergeRef: true */ 7541 ); 7542 if (children) { 7543 normalizeChildren(cloned, children); 7544 } 7545 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 7546 if (cloned.shapeFlag & 6) { 7547 currentBlock[currentBlock.indexOf(type)] = cloned; 7548 } else { 7549 currentBlock.push(cloned); 7550 } 7551 } 7552 cloned.patchFlag = -2; 7553 return cloned; 7554 } 7555 if (isClassComponent(type)) { 7556 type = type.__vccOpts; 7557 } 7558 if (props) { 7559 props = guardReactiveProps(props); 7560 let { class: klass, style } = props; 7561 if (klass && !isString(klass)) { 7562 props.class = normalizeClass(klass); 7563 } 7564 if (isObject(style)) { 7565 if (isProxy(style) && !isArray$3(style)) { 7566 style = extend({}, style); 7567 } 7568 props.style = normalizeStyle(style); 7569 } 7570 } 7571 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction$1(type) ? 2 : 0; 7572 return createBaseVNode( 7573 type, 7574 props, 7575 children, 7576 patchFlag, 7577 dynamicProps, 7578 shapeFlag, 7579 isBlockNode, 7580 true 7581 ); 7582} 7583function guardReactiveProps(props) { 7584 if (!props) return null; 7585 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 7586} 7587function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 7588 const { props, ref: ref3, patchFlag, children, transition } = vnode; 7589 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 7590 const cloned = { 7591 __v_isVNode: true, 7592 __v_skip: true, 7593 type: vnode.type, 7594 props: mergedProps, 7595 key: mergedProps && normalizeKey(mergedProps), 7596 ref: extraProps && extraProps.ref ? ( 7597 // #2078 in the case of <component :is="vnode" ref="extra"/> 7598 // if the vnode itself already has a ref, cloneVNode will need to merge 7599 // the refs so the single vnode can be set on multiple refs 7600 mergeRef && ref3 ? isArray$3(ref3) ? ref3.concat(normalizeRef(extraProps)) : [ref3, normalizeRef(extraProps)] : normalizeRef(extraProps) 7601 ) : ref3, 7602 scopeId: vnode.scopeId, 7603 slotScopeIds: vnode.slotScopeIds, 7604 children, 7605 target: vnode.target, 7606 targetStart: vnode.targetStart, 7607 targetAnchor: vnode.targetAnchor, 7608 staticCount: vnode.staticCount, 7609 shapeFlag: vnode.shapeFlag, 7610 // if the vnode is cloned with extra props, we can no longer assume its 7611 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 7612 // note: preserve flag for fragments since they use the flag for children 7613 // fast paths only. 7614 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 7615 dynamicProps: vnode.dynamicProps, 7616 dynamicChildren: vnode.dynamicChildren, 7617 appContext: vnode.appContext, 7618 dirs: vnode.dirs, 7619 transition, 7620 // These should technically only be non-null on mounted VNodes. However, 7621 // they *should* be copied for kept-alive vnodes. So we just always copy 7622 // them since them being non-null during a mount doesn't affect the logic as 7623 // they will simply be overwritten. 7624 component: vnode.component, 7625 suspense: vnode.suspense, 7626 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 7627 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 7628 el: vnode.el, 7629 anchor: vnode.anchor, 7630 ctx: vnode.ctx, 7631 ce: vnode.ce 7632 }; 7633 if (transition && cloneTransition) { 7634 setTransitionHooks( 7635 cloned, 7636 transition.clone(cloned) 7637 ); 7638 } 7639 return cloned; 7640} 7641function createTextVNode(text = " ", flag = 0) { 7642 return createVNode(Text, null, text, flag); 7643} 7644function createStaticVNode(content, numberOfNodes) { 7645 const vnode = createVNode(Static, null, content); 7646 vnode.staticCount = numberOfNodes; 7647 return vnode; 7648} 7649function createCommentVNode(text = "", asBlock = false) { 7650 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 7651} 7652function normalizeVNode(child) { 7653 if (child == null || typeof child === "boolean") { 7654 return createVNode(Comment); 7655 } else if (isArray$3(child)) { 7656 return createVNode( 7657 Fragment, 7658 null, 7659 // #3666, avoid reference pollution when reusing vnode 7660 child.slice() 7661 ); 7662 } else if (isVNode(child)) { 7663 return cloneIfMounted(child); 7664 } else { 7665 return createVNode(Text, null, String(child)); 7666 } 7667} 7668function cloneIfMounted(child) { 7669 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 7670} 7671function normalizeChildren(vnode, children) { 7672 let type = 0; 7673 const { shapeFlag } = vnode; 7674 if (children == null) { 7675 children = null; 7676 } else if (isArray$3(children)) { 7677 type = 16; 7678 } else if (typeof children === "object") { 7679 if (shapeFlag & (1 | 64)) { 7680 const slot = children.default; 7681 if (slot) { 7682 slot._c && (slot._d = false); 7683 normalizeChildren(vnode, slot()); 7684 slot._c && (slot._d = true); 7685 } 7686 return; 7687 } else { 7688 type = 32; 7689 const slotFlag = children._; 7690 if (!slotFlag && !isInternalObject(children)) { 7691 children._ctx = currentRenderingInstance; 7692 } else if (slotFlag === 3 && currentRenderingInstance) { 7693 if (currentRenderingInstance.slots._ === 1) { 7694 children._ = 1; 7695 } else { 7696 children._ = 2; 7697 vnode.patchFlag |= 1024; 7698 } 7699 } 7700 } 7701 } else if (isFunction$1(children)) { 7702 children = { default: children, _ctx: currentRenderingInstance }; 7703 type = 32; 7704 } else { 7705 children = String(children); 7706 if (shapeFlag & 64) { 7707 type = 16; 7708 children = [createTextVNode(children)]; 7709 } else { 7710 type = 8; 7711 } 7712 } 7713 vnode.children = children; 7714 vnode.shapeFlag |= type; 7715} 7716function mergeProps(...args) { 7717 const ret = {}; 7718 for (let i2 = 0; i2 < args.length; i2++) { 7719 const toMerge = args[i2]; 7720 for (const key in toMerge) { 7721 if (key === "class") { 7722 if (ret.class !== toMerge.class) { 7723 ret.class = normalizeClass([ret.class, toMerge.class]); 7724 } 7725 } else if (key === "style") { 7726 ret.style = normalizeStyle([ret.style, toMerge.style]); 7727 } else if (isOn(key)) { 7728 const existing = ret[key]; 7729 const incoming = toMerge[key]; 7730 if (incoming && existing !== incoming && !(isArray$3(existing) && existing.includes(incoming))) { 7731 ret[key] = existing ? [].concat(existing, incoming) : incoming; 7732 } 7733 } else if (key !== "") { 7734 ret[key] = toMerge[key]; 7735 } 7736 } 7737 } 7738 return ret; 7739} 7740function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 7741 callWithAsyncErrorHandling(hook, instance, 7, [ 7742 vnode, 7743 prevVNode 7744 ]); 7745} 7746const emptyAppContext = createAppContext(); 7747let uid = 0;
vendor: 5,145 bytes, lines 7748-7931
7748function createComponentInstance(vnode, parent, suspense) { 7749 const type = vnode.type; 7750 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 7751 const instance = { 7752 uid: uid++, 7753 vnode, 7754 type, 7755 parent, 7756 appContext, 7757 root: null, 7758 // to be immediately set 7759 next: null, 7760 subTree: null, 7761 // will be set synchronously right after creation 7762 effect: null, 7763 update: null, 7764 // will be set synchronously right after creation 7765 job: null, 7766 scope: new EffectScope( 7767 true 7768 /* detached */ 7769 ), 7770 render: null, 7771 proxy: null, 7772 exposed: null, 7773 exposeProxy: null, 7774 withProxy: null, 7775 provides: parent ? parent.provides : Object.create(appContext.provides), 7776 ids: parent ? parent.ids : ["", 0, 0], 7777 accessCache: null, 7778 renderCache: [], 7779 // local resolved assets 7780 components: null, 7781 directives: null, 7782 // resolved props and emits options 7783 propsOptions: normalizePropsOptions(type, appContext), 7784 emitsOptions: normalizeEmitsOptions(type, appContext), 7785 // emit 7786 emit: null, 7787 // to be set immediately 7788 emitted: null, 7789 // props default value 7790 propsDefaults: EMPTY_OBJ, 7791 // inheritAttrs 7792 inheritAttrs: type.inheritAttrs, 7793 // state 7794 ctx: EMPTY_OBJ, 7795 data: EMPTY_OBJ, 7796 props: EMPTY_OBJ, 7797 attrs: EMPTY_OBJ, 7798 slots: EMPTY_OBJ, 7799 refs: EMPTY_OBJ, 7800 setupState: EMPTY_OBJ, 7801 setupContext: null, 7802 // suspense related 7803 suspense, 7804 suspenseId: suspense ? suspense.pendingId : 0, 7805 asyncDep: null, 7806 asyncResolved: false, 7807 // lifecycle hooks 7808 // not using enums here because it results in computed properties 7809 isMounted: false, 7810 isUnmounted: false, 7811 isDeactivated: false, 7812 bc: null, 7813 c: null, 7814 bm: null, 7815 m: null, 7816 bu: null, 7817 u: null, 7818 um: null, 7819 bum: null, 7820 da: null, 7821 a: null, 7822 rtg: null, 7823 rtc: null, 7824 ec: null, 7825 sp: null 7826 }; 7827 { 7828 instance.ctx = { _: instance }; 7829 } 7830 instance.root = parent ? parent.root : instance; 7831 instance.emit = emit.bind(null, instance); 7832 if (vnode.ce) { 7833 vnode.ce(instance); 7834 } 7835 return instance; 7836} 7837let currentInstance = null; 7838const getCurrentInstance = () => currentInstance || currentRenderingInstance; 7839let internalSetCurrentInstance; 7840let setInSSRSetupState; 7841{ 7842 const g = getGlobalThis(); 7843 const registerGlobalSetter = (key, setter) => { 7844 let setters; 7845 if (!(setters = g[key])) setters = g[key] = []; 7846 setters.push(setter); 7847 return (v2) => { 7848 if (setters.length > 1) setters.forEach((set) => set(v2)); 7849 else setters[0](v2); 7850 }; 7851 }; 7852 internalSetCurrentInstance = registerGlobalSetter( 7853 `__VUE_INSTANCE_SETTERS__`, 7854 (v2) => currentInstance = v2 7855 ); 7856 setInSSRSetupState = registerGlobalSetter( 7857 `__VUE_SSR_SETTERS__`, 7858 (v2) => isInSSRComponentSetup = v2 7859 ); 7860} 7861const setCurrentInstance = (instance) => { 7862 const prev = currentInstance; 7863 internalSetCurrentInstance(instance); 7864 instance.scope.on(); 7865 return () => { 7866 instance.scope.off(); 7867 internalSetCurrentInstance(prev); 7868 }; 7869}; 7870const unsetCurrentInstance = () => { 7871 currentInstance && currentInstance.scope.off(); 7872 internalSetCurrentInstance(null); 7873}; 7874function isStatefulComponent(instance) { 7875 return instance.vnode.shapeFlag & 4; 7876} 7877let isInSSRComponentSetup = false; 7878function setupComponent(instance, isSSR = false, optimized = false) { 7879 isSSR && setInSSRSetupState(isSSR); 7880 const { props, children } = instance.vnode; 7881 const isStateful = isStatefulComponent(instance); 7882 initProps(instance, props, isStateful, isSSR); 7883 initSlots(instance, children, optimized || isSSR); 7884 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 7885 isSSR && setInSSRSetupState(false); 7886 return setupResult; 7887} 7888function setupStatefulComponent(instance, isSSR) { 7889 const Component = instance.type; 7890 instance.accessCache = /* @__PURE__ */ Object.create(null); 7891 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 7892 const { setup } = Component; 7893 if (setup) { 7894 pauseTracking(); 7895 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 7896 const reset = setCurrentInstance(instance); 7897 const setupResult = callWithErrorHandling( 7898 setup, 7899 instance, 7900 0, 7901 [ 7902 instance.props, 7903 setupContext 7904 ] 7905 ); 7906 const isAsyncSetup = isPromise$1(setupResult); 7907 resetTracking(); 7908 reset(); 7909 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) { 7910 markAsyncBoundary(instance); 7911 } 7912 if (isAsyncSetup) { 7913 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 7914 if (isSSR) { 7915 return setupResult.then((resolvedResult) => { 7916 handleSetupResult(instance, resolvedResult); 7917 }).catch((e2) => { 7918 handleError(e2, instance, 0); 7919 }); 7920 } else { 7921 instance.asyncDep = setupResult; 7922 } 7923 } else { 7924 handleSetupResult(instance, setupResult); 7925 } 7926 } else { 7927 finishComponentSetup(instance); 7928 } 7929} 7930function handleSetupResult(instance, setupResult, isSSR) { 7931 if (isFunction$1(setupResult)) {
vendor: 3,569 bytes, lines 7932-8053
7932 if (instance.type.__ssrInlineRender) { 7933 instance.ssrRender = setupResult; 7934 } else { 7935 instance.render = setupResult; 7936 } 7937 } else if (isObject(setupResult)) { 7938 instance.setupState = proxyRefs(setupResult); 7939 } else ; 7940 finishComponentSetup(instance); 7941} 7942function finishComponentSetup(instance, isSSR, skipOptions) { 7943 const Component = instance.type; 7944 if (!instance.render) { 7945 instance.render = Component.render || NOOP; 7946 } 7947 { 7948 const reset = setCurrentInstance(instance); 7949 pauseTracking(); 7950 try { 7951 applyOptions(instance); 7952 } finally { 7953 resetTracking(); 7954 reset(); 7955 } 7956 } 7957} 7958const attrsProxyHandlers = { 7959 get(target, key) { 7960 track(target, "get", ""); 7961 return target[key]; 7962 } 7963}; 7964function createSetupContext(instance) { 7965 const expose = (exposed) => { 7966 instance.exposed = exposed || {}; 7967 }; 7968 { 7969 return { 7970 attrs: new Proxy(instance.attrs, attrsProxyHandlers), 7971 slots: instance.slots, 7972 emit: instance.emit, 7973 expose 7974 }; 7975 } 7976} 7977function getComponentPublicInstance(instance) { 7978 if (instance.exposed) { 7979 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 7980 get(target, key) { 7981 if (key in target) { 7982 return target[key]; 7983 } else if (key in publicPropertiesMap) { 7984 return publicPropertiesMap[key](instance); 7985 } 7986 }, 7987 has(target, key) { 7988 return key in target || key in publicPropertiesMap; 7989 } 7990 })); 7991 } else { 7992 return instance.proxy; 7993 } 7994} 7995const classifyRE = /(?:^|[-_])(\w)/g; 7996const classify = (str) => str.replace(classifyRE, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""); 7997function getComponentName(Component, includeInferred = true) { 7998 return isFunction$1(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 7999} 8000function formatComponentName(instance, Component, isRoot = false) { 8001 let name = getComponentName(Component); 8002 if (!name && Component.__file) { 8003 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 8004 if (match) { 8005 name = match[1]; 8006 } 8007 } 8008 if (!name && instance && instance.parent) { 8009 const inferFromRegistry = (registry) => { 8010 for (const key in registry) { 8011 if (registry[key] === Component) { 8012 return key; 8013 } 8014 } 8015 }; 8016 name = inferFromRegistry( 8017 instance.components || instance.parent.type.components 8018 ) || inferFromRegistry(instance.appContext.components); 8019 } 8020 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 8021} 8022function isClassComponent(value) { 8023 return isFunction$1(value) && "__vccOpts" in value; 8024} 8025const computed = (getterOrOptions, debugOptions) => { 8026 const c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 8027 return c2; 8028}; 8029function h$1(type, propsOrChildren, children) { 8030 const l2 = arguments.length; 8031 if (l2 === 2) { 8032 if (isObject(propsOrChildren) && !isArray$3(propsOrChildren)) { 8033 if (isVNode(propsOrChildren)) { 8034 return createVNode(type, null, [propsOrChildren]); 8035 } 8036 return createVNode(type, propsOrChildren); 8037 } else { 8038 return createVNode(type, null, propsOrChildren); 8039 } 8040 } else { 8041 if (l2 > 3) { 8042 children = Array.prototype.slice.call(arguments, 2); 8043 } else if (l2 === 3 && isVNode(children)) { 8044 children = [children]; 8045 } 8046 return createVNode(type, propsOrChildren, children); 8047 } 8048} 8049const version = "3.5.14"; 8050/** 8051* @vue/runtime-dom v3.5.14 8052* (c) 2018-present Yuxi (Evan) You and Vue contributors 8053* @license MIT
vendor: 5,405 bytes, lines 8054-8222
8054**/ 8055let policy = void 0; 8056const tt = typeof window !== "undefined" && window.trustedTypes; 8057if (tt) { 8058 try { 8059 policy = /* @__PURE__ */ tt.createPolicy("vue", { 8060 createHTML: (val) => val 8061 }); 8062 } catch (e2) { 8063 } 8064} 8065const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 8066const svgNS = "http://www.w3.org/2000/svg"; 8067const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 8068const doc = typeof document !== "undefined" ? document : null; 8069const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 8070const nodeOps = { 8071 insert: (child, parent, anchor) => { 8072 parent.insertBefore(child, anchor || null); 8073 }, 8074 remove: (child) => { 8075 const parent = child.parentNode; 8076 if (parent) { 8077 parent.removeChild(child); 8078 } 8079 }, 8080 createElement: (tag, namespace, is, props) => { 8081 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 8082 if (tag === "select" && props && props.multiple != null) { 8083 el.setAttribute("multiple", props.multiple); 8084 } 8085 return el; 8086 }, 8087 createText: (text) => doc.createTextNode(text), 8088 createComment: (text) => doc.createComment(text), 8089 setText: (node, text) => { 8090 node.nodeValue = text; 8091 }, 8092 setElementText: (el, text) => { 8093 el.textContent = text; 8094 }, 8095 parentNode: (node) => node.parentNode, 8096 nextSibling: (node) => node.nextSibling, 8097 querySelector: (selector) => doc.querySelector(selector), 8098 setScopeId(el, id) { 8099 el.setAttribute(id, ""); 8100 }, 8101 // __UNSAFE__ 8102 // Reason: innerHTML. 8103 // Static content here can only come from compiled templates. 8104 // As long as the user only uses trusted templates, this is safe. 8105 insertStaticContent(content, parent, anchor, namespace, start, end) { 8106 const before = anchor ? anchor.previousSibling : parent.lastChild; 8107 if (start && (start === end || start.nextSibling)) { 8108 while (true) { 8109 parent.insertBefore(start.cloneNode(true), anchor); 8110 if (start === end || !(start = start.nextSibling)) break; 8111 } 8112 } else { 8113 templateContainer.innerHTML = unsafeToTrustedHTML( 8114 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 8115 ); 8116 const template = templateContainer.content; 8117 if (namespace === "svg" || namespace === "mathml") { 8118 const wrapper = template.firstChild; 8119 while (wrapper.firstChild) { 8120 template.appendChild(wrapper.firstChild); 8121 } 8122 template.removeChild(wrapper); 8123 } 8124 parent.insertBefore(template, anchor); 8125 } 8126 return [ 8127 // first 8128 before ? before.nextSibling : parent.firstChild, 8129 // last 8130 anchor ? anchor.previousSibling : parent.lastChild 8131 ]; 8132 } 8133}; 8134const TRANSITION = "transition"; 8135const ANIMATION = "animation"; 8136const vtcKey = Symbol("_vtc"); 8137const DOMTransitionPropsValidators = { 8138 name: String, 8139 type: String, 8140 css: { 8141 type: Boolean, 8142 default: true 8143 }, 8144 duration: [String, Number, Object], 8145 enterFromClass: String, 8146 enterActiveClass: String, 8147 enterToClass: String, 8148 appearFromClass: String, 8149 appearActiveClass: String, 8150 appearToClass: String, 8151 leaveFromClass: String, 8152 leaveActiveClass: String, 8153 leaveToClass: String 8154}; 8155const TransitionPropsValidators = /* @__PURE__ */ extend( 8156 {}, 8157 BaseTransitionPropsValidators, 8158 DOMTransitionPropsValidators 8159); 8160const decorate$1 = (t2) => { 8161 t2.displayName = "Transition"; 8162 t2.props = TransitionPropsValidators; 8163 return t2; 8164}; 8165const Transition = /* @__PURE__ */ decorate$1( 8166 (props, { slots }) => h$1(BaseTransition, resolveTransitionProps(props), slots) 8167); 8168const callHook = (hook, args = []) => { 8169 if (isArray$3(hook)) { 8170 hook.forEach((h2) => h2(...args)); 8171 } else if (hook) { 8172 hook(...args); 8173 } 8174}; 8175const hasExplicitCallback = (hook) => { 8176 return hook ? isArray$3(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 8177}; 8178function resolveTransitionProps(rawProps) { 8179 const baseProps = {}; 8180 for (const key in rawProps) { 8181 if (!(key in DOMTransitionPropsValidators)) { 8182 baseProps[key] = rawProps[key]; 8183 } 8184 } 8185 if (rawProps.css === false) { 8186 return baseProps; 8187 } 8188 const { 8189 name = "v", 8190 type, 8191 duration, 8192 enterFromClass = `${name}-enter-from`, 8193 enterActiveClass = `${name}-enter-active`, 8194 enterToClass = `${name}-enter-to`, 8195 appearFromClass = enterFromClass, 8196 appearActiveClass = enterActiveClass, 8197 appearToClass = enterToClass, 8198 leaveFromClass = `${name}-leave-from`, 8199 leaveActiveClass = `${name}-leave-active`, 8200 leaveToClass = `${name}-leave-to` 8201 } = rawProps; 8202 const durations = normalizeDuration(duration); 8203 const enterDuration = durations && durations[0]; 8204 const leaveDuration = durations && durations[1]; 8205 const { 8206 onBeforeEnter, 8207 onEnter, 8208 onEnterCancelled, 8209 onLeave, 8210 onLeaveCancelled, 8211 onBeforeAppear = onBeforeEnter, 8212 onAppear = onEnter, 8213 onAppearCancelled = onEnterCancelled 8214 } = baseProps; 8215 const finishEnter = (el, isAppear, done, isCancelled) => { 8216 el._enterCancelled = isCancelled; 8217 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 8218 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 8219 done && done(); 8220 }; 8221 const finishLeave = (el, done) => { 8222 el._isLeaving = false;
vendor: 7,321 bytes, lines 8223-8468
8223 removeTransitionClass(el, leaveFromClass); 8224 removeTransitionClass(el, leaveToClass); 8225 removeTransitionClass(el, leaveActiveClass); 8226 done && done(); 8227 }; 8228 const makeEnterHook = (isAppear) => { 8229 return (el, done) => { 8230 const hook = isAppear ? onAppear : onEnter; 8231 const resolve2 = () => finishEnter(el, isAppear, done); 8232 callHook(hook, [el, resolve2]); 8233 nextFrame(() => { 8234 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 8235 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 8236 if (!hasExplicitCallback(hook)) { 8237 whenTransitionEnds(el, type, enterDuration, resolve2); 8238 } 8239 }); 8240 }; 8241 }; 8242 return extend(baseProps, { 8243 onBeforeEnter(el) { 8244 callHook(onBeforeEnter, [el]); 8245 addTransitionClass(el, enterFromClass); 8246 addTransitionClass(el, enterActiveClass); 8247 }, 8248 onBeforeAppear(el) { 8249 callHook(onBeforeAppear, [el]); 8250 addTransitionClass(el, appearFromClass); 8251 addTransitionClass(el, appearActiveClass); 8252 }, 8253 onEnter: makeEnterHook(false), 8254 onAppear: makeEnterHook(true), 8255 onLeave(el, done) { 8256 el._isLeaving = true; 8257 const resolve2 = () => finishLeave(el, done); 8258 addTransitionClass(el, leaveFromClass); 8259 if (!el._enterCancelled) { 8260 forceReflow(); 8261 addTransitionClass(el, leaveActiveClass); 8262 } else { 8263 addTransitionClass(el, leaveActiveClass); 8264 forceReflow(); 8265 } 8266 nextFrame(() => { 8267 if (!el._isLeaving) { 8268 return; 8269 } 8270 removeTransitionClass(el, leaveFromClass); 8271 addTransitionClass(el, leaveToClass); 8272 if (!hasExplicitCallback(onLeave)) { 8273 whenTransitionEnds(el, type, leaveDuration, resolve2); 8274 } 8275 }); 8276 callHook(onLeave, [el, resolve2]); 8277 }, 8278 onEnterCancelled(el) { 8279 finishEnter(el, false, void 0, true); 8280 callHook(onEnterCancelled, [el]); 8281 }, 8282 onAppearCancelled(el) { 8283 finishEnter(el, true, void 0, true); 8284 callHook(onAppearCancelled, [el]); 8285 }, 8286 onLeaveCancelled(el) { 8287 finishLeave(el); 8288 callHook(onLeaveCancelled, [el]); 8289 } 8290 }); 8291} 8292function normalizeDuration(duration) { 8293 if (duration == null) { 8294 return null; 8295 } else if (isObject(duration)) { 8296 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 8297 } else { 8298 const n2 = NumberOf(duration); 8299 return [n2, n2]; 8300 } 8301} 8302function NumberOf(val) { 8303 const res = toNumber(val); 8304 return res; 8305} 8306function addTransitionClass(el, cls) { 8307 cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2)); 8308 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 8309} 8310function removeTransitionClass(el, cls) { 8311 cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2)); 8312 const _vtc = el[vtcKey]; 8313 if (_vtc) { 8314 _vtc.delete(cls); 8315 if (!_vtc.size) { 8316 el[vtcKey] = void 0; 8317 } 8318 } 8319} 8320function nextFrame(cb) { 8321 requestAnimationFrame(() => { 8322 requestAnimationFrame(cb); 8323 }); 8324} 8325let endId = 0; 8326function whenTransitionEnds(el, expectedType, explicitTimeout, resolve2) { 8327 const id = el._endId = ++endId; 8328 const resolveIfNotStale = () => { 8329 if (id === el._endId) { 8330 resolve2(); 8331 } 8332 }; 8333 if (explicitTimeout != null) { 8334 return setTimeout(resolveIfNotStale, explicitTimeout); 8335 } 8336 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 8337 if (!type) { 8338 return resolve2(); 8339 } 8340 const endEvent = type + "end"; 8341 let ended = 0; 8342 const end = () => { 8343 el.removeEventListener(endEvent, onEnd); 8344 resolveIfNotStale(); 8345 }; 8346 const onEnd = (e2) => { 8347 if (e2.target === el && ++ended >= propCount) { 8348 end(); 8349 } 8350 }; 8351 setTimeout(() => { 8352 if (ended < propCount) { 8353 end(); 8354 } 8355 }, timeout + 1); 8356 el.addEventListener(endEvent, onEnd); 8357} 8358function getTransitionInfo(el, expectedType) { 8359 const styles = window.getComputedStyle(el); 8360 const getStyleProperties = (key) => (styles[key] || "").split(", "); 8361 const transitionDelays = getStyleProperties(`${TRANSITION}Delay`); 8362 const transitionDurations = getStyleProperties(`${TRANSITION}Duration`); 8363 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 8364 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 8365 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 8366 const animationTimeout = getTimeout(animationDelays, animationDurations); 8367 let type = null; 8368 let timeout = 0; 8369 let propCount = 0; 8370 if (expectedType === TRANSITION) { 8371 if (transitionTimeout > 0) { 8372 type = TRANSITION; 8373 timeout = transitionTimeout; 8374 propCount = transitionDurations.length; 8375 } 8376 } else if (expectedType === ANIMATION) { 8377 if (animationTimeout > 0) { 8378 type = ANIMATION; 8379 timeout = animationTimeout; 8380 propCount = animationDurations.length; 8381 } 8382 } else { 8383 timeout = Math.max(transitionTimeout, animationTimeout); 8384 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null; 8385 propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0; 8386 } 8387 const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test( 8388 getStyleProperties(`${TRANSITION}Property`).toString() 8389 ); 8390 return { 8391 type, 8392 timeout, 8393 propCount, 8394 hasTransform 8395 }; 8396} 8397function getTimeout(delays, durations) { 8398 while (delays.length < durations.length) { 8399 delays = delays.concat(delays); 8400 } 8401 return Math.max(...durations.map((d2, i2) => toMs(d2) + toMs(delays[i2]))); 8402} 8403function toMs(s2) { 8404 if (s2 === "auto") return 0; 8405 return Number(s2.slice(0, -1).replace(",", ".")) * 1e3; 8406} 8407function forceReflow() { 8408 return document.body.offsetHeight; 8409} 8410function patchClass(el, value, isSVG) { 8411 const transitionClasses = el[vtcKey]; 8412 if (transitionClasses) { 8413 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 8414 } 8415 if (value == null) { 8416 el.removeAttribute("class"); 8417 } else if (isSVG) { 8418 el.setAttribute("class", value); 8419 } else { 8420 el.className = value; 8421 } 8422} 8423const vShowOriginalDisplay = Symbol("_vod"); 8424const vShowHidden = Symbol("_vsh"); 8425const vShow = { 8426 beforeMount(el, { value }, { transition }) { 8427 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 8428 if (transition && value) { 8429 transition.beforeEnter(el); 8430 } else { 8431 setDisplay(el, value); 8432 } 8433 }, 8434 mounted(el, { value }, { transition }) { 8435 if (transition && value) { 8436 transition.enter(el); 8437 } 8438 }, 8439 updated(el, { value, oldValue }, { transition }) { 8440 if (!value === !oldValue) return; 8441 if (transition) { 8442 if (value) { 8443 transition.beforeEnter(el); 8444 setDisplay(el, true); 8445 transition.enter(el); 8446 } else { 8447 transition.leave(el, () => { 8448 setDisplay(el, false); 8449 }); 8450 } 8451 } else { 8452 setDisplay(el, value); 8453 } 8454 }, 8455 beforeUnmount(el, { value }) { 8456 setDisplay(el, value); 8457 } 8458}; 8459function setDisplay(el, value) { 8460 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 8461 el[vShowHidden] = !value; 8462} 8463const CSS_VAR_TEXT = Symbol(""); 8464const displayRE = /(^|;)\s*display\s*:/; 8465function patchStyle(el, prev, next) { 8466 const style = el.style; 8467 const isCssString = isString(next); 8468 let hasControlledDisplay = false;
vendor: 4,560 bytes, lines 8469-8627
8469 if (next && !isCssString) { 8470 if (prev) { 8471 if (!isString(prev)) { 8472 for (const key in prev) { 8473 if (next[key] == null) { 8474 setStyle(style, key, ""); 8475 } 8476 } 8477 } else { 8478 for (const prevStyle of prev.split(";")) { 8479 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 8480 if (next[key] == null) { 8481 setStyle(style, key, ""); 8482 } 8483 } 8484 } 8485 } 8486 for (const key in next) { 8487 if (key === "display") { 8488 hasControlledDisplay = true; 8489 } 8490 setStyle(style, key, next[key]); 8491 } 8492 } else { 8493 if (isCssString) { 8494 if (prev !== next) { 8495 const cssVarText = style[CSS_VAR_TEXT]; 8496 if (cssVarText) { 8497 next += ";" + cssVarText; 8498 } 8499 style.cssText = next; 8500 hasControlledDisplay = displayRE.test(next); 8501 } 8502 } else if (prev) { 8503 el.removeAttribute("style"); 8504 } 8505 } 8506 if (vShowOriginalDisplay in el) { 8507 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 8508 if (el[vShowHidden]) { 8509 style.display = "none"; 8510 } 8511 } 8512} 8513const importantRE = /\s*!important$/; 8514function setStyle(style, name, val) { 8515 if (isArray$3(val)) { 8516 val.forEach((v2) => setStyle(style, name, v2)); 8517 } else { 8518 if (val == null) val = ""; 8519 if (name.startsWith("--")) { 8520 style.setProperty(name, val); 8521 } else { 8522 const prefixed = autoPrefix(style, name); 8523 if (importantRE.test(val)) { 8524 style.setProperty( 8525 hyphenate(prefixed), 8526 val.replace(importantRE, ""), 8527 "important" 8528 ); 8529 } else { 8530 style[prefixed] = val; 8531 } 8532 } 8533 } 8534} 8535const prefixes = ["Webkit", "Moz", "ms"]; 8536const prefixCache = {}; 8537function autoPrefix(style, rawName) { 8538 const cached = prefixCache[rawName]; 8539 if (cached) { 8540 return cached; 8541 } 8542 let name = camelize(rawName); 8543 if (name !== "filter" && name in style) { 8544 return prefixCache[rawName] = name; 8545 } 8546 name = capitalize(name); 8547 for (let i2 = 0; i2 < prefixes.length; i2++) { 8548 const prefixed = prefixes[i2] + name; 8549 if (prefixed in style) { 8550 return prefixCache[rawName] = prefixed; 8551 } 8552 } 8553 return rawName; 8554} 8555const xlinkNS = "http://www.w3.org/1999/xlink"; 8556function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 8557 if (isSVG && key.startsWith("xlink:")) { 8558 if (value == null) { 8559 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 8560 } else { 8561 el.setAttributeNS(xlinkNS, key, value); 8562 } 8563 } else { 8564 if (value == null || isBoolean && !includeBooleanAttr(value)) { 8565 el.removeAttribute(key); 8566 } else { 8567 el.setAttribute( 8568 key, 8569 isBoolean ? "" : isSymbol(value) ? String(value) : value 8570 ); 8571 } 8572 } 8573} 8574function patchDOMProp(el, key, value, parentComponent, attrName) { 8575 if (key === "innerHTML" || key === "textContent") { 8576 if (value != null) { 8577 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 8578 } 8579 return; 8580 } 8581 const tag = el.tagName; 8582 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 8583 !tag.includes("-")) { 8584 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 8585 const newValue = value == null ? ( 8586 // #11647: value should be set as empty string for null and undefined, 8587 // but <input type="checkbox"> should be set as 'on'. 8588 el.type === "checkbox" ? "on" : "" 8589 ) : String(value); 8590 if (oldValue !== newValue || !("_value" in el)) { 8591 el.value = newValue; 8592 } 8593 if (value == null) { 8594 el.removeAttribute(key); 8595 } 8596 el._value = value; 8597 return; 8598 } 8599 let needRemove = false; 8600 if (value === "" || value == null) { 8601 const type = typeof el[key]; 8602 if (type === "boolean") { 8603 value = includeBooleanAttr(value); 8604 } else if (value == null && type === "string") { 8605 value = ""; 8606 needRemove = true; 8607 } else if (type === "number") { 8608 value = 0; 8609 needRemove = true; 8610 } 8611 } 8612 try { 8613 el[key] = value; 8614 } catch (e2) { 8615 } 8616 needRemove && el.removeAttribute(attrName || key); 8617} 8618function addEventListener(el, event, handler, options) { 8619 el.addEventListener(event, handler, options); 8620} 8621function removeEventListener(el, event, handler, options) { 8622 el.removeEventListener(event, handler, options); 8623} 8624const veiKey = Symbol("_vei"); 8625function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 8626 const invokers = el[veiKey] || (el[veiKey] = {}); 8627 const existingInvoker = invokers[rawName];
vendor: 1,826 bytes, lines 8628-8693
8628 if (nextValue && existingInvoker) { 8629 existingInvoker.value = nextValue; 8630 } else { 8631 const [name, options] = parseName(rawName); 8632 if (nextValue) { 8633 const invoker = invokers[rawName] = createInvoker( 8634 nextValue, 8635 instance 8636 ); 8637 addEventListener(el, name, invoker, options); 8638 } else if (existingInvoker) { 8639 removeEventListener(el, name, existingInvoker, options); 8640 invokers[rawName] = void 0; 8641 } 8642 } 8643} 8644const optionsModifierRE = /(?:Once|Passive|Capture)$/; 8645function parseName(name) { 8646 let options; 8647 if (optionsModifierRE.test(name)) { 8648 options = {}; 8649 let m; 8650 while (m = name.match(optionsModifierRE)) { 8651 name = name.slice(0, name.length - m[0].length); 8652 options[m[0].toLowerCase()] = true; 8653 } 8654 } 8655 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 8656 return [event, options]; 8657} 8658let cachedNow = 0; 8659const p$2 = /* @__PURE__ */ Promise.resolve(); 8660const getNow = () => cachedNow || (p$2.then(() => cachedNow = 0), cachedNow = Date.now()); 8661function createInvoker(initialValue, instance) { 8662 const invoker = (e2) => { 8663 if (!e2._vts) { 8664 e2._vts = Date.now(); 8665 } else if (e2._vts <= invoker.attached) { 8666 return; 8667 } 8668 callWithAsyncErrorHandling( 8669 patchStopImmediatePropagation(e2, invoker.value), 8670 instance, 8671 5, 8672 [e2] 8673 ); 8674 }; 8675 invoker.value = initialValue; 8676 invoker.attached = getNow(); 8677 return invoker; 8678} 8679function patchStopImmediatePropagation(e2, value) { 8680 if (isArray$3(value)) { 8681 const originalStop = e2.stopImmediatePropagation; 8682 e2.stopImmediatePropagation = () => { 8683 originalStop.call(e2); 8684 e2._stopped = true; 8685 }; 8686 return value.map( 8687 (fn) => (e22) => !e22._stopped && fn && fn(e22) 8688 ); 8689 } else { 8690 return value; 8691 } 8692} 8693const isNativeOn = (key) =>
8693 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 8694key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 8695const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 8696 const isSVG = namespace === "svg"; 8697 if (key === "class") { 8698 patchClass(el, nextValue, isSVG); 8699 } else if (key === "style") { 8700 patchStyle(el, prevValue, nextValue); 8701 } else if (isOn(key)) { 8702 if (!isModelListener(key)) { 8703 patchEvent(el, key, prevValue, nextValue, parentComponent); 8704 } 8705 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 8706 patchDOMProp(el, key, nextValue); 8707 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 8708 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 8709 } 8710 } else if ( 8711 // #11081 force set props for possible async custom element 8712 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) 8713 ) { 8714 patchDOMProp(el, camelize(key), nextValue, parentComponent, key); 8715 } else { 8716 if (key === "true-value") { 8717 el._trueValue = nextValue; 8718 } else if (key === "false-value") { 8719 el._falseValue = nextValue; 8720 } 8721 patchAttr(el, key, nextValue, isSVG); 8722 } 8723}; 8724function shouldSetAsProp(el, key, value, isSVG) { 8725 if (isSVG) { 8726 if (key === "innerHTML" || key === "textContent") { 8727 return true; 8728 } 8729 if (key in el && isNativeOn(key) && isFunction$1(value)) { 8730 return true; 8731 } 8732 return false; 8733 } 8734 if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { 8735 return false; 8736 } 8737 if (key === "form") { 8738 return false; 8739 } 8740 if (key === "list" && el.tagName === "INPUT") { 8741 return false; 8742 } 8743 if (key === "type" && el.tagName === "TEXTAREA") { 8744 return false; 8745 } 8746 if (key === "width" || key === "height") { 8747 const tag = el.tagName; 8748 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 8749 return false; 8750 } 8751 } 8752 if (isNativeOn(key) && isString(value)) { 8753 return false; 8754 } 8755 return key in el; 8756} 8757const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 8758const modifierGuards = { 8759 stop: (e2) => e2.stopPropagation(), 8760 prevent: (e2) => e2.preventDefault(), 8761 self: (e2) => e2.target !== e2.currentTarget, 8762 ctrl: (e2) => !e2.ctrlKey, 8763 shift: (e2) => !e2.shiftKey, 8764 alt: (e2) => !e2.altKey, 8765 meta: (e2) => !e2.metaKey, 8766 left: (e2) => "button" in e2 && e2.button !== 0, 8767 middle: (e2) => "button" in e2 && e2.button !== 1, 8768 right: (e2) => "button" in e2 && e2.button !== 2, 8769 exact: (e2, modifiers) => systemModifiers.some((m) => e2[`${m}Key`] && !modifiers.includes(m)) 8770}; 8771const withModifiers = (fn, modifiers) => { 8772 const cache = fn._withMods || (fn._withMods = {}); 8773 const cacheKey = modifiers.join("."); 8774 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => { 8775 for (let i2 = 0; i2 < modifiers.length; i2++) { 8776 const guard = modifierGuards[modifiers[i2]]; 8777 if (guard && guard(event, modifiers)) return; 8778 } 8779 return fn(event, ...args); 8780 }); 8781}; 8782const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 8783let renderer; 8784let enabledHydration = false; 8785function ensureRenderer() { 8786 return renderer || (renderer = createRenderer(rendererOptions)); 8787} 8788function ensureHydrationRenderer() { 8789 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 8790 enabledHydration = true; 8791 return renderer; 8792} 8793const createApp = (...args) => { 8794 const app = ensureRenderer().createApp(...args); 8795 const { mount } = app; 8796 app.mount = (containerOrSelector) => { 8797 const container = normalizeContainer(containerOrSelector); 8798 if (!container) return; 8799 const component = app._component; 8800 if (!isFunction$1(component) && !component.render && !component.template) { 8801 component.template = container.innerHTML; 8802 } 8803 if (container.nodeType === 1) { 8804 container.textContent = ""; 8805 } 8806 const proxy = mount(container, false, resolveRootNamespace(container)); 8807 if (container instanceof Element) { 8808 container.removeAttribute("v-cloak"); 8809 container.setAttribute("data-v-app", ""); 8810 } 8811 return proxy; 8812 }; 8813 return app; 8814}; 8815const createSSRApp = (...args) => { 8816 const app = ensureHydrationRenderer().createApp(...args); 8817 const { mount } = app; 8818 app.mount = (containerOrSelector) => { 8819 const container = normalizeContainer(containerOrSelector); 8820 if (container) { 8821 return mount(container, true, resolveRootNamespace(container)); 8822 } 8823 }; 8824 return app; 8825}; 8826function resolveRootNamespace(container) { 8827 if (container instanceof SVGElement) { 8828 return "svg"; 8829 } 8830 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 8831 return "mathml"; 8832 } 8833} 8834function normalizeContainer(container) { 8835 if (isString(container)) { 8836 const res = document.querySelector(container); 8837 return res; 8838 } 8839 return container; 8840} 8841const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/; 8842const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/; 8843const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; 8844function jsonParseTransform(key, value) { 8845 if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) { 8846 warnKeyDropped(key); 8847 return; 8848 } 8849 return value; 8850} 8851function warnKeyDropped(key) { 8852 console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`); 8853} 8854function destr(value, options = {}) { 8855 if (typeof value !== "string") { 8856 return value; 8857 } 8858 if (value[0] === '"' && value[value.length - 1] === '"' && value.indexOf("\\") === -1) { 8859 return value.slice(1, -1); 8860 } 8861 const _value = value.trim(); 8862 if (_value.length <= 9) { 8863 switch (_value.toLowerCase()) { 8864 case "true": { 8865 return true; 8866 } 8867 case "false": { 8868 return false;
vendor: 9,813 bytes, lines 8869-9195
8869 } 8870 case "undefined": { 8871 return void 0; 8872 } 8873 case "null": { 8874 return null; 8875 } 8876 case "nan": { 8877 return Number.NaN; 8878 } 8879 case "infinity": { 8880 return Number.POSITIVE_INFINITY; 8881 } 8882 case "-infinity": { 8883 return Number.NEGATIVE_INFINITY; 8884 } 8885 } 8886 } 8887 if (!JsonSigRx.test(value)) { 8888 if (options.strict) { 8889 throw new SyntaxError("[destr] Invalid JSON"); 8890 } 8891 return value; 8892 } 8893 try { 8894 if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) { 8895 if (options.strict) { 8896 throw new Error("[destr] Possible prototype pollution"); 8897 } 8898 return JSON.parse(value, jsonParseTransform); 8899 } 8900 return JSON.parse(value); 8901 } catch (error) { 8902 if (options.strict) { 8903 throw error; 8904 } 8905 return value; 8906 } 8907} 8908const HASH_RE$1 = /#/g; 8909const AMPERSAND_RE$1 = /&/g; 8910const SLASH_RE$1 = /\//g; 8911const EQUAL_RE$1 = /=/g; 8912const PLUS_RE$1 = /\+/g; 8913const ENC_CARET_RE$1 = /%5e/gi; 8914const ENC_BACKTICK_RE$1 = /%60/gi; 8915const ENC_PIPE_RE$1 = /%7c/gi; 8916const ENC_SPACE_RE$1 = /%20/gi; 8917function encode(text) { 8918 return encodeURI("" + text).replace(ENC_PIPE_RE$1, "|"); 8919} 8920function encodeQueryValue$1(input) { 8921 return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE$1, "%2B").replace(ENC_SPACE_RE$1, "+").replace(HASH_RE$1, "%23").replace(AMPERSAND_RE$1, "%26").replace(ENC_BACKTICK_RE$1, "`").replace(ENC_CARET_RE$1, "^").replace(SLASH_RE$1, "%2F"); 8922} 8923function encodeQueryKey$1(text) { 8924 return encodeQueryValue$1(text).replace(EQUAL_RE$1, "%3D"); 8925} 8926function decode$1(text = "") { 8927 try { 8928 return decodeURIComponent("" + text); 8929 } catch { 8930 return "" + text; 8931 } 8932} 8933function decodeQueryKey(text) { 8934 return decode$1(text.replace(PLUS_RE$1, " ")); 8935} 8936function decodeQueryValue(text) { 8937 return decode$1(text.replace(PLUS_RE$1, " ")); 8938} 8939function parseQuery$1(parametersString = "") { 8940 const object = /* @__PURE__ */ Object.create(null); 8941 if (parametersString[0] === "?") { 8942 parametersString = parametersString.slice(1); 8943 } 8944 for (const parameter of parametersString.split("&")) { 8945 const s2 = parameter.match(/([^=]+)=?(.*)/) || []; 8946 if (s2.length < 2) { 8947 continue; 8948 } 8949 const key = decodeQueryKey(s2[1]); 8950 if (key === "__proto__" || key === "constructor") { 8951 continue; 8952 } 8953 const value = decodeQueryValue(s2[2] || ""); 8954 if (object[key] === void 0) { 8955 object[key] = value; 8956 } else if (Array.isArray(object[key])) { 8957 object[key].push(value); 8958 } else { 8959 object[key] = [object[key], value]; 8960 } 8961 } 8962 return object; 8963} 8964function encodeQueryItem(key, value) { 8965 if (typeof value === "number" || typeof value === "boolean") { 8966 value = String(value); 8967 } 8968 if (!value) { 8969 return encodeQueryKey$1(key); 8970 } 8971 if (Array.isArray(value)) { 8972 return value.map( 8973 (_value) => `${encodeQueryKey$1(key)}=${encodeQueryValue$1(_value)}` 8974 ).join("&"); 8975 } 8976 return `${encodeQueryKey$1(key)}=${encodeQueryValue$1(value)}`; 8977} 8978function stringifyQuery$1(query) { 8979 return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&"); 8980} 8981const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/; 8982const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/; 8983const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/; 8984const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i; 8985const TRAILING_SLASH_RE$1 = /\/$|\/\?|\/#/; 8986const JOIN_LEADING_SLASH_RE = /^\.?\//; 8987function hasProtocol(inputString, opts = {}) { 8988 if (typeof opts === "boolean") { 8989 opts = { acceptRelative: opts }; 8990 } 8991 if (opts.strict) { 8992 return PROTOCOL_STRICT_REGEX.test(inputString); 8993 } 8994 return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false); 8995} 8996function isScriptProtocol(protocol) { 8997 return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol); 8998} 8999function hasTrailingSlash(input = "", respectQueryAndFragment) { 9000 if (!respectQueryAndFragment) { 9001 return input.endsWith("/"); 9002 } 9003 return TRAILING_SLASH_RE$1.test(input); 9004} 9005function withoutTrailingSlash(input = "", respectQueryAndFragment) { 9006 if (!respectQueryAndFragment) { 9007 return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/"; 9008 } 9009 if (!hasTrailingSlash(input, true)) { 9010 return input || "/"; 9011 } 9012 let path = input; 9013 let fragment = ""; 9014 const fragmentIndex = input.indexOf("#"); 9015 if (fragmentIndex !== -1) { 9016 path = input.slice(0, fragmentIndex); 9017 fragment = input.slice(fragmentIndex); 9018 } 9019 const [s0, ...s2] = path.split("?"); 9020 const cleanPath = s0.endsWith("/") ? s0.slice(0, -1) : s0; 9021 return (cleanPath || "/") + (s2.length > 0 ? `?${s2.join("?")}` : "") + fragment; 9022} 9023function withTrailingSlash(input = "", respectQueryAndFragment) { 9024 if (!respectQueryAndFragment) { 9025 return input.endsWith("/") ? input : input + "/"; 9026 } 9027 if (hasTrailingSlash(input, true)) { 9028 return input || "/"; 9029 } 9030 let path = input; 9031 let fragment = ""; 9032 const fragmentIndex = input.indexOf("#"); 9033 if (fragmentIndex !== -1) { 9034 path = input.slice(0, fragmentIndex); 9035 fragment = input.slice(fragmentIndex); 9036 if (!path) { 9037 return fragment; 9038 } 9039 } 9040 const [s0, ...s2] = path.split("?"); 9041 return s0 + "/" + (s2.length > 0 ? `?${s2.join("?")}` : "") + fragment; 9042} 9043function withBase(input, base) { 9044 if (isEmptyURL(base) || hasProtocol(input)) { 9045 return input; 9046 } 9047 const _base = withoutTrailingSlash(base); 9048 if (input.startsWith(_base)) { 9049 return input; 9050 } 9051 return joinURL(_base, input); 9052} 9053function withoutBase(input, base) { 9054 if (isEmptyURL(base)) { 9055 return input; 9056 } 9057 const _base = withoutTrailingSlash(base); 9058 if (!input.startsWith(_base)) { 9059 return input; 9060 } 9061 const trimmed = input.slice(_base.length); 9062 return trimmed[0] === "/" ? trimmed : "/" + trimmed; 9063} 9064function withQuery(input, query) { 9065 const parsed = parseURL$1(input); 9066 const mergedQuery = { ...parseQuery$1(parsed.search), ...query }; 9067 parsed.search = stringifyQuery$1(mergedQuery); 9068 return stringifyParsedURL(parsed); 9069} 9070function isEmptyURL(url) { 9071 return !url || url === "/"; 9072} 9073function isNonEmptyURL(url) { 9074 return url && url !== "/"; 9075} 9076function joinURL(base, ...input) { 9077 let url = base || ""; 9078 for (const segment of input.filter((url2) => isNonEmptyURL(url2))) { 9079 if (url) { 9080 const _segment = segment.replace(JOIN_LEADING_SLASH_RE, ""); 9081 url = withTrailingSlash(url) + _segment; 9082 } else { 9083 url = segment; 9084 } 9085 } 9086 return url; 9087} 9088function joinRelativeURL(..._input) { 9089 var _a3, _b, _c, _d; 9090 const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/; 9091 const input = _input.filter(Boolean); 9092 const segments = []; 9093 let segmentsDepth = 0; 9094 for (const i2 of input) { 9095 if (!i2 || i2 === "/") { 9096 continue; 9097 } 9098 for (const [sindex, s2] of i2.split(JOIN_SEGMENT_SPLIT_RE).entries()) { 9099 if (!s2 || s2 === ".") { 9100 continue; 9101 } 9102 if (s2 === "..") { 9103 if (segments.length === 1 && hasProtocol(segments[0])) { 9104 continue; 9105 } 9106 segments.pop(); 9107 segmentsDepth--; 9108 continue; 9109 } 9110 if (sindex === 1 && ((_a3 = segments[segments.length - 1]) == null ? void 0 : _a3.endsWith(":/"))) { 9111 segments[segments.length - 1] += "/" + s2; 9112 continue; 9113 } 9114 segments.push(s2); 9115 segmentsDepth++; 9116 } 9117 } 9118 let url = segments.join("/"); 9119 if (segmentsDepth >= 0) { 9120 if (((_b = input[0]) == null ? void 0 : _b.startsWith("/")) && !url.startsWith("/")) { 9121 url = "/" + url; 9122 } else if (((_c = input[0]) == null ? void 0 : _c.startsWith("./")) && !url.startsWith("./")) { 9123 url = "./" + url; 9124 } 9125 } else { 9126 url = "../".repeat(-1 * segmentsDepth) + url; 9127 } 9128 if (((_d = input[input.length - 1]) == null ? void 0 : _d.endsWith("/")) && !url.endsWith("/")) { 9129 url += "/"; 9130 } 9131 return url; 9132} 9133function withHttps(input) { 9134 return withProtocol(input, "https://"); 9135} 9136function withProtocol(input, protocol) { 9137 let match = input.match(PROTOCOL_REGEX); 9138 if (!match) { 9139 match = input.match(/^\/{2,}/); 9140 } 9141 if (!match) { 9142 return protocol + input; 9143 } 9144 return protocol + input.slice(match[0].length); 9145} 9146function isSamePath(p1, p2) { 9147 return decode$1(withoutTrailingSlash(p1)) === decode$1(withoutTrailingSlash(p2)); 9148} 9149const protocolRelative = Symbol.for("ufo:protocolRelative"); 9150function parseURL$1(input = "", defaultProto) { 9151 const _specialProtoMatch = input.match( 9152 /^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i 9153 ); 9154 if (_specialProtoMatch) { 9155 const [, _proto, _pathname = ""] = _specialProtoMatch; 9156 return { 9157 protocol: _proto.toLowerCase(), 9158 pathname: _pathname, 9159 href: _proto + _pathname, 9160 auth: "", 9161 host: "", 9162 search: "", 9163 hash: "" 9164 }; 9165 } 9166 if (!hasProtocol(input, { acceptRelative: true })) { 9167 return parsePath(input); 9168 } 9169 const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || []; 9170 let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || []; 9171 if (protocol === "file:") { 9172 path = path.replace(/\/(?=[A-Za-z]:)/, ""); 9173 } 9174 const { pathname, search, hash } = parsePath(path); 9175 return { 9176 protocol: protocol.toLowerCase(), 9177 auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "", 9178 host, 9179 pathname, 9180 search, 9181 hash, 9182 [protocolRelative]: !protocol 9183 }; 9184} 9185function parsePath(input = "") { 9186 const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1); 9187 return { 9188 pathname, 9189 search, 9190 hash 9191 }; 9192} 9193function stringifyParsedURL(parsed) { 9194 const pathname = parsed.pathname || ""; 9195 const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
9196 const hash = parsed.hash || ""; 9197 const auth = parsed.auth ? parsed.auth + "@" : ""; 9198 const host = parsed.host || ""; 9199 const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : ""; 9200 return proto + auth + host + pathname + search + hash; 9201} 9202class FetchError extends Error { 9203 constructor(message, opts) { 9204 super(message, opts); 9205 this.name = "FetchError"; 9206 if ((opts == null ? void 0 : opts.cause) && !this.cause) { 9207 this.cause = opts.cause; 9208 } 9209 } 9210} 9211function createFetchError(ctx) { 9212 var _a3, _b, _c, _d, _e2; 9213 const errorMessage = ((_a3 = ctx.error) == null ? void 0 : _a3.message) || ((_b = ctx.error) == null ? void 0 : _b.toString()) || ""; 9214 const method = ((_c = ctx.request) == null ? void 0 : _c.method) || ((_d = ctx.options) == null ? void 0 : _d.method) || "GET"; 9215 const url = ((_e2 = ctx.request) == null ? void 0 : _e2.url) || String(ctx.request) || "/"; 9216 const requestStr = `[${method}] ${JSON.stringify(url)}`; 9217 const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>"; 9218 const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`; 9219 const fetchError = new FetchError( 9220 message, 9221 ctx.error ? { cause: ctx.error } : void 0 9222 ); 9223 for (const key of ["request", "options", "response"]) { 9224 Object.defineProperty(fetchError, key, { 9225 get() { 9226 return ctx[key]; 9227 } 9228 }); 9229 } 9230 for (const [key, refKey] of [ 9231 ["data", "_data"], 9232 ["status", "status"], 9233 ["statusCode", "status"], 9234 ["statusText", "statusText"], 9235 ["statusMessage", "statusText"] 9236 ]) { 9237 Object.defineProperty(fetchError, key, { 9238 get() { 9239 return ctx.response && ctx.response[refKey]; 9240 } 9241 }); 9242 } 9243 return fetchError; 9244} 9245const payloadMethods = new Set( 9246 Object.freeze(["PATCH", "POST", "PUT", "DELETE"]) 9247); 9248function isPayloadMethod(method = "GET") { 9249 return payloadMethods.has(method.toUpperCase()); 9250} 9251function isJSONSerializable(value) { 9252 if (value === void 0) { 9253 return false; 9254 } 9255 const t2 = typeof value; 9256 if (t2 === "string" || t2 === "number" || t2 === "boolean" || t2 === null) { 9257 return true; 9258 } 9259 if (t2 !== "object") { 9260 return false; 9261 } 9262 if (Array.isArray(value)) { 9263 return true; 9264 } 9265 if (value.buffer) { 9266 return false; 9267 } 9268 return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function"; 9269} 9270const textTypes = /* @__PURE__ */ new Set([ 9271 "image/svg", 9272 "application/xml", 9273 "application/xhtml", 9274 "application/html" 9275]); 9276const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i; 9277function detectResponseType(_contentType = "") { 9278 if (!_contentType) { 9279 return "json"; 9280 } 9281 const contentType = _contentType.split(";").shift() || ""; 9282 if (JSON_RE.test(contentType)) { 9283 return "json"; 9284 } 9285 if (textTypes.has(contentType) || contentType.startsWith("text/")) { 9286 return "text"; 9287 } 9288 return "blob"; 9289} 9290function resolveFetchOptions(request, input, defaults2, Headers2) { 9291 const headers = mergeHeaders( 9292 (input == null ? void 0 : input.headers) ?? (request == null ? void 0 : request.headers), 9293 defaults2 == null ? void 0 : defaults2.headers, 9294 Headers2 9295 ); 9296 let query; 9297 if ((defaults2 == null ? void 0 : defaults2.query) || (defaults2 == null ? void 0 : defaults2.params) || (input == null ? void 0 : input.params) || (input == null ? void 0 : input.query)) { 9298 query = { 9299 ...defaults2 == null ? void 0 : defaults2.params, 9300 ...defaults2 == null ? void 0 : defaults2.query, 9301 ...input == null ? void 0 : input.params, 9302 ...input == null ? void 0 : input.query 9303 }; 9304 } 9305 return { 9306 ...defaults2, 9307 ...input, 9308 query, 9309 params: query, 9310 headers 9311 }; 9312} 9313function mergeHeaders(input, defaults2, Headers2) { 9314 if (!defaults2) { 9315 return new Headers2(input); 9316 } 9317 const headers = new Headers2(defaults2); 9318 if (input) { 9319 for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers2(input)) { 9320 headers.set(key, value); 9321 } 9322 } 9323 return headers; 9324} 9325async function callHooks(context, hooks) { 9326 if (hooks) { 9327 if (Array.isArray(hooks)) { 9328 for (const hook of hooks) { 9329 await hook(context); 9330 } 9331 } else { 9332 await hooks(context); 9333 } 9334 } 9335} 9336const retryStatusCodes = /* @__PURE__ */ new Set([ 9337 408, 9338 // Request Timeout 9339 409, 9340 // Conflict 9341 425, 9342 // Too Early (Experimental) 9343 429, 9344 // Too Many Requests 9345 500, 9346 // Internal Server Error 9347 502, 9348 // Bad Gateway 9349 503, 9350 // Service Unavailable 9351 504 9352 // Gateway Timeout 9353]); 9354const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]); 9355function createFetch(globalOptions = {}) { 9356 const { 9357 fetch: fetch2 = globalThis.fetch, 9358 Headers: Headers2 = globalThis.Headers, 9359 AbortController: AbortController2 = globalThis.AbortController 9360 } = globalOptions; 9361 async function onError(context) { 9362 const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false; 9363 if (context.options.retry !== false && !isAbort) { 9364 let retries; 9365 if (typeof context.options.retry === "number") { 9366 retries = context.options.retry; 9367 } else { 9368 retries = isPayloadMethod(context.options.method) ? 0 : 1; 9369 } 9370 const responseCode = context.response && context.response.status || 500; 9371 if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) { 9372 const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0; 9373 if (retryDelay > 0) { 9374 await new Promise((resolve2) => setTimeout(resolve2, retryDelay)); 9375 } 9376 return $fetchRaw(context.request, { 9377 ...context.options, 9378 retry: retries - 1 9379 }); 9380 } 9381 } 9382 const error = createFetchError(context); 9383 if (Error.captureStackTrace) { 9384 Error.captureStackTrace(error, $fetchRaw); 9385 } 9386 throw error; 9387 } 9388 const $fetchRaw = async function $fetchRaw2(_request2, _options = {}) { 9389 const context = { 9390 request: _request2, 9391 options: resolveFetchOptions( 9392 _request2, 9393 _options, 9394 globalOptions.defaults, 9395 Headers2 9396 ), 9397 response: void 0, 9398 error: void 0 9399 }; 9400 if (context.options.method) { 9401 context.options.method = context.options.method.toUpperCase(); 9402 } 9403 if (context.options.onRequest) { 9404 await callHooks(context, context.options.onRequest); 9405 } 9406 if (typeof context.request === "string") { 9407 if (context.options.baseURL) { 9408 context.request = withBase(context.request, context.options.baseURL); 9409 } 9410 if (context.options.query) { 9411 context.request = withQuery(context.request, context.options.query); 9412 delete context.options.query; 9413 } 9414 if ("query" in context.options) { 9415 delete context.options.query; 9416 } 9417 if ("params" in context.options) { 9418 delete context.options.params; 9419 } 9420 } 9421 if (context.options.body && isPayloadMethod(context.options.method)) { 9422 if (isJSONSerializable(context.options.body)) { 9423 context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body); 9424 context.options.headers = new Headers2(context.options.headers || {}); 9425 if (!context.options.headers.has("content-type")) { 9426 context.options.headers.set("content-type", "application/json"); 9427 } 9428 if (!context.options.headers.has("accept")) { 9429 context.options.headers.set("accept", "application/json"); 9430 } 9431 } else if ( 9432 // ReadableStream Body 9433 "pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || // Node.js Stream Body 9434 typeof context.options.body.pipe === "function" 9435 ) { 9436 if (!("duplex" in context.options)) { 9437 context.options.duplex = "half"; 9438 } 9439 } 9440 } 9441 let abortTimeout; 9442 if (!context.options.signal && context.options.timeout) { 9443 const controller = new AbortController2(); 9444 abortTimeout = setTimeout(() => { 9445 const error = new Error( 9446 "[TimeoutError]: The operation was aborted due to timeout" 9447 );
9448 error.name = "TimeoutError"; 9449 error.code = 23; 9450 controller.abort(error); 9451 }, context.options.timeout); 9452 context.options.signal = controller.signal; 9453 } 9454 try { 9455 context.response = await fetch2( 9456 context.request, 9457 context.options 9458 ); 9459 } catch (error) { 9460 context.error = error; 9461 if (context.options.onRequestError) { 9462 await callHooks( 9463 context, 9464 context.options.onRequestError 9465 ); 9466 } 9467 return await onError(context); 9468 } finally { 9469 if (abortTimeout) { 9470 clearTimeout(abortTimeout); 9471 } 9472 } 9473 const hasBody = (context.response.body || // https://github.com/unjs/ofetch/issues/324 9474 // https://github.com/unjs/ofetch/issues/294 9475 // https://github.com/JakeChampion/fetch/issues/1454 9476 context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD"; 9477 if (hasBody) { 9478 const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || ""); 9479 switch (responseType) { 9480 case "json": { 9481 const data = await context.response.text(); 9482 const parseFunction = context.options.parseResponse || destr; 9483 context.response._data = parseFunction(data); 9484 break; 9485 } 9486 case "stream": { 9487 context.response._data = context.response.body || context.response._bodyInit; 9488 break; 9489 } 9490 default: { 9491 context.response._data = await context.response[responseType](); 9492 } 9493 } 9494 } 9495 if (context.options.onResponse) { 9496 await callHooks( 9497 context, 9498 context.options.onResponse 9499 ); 9500 } 9501 if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) { 9502 if (context.options.onResponseError) { 9503 await callHooks( 9504 context, 9505 context.options.onResponseError 9506 ); 9507 } 9508 return await onError(context); 9509 } 9510 return context.response; 9511 }; 9512 const $fetch2 = async function $fetch22(request, options) { 9513 const r2 = await $fetchRaw(request, options); 9514 return r2._data; 9515 }; 9516 $fetch2.raw = $fetchRaw; 9517 $fetch2.native = (...args) => fetch2(...args); 9518 $fetch2.create = (defaultOptions2 = {}, customGlobalOptions = {}) => createFetch({ 9519 ...globalOptions, 9520 ...customGlobalOptions, 9521 defaults: { 9522 ...globalOptions.defaults, 9523 ...customGlobalOptions.defaults, 9524 ...defaultOptions2 9525 } 9526 }); 9527 return $fetch2; 9528} 9529const _globalThis$1 = function() { 9530 if (typeof globalThis !== "undefined") { 9531 return globalThis; 9532 } 9533 if (typeof self !== "undefined") { 9534 return self; 9535 } 9536 if (typeof window !== "undefined") { 9537 return window; 9538 } 9539 if (typeof global !== "undefined") { 9540 return global; 9541 } 9542 throw new Error("unable to locate global object"); 9543}(); 9544const fetch$1 = _globalThis$1.fetch ? (...args) => _globalThis$1.fetch(...args) : () => Promise.reject(new Error("[ofetch] global.fetch is not supported!")); 9545const Headers = _globalThis$1.Headers; 9546const AbortController$1 = _globalThis$1.AbortController; 9547const ofetch = createFetch({ fetch: fetch$1, Headers, AbortController: AbortController$1 }); 9548const $fetch$1 = ofetch; 9549const useRuntimeConfig$1 = () => { 9550 var _a3; 9551 return ((_a3 = window == null ? void 0 : window.__NUXT__) == null ? void 0 : _a3.config) || {}; 9552}; 9553const appConfig = useRuntimeConfig$1().app; 9554const baseURL = () => appConfig.baseURL; 9555const buildAssetsDir = () => appConfig.buildAssetsDir; 9556const buildAssetsURL = (...path) => joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path); 9557const publicAssetsURL = (...path) => { 9558 const publicBase = appConfig.cdnURL || appConfig.baseURL; 9559 return path.length ? joinRelativeURL(publicBase, ...path) : publicBase; 9560}; 9561{ 9562 globalThis.__buildAssetsURL = buildAssetsURL; 9563 globalThis.__publicAssetsURL = publicAssetsURL; 9564} 9565if (!globalThis.$fetch) { 9566 globalThis.$fetch = $fetch$1.create({ 9567 baseURL: baseURL() 9568 }); 9569} 9570function flatHooks(configHooks, hooks = {}, parentName) { 9571 for (const key in configHooks) { 9572 const subHook = configHooks[key]; 9573 const name = parentName ? `${parentName}:${key}` : key; 9574 if (typeof subHook === "object" && subHook !== null) { 9575 flatHooks(subHook, hooks, name); 9576 } else if (typeof subHook === "function") { 9577 hooks[name] = subHook; 9578 } 9579 } 9580 return hooks; 9581} 9582const defaultTask = { run: (function_) => function_() }; 9583const _createTask = () => defaultTask; 9584const createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask; 9585function serialTaskCaller(hooks, args) { 9586 const name = args.shift(); 9587 const task = createTask(name); 9588 return hooks.reduce( 9589 (promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))), 9590 Promise.resolve() 9591 ); 9592} 9593function parallelTaskCaller(hooks, args) { 9594 const name = args.shift(); 9595 const task = createTask(name); 9596 return Promise.all(hooks.map((hook) => task.run(() => hook(...args)))); 9597} 9598function callEachWith(callbacks, arg0) { 9599 for (const callback of [...callbacks]) { 9600 callback(arg0); 9601 } 9602} 9603class Hookable { 9604 constructor() { 9605 this._hooks = {}; 9606 this._before = void 0; 9607 this._after = void 0; 9608 this._deprecatedMessages = void 0; 9609 this._deprecatedHooks = {}; 9610 this.hook = this.hook.bind(this); 9611 this.callHook = this.callHook.bind(this); 9612 this.callHookWith = this.callHookWith.bind(this); 9613 } 9614 hook(name, function_, options = {}) { 9615 if (!name || typeof function_ !== "function") { 9616 return () => { 9617 }; 9618 } 9619 const originalName = name; 9620 let dep; 9621 while (this._deprecatedHooks[name]) { 9622 dep = this._deprecatedHooks[name]; 9623 name = dep.to; 9624 } 9625 if (dep && !options.allowDeprecated) { 9626 let message = dep.message; 9627 if (!message) { 9628 message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : ""); 9629 } 9630 if (!this._deprecatedMessages) { 9631 this._deprecatedMessages = /* @__PURE__ */ new Set(); 9632 } 9633 if (!this._deprecatedMessages.has(message)) { 9634 console.warn(message); 9635 this._deprecatedMessages.add(message); 9636 } 9637 } 9638 if (!function_.name) {
9639 try { 9640 Object.defineProperty(function_, "name", { 9641 get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb", 9642 configurable: true 9643 }); 9644 } catch { 9645 } 9646 } 9647 this._hooks[name] = this._hooks[name] || []; 9648 this._hooks[name].push(function_); 9649 return () => { 9650 if (function_) { 9651 this.removeHook(name, function_); 9652 function_ = void 0; 9653 } 9654 }; 9655 } 9656 hookOnce(name, function_) { 9657 let _unreg; 9658 let _function = (...arguments_) => { 9659 if (typeof _unreg === "function") { 9660 _unreg(); 9661 } 9662 _unreg = void 0; 9663 _function = void 0; 9664 return function_(...arguments_); 9665 }; 9666 _unreg = this.hook(name, _function); 9667 return _unreg; 9668 } 9669 removeHook(name, function_) { 9670 if (this._hooks[name]) { 9671 const index = this._hooks[name].indexOf(function_); 9672 if (index !== -1) { 9673 this._hooks[name].splice(index, 1); 9674 } 9675 if (this._hooks[name].length === 0) { 9676 delete this._hooks[name]; 9677 } 9678 } 9679 } 9680 deprecateHook(name, deprecated) { 9681 this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated; 9682 const _hooks = this._hooks[name] || []; 9683 delete this._hooks[name]; 9684 for (const hook of _hooks) { 9685 this.hook(name, hook); 9686 } 9687 } 9688 deprecateHooks(deprecatedHooks) { 9689 Object.assign(this._deprecatedHooks, deprecatedHooks); 9690 for (const name in deprecatedHooks) { 9691 this.deprecateHook(name, deprecatedHooks[name]); 9692 } 9693 } 9694 addHooks(configHooks) { 9695 const hooks = flatHooks(configHooks); 9696 const removeFns = Object.keys(hooks).map( 9697 (key) => this.hook(key, hooks[key]) 9698 ); 9699 return () => { 9700 for (const unreg of removeFns.splice(0, removeFns.length)) { 9701 unreg(); 9702 } 9703 }; 9704 } 9705 removeHooks(configHooks) { 9706 const hooks = flatHooks(configHooks); 9707 for (const key in hooks) { 9708 this.removeHook(key, hooks[key]); 9709 } 9710 } 9711 removeAllHooks() { 9712 for (const key in this._hooks) { 9713 delete this._hooks[key]; 9714 } 9715 } 9716 callHook(name, ...arguments_) { 9717 arguments_.unshift(name); 9718 return this.callHookWith(serialTaskCaller, name, ...arguments_); 9719 } 9720 callHookParallel(name, ...arguments_) { 9721 arguments_.unshift(name); 9722 return this.callHookWith(parallelTaskCaller, name, ...arguments_); 9723 } 9724 callHookWith(caller, name, ...arguments_) { 9725 const event = this._before || this._after ? { name, args: arguments_, context: {} } : void 0; 9726 if (this._before) { 9727 callEachWith(this._before, event); 9728 } 9729 const result = caller( 9730 name in this._hooks ? [...this._hooks[name]] : [], 9731 arguments_ 9732 ); 9733 if (result instanceof Promise) { 9734 return result.finally(() => { 9735 if (this._after && event) { 9736 callEachWith(this._after, event); 9737 } 9738 }); 9739 } 9740 if (this._after && event) { 9741 callEachWith(this._after, event); 9742 } 9743 return result; 9744 } 9745 beforeEach(function_) { 9746 this._before = this._before || []; 9747 this._before.push(function_); 9748 return () => { 9749 if (this._before !== void 0) { 9750 const index = this._before.indexOf(function_); 9751 if (index !== -1) { 9752 this._before.splice(index, 1); 9753 } 9754 } 9755 }; 9756 } 9757 afterEach(function_) { 9758 this._after = this._after || []; 9759 this._after.push(function_); 9760 return () => { 9761 if (this._after !== void 0) { 9762 const index = this._after.indexOf(function_); 9763 if (index !== -1) { 9764 this._after.splice(index, 1); 9765 } 9766 } 9767 }; 9768 } 9769} 9770function createHooks() { 9771 return new Hookable(); 9772} 9773function createContext(opts = {}) { 9774 let currentInstance2; 9775 let isSingleton = false; 9776 const checkConflict = (instance) => { 9777 if (currentInstance2 && currentInstance2 !== instance) { 9778 throw new Error("Context conflict"); 9779 } 9780 }; 9781 let als; 9782 if (opts.asyncContext) { 9783 const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage; 9784 if (_AsyncLocalStorage) { 9785 als = new _AsyncLocalStorage(); 9786 } else { 9787 console.warn("[unctx] `AsyncLocalStorage` is not provided."); 9788 } 9789 } 9790 const _getCurrentInstance = () => { 9791 if (als) { 9792 const instance = als.getStore(); 9793 if (instance !== void 0) { 9794 return instance; 9795 } 9796 } 9797 return currentInstance2; 9798 }; 9799 return { 9800 use: () => { 9801 const _instance = _getCurrentInstance(); 9802 if (_instance === void 0) { 9803 throw new Error("Context is not available"); 9804 } 9805 return _instance; 9806 }, 9807 tryUse: () => { 9808 return _getCurrentInstance(); 9809 }, 9810 set: (instance, replace) => { 9811 if (!replace) { 9812 checkConflict(instance); 9813 } 9814 currentInstance2 = instance; 9815 isSingleton = true; 9816 }, 9817 unset: () => { 9818 currentInstance2 = void 0; 9819 isSingleton = false;
9820 }, 9821 call: (instance, callback) => { 9822 checkConflict(instance); 9823 currentInstance2 = instance; 9824 try { 9825 return als ? als.run(instance, callback) : callback(); 9826 } finally { 9827 if (!isSingleton) { 9828 currentInstance2 = void 0; 9829 } 9830 } 9831 }, 9832 async callAsync(instance, callback) { 9833 currentInstance2 = instance; 9834 const onRestore = () => { 9835 currentInstance2 = instance; 9836 }; 9837 const onLeave = () => currentInstance2 === instance ? onRestore : void 0; 9838 asyncHandlers.add(onLeave); 9839 try { 9840 const r2 = als ? als.run(instance, callback) : callback(); 9841 if (!isSingleton) { 9842 currentInstance2 = void 0; 9843 } 9844 return await r2; 9845 } finally { 9846 asyncHandlers.delete(onLeave); 9847 } 9848 } 9849 }; 9850} 9851function createNamespace(defaultOpts = {}) { 9852 const contexts = {}; 9853 return { 9854 get(key, opts = {}) { 9855 if (!contexts[key]) { 9856 contexts[key] = createContext({ ...defaultOpts, ...opts }); 9857 } 9858 return contexts[key]; 9859 } 9860 }; 9861} 9862const _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {}; 9863const globalKey = "__unctx__"; 9864const defaultNamespace = _globalThis[globalKey] || (_globalThis[globalKey] = createNamespace()); 9865const getContext = (key, opts = {}) => defaultNamespace.get(key, opts); 9866const asyncHandlersKey = "__unctx_async_handlers__"; 9867const asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set()); 9868function executeAsync(function_) { 9869 const restores = []; 9870 for (const leaveHandler of asyncHandlers) { 9871 const restore2 = leaveHandler(); 9872 if (restore2) { 9873 restores.push(restore2); 9874 } 9875 } 9876 const restore = () => { 9877 for (const restore2 of restores) { 9878 restore2(); 9879 } 9880 }; 9881 let awaitable = function_(); 9882 if (awaitable && typeof awaitable === "object" && "catch" in awaitable) { 9883 awaitable = awaitable.catch((error) => { 9884 restore(); 9885 throw error; 9886 }); 9887 } 9888 return [awaitable, restore]; 9889} 9890const appPageTransition = { "name": "page", "mode": "out-in" }; 9891const appLayoutTransition = false; 9892const appKeepalive = false; 9893const nuxtLinkDefaults = { "componentName": "NuxtLink", "prefetch": true, "prefetchOn": { "visibility": true } }; 9894const asyncDataDefaults = { "value": null, "errorValue": null, "deep": true }; 9895const nuxtDefaultErrorValue = null; 9896const vueAppRootContainer = "#__nuxt"; 9897const appId = "nuxt-app"; 9898const outdatedBuildInterval = 36e5; 9899const chunkErrorEvent = "vite:preloadError"; 9900function getNuxtAppCtx(id = appId) { 9901 return getContext(id, { 9902 asyncContext: false 9903 }); 9904} 9905const NuxtPluginIndicator = "__nuxt_plugin"; 9906function createNuxtApp(options) { 9907 var _a3; 9908 let hydratingCount = 0; 9909 const nuxtApp = { 9910 _id: options.id || appId || "nuxt-app", 9911 _scope: effectScope(), 9912 provide: void 0, 9913 globalName: "nuxt", 9914 versions: { 9915 get nuxt() { 9916 return "3.17.3"; 9917 }, 9918 get vue() { 9919 return nuxtApp.vueApp.version; 9920 } 9921 }, 9922 payload: shallowReactive({ 9923 ...((_a3 = options.ssrContext) == null ? void 0 : _a3.payload) || {}, 9924 data: shallowReactive({}), 9925 state: reactive({}), 9926 once: /* @__PURE__ */ new Set(), 9927 _errors: shallowReactive({}) 9928 }), 9929 static: { 9930 data: {} 9931 }, 9932 runWithContext(fn) { 9933 if (nuxtApp._scope.active && !getCurrentScope()) { 9934 return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn)); 9935 } 9936 return callWithNuxt(nuxtApp, fn); 9937 }, 9938 isHydrating: true, 9939 deferHydration() { 9940 if (!nuxtApp.isHydrating) { 9941 return () => { 9942 }; 9943 } 9944 hydratingCount++; 9945 let called = false; 9946 return () => { 9947 if (called) { 9948 return; 9949 } 9950 called = true; 9951 hydratingCount--; 9952 if (hydratingCount === 0) { 9953 nuxtApp.isHydrating = false; 9954 return nuxtApp.callHook("app:suspense:resolve"); 9955 } 9956 }; 9957 }, 9958 _asyncDataPromises: {}, 9959 _asyncData: shallowReactive({}), 9960 _payloadRevivers: {}, 9961 ...options 9962 }; 9963 { 9964 const __NUXT__ = window.__NUXT__; 9965 if (__NUXT__) { 9966 for (const key in __NUXT__) { 9967 switch (key) { 9968 case "data": 9969 case "state": 9970 case "_errors": 9971 Object.assign(nuxtApp.payload[key], __NUXT__[key]); 9972 break; 9973 default: 9974 nuxtApp.payload[key] = __NUXT__[key]; 9975 } 9976 } 9977 } 9978 } 9979 nuxtApp.hooks = createHooks(); 9980 nuxtApp.hook = nuxtApp.hooks.hook; 9981 nuxtApp.callHook = nuxtApp.hooks.callHook; 9982 nuxtApp.provide = (name, value) => { 9983 const $name = "$" + name; 9984 defineGetter(nuxtApp, $name, value); 9985 defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value); 9986 }; 9987 defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp); 9988 defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp); 9989 { 9990 { 9991 window.addEventListener(chunkErrorEvent, (event) => { 9992 nuxtApp.callHook("app:chunkError", { error: event.payload }); 9993 if (event.payload.message.includes("Unable to preload CSS")) { 9994 event.preventDefault(); 9995 } 9996 }); 9997 } 9998 window.useNuxtApp || (window.useNuxtApp = useNuxtApp); 9999 const unreg = nuxtApp.hook("app:error", (...args) => { 10000 console.error("[nuxt] error caught during app initialization", ...args); 10001 }); 10002 nuxtApp.hook("app:mounted", unreg); 10003 } 10004 const runtimeConfig = nuxtApp.payload.config; 10005 nuxtApp.provide("config", runtimeConfig); 10006 return nuxtApp; 10007} 10008function registerPluginHooks(nuxtApp, plugin2) { 10009 if (plugin2.hooks) { 10010 nuxtApp.hooks.addHooks(plugin2.hooks); 10011 } 10012} 10013async function applyPlugin(nuxtApp, plugin2) { 10014 if (typeof plugin2 === "function") { 10015 const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {}; 10016 if (provide2 && typeof provide2 === "object") { 10017 for (const key in provide2) { 10018 nuxtApp.provide(key, provide2[key]); 10019 } 10020 } 10021 } 10022} 10023async function applyPlugins(nuxtApp, plugins2) { 10024 const resolvedPlugins = []; 10025 const unresolvedPlugins = []; 10026 const parallels = []; 10027 const errors = []; 10028 let promiseDepth = 0; 10029 async function executePlugin(plugin2) { 10030 var _a3; 10031 const unresolvedPluginsForThisPlugin = ((_a3 = plugin2.dependsOn) == null ? void 0 : _a3.filter((name) => plugins2.some((p2) => p2._name === name) && !resolvedPlugins.includes(name))) ?? []; 10032 if (unresolvedPluginsForThisPlugin.length > 0) { 10033 unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]); 10034 } else { 10035 const promise = applyPlugin(nuxtApp, plugin2).then(async () => { 10036 if (plugin2._name) { 10037 resolvedPlugins.push(plugin2._name); 10038 await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => { 10039 if (dependsOn.has(plugin2._name)) { 10040 dependsOn.delete(plugin2._name); 10041 if (dependsOn.size === 0) { 10042 promiseDepth++; 10043 await executePlugin(unexecutedPlugin); 10044 } 10045 } 10046 })); 10047 } 10048 }); 10049 if (plugin2.parallel) { 10050 parallels.push(promise.catch((e2) => errors.push(e2))); 10051 } else { 10052 await promise; 10053 } 10054 } 10055 } 10056 for (const plugin2 of plugins2) { 10057 registerPluginHooks(nuxtApp, plugin2); 10058 } 10059 for (const plugin2 of plugins2) { 10060 await executePlugin(plugin2); 10061 } 10062 await Promise.all(parallels); 10063 if (promiseDepth) { 10064 for (let i2 = 0; i2 < promiseDepth; i2++) { 10065 await Promise.all(parallels); 10066 } 10067 } 10068 if (errors.length) { 10069 throw errors[0]; 10070 } 10071} 10072// @__NO_SIDE_EFFECTS__ 10073function defineNuxtPlugin(plugin2) { 10074 if (typeof plugin2 === "function") { 10075 return plugin2; 10076 } 10077 const _name = plugin2._name || plugin2.name; 10078 delete plugin2.name; 10079 return Object.assign(plugin2.setup || (() => { 10080 }), plugin2, { [NuxtPluginIndicator]: true, _name }); 10081} 10082const definePayloadPlugin = defineNuxtPlugin; 10083function callWithNuxt(nuxt, setup, args) { 10084 const fn = () => setup(); 10085 const nuxtAppCtx = getNuxtAppCtx(nuxt._id); 10086 { 10087 nuxtAppCtx.set(nuxt); 10088 return nuxt.vueApp.runWithContext(fn); 10089 } 10090} 10091function tryUseNuxtApp(id) { 10092 var _a3; 10093 let nuxtAppInstance; 10094 if (hasInjectionContext()) { 10095 nuxtAppInstance = (_a3 = getCurrentInstance()) == null ? void 0 : _a3.appContext.app.$nuxt; 10096 } 10097 nuxtAppInstance || (nuxtAppInstance = getNuxtAppCtx(id).tryUse()); 10098 return nuxtAppInstance || null; 10099} 10100function useNuxtApp(id) { 10101 const nuxtAppInstance = tryUseNuxtApp(id); 10102 if (!nuxtAppInstance) { 10103 { 10104 throw new Error("[nuxt] instance unavailable"); 10105 } 10106 } 10107 return nuxtAppInstance; 10108} 10109// @__NO_SIDE_EFFECTS__ 10110function useRuntimeConfig(_event) { 10111 return useNuxtApp().$config; 10112} 10113function defineGetter(obj, key, val) { 10114 Object.defineProperty(obj, key, { get: () => val }); 10115} 10116function _createMatcher(table, strictTrailingSlash) { 10117 return { 10118 ctx: { table }, 10119 matchAll: (path) => _matchRoutes(path, table) 10120 }; 10121} 10122function _createTableFromExport(matcherExport) { 10123 const table = {}; 10124 for (const property in matcherExport) { 10125 table[property] = property === "dynamic" ? new Map( 10126 Object.entries(matcherExport[property]).map(([key, value]) => [ 10127 key, 10128 _createTableFromExport(value) 10129 ]) 10130 ) : new Map( 10131 Object.entries(matcherExport[property]) 10132 ); 10133 } 10134 return table; 10135} 10136function createMatcherFromExport(matcherExport) { 10137 return _createMatcher(_createTableFromExport(matcherExport)); 10138} 10139function _matchRoutes(path, table, strictTrailingSlash) { 10140 if (path.endsWith("/")) { 10141 path = path.slice(0, -1) || "/"; 10142 } 10143 const matches2 = []; 10144 for (const [key, value] of _sortRoutesMap(table.wildcard)) { 10145 if (path === key || path.startsWith(key + "/")) { 10146 matches2.push(value); 10147 } 10148 } 10149 for (const [key, value] of _sortRoutesMap(table.dynamic)) { 10150 if (path.startsWith(key + "/")) { 10151 const subPath = "/" + path.slice(key.length).split("/").splice(2).join("/"); 10152 matches2.push(..._matchRoutes(subPath, value)); 10153 } 10154 } 10155 const staticMatch = table.static.get(path); 10156 if (staticMatch) { 10157 matches2.push(staticMatch); 10158 } 10159 return matches2.filter(Boolean); 10160} 10161function _sortRoutesMap(m) { 10162 return [...m.entries()].sort((a2, b) => a2[0].length - b[0].length); 10163} 10164function isPlainObject$2(value) { 10165 if (value === null || typeof value !== "object") { 10166 return false;
10167 } 10168 const prototype = Object.getPrototypeOf(value); 10169 if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) { 10170 return false; 10171 } 10172 if (Symbol.iterator in value) { 10173 return false; 10174 } 10175 if (Symbol.toStringTag in value) { 10176 return Object.prototype.toString.call(value) === "[object Module]"; 10177 } 10178 return true; 10179} 10180function _defu(baseObject, defaults2, namespace = ".", merger) { 10181 if (!isPlainObject$2(defaults2)) { 10182 return _defu(baseObject, {}, namespace, merger); 10183 } 10184 const object = Object.assign({}, defaults2); 10185 for (const key in baseObject) { 10186 if (key === "__proto__" || key === "constructor") { 10187 continue; 10188 } 10189 const value = baseObject[key]; 10190 if (value === null || value === void 0) { 10191 continue; 10192 } 10193 if (merger && merger(object, key, value, namespace)) { 10194 continue; 10195 } 10196 if (Array.isArray(value) && Array.isArray(object[key])) { 10197 object[key] = [...value, ...object[key]]; 10198 } else if (isPlainObject$2(value) && isPlainObject$2(object[key])) { 10199 object[key] = _defu( 10200 value, 10201 object[key], 10202 (namespace ? `${namespace}.` : "") + key.toString(), 10203 merger 10204 ); 10205 } else { 10206 object[key] = value; 10207 } 10208 } 10209 return object; 10210} 10211function createDefu(merger) { 10212 return (...arguments_) => ( 10213 // eslint-disable-next-line unicorn/no-array-reduce 10214 arguments_.reduce((p2, c2) => _defu(p2, c2, "", merger), {}) 10215 ); 10216} 10217const defu = createDefu(); 10218function hasProp(obj, prop) { 10219 try { 10220 return prop in obj; 10221 } catch { 10222 return false; 10223 } 10224} 10225class H3Error extends Error { 10226 constructor(message, opts = {}) { 10227 super(message, opts); 10228 __publicField(this, "statusCode", 500); 10229 __publicField(this, "fatal", false); 10230 __publicField(this, "unhandled", false); 10231 __publicField(this, "statusMessage"); 10232 __publicField(this, "data"); 10233 __publicField(this, "cause"); 10234 if (opts.cause && !this.cause) { 10235 this.cause = opts.cause; 10236 } 10237 } 10238 toJSON() { 10239 const obj = { 10240 message: this.message, 10241 statusCode: sanitizeStatusCode(this.statusCode, 500) 10242 }; 10243 if (this.statusMessage) { 10244 obj.statusMessage = sanitizeStatusMessage(this.statusMessage); 10245 } 10246 if (this.data !== void 0) { 10247 obj.data = this.data; 10248 } 10249 return obj; 10250 } 10251} 10252__publicField(H3Error, "__h3_error__", true); 10253function createError$1(input) { 10254 if (typeof input === "string") { 10255 return new H3Error(input); 10256 } 10257 if (isError(input)) { 10258 return input; 10259 } 10260 const err = new H3Error(input.message ?? input.statusMessage ?? "", { 10261 cause: input.cause || input 10262 }); 10263 if (hasProp(input, "stack")) { 10264 try { 10265 Object.defineProperty(err, "stack", { 10266 get() { 10267 return input.stack; 10268 } 10269 }); 10270 } catch { 10271 try { 10272 err.stack = input.stack; 10273 } catch { 10274 } 10275 } 10276 } 10277 if (input.data) { 10278 err.data = input.data; 10279 } 10280 if (input.statusCode) { 10281 err.statusCode = sanitizeStatusCode(input.statusCode, err.statusCode); 10282 } else if (input.status) { 10283 err.statusCode = sanitizeStatusCode(input.status, err.statusCode); 10284 } 10285 if (input.statusMessage) { 10286 err.statusMessage = input.statusMessage; 10287 } else if (input.statusText) { 10288 err.statusMessage = input.statusText; 10289 } 10290 if (err.statusMessage) { 10291 const originalMessage = err.statusMessage; 10292 const sanitizedMessage = sanitizeStatusMessage(err.statusMessage); 10293 if (sanitizedMessage !== originalMessage) { 10294 console.warn( 10295 "[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default." 10296 ); 10297 } 10298 } 10299 if (input.fatal !== void 0) { 10300 err.fatal = input.fatal; 10301 } 10302 if (input.unhandled !== void 0) { 10303 err.unhandled = input.unhandled; 10304 } 10305 return err; 10306} 10307function isError(input) { 10308 var _a3; 10309 return ((_a3 = input == null ? void 0 : input.constructor) == null ? void 0 : _a3.__h3_error__) === true; 10310} 10311const DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g; 10312function sanitizeStatusMessage(statusMessage = "") { 10313 return statusMessage.replace(DISALLOWED_STATUS_CHARS, ""); 10314} 10315function sanitizeStatusCode(statusCode, defaultStatusCode = 200) { 10316 if (!statusCode) { 10317 return defaultStatusCode; 10318 } 10319 if (typeof statusCode === "string") { 10320 statusCode = Number.parseInt(statusCode, 10); 10321 } 10322 if (statusCode < 100 || statusCode > 999) { 10323 return defaultStatusCode; 10324 } 10325 return statusCode; 10326} 10327typeof setImmediate === "undefined" ? (fn) => fn() : setImmediate; 10328const LayoutMetaSymbol = Symbol("layout-meta"); 10329const PageRouteSymbol = Symbol("route"); 10330const useRouter = () => { 10331 var _a3; 10332 return (_a3 = useNuxtApp()) == null ? void 0 : _a3.$router; 10333}; 10334const useRoute$1 = () => { 10335 if (hasInjectionContext()) { 10336 return inject(PageRouteSymbol, useNuxtApp()._route); 10337 } 10338 return useNuxtApp()._route; 10339}; 10340// @__NO_SIDE_EFFECTS__ 10341function defineNuxtRouteMiddleware(middleware) { 10342 return middleware; 10343} 10344const isProcessingMiddleware = () => { 10345 try { 10346 if (useNuxtApp()._processingMiddleware) { 10347 return true; 10348 } 10349 } catch { 10350 return false;
10351 } 10352 return false; 10353}; 10354const navigateTo = (to, options) => { 10355 to || (to = "/"); 10356 const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href; 10357 if (options == null ? void 0 : options.open) { 10358 const { target = "_blank", windowFeatures = {} } = options.open; 10359 const features = Object.entries(windowFeatures).filter(([_2, value]) => value !== void 0).map(([feature, value]) => `${feature.toLowerCase()}=${value}`).join(", "); 10360 open(toPath, target, features); 10361 return Promise.resolve(); 10362 } 10363 const isExternalHost = hasProtocol(toPath, { acceptRelative: true }); 10364 const isExternal = (options == null ? void 0 : options.external) || isExternalHost; 10365 if (isExternal) { 10366 if (!(options == null ? void 0 : options.external)) { 10367 throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`."); 10368 } 10369 const { protocol } = new URL(toPath, window.location.href); 10370 if (protocol && isScriptProtocol(protocol)) { 10371 throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`); 10372 } 10373 } 10374 const inMiddleware = isProcessingMiddleware(); 10375 if (!isExternal && inMiddleware) { 10376 if (options == null ? void 0 : options.replace) { 10377 if (typeof to === "string") { 10378 const { pathname, search, hash } = parseURL$1(to); 10379 return { 10380 path: pathname, 10381 ...search && { query: parseQuery$1(search) }, 10382 ...hash && { hash }, 10383 replace: true 10384 }; 10385 } 10386 return { ...to, replace: true }; 10387 } 10388 return to; 10389 } 10390 const router = useRouter(); 10391 const nuxtApp = useNuxtApp(); 10392 if (isExternal) { 10393 nuxtApp._scope.stop(); 10394 if (options == null ? void 0 : options.replace) { 10395 location.replace(toPath); 10396 } else { 10397 location.href = toPath; 10398 } 10399 if (inMiddleware) { 10400 if (!nuxtApp.isHydrating) { 10401 return false; 10402 } 10403 return new Promise(() => { 10404 }); 10405 } 10406 return Promise.resolve(); 10407 } 10408 return (options == null ? void 0 : options.replace) ? router.replace(to) : router.push(to); 10409}; 10410function resolveRouteObject(to) { 10411 return withQuery(to.path || "", to.query || {}) + (to.hash || ""); 10412} 10413const NUXT_ERROR_SIGNATURE = "__nuxt_error"; 10414const useError = () => toRef(useNuxtApp().payload, "error"); 10415const showError = (error) => { 10416 const nuxtError = createError(error); 10417 try { 10418 const nuxtApp = useNuxtApp(); 10419 const error2 = useError(); 10420 if (true) { 10421 nuxtApp.hooks.callHook("app:error", nuxtError); 10422 } 10423 error2.value || (error2.value = nuxtError); 10424 } catch { 10425 throw nuxtError; 10426 } 10427 return nuxtError; 10428}; 10429const clearError = async (options = {}) => { 10430 const nuxtApp = useNuxtApp(); 10431 const error = useError(); 10432 nuxtApp.callHook("app:error:cleared", options); 10433 if (options.redirect) { 10434 await useRouter().replace(options.redirect); 10435 } 10436 error.value = nuxtDefaultErrorValue; 10437}; 10438const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error; 10439const createError = (error) => { 10440 const nuxtError = createError$1(error); 10441 Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, { 10442 value: true, 10443 configurable: false, 10444 writable: false 10445 }); 10446 return nuxtError; 10447}; 10448const DEBOUNCE_DEFAULTS = { 10449 trailing: true 10450}; 10451function debounce(fn, wait = 25, options = {}) { 10452 options = { ...DEBOUNCE_DEFAULTS, ...options }; 10453 if (!Number.isFinite(wait)) { 10454 throw new TypeError("Expected `wait` to be a finite number"); 10455 } 10456 let leadingValue; 10457 let timeout; 10458 let resolveList = []; 10459 let currentPromise; 10460 let trailingArgs; 10461 const applyFn = (_this, args) => { 10462 currentPromise = _applyPromised(fn, _this, args); 10463 currentPromise.finally(() => { 10464 currentPromise = null; 10465 if (options.trailing && trailingArgs && !timeout) { 10466 const promise = applyFn(_this, trailingArgs); 10467 trailingArgs = null; 10468 return promise; 10469 } 10470 }); 10471 return currentPromise; 10472 }; 10473 return function(...args) { 10474 if (currentPromise) { 10475 if (options.trailing) { 10476 trailingArgs = args; 10477 } 10478 return currentPromise; 10479 } 10480 return new Promise((resolve2) => { 10481 const shouldCallNow = !timeout && options.leading; 10482 clearTimeout(timeout); 10483 timeout = setTimeout(() => { 10484 timeout = null; 10485 const promise = options.leading ? leadingValue : applyFn(this, args); 10486 for (const _resolve of resolveList) { 10487 _resolve(promise); 10488 } 10489 resolveList = []; 10490 }, wait); 10491 if (shouldCallNow) { 10492 leadingValue = applyFn(this, args); 10493 resolve2(leadingValue); 10494 } else { 10495 resolveList.push(resolve2); 10496 } 10497 }); 10498 }; 10499} 10500async function _applyPromised(fn, _this, args) { 10501 return await fn.apply(_this, args); 10502} 10503/*! 10504 * pinia v3.0.2 10505 * (c) 2025 Eduardo San Martin Morote 10506 * @license MIT 10507 */ 10508let activePinia; 10509const setActivePinia = (pinia) => activePinia = pinia; 10510const piniaSymbol = ( 10511 /* istanbul ignore next */ 10512 Symbol() 10513); 10514function isPlainObject$1(o2) { 10515 return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function"; 10516} 10517var MutationType; 10518(function(MutationType2) { 10519 MutationType2["direct"] = "direct"; 10520 MutationType2["patchObject"] = "patch object"; 10521 MutationType2["patchFunction"] = "patch function"; 10522})(MutationType || (MutationType = {})); 10523function createPinia() { 10524 const scope = effectScope(true); 10525 const state = scope.run(() => ref({})); 10526 let _p = []; 10527 let toBeInstalled = []; 10528 const pinia = markRaw({ 10529 install(app) {
vendor: 4,976 bytes, lines 10530-10694
10530 setActivePinia(pinia); 10531 pinia._a = app; 10532 app.provide(piniaSymbol, pinia); 10533 app.config.globalProperties.$pinia = pinia; 10534 toBeInstalled.forEach((plugin2) => _p.push(plugin2)); 10535 toBeInstalled = []; 10536 }, 10537 use(plugin2) { 10538 if (!this._a) { 10539 toBeInstalled.push(plugin2); 10540 } else { 10541 _p.push(plugin2); 10542 } 10543 return this; 10544 }, 10545 _p, 10546 // it's actually undefined here 10547 // @ts-expect-error 10548 _a: null, 10549 _e: scope, 10550 _s: /* @__PURE__ */ new Map(), 10551 state 10552 }); 10553 return pinia; 10554} 10555const noop$2 = () => { 10556}; 10557function addSubscription(subscriptions, callback, detached, onCleanup = noop$2) { 10558 subscriptions.push(callback); 10559 const removeSubscription = () => { 10560 const idx = subscriptions.indexOf(callback); 10561 if (idx > -1) { 10562 subscriptions.splice(idx, 1); 10563 onCleanup(); 10564 } 10565 }; 10566 if (!detached && getCurrentScope()) { 10567 onScopeDispose(removeSubscription); 10568 } 10569 return removeSubscription; 10570} 10571function triggerSubscriptions(subscriptions, ...args) { 10572 subscriptions.slice().forEach((callback) => { 10573 callback(...args); 10574 }); 10575} 10576const fallbackRunWithContext = (fn) => fn(); 10577const ACTION_MARKER = Symbol(); 10578const ACTION_NAME = Symbol(); 10579function mergeReactiveObjects(target, patchToApply) { 10580 if (target instanceof Map && patchToApply instanceof Map) { 10581 patchToApply.forEach((value, key) => target.set(key, value)); 10582 } else if (target instanceof Set && patchToApply instanceof Set) { 10583 patchToApply.forEach(target.add, target); 10584 } 10585 for (const key in patchToApply) { 10586 if (!patchToApply.hasOwnProperty(key)) 10587 continue; 10588 const subPatch = patchToApply[key]; 10589 const targetValue = target[key]; 10590 if (isPlainObject$1(targetValue) && isPlainObject$1(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) { 10591 target[key] = mergeReactiveObjects(targetValue, subPatch); 10592 } else { 10593 target[key] = subPatch; 10594 } 10595 } 10596 return target; 10597} 10598const skipHydrateSymbol = ( 10599 /* istanbul ignore next */ 10600 Symbol() 10601); 10602function shouldHydrate(obj) { 10603 return !isPlainObject$1(obj) || !Object.prototype.hasOwnProperty.call(obj, skipHydrateSymbol); 10604} 10605const { assign: assign$1 } = Object; 10606function isComputed(o2) { 10607 return !!(isRef(o2) && o2.effect); 10608} 10609function createOptionsStore(id, options, pinia, hot) { 10610 const { state, actions, getters } = options; 10611 const initialState = pinia.state.value[id]; 10612 let store; 10613 function setup() { 10614 if (!initialState && true) { 10615 pinia.state.value[id] = state ? state() : {}; 10616 } 10617 const localState = toRefs(pinia.state.value[id]); 10618 return assign$1(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => { 10619 computedGetters[name] = markRaw(computed(() => { 10620 setActivePinia(pinia); 10621 const store2 = pinia._s.get(id); 10622 return getters[name].call(store2, store2); 10623 })); 10624 return computedGetters; 10625 }, {})); 10626 } 10627 store = createSetupStore(id, setup, options, pinia, hot, true); 10628 return store; 10629} 10630function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) { 10631 let scope; 10632 const optionsForPlugin = assign$1({ actions: {} }, options); 10633 const $subscribeOptions = { deep: true }; 10634 let isListening; 10635 let isSyncListening; 10636 let subscriptions = []; 10637 let actionSubscriptions = []; 10638 let debuggerEvents; 10639 const initialState = pinia.state.value[$id]; 10640 if (!isOptionsStore && !initialState && true) { 10641 pinia.state.value[$id] = {}; 10642 } 10643 ref({}); 10644 let activeListener; 10645 function $patch(partialStateOrMutator) { 10646 let subscriptionMutation; 10647 isListening = isSyncListening = false; 10648 if (typeof partialStateOrMutator === "function") { 10649 partialStateOrMutator(pinia.state.value[$id]); 10650 subscriptionMutation = { 10651 type: MutationType.patchFunction, 10652 storeId: $id, 10653 events: debuggerEvents 10654 }; 10655 } else { 10656 mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator); 10657 subscriptionMutation = { 10658 type: MutationType.patchObject, 10659 payload: partialStateOrMutator, 10660 storeId: $id, 10661 events: debuggerEvents 10662 }; 10663 } 10664 const myListenerId = activeListener = Symbol(); 10665 nextTick().then(() => { 10666 if (activeListener === myListenerId) { 10667 isListening = true; 10668 } 10669 }); 10670 isSyncListening = true; 10671 triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]); 10672 } 10673 const $reset = isOptionsStore ? function $reset2() { 10674 const { state } = options; 10675 const newState = state ? state() : {}; 10676 this.$patch(($state) => { 10677 assign$1($state, newState); 10678 }); 10679 } : ( 10680 /* istanbul ignore next */ 10681 noop$2 10682 ); 10683 function $dispose() { 10684 scope.stop(); 10685 subscriptions = []; 10686 actionSubscriptions = []; 10687 pinia._s.delete($id); 10688 } 10689 const action = (fn, name = "") => { 10690 if (ACTION_MARKER in fn) { 10691 fn[ACTION_NAME] = name; 10692 return fn; 10693 } 10694 const wrappedAction = function() {
10695 setActivePinia(pinia); 10696 const args = Array.from(arguments); 10697 const afterCallbackList = []; 10698 const onErrorCallbackList = []; 10699 function after(callback) { 10700 afterCallbackList.push(callback); 10701 } 10702 function onError(callback) { 10703 onErrorCallbackList.push(callback); 10704 } 10705 triggerSubscriptions(actionSubscriptions, { 10706 args, 10707 name: wrappedAction[ACTION_NAME], 10708 store, 10709 after, 10710 onError 10711 }); 10712 let ret; 10713 try { 10714 ret = fn.apply(this && this.$id === $id ? this : store, args); 10715 } catch (error) { 10716 triggerSubscriptions(onErrorCallbackList, error); 10717 throw error; 10718 } 10719 if (ret instanceof Promise) { 10720 return ret.then((value) => { 10721 triggerSubscriptions(afterCallbackList, value); 10722 return value; 10723 }).catch((error) => { 10724 triggerSubscriptions(onErrorCallbackList, error); 10725 return Promise.reject(error); 10726 }); 10727 } 10728 triggerSubscriptions(afterCallbackList, ret); 10729 return ret; 10730 }; 10731 wrappedAction[ACTION_MARKER] = true; 10732 wrappedAction[ACTION_NAME] = name; 10733 return wrappedAction; 10734 }; 10735 const partialStore = { 10736 _p: pinia, 10737 // _s: scope, 10738 $id, 10739 $onAction: addSubscription.bind(null, actionSubscriptions), 10740 $patch, 10741 $reset, 10742 $subscribe(callback, options2 = {}) { 10743 const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher()); 10744 const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => { 10745 if (options2.flush === "sync" ? isSyncListening : isListening) { 10746 callback({ 10747 storeId: $id, 10748 type: MutationType.direct, 10749 events: debuggerEvents 10750 }, state); 10751 } 10752 }, assign$1({}, $subscribeOptions, options2))); 10753 return removeSubscription; 10754 }, 10755 $dispose 10756 }; 10757 const store = reactive(partialStore); 10758 pinia._s.set($id, store); 10759 const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext; 10760 const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action })))); 10761 for (const key in setupStore) { 10762 const prop = setupStore[key]; 10763 if (isRef(prop) && !isComputed(prop) || isReactive(prop)) { 10764 if (!isOptionsStore) { 10765 if (initialState && shouldHydrate(prop)) { 10766 if (isRef(prop)) { 10767 prop.value = initialState[key]; 10768 } else { 10769 mergeReactiveObjects(prop, initialState[key]); 10770 } 10771 } 10772 pinia.state.value[$id][key] = prop; 10773 } 10774 } else if (typeof prop === "function") { 10775 const actionValue = action(prop, key); 10776 setupStore[key] = actionValue; 10777 optionsForPlugin.actions[key] = prop; 10778 } else ; 10779 } 10780 assign$1(store, setupStore); 10781 assign$1(toRaw(store), setupStore); 10782 Object.defineProperty(store, "$state", { 10783 get: () => pinia.state.value[$id], 10784 set: (state) => { 10785 $patch(($state) => { 10786 assign$1($state, state); 10787 }); 10788 } 10789 }); 10790 pinia._p.forEach((extender) => { 10791 { 10792 assign$1(store, scope.run(() => extender({ 10793 store, 10794 app: pinia._a, 10795 pinia, 10796 options: optionsForPlugin 10797 }))); 10798 } 10799 }); 10800 if (initialState && isOptionsStore && options.hydrate) { 10801 options.hydrate(store.$state, initialState); 10802 } 10803 isListening = true; 10804 isSyncListening = true; 10805 return store; 10806} 10807/*! #__NO_SIDE_EFFECTS__ */ 10808// @__NO_SIDE_EFFECTS__ 10809function defineStore(id, setup, setupOptions) { 10810 let options; 10811 const isSetupStore = typeof setup === "function"; 10812 options = isSetupStore ? setupOptions : setup; 10813 function useStore(pinia, hot) { 10814 const hasContext = hasInjectionContext(); 10815 pinia = // in test mode, ignore the argument provided as we can always retrieve a 10816 // pinia instance with getActivePinia() 10817 pinia || (hasContext ? inject(piniaSymbol, null) : null); 10818 if (pinia) 10819 setActivePinia(pinia); 10820 pinia = activePinia; 10821 if (!pinia._s.has(id)) { 10822 if (isSetupStore) { 10823 createSetupStore(id, setup, options, pinia); 10824 } else { 10825 createOptionsStore(id, options, pinia); 10826 } 10827 } 10828 const store = pinia._s.get(id); 10829 return store; 10830 } 10831 useStore.$id = id; 10832 return useStore; 10833} 10834function decode64(string) { 10835 const binaryString = asciiToBinary(string); 10836 const arraybuffer = new ArrayBuffer(binaryString.length); 10837 const dv = new DataView(arraybuffer); 10838 for (let i2 = 0; i2 < arraybuffer.byteLength; i2++) { 10839 dv.setUint8(i2, binaryString.charCodeAt(i2)); 10840 } 10841 return arraybuffer; 10842} 10843const KEY_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
10843+/"; 10844function asciiToBinary(data) { 10845 if (data.length % 4 === 0) { 10846 data = data.replace(/==?$/, ""); 10847 } 10848 let output = ""; 10849 let buffer = 0; 10850 let accumulatedBits = 0; 10851 for (let i2 = 0; i2 < data.length; i2++) { 10852 buffer <<= 6; 10853 buffer |= KEY_STRING.indexOf(data[i2]); 10854 accumulatedBits += 6; 10855 if (accumulatedBits === 24) { 10856 output += String.fromCharCode((buffer & 16711680) >> 16); 10857 output += String.fromCharCode((buffer & 65280) >> 8); 10858 output += String.fromCharCode(buffer & 255); 10859 buffer = accumulatedBits = 0; 10860 } 10861 } 10862 if (accumulatedBits === 12) { 10863 buffer >>= 4; 10864 output += String.fromCharCode(buffer); 10865 } else if (accumulatedBits === 18) { 10866 buffer >>= 2; 10867 output += String.fromCharCode((buffer & 65280) >> 8); 10868 output += String.fromCharCode(buffer & 255); 10869 } 10870 return output; 10871} 10872const UNDEFINED = -1; 10873const HOLE = -2; 10874const NAN = -3; 10875const POSITIVE_INFINITY = -4; 10876const NEGATIVE_INFINITY = -5; 10877const NEGATIVE_ZERO = -6; 10878function parse(serialized, revivers2) { 10879 return unflatten(JSON.parse(serialized), revivers2); 10880} 10881function unflatten(parsed, revivers2) { 10882 if (typeof parsed === "number") return hydrate(parsed, true); 10883 if (!Array.isArray(parsed) || parsed.length === 0) { 10884 throw new Error("Invalid input"); 10885 } 10886 const values = ( 10887 /** @type {any[]} */ 10888 parsed 10889 ); 10890 const hydrated = Array(values.length); 10891 function hydrate(index, standalone = false) { 10892 if (index === UNDEFINED) return void 0; 10893 if (index === NAN) return NaN; 10894 if (index === POSITIVE_INFINITY) return Infinity; 10895 if (index === NEGATIVE_INFINITY) return -Infinity; 10896 if (index === NEGATIVE_ZERO) return -0; 10897 if (standalone) throw new Error(`Invalid input`); 10898 if (index in hydrated) return hydrated[index]; 10899 const value = values[index]; 10900 if (!value || typeof value !== "object") { 10901 hydrated[index] = value; 10902 } else if (Array.isArray(value)) { 10903 if (typeof value[0] === "string") { 10904 const type = value[0]; 10905 const reviver = revivers2 == null ? void 0 : revivers2[type]; 10906 if (reviver) { 10907 return hydrated[index] = reviver(hydrate(value[1])); 10908 } 10909 switch (type) { 10910 case "Date": 10911 hydrated[index] = new Date(value[1]); 10912 break; 10913 case "Set": 10914 const set = /* @__PURE__ */ new Set(); 10915 hydrated[index] = set; 10916 for (let i2 = 1; i2 < value.length; i2 += 1) { 10917 set.add(hydrate(value[i2])); 10918 } 10919 break; 10920 case "Map": 10921 const map2 = /* @__PURE__ */ new Map(); 10922 hydrated[index] = map2; 10923 for (let i2 = 1; i2 < value.length; i2 += 2) { 10924 map2.set(hydrate(value[i2]), hydrate(value[i2 + 1])); 10925 } 10926 break; 10927 case "RegExp": 10928 hydrated[index] = new RegExp(value[1], value[2]); 10929 break; 10930 case "Object": 10931 hydrated[index] = Object(value[1]); 10932 break; 10933 case "BigInt": 10934 hydrated[index] = BigInt(value[1]); 10935 break; 10936 case "null": 10937 const obj = /* @__PURE__ */ Object.create(null); 10938 hydrated[index] = obj; 10939 for (let i2 = 1; i2 < value.length; i2 += 2) { 10940 obj[value[i2]] = hydrate(value[i2 + 1]); 10941 } 10942 break; 10943 case "Int8Array": 10944 case "Uint8Array": 10945 case "Uint8ClampedArray": 10946 case "Int16Array": 10947 case "Uint16Array": 10948 case "Int32Array": 10949 case "Uint32Array": 10950 case "Float32Array": 10951 case "Float64Array": 10952 case "BigInt64Array": 10953 case "BigUint64Array": { 10954 const TypedArrayConstructor = globalThis[type]; 10955 const base64 = value[1]; 10956 const arraybuffer = decode64(base64); 10957 const typedArray = new TypedArrayConstructor(arraybuffer); 10958 hydrated[index] = typedArray; 10959 break; 10960 } 10961 case "ArrayBuffer": { 10962 const base64 = value[1]; 10963 const arraybuffer = decode64(base64); 10964 hydrated[index] = arraybuffer; 10965 break; 10966 } 10967 default: 10968 throw new Error(`Unknown type ${type}`); 10969 } 10970 } else { 10971 const array = new Array(value.length); 10972 hydrated[index] = array; 10973 for (let i2 = 0; i2 < value.length; i2 += 1) { 10974 const n2 = value[i2]; 10975 if (n2 === HOLE) continue; 10976 array[i2] = hydrate(n2); 10977 } 10978 } 10979 } else { 10980 const object = {}; 10981 hydrated[index] = object; 10982 for (const key in value) { 10983 const n2 = value[key]; 10984 object[key] = hydrate(n2); 10985 } 10986 } 10987 return hydrated[index]; 10988 } 10989 return hydrate(0); 10990} 10991const DupeableTags = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]); 10992const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]); 10993const HasElementTags = /* @__PURE__ */ new Set([ 10994 "base", 10995 "meta", 10996 "link", 10997 "style", 10998 "script", 10999 "noscript" 11000]); 11001const ValidHeadTags = /* @__PURE__ */ new Set([ 11002 "title", 11003 "base", 11004 "htmlAttrs", 11005 "bodyAttrs", 11006 "meta", 11007 "link", 11008 "style", 11009 "script", 11010 "noscript" 11011]); 11012const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]); 11013const TagConfigKeys = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]); 11014const UsesMergeStrategy = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]); 11015const MetaTagsArrayable = /* @__PURE__ */ new Set([ 11016 "theme-color", 11017 "google-site-verification", 11018 "og", 11019 "article", 11020 "book", 11021 "profile", 11022 "twitter", 11023 "author" 11024]);
vendor: 7,267 bytes, lines 11025-11213
11025const NAMESPACES = { 11026 META: /* @__PURE__ */ new Set(["twitter"]), 11027 OG: /* @__PURE__ */ new Set(["og", "book", "article", "profile", "fb"]), 11028 MEDIA: /* @__PURE__ */ new Set(["ogImage", "ogVideo", "ogAudio", "twitterImage"]), 11029 HTTP_EQUIV: /* @__PURE__ */ new Set(["contentType", "defaultStyle", "xUaCompatible"]) 11030}; 11031const META_ALIASES = { 11032 articleExpirationTime: "article:expiration_time", 11033 articleModifiedTime: "article:modified_time", 11034 articlePublishedTime: "article:published_time", 11035 bookReleaseDate: "book:release_date", 11036 fbAppId: "fb:app_id", 11037 ogAudioSecureUrl: "og:audio:secure_url", 11038 ogAudioUrl: "og:audio", 11039 ogImageSecureUrl: "og:image:secure_url", 11040 ogImageUrl: "og:image", 11041 ogSiteName: "og:site_name", 11042 ogVideoSecureUrl: "og:video:secure_url", 11043 ogVideoUrl: "og:video", 11044 profileFirstName: "profile:first_name", 11045 profileLastName: "profile:last_name", 11046 profileUsername: "profile:username", 11047 msapplicationConfig: "msapplication-Config", 11048 msapplicationTileColor: "msapplication-TileColor", 11049 msapplicationTileImage: "msapplication-TileImage" 11050}; 11051const MetaPackingSchema = { 11052 appleItunesApp: { 11053 unpack: { 11054 entrySeparator: ", ", 11055 // @ts-expect-error untyped 11056 resolve: ({ key, value }) => `${fixKeyCase(key)}=${value}` 11057 } 11058 }, 11059 refresh: { 11060 metaKey: "http-equiv", 11061 unpack: { 11062 entrySeparator: ";", 11063 // @ts-expect-error untyped 11064 resolve: ({ key, value }) => key === "seconds" ? `${value}` : void 0 11065 } 11066 }, 11067 robots: { 11068 unpack: { 11069 entrySeparator: ", ", 11070 // @ts-expect-error untyped 11071 resolve: ({ key, value }) => typeof value === "boolean" ? fixKeyCase(key) : `${fixKeyCase(key)}:${value}` 11072 } 11073 }, 11074 contentSecurityPolicy: { 11075 metaKey: "http-equiv", 11076 unpack: { 11077 entrySeparator: "; ", 11078 // @ts-expect-error untyped 11079 resolve: ({ key, value }) => `${fixKeyCase(key)} ${value}` 11080 } 11081 }, 11082 charset: {} 11083}; 11084function fixKeyCase(key) { 11085 const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase(); 11086 const prefixIndex = updated.indexOf("-"); 11087 return prefixIndex === -1 ? updated : NAMESPACES.META.has(updated.slice(0, prefixIndex)) || NAMESPACES.OG.has(updated.slice(0, prefixIndex)) ? key.replace(/([A-Z])/g, ":$1").toLowerCase() : updated; 11088} 11089function sanitizeObject(input) { 11090 return Object.fromEntries(Object.entries(input).filter(([k, v2]) => String(v2) !== "false" && k)); 11091} 11092function transformObject(obj) { 11093 return Array.isArray(obj) ? obj.map(transformObject) : !obj || typeof obj !== "object" ? obj : Object.fromEntries(Object.entries(obj).map(([k, v2]) => [fixKeyCase(k), transformObject(v2)])); 11094} 11095function unpackToString(value, options = {}) { 11096 const { entrySeparator = "", keyValueSeparator = "", wrapValue, resolve: resolve2 } = options; 11097 return Object.entries(value).map(([key, val]) => { 11098 if (resolve2) { 11099 const resolved = resolve2({ key, value: val }); 11100 if (resolved !== void 0) 11101 return resolved; 11102 } 11103 const processedVal = typeof val === "object" ? unpackToString(val, options) : typeof val === "number" ? val.toString() : typeof val === "string" && wrapValue ? `${wrapValue}${val.replace(new RegExp(wrapValue, "g"), `\\${wrapValue}`)}${wrapValue}` : val; 11104 return `${key}${keyValueSeparator}${processedVal}`; 11105 }).join(entrySeparator); 11106} 11107function handleObjectEntry(key, value) { 11108 const sanitizedValue = sanitizeObject(value); 11109 const fixedKey = fixKeyCase(key); 11110 const attr = resolveMetaKeyType(fixedKey); 11111 if (!MetaTagsArrayable.has(fixedKey)) { 11112 return [{ [attr]: fixedKey, ...sanitizedValue }]; 11113 } 11114 const input = Object.fromEntries( 11115 Object.entries(sanitizedValue).map(([k, v2]) => [`${key}${k === "url" ? "" : `${k[0].toUpperCase()}${k.slice(1)}`}`, v2]) 11116 ); 11117 return unpackMeta(input || {}).sort((a2, b) => { 11118 var _a3, _b; 11119 return (((_a3 = a2[attr]) == null ? void 0 : _a3.length) || 0) - (((_b = b[attr]) == null ? void 0 : _b.length) || 0); 11120 }); 11121} 11122function resolveMetaKeyType(key) { 11123 var _a3; 11124 if (((_a3 = MetaPackingSchema[key]) == null ? void 0 : _a3.metaKey) === "http-equiv" || NAMESPACES.HTTP_EQUIV.has(key)) { 11125 return "http-equiv"; 11126 } 11127 const fixed = fixKeyCase(key); 11128 const colonIndex = fixed.indexOf(":"); 11129 return colonIndex === -1 ? "name" : NAMESPACES.OG.has(fixed.slice(0, colonIndex)) ? "property" : "name"; 11130} 11131function resolveMetaKeyValue(key) { 11132 return META_ALIASES[key] || fixKeyCase(key); 11133} 11134function resolvePackedMetaObjectValue(value, key) { 11135 var _a3; 11136 if (key === "refresh") 11137 return `${value.seconds};url=${value.url}`; 11138 return unpackToString(transformObject(value), { 11139 keyValueSeparator: "=", 11140 entrySeparator: ", ", 11141 resolve: ({ value: value2, key: key2 }) => value2 === null ? "" : typeof value2 === "boolean" ? key2 : void 0, 11142 // @ts-expect-error untyped 11143 ...(_a3 = MetaPackingSchema[key]) == null ? void 0 : _a3.unpack 11144 }); 11145} 11146function unpackMeta(input) { 11147 const extras = []; 11148 const primitives = {}; 11149 for (const [key, value] of Object.entries(input)) { 11150 if (Array.isArray(value)) { 11151 if (key === "themeColor") { 11152 value.forEach((v2) => { 11153 if (typeof v2 === "object" && v2 !== null) { 11154 extras.push({ name: "theme-color", ...v2 }); 11155 } 11156 }); 11157 continue; 11158 } 11159 for (const v2 of value) { 11160 if (typeof v2 === "object" && v2 !== null) { 11161 const urlProps = []; 11162 const otherProps = []; 11163 for (const [propKey, propValue] of Object.entries(v2)) { 11164 const metaKey = `${key}${propKey === "url" ? "" : `:${propKey}`}`; 11165 const meta2 = unpackMeta({ [metaKey]: propValue }); 11166 (propKey === "url" ? urlProps : otherProps).push(...meta2); 11167 } 11168 extras.push(...urlProps, ...otherProps); 11169 } else { 11170 extras.push(...typeof v2 === "string" ? unpackMeta({ [key]: v2 }) : handleObjectEntry(key, v2)); 11171 } 11172 } 11173 continue; 11174 } 11175 if (typeof value === "object" && value) { 11176 if (NAMESPACES.MEDIA.has(key)) { 11177 const prefix = key.startsWith("twitter") ? "twitter" : "og"; 11178 const type = key.replace(/^(og|twitter)/, "").toLowerCase(); 11179 const metaKey = prefix === "twitter" ? "name" : "property"; 11180 if (value.url) { 11181 extras.push({ 11182 [metaKey]: `${prefix}:${type}`, 11183 content: value.url 11184 }); 11185 } 11186 if (value.secureUrl) { 11187 extras.push({ 11188 [metaKey]: `${prefix}:${type}:secure_url`, 11189 content: value.secureUrl 11190 }); 11191 } 11192 for (const [propKey, propValue] of Object.entries(value)) { 11193 if (propKey !== "url" && propKey !== "secureUrl") { 11194 extras.push({ 11195 [metaKey]: `${prefix}:${type}:${propKey}`, 11196 // @ts-expect-error untyped 11197 content: propValue 11198 }); 11199 } 11200 } 11201 } else if (MetaTagsArrayable.has(fixKeyCase(key))) { 11202 extras.push(...handleObjectEntry(key, value)); 11203 } else { 11204 primitives[key] = sanitizeObject(value); 11205 } 11206 } else { 11207 primitives[key] = value; 11208 } 11209 } 11210 const meta = Object.entries(primitives).map(([key, value]) => { 11211 if (key === "charset") 11212 return { charset: value === null ? "_null" : value }; 11213 const metaKey = resolveMetaKeyType(key);
11214 const keyValue = resolveMetaKeyValue(key); 11215 const processedValue = value === null ? "_null" : typeof value === "object" ? resolvePackedMetaObjectValue(value, key) : typeof value === "number" ? value.toString() : value; 11216 return metaKey === "http-equiv" ? { "http-equiv": keyValue, "content": processedValue } : { [metaKey]: keyValue, content: processedValue }; 11217 }); 11218 return [...extras, ...meta].map( 11219 (m) => !("content" in m) ? m : m.content === "_null" ? { ...m, content: null } : m 11220 ); 11221} 11222function defineHeadPlugin(plugin2) { 11223 return plugin2; 11224} 11225const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({ 11226 key: "flatMeta", 11227 hooks: { 11228 "entries:normalize": (ctx) => { 11229 const tagsToAdd = []; 11230 ctx.tags = ctx.tags.map((t2) => { 11231 if (t2.tag !== "_flatMeta") { 11232 return t2; 11233 } 11234 tagsToAdd.push(unpackMeta(t2.props).map((p2) => ({ 11235 ...t2, 11236 tag: "meta", 11237 props: p2 11238 }))); 11239 return false; 11240 }).filter(Boolean).concat(...tagsToAdd); 11241 } 11242 } 11243}); 11244const allowedMetaProperties = ["name", "property", "http-equiv"]; 11245function isMetaArrayDupeKey(v2) { 11246 const k = v2.split(":")[1]; 11247 return MetaTagsArrayable.has(k); 11248} 11249function dedupeKey(tag) { 11250 const { props, tag: name } = tag; 11251 if (UniqueTags.has(name)) 11252 return name; 11253 if (name === "link" && props.rel === "canonical") 11254 return "canonical"; 11255 if (props.charset) 11256 return "charset"; 11257 if (tag.tag === "meta") { 11258 for (const n2 of allowedMetaProperties) { 11259 if (props[n2] !== void 0) { 11260 return `${name}:${props[n2]}`; 11261 } 11262 } 11263 } 11264 if (tag.key) { 11265 return `${name}:key:${tag.key}`; 11266 } 11267 if (props.id) { 11268 return `${name}:id:${props.id}`; 11269 } 11270 if (TagsWithInnerContent.has(name)) { 11271 const v2 = tag.textContent || tag.innerHTML; 11272 if (v2) { 11273 return `${name}:content:${v2}`; 11274 } 11275 } 11276} 11277function hashTag(tag) { 11278 const dedupe = tag._h || tag._d; 11279 if (dedupe) 11280 return dedupe; 11281 const inner = tag.textContent || tag.innerHTML; 11282 if (inner) 11283 return inner; 11284 return `${tag.tag}:${Object.entries(tag.props).map(([k, v2]) => `${k}:${String(v2)}`).join(",")}`; 11285} 11286function walkResolver(val, resolve2, key) { 11287 const type = typeof val; 11288 if (type === "function") { 11289 if (!key || key !== "titleTemplate" && !(key[0] === "o" && key[1] === "n")) { 11290 val = val(); 11291 } 11292 } 11293 let v2; 11294 if (resolve2) { 11295 v2 = resolve2(key, val); 11296 } 11297 if (Array.isArray(v2)) { 11298 return v2.map((r2) => walkResolver(r2, resolve2)); 11299 } 11300 if ((v2 == null ? void 0 : v2.constructor) === Object) { 11301 const next = {}; 11302 for (const key2 of Object.keys(v2)) { 11303 next[key2] = walkResolver(v2[key2], resolve2, key2); 11304 } 11305 return next; 11306 } 11307 return v2; 11308} 11309function normalizeStyleClassProps(key, value) { 11310 const store = key === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set(); 11311 function processValue(rawValue) { 11312 const value2 = rawValue.trim(); 11313 if (!value2) 11314 return; 11315 if (key === "style") { 11316 const [k, ...v2] = value2.split(":").map((s2) => s2.trim()); 11317 if (k && v2.length) 11318 store.set(k, v2.join(":")); 11319 } else { 11320 value2.split(" ").filter(Boolean).forEach((c2) => store.add(c2)); 11321 } 11322 } 11323 if (typeof value === "string") { 11324 key === "style" ? value.split(";").forEach(processValue) : processValue(value); 11325 } else if (Array.isArray(value)) { 11326 value.forEach((item) => processValue(item)); 11327 } else if (value && typeof value === "object") { 11328 Object.entries(value).forEach(([k, v2]) => { 11329 if (v2 && v2 !== "false") { 11330 key === "style" ? store.set(k.trim(), v2) : processValue(k); 11331 } 11332 }); 11333 } 11334 return store; 11335} 11336function normalizeProps$1(tag, input) { 11337 tag.props = tag.props || {}; 11338 if (!input) { 11339 return tag; 11340 } 11341 Object.entries(input).forEach(([key, value]) => { 11342 if (value === null) { 11343 tag.props[key] = null; 11344 return; 11345 } 11346 if (key === "class" || key === "style") { 11347 tag.props[key] = normalizeStyleClassProps(key, value); 11348 return; 11349 } 11350 if (TagConfigKeys.has(key)) { 11351 if (["textContent", "innerHTML"].includes(key) && typeof value === "object") { 11352 let type = input.type; 11353 if (!input.type) { 11354 type = "application/json"; 11355 } 11356 if (!(type == null ? void 0 : type.endsWith("json")) && type !== "speculationrules") { 11357 return; 11358 } 11359 input.type = type; 11360 tag.props.type = type; 11361 tag[key] = JSON.stringify(value); 11362 } else { 11363 tag[key] = value; 11364 } 11365 return; 11366 } 11367 const strValue = String(value); 11368 const isDataKey = key.startsWith("data-"); 11369 if (strValue === "true" || strValue === "") { 11370 tag.props[key] = isDataKey ? strValue : true; 11371 }
11371 else if (!value && isDataKey && strValue === "false") { 11372 tag.props[key] = "false"; 11373 } else if (value !== void 0) { 11374 tag.props[key] = value; 11375 } 11376 }); 11377 return tag; 11378} 11379function normalizeTag(tagName, _input) { 11380 const input = typeof _input === "object" && typeof _input !== "function" ? _input : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: _input }; 11381 const tag = normalizeProps$1({ tag: tagName, props: {} }, input); 11382 if (tag.key && DupeableTags.has(tag.tag)) { 11383 tag.props["data-hid"] = tag._h = tag.key; 11384 } 11385 if (tag.tag === "script" && typeof tag.innerHTML === "object") { 11386 tag.innerHTML = JSON.stringify(tag.innerHTML); 11387 tag.props.type = tag.props.type || "application/json"; 11388 } 11389 return Array.isArray(tag.props.content) ? tag.props.content.map((v2) => ({ ...tag, props: { ...tag.props, content: v2 } })) : tag; 11390} 11391function normalizeEntryToTags(input, propResolvers) { 11392 if (!input) { 11393 return []; 11394 } 11395 if (typeof input === "function") { 11396 input = input(); 11397 } 11398 const resolvers = (key, val) => { 11399 for (let i2 = 0; i2 < propResolvers.length; i2++) { 11400 val = propResolvers[i2](key, val); 11401 } 11402 return val; 11403 }; 11404 input = resolvers(void 0, input); 11405 const tags = []; 11406 input = walkResolver(input, resolvers); 11407 Object.entries(input || {}).forEach(([key, value]) => { 11408 if (value === void 0) 11409 return; 11410 for (const v2 of Array.isArray(value) ? value : [value]) 11411 tags.push(normalizeTag(key, v2)); 11412 }); 11413 return tags.flat(); 11414} 11415const sortTags = (a2, b) => a2._w === b._w ? a2._p - b._p : a2._w - b._w; 11416const TAG_WEIGHTS = { 11417 base: -10, 11418 title: 10 11419}; 11420const TAG_ALIASES = { 11421 critical: -8, 11422 high: -1, 11423 low: 2 11424}; 11425const WEIGHT_MAP = { 11426 meta: { 11427 "content-security-policy": -30, 11428 "charset": -20, 11429 "viewport": -15 11430 }, 11431 link: { 11432 "preconnect": 20, 11433 "stylesheet": 60, 11434 "preload": 70, 11435 "modulepreload": 70, 11436 "prefetch": 90, 11437 "dns-prefetch": 90, 11438 "prerender": 90 11439 }, 11440 script: { 11441 async: 30, 11442 defer: 80, 11443 sync: 50 11444 }, 11445 style: { 11446 imported: 40, 11447 sync: 60 11448 } 11449}; 11450const ImportStyleRe = /@import/; 11451const isTruthy = (val) => val === "" || val === true; 11452function tagWeight(head, tag) { 11453 var _a3; 11454 if (typeof tag.tagPriority === "number") 11455 return tag.tagPriority; 11456 let weight = 100; 11457 const offset = TAG_ALIASES[tag.tagPriority] || 0; 11458 const weightMap = head.resolvedOptions.disableCapoSorting ? { 11459 link: {}, 11460 script: {}, 11461 style: {} 11462 } : WEIGHT_MAP; 11463 if (tag.tag in TAG_WEIGHTS) { 11464 weight = TAG_WEIGHTS[tag.tag]; 11465 } else if (tag.tag === "meta") { 11466 const metaType = tag.props["http-equiv"] === "content-security-policy" ? "content-security-policy" : tag.props.charset ? "charset" : tag.props.name === "viewport" ? "viewport" : null; 11467 if (metaType) 11468 weight = WEIGHT_MAP.meta[metaType]; 11469 } else if (tag.tag === "link" && tag.props.rel) { 11470 weight = weightMap.link[tag.props.rel]; 11471 } else if (tag.tag === "script") { 11472 if (isTruthy(tag.props.async)) { 11473 weight = weightMap.script.async; 11474 } else if (tag.props.src && !isTruthy(tag.props.defer) && !isTruthy(tag.props.async) && tag.props.type !== "module" && !((_a3 = tag.props.type) == null ? void 0 : _a3.endsWith("json"))) { 11475 weight = weightMap.script.sync; 11476 } else if (isTruthy(tag.props.defer) && tag.props.src && !isTruthy(tag.props.async)) { 11477 weight = weightMap.script.defer; 11478 } 11479 } else if (tag.tag === "style") { 11480 weight = tag.innerHTML && ImportStyleRe.test(tag.innerHTML) ? weightMap.style.imported : weightMap.style.sync; 11481 } 11482 return (weight || 100) + offset; 11483} 11484function registerPlugin(head, p2) { 11485 const plugin2 = typeof p2 === "function" ? p2(head) : p2; 11486 const key = plugin2.key || String(head.plugins.size + 1); 11487 const exists = head.plugins.get(key); 11488 if (!exists) { 11489 head.plugins.set(key, plugin2); 11490 head.hooks.addHooks(plugin2.hooks || {}); 11491 } 11492} 11493// @__NO_SIDE_EFFECTS__ 11494function createUnhead(resolvedOptions = {}) { 11495 var _a3; 11496 const hooks = createHooks(); 11497 hooks.addHooks(resolvedOptions.hooks || {}); 11498 const ssr = !resolvedOptions.document; 11499 const entries = /* @__PURE__ */ new Map(); 11500 const plugins2 = /* @__PURE__ */ new Map(); 11501 const normalizeQueue = []; 11502 const head = { 11503 _entryCount: 1, 11504 // 0 is reserved for internal use 11505 plugins: plugins2, 11506 dirty: false, 11507 resolvedOptions, 11508 hooks, 11509 ssr, 11510 entries, 11511 headEntries() { 11512 return [...entries.values()]; 11513 }, 11514 use: (p2) => registerPlugin(head, p2),
11515 push(input, _options) { 11516 const options = { ..._options || {} }; 11517 delete options.head; 11518 const _i = options._index ?? head._entryCount++; 11519 const inst = { _i, input, options }; 11520 const _2 = { 11521 _poll(rm = false) { 11522 head.dirty = true; 11523 !rm && normalizeQueue.push(_i); 11524 hooks.callHook("entries:updated", head); 11525 }, 11526 dispose() { 11527 if (entries.delete(_i)) { 11528 _2._poll(true); 11529 } 11530 }, 11531 // a patch is the same as creating a new entry, just a nice DX 11532 patch(input2) { 11533 if (!options.mode || options.mode === "server" && ssr || options.mode === "client" && !ssr) { 11534 inst.input = input2; 11535 entries.set(_i, inst); 11536 _2._poll(); 11537 } 11538 } 11539 }; 11540 _2.patch(input); 11541 return _2; 11542 }, 11543 async resolveTags() { 11544 var _a4; 11545 const ctx = { 11546 tagMap: /* @__PURE__ */ new Map(), 11547 tags: [], 11548 entries: [...head.entries.values()] 11549 }; 11550 await hooks.callHook("entries:resolve", ctx); 11551 while (normalizeQueue.length) { 11552 const i2 = normalizeQueue.shift(); 11553 const e2 = entries.get(i2); 11554 if (e2) { 11555 const normalizeCtx = { 11556 tags: normalizeEntryToTags(e2.input, resolvedOptions.propResolvers || []).map((t2) => Object.assign(t2, e2.options)), 11557 entry: e2 11558 }; 11559 await hooks.callHook("entries:normalize", normalizeCtx); 11560 e2._tags = normalizeCtx.tags.map((t2, i22) => { 11561 t2._w = tagWeight(head, t2); 11562 t2._p = (e2._i << 10) + i22; 11563 t2._d = dedupeKey(t2); 11564 return t2; 11565 }); 11566 } 11567 } 11568 let hasFlatMeta = false; 11569 ctx.entries.flatMap((e2) => (e2._tags || []).map((t2) => ({ ...t2, props: { ...t2.props } }))).sort(sortTags).reduce((acc, next) => { 11570 const k = String(next._d || next._p); 11571 if (!acc.has(k)) 11572 return acc.set(k, next); 11573 const prev = acc.get(k); 11574 const strategy = (next == null ? void 0 : next.tagDuplicateStrategy) || (UsesMergeStrategy.has(next.tag) ? "merge" : null) || (next.key && next.key === prev.key ? "merge" : null); 11575 if (strategy === "merge") { 11576 const newProps = { ...prev.props }; 11577 Object.entries(next.props).forEach(([p2, v2]) => ( 11578 // @ts-expect-error untyped 11579 newProps[p2] = p2 === "style" ? new Map([...prev.props.style || /* @__PURE__ */ new Map(), ...v2]) : p2 === "class" ? /* @__P
11579URE__ */ new Set([...prev.props.class || /* @__PURE__ */ new Set(), ...v2]) : v2 11580 )); 11581 acc.set(k, { ...next, props: newProps }); 11582 } else if (next._p >> 10 === prev._p >> 10 && isMetaArrayDupeKey(next._d)) { 11583 acc.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next)); 11584 hasFlatMeta = true; 11585 } else if (next._w === prev._w ? next._p > prev._p : (next == null ? void 0 : next._w) < (prev == null ? void 0 : prev._w)) { 11586 acc.set(k, next); 11587 } 11588 return acc; 11589 }, ctx.tagMap); 11590 const title = ctx.tagMap.get("title"); 11591 const titleTemplate = ctx.tagMap.get("titleTemplate"); 11592 head._title = title == null ? void 0 : title.textContent; 11593 if (titleTemplate) { 11594 const titleTemplateFn = titleTemplate == null ? void 0 : titleTemplate.textContent; 11595 head._titleTemplate = titleTemplateFn; 11596 if (titleTemplateFn) { 11597 let newTitle = typeof titleTemplateFn === "function" ? titleTemplateFn(title == null ? void 0 : title.textContent) : titleTemplateFn; 11598 if (typeof newTitle === "string" && !head.plugins.has("template-params")) { 11599 newTitle = newTitle.replace("%s", (title == null ? void 0 : title.textContent) || ""); 11600 } 11601 if (title) { 11602 newTitle === null ? ctx.tagMap.delete("title") : ctx.tagMap.set("title", { ...title, textContent: newTitle }); 11603 } else { 11604 titleTemplate.tag = "title"; 11605 titleTemplate.textContent = newTitle; 11606 } 11607 } 11608 } 11609 ctx.tags = Array.from(ctx.tagMap.values()); 11610 if (hasFlatMeta) { 11611 ctx.tags = ctx.tags.flat().sort(sortTags); 11612 } 11613 await hooks.callHook("tags:beforeResolve", ctx); 11614 await hooks.callHook("tags:resolve", ctx); 11615 await hooks.callHook("tags:afterResolve", ctx); 11616 const finalTags = []; 11617 for (const t2 of ctx.tags) { 11618 const { innerHTML, tag, props } = t2; 11619 if (!ValidHeadTags.has(tag)) { 11620 continue; 11621 } 11622 if (Object.keys(props).length === 0 && !t2.innerHTML && !t2.textContent) { 11623 continue; 11624 } 11625 if (tag === "meta" && !props.content && !props["http-equiv"] && !props.charset) { 11626 continue; 11627 } 11628 if (tag === "script" && innerHTML) { 11629 if ((_a4 = props.type) == null ? void 0 : _a4.endsWith("json")) { 11630 const v2 = typeof innerHTML === "string" ? innerHTML : JSON.stringify(innerHTML); 11631 t2.innerHTML = v2.replace(/</g, "\\u003C"); 11632 } else if (typeof innerHTML === "string") { 11633 t2.innerHTML = innerHTML.replace(new RegExp(`</${tag}`, "g"), `<\\/${tag}`); 11634 } 11635 t2._d = dedupeKey(t2); 11636 } 11637 finalTags.push(t2); 11638 } 11639 return finalTags; 11640 } 11641 }; 11642 ((resolvedOptions == null ? void 0 : resolvedOptions.plugins) || []).forEach((p2) => registerPlugin(head, p2)); 11643 head.hooks.callHook("init", head); 11644 (_a3 = resolvedOptions.init) == null ? void 0 : _a3.forEach((e2) => e2 && head.push(e2)); 11645 return head; 11646} 11647const SepSub = "%separator"; 11648const SepSubRE = new RegExp(`${SepSub}(?:\\s*${SepSub})*`, "g"); 11649function sub(p2, token, isJson = false) { 11650 var _a3; 11651 let val; 11652 if (token === "s" || token === "pageTitle") { 11653 val = p2.pageTitle; 11654 } else if (token.includes(".")) { 11655 const dotIndex = token.indexOf("."); 11656 val = (_a3 = p2[token.substring(0, dotIndex)]) == null ? void 0 : _a3[token.substring(dotIndex + 1)]; 11657 } else { 11658 val = p2[token]; 11659 } 11660 if (val !== void 0) { 11661 return isJson ? (val || "").replace(/\\/g, "\\\\").replace(/</g, "\\u003C").replace(/"/g, '\\"') : val || ""; 11662 } 11663 return void 0; 11664} 11665function processTemplateParams(s2, p2, sep, isJson = false) { 11666 if (typeof s2 !== "string" || !s2.includes("%")) 11667 return s2; 11668 let decoded = s2; 11669 try { 11670 decoded = decodeURI(s2); 11671 } catch { 11672 } 11673 const tokens = decoded.match(/%\w+(?:\.\w+)?/g); 11674 if (!tokens) { 11675 return s2; 11676 } 11677 const hasSepSub = s2.includes(SepSub); 11678 s2 = s2.replace(/%\w+(?:\.\w+)?/g, (token) => { 11679 if (token === SepSub || !tokens.includes(token)) { 11680 return token; 11681 } 11682 const re = sub(p2, token.slice(1), isJson); 11683 return re !== void 0 ? re : token; 11684 }).trim(); 11685 if (hasSepSub) { 11686 if (s2.endsWith(SepSub)) 11687 s2 = s2.slice(0, -SepSub.length); 11688 if (s2.startsWith(SepSub)) 11689 s2 = s2.slice(SepSub.length); 11690 s2 = s2.replace(SepSubRE, sep || "").trim(); 11691 } 11692 return s2; 11693} 11694const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k; 11695const AliasSortingPlugin = defineHeadPlugin({ 11696 key: "aliasSorting", 11697 hooks: { 11698 "tags:resolve": (ctx) => { 11699 let m = false;
11700 for (const t2 of ctx.tags) { 11701 const p2 = t2.tagPriority; 11702 if (!p2) 11703 continue; 11704 const s2 = String(p2); 11705 if (s2.startsWith("before:")) { 11706 const k = formatKey(s2.slice(7)); 11707 const l2 = ctx.tagMap.get(k); 11708 if (l2) { 11709 if (typeof l2.tagPriority === "number") 11710 t2.tagPriority = l2.tagPriority; 11711 t2._p = l2._p - 1; 11712 m = true; 11713 } 11714 } else if (s2.startsWith("after:")) { 11715 const k = formatKey(s2.slice(6)); 11716 const l2 = ctx.tagMap.get(k); 11717 if (l2) { 11718 if (typeof l2.tagPriority === "number") 11719 t2.tagPriority = l2.tagPriority; 11720 t2._p = l2._p + 1; 11721 m = true; 11722 } 11723 } 11724 } 11725 if (m) 11726 ctx.tags = ctx.tags.sort(sortTags); 11727 } 11728 } 11729}); 11730const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({ 11731 key: "deprecations", 11732 hooks: { 11733 "entries:normalize": ({ tags }) => { 11734 for (const tag of tags) { 11735 if (tag.props.children) { 11736 tag.innerHTML = tag.props.children; 11737 delete tag.props.children; 11738 } 11739 if (tag.props.hid) { 11740 tag.key = tag.props.hid; 11741 delete tag.props.hid; 11742 } 11743 if (tag.props.vmid) { 11744 tag.key = tag.props.vmid; 11745 delete tag.props.vmid; 11746 } 11747 if (tag.props.body) { 11748 tag.tagPosition = "bodyClose"; 11749 delete tag.props.body; 11750 } 11751 } 11752 } 11753 } 11754}); 11755async function walkPromises(v2) { 11756 const type = typeof v2; 11757 if (type === "function") { 11758 return v2; 11759 } 11760 if (v2 instanceof Promise) { 11761 return await v2; 11762 } 11763 if (Array.isArray(v2)) { 11764 return await Promise.all(v2.map((r2) => walkPromises(r2))); 11765 } 11766 if ((v2 == null ? void 0 : v2.constructor) === Object) { 11767 const next = {}; 11768 for (const key of Object.keys(v2)) { 11769 next[key] = await walkPromises(v2[key]); 11770 } 11771 return next; 11772 } 11773 return v2; 11774} 11775const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({ 11776 key: "promises", 11777 hooks: { 11778 "entries:resolve": async (ctx) => { 11779 const promises = []; 11780 for (const k in ctx.entries) { 11781 if (!ctx.entries[k]._promisesProcessed) { 11782 promises.push( 11783 walkPromises(ctx.entries[k].input).then((val) => { 11784 ctx.entries[k].input = val; 11785 ctx.entries[k]._promisesProcessed = true; 11786 }) 11787 ); 11788 } 11789 } 11790 await Promise.all(promises); 11791 } 11792 } 11793}); 11794const SupportedAttrs = { 11795 meta: "content", 11796 link: "href", 11797 htmlAttrs: "lang" 11798}; 11799const contentAttrs = ["innerHTML", "textContent"]; 11800const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => { 11801 return { 11802 key: "template-params", 11803 hooks: { 11804 "entries:normalize": (ctx) => { 11805 var _a3, _b, _c; 11806 const params = ((_b = (_a3 = ctx.tags.filter((t2) => t2.tag === "templateParams" && t2.mode === "server")) == null ? void 0 : _a3[0]) == null ? void 0 : _b.props) || {}; 11807 if (Object.keys(params).length) { 11808 head._ssrPayload = { 11809 templateParams: { 11810 ...((_c = head._ssrPayload) == null ? void 0 : _c.templateParams) || {}, 11811 ...params 11812 } 11813 }; 11814 } 11815 }, 11816 "tags:resolve": ({ tagMap, tags }) => { 11817 var _a3; 11818 const params = ((_a3 = tagMap.get("templateParams")) == null ? void 0 : _a3.props) || {}; 11819 const sep = params.separator || "|"; 11820 delete params.separator; 11821 params.pageTitle = processTemplateParams( 11822 // find templateParams 11823 params.pageTitle || head._title || "", 11824 params, 11825 sep 11826 ); 11827 for (const tag of tags) { 11828 if (tag.processTemplateParams === false) { 11829 continue; 11830 } 11831 const v2 = SupportedAttrs[tag.tag]; 11832 if (v2 && typeof tag.props[v2] === "string") { 11833 tag.props[v2] = processTemplateParams(tag.props[v2], params, sep); 11834 } else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") { 11835 for (const p2 of contentAttrs) { 11836 if (typeof tag[p2] === "string") 11837 tag[p2] = processTemplateParams(tag[p2], params, sep, tag.tag === "script" && tag.props.type.endsWith("json")); 11838 } 11839 } 11840 } 11841 head._templateParams = params; 11842 head._separator = sep; 11843 }, 11844 "tags:afterResolve": ({ tagMap }) => { 11845 const title = tagMap.get("title"); 11846 if ((title == null ? void 0 : title.textContent) && title.processTemplateParams !== false) { 11847 title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator); 11848 } 11849 } 11850 } 11851 }; 11852}); 11853const VueResolver = (_2, value) => { 11854 return isRef(value) ? toValue(value) : value; 11855}; 11856const headSymbol = "usehead"; 11857function vueInstall(head) { 11858 const plugin2 = { 11859 install(app) { 11860 app.config.globalProperties.$unhead = head; 11861 app.config.globalProperties.$head = head; 11862 app.provide(headSymbol, head); 11863 } 11864 }; 11865 return plugin2.install; 11866} 11867function injectHead$1() { 11868 if (hasInjectionContext()) { 11869 const instance = inject(headSymbol); 11870 if (!instance) { 11871 throw new Error("useHead() was called without provide context, ensure you call it through the setup() function."); 11872 } 11873 return instance; 11874 } 11875 throw new Error("useHead() was called without provide context, ensure you call it through the setup() function."); 11876} 11877function useHead$1(input, options = {}) { 11878 const head = options.head || injectHead$1(); 11879 return head.ssr ? head.push(input || {}, options) : clientUseHead(head, input, options); 11880} 11881function clientUseHead(head, input, options = {}) { 11882 const deactivated = ref(false); 11883 let entry2; 11884 watchEffect(() => { 11885 const i2 = deactivated.value ? {} : walkResolver(input, VueResolver); 11886 if (entry2) { 11887 entry2.patch(i2); 11888 } else { 11889 entry2 = head.push(i2, options); 11890 } 11891 }); 11892 const vm = getCurrentInstance(); 11893 if (vm) { 11894 onBeforeUnmount(() => { 11895 entry2.dispose(); 11896 }); 11897 onDeactivated(() => { 11898 deactivated.value = true; 11899 }); 11900 onActivated(() => { 11901 deactivated.value = false;
11902 }); 11903 } 11904 return entry2; 11905} 11906function useSeoMeta$1(input = {}, options = {}) { 11907 const head = options.head || injectHead$1(); 11908 head.use(FlatMetaPlugin); 11909 const { title, titleTemplate, ...meta } = input; 11910 return useHead$1({ 11911 title, 11912 titleTemplate, 11913 _flatMeta: meta 11914 }, options); 11915} 11916function injectHead(nuxtApp) { 11917 var _a3; 11918 const nuxt = nuxtApp || tryUseNuxtApp(); 11919 return ((_a3 = nuxt == null ? void 0 : nuxt.ssrContext) == null ? void 0 : _a3.head) || (nuxt == null ? void 0 : nuxt.runWithContext(() => { 11920 if (hasInjectionContext()) { 11921 return inject(headSymbol); 11922 } 11923 })); 11924} 11925function useHead(input, options = {}) { 11926 const head = injectHead(options.nuxt); 11927 if (head) { 11928 return useHead$1(input, { head, ...options }); 11929 } 11930} 11931function useSeoMeta(input, options = {}) { 11932 const head = injectHead(options.nuxt); 11933 if (head) { 11934 return useSeoMeta$1(input, { head, ...options }); 11935 } 11936} 11937const scriptRel = "modulepreload"; 11938const assetsURL = function(dep, importerUrl) { 11939 return new URL(dep, importerUrl).href; 11940}; 11941const seen = {}; 11942const __vitePreload = function preload(baseModule, deps, importerUrl) { 11943 let promise = Promise.resolve(); 11944 if (deps && deps.length > 0) { 11945 let allSettled2 = function(promises) { 11946 return Promise.all( 11947 promises.map( 11948 (p2) => Promise.resolve(p2).then( 11949 (value) => ({ status: "fulfilled", value }), 11950 (reason) => ({ status: "rejected", reason }) 11951 ) 11952 ) 11953 ); 11954 }; 11955 const links = document.getElementsByTagName("link"); 11956 const cspNonceMeta = document.querySelector( 11957 "meta[property=csp-nonce]" 11958 ); 11959 const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce")); 11960 promise = allSettled2( 11961 deps.map((dep) => { 11962 dep = assetsURL(dep, importerUrl); 11963 if (dep in seen) return; 11964 seen[dep] = true; 11965 const isCss = dep.endsWith(".css"); 11966 const cssSelector = isCss ? '[rel="stylesheet"]' : ""; 11967 const isBaseRelative = !!importerUrl; 11968 if (isBaseRelative) { 11969 for (let i2 = links.length - 1; i2 >= 0; i2--) { 11970 const link2 = links[i2]; 11971 if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) { 11972 return; 11973 } 11974 } 11975 } else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) { 11976 return; 11977 } 11978 const link = document.createElement("link"); 11979 link.rel = isCss ? "stylesheet" : scriptRel; 11980 if (!isCss) { 11981 link.as = "script"; 11982 } 11983 link.crossOrigin = ""; 11984 link.href = dep; 11985 if (cspNonce) { 11986 link.setAttribute("nonce", cspNonce); 11987 } 11988 document.head.appendChild(link); 11989 if (isCss) { 11990 return new Promise((res, rej) => { 11991 link.addEventListener("load", res); 11992 link.addEventListener( 11993 "error", 11994 () => rej(new Error(`Unable to preload CSS for ${dep}`)) 11995 ); 11996 }); 11997 } 11998 }) 11999 ); 12000 } 12001 function handlePreloadError(err) { 12002 const e2 = new Event("vite:preloadError", { 12003 cancelable: true 12004 }); 12005 e2.payload = err; 12006 window.dispatchEvent(e2); 12007 if (!e2.defaultPrevented) { 12008 throw err; 12009 } 12010 } 12011 return promise.then((res) => { 12012 for (const item of res || []) { 12013 if (item.status !== "rejected") continue; 12014 handlePreloadError(item.reason); 12015 } 12016 return baseModule().catch(handlePreloadError); 12017 }); 12018}; 12019let manifest; 12020let matcher; 12021function fetchManifest() { 12022 { 12023 manifest = $fetch(buildAssetsURL(`builds/meta/${(/* @__PURE__ */ useRuntimeConfig()).app.buildId}.json`), { 12024 responseType: "json" 12025 }); 12026 } 12027 manifest.then((m) => { 12028 matcher = createMatcherFromExport(m.matcher); 12029 }).catch((e2) => { 12030 console.error("[nuxt] Error fetching app manifest.", e2); 12031 }); 12032 return manifest; 12033} 12034function getAppManifest() { 12035 return manifest || fetchManifest(); 12036} 12037async function getRouteRules(arg) { 12038 const path = typeof arg === "string" ? arg : arg.path; 12039 await getAppManifest(); 12040 if (!matcher) { 12041 console.error("[nuxt] Error creating app manifest matcher.", matcher); 12042 return {}; 12043 } 12044 try { 12045 return defu({}, ...matcher.matchAll(path).reverse()); 12046 } catch (e2) { 12047 console.error("[nuxt] Error matching route rules.", e2); 12048 return {}; 12049 } 12050} 12051async function loadPayload(url, opts = {}) { 12052 const shouldLoadPayload = await isPrerendered(url); 12053 if (!shouldLoadPayload) { 12054 return null; 12055 } 12056 const payloadURL = await _getPayloadURL(url, opts); 12057 return await _importPayload(payloadURL) || null; 12058} 12059const filename = "_payload.json"; 12060async function _getPayloadURL(url, opts = {}) { 12061 const u2 = new URL(url, "http://localhost"); 12062 if (u2.host !== "localhost" || hasProtocol(u2.pathname, { acceptRelative: true })) { 12063 throw new Error("Payload URL must not include hostname: " + url); 12064 } 12065 const config2 = /* @__PURE__ */ useRuntimeConfig(); 12066 const hash = opts.hash || (opts.fresh ? Date.now() : config2.app.buildId); 12067 const cdnURL = config2.app.cdnURL; 12068 const baseOrCdnURL = cdnURL && await isPrerendered(url) ? cdnURL : config2.app.baseURL; 12069 return joinURL(baseOrCdnURL, u2.pathname, filename + (hash ? `?${hash}` : "")); 12070} 12071async function _importPayload(payloadURL) { 12072 const payloadPromise = fetch(payloadURL, { cache: "force-cache" }).then((res) => res.text().then(parsePayload)); 12073 try { 12074 return await payloadPromise; 12075 } catch (err) { 12076 console.warn("[nuxt] Cannot load payload ", payloadURL, err); 12077 } 12078 return null; 12079} 12080async function isPrerendered(url = useRoute$1().path) { 12081 const nuxtApp = useNuxtApp(); 12082 url = withoutTrailingSlash(url); 12083 const manifest2 = await getAppManifest(); 12084 if (manifest2.prerendered.includes(url)) { 12085 return true; 12086 } 12087 return nuxtApp.runWithContext(async () => { 12088 const rules = await getRouteRules({ path: url }); 12089 return !!rules.prerender && !rules.redirect; 12090 }); 12091} 12092let payloadCache = null; 12093async function getNuxtClientPayload() { 12094 var _a3; 12095 if (payloadCache) { 12096 return payloadCache; 12097 } 12098 const el = document.getElementById("__NUXT_DATA__"); 12099 if (!el) { 12100 return {}; 12101 } 12102 const inlineData = await parsePayload(el.textContent || ""); 12103 const externalData = el.dataset.src ? await _importPayload(el.dataset.src) : void 0; 12104 payloadCache = { 12105 ...inlineData, 12106 ...externalData, 12107 ...window.__NUXT__ 12108 }; 12109 if ((_a3 = payloadCache.config) == null ? void 0 : _a3.public) { 12110 payloadCache.config.public = reactive(payloadCache.config.public); 12111 } 12112 return payloadCache; 12113} 12114async function parsePayload(payload) { 12115 return await parse(payload, useNuxtApp()._payloadRevivers); 12116} 12117function definePayloadReviver(name, revive) { 12118 { 12119 useNuxtApp()._payloadRevivers[name] = revive; 12120 } 12121} 12122const payloadPlugin = definePayloadPlugin(() => { 12123 definePayloadReviver("skipHydrate", (_data) => void 0); 12124}); 12125const revivers = [ 12126 ["NuxtError", (data) => createError(data)], 12127 ["EmptyShallowRef", (data) => shallowRef(data === "_" ? void 0 : data === "0n" ? BigInt(0) : destr(data))], 12128 ["EmptyRef", (data) => ref(data === "_" ? void 0 : data === "0n" ? BigInt(0) : destr(data))], 12129 ["ShallowRef", (data) => shallowRef(data)], 12130 ["ShallowReactive", (data) => shallowReactive(data)], 12131 ["Ref", (data) => ref(data)], 12132 ["Reactive", (data) => reactive(data)] 12133]; 12134const revive_payload_client_kG4vF4SWGlhgLJRKrmco1O_zuG41odAu7e9PNPCDOtY = /* @__PURE__ */ defineNuxtPlugin({ 12135 name: "nuxt:revive-payload:client", 12136 order: -30, 12137 async setup(nuxtApp) { 12138 let __temp, __restore; 12139 for (const [reviver, fn] of revivers) { 12140 definePayloadReviver(reviver, fn); 12141 } 12142 Object.assign(nuxtApp.payload, ([__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(getNuxtClientPayload)), __temp = await __temp, __restore(
12142), __temp)); 12143 window.__NUXT__ = nuxtApp.payload; 12144 } 12145}); 12146async function renderDOMHead(head, options = {}) { 12147 const dom = options.document || head.resolvedOptions.document; 12148 if (!dom || !head.dirty) 12149 return; 12150 const beforeRenderCtx = { shouldRender: true, tags: [] }; 12151 await head.hooks.callHook("dom:beforeRender", beforeRenderCtx); 12152 if (!beforeRenderCtx.shouldRender) 12153 return; 12154 if (head._domUpdatePromise) { 12155 return head._domUpdatePromise; 12156 } 12157 head._domUpdatePromise = new Promise(async (resolve2) => { 12158 var _a3; 12159 const dupeKeyCounter = /* @__PURE__ */ new Map(); 12160 const resolveTagPromise = new Promise((resolve22) => { 12161 head.resolveTags().then((tags2) => { 12162 resolve22( 12163 tags2.map((tag) => { 12164 const count = dupeKeyCounter.get(tag._d) || 0; 12165 const res = { 12166 tag, 12167 id: (count ? `${tag._d}:${count}` : tag._d) || hashTag(tag), 12168 shouldRender: true 12169 }; 12170 if (tag._d && isMetaArrayDupeKey(tag._d)) { 12171 dupeKeyCounter.set(tag._d, count + 1); 12172 } 12173 return res; 12174 }) 12175 ); 12176 }); 12177 }); 12178 let state = head._dom; 12179 if (!state) { 12180 state = { 12181 title: dom.title, 12182 elMap: (/* @__PURE__ */ new Map()).set("htmlAttrs", dom.documentElement).set("bodyAttrs", dom.body) 12183 }; 12184 for (const key of ["body", "head"]) { 12185 const children = (_a3 = dom[key]) == null ? void 0 : _a3.children; 12186 for (const c2 of children) { 12187 const tag = c2.tagName.toLowerCase(); 12188 if (!HasElementTags.has(tag)) { 12189 continue; 12190 } 12191 const next = normalizeProps$1({ tag, props: {} }, { 12192 innerHTML: c2.innerHTML, 12193 ...c2.getAttributeNames().reduce((props, name) => { 12194 props[name] = c2.getAttribute(name); 12195 return props; 12196 }, {}) || {} 12197 }); 12198 next.key = c2.getAttribute("data-hid") || void 0; 12199 next._d = dedupeKey(next) || hashTag(next); 12200 if (state.elMap.has(next._d)) { 12201 let count = 1; 12202 let k = next._d; 12203 while (state.elMap.has(k)) { 12204 k = `${next._d}:${count++}`; 12205 } 12206 state.elMap.set(k, c2); 12207 } else { 12208 state.elMap.set(next._d, c2); 12209 } 12210 } 12211 } 12212 } 12213 state.pendingSideEffects = { ...state.sideEffects }; 12214 state.sideEffects = {}; 12215 function track2(id, scope, fn) { 12216 const k = `${id}:${scope}`; 12217 state.sideEffects[k] = fn; 12218 delete state.pendingSideEffects[k]; 12219 } 12220 function trackCtx({ id, $el, tag }) { 12221 const isAttrTag = tag.tag.endsWith("Attrs"); 12222 state.elMap.set(id, $el); 12223 if (!isAttrTag) { 12224 if (tag.textContent && tag.textContent !== $el.textContent) { 12225 $el.textContent = tag.textContent; 12226 } 12227 if (tag.innerHTML && tag.innerHTML !== $el.innerHTML) { 12228 $el.innerHTML = tag.innerHTML; 12229 } 12230 track2(id, "el", () => { 12231 $el == null ? void 0 : $el.remove(); 12232 state.elMap.delete(id); 12233 }); 12234 } 12235 for (const k in tag.props) { 12236 if (!Object.prototype.hasOwnProperty.call(tag.props, k)) 12237 continue; 12238 const value = tag.props[k]; 12239 if (k.startsWith("on") && typeof value === "function") { 12240 const dataset2 = $el == null ? void 0 : $el.dataset; 12241 if (dataset2 && dataset2[`${k}fired`]) { 12242 const ek = k.slice(0, -5); 12243 value.call($el, new Event(ek.substring(2))); 12244 } 12245 if ($el.getAttribute(`data-${k}`) !== "") { 12246 (tag.tag === "bodyAttrs" ? dom.defaultView : $el).addEventListener( 12247 // onload -> load 12248 k.substring(2), 12249 value.bind($el) 12250 ); 12251 $el.setAttribute(`data-${k}`, ""); 12252 } 12253 continue; 12254 } 12255 const ck = `attr:${k}`; 12256 if (k === "class") { 12257 if (!value) { 12258 continue; 12259 } 12260 for (const c2 of value) { 12261 isAttrTag && track2(id, `${ck}:${c2}`, () => $el.classList.remove(c2)); 12262 !$el.classList.contains(c2) && $el.classList.add(c2); 12263 } 12264 } else if (k === "style") { 12265 if (!value) { 12266 continue; 12267 } 12268 for (const [k2, v2] of value) { 12269 track2(id, `${ck}:${k2}`, () => { 12270 $el.style.removeProperty(k2); 12271 }); 12272 $el.style.setProperty(k2, v2); 12273 } 12274 } else if (value !== false && value !== null) { 12275 $el.getAttribute(k) !== value && $el.setAttribute(k, value === true ? "" : String(value)); 12276 isAttrTag && track2(id, ck, () => $el.removeAttribute(k)); 12277 } 12278 } 12279 } 12280 const pending = []; 12281 const frag = { 12282 bodyClose: void 0, 12283 bodyOpen: void 0, 12284 head: void 0 12285 }; 12286 const tags = await resolveTagPromise; 12287 for (const ctx of tags) { 12288 const { tag, shouldRender, id } = ctx; 12289 if (!shouldRender) 12290 continue; 12291 if (tag.tag === "title") { 12292 dom.title = tag.textContent; 12293 track2("title", "", () =>
12293 dom.title = state.title); 12294 continue; 12295 } 12296 ctx.$el = ctx.$el || state.elMap.get(id); 12297 if (ctx.$el) { 12298 trackCtx(ctx); 12299 } else if (HasElementTags.has(tag.tag)) { 12300 pending.push(ctx); 12301 } 12302 } 12303 for (const ctx of pending) { 12304 const pos = ctx.tag.tagPosition || "head"; 12305 ctx.$el = dom.createElement(ctx.tag.tag); 12306 trackCtx(ctx); 12307 frag[pos] = frag[pos] || dom.createDocumentFragment(); 12308 frag[pos].appendChild(ctx.$el); 12309 } 12310 for (const ctx of tags) 12311 await head.hooks.callHook("dom:renderTag", ctx, dom, track2); 12312 frag.head && dom.head.appendChild(frag.head); 12313 frag.bodyOpen && dom.body.insertBefore(frag.bodyOpen, dom.body.firstChild); 12314 frag.bodyClose && dom.body.appendChild(frag.bodyClose); 12315 for (const k in state.pendingSideEffects) { 12316 state.pendingSideEffects[k](); 12317 } 12318 head._dom = state; 12319 await head.hooks.callHook("dom:rendered", { renders: tags }); 12320 resolve2(); 12321 }).finally(() => { 12322 head._domUpdatePromise = void 0; 12323 head.dirty = false; 12324 }); 12325 return head._domUpdatePromise; 12326} 12327function createHead$1(options = {}) { 12328 var _a3, _b, _c; 12329 const render = ((_a3 = options.domOptions) == null ? void 0 : _a3.render) || renderDOMHead; 12330 options.document = options.document || (typeof window !== "undefined" ? document : void 0); 12331 const initialPayload = ((_c = (_b = options.document) == null ? void 0 : _b.head.querySelector('script[id="unhead:payload"]')) == null ? void 0 : _c.innerHTML) || false; 12332 return /* @__PURE__ */ createUnhead({ 12333 ...options, 12334 plugins: [ 12335 ...options.plugins || [], 12336 { 12337 key: "client", 12338 hooks: { 12339 "entries:updated": render 12340 } 12341 } 12342 ], 12343 init: [ 12344 initialPayload ? JSON.parse(initialPayload) : false, 12345 ...options.init || [] 12346 ] 12347 }); 12348} 12349function createDebouncedFn(callee, delayer) { 12350 let ctxId = 0; 12351 return () => { 12352 const delayFnCtxId = ++ctxId; 12353 delayer(() => { 12354 if (ctxId === delayFnCtxId) { 12355 callee(); 12356 } 12357 }); 12358 }; 12359} 12360function createHead(options = {}) { 12361 const head = createHead$1({ 12362 domOptions: { 12363 render: createDebouncedFn(() => renderDOMHead(head), (fn) => setTimeout(fn, 0)) 12364 }, 12365 ...options 12366 }); 12367 head.install = vueInstall(head); 12368 return head; 12369} 12370const unheadOptions = { 12371 disableDefaults: true, 12372 disableCapoSorting: false, 12373 plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin] 12374}; 12375const unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU = /* @__PURE__ */ defineNuxtPlugin({ 12376 name: "nuxt:head", 12377 enforce: "pre", 12378 setup(nuxtApp) { 12379 const head = createHead(unheadOptions); 12380 nuxtApp.vueApp.use(head); 12381 { 12382 let pauseDOMUpdates = true; 12383 const syncHead = async () => { 12384 pauseDOMUpdates = false; 12385 await renderDOMHead(head); 12386 }; 12387 head.hooks.hook("dom:beforeRender", (context) => { 12388 context.shouldRender = !pauseDOMUpdates; 12389 }); 12390 nuxtApp.hooks.hook("page:start", () => { 12391 pauseDOMUpdates = true; 12392 }); 12393 nuxtApp.hooks.hook("page:finish", () => { 12394 if (!nuxtApp.isHydrating) { 12395 syncHead(); 12396 } 12397 }); 12398 nuxtApp.hooks.hook("app:error", syncHead); 12399 nuxtApp.hooks.hook("app:suspense:resolve", syncHead); 12400 } 12401 } 12402}); 12403/*! 12404 * vue-router v4.5.1 12405 * (c) 2025 Eduardo San Martin Morote 12406 * @license MIT 12407 */ 12408const isBrowser = typeof document !== "undefined"; 12409function isRouteComponent(component) { 12410 return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component; 12411} 12412function isESModule(obj) { 12413 return obj.__esModule || obj[Symbol.toStringTag] === "Module" || // support CF with dynamic imports that do not 12414 // add the Module string tag 12415 obj.default && isRouteComponent(obj.default); 12416} 12417const assign = Object.assign; 12418function applyToParams(fn, params) { 12419 const newParams = {}; 12420 for (const key in params) { 12421 const value = params[key]; 12422 newParams[key] = isArray$2(value) ? value.map(fn) : fn(value); 12423 } 12424 return newParams; 12425} 12426const noop$1 = () => { 12427}; 12428const isArray$2 = Array.isArray; 12429const HASH_RE = /#/g; 12430const AMPERSAND_RE = /&/g; 12431const SLASH_RE = /\//g; 12432const EQUAL_RE = /=/g; 12433const IM_RE = /\?/g; 12434const PLUS_RE = /\+/g; 12435const ENC_BRACKET_OPEN_RE = /%5B/g; 12436const ENC_BRACKET_CLOSE_RE = /%5D/g; 12437const ENC_CARET_RE = /%5E/g; 12438const ENC_BACKTICK_RE = /%60/g; 12439const ENC_CURLY_OPEN_RE = /%7B/g; 12440const ENC_PIPE_RE = /%7C/g; 12441const ENC_CURLY_CLOSE_RE = /%7D/g; 12442const ENC_SPACE_RE = /%20/g; 12443function commonEncode(text) { 12444 return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]"); 12445} 12446function encodeHash(text) { 12447 return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^"); 12448} 12449function encodeQueryValue(text) { 12450 return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^"); 12451} 12452function encodeQueryKey(text) { 12453 return encodeQueryValue(text).replace(EQUAL_RE, "%3D"); 12454} 12455function encodePath(text) { 12456 return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F"); 12457} 12458function encodeParam(text) { 12459 return text == null ? "" : encodePath(text).replace(SLASH_RE, "%2F"); 12460} 12461function decode(text) { 12462 try { 12463 return decodeURIComponent("" + text); 12464 } catch (err) { 12465 } 12466 return "" + text; 12467} 12468const TRAILING_SLASH_RE = /\/$/; 12469const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, ""); 12470function parseURL(parseQuery2, location2, currentLocation = "/") { 12471 let path, query = {}, searchString = "", hash = "";
12472 const hashPos = location2.indexOf("#"); 12473 let searchPos = location2.indexOf("?"); 12474 if (hashPos < searchPos && hashPos >= 0) { 12475 searchPos = -1; 12476 } 12477 if (searchPos > -1) { 12478 path = location2.slice(0, searchPos); 12479 searchString = location2.slice(searchPos + 1, hashPos > -1 ? hashPos : location2.length); 12480 query = parseQuery2(searchString); 12481 } 12482 if (hashPos > -1) { 12483 path = path || location2.slice(0, hashPos); 12484 hash = location2.slice(hashPos, location2.length); 12485 } 12486 path = resolveRelativePath(path != null ? path : location2, currentLocation); 12487 return { 12488 fullPath: path + (searchString && "?") + searchString + hash, 12489 path, 12490 query, 12491 hash: decode(hash) 12492 }; 12493} 12494function stringifyURL(stringifyQuery2, location2) { 12495 const query = location2.query ? stringifyQuery2(location2.query) : ""; 12496 return location2.path + (query && "?") + query + (location2.hash || ""); 12497} 12498function stripBase(pathname, base) { 12499 if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase())) 12500 return pathname; 12501 return pathname.slice(base.length) || "/"; 12502} 12503function isSameRouteLocation(stringifyQuery2, a2, b) { 12504 const aLastIndex = a2.matched.length - 1; 12505 const bLastIndex = b.matched.length - 1; 12506 return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a2.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a2.params, b.params) && stringifyQuery2(a2.query) === stringifyQuery2(b.query) && a2.hash === b.hash; 12507} 12508function isSameRouteRecord(a2, b) { 12509 return (a2.aliasOf || a2) === (b.aliasOf || b); 12510} 12511function isSameRouteLocationParams(a2, b) { 12512 if (Object.keys(a2).length !== Object.keys(b).length) 12513 return false; 12514 for (const key in a2) { 12515 if (!isSameRouteLocationParamsValue(a2[key], b[key])) 12516 return false; 12517 } 12518 return true; 12519} 12520function isSameRouteLocationParamsValue(a2, b) { 12521 return isArray$2(a2) ? isEquivalentArray(a2, b) : isArray$2(b) ? isEquivalentArray(b, a2) : a2 === b; 12522} 12523function isEquivalentArray(a2, b) { 12524 return isArray$2(b) ? a2.length === b.length && a2.every((value, i2) => value === b[i2]) : a2.length === 1 && a2[0] === b; 12525} 12526function resolveRelativePath(to, from2) { 12527 if (to.startsWith("/")) 12528 return to; 12529 if (!to) 12530 return from2; 12531 const fromSegments = from2.split("/"); 12532 const toSegments = to.split("/"); 12533 const lastToSegment = toSegments[toSegments.length - 1]; 12534 if (lastToSegment === ".." || lastToSegment === ".") { 12535 toSegments.push(""); 12536 } 12537 let position = fromSegments.length - 1; 12538 let toPosition; 12539 let segment; 12540 for (toPosition = 0; toPosition < toSegments.length; toPosition++) { 12541 segment = toSegments[toPosition]; 12542 if (segment === ".") 12543 continue; 12544 if (segment === "..") { 12545 if (position > 1) 12546 position--; 12547 } else 12548 break; 12549 } 12550 return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/"); 12551} 12552const START_LOCATION_NORMALIZED = { 12553 path: "/", 12554 // TODO: could we use a symbol in the future? 12555 name: void 0, 12556 params: {}, 12557 query: {}, 12558 hash: "", 12559 fullPath: "/", 12560 matched: [], 12561 meta: {}, 12562 redirectedFrom: void 0 12563}; 12564var NavigationType; 12565(function(NavigationType2) { 12566 NavigationType2["pop"] = "pop"; 12567 NavigationType2["push"] = "push"; 12568})(NavigationType || (NavigationType = {})); 12569var NavigationDirection; 12570(function(NavigationDirection2) { 12571 NavigationDirection2["back"] = "back"; 12572 NavigationDirection2["forward"] = "forward"; 12573 NavigationDirection2["unknown"] = ""; 12574})(NavigationDirection || (NavigationDirection = {})); 12575function normalizeBase(base) { 12576 if (!base) { 12577 if (isBrowser) { 12578 const baseEl = document.querySelector("base"); 12579 base = baseEl && baseEl.getAttribute("href") || "/"; 12580 base = base.replace(/^\w+:\/\/[^\/]+/, ""); 12581 } else { 12582 base = "/"; 12583 } 12584 } 12585 if (base[0] !== "/" && base[0] !== "#") 12586 base = "/" + base; 12587 return removeTrailingSlash(base); 12588} 12589const BEFORE_HASH_RE = /^[^#]+#/; 12590function createHref(base, location2) { 12591 return base.replace(BEFORE_HASH_RE, "#") + location2; 12592} 12593function getElementPosition(el, offset) { 12594 const docRect = document.documentElement.getBoundingClientRect(); 12595 const elRect = el.getBoundingClientRect(); 12596 return { 12597 behavior: offset.behavior, 12598 left: elRect.left - docRect.left - (offset.left || 0), 12599 top: elRect.top - docRect.top - (offset.top || 0) 12600 }; 12601} 12602const computeScrollPosition = () => ({ 12603 left: window.scrollX, 12604 top: window.scrollY 12605}); 12606function scrollToPosition(position) { 12607 let scrollToOptions; 12608 if ("el" in position) { 12609 const positionEl = position.el; 12610 const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#"); 12611 const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl)
12611: positionEl; 12612 if (!el) { 12613 return; 12614 } 12615 scrollToOptions = getElementPosition(el, position); 12616 } else { 12617 scrollToOptions = position; 12618 } 12619 if ("scrollBehavior" in document.documentElement.style) 12620 window.scrollTo(scrollToOptions); 12621 else { 12622 window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY); 12623 } 12624} 12625function getScrollKey(path, delta) { 12626 const position = history.state ? history.state.position - delta : -1; 12627 return position + path; 12628} 12629const scrollPositions = /* @__PURE__ */ new Map(); 12630function saveScrollPosition(key, scrollPosition) { 12631 scrollPositions.set(key, scrollPosition); 12632} 12633function getSavedScrollPosition(key) { 12634 const scroll = scrollPositions.get(key); 12635 scrollPositions.delete(key); 12636 return scroll; 12637} 12638let createBaseLocation = () => location.protocol + "//" + location.host; 12639function createCurrentLocation$1(base, location2) { 12640 const { pathname, search, hash } = location2; 12641 const hashPos = base.indexOf("#"); 12642 if (hashPos > -1) { 12643 let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1; 12644 let pathFromHash = hash.slice(slicePos); 12645 if (pathFromHash[0] !== "/") 12646 pathFromHash = "/" + pathFromHash; 12647 return stripBase(pathFromHash, ""); 12648 } 12649 const path = stripBase(pathname, base); 12650 return path + search + hash; 12651} 12652function useHistoryListeners(base, historyState, currentLocation, replace) { 12653 let listeners = []; 12654 let teardowns = []; 12655 let pauseState = null; 12656 const popStateHandler = ({ state }) => { 12657 const to = createCurrentLocation$1(base, location); 12658 const from2 = currentLocation.value; 12659 const fromState = historyState.value; 12660 let delta = 0; 12661 if (state) { 12662 currentLocation.value = to; 12663 historyState.value = state; 12664 if (pauseState && pauseState === from2) { 12665 pauseState = null; 12666 return; 12667 } 12668 delta = fromState ? state.position - fromState.position : 0; 12669 } else { 12670 replace(to); 12671 } 12672 listeners.forEach((listener) => { 12673 listener(currentLocation.value, from2, { 12674 delta, 12675 type: NavigationType.pop, 12676 direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown 12677 }); 12678 }); 12679 }; 12680 function pauseListeners() { 12681 pauseState = currentLocation.value; 12682 } 12683 function listen(callback) { 12684 listeners.push(callback); 12685 const teardown = () => { 12686 const index = listeners.indexOf(callback); 12687 if (index > -1) 12688 listeners.splice(index, 1); 12689 }; 12690 teardowns.push(teardown); 12691 return teardown; 12692 } 12693 function beforeUnloadListener() { 12694 const { history: history2 } = window; 12695 if (!history2.state) 12696 return; 12697 history2.replaceState(assign({}, history2.state, { scroll: computeScrollPosition() }), ""); 12698 } 12699 function destroy() { 12700 for (const teardown of teardowns) 12701 teardown(); 12702 teardowns = []; 12703 window.removeEventListener("popstate", popStateHandler); 12704 window.removeEventListener("beforeunload", beforeUnloadListener); 12705 } 12706 window.addEventListener("popstate", popStateHandler); 12707 window.addEventListener("beforeunload", beforeUnloadListener, { 12708 passive: true 12709 }); 12710 return { 12711 pauseListeners, 12712 listen, 12713 destroy 12714 }; 12715} 12716function buildState(back, current, forward, replaced = false, computeScroll = false) { 12717 return { 12718 back, 12719 current, 12720 forward, 12721 replaced, 12722 position: window.history.length, 12723 scroll: computeScroll ? computeScrollPosition() : null 12724 }; 12725} 12726function useHistoryStateNavigation(base) { 12727 const { history: history2, location: location2 } = window; 12728 const currentLocation = { 12729 value: createCurrentLocation$1(base, location2) 12730 }; 12731 const historyState = { value: history2.state }; 12732 if (!historyState.value) { 12733 changeLocation(currentLocation.value, { 12734 back: null, 12735 current: currentLocation.value, 12736 forward: null, 12737 // the length is off by one, we need to decrease it 12738 position: history2.length - 1, 12739 replaced: true, 12740 // don't add a scroll as the user may have an anchor, and we want 12741 // scrollBehavior to be triggered without a saved position 12742 scroll: null 12743 }, true); 12744 } 12745 function changeLocation(to, state, replace2) { 12746 const hashIndex = base.indexOf("#"); 12747 const url = hashIndex > -1 ? (location2.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to; 12748 try { 12749 history2[replace2 ? "replaceState" : "pushState"](state, "", url); 12750 historyState.value = state; 12751 } catch (err) { 12752 { 12753 console.error(err); 12754 } 12755 location2[replace2 ? "replace" : "assign"](url); 12756 } 12757 } 12758 function replace(to, data) { 12759 const state = assign({}, history2.state, buildState( 12760 historyState.value.back, 12761 // keep back and forward entries but override current position 12762 to, 12763 historyState.value.forward, 12764 true 12765 ), data, { position: historyState.value.position }); 12766 changeLocation(to, state, true); 12767 currentLocation.value = to; 12768 } 12769 function push(to, data) { 12770 const currentState = assign( 12771 {}, 12772 // use current history state to gracefully handle a wrong call to 12773 // history.replaceState 12774 // https://github.com/vuejs/router/issues/366 12775 historyState.value, 12776 history2.state, 12777 { 12778 forward: to, 12779 scroll: computeScrollPosition() 12780 } 12781 ); 12782 changeLocation(currentState.current, currentState, true); 12783 const state = assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data); 12784 changeLocation(to, state, false); 12785 currentLocation.value = to; 12786 } 12787 return { 12788 location: currentLocation, 12789 state: historyState, 12790 push, 12791 replace 12792 }; 12793} 12794function createWebHistory(base) { 12795 base = normalizeBase(base); 12796 const historyNavigation = useHistoryStateNavigation(base); 12797 const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace); 12798 function go(delta, triggerListeners = true) { 12799 if (!triggerListeners) 12800 historyListeners.pauseListeners(); 12801 history.go(delta); 12802 } 12803 const routerHistory = assign({ 12804 // it's overridden right after 12805 location: "", 12806 base, 12807 go, 12808 createHref: createHref.bind(null, base) 12809 }, historyNavigation, historyListeners); 12810 Object.defineProperty(routerHistory, "location", { 12811 enumerable: true, 12812 get: () => historyNavigation.location.value 12813 }); 12814 Object.defineProperty(routerHistory, "state", { 12815 enumerable: true, 12816 get: () => historyNavigation.state.value 12817 }); 12818 return routerHistory; 12819} 12820function createWebHashHistory(base) { 12821 base = location.host ? base || location.pathname + location.search : ""; 12822 if (!base.includes("#")) 12823 base += "#"; 12824 return createWebHistory(base); 12825} 12826function isRouteLocation(route) { 12827 return typeof route === "string" || route && typeof route === "object"; 12828} 12829function isRouteName(name) { 12830 return typeof name === "string" || typeof name === "symbol"; 12831} 12832const NavigationFailureSymbol = Symbol(""); 12833var NavigationFailureType; 12834(function(NavigationFailureType2) { 12835 NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted"; 12836 NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled"; 12837 NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated"; 12838})(NavigationFailureType || (NavigationFailureType = {})); 12839function createRouterError(type, params) { 12840 { 12841 return assign(new Error(), { 12842 type, 12843 [NavigationFailureSymbol]: true 12844 }, params); 12845 } 12846} 12847function isNavigationFailure(error, type) { 12848 return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type)); 12849} 12850const BASE_PARAM_PATTERN = "[^/]+?"; 12851const BASE_PATH_PARSER_OPTIONS = { 12852 sensitive: false, 12853 strict: false, 12854 start: true, 12855 end: true 12856}; 12857const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g; 12858function tokensToParser(segments, extraOptions) { 12859 const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions); 12860 const score = []; 12861 let pattern = options.start ? "^" : "";
12862 const keys = []; 12863 for (const segment of segments) { 12864 const segmentScores = segment.length ? [] : [ 12865 90 12866 /* PathScore.Root */ 12867 ]; 12868 if (options.strict && !segment.length) 12869 pattern += "/"; 12870 for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) { 12871 const token = segment[tokenIndex]; 12872 let subSegmentScore = 40 + (options.sensitive ? 0.25 : 0); 12873 if (token.type === 0) { 12874 if (!tokenIndex) 12875 pattern += "/"; 12876 pattern += token.value.replace(REGEX_CHARS_RE, "\\$&"); 12877 subSegmentScore += 40; 12878 } else if (token.type === 1) { 12879 const { value, repeatable, optional, regexp } = token; 12880 keys.push({ 12881 name: value, 12882 repeatable, 12883 optional 12884 }); 12885 const re2 = regexp ? regexp : BASE_PARAM_PATTERN; 12886 if (re2 !== BASE_PARAM_PATTERN) { 12887 subSegmentScore += 10; 12888 try { 12889 new RegExp(`(${re2})`); 12890 } catch (err) { 12891 throw new Error(`Invalid custom RegExp for param "${value}" (${re2}): ` + err.message); 12892 } 12893 } 12894 let subPattern = repeatable ? `((?:${re2})(?:/(?:${re2}))*)` : `(${re2})`; 12895 if (!tokenIndex) 12896 subPattern = // avoid an optional / if there are more segments e.g. /:p?-static 12897 // or /:p?-:p2 12898 optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern; 12899 if (optional) 12900 subPattern += "?"; 12901 pattern += subPattern; 12902 subSegmentScore += 20; 12903 if (optional) 12904 subSegmentScore += -8; 12905 if (repeatable) 12906 subSegmentScore += -20; 12907 if (re2 === ".*") 12908 subSegmentScore += -50; 12909 } 12910 segmentScores.push(subSegmentScore); 12911 } 12912 score.push(segmentScores); 12913 } 12914 if (options.strict && options.end) { 12915 const i2 = score.length - 1; 12916 score[i2][score[i2].length - 1] += 0.7000000000000001; 12917 } 12918 if (!options.strict) 12919 pattern += "/?"; 12920 if (options.end) 12921 pattern += "$"; 12922 else if (options.strict && !pattern.endsWith("/")) 12923 pattern += "(?:/|$)"; 12924 const re = new RegExp(pattern, options.sensitive ? "" : "i"); 12925 function parse2(path) { 12926 const match = path.match(re); 12927 const params = {}; 12928 if (!match) 12929 return null; 12930 for (let i2 = 1; i2 < match.length; i2++) { 12931 const value = match[i2] || ""; 12932 const key = keys[i2 - 1]; 12933 params[key.name] = value && key.repeatable ? value.split("/") : value; 12934 } 12935 return params; 12936 } 12937 function stringify(params) { 12938 let path = ""; 12939 let avoidDuplicatedSlash = false; 12940 for (const segment of segments) { 12941 if (!avoidDuplicatedSlash || !path.endsWith("/")) 12942 path += "/"; 12943 avoidDuplicatedSlash = false; 12944 for (const token of segment) { 12945 if (token.type === 0) { 12946 path += token.value; 12947 } else if (token.type === 1) { 12948 const { value, repeatable, optional } = token; 12949 const param = value in params ? params[value] : ""; 12950 if (isArray$2(param) && !repeatable) { 12951 throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`); 12952 } 12953 const text = isArray$2(param) ? param.join("/") : param; 12954 if (!text) { 12955 if (optional) { 12956 if (segment.length < 2) { 12957 if (path.endsWith("/")) 12958 path = path.slice(0, -1); 12959 else 12960 avoidDuplicatedSlash = true; 12961 } 12962 } else 12963 throw new Error(`Missing required param "${value}"`); 12964 } 12965 path += text; 12966 } 12967 } 12968 } 12969 return path || "/"; 12970 } 12971 return { 12972 re, 12973 score, 12974 keys, 12975 parse: parse2, 12976 stringify 12977 }; 12978} 12979function compareScoreArray(a2, b) { 12980 let i2 = 0; 12981 while (i2 < a2.length && i2 < b.length) { 12982 const diff = b[i2] - a2[i2]; 12983 if (diff) 12984 return diff; 12985 i2++; 12986 } 12987 if (a2.length < b.length) { 12988 return a2.length === 1 && a2[0] === 40 + 40 ? -1 : 1; 12989 } else if (a2.length > b.length) { 12990 return b.length === 1 && b[0] === 40 + 40 ? 1 : -1; 12991 } 12992 return 0; 12993} 12994function comparePathParserScore(a2, b) { 12995 let i2 = 0; 12996 const aScore = a2.score; 12997 const bScore = b.score; 12998 while (i2 < aScore.length && i2 < bScore.length) { 12999 const comp = compareScoreArray(aScore[i2], bScore[i2]); 13000 if (comp) 13001 return comp; 13002 i2++; 13003 } 13004 if (Math.abs(bScore.length - aScore.length) === 1) { 13005 if (isLastScoreNegative(aScore)) 13006 return 1; 13007 if (isLastScoreNegative(bScore)) 13008 return -1; 13009 } 13010 return bScore.length - aScore.length; 13011} 13012function isLastScoreNegative(score) { 13013 const last2 = score[score.length - 1]; 13014 return score.length > 0 && last2[last2.length - 1] < 0; 13015} 13016const ROOT_TOKEN = { 13017 type: 0, 13018 value: "" 13019}; 13020const VALID_PARAM_RE = /[a-zA-Z0-9_]/; 13021function tokenizePath(path) { 13022 if (!path) 13023 return [[]]; 13024 if (path === "/") 13025 return [[ROOT_TOKEN]]; 13026 if (!path.startsWith("/")) { 13027 throw new Error(`Invalid path "${path}"`); 13028 } 13029 function crash(message) { 13030 throw new Error(`ERR (${state})/"${buffer}": ${message}`); 13031 } 13032 let state = 0; 13033 let previousState = state; 13034 const tokens = []; 13035 let segment; 13036 function finalizeSegment() { 13037 if (segment) 13038 tokens.push(segment); 13039 segment = []; 13040 } 13041 let i2 = 0; 13042 let char; 13043 let buffer = ""; 13044 let customRe = ""; 13045 function consumeBuffer() { 13046 if (!buffer) 13047 return; 13048 if (state === 0) { 13049 segment.push({ 13050 type: 0, 13051 value: buffer 13052 }); 13053 } else if (state === 1 || state === 2 || state === 3) { 13054 if (segment.length > 1 && (char === "*" || char === "+")) 13055 crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`); 13056 segment.push({ 13057 type: 1, 13058 value: buffer, 13059 regexp: customRe, 13060 repeatable: char === "*" || char === "+", 13061 optional: char === "*" || char === "?" 13062 }); 13063 } else { 13064 crash("Invalid state to consume buffer"); 13065 } 13066 buffer = ""; 13067 } 13068 function addCharToBuffer() { 13069 buffer += char; 13070 } 13071 while (i2 < path.length) { 13072 char = path[i2++]; 13073 if (char === "\\" && state !== 2) { 13074 previousState = state; 13075 state = 4; 13076 continue; 13077 } 13078 switch (state) { 13079 case 0: 13080 if (char === "/") { 13081 if (buffer) { 13082 consumeBuffer(); 13083 } 13084 finalizeSegment(); 13085 } else if (char === ":") { 13086 consumeBuffer(); 13087 state = 1; 13088 } else { 13089 addCharToBuffer(); 13090 } 13091 break; 13092 case 4: 13093 addCharToBuffer(); 13094 state = previousState; 13095 break; 13096 case 1: 13097 if (char === "(") { 13098 state = 2; 13099 } else if (VALID_PARAM_RE.test(char)) { 13100 addCharToBuffer(); 13101 } else { 13102 consumeBuffer(); 13103 state = 0; 13104 if (char !== "*" && char !== "?" && char !== "+") 13105 i2--; 13106 } 13107 break; 13108 case 2: 13109 if (char === ")") { 13110 if (customRe[customRe.length - 1] == "\\") 13111 customRe = customRe.slice(0, -1) + char; 13112 else 13113 state = 3; 13114 } else { 13115 customRe += char; 13116 } 13117 break; 13118 case 3: 13119 consumeBuffer(); 13120 state = 0; 13121 if (char !== "*" && char !== "?" && char !== "+") 13122 i2--; 13123 customRe = ""; 13124 break; 13125 default: 13126 crash("Unknown state"); 13127 break; 13128 } 13129 } 13130 if (state === 2) 13131 crash(`Unfinished custom RegExp for param "${buffer}"`); 13132 consumeBuffer(); 13133 finalizeSegment(); 13134 return tokens; 13135} 13136function createRouteRecordMatcher(record, parent, options) { 13137 const parser = tokensToParser(tokenizePath(record.path), options); 13138 const matcher2 = assign(parser, { 13139 record, 13140 parent, 13141 // these needs to be populated by the parent 13142 children: [],
13143 alias: [] 13144 }); 13145 if (parent) { 13146 if (!matcher2.record.aliasOf === !parent.record.aliasOf) 13147 parent.children.push(matcher2); 13148 } 13149 return matcher2; 13150} 13151function createRouterMatcher(routes, globalOptions) { 13152 const matchers = []; 13153 const matcherMap = /* @__PURE__ */ new Map(); 13154 globalOptions = mergeOptions({ strict: false, end: true, sensitive: false }, globalOptions); 13155 function getRecordMatcher(name) { 13156 return matcherMap.get(name); 13157 } 13158 function addRoute(record, parent, originalRecord) { 13159 const isRootAdd = !originalRecord; 13160 const mainNormalizedRecord = normalizeRouteRecord(record); 13161 mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record; 13162 const options = mergeOptions(globalOptions, record); 13163 const normalizedRecords = [mainNormalizedRecord]; 13164 if ("alias" in record) { 13165 const aliases = typeof record.alias === "string" ? [record.alias] : record.alias; 13166 for (const alias of aliases) { 13167 normalizedRecords.push( 13168 // we need to normalize again to ensure the `mods` property 13169 // being non enumerable 13170 normalizeRouteRecord(assign({}, mainNormalizedRecord, { 13171 // this allows us to hold a copy of the `components` option 13172 // so that async components cache is hold on the original record 13173 components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components, 13174 path: alias, 13175 // we might be the child of an alias 13176 aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord 13177 // the aliases are always of the same kind as the original since they 13178 // are defined on the same record 13179 })) 13180 ); 13181 } 13182 } 13183 let matcher2; 13184 let originalMatcher; 13185 for (const normalizedRecord of normalizedRecords) { 13186 const { path } = normalizedRecord; 13187 if (parent && path[0] !== "/") { 13188 const parentPath = parent.record.path; 13189 const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/"; 13190 normalizedRecord.path = parent.record.path + (path && connectingSlash + path); 13191 } 13192 matcher2 = createRouteRecordMatcher(normalizedRecord, parent, options); 13193 if (originalRecord) { 13194 originalRecord.alias.push(matcher2); 13195 } else { 13196 originalMatcher = originalMatcher || matcher2; 13197 if (originalMatcher !== matcher2) 13198 originalMatcher.alias.push(matcher2); 13199 if (isRootAdd && record.name && !isAliasRecord(matcher2)) { 13200 removeRoute(record.name); 13201 } 13202 } 13203 if (isMatchable(matcher2)) { 13204 insertMatcher(matcher2); 13205 } 13206 if (mainNormalizedRecord.children) { 13207 const children = mainNormalizedRecord.children; 13208 for (let i2 = 0; i2 < children.length; i2++) { 13209 addRoute(children[i2], matcher2, originalRecord && originalRecord.children[i2]); 13210 } 13211 } 13212 originalRecord = originalRecord || matcher2; 13213 } 13214 return originalMatcher ? () => { 13215 removeRoute(originalMatcher); 13216 } : noop$1; 13217 } 13218 function removeRoute(matcherRef) { 13219 if (isRouteName(matcherRef)) { 13220 const matcher2 = matcherMap.get(matcherRef); 13221 if (matcher2) { 13222 matcherMap.delete(matcherRef); 13223 matchers.splice(matchers.indexOf(matcher2), 1); 13224 matcher2.children.forEach(removeRoute); 13225 matcher2.alias.forEach(removeRoute); 13226 } 13227 } else { 13228 const index = matchers.indexOf(matcherRef); 13229 if (index > -1) { 13230 matchers.splice(index, 1); 13231 if (matcherRef.record.name) 13232 matcherMap.delete(matcherRef.record.name); 13233 matcherRef.children.forEach(removeRoute); 13234 matcherRef.alias.forEach(removeRoute); 13235 } 13236 } 13237 } 13238 function getRoutes() { 13239 return matchers; 13240 } 13241 function insertMatcher(matcher2) { 13242 const index = findInsertionIndex(matcher2, matchers); 13243 matchers.splice(index, 0, matcher2); 13244 if (matcher2.record.name && !isAliasRecord(matcher2)) 13245 matcherMap.set(matcher2.record.name, matcher2); 13246 } 13247 function resolve2(location2, currentLocation) { 13248 let matcher2; 13249 let params = {}; 13250 let path; 13251 let name; 13252 if ("name" in location2 && location2.name) { 13253 matcher2 = matcherMap.get(location2.name); 13254 if (!matcher2) 13255 throw createRouterError(1, { 13256 location: location2 13257 }); 13258 name = matcher2.record.name; 13259 params = assign( 13260 // paramsFromLocation is a new object 13261 paramsFromLocation( 13262 currentLocation.params, 13263 // only keep params that exist in the resolved location 13264 // only keep optional params coming from a parent record 13265 matcher2.keys.filter((k) => !k.optional).concat(matcher2.parent ? matcher2.parent.keys.filter((k) => k.optional) : []).map((k) => k.name) 13266 ), 13267 // discard any existing params in the current location that do not exist here 13268 // #1497 this ensures better active/exact matching 13269 location2.params && paramsFromLocation(location2.params, matcher2.keys.map((k) => k.name)) 13270 ); 13271 path = matcher2.stringify(params); 13272 } else if (location2.path != null) { 13273 path = location2.path; 13274 matcher2 = matchers.find((m) => m.re.test(path)); 13275 if (matcher2) { 13276 params = matcher2.parse(path); 13277 name = matcher2.record.name; 13278 } 13279 } else { 13280 matcher2 = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path)); 13281 if (!matcher2) 13282 throw createRouterError(1, { 13283 location: location2, 13284 currentLocation 13285 }); 13286 name = matcher2.record.name; 13287 params = assign({}, currentLocation.params, location2.params); 13288 path = matcher2.stringify(params); 13289 } 13290 const matched = []; 13291 let parentMatcher = matcher2; 13292 while (parentMatcher) { 13293 matched.unshift(parentMatcher.record); 13294 parentMatcher = parentMatcher.parent; 13295 } 13296 return { 13297 name, 13298 path, 13299 params, 13300 matched, 13301 meta: mergeMetaFields(matched) 13302 }; 13303 }
13304 routes.forEach((route) => addRoute(route)); 13305 function clearRoutes() { 13306 matchers.length = 0; 13307 matcherMap.clear(); 13308 } 13309 return { 13310 addRoute, 13311 resolve: resolve2, 13312 removeRoute, 13313 clearRoutes, 13314 getRoutes, 13315 getRecordMatcher 13316 }; 13317} 13318function paramsFromLocation(params, keys) { 13319 const newParams = {}; 13320 for (const key of keys) { 13321 if (key in params) 13322 newParams[key] = params[key]; 13323 } 13324 return newParams; 13325} 13326function normalizeRouteRecord(record) { 13327 const normalized = { 13328 path: record.path, 13329 redirect: record.redirect, 13330 name: record.name, 13331 meta: record.meta || {}, 13332 aliasOf: record.aliasOf, 13333 beforeEnter: record.beforeEnter, 13334 props: normalizeRecordProps(record), 13335 children: record.children || [], 13336 instances: {}, 13337 leaveGuards: /* @__PURE__ */ new Set(), 13338 updateGuards: /* @__PURE__ */ new Set(), 13339 enterCallbacks: {}, 13340 // must be declared afterwards 13341 // mods: {}, 13342 components: "components" in record ? record.components || null : record.component && { default: record.component } 13343 }; 13344 Object.defineProperty(normalized, "mods", { 13345 value: {} 13346 }); 13347 return normalized; 13348} 13349function normalizeRecordProps(record) { 13350 const propsObject = {}; 13351 const props = record.props || false; 13352 if ("component" in record) { 13353 propsObject.default = props; 13354 } else { 13355 for (const name in record.components) 13356 propsObject[name] = typeof props === "object" ? props[name] : props; 13357 } 13358 return propsObject; 13359} 13360function isAliasRecord(record) { 13361 while (record) { 13362 if (record.record.aliasOf) 13363 return true; 13364 record = record.parent; 13365 } 13366 return false; 13367} 13368function mergeMetaFields(matched) { 13369 return matched.reduce((meta, record) => assign(meta, record.meta), {}); 13370} 13371function mergeOptions(defaults2, partialOptions) { 13372 const options = {}; 13373 for (const key in defaults2) { 13374 options[key] = key in partialOptions ? partialOptions[key] : defaults2[key]; 13375 } 13376 return options; 13377} 13378function findInsertionIndex(matcher2, matchers) { 13379 let lower = 0; 13380 let upper = matchers.length; 13381 while (lower !== upper) { 13382 const mid = lower + upper >> 1; 13383 const sortOrder = comparePathParserScore(matcher2, matchers[mid]); 13384 if (sortOrder < 0) { 13385 upper = mid; 13386 } else { 13387 lower = mid + 1; 13388 } 13389 } 13390 const insertionAncestor = getInsertionAncestor(matcher2); 13391 if (insertionAncestor) { 13392 upper = matchers.lastIndexOf(insertionAncestor, upper - 1); 13393 } 13394 return upper; 13395} 13396function getInsertionAncestor(matcher2) { 13397 let ancestor = matcher2; 13398 while (ancestor = ancestor.parent) { 13399 if (isMatchable(ancestor) && comparePathParserScore(matcher2, ancestor) === 0) { 13400 return ancestor; 13401 } 13402 } 13403 return; 13404} 13405function isMatchable({ record }) { 13406 return !!(record.name || record.components && Object.keys(record.components).length || record.redirect); 13407} 13408function parseQuery(search) { 13409 const query = {}; 13410 if (search === "" || search === "?") 13411 return query; 13412 const hasLeadingIM = search[0] === "?"; 13413 const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&"); 13414 for (let i2 = 0; i2 < searchParams.length; ++i2) { 13415 const searchParam = searchParams[i2].replace(PLUS_RE, " "); 13416 const eqPos = searchParam.indexOf("="); 13417 const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos)); 13418 const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1)); 13419 if (key in query) { 13420 let currentValue = query[key]; 13421 if (!isArray$2(currentValue)) { 13422 currentValue = query[key] = [currentValue]; 13423 } 13424 currentValue.push(value); 13425 } else { 13426 query[key] = value; 13427 } 13428 } 13429 return query; 13430} 13431function stringifyQuery(query) { 13432 let search = ""; 13433 for (let key in query) { 13434 const value = query[key]; 13435 key = encodeQueryKey(key); 13436 if (value == null) { 13437 if (value !== void 0) { 13438 search += (search.length ? "&" : "") + key; 13439 } 13440 continue; 13441 } 13442 const values = isArray$2(value) ? value.map((v2) => v2 && encodeQueryValue(v2)) : [value && encodeQueryValue(value)]; 13443 values.forEach((value2) => { 13444 if (value2 !== void 0) { 13445 search += (search.length ? "&" : "") + key; 13446 if (value2 != null) 13447 search += "=" + value2; 13448 } 13449 }); 13450 } 13451 return search; 13452} 13453function normalizeQuery(query) { 13454 const normalizedQuery = {}; 13455 for (const key in query) { 13456 const value = query[key]; 13457 if (value !== void 0) { 13458 normalizedQuery[key] = isArray$2(value) ? value.map((v2) => v2 == null ? null : "" + v2) : value == null ? value : "" + value; 13459 } 13460 } 13461 return normalizedQuery; 13462} 13463const matchedRouteKey = Symbol(""); 13464const viewDepthKey = Symbol(""); 13465const routerKey = Symbol(""); 13466const routeLocationKey = Symbol(""); 13467const routerViewLocationKey = Symbol(""); 13468function useCallbacks() { 13469 let handlers = []; 13470 function add(handler) { 13471 handlers.push(handler); 13472 return () => { 13473 const i2 = handlers.indexOf(handler); 13474 if (i2 > -1) 13475 handlers.splice(i2, 1); 13476 }; 13477 } 13478 function reset() { 13479 handlers = []; 13480 } 13481 return { 13482 add, 13483 list: () => handlers.slice(), 13484 reset 13485 }; 13486} 13487function guardToPromiseFn(guard, to, from2, record, name, runWithContext = (fn) => fn()) { 13488 const enterCallbackArray = record && // name is defined if record
13488is because of the function overload 13489 (record.enterCallbacks[name] = record.enterCallbacks[name] || []); 13490 return () => new Promise((resolve2, reject) => { 13491 const next = (valid) => { 13492 if (valid === false) { 13493 reject(createRouterError(4, { 13494 from: from2, 13495 to 13496 })); 13497 } else if (valid instanceof Error) { 13498 reject(valid); 13499 } else if (isRouteLocation(valid)) { 13500 reject(createRouterError(2, { 13501 from: to, 13502 to: valid 13503 })); 13504 } else { 13505 if (enterCallbackArray && // since enterCallbackArray is truthy, both record and name also are 13506 record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") { 13507 enterCallbackArray.push(valid); 13508 } 13509 resolve2(); 13510 } 13511 }; 13512 const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from2, next)); 13513 let guardCall = Promise.resolve(guardReturn); 13514 if (guard.length < 3) 13515 guardCall = guardCall.then(next); 13516 guardCall.catch((err) => reject(err)); 13517 }); 13518} 13519function extractComponentsGuards(matched, guardType, to, from2, runWithContext = (fn) => fn()) { 13520 const guards = []; 13521 for (const record of matched) { 13522 for (const name in record.components) { 13523 let rawComponent = record.components[name]; 13524 if (guardType !== "beforeRouteEnter" && !record.instances[name]) 13525 continue; 13526 if (isRouteComponent(rawComponent)) { 13527 const options = rawComponent.__vccOpts || rawComponent; 13528 const guard = options[guardType]; 13529 guard && guards.push(guardToPromiseFn(guard, to, from2, record, name, runWithContext)); 13530 } else { 13531 let componentPromise = rawComponent(); 13532 guards.push(() => componentPromise.then((resolved) => { 13533 if (!resolved) 13534 throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`); 13535 const resolvedComponent = isESModule(resolved) ? resolved.default : resolved; 13536 record.mods[name] = resolved; 13537 record.components[name] = resolvedComponent; 13538 const options = resolvedComponent.__vccOpts || resolvedComponent; 13539 const guard = options[guardType]; 13540 return guard && guardToPromiseFn(guard, to, from2, record, name, runWithContext)(); 13541 })); 13542 } 13543 } 13544 } 13545 return guards; 13546} 13547function useLink(props) { 13548 const router = inject(routerKey); 13549 const currentRoute = inject(routeLocationKey); 13550 const route = computed(() => { 13551 const to = unref(props.to); 13552 return router.resolve(to); 13553 }); 13554 const activeRecordIndex = computed(() => { 13555 const { matched } = route.value; 13556 const { length } = matched; 13557 const routeMatched = matched[length - 1]; 13558 const currentMatched = currentRoute.matched; 13559 if (!routeMatched || !currentMatched.length) 13560 return -1; 13561 const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched)); 13562 if (index > -1) 13563 return index; 13564 const parentRecordPath = getOriginalPath(matched[length - 2]); 13565 return ( 13566 // we are dealing with nested routes 13567 length > 1 && // if the parent and matched route have the same path, this link is 13568 // referring to the empty child. Or we currently are on a different 13569 // child of the same parent 13570 getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent 13571 currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index 13572 ); 13573 }); 13574 const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params)); 13575 const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params)); 13576 function navigate(e2 = {}) { 13577 if (guardEvent(e2)) { 13578 const p2 = router[unref(props.replace) ? "replace" : "push"]( 13579 unref(props.to) 13580 // avoid uncaught errors are they are logged anyway 13581 ).catch(noop$1); 13582 if (props.viewTransition && typeof document !== "undefined" && "startViewTransition" in document) { 13583 document.startViewTransition(() => p2); 13584 } 13585 return p2; 13586 } 13587 return Promise.resolve(); 13588 } 13589 return { 13590 route, 13591 href: computed(() => route.value.href), 13592 isActive, 13593 isExactActive, 13594 navigate 13595 }; 13596} 13597function preferSingleVNode(vnodes) { 13598 return vnodes.length === 1 ? vnodes[0] : vnodes; 13599} 13600const RouterLinkImpl = /* @__PURE__ */ defineComponent({ 13601 name: "RouterLink", 13602 compatConfig: { MODE: 3 }, 13603 props: { 13604 to: { 13605 type: [String, Object], 13606 required: true 13607 }, 13608 replace: Boolean, 13609 activeClass: String, 13610 // inactiveClass: String, 13611 exactActiveClass: String, 13612 custom: Boolean, 13613 ariaCurrentValue: { 13614 type: String, 13615 default: "page" 13616 }, 13617 viewTransition: Boolean 13618 }, 13619 useLink, 13620 setup(props, { slots }) { 13621 const link = reactive(useLink(props)); 13622 const { options } = inject(routerKey); 13623 const elClass = computed(() => ({ 13624 [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive, 13625 // [getLinkClass( 13626 // props.inactiveClass, 13627 // options.linkInactiveClass, 13628 // 'router-link-inactive' 13629 // )]: !link.isExactActive, 13630 [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive 13631 })); 13632 return () => { 13633 const children = slots.default && preferSingleVNode(slots.default(link)); 13634 return props.custom ? children : h$1("a", { 13635 "aria-current": link.isExactActive ? props.ariaCurrentValue : null, 13636 href: link.href, 13637 // this would override user added attrs but Vue will still add 13638 // the listener, so we end up triggering both 13639 onClick: link.navigate, 13640 class: elClass.value 13641 }, children); 13642 }; 13643 } 13644}); 13645const RouterLink = RouterLinkImpl; 13646function guardEvent(e2) { 13647 if (e2.metaKey || e2.altKey || e2.ctrlKey || e2.shiftKey) 13648 return; 13649 if (e2.defaultPrevented) 13650 return; 13651 if (e2.button !== void 0 && e2.button !== 0) 13652 return; 13653 if (e2.currentTarget && e2.currentTarget.getAttribute) { 13654 const target = e2.currentTarget.getAttribute("target"); 13655 if (/\b_blank\b/i.test(target)) 13656 return; 13657 } 13658 if (e2.preventDefault) 13659 e2.preventDefault(); 13660 return true; 13661} 13662function includesParams(outer, inner) { 13663 for (const key in inner) { 13664 const innerValue = inner[key]; 13665 const outerValue = outer[key]; 13666 if (typeof innerValue === "string") { 13667 if (innerValue !== outerValue) 13668 return false;
13669 } else { 13670 if (!isArray$2(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i2) => value !== outerValue[i2])) 13671 return false; 13672 } 13673 } 13674 return true; 13675} 13676function getOriginalPath(record) { 13677 return record ? record.aliasOf ? record.aliasOf.path : record.path : ""; 13678} 13679const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass; 13680const RouterViewImpl = /* @__PURE__ */ defineComponent({ 13681 name: "RouterView", 13682 // #674 we manually inherit them 13683 inheritAttrs: false, 13684 props: { 13685 name: { 13686 type: String, 13687 default: "default" 13688 }, 13689 route: Object 13690 }, 13691 // Better compat for @vue/compat users 13692 // https://github.com/vuejs/router/issues/1315 13693 compatConfig: { MODE: 3 }, 13694 setup(props, { attrs, slots }) { 13695 const injectedRoute = inject(routerViewLocationKey); 13696 const routeToDisplay = computed(() => props.route || injectedRoute.value); 13697 const injectedDepth = inject(viewDepthKey, 0); 13698 const depth = computed(() => { 13699 let initialDepth = unref(injectedDepth); 13700 const { matched } = routeToDisplay.value; 13701 let matchedRoute; 13702 while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) { 13703 initialDepth++; 13704 } 13705 return initialDepth; 13706 }); 13707 const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]); 13708 provide(viewDepthKey, computed(() => depth.value + 1)); 13709 provide(matchedRouteKey, matchedRouteRef); 13710 provide(routerViewLocationKey, routeToDisplay); 13711 const viewRef = ref(); 13712 watch(() => [viewRef.value, matchedRouteRef.value, props.name], ([instance, to, name], [oldInstance, from2, oldName]) => { 13713 if (to) { 13714 to.instances[name] = instance; 13715 if (from2 && from2 !== to && instance && instance === oldInstance) { 13716 if (!to.leaveGuards.size) { 13717 to.leaveGuards = from2.leaveGuards; 13718 } 13719 if (!to.updateGuards.size) { 13720 to.updateGuards = from2.updateGuards; 13721 } 13722 } 13723 } 13724 if (instance && to && // if there is no instance but to and from are the same this might be 13725 // the first visit 13726 (!from2 || !isSameRouteRecord(to, from2) || !oldInstance)) { 13727 (to.enterCallbacks[name] || []).forEach((callback) => callback(instance)); 13728 } 13729 }, { flush: "post" }); 13730 return () => { 13731 const route = routeToDisplay.value; 13732 const currentName = props.name; 13733 const matchedRoute = matchedRouteRef.value; 13734 const ViewComponent = matchedRoute && matchedRoute.components[currentName]; 13735 if (!ViewComponent) { 13736 return normalizeSlot$1(slots.default, { Component: ViewComponent, route }); 13737 } 13738 const routePropsOption = matchedRoute.props[currentName]; 13739 const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null; 13740 const onVnodeUnmounted = (vnode) => { 13741 if (vnode.component.isUnmounted) { 13742 matchedRoute.instances[currentName] = null; 13743 } 13744 }; 13745 const component = h$1(ViewComponent, assign({}, routeProps, attrs, { 13746 onVnodeUnmounted, 13747 ref: viewRef 13748 })); 13749 return ( 13750 // pass the vnode to the slot as a prop. 13751 // h and <component :is="..."> both accept vnodes 13752 normalizeSlot$1(slots.default, { Component: component, route }) || component 13753 ); 13754 }; 13755 } 13756}); 13757function normalizeSlot$1(slot, data) { 13758 if (!slot) 13759 return null; 13760 const slotContent = slot(data); 13761 return slotContent.length === 1 ? slotContent[0] : slotContent; 13762} 13763const RouterView = RouterViewImpl; 13764function createRouter(options) { 13765 const matcher2 = createRouterMatcher(options.routes, options); 13766 const parseQuery$12 = options.parseQuery || parseQuery; 13767 const stringifyQuery$12 = options.stringifyQuery || stringifyQuery; 13768 const routerHistory = options.history; 13769 const beforeGuards = useCallbacks(); 13770 const beforeResolveGuards = useCallbacks(); 13771 const afterGuards = useCallbacks(); 13772 const currentRoute = shallowRef(START_LOCATION_NORMALIZED); 13773 let pendingLocation = START_LOCATION_NORMALIZED; 13774 if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) { 13775 history.scrollRestoration = "manual"; 13776 } 13777 const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue); 13778 const encodeParams = applyToParams.bind(null, encodeParam); 13779 const decodeParams = ( 13780 // @ts-expect-error: intentionally avoid the type check 13781 applyToParams.bind(null, decode) 13782 ); 13783 function addRoute(parentOrRoute, route) { 13784 let parent; 13785 let record; 13786 if (isRouteName(parentOrRoute)) { 13787 parent = matcher2.getRecordMatcher(parentOrRoute); 13788 record = route; 13789 } else { 13790 record = parentOrRoute; 13791 } 13792 return matcher2.addRoute(record, parent); 13793 } 13794 function removeRoute(name) { 13795 const recordMatcher = matcher2.getRecordMatcher(name); 13796 if (recordMatcher) { 13797 matcher2.removeRoute(recordMatcher); 13798 } 13799 } 13800 function getRoutes() { 13801 return matcher2.getRoutes().map((routeMatcher) => routeMatcher.record); 13802 } 13803 function hasRoute(name) { 13804 return !!matcher2.getRecordMatcher(name); 13805 } 13806 function resolve2(rawLocation, currentLocation) { 13807 currentLocation = assign({}, currentLocation || currentRoute.value); 13808 if (typeof rawLocation === "string") { 13809 const locationNormalized = parseURL(parseQuery$12, rawLocation, currentLocation.path); 13810 const matchedRoute2 = matcher2.resolve({ path: locationNormalized.path }, currentLocation); 13811 const href2 = routerHistory.createHref(locationNormalized.fullPath); 13812 return assign(locationNormalized, matchedRoute2, { 13813 params: decodeParams(matchedRoute2.params), 13814 hash: decode(locationNormalized.hash), 13815 redirectedFrom: void 0, 13816 href: href2 13817 }); 13818 } 13819 let matcherLocation; 13820 if (rawLocation.path != null) { 13821 matcherLocation = assign({}, rawLocation, { 13822 path: parseURL(parseQuery$12, rawLocation.path, currentLocation.path).path 13823 }); 13824 } else { 13825 const targetParams = assign({}, rawLocation.params); 13826 for (const key in targetParams) { 13827 if (targetParams[key] == null) { 13828 delete targetParams[key]; 13829 } 13830 } 13831 matcherLocation = assign({}, rawLocation, { 13832 params: encodeParams(targetParams) 13833 }); 13834 currentLocation.params = encodeParams(currentLocation.params); 13835 } 13836 const matchedRoute = matcher2.resolve(matcherLocation, currentLocation); 13837 const hash = rawLocation.hash || ""; 13838 matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params)); 13839 const fullPath = stringifyURL(stringifyQuery$12, assign({}, rawLocation, { 13840 hash: encodeHash(hash), 13841 path: matchedRoute.path 13842 })); 13843 const href = routerHistory.createHref(fullPath); 13844 return assign({ 13845 fullPath, 13846 // keep the hash encoded so fullPath is effectively path + encodedQuery + 13847 // hash 13848 hash, 13849 query: ( 13850 // if the user is using a custom query lib like qs, we might have 13851 // nested objects, so we keep the query as is, meaning it can contain 13852 // numbers at `$route.query`, but at the point, the user will have to 13853 // use their own type anyway. 13854 // https://github.com/vuejs/router/issues/328#issuecomment-649481567
13855 stringifyQuery$12 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {} 13856 ) 13857 }, matchedRoute, { 13858 redirectedFrom: void 0, 13859 href 13860 }); 13861 } 13862 function locationAsObject(to) { 13863 return typeof to === "string" ? parseURL(parseQuery$12, to, currentRoute.value.path) : assign({}, to); 13864 } 13865 function checkCanceledNavigation(to, from2) { 13866 if (pendingLocation !== to) { 13867 return createRouterError(8, { 13868 from: from2, 13869 to 13870 }); 13871 } 13872 } 13873 function push(to) { 13874 return pushWithRedirect(to); 13875 } 13876 function replace(to) { 13877 return push(assign(locationAsObject(to), { replace: true })); 13878 } 13879 function handleRedirectRecord(to) { 13880 const lastMatched = to.matched[to.matched.length - 1]; 13881 if (lastMatched && lastMatched.redirect) { 13882 const { redirect } = lastMatched; 13883 let newTargetLocation = typeof redirect === "function" ? redirect(to) : redirect; 13884 if (typeof newTargetLocation === "string") { 13885 newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : ( 13886 // force empty params 13887 { path: newTargetLocation } 13888 ); 13889 newTargetLocation.params = {}; 13890 } 13891 return assign({ 13892 query: to.query, 13893 hash: to.hash, 13894 // avoid transferring params if the redirect has a path 13895 params: newTargetLocation.path != null ? {} : to.params 13896 }, newTargetLocation); 13897 } 13898 } 13899 function pushWithRedirect(to, redirectedFrom) { 13900 const targetLocation = pendingLocation = resolve2(to); 13901 const from2 = currentRoute.value; 13902 const data = to.state; 13903 const force = to.force; 13904 const replace2 = to.replace === true; 13905 const shouldRedirect = handleRedirectRecord(targetLocation); 13906 if (shouldRedirect) 13907 return pushWithRedirect( 13908 assign(locationAsObject(shouldRedirect), { 13909 state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data, 13910 force, 13911 replace: replace2 13912 }), 13913 // keep original redirectedFrom if it exists 13914 redirectedFrom || targetLocation 13915 ); 13916 const toLocation = targetLocation; 13917 toLocation.redirectedFrom = redirectedFrom; 13918 let failure; 13919 if (!force && isSameRouteLocation(stringifyQuery$12, from2, targetLocation)) { 13920 failure = createRouterError(16, { to: toLocation, from: from2 }); 13921 handleScroll( 13922 from2, 13923 from2, 13924 // this is a push, the only way for it to be triggered from a 13925 // history.listen is with a redirect, which makes it become a push 13926 true, 13927 // This cannot be the first navigation because the initial location 13928 // cannot be manually navigated to 13929 false 13930 ); 13931 } 13932 return (failure ? Promise.resolve(failure) : navigate(toLocation, from2)).catch((error) => isNavigationFailure(error) ? ( 13933 // navigation redirects still mark the router as ready 13934 isNavigationFailure( 13935 error, 13936 2 13937 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */ 13938 ) ? error : markAsReady(error) 13939 ) : ( 13940 // reject any unknown error 13941 triggerError(error, toLocation, from2) 13942 )).then((failure2) => { 13943 if (failure2) { 13944 if (isNavigationFailure( 13945 failure2, 13946 2 13947 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */ 13948 )) { 13949 return pushWithRedirect( 13950 // keep options 13951 assign({ 13952 // preserve an existing replacement but allow the redirect to override it 13953 replace: replace2 13954 }, locationAsObject(failure2.to), { 13955 state: typeof failure2.to === "object" ? assign({}, data, failure2.to.state) : data, 13956 force 13957 }), 13958 // preserve the original redirectedFrom if any 13959 redirectedFrom || toLocation 13960 ); 13961 } 13962 } else { 13963 failure2 = finalizeNavigation(toLocation, from2, true, replace2, data); 13964 } 13965 triggerAfterEach(toLocation, from2, failure2); 13966 return failure2; 13967 }); 13968 } 13969 function checkCanceledNavigationAndReject(to, from2) { 13970 const error = checkCanceledNavigation(to, from2); 13971 return error ? Promise.reject(error) : Promise.resolve(); 13972 } 13973 function runWithContext(fn) { 13974 const app = installedApps.values().next().value; 13975 return app && typeof app.runWithContext === "function" ? app.runWithContext(fn) : fn(); 13976 } 13977 function navigate(to, from2) { 13978 let guards; 13979 const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from2); 13980 guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from2); 13981 for (const record of leavingRecords) { 13982 record.leaveGuards.forEach((guard) => { 13983 guards.push(guardToPromiseFn(guard, to, from2)); 13984 }); 13985 } 13986 const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from2); 13987 guards.push(canceledNavigationCheck); 13988 return runGuardQueue(guards).then(() => { 13989 guards = []; 13990 for (const guard of beforeGuards.list()) { 13991 guards.push(guardToPromiseFn(guard, to, from2)); 13992 } 13993 guards.push(canceledNavigationCheck); 13994 return runGuardQueue(guards); 13995 }).then(() => { 13996 guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from2); 13997 for (const record of updatingRecords) { 13998 record.updateGuards.forEach((guard) => { 13999 guards.push(guardToPromiseFn(guard, to, from2)); 14000 }); 14001 } 14002 guards.push(canceledNavigationCheck); 14003 return runGuardQueue(guards); 14004 }).then(() => { 14005 guards = []; 14006 for (const record of enteringRecords) { 14007 if (record.beforeEnter) { 14008 if (isArray$2(record.beforeEnter)) { 14009 for (const beforeEnter of record.beforeEnter) 14010 guards.push(guardToPromiseFn(beforeEnter, to, from2)); 14011 } else { 14012 guards.push(guardToPromiseFn(record.beforeEnter, to, from2)); 14013 } 14014 } 14015 } 14016 guards.push(canceledNavigationCheck); 14017 return runGuardQueue(guards); 14018 }).then(() => { 14019 to.matched.forEach((record) => record.enterCallbacks = {}); 14020 guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from2, runWithContext); 14021 guards.push(canceledNavigationCheck); 14022 return runGuardQueue(guards); 14023 }).then(() => { 14024 guards = []; 14025 for (const guard of beforeResolveGuards.list()) { 14026 guards.push(guardToPromiseFn(guard, to, from2)); 14027 } 14028 guards.push(canceledNavigationCheck); 14029 return runGuardQueue(guards); 14030 }).catch((err) => isNavigationFailure( 14031 err, 14032 8 14033 /* ErrorTypes.NAVIGATION_CANCELLED */ 14034 ) ? err : Promise.reject(err)); 14035 } 14036 function triggerAfterEach(to, from2, failure) {
14037 afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from2, failure))); 14038 } 14039 function finalizeNavigation(toLocation, from2, isPush, replace2, data) { 14040 const error = checkCanceledNavigation(toLocation, from2); 14041 if (error) 14042 return error; 14043 const isFirstNavigation = from2 === START_LOCATION_NORMALIZED; 14044 const state = !isBrowser ? {} : history.state; 14045 if (isPush) { 14046 if (replace2 || isFirstNavigation) 14047 routerHistory.replace(toLocation.fullPath, assign({ 14048 scroll: isFirstNavigation && state && state.scroll 14049 }, data)); 14050 else 14051 routerHistory.push(toLocation.fullPath, data); 14052 } 14053 currentRoute.value = toLocation; 14054 handleScroll(toLocation, from2, isPush, isFirstNavigation); 14055 markAsReady(); 14056 } 14057 let removeHistoryListener; 14058 function setupListeners() { 14059 if (removeHistoryListener) 14060 return; 14061 removeHistoryListener = routerHistory.listen((to, _from, info) => { 14062 if (!router.listening) 14063 return; 14064 const toLocation = resolve2(to); 14065 const shouldRedirect = handleRedirectRecord(toLocation); 14066 if (shouldRedirect) { 14067 pushWithRedirect(assign(shouldRedirect, { replace: true, force: true }), toLocation).catch(noop$1); 14068 return; 14069 } 14070 pendingLocation = toLocation; 14071 const from2 = currentRoute.value; 14072 if (isBrowser) { 14073 saveScrollPosition(getScrollKey(from2.fullPath, info.delta), computeScrollPosition()); 14074 } 14075 navigate(toLocation, from2).catch((error) => { 14076 if (isNavigationFailure( 14077 error, 14078 4 | 8 14079 /* ErrorTypes.NAVIGATION_CANCELLED */ 14080 )) { 14081 return error; 14082 } 14083 if (isNavigationFailure( 14084 error, 14085 2 14086 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */ 14087 )) { 14088 pushWithRedirect( 14089 assign(locationAsObject(error.to), { 14090 force: true 14091 }), 14092 toLocation 14093 // avoid an uncaught rejection, let push call triggerError 14094 ).then((failure) => { 14095 if (isNavigationFailure( 14096 failure, 14097 4 | 16 14098 /* ErrorTypes.NAVIGATION_DUPLICATED */ 14099 ) && !info.delta && info.type === NavigationType.pop) { 14100 routerHistory.go(-1, false); 14101 } 14102 }).catch(noop$1); 14103 return Promise.reject(); 14104 } 14105 if (info.delta) { 14106 routerHistory.go(-info.delta, false); 14107 } 14108 return triggerError(error, toLocation, from2); 14109 }).then((failure) => { 14110 failure = failure || finalizeNavigation( 14111 // after navigation, all matched components are resolved 14112 toLocation, 14113 from2, 14114 false 14115 ); 14116 if (failure) { 14117 if (info.delta && // a new navigation has been triggered, so we do not want to revert, that will change the current history 14118 // entry while a different route is displayed 14119 !isNavigationFailure( 14120 failure, 14121 8 14122 /* ErrorTypes.NAVIGATION_CANCELLED */ 14123 )) { 14124 routerHistory.go(-info.delta, false); 14125 } else if (info.type === NavigationType.pop && isNavigationFailure( 14126 failure, 14127 4 | 16 14128 /* ErrorTypes.NAVIGATION_DUPLICATED */ 14129 )) { 14130 routerHistory.go(-1, false); 14131 } 14132 } 14133 triggerAfterEach(toLocation, from2, failure); 14134 }).catch(noop$1); 14135 }); 14136 } 14137 let readyHandlers = useCallbacks(); 14138 let errorListeners = useCallbacks(); 14139 let ready; 14140 function triggerError(error, to, from2) { 14141 markAsReady(error); 14142 const list = errorListeners.list(); 14143 if (list.length) { 14144 list.forEach((handler) => handler(error, to, from2)); 14145 } else { 14146 console.error(error); 14147 } 14148 return Promise.reject(error); 14149 } 14150 function isReady() { 14151 if (ready && currentRoute.value !== START_LOCATION_NORMALIZED) 14152 return Promise.resolve(); 14153 return new Promise((resolve22, reject) => { 14154 readyHandlers.add([resolve22, reject]); 14155 }); 14156 } 14157 function markAsReady(err) { 14158 if (!ready) { 14159 ready = !err; 14160 setupListeners();
14161 readyHandlers.list().forEach(([resolve22, reject]) => err ? reject(err) : resolve22()); 14162 readyHandlers.reset(); 14163 } 14164 return err; 14165 } 14166 function handleScroll(to, from2, isPush, isFirstNavigation) { 14167 const { scrollBehavior } = options; 14168 if (!isBrowser || !scrollBehavior) 14169 return Promise.resolve(); 14170 const scrollPosition = !isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0)) || (isFirstNavigation || !isPush) && history.state && history.state.scroll || null; 14171 return nextTick().then(() => scrollBehavior(to, from2, scrollPosition)).then((position) => position && scrollToPosition(position)).catch((err) => triggerError(err, to, from2)); 14172 } 14173 const go = (delta) => routerHistory.go(delta); 14174 let started; 14175 const installedApps = /* @__PURE__ */ new Set(); 14176 const router = { 14177 currentRoute, 14178 listening: true, 14179 addRoute, 14180 removeRoute, 14181 clearRoutes: matcher2.clearRoutes, 14182 hasRoute, 14183 getRoutes, 14184 resolve: resolve2, 14185 options, 14186 push, 14187 replace, 14188 go, 14189 back: () => go(-1), 14190 forward: () => go(1), 14191 beforeEach: beforeGuards.add, 14192 beforeResolve: beforeResolveGuards.add, 14193 afterEach: afterGuards.add, 14194 onError: errorListeners.add, 14195 isReady, 14196 install(app) { 14197 const router2 = this; 14198 app.component("RouterLink", RouterLink); 14199 app.component("RouterView", RouterView); 14200 app.config.globalProperties.$router = router2; 14201 Object.defineProperty(app.config.globalProperties, "$route", { 14202 enumerable: true, 14203 get: () => unref(currentRoute) 14204 }); 14205 if (isBrowser && // used for the initial navigation client side to avoid pushing 14206 // multiple times when the router is used in multiple apps 14207 !started && currentRoute.value === START_LOCATION_NORMALIZED) { 14208 started = true; 14209 push(routerHistory.location).catch((err) => { 14210 }); 14211 } 14212 const reactiveRoute = {}; 14213 for (const key in START_LOCATION_NORMALIZED) { 14214 Object.defineProperty(reactiveRoute, key, { 14215 get: () => currentRoute.value[key], 14216 enumerable: true 14217 }); 14218 } 14219 app.provide(routerKey, router2); 14220 app.provide(routeLocationKey, shallowReactive(reactiveRoute)); 14221 app.provide(routerViewLocationKey, currentRoute); 14222 const unmountApp = app.unmount; 14223 installedApps.add(app); 14224 app.unmount = function() { 14225 installedApps.delete(app); 14226 if (installedApps.size < 1) { 14227 pendingLocation = START_LOCATION_NORMALIZED; 14228 removeHistoryListener && removeHistoryListener(); 14229 removeHistoryListener = null; 14230 currentRoute.value = START_LOCATION_NORMALIZED; 14231 started = false; 14232 ready = false; 14233 } 14234 unmountApp(); 14235 }; 14236 } 14237 }; 14238 function runGuardQueue(guards) { 14239 return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve()); 14240 } 14241 return router; 14242} 14243function extractChangingRecords(to, from2) { 14244 const leavingRecords = []; 14245 const updatingRecords = []; 14246 const enteringRecords = []; 14247 const len = Math.max(from2.matched.length, to.matched.length); 14248 for (let i2 = 0; i2 < len; i2++) { 14249 const recordFrom = from2.matched[i2]; 14250 if (recordFrom) { 14251 if (to.matched.find((record) => isSameRouteRecord(record, recordFrom))) 14252 updatingRecords.push(recordFrom); 14253 else 14254 leavingRecords.push(recordFrom); 14255 } 14256 const recordTo = to.matched[i2]; 14257 if (recordTo) { 14258 if (!from2.matched.find((record) => isSameRouteRecord(record, recordTo))) { 14259 enteringRecords.push(recordTo); 14260 } 14261 } 14262 } 14263 return [leavingRecords, updatingRecords, enteringRecords]; 14264} 14265function useRoute(_name) { 14266 return inject(routeLocationKey); 14267} 14268const ROUTE_KEY_PARENTHESES_RE$1 = /(:\w+)\([^)]+\)/g; 14269const ROUTE_KEY_SYMBOLS_RE$1 = /(:\w+)[?+*]/g; 14270const ROUTE_KEY_NORMAL_RE$1 = /:\w+/g; 14271const interpolatePath = (route, match) => { 14272 return match.path.replace(ROUTE_KEY_PARENTHESES_RE$1, "$1").replace(ROUTE_KEY_SYMBOLS_RE$1, "$1").replace(ROUTE_KEY_NORMAL_RE$1, (r2) => { 14273 var _a3; 14274 return ((_a3 = route.params[r2.slice(1)]) == null ? void 0 : _a3.toString()) || ""; 14275 }); 14276}; 14277const generateRouteKey$1 = (routeProps, override) => { 14278 const matchedRoute = routeProps.route.matched.find((m) => { 14279 var _a3; 14280 return ((_a3 = m.components) == null ? void 0 : _a3.default) === routeProps.Component.type; 14281 }); 14282 const source = override ?? (matchedRoute == null ? void 0 : matchedRoute.meta.key) ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute)); 14283 return typeof source === "function" ? source(routeProps.route) : source; 14284}; 14285const wrapInKeepAlive = (props, children) => { 14286 return { default: () => props ? h$1(KeepAlive, props === true ? {} : props, children) : children }; 14287}; 14288function toArray(value) { 14289 return Array.isArray(value) ? value : [value]; 14290} 14291const _routes = [ 14292 { 14293 name: "id", 14294 path: "/:id()", 14295 component: () => __vitePreload(() => import("./DTkwnBNG.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6,7,8,9]) : void 0, import.meta.url) 14296 }, 14297 { 14298 name: "index", 14299 path: "/", 14300 component: () => __vitePreload(() => import("./CEkLH7OR.js"), true ? __vite__mapDeps([10,1,2,3,6,8]) : void 0, import.meta.url) 14301 }, 14302 { 14303 name: "socis", 14304 path: "/socis", 14305 component: () => __vitePreload(() => import("./Df2PSNAy.js"), true ? __vite__mapDeps([11,4,5,6,7,2,3,8]) : void 0, import.meta.url) 14306 }, 14307 { 14308 name: "espais", 14309 path: "/espais", 14310 component: () => __vitePreload(() => import("./Bhs-h9c6.js"), true ? __vite__mapDeps([12,1,2,3,4,5,6,7,13,8,14]) : void 0, import.meta.url) 14311 }, 14312 { 14313 name: "entitat", 14314 path: "/entitat", 14315 component: () => __vitePreload(() => import("./K1Q6EdSe.js"), true ? __vite__mapDeps([15,1,2,3,4,5,6,7,13,8,16]) : void 0, import.meta.url) 14316 }, 14317 { 14318 name: "contacte", 14319 path: "/contacte", 14320 component: () => __vitePreload(() => import("./BX5ySEyc.js"), true ? __vite__mapDeps([17,4,5,6,7,8,18]) : void 0, import.meta.url) 14321 }, 14322 { 14323 name: "legal-id", 14324 path: "/legal/:id()", 14325 component: () => __vitePreload(() => import("./D2003eD7.js"), true ? __vite__mapDeps([19,4,5,6,7,8]) : void 0, import.meta.url) 14326 }, 14327 { 14328 name: "programacio-id", 14329 path: "/programacio/:id()", 14330 component: () => __vitePreload(() => import("./B0bk_Oly.js"), true ? __vite__mapDeps([20,1,2,3,4,5,6,7,8,9]) : void 0, import.meta.url) 14331 } 14332]; 14333const _wrapInTransition = (props, children) => { 14334 return { default: () => { 14335 var _a3; 14336 return props ? h$1(Transition, props === true ? {} : props, children) : (_a3 = children.default) == null ? void 0 : _a3.call(children); 14337 } }; 14338}; 14339const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g; 14340const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g; 14341const ROUTE_KEY_NORMAL_RE = /:\w+/g; 14342function generateRouteKey(route) { 14343 const source = (route == null ? void 0 : route.meta.key) ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r2) => { 14344 var _a3; 14345 return ((_a3 = route.params[r2.slice(1)]) == null ? void 0 : _a3.toString()) || ""; 14346 }); 14347 return typeof source === "function" ? source(route) : source; 14348} 14349function isChangingPage(to, from2) { 14350 if (to === from2 || from2 === START_LOCATION_NORMALIZED) { 14351 return false;
14352 } 14353 if (generateRouteKey(to) !== generateRouteKey(from2)) { 14354 return true; 14355 } 14356 const areComponentsSame = to.matched.every( 14357 (comp, index) => { 14358 var _a3, _b; 14359 return comp.components && comp.components.default === ((_b = (_a3 = from2.matched[index]) == null ? void 0 : _a3.components) == null ? void 0 : _b.default); 14360 } 14361 ); 14362 if (areComponentsSame) { 14363 return false; 14364 } 14365 return true; 14366} 14367const routerOptions0 = { 14368 scrollBehavior(to, from2, savedPosition) { 14369 var _a3; 14370 const nuxtApp = useNuxtApp(); 14371 const behavior = ((_a3 = useRouter().options) == null ? void 0 : _a3.scrollBehaviorType) ?? "auto"; 14372 if (to.path === from2.path) { 14373 if (from2.hash && !to.hash) { 14374 return { left: 0, top: 0 }; 14375 } 14376 if (to.hash) { 14377 return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior }; 14378 } 14379 return false; 14380 } 14381 const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from2) : to.meta.scrollToTop; 14382 if (routeAllowsScrollToTop === false) { 14383 return false; 14384 } 14385 let position = savedPosition || void 0; 14386 if (!position && isChangingPage(to, from2)) { 14387 position = { left: 0, top: 0 }; 14388 } 14389 const hookToWait = nuxtApp._runningTransition ? "page:transition:finish" : "page:loading:end"; 14390 return new Promise((resolve2) => { 14391 if (from2 === START_LOCATION_NORMALIZED) { 14392 resolve2(_calculatePosition(to, "instant", position)); 14393 return; 14394 } 14395 nuxtApp.hooks.hookOnce(hookToWait, () => { 14396 requestAnimationFrame(() => resolve2(_calculatePosition(to, "instant", position))); 14397 }); 14398 }); 14399 } 14400}; 14401function _getHashElementScrollMarginTop(selector) { 14402 try { 14403 const elem = document.querySelector(selector); 14404 if (elem) { 14405 return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop) || 0); 14406 } 14407 } catch { 14408 } 14409 return 0; 14410} 14411function _calculatePosition(to, scrollBehaviorType, position) { 14412 if (position) { 14413 return position; 14414 } 14415 if (to.hash) { 14416 return { 14417 el: to.hash, 14418 top: _getHashElementScrollMarginTop(to.hash), 14419 behavior: scrollBehaviorType 14420 }; 14421 } 14422 return { left: 0, top: 0, behavior: scrollBehaviorType }; 14423} 14424const routerOptions1 = { 14425 scrollBehavior(to, from2, savedPosition) { 14426 const nuxtApp = useNuxtApp(); 14427 if (savedPosition) { 14428 if (to.path == from2.path) 14429 return savedPosition; 14430 else 14431 return new Promise((resolve2, reject) => { 14432 nuxtApp.hooks.hookOnce("page:transition:finish", () => { 14433 requestAnimationFrame(() => resolve2(savedPosition)); 14434 }); 14435 }); 14436 } else { 14437 if (to.hash && to.path == from2.path) { 14438 return { el: to.hash }; 14439 } else if (to.hash && to.path != from2.path) { 14440 return new Promise((resolve2, reject) => { 14441 nuxtApp.hooks.hookOnce("page:transition:finish", () => { 14442 requestAnimationFrame(() => resolve2({ el: to.hash })); 14443 }); 14444 }); 14445 } else { 14446 if (to) { 14447 return new Promise((resolve2, reject) => { 14448 nuxtApp.hooks.hookOnce("page:transition:finish", () => { 14449 requestAnimationFrame(() => resolve2({ top: 0, left: 0 })); 14450 }); 14451 }); 14452 } else { 14453 return { top: 0, left: 0 }; 14454 } 14455 } 14456 } 14457 } 14458}; 14459const configRouterOptions = { 14460 hashMode: false, 14461 scrollBehaviorType: "auto" 14462}; 14463const hashMode = routerOptions0.hashMode ?? false; 14464const routerOptions = { 14465 ...configRouterOptions, 14466 ...routerOptions0, 14467 ...routerOptions1 14468}; 14469const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to, from2) => { 14470 var _a3; 14471 let __temp, __restore; 14472 if (!((_a3 = to.meta) == null ? void 0 : _a3.validate)) { 14473 return; 14474 } 14475 const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp); 14476 if (result === true) { 14477 return; 14478 } 14479 const error = createError({ 14480 fatal: true, 14481 statusCode: result && result.statusCode || 404, 14482 statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`, 14483 data: { 14484 path: to.fullPath 14485 } 14486 }); 14487 if (typeof window !== "undefined") { 14488 window.history.pushState({}, "", from2.fullPath); 14489 } 14490 return error; 14491}); 14492const page_45global = /* @__PURE__ */ defineNuxtRouteMiddleware((to, from2) => { 14493}); 14494const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => { 14495 let __temp, __restore; 14496 const rules = ([__temp, __restore] = executeAsync(() => getRouteRules({ path: to.path }
14496)), __temp = await __temp, __restore(), __temp); 14497 if (rules.redirect) { 14498 if (hasProtocol(rules.redirect, { acceptRelative: true })) { 14499 window.location.href = rules.redirect; 14500 return false; 14501 } 14502 return rules.redirect; 14503 } 14504}); 14505const globalMiddleware = [ 14506 validate, 14507 page_45global, 14508 manifest_45route_45rule 14509]; 14510const namedMiddleware = {}; 14511function createCurrentLocation(base, location2, renderedPath) { 14512 const { pathname, search, hash } = location2; 14513 const hashPos = base.indexOf("#"); 14514 if (hashPos > -1) { 14515 const slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1; 14516 let pathFromHash = hash.slice(slicePos); 14517 if (pathFromHash[0] !== "/") { 14518 pathFromHash = "/" + pathFromHash; 14519 } 14520 return withoutBase(pathFromHash, ""); 14521 } 14522 const displayedPath = withoutBase(pathname, base); 14523 const path = !renderedPath || isSamePath(displayedPath, renderedPath) ? displayedPath : renderedPath; 14524 return path + (path.includes("?") ? "" : search) + hash; 14525} 14526const plugin$1 = /* @__PURE__ */ defineNuxtPlugin({ 14527 name: "nuxt:router", 14528 enforce: "pre", 14529 async setup(nuxtApp) { 14530 var _a3; 14531 let __temp, __restore; 14532 let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL; 14533 if (hashMode && !routerBase.includes("#")) { 14534 routerBase += "#"; 14535 } 14536 const history2 = ((_a3 = routerOptions.history) == null ? void 0 : _a3.call(routerOptions, routerBase)) ?? (hashMode ? createWebHashHistory(routerBase) : createWebHistory(routerBase)); 14537 const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes; 14538 let startPosition; 14539 const router = createRouter({ 14540 ...routerOptions, 14541 scrollBehavior: (to, from2, savedPosition) => { 14542 if (from2 === START_LOCATION_NORMALIZED) { 14543 startPosition = savedPosition; 14544 return; 14545 } 14546 if (routerOptions.scrollBehavior) { 14547 router.options.scrollBehavior = routerOptions.scrollBehavior; 14548 if ("scrollRestoration" in window.history) { 14549 const unsub = router.beforeEach(() => { 14550 unsub(); 14551 window.history.scrollRestoration = "manual"; 14552 }); 14553 } 14554 return routerOptions.scrollBehavior(to, START_LOCATION_NORMALIZED, startPosition || savedPosition); 14555 } 14556 }, 14557 history: history2, 14558 routes 14559 }); 14560 if ("scrollRestoration" in window.history) { 14561 window.history.scrollRestoration = "auto"; 14562 } 14563 nuxtApp.vueApp.use(router); 14564 const previousRoute = shallowRef(router.currentRoute.value); 14565 router.afterEach((_to, from2) => { 14566 previousRoute.value = from2; 14567 }); 14568 Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", { 14569 get: () => previousRoute.value 14570 }); 14571 const initialURL = createCurrentLocation(routerBase, window.location, nuxtApp.payload.path); 14572 const _route = shallowRef(router.currentRoute.value); 14573 const syncCurrentRoute = () => { 14574 _route.value = router.currentRoute.value; 14575 }; 14576 nuxtApp.hook("page:finish", syncCurrentRoute); 14577 router.afterEach((to, from2) => { 14578 var _a4, _b, _c, _d; 14579 if (((_b = (_a4 = to.matched[0]) == null ? void 0 : _a4.components) == null ? void 0 : _b.default) === ((_d = (_c = from2.matched[0]) == null ? void 0 : _c.components) == null ? void 0 : _d.default)) { 14580 syncCurrentRoute(); 14581 } 14582 }); 14583 const route = {}; 14584 for (const key in _route.value) { 14585 Object.defineProperty(route, key, { 14586 get: () => _route.value[key], 14587 enumerable: true 14588 }); 14589 } 14590 nuxtApp._route = shallowReactive(route); 14591 nuxtApp._middleware || (nuxtApp._middleware = { 14592 global: [], 14593 named: {} 14594 }); 14595 const error = useError(); 14596 { 14597 router.afterEach(async (to, _from, failure) => { 14598 delete nuxtApp._processingMiddleware; 14599 if (!nuxtApp.isHydrating && error.value) { 14600 await nuxtApp.runWithContext(clearError); 14601 } 14602 if (failure) { 14603 await nuxtApp.callHook("page:loading:end"); 14604 } 14605 }); 14606 } 14607 try { 14608 if (false) ; 14609 ; 14610 [__temp, __restore] = executeAsync(() =>
14610 router.isReady()), await __temp, __restore(); 14611 ; 14612 } catch (error2) { 14613 [__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore(); 14614 } 14615 const resolvedInitialRoute = initialURL !== router.currentRoute.value.fullPath ? router.resolve(initialURL) : router.currentRoute.value; 14616 syncCurrentRoute(); 14617 const initialLayout = nuxtApp.payload.state._layout; 14618 router.beforeEach(async (to, from2) => { 14619 var _a4; 14620 await nuxtApp.callHook("page:loading:start"); 14621 to.meta = reactive(to.meta); 14622 if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) { 14623 to.meta.layout = initialLayout; 14624 } 14625 nuxtApp._processingMiddleware = true; 14626 { 14627 const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]); 14628 for (const component of to.matched) { 14629 const componentMiddleware = component.meta.middleware; 14630 if (!componentMiddleware) { 14631 continue; 14632 } 14633 for (const entry2 of toArray(componentMiddleware)) { 14634 middlewareEntries.add(entry2); 14635 } 14636 } 14637 { 14638 const routeRules = await nuxtApp.runWithContext(() => getRouteRules({ path: to.path })); 14639 if (routeRules.appMiddleware) { 14640 for (const key in routeRules.appMiddleware) { 14641 if (routeRules.appMiddleware[key]) { 14642 middlewareEntries.add(key); 14643 } else { 14644 middlewareEntries.delete(key); 14645 } 14646 } 14647 } 14648 } 14649 for (const entry2 of middlewareEntries) { 14650 const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_a4 = namedMiddleware[entry2]) == null ? void 0 : _a4.call(namedMiddleware).then((r2) => r2.default || r2)) : entry2; 14651 if (!middleware) { 14652 throw new Error(`Unknown route middleware: '${entry2}'.`); 14653 } 14654 try { 14655 const result = await nuxtApp.runWithContext(() => middleware(to, from2)); 14656 if (!nuxtApp.payload.serverRendered && nuxtApp.isHydrating) { 14657 if (result === false || result instanceof Error) { 14658 const error2 = result || createError({ 14659 statusCode: 404, 14660 statusMessage: `Page Not Found: ${initialURL}` 14661 }); 14662 await nuxtApp.runWithContext(() => showError(error2)); 14663 return false; 14664 } 14665 } 14666 if (result === true) { 14667 continue; 14668 } 14669 if (result === false) { 14670 return result; 14671 } 14672 if (result) { 14673 if (isNuxtError(result) && result.fatal) { 14674 await nuxtApp.runWithContext(() => showError(result)); 14675 } 14676 return result; 14677 } 14678 } catch (err) { 14679 const error2 = createError(err); 14680 if (error2.fatal) { 14681 await nuxtApp.runWithContext(() => showError(error2)); 14682 } 14683 return error2; 14684 } 14685 } 14686 } 14687 }); 14688 router.onError(async () => { 14689 delete nuxtApp._processingMiddleware; 14690 await nuxtApp.callHook("page:loading:end"); 14691 }); 14692 router.afterEach(async (to, _from) => { 14693 if (to.matched.length === 0) { 14694 await nuxtApp.runWithContext(() => showError(createError({ 14695 statusCode: 404, 14696 fatal: false, 14697 statusMessage: `Page not found: ${to.fullPath}`, 14698 data: { 14699 path: to.fullPath 14700 } 14701 }))); 14702 } 14703 }); 14704 nuxtApp.hooks.hookOnce("app:created", async () => { 14705 try { 14706 if ("name" in resolvedInitialRoute) { 14707 resolvedInitialRoute.name = void 0; 14708 } 14709 await router.replace({ 14710 ...resolvedInitialRoute, 14711 force: true 14712 }); 14713 router.options.scrollBehavior = routerOptions.scrollBehavior; 14714 } catch (error2) { 14715 await nuxtApp.runWithContext(() => showError(error2)); 14716 } 14717 }); 14718 return { provide: { router } }; 14719 } 14720}); 14721const clientOnlySymbol = Symbol.for("nuxt:client-only"); 14722const requestIdleCallback = globalThis.requestIdleCallback || ((cb) => { 14723 const start = Date.now(); 14724 const idleDeadline = { 14725 didTimeout: false, 14726 timeRemaining: () => Math.max(0, 50 - (Date.now() - start)) 14727 }; 14728 return setTimeout(() => { 14729 cb(idleDeadline); 14730 }, 1); 14731}); 14732const cancelIdleCallback = globalThis.cancelIdleCallback || ((id) => { 14733 clearTimeout(id); 14734}); 14735const onNuxtReady = (callback) => { 14736 const nuxtApp = useNuxtApp(); 14737 if (nuxtApp.isHydrating) { 14738 nuxtApp.hooks.hookOnce("app:suspense:resolve", () => { 14739 requestIdleCallback(() => callback()); 14740 }); 14741 } else { 14742 requestIdleCallback(() => callback()); 14743 } 14744}; 14745const isDefer = (dedupe) => dedupe === "defer" || dedupe === false; 14746function useAsyncData(...args) { 14747 var _a3; 14748 const autoKey = typeof args[args.length - 1] === "string" ? args.pop() : void 0; 14749 if (typeof args[0] !== "string" && typeof args[0] !== "object" && !(typeof args[0] === "function" && typeof args[1] === "function")) { 14750 args.unshift(autoKey); 14751 } 14752 let [_key, _handler, options = {}] = args; 14753 const key = computed(() => toValue(_key)); 14754 if (typeof key.value !== "string") { 14755 throw new TypeError("[nuxt] [useAsyncData] key must be a string."); 14756 } 14757 if (typeof _handler !== "function") { 14758 throw new TypeError("[nuxt] [useAsyncData] handler must be a function."); 14759 } 14760 const nuxtApp = useNuxtApp(); 14761 options.server ?? (options.server = true); 14762 options.default ?? (options.default = getDefault); 14763 options.getCachedData ?? (options.getCachedData = getDefaultCachedData); 14764 options.lazy ?? (options.lazy = false); 14765 options.immediate ?? (options.immediate = true); 14766 options.deep ?? (options.deep = asyncDataDefaults.deep); 14767 options.dedupe ?? (options.dedupe = "cancel"); 14768 options._functionName || "useAsyncData"; 14769 nuxtApp._asyncData[key.value]; 14770 const initialCachedData = options.getCachedData(key.value, nuxtApp, { cause: "initial" }); 14771 if (!((_a3 = nuxtApp._asyncData[key.value]) == null ? void 0 : _a3._init)) { 14772 nuxtApp._asyncData[key.value] = createAsyncData(nuxtApp, key.value, _handler, options, initialCachedData); 14773 } 14774 const asyncData = nuxtApp._asyncData[key.value]; 14775 asyncData._deps++; 14776 const initialFetch = () => nuxtApp._asyncData[key.value].execute({ cause: "initial", dedupe: options.dedupe }); 14777 const fetchOnServer = options.server !== false && nuxtApp.payload.serverRendered; 14778 { 14779 let unregister = function(key2) { 14780 const data = nuxtApp._asyncData[key2]; 14781 if (data == null ? void 0 : data._deps) { 14782 data._deps--; 14783 if (data._deps === 0) { 14784 data == null ? void 0 : data._off(); 14785 } 14786 } 14787 }; 14788 const instance = getCurrentInstance(); 14789 if (instance && fetchOnServer && options.immediate && !instance.sp) { 14790 instance.sp = []; 14791 } 14792 if (instance && !instance._nuxtOnBeforeMountCbs) { 14793 instance._nuxtOnBeforeMountCbs = []; 14794 const cbs = instance._nuxtOnBeforeMountCbs; 14795 onBeforeMount(() => {
14796 cbs.forEach((cb) => { 14797 cb(); 14798 }); 14799 cbs.splice(0, cbs.length); 14800 }); 14801 onUnmounted(() => cbs.splice(0, cbs.length)); 14802 } 14803 const isWithinClientOnly = instance && (instance._nuxtClientOnly || inject(clientOnlySymbol, false)); 14804 if (fetchOnServer && nuxtApp.isHydrating && (asyncData.error.value || initialCachedData != null)) { 14805 { 14806 asyncData.pending.value = false; 14807 } 14808 asyncData.status.value = asyncData.error.value ? "error" : "success"; 14809 } else if (instance && !isWithinClientOnly && (nuxtApp.payload.serverRendered && nuxtApp.isHydrating || options.lazy) && options.immediate) { 14810 instance._nuxtOnBeforeMountCbs.push(initialFetch); 14811 } else if (options.immediate) { 14812 initialFetch(); 14813 } 14814 const hasScope = getCurrentScope(); 14815 if (options.watch) { 14816 const unsubExecute = watch(options.watch, () => { 14817 asyncData._execute({ cause: "watch", dedupe: options.dedupe }); 14818 }, { flush: "post" }); 14819 if (hasScope) { 14820 onScopeDispose(() => unsubExecute()); 14821 } 14822 } 14823 const unsubKey = watch(key, (newKey, oldKey) => { 14824 var _a4, _b; 14825 const hasRun = ((_a4 = nuxtApp._asyncData[oldKey]) == null ? void 0 : _a4.data.value) !== asyncDataDefaults.value; 14826 if (oldKey) { 14827 unregister(oldKey); 14828 } 14829 if (!((_b = nuxtApp._asyncData[newKey]) == null ? void 0 : _b._init)) { 14830 nuxtApp._asyncData[newKey] = createAsyncData(nuxtApp, newKey, _handler, options, options.getCachedData(newKey, nuxtApp, { cause: "initial" })); 14831 } 14832 nuxtApp._asyncData[newKey]._deps++; 14833 if (options.immediate || hasRun) { 14834 nuxtApp._asyncData[newKey].execute({ cause: "initial", dedupe: options.dedupe }); 14835 } 14836 }, { flush: "sync" }); 14837 if (hasScope) { 14838 onScopeDispose(() => { 14839 unsubKey(); 14840 unregister(key.value); 14841 }); 14842 } 14843 } 14844 const asyncReturn = { 14845 data: writableComputedRef(() => { 14846 var _a4; 14847 return (_a4 = nuxtApp._asyncData[key.value]) == null ? void 0 : _a4.data; 14848 }), 14849 pending: writableComputedRef(() => { 14850 var _a4; 14851 return (_a4 = nuxtApp._asyncData[key.value]) == null ? void 0 : _a4.pending; 14852 }), 14853 status: writableComputedRef(() => { 14854 var _a4; 14855 return (_a4 = nuxtApp._asyncData[key.value]) == null ? void 0 : _a4.status; 14856 }), 14857 error: writableComputedRef(() => { 14858 var _a4; 14859 return (_a4 = nuxtApp._asyncData[key.value]) == null ? void 0 : _a4.error; 14860 }), 14861 refresh: (...args2) => nuxtApp._asyncData[key.value].execute(...args2), 14862 execute: (...args2) => nuxtApp._asyncData[key.value].execute(...args2), 14863 clear: () => clearNuxtDataByKey(nuxtApp, key.value) 14864 }; 14865 const asyncDataPromise = Promise.resolve(nuxtApp._asyncDataPromises[key.value]).then(() => asyncReturn); 14866 Object.assign(asyncDataPromise, asyncReturn); 14867 return asyncDataPromise; 14868} 14869function writableComputedRef(getter) { 14870 return computed({ 14871 get() { 14872 var _a3; 14873 return (_a3 = getter()) == null ? void 0 : _a3.value; 14874 }, 14875 set(value) { 14876 const ref2 = getter(); 14877 if (ref2) { 14878 ref2.value = value; 14879 } 14880 } 14881 }); 14882} 14883function clearNuxtDataByKey(nuxtApp, key) { 14884 if (key in nuxtApp.payload.data) { 14885 nuxtApp.payload.data[key] = void 0; 14886 } 14887 if (key in nuxtApp.payload._errors) { 14888 nuxtApp.payload._errors[key] = asyncDataDefaults.errorValue; 14889 } 14890 if (nuxtApp._asyncData[key]) { 14891 nuxtApp._asyncData[key].data.value = void 0; 14892 nuxtApp._asyncData[key].error.value = asyncDataDefaults.errorValue; 14893 { 14894 nuxtApp._asyncData[key].pending.value = false; 14895 } 14896 nuxtApp._asyncData[key].status.value = "idle"; 14897 } 14898 if (key in nuxtApp._asyncDataPromises) { 14899 if (nuxtApp._asyncDataPromises[key]) { 14900 nuxtApp._asyncDataPromises[key].cancelled = true; 14901 } 14902 nuxtApp._asyncDataPromises[key] = void 0; 14903 } 14904} 14905function pick$1(obj, keys) { 14906 const newObj = {}; 14907 for (const key of keys) { 14908 newObj[key] = obj[key]; 14909 } 14910 return newObj; 14911} 14912function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) { 14913 var _a3; 14914 (_a3 = nuxtApp.payload._errors)[key] ?? (_a3[key] = asyncDataDefaults.errorValue); 14915 const hasCustomGetCachedData = options.getCachedData !== getDefaultCachedData; 14916 const handler = _handler; 14917 const _ref = options.deep ? ref : shallowRef; 14918 const hasCachedData = initialCachedData != null; 14919 const unsubRefreshAsyncData = nuxtApp.hook("app:data:refresh", async (keys) => { 14920 if (!keys || keys.includes(key)) { 14921 await asyncData.execute({ cause: "refresh:hook" }); 14922 } 14923 }); 14924 const asyncData = { 14925 data: _ref(hasCachedData ? initialCachedData : options.default()), 14926 pending: shallowRef(!hasCachedData), 14927 error: toRef(nuxtApp.payload._errors, key), 14928 status: shallowRef("idle"), 14929 execute: (opts = {}) => { 14930 if (nuxtApp._asyncDataPromises[key]) { 14931 if (isDefer(opts.dedupe ?? options.dedupe)) { 14932 return nuxtApp._asyncDataPromises[key]; 14933 } 14934 nuxtApp._asyncDataPromises[key].cancelled = true; 14935 } 14936 if (opts.cause === "initial" || nuxtApp.isHydrating) { 14937 const cachedData = opts.cause === "initial" ? initialCachedData : options.getCachedData(key, nuxtApp, { cause: opts.cause ?? "refresh:manual" }); 14938 if (cachedData != null) { 14939 nuxtApp.payload.data[key] = asyncData.data.value = cachedData; 14940 asyncData.error.value = asyncDataDefaults.errorValue; 14941 asyncData.status.value = "success"; 14942 return Promise.resolve(cachedData); 14943 } 14944 } 14945 { 14946 asyncData.pending.value = true; 14947 } 14948 asyncData.status.value = "pending"; 14949 const promise = new Promise( 14950 (resolve2, reject) => { 14951 try { 14952 resolve2(handler(nuxtApp)); 14953 } catch (err) { 14954 reject(err); 14955 } 14956 } 14957 ).then(async (_result) => { 14958 if (promise.cancelled) { 14959 return nuxtApp._asyncDataPromises[key]; 14960 } 14961 let result = _result; 14962 if (options.transform) { 14963 result = await options.transform(_result); 14964 } 14965 if (options.pick) { 14966 result = pick$1(result, options.pick); 14967 } 14968 nuxtApp.payload.data[key] = result; 14969 asyncData.data.value = result; 14970 asyncData.error.value = asyncDataDefaults.errorValue; 14971 asyncData.status.value = "success"; 14972 }).catch((error) => { 14973 if (promise.cancelled) { 14974 return nuxtApp._asyncDataPromises[key]; 14975 } 14976 asyncData.error.value = createError(error); 14977 asyncData.data.value = unref(options.default()); 14978 asyncData.status.value = "error"; 14979 }).finally(() => { 14980 if (promise.cancelled) { 14981 return; 14982 } 14983 { 14984 asyncData.pending.value = false;
14985 } 14986 delete nuxtApp._asyncDataPromises[key]; 14987 }); 14988 nuxtApp._asyncDataPromises[key] = promise; 14989 return nuxtApp._asyncDataPromises[key]; 14990 }, 14991 _execute: debounce((...args) => asyncData.execute(...args), 0, { leading: true }), 14992 _default: options.default, 14993 _deps: 0, 14994 _init: true, 14995 _hash: void 0, 14996 _off: () => { 14997 unsubRefreshAsyncData(); 14998 asyncData._init = false; 14999 if (!hasCustomGetCachedData) { 15000 clearNuxtDataByKey(nuxtApp, key); 15001 asyncData.execute = () => Promise.resolve(); 15002 asyncData.data.value = asyncDataDefaults.value; 15003 } 15004 } 15005 }; 15006 return asyncData; 15007} 15008const getDefault = () => asyncDataDefaults.value; 15009const getDefaultCachedData = (key, nuxtApp, ctx) => { 15010 if (nuxtApp.isHydrating) { 15011 return nuxtApp.payload.data[key]; 15012 } 15013 if (ctx.cause !== "refresh:manual" && ctx.cause !== "refresh:hook") { 15014 return nuxtApp.static.data[key]; 15015 } 15016}; 15017const useStateKeyPrefix = "$s"; 15018function useState(...args) { 15019 const autoKey = typeof args[args.length - 1] === "string" ? args.pop() : void 0; 15020 if (typeof args[0] !== "string") { 15021 args.unshift(autoKey); 15022 } 15023 const [_key, init] = args; 15024 if (!_key || typeof _key !== "string") { 15025 throw new TypeError("[nuxt] [useState] key must be a string: " + _key); 15026 } 15027 if (init !== void 0 && typeof init !== "function") { 15028 throw new Error("[nuxt] [useState] init must be a function: " + init); 15029 } 15030 const key = useStateKeyPrefix + _key; 15031 const nuxtApp = useNuxtApp(); 15032 const state = toRef(nuxtApp.payload.state, key); 15033 if (state.value === void 0 && init) { 15034 const initialValue = init(); 15035 if (isRef(initialValue)) { 15036 nuxtApp.payload.state[key] = initialValue; 15037 return initialValue; 15038 } 15039 state.value = initialValue; 15040 } 15041 return state; 15042} 15043function _loadAsyncComponent(component) { 15044 if ((component == null ? void 0 : component.__asyncLoader) && !component.__asyncResolved) { 15045 return component.__asyncLoader(); 15046 } 15047} 15048async function preloadRouteComponents(to, router = useRouter()) { 15049 const { path, matched } = router.resolve(to); 15050 if (!matched.length) { 15051 return; 15052 } 15053 router._routePreloaded || (router._routePreloaded = /* @__PURE__ */ new Set()); 15054 if (router._routePreloaded.has(path)) { 15055 return; 15056 } 15057 const promises = router._preloadPromises || (router._preloadPromises = []); 15058 if (promises.length > 4) { 15059 return Promise.all(promises).then(() => preloadRouteComponents(to, router)); 15060 } 15061 router._routePreloaded.add(path); 15062 const components = matched.map((component) => { 15063 var _a3; 15064 return (_a3 = component.components) == null ? void 0 : _a3.default; 15065 }).filter((component) => typeof component === "function"); 15066 for (const component of components) { 15067 const promise = Promise.resolve(component()).catch(() => { 15068 }).finally(() => promises.splice(promises.indexOf(promise))); 15069 promises.push(promise); 15070 } 15071 await Promise.all(promises); 15072} 15073function reloadNuxtApp(options = {}) { 15074 const path = options.path || window.location.pathname; 15075 let handledPath = {}; 15076 try { 15077 handledPath = destr(sessionStorage.getItem("nuxt:reload") || "{}"); 15078 } catch { 15079 } 15080 if (options.force || (handledPath == null ? void 0 : handledPath.path) !== path || (handledPath == null ? void 0 : handledPath.expires) < Date.now()) { 15081 try { 15082 sessionStorage.setItem("nuxt:reload", JSON.stringify({ path, expires: Date.now() + (options.ttl ?? 1e4) })); 15083 } catch { 15084 } 15085 if (options.persistState) { 15086 try { 15087 sessionStorage.setItem("nuxt:reload:state", JSON.stringify({ state: useNuxtApp().payload.state })); 15088 } catch { 15089 } 15090 } 15091 if (window.location.pathname !== path) { 15092 window.location.href = path; 15093 } else { 15094 window.location.reload(); 15095 } 15096 } 15097} 15098function normalizeSiteConfig(config2) { 15099 if (typeof config2.indexable !== "undefined") 15100 config2.indexable = String(config2.indexable) !== "false"; 15101 if (typeof config2.trailingSlash !== "undefined" && !config2.trailingSlash) 15102 config2.trailingSlash = String(config2.trailingSlash) !== "false"; 15103 if (config2.url && !hasProtocol(String(config2.url), { acceptRelative: true, strict: false })) 15104 config2.url = withHttps(String(config2.url)); 15105 const keys = Object.keys(config2).sort((a2, b) => a2.localeCompare(b)); 15106 const newConfig = {}; 15107 for (const k of keys) 15108 newConfig[k] = config2[k]; 15109 return newConfig; 15110} 15111function createSiteConfigStack(options) { 15112 const debug = false;
15113 const stack2 = []; 15114 function push(input) { 15115 if (!input || typeof input !== "object" || Object.keys(input).length === 0) { 15116 return () => { 15117 }; 15118 } 15119 if (!input._context && debug) ; 15120 const entry2 = {}; 15121 for (const k in input) { 15122 const val = input[k]; 15123 if (typeof val !== "undefined" && val !== "") 15124 entry2[k] = val; 15125 } 15126 let idx; 15127 if (Object.keys(entry2).filter((k) => !k.startsWith("_")).length > 0) 15128 idx = stack2.push(entry2); 15129 return () => { 15130 if (typeof idx !== "undefined") { 15131 stack2.splice(idx - 1, 1); 15132 } 15133 }; 15134 } 15135 function get(options2) { 15136 var _a3; 15137 const siteConfig = {}; 15138 if (options2 == null ? void 0 : options2.debug) 15139 siteConfig._context = {}; 15140 siteConfig._priority = {}; 15141 for (const o2 in stack2.sort((a2, b) => (a2._priority || 0) - (b._priority || 0))) { 15142 for (const k in stack2[o2]) { 15143 const key = k; 15144 const val = (options2 == null ? void 0 : options2.resolveRefs) ? toValue(stack2[o2][k]) : stack2[o2][k]; 15145 if (!k.startsWith("_") && typeof val !== "undefined" && val !== "") { 15146 siteConfig[k] = val; 15147 if (typeof stack2[o2]._priority !== "undefined" && stack2[o2]._priority !== -1) { 15148 siteConfig._priority[key] = stack2[o2]._priority; 15149 } 15150 if (options2 == null ? void 0 : options2.debug) 15151 siteConfig._context[key] = ((_a3 = stack2[o2]._context) == null ? void 0 : _a3[key]) || stack2[o2]._context || "anonymous"; 15152 } 15153 } 15154 } 15155 return (options2 == null ? void 0 : options2.skipNormalize) ? siteConfig : normalizeSiteConfig(siteConfig); 15156 } 15157 return { 15158 stack: stack2, 15159 push, 15160 get 15161 }; 15162} 15163const _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q = /* @__PURE__ */ defineNuxtPlugin({ 15164 name: "nuxt-site-config:init", 15165 enforce: "pre", 15166 async setup(nuxtApp) { 15167 var _a3; 15168 const stack2 = createSiteConfigStack(); 15169 const state = useState("site-config"); 15170 { 15171 const store = state.value || window.__NUXT_SITE_CONFIG__ || {}; 15172 for (const k in store) { 15173 if (k[0] !== "_") { 15174 stack2.push({ [k]: store[k], _priority: ((_a3 = store._priority) == null ? void 0 : _a3[k]) || -1 }); 15175 } 15176 } 15177 } 15178 return { 15179 provide: { 15180 nuxtSiteConfig: stack2 15181 } 15182 }; 15183 } 15184}); 15185const payload_client_kSYcIMYUswSDcSGoGWqM0MO2T4MjOZsQFA1GU6fqohM = /* @__PURE__ */ defineNuxtPlugin({ 15186 name: "nuxt:payload", 15187 setup(nuxtApp) { 15188 const staticKeysToRemove = /* @__PURE__ */ new Set(); 15189 useRouter().beforeResolve(async (to, from2) => { 15190 if (to.path === from2.path) { 15191 return; 15192 } 15193 const payload = await loadPayload(to.path); 15194 if (!payload) { 15195 return; 15196 } 15197 { 15198 for (const key of staticKeysToRemove) { 15199 delete nuxtApp.static.data[key]; 15200 } 15201 } 15202 for (const key in payload.data) { 15203 { 15204 if (!(key in nuxtApp.static.data)) { 15205 staticKeysToRemove.add(key); 15206 } 15207 } 15208 nuxtApp.static.data[key] = payload.data[key]; 15209 } 15210 }); 15211 onNuxtReady(() => { 15212 var _a3; 15213 nuxtApp.hooks.hook("link:prefetch", async (url) => { 15214 const { hostname } = new URL(url, window.location.href); 15215 if (hostname === window.location.hostname) { 15216 await loadPayload(url).catch(() => { 15217 console.warn("[nuxt] Error preloading payload for", url); 15218 }); 15219 } 15220 }); 15221 if (((_a3 = navigator.connection) == null ? void 0 : _a3.effectiveType) !== "slow-2g") { 15222 setTimeout(getAppManifest, 1e3); 15223 } 15224 }); 15225 } 15226}); 15227const navigation_repaint_client_iZ4sbIDUOBlI58WRS1dxkRZJOsKNs1c7SCqRszdxr6Y = /* @__PURE__ */ defineNuxtPlugin(() => { 15228 const router = useRouter(); 15229 onNuxtReady(() => { 15230 router.beforeResolve(async () => { 15231 await new Promise((resolve2) => { 15232 setTimeout(resolve2, 100); 15233 requestAnimationFrame(() => { 15234 setTimeout(resolve2, 0); 15235 }); 15236 }); 15237 }); 15238 }); 15239}); 15240const check_outdated_build_client__GMdmUuNCTKDee9GyDhHz84CJEYUp5_FenYjvgAxtj8 = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => { 15241 let timeout; 15242 async function getLatestManifest() { 15243 const currentManifest = await getAppManifest(); 15244 if (timeout) { 15245 clearTimeout(timeout); 15246 } 15247 timeout = setTimeout(getLatestManifest, outdatedBuildInterval); 15248 try { 15249 const meta = await $fetch(buildAssetsURL("builds/latest.json") + `?${Date.now()}`); 15250 if (meta.id !== currentManifest.id) { 15251 nuxtApp.hooks.callHook("app:manifest:update", meta); 15252 } 15253 } catch { 15254 } 15255 } 15256 onNuxtReady(() => { 15257 timeout = setTimeout(getLatestManifest, outdatedBuildInterval); 15258 }); 15259}); 15260const chunk_reload_client_90gdG_aWZaDfO85SQYWzwaOywz7zi0wBnFUoX0cT54U = /* @__PURE__ */ defineNuxtPlugin({ 15261 name: "nuxt:chunk-reload", 15262 setup(nuxtApp) { 15263 const router = useRouter(); 15264 const config2 = /* @__PURE__ */ useRuntimeConfig(); 15265 const chunkErrors = /* @__PURE__ */ new Set(); 15266 router.beforeEach(() => { 15267 chunkErrors.clear(); 15268 }); 15269 nuxtApp.hook("app:chunkError", ({ error }) => { 15270 chunkErrors.add(error); 15271 }); 15272 function reloadAppAtPath(to) { 15273 const isHash = "href" in to && to.href[0] === "#"; 15274 const path = isHash ? config2.app.baseURL + to.href : joinURL(config2.app.baseURL, to.fullPath); 15275 reloadNuxtApp({ path, persistState: true }); 15276 } 15277 nuxtApp.hook("app:manifest:update", () => { 15278 router.beforeResolve(reloadAppAtPath); 15279 }); 15280 router.onError((error, to) => { 15281 if (chunkErrors.has(error)) { 15282 reloadAppAtPath(to); 15283 } 15284 }); 15285 } 15286}); 15287const plugin = /* @__PURE__ */ defineNuxtPlugin({ 15288 name: "pinia", 15289 setup(nuxtApp) { 15290 const pinia = createPinia(); 15291 nuxtApp.vueApp.use(pinia); 15292 setActivePinia(pinia); 15293 if (nuxtApp.payload && nuxtApp.payload.pinia) { 15294 pinia.state.value = nuxtApp.payload.pinia; 15295 } 15296 return { 15297 provide: { 15298 pinia 15299 } 15300 }; 15301 } 15302}); 15303const components_plugin_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4 = /* @__PURE__ */ defineNuxtPlugin({ 15304 name: "nuxt:global-components" 15305}); 15306const layouts = { 15307 default: /* @__PURE__ */ defineAsyncComponent(() => __vitePreload(() => import("./Bt12qBFB.js"), true ? __vite__mapDeps([21,5,6,2,3,22]) : void 0, import.meta.url).then((m) => m.default || m)) 15308}; 15309const prefetch_client_plc8Lsxh1X10IEwNhW7mxf0MabjBz64b9ODLi87nY5E = /* @__PURE__ */ defineNuxtPlugin({ 15310 name: "nuxt:prefetch", 15311 setup(nuxtApp) { 15312 const router = useRouter(); 15313 nuxtApp.hooks.hook("app:mounted", () => { 15314 router.beforeEach(async (to) => { 15315 var _a3; 15316 const layout = (_a3 = to == null ? void 0 : to.meta) == null ? void 0 : _a3.layout; 15317 if (layout && typeof layouts[layout] === "function") { 15318 await layouts[layout](); 15319 } 15320 }); 15321 }); 15322 nuxtApp.hooks.hook("link:prefetch", (url) => { 15323 if (hasProtocol(url)) { 15324 return; 15325 } 15326 const route = router.resolve(url); 15327 if (!route) { 15328 return; 15329 } 15330 const layout = route.meta.layout; 15331 let middleware = toArray(route.meta.middleware); 15332 middleware = middleware.filter((m) => typeof m === "string"); 15333 for (const name of middleware) { 15334 if (typeof namedMiddleware[name] === "function") { 15335 namedMiddleware[name](); 15336 } 15337 } 15338 if (typeof layout === "string" && layout in layouts) { 15339 _loadAsyncComponent(layouts[layout]); 15340 } 15341 }); 15342 } 15343}); 15344const e = !(typeof navigator > "u") && "ReactNative" === navigator.product, t = { timeout: e ? 6e4 : 12e4 }, r = function(r2) { 15345 const a2 = { ...t, ..."string" == typeof r2 ? { url: r2 } : r2 }; 15346 if (a2.timeout = n$1(a2.timeout), a2.query) { 15347 const { url: t2, searchParams: r3 } = function(t3) { 15348 const r4 = t3.indexOf("?"); 15349 if (-1 === r4) return { url: t3, searchParams: new URLSearchParams() }; 15350 const n2 = t3.slice(0, r4), a3 = t3.slice(r4 + 1); 15351 if (!e) return { url: n2, searchParams: new URLSearchParams(a3) }; 15352 if ("function" != typeof decodeURIComponent) throw new Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined"); 15353 const s2 = new URLSearchParams(); 15354 for (const e2 of a3.split("&")) { 15355 const [t4, r5] = e2.split("="); 15356 t4 && s2.append(o$1(t4), o$1(r5 || "")); 15357 } 15358 return { url: n2, searchParams: s2 }; 15359 }(a2.url); 15360 for (const [e2, o2] of Object.entries(a2.query)) { 15361 if (void 0 !== o2) if (Array.isArray(o2)) for (const t3 of o2) r3.append(e2, t3); 15362 else r3.append(e2, o2); 15363 const n2 = r3.toString(); 15364 n2 && (a2.url = `${t2}?${n2}`); 15365 } 15366 } 15367 return a2.method = a2.body && !a2.method ? "POST" : (a2.method || "GET").toUpperCase(), a2; 15368}; 15369function o$1(e2) { 15370 return decodeURIComponent(e2.replace(/\+/g, " ")); 15371} 15372function n$1(e2) { 15373 if (false === e2 || 0 === e2) return false;
15374 if (e2.connect || e2.socket) return e2; 15375 const r2 = Number(e2); 15376 return isNaN(r2) ? n$1(t.timeout) : { connect: r2, socket: r2 }; 15377} 15378const a$2 = /^https?:\/\//i, s$2 = function(e2) { 15379 if (!a$2.test(e2.url)) throw new Error(`"${e2.url}" is not a valid URL`); 15380}; 15381function c$3(e2) { 15382 return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2; 15383} 15384const o = ["request", "response", "progress", "error", "abort"], s$1 = ["processOptions", "validateOptions", "interceptRequest", "finalizeOptions", "onRequest", "onResponse", "onError", "onReturn", "onHeaders"]; 15385function n(r$1, a2) { 15386 const i2 = [], u2 = s$1.reduce((e2, t2) => (e2[t2] = e2[t2] || [], e2), { processOptions: [r], validateOptions: [s$2] }); 15387 function l2(e2) { 15388 const t2 = o.reduce((e3, t3) => (e3[t3] = /* @__PURE__ */ function() { 15389 const e4 = /* @__PURE__ */ Object.create(null); 15390 let t4 = 0; 15391 return { publish: function(t5) { 15392 for (const r3 in e4) e4[r3](t5); 15393 }, subscribe: function(r3) { 15394 const o2 = t4++; 15395 return e4[o2] = r3, function() { 15396 delete e4[o2]; 15397 }; 15398 } }; 15399 }(), e3), {}), r2 = /* @__PURE__ */ ((e3) => function(t3, r3, ...o2) { 15400 const s3 = "onError" === t3; 15401 let n3 = r3; 15402 for (let r4 = 0; r4 < e3[t3].length && (n3 = (0, e3[t3][r4])(n3, ...o2), !s3 || n3); r4++) ; 15403 return n3; 15404 })(u2), s2 = r2("processOptions", e2); 15405 r2("validateOptions", s2); 15406 const n2 = { options: s2, channels: t2, applyMiddleware: r2 }; 15407 let i3; 15408 const l3 = t2.request.subscribe((e3) => { 15409 i3 = a2(e3, (o2, s3) => ((e4, o3, s4) => { 15410 let n3 = e4, a3 = o3; 15411 if (!n3) try { 15412 a3 = r2("onResponse", o3, s4); 15413 } catch (e5) { 15414 a3 = null, n3 = e5; 15415 } 15416 n3 = n3 && r2("onError", n3, s4), n3 ? t2.error.publish(n3) : a3 && t2.response.publish(a3); 15417 })(o2, s3, e3)); 15418 }); 15419 t2.abort.subscribe(() => { 15420 l3(), i3 && i3.abort(); 15421 }); 15422 const c2 = r2("onReturn", t2, n2); 15423 return c2 === t2 && t2.request.publish(n2), c2; 15424 } 15425 return l2.use = function(e2) { 15426 if (!e2) throw new Error("Tried to add middleware that resolved to falsey value"); 15427 if ("function" == typeof e2) throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it."); 15428 if (e2.onReturn && u2.onReturn.length > 0) throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event"); 15429 return s$1.forEach((t2) => { 15430 e2[t2] && u2[t2].push(e2[t2]); 15431 }), i2.push(e2), l2; 15432 }, l2.clone = () => n(i2, a2), r$1.forEach(l2.use), l2; 15433} 15434var a$1, i, u$2 = /* @__PURE__ */ c$3(function() { 15435 if (i) return a$1; 15436 i = 1; 15437 var e2 = function(e3) { 15438 return e3.replace(/^\s+|\s+$/g, ""); 15439 }; 15440 return a$1 = function(t2) { 15441 if (!t2) return {}; 15442 for (var r2 = {}, o2 = e2(t2).split("\n"), s2 = 0; s2 < o2.length; s2++) { 15443 var n2 = o2[s2], a2 = n2.indexOf(":"), i2 = e2(n2.slice(0, a2)).toLowerCase(), u2 = e2(n2.slice(a2 + 1)); 15444 typeof r2[i2] > "u" ? r2[i2] = u2 : (l2 = r2[i2], "[object Array]" === Object.prototype.toString.call(l2) ? r2[i2].push(u2) : r2[i2] = [r2[i2], u2]); 15445 } 15446 var l2; 15447 return r2; 15448 }; 15449}()); 15450let l$1 = (_a = class { 15451 constructor() { 15452 __publicField(this, "onabort"); 15453 __publicField(this, "onerror"); 15454 __publicField(this, "onreadystatechange"); 15455 __publicField(this, "ontimeout"); 15456 __publicField(this, "readyState", 0); 15457 __publicField(this, "response"); 15458 __publicField(this, "responseText", ""); 15459 __publicField(this, "responseType", ""); 15460 __publicField(this, "status"); 15461 __publicField(this, "statusText"); 15462 __publicField(this, "withCredentials"); 15463 __privateAdd(this, _e); 15464 __privateAdd(this, _t); 15465 __privateAdd(this, _r); 15466 __privateAdd(this, _o, {}); 15467 __privateAdd(this, _s); 15468 __privateAdd(this, _n, {}); 15469 __privateAdd(this, _a2); 15470 } 15471 open(e2, t2, r2) { 15472 var _a3; 15473 __privateSet(this, _e, e2), __privateSet(this, _t, t2), __privateSet(this, _r, ""), this.readyState = 1, (_a3 = this.onreadystatechange) == null ? void 0 : _a3.call(this), __privateSet(this, _s, void 0); 15474 } 15475 abort() { 15476 __privateGet(this, _s) && __privateGet(this, _s).abort(); 15477 } 15478 getAllResponseHeaders() { 15479 return __privateGet(this, _r); 15480 } 15481 setRequestHeader(e2, t2) { 15482 __privateGet(this, _o)[e2] = t2; 15483 } 15484 setInit(e2, t2 = true) { 15485 __privateSet(this, _n, e2), __privateSet(this, _a2, t2); 15486 } 15487 send(e2) { 15488 const t2 = "arraybuffer" !== this.responseType, r2 = { ...__privateGet(this, _n), method: __privateGet(this, _e), headers: __privateGet(this, _o), body: e2 }; 15489 "function" == typeof AbortController && __privateGet(this, _a2) && (__privateSet(this, _s, new AbortController()), typeof EventTarget < "u" && __privateGet(this, _s).signal instanceof EventTarget && (r2.signal = __privateGet(this, _s).signal)), typeof document < "u" && (r2.credentials = this.withCredentials ? "include" : "omit"), fetch(__privateGet(this, _t), r2).then((e3) => { 15490 var _a3;
15491 return e3.headers.forEach((e4, t3) => { 15492 __privateSet(this, _r, __privateGet(this, _r) + `${t3}: ${e4}\r 15493`); 15494 }), this.status = e3.status, this.statusText = e3.statusText, this.readyState = 3, (_a3 = this.onreadystatechange) == null ? void 0 : _a3.call(this), t2 ? e3.text() : e3.arrayBuffer(); 15495 }).then((e3) => { 15496 var _a3; 15497 "string" == typeof e3 ? this.responseText = e3 : this.response = e3, this.readyState = 4, (_a3 = this.onreadystatechange) == null ? void 0 : _a3.call(this); 15498 }).catch((e3) => { 15499 var _a3, _b; 15500 "AbortError" !== e3.name ? (_a3 = this.onerror) == null ? void 0 : _a3.call(this, e3) : (_b = this.onabort) == null ? void 0 : _b.call(this); 15501 }); 15502 } 15503}, _e = new WeakMap(), _t = new WeakMap(), _r = new WeakMap(), _o = new WeakMap(), _s = new WeakMap(), _n = new WeakMap(), _a2 = new WeakMap(), _a); 15504const c$2 = "function" == typeof XMLHttpRequest ? "xhr" : "fetch", h = "xhr" === c$2 ? XMLHttpRequest : l$1, d$1 = (e2, t2) => { 15505 const r2 = e2.options, o2 = e2.applyMiddleware("finalizeOptions", r2), s2 = {}, n2 = e2.applyMiddleware("interceptRequest", void 0, { adapter: c$2, context: e2 }); 15506 if (n2) { 15507 const e3 = setTimeout(t2, 0, null, n2); 15508 return { abort: () => clearTimeout(e3) }; 15509 } 15510 let a2 = new h(); 15511 a2 instanceof l$1 && "object" == typeof o2.fetch && a2.setInit(o2.fetch, o2.useAbortSignal ?? true); 15512 const i2 = o2.headers, d2 = o2.timeout; 15513 let p2 = false, f2 = false, b = false; 15514 if (a2.onerror = (e3) => { 15515 m(a2 instanceof l$1 ? e3 instanceof Error ? e3 : new Error(`Request error while attempting to reach is ${o2.url}`, { cause: e3 }) : new Error(`Request error while attempting to reach is ${o2.url}${e3.lengthComputable ? `(${e3.loaded} of ${e3.total} bytes transferred)` : ""}`)); 15516 }, a2.ontimeout = (e3) => { 15517 m(new Error(`Request timeout while attempting to reach ${o2.url}${e3.lengthComputable ? `(${e3.loaded} of ${e3.total} bytes transferred)` : ""}`)); 15518 }, a2.onabort = () => { 15519 w(true), p2 = true; 15520 }, a2.onreadystatechange = () => { 15521 d2 && (w(), s2.socket = setTimeout(() => y("ESOCKETTIMEDOUT"), d2.socket)), !p2 && 4 === a2.readyState && 0 !== a2.status && function() { 15522 if (!(p2 || f2 || b)) { 15523 if (0 === a2.status) return void m(new Error("Unknown XHR error")); 15524 w(), f2 = true, t2(null, { body: a2.response || ("" === a2.responseType || "text" === a2.responseType ? a2.responseText : ""), url: o2.url, method: o2.method, headers: u$2(a2.getAllResponseHeaders()), statusCode: a2.status, statusMessage: a2.statusText }); 15525 } 15526 }(); 15527 }, a2.open(o2.method, o2.url, true), a2.withCredentials = !!o2.withCredentials, i2 && a2.setRequestHeader) for (const e3 in i2) i2.hasOwnProperty(e3) && a2.setRequestHeader(e3, i2[e3]); 15528 return o2.rawBody && (a2.responseType = "arraybuffer"), e2.applyMiddleware("onRequest", { options: o2, adapter: c$2, request: a2, context: e2 }), a2.send(o2.body || null), d2 && (s2.connect = setTimeout(() => y("ETIMEDOUT"), d2.connect)), { abort: function() { 15529 p2 = true, a2 && a2.abort(); 15530 } }; 15531 function y(t3) { 15532 b = true, a2.abort(); 15533 const r3 = new Error("ESOCKETTIMEDOUT" === t3 ? `Socket timed out on request to ${o2.url}` : `Connection timed out on request to ${o2.url}`); 15534 r3.code = t3, e2.channels.error.publish(r3); 15535 } 15536 function w(e3) { 15537 (e3 || p2 || a2.readyState >= 2 && s2.connect) && clearTimeout(s2.connect), s2.socket && clearTimeout(s2.socket); 15538 } 15539 function m(e3) { 15540 if (f2) return; 15541 w(true), f2 = true, a2 = null; 15542 const r3 = e3 || new Error(`Network error while attempting to reach ${o2.url}`); 15543 r3.isNetworkError = true, r3.request = o2, t2(r3); 15544 } 15545}, p$1 = (e2 = [], t2 = d$1) => n(e2, t2); 15546var define_process_env_default = {}; 15547var a, c$1, u$1, l, p, d = { exports: {} }; 15548/* @__PURE__ */ c$3((p || (p = 1, function(e2, t2) { 15549 t2.formatArgs = function(t3) { 15550 if (t3[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t3[0] + (this.useColors ? "%c " : " ") + "+" + e2.exports.humanize(this.diff), !this.useColors) return; 15551 const s3 = "color: " + this.color; 15552 t3.splice(1, 0, s3, "color: inherit"); 15553 let n2 = 0, r2 = 0; 15554 t3[0].replace(/%[a-zA-Z%]/g, (e3) => { 15555 "%%" !== e3 && (n2++, "%c" === e3 && (r2 = n2)); 15556 }), t3.splice(r2, 0, s3); 15557 }, t2.save = function(e3) { 15558 try { 15559 e3 ? t2.storage.setItem("debug", e3) : t2.storage.removeItem("debug"); 15560 } catch { 15561 } 15562 }, t2.load = function() { 15563 let e3; 15564 try { 15565 e3 = t2.storage.getItem("debug"); 15566 } catch { 15567 } 15568 return !e3 && typeof process < "u" && "env" in process && (e3 = define_process_env_default.DEBUG), e3; 15569 }, t2.useColors = function() { 15570 if (typeof window < "u" && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return true; 15571 if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
15572 let e3; 15573 return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (e3 = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(e3[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); 15574 }, t2.storage = function() { 15575 try { 15576 return localStorage; 15577 } catch { 15578 } 15579 }(), t2.destroy = /* @__PURE__ */ (() => { 15580 let e3 = false; 15581 return () => { 15582 e3 || (e3 = true, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")); 15583 }; 15584 })(), t2.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t2.log = console.debug || console.log || (() => { 15585 }), e2.exports = (l ? u$1 : (l = 1, u$1 = function(e3) { 15586 function t3(e4) { 15587 let n3, r2, o2, i2 = null; 15588 function a2(...e5) { 15589 if (!a2.enabled) return; 15590 const s4 = a2, r3 = Number(/* @__PURE__ */ new Date()), o3 = r3 - (n3 || r3); 15591 s4.diff = o3, s4.prev = n3, s4.curr = r3, n3 = r3, e5[0] = t3.coerce(e5[0]), "string" != typeof e5[0] && e5.unshift("%O"); 15592 let i3 = 0; 15593 e5[0] = e5[0].replace(/%([a-zA-Z%])/g, (n4, r4) => { 15594 if ("%%" === n4) return "%"; 15595 i3++; 15596 const o4 = t3.formatters[r4]; 15597 if ("function" == typeof o4) { 15598 const t4 = e5[i3]; 15599 n4 = o4.call(s4, t4), e5.splice(i3, 1), i3--; 15600 } 15601 return n4; 15602 }), t3.formatArgs.call(s4, e5), (s4.log || t3.log).apply(s4, e5); 15603 } 15604 return a2.namespace = e4, a2.useColors = t3.useColors(), a2.color = t3.selectColor(e4), a2.extend = s3, a2.destroy = t3.destroy, Object.defineProperty(a2, "enabled", { enumerable: true, configurable: false, get: () => null !== i2 ? i2 : (r2 !== t3.namespaces && (r2 = t3.namespaces, o2 = t3.enabled(e4)), o2), set: (e5) => { 15605 i2 = e5; 15606 } }), "function" == typeof t3.init && t3.init(a2), a2; 15607 } 15608 function s3(e4, s4) { 15609 const n3 = t3(this.namespace + (typeof s4 > "u" ? ":" : s4) + e4); 15610 return n3.log = this.log, n3; 15611 } 15612 function n2(e4, t4) { 15613 let s4 = 0, n3 = 0, r2 = -1, o2 = 0; 15614 for (; s4 < e4.length; ) if (n3 < t4.length && (t4[n3] === e4[s4] || "*" === t4[n3])) "*" === t4[n3] ? (r2 = n3, o2 = s4, n3++) : (s4++, n3++); 15615 else { 15616 if (-1 === r2) return false; 15617 n3 = r2 + 1, o2++, s4 = o2; 15618 } 15619 for (; n3 < t4.length && "*" === t4[n3]; ) n3++; 15620 return n3 === t4.length; 15621 } 15622 return t3.debug = t3, t3.default = t3, t3.coerce = function(e4) { 15623 return e4 instanceof Error ? e4.stack || e4.message : e4; 15624 }, t3.disable = function() { 15625 const e4 = [...t3.names, ...t3.skips.map((e5) => "-" + e5)].join(","); 15626 return t3.enable(""), e4; 15627 }, t3.enable = function(e4) { 15628 t3.save(e4), t3.namespaces = e4, t3.names = [], t3.skips = []; 15629 const s4 = ("string" == typeof e4 ? e4 : "").trim().replace(" ", ",").split(",").filter(Boolean); 15630 for (const e5 of s4) "-" === e5[0] ? t3.skips.push(e5.slice(1)) : t3.names.push(e5); 15631 }, t3.enabled = function(e4) { 15632 for (const s4 of t3.skips) if (n2(e4, s4)) return false;
15633 for (const s4 of t3.names) if (n2(e4, s4)) return true; 15634 return false; 15635 }, t3.humanize = function() { 15636 if (c$1) return a; 15637 c$1 = 1; 15638 var e4 = 1e3, t4 = 60 * e4, s4 = 60 * t4, n3 = 24 * s4, r2 = 7 * n3; 15639 function o2(e5, t5, s5, n4) { 15640 var r3 = t5 >= 1.5 * s5; 15641 return Math.round(e5 / s5) + " " + n4 + (r3 ? "s" : ""); 15642 } 15643 return a = function(i2, a2) { 15644 a2 = a2 || {}; 15645 var c2, u2, l2 = typeof i2; 15646 if ("string" === l2 && i2.length > 0) return function(o3) { 15647 if (!((o3 = String(o3)).length > 100)) { 15648 var i3 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o3); 15649 if (i3) { 15650 var a3 = parseFloat(i3[1]); 15651 switch ((i3[2] || "ms").toLowerCase()) { 15652 case "years": 15653 case "year": 15654 case "yrs": 15655 case "yr": 15656 case "y": 15657 return 315576e5 * a3; 15658 case "weeks": 15659 case "week": 15660 case "w": 15661 return a3 * r2; 15662 case "days": 15663 case "day": 15664 case "d": 15665 return a3 * n3; 15666 case "hours": 15667 case "hour": 15668 case "hrs": 15669 case "hr": 15670 case "h": 15671 return a3 * s4; 15672 case "minutes": 15673 case "minute": 15674 case "mins": 15675 case "min": 15676 case "m": 15677 return a3 * t4; 15678 case "seconds": 15679 case "second": 15680 case "secs": 15681 case "sec": 15682 case "s": 15683 return a3 * e4; 15684 case "milliseconds": 15685 case "millisecond": 15686 case "msecs": 15687 case "msec": 15688 case "ms": 15689 return a3; 15690 default: 15691 return; 15692 } 15693 } 15694 } 15695 }(i2); 15696 if ("number" === l2 && isFinite(i2)) return a2.long ? (c2 = i2, (u2 = Math.abs(c2)) >= n3 ? o2(c2, u2, n3, "day") : u2 >= s4 ? o2(c2, u2, s4, "hour") : u2 >= t4 ? o2(c2, u2, t4, "minute") : u2 >= e4 ? o2(c2, u2, e4, "second") : c2 + " ms") : function(r3) { 15697 var o3 = Math.abs(r3); 15698 return o3 >= n3 ? Math.round(r3 / n3) + "d" : o3 >= s4 ? Math.round(r3 / s4) + "h" : o3 >= t4 ? Math.round(r3 / t4) + "m" : o3 >= e4 ? Math.round(r3 / e4) + "s" : r3 + "ms"; 15699 }(i2); 15700 throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(i2)); 15701 }; 15702 }(), t3.destroy = function() { 15703 console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); 15704 }, Object.keys(e3).forEach((s4) => { 15705 t3[s4] = e3[s4]; 15706 }), t3.names = [], t3.skips = [], t3.formatters = {}, t3.selectColor = function(e4) { 15707 let s4 = 0; 15708 for (let t4 = 0; t4 < e4.length; t4++) s4 = (s4 << 5) - s4 + e4.charCodeAt(t4), s4 |= 0; 15709 return t3.colors[Math.abs(s4) % t3.colors.length]; 15710 }, t3.enable(t3.load()), t3; 15711 }))(t2); 15712 const { formatters: s2 } = e2.exports; 15713 s2.j = function(e3) { 15714 try { 15715 return JSON.stringify(e3); 15716 } catch (e4) { 15717 return "[UnexpectedJSONParseError]: " + e4.message; 15718 } 15719 }; 15720}(d, d.exports)), d.exports)); 15721const F = typeof Buffer > "u" ? () => false : (e2) => Buffer.isBuffer(e2); 15722function O$1(e2) { 15723 return "[object Object]" === Object.prototype.toString.call(e2); 15724} 15725function j(e2) { 15726 if (false === O$1(e2)) return false; 15727 const t2 = e2.constructor; 15728 if (void 0 === t2) return true; 15729 const s2 = t2.prototype; 15730 return !(false === O$1(s2) || false === s2.hasOwnProperty("isPrototypeOf")); 15731} 15732const v = ["boolean", "string", "number"]; 15733function x() { 15734 return { processOptions: (e2) => { 15735 const t2 = e2.body; 15736 return !t2 || "function" == typeof t2.pipe || F(t2) || -1 === v.indexOf(typeof t2) && !Array.isArray(t2) && !j(t2) ? e2 : Object.assign({}, e2, { body: JSON.stringify(e2.body), headers: Object.assign({}, e2.headers, { "Content-Type": "application/json" }) }); 15737 } }; 15738}
15739function E$1(e2) { 15740 return { onResponse: (s2) => { 15741 const n2 = s2.headers["content-type"] || "", r2 = e2 && e2.force || -1 !== n2.indexOf("application/json"); 15742 return s2.body && n2 && r2 ? Object.assign({}, s2, { body: t2(s2.body) }) : s2; 15743 }, processOptions: (e3) => Object.assign({}, e3, { headers: Object.assign({ Accept: "application/json" }, e3.headers) }) }; 15744 function t2(e3) { 15745 try { 15746 return JSON.parse(e3); 15747 } catch (e4) { 15748 throw e4.message = `Failed to parsed response body as JSON: ${e4.message}`, e4; 15749 } 15750 } 15751} 15752let R = {}; 15753typeof globalThis < "u" ? R = globalThis : typeof window < "u" ? R = window : typeof global < "u" ? R = global : typeof self < "u" && (R = self); 15754var q = R; 15755function A(e2 = {}) { 15756 const t2 = e2.implementation || q.Observable; 15757 if (!t2) throw new Error("`Observable` is not available in global scope, and no implementation was passed"); 15758 return { onReturn: (e3, s2) => new t2((t3) => (e3.error.subscribe((e4) => t3.error(e4)), e3.progress.subscribe((e4) => t3.next(Object.assign({ type: "progress" }, e4))), e3.response.subscribe((e4) => { 15759 t3.next(Object.assign({ type: "response" }, e4)), t3.complete(); 15760 }), e3.request.publish(s2), () => e3.abort.publish())) }; 15761} 15762function S$1() { 15763 return { onRequest: (e2) => { 15764 if ("xhr" !== e2.adapter) return; 15765 const t2 = e2.request, s2 = e2.context; 15766 function n2(e3) { 15767 return (t3) => { 15768 const n3 = t3.lengthComputable ? t3.loaded / t3.total * 100 : -1; 15769 s2.channels.progress.publish({ stage: e3, percent: n3, total: t3.total, loaded: t3.loaded, lengthComputable: t3.lengthComputable }); 15770 }; 15771 } 15772 "upload" in t2 && "onprogress" in t2.upload && (t2.upload.onprogress = n2("upload")), "onprogress" in t2 && (t2.onprogress = n2("download")); 15773 } }; 15774} 15775var $ = (e2, t2, s2) => ("GET" === s2.method || "HEAD" === s2.method) && (e2.isNetworkError || false); 15776function _$1(e2) { 15777 return 100 * Math.pow(2, e2) + 100 * Math.random(); 15778} 15779const P = (e2 = {}) => ((e3) => { 15780 const t2 = e3.maxRetries || 5, s2 = e3.retryDelay || _$1, n2 = e3.shouldRetry; 15781 return { onError: (e4, r2) => { 15782 const o2 = r2.options, i2 = o2.maxRetries || t2, a2 = o2.retryDelay || s2, c2 = o2.shouldRetry || n2, u2 = o2.attemptNumber || 0; 15783 if (null !== (l2 = o2.body) && "object" == typeof l2 && "function" == typeof l2.pipe || !c2(e4, u2, o2) || u2 >= i2) return e4; 15784 var l2; 15785 const p2 = Object.assign({}, r2, { options: Object.assign({}, o2, { attemptNumber: u2 + 1 }) }); 15786 return setTimeout(() => r2.channels.request.publish(p2), a2(u2)), null; 15787 } }; 15788})({ shouldRetry: $, ...e2 }); 15789P.shouldRetry = $; 15790var extendStatics = function(d2, b) { 15791 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) { 15792 d3.__proto__ = b2; 15793 } || function(d3, b2) { 15794 for (var p2 in b2) if (Object.prototype.hasOwnProperty.call(b2, p2)) d3[p2] = b2[p2]; 15795 }; 15796 return extendStatics(d2, b); 15797}; 15798function __extends(d2, b) { 15799 if (typeof b !== "function" && b !== null) 15800 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 15801 extendStatics(d2, b); 15802 function __() { 15803 this.constructor = d2; 15804 } 15805 d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 15806} 15807function __awaiter(thisArg, _arguments, P2, generator) { 15808 function adopt(value) { 15809 return value instanceof P2 ? value : new P2(function(resolve2) { 15810 resolve2(value); 15811 }); 15812 } 15813 return new (P2 || (P2 = Promise))(function(resolve2, reject) { 15814 function fulfilled(value) { 15815 try { 15816 step(generator.next(value)); 15817 } catch (e2) { 15818 reject(e2); 15819 } 15820 } 15821 function rejected(value) { 15822 try { 15823 step(generator["throw"](value)); 15824 } catch (e2) { 15825 reject(e2); 15826 } 15827 } 15828 function step(result) { 15829 result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); 15830 } 15831 step((generator = generator.apply(thisArg, _arguments || [])).next()); 15832 }); 15833} 15834function __generator(thisArg, body) { 15835 var _2 = { label: 0, sent: function() { 15836 if (t2[0] & 1) throw t2[1]; 15837 return t2[1]; 15838 }, trys: [], ops: [] }, f2, y, t2, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 15839 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { 15840 return this; 15841 }), g; 15842 function verb(n2) { 15843 return function(v2) { 15844 return step([n2, v2]); 15845 }; 15846 } 15847 function step(op) { 15848 if (f2) throw new TypeError("Generator is already executing."); 15849 while (g && (g = 0, op[0] && (_2 = 0)), _2) try { 15850 if (f2 = 1, y && (t2 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t2 = y["return"]) && t2.call(y), 0) : y.next) && !(t2 = t2.call(y, op[1])).done) return t2; 15851 if (y = 0, t2) op = [op[0] & 2, t2.value]; 15852 switch (op[0]) { 15853 case 0: 15854 case 1: 15855 t2 = op; 15856 break; 15857 case 4: 15858 _2.label++; 15859 return { value: op[1], done: false }; 15860 case 5: 15861 _2.label++; 15862 y = op[1]; 15863 op = [0]; 15864 continue; 15865 case 7: 15866 op = _2.ops.pop(); 15867 _2.trys.pop(); 15868 continue; 15869 default: 15870 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { 15871 _2 = 0; 15872 continue; 15873 } 15874 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { 15875 _2.label = op[1]; 15876 break; 15877 } 15878 if (op[0] === 6 && _2.label < t2[1]) { 15879 _2.label = t2[1]; 15880 t2 = op; 15881 break; 15882 } 15883 if (t2 && _2.label < t2[2]) { 15884 _2.label = t2[2]; 15885 _2.ops.push(op); 15886 break; 15887 } 15888 if (t2[2]) _2.ops.pop(); 15889 _2.trys.pop(); 15890 continue; 15891 } 15892 op = body.call(thisArg, _2); 15893 } catch (e2) { 15894 op = [6, e2]; 15895 y = 0; 15896 } finally { 15897 f2 = t2 = 0; 15898 } 15899 if (op[0] & 5) throw op[1];
vendor: 27,244 bytes, lines 15900-16765
15900 return { value: op[0] ? op[1] : void 0, done: true }; 15901 } 15902} 15903function __values(o2) { 15904 var s2 = typeof Symbol === "function" && Symbol.iterator, m = s2 && o2[s2], i2 = 0; 15905 if (m) return m.call(o2); 15906 if (o2 && typeof o2.length === "number") return { 15907 next: function() { 15908 if (o2 && i2 >= o2.length) o2 = void 0; 15909 return { value: o2 && o2[i2++], done: !o2 }; 15910 } 15911 }; 15912 throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); 15913} 15914function __read(o2, n2) { 15915 var m = typeof Symbol === "function" && o2[Symbol.iterator]; 15916 if (!m) return o2; 15917 var i2 = m.call(o2), r2, ar = [], e2; 15918 try { 15919 while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done) ar.push(r2.value); 15920 } catch (error) { 15921 e2 = { error }; 15922 } finally { 15923 try { 15924 if (r2 && !r2.done && (m = i2["return"])) m.call(i2); 15925 } finally { 15926 if (e2) throw e2.error; 15927 } 15928 } 15929 return ar; 15930} 15931function __spreadArray(to, from2, pack) { 15932 if (pack || arguments.length === 2) for (var i2 = 0, l2 = from2.length, ar; i2 < l2; i2++) { 15933 if (ar || !(i2 in from2)) { 15934 if (!ar) ar = Array.prototype.slice.call(from2, 0, i2); 15935 ar[i2] = from2[i2]; 15936 } 15937 } 15938 return to.concat(ar || Array.prototype.slice.call(from2)); 15939} 15940function __await(v2) { 15941 return this instanceof __await ? (this.v = v2, this) : new __await(v2); 15942} 15943function __asyncGenerator(thisArg, _arguments, generator) { 15944 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 15945 var g = generator.apply(thisArg, _arguments || []), i2, q2 = []; 15946 return i2 = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i2[Symbol.asyncIterator] = function() { 15947 return this; 15948 }, i2; 15949 function awaitReturn(f2) { 15950 return function(v2) { 15951 return Promise.resolve(v2).then(f2, reject); 15952 }; 15953 } 15954 function verb(n2, f2) { 15955 if (g[n2]) { 15956 i2[n2] = function(v2) { 15957 return new Promise(function(a2, b) { 15958 q2.push([n2, v2, a2, b]) > 1 || resume(n2, v2); 15959 }); 15960 }; 15961 if (f2) i2[n2] = f2(i2[n2]); 15962 } 15963 } 15964 function resume(n2, v2) { 15965 try { 15966 step(g[n2](v2)); 15967 } catch (e2) { 15968 settle(q2[0][3], e2); 15969 } 15970 } 15971 function step(r2) { 15972 r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q2[0][2], r2); 15973 } 15974 function fulfill(value) { 15975 resume("next", value); 15976 } 15977 function reject(value) { 15978 resume("throw", value); 15979 } 15980 function settle(f2, v2) { 15981 if (f2(v2), q2.shift(), q2.length) resume(q2[0][0], q2[0][1]); 15982 } 15983} 15984function __asyncValues(o2) { 15985 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 15986 var m = o2[Symbol.asyncIterator], i2; 15987 return m ? m.call(o2) : (o2 = typeof __values === "function" ? __values(o2) : o2[Symbol.iterator](), i2 = {}, verb("next"), verb("throw"), verb("return"), i2[Symbol.asyncIterator] = function() { 15988 return this; 15989 }, i2); 15990 function verb(n2) { 15991 i2[n2] = o2[n2] && function(v2) { 15992 return new Promise(function(resolve2, reject) { 15993 v2 = o2[n2](v2), settle(resolve2, reject, v2.done, v2.value); 15994 }); 15995 }; 15996 } 15997 function settle(resolve2, reject, d2, v2) { 15998 Promise.resolve(v2).then(function(v3) { 15999 resolve2({ value: v3, done: d2 }); 16000 }, reject); 16001 } 16002} 16003typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { 16004 var e2 = new Error(message); 16005 return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2; 16006}; 16007function isFunction(value) { 16008 return typeof value === "function"; 16009} 16010function createErrorClass(createImpl) { 16011 var _super = function(instance) { 16012 Error.call(instance); 16013 instance.stack = new Error().stack; 16014 }; 16015 var ctorFunc = createImpl(_super); 16016 ctorFunc.prototype = Object.create(Error.prototype); 16017 ctorFunc.prototype.constructor = ctorFunc; 16018 return ctorFunc; 16019} 16020var UnsubscriptionError = createErrorClass(function(_super) { 16021 return function UnsubscriptionErrorImpl(errors) { 16022 _super(this); 16023 this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i2) { 16024 return i2 + 1 + ") " + err.toString(); 16025 }).join("\n ") : ""; 16026 this.name = "UnsubscriptionError"; 16027 this.errors = errors; 16028 }; 16029}); 16030function arrRemove(arr, item) { 16031 if (arr) { 16032 var index = arr.indexOf(item); 16033 0 <= index && arr.splice(index, 1); 16034 } 16035} 16036var Subscription = function() { 16037 function Subscription2(initialTeardown) { 16038 this.initialTeardown = initialTeardown; 16039 this.closed = false; 16040 this._parentage = null; 16041 this._finalizers = null; 16042 } 16043 Subscription2.prototype.unsubscribe = function() { 16044 var e_1, _a3, e_2, _b; 16045 var errors; 16046 if (!this.closed) { 16047 this.closed = true; 16048 var _parentage = this._parentage; 16049 if (_parentage) { 16050 this._parentage = null; 16051 if (Array.isArray(_parentage)) { 16052 try { 16053 for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) { 16054 var parent_1 = _parentage_1_1.value; 16055 parent_1.remove(this); 16056 } 16057 } catch (e_1_1) { 16058 e_1 = { error: e_1_1 }; 16059 } finally { 16060 try { 16061 if (_parentage_1_1 && !_parentage_1_1.done && (_a3 = _parentage_1.return)) _a3.call(_parentage_1); 16062 } finally { 16063 if (e_1) throw e_1.error; 16064 } 16065 } 16066 } else { 16067 _parentage.remove(this); 16068 } 16069 } 16070 var initialFinalizer = this.initialTeardown; 16071 if (isFunction(initialFinalizer)) { 16072 try { 16073 initialFinalizer(); 16074 } catch (e2) { 16075 errors = e2 instanceof UnsubscriptionError ? e2.errors : [e2]; 16076 } 16077 } 16078 var _finalizers = this._finalizers; 16079 if (_finalizers) { 16080 this._finalizers = null; 16081 try { 16082 for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) { 16083 var finalizer = _finalizers_1_1.value; 16084 try { 16085 execFinalizer(finalizer); 16086 } catch (err) { 16087 errors = errors !== null && errors !== void 0 ? errors : []; 16088 if (err instanceof UnsubscriptionError) { 16089 errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors)); 16090 } else { 16091 errors.push(err); 16092 } 16093 } 16094 } 16095 } catch (e_2_1) { 16096 e_2 = { error: e_2_1 }; 16097 } finally { 16098 try { 16099 if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1); 16100 } finally { 16101 if (e_2) throw e_2.error; 16102 } 16103 } 16104 } 16105 if (errors) { 16106 throw new UnsubscriptionError(errors); 16107 } 16108 } 16109 }; 16110 Subscription2.prototype.add = function(teardown) { 16111 var _a3; 16112 if (teardown && teardown !== this) { 16113 if (this.closed) { 16114 execFinalizer(teardown); 16115 } else { 16116 if (teardown instanceof Subscription2) { 16117 if (teardown.closed || teardown._hasParent(this)) { 16118 return; 16119 } 16120 teardown._addParent(this); 16121 } 16122 (this._finalizers = (_a3 = this._finalizers) !== null && _a3 !== void 0 ? _a3 : []).push(teardown); 16123 } 16124 } 16125 }; 16126 Subscription2.prototype._hasParent = function(parent) { 16127 var _parentage = this._parentage; 16128 return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); 16129 }; 16130 Subscription2.prototype._addParent = function(parent) { 16131 var _parentage = this._parentage; 16132 this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; 16133 }; 16134 Subscription2.prototype._removeParent = function(parent) { 16135 var _parentage = this._parentage; 16136 if (_parentage === parent) { 16137 this._parentage = null; 16138 } else if (Array.isArray(_parentage)) { 16139 arrRemove(_parentage, parent); 16140 } 16141 }; 16142 Subscription2.prototype.remove = function(teardown) { 16143 var _finalizers = this._finalizers; 16144 _finalizers && arrRemove(_finalizers, teardown); 16145 if (teardown instanceof Subscription2) { 16146 teardown._removeParent(this); 16147 } 16148 }; 16149 Subscription2.EMPTY = function() { 16150 var empty = new Subscription2(); 16151 empty.closed = true; 16152 return empty; 16153 }(); 16154 return Subscription2; 16155}(); 16156var EMPTY_SUBSCRIPTION = Subscription.EMPTY; 16157function isSubscription(value) { 16158 return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); 16159} 16160function execFinalizer(finalizer) { 16161 if (isFunction(finalizer)) { 16162 finalizer(); 16163 } else { 16164 finalizer.unsubscribe(); 16165 } 16166} 16167var config = { 16168 Promise: void 0 16169}; 16170var timeoutProvider = { 16171 setTimeout: function(handler, timeout) { 16172 var args = []; 16173 for (var _i = 2; _i < arguments.length; _i++) { 16174 args[_i - 2] = arguments[_i]; 16175 } 16176 return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args))); 16177 }, 16178 clearTimeout: function(handle) { 16179 return clearTimeout(handle); 16180 }, 16181 delegate: void 0 16182}; 16183function reportUnhandledError(err) { 16184 timeoutProvider.setTimeout(function() { 16185 { 16186 throw err; 16187 } 16188 }); 16189} 16190function noop() { 16191} 16192function errorContext(cb) { 16193 { 16194 cb(); 16195 } 16196} 16197var Subscriber = function(_super) { 16198 __extends(Subscriber2, _super); 16199 function Subscriber2(destination) { 16200 var _this = _super.call(this) || this; 16201 _this.isStopped = false; 16202 if (destination) { 16203 _this.destination = destination; 16204 if (isSubscription(destination)) { 16205 destination.add(_this); 16206 } 16207 } else { 16208 _this.destination = EMPTY_OBSERVER; 16209 } 16210 return _this; 16211 } 16212 Subscriber2.create = function(next, error, complete) { 16213 return new SafeSubscriber(next, error, complete); 16214 }; 16215 Subscriber2.prototype.next = function(value) { 16216 if (this.isStopped) ; 16217 else { 16218 this._next(value); 16219 } 16220 }; 16221 Subscriber2.prototype.error = function(err) { 16222 if (this.isStopped) ; 16223 else { 16224 this.isStopped = true; 16225 this._error(err); 16226 } 16227 }; 16228 Subscriber2.prototype.complete = function() { 16229 if (this.isStopped) ; 16230 else { 16231 this.isStopped = true; 16232 this._complete(); 16233 } 16234 }; 16235 Subscriber2.prototype.unsubscribe = function() { 16236 if (!this.closed) { 16237 this.isStopped = true; 16238 _super.prototype.unsubscribe.call(this); 16239 this.destination = null; 16240 } 16241 }; 16242 Subscriber2.prototype._next = function(value) { 16243 this.destination.next(value); 16244 }; 16245 Subscriber2.prototype._error = function(err) { 16246 try { 16247 this.destination.error(err); 16248 } finally { 16249 this.unsubscribe(); 16250 } 16251 }; 16252 Subscriber2.prototype._complete = function() { 16253 try { 16254 this.destination.complete(); 16255 } finally { 16256 this.unsubscribe(); 16257 } 16258 }; 16259 return Subscriber2; 16260}(Subscription); 16261var ConsumerObserver = function() { 16262 function ConsumerObserver2(partialObserver) { 16263 this.partialObserver = partialObserver; 16264 } 16265 ConsumerObserver2.prototype.next = function(value) { 16266 var partialObserver = this.partialObserver; 16267 if (partialObserver.next) { 16268 try { 16269 partialObserver.next(value); 16270 } catch (error) { 16271 handleUnhandledError(error); 16272 } 16273 } 16274 }; 16275 ConsumerObserver2.prototype.error = function(err) { 16276 var partialObserver = this.partialObserver; 16277 if (partialObserver.error) { 16278 try { 16279 partialObserver.error(err); 16280 } catch (error) { 16281 handleUnhandledError(error); 16282 } 16283 } else { 16284 handleUnhandledError(err); 16285 } 16286 }; 16287 ConsumerObserver2.prototype.complete = function() { 16288 var partialObserver = this.partialObserver; 16289 if (partialObserver.complete) { 16290 try { 16291 partialObserver.complete(); 16292 } catch (error) { 16293 handleUnhandledError(error); 16294 } 16295 } 16296 }; 16297 return ConsumerObserver2; 16298}(); 16299var SafeSubscriber = function(_super) { 16300 __extends(SafeSubscriber2, _super); 16301 function SafeSubscriber2(observerOrNext, error, complete) { 16302 var _this = _super.call(this) || this; 16303 var partialObserver; 16304 if (isFunction(observerOrNext) || !observerOrNext) { 16305 partialObserver = { 16306 next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, 16307 error: error !== null && error !== void 0 ? error : void 0, 16308 complete: complete !== null && complete !== void 0 ? complete : void 0 16309 }; 16310 } else { 16311 { 16312 partialObserver = observerOrNext; 16313 } 16314 } 16315 _this.destination = new ConsumerObserver(partialObserver); 16316 return _this; 16317 } 16318 return SafeSubscriber2; 16319}(Subscriber); 16320function handleUnhandledError(error) { 16321 { 16322 reportUnhandledError(error); 16323 } 16324} 16325function defaultErrorHandler(err) { 16326 throw err; 16327} 16328var EMPTY_OBSERVER = { 16329 closed: true, 16330 next: noop, 16331 error: defaultErrorHandler, 16332 complete: noop 16333}; 16334var observable = function() { 16335 return typeof Symbol === "function" && Symbol.observable || "@@observable"; 16336}(); 16337function identity(x2) { 16338 return x2; 16339} 16340function pipe() { 16341 var fns = []; 16342 for (var _i = 0; _i < arguments.length; _i++) { 16343 fns[_i] = arguments[_i]; 16344 } 16345 return pipeFromArray(fns); 16346} 16347function pipeFromArray(fns) { 16348 if (fns.length === 0) { 16349 return identity; 16350 } 16351 if (fns.length === 1) { 16352 return fns[0]; 16353 } 16354 return function piped(input) { 16355 return fns.reduce(function(prev, fn) { 16356 return fn(prev); 16357 }, input); 16358 }; 16359} 16360var Observable = function() { 16361 function Observable2(subscribe) { 16362 if (subscribe) { 16363 this._subscribe = subscribe; 16364 } 16365 } 16366 Observable2.prototype.lift = function(operator) { 16367 var observable2 = new Observable2(); 16368 observable2.source = this; 16369 observable2.operator = operator; 16370 return observable2; 16371 }; 16372 Observable2.prototype.subscribe = function(observerOrNext, error, complete) { 16373 var _this = this; 16374 var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); 16375 errorContext(function() { 16376 var _a3 = _this, operator = _a3.operator, source = _a3.source; 16377 subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber)); 16378 }); 16379 return subscriber; 16380 }; 16381 Observable2.prototype._trySubscribe = function(sink) { 16382 try { 16383 return this._subscribe(sink); 16384 } catch (err) { 16385 sink.error(err); 16386 } 16387 }; 16388 Observable2.prototype.forEach = function(next, promiseCtor) { 16389 var _this = this; 16390 promiseCtor = getPromiseCtor(promiseCtor); 16391 return new promiseCtor(function(resolve2, reject) { 16392 var subscriber = new SafeSubscriber({ 16393 next: function(value) { 16394 try { 16395 next(value); 16396 } catch (err) { 16397 reject(err); 16398 subscriber.unsubscribe(); 16399 } 16400 }, 16401 error: reject, 16402 complete: resolve2 16403 }); 16404 _this.subscribe(subscriber); 16405 }); 16406 }; 16407 Observable2.prototype._subscribe = function(subscriber) { 16408 var _a3; 16409 return (_a3 = this.source) === null || _a3 === void 0 ? void 0 : _a3.subscribe(subscriber); 16410 }; 16411 Observable2.prototype[observable] = function() { 16412 return this; 16413 }; 16414 Observable2.prototype.pipe = function() { 16415 var operations = []; 16416 for (var _i = 0; _i < arguments.length; _i++) { 16417 operations[_i] = arguments[_i]; 16418 } 16419 return pipeFromArray(operations)(this); 16420 }; 16421 Observable2.prototype.toPromise = function(promiseCtor) { 16422 var _this = this; 16423 promiseCtor = getPromiseCtor(promiseCtor); 16424 return new promiseCtor(function(resolve2, reject) { 16425 var value; 16426 _this.subscribe(function(x2) { 16427 return value = x2; 16428 }, function(err) { 16429 return reject(err); 16430 }, function() { 16431 return resolve2(value); 16432 }); 16433 }); 16434 }; 16435 Observable2.create = function(subscribe) { 16436 return new Observable2(subscribe); 16437 }; 16438 return Observable2; 16439}(); 16440function getPromiseCtor(promiseCtor) { 16441 var _a3; 16442 return (_a3 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a3 !== void 0 ? _a3 : Promise; 16443} 16444function isObserver(value) { 16445 return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); 16446} 16447function isSubscriber(value) { 16448 return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); 16449} 16450function hasLift(source) { 16451 return isFunction(source === null || source === void 0 ? void 0 : source.lift); 16452} 16453function operate(init) { 16454 return function(source) { 16455 if (hasLift(source)) { 16456 return source.lift(function(liftedSource) { 16457 try { 16458 return init(liftedSource, this); 16459 } catch (err) { 16460 this.error(err); 16461 } 16462 }); 16463 } 16464 throw new TypeError("Unable to lift unknown Observable type"); 16465 }; 16466} 16467function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { 16468 return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); 16469} 16470var OperatorSubscriber = function(_super) { 16471 __extends(OperatorSubscriber2, _super); 16472 function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { 16473 var _this = _super.call(this, destination) || this; 16474 _this.onFinalize = onFinalize; 16475 _this.shouldUnsubscribe = shouldUnsubscribe; 16476 _this._next = onNext ? function(value) { 16477 try { 16478 onNext(value); 16479 } catch (err) { 16480 destination.error(err); 16481 } 16482 } : _super.prototype._next; 16483 _this._error = onError ? function(err) { 16484 try { 16485 onError(err); 16486 } catch (err2) { 16487 destination.error(err2); 16488 } finally { 16489 this.unsubscribe(); 16490 } 16491 } : _super.prototype._error; 16492 _this._complete = onComplete ? function() { 16493 try { 16494 onComplete(); 16495 } catch (err) { 16496 destination.error(err); 16497 } finally { 16498 this.unsubscribe(); 16499 } 16500 } : _super.prototype._complete; 16501 return _this; 16502 } 16503 OperatorSubscriber2.prototype.unsubscribe = function() { 16504 var _a3; 16505 if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { 16506 var closed_1 = this.closed; 16507 _super.prototype.unsubscribe.call(this); 16508 !closed_1 && ((_a3 = this.onFinalize) === null || _a3 === void 0 ? void 0 : _a3.call(this)); 16509 } 16510 }; 16511 return OperatorSubscriber2; 16512}(Subscriber); 16513var ObjectUnsubscribedError = createErrorClass(function(_super) { 16514 return function ObjectUnsubscribedErrorImpl() { 16515 _super(this); 16516 this.name = "ObjectUnsubscribedError"; 16517 this.message = "object unsubscribed"; 16518 }; 16519}); 16520var Subject = function(_super) { 16521 __extends(Subject2, _super); 16522 function Subject2() { 16523 var _this = _super.call(this) || this; 16524 _this.closed = false; 16525 _this.currentObservers = null; 16526 _this.observers = []; 16527 _this.isStopped = false; 16528 _this.hasError = false; 16529 _this.thrownError = null; 16530 return _this; 16531 } 16532 Subject2.prototype.lift = function(operator) { 16533 var subject = new AnonymousSubject(this, this); 16534 subject.operator = operator; 16535 return subject; 16536 }; 16537 Subject2.prototype._throwIfClosed = function() { 16538 if (this.closed) { 16539 throw new ObjectUnsubscribedError(); 16540 } 16541 }; 16542 Subject2.prototype.next = function(value) { 16543 var _this = this; 16544 errorContext(function() { 16545 var e_1, _a3; 16546 _this._throwIfClosed(); 16547 if (!_this.isStopped) { 16548 if (!_this.currentObservers) { 16549 _this.currentObservers = Array.from(_this.observers); 16550 } 16551 try { 16552 for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) { 16553 var observer = _c.value; 16554 observer.next(value); 16555 } 16556 } catch (e_1_1) { 16557 e_1 = { error: e_1_1 }; 16558 } finally { 16559 try { 16560 if (_c && !_c.done && (_a3 = _b.return)) _a3.call(_b); 16561 } finally { 16562 if (e_1) throw e_1.error; 16563 } 16564 } 16565 } 16566 }); 16567 }; 16568 Subject2.prototype.error = function(err) { 16569 var _this = this; 16570 errorContext(function() { 16571 _this._throwIfClosed(); 16572 if (!_this.isStopped) { 16573 _this.hasError = _this.isStopped = true; 16574 _this.thrownError = err; 16575 var observers = _this.observers; 16576 while (observers.length) { 16577 observers.shift().error(err); 16578 } 16579 } 16580 }); 16581 }; 16582 Subject2.prototype.complete = function() { 16583 var _this = this; 16584 errorContext(function() { 16585 _this._throwIfClosed(); 16586 if (!_this.isStopped) { 16587 _this.isStopped = true; 16588 var observers = _this.observers; 16589 while (observers.length) { 16590 observers.shift().complete(); 16591 } 16592 } 16593 }); 16594 }; 16595 Subject2.prototype.unsubscribe = function() { 16596 this.isStopped = this.closed = true; 16597 this.observers = this.currentObservers = null; 16598 }; 16599 Object.defineProperty(Subject2.prototype, "observed", { 16600 get: function() { 16601 var _a3; 16602 return ((_a3 = this.observers) === null || _a3 === void 0 ? void 0 : _a3.length) > 0; 16603 }, 16604 enumerable: false, 16605 configurable: true 16606 }); 16607 Subject2.prototype._trySubscribe = function(subscriber) { 16608 this._throwIfClosed(); 16609 return _super.prototype._trySubscribe.call(this, subscriber); 16610 }; 16611 Subject2.prototype._subscribe = function(subscriber) { 16612 this._throwIfClosed(); 16613 this._checkFinalizedStatuses(subscriber); 16614 return this._innerSubscribe(subscriber); 16615 }; 16616 Subject2.prototype._innerSubscribe = function(subscriber) { 16617 var _this = this; 16618 var _a3 = this, hasError = _a3.hasError, isStopped = _a3.isStopped, observers = _a3.observers; 16619 if (hasError || isStopped) { 16620 return EMPTY_SUBSCRIPTION; 16621 } 16622 this.currentObservers = null; 16623 observers.push(subscriber); 16624 return new Subscription(function() { 16625 _this.currentObservers = null; 16626 arrRemove(observers, subscriber); 16627 }); 16628 }; 16629 Subject2.prototype._checkFinalizedStatuses = function(subscriber) { 16630 var _a3 = this, hasError = _a3.hasError, thrownError = _a3.thrownError, isStopped = _a3.isStopped; 16631 if (hasError) { 16632 subscriber.error(thrownError); 16633 } else if (isStopped) { 16634 subscriber.complete(); 16635 } 16636 }; 16637 Subject2.prototype.asObservable = function() { 16638 var observable2 = new Observable(); 16639 observable2.source = this; 16640 return observable2; 16641 }; 16642 Subject2.create = function(destination, source) { 16643 return new AnonymousSubject(destination, source); 16644 }; 16645 return Subject2; 16646}(Observable); 16647var AnonymousSubject = function(_super) { 16648 __extends(AnonymousSubject2, _super); 16649 function AnonymousSubject2(destination, source) { 16650 var _this = _super.call(this) || this; 16651 _this.destination = destination; 16652 _this.source = source; 16653 return _this; 16654 } 16655 AnonymousSubject2.prototype.next = function(value) { 16656 var _a3, _b; 16657 (_b = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.next) === null || _b === void 0 ? void 0 : _b.call(_a3, value); 16658 }; 16659 AnonymousSubject2.prototype.error = function(err) { 16660 var _a3, _b; 16661 (_b = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.error) === null || _b === void 0 ? void 0 : _b.call(_a3, err); 16662 }; 16663 AnonymousSubject2.prototype.complete = function() { 16664 var _a3, _b; 16665 (_b = (_a3 = this.destination) === null || _a3 === void 0 ? void 0 : _a3.complete) === null || _b === void 0 ? void 0 : _b.call(_a3); 16666 }; 16667 AnonymousSubject2.prototype._subscribe = function(subscriber) { 16668 var _a3, _b; 16669 return (_b = (_a3 = this.source) === null || _a3 === void 0 ? void 0 : _a3.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION; 16670 }; 16671 return AnonymousSubject2; 16672}(Subject); 16673var dateTimestampProvider = { 16674 now: function() { 16675 return (dateTimestampProvider.delegate || Date).now(); 16676 }, 16677 delegate: void 0 16678}; 16679var ReplaySubject = function(_super) { 16680 __extends(ReplaySubject2, _super); 16681 function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) { 16682 if (_bufferSize === void 0) { 16683 _bufferSize = Infinity; 16684 } 16685 if (_windowTime === void 0) { 16686 _windowTime = Infinity; 16687 } 16688 if (_timestampProvider === void 0) { 16689 _timestampProvider = dateTimestampProvider; 16690 } 16691 var _this = _super.call(this) || this; 16692 _this._bufferSize = _bufferSize; 16693 _this._windowTime = _windowTime; 16694 _this._timestampProvider = _timestampProvider; 16695 _this._buffer = []; 16696 _this._infiniteTimeWindow = true; 16697 _this._infiniteTimeWindow = _windowTime === Infinity; 16698 _this._bufferSize = Math.max(1, _bufferSize); 16699 _this._windowTime = Math.max(1, _windowTime); 16700 return _this; 16701 } 16702 ReplaySubject2.prototype.next = function(value) { 16703 var _a3 = this, isStopped = _a3.isStopped, _buffer = _a3._buffer, _infiniteTimeWindow = _a3._infiniteTimeWindow, _timestampProvider = _a3._timestampProvider, _windowTime = _a3._windowTime; 16704 if (!isStopped) { 16705 _buffer.push(value); 16706 !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime); 16707 } 16708 this._trimBuffer(); 16709 _super.prototype.next.call(this, value); 16710 }; 16711 ReplaySubject2.prototype._subscribe = function(subscriber) { 16712 this._throwIfClosed(); 16713 this._trimBuffer(); 16714 var subscription = this._innerSubscribe(subscriber); 16715 var _a3 = this, _infiniteTimeWindow = _a3._infiniteTimeWindow, _buffer = _a3._buffer; 16716 var copy = _buffer.slice(); 16717 for (var i2 = 0; i2 < copy.length && !subscriber.closed; i2 += _infiniteTimeWindow ? 1 : 2) { 16718 subscriber.next(copy[i2]); 16719 } 16720 this._checkFinalizedStatuses(subscriber); 16721 return subscription; 16722 }; 16723 ReplaySubject2.prototype._trimBuffer = function() { 16724 var _a3 = this, _bufferSize = _a3._bufferSize, _timestampProvider = _a3._timestampProvider, _buffer = _a3._buffer, _infiniteTimeWindow = _a3._infiniteTimeWindow; 16725 var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize; 16726 _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize); 16727 if (!_infiniteTimeWindow) { 16728 var now = _timestampProvider.now(); 16729 var last2 = 0; 16730 for (var i2 = 1; i2 < _buffer.length && _buffer[i2] <= now; i2 += 2) { 16731 last2 = i2; 16732 } 16733 last2 && _buffer.splice(0, last2 + 1); 16734 } 16735 }; 16736 return ReplaySubject2; 16737}(Subject); 16738var Action = function(_super) { 16739 __extends(Action2, _super); 16740 function Action2(scheduler, work) { 16741 return _super.call(this) || this; 16742 } 16743 Action2.prototype.schedule = function(state, delay) { 16744 return this; 16745 }; 16746 return Action2; 16747}(Subscription); 16748var intervalProvider = { 16749 setInterval: function(handler, timeout) { 16750 var args = []; 16751 for (var _i = 2; _i < arguments.length; _i++) { 16752 args[_i - 2] = arguments[_i]; 16753 } 16754 return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args))); 16755 }, 16756 clearInterval: function(handle) { 16757 return clearInterval(handle); 16758 }, 16759 delegate: void 0 16760}; 16761var AsyncAction = function(_super) { 16762 __extends(AsyncAction2, _super); 16763 function AsyncAction2(scheduler, work) { 16764 var _this = _super.call(this, scheduler, work) || this; 16765 _this.scheduler = scheduler;
vendor: 17,455 bytes, lines 16766-17366
16766 _this.work = work; 16767 _this.pending = false; 16768 return _this; 16769 } 16770 AsyncAction2.prototype.schedule = function(state, delay) { 16771 var _a3; 16772 if (delay === void 0) { 16773 delay = 0; 16774 } 16775 if (this.closed) { 16776 return this; 16777 } 16778 this.state = state; 16779 var id = this.id; 16780 var scheduler = this.scheduler; 16781 if (id != null) { 16782 this.id = this.recycleAsyncId(scheduler, id, delay); 16783 } 16784 this.pending = true; 16785 this.delay = delay; 16786 this.id = (_a3 = this.id) !== null && _a3 !== void 0 ? _a3 : this.requestAsyncId(scheduler, this.id, delay); 16787 return this; 16788 }; 16789 AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay) { 16790 if (delay === void 0) { 16791 delay = 0; 16792 } 16793 return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay); 16794 }; 16795 AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay) { 16796 if (delay === void 0) { 16797 delay = 0; 16798 } 16799 if (delay != null && this.delay === delay && this.pending === false) { 16800 return id; 16801 } 16802 if (id != null) { 16803 intervalProvider.clearInterval(id); 16804 } 16805 return void 0; 16806 }; 16807 AsyncAction2.prototype.execute = function(state, delay) { 16808 if (this.closed) { 16809 return new Error("executing a cancelled action"); 16810 } 16811 this.pending = false; 16812 var error = this._execute(state, delay); 16813 if (error) { 16814 return error; 16815 } else if (this.pending === false && this.id != null) { 16816 this.id = this.recycleAsyncId(this.scheduler, this.id, null); 16817 } 16818 }; 16819 AsyncAction2.prototype._execute = function(state, _delay) { 16820 var errored = false; 16821 var errorValue; 16822 try { 16823 this.work(state); 16824 } catch (e2) { 16825 errored = true; 16826 errorValue = e2 ? e2 : new Error("Scheduled action threw falsy error"); 16827 } 16828 if (errored) { 16829 this.unsubscribe(); 16830 return errorValue; 16831 } 16832 }; 16833 AsyncAction2.prototype.unsubscribe = function() { 16834 if (!this.closed) { 16835 var _a3 = this, id = _a3.id, scheduler = _a3.scheduler; 16836 var actions = scheduler.actions; 16837 this.work = this.state = this.scheduler = null; 16838 this.pending = false; 16839 arrRemove(actions, this); 16840 if (id != null) { 16841 this.id = this.recycleAsyncId(scheduler, id, null); 16842 } 16843 this.delay = null; 16844 _super.prototype.unsubscribe.call(this); 16845 } 16846 }; 16847 return AsyncAction2; 16848}(Action); 16849var Scheduler = function() { 16850 function Scheduler2(schedulerActionCtor, now) { 16851 if (now === void 0) { 16852 now = Scheduler2.now; 16853 } 16854 this.schedulerActionCtor = schedulerActionCtor; 16855 this.now = now; 16856 } 16857 Scheduler2.prototype.schedule = function(work, delay, state) { 16858 if (delay === void 0) { 16859 delay = 0; 16860 } 16861 return new this.schedulerActionCtor(this, work).schedule(state, delay); 16862 }; 16863 Scheduler2.now = dateTimestampProvider.now; 16864 return Scheduler2; 16865}(); 16866var AsyncScheduler = function(_super) { 16867 __extends(AsyncScheduler2, _super); 16868 function AsyncScheduler2(SchedulerAction, now) { 16869 if (now === void 0) { 16870 now = Scheduler.now; 16871 } 16872 var _this = _super.call(this, SchedulerAction, now) || this; 16873 _this.actions = []; 16874 _this._active = false; 16875 return _this; 16876 } 16877 AsyncScheduler2.prototype.flush = function(action) { 16878 var actions = this.actions; 16879 if (this._active) { 16880 actions.push(action); 16881 return; 16882 } 16883 var error; 16884 this._active = true; 16885 do { 16886 if (error = action.execute(action.state, action.delay)) { 16887 break; 16888 } 16889 } while (action = actions.shift()); 16890 this._active = false; 16891 if (error) { 16892 while (action = actions.shift()) { 16893 action.unsubscribe(); 16894 } 16895 throw error; 16896 } 16897 }; 16898 return AsyncScheduler2; 16899}(Scheduler); 16900var asyncScheduler = new AsyncScheduler(AsyncAction); 16901var async = asyncScheduler; 16902var EMPTY = new Observable(function(subscriber) { 16903 return subscriber.complete(); 16904}); 16905function isScheduler(value) { 16906 return value && isFunction(value.schedule); 16907} 16908function last(arr) { 16909 return arr[arr.length - 1]; 16910} 16911function popResultSelector(args) { 16912 return isFunction(last(args)) ? args.pop() : void 0; 16913} 16914function popScheduler(args) { 16915 return isScheduler(last(args)) ? args.pop() : void 0; 16916} 16917function popNumber(args, defaultValue) { 16918 return typeof last(args) === "number" ? args.pop() : defaultValue; 16919} 16920var isArrayLike = function(x2) { 16921 return x2 && typeof x2.length === "number" && typeof x2 !== "function"; 16922}; 16923function isPromise(value) { 16924 return isFunction(value === null || value === void 0 ? void 0 : value.then); 16925} 16926function isInteropObservable(input) { 16927 return isFunction(input[observable]); 16928} 16929function isAsyncIterable(obj) { 16930 return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]); 16931} 16932function createInvalidObservableTypeError(input) { 16933 return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); 16934} 16935function getSymbolIterator() { 16936 if (typeof Symbol !== "function" || !Symbol.iterator) { 16937 return "@@iterator"; 16938 } 16939 return Symbol.iterator; 16940} 16941var iterator = getSymbolIterator(); 16942function isIterable(input) { 16943 return isFunction(input === null || input === void 0 ? void 0 : input[iterator]); 16944} 16945function readableStreamLikeToAsyncGenerator(readableStream) { 16946 return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() { 16947 var reader, _a3, value, done; 16948 return __generator(this, function(_b) { 16949 switch (_b.label) { 16950 case 0: 16951 reader = readableStream.getReader(); 16952 _b.label = 1; 16953 case 1: 16954 _b.trys.push([1, , 9, 10]); 16955 _b.label = 2; 16956 case 2: 16957 return [4, __await(reader.read())]; 16958 case 3: 16959 _a3 = _b.sent(), value = _a3.value, done = _a3.done; 16960 if (!done) return [3, 5]; 16961 return [4, __await(void 0)]; 16962 case 4: 16963 return [2, _b.sent()]; 16964 case 5: 16965 return [4, __await(value)]; 16966 case 6: 16967 return [4, _b.sent()]; 16968 case 7: 16969 _b.sent(); 16970 return [3, 2]; 16971 case 8: 16972 return [3, 10]; 16973 case 9: 16974 reader.releaseLock(); 16975 return [7]; 16976 case 10: 16977 return [2]; 16978 } 16979 }); 16980 }); 16981} 16982function isReadableStreamLike(obj) { 16983 return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); 16984} 16985function innerFrom(input) { 16986 if (input instanceof Observable) { 16987 return input; 16988 } 16989 if (input != null) { 16990 if (isInteropObservable(input)) { 16991 return fromInteropObservable(input); 16992 } 16993 if (isArrayLike(input)) { 16994 return fromArrayLike(input); 16995 } 16996 if (isPromise(input)) { 16997 return fromPromise(input); 16998 } 16999 if (isAsyncIterable(input)) { 17000 return fromAsyncIterable(input); 17001 } 17002 if (isIterable(input)) { 17003 return fromIterable(input); 17004 } 17005 if (isReadableStreamLike(input)) { 17006 return fromReadableStreamLike(input); 17007 } 17008 } 17009 throw createInvalidObservableTypeError(input); 17010} 17011function fromInteropObservable(obj) { 17012 return new Observable(function(subscriber) { 17013 var obs = obj[observable](); 17014 if (isFunction(obs.subscribe)) { 17015 return obs.subscribe(subscriber); 17016 } 17017 throw new TypeError("Provided object does not correctly implement Symbol.observable"); 17018 }); 17019} 17020function fromArrayLike(array) { 17021 return new Observable(function(subscriber) { 17022 for (var i2 = 0; i2 < array.length && !subscriber.closed; i2++) { 17023 subscriber.next(array[i2]); 17024 } 17025 subscriber.complete(); 17026 }); 17027} 17028function fromPromise(promise) { 17029 return new Observable(function(subscriber) { 17030 promise.then(function(value) { 17031 if (!subscriber.closed) { 17032 subscriber.next(value); 17033 subscriber.complete(); 17034 } 17035 }, function(err) { 17036 return subscriber.error(err); 17037 }).then(null, reportUnhandledError); 17038 }); 17039} 17040function fromIterable(iterable) { 17041 return new Observable(function(subscriber) { 17042 var e_1, _a3; 17043 try { 17044 for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) { 17045 var value = iterable_1_1.value; 17046 subscriber.next(value); 17047 if (subscriber.closed) { 17048 return; 17049 } 17050 } 17051 } catch (e_1_1) { 17052 e_1 = { error: e_1_1 }; 17053 } finally { 17054 try { 17055 if (iterable_1_1 && !iterable_1_1.done && (_a3 = iterable_1.return)) _a3.call(iterable_1); 17056 } finally { 17057 if (e_1) throw e_1.error; 17058 } 17059 } 17060 subscriber.complete(); 17061 }); 17062} 17063function fromAsyncIterable(asyncIterable) { 17064 return new Observable(function(subscriber) { 17065 process$1(asyncIterable, subscriber).catch(function(err) { 17066 return subscriber.error(err); 17067 }); 17068 }); 17069} 17070function fromReadableStreamLike(readableStream) { 17071 return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream)); 17072} 17073function process$1(asyncIterable, subscriber) { 17074 var asyncIterable_1, asyncIterable_1_1; 17075 var e_2, _a3; 17076 return __awaiter(this, void 0, void 0, function() { 17077 var value, e_2_1; 17078 return __generator(this, function(_b) { 17079 switch (_b.label) { 17080 case 0: 17081 _b.trys.push([0, 5, 6, 11]); 17082 asyncIterable_1 = __asyncValues(asyncIterable); 17083 _b.label = 1; 17084 case 1: 17085 return [4, asyncIterable_1.next()]; 17086 case 2: 17087 if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4]; 17088 value = asyncIterable_1_1.value; 17089 subscriber.next(value); 17090 if (subscriber.closed) { 17091 return [2]; 17092 } 17093 _b.label = 3; 17094 case 3: 17095 return [3, 1]; 17096 case 4: 17097 return [3, 11]; 17098 case 5: 17099 e_2_1 = _b.sent(); 17100 e_2 = { error: e_2_1 }; 17101 return [3, 11]; 17102 case 6: 17103 _b.trys.push([6, , 9, 10]); 17104 if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a3 = asyncIterable_1.return))) return [3, 8]; 17105 return [4, _a3.call(asyncIterable_1)]; 17106 case 7: 17107 _b.sent(); 17108 _b.label = 8; 17109 case 8: 17110 return [3, 10]; 17111 case 9: 17112 if (e_2) throw e_2.error; 17113 return [7]; 17114 case 10: 17115 return [7]; 17116 case 11: 17117 subscriber.complete(); 17118 return [2]; 17119 } 17120 }); 17121 }); 17122} 17123function executeSchedule(parentSubscription, scheduler, work, delay, repeat) { 17124 if (delay === void 0) { 17125 delay = 0; 17126 } 17127 if (repeat === void 0) { 17128 repeat = false; 17129 } 17130 var scheduleSubscription = scheduler.schedule(function() { 17131 work(); 17132 if (repeat) { 17133 parentSubscription.add(this.schedule(null, delay)); 17134 } else { 17135 this.unsubscribe(); 17136 } 17137 }, delay); 17138 parentSubscription.add(scheduleSubscription); 17139 if (!repeat) { 17140 return scheduleSubscription; 17141 } 17142} 17143function observeOn(scheduler, delay) { 17144 if (delay === void 0) { 17145 delay = 0; 17146 } 17147 return operate(function(source, subscriber) { 17148 source.subscribe(createOperatorSubscriber(subscriber, function(value) { 17149 return executeSchedule(subscriber, scheduler, function() { 17150 return subscriber.next(value); 17151 }, delay); 17152 }, function() { 17153 return executeSchedule(subscriber, scheduler, function() { 17154 return subscriber.complete(); 17155 }, delay); 17156 }, function(err) { 17157 return executeSchedule(subscriber, scheduler, function() { 17158 return subscriber.error(err); 17159 }, delay); 17160 })); 17161 }); 17162} 17163function subscribeOn(scheduler, delay) { 17164 if (delay === void 0) { 17165 delay = 0; 17166 } 17167 return operate(function(source, subscriber) { 17168 subscriber.add(scheduler.schedule(function() { 17169 return source.subscribe(subscriber); 17170 }, delay)); 17171 }); 17172} 17173function scheduleObservable(input, scheduler) { 17174 return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler)); 17175} 17176function schedulePromise(input, scheduler) { 17177 return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler)); 17178} 17179function scheduleArray(input, scheduler) { 17180 return new Observable(function(subscriber) { 17181 var i2 = 0; 17182 return scheduler.schedule(function() { 17183 if (i2 === input.length) { 17184 subscriber.complete(); 17185 } else { 17186 subscriber.next(input[i2++]); 17187 if (!subscriber.closed) { 17188 this.schedule(); 17189 } 17190 } 17191 }); 17192 }); 17193} 17194function scheduleIterable(input, scheduler) { 17195 return new Observable(function(subscriber) { 17196 var iterator$12; 17197 executeSchedule(subscriber, scheduler, function() { 17198 iterator$12 = input[iterator](); 17199 executeSchedule(subscriber, scheduler, function() { 17200 var _a3; 17201 var value; 17202 var done; 17203 try { 17204 _a3 = iterator$12.next(), value = _a3.value, done = _a3.done; 17205 } catch (err) { 17206 subscriber.error(err); 17207 return; 17208 } 17209 if (done) { 17210 subscriber.complete(); 17211 } else { 17212 subscriber.next(value); 17213 } 17214 }, 0, true); 17215 }); 17216 return function() { 17217 return isFunction(iterator$12 === null || iterator$12 === void 0 ? void 0 : iterator$12.return) && iterator$12.return(); 17218 }; 17219 }); 17220} 17221function scheduleAsyncIterable(input, scheduler) { 17222 if (!input) { 17223 throw new Error("Iterable cannot be null"); 17224 } 17225 return new Observable(function(subscriber) { 17226 executeSchedule(subscriber, scheduler, function() { 17227 var iterator2 = input[Symbol.asyncIterator](); 17228 executeSchedule(subscriber, scheduler, function() { 17229 iterator2.next().then(function(result) { 17230 if (result.done) { 17231 subscriber.complete(); 17232 } else { 17233 subscriber.next(result.value); 17234 } 17235 }); 17236 }, 0, true); 17237 }); 17238 }); 17239} 17240function scheduleReadableStreamLike(input, scheduler) { 17241 return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler); 17242} 17243function scheduled(input, scheduler) { 17244 if (input != null) { 17245 if (isInteropObservable(input)) { 17246 return scheduleObservable(input, scheduler); 17247 } 17248 if (isArrayLike(input)) { 17249 return scheduleArray(input, scheduler); 17250 } 17251 if (isPromise(input)) { 17252 return schedulePromise(input, scheduler); 17253 } 17254 if (isAsyncIterable(input)) { 17255 return scheduleAsyncIterable(input, scheduler); 17256 } 17257 if (isIterable(input)) { 17258 return scheduleIterable(input, scheduler); 17259 } 17260 if (isReadableStreamLike(input)) { 17261 return scheduleReadableStreamLike(input, scheduler); 17262 } 17263 } 17264 throw createInvalidObservableTypeError(input); 17265} 17266function from(input, scheduler) { 17267 return scheduler ? scheduled(input, scheduler) : innerFrom(input); 17268} 17269function of() { 17270 var args = []; 17271 for (var _i = 0; _i < arguments.length; _i++) { 17272 args[_i] = arguments[_i]; 17273 } 17274 var scheduler = popScheduler(args); 17275 return from(args, scheduler); 17276} 17277function throwError(errorOrErrorFactory, scheduler) { 17278 var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() { 17279 return errorOrErrorFactory; 17280 }; 17281 var init = function(subscriber) { 17282 return subscriber.error(errorFactory()); 17283 }; 17284 return new Observable(init); 17285} 17286function isObservable(obj) { 17287 return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe)); 17288} 17289var EmptyError = createErrorClass(function(_super) { 17290 return function EmptyErrorImpl() { 17291 _super(this); 17292 this.name = "EmptyError"; 17293 this.message = "no elements in sequence"; 17294 }; 17295}); 17296function lastValueFrom(source, config2) { 17297 return new Promise(function(resolve2, reject) { 17298 var _hasValue = false; 17299 var _value; 17300 source.subscribe({ 17301 next: function(value) { 17302 _value = value; 17303 _hasValue = true; 17304 }, 17305 error: reject, 17306 complete: function() { 17307 if (_hasValue) { 17308 resolve2(_value); 17309 } else { 17310 reject(new EmptyError()); 17311 } 17312 } 17313 }); 17314 }); 17315} 17316function firstValueFrom(source, config2) { 17317 return new Promise(function(resolve2, reject) { 17318 var subscriber = new SafeSubscriber({ 17319 next: function(value) { 17320 resolve2(value); 17321 subscriber.unsubscribe(); 17322 }, 17323 error: reject, 17324 complete: function() { 17325 { 17326 reject(new EmptyError()); 17327 } 17328 } 17329 }); 17330 source.subscribe(subscriber); 17331 }); 17332} 17333function isValidDate(value) { 17334 return value instanceof Date && !isNaN(value); 17335} 17336function map(project, thisArg) { 17337 return operate(function(source, subscriber) { 17338 var index = 0; 17339 source.subscribe(createOperatorSubscriber(subscriber, function(value) { 17340 subscriber.next(project.call(thisArg, value, index++)); 17341 })); 17342 }); 17343} 17344var isArray$1 = Array.isArray; 17345function callOrApply(fn, args) { 17346 return isArray$1(args) ? fn.apply(void 0, __spreadArray([], __read(args))) : fn(args); 17347} 17348function mapOneOrManyArgs(fn) { 17349 return map(function(args) { 17350 return callOrApply(fn, args); 17351 }); 17352} 17353function combineLatestInit(observables, scheduler, valueTransform) { 17354 if (valueTransform === void 0) { 17355 valueTransform = identity; 17356 } 17357 return function(subscriber) { 17358 maybeSchedule(scheduler, function() { 17359 var length = observables.length; 17360 var values = new Array(length); 17361 var active = length; 17362 var remainingFirstValues = length; 17363 var _loop_1 = function(i3) { 17364 maybeSchedule(scheduler, function() { 17365 var source = from(observables[i3], scheduler); 17366 var hasFirstValue = false;
17367 source.subscribe(createOperatorSubscriber(subscriber, function(value) { 17368 values[i3] = value; 17369 if (!hasFirstValue) { 17370 hasFirstValue = true; 17371 remainingFirstValues--; 17372 } 17373 if (!remainingFirstValues) { 17374 subscriber.next(valueTransform(values.slice())); 17375 } 17376 }, function() { 17377 if (!--active) { 17378 subscriber.complete(); 17379 } 17380 })); 17381 }, subscriber); 17382 }; 17383 for (var i2 = 0; i2 < length; i2++) { 17384 _loop_1(i2); 17385 } 17386 }); 17387 }; 17388} 17389function maybeSchedule(scheduler, execute, subscription) { 17390 { 17391 execute(); 17392 } 17393} 17394function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) { 17395 var buffer = []; 17396 var active = 0; 17397 var index = 0; 17398 var isComplete = false; 17399 var checkComplete = function() { 17400 if (isComplete && !buffer.length && !active) { 17401 subscriber.complete(); 17402 } 17403 }; 17404 var outerNext = function(value) { 17405 return active < concurrent ? doInnerSub(value) : buffer.push(value); 17406 }; 17407 var doInnerSub = function(value) { 17408 active++; 17409 var innerComplete = false; 17410 innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) { 17411 { 17412 subscriber.next(innerValue); 17413 } 17414 }, function() { 17415 innerComplete = true; 17416 }, void 0, function() { 17417 if (innerComplete) { 17418 try { 17419 active--; 17420 var _loop_1 = function() { 17421 var bufferedValue = buffer.shift(); 17422 if (innerSubScheduler) ; 17423 else { 17424 doInnerSub(bufferedValue); 17425 } 17426 }; 17427 while (buffer.length && active < concurrent) { 17428 _loop_1(); 17429 } 17430 checkComplete(); 17431 } catch (err) { 17432 subscriber.error(err); 17433 } 17434 } 17435 })); 17436 }; 17437 source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() { 17438 isComplete = true; 17439 checkComplete(); 17440 })); 17441 return function() { 17442 }; 17443} 17444function mergeMap(project, resultSelector, concurrent) { 17445 if (concurrent === void 0) { 17446 concurrent = Infinity; 17447 } 17448 if (isFunction(resultSelector)) { 17449 return mergeMap(function(a2, i2) { 17450 return map(function(b, ii) { 17451 return resultSelector(a2, b, i2, ii); 17452 })(innerFrom(project(a2, i2))); 17453 }, concurrent); 17454 } else if (typeof resultSelector === "number") { 17455 concurrent = resultSelector; 17456 } 17457 return operate(function(source, subscriber) { 17458 return mergeInternals(source, subscriber, project, concurrent); 17459 }); 17460} 17461function mergeAll(concurrent) { 17462 if (concurrent === void 0) { 17463 concurrent = Infinity; 17464 } 17465 return mergeMap(identity, concurrent); 17466} 17467function concatAll() { 17468 return mergeAll(1); 17469} 17470function concat() { 17471 var args = []; 17472 for (var _i = 0; _i < arguments.length; _i++) { 17473 args[_i] = arguments[_i]; 17474 } 17475 return concatAll()(from(args, popScheduler(args))); 17476} 17477function defer(observableFactory) { 17478 return new Observable(function(subscriber) { 17479 innerFrom(observableFactory()).subscribe(subscriber); 17480 }); 17481} 17482function timer(dueTime, intervalOrScheduler, scheduler) { 17483 if (scheduler === void 0) { 17484 scheduler = async; 17485 } 17486 return new Observable(function(subscriber) { 17487 var due = isValidDate(dueTime) ? 1e3 - scheduler.now() : dueTime; 17488 if (due < 0) { 17489 due = 0; 17490 } 17491 var n2 = 0; 17492 return scheduler.schedule(function() { 17493 if (!subscriber.closed) { 17494 subscriber.next(n2++); 17495 { 17496 subscriber.complete(); 17497 } 17498 } 17499 }, due); 17500 }); 17501} 17502function merge() { 17503 var args = []; 17504 for (var _i = 0; _i < arguments.length; _i++) { 17505 args[_i] = arguments[_i]; 17506 } 17507 var scheduler = popScheduler(args); 17508 var concurrent = popNumber(args, Infinity); 17509 var sources = args; 17510 return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler)); 17511} 17512var isArray = Array.isArray; 17513function argsOrArgArray(args) { 17514 return args.length === 1 && isArray(args[0]) ? args[0] : args; 17515} 17516function filter(predicate, thisArg) { 17517 return operate(function(source, subscriber) { 17518 var index = 0; 17519 source.subscribe(createOperatorSubscriber(subscriber, function(value) { 17520 return predicate.call(thisArg, value, index++) && subscriber.next(value); 17521 })); 17522 }); 17523} 17524function catchError(selector) { 17525 return operate(function(source, subscriber) { 17526 var innerSub = null; 17527 var syncUnsub = false;
17528 var handledResult; 17529 innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, function(err) { 17530 handledResult = innerFrom(selector(err, catchError(selector)(source))); 17531 if (innerSub) { 17532 innerSub.unsubscribe(); 17533 innerSub = null; 17534 handledResult.subscribe(subscriber); 17535 } else { 17536 syncUnsub = true; 17537 } 17538 })); 17539 if (syncUnsub) { 17540 innerSub.unsubscribe(); 17541 innerSub = null; 17542 handledResult.subscribe(subscriber); 17543 } 17544 }); 17545} 17546function combineLatest() { 17547 var args = []; 17548 for (var _i = 0; _i < arguments.length; _i++) { 17549 args[_i] = arguments[_i]; 17550 } 17551 var resultSelector = popResultSelector(args); 17552 return resultSelector ? pipe(combineLatest.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs(resultSelector)) : operate(function(source, subscriber) { 17553 combineLatestInit(__spreadArray([source], __read(argsOrArgArray(args))))(subscriber); 17554 }); 17555} 17556function combineLatestWith() { 17557 var otherSources = []; 17558 for (var _i = 0; _i < arguments.length; _i++) { 17559 otherSources[_i] = arguments[_i]; 17560 } 17561 return combineLatest.apply(void 0, __spreadArray([], __read(otherSources))); 17562} 17563function finalize(callback) { 17564 return operate(function(source, subscriber) { 17565 try { 17566 source.subscribe(subscriber); 17567 } finally { 17568 subscriber.add(callback); 17569 } 17570 }); 17571} 17572function share(options) { 17573 if (options === void 0) { 17574 options = {}; 17575 } 17576 var _a3 = options.connector, connector = _a3 === void 0 ? function() { 17577 return new Subject(); 17578 } : _a3, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d; 17579 return function(wrapperSource) { 17580 var connection; 17581 var resetConnection; 17582 var subject; 17583 var refCount = 0; 17584 var hasCompleted = false; 17585 var hasErrored = false; 17586 var cancelReset = function() { 17587 resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe(); 17588 resetConnection = void 0; 17589 }; 17590 var reset = function() { 17591 cancelReset(); 17592 connection = subject = void 0; 17593 hasCompleted = hasErrored = false; 17594 }; 17595 var resetAndUnsubscribe = function() { 17596 var conn = connection; 17597 reset(); 17598 conn === null || conn === void 0 ? void 0 : conn.unsubscribe(); 17599 }; 17600 return operate(function(source, subscriber) { 17601 refCount++; 17602 if (!hasErrored && !hasCompleted) { 17603 cancelReset(); 17604 } 17605 var dest = subject = subject !== null && subject !== void 0 ? subject : connector(); 17606 subscriber.add(function() { 17607 refCount--; 17608 if (refCount === 0 && !hasErrored && !hasCompleted) { 17609 resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero); 17610 } 17611 }); 17612 dest.subscribe(subscriber); 17613 if (!connection && refCount > 0) { 17614 connection = new SafeSubscriber({ 17615 next: function(value) { 17616 return dest.next(value); 17617 }, 17618 error: function(err) { 17619 hasErrored = true; 17620 cancelReset(); 17621 resetConnection = handleReset(reset, resetOnError, err); 17622 dest.error(err); 17623 }, 17624 complete: function() { 17625 hasCompleted = true; 17626 cancelReset(); 17627 resetConnection = handleReset(reset, resetOnComplete); 17628 dest.complete(); 17629 } 17630 }); 17631 innerFrom(source).subscribe(connection); 17632 } 17633 })(wrapperSource); 17634 }; 17635} 17636function handleReset(reset, on) { 17637 var args = []; 17638 for (var _i = 2; _i < arguments.length; _i++) { 17639 args[_i - 2] = arguments[_i]; 17640 } 17641 if (on === true) { 17642 reset(); 17643 return; 17644 } 17645 if (on === false) { 17646 return; 17647 } 17648 var onSubscriber = new SafeSubscriber({ 17649 next: function() { 17650 onSubscriber.unsubscribe(); 17651 reset(); 17652 } 17653 }); 17654 return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber); 17655} 17656function shareReplay(configOrBufferSize, windowTime, scheduler) { 17657 var bufferSize; 17658 var refCount = false;
17659 { 17660 bufferSize = configOrBufferSize; 17661 } 17662 return share({ 17663 connector: function() { 17664 return new ReplaySubject(bufferSize, windowTime, scheduler); 17665 }, 17666 resetOnError: true, 17667 resetOnComplete: false, 17668 resetOnRefCountZero: refCount 17669 }); 17670} 17671function tap(observerOrNext, error, complete) { 17672 var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext; 17673 return tapObserver ? operate(function(source, subscriber) { 17674 var _a3; 17675 (_a3 = tapObserver.subscribe) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver); 17676 var isUnsub = true; 17677 source.subscribe(createOperatorSubscriber(subscriber, function(value) { 17678 var _a4; 17679 (_a4 = tapObserver.next) === null || _a4 === void 0 ? void 0 : _a4.call(tapObserver, value); 17680 subscriber.next(value); 17681 }, function() { 17682 var _a4; 17683 isUnsub = false; 17684 (_a4 = tapObserver.complete) === null || _a4 === void 0 ? void 0 : _a4.call(tapObserver); 17685 subscriber.complete(); 17686 }, function(err) { 17687 var _a4; 17688 isUnsub = false; 17689 (_a4 = tapObserver.error) === null || _a4 === void 0 ? void 0 : _a4.call(tapObserver, err); 17690 subscriber.error(err); 17691 }, function() { 17692 var _a4, _b; 17693 if (isUnsub) { 17694 (_a4 = tapObserver.unsubscribe) === null || _a4 === void 0 ? void 0 : _a4.call(tapObserver); 17695 } 17696 (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver); 17697 })); 17698 }) : identity; 17699} 17700var s = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, c = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, u = new Array(4).fill(String.fromCodePoint(c[0])).join(""); 17701function E(t2) { 17702 let e2 = JSON.stringify(t2); 17703 return `${u}${Array.from(e2).map((r2) => { 17704 let n2 = r2.charCodeAt(0); 17705 if (n2 > 255) throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e2} on character ${r2} (${n2})`); 17706 return Array.from(n2.toString(4).padStart(4, "0")).map((o2) => String.fromCodePoint(c[o2])).join(""); 17707 }).join("")}`; 17708} 17709function I(t2) { 17710 return !Number.isNaN(Number(t2)) || /[a-z]/i.test(t2) && !/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(t2) ? false : !!Date.parse(t2); 17711} 17712function T(t2) { 17713 try { 17714 new URL(t2, t2.startsWith("/") ? "https://acme.com" : void 0); 17715 } catch { 17716 return false; 17717 } 17718 return true; 17719} 17720function C(t2, e2, r2 = "auto") { 17721 return r2 === true || r2 === "auto" && (I(t2) || T(t2)) ? t2 : `${t2}${E(e2)}`; 17722} 17723Object.fromEntries(Object.entries(c).map((t2) => t2.reverse())); 17724Object.fromEntries(Object.entries(s).map((t2) => t2.reverse())); 17725var S = `${Object.values(s).map((t2) => `\\u{${t2.toString(16)}}`).join("")}`, f = new RegExp(`[${S}]{4,}`, "gu"); 17726function _(t2) { 17727 var e2; 17728 return { cleaned: t2.replace(f, ""), encoded: ((e2 = t2.match(f)) == null ? void 0 : e2[0]) || "" }; 17729} 17730function O(t2) { 17731 return t2 && JSON.parse(_(JSON.stringify(t2)).cleaned); 17732} 17733function stegaClean(result) { 17734 return O(result); 17735} 17736const DRAFTS_FOLDER = "drafts", VERSION_FOLDER = "versions", PATH_SEPARATOR = ".", DRAFTS_PREFIX = `${DRAFTS_FOLDER}${PATH_SEPARATOR}`, VERSION_PREFIX = `${VERSION_FOLDER}${PATH_SEPARATOR}`; 17737function isDraftId(id) { 17738 return id.startsWith(DRAFTS_PREFIX); 17739} 17740function isVersionId(id) { 17741 return id.startsWith(VERSION_PREFIX); 17742} 17743function getDraftId(id) { 17744 if (isVersionId(id)) { 17745 const publishedId = getPublishedId(id); 17746 return DRAFTS_PREFIX + publishedId; 17747 } 17748 return isDraftId(id) ? id : DRAFTS_PREFIX + id; 17749} 17750function getVersionId(id, version2) { 17751 if (version2 === "drafts" || version2 === "published") 17752 throw new Error('Version can not be "published" or "drafts"'); 17753 return `${VERSION_PREFIX}${version2}${PATH_SEPARATOR}${getPublishedId(id)}`; 17754} 17755function getVersionFromId(id) { 17756 if (!isVersionId(id)) return; 17757 const [_versionPrefix, versionId, ..._publishedId] = id.split(PATH_SEPARATOR); 17758 return versionId; 17759} 17760function getPublishedId(id) { 17761 return isVersionId(id) ? id.split(PATH_SEPARATOR).slice(2).join(PATH_SEPARATOR) : isDraftId(id) ? id.slice(DRAFTS_PREFIX.length) : id; 17762} 17763let random = (bytes) => crypto.getRandomValues(new Uint8Array(bytes)); 17764let customRandom = (alphabet, defaultSize, getRandom) => { 17765 let mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1; 17766 let step = -~(1.6 * mask * defaultSize / alphabet.length); 17767 return (size = defaultSize) => { 17768 let id = ""; 17769 while (true) { 17770 let bytes = getRandom(step); 17771 let j2 = step | 0; 17772 while (j2--) { 17773 id += alphabet[bytes[j2] & mask] || ""; 17774 if (id.length === size) return id; 17775 } 17776 } 17777 }; 17778}; 17779let customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size, random);
17780class ClientError extends Error { 17781 constructor(res) { 17782 const props = extractErrorProps(res); 17783 super(props.message); 17784 __publicField(this, "response"); 17785 __publicField(this, "statusCode", 400); 17786 __publicField(this, "responseBody"); 17787 __publicField(this, "details"); 17788 Object.assign(this, props); 17789 } 17790} 17791class ServerError extends Error { 17792 constructor(res) { 17793 const props = extractErrorProps(res); 17794 super(props.message); 17795 __publicField(this, "response"); 17796 __publicField(this, "statusCode", 500); 17797 __publicField(this, "responseBody"); 17798 __publicField(this, "details"); 17799 Object.assign(this, props); 17800 } 17801} 17802function extractErrorProps(res) { 17803 const body = res.body, props = { 17804 response: res, 17805 statusCode: res.statusCode, 17806 responseBody: stringifyBody(body, res), 17807 message: "", 17808 details: void 0 17809 }; 17810 if (body.error && body.message) 17811 return props.message = `${body.error} - ${body.message}`, props; 17812 if (isMutationError(body) || isActionError(body)) { 17813 const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => { 17814 var _a3; 17815 return (_a3 = item.error) == null ? void 0 : _a3.description; 17816 }).filter(Boolean); 17817 let itemsStr = items.length ? `: 17818- ${items.join(` 17819- `)}` : ""; 17820 return allItems.length > 5 && (itemsStr += ` 17821...and ${allItems.length - 5} more`), props.message = `${body.error.description}${itemsStr}`, props.details = body.error, props; 17822 } 17823 return body.error && body.error.description ? (props.message = body.error.description, props.details = body.error, props) : (props.message = body.error || body.message || httpErrorMessage(res), props); 17824} 17825function isMutationError(body) { 17826 return isPlainObject(body) && isPlainObject(body.error) && body.error.type === "mutationError" && typeof body.error.description == "string"; 17827} 17828function isActionError(body) { 17829 return isPlainObject(body) && isPlainObject(body.error) && body.error.type === "actionError" && typeof body.error.description == "string"; 17830} 17831function isPlainObject(obj) { 17832 return typeof obj == "object" && obj !== null && !Array.isArray(obj); 17833} 17834function httpErrorMessage(res) { 17835 const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : ""; 17836 return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}`; 17837} 17838function stringifyBody(body, res) { 17839 return (res.headers["content-type"] || "").toLowerCase().indexOf("application/json") !== -1 ? JSON.stringify(body, null, 2) : body; 17840} 17841class CorsOriginError extends Error { 17842 constructor({ projectId: projectId2 }) { 17843 super("CorsOriginError"); 17844 __publicField(this, "projectId"); 17845 __publicField(this, "addOriginUrl"); 17846 this.name = "CorsOriginError", this.projectId = projectId2; 17847 const url = new URL(`https://sanity.io/manage/project/${projectId2}/api`); 17848 if (typeof location < "u") { 17849 const { origin } = location; 17850 url.searchParams.set("cors", "add"), url.searchParams.set("origin", origin), this.addOriginUrl = url, this.message = `The current origin is not allowed to connect to the Live Content API. Add it here: ${url}`; 17851 } else 17852 this.message = `The current origin is not allowed to connect to the Live Content API. Change your configuration here: ${url}`; 17853 } 17854} 17855const httpError = { 17856 onResponse: (res) => { 17857 if (res.statusCode >= 500) 17858 throw new ServerError(res); 17859 if (res.statusCode >= 400) 17860 throw new ClientError(res); 17861 return res; 17862 } 17863}; 17864function printWarnings() { 17865 const seen2 = {}; 17866 return { 17867 onResponse: (res) => { 17868 const warn = res.headers["x-sanity-warning"], warnings = Array.isArray(warn) ? warn : [warn]; 17869 for (const msg of warnings) 17870 !msg || seen2[msg] || (seen2[msg] = true, console.warn(msg)); 17871 return res; 17872 } 17873 }; 17874} 17875function defineHttpRequest(envMiddleware2) { 17876 return p$1([ 17877 P({ shouldRetry }), 17878 ...envMiddleware2, 17879 printWarnings(), 17880 x(), 17881 E$1(), 17882 S$1(), 17883 httpError, 17884 A({ implementation: Observable }) 17885 ]); 17886} 17887function shouldRetry(err, attempt, options) { 17888 if (options.maxRetries === 0) return false; 17889 const isSafe = options.method === "GET" || options.method === "HEAD", isQuery2 = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503); 17890 return (isSafe || isQuery2) && isRetriableResponse ? true : P.shouldRetry(err, attempt, options); 17891} 17892const BASE_URL = "https://www.sanity.io/help/"; 17893function generateHelpUrl(slug) { 17894 return BASE_URL + slug; 17895} 17896const VALID_ASSET_TYPES = ["image", "file"], VALID_INSERT_LOCATIONS = ["before", "after", "replace"], dataset = (name) => { 17897 if (!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(name)) 17898 throw new Error( 17899 "Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters" 17900 ); 17901}, projectId = (id) => { 17902 if (!/^[-a-z0-9]+$/i.test(id)) 17903 throw new Error("`projectId` can only contain only a-z, 0-9 and dashes"); 17904}, validateAssetType = (type) => { 17905 if (VALID_ASSET_TYPES.indexOf(type) === -1) 17906 throw new Error(`Invalid asset type: ${type}. Must be one of ${VALID_ASSET_TYPES.join(", ")}`); 17907}, validateObject = (op, val) => { 17908 if (val === null || typeof val != "object" || Array.isArray(val)) 17909 throw new Error(`${op}() takes an object of properties`); 17910}, validateDocumentId = (op, id) => { 17911 if (typeof id != "string" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes("..")) 17912 throw new Error(`${op}(): "${id}" is not a valid document ID`); 17913}, requireDocumentId = (op, doc2) => { 17914 if (!doc2._id) 17915 throw new Error(`${op}() requires that the document contains an ID ("_id" property)`); 17916 validateDocumentId(op, doc2._id); 17917}, validateDocumentType = (op, type) => { 17918 if (typeof type != "string") 17919 throw new Error(`\`${op}()\`: \`${type}\` is not a valid document type`); 17920}, requireDocumentType = (op, doc2) => { 17921 if (!doc2._type) 17922 throw new Error(`\`${op}()\` requires that the document contains a type (\`_type\` property)`); 17923 validateDocumentType(op, doc2._type); 17924}, validateVersionIdMatch = (builtVersionId, document2) => { 17925 if (document2._id && document2._id !== builtVersionId) 17926 throw new Error( 17927 `The provided document ID (\`${document2._id}
17927\`) does not match the generated version ID (\`${builtVersionId}\`)` 17928 ); 17929}, validateInsert = (at, selector, items) => { 17930 const signature = "insert(at, selector, items)"; 17931 if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) { 17932 const valid = VALID_INSERT_LOCATIONS.map((loc) => `"${loc}"`).join(", "); 17933 throw new Error(`${signature} takes an "at"-argument which is one of: ${valid}`); 17934 } 17935 if (typeof selector != "string") 17936 throw new Error(`${signature} takes a "selector"-argument which must be a string`); 17937 if (!Array.isArray(items)) 17938 throw new Error(`${signature} takes an "items"-argument which must be an array`); 17939}, hasDataset = (config2) => { 17940 if (!config2.dataset) 17941 throw new Error("`dataset` must be provided to perform queries"); 17942 return config2.dataset || ""; 17943}, requestTag = (tag) => { 17944 if (typeof tag != "string" || !/^[a-z0-9._-]{1,75}$/i.test(tag)) 17945 throw new Error( 17946 "Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long." 17947 ); 17948 return tag; 17949}, resourceConfig = (config2) => { 17950 if (!config2["~experimental_resource"]) 17951 throw new Error("`resource` must be provided to perform resource queries"); 17952 const { type, id } = config2["~experimental_resource"]; 17953 switch (type) { 17954 case "dataset": { 17955 if (id.split(".").length !== 2) 17956 throw new Error('Dataset resource ID must be in the format "project.dataset"'); 17957 return; 17958 } 17959 case "dashboard": 17960 case "media-library": 17961 case "canvas": 17962 return; 17963 default: 17964 throw new Error(`Unsupported resource type: ${type.toString()}`); 17965 } 17966}, resourceGuard = (service, config2) => { 17967 if (config2["~experimental_resource"]) 17968 throw new Error(`\`${service}\` does not support resource-based operations`); 17969}; 17970function once(fn) { 17971 let didCall = false, returnValue; 17972 return (...args) => (didCall || (returnValue = fn(...args), didCall = true), returnValue); 17973} 17974const createWarningPrinter = (message) => ( 17975 // eslint-disable-next-line no-console 17976 once((...args) => console.warn(message.join(" "), ...args)) 17977), printCdnAndWithCredentialsWarning = createWarningPrinter([ 17978 "Because you set `withCredentials` to true, we will override your `useCdn`", 17979 "setting to be false since (cookie-based) credentials are never set on the CDN" 17980]), printCdnWarning = createWarningPrinter([ 17981 "Since you haven't set a value for `useCdn`, we will deliver content using our", 17982 "global, edge-cached API-CDN. If you wish to have content delivered faster, set", 17983 "`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API." 17984]), printCdnPreviewDraftsWarning = createWarningPrinter([ 17985 "The Sanity client is configured with the `perspective` set to `drafts` or `previewDrafts`, which doesn't support the API-CDN.", 17986 "The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning." 17987]), printPreviewDraftsDeprecationWarning = createWarningPrinter([ 17988 "The `previewDrafts` perspective has been renamed to `drafts` and will be removed in a future API version" 17989]), printBrowserTokenWarning = createWarningPrinter([ 17990 "You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.", 17991 `See ${generateHelpUrl( 17992 "js-client-browser-token" 17993 )} for more information and how to hide this warning.` 17994]), printCredentialedTokenWarning = createWarningPrinter([ 17995 "You have configured Sanity client to use a token, but also provided `withCredentials: true`.", 17996 "This is no longer supported - only token will be used - remove `withCredentials: true`." 17997]), printNoApiVersionSpecifiedWarning = createWarningPrinter([ 17998 "Using the Sanity client without specifying an API version is deprecated.", 17999 `See ${generateHelpUrl("js-client-api-version")}` 18000]), defaultCdnHost = "apicdn.sanity.io", defaultConfig = { 18001 apiHost: "https://api.sanity.io", 18002 apiVersion: "1", 18003 useProjectHostname: true, 18004 stega: { enabled: false } 18005}, LOCALHOSTS = ["localhost", "127.0.0.1", "0.0.0.0"], isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1; 18006function validateApiVersion(apiVersion) { 18007 if (apiVersion === "1" || apiVersion === "X") 18008 return; 18009 const apiDate = new Date(apiVersion); 18010 if (!(/^\d{4}-\d{2}-\d{2}$/.test(apiVersion) && apiDate instanceof Date && apiDate.getTime() > 0)) 18011 throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`"); 18012} 18013function validateApiPerspective(perspective) { 18014 if (Array.isArray(perspective) && perspective.length > 1 && perspective.includes("raw")) 18015 throw new TypeError( 18016 'Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives' 18017 ); 18018}
18019const initConfig = (config2, prevConfig) => { 18020 const specifiedConfig = { 18021 ...prevConfig, 18022 ...config2, 18023 stega: { 18024 ...typeof prevConfig.stega == "boolean" ? { enabled: prevConfig.stega } : prevConfig.stega || defaultConfig.stega, 18025 ...typeof config2.stega == "boolean" ? { enabled: config2.stega } : config2.stega || {} 18026 } 18027 }; 18028 specifiedConfig.apiVersion || printNoApiVersionSpecifiedWarning(); 18029 const newConfig = { 18030 ...defaultConfig, 18031 ...specifiedConfig 18032 }, projectBased = newConfig.useProjectHostname && !newConfig["~experimental_resource"]; 18033 if (typeof Promise > "u") { 18034 const helpUrl = generateHelpUrl("js-client-promise-polyfill"); 18035 throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`); 18036 } 18037 if (projectBased && !newConfig.projectId) 18038 throw new Error("Configuration must contain `projectId`"); 18039 if (newConfig["~experimental_resource"] && resourceConfig(newConfig), typeof newConfig.perspective < "u" && validateApiPerspective(newConfig.perspective), "encodeSourceMap" in newConfig) 18040 throw new Error( 18041 "It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?" 18042 ); 18043 if ("encodeSourceMapAtPath" in newConfig) 18044 throw new Error( 18045 "It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?" 18046 ); 18047 if (typeof newConfig.stega.enabled != "boolean") 18048 throw new Error(`stega.enabled must be a boolean, received ${newConfig.stega.enabled}`); 18049 if (newConfig.stega.enabled && newConfig.stega.studioUrl === void 0) 18050 throw new Error("stega.studioUrl must be defined when stega.enabled is true"); 18051 if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl != "string" && typeof newConfig.stega.studioUrl != "function") 18052 throw new Error( 18053 `stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}` 18054 ); 18055 const isBrowser2 = typeof window < "u" && window.location && window.location.hostname, isLocalhost = isBrowser2 && isLocal(window.location.hostname), hasToken = !!newConfig.token; 18056 newConfig.withCredentials && hasToken && (printCredentialedTokenWarning(), newConfig.withCredentials = false), isBrowser2 && isLocalhost && hasToken && newConfig.ignoreBrowserTokenWarning !== true ? printBrowserTokenWarning() : typeof newConfig.useCdn > "u" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), "requestTagPrefix" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : void 0), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, ""), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn === true && newConfig.withCredentials && printCdnAndWithCredentialsWarning(), newConfig.useCdn = newConfig.useCdn !== false && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion); 18057 const hostParts = newConfig.apiHost.split("://", 2), protocol = hostParts[0], host = hostParts[1], cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host; 18058 return projectBased ? (newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`, newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`) : (newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`, newConfig.cdnUrl = newConfig.url), newConfig; 18059}; 18060class ConnectionFailedError extends Error { 18061 constructor() { 18062 super(...arguments); 18063 __publicField(this, "name", "ConnectionFailedError"); 18064 } 18065} 18066class DisconnectError extends Error { 18067 constructor(message, reason, options = {}) { 18068 super(message, options); 18069 __publicField(this, "name", "DisconnectError"); 18070 __publicField(this, "reason"); 18071 this.reason = reason; 18072 } 18073} 18074class ChannelError extends Error { 18075 constructor(message, data) { 18076 super(message); 18077 __publicField(this, "name", "ChannelError"); 18078 __publicField(this, "data"); 18079 this.data = data; 18080 } 18081}
18082class MessageError extends Error { 18083 constructor(message, data, options = {}) { 18084 super(message, options); 18085 __publicField(this, "name", "MessageError"); 18086 __publicField(this, "data"); 18087 this.data = data; 18088 } 18089} 18090class MessageParseError extends Error { 18091 constructor() { 18092 super(...arguments); 18093 __publicField(this, "name", "MessageParseError"); 18094 } 18095} 18096const REQUIRED_EVENTS = ["channelError", "disconnect"]; 18097function connectEventSource(initEventSource, events) { 18098 return defer(() => { 18099 const es = initEventSource(); 18100 return isObservable(es) ? es : of(es); 18101 }).pipe(mergeMap((es) => connectWithESInstance(es, events))); 18102} 18103function connectWithESInstance(es, events) { 18104 return new Observable((observer) => { 18105 const emitOpen = events.includes("open"), emitReconnect = events.includes("reconnect"); 18106 function onError(evt) { 18107 if ("data" in evt) { 18108 const [parseError, event] = parseEvent(evt); 18109 observer.error( 18110 parseError ? new MessageParseError("Unable to parse EventSource error message", { cause: event }) : new MessageError((event == null ? void 0 : event.data).message, event) 18111 ); 18112 return; 18113 } 18114 es.readyState === es.CLOSED ? observer.error(new ConnectionFailedError("EventSource connection failed")) : emitReconnect && observer.next({ type: "reconnect" }); 18115 } 18116 function onOpen() { 18117 observer.next({ type: "open" }); 18118 } 18119 function onMessage(message) { 18120 var _a3; 18121 const [parseError, event] = parseEvent(message); 18122 if (parseError) { 18123 observer.error( 18124 new MessageParseError("Unable to parse EventSource message", { cause: parseError }) 18125 ); 18126 return; 18127 } 18128 if (message.type === "channelError") { 18129 observer.error(new ChannelError(extractErrorMessage(event == null ? void 0 : event.data), event.data)); 18130 return; 18131 } 18132 if (message.type === "disconnect") { 18133 observer.error( 18134 new DisconnectError( 18135 `Server disconnected client: ${((_a3 = event.data) == null ? void 0 : _a3.reason) || "unknown error"}` 18136 ) 18137 ); 18138 return; 18139 } 18140 observer.next({ 18141 type: message.type, 18142 id: message.lastEventId, 18143 ...event.data ? { data: event.data } : {} 18144 }); 18145 } 18146 es.addEventListener("error", onError), emitOpen && es.addEventListener("open", onOpen); 18147 const cleanedEvents = [.../* @__PURE__ */ new Set([...REQUIRED_EVENTS, ...events])].filter((type) => type !== "error" && type !== "open" && type !== "reconnect"); 18148 return cleanedEvents.forEach((type) => es.addEventListener(type, onMessage)), () => { 18149 es.removeEventListener("error", onError), emitOpen && es.removeEventListener("open", onOpen), cleanedEvents.forEach((type) => es.removeEventListener(type, onMessage)), es.close(); 18150 }; 18151 }); 18152} 18153function parseEvent(message) { 18154 try { 18155 const data = typeof message.data == "string" && JSON.parse(message.data); 18156 return [ 18157 null, 18158 { 18159 type: message.type, 18160 id: message.lastEventId, 18161 ...isEmptyObject(data) ? {} : { data } 18162 } 18163 ]; 18164 } catch (err) { 18165 return [err, null]; 18166 } 18167} 18168function extractErrorMessage(err) { 18169 return err.error ? err.error.description ? err.error.description : typeof err.error == "string" ? err.error : JSON.stringify(err.error, null, 2) : err.message || "Unknown listener error"; 18170} 18171function isEmptyObject(data) { 18172 for (const _2 in data) 18173 return false; 18174 return true; 18175} 18176function getSelection(sel) { 18177 if (typeof sel == "string") 18178 return { id: sel }; 18179 if (Array.isArray(sel)) 18180 return { query: "*[_id in $ids]", params: { ids: sel } }; 18181 if (typeof sel == "object" && sel !== null && "query" in sel && typeof sel.query == "string") 18182 return "params" in sel && typeof sel.params == "object" && sel.params !== null ? { query: sel.query, params: sel.params } : { query: sel.query }; 18183 const selectionOpts = [ 18184 "* Document ID (<docId>)", 18185 "* Array of document IDs", 18186 "* Object containing `query`" 18187 ].join(` 18188`); 18189 throw new Error(`Unknown selection - must be one of: 18190 18191${selectionOpts}`); 18192} 18193class BasePatch { 18194 constructor(selection, operations = {}) { 18195 __publicField(this, "selection"); 18196 __publicField(this, "operations"); 18197 this.selection = selection, this.operations = operations; 18198 } 18199 /** 18200 * Sets the given attributes to the document. Does NOT merge objects. 18201 * The operation is added to the current patch, ready to be commited by `commit()` 18202 * 18203 * @param attrs - Attributes to set. To set a deep attribute, use JSONMat
18203ch, eg: \{"nested.prop": "value"\} 18204 */ 18205 set(attrs) { 18206 return this._assign("set", attrs); 18207 } 18208 /** 18209 * Sets the given attributes to the document if they are not currently set. Does NOT merge objects. 18210 * The operation is added to the current patch, ready to be commited by `commit()` 18211 * 18212 * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\} 18213 */ 18214 setIfMissing(attrs) { 18215 return this._assign("setIfMissing", attrs); 18216 } 18217 /** 18218 * Performs a "diff-match-patch" operation on the string attributes provided. 18219 * The operation is added to the current patch, ready to be commited by `commit()` 18220 * 18221 * @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "dmp"\} 18222 */ 18223 diffMatchPatch(attrs) { 18224 return validateObject("diffMatchPatch", attrs), this._assign("diffMatchPatch", attrs); 18225 } 18226 /** 18227 * Unsets the attribute paths provided. 18228 * The operation is added to the current patch, ready to be commited by `commit()` 18229 * 18230 * @param attrs - Attribute paths to unset. 18231 */ 18232 unset(attrs) { 18233 if (!Array.isArray(attrs)) 18234 throw new Error("unset(attrs) takes an array of attributes to unset, non-array given"); 18235 return this.operations = Object.assign({}, this.operations, { unset: attrs }), this; 18236 } 18237 /** 18238 * Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist. 18239 * 18240 * @param attrs - Object of attribute paths to increment, values representing the number to increment by. 18241 */ 18242 inc(attrs) { 18243 return this._assign("inc", attrs); 18244 } 18245 /** 18246 * Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist. 18247 * 18248 * @param attrs - Object of attribute paths to decrement, values representing the number to decrement by. 18249 */ 18250 dec(attrs) { 18251 return this._assign("dec", attrs); 18252 } 18253 /** 18254 * Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression. 18255 * 18256 * @param at - Location to insert at, relative to the given selector, or 'replace' the matched path 18257 * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]` 18258 * @param items - Array of items to insert/replace 18259 */ 18260 insert(at, selector, items) { 18261 return validateInsert(at, selector, items), this._assign("insert", { [at]: selector, items }); 18262 } 18263 /** 18264 * Append the given items to the array at the given JSONPath 18265 * 18266 * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies` 18267 * @param items - Array of items to append to the array 18268 */ 18269 append(selector, items) { 18270 return this.insert("after", `${selector}[-1]`, items); 18271 } 18272 /** 18273 * Prepend the given items to the array at the given JSONPath 18274 * 18275 * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies` 18276 * @param items - Array of items to prepend to the array 18277 */ 18278 prepend(selector, items) { 18279 return this.insert("before", `${selector}[0]`, items); 18280 } 18281 /** 18282 * Change the contents of an array by removing existing elements and/or adding new elements. 18283 * 18284 * @param selector - Attribute or JSONPath expression for array 18285 * @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x 18286 * @param deleteCount - An integer indicating the number of old array elements to remove. 18287 * @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array. 18288 */ 18289 splice(selector, start, deleteCount, items) { 18290 const delAll = typeof deleteCount > "u" || deleteCount === -1, startIndex = start < 0 ? start - 1 : start, delCount = delAll ? -1 : Math.max(0, start + deleteCount), delRange = startIndex < 0 && delCount >= 0 ? "" : delCount, rangeSelector = `${selector}[${startIndex}:${delRange}]`; 18291 return this.insert("replace", rangeSelector, items || []); 18292 } 18293 /** 18294 * Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value 18295 * 18296 * @param rev - Revision to lock the patch to 18297 */ 18298 ifRevisionId(rev) { 18299 return this.operations.ifRevisionID = rev, this; 18300 } 18301 /** 18302 * Return a plain JSON representation of the patch 18303 */
18304 serialize() { 18305 return { ...getSelection(this.selection), ...this.operations }; 18306 } 18307 /** 18308 * Return a plain JSON representation of the patch 18309 */ 18310 toJSON() { 18311 return this.serialize(); 18312 } 18313 /** 18314 * Clears the patch of all operations 18315 */ 18316 reset() { 18317 return this.operations = {}, this; 18318 } 18319 _assign(op, props, merge2 = true) { 18320 return validateObject(op, props), this.operations = Object.assign({}, this.operations, { 18321 [op]: Object.assign({}, merge2 && this.operations[op] || {}, props) 18322 }), this; 18323 } 18324 _set(op, props) { 18325 return this._assign(op, props, false); 18326 } 18327} 18328const _ObservablePatch = class _ObservablePatch extends BasePatch { 18329 constructor(selection, operations, client) { 18330 super(selection, operations); 18331 __privateAdd(this, _client); 18332 __privateSet(this, _client, client); 18333 } 18334 /** 18335 * Clones the patch 18336 */ 18337 clone() { 18338 return new _ObservablePatch(this.selection, { ...this.operations }, __privateGet(this, _client)); 18339 } 18340 commit(options) { 18341 if (!__privateGet(this, _client)) 18342 throw new Error( 18343 "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method" 18344 ); 18345 const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: true }, options); 18346 return __privateGet(this, _client).mutate({ patch: this.serialize() }, opts); 18347 } 18348}; 18349_client = new WeakMap(); 18350let ObservablePatch = _ObservablePatch; 18351const _Patch = class _Patch extends BasePatch { 18352 constructor(selection, operations, client) { 18353 super(selection, operations); 18354 __privateAdd(this, _client2); 18355 __privateSet(this, _client2, client); 18356 } 18357 /** 18358 * Clones the patch 18359 */ 18360 clone() { 18361 return new _Patch(this.selection, { ...this.operations }, __privateGet(this, _client2)); 18362 } 18363 commit(options) { 18364 if (!__privateGet(this, _client2)) 18365 throw new Error( 18366 "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method" 18367 ); 18368 const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: true }, options); 18369 return __privateGet(this, _client2).mutate({ patch: this.serialize() }, opts); 18370 } 18371}; 18372_client2 = new WeakMap(); 18373let Patch = _Patch; 18374const defaultMutateOptions = { returnDocuments: false }; 18375class BaseTransaction { 18376 constructor(operations = [], transactionId) { 18377 __publicField(this, "operations"); 18378 __publicField(this, "trxId"); 18379 this.operations = operations, this.trxId = transactionId; 18380 } 18381 /** 18382 * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database. 18383 * The operation is added to the current transaction, ready to be commited by `commit()` 18384 * 18385 * @param doc - Document to create. Requires a `_type` property. 18386 */ 18387 create(doc2) { 18388 return validateObject("create", doc2), this._add({ create: doc2 }); 18389 } 18390 /** 18391 * Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored. 18392 * The operation is added to the current transaction, ready to be commited by `commit()` 18393 * 18394 * @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties. 18395 */ 18396 createIfNotExists(doc2) { 18397 const op = "createIfNotExists"; 18398 return validateObject(op, doc2), requireDocumentId(op, doc2), this._add({ [op]: doc2 }); 18399 } 18400 /** 18401 * Creates a new Sanity document, or replaces an existing one if the same `_id` is already used. 18402 * The operation is added to the current transaction, ready to be commited by `commit()` 18403 * 18404 * @param doc - Document to create or replace. Requires `_id` and `_type` properties. 18405 */ 18406 createOrReplace(doc2) { 18407 const op = "createOrReplace"; 18408 return validateObject(op, doc2), requireDocumentId(op, doc2), this._add({ [op]: doc2 }); 18409 } 18410 /** 18411 * Deletes the document with the given document ID 18412 * The operation is added to the current transaction, ready to be commited by `commit()` 18413 * 18414 * @param documentId - Document ID to delete
18415 */ 18416 delete(documentId) { 18417 return validateDocumentId("delete", documentId), this._add({ delete: { id: documentId } }); 18418 } 18419 transactionId(id) { 18420 return id ? (this.trxId = id, this) : this.trxId; 18421 } 18422 /** 18423 * Return a plain JSON representation of the transaction 18424 */ 18425 serialize() { 18426 return [...this.operations]; 18427 } 18428 /** 18429 * Return a plain JSON representation of the transaction 18430 */ 18431 toJSON() { 18432 return this.serialize(); 18433 } 18434 /** 18435 * Clears the transaction of all operations 18436 */ 18437 reset() { 18438 return this.operations = [], this; 18439 } 18440 _add(mut) { 18441 return this.operations.push(mut), this; 18442 } 18443} 18444const _Transaction = class _Transaction extends BaseTransaction { 18445 constructor(operations, client, transactionId) { 18446 super(operations, transactionId); 18447 __privateAdd(this, _client3); 18448 __privateSet(this, _client3, client); 18449 } 18450 /** 18451 * Clones the transaction 18452 */ 18453 clone() { 18454 return new _Transaction([...this.operations], __privateGet(this, _client3), this.trxId); 18455 } 18456 commit(options) { 18457 if (!__privateGet(this, _client3)) 18458 throw new Error( 18459 "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method" 18460 ); 18461 return __privateGet(this, _client3).mutate( 18462 this.serialize(), 18463 Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {}) 18464 ); 18465 } 18466 patch(patchOrDocumentId, patchOps) { 18467 const isBuilder = typeof patchOps == "function", isPatch = typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof Patch, isMutationSelection = typeof patchOrDocumentId == "object" && ("query" in patchOrDocumentId || "id" in patchOrDocumentId); 18468 if (isPatch) 18469 return this._add({ patch: patchOrDocumentId.serialize() }); 18470 if (isBuilder) { 18471 const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet(this, _client3))); 18472 if (!(patch instanceof Patch)) 18473 throw new Error("function passed to `patch()` must return the patch"); 18474 return this._add({ patch: patch.serialize() }); 18475 } 18476 if (isMutationSelection) { 18477 const patch = new Patch(patchOrDocumentId, patchOps || {}, __privateGet(this, _client3)); 18478 return this._add({ patch: patch.serialize() }); 18479 } 18480 return this._add({ patch: { id: patchOrDocumentId, ...patchOps } }); 18481 } 18482}; 18483_client3 = new WeakMap(); 18484let Transaction = _Transaction; 18485const _ObservableTransaction = class _ObservableTransaction extends BaseTransaction { 18486 constructor(operations, client, transactionId) { 18487 super(operations, transactionId); 18488 __privateAdd(this, _client4); 18489 __privateSet(this, _client4, client); 18490 } 18491 /** 18492 * Clones the transaction 18493 */ 18494 clone() { 18495 return new _ObservableTransaction([...this.operations], __privateGet(this, _client4), this.trxId); 18496 } 18497 commit(options) { 18498 if (!__privateGet(this, _client4)) 18499 throw new Error( 18500 "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method" 18501 ); 18502 return __privateGet(this, _client4).mutate( 18503 this.serialize(), 18504 Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {}) 18505 ); 18506 } 18507 patch(patchOrDocumentId, patchOps) { 18508 const isBuilder = typeof patchOps == "function"; 18509 if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof ObservablePatch) 18510 return this._add({ patch: patchOrDocumentId.serialize() }); 18511 if (isBuilder) {
18512 const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet(this, _client4))); 18513 if (!(patch instanceof ObservablePatch)) 18514 throw new Error("function passed to `patch()` must return the patch"); 18515 return this._add({ patch: patch.serialize() }); 18516 } 18517 return this._add({ patch: { id: patchOrDocumentId, ...patchOps } }); 18518 } 18519}; 18520_client4 = new WeakMap(); 18521let ObservableTransaction = _ObservableTransaction; 18522const projectHeader = "X-Sanity-Project-ID"; 18523function requestOptions(config2, overrides = {}) { 18524 const headers = {}, token = overrides.token || config2.token; 18525 token && (headers.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config2.useProjectHostname && config2.projectId && (headers[projectHeader] = config2.projectId); 18526 const withCredentials = !!(typeof overrides.withCredentials > "u" ? config2.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config2.timeout : overrides.timeout; 18527 return Object.assign({}, overrides, { 18528 headers: Object.assign({}, headers, overrides.headers || {}), 18529 timeout: typeof timeout > "u" ? 5 * 60 * 1e3 : timeout, 18530 proxy: overrides.proxy || config2.proxy, 18531 json: true, 18532 withCredentials, 18533 fetch: typeof overrides.fetch == "object" && typeof config2.fetch == "object" ? { ...config2.fetch, ...overrides.fetch } : overrides.fetch || config2.fetch 18534 }); 18535} 18536const encodeQueryString = ({ 18537 query, 18538 params = {}, 18539 options = {} 18540}) => { 18541 const searchParams = new URLSearchParams(), { tag, includeMutations, returnQuery, ...opts } = options; 18542 tag && searchParams.append("tag", tag), searchParams.append("query", query); 18543 for (const [key, value] of Object.entries(params)) 18544 searchParams.append(`$${key}`, JSON.stringify(value)); 18545 for (const [key, value] of Object.entries(opts)) 18546 value && searchParams.append(key, `${value}`); 18547 return returnQuery === false && searchParams.append("returnQuery", "false"), includeMutations === false && searchParams.append("includeMutations", "false"), `?${searchParams}`; 18548}, excludeFalsey = (param, defValue) => param === false ? void 0 : typeof param > "u" ? defValue : param, getMutationQuery = (options = {}) => ({ 18549 dryRun: options.dryRun, 18550 returnIds: true, 18551 returnDocuments: excludeFalsey(options.returnDocuments, true), 18552 visibility: options.visibility || "sync", 18553 autoGenerateArrayKeys: options.autoGenerateArrayKeys, 18554 skipCrossDatasetReferenceValidation: options.skipCrossDatasetReferenceValidation 18555}), isResponse = (event) => event.type === "response", getBody = (event) => event.body, indexBy = (docs, attr) => docs.reduce((indexed, doc2) => (indexed[attr(doc2)] = doc2, indexed), /* @__PURE__ */ Object.create(null)), getQuerySizeLimit = 11264; 18556function _fetch(client, httpRequest, _stega, query, _params = {}, options = {}) { 18557 const stega = "stega" in options ? { 18558 ..._stega || {}, 18559 ...typeof options.stega == "boolean" ? { enabled: options.stega } : options.stega || {} 18560 } : _stega, params = stega.enabled ? stegaClean(_params) : _params, mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result, { cache, next, ...opts } = { 18561 // Opt out of setting a `signal` on an internal `fetch` if one isn't provided. 18562 // This is necessary in React Server Components to avoid opting out of Request Memoization. 18563 useAbortSignal: typeof options.signal < "u", 18564 // Set `resultSourceMap' when stega is enabled, as it's required for encoding. 18565 resultSourceMap: stega.enabled ? "withKeyArraySelector" : options.resultSourceMap, 18566 ...options, 18567 // Default to not returning the query, unless `filterResponse` is `false`, 18568 // or `returnQuery` is explicitly set. `true` is the default in Content Lake, so skip if truthy 18569 returnQuery: options.filterResponse === false && options.returnQuery !== false 18570 }, reqOpts = typeof cache < "u" || typeof next < "u" ? { ...opts, fetch: { cache, next } } : opts, $request = _dataRequest(client, httpRequest, "query", { query, params }, reqOpts); 18571 return stega.enabled ? $request.pipe( 18572 combineLatestWith( 18573 from( 18574 __vitePreload(() => import("./BkHQlCSO.js"), true ? [] : void 0, import.meta.url).then(function(n2) { 18575 return n2.stegaEncodeSourceMap$1; 18576 }).then( 18577 ({ stegaEncodeSourceMap }) => stegaEncodeSourceMap 18578 ) 18579 ) 18580 ), 18581 map( 18582 ([res, stegaEncodeSourceMap]) => { 18583 const result = stegaEncodeSourceMap(res.result, res.resultSourceMap, stega); 18584 return mapResponse({ ...res, result }); 18585 } 18586 ) 18587 ) : $request.pipe(map(mapResponse)); 18588} 18589function _getDocument(client, httpRequest, id, opts = {}) { 18590 const docId = (() => { 18591 if (!opts.releaseId) 18592 return id; 18593 const versionId = getVersionFromId(id); 18594 if (!versionId) { 18595 if (isDraftId(id)) 18596 throw new Error( 18597 `The document ID (\`${id}\`) is a draft, but \`options.releaseId\` is set as \`${opts.releaseId}\`` 18598 ); 18599 return getVersionId(id, opts.releaseId); 18600 } 18601 if (versionId !== opts.releaseId) 18602 throw new Error( 18603 `The document ID (\`${id}\`) is already a version of \`${versionId}\` release, but this does not match the provided \`options.releaseId\` (\`${opts.releaseId}\`)` 18604 ); 18605 return id; 18606 })(), options = { 18607 uri: _getDataUrl(client, "doc", docId), 18608 json: true, 18609 tag: opts.tag, 18610 signal: opts.signal 18611 }; 18612 return _requestObservable(client, httpRequest, options).pipe( 18613 filter(isResponse), 18614 map((event) => event.body.documents && event.body.documents[0]) 18615 ); 18616} 18617function _getDocuments(client, httpRequest, ids, opts = {}) { 18618 const options = { 18619 uri: _getDataUrl(client, "doc", ids.join(",")), 18620 json: true, 18621 tag: opts.tag, 18622 signal: opts.signal 18623 }; 18624 return _requestObservable(client, httpRequest, options).pipe( 18625 filter(isResponse), 18626 map((event) => { 18627 const indexed = indexBy(event.body.documents || [], (doc2) => doc2._id); 18628 return ids.map((id) => indexed[id] || null); 18629 }) 18630 ); 18631} 18632function _getReleaseDocuments(client, httpRequest, releaseId, opts = {}) { 18633 return _dataRequest( 18634 client, 18635 httpRequest, 18636 "query", 18637 { 18638 query: "*[sanity::partOfRelease($releaseId)]", 18639 params: { 18640 releaseId 18641 } 18642 }, 18643 opts 18644 ); 18645} 18646function _createIfNotExists(client, httpRequest, doc2, options) { 18647 return requireDocumentId("createIfNotExists", doc2), _create(client, httpRequest, doc2, "createIfNotExists", options); 18648} 18649function _createOrReplace(client, httpRequest, doc2, options) { 18650 return requireDocumentId("createOrReplace", doc2), _create(client, httpRequest, doc2, "createOrReplace", options); 18651} 18652function _createVersion(client, httpRequest, doc2, publishedId, options) { 18653 return requireDocumentId("createVersion", doc2), requireDocumentType("createVersion", doc2), _action(client, httpRequest, { 18654 actionType: "sanity.action.document.version.create", 18655 publishedId, 18656 document: doc2 18657 }, options); 18658} 18659function _delete(client, httpRequest, selection, options) { 18660 return _dataRequest( 18661 client, 18662 httpRequest, 18663 "mutate", 18664 { mutations: [{ delete: getSelection(selection) }] }, 18665 options 18666 ); 18667} 18668function _discardVersion(client, httpRequest, versionId, purge = false, options) { 18669 return _action(client, httpRequest, { 18670 actionType: "sanity.action.document.version.discard", 18671 versionId, 18672 purge 18673 }, options); 18674} 18675function _replaceVersion(client, httpRequest, doc2, options) { 18676 return requireDocumentId("replaceVersion", doc2), requireDocumentType("replaceVersion", doc2), _action(client, httpRequest, { 18677 actionType: "sanity.action.document.version.replace", 18678 document: doc2 18679 }, options); 18680} 18681function _unpublishVersion(client, httpRequest, versionId, publishedId, options) { 18682 return _action(client, httpRequest, { 18683 actionType: "sanity.action.document.version.unpublish", 18684 versionId, 18685 publishedId 18686 }, options); 18687} 18688function _mutate(client, httpRequest, mutations, options) { 18689 let mut; 18690 mutations instanceof Patch || mutations instanceof ObservablePatch ? mut = { patch: mutations.serialize() } : mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mut = mutations.serialize() : mut = mutations; 18691 const muts = Array.isArray(mut) ? mut : [mut], transactionId = options && options.transactionId || void 0; 18692 return _dataRequest(client, httpRequest, "mutate", { mutations: muts, transactionId }, options); 18693} 18694function _action(client, httpRequest, actions, options) { 18695 const acts = Array.isArray(actions) ? actions : [actions], transactionId = options && options.transactionId || void 0, skipCrossDatasetReferenceValidation = options && options.skipCrossDatasetReferenceValidation || void 0, dryRun = options && options.dryRun || void 0; 18696 return _dataRequest( 18697 client, 18698 httpRequest, 18699 "actions", 18700 { actions: acts, transactionId, skipCrossDatasetReferenceValidation, dryRun }, 18701 options 18702 ); 18703} 18704function _dataRequest(client, httpRequest, endpoint, body, options = {}) { 18705 const isMutation = endpoint === "mutate", isAction = endpoint === "actions", isQuery2 = endpoint === "query", strQuery = isMutation || isAction ? "" : encodeQueryString(body), useGet = !isMutation && !isAction && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId, cacheMode } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = { 18706 method: useGet ? "GET" : "POST", 18707 uri, 18708 json: true, 18709 body: useGet ? void 0 : body, 18710 query: isMutation && getMutationQuery(options), 18711 timeout, 18712 headers, 18713 token, 18714 tag, 18715 returnQuery, 18716 perspective: options.perspective, 18717 resultSourceMap: options.resultSourceMap, 18718 lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId, 18719 cacheMode, 18720 canUseCdn: isQuery2, 18721 signal: options.signal, 18722 fetch: options.fetch, 18723 useAbortSignal: options.useAbortSignal, 18724 useCdn: options.useCdn 18725 }; 18726 return _requestObservable(client, httpRequest, reqOptions).pipe( 18727 filter(isResponse), 18728 map(getBody), 18729 map((res) => { 18730 if (!isMutation) 18731 return res; 18732 const results = res.results || []; 18733 if (options.returnDocuments) 18734 return returnFirst ? results[0] && results[0].document : results.map((mut) => mut.document);
18735 const key = returnFirst ? "documentId" : "documentIds", ids = returnFirst ? results[0] && results[0].id : results.map((mut) => mut.id); 18736 return { 18737 transactionId: res.transactionId, 18738 results, 18739 [key]: ids 18740 }; 18741 }) 18742 ); 18743} 18744function _create(client, httpRequest, doc2, op, options = {}) { 18745 const mutation = { [op]: doc2 }, opts = Object.assign({ returnFirst: true, returnDocuments: true }, options); 18746 return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts); 18747} 18748const hasDataConfig = (client) => client.config().dataset !== void 0 && client.config().projectId !== void 0 || client.config()["~experimental_resource"] !== void 0, isQuery = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "query")), isMutate = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "mutate")), isDoc = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "doc", "")), isListener = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "listen")), isHistory = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "history", "")), isData = (client, uri) => uri.startsWith("/data/") || isQuery(client, uri) || isMutate(client, uri) || isDoc(client, uri) || isListener(client, uri) || isHistory(client, uri); 18749function _requestObservable(client, httpRequest, options) { 18750 const uri = options.url || options.uri, config2 = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isData(client, uri) : options.canUseCdn; 18751 let useCdn = (options.useCdn ?? config2.useCdn) && canUseCdn; 18752 const tag = options.tag && config2.requestTagPrefix ? [config2.requestTagPrefix, options.tag].join(".") : options.tag || config2.requestTagPrefix; 18753 if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && isQuery(client, uri)) { 18754 const resultSourceMap = options.resultSourceMap ?? config2.resultSourceMap; 18755 resultSourceMap !== void 0 && resultSourceMap !== false && (options.query = { resultSourceMap, ...options.query }); 18756 const perspectiveOption = options.perspective || config2.perspective; 18757 typeof perspectiveOption < "u" && (perspectiveOption === "previewDrafts" && printPreviewDraftsDeprecationWarning(), validateApiPerspective(perspectiveOption), options.query = { 18758 perspective: Array.isArray(perspectiveOption) ? perspectiveOption.join(",") : perspectiveOption, 18759 ...options.query 18760 }, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat 18761 perspectiveOption === "previewDrafts" || perspectiveOption === "drafts") && useCdn && (useCdn = false, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === false && (options.query = { returnQuery: "false", ...options.query }), useCdn && options.cacheMode == "noStale" && (options.query = { cacheMode: "noStale", ...options.query }); 18762 } 18763 const reqOptions = requestOptions( 18764 config2, 18765 Object.assign({}, options, { 18766 url: _getUrl(client, uri, useCdn) 18767 }) 18768 ), request = new Observable( 18769 (subscriber) => httpRequest(reqOptions, config2.requester).subscribe(subscriber) 18770 ); 18771 return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request; 18772} 18773function _request(client, httpRequest, options) { 18774 return _requestObservable(client, httpRequest, options).pipe( 18775 filter((event) => event.type === "response"), 18776 map((event) => event.body) 18777 ); 18778} 18779function _getDataUrl(client, operation, path) { 18780 const config2 = client.config(); 18781 if (config2["~experimental_resource"]) { 18782 resourceConfig(config2); 18783 const resourceBase = resourceDataBase(config2), uri2 = path !== void 0 ? `${operation}/${path}` : operation; 18784 return `${resourceBase}/${uri2}`.replace(/\/($|\?)/, "$1"); 18785 } 18786 const catalog = hasDataset(config2), baseUri = `/${operation}/${catalog}`; 18787 return `/data${path !== void 0 ? `${baseUri}/${path}` : baseUri}`.replace(/\/($|\?)/, "$1"); 18788} 18789function _getUrl(client, uri, canUseCdn = false) {
18790 const { url, cdnUrl } = client.config(); 18791 return `${canUseCdn ? cdnUrl : url}/${uri.replace(/^\//, "")}`; 18792} 18793function _withAbortSignal(signal) { 18794 return (input) => new Observable((observer) => { 18795 const abort = () => observer.error(_createAbortError(signal)); 18796 if (signal && signal.aborted) { 18797 abort(); 18798 return; 18799 } 18800 const subscription = input.subscribe(observer); 18801 return signal.addEventListener("abort", abort), () => { 18802 signal.removeEventListener("abort", abort), subscription.unsubscribe(); 18803 }; 18804 }); 18805} 18806const isDomExceptionSupported = !!globalThis.DOMException; 18807function _createAbortError(signal) { 18808 if (isDomExceptionSupported) 18809 return new DOMException((signal == null ? void 0 : signal.reason) ?? "The operation was aborted.", "AbortError"); 18810 const error = new Error((signal == null ? void 0 : signal.reason) ?? "The operation was aborted."); 18811 return error.name = "AbortError", error; 18812} 18813const resourceDataBase = (config2) => { 18814 if (!config2["~experimental_resource"]) 18815 throw new Error("`resource` must be provided to perform resource queries"); 18816 const { type, id } = config2["~experimental_resource"]; 18817 switch (type) { 18818 case "dataset": { 18819 const segments = id.split("."); 18820 if (segments.length !== 2) 18821 throw new Error('Dataset ID must be in the format "project.dataset"'); 18822 return `/projects/${segments[0]}/datasets/${segments[1]}`; 18823 } 18824 case "canvas": 18825 return `/canvases/${id}`; 18826 case "media-library": 18827 return `/media-libraries/${id}`; 18828 case "dashboard": 18829 return `/dashboards/${id}`; 18830 default: 18831 throw new Error(`Unsupported resource type: ${type.toString()}`); 18832 } 18833}; 18834function _generate(client, httpRequest, request) { 18835 const dataset2 = hasDataset(client.config()); 18836 return _request(client, httpRequest, { 18837 method: "POST", 18838 uri: `/agent/action/generate/${dataset2}`, 18839 body: request 18840 }); 18841} 18842function _transform(client, httpRequest, request) { 18843 const dataset2 = hasDataset(client.config()); 18844 return _request(client, httpRequest, { 18845 method: "POST", 18846 uri: `/agent/action/transform/${dataset2}`, 18847 body: request 18848 }); 18849} 18850function _translate(client, httpRequest, request) { 18851 const dataset2 = hasDataset(client.config()); 18852 return _request(client, httpRequest, { 18853 method: "POST", 18854 uri: `/agent/action/translate/${dataset2}`, 18855 body: request 18856 }); 18857} 18858class ObservableAgentsActionClient { 18859 constructor(client, httpRequest) { 18860 __privateAdd(this, _client5); 18861 __privateAdd(this, _httpRequest); 18862 __privateSet(this, _client5, client), __privateSet(this, _httpRequest, httpRequest); 18863 } 18864 /** 18865 * Run an instruction to generate content in a target document. 18866 * @param request - instruction request 18867 */ 18868 generate(request) { 18869 return _generate(__privateGet(this, _client5), __privateGet(this, _httpRequest), request); 18870 } 18871 /** 18872 * Transform a target document based on a source. 18873 * @param request - translation request 18874 */ 18875 transform(request) { 18876 return _transform(__privateGet(this, _client5), __privateGet(this, _httpRequest), request); 18877 } 18878 /** 18879 * Translate a target document based on a source. 18880 * @param request - translation request 18881 */ 18882 translate(request) { 18883 return _translate(__privateGet(this, _client5), __privateGet(this, _httpRequest), request); 18884 } 18885} 18886_client5 = new WeakMap(); 18887_httpRequest = new WeakMap(); 18888class AgentActionsClient { 18889 constructor(client, httpRequest) { 18890 __privateAdd(this, _client6); 18891 __privateAdd(this, _httpRequest2); 18892 __privateSet(this, _client6, client), __privateSet(this, _httpRequest2, httpRequest); 18893 } 18894 /** 18895 * Run an instruction to generate content in a target document. 18896 * @param request - instruction request 18897 */ 18898 generate(request) { 18899 return lastValueFrom(_generate(__privateGet(this, _client6), __privateGet(this, _httpRequest2), request)); 18900 } 18901 /** 18902 * Transform a target document based on a source. 18903 * @param request - translation request 18904 */ 18905 transform(request) { 18906 return lastValueFrom(_transform(__privateGet(this, _client6), __privateGet(this, _httpRequest2), request)); 18907 } 18908 /** 18909 * Translate a target document based on a source. 18910 * @param request - translation request 18911 */ 18912 translate(request) { 18913 return lastValueFrom(_translate(__privateGet(this, _client6), __privateGet(this, _httpRequest2), request)); 18914 } 18915} 18916_client6 = new WeakMap(); 18917_httpRequest2 = new WeakMap(); 18918class ObservableAssetsClient { 18919 constructor(client, httpRequest) { 18920 __privateAdd(this, _client7); 18921 __privateAdd(this, _httpRequest3); 18922 __privateSet(this, _client7, client), __privateSet(this, _httpRequest3, httpRequest); 18923 } 18924 upload(assetType, body, options) { 18925 return _upload(__privateGet(this, _client7), __privateGet(this, _httpRequest3), assetType, body, options); 18926 } 18927} 18928_client7 = new WeakMap(); 18929_httpRequest3 = new WeakMap(); 18930class AssetsClient { 18931 constructor(client, httpRequest) { 18932 __privateAdd(this, _client8); 18933 __privateAdd(this, _httpRequest4); 18934 __privateSet(this, _client8, client), __privateSet(this, _httpRequest4, httpRequest); 18935 } 18936 upload(assetType, body, options) { 18937 const observable2 = _upload(__privateGet(this, _client8), __privateGet(this, _httpRequest4), assetType, body, options); 18938 return lastValueFrom( 18939 observable2.pipe( 18940 filter((event) => event.type === "response"), 18941 map( 18942 (event) => event.body.document 18943 ) 18944 ) 18945 ); 18946 } 18947} 18948_client8 = new WeakMap(); 18949_httpRequest4 = new WeakMap(); 18950function _upload(client, httpRequest, assetType, body, opts = {}) { 18951 validateAssetType(assetType); 18952 let meta = opts.extract || void 0; 18953 meta && !meta.length && (meta = ["none"]); 18954 const config2 = client.config(), options = optionsFromFile(opts, body), { tag, label, title, description, creditLine, filename: filename2, source }
18954 = options, query = { 18955 label, 18956 title, 18957 description, 18958 filename: filename2, 18959 meta, 18960 creditLine 18961 }; 18962 return source && (query.sourceId = source.id, query.sourceName = source.name, query.sourceUrl = source.url), _requestObservable(client, httpRequest, { 18963 tag, 18964 method: "POST", 18965 timeout: options.timeout || 0, 18966 uri: buildAssetUploadUrl(config2, assetType), 18967 headers: options.contentType ? { "Content-Type": options.contentType } : {}, 18968 query, 18969 body 18970 }); 18971} 18972function buildAssetUploadUrl(config2, assetType) { 18973 const assetTypeEndpoint = assetType === "image" ? "images" : "files"; 18974 if (config2["~experimental_resource"]) { 18975 const { type, id } = config2["~experimental_resource"]; 18976 switch (type) { 18977 case "dataset": 18978 throw new Error( 18979 "Assets are not supported for dataset resources, yet. Configure the client with `{projectId: <projectId>, dataset: <datasetId>}` instead." 18980 ); 18981 case "canvas": 18982 return `/canvases/${id}/assets/${assetTypeEndpoint}`; 18983 case "media-library": 18984 return `/media-libraries/${id}/upload`; 18985 case "dashboard": 18986 return `/dashboards/${id}/assets/${assetTypeEndpoint}`; 18987 default: 18988 throw new Error(`Unsupported resource type: ${type.toString()}`); 18989 } 18990 } 18991 const dataset2 = hasDataset(config2); 18992 return `assets/${assetTypeEndpoint}/${dataset2}`; 18993} 18994function optionsFromFile(opts, file) { 18995 return typeof File > "u" || !(file instanceof File) ? opts : Object.assign( 18996 { 18997 filename: opts.preserveFilename === false ? void 0 : file.name, 18998 contentType: file.type 18999 }, 19000 opts 19001 ); 19002} 19003var defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj)).reduce((target, prop) => (target[prop] = typeof obj[prop] > "u" ? defaults2[prop] : obj[prop], target), {}); 19004const pick = (obj, props) =>
19004 props.reduce((selection, prop) => (typeof obj[prop] > "u" || (selection[prop] = obj[prop]), selection), {}), eventSourcePolyfill = defer(() => __vitePreload(() => import("./BOr1IfOc.js").then((n2) => n2.b), true ? __vite__mapDeps([23,3]) : void 0, import.meta.url)).pipe( 19005 map(({ default: EventSource2 }) => EventSource2), 19006 shareReplay(1) 19007); 19008function reconnectOnConnectionFailure() { 19009 return function(source) { 19010 return source.pipe( 19011 catchError((err, caught) => err instanceof ConnectionFailedError ? concat(of({ type: "reconnect" }), timer(1e3).pipe(mergeMap(() => caught))) : throwError(() => err)) 19012 ); 19013 }; 19014} 19015const MAX_URL_LENGTH = 14800, possibleOptions = [ 19016 "includePreviousRevision", 19017 "includeResult", 19018 "includeMutations", 19019 "includeAllVersions", 19020 "visibility", 19021 "effectFormat", 19022 "tag" 19023], defaultOptions = { 19024 includeResult: true 19025}; 19026function _listen(query, params, opts = {}) { 19027 const { url, token, withCredentials, requestTagPrefix } = this.config(), tag = opts.tag && requestTagPrefix ? [requestTagPrefix, opts.tag].join(".") : opts.tag, options = { ...defaults(opts, defaultOptions), tag }, listenOpts = pick(options, possibleOptions), qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } }), uri = `${url}${_getDataUrl(this, "listen", qs)}`; 19028 if (uri.length > MAX_URL_LENGTH) 19029 return throwError(() => new Error("Query too large for listener")); 19030 const listenFor = options.events ? options.events : ["mutation"], esOptions = {}; 19031 return withCredentials && (esOptions.withCredentials = true), token && (esOptions.headers = { 19032 Authorization: `Bearer ${token}` 19033 }), connectEventSource(() => ( 19034 // use polyfill if there is no global EventSource or if we need to set headers 19035 (typeof EventSource > "u" || esOptions.headers ? eventSourcePolyfill : of(EventSource)).pipe(map((EventSource2) => new EventSource2(uri, esOptions))) 19036 ), listenFor).pipe( 19037 reconnectOnConnectionFailure(), 19038 filter((event) => listenFor.includes(event.type)), 19039 map( 19040 (event) => ({ 19041 type: event.type, 19042 ..."data" in event ? event.data : {} 19043 }) 19044 ) 19045 ); 19046} 19047function shareReplayLatest(configOrPredicate, config2) { 19048 return _shareReplayLatest( 19049 typeof configOrPredicate == "function" ? { predicate: configOrPredicate, ...config2 } : configOrPredicate 19050 ); 19051} 19052function _shareReplayLatest(config2) { 19053 return (source) => { 19054 let latest, emitted = false; 19055 const { predicate, ...shareConfig } = config2, wrapped = source.pipe( 19056 tap((value) => { 19057 config2.predicate(value) && (emitted = true, latest = value); 19058 }), 19059 finalize(() => { 19060 emitted = false, latest = void 0; 19061 }), 19062 share(shareConfig) 19063 ), emitLatest = new Observable((subscriber) => { 19064 emitted && subscriber.next( 19065 // this cast is safe because of the emitted check which asserts that we got T from the source 19066 latest 19067 ), subscriber.complete(); 19068 }); 19069 return merge(wrapped, emitLatest); 19070 }; 19071} 19072const requiredApiVersion = "2021-03-25"; 19073class LiveClient { 19074 constructor(client) { 19075 __privateAdd(this, _client9); 19076 __privateSet(this, _client9, client); 19077 } 19078 /** 19079 * Requires `apiVersion` to be `2021-03-25` or later. 19080 */ 19081 events({ 19082 includeDrafts = false, 19083 tag: _tag 19084 } = {}) { 19085 resourceGuard("live", __privateGet(this, _client9).config()); 19086 const { 19087 projectId: projectId2, 19088 apiVersion: _apiVersion, 19089 token, 19090 withCredentials, 19091 requestTagPrefix 19092 } = __privateGet(this, _client9).config(), apiVersion = _apiVersion.replace(/^v/, ""); 19093 if (apiVersion !== "X" && apiVersion < requiredApiVersion) 19094 throw new Error( 19095 `The live events API requires API version ${requiredApiVersion} or later. The current API version is ${apiVersion}. Please update your API version to use this feature.` 19096 ); 19097 if (includeDrafts && !token && !withCredentials) 19098 throw new Error( 19099 "The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role." 19100 ); 19101 const path = _getDataUrl(__privateGet(this, _client9), "live/events"), url = new URL(__privateGet(this, _client9).getUrl(path, false)), tag = _tag && requestTagPrefix ? [requestTagPrefix, _tag].join(".") : _tag; 19102 tag && url.searchParams.set("tag", tag), includeDrafts && url.searchParams.set("includeDrafts", "true"); 19103 const esOptions = {}; 19104 includeDrafts && token && (esOptions.headers = { 19105 Authorization: `Bearer ${token}` 19106 }), includeDrafts && withCredentials && (esOptions.withCredentials = true);
19107 const key = `${url.href}::${JSON.stringify(esOptions)}`, existing = eventsCache.get(key); 19108 if (existing) 19109 return existing; 19110 const events = connectEventSource(() => ( 19111 // use polyfill if there is no global EventSource or if we need to set headers 19112 (typeof EventSource > "u" || esOptions.headers ? eventSourcePolyfill : of(EventSource)).pipe(map((EventSource2) => new EventSource2(url.href, esOptions))) 19113 ), [ 19114 "message", 19115 "restart", 19116 "welcome", 19117 "reconnect", 19118 "goaway" 19119 ]).pipe( 19120 reconnectOnConnectionFailure(), 19121 map((event) => { 19122 if (event.type === "message") { 19123 const { data, ...rest } = event; 19124 return { ...rest, tags: data.tags }; 19125 } 19126 return event; 19127 }) 19128 ), checkCors = fetchObservable(url, { 19129 method: "OPTIONS", 19130 mode: "cors", 19131 credentials: esOptions.withCredentials ? "include" : "omit", 19132 headers: esOptions.headers 19133 }).pipe( 19134 mergeMap(() => EMPTY), 19135 catchError(() => { 19136 throw new CorsOriginError({ projectId: projectId2 }); 19137 }) 19138 ), observable2 = concat(checkCors, events).pipe( 19139 finalize(() => eventsCache.delete(key)), 19140 shareReplayLatest({ 19141 predicate: (event) => event.type === "welcome" 19142 }) 19143 ); 19144 return eventsCache.set(key, observable2), observable2; 19145 } 19146} 19147_client9 = new WeakMap(); 19148function fetchObservable(url, init) { 19149 return new Observable((observer) => { 19150 const controller = new AbortController(), signal = controller.signal; 19151 return fetch(url, { ...init, signal: controller.signal }).then( 19152 (response) => { 19153 observer.next(response), observer.complete(); 19154 }, 19155 (err) => { 19156 signal.aborted || observer.error(err); 19157 } 19158 ), () => controller.abort(); 19159 }); 19160} 19161const eventsCache = /* @__PURE__ */ new Map(); 19162class ObservableDatasetsClient { 19163 constructor(client, httpRequest) { 19164 __privateAdd(this, _client10); 19165 __privateAdd(this, _httpRequest5); 19166 __privateSet(this, _client10, client), __privateSet(this, _httpRequest5, httpRequest); 19167 } 19168 /** 19169 * Create a new dataset with the given name 19170 * 19171 * @param name - Name of the dataset to create 19172 * @param options - Options for the dataset 19173 */ 19174 create(name, options) { 19175 return _modify(__privateGet(this, _client10), __privateGet(this, _httpRequest5), "PUT", name, options); 19176 } 19177 /** 19178 * Edit a dataset with the given name 19179 * 19180 * @param name - Name of the dataset to edit 19181 * @param options - New options for the dataset 19182 */ 19183 edit(name, options) { 19184 return _modify(__privateGet(this, _client10), __privateGet(this, _httpRequest5), "PATCH", name, options); 19185 } 19186 /** 19187 * Delete a dataset with the given name 19188 * 19189 * @param name - Name of the dataset to delete 19190 */ 19191 delete(name) { 19192 return _modify(__privateGet(this, _client10), __privateGet(this, _httpRequest5), "DELETE", name); 19193 } 19194 /** 19195 * Fetch a list of datasets for the configured project 19196 */ 19197 list() { 19198 return _request(__privateGet(this, _client10), __privateGet(this, _httpRequest5), { 19199 uri: "/datasets", 19200 tag: null 19201 }); 19202 } 19203} 19204_client10 = new WeakMap(); 19205_httpRequest5 = new WeakMap(); 19206class DatasetsClient { 19207 constructor(client, httpRequest) { 19208 __privateAdd(this, _client11); 19209 __privateAdd(this, _httpRequest6); 19210 __privateSet(this, _client11, client), __privateSet(this, _httpRequest6, httpRequest); 19211 } 19212 /** 19213 * Create a new dataset with the given name 19214 * 19215 * @param name - Name of the dataset to create 19216 * @param options - Options for the dataset 19217 */ 19218 create(name, options) { 19219 return resourceGuard("dataset", __privateGet(this, _client11).config()), lastValueFrom( 19220 _modify(__privateGet(this, _client11), __privateGet(this, _httpRequest6), "PUT", name, options) 19221 ); 19222 } 19223 /** 19224 * Edit a dataset with the given name 19225 * 19226 * @param name - Name of the dataset to edit 19227 * @param options - New options for the dataset 19228 */ 19229 edit(name, options) { 19230 return resourceGuard("dataset", __privateGet(this, _client11).config()), lastValueFrom( 19231 _modify(__privateGet(this, _client11), __privateGet(this, _httpRequest6), "PATCH", name, options) 19232 ); 19233 } 19234 /** 19235 * Delete a dataset with the given name 19236 * 19237 * @param name - Name of the dataset to delete
19238 */ 19239 delete(name) { 19240 return resourceGuard("dataset", __privateGet(this, _client11).config()), lastValueFrom(_modify(__privateGet(this, _client11), __privateGet(this, _httpRequest6), "DELETE", name)); 19241 } 19242 /** 19243 * Fetch a list of datasets for the configured project 19244 */ 19245 list() { 19246 return resourceGuard("dataset", __privateGet(this, _client11).config()), lastValueFrom( 19247 _request(__privateGet(this, _client11), __privateGet(this, _httpRequest6), { uri: "/datasets", tag: null }) 19248 ); 19249 } 19250} 19251_client11 = new WeakMap(); 19252_httpRequest6 = new WeakMap(); 19253function _modify(client, httpRequest, method, name, options) { 19254 return resourceGuard("dataset", client.config()), dataset(name), _request(client, httpRequest, { 19255 method, 19256 uri: `/datasets/${name}`, 19257 body: options, 19258 tag: null 19259 }); 19260} 19261class ObservableProjectsClient { 19262 constructor(client, httpRequest) { 19263 __privateAdd(this, _client12); 19264 __privateAdd(this, _httpRequest7); 19265 __privateSet(this, _client12, client), __privateSet(this, _httpRequest7, httpRequest); 19266 } 19267 list(options) { 19268 resourceGuard("projects", __privateGet(this, _client12).config()); 19269 const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects"; 19270 return _request(__privateGet(this, _client12), __privateGet(this, _httpRequest7), { uri }); 19271 } 19272 /** 19273 * Fetch a project by project ID 19274 * 19275 * @param projectId - ID of the project to fetch 19276 */ 19277 getById(projectId2) { 19278 return resourceGuard("projects", __privateGet(this, _client12).config()), _request(__privateGet(this, _client12), __privateGet(this, _httpRequest7), { uri: `/projects/${projectId2}` }); 19279 } 19280} 19281_client12 = new WeakMap(); 19282_httpRequest7 = new WeakMap(); 19283class ProjectsClient { 19284 constructor(client, httpRequest) { 19285 __privateAdd(this, _client13); 19286 __privateAdd(this, _httpRequest8); 19287 __privateSet(this, _client13, client), __privateSet(this, _httpRequest8, httpRequest); 19288 } 19289 list(options) { 19290 resourceGuard("projects", __privateGet(this, _client13).config()); 19291 const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects"; 19292 return lastValueFrom(_request(__privateGet(this, _client13), __privateGet(this, _httpRequest8), { uri })); 19293 } 19294 /** 19295 * Fetch a project by project ID 19296 * 19297 * @param projectId - ID of the project to fetch 19298 */ 19299 getById(projectId2) { 19300 return resourceGuard("projects", __privateGet(this, _client13).config()), lastValueFrom( 19301 _request(__privateGet(this, _client13), __privateGet(this, _httpRequest8), { uri: `/projects/${projectId2}` }) 19302 ); 19303 } 19304} 19305_client13 = new WeakMap(); 19306_httpRequest8 = new WeakMap(); 19307const generateReleaseId = customAlphabet( 19308 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 19309 8 19310), getDocumentVersionId = (publishedId, releaseId) => releaseId ? getVersionId(publishedId, releaseId) : getDraftId(publishedId); 19311function deriveDocumentVersionId(op, { 19312 releaseId, 19313 publishedId, 19314 document: document2 19315}) { 19316 if (publishedId && document2._id) { 19317 const versionId = getDocumentVersionId(publishedId, releaseId); 19318 return validateVersionIdMatch(versionId, document2), versionId; 19319 } 19320 if (document2._id) { 19321 const isDraft = isDraftId(document2._id), isVersion = isVersionId(document2._id); 19322 if (!isDraft && !isVersion) 19323 throw new Error( 19324 `\`${op}()\` requires a document with an \`_id\` that is a version or draft ID` 19325 ); 19326 if (releaseId) { 19327 if (isDraft) 19328 throw new Error( 19329 `\`${op}()\` was called with a document ID (\`${document2._id}\`) that is a draft ID, but a release ID (\`${releaseId}\`) was also provided.` 19330 ); 19331 const builtVersionId = getVersionFromId(document2._id); 19332 if (builtVersionId !== releaseId) 19333 throw new Error( 19334 `\`${op}()\` was called with a document ID (\`${document2._id}\`) that is a version ID, but the release ID (\`${releaseId}\`) does not match the document's version ID (\`${builtVersionId}\`).` 19335 ); 19336 } 19337 return document2._id; 19338 } 19339 if (publishedId) 19340 return getDocumentVersionId(publishedId, releaseId); 19341 throw new Error(`\`${op}()\` requires either a publishedId or a document with an \`_id\``); 19342} 19343const getArgs = (releaseOrOptions, maybeOptions) => { 19344 if (typeof releaseOrOptions == "object" && releaseOrOptions !== null && ("releaseId" in releaseOrOptions || "metadata" in releaseOrOptions)) { 19345 const { releaseId = generateReleaseId(), metadata = {} } = releaseOrOptions; 19346 return [releaseId, metadata, maybeOptions]; 19347 } 19348 return [generateReleaseId(), {}, releaseOrOptions]; 19349}, createRelease = (releaseOrOptions, maybeOptions) => { 19350 const [releaseId, metadata, options] = getArgs(releaseOrOptions, maybeOptions), finalMetadata = { 19351 ...metadata, 19352 releaseType: metadata.releaseType || "undecided" 19353 }; 19354 return { action: { 19355 actionType: "sanity.action.release.create", 19356 releaseId, 19357 metadata: finalMetadata 19358 }, options }; 19359}; 19360class ObservableReleasesClient { 19361 constructor(client, httpRequest) { 19362 __privateAdd(this, _client14); 19363 __privateAdd(this, _httpRequest9); 19364 __privateSet(this, _client14, client), __privateSet(this, _httpRequest9, httpRequest); 19365 } 19366 /** 19367 * @public 19368 * 19369 * Retrieve a release by id. 19370 * 19371 * @category Releases 19372 * 19373 * @param params - Release action parameters: 19374 * - `releaseId` - The id of the release to retrieve. 19375 * @param options - Additional query options including abort signal and query tag. 19376 * @returns An observable that resolves to the release document {@link ReleaseDocument}. 19377 * 19378 * @example Retrieving a release by id 19379 * ```ts 19380 * client.observable.releases.get({releaseId: 'my-release'}).pipe( 19381 * tap((release) => console.log(release)), 19382 * // { 19383 * // _id: '_.releases.my-release', 19384 * // name: 'my-release' 19385 * // _type: 'system.release', 19386 * // metadata: {releaseType: 'asap'}, 19387 * // _createdAt: '2021-01-01T00:00:00.000Z', 19388 * // ... 19389 * // } 19390 * ).subscribe() 19391 * ``` 19392 */ 19393 get({ releaseId }, options) { 19394 return _getDocument( 19395 __privateGet(this, _client14), 19396 __privateGet(this, _httpRequest9), 19397 `_.releases.${releaseId}`, 19398 options 19399 ); 19400 } 19401 create(releaseOrOptions, maybeOptions) { 19402 const { action, options } = createRelease(releaseOrOptions, maybeOptions), { releaseId, metadata } = action; 19403 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), action, options).pipe( 19404 map((actionResult) => ({ 19405 ...actionResult, 19406 releaseId, 19407 metadata 19408 })) 19409 ); 19410 } 19411 /** 19412 * @public 19413 * 19414 * Edits an existing release, updating the metadata. 19415 * 19416 * @category Releases 19417 * 19418 * @param params - Release action parameters: 19419 * - `releaseId` - The id of the release to edit. 19420 * - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}. 19421 * @param options - Additional action options. 19422 * @returns An observable that resolves to the `transactionId`. 19423 */ 19424 edit({ releaseId, patch }, options) { 19425 const editAction = { 19426 actionType: "sanity.action.release.edit", 19427 releaseId, 19428 patch 19429 }; 19430 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), editAction, options); 19431 } 19432 /** 19433 * @public 19434 * 19435 * Publishes all documents in a release at once. For larger releases the effect of the publish 19436 * will be visible immediately when querying but the removal of the `versions.<releasesId>.*` 19437 * documents and creation of the corresponding published documents with the new content may 19438 * take some time. 19439 * 19440 * During this period both the source and target documents are locked and cannot be 19441 * modified through any other means. 19442 * 19443 * @category Releases 19444 * 19445 * @param params - Release action parameters: 19446 * - `releaseId` - The id of the release to publish. 19447 * @param options - Additional action options. 19448 * @returns An observable that resolves to the `transactionId`. 19449 */ 19450 publish({ releaseId }, options) { 19451 const publishAction = { 19452 actionType: "sanity.action.release.publish", 19453 releaseId 19454 }; 19455 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), publishAction, options); 19456 } 19457 /** 19458 * @public 19459 * 19460 * An archive action removes an active release. The documents that comprise the release 19461 * are deleted and therefore no longer queryable. 19462 * 19463 * While the documents remain in retention the last version can still be accessed using document history endpoint. 19464 * 19465 * @category Releases 19466 * 19467 * @param params - Release action parameters: 19468 * - `releaseId` - The id of the release to archive. 19469 * @param options - Additional action options. 19470 * @returns An observable that resolves to the `transactionId`. 19471 */ 19472 archive({ releaseId }, options) { 19473 const archiveAction = { 19474 actionType: "sanity.action.release.archive", 19475 releaseId 19476 }; 19477 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), archiveAction, options); 19478 } 19479 /** 19480 * @public 19481 * 19482 * An unarchive action restores an archived release and all documents 19483 * with the content they had just prior to archiving. 19484 * 19485 * @category Releases 19486 * 19487 * @param params - Release action parameters: 19488 * - `releaseId` - The id of the release to unarchive. 19489 * @param options - Additional action options. 19490 * @returns An observable that resolves to the `transactionId`. 19491 */ 19492 unarchive({ releaseId }, options) { 19493 const unarchiveAction = { 19494 actionType: "sanity.action.release.unarchive", 19495 releaseId 19496 }; 19497 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), unarchiveAction, options); 19498 } 19499 /** 19500 * @public 19501 * 19502 * A schedule action queues a release for publishing at the given future time. 19503 * The release is locked such that no documents in the release can be modified and 19504 * no documents that it references can be deleted as this would make the publish fail. 19505 * At the given time, the same logic as for the publish action is triggered. 19506 * 19507 * @category Releases 19508 * 19509 * @param params - Release action parameters: 19510 * - `releaseId` - The id of the release to schedule.
19511 * - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately. 19512 * @param options - Additional action options. 19513 * @returns An observable that resolves to the `transactionId`. 19514 */ 19515 schedule({ releaseId, publishAt }, options) { 19516 const scheduleAction = { 19517 actionType: "sanity.action.release.schedule", 19518 releaseId, 19519 publishAt 19520 }; 19521 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), scheduleAction, options); 19522 } 19523 /** 19524 * @public 19525 * 19526 * An unschedule action stops a release from being published. 19527 * The documents in the release are considered unlocked and can be edited again. 19528 * This may fail if another release is scheduled to be published after this one and 19529 * has a reference to a document created by this one. 19530 * 19531 * @category Releases 19532 * 19533 * @param params - Release action parameters: 19534 * - `releaseId` - The id of the release to unschedule. 19535 * @param options - Additional action options. 19536 * @returns An observable that resolves to the `transactionId`. 19537 */ 19538 unschedule({ releaseId }, options) { 19539 const unscheduleAction = { 19540 actionType: "sanity.action.release.unschedule", 19541 releaseId 19542 }; 19543 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), unscheduleAction, options); 19544 } 19545 /** 19546 * @public 19547 * 19548 * A delete action removes a published or archived release. 19549 * The backing system document will be removed from the dataset. 19550 * 19551 * @category Releases 19552 * 19553 * @param params - Release action parameters: 19554 * - `releaseId` - The id of the release to delete. 19555 * @param options - Additional action options. 19556 * @returns An observable that resolves to the `transactionId`. 19557 */ 19558 delete({ releaseId }, options) { 19559 const deleteAction = { 19560 actionType: "sanity.action.release.delete", 19561 releaseId 19562 }; 19563 return _action(__privateGet(this, _client14), __privateGet(this, _httpRequest9), deleteAction, options); 19564 } 19565 /** 19566 * @public 19567 * 19568 * Fetch the documents in a release by release id. 19569 * 19570 * @category Releases 19571 * 19572 * @param params - Release action parameters: 19573 * - `releaseId` - The id of the release to fetch documents for. 19574 * @param options - Additional mutation options {@link BaseMutationOptions}. 19575 * @returns An observable that resolves to the documents in the release. 19576 */ 19577 fetchDocuments({ releaseId }, options) { 19578 return _getReleaseDocuments(__privateGet(this, _client14), __privateGet(this, _httpRequest9), releaseId, options); 19579 } 19580} 19581_client14 = new WeakMap(); 19582_httpRequest9 = new WeakMap(); 19583class ReleasesClient { 19584 constructor(client, httpRequest) { 19585 __privateAdd(this, _client15); 19586 __privateAdd(this, _httpRequest10); 19587 __privateSet(this, _client15, client), __privateSet(this, _httpRequest10, httpRequest); 19588 } 19589 /** 19590 * @public 19591 * 19592 * Retrieve a release by id. 19593 * 19594 * @category Releases 19595 * 19596 * @param params - Release action parameters: 19597 * - `releaseId` - The id of the release to retrieve. 19598 * @param options - Additional query options including abort signal and query tag. 19599 * @returns A promise that resolves to the release document {@link ReleaseDocument}. 19600 * 19601 * @example Retrieving a release by id 19602 * ```ts 19603 * const release = await client.releases.get({releaseId: 'my-release'}) 19604 * console.log(release) 19605 * // { 19606 * // _id: '_.releases.my-release', 19607 * // name: 'my-release' 19608 * // _type: 'system.release', 19609 * // metadata: {releaseType: 'asap'}, 19610 * // _createdAt: '2021-01-01T00:00:00.000Z', 19611 * // ... 19612 * // } 19613 * ``` 19614 */ 19615 get({ releaseId }, options) { 19616 return lastValueFrom( 19617 _getDocument( 19618 __privateGet(this, _client15), 19619 __privateGet(this, _httpRequest10), 19620 `_.releases.${releaseId}`, 19621 options 19622 ) 19623 ); 19624 } 19625 async create(releaseOrOptions, maybeOptions) { 19626 const { action, options } = createRelease(releaseOrOptions, maybeOptions), { releaseId, metadata } = action; 19627 return { ...await lastValueFrom( 19628 _action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), action, options) 19629 ), releaseId, metadata }; 19630 } 19631 /** 19632 * @public 19633 * 19634 * Edits an existing release, updating the metadata. 19635 * 19636 * @category Releases 19637 * 19638 * @param params - Release action parameters: 19639 * - `releaseId` - The id of the release to edit. 19640 * - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}. 19641 * @param options - Additional action options. 19642 * @returns A promise that resolves to the `transactionId`. 19643 */ 19644 edit({ releaseId, patch }, options) { 19645 const editAction = { 19646 actionType: "sanity.action.release.edit", 19647 releaseId, 19648 patch 19649 }; 19650 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), editAction, options)); 19651 } 19652 /** 19653 * @public 19654 * 19655 * Publishes all documents in a release at once. For larger releases the effect of the publish 19656 * will be visible immediately when querying but the removal of the `versions.<releasesId>.*` 19657 * documents and creation of the corresponding published documents with the new content may 19658 * take some time. 19659 * 19660 * During this period both the source and target documents are locked and cannot be 19661 * modified through any other means. 19662 * 19663 * @category Releases 19664 * 19665 * @param params - Release action parameters: 19666 * - `releaseId` - The id of the release to publish. 19667 * @param options - Additional action options. 19668 * @returns A promise that resolves to the `transactionId`. 19669 */ 19670 publish({ releaseId }, options) { 19671 const publishAction = { 19672 actionType: "sanity.action.release.publish", 19673 releaseId 19674 }; 19675 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), publishAction, options)); 19676 } 19677 /** 19678 * @public 19679 * 19680 * An archive action removes an active release. The documents that comprise the release 19681 * are deleted and therefore no longer queryable. 19682 * 19683 * While the documents remain in retention the last version can still be accessed using document history endpoint. 19684 * 19685 * @category Releases 19686 * 19687 * @param params - Release action parameters: 19688 * - `releaseId` - The id of the release to archive. 19689 * @param options - Additional action options. 19690 * @returns A promise that resolves to the `transactionId`. 19691 */ 19692 archive({ releaseId }, options) { 19693 const archiveAction = { 19694 actionType: "sanity.action.release.archive", 19695 releaseId 19696 }; 19697 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), archiveAction, options)); 19698 } 19699 /** 19700 * @public 19701 * 19702 * An unarchive action restores an archived release and all documents 19703 * with the content they had just prior to archiving. 19704 * 19705 * @category Releases 19706 * 19707 * @param params - Release action parameters: 19708 * - `releaseId` - The id of the release to unarchive. 19709 * @param options - Additional action options. 19710 * @returns A promise that resolves to the `transactionId`. 19711 */ 19712 unarchive({ releaseId }, options) { 19713 const unarchiveAction = { 19714 actionType: "sanity.action.release.unarchive", 19715 releaseId 19716 }; 19717 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), unarchiveAction, options)); 19718 } 19719 /** 19720 * @public 19721 * 19722 * A schedule action queues a release for publishing at the given future time. 19723 * The release is locked such that no documents in the release can be modified and 19724 * no documents that it references can be deleted as this would make the publish fail. 19725 * At the given time, the same logic as for the publish action is triggered. 19726 * 19727 * @category Releases 19728 * 19729 * @param params - Release action parameters: 19730 * - `releaseId` - The id of the release to schedule.
19731 * - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately. 19732 * @param options - Additional action options. 19733 * @returns A promise that resolves to the `transactionId`. 19734 */ 19735 schedule({ releaseId, publishAt }, options) { 19736 const scheduleAction = { 19737 actionType: "sanity.action.release.schedule", 19738 releaseId, 19739 publishAt 19740 }; 19741 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), scheduleAction, options)); 19742 } 19743 /** 19744 * @public 19745 * 19746 * An unschedule action stops a release from being published. 19747 * The documents in the release are considered unlocked and can be edited again. 19748 * This may fail if another release is scheduled to be published after this one and 19749 * has a reference to a document created by this one. 19750 * 19751 * @category Releases 19752 * 19753 * @param params - Release action parameters: 19754 * - `releaseId` - The id of the release to unschedule. 19755 * @param options - Additional action options. 19756 * @returns A promise that resolves to the `transactionId`. 19757 */ 19758 unschedule({ releaseId }, options) { 19759 const unscheduleAction = { 19760 actionType: "sanity.action.release.unschedule", 19761 releaseId 19762 }; 19763 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), unscheduleAction, options)); 19764 } 19765 /** 19766 * @public 19767 * 19768 * A delete action removes a published or archived release. 19769 * The backing system document will be removed from the dataset. 19770 * 19771 * @category Releases 19772 * 19773 * @param params - Release action parameters: 19774 * - `releaseId` - The id of the release to delete. 19775 * @param options - Additional action options. 19776 * @returns A promise that resolves to the `transactionId`. 19777 */ 19778 delete({ releaseId }, options) { 19779 const deleteAction = { 19780 actionType: "sanity.action.release.delete", 19781 releaseId 19782 }; 19783 return lastValueFrom(_action(__privateGet(this, _client15), __privateGet(this, _httpRequest10), deleteAction, options)); 19784 } 19785 /** 19786 * @public 19787 * 19788 * Fetch the documents in a release by release id. 19789 * 19790 * @category Releases 19791 * 19792 * @param params - Release action parameters: 19793 * - `releaseId` - The id of the release to fetch documents for. 19794 * @param options - Additional mutation options {@link BaseMutationOptions}. 19795 * @returns A promise that resolves to the documents in the release. 19796 */ 19797 fetchDocuments({ releaseId }, options) { 19798 return lastValueFrom(_getReleaseDocuments(__privateGet(this, _client15), __privateGet(this, _httpRequest10), releaseId, options)); 19799 } 19800} 19801_client15 = new WeakMap(); 19802_httpRequest10 = new WeakMap(); 19803class ObservableUsersClient { 19804 constructor(client, httpRequest) { 19805 __privateAdd(this, _client16); 19806 __privateAdd(this, _httpRequest11); 19807 __privateSet(this, _client16, client), __privateSet(this, _httpRequest11, httpRequest); 19808 } 19809 /** 19810 * Fetch a user by user ID 19811 * 19812 * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned. 19813 */ 19814 getById(id) { 19815 return _request( 19816 __privateGet(this, _client16), 19817 __privateGet(this, _httpRequest11), 19818 { uri: `/users/${id}` } 19819 ); 19820 } 19821} 19822_client16 = new WeakMap(); 19823_httpRequest11 = new WeakMap(); 19824class UsersClient { 19825 constructor(client, httpRequest) { 19826 __privateAdd(this, _client17); 19827 __privateAdd(this, _httpRequest12); 19828 __privateSet(this, _client17, client), __privateSet(this, _httpRequest12, httpRequest); 19829 } 19830 /** 19831 * Fetch a user by user ID 19832 * 19833 * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned. 19834 */ 19835 getById(id) { 19836 return lastValueFrom( 19837 _request(__privateGet(this, _client17), __privateGet(this, _httpRequest12), { 19838 uri: `/users/${id}` 19839 }) 19840 ); 19841 } 19842} 19843_client17 = new WeakMap(); 19844_httpRequest12 = new WeakMap(); 19845const _ObservableSanityClient = class _ObservableSanityClient { 19846 constructor(httpRequest, config2 = defaultConfig) { 19847 __publicField(this, "assets"); 19848 __publicField(this, "datasets"); 19849 __publicField(this, "live"); 19850 __publicField(this, "projects"); 19851 __publicField(this, "users"); 19852 __publicField(this, "agent"); 19853 __publicField(this, "releases"); 19854 /** 19855 * Private properties 19856 */ 19857 __privateAdd(this, _clientConfig); 19858 __privateAdd(this, _httpRequest13); 19859 /** 19860 * Instance properties 19861 */ 19862 __publicField(this, "listen", _listen); 19863 this.config(config2), __privateSet(this, _httpRequest13, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest13)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest13)), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest13)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest13)), this.agent = { 19864 action: new ObservableAgentsActionClient(this, __privateGet(this, _httpRequest13)) 19865 }, this.releases = new ObservableReleasesClient(this, __privateGet(this, _httpRequest13)); 19866 } 19867 /** 19868 * Clone the client - returns a new instance 19869 */ 19870 clone() { 19871 return new _ObservableSanityClient(__privateGet(this, _httpRequest13), this.config()); 19872 } 19873 config(newConfig) { 19874 if (newConfig === void 0) 19875 return { ...__privateGet(this, _clientConfig) }; 19876 if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === false) 19877 throw new Error( 19878 "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client" 19879 ); 19880 return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this; 19881 } 19882 /** 19883 * Clone the client with a new (partial) configuration. 19884 * 19885 * @param newConfig - New client configuration properties, shallowly merged with existing configuration 19886 */ 19887 withConfig(newConfig) { 19888 const thisConfig = this.config(); 19889 return new _ObservableSanityClient(__privateGet(this, _httpRequest13), { 19890 ...thisConfig, 19891 ...newConfig, 19892 stega: { 19893 ...thisConfig.stega || {}, 19894 ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {} 19895 } 19896 }); 19897 } 19898 fetch(query, params, options) { 19899 return _fetch( 19900 this, 19901 __privateGet(this, _httpRequest13), 19902 __privateGet(this, _clientConfig).stega, 19903 query, 19904 params, 19905 options 19906 ); 19907 } 19908 /** 19909 * Fetch a single document with the given ID. 19910 * 19911 * @param id - Document ID to fetch 19912 * @param options - Request options 19913 */ 19914 getDocument(id, options) { 19915 return _getDocument(this, __privateGet(this, _httpRequest13), id, options); 19916 } 19917 /** 19918 * Fetch multiple documents in one request. 19919 * Should be used sparingly - performing a query is usually a better option. 19920 * The order/position of documents is preserved based on the original array of IDs. 19921 * If any of the documents are missing, they will be replaced by a `null` entry in the returned array 19922 * 19923 * @param ids - Document IDs to fetch 19924 * @param options - Request options 19925 */ 19926 getDocuments(ids, options) { 19927 return _getDocuments(this, __privateGet(this, _httpRequest13), ids, options); 19928 } 19929 create(document2, options) { 19930 return _create(this, __privateGet(this, _httpRequest13), document2, "create", options); 19931 } 19932 createIfNotExists(document2, options) { 19933 return _createIfNotExists(this, __privateGet(this, _httpRequest13), document2, options); 19934 } 19935 createOrReplace(document2, options) { 19936 return _createOrReplace(this, __privateGet(this, _httpRequest13), document2, options); 19937 } 19938 createVersion({ 19939 document: document2, 19940 publishedId, 19941 releaseId 19942 }, options) { 19943 const documentVersionId = deriveDocumentVersionId("createVersion", { 19944 document: document2, 19945 publishedId, 19946 releaseId 19947 }), documentVersion = { ...document2, _id: documentVersionId }, versionPublishedId = publishedId || getPublishedId(document2._id); 19948 return _createVersion( 19949 this, 19950 __privateGet(this, _httpRequest13), 19951 documentVersion, 19952 versionPublishedId, 19953 options 19954 ); 19955 } 19956 delete(selection, options) { 19957 return _delete(this, __privateGet(this, _httpRequest13), selection, options); 19958 } 19959 /** 19960 * @public 19961 * 19962 * Deletes the draft or release version of a document. 19963 * 19964 * @remarks 19965 * * Discarding a version with no `releaseId` will discard the draft version of the published document. 19966 * * If the draft or release version does not exist, any error will throw. 19967 * 19968 * @param params - Version action parameters: 19969 * - `releaseId` - The ID of the release to discard the document from. 19970 * - `publishedId` - The published ID of the document to discard. 19971 * @param purge - if `true` the document history is also discarded. 19972 * @param options - Additional action options. 19973 * @returns an observable that resolves to the `transactionId`. 19974 * 19975 * @example Discarding a release version of a document 19976 * ```ts 19977 * client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'}) 19978 * // The document with the ID `versions.myRelease.myDocument` will be discarded. 19979 * ``` 19980 * 19981 * @example Discarding a draft version of a document 19982 * ```ts 19983 * client.observable.discardVersion({publishedId: 'myDocument'}) 19984 * // The document with the ID `drafts.myDocument` will be discarded. 19985 * ``` 19986 */ 19987 discardVersion({ releaseId, publishedId }, purge, options) { 19988 const documentVersionId = getDocumentVersionId(publishedId, releaseId); 19989 return _discardVersion(this, __privateGet(this, _httpRequest13), documentVersionId, purge, options); 19990 } 19991 replaceVersion({ 19992 document: document2, 19993 publishedId, 19994 releaseId 19995 }, options) { 19996 const documentVersionId = deriveDocumentVersionId("replaceVersion", { 19997 document: document2, 19998 publishedId, 19999 releaseId 20000 }), documentVersion = { ...document2, _id: documentVersionId }; 20001 return _replaceVersion(this, __privateGet(this, _httpRequest13), documentVersion, options); 20002 } 20003 /** 20004 * @public 20005 * 20006 * Used to indicate when a document within a release should be unpublished when 20007 * the release is run. 20008 * 20009 * @remarks 20010 * * If the published document does not exist, an error will be thrown. 20011 * 20012 * @param params - Version action parameters: 20013 * - `releaseId` - The ID of the release to unpublish the document from. 20014 * - `publishedId` - The published ID of the document to unpublish. 20015 * @param options - Additional action options. 20016 * @returns an observable that resolves to the `transactionId`. 20017 * 20018 * @example Unpublishing a release version of a published document 20019 * ```ts 20020 * client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'}) 20021 * // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run. 20022 * ``` 20023 */ 20024 unpublishVersion({ releaseId, publishedId }, options) { 20025 const versionId = getVersionId(publishedId, releaseId); 20026 return _unpublishVersion(this, __privateGet(this, _httpRequest13), versionId, publishedId, options); 20027 } 20028 mutate(operations, options) { 20029 return _mutate(this, __privateGet(this, _httpRequest13), operations, options); 20030 } 20031 /** 20032 * Create a new buildable patch of operations to perform 20033 * 20034 * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch 20035 * @param operations - Optional object of patch operations to initialize the patch instance with 20036 * @returns Patch instance - call `.commit()` to perform the operations defined 20037 */ 20038 patch(selection, operations) { 20039 return new ObservablePatch(selection, operations, this); 20040 } 20041 /** 20042 * Create a new transaction of mutations 20043 * 20044 * @param operations - Optional array of mutation operations to initialize the transaction instance with 20045 */ 20046 transaction(operations) { 20047 return new ObservableTransaction(operations, this); 20048 } 20049 /** 20050 * Perform action operations against the configured dataset 20051 * 20052 * @param operations - Action operation(s) to execute 20053 * @param options - Action options 20054 */ 20055 action(operations, options) { 20056 return _action(this, __privateGet(this, _httpRequest13), operations, options); 20057 } 20058 /** 20059 * Perform an HTTP request against the Sanity API 20060 * 20061 * @param options - Request options 20062 */ 20063 request(options) { 20064 return _request(this, __privateGet(this, _httpRequest13), options); 20065 } 20066 /** 20067 * Get a Sanity API URL for the URI provided 20068 *
20069 * @param uri - URI/path to build URL for 20070 * @param canUseCdn - Whether or not to allow using the API CDN for this route 20071 */ 20072 getUrl(uri, canUseCdn) { 20073 return _getUrl(this, uri, canUseCdn); 20074 } 20075 /** 20076 * Get a Sanity API URL for the data operation and path provided 20077 * 20078 * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar) 20079 * @param path - Path to append after the operation 20080 */ 20081 getDataUrl(operation, path) { 20082 return _getDataUrl(this, operation, path); 20083 } 20084}; 20085_clientConfig = new WeakMap(); 20086_httpRequest13 = new WeakMap(); 20087let ObservableSanityClient = _ObservableSanityClient; 20088const _SanityClient = class _SanityClient { 20089 constructor(httpRequest, config2 = defaultConfig) { 20090 __publicField(this, "assets"); 20091 __publicField(this, "datasets"); 20092 __publicField(this, "live"); 20093 __publicField(this, "projects"); 20094 __publicField(this, "users"); 20095 __publicField(this, "agent"); 20096 __publicField(this, "releases"); 20097 /** 20098 * Observable version of the Sanity client, with the same configuration as the promise-based one 20099 */ 20100 __publicField(this, "observable"); 20101 /** 20102 * Private properties 20103 */ 20104 __privateAdd(this, _clientConfig2); 20105 __privateAdd(this, _httpRequest14); 20106 /** 20107 * Instance properties 20108 */ 20109 __publicField(this, "listen", _listen); 20110 this.config(config2), __privateSet(this, _httpRequest14, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest14)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest14)), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest14)), this.users = new UsersClient(this, __privateGet(this, _httpRequest14)), this.agent = { 20111 action: new AgentActionsClient(this, __privateGet(this, _httpRequest14)) 20112 }, this.releases = new ReleasesClient(this, __privateGet(this, _httpRequest14)), this.observable = new ObservableSanityClient(httpRequest, config2); 20113 } 20114 /** 20115 * Clone the client - returns a new instance 20116 */ 20117 clone() { 20118 return new _SanityClient(__privateGet(this, _httpRequest14), this.config()); 20119 } 20120 config(newConfig) { 20121 if (newConfig === void 0) 20122 return { ...__privateGet(this, _clientConfig2) }; 20123 if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === false) 20124 throw new Error( 20125 "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client" 20126 ); 20127 return this.observable && this.observable.config(newConfig), __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {})), this; 20128 } 20129 /** 20130 * Clone the client with a new (partial) configuration. 20131 * 20132 * @param newConfig - New client configuration properties, shallowly merged with existing configuration 20133 */ 20134 withConfig(newConfig) { 20135 const thisConfig = this.config(); 20136 return new _SanityClient(__privateGet(this, _httpRequest14), { 20137 ...thisConfig, 20138 ...newConfig, 20139 stega: { 20140 ...thisConfig.stega || {}, 20141 ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {} 20142 } 20143 }); 20144 } 20145 fetch(query, params, options) { 20146 return lastValueFrom( 20147 _fetch( 20148 this, 20149 __privateGet(this, _httpRequest14), 20150 __privateGet(this, _clientConfig2).stega, 20151 query, 20152 params, 20153 options 20154 ) 20155 ); 20156 } 20157 /** 20158 * Fetch a single document with the given ID. 20159 * 20160 * @param id - Document ID to fetch 20161 * @param options - Request options 20162 */ 20163 getDocument(id, options) { 20164 return lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest14), id, options)); 20165 } 20166 /** 20167 * Fetch multiple documents in one request. 20168 * Should be used sparingly - performing a query is usually a better option. 20169 * The order/position of documents is preserved based on the original array of IDs. 20170 * If any of the documents are missing, they will be replaced by a `null` entry in the returned array 20171 * 20172 * @param ids - Document IDs to fetch 20173 * @param options - Request options 20174 */ 20175 getDocuments(ids, options) { 20176 return lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest14), ids, options)); 20177 } 20178 create(document2, options) { 20179 return lastValueFrom( 20180 _create(this, __privateGet(this, _httpRequest14), document2, "create", options) 20181 ); 20182 } 20183 createIfNotExists(document2, options) { 20184 return lastValueFrom( 20185 _createIfNotExists(this, __privateGet(this, _httpRequest14), document2, options) 20186 ); 20187 } 20188 createOrReplace(document2, options) { 20189 return lastValueFrom( 20190 _createOrReplace(this, __privateGet(this, _httpRequest14), document2, options) 20191 ); 20192 } 20193 createVersion({ 20194 document: document2, 20195 publishedId, 20196 releaseId 20197 }, options) { 20198 const documentVersionId = deriveDocumentVersionId("createVersion", { 20199 document: document2, 20200 publishedId, 20201 releaseId 20202 }), documentVersion = { ...document2, _id: documentVersionId }, versionPublishedId = publishedId || getPublishedId(document2._id); 20203 return firstValueFrom( 20204 _createVersion( 20205 this, 20206 __privateGet(this, _httpRequest14), 20207 documentVersion, 20208 versionPublishedId, 20209 options 20210 ) 20211 ); 20212 } 20213 delete(selection, options) { 20214 return lastValueFrom(_delete(this, __privateGet(this, _httpRequest14), selection, options)); 20215 } 20216 /** 20217 * @public 20218 * 20219 * Deletes the draft or release version of a document. 20220 * 20221 * @remarks 20222 * * Discarding a version with no `releaseId` will discard the draft version of the published document. 20223 * * If the draft or release version does not exist, any error will throw. 20224 * 20225 * @param params - Version action parameters: 20226 * - `releaseId` - The ID of the release to discard the document from. 20227 * - `publishedId` - The published ID of the document to discard. 20228 * @param purge - if `true` the document history is also discarded. 20229 * @param options - Additional action options. 20230 * @returns a promise that resolves to the `transactionId`. 20231 * 20232 * @example Discarding a release version of a document 20233 * ```ts 20234 * client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'}) 20235 * // The document with the ID `versions.myRelease.myDocument` will be discarded. 20236 * ``` 20237 * 20238 * @example Discarding a draft version of a document 20239 * ```ts 20240 * client.discardVersion({publishedId: 'myDocument'}) 20241 * // The document with the ID `drafts.myDocument` will be discarded. 20242 * ``` 20243 */ 20244 discardVersion({ releaseId, publishedId }, purge, options) { 20245 const documentVersionId = getDocumentVersionId(publishedId, releaseId); 20246 return lastValueFrom( 20247 _discardVersion(this, __privateGet(this, _httpRequest14), documentVersionId, purge, options) 20248 ); 20249 } 20250 replaceVersion({ 20251 document: document2, 20252 publishedId, 20253 releaseId 20254 }, options) { 20255 const documentVersionId = deriveDocumentVersionId("replaceVersion", { 20256 document: document2, 20257 publishedId, 20258 releaseId 20259 }), documentVersion = { ...document2, _id: documentVersionId }; 20260 return firstValueFrom( 20261 _replaceVersion(this, __privateGet(this, _httpRequest14), documentVersion, options) 20262 ); 20263 } 20264 /** 20265 * @public 20266 * 20267 * Used to indicate when a document within a release should be unpublished when 20268 * the release is run. 20269 * 20270 * @remarks 20271 * * If the published document does not exist, an error will be thrown. 20272 * 20273 * @param params - Version action parameters: 20274 * - `releaseId` - The ID of the release to unpublish the document from. 20275 * - `publishedId` - The published ID of the document to unpublish. 20276 * @param options - Additional action options. 20277 * @returns a promise that resolves to the `transactionId`. 20278 * 20279 * @example Unpublishing a release version of a published document 20280 * ```ts 20281 * await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'}) 20282 * // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run. 20283 * ``` 20284 */ 20285 unpublishVersion({ releaseId, publishedId }, options) { 20286 const versionId = getVersionId(publishedId, releaseId); 20287 return lastValueFrom( 20288 _unpublishVersion(this, __privateGet(this, _httpRequest14), versionId, publishedId, options) 20289 ); 20290 } 20291 mutate(operations, options) { 20292 return lastValueFrom(_mutate(this, __privateGet(this, _httpRequest14), operations, options)); 20293 } 20294 /** 20295 * Create a new buildable patch of operations to perform 20296 * 20297 * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch 20298 * @param operations - Optional object of patch operations to initialize the patch instance with 20299 * @returns Patch instance - call `.commit()` to perform the operations defined 20300 */ 20301 patch(documentId, operations) { 20302 return new Patch(documentId, operations, this); 20303 } 20304 /** 20305 * Create a new transaction of mutations 20306 * 20307 * @param operations - Optional array of mutation operations to initialize the transaction instance with 20308 */ 20309 transaction(operations) { 20310 return new Transaction(operations, this); 20311 } 20312 /** 20313 * Perform action operations against the configured dataset 20314 * Returns a promise that resolves to the transaction result 20315 * 20316 * @param operations - Action operation(s) to execute 20317 * @param options - Action options 20318 */ 20319 action(operations, options) { 20320 return lastValueFrom(_action(this, __privateGet(this, _httpRequest14), operations, options)); 20321 } 20322 /** 20323 * Perform a request against the Sanity API 20324 * NOTE: Only use this for Sanity API endpoints, not for your own APIs! 20325 * 20326 * @param options - Request options 20327 * @returns Promise resolving to the response body 20328 */ 20329 request(options) { 20330 return lastValueFrom(_request(this, __privateGet(this, _httpRequest14), options)); 20331 } 20332 /** 20333 * Perform an HTTP request a `/data` sub-endpoint 20334 * NOTE: Considered internal, thus marked as deprecated. Use `request` instead. 20335 * 20336 * @deprecated - Use `request()` or your own HTTP library instead 20337 * @param endpoint - Endpoint to hit (mutate, query etc) 20338 * @param body - Request body 20339 * @param options - Request options 20340 * @internal 20341 */ 20342 dataRequest(endpoint, body, options) { 20343 return lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest14), endpoint, body, options)); 20344 } 20345 /** 20346 * Get a Sanity API URL for the URI provided 20347 *
20348 * @param uri - URI/path to build URL for 20349 * @param canUseCdn - Whether or not to allow using the API CDN for this route 20350 */ 20351 getUrl(uri, canUseCdn) { 20352 return _getUrl(this, uri, canUseCdn); 20353 } 20354 /** 20355 * Get a Sanity API URL for the data operation and path provided 20356 * 20357 * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar) 20358 * @param path - Path to append after the operation 20359 */ 20360 getDataUrl(operation, path) { 20361 return _getDataUrl(this, operation, path); 20362 } 20363}; 20364_clientConfig2 = new WeakMap(); 20365_httpRequest14 = new WeakMap(); 20366let SanityClient = _SanityClient; 20367function defineCreateClientExports(envMiddleware2, ClassConstructor) { 20368 return { requester: defineHttpRequest(envMiddleware2), createClient: (config2) => { 20369 const clientRequester = defineHttpRequest(envMiddleware2); 20370 return new ClassConstructor( 20371 (options, requester2) => (requester2 || clientRequester)({ 20372 maxRedirects: 0, 20373 maxRetries: config2.maxRetries, 20374 retryDelay: config2.retryDelay, 20375 ...options 20376 }), 20377 config2 20378 ); 20379 } }; 20380} 20381var envMiddleware = []; 20382const exp = defineCreateClientExports(envMiddleware, SanityClient), createClient = exp.createClient; 20383const sanity_UVGjbsmU6He_QKSqt9goWNcJjGQleK6GPV_g1uufNqA = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => { 20384 const config2 = /* @__PURE__ */ useRuntimeConfig(); 20385 const client = createClient(config2.public.sanity); 20386 return { 20387 provide: { 20388 sanity: client 20389 } 20390 }; 20391}); 20392const plugins = [ 20393 payloadPlugin, 20394 revive_payload_client_kG4vF4SWGlhgLJRKrmco1O_zuG41odAu7e9PNPCDOtY, 20395 unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU, 20396 plugin$1, 20397 _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q, 20398 payload_client_kSYcIMYUswSDcSGoGWqM0MO2T4MjOZsQFA1GU6fqohM, 20399 navigation_repaint_client_iZ4sbIDUOBlI58WRS1dxkRZJOsKNs1c7SCqRszdxr6Y, 20400 check_outdated_build_client__GMdmUuNCTKDee9GyDhHz84CJEYUp5_FenYjvgAxtj8, 20401 chunk_reload_client_90gdG_aWZaDfO85SQYWzwaOywz7zi0wBnFUoX0cT54U, 20402 plugin, 20403 components_plugin_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4, 20404 prefetch_client_plc8Lsxh1X10IEwNhW7mxf0MabjBz64b9ODLi87nY5E, 20405 sanity_UVGjbsmU6He_QKSqt9goWNcJjGQleK6GPV_g1uufNqA 20406]; 20407function defaultEstimatedProgress(duration, elapsed) { 20408 const completionPercentage = elapsed / duration * 100; 20409 return 2 / Math.PI * 100 * Math.atan(completionPercentage / 50); 20410} 20411function createLoadingIndicator(opts = {}) { 20412 const { duration = 2e3, throttle = 200, hideDelay = 500, resetDelay = 400 } = opts; 20413 const getProgress = opts.estimatedProgress || defaultEstimatedProgress; 20414 const nuxtApp = useNuxtApp(); 20415 const progress = shallowRef(0); 20416 const isLoading = shallowRef(false); 20417 const error = shallowRef(false); 20418 let done = false; 20419 let rafId; 20420 let throttleTimeout; 20421 let hideTimeout; 20422 let resetTimeout; 20423 const start = (opts2 = {}) => { 20424 _clearTimeouts(); 20425 error.value = false; 20426 set(0, opts2); 20427 }; 20428 function set(at = 0, opts2 = {}) { 20429 if (nuxtApp.isHydrating) { 20430 return; 20431 } 20432 if (at >= 100) { 20433 return finish({ force: opts2.force }); 20434 } 20435 clear(); 20436 progress.value = at < 0 ? 0 : at; 20437 const throttleTime = opts2.force ? 0 : throttle; 20438 if (throttleTime && true) { 20439 throttleTimeout = setTimeout(() => { 20440 isLoading.value = true; 20441 _startProgress(); 20442 }, throttleTime); 20443 } else { 20444 isLoading.value = true; 20445 _startProgress(); 20446 } 20447 } 20448 function _hide() { 20449 { 20450 hideTimeout = setTimeout(() => { 20451 isLoading.value = false; 20452 resetTimeout = setTimeout(() => { 20453 progress.value = 0; 20454 }, resetDelay); 20455 }, hideDelay); 20456 } 20457 } 20458 function finish(opts2 = {}) { 20459 progress.value = 100; 20460 done = true; 20461 clear(); 20462 _clearTimeouts(); 20463 if (opts2.error) { 20464 error.value = true; 20465 } 20466 if (opts2.force) { 20467 progress.value = 0; 20468 isLoading.value = false; 20469 } else { 20470 _hide(); 20471 } 20472 } 20473 function _clearTimeouts() { 20474 { 20475 clearTimeout(hideTimeout); 20476 clearTimeout(resetTimeout); 20477 } 20478 } 20479 function clear() { 20480 { 20481 clearTimeout(throttleTimeout); 20482 cancelAnimationFrame(rafId); 20483 } 20484 } 20485 function _startProgress() { 20486 done = false;
20487 let startTimeStamp; 20488 function step(timeStamp) { 20489 if (done) { 20490 return; 20491 } 20492 startTimeStamp ?? (startTimeStamp = timeStamp); 20493 const elapsed = timeStamp - startTimeStamp; 20494 progress.value = Math.max(0, Math.min(100, getProgress(duration, elapsed))); 20495 { 20496 rafId = requestAnimationFrame(step); 20497 } 20498 } 20499 { 20500 rafId = requestAnimationFrame(step); 20501 } 20502 } 20503 let _cleanup = () => { 20504 }; 20505 { 20506 const unsubLoadingStartHook = nuxtApp.hook("page:loading:start", () => { 20507 start(); 20508 }); 20509 const unsubLoadingFinishHook = nuxtApp.hook("page:loading:end", () => { 20510 finish(); 20511 }); 20512 const unsubError = nuxtApp.hook("vue:error", () => finish()); 20513 _cleanup = () => { 20514 unsubError(); 20515 unsubLoadingStartHook(); 20516 unsubLoadingFinishHook(); 20517 clear(); 20518 }; 20519 } 20520 return { 20521 _cleanup, 20522 progress: computed(() => progress.value), 20523 isLoading: computed(() => isLoading.value), 20524 error: computed(() => error.value), 20525 start, 20526 set, 20527 finish, 20528 clear 20529 }; 20530} 20531function useLoadingIndicator(opts = {}) { 20532 const nuxtApp = useNuxtApp(); 20533 const indicator = nuxtApp._loadingIndicator || (nuxtApp._loadingIndicator = createLoadingIndicator(opts)); 20534 if (getCurrentScope()) { 20535 nuxtApp._loadingIndicatorDeps || (nuxtApp._loadingIndicatorDeps = 0); 20536 nuxtApp._loadingIndicatorDeps++; 20537 onScopeDispose(() => { 20538 nuxtApp._loadingIndicatorDeps--; 20539 if (nuxtApp._loadingIndicatorDeps === 0) { 20540 indicator._cleanup(); 20541 delete nuxtApp._loadingIndicator; 20542 } 20543 }); 20544 } 20545 return indicator; 20546} 20547const __nuxt_component_0 = /* @__PURE__ */ defineComponent({ 20548 name: "NuxtLoadingIndicator", 20549 props: { 20550 throttle: { 20551 type: Number, 20552 default: 200 20553 }, 20554 duration: { 20555 type: Number, 20556 default: 2e3 20557 }, 20558 hideDelay: { 20559 type: Number, 20560 default: 500 20561 }, 20562 resetDelay: { 20563 type: Number, 20564 default: 400 20565 }, 20566 height: { 20567 type: Number, 20568 default: 3 20569 }, 20570 color: { 20571 type: [String, Boolean], 20572 default: "repeating-linear-gradient(to right,#00dc82 0%,#34cdfe 50%,#0047e1 100%)" 20573 }, 20574 errorColor: { 20575 type: String, 20576 default: "repeating-linear-gradient(to right,#f87171 0%,#ef4444 100%)" 20577 }, 20578 estimatedProgress: { 20579 type: Function, 20580 required: false 20581 } 20582 }, 20583 setup(props, { slots, expose }) { 20584 const { progress, isLoading, error, start, finish, clear } = useLoadingIndicator({ 20585 duration: props.duration, 20586 throttle: props.throttle, 20587 hideDelay: props.hideDelay, 20588 resetDelay: props.resetDelay, 20589 estimatedProgress: props.estimatedProgress 20590 }); 20591 expose({ 20592 progress, 20593 isLoading, 20594 error, 20595 start, 20596 finish, 20597 clear 20598 }); 20599 return () => h$1("div", { 20600 class: "nuxt-loading-indicator", 20601 style: { 20602 position: "fixed", 20603 top: 0, 20604 right: 0, 20605 left: 0, 20606 pointerEvents: "none", 20607 width: "auto", 20608 height: `${props.height}px`, 20609 opacity: isLoading.value ? 1 : 0, 20610 background: error.value ? props.errorColor : props.color || void 0, 20611 backgroundSize: `${100 / progress.value * 100}% auto`, 20612 transform: `scaleX(${progress.value}%)`, 20613 transformOrigin: "left", 20614 transition: "transform 0.1s, height 0.4s, opacity 0.4s", 20615 zIndex: 999999 20616 } 20617 }, slots); 20618 } 20619}); 20620const defineRouteProvider = (name = "RouteProvider") => /* @__PURE__ */ defineComponent({ 20621 name, 20622 props: { 20623 vnode: { 20624 type: Object, 20625 required: true 20626 }, 20627 route: { 20628 type: Object, 20629 required: true 20630 }, 20631 vnodeRef: Object, 20632 renderKey: String, 20633 trackRootNodes: Boolean 20634 }, 20635 setup(props) { 20636 const previousKey = props.renderKey; 20637 const previousRoute = props.route; 20638 const route = {}; 20639 for (const key in props.route) { 20640 Object.defineProperty(route, key, { 20641 get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key], 20642 enumerable: true 20643 }); 20644 } 20645 provide(PageRouteSymbol, shallowReactive(route)); 20646 return () => { 20647 return h$1(props.vnode, { ref: props.vnodeRef }); 20648 }; 20649 } 20650}); 20651const RouteProvider = defineRouteProvider(); 20652const _routeProviders = /* @__PURE__ */ new WeakMap(); 20653const __nuxt_component_1 = /* @__PURE__ */ defineComponent({ 20654 name: "NuxtPage", 20655 inheritAttrs: false, 20656 props: { 20657 name: { 20658 type: String 20659 }, 20660 transition: { 20661 type: [Boolean, Object], 20662 default: void 0 20663 }, 20664 keepalive: { 20665 type: [Boolean, Object], 20666 default: void 0 20667 }, 20668 route: { 20669 type: Object 20670 }, 20671 pageKey: { 20672 type: [Function, String], 20673 default: null 20674 } 20675 }, 20676 setup(props, { attrs, slots, expose }) { 20677 const nuxtApp = useNuxtApp(); 20678 const pageRef = ref(); 20679 const forkRoute = inject(PageRouteSymbol, null); 20680 let previousPageKey; 20681 expose({ pageRef }); 20682 const _layoutMeta = inject(LayoutMetaSymbol, null); 20683 let vnode; 20684 const done = nuxtApp.deferHydration(); 20685 if (nuxtApp.isHydrating) { 20686 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", done); 20687 useRouter().beforeEach(removeErrorHook); 20688 } 20689 if (props.pageKey) { 20690 watch(() => props.pageKey, (next, prev) => { 20691 if (next !== prev) { 20692 nuxtApp.callHook("page:loading:start"); 20693 } 20694 }); 20695 } 20696 let pageLoadingEndHookAlreadyCalled = false;
20697 { 20698 const unsub = useRouter().beforeResolve(() => { 20699 pageLoadingEndHookAlreadyCalled = false; 20700 }); 20701 onBeforeUnmount(() => { 20702 unsub(); 20703 }); 20704 } 20705 return () => { 20706 return h$1(RouterView, { name: props.name, route: props.route, ...attrs }, { 20707 default: (routeProps) => { 20708 const isRenderingNewRouteInOldFork = haveParentRoutesRendered(forkRoute, routeProps.route, routeProps.Component); 20709 const hasSameChildren = forkRoute && forkRoute.matched.length === routeProps.route.matched.length; 20710 if (!routeProps.Component) { 20711 if (vnode && !hasSameChildren) { 20712 return vnode; 20713 } 20714 done(); 20715 return; 20716 } 20717 if (vnode && _layoutMeta && !_layoutMeta.isCurrent(routeProps.route)) { 20718 return vnode; 20719 } 20720 if (isRenderingNewRouteInOldFork && forkRoute && (!_layoutMeta || (_layoutMeta == null ? void 0 : _layoutMeta.isCurrent(forkRoute)))) { 20721 if (hasSameChildren) { 20722 return vnode; 20723 } 20724 return null; 20725 } 20726 const key = generateRouteKey$1(routeProps, props.pageKey); 20727 const willRenderAnotherChild = hasChildrenRoutes(forkRoute, routeProps.route, routeProps.Component); 20728 if (!nuxtApp.isHydrating && previousPageKey === key && !willRenderAnotherChild) { 20729 nextTick(() => { 20730 pageLoadingEndHookAlreadyCalled = true; 20731 nuxtApp.callHook("page:loading:end"); 20732 }); 20733 } 20734 previousPageKey = key; 20735 const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? appPageTransition); 20736 const transitionProps = hasTransition && _mergeTransitionProps([ 20737 props.transition, 20738 routeProps.route.meta.pageTransition, 20739 appPageTransition, 20740 { 20741 onBeforeLeave() { 20742 nuxtApp._runningTransition = true; 20743 }, 20744 onAfterLeave() { 20745 delete nuxtApp._runningTransition; 20746 nuxtApp.callHook("page:transition:finish", routeProps.Component); 20747 } 20748 } 20749 ]); 20750 const keepaliveConfig = props.keepalive ?? routeProps.route.meta.keepalive ?? appKeepalive; 20751 vnode = _wrapInTransition( 20752 hasTransition && transitionProps, 20753 wrapInKeepAlive( 20754 keepaliveConfig, 20755 h$1(Suspense, { 20756 suspensible: true, 20757 onPending: () => nuxtApp.callHook("page:start", routeProps.Component), 20758 onResolve: () => { 20759 nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => { 20760 if (!pageLoadingEndHookAlreadyCalled && !willRenderAnotherChild) { 20761 pageLoadingEndHookAlreadyCalled = true; 20762 return nuxtApp.callHook("page:loading:end"); 20763 } 20764 }).finally(done)); 20765 } 20766 }, { 20767 default: () => { 20768 const routeProviderProps = { 20769 key: key || void 0, 20770 vnode: slots.default ? normalizeSlot(slots.default, routeProps) : routeProps.Component, 20771 route: routeProps.route, 20772 renderKey: key || void 0, 20773 trackRootNodes: hasTransition, 20774 vnodeRef: pageRef 20775 }; 20776 if (!keepaliveConfig) { 20777 return h$1(RouteProvider, routeProviderProps); 20778 } 20779 const routerComponentType = routeProps.Component.type; 20780 const routeProviderKey = routerComponentType; 20781 let PageRouteProvider = _routeProviders.get(routeProviderKey); 20782 if (!PageRouteProvider) { 20783 PageRouteProvider = defineRouteProvider(routerComponentType.name || routerComponentType.__name); 20784 _routeProviders.set(routeProviderKey, PageRouteProvider); 20785 } 20786 return h$1(PageRouteProvider, routeProviderProps); 20787 } 20788 }) 20789 ) 20790 ).default(); 20791 return vnode; 20792 } 20793 }); 20794 }; 20795 } 20796}); 20797function _mergeTransitionProps(routeProps) {
20798 const _props = routeProps.filter(Boolean).map((prop) => ({ 20799 ...prop, 20800 onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0 20801 })); 20802 return defu(..._props); 20803} 20804function haveParentRoutesRendered(fork, newRoute, Component) { 20805 if (!fork) { 20806 return false; 20807 } 20808 const index = newRoute.matched.findIndex((m) => { 20809 var _a3; 20810 return ((_a3 = m.components) == null ? void 0 : _a3.default) === (Component == null ? void 0 : Component.type); 20811 }); 20812 if (!index || index === -1) { 20813 return false; 20814 } 20815 return newRoute.matched.slice(0, index).some( 20816 (c2, i2) => { 20817 var _a3, _b, _c; 20818 return ((_a3 = c2.components) == null ? void 0 : _a3.default) !== ((_c = (_b = fork.matched[i2]) == null ? void 0 : _b.components) == null ? void 0 : _c.default); 20819 } 20820 ) || Component && generateRouteKey$1({ route: newRoute, Component }) !== generateRouteKey$1({ route: fork, Component }); 20821} 20822function hasChildrenRoutes(fork, newRoute, Component) { 20823 if (!fork) { 20824 return false; 20825 } 20826 const index = newRoute.matched.findIndex((m) => { 20827 var _a3; 20828 return ((_a3 = m.components) == null ? void 0 : _a3.default) === (Component == null ? void 0 : Component.type); 20829 }); 20830 return index < newRoute.matched.length - 1; 20831} 20832function normalizeSlot(slot, data) { 20833 const slotContent = slot(data); 20834 return slotContent.length === 1 ? h$1(slotContent[0]) : h$1(Fragment, void 0, slotContent); 20835} 20836const LayoutLoader = /* @__PURE__ */ defineComponent({ 20837 name: "LayoutLoader", 20838 inheritAttrs: false, 20839 props: { 20840 name: String, 20841 layoutProps: Object 20842 }, 20843 setup(props, context) { 20844 return () => h$1(layouts[props.name], props.layoutProps, context.slots); 20845 } 20846}); 20847const nuxtLayoutProps = { 20848 name: { 20849 type: [String, Boolean, Object], 20850 default: null 20851 }, 20852 fallback: { 20853 type: [String, Object], 20854 default: null 20855 } 20856}; 20857const __nuxt_component_2 = /* @__PURE__ */ defineComponent({ 20858 name: "NuxtLayout", 20859 inheritAttrs: false, 20860 props: nuxtLayoutProps, 20861 setup(props, context) { 20862 const nuxtApp = useNuxtApp(); 20863 const injectedRoute = inject(PageRouteSymbol); 20864 const route = injectedRoute === useRoute$1() ? useRoute() : injectedRoute; 20865 const layout = computed(() => { 20866 let layout2 = unref(props.name) ?? route.meta.layout ?? "default"; 20867 if (layout2 && !(layout2 in layouts)) { 20868 if (props.fallback) { 20869 layout2 = unref(props.fallback); 20870 } 20871 } 20872 return layout2; 20873 }); 20874 const layoutRef = ref(); 20875 context.expose({ layoutRef }); 20876 const done = nuxtApp.deferHydration(); 20877 if (nuxtApp.isHydrating) { 20878 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", done); 20879 useRouter().beforeEach(removeErrorHook); 20880 } 20881 return () => { 20882 const hasLayout = layout.value && layout.value in layouts; 20883 const transitionProps = route.meta.layoutTransition ?? appLayoutTransition; 20884 return _wrapInTransition(hasLayout && transitionProps, { 20885 default: () => h$1(Suspense, { suspensible: true, onResolve: () => { 20886 nextTick(done); 20887 } }, { 20888 default: () => h$1( 20889 LayoutProvider, 20890 { 20891 layoutProps: mergeProps(context.attrs, { ref: layoutRef }), 20892 key: layout.value || void 0, 20893 name: layout.value, 20894 shouldProvide: !props.name, 20895 hasTransition: !!transitionProps 20896 }, 20897 context.slots 20898 ) 20899 }) 20900 }).default(); 20901 }; 20902 } 20903}); 20904const LayoutProvider = /* @__PURE__ */ defineComponent({ 20905 name: "NuxtLayoutProvider", 20906 inheritAttrs: false, 20907 props: { 20908 name: { 20909 type: [String, Boolean] 20910 }, 20911 layoutProps: { 20912 type: Object 20913 }, 20914 hasTransition: { 20915 type: Boolean 20916 }, 20917 shouldProvide: { 20918 type: Boolean 20919 } 20920 }, 20921 setup(props, context) { 20922 const name = props.name; 20923 if (props.shouldProvide) { 20924 provide(LayoutMetaSymbol, { 20925 isCurrent: (route) => name === (route.meta.layout ?? "default") 20926 }); 20927 } 20928 return () => { 20929 var _a3, _b; 20930 if (!name || typeof name === "string" && !(name in layouts)) { 20931 return (_b = (_a3 = context.slots).default) == null ? void 0 : _b.call(_a3); 20932 } 20933 return h$1( 20934 LayoutLoader, 20935 { key: name, layoutProps: props.layoutProps, name }, 20936 context.slots 20937 ); 20938 }; 20939 } 20940}); 20941const HeadComponentCtxSymbol = Symbol("head-component"); 20942const TagPositionProps = { 20943 /** 20944 * @deprecated Use tagPosition 20945 */ 20946 body: { type: Boolean, default: void 0 }, 20947 tagPosition: { type: String } 20948}; 20949const normalizeProps = (_props) => { 20950 const props = Object.fromEntries( 20951 Object.entries(_props).filter(([_2, value]) => value !== void 0) 20952 ); 20953 if (typeof props.body !== "undefined") { 20954 props.tagPosition = props.body ? "bodyClose" : "head"; 20955 }
20956 if (typeof props.renderPriority !== "undefined") { 20957 props.tagPriority = props.renderPriority; 20958 } 20959 return props; 20960}; 20961function useHeadComponentCtx() { 20962 return inject(HeadComponentCtxSymbol, createHeadComponentCtx, true); 20963} 20964function createHeadComponentCtx() { 20965 const prev = inject(HeadComponentCtxSymbol, null); 20966 if (prev) { 20967 return prev; 20968 } 20969 const input = reactive({}); 20970 const entry2 = useHead(input); 20971 const ctx = { input, entry: entry2 }; 20972 provide(HeadComponentCtxSymbol, ctx); 20973 return ctx; 20974} 20975const globalProps = { 20976 accesskey: String, 20977 autocapitalize: String, 20978 autofocus: { 20979 type: Boolean, 20980 default: void 0 20981 }, 20982 class: { type: [String, Object, Array], default: void 0 }, 20983 contenteditable: { 20984 type: Boolean, 20985 default: void 0 20986 }, 20987 contextmenu: String, 20988 dir: String, 20989 draggable: { 20990 type: Boolean, 20991 default: void 0 20992 }, 20993 enterkeyhint: String, 20994 exportparts: String, 20995 hidden: { 20996 type: Boolean, 20997 default: void 0 20998 }, 20999 id: String, 21000 inputmode: String, 21001 is: String, 21002 itemid: String, 21003 itemprop: String, 21004 itemref: String, 21005 itemscope: String, 21006 itemtype: String, 21007 lang: String, 21008 nonce: String, 21009 part: String, 21010 slot: String, 21011 spellcheck: { 21012 type: Boolean, 21013 default: void 0 21014 }, 21015 style: { type: [String, Object, Array], default: void 0 }, 21016 tabindex: String, 21017 title: String, 21018 translate: String, 21019 /** 21020 * @deprecated Use tagPriority 21021 */ 21022 renderPriority: [String, Number], 21023 /** 21024 * Unhead prop to modify the priority of the tag. 21025 */ 21026 tagPriority: { type: [String, Number] } 21027}; 21028/* @__PURE__ */ defineComponent({ 21029 name: "NoScript", 21030 inheritAttrs: false, 21031 props: { 21032 ...globalProps, 21033 ...TagPositionProps, 21034 title: String 21035 }, 21036 setup(props, { slots }) { 21037 const { input } = useHeadComponentCtx(); 21038 input.noscript || (input.noscript = []); 21039 const idx = input.noscript.push({}) - 1; 21040 onUnmounted(() => input.noscript[idx] = null); 21041 return () => { 21042 var _a3; 21043 const noscript = normalizeProps(props); 21044 const slotVnodes = (_a3 = slots.default) == null ? void 0 : _a3.call(slots); 21045 const textContent = slotVnodes ? slotVnodes.filter(({ children }) => children).map(({ children }) => children).join("") : ""; 21046 if (textContent) { 21047 noscript.innerHTML = textContent; 21048 } 21049 input.noscript[idx] = noscript; 21050 return null; 21051 }; 21052 } 21053}); 21054/* @__PURE__ */ defineComponent({ 21055 name: "Link", 21056 inheritAttrs: false, 21057 props: { 21058 ...globalProps, 21059 ...TagPositionProps, 21060 as: String, 21061 crossorigin: String, 21062 disabled: Boolean, 21063 fetchpriority: String, 21064 href: String, 21065 hreflang: String, 21066 imagesizes: String, 21067 imagesrcset: String, 21068 integrity: String, 21069 media: String, 21070 prefetch: { 21071 type: Boolean, 21072 default: void 0 21073 }, 21074 referrerpolicy: String, 21075 rel: String, 21076 sizes: String, 21077 title: String, 21078 type: String, 21079 /** @deprecated **/ 21080 methods: String, 21081 /** @deprecated **/ 21082 target: String 21083 }, 21084 setup(props) { 21085 const { input } = useHeadComponentCtx(); 21086 input.link || (input.link = []); 21087 const idx = input.link.push({}) - 1; 21088 onUnmounted(() => input.link[idx] = null); 21089 return () => { 21090 input.link[idx] = normalizeProps(props); 21091 return null; 21092 }; 21093 } 21094}); 21095/* @__PURE__ */ defineComponent({ 21096 name: "Base", 21097 inheritAttrs: false, 21098 props: { 21099 ...globalProps, 21100 href: String, 21101 target: String 21102 }, 21103 setup(props) { 21104 const { input } = useHeadComponentCtx(); 21105 onUnmounted(() => input.base = null); 21106 return () => { 21107 input.base = normalizeProps(props); 21108 return null; 21109 }; 21110 } 21111}); 21112/* @__PURE__ */ defineComponent({ 21113 name: "Meta", 21114 inheritAttrs: false, 21115 props: { 21116 ...globalProps, 21117 charset: String, 21118 content: String, 21119 httpEquiv: String, 21120 name: String, 21121 property: String 21122 }, 21123 setup(props) { 21124 const { input } = useHeadComponentCtx(); 21125 input.meta || (input.meta = []); 21126 const idx = input.meta.push({}) - 1; 21127 onUnmounted(() => input.meta[idx] = null); 21128 return () => { 21129 const meta = { "http-equiv": props.httpEquiv, ...normalizeProps(props) }; 21130 if ("httpEquiv" in meta) { 21131 delete meta.httpEquiv; 21132 } 21133 input.meta[idx] = meta; 21134 return null; 21135 }; 21136 } 21137}); 21138/* @__PURE__ */ defineComponent({ 21139 name: "Style", 21140 inheritAttrs: false, 21141 props: { 21142 ...globalProps, 21143 ...TagPositionProps, 21144 type: String, 21145 media: String, 21146 nonce: String, 21147 title: String, 21148 /** @deprecated **/ 21149 scoped: { 21150 type: Boolean, 21151 default: void 0 21152 } 21153 }, 21154 setup(props, { slots }) { 21155 const { input } = useHeadComponentCtx(); 21156 input.style || (input.style = []); 21157 const idx = input.style.push({}) - 1; 21158 onUnmounted(() => input.style[idx] = null); 21159 return () => { 21160 var _a3, _b, _c; 21161 const style = normalizeProps(props); 21162 const textContent = (_c = (_b = (_a3 = slots.default) == null ? void 0 : _a3.call(slots)) == null ? void 0 : _b[0]) == null ? void 0 : _c.children; 21163 if (textContent) { 21164 input.style[idx] = style; 21165 style.textContent = textContent; 21166 } 21167 return null; 21168 }; 21169 } 21170}); 21171const Html = /* @__PURE__ */ defineComponent({ 21172 name: "Html", 21173 inheritAttrs: false, 21174 props: { 21175 ...globalProps, 21176 manifest: String, 21177 version: String, 21178 xmlns: String 21179 }, 21180 setup(_props, ctx) { 21181 const { input } = useHeadComponentCtx(); 21182 onUnmounted(() => input.htmlAttrs = null); 21183 return () => { 21184 var _a3, _b; 21185 input.htmlAttrs = { ..._props, ...ctx.attrs }; 21186 return (_b = (_a3 = ctx.slots).default) == null ? void 0 : _b.call(_a3); 21187 }; 21188 } 21189}); 21190const Body = /* @__PURE__ */ defineComponent({ 21191 name: "Body", 21192 inheritAttrs: false, 21193 props: globalProps, 21194 setup(_props, ctx) { 21195 const { input } = useHeadComponentCtx(); 21196 onUnmounted(() => input.bodyAttrs = null); 21197 return () => { 21198 var _a3, _b; 21199 input.bodyAttrs = { ..._props, ...ctx.attrs }; 21200 return (_b = (_a3 = ctx.slots).default) == null ? void 0 : _b.call(_a3); 21201 }; 21202 } 21203}); 21204function groq(strings, ...keys) { 21205 const lastIndex = strings.length - 1; 21206 return strings.slice(0, lastIndex).reduce((acc, str, i2) => acc + str + keys[i2], "") + strings[lastIndex]; 21207} 21208const imageQuery = ` 21209asset-> { 21210 metadata, 21211 url, 21212 altText, 21213 originalFilename 21214}, 21215crop, 21216hotspot 21217`; 21218const linkQuery = ` 21219title, 21220isInternalLink, 21221"internalLink": internalLink->{ 21222 _id, 21223 _type, 21224 "slug": slug.current, 21225}, 21226"externalUrl": externalUrl 21227`;
21228const mediaQuery = ` 21229 videoUrl, 21230 autoplay, 21231 caption []{ 21232 ..., 21233 _type=='block' => { 21234 markDefs [] { 21235 ..., 21236 _type == "link" => { 21237 ${linkQuery} 21238 } 21239 } 21240 } 21241 }, 21242 videoType, 21243 ${imageQuery} 21244`; 21245const textContentQuery = ` 21246..., 21247_type=='block' => { 21248 markDefs [] { 21249 ..., 21250 _type == "link" => { 21251 ${linkQuery} 21252 } 21253 } 21254} 21255`; 21256const seoQuery = ` 21257ogtitle, 21258ogdescription, 21259ogimage { 21260 asset-> { 21261 url 21262 } 21263} 21264`; 21265const blockContentQuery = ` 21266..., 21267_type=='block' => { 21268 markDefs [] { 21269 ..., 21270 _type == "link" => { 21271 ${linkQuery} 21272 } 21273 } 21274}, 21275_type == 'media' => { 21276 ${mediaQuery} 21277}, 21278_type == 'gallery' => { 21279 "images": images[]{ 21280 ${imageQuery} 21281 }, 21282}, 21283`; 21284const siteSettings = async () => { 21285 const { $sanity } = useNuxtApp(); 21286 const query = groq`*[_type == "siteConfig"][0]{ 21287 siteTitle, 21288 siteUrl, 21289 gtmID, 21290 cookiesPolicyLink -> { 21291 _id, 21292 "slug": slug.current, 21293 }, 21294 siteLanguage, 21295 siteLogo, 21296 siteFavicon { 21297 ${imageQuery} 21298 }, 21299 mainNav ->{ 21300 ..., 21301 items [] { 21302 ..., 21303 link { 21304 ${linkQuery} 21305 } 21306 }, 21307 }, 21308 legalLink -> { 21309 _id, 21310 slug, 21311 title, 21312 }, 21313 logos[] { 21314 ${imageQuery} 21315 }, 21316 newsletterText, 21317 newsletterLink, 21318 }`; 21319 const { data } = await useAsyncData( 21320 "siteSettings", 21321 () => $sanity.fetch(query) 21322 ); 21323 return data; 21324}; 21325function getFileExtension(filename2) { 21326 if (!filename2) return ""; 21327 return filename2.split(".").pop(); 21328} 21329function buildBodyClass(path) { 21330 if (path) { 21331 return path == "/" ? "home" : "page-" + path.replace(/\//g, " ").trim(); 21332 } 21333 return ""; 21334} 21335const usePreviousRouteStore = /* @__PURE__ */ defineStore("previousRouteStore", { 21336 state: () => ({ 21337 name: "" 21338 }) 21339}); 21340const useMenuStore = /* @__PURE__ */ defineStore("menu", { 21341 state: () => ({ isOpened: false }) 21342}); 21343const _sfc_main$2 = { 21344 __name: "app", 21345 async setup(__props) { 21346 var _a3, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l; 21347 let __temp, __restore; 21348 let siteSettingsData = ([__temp, __restore] = withAsyncContext(() => siteSettings()), __temp = await __temp, __restore(), __temp); 21349 const runtimeConfig = /* @__PURE__ */ useRuntimeConfig(); 21350 const isProduction = ((_a3 = runtimeConfig == null ? void 0 : runtimeConfig.public) == null ? void 0 : _a3.appEnv) === "production"; 21351 const siteUrlIsValid = ((_b = runtimeConfig == null ? void 0 : runtimeConfig.public) == null ? void 0 : _b.publicSiteUrl) && !((_c = runtimeConfig == null ? void 0 : runtimeConfig.public) == null ? void 0 : _c.publicSiteUrl.includes("netlify.app")) && !((_d = runtimeConfig == null ? void 0 : runtimeConfig.public) == null ? void 0 : _d.publicSiteUrl.includes("vercel.app")) && !((_e2 = runtimeConfig == null ? void 0 : runtimeConfig.public) == null ? void 0 : _e2.publicSiteUrl.includes("pages.dev")); 21352 const shouldIndexFollow = isProduction && siteUrlIsValid; 21353 const nuxtApp = useNuxtApp(); 21354 const route = useRoute$1(); 21355 const previousRouteStore = usePreviousRouteStore(); 21356 const favicon = ((_h = (_g = (_f = siteSettingsData == null ? void 0 : siteSettingsData.value) == null ? void 0 : _f.siteFavicon) == null ? void 0 : _g.asset) == null ? void 0 : _h.url) ? (_k = (_j = (_i = siteSettingsData == null ? void 0 : siteSettingsData.value) == null ? void 0 : _i.siteFavicon) == null ? void 0 : _j.asset) == null ? void 0 : _k.url : "/favicon.png"; 21357 const faviconType = getFileExtension(favicon); 21358 const gtmID = (_l = siteSettingsData == null ? void 0 : siteSettingsData.value) == null ? void 0 : _l.gtmID; 21359 const menuState = useMenuStore(); 21360 nuxtApp.hook("page:start", () => { 21361 previousRouteStore.name = route == null ? void 0 : route.name; 21362 }); 21363 nuxtApp.hook("page:finish", () => { 21364 menuState.isOpened = false;
21365 }); 21366 provide("siteSettingsData", siteSettingsData); 21367 useHead({ 21368 meta: [ 21369 { 21370 name: "robots", 21371 content: shouldIndexFollow ? "index, follow" : "noindex, nofollow" 21372 }, 21373 { 21374 name: "theme-color", 21375 content: "#FFC533" 21376 } 21377 ], 21378 link: [ 21379 { 21380 rel: "icon", 21381 type: `image/${faviconType}`, 21382 href: `${favicon}?w=100&h=100` 21383 }, 21384 { 21385 rel: "preload", 21386 href: "/fonts/Outfit-Regular.woff2", 21387 crossorigin: "", 21388 as: "font", 21389 type: "font/woff2" 21390 }, 21391 { 21392 rel: "preload", 21393 href: "/fonts/Outfit-Medium.woff2", 21394 crossorigin: "", 21395 as: "font", 21396 type: "font/woff2" 21397 }, 21398 { 21399 rel: "preload", 21400 href: "/fonts/Outfit-Semibold.woff2", 21401 crossorigin: "", 21402 as: "font", 21403 type: "font/woff2" 21404 }, 21405 { 21406 rel: "preload", 21407 href: "/fonts/Outfit-Bold.woff2", 21408 crossorigin: "", 21409 as: "font", 21410 type: "font/woff2" 21411 } 21412 ], 21413 noscript: gtmID ? [ 21414 { 21415 hid: "gtm", 21416 children: `<iframe src="https://www.googletagmanager.com/ns.html?id=${gtmID}" height="0" width="0" 21417 style="display:none;visibility:hidden"></iframe>`, 21418 "data-analytics-type": "gtm", 21419 "data-cookiecategory": "analytics", 21420 body: true 21421 }
21422 ] : [], 21423 script: gtmID ? [ 21424 { 21425 src: "/js/analytics.js", 21426 type: "text/plain", 21427 "data-analytics-type": "gtm", 21428 "data-category": "analytics", 21429 "data-gtmid": gtmID, 21430 body: false 21431 } 21432 ] : [] 21433 }); 21434 return (_ctx, _cache) => { 21435 const _component_NuxtLoadingIndicator = __nuxt_component_0; 21436 const _component_NuxtPage = __nuxt_component_1; 21437 const _component_NuxtLayout = __nuxt_component_2; 21438 const _component_Body = Body; 21439 const _component_Html = Html; 21440 return openBlock(), createBlock(_component_Html, null, { 21441 default: withCtx(() => [ 21442 createVNode(_component_Body, null, { 21443 default: withCtx(() => [ 21444 createVNode(_component_NuxtLoadingIndicator, { 21445 throttle: 200, 21446 height: 2, 21447 color: "#000" 21448 }), 21449 createVNode(_component_NuxtLayout, null, { 21450 default: withCtx(() => [ 21451 createVNode(_component_NuxtPage) 21452 ]), 21453 _: 1 21454 }) 21455 ]), 21456 _: 1 21457 }) 21458 ]), 21459 _: 1 21460 }); 21461 }; 21462 } 21463}; 21464const _hoisted_1$1 = { 21465 id: "main-content-wrapper", 21466 class: "flex flex-col min-h-min 404-content" 21467}; 21468const _hoisted_2 = { 21469 id: "main-content", 21470 class: "relative flex flex-col items-center justify-center text-center min-h-svh" 21471}; 21472const _hoisted_3 = ["innerHTML"]; 21473const defaultText = "Sorry, something went wrong.<br>Please try again later"; 21474const text404 = '404<br>The page could not be found<br>Please visit our <a href="/" class="text-primary">homepage to start fresh</a>'; 21475const _sfc_main$1 = { 21476 __name: "error", 21477 props: { 21478 error: Object 21479 }, 21480 setup(__props) { 21481 var _a3; 21482 const props = __props; 21483 const metaTitle = ((_a3 = props.error) == null ? void 0 : _a3.statusCode) == "404" ? "404 - Page not found" : "Something went wrong"; 21484 useHead({ 21485 title: metaTitle 21486 }); 21487 return (_ctx, _cache) => { 21488 var _a4; 21489 return openBlock(), createElementBlock("div", _hoisted_1$1, [ 21490 createBaseVNode("main", _hoisted_2, [ 21491 createBaseVNode("h2", { 21492 class: "p-4 uppercase", 21493 innerHTML: ((_a4 = __props.error) == null ? void 0 : _a4.statusCode) == "404" ? text404 : defaultText 21494 }, null, 8, _hoisted_3) 21495 ]) 21496 ]); 21497 }; 21498 } 21499}; 21500const _hoisted_1 = { key: 0 }; 21501const _sfc_main = { 21502 __name: "nuxt-root", 21503 setup(__props) { 21504 const IslandRenderer = () => null; 21505 const nuxtApp = useNuxtApp(); 21506 const onResolve = nuxtApp.deferHydration(); 21507 if (nuxtApp.isHydrating) { 21508 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", onResolve); 21509 useRouter().beforeEach(removeErrorHook); 21510 } 21511 const SingleRenderer = false; 21512 provide(PageRouteSymbol, useRoute$1()); 21513 nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup"); 21514 const error = useError(); 21515 const abortRender = false;
21516 onErrorCaptured((err, target, info) => { 21517 nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError)); 21518 if (isNuxtError(err) && (err.fatal || err.unhandled)) { 21519 nuxtApp.runWithContext(() => showError(err)); 21520 return false; 21521 } 21522 }); 21523 const islandContext = false; 21524 return (_ctx, _cache) => { 21525 return openBlock(), createBlock(Suspense, { onResolve: unref(onResolve) }, { 21526 default: withCtx(() => [ 21527 unref(abortRender) ? (openBlock(), createElementBlock("div", _hoisted_1)) : unref(error) ? (openBlock(), createBlock(unref(_sfc_main$1), { 21528 key: 1, 21529 error: unref(error) 21530 }, null, 8, ["error"])) : unref(islandContext) ? (openBlock(), createBlock(unref(IslandRenderer), { 21531 key: 2, 21532 context: unref(islandContext) 21533 }, null, 8, ["context"])) : unref(SingleRenderer) ? (openBlock(), createBlock(resolveDynamicComponent(unref(SingleRenderer)), { key: 3 })) : (openBlock(), createBlock(unref(_sfc_main$2), { key: 4 })) 21534 ]), 21535 _: 1 21536 }, 8, ["onResolve"]); 21537 }; 21538 } 21539}; 21540let entry; 21541{ 21542 let vueAppPromise; 21543 entry = async function initApp() { 21544 var _a3, _b; 21545 if (vueAppPromise) { 21546 return vueAppPromise; 21547 } 21548 const isSSR = Boolean( 21549 ((_a3 = window.__NUXT__) == null ? void 0 : _a3.serverRendered) ?? ((_b = document.getElementById("__NUXT_DATA__")) == null ? void 0 : _b.dataset.ssr) === "true" 21550 ); 21551 const vueApp = isSSR ? createSSRApp(_sfc_main) : createApp(_sfc_main); 21552 const nuxt = createNuxtApp({ vueApp }); 21553 async function handleVueError(error) { 21554 var _a4; 21555 await nuxt.callHook("app:error", error); 21556 (_a4 = nuxt.payload).error || (_a4.error = createError(error)); 21557 } 21558 vueApp.config.errorHandler = handleVueError; 21559 nuxt.hook("app:suspense:resolve", () => { 21560 if (vueApp.config.errorHandler === handleVueError) { 21561 vueApp.config.errorHandler = void 0; 21562 } 21563 }); 21564 try { 21565 await applyPlugins(nuxt, plugins); 21566 } catch (err) { 21567 handleVueError(err); 21568 } 21569 try { 21570 await nuxt.hooks.callHook("app:created", vueApp); 21571 await nuxt.hooks.callHook("app:beforeMount", vueApp); 21572 vueApp.mount(vueAppRootContainer); 21573 await nuxt.hooks.callHook("app:mounted", vueApp); 21574 await nextTick(); 21575 } catch (err) { 21576 handleVueError(err); 21577 } 21578 return vueApp; 21579 }; 21580 vueAppPromise = entry().catch((error) => { 21581 console.error("Error while mounting app:", error); 21582 throw error; 21583 }); 21584} 21585export { 21586 onBeforeMount as $, 21587 inject as A, 21588 shallowRef as B, 21589 watchEffect as C, 21590 computed as D, 21591 toValue as E, 21592 Fragment as F, 21593 createBlock as G, 21594 withModifiers as H, 21595 nextTick as I, 21596 renderSlot as J, 21597 onBeforeUnmount as K, 21598 resolveComponent as L, 21599 createTextVNode as M, 21600 h$1 as N, 21601 blockContentQuery as O, 21602 textContentQuery as P, 21603 imageQuery as Q, 21604 createError as R, 21605 toDisplayString as S, 21606 Teleport as T, 21607 defineComponent as U, 21608 withCtx as V, 21609 defineStore as W, 21610 useSeoMeta as X, 21611 createStaticVNode as Y, 21612 useMenuStore as Z, 21613 useRuntimeConfig as _, 21614 useHead as a, 21615 useRouter as a0, 21616 onNuxtReady as a1, 21617 requestIdleCallback as a2, 21618 cancelIdleCallback as a3, 21619 parseQuery$1 as a4, 21620 resolveRouteObject as a5, 21621 preloadRouteComponents as a6, 21622 hasProtocol as a7, 21623 joinURL as a8, 21624 navigateTo as a9, 21625 hashMode as aa, 21626 withTrailingSlash as ab, 21627 withoutTrailingSlash as ac, 21628 nuxtLinkDefaults as ad, 21629 C as ae, 21630 buildBodyClass as b, 21631 createElementBlock as c, 21632 createBaseVNode as d, 21633 createVNode as e, 21634 unref as f, 21635 createCommentVNode as g, 21636 useNuxtApp as h, 21637 groq as i, 21638 useAsyncData as j, 21639 onMounted as k, 21640 renderList as l, 21641 mediaQuery as m, 21642 normalizeClass as n, 21643 openBlock as o, 21644 withDirectives as p, 21645 watch as q, 21646 ref as r, 21647 seoQuery as s, 21648 getCurrentScope as t, 21649 useRoute$1 as u, 21650 vShow as v, 21651 withAsyncContext as w, 21652 onScopeDispose as x, 21653 getCurrentInstance as y, 21654 hasInjectionContext as z 21655};
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.