563 kBJavaScriptView Raw
1/**
2* vue v3.5.13
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6var Vue = (function (exports) {
7 'use strict';
8
9 /*! #__NO_SIDE_EFFECTS__ */
10 // @__NO_SIDE_EFFECTS__
11 function makeMap(str) {
12 const map = /* @__PURE__ */ Object.create(null);
13 for (const key of str.split(",")) map[key] = 1;
14 return (val) => val in map;
15 }
16
17 const EMPTY_OBJ = Object.freeze({}) ;
18 const EMPTY_ARR = Object.freeze([]) ;
19 const NOOP = () => {
20 };
21 const NO = () => false;
22 const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
23 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
24 const isModelListener = (key) => key.startsWith("onUpdate:");
25 const extend = Object.assign;
26 const remove = (arr, el) => {
27 const i = arr.indexOf(el);
28 if (i > -1) {
29 arr.splice(i, 1);
30 }
31 };
32 const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
33 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
34 const isArray = Array.isArray;
35 const isMap = (val) => toTypeString(val) === "[object Map]";
36 const isSet = (val) => toTypeString(val) === "[object Set]";
37 const isDate = (val) => toTypeString(val) === "[object Date]";
38 const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
39 const isFunction = (val) => typeof val === "function";
40 const isString = (val) => typeof val === "string";
41 const isSymbol = (val) => typeof val === "symbol";
42 const isObject = (val) => val !== null && typeof val === "object";
43 const isPromise = (val) => {
44 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
45 };
46 const objectToString = Object.prototype.toString;
47 const toTypeString = (value) => objectToString.call(value);
48 const toRawType = (value) => {
49 return toTypeString(value).slice(8, -1);
50 };
51 const isPlainObject = (val) => toTypeString(val) === "[object Object]";
52 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
53 const isReservedProp = /* @__PURE__ */ makeMap(
54 // the leading comma is intentional so empty string "" is also included
55 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
56 );
57 const isBuiltInDirective = /* @__PURE__ */ makeMap(
58 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
59 );
60 const cacheStringFunction = (fn) => {
61 const cache = /* @__PURE__ */ Object.create(null);
62 return (str) => {
63 const hit = cache[str];
64 return hit || (cache[str] = fn(str));
65 };
66 };
67 const camelizeRE = /-(\w)/g;
68 const camelize = cacheStringFunction(
69 (str) => {
70 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
71 }
72 );
73 const hyphenateRE = /\B([A-Z])/g;
74 const hyphenate = cacheStringFunction(
75 (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
76 );
77 const capitalize = cacheStringFunction((str) => {
78 return str.charAt(0).toUpperCase() + str.slice(1);
79 });
80 const toHandlerKey = cacheStringFunction(
81 (str) => {
82 const s = str ? `on${capitalize(str)}` : ``;
83 return s;
84 }
85 );
86 const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
87 const invokeArrayFns = (fns, ...arg) => {
88 for (let i = 0; i < fns.length; i++) {
89 fns[i](...arg);
90 }
91 };
92 const def = (obj, key, value, writable = false) => {
93 Object.defineProperty(obj, key, {
94 configurable: true,
95 enumerable: false,
96 writable,
97 value
98 });
99 };
100 const looseToNumber = (val) => {
101 const n = parseFloat(val);
102 return isNaN(n) ? val : n;
103 };
104 const toNumber = (val) => {
105 const n = isString(val) ? Number(val) : NaN;
106 return isNaN(n) ? val : n;
107 };
108 let _globalThis;
109 const getGlobalThis = () => {
110 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
111 };
112 function genCacheKey(source, options) {
113 return source + JSON.stringify(
114 options,
115 (_, val) => typeof val === "function" ? val.toString() : val
116 );
117 }
118
119 const PatchFlagNames = {
120 [1]: `TEXT`,
121 [2]: `CLASS`,
122 [4]: `STYLE`,
123 [8]: `PROPS`,
124 [16]: `FULL_PROPS`,
125 [32]: `NEED_HYDRATION`,
126 [64]: `STABLE_FRAGMENT`,
127 [128]: `KEYED_FRAGMENT`,
128 [256]: `UNKEYED_FRAGMENT`,
129 [512]: `NEED_PATCH`,
130 [1024]: `DYNAMIC_SLOTS`,
131 [2048]: `DEV_ROOT_FRAGMENT`,
132 [-1]: `HOISTED`,
133 [-2]: `BAIL`
134 };
135
136 const slotFlagsText = {
137 [1]: "STABLE",
138 [2]: "DYNAMIC",
139 [3]: "FORWARDED"
140 };
141
142 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
143 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
144
145 const range = 2;
146 function generateCodeFrame(source, start = 0, end = source.length) {
147 start = Math.max(0, Math.min(start, source.length));
148 end = Math.max(0, Math.min(end, source.length));
149 if (start > end) return "";
150 let lines = source.split(/(\r?\n)/);
151 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
152 lines = lines.filter((_, idx) => idx % 2 === 0);
153 let count = 0;
154 const res = [];
155 for (let i = 0; i < lines.length; i++) {
156 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
157 if (count >= start) {
158 for (let j = i - range; j <= i + range || end > count; j++) {
159 if (j < 0 || j >= lines.length) continue;
160 const line = j + 1;
161 res.push(
162 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
163 );
164 const lineLength = lines[j].length;
165 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
166 if (j === i) {
167 const pad = start - (count - (lineLength + newLineSeqLength));
168 const length = Math.max(
169 1,
170 end > count ? lineLength - pad : end - start
171 );
172 res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
173 } else if (j > i) {
174 if (end > count) {
175 const length = Math.max(Math.min(end - count, lineLength), 1);
176 res.push(` | ` + "^".repeat(length));
177 }
178 count += lineLength + newLineSeqLength;
179 }
180 }
181 break;
182 }
183 }
184 return res.join("\n");
185 }
186
187 function normalizeStyle(value) {
188 if (isArray(value)) {
189 const res = {};
190 for (let i = 0; i < value.length; i++) {
191 const item = value[i];
192 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
193 if (normalized) {
194 for (const key in normalized) {
195 res[key] = normalized[key];
196 }
197 }
198 }
199 return res;
200 } else if (isString(value) || isObject(value)) {
201 return value;
202 }
203 }
204 const listDelimiterRE = /;(?![^(]*\))/g;
205 const propertyDelimiterRE = /:([^]+)/;
206 const styleCommentRE = /\/\*[^]*?\*\//g;
207 function parseStringStyle(cssText) {
208 const ret = {};
209 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
210 if (item) {
211 const tmp = item.split(propertyDelimiterRE);
212 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
213 }
214 });
215 return ret;
216 }
217 function stringifyStyle(styles) {
218 if (!styles) return "";
219 if (isString(styles)) return styles;
220 let ret = "";
221 for (const key in styles) {
222 const value = styles[key];
223 if (isString(value) || typeof value === "number") {
224 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
225 ret += `${normalizedKey}:${value};`;
226 }
227 }
228 return ret;
229 }
230 function normalizeClass(value) {
231 let res = "";
232 if (isString(value)) {
233 res = value;
234 } else if (isArray(value)) {
235 for (let i = 0; i < value.length; i++) {
236 const normalized = normalizeClass(value[i]);
237 if (normalized) {
238 res += normalized + " ";
239 }
240 }
241 } else if (isObject(value)) {
242 for (const name in value) {
243 if (value[name]) {
244 res += name + " ";
245 }
246 }
247 }
248 return res.trim();
249 }
250 function normalizeProps(props) {
251 if (!props) return null;
252 let { class: klass, style } = props;
253 if (klass && !isString(klass)) {
254 props.class = normalizeClass(klass);
255 }
256 if (style) {
257 props.style = normalizeStyle(style);
258 }
259 return props;
260 }
261
262 const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
263 const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
264 const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
265 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
266 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
267 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
268 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
269 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
270
271 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
272 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
273 const isBooleanAttr = /* @__PURE__ */ makeMap(
274 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
275 );
276 function includeBooleanAttr(value) {
277 return !!value || value === "";
278 }
279 const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
280 `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
281 );
282 const isKnownSvgAttr = /* @__PURE__ */ makeMap(
283 `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
284 );
285 function isRenderableAttrValue(value) {
286 if (value == null) {
287 return false;
288 }
289 const type = typeof value;
290 return type === "string" || type === "number" || type === "boolean";
291 }
292
293 const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
294 function getEscapedCssVarName(key, doubleEscape) {
295 return key.replace(
296 cssVarNameEscapeSymbolsRE,
297 (s) => `\\${s}`
298 );
299 }
300
301 function looseCompareArrays(a, b) {
302 if (a.length !== b.length) return false;
303 let equal = true;
304 for (let i = 0; equal && i < a.length; i++) {
305 equal = looseEqual(a[i], b[i]);
306 }
307 return equal;
308 }
309 function looseEqual(a, b) {
310 if (a === b) return true;
311 let aValidType = isDate(a);
312 let bValidType = isDate(b);
313 if (aValidType || bValidType) {
314 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
315 }
316 aValidType = isSymbol(a);
317 bValidType = isSymbol(b);
318 if (aValidType || bValidType) {
319 return a === b;
320 }
321 aValidType = isArray(a);
322 bValidType = isArray(b);
323 if (aValidType || bValidType) {
324 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
325 }
326 aValidType = isObject(a);
327 bValidType = isObject(b);
328 if (aValidType || bValidType) {
329 if (!aValidType || !bValidType) {
330 return false;
331 }
332 const aKeysCount = Object.keys(a).length;
333 const bKeysCount = Object.keys(b).length;
334 if (aKeysCount !== bKeysCount) {
335 return false;
336 }
337 for (const key in a) {
338 const aHasKey = a.hasOwnProperty(key);
339 const bHasKey = b.hasOwnProperty(key);
340 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
341 return false;
342 }
343 }
344 }
345 return String(a) === String(b);
346 }
347 function looseIndexOf(arr, val) {
348 return arr.findIndex((item) => looseEqual(item, val));
349 }
350
351 const isRef$1 = (val) => {
352 return !!(val && val["__v_isRef"] === true);
353 };
354 const toDisplayString = (val) => {
355 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
356 };
357 const replacer = (_key, val) => {
358 if (isRef$1(val)) {
359 return replacer(_key, val.value);
360 } else if (isMap(val)) {
361 return {
362 [`Map(${val.size})`]: [...val.entries()].reduce(
363 (entries, [key, val2], i) => {
364 entries[stringifySymbol(key, i) + " =>"] = val2;
365 return entries;
366 },
367 {}
368 )
369 };
370 } else if (isSet(val)) {
371 return {
372 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
373 };
374 } else if (isSymbol(val)) {
375 return stringifySymbol(val);
376 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
377 return String(val);
378 }
379 return val;
380 };
381 const stringifySymbol = (v, i = "") => {
382 var _a;
383 return (
384 // Symbol.description in es2019+ so we need to cast here to pass
385 // the lib: es2016 check
386 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
387 );
388 };
389
390 function warn$2(msg, ...args) {
391 console.warn(`[Vue warn] ${msg}`, ...args);
392 }
393
394 let activeEffectScope;
395 class EffectScope {
396 constructor(detached = false) {
397 this.detached = detached;
398 /**
399 * @internal
400 */
401 this._active = true;
402 /**
403 * @internal
404 */
405 this.effects = [];
406 /**
407 * @internal
408 */
409 this.cleanups = [];
410 this._isPaused = false;
411 this.parent = activeEffectScope;
412 if (!detached && activeEffectScope) {
413 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
414 this
415 ) - 1;
416 }
417 }
418 get active() {
419 return this._active;
420 }
421 pause() {
422 if (this._active) {
423 this._isPaused = true;
424 let i, l;
425 if (this.scopes) {
426 for (i = 0, l = this.scopes.length; i < l; i++) {
427 this.scopes[i].pause();
428 }
429 }
430 for (i = 0, l = this.effects.length; i < l; i++) {
431 this.effects[i].pause();
432 }
433 }
434 }
435 /**
436 * Resumes the effect scope, including all child scopes and effects.
437 */
438 resume() {
439 if (this._active) {
440 if (this._isPaused) {
441 this._isPaused = false;
442 let i, l;
443 if (this.scopes) {
444 for (i = 0, l = this.scopes.length; i < l; i++) {
445 this.scopes[i].resume();
446 }
447 }
448 for (i = 0, l = this.effects.length; i < l; i++) {
449 this.effects[i].resume();
450 }
451 }
452 }
453 }
454 run(fn) {
455 if (this._active) {
456 const currentEffectScope = activeEffectScope;
457 try {
458 activeEffectScope = this;
459 return fn();
460 } finally {
461 activeEffectScope = currentEffectScope;
462 }
463 } else {
464 warn$2(`cannot run an inactive effect scope.`);
465 }
466 }
467 /**
468 * This should only be called on non-detached scopes
469 * @internal
470 */
471 on() {
472 activeEffectScope = this;
473 }
474 /**
475 * This should only be called on non-detached scopes
476 * @internal
477 */
478 off() {
479 activeEffectScope = this.parent;
480 }
481 stop(fromParent) {
482 if (this._active) {
483 this._active = false;
484 let i, l;
485 for (i = 0, l = this.effects.length; i < l; i++) {
486 this.effects[i].stop();
487 }
488 this.effects.length = 0;
489 for (i = 0, l = this.cleanups.length; i < l; i++) {
490 this.cleanups[i]();
491 }
492 this.cleanups.length = 0;
493 if (this.scopes) {
494 for (i = 0, l = this.scopes.length; i < l; i++) {
495 this.scopes[i].stop(true);
496 }
497 this.scopes.length = 0;
498 }
499 if (!this.detached && this.parent && !fromParent) {
500 const last = this.parent.scopes.pop();
501 if (last && last !== this) {
502 this.parent.scopes[this.index] = last;
503 last.index = this.index;
504 }
505 }
506 this.parent = void 0;
507 }
508 }
509 }
510 function effectScope(detached) {
511 return new EffectScope(detached);
512 }
513 function getCurrentScope() {
514 return activeEffectScope;
515 }
516 function onScopeDispose(fn, failSilently = false) {
517 if (activeEffectScope) {
518 activeEffectScope.cleanups.push(fn);
519 } else if (!failSilently) {
520 warn$2(
521 `onScopeDispose() is called when there is no active effect scope to be associated with.`
522 );
523 }
524 }
525
526 let activeSub;
527 const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
528 class ReactiveEffect {
529 constructor(fn) {
530 this.fn = fn;
531 /**
532 * @internal
533 */
534 this.deps = void 0;
535 /**
536 * @internal
537 */
538 this.depsTail = void 0;
539 /**
540 * @internal
541 */
542 this.flags = 1 | 4;
543 /**
544 * @internal
545 */
546 this.next = void 0;
547 /**
548 * @internal
549 */
550 this.cleanup = void 0;
551 this.scheduler = void 0;
552 if (activeEffectScope && activeEffectScope.active) {
553 activeEffectScope.effects.push(this);
554 }
555 }
556 pause() {
557 this.flags |= 64;
558 }
559 resume() {
560 if (this.flags & 64) {
561 this.flags &= ~64;
562 if (pausedQueueEffects.has(this)) {
563 pausedQueueEffects.delete(this);
564 this.trigger();
565 }
566 }
567 }
568 /**
569 * @internal
570 */
571 notify() {
572 if (this.flags & 2 && !(this.flags & 32)) {
573 return;
574 }
575 if (!(this.flags & 8)) {
576 batch(this);
577 }
578 }
579 run() {
580 if (!(this.flags & 1)) {
581 return this.fn();
582 }
583 this.flags |= 2;
584 cleanupEffect(this);
585 prepareDeps(this);
586 const prevEffect = activeSub;
587 const prevShouldTrack = shouldTrack;
588 activeSub = this;
589 shouldTrack = true;
590 try {
591 return this.fn();
592 } finally {
593 if (activeSub !== this) {
594 warn$2(
595 "Active effect was not restored correctly - this is likely a Vue internal bug."
596 );
597 }
598 cleanupDeps(this);
599 activeSub = prevEffect;
600 shouldTrack = prevShouldTrack;
601 this.flags &= ~2;
602 }
603 }
604 stop() {
605 if (this.flags & 1) {
606 for (let link = this.deps; link; link = link.nextDep) {
607 removeSub(link);
608 }
609 this.deps = this.depsTail = void 0;
610 cleanupEffect(this);
611 this.onStop && this.onStop();
612 this.flags &= ~1;
613 }
614 }
615 trigger() {
616 if (this.flags & 64) {
617 pausedQueueEffects.add(this);
618 } else if (this.scheduler) {
619 this.scheduler();
620 } else {
621 this.runIfDirty();
622 }
623 }
624 /**
625 * @internal
626 */
627 runIfDirty() {
628 if (isDirty(this)) {
629 this.run();
630 }
631 }
632 get dirty() {
633 return isDirty(this);
634 }
635 }
636 let batchDepth = 0;
637 let batchedSub;
638 let batchedComputed;
639 function batch(sub, isComputed = false) {
640 sub.flags |= 8;
641 if (isComputed) {
642 sub.next = batchedComputed;
643 batchedComputed = sub;
644 return;
645 }
646 sub.next = batchedSub;
647 batchedSub = sub;
648 }
649 function startBatch() {
650 batchDepth++;
651 }
652 function endBatch() {
653 if (--batchDepth > 0) {
654 return;
655 }
656 if (batchedComputed) {
657 let e = batchedComputed;
658 batchedComputed = void 0;
659 while (e) {
660 const next = e.next;
661 e.next = void 0;
662 e.flags &= ~8;
663 e = next;
664 }
665 }
666 let error;
667 while (batchedSub) {
668 let e = batchedSub;
669 batchedSub = void 0;
670 while (e) {
671 const next = e.next;
672 e.next = void 0;
673 e.flags &= ~8;
674 if (e.flags & 1) {
675 try {
676 ;
677 e.trigger();
678 } catch (err) {
679 if (!error) error = err;
680 }
681 }
682 e = next;
683 }
684 }
685 if (error) throw error;
686 }
687 function prepareDeps(sub) {
688 for (let link = sub.deps; link; link = link.nextDep) {
689 link.version = -1;
690 link.prevActiveLink = link.dep.activeLink;
691 link.dep.activeLink = link;
692 }
693 }
694 function cleanupDeps(sub) {
695 let head;
696 let tail = sub.depsTail;
697 let link = tail;
698 while (link) {
699 const prev = link.prevDep;
700 if (link.version === -1) {
701 if (link === tail) tail = prev;
702 removeSub(link);
703 removeDep(link);
704 } else {
705 head = link;
706 }
707 link.dep.activeLink = link.prevActiveLink;
708 link.prevActiveLink = void 0;
709 link = prev;
710 }
711 sub.deps = head;
712 sub.depsTail = tail;
713 }
714 function isDirty(sub) {
715 for (let link = sub.deps; link; link = link.nextDep) {
716 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
717 return true;
718 }
719 }
720 if (sub._dirty) {
721 return true;
722 }
723 return false;
724 }
725 function refreshComputed(computed) {
726 if (computed.flags & 4 && !(computed.flags & 16)) {
727 return;
728 }
729 computed.flags &= ~16;
730 if (computed.globalVersion === globalVersion) {
731 return;
732 }
733 computed.globalVersion = globalVersion;
734 const dep = computed.dep;
735 computed.flags |= 2;
736 if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
737 computed.flags &= ~2;
738 return;
739 }
740 const prevSub = activeSub;
741 const prevShouldTrack = shouldTrack;
742 activeSub = computed;
743 shouldTrack = true;
744 try {
745 prepareDeps(computed);
746 const value = computed.fn(computed._value);
747 if (dep.version === 0 || hasChanged(value, computed._value)) {
748 computed._value = value;
749 dep.version++;
750 }
751 } catch (err) {
752 dep.version++;
753 throw err;
754 } finally {
755 activeSub = prevSub;
756 shouldTrack = prevShouldTrack;
757 cleanupDeps(computed);
758 computed.flags &= ~2;
759 }
760 }
761 function removeSub(link, soft = false) {
762 const { dep, prevSub, nextSub } = link;
763 if (prevSub) {
764 prevSub.nextSub = nextSub;
765 link.prevSub = void 0;
766 }
767 if (nextSub) {
768 nextSub.prevSub = prevSub;
769 link.nextSub = void 0;
770 }
771 if (dep.subsHead === link) {
772 dep.subsHead = nextSub;
773 }
774 if (dep.subs === link) {
775 dep.subs = prevSub;
776 if (!prevSub && dep.computed) {
777 dep.computed.flags &= ~4;
778 for (let l = dep.computed.deps; l; l = l.nextDep) {
779 removeSub(l, true);
780 }
781 }
782 }
783 if (!soft && !--dep.sc && dep.map) {
784 dep.map.delete(dep.key);
785 }
786 }
787 function removeDep(link) {
788 const { prevDep, nextDep } = link;
789 if (prevDep) {
790 prevDep.nextDep = nextDep;
791 link.prevDep = void 0;
792 }
793 if (nextDep) {
794 nextDep.prevDep = prevDep;
795 link.nextDep = void 0;
796 }
797 }
798 function effect(fn, options) {
799 if (fn.effect instanceof ReactiveEffect) {
800 fn = fn.effect.fn;
801 }
802 const e = new ReactiveEffect(fn);
803 if (options) {
804 extend(e, options);
805 }
806 try {
807 e.run();
808 } catch (err) {
809 e.stop();
810 throw err;
811 }
812 const runner = e.run.bind(e);
813 runner.effect = e;
814 return runner;
815 }
816 function stop(runner) {
817 runner.effect.stop();
818 }
819 let shouldTrack = true;
820 const trackStack = [];
821 function pauseTracking() {
822 trackStack.push(shouldTrack);
823 shouldTrack = false;
824 }
825 function resetTracking() {
826 const last = trackStack.pop();
827 shouldTrack = last === void 0 ? true : last;
828 }
829 function cleanupEffect(e) {
830 const { cleanup } = e;
831 e.cleanup = void 0;
832 if (cleanup) {
833 const prevSub = activeSub;
834 activeSub = void 0;
835 try {
836 cleanup();
837 } finally {
838 activeSub = prevSub;
839 }
840 }
841 }
842
843 let globalVersion = 0;
844 class Link {
845 constructor(sub, dep) {
846 this.sub = sub;
847 this.dep = dep;
848 this.version = dep.version;
849 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
850 }
851 }
852 class Dep {
853 constructor(computed) {
854 this.computed = computed;
855 this.version = 0;
856 /**
857 * Link between this dep and the current active effect
858 */
859 this.activeLink = void 0;
860 /**
861 * Doubly linked list representing the subscribing effects (tail)
862 */
863 this.subs = void 0;
864 /**
865 * For object property deps cleanup
866 */
867 this.map = void 0;
868 this.key = void 0;
869 /**
870 * Subscriber counter
871 */
872 this.sc = 0;
873 {
874 this.subsHead = void 0;
875 }
876 }
877 track(debugInfo) {
878 if (!activeSub || !shouldTrack || activeSub === this.computed) {
879 return;
880 }
881 let link = this.activeLink;
882 if (link === void 0 || link.sub !== activeSub) {
883 link = this.activeLink = new Link(activeSub, this);
884 if (!activeSub.deps) {
885 activeSub.deps = activeSub.depsTail = link;
886 } else {
887 link.prevDep = activeSub.depsTail;
888 activeSub.depsTail.nextDep = link;
889 activeSub.depsTail = link;
890 }
891 addSub(link);
892 } else if (link.version === -1) {
893 link.version = this.version;
894 if (link.nextDep) {
895 const next = link.nextDep;
896 next.prevDep = link.prevDep;
897 if (link.prevDep) {
898 link.prevDep.nextDep = next;
899 }
900 link.prevDep = activeSub.depsTail;
901 link.nextDep = void 0;
902 activeSub.depsTail.nextDep = link;
903 activeSub.depsTail = link;
904 if (activeSub.deps === link) {
905 activeSub.deps = next;
906 }
907 }
908 }
909 if (activeSub.onTrack) {
910 activeSub.onTrack(
911 extend(
912 {
913 effect: activeSub
914 },
915 debugInfo
916 )
917 );
918 }
919 return link;
920 }
921 trigger(debugInfo) {
922 this.version++;
923 globalVersion++;
924 this.notify(debugInfo);
925 }
926 notify(debugInfo) {
927 startBatch();
928 try {
929 if (true) {
930 for (let head = this.subsHead; head; head = head.nextSub) {
931 if (head.sub.onTrigger && !(head.sub.flags & 8)) {
932 head.sub.onTrigger(
933 extend(
934 {
935 effect: head.sub
936 },
937 debugInfo
938 )
939 );
940 }
941 }
942 }
943 for (let link = this.subs; link; link = link.prevSub) {
944 if (link.sub.notify()) {
945 ;
946 link.sub.dep.notify();
947 }
948 }
949 } finally {
950 endBatch();
951 }
952 }
953 }
954 function addSub(link) {
955 link.dep.sc++;
956 if (link.sub.flags & 4) {
957 const computed = link.dep.computed;
958 if (computed && !link.dep.subs) {
959 computed.flags |= 4 | 16;
960 for (let l = computed.deps; l; l = l.nextDep) {
961 addSub(l);
962 }
963 }
964 const currentTail = link.dep.subs;
965 if (currentTail !== link) {
966 link.prevSub = currentTail;
967 if (currentTail) currentTail.nextSub = link;
968 }
969 if (link.dep.subsHead === void 0) {
970 link.dep.subsHead = link;
971 }
972 link.dep.subs = link;
973 }
974 }
975 const targetMap = /* @__PURE__ */ new WeakMap();
976 const ITERATE_KEY = Symbol(
977 "Object iterate"
978 );
979 const MAP_KEY_ITERATE_KEY = Symbol(
980 "Map keys iterate"
981 );
982 const ARRAY_ITERATE_KEY = Symbol(
983 "Array iterate"
984 );
985 function track(target, type, key) {
986 if (shouldTrack && activeSub) {
987 let depsMap = targetMap.get(target);
988 if (!depsMap) {
989 targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
990 }
991 let dep = depsMap.get(key);
992 if (!dep) {
993 depsMap.set(key, dep = new Dep());
994 dep.map = depsMap;
995 dep.key = key;
996 }
997 {
998 dep.track({
999 target,
1000 type,
1001 key
1002 });
1003 }
1004 }
1005 }
1006 function trigger(target, type, key, newValue, oldValue, oldTarget) {
1007 const depsMap = targetMap.get(target);
1008 if (!depsMap) {
1009 globalVersion++;
1010 return;
1011 }
1012 const run = (dep) => {
1013 if (dep) {
1014 {
1015 dep.trigger({
1016 target,
1017 type,
1018 key,
1019 newValue,
1020 oldValue,
1021 oldTarget
1022 });
1023 }
1024 }
1025 };
1026 startBatch();
1027 if (type === "clear") {
1028 depsMap.forEach(run);
1029 } else {
1030 const targetIsArray = isArray(target);
1031 const isArrayIndex = targetIsArray && isIntegerKey(key);
1032 if (targetIsArray && key === "length") {
1033 const newLength = Number(newValue);
1034 depsMap.forEach((dep, key2) => {
1035 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
1036 run(dep);
1037 }
1038 });
1039 } else {
1040 if (key !== void 0 || depsMap.has(void 0)) {
1041 run(depsMap.get(key));
1042 }
1043 if (isArrayIndex) {
1044 run(depsMap.get(ARRAY_ITERATE_KEY));
1045 }
1046 switch (type) {
1047 case "add":
1048 if (!targetIsArray) {
1049 run(depsMap.get(ITERATE_KEY));
1050 if (isMap(target)) {
1051 run(depsMap.get(MAP_KEY_ITERATE_KEY));
1052 }
1053 } else if (isArrayIndex) {
1054 run(depsMap.get("length"));
1055 }
1056 break;
1057 case "delete":
1058 if (!targetIsArray) {
1059 run(depsMap.get(ITERATE_KEY));
1060 if (isMap(target)) {
1061 run(depsMap.get(MAP_KEY_ITERATE_KEY));
1062 }
1063 }
1064 break;
1065 case "set":
1066 if (isMap(target)) {
1067 run(depsMap.get(ITERATE_KEY));
1068 }
1069 break;
1070 }
1071 }
1072 }
1073 endBatch();
1074 }
1075 function getDepFromReactive(object, key) {
1076 const depMap = targetMap.get(object);
1077 return depMap && depMap.get(key);
1078 }
1079
1080 function reactiveReadArray(array) {
1081 const raw = toRaw(array);
1082 if (raw === array) return raw;
1083 track(raw, "iterate", ARRAY_ITERATE_KEY);
1084 return isShallow(array) ? raw : raw.map(toReactive);
1085 }
1086 function shallowReadArray(arr) {
1087 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
1088 return arr;
1089 }
1090 const arrayInstrumentations = {
1091 __proto__: null,
1092 [Symbol.iterator]() {
1093 return iterator(this, Symbol.iterator, toReactive);
1094 },
1095 concat(...args) {
1096 return reactiveReadArray(this).concat(
1097 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1098 );
1099 },
1100 entries() {
1101 return iterator(this, "entries", (value) => {
1102 value[1] = toReactive(value[1]);
1103 return value;
1104 });
1105 },
1106 every(fn, thisArg) {
1107 return apply(this, "every", fn, thisArg, void 0, arguments);
1108 },
1109 filter(fn, thisArg) {
1110 return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
1111 },
1112 find(fn, thisArg) {
1113 return apply(this, "find", fn, thisArg, toReactive, arguments);
1114 },
1115 findIndex(fn, thisArg) {
1116 return apply(this, "findIndex", fn, thisArg, void 0, arguments);
1117 },
1118 findLast(fn, thisArg) {
1119 return apply(this, "findLast", fn, thisArg, toReactive, arguments);
1120 },
1121 findLastIndex(fn, thisArg) {
1122 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
1123 },
1124 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1125 forEach(fn, thisArg) {
1126 return apply(this, "forEach", fn, thisArg, void 0, arguments);
1127 },
1128 includes(...args) {
1129 return searchProxy(this, "includes", args);
1130 },
1131 indexOf(...args) {
1132 return searchProxy(this, "indexOf", args);
1133 },
1134 join(separator) {
1135 return reactiveReadArray(this).join(separator);
1136 },
1137 // keys() iterator only reads `length`, no optimisation required
1138 lastIndexOf(...args) {
1139 return searchProxy(this, "lastIndexOf", args);
1140 },
1141 map(fn, thisArg) {
1142 return apply(this, "map", fn, thisArg, void 0, arguments);
1143 },
1144 pop() {
1145 return noTracking(this, "pop");
1146 },
1147 push(...args) {
1148 return noTracking(this, "push", args);
1149 },
1150 reduce(fn, ...args) {
1151 return reduce(this, "reduce", fn, args);
1152 },
1153 reduceRight(fn, ...args) {
1154 return reduce(this, "reduceRight", fn, args);
1155 },
1156 shift() {
1157 return noTracking(this, "shift");
1158 },
1159 // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1160 some(fn, thisArg) {
1161 return apply(this, "some", fn, thisArg, void 0, arguments);
1162 },
1163 splice(...args) {
1164 return noTracking(this, "splice", args);
1165 },
1166 toReversed() {
1167 return reactiveReadArray(this).toReversed();
1168 },
1169 toSorted(comparer) {
1170 return reactiveReadArray(this).toSorted(comparer);
1171 },
1172 toSpliced(...args) {
1173 return reactiveReadArray(this).toSpliced(...args);
1174 },
1175 unshift(...args) {
1176 return noTracking(this, "unshift", args);
1177 },
1178 values() {
1179 return iterator(this, "values", toReactive);
1180 }
1181 };
1182 function iterator(self, method, wrapValue) {
1183 const arr = shallowReadArray(self);
1184 const iter = arr[method]();
1185 if (arr !== self && !isShallow(self)) {
1186 iter._next = iter.next;
1187 iter.next = () => {
1188 const result = iter._next();
1189 if (result.value) {
1190 result.value = wrapValue(result.value);
1191 }
1192 return result;
1193 };
1194 }
1195 return iter;
1196 }
1197 const arrayProto = Array.prototype;
1198 function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1199 const arr = shallowReadArray(self);
1200 const needsWrap = arr !== self && !isShallow(self);
1201 const methodFn = arr[method];
1202 if (methodFn !== arrayProto[method]) {
1203 const result2 = methodFn.apply(self, args);
1204 return needsWrap ? toReactive(result2) : result2;
1205 }
1206 let wrappedFn = fn;
1207 if (arr !== self) {
1208 if (needsWrap) {
1209 wrappedFn = function(item, index) {
1210 return fn.call(this, toReactive(item), index, self);
1211 };
1212 } else if (fn.length > 2) {
1213 wrappedFn = function(item, index) {
1214 return fn.call(this, item, index, self);
1215 };
1216 }
1217 }
1218 const result = methodFn.call(arr, wrappedFn, thisArg);
1219 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1220 }
1221 function reduce(self, method, fn, args) {
1222 const arr = shallowReadArray(self);
1223 let wrappedFn = fn;
1224 if (arr !== self) {
1225 if (!isShallow(self)) {
1226 wrappedFn = function(acc, item, index) {
1227 return fn.call(this, acc, toReactive(item), index, self);
1228 };
1229 } else if (fn.length > 3) {
1230 wrappedFn = function(acc, item, index) {
1231 return fn.call(this, acc, item, index, self);
1232 };
1233 }
1234 }
1235 return arr[method](wrappedFn, ...args);
1236 }
1237 function searchProxy(self, method, args) {
1238 const arr = toRaw(self);
1239 track(arr, "iterate", ARRAY_ITERATE_KEY);
1240 const res = arr[method](...args);
1241 if ((res === -1 || res === false) && isProxy(args[0])) {
1242 args[0] = toRaw(args[0]);
1243 return arr[method](...args);
1244 }
1245 return res;
1246 }
1247 function noTracking(self, method, args = []) {
1248 pauseTracking();
1249 startBatch();
1250 const res = toRaw(self)[method].apply(self, args);
1251 endBatch();
1252 resetTracking();
1253 return res;
1254 }
1255
1256 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
1257 const builtInSymbols = new Set(
1258 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
1259 );
1260 function hasOwnProperty(key) {
1261 if (!isSymbol(key)) key = String(key);
1262 const obj = toRaw(this);
1263 track(obj, "has", key);
1264 return obj.hasOwnProperty(key);
1265 }
1266 class BaseReactiveHandler {
1267 constructor(_isReadonly = false, _isShallow = false) {
1268 this._isReadonly = _isReadonly;
1269 this._isShallow = _isShallow;
1270 }
1271 get(target, key, receiver) {
1272 if (key === "__v_skip") return target["__v_skip"];
1273 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
1274 if (key === "__v_isReactive") {
1275 return !isReadonly2;
1276 } else if (key === "__v_isReadonly") {
1277 return isReadonly2;
1278 } else if (key === "__v_isShallow") {
1279 return isShallow2;
1280 } else if (key === "__v_raw") {
1281 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1282 // this means the receiver is a user proxy of the reactive proxy
1283 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1284 return target;
1285 }
1286 return;
1287 }
1288 const targetIsArray = isArray(target);
1289 if (!isReadonly2) {
1290 let fn;
1291 if (targetIsArray && (fn = arrayInstrumentations[key])) {
1292 return fn;
1293 }
1294 if (key === "hasOwnProperty") {
1295 return hasOwnProperty;
1296 }
1297 }
1298 const res = Reflect.get(
1299 target,
1300 key,
1301 // if this is a proxy wrapping a ref, return methods using the raw ref
1302 // as receiver so that we don't have to call `toRaw` on the ref in all
1303 // its class methods
1304 isRef(target) ? target : receiver
1305 );
1306 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1307 return res;
1308 }
1309 if (!isReadonly2) {
1310 track(target, "get", key);
1311 }
1312 if (isShallow2) {
1313 return res;
1314 }
1315 if (isRef(res)) {
1316 return targetIsArray && isIntegerKey(key) ? res : res.value;
1317 }
1318 if (isObject(res)) {
1319 return isReadonly2 ? readonly(res) : reactive(res);
1320 }
1321 return res;
1322 }
1323 }
1324 class MutableReactiveHandler extends BaseReactiveHandler {
1325 constructor(isShallow2 = false) {
1326 super(false, isShallow2);
1327 }
1328 set(target, key, value, receiver) {
1329 let oldValue = target[key];
1330 if (!this._isShallow) {
1331 const isOldValueReadonly = isReadonly(oldValue);
1332 if (!isShallow(value) && !isReadonly(value)) {
1333 oldValue = toRaw(oldValue);
1334 value = toRaw(value);
1335 }
1336 if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1337 if (isOldValueReadonly) {
1338 return false;
1339 } else {
1340 oldValue.value = value;
1341 return true;
1342 }
1343 }
1344 }
1345 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1346 const result = Reflect.set(
1347 target,
1348 key,
1349 value,
1350 isRef(target) ? target : receiver
1351 );
1352 if (target === toRaw(receiver)) {
1353 if (!hadKey) {
1354 trigger(target, "add", key, value);
1355 } else if (hasChanged(value, oldValue)) {
1356 trigger(target, "set", key, value, oldValue);
1357 }
1358 }
1359 return result;
1360 }
1361 deleteProperty(target, key) {
1362 const hadKey = hasOwn(target, key);
1363 const oldValue = target[key];
1364 const result = Reflect.deleteProperty(target, key);
1365 if (result && hadKey) {
1366 trigger(target, "delete", key, void 0, oldValue);
1367 }
1368 return result;
1369 }
1370 has(target, key) {
1371 const result = Reflect.has(target, key);
1372 if (!isSymbol(key) || !builtInSymbols.has(key)) {
1373 track(target, "has", key);
1374 }
1375 return result;
1376 }
1377 ownKeys(target) {
1378 track(
1379 target,
1380 "iterate",
1381 isArray(target) ? "length" : ITERATE_KEY
1382 );
1383 return Reflect.ownKeys(target);
1384 }
1385 }
1386 class ReadonlyReactiveHandler extends BaseReactiveHandler {
1387 constructor(isShallow2 = false) {
1388 super(true, isShallow2);
1389 }
1390 set(target, key) {
1391 {
1392 warn$2(
1393 `Set operation on key "${String(key)}" failed: target is readonly.`,
1394 target
1395 );
1396 }
1397 return true;
1398 }
1399 deleteProperty(target, key) {
1400 {
1401 warn$2(
1402 `Delete operation on key "${String(key)}" failed: target is readonly.`,
1403 target
1404 );
1405 }
1406 return true;
1407 }
1408 }
1409 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1410 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1411 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1412 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1413
1414 const toShallow = (value) => value;
1415 const getProto = (v) => Reflect.getPrototypeOf(v);
1416 function createIterableMethod(method, isReadonly2, isShallow2) {
1417 return function(...args) {
1418 const target = this["__v_raw"];
1419 const rawTarget = toRaw(target);
1420 const targetIsMap = isMap(rawTarget);
1421 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1422 const isKeyOnly = method === "keys" && targetIsMap;
1423 const innerIterator = target[method](...args);
1424 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
1425 !isReadonly2 && track(
1426 rawTarget,
1427 "iterate",
1428 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1429 );
1430 return {
1431 // iterator protocol
1432 next() {
1433 const { value, done } = innerIterator.next();
1434 return done ? { value, done } : {
1435 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1436 done
1437 };
1438 },
1439 // iterable protocol
1440 [Symbol.iterator]() {
1441 return this;
1442 }
1443 };
1444 };
1445 }
1446 function createReadonlyMethod(type) {
1447 return function(...args) {
1448 {
1449 const key = args[0] ? `on key "${args[0]}" ` : ``;
1450 warn$2(
1451 `${capitalize(type)} operation ${key}failed: target is readonly.`,
1452 toRaw(this)
1453 );
1454 }
1455 return type === "delete" ? false : type === "clear" ? void 0 : this;
1456 };
1457 }
1458 function createInstrumentations(readonly, shallow) {
1459 const instrumentations = {
1460 get(key) {
1461 const target = this["__v_raw"];
1462 const rawTarget = toRaw(target);
1463 const rawKey = toRaw(key);
1464 if (!readonly) {
1465 if (hasChanged(key, rawKey)) {
1466 track(rawTarget, "get", key);
1467 }
1468 track(rawTarget, "get", rawKey);
1469 }
1470 const { has } = getProto(rawTarget);
1471 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1472 if (has.call(rawTarget, key)) {
1473 return wrap(target.get(key));
1474 } else if (has.call(rawTarget, rawKey)) {
1475 return wrap(target.get(rawKey));
1476 } else if (target !== rawTarget) {
1477 target.get(key);
1478 }
1479 },
1480 get size() {
1481 const target = this["__v_raw"];
1482 !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1483 return Reflect.get(target, "size", target);
1484 },
1485 has(key) {
1486 const target = this["__v_raw"];
1487 const rawTarget = toRaw(target);
1488 const rawKey = toRaw(key);
1489 if (!readonly) {
1490 if (hasChanged(key, rawKey)) {
1491 track(rawTarget, "has", key);
1492 }
1493 track(rawTarget, "has", rawKey);
1494 }
1495 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
1496 },
1497 forEach(callback, thisArg) {
1498 const observed = this;
1499 const target = observed["__v_raw"];
1500 const rawTarget = toRaw(target);
1501 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1502 !readonly && track(rawTarget, "iterate", ITERATE_KEY);
1503 return target.forEach((value, key) => {
1504 return callback.call(thisArg, wrap(value), wrap(key), observed);
1505 });
1506 }
1507 };
1508 extend(
1509 instrumentations,
1510 readonly ? {
1511 add: createReadonlyMethod("add"),
1512 set: createReadonlyMethod("set"),
1513 delete: createReadonlyMethod("delete"),
1514 clear: createReadonlyMethod("clear")
1515 } : {
1516 add(value) {
1517 if (!shallow && !isShallow(value) && !isReadonly(value)) {
1518 value = toRaw(value);
1519 }
1520 const target = toRaw(this);
1521 const proto = getProto(target);
1522 const hadKey = proto.has.call(target, value);
1523 if (!hadKey) {
1524 target.add(value);
1525 trigger(target, "add", value, value);
1526 }
1527 return this;
1528 },
1529 set(key, value) {
1530 if (!shallow && !isShallow(value) && !isReadonly(value)) {
1531 value = toRaw(value);
1532 }
1533 const target = toRaw(this);
1534 const { has, get } = getProto(target);
1535 let hadKey = has.call(target, key);
1536 if (!hadKey) {
1537 key = toRaw(key);
1538 hadKey = has.call(target, key);
1539 } else {
1540 checkIdentityKeys(target, has, key);
1541 }
1542 const oldValue = get.call(target, key);
1543 target.set(key, value);
1544 if (!hadKey) {
1545 trigger(target, "add", key, value);
1546 } else if (hasChanged(value, oldValue)) {
1547 trigger(target, "set", key, value, oldValue);
1548 }
1549 return this;
1550 },
1551 delete(key) {
1552 const target = toRaw(this);
1553 const { has, get } = getProto(target);
1554 let hadKey = has.call(target, key);
1555 if (!hadKey) {
1556 key = toRaw(key);
1557 hadKey = has.call(target, key);
1558 } else {
1559 checkIdentityKeys(target, has, key);
1560 }
1561 const oldValue = get ? get.call(target, key) : void 0;
1562 const result = target.delete(key);
1563 if (hadKey) {
1564 trigger(target, "delete", key, void 0, oldValue);
1565 }
1566 return result;
1567 },
1568 clear() {
1569 const target = toRaw(this);
1570 const hadItems = target.size !== 0;
1571 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
1572 const result = target.clear();
1573 if (hadItems) {
1574 trigger(
1575 target,
1576 "clear",
1577 void 0,
1578 void 0,
1579 oldTarget
1580 );
1581 }
1582 return result;
1583 }
1584 }
1585 );
1586 const iteratorMethods = [
1587 "keys",
1588 "values",
1589 "entries",
1590 Symbol.iterator
1591 ];
1592 iteratorMethods.forEach((method) => {
1593 instrumentations[method] = createIterableMethod(method, readonly, shallow);
1594 });
1595 return instrumentations;
1596 }
1597 function createInstrumentationGetter(isReadonly2, shallow) {
1598 const instrumentations = createInstrumentations(isReadonly2, shallow);
1599 return (target, key, receiver) => {
1600 if (key === "__v_isReactive") {
1601 return !isReadonly2;
1602 } else if (key === "__v_isReadonly") {
1603 return isReadonly2;
1604 } else if (key === "__v_raw") {
1605 return target;
1606 }
1607 return Reflect.get(
1608 hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1609 key,
1610 receiver
1611 );
1612 };
1613 }
1614 const mutableCollectionHandlers = {
1615 get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1616 };
1617 const shallowCollectionHandlers = {
1618 get: /* @__PURE__ */ createInstrumentationGetter(false, true)
1619 };
1620 const readonlyCollectionHandlers = {
1621 get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1622 };
1623 const shallowReadonlyCollectionHandlers = {
1624 get: /* @__PURE__ */ createInstrumentationGetter(true, true)
1625 };
1626 function checkIdentityKeys(target, has, key) {
1627 const rawKey = toRaw(key);
1628 if (rawKey !== key && has.call(target, rawKey)) {
1629 const type = toRawType(target);
1630 warn$2(
1631 `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
1632 );
1633 }
1634 }
1635
1636 const reactiveMap = /* @__PURE__ */ new WeakMap();
1637 const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1638 const readonlyMap = /* @__PURE__ */ new WeakMap();
1639 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1640 function targetTypeMap(rawType) {
1641 switch (rawType) {
1642 case "Object":
1643 case "Array":
1644 return 1 /* COMMON */;
1645 case "Map":
1646 case "Set":
1647 case "WeakMap":
1648 case "WeakSet":
1649 return 2 /* COLLECTION */;
1650 default:
1651 return 0 /* INVALID */;
1652 }
1653 }
1654 function getTargetType(value) {
1655 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1656 }
1657 function reactive(target) {
1658 if (isReadonly(target)) {
1659 return target;
1660 }
1661 return createReactiveObject(
1662 target,
1663 false,
1664 mutableHandlers,
1665 mutableCollectionHandlers,
1666 reactiveMap
1667 );
1668 }
1669 function shallowReactive(target) {
1670 return createReactiveObject(
1671 target,
1672 false,
1673 shallowReactiveHandlers,
1674 shallowCollectionHandlers,
1675 shallowReactiveMap
1676 );
1677 }
1678 function readonly(target) {
1679 return createReactiveObject(
1680 target,
1681 true,
1682 readonlyHandlers,
1683 readonlyCollectionHandlers,
1684 readonlyMap
1685 );
1686 }
1687 function shallowReadonly(target) {
1688 return createReactiveObject(
1689 target,
1690 true,
1691 shallowReadonlyHandlers,
1692 shallowReadonlyCollectionHandlers,
1693 shallowReadonlyMap
1694 );
1695 }
1696 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1697 if (!isObject(target)) {
1698 {
1699 warn$2(
1700 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
1701 target
1702 )}`
1703 );
1704 }
1705 return target;
1706 }
1707 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1708 return target;
1709 }
1710 const existingProxy = proxyMap.get(target);
1711 if (existingProxy) {
1712 return existingProxy;
1713 }
1714 const targetType = getTargetType(target);
1715 if (targetType === 0 /* INVALID */) {
1716 return target;
1717 }
1718 const proxy = new Proxy(
1719 target,
1720 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1721 );
1722 proxyMap.set(target, proxy);
1723 return proxy;
1724 }
1725 function isReactive(value) {
1726 if (isReadonly(value)) {
1727 return isReactive(value["__v_raw"]);
1728 }
1729 return !!(value && value["__v_isReactive"]);
1730 }
1731 function isReadonly(value) {
1732 return !!(value && value["__v_isReadonly"]);
1733 }
1734 function isShallow(value) {
1735 return !!(value && value["__v_isShallow"]);
1736 }
1737 function isProxy(value) {
1738 return value ? !!value["__v_raw"] : false;
1739 }
1740 function toRaw(observed) {
1741 const raw = observed && observed["__v_raw"];
1742 return raw ? toRaw(raw) : observed;
1743 }
1744 function markRaw(value) {
1745 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1746 def(value, "__v_skip", true);
1747 }
1748 return value;
1749 }
1750 const toReactive = (value) => isObject(value) ? reactive(value) : value;
1751 const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1752
1753 function isRef(r) {
1754 return r ? r["__v_isRef"] === true : false;
1755 }
1756 function ref(value) {
1757 return createRef(value, false);
1758 }
1759 function shallowRef(value) {
1760 return createRef(value, true);
1761 }
1762 function createRef(rawValue, shallow) {
1763 if (isRef(rawValue)) {
1764 return rawValue;
1765 }
1766 return new RefImpl(rawValue, shallow);
1767 }
1768 class RefImpl {
1769 constructor(value, isShallow2) {
1770 this.dep = new Dep();
1771 this["__v_isRef"] = true;
1772 this["__v_isShallow"] = false;
1773 this._rawValue = isShallow2 ? value : toRaw(value);
1774 this._value = isShallow2 ? value : toReactive(value);
1775 this["__v_isShallow"] = isShallow2;
1776 }
1777 get value() {
1778 {
1779 this.dep.track({
1780 target: this,
1781 type: "get",
1782 key: "value"
1783 });
1784 }
1785 return this._value;
1786 }
1787 set value(newValue) {
1788 const oldValue = this._rawValue;
1789 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1790 newValue = useDirectValue ? newValue : toRaw(newValue);
1791 if (hasChanged(newValue, oldValue)) {
1792 this._rawValue = newValue;
1793 this._value = useDirectValue ? newValue : toReactive(newValue);
1794 {
1795 this.dep.trigger({
1796 target: this,
1797 type: "set",
1798 key: "value",
1799 newValue,
1800 oldValue
1801 });
1802 }
1803 }
1804 }
1805 }
1806 function triggerRef(ref2) {
1807 if (ref2.dep) {
1808 {
1809 ref2.dep.trigger({
1810 target: ref2,
1811 type: "set",
1812 key: "value",
1813 newValue: ref2._value
1814 });
1815 }
1816 }
1817 }
1818 function unref(ref2) {
1819 return isRef(ref2) ? ref2.value : ref2;
1820 }
1821 function toValue(source) {
1822 return isFunction(source) ? source() : unref(source);
1823 }
1824 const shallowUnwrapHandlers = {
1825 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1826 set: (target, key, value, receiver) => {
1827 const oldValue = target[key];
1828 if (isRef(oldValue) && !isRef(value)) {
1829 oldValue.value = value;
1830 return true;
1831 } else {
1832 return Reflect.set(target, key, value, receiver);
1833 }
1834 }
1835 };
1836 function proxyRefs(objectWithRefs) {
1837 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1838 }
1839 class CustomRefImpl {
1840 constructor(factory) {
1841 this["__v_isRef"] = true;
1842 this._value = void 0;
1843 const dep = this.dep = new Dep();
1844 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1845 this._get = get;
1846 this._set = set;
1847 }
1848 get value() {
1849 return this._value = this._get();
1850 }
1851 set value(newVal) {
1852 this._set(newVal);
1853 }
1854 }
1855 function customRef(factory) {
1856 return new CustomRefImpl(factory);
1857 }
1858 function toRefs(object) {
1859 if (!isProxy(object)) {
1860 warn$2(`toRefs() expects a reactive object but received a plain one.`);
1861 }
1862 const ret = isArray(object) ? new Array(object.length) : {};
1863 for (const key in object) {
1864 ret[key] = propertyToRef(object, key);
1865 }
1866 return ret;
1867 }
1868 class ObjectRefImpl {
1869 constructor(_object, _key, _defaultValue) {
1870 this._object = _object;
1871 this._key = _key;
1872 this._defaultValue = _defaultValue;
1873 this["__v_isRef"] = true;
1874 this._value = void 0;
1875 }
1876 get value() {
1877 const val = this._object[this._key];
1878 return this._value = val === void 0 ? this._defaultValue : val;
1879 }
1880 set value(newVal) {
1881 this._object[this._key] = newVal;
1882 }
1883 get dep() {
1884 return getDepFromReactive(toRaw(this._object), this._key);
1885 }
1886 }
1887 class GetterRefImpl {
1888 constructor(_getter) {
1889 this._getter = _getter;
1890 this["__v_isRef"] = true;
1891 this["__v_isReadonly"] = true;
1892 this._value = void 0;
1893 }
1894 get value() {
1895 return this._value = this._getter();
1896 }
1897 }
1898 function toRef(source, key, defaultValue) {
1899 if (isRef(source)) {
1900 return source;
1901 } else if (isFunction(source)) {
1902 return new GetterRefImpl(source);
1903 } else if (isObject(source) && arguments.length > 1) {
1904 return propertyToRef(source, key, defaultValue);
1905 } else {
1906 return ref(source);
1907 }
1908 }
1909 function propertyToRef(source, key, defaultValue) {
1910 const val = source[key];
1911 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1912 }
1913
1914 class ComputedRefImpl {
1915 constructor(fn, setter, isSSR) {
1916 this.fn = fn;
1917 this.setter = setter;
1918 /**
1919 * @internal
1920 */
1921 this._value = void 0;
1922 /**
1923 * @internal
1924 */
1925 this.dep = new Dep(this);
1926 /**
1927 * @internal
1928 */
1929 this.__v_isRef = true;
1930 // TODO isolatedDeclarations "__v_isReadonly"
1931 // A computed is also a subscriber that tracks other deps
1932 /**
1933 * @internal
1934 */
1935 this.deps = void 0;
1936 /**
1937 * @internal
1938 */
1939 this.depsTail = void 0;
1940 /**
1941 * @internal
1942 */
1943 this.flags = 16;
1944 /**
1945 * @internal
1946 */
1947 this.globalVersion = globalVersion - 1;
1948 /**
1949 * @internal
1950 */
1951 this.next = void 0;
1952 // for backwards compat
1953 this.effect = this;
1954 this["__v_isReadonly"] = !setter;
1955 this.isSSR = isSSR;
1956 }
1957 /**
1958 * @internal
1959 */
1960 notify() {
1961 this.flags |= 16;
1962 if (!(this.flags & 8) && // avoid infinite self recursion
1963 activeSub !== this) {
1964 batch(this, true);
1965 return true;
1966 }
1967 }
1968 get value() {
1969 const link = this.dep.track({
1970 target: this,
1971 type: "get",
1972 key: "value"
1973 }) ;
1974 refreshComputed(this);
1975 if (link) {
1976 link.version = this.dep.version;
1977 }
1978 return this._value;
1979 }
1980 set value(newValue) {
1981 if (this.setter) {
1982 this.setter(newValue);
1983 } else {
1984 warn$2("Write operation failed: computed value is readonly");
1985 }
1986 }
1987 }
1988 function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1989 let getter;
1990 let setter;
1991 if (isFunction(getterOrOptions)) {
1992 getter = getterOrOptions;
1993 } else {
1994 getter = getterOrOptions.get;
1995 setter = getterOrOptions.set;
1996 }
1997 const cRef = new ComputedRefImpl(getter, setter, isSSR);
1998 if (debugOptions && !isSSR) {
1999 cRef.onTrack = debugOptions.onTrack;
2000 cRef.onTrigger = debugOptions.onTrigger;
2001 }
2002 return cRef;
2003 }
2004
2005 const TrackOpTypes = {
2006 "GET": "get",
2007 "HAS": "has",
2008 "ITERATE": "iterate"
2009 };
2010 const TriggerOpTypes = {
2011 "SET": "set",
2012 "ADD": "add",
2013 "DELETE": "delete",
2014 "CLEAR": "clear"
2015 };
2016
2017 const INITIAL_WATCHER_VALUE = {};
2018 const cleanupMap = /* @__PURE__ */ new WeakMap();
2019 let activeWatcher = void 0;
2020 function getCurrentWatcher() {
2021 return activeWatcher;
2022 }
2023 function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
2024 if (owner) {
2025 let cleanups = cleanupMap.get(owner);
2026 if (!cleanups) cleanupMap.set(owner, cleanups = []);
2027 cleanups.push(cleanupFn);
2028 } else if (!failSilently) {
2029 warn$2(
2030 `onWatcherCleanup() was called when there was no active watcher to associate with.`
2031 );
2032 }
2033 }
2034 function watch$1(source, cb, options = EMPTY_OBJ) {
2035 const { immediate, deep, once, scheduler, augmentJob, call } = options;
2036 const warnInvalidSource = (s) => {
2037 (options.onWarn || warn$2)(
2038 `Invalid watch source: `,
2039 s,
2040 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2041 );
2042 };
2043 const reactiveGetter = (source2) => {
2044 if (deep) return source2;
2045 if (isShallow(source2) || deep === false || deep === 0)
2046 return traverse(source2, 1);
2047 return traverse(source2);
2048 };
2049 let effect;
2050 let getter;
2051 let cleanup;
2052 let boundCleanup;
2053 let forceTrigger = false;
2054 let isMultiSource = false;
2055 if (isRef(source)) {
2056 getter = () => source.value;
2057 forceTrigger = isShallow(source);
2058 } else if (isReactive(source)) {
2059 getter = () => reactiveGetter(source);
2060 forceTrigger = true;
2061 } else if (isArray(source)) {
2062 isMultiSource = true;
2063 forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2064 getter = () => source.map((s) => {
2065 if (isRef(s)) {
2066 return s.value;
2067 } else if (isReactive(s)) {
2068 return reactiveGetter(s);
2069 } else if (isFunction(s)) {
2070 return call ? call(s, 2) : s();
2071 } else {
2072 warnInvalidSource(s);
2073 }
2074 });
2075 } else if (isFunction(source)) {
2076 if (cb) {
2077 getter = call ? () => call(source, 2) : source;
2078 } else {
2079 getter = () => {
2080 if (cleanup) {
2081 pauseTracking();
2082 try {
2083 cleanup();
2084 } finally {
2085 resetTracking();
2086 }
2087 }
2088 const currentEffect = activeWatcher;
2089 activeWatcher = effect;
2090 try {
2091 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2092 } finally {
2093 activeWatcher = currentEffect;
2094 }
2095 };
2096 }
2097 } else {
2098 getter = NOOP;
2099 warnInvalidSource(source);
2100 }
2101 if (cb && deep) {
2102 const baseGetter = getter;
2103 const depth = deep === true ? Infinity : deep;
2104 getter = () => traverse(baseGetter(), depth);
2105 }
2106 const scope = getCurrentScope();
2107 const watchHandle = () => {
2108 effect.stop();
2109 if (scope && scope.active) {
2110 remove(scope.effects, effect);
2111 }
2112 };
2113 if (once && cb) {
2114 const _cb = cb;
2115 cb = (...args) => {
2116 _cb(...args);
2117 watchHandle();
2118 };
2119 }
2120 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2121 const job = (immediateFirstRun) => {
2122 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2123 return;
2124 }
2125 if (cb) {
2126 const newValue = effect.run();
2127 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2128 if (cleanup) {
2129 cleanup();
2130 }
2131 const currentWatcher = activeWatcher;
2132 activeWatcher = effect;
2133 try {
2134 const args = [
2135 newValue,
2136 // pass undefined as the old value when it's changed for the first time
2137 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2138 boundCleanup
2139 ];
2140 call ? call(cb, 3, args) : (
2141 // @ts-expect-error
2142 cb(...args)
2143 );
2144 oldValue = newValue;
2145 } finally {
2146 activeWatcher = currentWatcher;
2147 }
2148 }
2149 } else {
2150 effect.run();
2151 }
2152 };
2153 if (augmentJob) {
2154 augmentJob(job);
2155 }
2156 effect = new ReactiveEffect(getter);
2157 effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2158 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2159 cleanup = effect.onStop = () => {
2160 const cleanups = cleanupMap.get(effect);
2161 if (cleanups) {
2162 if (call) {
2163 call(cleanups, 4);
2164 } else {
2165 for (const cleanup2 of cleanups) cleanup2();
2166 }
2167 cleanupMap.delete(effect);
2168 }
2169 };
2170 {
2171 effect.onTrack = options.onTrack;
2172 effect.onTrigger = options.onTrigger;
2173 }
2174 if (cb) {
2175 if (immediate) {
2176 job(true);
2177 } else {
2178 oldValue = effect.run();
2179 }
2180 } else if (scheduler) {
2181 scheduler(job.bind(null, true), true);
2182 } else {
2183 effect.run();
2184 }
2185 watchHandle.pause = effect.pause.bind(effect);
2186 watchHandle.resume = effect.resume.bind(effect);
2187 watchHandle.stop = watchHandle;
2188 return watchHandle;
2189 }
2190 function traverse(value, depth = Infinity, seen) {
2191 if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2192 return value;
2193 }
2194 seen = seen || /* @__PURE__ */ new Set();
2195 if (seen.has(value)) {
2196 return value;
2197 }
2198 seen.add(value);
2199 depth--;
2200 if (isRef(value)) {
2201 traverse(value.value, depth, seen);
2202 } else if (isArray(value)) {
2203 for (let i = 0; i < value.length; i++) {
2204 traverse(value[i], depth, seen);
2205 }
2206 } else if (isSet(value) || isMap(value)) {
2207 value.forEach((v) => {
2208 traverse(v, depth, seen);
2209 });
2210 } else if (isPlainObject(value)) {
2211 for (const key in value) {
2212 traverse(value[key], depth, seen);
2213 }
2214 for (const key of Object.getOwnPropertySymbols(value)) {
2215 if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2216 traverse(value[key], depth, seen);
2217 }
2218 }
2219 }
2220 return value;
2221 }
2222
2223 const stack$1 = [];
2224 function pushWarningContext(vnode) {
2225 stack$1.push(vnode);
2226 }
2227 function popWarningContext() {
2228 stack$1.pop();
2229 }
2230 let isWarning = false;
2231 function warn$1(msg, ...args) {
2232 if (isWarning) return;
2233 isWarning = true;
2234 pauseTracking();
2235 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
2236 const appWarnHandler = instance && instance.appContext.config.warnHandler;
2237 const trace = getComponentTrace();
2238 if (appWarnHandler) {
2239 callWithErrorHandling(
2240 appWarnHandler,
2241 instance,
2242 11,
2243 [
2244 // eslint-disable-next-line no-restricted-syntax
2245 msg + args.map((a) => {
2246 var _a, _b;
2247 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2248 }).join(""),
2249 instance && instance.proxy,
2250 trace.map(
2251 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2252 ).join("\n"),
2253 trace
2254 ]
2255 );
2256 } else {
2257 const warnArgs = [`[Vue warn]: ${msg}`, ...args];
2258 if (trace.length && // avoid spamming console during tests
2259 true) {
2260 warnArgs.push(`
2261`, ...formatTrace(trace));
2262 }
2263 console.warn(...warnArgs);
2264 }
2265 resetTracking();
2266 isWarning = false;
2267 }
2268 function getComponentTrace() {
2269 let currentVNode = stack$1[stack$1.length - 1];
2270 if (!currentVNode) {
2271 return [];
2272 }
2273 const normalizedStack = [];
2274 while (currentVNode) {
2275 const last = normalizedStack[0];
2276 if (last && last.vnode === currentVNode) {
2277 last.recurseCount++;
2278 } else {
2279 normalizedStack.push({
2280 vnode: currentVNode,
2281 recurseCount: 0
2282 });
2283 }
2284 const parentInstance = currentVNode.component && currentVNode.component.parent;
2285 currentVNode = parentInstance && parentInstance.vnode;
2286 }
2287 return normalizedStack;
2288 }
2289 function formatTrace(trace) {
2290 const logs = [];
2291 trace.forEach((entry, i) => {
2292 logs.push(...i === 0 ? [] : [`
2293`], ...formatTraceEntry(entry));
2294 });
2295 return logs;
2296 }
2297 function formatTraceEntry({ vnode, recurseCount }) {
2298 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2299 const isRoot = vnode.component ? vnode.component.parent == null : false;
2300 const open = ` at <${formatComponentName(
2301 vnode.component,
2302 vnode.type,
2303 isRoot
2304 )}`;
2305 const close = `>` + postfix;
2306 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2307 }
2308 function formatProps(props) {
2309 const res = [];
2310 const keys = Object.keys(props);
2311 keys.slice(0, 3).forEach((key) => {
2312 res.push(...formatProp(key, props[key]));
2313 });
2314 if (keys.length > 3) {
2315 res.push(` ...`);
2316 }
2317 return res;
2318 }
2319 function formatProp(key, value, raw) {
2320 if (isString(value)) {
2321 value = JSON.stringify(value);
2322 return raw ? value : [`${key}=${value}`];
2323 } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
2324 return raw ? value : [`${key}=${value}`];
2325 } else if (isRef(value)) {
2326 value = formatProp(key, toRaw(value.value), true);
2327 return raw ? value : [`${key}=Ref<`, value, `>`];
2328 } else if (isFunction(value)) {
2329 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
2330 } else {
2331 value = toRaw(value);
2332 return raw ? value : [`${key}=`, value];
2333 }
2334 }
2335 function assertNumber(val, type) {
2336 if (val === void 0) {
2337 return;
2338 } else if (typeof val !== "number") {
2339 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
2340 } else if (isNaN(val)) {
2341 warn$1(`${type} is NaN - the duration expression might be incorrect.`);
2342 }
2343 }
2344
2345 const ErrorCodes = {
2346 "SETUP_FUNCTION": 0,
2347 "0": "SETUP_FUNCTION",
2348 "RENDER_FUNCTION": 1,
2349 "1": "RENDER_FUNCTION",
2350 "NATIVE_EVENT_HANDLER": 5,
2351 "5": "NATIVE_EVENT_HANDLER",
2352 "COMPONENT_EVENT_HANDLER": 6,
2353 "6": "COMPONENT_EVENT_HANDLER",
2354 "VNODE_HOOK": 7,
2355 "7": "VNODE_HOOK",
2356 "DIRECTIVE_HOOK": 8,
2357 "8": "DIRECTIVE_HOOK",
2358 "TRANSITION_HOOK": 9,
2359 "9": "TRANSITION_HOOK",
2360 "APP_ERROR_HANDLER": 10,
2361 "10": "APP_ERROR_HANDLER",
2362 "APP_WARN_HANDLER": 11,
2363 "11": "APP_WARN_HANDLER",
2364 "FUNCTION_REF": 12,
2365 "12": "FUNCTION_REF",
2366 "ASYNC_COMPONENT_LOADER": 13,
2367 "13": "ASYNC_COMPONENT_LOADER",
2368 "SCHEDULER": 14,
2369 "14": "SCHEDULER",
2370 "COMPONENT_UPDATE": 15,
2371 "15": "COMPONENT_UPDATE",
2372 "APP_UNMOUNT_CLEANUP": 16,
2373 "16": "APP_UNMOUNT_CLEANUP"
2374 };
2375 const ErrorTypeStrings$1 = {
2376 ["sp"]: "serverPrefetch hook",
2377 ["bc"]: "beforeCreate hook",
2378 ["c"]: "created hook",
2379 ["bm"]: "beforeMount hook",
2380 ["m"]: "mounted hook",
2381 ["bu"]: "beforeUpdate hook",
2382 ["u"]: "updated",
2383 ["bum"]: "beforeUnmount hook",
2384 ["um"]: "unmounted hook",
2385 ["a"]: "activated hook",
2386 ["da"]: "deactivated hook",
2387 ["ec"]: "errorCaptured hook",
2388 ["rtc"]: "renderTracked hook",
2389 ["rtg"]: "renderTriggered hook",
2390 [0]: "setup function",
2391 [1]: "render function",
2392 [2]: "watcher getter",
2393 [3]: "watcher callback",
2394 [4]: "watcher cleanup function",
2395 [5]: "native event handler",
2396 [6]: "component event handler",
2397 [7]: "vnode hook",
2398 [8]: "directive hook",
2399 [9]: "transition hook",
2400 [10]: "app errorHandler",
2401 [11]: "app warnHandler",
2402 [12]: "ref function",
2403 [13]: "async component loader",
2404 [14]: "scheduler flush",
2405 [15]: "component update",
2406 [16]: "app unmount cleanup function"
2407 };
2408 function callWithErrorHandling(fn, instance, type, args) {
2409 try {
2410 return args ? fn(...args) : fn();
2411 } catch (err) {
2412 handleError(err, instance, type);
2413 }
2414 }
2415 function callWithAsyncErrorHandling(fn, instance, type, args) {
2416 if (isFunction(fn)) {
2417 const res = callWithErrorHandling(fn, instance, type, args);
2418 if (res && isPromise(res)) {
2419 res.catch((err) => {
2420 handleError(err, instance, type);
2421 });
2422 }
2423 return res;
2424 }
2425 if (isArray(fn)) {
2426 const values = [];
2427 for (let i = 0; i < fn.length; i++) {
2428 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
2429 }
2430 return values;
2431 } else {
2432 warn$1(
2433 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
2434 );
2435 }
2436 }
2437 function handleError(err, instance, type, throwInDev = true) {
2438 const contextVNode = instance ? instance.vnode : null;
2439 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2440 if (instance) {
2441 let cur = instance.parent;
2442 const exposedInstance = instance.proxy;
2443 const errorInfo = ErrorTypeStrings$1[type] ;
2444 while (cur) {
2445 const errorCapturedHooks = cur.ec;
2446 if (errorCapturedHooks) {
2447 for (let i = 0; i < errorCapturedHooks.length; i++) {
2448 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
2449 return;
2450 }
2451 }
2452 }
2453 cur = cur.parent;
2454 }
2455 if (errorHandler) {
2456 pauseTracking();
2457 callWithErrorHandling(errorHandler, null, 10, [
2458 err,
2459 exposedInstance,
2460 errorInfo
2461 ]);
2462 resetTracking();
2463 return;
2464 }
2465 }
2466 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2467 }
2468 function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2469 {
2470 const info = ErrorTypeStrings$1[type];
2471 if (contextVNode) {
2472 pushWarningContext(contextVNode);
2473 }
2474 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2475 if (contextVNode) {
2476 popWarningContext();
2477 }
2478 if (throwInDev) {
2479 throw err;
2480 } else {
2481 console.error(err);
2482 }
2483 }
2484 }
2485
2486 const queue = [];
2487 let flushIndex = -1;
2488 const pendingPostFlushCbs = [];
2489 let activePostFlushCbs = null;
2490 let postFlushIndex = 0;
2491 const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2492 let currentFlushPromise = null;
2493 const RECURSION_LIMIT = 100;
2494 function nextTick(fn) {
2495 const p = currentFlushPromise || resolvedPromise;
2496 return fn ? p.then(this ? fn.bind(this) : fn) : p;
2497 }
2498 function findInsertionIndex(id) {
2499 let start = flushIndex + 1;
2500 let end = queue.length;
2501 while (start < end) {
2502 const middle = start + end >>> 1;
2503 const middleJob = queue[middle];
2504 const middleJobId = getId(middleJob);
2505 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2506 start = middle + 1;
2507 } else {
2508 end = middle;
2509 }
2510 }
2511 return start;
2512 }
2513 function queueJob(job) {
2514 if (!(job.flags & 1)) {
2515 const jobId = getId(job);
2516 const lastJob = queue[queue.length - 1];
2517 if (!lastJob || // fast path when the job id is larger than the tail
2518 !(job.flags & 2) && jobId >= getId(lastJob)) {
2519 queue.push(job);
2520 } else {
2521 queue.splice(findInsertionIndex(jobId), 0, job);
2522 }
2523 job.flags |= 1;
2524 queueFlush();
2525 }
2526 }
2527 function queueFlush() {
2528 if (!currentFlushPromise) {
2529 currentFlushPromise = resolvedPromise.then(flushJobs);
2530 }
2531 }
2532 function queuePostFlushCb(cb) {
2533 if (!isArray(cb)) {
2534 if (activePostFlushCbs && cb.id === -1) {
2535 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2536 } else if (!(cb.flags & 1)) {
2537 pendingPostFlushCbs.push(cb);
2538 cb.flags |= 1;
2539 }
2540 } else {
2541 pendingPostFlushCbs.push(...cb);
2542 }
2543 queueFlush();
2544 }
2545 function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2546 {
2547 seen = seen || /* @__PURE__ */ new Map();
2548 }
2549 for (; i < queue.length; i++) {
2550 const cb = queue[i];
2551 if (cb && cb.flags & 2) {
2552 if (instance && cb.id !== instance.uid) {
2553 continue;
2554 }
2555 if (checkRecursiveUpdates(seen, cb)) {
2556 continue;
2557 }
2558 queue.splice(i, 1);
2559 i--;
2560 if (cb.flags & 4) {
2561 cb.flags &= ~1;
2562 }
2563 cb();
2564 if (!(cb.flags & 4)) {
2565 cb.flags &= ~1;
2566 }
2567 }
2568 }
2569 }
2570 function flushPostFlushCbs(seen) {
2571 if (pendingPostFlushCbs.length) {
2572 const deduped = [...new Set(pendingPostFlushCbs)].sort(
2573 (a, b) => getId(a) - getId(b)
2574 );
2575 pendingPostFlushCbs.length = 0;
2576 if (activePostFlushCbs) {
2577 activePostFlushCbs.push(...deduped);
2578 return;
2579 }
2580 activePostFlushCbs = deduped;
2581 {
2582 seen = seen || /* @__PURE__ */ new Map();
2583 }
2584 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2585 const cb = activePostFlushCbs[postFlushIndex];
2586 if (checkRecursiveUpdates(seen, cb)) {
2587 continue;
2588 }
2589 if (cb.flags & 4) {
2590 cb.flags &= ~1;
2591 }
2592 if (!(cb.flags & 8)) cb();
2593 cb.flags &= ~1;
2594 }
2595 activePostFlushCbs = null;
2596 postFlushIndex = 0;
2597 }
2598 }
2599 const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2600 function flushJobs(seen) {
2601 {
2602 seen = seen || /* @__PURE__ */ new Map();
2603 }
2604 const check = (job) => checkRecursiveUpdates(seen, job) ;
2605 try {
2606 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2607 const job = queue[flushIndex];
2608 if (job && !(job.flags & 8)) {
2609 if (check(job)) {
2610 continue;
2611 }
2612 if (job.flags & 4) {
2613 job.flags &= ~1;
2614 }
2615 callWithErrorHandling(
2616 job,
2617 job.i,
2618 job.i ? 15 : 14
2619 );
2620 if (!(job.flags & 4)) {
2621 job.flags &= ~1;
2622 }
2623 }
2624 }
2625 } finally {
2626 for (; flushIndex < queue.length; flushIndex++) {
2627 const job = queue[flushIndex];
2628 if (job) {
2629 job.flags &= ~1;
2630 }
2631 }
2632 flushIndex = -1;
2633 queue.length = 0;
2634 flushPostFlushCbs(seen);
2635 currentFlushPromise = null;
2636 if (queue.length || pendingPostFlushCbs.length) {
2637 flushJobs(seen);
2638 }
2639 }
2640 }
2641 function checkRecursiveUpdates(seen, fn) {
2642 const count = seen.get(fn) || 0;
2643 if (count > RECURSION_LIMIT) {
2644 const instance = fn.i;
2645 const componentName = instance && getComponentName(instance.type);
2646 handleError(
2647 `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2648 null,
2649 10
2650 );
2651 return true;
2652 }
2653 seen.set(fn, count + 1);
2654 return false;
2655 }
2656
2657 let isHmrUpdating = false;
2658 const hmrDirtyComponents = /* @__PURE__ */ new Map();
2659 {
2660 getGlobalThis().__VUE_HMR_RUNTIME__ = {
2661 createRecord: tryWrap(createRecord),
2662 rerender: tryWrap(rerender),
2663 reload: tryWrap(reload)
2664 };
2665 }
2666 const map = /* @__PURE__ */ new Map();
2667 function registerHMR(instance) {
2668 const id = instance.type.__hmrId;
2669 let record = map.get(id);
2670 if (!record) {
2671 createRecord(id, instance.type);
2672 record = map.get(id);
2673 }
2674 record.instances.add(instance);
2675 }
2676 function unregisterHMR(instance) {
2677 map.get(instance.type.__hmrId).instances.delete(instance);
2678 }
2679 function createRecord(id, initialDef) {
2680 if (map.has(id)) {
2681 return false;
2682 }
2683 map.set(id, {
2684 initialDef: normalizeClassComponent(initialDef),
2685 instances: /* @__PURE__ */ new Set()
2686 });
2687 return true;
2688 }
2689 function normalizeClassComponent(component) {
2690 return isClassComponent(component) ? component.__vccOpts : component;
2691 }
2692 function rerender(id, newRender) {
2693 const record = map.get(id);
2694 if (!record) {
2695 return;
2696 }
2697 record.initialDef.render = newRender;
2698 [...record.instances].forEach((instance) => {
2699 if (newRender) {
2700 instance.render = newRender;
2701 normalizeClassComponent(instance.type).render = newRender;
2702 }
2703 instance.renderCache = [];
2704 isHmrUpdating = true;
2705 instance.update();
2706 isHmrUpdating = false;
2707 });
2708 }
2709 function reload(id, newComp) {
2710 const record = map.get(id);
2711 if (!record) return;
2712 newComp = normalizeClassComponent(newComp);
2713 updateComponentDef(record.initialDef, newComp);
2714 const instances = [...record.instances];
2715 for (let i = 0; i < instances.length; i++) {
2716 const instance = instances[i];
2717 const oldComp = normalizeClassComponent(instance.type);
2718 let dirtyInstances = hmrDirtyComponents.get(oldComp);
2719 if (!dirtyInstances) {
2720 if (oldComp !== record.initialDef) {
2721 updateComponentDef(oldComp, newComp);
2722 }
2723 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2724 }
2725 dirtyInstances.add(instance);
2726 instance.appContext.propsCache.delete(instance.type);
2727 instance.appContext.emitsCache.delete(instance.type);
2728 instance.appContext.optionsCache.delete(instance.type);
2729 if (instance.ceReload) {
2730 dirtyInstances.add(instance);
2731 instance.ceReload(newComp.styles);
2732 dirtyInstances.delete(instance);
2733 } else if (instance.parent) {
2734 queueJob(() => {
2735 isHmrUpdating = true;
2736 instance.parent.update();
2737 isHmrUpdating = false;
2738 dirtyInstances.delete(instance);
2739 });
2740 } else if (instance.appContext.reload) {
2741 instance.appContext.reload();
2742 } else if (typeof window !== "undefined") {
2743 window.location.reload();
2744 } else {
2745 console.warn(
2746 "[HMR] Root or manually mounted instance modified. Full reload required."
2747 );
2748 }
2749 if (instance.root.ce && instance !== instance.root) {
2750 instance.root.ce._removeChildStyle(oldComp);
2751 }
2752 }
2753 queuePostFlushCb(() => {
2754 hmrDirtyComponents.clear();
2755 });
2756 }
2757 function updateComponentDef(oldComp, newComp) {
2758 extend(oldComp, newComp);
2759 for (const key in oldComp) {
2760 if (key !== "__file" && !(key in newComp)) {
2761 delete oldComp[key];
2762 }
2763 }
2764 }
2765 function tryWrap(fn) {
2766 return (id, arg) => {
2767 try {
2768 return fn(id, arg);
2769 } catch (e) {
2770 console.error(e);
2771 console.warn(
2772 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
2773 );
2774 }
2775 };
2776 }
2777
2778 let devtools$1;
2779 let buffer = [];
2780 let devtoolsNotInstalled = false;
2781 function emit$1(event, ...args) {
2782 if (devtools$1) {
2783 devtools$1.emit(event, ...args);
2784 } else if (!devtoolsNotInstalled) {
2785 buffer.push({ event, args });
2786 }
2787 }
2788 function setDevtoolsHook$1(hook, target) {
2789 var _a, _b;
2790 devtools$1 = hook;
2791 if (devtools$1) {
2792 devtools$1.enabled = true;
2793 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
2794 buffer = [];
2795 } else if (
2796 // handle late devtools injection - only do this if we are in an actual
2797 // browser environment to avoid the timer handle stalling test runner exit
2798 // (#4815)
2799 typeof window !== "undefined" && // some envs mock window but not fully
2800 window.HTMLElement && // also exclude jsdom
2801 // eslint-disable-next-line no-restricted-syntax
2802 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
2803 ) {
2804 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
2805 replay.push((newHook) => {
2806 setDevtoolsHook$1(newHook, target);
2807 });
2808 setTimeout(() => {
2809 if (!devtools$1) {
2810 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
2811 devtoolsNotInstalled = true;
2812 buffer = [];
2813 }
2814 }, 3e3);
2815 } else {
2816 devtoolsNotInstalled = true;
2817 buffer = [];
2818 }
2819 }
2820 function devtoolsInitApp(app, version) {
2821 emit$1("app:init" /* APP_INIT */, app, version, {
2822 Fragment,
2823 Text,
2824 Comment,
2825 Static
2826 });
2827 }
2828 function devtoolsUnmountApp(app) {
2829 emit$1("app:unmount" /* APP_UNMOUNT */, app);
2830 }
2831 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2832 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2833 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2834 "component:removed" /* COMPONENT_REMOVED */
2835 );
2836 const devtoolsComponentRemoved = (component) => {
2837 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
2838 !devtools$1.cleanupBuffer(component)) {
2839 _devtoolsComponentRemoved(component);
2840 }
2841 };
2842 /*! #__NO_SIDE_EFFECTS__ */
2843 // @__NO_SIDE_EFFECTS__
2844 function createDevtoolsComponentHook(hook) {
2845 return (component) => {
2846 emit$1(
2847 hook,
2848 component.appContext.app,
2849 component.uid,
2850 component.parent ? component.parent.uid : void 0,
2851 component
2852 );
2853 };
2854 }
2855 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2856 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2857 function createDevtoolsPerformanceHook(hook) {
2858 return (component, type, time) => {
2859 emit$1(hook, component.appContext.app, component.uid, component, type, time);
2860 };
2861 }
2862 function devtoolsComponentEmit(component, event, params) {
2863 emit$1(
2864 "component:emit" /* COMPONENT_EMIT */,
2865 component.appContext.app,
2866 component,
2867 event,
2868 params
2869 );
2870 }
2871
2872 let currentRenderingInstance = null;
2873 let currentScopeId = null;
2874 function setCurrentRenderingInstance(instance) {
2875 const prev = currentRenderingInstance;
2876 currentRenderingInstance = instance;
2877 currentScopeId = instance && instance.type.__scopeId || null;
2878 return prev;
2879 }
2880 function pushScopeId(id) {
2881 currentScopeId = id;
2882 }
2883 function popScopeId() {
2884 currentScopeId = null;
2885 }
2886 const withScopeId = (_id) => withCtx;
2887 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2888 if (!ctx) return fn;
2889 if (fn._n) {
2890 return fn;
2891 }
2892 const renderFnWithContext = (...args) => {
2893 if (renderFnWithContext._d) {
2894 setBlockTracking(-1);
2895 }
2896 const prevInstance = setCurrentRenderingInstance(ctx);
2897 let res;
2898 try {
2899 res = fn(...args);
2900 } finally {
2901 setCurrentRenderingInstance(prevInstance);
2902 if (renderFnWithContext._d) {
2903 setBlockTracking(1);
2904 }
2905 }
2906 {
2907 devtoolsComponentUpdated(ctx);
2908 }
2909 return res;
2910 };
2911 renderFnWithContext._n = true;
2912 renderFnWithContext._c = true;
2913 renderFnWithContext._d = true;
2914 return renderFnWithContext;
2915 }
2916
2917 function validateDirectiveName(name) {
2918 if (isBuiltInDirective(name)) {
2919 warn$1("Do not use built-in directive ids as custom directive id: " + name);
2920 }
2921 }
2922 function withDirectives(vnode, directives) {
2923 if (currentRenderingInstance === null) {
2924 warn$1(`withDirectives can only be used inside render functions.`);
2925 return vnode;
2926 }
2927 const instance = getComponentPublicInstance(currentRenderingInstance);
2928 const bindings = vnode.dirs || (vnode.dirs = []);
2929 for (let i = 0; i < directives.length; i++) {
2930 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2931 if (dir) {
2932 if (isFunction(dir)) {
2933 dir = {
2934 mounted: dir,
2935 updated: dir
2936 };
2937 }
2938 if (dir.deep) {
2939 traverse(value);
2940 }
2941 bindings.push({
2942 dir,
2943 instance,
2944 value,
2945 oldValue: void 0,
2946 arg,
2947 modifiers
2948 });
2949 }
2950 }
2951 return vnode;
2952 }
2953 function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2954 const bindings = vnode.dirs;
2955 const oldBindings = prevVNode && prevVNode.dirs;
2956 for (let i = 0; i < bindings.length; i++) {
2957 const binding = bindings[i];
2958 if (oldBindings) {
2959 binding.oldValue = oldBindings[i].value;
2960 }
2961 let hook = binding.dir[name];
2962 if (hook) {
2963 pauseTracking();
2964 callWithAsyncErrorHandling(hook, instance, 8, [
2965 vnode.el,
2966 binding,
2967 vnode,
2968 prevVNode
2969 ]);
2970 resetTracking();
2971 }
2972 }
2973 }
2974
2975 const TeleportEndKey = Symbol("_vte");
2976 const isTeleport = (type) => type.__isTeleport;
2977 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
2978 const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
2979 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
2980 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
2981 const resolveTarget = (props, select) => {
2982 const targetSelector = props && props.to;
2983 if (isString(targetSelector)) {
2984 if (!select) {
2985 warn$1(
2986 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
2987 );
2988 return null;
2989 } else {
2990 const target = select(targetSelector);
2991 if (!target && !isTeleportDisabled(props)) {
2992 warn$1(
2993 `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
2994 );
2995 }
2996 return target;
2997 }
2998 } else {
2999 if (!targetSelector && !isTeleportDisabled(props)) {
3000 warn$1(`Invalid Teleport target: ${targetSelector}`);
3001 }
3002 return targetSelector;
3003 }
3004 };
3005 const TeleportImpl = {
3006 name: "Teleport",
3007 __isTeleport: true,
3008 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3009 const {
3010 mc: mountChildren,
3011 pc: patchChildren,
3012 pbc: patchBlockChildren,
3013 o: { insert, querySelector, createText, createComment }
3014 } = internals;
3015 const disabled = isTeleportDisabled(n2.props);
3016 let { shapeFlag, children, dynamicChildren } = n2;
3017 if (isHmrUpdating) {
3018 optimized = false;
3019 dynamicChildren = null;
3020 }
3021 if (n1 == null) {
3022 const placeholder = n2.el = createComment("teleport start") ;
3023 const mainAnchor = n2.anchor = createComment("teleport end") ;
3024 insert(placeholder, container, anchor);
3025 insert(mainAnchor, container, anchor);
3026 const mount = (container2, anchor2) => {
3027 if (shapeFlag & 16) {
3028 if (parentComponent && parentComponent.isCE) {
3029 parentComponent.ce._teleportTarget = container2;
3030 }
3031 mountChildren(
3032 children,
3033 container2,
3034 anchor2,
3035 parentComponent,
3036 parentSuspense,
3037 namespace,
3038 slotScopeIds,
3039 optimized
3040 );
3041 }
3042 };
3043 const mountToTarget = () => {
3044 const target = n2.target = resolveTarget(n2.props, querySelector);
3045 const targetAnchor = prepareAnchor(target, n2, createText, insert);
3046 if (target) {
3047 if (namespace !== "svg" && isTargetSVG(target)) {
3048 namespace = "svg";
3049 } else if (namespace !== "mathml" && isTargetMathML(target)) {
3050 namespace = "mathml";
3051 }
3052 if (!disabled) {
3053 mount(target, targetAnchor);
3054 updateCssVars(n2, false);
3055 }
3056 } else if (!disabled) {
3057 warn$1(
3058 "Invalid Teleport target on mount:",
3059 target,
3060 `(${typeof target})`
3061 );
3062 }
3063 };
3064 if (disabled) {
3065 mount(container, mainAnchor);
3066 updateCssVars(n2, true);
3067 }
3068 if (isTeleportDeferred(n2.props)) {
3069 queuePostRenderEffect(() => {
3070 mountToTarget();
3071 n2.el.__isMounted = true;
3072 }, parentSuspense);
3073 } else {
3074 mountToTarget();
3075 }
3076 } else {
3077 if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3078 queuePostRenderEffect(() => {
3079 TeleportImpl.process(
3080 n1,
3081 n2,
3082 container,
3083 anchor,
3084 parentComponent,
3085 parentSuspense,
3086 namespace,
3087 slotScopeIds,
3088 optimized,
3089 internals
3090 );
3091 delete n1.el.__isMounted;
3092 }, parentSuspense);
3093 return;
3094 }
3095 n2.el = n1.el;
3096 n2.targetStart = n1.targetStart;
3097 const mainAnchor = n2.anchor = n1.anchor;
3098 const target = n2.target = n1.target;
3099 const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3100 const wasDisabled = isTeleportDisabled(n1.props);
3101 const currentContainer = wasDisabled ? container : target;
3102 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
3103 if (namespace === "svg" || isTargetSVG(target)) {
3104 namespace = "svg";
3105 } else if (namespace === "mathml" || isTargetMathML(target)) {
3106 namespace = "mathml";
3107 }
3108 if (dynamicChildren) {
3109 patchBlockChildren(
3110 n1.dynamicChildren,
3111 dynamicChildren,
3112 currentContainer,
3113 parentComponent,
3114 parentSuspense,
3115 namespace,
3116 slotScopeIds
3117 );
3118 traverseStaticChildren(n1, n2, true);
3119 } else if (!optimized) {
3120 patchChildren(
3121 n1,
3122 n2,
3123 currentContainer,
3124 currentAnchor,
3125 parentComponent,
3126 parentSuspense,
3127 namespace,
3128 slotScopeIds,
3129 false
3130 );
3131 }
3132 if (disabled) {
3133 if (!wasDisabled) {
3134 moveTeleport(
3135 n2,
3136 container,
3137 mainAnchor,
3138 internals,
3139 1
3140 );
3141 } else {
3142 if (n2.props && n1.props && n2.props.to !== n1.props.to) {
3143 n2.props.to = n1.props.to;
3144 }
3145 }
3146 } else {
3147 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3148 const nextTarget = n2.target = resolveTarget(
3149 n2.props,
3150 querySelector
3151 );
3152 if (nextTarget) {
3153 moveTeleport(
3154 n2,
3155 nextTarget,
3156 null,
3157 internals,
3158 0
3159 );
3160 } else {
3161 warn$1(
3162 "Invalid Teleport target on update:",
3163 target,
3164 `(${typeof target})`
3165 );
3166 }
3167 } else if (wasDisabled) {
3168 moveTeleport(
3169 n2,
3170 target,
3171 targetAnchor,
3172 internals,
3173 1
3174 );
3175 }
3176 }
3177 updateCssVars(n2, disabled);
3178 }
3179 },
3180 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3181 const {
3182 shapeFlag,
3183 children,
3184 anchor,
3185 targetStart,
3186 targetAnchor,
3187 target,
3188 props
3189 } = vnode;
3190 if (target) {
3191 hostRemove(targetStart);
3192 hostRemove(targetAnchor);
3193 }
3194 doRemove && hostRemove(anchor);
3195 if (shapeFlag & 16) {
3196 const shouldRemove = doRemove || !isTeleportDisabled(props);
3197 for (let i = 0; i < children.length; i++) {
3198 const child = children[i];
3199 unmount(
3200 child,
3201 parentComponent,
3202 parentSuspense,
3203 shouldRemove,
3204 !!child.dynamicChildren
3205 );
3206 }
3207 }
3208 },
3209 move: moveTeleport,
3210 hydrate: hydrateTeleport
3211 };
3212 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3213 if (moveType === 0) {
3214 insert(vnode.targetAnchor, container, parentAnchor);
3215 }
3216 const { el, anchor, shapeFlag, children, props } = vnode;
3217 const isReorder = moveType === 2;
3218 if (isReorder) {
3219 insert(el, container, parentAnchor);
3220 }
3221 if (!isReorder || isTeleportDisabled(props)) {
3222 if (shapeFlag & 16) {
3223 for (let i = 0; i < children.length; i++) {
3224 move(
3225 children[i],
3226 container,
3227 parentAnchor,
3228 2
3229 );
3230 }
3231 }
3232 }
3233 if (isReorder) {
3234 insert(anchor, container, parentAnchor);
3235 }
3236 }
3237 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3238 o: { nextSibling, parentNode, querySelector, insert, createText }
3239 }, hydrateChildren) {
3240 const target = vnode.target = resolveTarget(
3241 vnode.props,
3242 querySelector
3243 );
3244 if (target) {
3245 const disabled = isTeleportDisabled(vnode.props);
3246 const targetNode = target._lpa || target.firstChild;
3247 if (vnode.shapeFlag & 16) {
3248 if (disabled) {
3249 vnode.anchor = hydrateChildren(
3250 nextSibling(node),
3251 vnode,
3252 parentNode(node),
3253 parentComponent,
3254 parentSuspense,
3255 slotScopeIds,
3256 optimized
3257 );
3258 vnode.targetStart = targetNode;
3259 vnode.targetAnchor = targetNode && nextSibling(targetNode);
3260 } else {
3261 vnode.anchor = nextSibling(node);
3262 let targetAnchor = targetNode;
3263 while (targetAnchor) {
3264 if (targetAnchor && targetAnchor.nodeType === 8) {
3265 if (targetAnchor.data === "teleport start anchor") {
3266 vnode.targetStart = targetAnchor;
3267 } else if (targetAnchor.data === "teleport anchor") {
3268 vnode.targetAnchor = targetAnchor;
3269 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3270 break;
3271 }
3272 }
3273 targetAnchor = nextSibling(targetAnchor);
3274 }
3275 if (!vnode.targetAnchor) {
3276 prepareAnchor(target, vnode, createText, insert);
3277 }
3278 hydrateChildren(
3279 targetNode && nextSibling(targetNode),
3280 vnode,
3281 target,
3282 parentComponent,
3283 parentSuspense,
3284 slotScopeIds,
3285 optimized
3286 );
3287 }
3288 }
3289 updateCssVars(vnode, disabled);
3290 }
3291 return vnode.anchor && nextSibling(vnode.anchor);
3292 }
3293 const Teleport = TeleportImpl;
3294 function updateCssVars(vnode, isDisabled) {
3295 const ctx = vnode.ctx;
3296 if (ctx && ctx.ut) {
3297 let node, anchor;
3298 if (isDisabled) {
3299 node = vnode.el;
3300 anchor = vnode.anchor;
3301 } else {
3302 node = vnode.targetStart;
3303 anchor = vnode.targetAnchor;
3304 }
3305 while (node && node !== anchor) {
3306 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
3307 node = node.nextSibling;
3308 }
3309 ctx.ut();
3310 }
3311 }
3312 function prepareAnchor(target, vnode, createText, insert) {
3313 const targetStart = vnode.targetStart = createText("");
3314 const targetAnchor = vnode.targetAnchor = createText("");
3315 targetStart[TeleportEndKey] = targetAnchor;
3316 if (target) {
3317 insert(targetStart, target);
3318 insert(targetAnchor, target);
3319 }
3320 return targetAnchor;
3321 }
3322
3323 const leaveCbKey = Symbol("_leaveCb");
3324 const enterCbKey$1 = Symbol("_enterCb");
3325 function useTransitionState() {
3326 const state = {
3327 isMounted: false,
3328 isLeaving: false,
3329 isUnmounting: false,
3330 leavingVNodes: /* @__PURE__ */ new Map()
3331 };
3332 onMounted(() => {
3333 state.isMounted = true;
3334 });
3335 onBeforeUnmount(() => {
3336 state.isUnmounting = true;
3337 });
3338 return state;
3339 }
3340 const TransitionHookValidator = [Function, Array];
3341 const BaseTransitionPropsValidators = {
3342 mode: String,
3343 appear: Boolean,
3344 persisted: Boolean,
3345 // enter
3346 onBeforeEnter: TransitionHookValidator,
3347 onEnter: TransitionHookValidator,
3348 onAfterEnter: TransitionHookValidator,
3349 onEnterCancelled: TransitionHookValidator,
3350 // leave
3351 onBeforeLeave: TransitionHookValidator,
3352 onLeave: TransitionHookValidator,
3353 onAfterLeave: TransitionHookValidator,
3354 onLeaveCancelled: TransitionHookValidator,
3355 // appear
3356 onBeforeAppear: TransitionHookValidator,
3357 onAppear: TransitionHookValidator,
3358 onAfterAppear: TransitionHookValidator,
3359 onAppearCancelled: TransitionHookValidator
3360 };
3361 const recursiveGetSubtree = (instance) => {
3362 const subTree = instance.subTree;
3363 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
3364 };
3365 const BaseTransitionImpl = {
3366 name: `BaseTransition`,
3367 props: BaseTransitionPropsValidators,
3368 setup(props, { slots }) {
3369 const instance = getCurrentInstance();
3370 const state = useTransitionState();
3371 return () => {
3372 const children = slots.default && getTransitionRawChildren(slots.default(), true);
3373 if (!children || !children.length) {
3374 return;
3375 }
3376 const child = findNonCommentChild(children);
3377 const rawProps = toRaw(props);
3378 const { mode } = rawProps;
3379 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3380 warn$1(`invalid <transition> mode: ${mode}`);
3381 }
3382 if (state.isLeaving) {
3383 return emptyPlaceholder(child);
3384 }
3385 const innerChild = getInnerChild$1(child);
3386 if (!innerChild) {
3387 return emptyPlaceholder(child);
3388 }
3389 let enterHooks = resolveTransitionHooks(
3390 innerChild,
3391 rawProps,
3392 state,
3393 instance,
3394 // #11061, ensure enterHooks is fresh after clone
3395 (hooks) => enterHooks = hooks
3396 );
3397 if (innerChild.type !== Comment) {
3398 setTransitionHooks(innerChild, enterHooks);
3399 }
3400 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3401 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3402 let leavingHooks = resolveTransitionHooks(
3403 oldInnerChild,
3404 rawProps,
3405 state,
3406 instance
3407 );
3408 setTransitionHooks(oldInnerChild, leavingHooks);
3409 if (mode === "out-in" && innerChild.type !== Comment) {
3410 state.isLeaving = true;
3411 leavingHooks.afterLeave = () => {
3412 state.isLeaving = false;
3413 if (!(instance.job.flags & 8)) {
3414 instance.update();
3415 }
3416 delete leavingHooks.afterLeave;
3417 oldInnerChild = void 0;
3418 };
3419 return emptyPlaceholder(child);
3420 } else if (mode === "in-out" && innerChild.type !== Comment) {
3421 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3422 const leavingVNodesCache = getLeavingNodesForType(
3423 state,
3424 oldInnerChild
3425 );
3426 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3427 el[leaveCbKey] = () => {
3428 earlyRemove();
3429 el[leaveCbKey] = void 0;
3430 delete enterHooks.delayedLeave;
3431 oldInnerChild = void 0;
3432 };
3433 enterHooks.delayedLeave = () => {
3434 delayedLeave();
3435 delete enterHooks.delayedLeave;
3436 oldInnerChild = void 0;
3437 };
3438 };
3439 } else {
3440 oldInnerChild = void 0;
3441 }
3442 } else if (oldInnerChild) {
3443 oldInnerChild = void 0;
3444 }
3445 return child;
3446 };
3447 }
3448 };
3449 function findNonCommentChild(children) {
3450 let child = children[0];
3451 if (children.length > 1) {
3452 let hasFound = false;
3453 for (const c of children) {
3454 if (c.type !== Comment) {
3455 if (hasFound) {
3456 warn$1(
3457 "<transition> can only be used on a single element or component. Use <transition-group> for lists."
3458 );
3459 break;
3460 }
3461 child = c;
3462 hasFound = true;
3463 }
3464 }
3465 }
3466 return child;
3467 }
3468 const BaseTransition = BaseTransitionImpl;
3469 function getLeavingNodesForType(state, vnode) {
3470 const { leavingVNodes } = state;
3471 let leavingVNodesCache = leavingVNodes.get(vnode.type);
3472 if (!leavingVNodesCache) {
3473 leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3474 leavingVNodes.set(vnode.type, leavingVNodesCache);
3475 }
3476 return leavingVNodesCache;
3477 }
3478 function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3479 const {
3480 appear,
3481 mode,
3482 persisted = false,
3483 onBeforeEnter,
3484 onEnter,
3485 onAfterEnter,
3486 onEnterCancelled,
3487 onBeforeLeave,
3488 onLeave,
3489 onAfterLeave,
3490 onLeaveCancelled,
3491 onBeforeAppear,
3492 onAppear,
3493 onAfterAppear,
3494 onAppearCancelled
3495 } = props;
3496 const key = String(vnode.key);
3497 const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3498 const callHook = (hook, args) => {
3499 hook && callWithAsyncErrorHandling(
3500 hook,
3501 instance,
3502 9,
3503 args
3504 );
3505 };
3506 const callAsyncHook = (hook, args) => {
3507 const done = args[1];
3508 callHook(hook, args);
3509 if (isArray(hook)) {
3510 if (hook.every((hook2) => hook2.length <= 1)) done();
3511 } else if (hook.length <= 1) {
3512 done();
3513 }
3514 };
3515 const hooks = {
3516 mode,
3517 persisted,
3518 beforeEnter(el) {
3519 let hook = onBeforeEnter;
3520 if (!state.isMounted) {
3521 if (appear) {
3522 hook = onBeforeAppear || onBeforeEnter;
3523 } else {
3524 return;
3525 }
3526 }
3527 if (el[leaveCbKey]) {
3528 el[leaveCbKey](
3529 true
3530 /* cancelled */
3531 );
3532 }
3533 const leavingVNode = leavingVNodesCache[key];
3534 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3535 leavingVNode.el[leaveCbKey]();
3536 }
3537 callHook(hook, [el]);
3538 },
3539 enter(el) {
3540 let hook = onEnter;
3541 let afterHook = onAfterEnter;
3542 let cancelHook = onEnterCancelled;
3543 if (!state.isMounted) {
3544 if (appear) {
3545 hook = onAppear || onEnter;
3546 afterHook = onAfterAppear || onAfterEnter;
3547 cancelHook = onAppearCancelled || onEnterCancelled;
3548 } else {
3549 return;
3550 }
3551 }
3552 let called = false;
3553 const done = el[enterCbKey$1] = (cancelled) => {
3554 if (called) return;
3555 called = true;
3556 if (cancelled) {
3557 callHook(cancelHook, [el]);
3558 } else {
3559 callHook(afterHook, [el]);
3560 }
3561 if (hooks.delayedLeave) {
3562 hooks.delayedLeave();
3563 }
3564 el[enterCbKey$1] = void 0;
3565 };
3566 if (hook) {
3567 callAsyncHook(hook, [el, done]);
3568 } else {
3569 done();
3570 }
3571 },
3572 leave(el, remove) {
3573 const key2 = String(vnode.key);
3574 if (el[enterCbKey$1]) {
3575 el[enterCbKey$1](
3576 true
3577 /* cancelled */
3578 );
3579 }
3580 if (state.isUnmounting) {
3581 return remove();
3582 }
3583 callHook(onBeforeLeave, [el]);
3584 let called = false;
3585 const done = el[leaveCbKey] = (cancelled) => {
3586 if (called) return;
3587 called = true;
3588 remove();
3589 if (cancelled) {
3590 callHook(onLeaveCancelled, [el]);
3591 } else {
3592 callHook(onAfterLeave, [el]);
3593 }
3594 el[leaveCbKey] = void 0;
3595 if (leavingVNodesCache[key2] === vnode) {
3596 delete leavingVNodesCache[key2];
3597 }
3598 };
3599 leavingVNodesCache[key2] = vnode;
3600 if (onLeave) {
3601 callAsyncHook(onLeave, [el, done]);
3602 } else {
3603 done();
3604 }
3605 },
3606 clone(vnode2) {
3607 const hooks2 = resolveTransitionHooks(
3608 vnode2,
3609 props,
3610 state,
3611 instance,
3612 postClone
3613 );
3614 if (postClone) postClone(hooks2);
3615 return hooks2;
3616 }
3617 };
3618 return hooks;
3619 }
3620 function emptyPlaceholder(vnode) {
3621 if (isKeepAlive(vnode)) {
3622 vnode = cloneVNode(vnode);
3623 vnode.children = null;
3624 return vnode;
3625 }
3626 }
3627 function getInnerChild$1(vnode) {
3628 if (!isKeepAlive(vnode)) {
3629 if (isTeleport(vnode.type) && vnode.children) {
3630 return findNonCommentChild(vnode.children);
3631 }
3632 return vnode;
3633 }
3634 if (vnode.component) {
3635 return vnode.component.subTree;
3636 }
3637 const { shapeFlag, children } = vnode;
3638 if (children) {
3639 if (shapeFlag & 16) {
3640 return children[0];
3641 }
3642 if (shapeFlag & 32 && isFunction(children.default)) {
3643 return children.default();
3644 }
3645 }
3646 }
3647 function setTransitionHooks(vnode, hooks) {
3648 if (vnode.shapeFlag & 6 && vnode.component) {
3649 vnode.transition = hooks;
3650 setTransitionHooks(vnode.component.subTree, hooks);
3651 } else if (vnode.shapeFlag & 128) {
3652 vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3653 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3654 } else {
3655 vnode.transition = hooks;
3656 }
3657 }
3658 function getTransitionRawChildren(children, keepComment = false, parentKey) {
3659 let ret = [];
3660 let keyedFragmentCount = 0;
3661 for (let i = 0; i < children.length; i++) {
3662 let child = children[i];
3663 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
3664 if (child.type === Fragment) {
3665 if (child.patchFlag & 128) keyedFragmentCount++;
3666 ret = ret.concat(
3667 getTransitionRawChildren(child.children, keepComment, key)
3668 );
3669 } else if (keepComment || child.type !== Comment) {
3670 ret.push(key != null ? cloneVNode(child, { key }) : child);
3671 }
3672 }
3673 if (keyedFragmentCount > 1) {
3674 for (let i = 0; i < ret.length; i++) {
3675 ret[i].patchFlag = -2;
3676 }
3677 }
3678 return ret;
3679 }
3680
3681 /*! #__NO_SIDE_EFFECTS__ */
3682 // @__NO_SIDE_EFFECTS__
3683 function defineComponent(options, extraOptions) {
3684 return isFunction(options) ? (
3685 // #8236: extend call and options.name access are considered side-effects
3686 // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3687 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3688 ) : options;
3689 }
3690
3691 function useId() {
3692 const i = getCurrentInstance();
3693 if (i) {
3694 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3695 } else {
3696 warn$1(
3697 `useId() is called when there is no active component instance to be associated with.`
3698 );
3699 }
3700 return "";
3701 }
3702 function markAsyncBoundary(instance) {
3703 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3704 }
3705
3706 const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3707 function useTemplateRef(key) {
3708 const i = getCurrentInstance();
3709 const r = shallowRef(null);
3710 if (i) {
3711 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3712 let desc;
3713 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3714 warn$1(`useTemplateRef('${key}') already exists.`);
3715 } else {
3716 Object.defineProperty(refs, key, {
3717 enumerable: true,
3718 get: () => r.value,
3719 set: (val) => r.value = val
3720 });
3721 }
3722 } else {
3723 warn$1(
3724 `useTemplateRef() is called when there is no active component instance to be associated with.`
3725 );
3726 }
3727 const ret = readonly(r) ;
3728 {
3729 knownTemplateRefs.add(ret);
3730 }
3731 return ret;
3732 }
3733
3734 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3735 if (isArray(rawRef)) {
3736 rawRef.forEach(
3737 (r, i) => setRef(
3738 r,
3739 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
3740 parentSuspense,
3741 vnode,
3742 isUnmount
3743 )
3744 );
3745 return;
3746 }
3747 if (isAsyncWrapper(vnode) && !isUnmount) {
3748 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
3749 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
3750 }
3751 return;
3752 }
3753 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
3754 const value = isUnmount ? null : refValue;
3755 const { i: owner, r: ref } = rawRef;
3756 if (!owner) {
3757 warn$1(
3758 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
3759 );
3760 return;
3761 }
3762 const oldRef = oldRawRef && oldRawRef.r;
3763 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3764 const setupState = owner.setupState;
3765 const rawSetupState = toRaw(setupState);
3766 const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3767 {
3768 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3769 warn$1(
3770 `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
3771 );
3772 }
3773 if (knownTemplateRefs.has(rawSetupState[key])) {
3774 return false;
3775 }
3776 }
3777 return hasOwn(rawSetupState, key);
3778 };
3779 if (oldRef != null && oldRef !== ref) {
3780 if (isString(oldRef)) {
3781 refs[oldRef] = null;
3782 if (canSetSetupRef(oldRef)) {
3783 setupState[oldRef] = null;
3784 }
3785 } else if (isRef(oldRef)) {
3786 oldRef.value = null;
3787 }
3788 }
3789 if (isFunction(ref)) {
3790 callWithErrorHandling(ref, owner, 12, [value, refs]);
3791 } else {
3792 const _isString = isString(ref);
3793 const _isRef = isRef(ref);
3794 if (_isString || _isRef) {
3795 const doSet = () => {
3796 if (rawRef.f) {
3797 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3798 if (isUnmount) {
3799 isArray(existing) && remove(existing, refValue);
3800 } else {
3801 if (!isArray(existing)) {
3802 if (_isString) {
3803 refs[ref] = [refValue];
3804 if (canSetSetupRef(ref)) {
3805 setupState[ref] = refs[ref];
3806 }
3807 } else {
3808 ref.value = [refValue];
3809 if (rawRef.k) refs[rawRef.k] = ref.value;
3810 }
3811 } else if (!existing.includes(refValue)) {
3812 existing.push(refValue);
3813 }
3814 }
3815 } else if (_isString) {
3816 refs[ref] = value;
3817 if (canSetSetupRef(ref)) {
3818 setupState[ref] = value;
3819 }
3820 } else if (_isRef) {
3821 ref.value = value;
3822 if (rawRef.k) refs[rawRef.k] = value;
3823 } else {
3824 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3825 }
3826 };
3827 if (value) {
3828 doSet.id = -1;
3829 queuePostRenderEffect(doSet, parentSuspense);
3830 } else {
3831 doSet();
3832 }
3833 } else {
3834 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3835 }
3836 }
3837 }
3838
3839 let hasLoggedMismatchError = false;
3840 const logMismatchError = () => {
3841 if (hasLoggedMismatchError) {
3842 return;
3843 }
3844 console.error("Hydration completed but contains mismatches.");
3845 hasLoggedMismatchError = true;
3846 };
3847 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3848 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3849 const getContainerType = (container) => {
3850 if (container.nodeType !== 1) return void 0;
3851 if (isSVGContainer(container)) return "svg";
3852 if (isMathMLContainer(container)) return "mathml";
3853 return void 0;
3854 };
3855 const isComment = (node) => node.nodeType === 8;
3856 function createHydrationFunctions(rendererInternals) {
3857 const {
3858 mt: mountComponent,
3859 p: patch,
3860 o: {
3861 patchProp,
3862 createText,
3863 nextSibling,
3864 parentNode,
3865 remove,
3866 insert,
3867 createComment
3868 }
3869 } = rendererInternals;
3870 const hydrate = (vnode, container) => {
3871 if (!container.hasChildNodes()) {
3872 warn$1(
3873 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
3874 );
3875 patch(null, vnode, container);
3876 flushPostFlushCbs();
3877 container._vnode = vnode;
3878 return;
3879 }
3880 hydrateNode(container.firstChild, vnode, null, null, null);
3881 flushPostFlushCbs();
3882 container._vnode = vnode;
3883 };
3884 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
3885 optimized = optimized || !!vnode.dynamicChildren;
3886 const isFragmentStart = isComment(node) && node.data === "[";
3887 const onMismatch = () => handleMismatch(
3888 node,
3889 vnode,
3890 parentComponent,
3891 parentSuspense,
3892 slotScopeIds,
3893 isFragmentStart
3894 );
3895 const { type, ref, shapeFlag, patchFlag } = vnode;
3896 let domType = node.nodeType;
3897 vnode.el = node;
3898 {
3899 def(node, "__vnode", vnode, true);
3900 def(node, "__vueParentComponent", parentComponent, true);
3901 }
3902 if (patchFlag === -2) {
3903 optimized = false;
3904 vnode.dynamicChildren = null;
3905 }
3906 let nextNode = null;
3907 switch (type) {
3908 case Text:
3909 if (domType !== 3) {
3910 if (vnode.children === "") {
3911 insert(vnode.el = createText(""), parentNode(node), node);
3912 nextNode = node;
3913 } else {
3914 nextNode = onMismatch();
3915 }
3916 } else {
3917 if (node.data !== vnode.children) {
3918 warn$1(
3919 `Hydration text mismatch in`,
3920 node.parentNode,
3921 `
3922 - rendered on server: ${JSON.stringify(
3923 node.data
3924 )}
3925 - expected on client: ${JSON.stringify(vnode.children)}`
3926 );
3927 logMismatchError();
3928 node.data = vnode.children;
3929 }
3930 nextNode = nextSibling(node);
3931 }
3932 break;
3933 case Comment:
3934 if (isTemplateNode(node)) {
3935 nextNode = nextSibling(node);
3936 replaceNode(
3937 vnode.el = node.content.firstChild,
3938 node,
3939 parentComponent
3940 );
3941 } else if (domType !== 8 || isFragmentStart) {
3942 nextNode = onMismatch();
3943 } else {
3944 nextNode = nextSibling(node);
3945 }
3946 break;
3947 case Static:
3948 if (isFragmentStart) {
3949 node = nextSibling(node);
3950 domType = node.nodeType;
3951 }
3952 if (domType === 1 || domType === 3) {
3953 nextNode = node;
3954 const needToAdoptContent = !vnode.children.length;
3955 for (let i = 0; i < vnode.staticCount; i++) {
3956 if (needToAdoptContent)
3957 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
3958 if (i === vnode.staticCount - 1) {
3959 vnode.anchor = nextNode;
3960 }
3961 nextNode = nextSibling(nextNode);
3962 }
3963 return isFragmentStart ? nextSibling(nextNode) : nextNode;
3964 } else {
3965 onMismatch();
3966 }
3967 break;
3968 case Fragment:
3969 if (!isFragmentStart) {
3970 nextNode = onMismatch();
3971 } else {
3972 nextNode = hydrateFragment(
3973 node,
3974 vnode,
3975 parentComponent,
3976 parentSuspense,
3977 slotScopeIds,
3978 optimized
3979 );
3980 }
3981 break;
3982 default:
3983 if (shapeFlag & 1) {
3984 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
3985 nextNode = onMismatch();
3986 } else {
3987 nextNode = hydrateElement(
3988 node,
3989 vnode,
3990 parentComponent,
3991 parentSuspense,
3992 slotScopeIds,
3993 optimized
3994 );
3995 }
3996 } else if (shapeFlag & 6) {
3997 vnode.slotScopeIds = slotScopeIds;
3998 const container = parentNode(node);
3999 if (isFragmentStart) {
4000 nextNode = locateClosingAnchor(node);
4001 } else if (isComment(node) && node.data === "teleport start") {
4002 nextNode = locateClosingAnchor(node, node.data, "teleport end");
4003 } else {
4004 nextNode = nextSibling(node);
4005 }
4006 mountComponent(
4007 vnode,
4008 container,
4009 null,
4010 parentComponent,
4011 parentSuspense,
4012 getContainerType(container),
4013 optimized
4014 );
4015 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4016 let subTree;
4017 if (isFragmentStart) {
4018 subTree = createVNode(Fragment);
4019 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4020 } else {
4021 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4022 }
4023 subTree.el = node;
4024 vnode.component.subTree = subTree;
4025 }
4026 } else if (shapeFlag & 64) {
4027 if (domType !== 8) {
4028 nextNode = onMismatch();
4029 } else {
4030 nextNode = vnode.type.hydrate(
4031 node,
4032 vnode,
4033 parentComponent,
4034 parentSuspense,
4035 slotScopeIds,
4036 optimized,
4037 rendererInternals,
4038 hydrateChildren
4039 );
4040 }
4041 } else if (shapeFlag & 128) {
4042 nextNode = vnode.type.hydrate(
4043 node,
4044 vnode,
4045 parentComponent,
4046 parentSuspense,
4047 getContainerType(parentNode(node)),
4048 slotScopeIds,
4049 optimized,
4050 rendererInternals,
4051 hydrateNode
4052 );
4053 } else {
4054 warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
4055 }
4056 }
4057 if (ref != null) {
4058 setRef(ref, null, parentSuspense, vnode);
4059 }
4060 return nextNode;
4061 };
4062 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4063 optimized = optimized || !!vnode.dynamicChildren;
4064 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4065 const forcePatch = type === "input" || type === "option";
4066 {
4067 if (dirs) {
4068 invokeDirectiveHook(vnode, null, parentComponent, "created");
4069 }
4070 let needCallTransitionHooks = false;
4071 if (isTemplateNode(el)) {
4072 needCallTransitionHooks = needTransition(
4073 null,
4074 // no need check parentSuspense in hydration
4075 transition
4076 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
4077 const content = el.content.firstChild;
4078 if (needCallTransitionHooks) {
4079 transition.beforeEnter(content);
4080 }
4081 replaceNode(content, el, parentComponent);
4082 vnode.el = el = content;
4083 }
4084 if (shapeFlag & 16 && // skip if element has innerHTML / textContent
4085 !(props && (props.innerHTML || props.textContent))) {
4086 let next = hydrateChildren(
4087 el.firstChild,
4088 vnode,
4089 el,
4090 parentComponent,
4091 parentSuspense,
4092 slotScopeIds,
4093 optimized
4094 );
4095 let hasWarned = false;
4096 while (next) {
4097 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4098 if (!hasWarned) {
4099 warn$1(
4100 `Hydration children mismatch on`,
4101 el,
4102 `
4103Server rendered element contains more child nodes than client vdom.`
4104 );
4105 hasWarned = true;
4106 }
4107 logMismatchError();
4108 }
4109 const cur = next;
4110 next = next.nextSibling;
4111 remove(cur);
4112 }
4113 } else if (shapeFlag & 8) {
4114 let clientText = vnode.children;
4115 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4116 clientText = clientText.slice(1);
4117 }
4118 if (el.textContent !== clientText) {
4119 if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4120 warn$1(
4121 `Hydration text content mismatch on`,
4122 el,
4123 `
4124 - rendered on server: ${el.textContent}
4125 - expected on client: ${vnode.children}`
4126 );
4127 logMismatchError();
4128 }
4129 el.textContent = vnode.children;
4130 }
4131 }
4132 if (props) {
4133 {
4134 const isCustomElement = el.tagName.includes("-");
4135 for (const key in props) {
4136 if (// #11189 skip if this node has directives that have created hooks
4137 // as it could have mutated the DOM in any possible way
4138 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
4139 logMismatchError();
4140 }
4141 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4142 key[0] === "." || isCustomElement) {
4143 patchProp(el, key, null, props[key], void 0, parentComponent);
4144 }
4145 }
4146 }
4147 }
4148 let vnodeHooks;
4149 if (vnodeHooks = props && props.onVnodeBeforeMount) {
4150 invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4151 }
4152 if (dirs) {
4153 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4154 }
4155 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4156 queueEffectWithSuspense(() => {
4157 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4158 needCallTransitionHooks && transition.enter(el);
4159 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4160 }, parentSuspense);
4161 }
4162 }
4163 return el.nextSibling;
4164 };
4165 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4166 optimized = optimized || !!parentVNode.dynamicChildren;
4167 const children = parentVNode.children;
4168 const l = children.length;
4169 let hasWarned = false;
4170 for (let i = 0; i < l; i++) {
4171 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4172 const isText = vnode.type === Text;
4173 if (node) {
4174 if (isText && !optimized) {
4175 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4176 insert(
4177 createText(
4178 node.data.slice(vnode.children.length)
4179 ),
4180 container,
4181 nextSibling(node)
4182 );
4183 node.data = vnode.children;
4184 }
4185 }
4186 node = hydrateNode(
4187 node,
4188 vnode,
4189 parentComponent,
4190 parentSuspense,
4191 slotScopeIds,
4192 optimized
4193 );
4194 } else if (isText && !vnode.children) {
4195 insert(vnode.el = createText(""), container);
4196 } else {
4197 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4198 if (!hasWarned) {
4199 warn$1(
4200 `Hydration children mismatch on`,
4201 container,
4202 `
4203Server rendered element contains fewer child nodes than client vdom.`
4204 );
4205 hasWarned = true;
4206 }
4207 logMismatchError();
4208 }
4209 patch(
4210 null,
4211 vnode,
4212 container,
4213 null,
4214 parentComponent,
4215 parentSuspense,
4216 getContainerType(container),
4217 slotScopeIds
4218 );
4219 }
4220 }
4221 return node;
4222 };
4223 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4224 const { slotScopeIds: fragmentSlotScopeIds } = vnode;
4225 if (fragmentSlotScopeIds) {
4226 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
4227 }
4228 const container = parentNode(node);
4229 const next = hydrateChildren(
4230 nextSibling(node),
4231 vnode,
4232 container,
4233 parentComponent,
4234 parentSuspense,
4235 slotScopeIds,
4236 optimized
4237 );
4238 if (next && isComment(next) && next.data === "]") {
4239 return nextSibling(vnode.anchor = next);
4240 } else {
4241 logMismatchError();
4242 insert(vnode.anchor = createComment(`]`), container, next);
4243 return next;
4244 }
4245 };
4246 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4247 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4248 warn$1(
4249 `Hydration node mismatch:
4250- rendered on server:`,
4251 node,
4252 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
4253 `
4254- expected on client:`,
4255 vnode.type
4256 );
4257 logMismatchError();
4258 }
4259 vnode.el = null;
4260 if (isFragment) {
4261 const end = locateClosingAnchor(node);
4262 while (true) {
4263 const next2 = nextSibling(node);
4264 if (next2 && next2 !== end) {
4265 remove(next2);
4266 } else {
4267 break;
4268 }
4269 }
4270 }
4271 const next = nextSibling(node);
4272 const container = parentNode(node);
4273 remove(node);
4274 patch(
4275 null,
4276 vnode,
4277 container,
4278 next,
4279 parentComponent,
4280 parentSuspense,
4281 getContainerType(container),
4282 slotScopeIds
4283 );
4284 if (parentComponent) {
4285 parentComponent.vnode.el = vnode.el;
4286 updateHOCHostEl(parentComponent, vnode.el);
4287 }
4288 return next;
4289 };
4290 const locateClosingAnchor = (node, open = "[", close = "]") => {
4291 let match = 0;
4292 while (node) {
4293 node = nextSibling(node);
4294 if (node && isComment(node)) {
4295 if (node.data === open) match++;
4296 if (node.data === close) {
4297 if (match === 0) {
4298 return nextSibling(node);
4299 } else {
4300 match--;
4301 }
4302 }
4303 }
4304 }
4305 return node;
4306 };
4307 const replaceNode = (newNode, oldNode, parentComponent) => {
4308 const parentNode2 = oldNode.parentNode;
4309 if (parentNode2) {
4310 parentNode2.replaceChild(newNode, oldNode);
4311 }
4312 let parent = parentComponent;
4313 while (parent) {
4314 if (parent.vnode.el === oldNode) {
4315 parent.vnode.el = parent.subTree.el = newNode;
4316 }
4317 parent = parent.parent;
4318 }
4319 };
4320 const isTemplateNode = (node) => {
4321 return node.nodeType === 1 && node.tagName === "TEMPLATE";
4322 };
4323 return [hydrate, hydrateNode];
4324 }
4325 function propHasMismatch(el, key, clientValue, vnode, instance) {
4326 let mismatchType;
4327 let mismatchKey;
4328 let actual;
4329 let expected;
4330 if (key === "class") {
4331 actual = el.getAttribute("class");
4332 expected = normalizeClass(clientValue);
4333 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
4334 mismatchType = 2 /* CLASS */;
4335 mismatchKey = `class`;
4336 }
4337 } else if (key === "style") {
4338 actual = el.getAttribute("style") || "";
4339 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
4340 const actualMap = toStyleMap(actual);
4341 const expectedMap = toStyleMap(expected);
4342 if (vnode.dirs) {
4343 for (const { dir, value } of vnode.dirs) {
4344 if (dir.name === "show" && !value) {
4345 expectedMap.set("display", "none");
4346 }
4347 }
4348 }
4349 if (instance) {
4350 resolveCssVars(instance, vnode, expectedMap);
4351 }
4352 if (!isMapEqual(actualMap, expectedMap)) {
4353 mismatchType = 3 /* STYLE */;
4354 mismatchKey = "style";
4355 }
4356 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4357 if (isBooleanAttr(key)) {
4358 actual = el.hasAttribute(key);
4359 expected = includeBooleanAttr(clientValue);
4360 } else if (clientValue == null) {
4361 actual = el.hasAttribute(key);
4362 expected = false;
4363 } else {
4364 if (el.hasAttribute(key)) {
4365 actual = el.getAttribute(key);
4366 } else if (key === "value" && el.tagName === "TEXTAREA") {
4367 actual = el.value;
4368 } else {
4369 actual = false;
4370 }
4371 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
4372 }
4373 if (actual !== expected) {
4374 mismatchType = 4 /* ATTRIBUTE */;
4375 mismatchKey = key;
4376 }
4377 }
4378 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
4379 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
4380 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
4381 const postSegment = `
4382 - rendered on server: ${format(actual)}
4383 - expected on client: ${format(expected)}
4384 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
4385 You should fix the source of the mismatch.`;
4386 {
4387 warn$1(preSegment, el, postSegment);
4388 }
4389 return true;
4390 }
4391 return false;
4392 }
4393 function toClassSet(str) {
4394 return new Set(str.trim().split(/\s+/));
4395 }
4396 function isSetEqual(a, b) {
4397 if (a.size !== b.size) {
4398 return false;
4399 }
4400 for (const s of a) {
4401 if (!b.has(s)) {
4402 return false;
4403 }
4404 }
4405 return true;
4406 }
4407 function toStyleMap(str) {
4408 const styleMap = /* @__PURE__ */ new Map();
4409 for (const item of str.split(";")) {
4410 let [key, value] = item.split(":");
4411 key = key.trim();
4412 value = value && value.trim();
4413 if (key && value) {
4414 styleMap.set(key, value);
4415 }
4416 }
4417 return styleMap;
4418 }
4419 function isMapEqual(a, b) {
4420 if (a.size !== b.size) {
4421 return false;
4422 }
4423 for (const [key, value] of a) {
4424 if (value !== b.get(key)) {
4425 return false;
4426 }
4427 }
4428 return true;
4429 }
4430 function resolveCssVars(instance, vnode, expectedMap) {
4431 const root = instance.subTree;
4432 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4433 const cssVars = instance.getCssVars();
4434 for (const key in cssVars) {
4435 expectedMap.set(
4436 `--${getEscapedCssVarName(key)}`,
4437 String(cssVars[key])
4438 );
4439 }
4440 }
4441 if (vnode === root && instance.parent) {
4442 resolveCssVars(instance.parent, instance.vnode, expectedMap);
4443 }
4444 }
4445 const allowMismatchAttr = "data-allow-mismatch";
4446 const MismatchTypeString = {
4447 [0 /* TEXT */]: "text",
4448 [1 /* CHILDREN */]: "children",
4449 [2 /* CLASS */]: "class",
4450 [3 /* STYLE */]: "style",
4451 [4 /* ATTRIBUTE */]: "attribute"
4452 };
4453 function isMismatchAllowed(el, allowedType) {
4454 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
4455 while (el && !el.hasAttribute(allowMismatchAttr)) {
4456 el = el.parentElement;
4457 }
4458 }
4459 const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4460 if (allowedAttr == null) {
4461 return false;
4462 } else if (allowedAttr === "") {
4463 return true;
4464 } else {
4465 const list = allowedAttr.split(",");
4466 if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4467 return true;
4468 }
4469 return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4470 }
4471 }
4472
4473 const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4474 const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
4475 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4476 const id = requestIdleCallback(hydrate, { timeout });
4477 return () => cancelIdleCallback(id);
4478 };
4479 function elementIsVisibleInViewport(el) {
4480 const { top, left, bottom, right } = el.getBoundingClientRect();
4481 const { innerHeight, innerWidth } = window;
4482 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4483 }
4484 const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4485 const ob = new IntersectionObserver((entries) => {
4486 for (const e of entries) {
4487 if (!e.isIntersecting) continue;
4488 ob.disconnect();
4489 hydrate();
4490 break;
4491 }
4492 }, opts);
4493 forEach((el) => {
4494 if (!(el instanceof Element)) return;
4495 if (elementIsVisibleInViewport(el)) {
4496 hydrate();
4497 ob.disconnect();
4498 return false;
4499 }
4500 ob.observe(el);
4501 });
4502 return () => ob.disconnect();
4503 };
4504 const hydrateOnMediaQuery = (query) => (hydrate) => {
4505 if (query) {
4506 const mql = matchMedia(query);
4507 if (mql.matches) {
4508 hydrate();
4509 } else {
4510 mql.addEventListener("change", hydrate, { once: true });
4511 return () => mql.removeEventListener("change", hydrate);
4512 }
4513 }
4514 };
4515 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
4516 if (isString(interactions)) interactions = [interactions];
4517 let hasHydrated = false;
4518 const doHydrate = (e) => {
4519 if (!hasHydrated) {
4520 hasHydrated = true;
4521 teardown();
4522 hydrate();
4523 e.target.dispatchEvent(new e.constructor(e.type, e));
4524 }
4525 };
4526 const teardown = () => {
4527 forEach((el) => {
4528 for (const i of interactions) {
4529 el.removeEventListener(i, doHydrate);
4530 }
4531 });
4532 };
4533 forEach((el) => {
4534 for (const i of interactions) {
4535 el.addEventListener(i, doHydrate, { once: true });
4536 }
4537 });
4538 return teardown;
4539 };
4540 function forEachElement(node, cb) {
4541 if (isComment(node) && node.data === "[") {
4542 let depth = 1;
4543 let next = node.nextSibling;
4544 while (next) {
4545 if (next.nodeType === 1) {
4546 const result = cb(next);
4547 if (result === false) {
4548 break;
4549 }
4550 } else if (isComment(next)) {
4551 if (next.data === "]") {
4552 if (--depth === 0) break;
4553 } else if (next.data === "[") {
4554 depth++;
4555 }
4556 }
4557 next = next.nextSibling;
4558 }
4559 } else {
4560 cb(node);
4561 }
4562 }
4563
4564 const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4565 /*! #__NO_SIDE_EFFECTS__ */
4566 // @__NO_SIDE_EFFECTS__
4567 function defineAsyncComponent(source) {
4568 if (isFunction(source)) {
4569 source = { loader: source };
4570 }
4571 const {
4572 loader,
4573 loadingComponent,
4574 errorComponent,
4575 delay = 200,
4576 hydrate: hydrateStrategy,
4577 timeout,
4578 // undefined = never times out
4579 suspensible = true,
4580 onError: userOnError
4581 } = source;
4582 let pendingRequest = null;
4583 let resolvedComp;
4584 let retries = 0;
4585 const retry = () => {
4586 retries++;
4587 pendingRequest = null;
4588 return load();
4589 };
4590 const load = () => {
4591 let thisRequest;
4592 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4593 err = err instanceof Error ? err : new Error(String(err));
4594 if (userOnError) {
4595 return new Promise((resolve, reject) => {
4596 const userRetry = () => resolve(retry());
4597 const userFail = () => reject(err);
4598 userOnError(err, userRetry, userFail, retries + 1);
4599 });
4600 } else {
4601 throw err;
4602 }
4603 }).then((comp) => {
4604 if (thisRequest !== pendingRequest && pendingRequest) {
4605 return pendingRequest;
4606 }
4607 if (!comp) {
4608 warn$1(
4609 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
4610 );
4611 }
4612 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4613 comp = comp.default;
4614 }
4615 if (comp && !isObject(comp) && !isFunction(comp)) {
4616 throw new Error(`Invalid async component load result: ${comp}`);
4617 }
4618 resolvedComp = comp;
4619 return comp;
4620 }));
4621 };
4622 return defineComponent({
4623 name: "AsyncComponentWrapper",
4624 __asyncLoader: load,
4625 __asyncHydrate(el, instance, hydrate) {
4626 const doHydrate = hydrateStrategy ? () => {
4627 const teardown = hydrateStrategy(
4628 hydrate,
4629 (cb) => forEachElement(el, cb)
4630 );
4631 if (teardown) {
4632 (instance.bum || (instance.bum = [])).push(teardown);
4633 }
4634 } : hydrate;
4635 if (resolvedComp) {
4636 doHydrate();
4637 } else {
4638 load().then(() => !instance.isUnmounted && doHydrate());
4639 }
4640 },
4641 get __asyncResolved() {
4642 return resolvedComp;
4643 },
4644 setup() {
4645 const instance = currentInstance;
4646 markAsyncBoundary(instance);
4647 if (resolvedComp) {
4648 return () => createInnerComp(resolvedComp, instance);
4649 }
4650 const onError = (err) => {
4651 pendingRequest = null;
4652 handleError(
4653 err,
4654 instance,
4655 13,
4656 !errorComponent
4657 );
4658 };
4659 if (suspensible && instance.suspense || false) {
4660 return load().then((comp) => {
4661 return () => createInnerComp(comp, instance);
4662 }).catch((err) => {
4663 onError(err);
4664 return () => errorComponent ? createVNode(errorComponent, {
4665 error: err
4666 }) : null;
4667 });
4668 }
4669 const loaded = ref(false);
4670 const error = ref();
4671 const delayed = ref(!!delay);
4672 if (delay) {
4673 setTimeout(() => {
4674 delayed.value = false;
4675 }, delay);
4676 }
4677 if (timeout != null) {
4678 setTimeout(() => {
4679 if (!loaded.value && !error.value) {
4680 const err = new Error(
4681 `Async component timed out after ${timeout}ms.`
4682 );
4683 onError(err);
4684 error.value = err;
4685 }
4686 }, timeout);
4687 }
4688 load().then(() => {
4689 loaded.value = true;
4690 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4691 instance.parent.update();
4692 }
4693 }).catch((err) => {
4694 onError(err);
4695 error.value = err;
4696 });
4697 return () => {
4698 if (loaded.value && resolvedComp) {
4699 return createInnerComp(resolvedComp, instance);
4700 } else if (error.value && errorComponent) {
4701 return createVNode(errorComponent, {
4702 error: error.value
4703 });
4704 } else if (loadingComponent && !delayed.value) {
4705 return createVNode(loadingComponent);
4706 }
4707 };
4708 }
4709 });
4710 }
4711 function createInnerComp(comp, parent) {
4712 const { ref: ref2, props, children, ce } = parent.vnode;
4713 const vnode = createVNode(comp, props, children);
4714 vnode.ref = ref2;
4715 vnode.ce = ce;
4716 delete parent.vnode.ce;
4717 return vnode;
4718 }
4719
4720 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4721 const KeepAliveImpl = {
4722 name: `KeepAlive`,
4723 // Marker for special handling inside the renderer. We are not using a ===
4724 // check directly on KeepAlive in the renderer, because importing it directly
4725 // would prevent it from being tree-shaken.
4726 __isKeepAlive: true,
4727 props: {
4728 include: [String, RegExp, Array],
4729 exclude: [String, RegExp, Array],
4730 max: [String, Number]
4731 },
4732 setup(props, { slots }) {
4733 const instance = getCurrentInstance();
4734 const sharedContext = instance.ctx;
4735 const cache = /* @__PURE__ */ new Map();
4736 const keys = /* @__PURE__ */ new Set();
4737 let current = null;
4738 {
4739 instance.__v_cache = cache;
4740 }
4741 const parentSuspense = instance.suspense;
4742 const {
4743 renderer: {
4744 p: patch,
4745 m: move,
4746 um: _unmount,
4747 o: { createElement }
4748 }
4749 } = sharedContext;
4750 const storageContainer = createElement("div");
4751 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4752 const instance2 = vnode.component;
4753 move(vnode, container, anchor, 0, parentSuspense);
4754 patch(
4755 instance2.vnode,
4756 vnode,
4757 container,
4758 anchor,
4759 instance2,
4760 parentSuspense,
4761 namespace,
4762 vnode.slotScopeIds,
4763 optimized
4764 );
4765 queuePostRenderEffect(() => {
4766 instance2.isDeactivated = false;
4767 if (instance2.a) {
4768 invokeArrayFns(instance2.a);
4769 }
4770 const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4771 if (vnodeHook) {
4772 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4773 }
4774 }, parentSuspense);
4775 {
4776 devtoolsComponentAdded(instance2);
4777 }
4778 };
4779 sharedContext.deactivate = (vnode) => {
4780 const instance2 = vnode.component;
4781 invalidateMount(instance2.m);
4782 invalidateMount(instance2.a);
4783 move(vnode, storageContainer, null, 1, parentSuspense);
4784 queuePostRenderEffect(() => {
4785 if (instance2.da) {
4786 invokeArrayFns(instance2.da);
4787 }
4788 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4789 if (vnodeHook) {
4790 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4791 }
4792 instance2.isDeactivated = true;
4793 }, parentSuspense);
4794 {
4795 devtoolsComponentAdded(instance2);
4796 }
4797 };
4798 function unmount(vnode) {
4799 resetShapeFlag(vnode);
4800 _unmount(vnode, instance, parentSuspense, true);
4801 }
4802 function pruneCache(filter) {
4803 cache.forEach((vnode, key) => {
4804 const name = getComponentName(vnode.type);
4805 if (name && !filter(name)) {
4806 pruneCacheEntry(key);
4807 }
4808 });
4809 }
4810 function pruneCacheEntry(key) {
4811 const cached = cache.get(key);
4812 if (cached && (!current || !isSameVNodeType(cached, current))) {
4813 unmount(cached);
4814 } else if (current) {
4815 resetShapeFlag(current);
4816 }
4817 cache.delete(key);
4818 keys.delete(key);
4819 }
4820 watch(
4821 () => [props.include, props.exclude],
4822 ([include, exclude]) => {
4823 include && pruneCache((name) => matches(include, name));
4824 exclude && pruneCache((name) => !matches(exclude, name));
4825 },
4826 // prune post-render after `current` has been updated
4827 { flush: "post", deep: true }
4828 );
4829 let pendingCacheKey = null;
4830 const cacheSubtree = () => {
4831 if (pendingCacheKey != null) {
4832 if (isSuspense(instance.subTree.type)) {
4833 queuePostRenderEffect(() => {
4834 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4835 }, instance.subTree.suspense);
4836 } else {
4837 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4838 }
4839 }
4840 };
4841 onMounted(cacheSubtree);
4842 onUpdated(cacheSubtree);
4843 onBeforeUnmount(() => {
4844 cache.forEach((cached) => {
4845 const { subTree, suspense } = instance;
4846 const vnode = getInnerChild(subTree);
4847 if (cached.type === vnode.type && cached.key === vnode.key) {
4848 resetShapeFlag(vnode);
4849 const da = vnode.component.da;
4850 da && queuePostRenderEffect(da, suspense);
4851 return;
4852 }
4853 unmount(cached);
4854 });
4855 });
4856 return () => {
4857 pendingCacheKey = null;
4858 if (!slots.default) {
4859 return current = null;
4860 }
4861 const children = slots.default();
4862 const rawVNode = children[0];
4863 if (children.length > 1) {
4864 {
4865 warn$1(`KeepAlive should contain exactly one component child.`);
4866 }
4867 current = null;
4868 return children;
4869 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4870 current = null;
4871 return rawVNode;
4872 }
4873 let vnode = getInnerChild(rawVNode);
4874 if (vnode.type === Comment) {
4875 current = null;
4876 return vnode;
4877 }
4878 const comp = vnode.type;
4879 const name = getComponentName(
4880 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4881 );
4882 const { include, exclude, max } = props;
4883 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4884 vnode.shapeFlag &= ~256;
4885 current = vnode;
4886 return rawVNode;
4887 }
4888 const key = vnode.key == null ? comp : vnode.key;
4889 const cachedVNode = cache.get(key);
4890 if (vnode.el) {
4891 vnode = cloneVNode(vnode);
4892 if (rawVNode.shapeFlag & 128) {
4893 rawVNode.ssContent = vnode;
4894 }
4895 }
4896 pendingCacheKey = key;
4897 if (cachedVNode) {
4898 vnode.el = cachedVNode.el;
4899 vnode.component = cachedVNode.component;
4900 if (vnode.transition) {
4901 setTransitionHooks(vnode, vnode.transition);
4902 }
4903 vnode.shapeFlag |= 512;
4904 keys.delete(key);
4905 keys.add(key);
4906 } else {
4907 keys.add(key);
4908 if (max && keys.size > parseInt(max, 10)) {
4909 pruneCacheEntry(keys.values().next().value);
4910 }
4911 }
4912 vnode.shapeFlag |= 256;
4913 current = vnode;
4914 return isSuspense(rawVNode.type) ? rawVNode : vnode;
4915 };
4916 }
4917 };
4918 const KeepAlive = KeepAliveImpl;
4919 function matches(pattern, name) {
4920 if (isArray(pattern)) {
4921 return pattern.some((p) => matches(p, name));
4922 } else if (isString(pattern)) {
4923 return pattern.split(",").includes(name);
4924 } else if (isRegExp(pattern)) {
4925 pattern.lastIndex = 0;
4926 return pattern.test(name);
4927 }
4928 return false;
4929 }
4930 function onActivated(hook, target) {
4931 registerKeepAliveHook(hook, "a", target);
4932 }
4933 function onDeactivated(hook, target) {
4934 registerKeepAliveHook(hook, "da", target);
4935 }
4936 function registerKeepAliveHook(hook, type, target = currentInstance) {
4937 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4938 let current = target;
4939 while (current) {
4940 if (current.isDeactivated) {
4941 return;
4942 }
4943 current = current.parent;
4944 }
4945 return hook();
4946 });
4947 injectHook(type, wrappedHook, target);
4948 if (target) {
4949 let current = target.parent;
4950 while (current && current.parent) {
4951 if (isKeepAlive(current.parent.vnode)) {
4952 injectToKeepAliveRoot(wrappedHook, type, target, current);
4953 }
4954 current = current.parent;
4955 }
4956 }
4957 }
4958 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4959 const injected = injectHook(
4960 type,
4961 hook,
4962 keepAliveRoot,
4963 true
4964 /* prepend */
4965 );
4966 onUnmounted(() => {
4967 remove(keepAliveRoot[type], injected);
4968 }, target);
4969 }
4970 function resetShapeFlag(vnode) {
4971 vnode.shapeFlag &= ~256;
4972 vnode.shapeFlag &= ~512;
4973 }
4974 function getInnerChild(vnode) {
4975 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4976 }
4977
4978 function injectHook(type, hook, target = currentInstance, prepend = false) {
4979 if (target) {
4980 const hooks = target[type] || (target[type] = []);
4981 const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4982 pauseTracking();
4983 const reset = setCurrentInstance(target);
4984 const res = callWithAsyncErrorHandling(hook, target, type, args);
4985 reset();
4986 resetTracking();
4987 return res;
4988 });
4989 if (prepend) {
4990 hooks.unshift(wrappedHook);
4991 } else {
4992 hooks.push(wrappedHook);
4993 }
4994 return wrappedHook;
4995 } else {
4996 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4997 warn$1(
4998 `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
4999 );
5000 }
5001 }
5002 const createHook = (lifecycle) => (hook, target = currentInstance) => {
5003 if (!isInSSRComponentSetup || lifecycle === "sp") {
5004 injectHook(lifecycle, (...args) => hook(...args), target);
5005 }
5006 };
5007 const onBeforeMount = createHook("bm");
5008 const onMounted = createHook("m");
5009 const onBeforeUpdate = createHook(
5010 "bu"
5011 );
5012 const onUpdated = createHook("u");
5013 const onBeforeUnmount = createHook(
5014 "bum"
5015 );
5016 const onUnmounted = createHook("um");
5017 const onServerPrefetch = createHook(
5018 "sp"
5019 );
5020 const onRenderTriggered = createHook("rtg");
5021 const onRenderTracked = createHook("rtc");
5022 function onErrorCaptured(hook, target = currentInstance) {
5023 injectHook("ec", hook, target);
5024 }
5025
5026 const COMPONENTS = "components";
5027 const DIRECTIVES = "directives";
5028 function resolveComponent(name, maybeSelfReference) {
5029 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
5030 }
5031 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
5032 function resolveDynamicComponent(component) {
5033 if (isString(component)) {
5034 return resolveAsset(COMPONENTS, component, false) || component;
5035 } else {
5036 return component || NULL_DYNAMIC_COMPONENT;
5037 }
5038 }
5039 function resolveDirective(name) {
5040 return resolveAsset(DIRECTIVES, name);
5041 }
5042 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
5043 const instance = currentRenderingInstance || currentInstance;
5044 if (instance) {
5045 const Component = instance.type;
5046 if (type === COMPONENTS) {
5047 const selfName = getComponentName(
5048 Component,
5049 false
5050 );
5051 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
5052 return Component;
5053 }
5054 }
5055 const res = (
5056 // local registration
5057 // check instance[type] first which is resolved for options API
5058 resolve(instance[type] || Component[type], name) || // global registration
5059 resolve(instance.appContext[type], name)
5060 );
5061 if (!res && maybeSelfReference) {
5062 return Component;
5063 }
5064 if (warnMissing && !res) {
5065 const extra = type === COMPONENTS ? `
5066If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
5067 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
5068 }
5069 return res;
5070 } else {
5071 warn$1(
5072 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
5073 );
5074 }
5075 }
5076 function resolve(registry, name) {
5077 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
5078 }
5079
5080 function renderList(source, renderItem, cache, index) {
5081 let ret;
5082 const cached = cache && cache[index];
5083 const sourceIsArray = isArray(source);
5084 if (sourceIsArray || isString(source)) {
5085 const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5086 let needsWrap = false;
5087 if (sourceIsReactiveArray) {
5088 needsWrap = !isShallow(source);
5089 source = shallowReadArray(source);
5090 }
5091 ret = new Array(source.length);
5092 for (let i = 0, l = source.length; i < l; i++) {
5093 ret[i] = renderItem(
5094 needsWrap ? toReactive(source[i]) : source[i],
5095 i,
5096 void 0,
5097 cached && cached[i]
5098 );
5099 }
5100 } else if (typeof source === "number") {
5101 if (!Number.isInteger(source)) {
5102 warn$1(`The v-for range expect an integer value but got ${source}.`);
5103 }
5104 ret = new Array(source);
5105 for (let i = 0; i < source; i++) {
5106 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5107 }
5108 } else if (isObject(source)) {
5109 if (source[Symbol.iterator]) {
5110 ret = Array.from(
5111 source,
5112 (item, i) => renderItem(item, i, void 0, cached && cached[i])
5113 );
5114 } else {
5115 const keys = Object.keys(source);
5116 ret = new Array(keys.length);
5117 for (let i = 0, l = keys.length; i < l; i++) {
5118 const key = keys[i];
5119 ret[i] = renderItem(source[key], key, i, cached && cached[i]);
5120 }
5121 }
5122 } else {
5123 ret = [];
5124 }
5125 if (cache) {
5126 cache[index] = ret;
5127 }
5128 return ret;
5129 }
5130
5131 function createSlots(slots, dynamicSlots) {
5132 for (let i = 0; i < dynamicSlots.length; i++) {
5133 const slot = dynamicSlots[i];
5134 if (isArray(slot)) {
5135 for (let j = 0; j < slot.length; j++) {
5136 slots[slot[j].name] = slot[j].fn;
5137 }
5138 } else if (slot) {
5139 slots[slot.name] = slot.key ? (...args) => {
5140 const res = slot.fn(...args);
5141 if (res) res.key = slot.key;
5142 return res;
5143 } : slot.fn;
5144 }
5145 }
5146 return slots;
5147 }
5148
5149 function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5150 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5151 if (name !== "default") props.name = name;
5152 return openBlock(), createBlock(
5153 Fragment,
5154 null,
5155 [createVNode("slot", props, fallback && fallback())],
5156 64
5157 );
5158 }
5159 let slot = slots[name];
5160 if (slot && slot.length > 1) {
5161 warn$1(
5162 `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
5163 );
5164 slot = () => [];
5165 }
5166 if (slot && slot._c) {
5167 slot._d = false;
5168 }
5169 openBlock();
5170 const validSlotContent = slot && ensureValidVNode(slot(props));
5171 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5172 // key attached in the `createSlots` helper, respect that
5173 validSlotContent && validSlotContent.key;
5174 const rendered = createBlock(
5175 Fragment,
5176 {
5177 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5178 (!validSlotContent && fallback ? "_fb" : "")
5179 },
5180 validSlotContent || (fallback ? fallback() : []),
5181 validSlotContent && slots._ === 1 ? 64 : -2
5182 );
5183 if (!noSlotted && rendered.scopeId) {
5184 rendered.slotScopeIds = [rendered.scopeId + "-s"];
5185 }
5186 if (slot && slot._c) {
5187 slot._d = true;
5188 }
5189 return rendered;
5190 }
5191 function ensureValidVNode(vnodes) {
5192 return vnodes.some((child) => {
5193 if (!isVNode(child)) return true;
5194 if (child.type === Comment) return false;
5195 if (child.type === Fragment && !ensureValidVNode(child.children))
5196 return false;
5197 return true;
5198 }) ? vnodes : null;
5199 }
5200
5201 function toHandlers(obj, preserveCaseIfNecessary) {
5202 const ret = {};
5203 if (!isObject(obj)) {
5204 warn$1(`v-on with no argument expects an object value.`);
5205 return ret;
5206 }
5207 for (const key in obj) {
5208 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
5209 }
5210 return ret;
5211 }
5212
5213 const getPublicInstance = (i) => {
5214 if (!i) return null;
5215 if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5216 return getPublicInstance(i.parent);
5217 };
5218 const publicPropertiesMap = (
5219 // Move PURE marker to new line to workaround compiler discarding it
5220 // due to type annotation
5221 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5222 $: (i) => i,
5223 $el: (i) => i.vnode.el,
5224 $data: (i) => i.data,
5225 $props: (i) => shallowReadonly(i.props) ,
5226 $attrs: (i) => shallowReadonly(i.attrs) ,
5227 $slots: (i) => shallowReadonly(i.slots) ,
5228 $refs: (i) => shallowReadonly(i.refs) ,
5229 $parent: (i) => getPublicInstance(i.parent),
5230 $root: (i) => getPublicInstance(i.root),
5231 $host: (i) => i.ce,
5232 $emit: (i) => i.emit,
5233 $options: (i) => resolveMergedOptions(i) ,
5234 $forceUpdate: (i) => i.f || (i.f = () => {
5235 queueJob(i.update);
5236 }),
5237 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
5238 $watch: (i) => instanceWatch.bind(i)
5239 })
5240 );
5241 const isReservedPrefix = (key) => key === "_" || key === "$";
5242 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
5243 const PublicInstanceProxyHandlers = {
5244 get({ _: instance }, key) {
5245 if (key === "__v_skip") {
5246 return true;
5247 }
5248 const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
5249 if (key === "__isVue") {
5250 return true;
5251 }
5252 let normalizedProps;
5253 if (key[0] !== "$") {
5254 const n = accessCache[key];
5255 if (n !== void 0) {
5256 switch (n) {
5257 case 1 /* SETUP */:
5258 return setupState[key];
5259 case 2 /* DATA */:
5260 return data[key];
5261 case 4 /* CONTEXT */:
5262 return ctx[key];
5263 case 3 /* PROPS */:
5264 return props[key];
5265 }
5266 } else if (hasSetupBinding(setupState, key)) {
5267 accessCache[key] = 1 /* SETUP */;
5268 return setupState[key];
5269 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
5270 accessCache[key] = 2 /* DATA */;
5271 return data[key];
5272 } else if (
5273 // only cache other properties when instance has declared (thus stable)
5274 // props
5275 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
5276 ) {
5277 accessCache[key] = 3 /* PROPS */;
5278 return props[key];
5279 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
5280 accessCache[key] = 4 /* CONTEXT */;
5281 return ctx[key];
5282 } else if (shouldCacheAccess) {
5283 accessCache[key] = 0 /* OTHER */;
5284 }
5285 }
5286 const publicGetter = publicPropertiesMap[key];
5287 let cssModule, globalProperties;
5288 if (publicGetter) {
5289 if (key === "$attrs") {
5290 track(instance.attrs, "get", "");
5291 markAttrsAccessed();
5292 } else if (key === "$slots") {
5293 track(instance, "get", key);
5294 }
5295 return publicGetter(instance);
5296 } else if (
5297 // css module (injected by vue-loader)
5298 (cssModule = type.__cssModules) && (cssModule = cssModule[key])
5299 ) {
5300 return cssModule;
5301 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
5302 accessCache[key] = 4 /* CONTEXT */;
5303 return ctx[key];
5304 } else if (
5305 // global properties
5306 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
5307 ) {
5308 {
5309 return globalProperties[key];
5310 }
5311 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
5312 // to infinite warning loop
5313 key.indexOf("__v") !== 0)) {
5314 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
5315 warn$1(
5316 `Property ${JSON.stringify(
5317 key
5318 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
5319 );
5320 } else if (instance === currentRenderingInstance) {
5321 warn$1(
5322 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
5323 );
5324 }
5325 }
5326 },
5327 set({ _: instance }, key, value) {
5328 const { data, setupState, ctx } = instance;
5329 if (hasSetupBinding(setupState, key)) {
5330 setupState[key] = value;
5331 return true;
5332 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
5333 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
5334 return false;
5335 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
5336 data[key] = value;
5337 return true;
5338 } else if (hasOwn(instance.props, key)) {
5339 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
5340 return false;
5341 }
5342 if (key[0] === "$" && key.slice(1) in instance) {
5343 warn$1(
5344 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
5345 );
5346 return false;
5347 } else {
5348 if (key in instance.appContext.config.globalProperties) {
5349 Object.defineProperty(ctx, key, {
5350 enumerable: true,
5351 configurable: true,
5352 value
5353 });
5354 } else {
5355 ctx[key] = value;
5356 }
5357 }
5358 return true;
5359 },
5360 has({
5361 _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5362 }, key) {
5363 let normalizedProps;
5364 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);
5365 },
5366 defineProperty(target, key, descriptor) {
5367 if (descriptor.get != null) {
5368 target._.accessCache[key] = 0;
5369 } else if (hasOwn(descriptor, "value")) {
5370 this.set(target, key, descriptor.value, null);
5371 }
5372 return Reflect.defineProperty(target, key, descriptor);
5373 }
5374 };
5375 {
5376 PublicInstanceProxyHandlers.ownKeys = (target) => {
5377 warn$1(
5378 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
5379 );
5380 return Reflect.ownKeys(target);
5381 };
5382 }
5383 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
5384 get(target, key) {
5385 if (key === Symbol.unscopables) {
5386 return;
5387 }
5388 return PublicInstanceProxyHandlers.get(target, key, target);
5389 },
5390 has(_, key) {
5391 const has = key[0] !== "_" && !isGloballyAllowed(key);
5392 if (!has && PublicInstanceProxyHandlers.has(_, key)) {
5393 warn$1(
5394 `Property ${JSON.stringify(
5395 key
5396 )} should not start with _ which is a reserved prefix for Vue internals.`
5397 );
5398 }
5399 return has;
5400 }
5401 });
5402 function createDevRenderContext(instance) {
5403 const target = {};
5404 Object.defineProperty(target, `_`, {
5405 configurable: true,
5406 enumerable: false,
5407 get: () => instance
5408 });
5409 Object.keys(publicPropertiesMap).forEach((key) => {
5410 Object.defineProperty(target, key, {
5411 configurable: true,
5412 enumerable: false,
5413 get: () => publicPropertiesMap[key](instance),
5414 // intercepted by the proxy so no need for implementation,
5415 // but needed to prevent set errors
5416 set: NOOP
5417 });
5418 });
5419 return target;
5420 }
5421 function exposePropsOnRenderContext(instance) {
5422 const {
5423 ctx,
5424 propsOptions: [propsOptions]
5425 } = instance;
5426 if (propsOptions) {
5427 Object.keys(propsOptions).forEach((key) => {
5428 Object.defineProperty(ctx, key, {
5429 enumerable: true,
5430 configurable: true,
5431 get: () => instance.props[key],
5432 set: NOOP
5433 });
5434 });
5435 }
5436 }
5437 function exposeSetupStateOnRenderContext(instance) {
5438 const { ctx, setupState } = instance;
5439 Object.keys(toRaw(setupState)).forEach((key) => {
5440 if (!setupState.__isScriptSetup) {
5441 if (isReservedPrefix(key[0])) {
5442 warn$1(
5443 `setup() return property ${JSON.stringify(
5444 key
5445 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
5446 );
5447 return;
5448 }
5449 Object.defineProperty(ctx, key, {
5450 enumerable: true,
5451 configurable: true,
5452 get: () => setupState[key],
5453 set: NOOP
5454 });
5455 }
5456 });
5457 }
5458
5459 const warnRuntimeUsage = (method) => warn$1(
5460 `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
5461 );
5462 function defineProps() {
5463 {
5464 warnRuntimeUsage(`defineProps`);
5465 }
5466 return null;
5467 }
5468 function defineEmits() {
5469 {
5470 warnRuntimeUsage(`defineEmits`);
5471 }
5472 return null;
5473 }
5474 function defineExpose(exposed) {
5475 {
5476 warnRuntimeUsage(`defineExpose`);
5477 }
5478 }
5479 function defineOptions(options) {
5480 {
5481 warnRuntimeUsage(`defineOptions`);
5482 }
5483 }
5484 function defineSlots() {
5485 {
5486 warnRuntimeUsage(`defineSlots`);
5487 }
5488 return null;
5489 }
5490 function defineModel() {
5491 {
5492 warnRuntimeUsage("defineModel");
5493 }
5494 }
5495 function withDefaults(props, defaults) {
5496 {
5497 warnRuntimeUsage(`withDefaults`);
5498 }
5499 return null;
5500 }
5501 function useSlots() {
5502 return getContext().slots;
5503 }
5504 function useAttrs() {
5505 return getContext().attrs;
5506 }
5507 function getContext() {
5508 const i = getCurrentInstance();
5509 if (!i) {
5510 warn$1(`useContext() called without active instance.`);
5511 }
5512 return i.setupContext || (i.setupContext = createSetupContext(i));
5513 }
5514 function normalizePropsOrEmits(props) {
5515 return isArray(props) ? props.reduce(
5516 (normalized, p) => (normalized[p] = null, normalized),
5517 {}
5518 ) : props;
5519 }
5520 function mergeDefaults(raw, defaults) {
5521 const props = normalizePropsOrEmits(raw);
5522 for (const key in defaults) {
5523 if (key.startsWith("__skip")) continue;
5524 let opt = props[key];
5525 if (opt) {
5526 if (isArray(opt) || isFunction(opt)) {
5527 opt = props[key] = { type: opt, default: defaults[key] };
5528 } else {
5529 opt.default = defaults[key];
5530 }
5531 } else if (opt === null) {
5532 opt = props[key] = { default: defaults[key] };
5533 } else {
5534 warn$1(`props default key "${key}" has no corresponding declaration.`);
5535 }
5536 if (opt && defaults[`__skip_${key}`]) {
5537 opt.skipFactory = true;
5538 }
5539 }
5540 return props;
5541 }
5542 function mergeModels(a, b) {
5543 if (!a || !b) return a || b;
5544 if (isArray(a) && isArray(b)) return a.concat(b);
5545 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5546 }
5547 function createPropsRestProxy(props, excludedKeys) {
5548 const ret = {};
5549 for (const key in props) {
5550 if (!excludedKeys.includes(key)) {
5551 Object.defineProperty(ret, key, {
5552 enumerable: true,
5553 get: () => props[key]
5554 });
5555 }
5556 }
5557 return ret;
5558 }
5559 function withAsyncContext(getAwaitable) {
5560 const ctx = getCurrentInstance();
5561 if (!ctx) {
5562 warn$1(
5563 `withAsyncContext called without active current instance. This is likely a bug.`
5564 );
5565 }
5566 let awaitable = getAwaitable();
5567 unsetCurrentInstance();
5568 if (isPromise(awaitable)) {
5569 awaitable = awaitable.catch((e) => {
5570 setCurrentInstance(ctx);
5571 throw e;
5572 });
5573 }
5574 return [awaitable, () => setCurrentInstance(ctx)];
5575 }
5576
5577 function createDuplicateChecker() {
5578 const cache = /* @__PURE__ */ Object.create(null);
5579 return (type, key) => {
5580 if (cache[key]) {
5581 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
5582 } else {
5583 cache[key] = type;
5584 }
5585 };
5586 }
5587 let shouldCacheAccess = true;
5588 function applyOptions(instance) {
5589 const options = resolveMergedOptions(instance);
5590 const publicThis = instance.proxy;
5591 const ctx = instance.ctx;
5592 shouldCacheAccess = false;
5593 if (options.beforeCreate) {
5594 callHook$1(options.beforeCreate, instance, "bc");
5595 }
5596 const {
5597 // state
5598 data: dataOptions,
5599 computed: computedOptions,
5600 methods,
5601 watch: watchOptions,
5602 provide: provideOptions,
5603 inject: injectOptions,
5604 // lifecycle
5605 created,
5606 beforeMount,
5607 mounted,
5608 beforeUpdate,
5609 updated,
5610 activated,
5611 deactivated,
5612 beforeDestroy,
5613 beforeUnmount,
5614 destroyed,
5615 unmounted,
5616 render,
5617 renderTracked,
5618 renderTriggered,
5619 errorCaptured,
5620 serverPrefetch,
5621 // public API
5622 expose,
5623 inheritAttrs,
5624 // assets
5625 components,
5626 directives,
5627 filters
5628 } = options;
5629 const checkDuplicateProperties = createDuplicateChecker() ;
5630 {
5631 const [propsOptions] = instance.propsOptions;
5632 if (propsOptions) {
5633 for (const key in propsOptions) {
5634 checkDuplicateProperties("Props" /* PROPS */, key);
5635 }
5636 }
5637 }
5638 if (injectOptions) {
5639 resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5640 }
5641 if (methods) {
5642 for (const key in methods) {
5643 const methodHandler = methods[key];
5644 if (isFunction(methodHandler)) {
5645 {
5646 Object.defineProperty(ctx, key, {
5647 value: methodHandler.bind(publicThis),
5648 configurable: true,
5649 enumerable: true,
5650 writable: true
5651 });
5652 }
5653 {
5654 checkDuplicateProperties("Methods" /* METHODS */, key);
5655 }
5656 } else {
5657 warn$1(
5658 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
5659 );
5660 }
5661 }
5662 }
5663 if (dataOptions) {
5664 if (!isFunction(dataOptions)) {
5665 warn$1(
5666 `The data option must be a function. Plain object usage is no longer supported.`
5667 );
5668 }
5669 const data = dataOptions.call(publicThis, publicThis);
5670 if (isPromise(data)) {
5671 warn$1(
5672 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
5673 );
5674 }
5675 if (!isObject(data)) {
5676 warn$1(`data() should return an object.`);
5677 } else {
5678 instance.data = reactive(data);
5679 {
5680 for (const key in data) {
5681 checkDuplicateProperties("Data" /* DATA */, key);
5682 if (!isReservedPrefix(key[0])) {
5683 Object.defineProperty(ctx, key, {
5684 configurable: true,
5685 enumerable: true,
5686 get: () => data[key],
5687 set: NOOP
5688 });
5689 }
5690 }
5691 }
5692 }
5693 }
5694 shouldCacheAccess = true;
5695 if (computedOptions) {
5696 for (const key in computedOptions) {
5697 const opt = computedOptions[key];
5698 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
5699 if (get === NOOP) {
5700 warn$1(`Computed property "${key}" has no getter.`);
5701 }
5702 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
5703 warn$1(
5704 `Write operation failed: computed property "${key}" is readonly.`
5705 );
5706 } ;
5707 const c = computed({
5708 get,
5709 set
5710 });
5711 Object.defineProperty(ctx, key, {
5712 enumerable: true,
5713 configurable: true,
5714 get: () => c.value,
5715 set: (v) => c.value = v
5716 });
5717 {
5718 checkDuplicateProperties("Computed" /* COMPUTED */, key);
5719 }
5720 }
5721 }
5722 if (watchOptions) {
5723 for (const key in watchOptions) {
5724 createWatcher(watchOptions[key], ctx, publicThis, key);
5725 }
5726 }
5727 if (provideOptions) {
5728 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
5729 Reflect.ownKeys(provides).forEach((key) => {
5730 provide(key, provides[key]);
5731 });
5732 }
5733 if (created) {
5734 callHook$1(created, instance, "c");
5735 }
5736 function registerLifecycleHook(register, hook) {
5737 if (isArray(hook)) {
5738 hook.forEach((_hook) => register(_hook.bind(publicThis)));
5739 } else if (hook) {
5740 register(hook.bind(publicThis));
5741 }
5742 }
5743 registerLifecycleHook(onBeforeMount, beforeMount);
5744 registerLifecycleHook(onMounted, mounted);
5745 registerLifecycleHook(onBeforeUpdate, beforeUpdate);
5746 registerLifecycleHook(onUpdated, updated);
5747 registerLifecycleHook(onActivated, activated);
5748 registerLifecycleHook(onDeactivated, deactivated);
5749 registerLifecycleHook(onErrorCaptured, errorCaptured);
5750 registerLifecycleHook(onRenderTracked, renderTracked);
5751 registerLifecycleHook(onRenderTriggered, renderTriggered);
5752 registerLifecycleHook(onBeforeUnmount, beforeUnmount);
5753 registerLifecycleHook(onUnmounted, unmounted);
5754 registerLifecycleHook(onServerPrefetch, serverPrefetch);
5755 if (isArray(expose)) {
5756 if (expose.length) {
5757 const exposed = instance.exposed || (instance.exposed = {});
5758 expose.forEach((key) => {
5759 Object.defineProperty(exposed, key, {
5760 get: () => publicThis[key],
5761 set: (val) => publicThis[key] = val
5762 });
5763 });
5764 } else if (!instance.exposed) {
5765 instance.exposed = {};
5766 }
5767 }
5768 if (render && instance.render === NOOP) {
5769 instance.render = render;
5770 }
5771 if (inheritAttrs != null) {
5772 instance.inheritAttrs = inheritAttrs;
5773 }
5774 if (components) instance.components = components;
5775 if (directives) instance.directives = directives;
5776 }
5777 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5778 if (isArray(injectOptions)) {
5779 injectOptions = normalizeInject(injectOptions);
5780 }
5781 for (const key in injectOptions) {
5782 const opt = injectOptions[key];
5783 let injected;
5784 if (isObject(opt)) {
5785 if ("default" in opt) {
5786 injected = inject(
5787 opt.from || key,
5788 opt.default,
5789 true
5790 );
5791 } else {
5792 injected = inject(opt.from || key);
5793 }
5794 } else {
5795 injected = inject(opt);
5796 }
5797 if (isRef(injected)) {
5798 Object.defineProperty(ctx, key, {
5799 enumerable: true,
5800 configurable: true,
5801 get: () => injected.value,
5802 set: (v) => injected.value = v
5803 });
5804 } else {
5805 ctx[key] = injected;
5806 }
5807 {
5808 checkDuplicateProperties("Inject" /* INJECT */, key);
5809 }
5810 }
5811 }
5812 function callHook$1(hook, instance, type) {
5813 callWithAsyncErrorHandling(
5814 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
5815 instance,
5816 type
5817 );
5818 }
5819 function createWatcher(raw, ctx, publicThis, key) {
5820 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5821 if (isString(raw)) {
5822 const handler = ctx[raw];
5823 if (isFunction(handler)) {
5824 {
5825 watch(getter, handler);
5826 }
5827 } else {
5828 warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5829 }
5830 } else if (isFunction(raw)) {
5831 {
5832 watch(getter, raw.bind(publicThis));
5833 }
5834 } else if (isObject(raw)) {
5835 if (isArray(raw)) {
5836 raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
5837 } else {
5838 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
5839 if (isFunction(handler)) {
5840 watch(getter, handler, raw);
5841 } else {
5842 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
5843 }
5844 }
5845 } else {
5846 warn$1(`Invalid watch option: "${key}"`, raw);
5847 }
5848 }
5849 function resolveMergedOptions(instance) {
5850 const base = instance.type;
5851 const { mixins, extends: extendsOptions } = base;
5852 const {
5853 mixins: globalMixins,
5854 optionsCache: cache,
5855 config: { optionMergeStrategies }
5856 } = instance.appContext;
5857 const cached = cache.get(base);
5858 let resolved;
5859 if (cached) {
5860 resolved = cached;
5861 } else if (!globalMixins.length && !mixins && !extendsOptions) {
5862 {
5863 resolved = base;
5864 }
5865 } else {
5866 resolved = {};
5867 if (globalMixins.length) {
5868 globalMixins.forEach(
5869 (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
5870 );
5871 }
5872 mergeOptions(resolved, base, optionMergeStrategies);
5873 }
5874 if (isObject(base)) {
5875 cache.set(base, resolved);
5876 }
5877 return resolved;
5878 }
5879 function mergeOptions(to, from, strats, asMixin = false) {
5880 const { mixins, extends: extendsOptions } = from;
5881 if (extendsOptions) {
5882 mergeOptions(to, extendsOptions, strats, true);
5883 }
5884 if (mixins) {
5885 mixins.forEach(
5886 (m) => mergeOptions(to, m, strats, true)
5887 );
5888 }
5889 for (const key in from) {
5890 if (asMixin && key === "expose") {
5891 warn$1(
5892 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
5893 );
5894 } else {
5895 const strat = internalOptionMergeStrats[key] || strats && strats[key];
5896 to[key] = strat ? strat(to[key], from[key]) : from[key];
5897 }
5898 }
5899 return to;
5900 }
5901 const internalOptionMergeStrats = {
5902 data: mergeDataFn,
5903 props: mergeEmitsOrPropsOptions,
5904 emits: mergeEmitsOrPropsOptions,
5905 // objects
5906 methods: mergeObjectOptions,
5907 computed: mergeObjectOptions,
5908 // lifecycle
5909 beforeCreate: mergeAsArray$1,
5910 created: mergeAsArray$1,
5911 beforeMount: mergeAsArray$1,
5912 mounted: mergeAsArray$1,
5913 beforeUpdate: mergeAsArray$1,
5914 updated: mergeAsArray$1,
5915 beforeDestroy: mergeAsArray$1,
5916 beforeUnmount: mergeAsArray$1,
5917 destroyed: mergeAsArray$1,
5918 unmounted: mergeAsArray$1,
5919 activated: mergeAsArray$1,
5920 deactivated: mergeAsArray$1,
5921 errorCaptured: mergeAsArray$1,
5922 serverPrefetch: mergeAsArray$1,
5923 // assets
5924 components: mergeObjectOptions,
5925 directives: mergeObjectOptions,
5926 // watch
5927 watch: mergeWatchOptions,
5928 // provide / inject
5929 provide: mergeDataFn,
5930 inject: mergeInject
5931 };
5932 function mergeDataFn(to, from) {
5933 if (!from) {
5934 return to;
5935 }
5936 if (!to) {
5937 return from;
5938 }
5939 return function mergedDataFn() {
5940 return (extend)(
5941 isFunction(to) ? to.call(this, this) : to,
5942 isFunction(from) ? from.call(this, this) : from
5943 );
5944 };
5945 }
5946 function mergeInject(to, from) {
5947 return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
5948 }
5949 function normalizeInject(raw) {
5950 if (isArray(raw)) {
5951 const res = {};
5952 for (let i = 0; i < raw.length; i++) {
5953 res[raw[i]] = raw[i];
5954 }
5955 return res;
5956 }
5957 return raw;
5958 }
5959 function mergeAsArray$1(to, from) {
5960 return to ? [...new Set([].concat(to, from))] : from;
5961 }
5962 function mergeObjectOptions(to, from) {
5963 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5964 }
5965 function mergeEmitsOrPropsOptions(to, from) {
5966 if (to) {
5967 if (isArray(to) && isArray(from)) {
5968 return [.../* @__PURE__ */ new Set([...to, ...from])];
5969 }
5970 return extend(
5971 /* @__PURE__ */ Object.create(null),
5972 normalizePropsOrEmits(to),
5973 normalizePropsOrEmits(from != null ? from : {})
5974 );
5975 } else {
5976 return from;
5977 }
5978 }
5979 function mergeWatchOptions(to, from) {
5980 if (!to) return from;
5981 if (!from) return to;
5982 const merged = extend(/* @__PURE__ */ Object.create(null), to);
5983 for (const key in from) {
5984 merged[key] = mergeAsArray$1(to[key], from[key]);
5985 }
5986 return merged;
5987 }
5988
5989 function createAppContext() {
5990 return {
5991 app: null,
5992 config: {
5993 isNativeTag: NO,
5994 performance: false,
5995 globalProperties: {},
5996 optionMergeStrategies: {},
5997 errorHandler: void 0,
5998 warnHandler: void 0,
5999 compilerOptions: {}
6000 },
6001 mixins: [],
6002 components: {},
6003 directives: {},
6004 provides: /* @__PURE__ */ Object.create(null),
6005 optionsCache: /* @__PURE__ */ new WeakMap(),
6006 propsCache: /* @__PURE__ */ new WeakMap(),
6007 emitsCache: /* @__PURE__ */ new WeakMap()
6008 };
6009 }
6010 let uid$1 = 0;
6011 function createAppAPI(render, hydrate) {
6012 return function createApp(rootComponent, rootProps = null) {
6013 if (!isFunction(rootComponent)) {
6014 rootComponent = extend({}, rootComponent);
6015 }
6016 if (rootProps != null && !isObject(rootProps)) {
6017 warn$1(`root props passed to app.mount() must be an object.`);
6018 rootProps = null;
6019 }
6020 const context = createAppContext();
6021 const installedPlugins = /* @__PURE__ */ new WeakSet();
6022 const pluginCleanupFns = [];
6023 let isMounted = false;
6024 const app = context.app = {
6025 _uid: uid$1++,
6026 _component: rootComponent,
6027 _props: rootProps,
6028 _container: null,
6029 _context: context,
6030 _instance: null,
6031 version,
6032 get config() {
6033 return context.config;
6034 },
6035 set config(v) {
6036 {
6037 warn$1(
6038 `app.config cannot be replaced. Modify individual options instead.`
6039 );
6040 }
6041 },
6042 use(plugin, ...options) {
6043 if (installedPlugins.has(plugin)) {
6044 warn$1(`Plugin has already been applied to target app.`);
6045 } else if (plugin && isFunction(plugin.install)) {
6046 installedPlugins.add(plugin);
6047 plugin.install(app, ...options);
6048 } else if (isFunction(plugin)) {
6049 installedPlugins.add(plugin);
6050 plugin(app, ...options);
6051 } else {
6052 warn$1(
6053 `A plugin must either be a function or an object with an "install" function.`
6054 );
6055 }
6056 return app;
6057 },
6058 mixin(mixin) {
6059 {
6060 if (!context.mixins.includes(mixin)) {
6061 context.mixins.push(mixin);
6062 } else {
6063 warn$1(
6064 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6065 );
6066 }
6067 }
6068 return app;
6069 },
6070 component(name, component) {
6071 {
6072 validateComponentName(name, context.config);
6073 }
6074 if (!component) {
6075 return context.components[name];
6076 }
6077 if (context.components[name]) {
6078 warn$1(`Component "${name}" has already been registered in target app.`);
6079 }
6080 context.components[name] = component;
6081 return app;
6082 },
6083 directive(name, directive) {
6084 {
6085 validateDirectiveName(name);
6086 }
6087 if (!directive) {
6088 return context.directives[name];
6089 }
6090 if (context.directives[name]) {
6091 warn$1(`Directive "${name}" has already been registered in target app.`);
6092 }
6093 context.directives[name] = directive;
6094 return app;
6095 },
6096 mount(rootContainer, isHydrate, namespace) {
6097 if (!isMounted) {
6098 if (rootContainer.__vue_app__) {
6099 warn$1(
6100 `There is already an app instance mounted on the host container.
6101 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6102 );
6103 }
6104 const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
6105 vnode.appContext = context;
6106 if (namespace === true) {
6107 namespace = "svg";
6108 } else if (namespace === false) {
6109 namespace = void 0;
6110 }
6111 {
6112 context.reload = () => {
6113 render(
6114 cloneVNode(vnode),
6115 rootContainer,
6116 namespace
6117 );
6118 };
6119 }
6120 if (isHydrate && hydrate) {
6121 hydrate(vnode, rootContainer);
6122 } else {
6123 render(vnode, rootContainer, namespace);
6124 }
6125 isMounted = true;
6126 app._container = rootContainer;
6127 rootContainer.__vue_app__ = app;
6128 {
6129 app._instance = vnode.component;
6130 devtoolsInitApp(app, version);
6131 }
6132 return getComponentPublicInstance(vnode.component);
6133 } else {
6134 warn$1(
6135 `App has already been mounted.
6136If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
6137 );
6138 }
6139 },
6140 onUnmount(cleanupFn) {
6141 if (typeof cleanupFn !== "function") {
6142 warn$1(
6143 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
6144 );
6145 }
6146 pluginCleanupFns.push(cleanupFn);
6147 },
6148 unmount() {
6149 if (isMounted) {
6150 callWithAsyncErrorHandling(
6151 pluginCleanupFns,
6152 app._instance,
6153 16
6154 );
6155 render(null, app._container);
6156 {
6157 app._instance = null;
6158 devtoolsUnmountApp(app);
6159 }
6160 delete app._container.__vue_app__;
6161 } else {
6162 warn$1(`Cannot unmount an app that is not mounted.`);
6163 }
6164 },
6165 provide(key, value) {
6166 if (key in context.provides) {
6167 warn$1(
6168 `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6169 );
6170 }
6171 context.provides[key] = value;
6172 return app;
6173 },
6174 runWithContext(fn) {
6175 const lastApp = currentApp;
6176 currentApp = app;
6177 try {
6178 return fn();
6179 } finally {
6180 currentApp = lastApp;
6181 }
6182 }
6183 };
6184 return app;
6185 };
6186 }
6187 let currentApp = null;
6188
6189 function provide(key, value) {
6190 if (!currentInstance) {
6191 {
6192 warn$1(`provide() can only be used inside setup().`);
6193 }
6194 } else {
6195 let provides = currentInstance.provides;
6196 const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6197 if (parentProvides === provides) {
6198 provides = currentInstance.provides = Object.create(parentProvides);
6199 }
6200 provides[key] = value;
6201 }
6202 }
6203 function inject(key, defaultValue, treatDefaultAsFactory = false) {
6204 const instance = currentInstance || currentRenderingInstance;
6205 if (instance || currentApp) {
6206 const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6207 if (provides && key in provides) {
6208 return provides[key];
6209 } else if (arguments.length > 1) {
6210 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6211 } else {
6212 warn$1(`injection "${String(key)}" not found.`);
6213 }
6214 } else {
6215 warn$1(`inject() can only be used inside setup() or functional components.`);
6216 }
6217 }
6218 function hasInjectionContext() {
6219 return !!(currentInstance || currentRenderingInstance || currentApp);
6220 }
6221
6222 const internalObjectProto = {};
6223 const createInternalObject = () => Object.create(internalObjectProto);
6224 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
6225
6226 function initProps(instance, rawProps, isStateful, isSSR = false) {
6227 const props = {};
6228 const attrs = createInternalObject();
6229 instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6230 setFullProps(instance, rawProps, props, attrs);
6231 for (const key in instance.propsOptions[0]) {
6232 if (!(key in props)) {
6233 props[key] = void 0;
6234 }
6235 }
6236 {
6237 validateProps(rawProps || {}, props, instance);
6238 }
6239 if (isStateful) {
6240 instance.props = isSSR ? props : shallowReactive(props);
6241 } else {
6242 if (!instance.type.props) {
6243 instance.props = attrs;
6244 } else {
6245 instance.props = props;
6246 }
6247 }
6248 instance.attrs = attrs;
6249 }
6250 function isInHmrContext(instance) {
6251 while (instance) {
6252 if (instance.type.__hmrId) return true;
6253 instance = instance.parent;
6254 }
6255 }
6256 function updateProps(instance, rawProps, rawPrevProps, optimized) {
6257 const {
6258 props,
6259 attrs,
6260 vnode: { patchFlag }
6261 } = instance;
6262 const rawCurrentProps = toRaw(props);
6263 const [options] = instance.propsOptions;
6264 let hasAttrsChanged = false;
6265 if (
6266 // always force full diff in dev
6267 // - #1942 if hmr is enabled with sfc component
6268 // - vite#872 non-sfc component used by sfc component
6269 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6270 ) {
6271 if (patchFlag & 8) {
6272 const propsToUpdate = instance.vnode.dynamicProps;
6273 for (let i = 0; i < propsToUpdate.length; i++) {
6274 let key = propsToUpdate[i];
6275 if (isEmitListener(instance.emitsOptions, key)) {
6276 continue;
6277 }
6278 const value = rawProps[key];
6279 if (options) {
6280 if (hasOwn(attrs, key)) {
6281 if (value !== attrs[key]) {
6282 attrs[key] = value;
6283 hasAttrsChanged = true;
6284 }
6285 } else {
6286 const camelizedKey = camelize(key);
6287 props[camelizedKey] = resolvePropValue(
6288 options,
6289 rawCurrentProps,
6290 camelizedKey,
6291 value,
6292 instance,
6293 false
6294 );
6295 }
6296 } else {
6297 if (value !== attrs[key]) {
6298 attrs[key] = value;
6299 hasAttrsChanged = true;
6300 }
6301 }
6302 }
6303 }
6304 } else {
6305 if (setFullProps(instance, rawProps, props, attrs)) {
6306 hasAttrsChanged = true;
6307 }
6308 let kebabKey;
6309 for (const key in rawCurrentProps) {
6310 if (!rawProps || // for camelCase
6311 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6312 // and converted to camelCase (#955)
6313 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6314 if (options) {
6315 if (rawPrevProps && // for camelCase
6316 (rawPrevProps[key] !== void 0 || // for kebab-case
6317 rawPrevProps[kebabKey] !== void 0)) {
6318 props[key] = resolvePropValue(
6319 options,
6320 rawCurrentProps,
6321 key,
6322 void 0,
6323 instance,
6324 true
6325 );
6326 }
6327 } else {
6328 delete props[key];
6329 }
6330 }
6331 }
6332 if (attrs !== rawCurrentProps) {
6333 for (const key in attrs) {
6334 if (!rawProps || !hasOwn(rawProps, key) && true) {
6335 delete attrs[key];
6336 hasAttrsChanged = true;
6337 }
6338 }
6339 }
6340 }
6341 if (hasAttrsChanged) {
6342 trigger(instance.attrs, "set", "");
6343 }
6344 {
6345 validateProps(rawProps || {}, props, instance);
6346 }
6347 }
6348 function setFullProps(instance, rawProps, props, attrs) {
6349 const [options, needCastKeys] = instance.propsOptions;
6350 let hasAttrsChanged = false;
6351 let rawCastValues;
6352 if (rawProps) {
6353 for (let key in rawProps) {
6354 if (isReservedProp(key)) {
6355 continue;
6356 }
6357 const value = rawProps[key];
6358 let camelKey;
6359 if (options && hasOwn(options, camelKey = camelize(key))) {
6360 if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6361 props[camelKey] = value;
6362 } else {
6363 (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6364 }
6365 } else if (!isEmitListener(instance.emitsOptions, key)) {
6366 if (!(key in attrs) || value !== attrs[key]) {
6367 attrs[key] = value;
6368 hasAttrsChanged = true;
6369 }
6370 }
6371 }
6372 }
6373 if (needCastKeys) {
6374 const rawCurrentProps = toRaw(props);
6375 const castValues = rawCastValues || EMPTY_OBJ;
6376 for (let i = 0; i < needCastKeys.length; i++) {
6377 const key = needCastKeys[i];
6378 props[key] = resolvePropValue(
6379 options,
6380 rawCurrentProps,
6381 key,
6382 castValues[key],
6383 instance,
6384 !hasOwn(castValues, key)
6385 );
6386 }
6387 }
6388 return hasAttrsChanged;
6389 }
6390 function resolvePropValue(options, props, key, value, instance, isAbsent) {
6391 const opt = options[key];
6392 if (opt != null) {
6393 const hasDefault = hasOwn(opt, "default");
6394 if (hasDefault && value === void 0) {
6395 const defaultValue = opt.default;
6396 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6397 const { propsDefaults } = instance;
6398 if (key in propsDefaults) {
6399 value = propsDefaults[key];
6400 } else {
6401 const reset = setCurrentInstance(instance);
6402 value = propsDefaults[key] = defaultValue.call(
6403 null,
6404 props
6405 );
6406 reset();
6407 }
6408 } else {
6409 value = defaultValue;
6410 }
6411 if (instance.ce) {
6412 instance.ce._setProp(key, value);
6413 }
6414 }
6415 if (opt[0 /* shouldCast */]) {
6416 if (isAbsent && !hasDefault) {
6417 value = false;
6418 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6419 value = true;
6420 }
6421 }
6422 }
6423 return value;
6424 }
6425 const mixinPropsCache = /* @__PURE__ */ new WeakMap();
6426 function normalizePropsOptions(comp, appContext, asMixin = false) {
6427 const cache = asMixin ? mixinPropsCache : appContext.propsCache;
6428 const cached = cache.get(comp);
6429 if (cached) {
6430 return cached;
6431 }
6432 const raw = comp.props;
6433 const normalized = {};
6434 const needCastKeys = [];
6435 let hasExtends = false;
6436 if (!isFunction(comp)) {
6437 const extendProps = (raw2) => {
6438 hasExtends = true;
6439 const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6440 extend(normalized, props);
6441 if (keys) needCastKeys.push(...keys);
6442 };
6443 if (!asMixin && appContext.mixins.length) {
6444 appContext.mixins.forEach(extendProps);
6445 }
6446 if (comp.extends) {
6447 extendProps(comp.extends);
6448 }
6449 if (comp.mixins) {
6450 comp.mixins.forEach(extendProps);
6451 }
6452 }
6453 if (!raw && !hasExtends) {
6454 if (isObject(comp)) {
6455 cache.set(comp, EMPTY_ARR);
6456 }
6457 return EMPTY_ARR;
6458 }
6459 if (isArray(raw)) {
6460 for (let i = 0; i < raw.length; i++) {
6461 if (!isString(raw[i])) {
6462 warn$1(`props must be strings when using array syntax.`, raw[i]);
6463 }
6464 const normalizedKey = camelize(raw[i]);
6465 if (validatePropName(normalizedKey)) {
6466 normalized[normalizedKey] = EMPTY_OBJ;
6467 }
6468 }
6469 } else if (raw) {
6470 if (!isObject(raw)) {
6471 warn$1(`invalid props options`, raw);
6472 }
6473 for (const key in raw) {
6474 const normalizedKey = camelize(key);
6475 if (validatePropName(normalizedKey)) {
6476 const opt = raw[key];
6477 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6478 const propType = prop.type;
6479 let shouldCast = false;
6480 let shouldCastTrue = true;
6481 if (isArray(propType)) {
6482 for (let index = 0; index < propType.length; ++index) {
6483 const type = propType[index];
6484 const typeName = isFunction(type) && type.name;
6485 if (typeName === "Boolean") {
6486 shouldCast = true;
6487 break;
6488 } else if (typeName === "String") {
6489 shouldCastTrue = false;
6490 }
6491 }
6492 } else {
6493 shouldCast = isFunction(propType) && propType.name === "Boolean";
6494 }
6495 prop[0 /* shouldCast */] = shouldCast;
6496 prop[1 /* shouldCastTrue */] = shouldCastTrue;
6497 if (shouldCast || hasOwn(prop, "default")) {
6498 needCastKeys.push(normalizedKey);
6499 }
6500 }
6501 }
6502 }
6503 const res = [normalized, needCastKeys];
6504 if (isObject(comp)) {
6505 cache.set(comp, res);
6506 }
6507 return res;
6508 }
6509 function validatePropName(key) {
6510 if (key[0] !== "$" && !isReservedProp(key)) {
6511 return true;
6512 } else {
6513 warn$1(`Invalid prop name: "${key}" is a reserved property.`);
6514 }
6515 return false;
6516 }
6517 function getType(ctor) {
6518 if (ctor === null) {
6519 return "null";
6520 }
6521 if (typeof ctor === "function") {
6522 return ctor.name || "";
6523 } else if (typeof ctor === "object") {
6524 const name = ctor.constructor && ctor.constructor.name;
6525 return name || "";
6526 }
6527 return "";
6528 }
6529 function validateProps(rawProps, props, instance) {
6530 const resolvedValues = toRaw(props);
6531 const options = instance.propsOptions[0];
6532 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
6533 for (const key in options) {
6534 let opt = options[key];
6535 if (opt == null) continue;
6536 validateProp(
6537 key,
6538 resolvedValues[key],
6539 opt,
6540 shallowReadonly(resolvedValues) ,
6541 !camelizePropsKey.includes(key)
6542 );
6543 }
6544 }
6545 function validateProp(name, value, prop, props, isAbsent) {
6546 const { type, required, validator, skipCheck } = prop;
6547 if (required && isAbsent) {
6548 warn$1('Missing required prop: "' + name + '"');
6549 return;
6550 }
6551 if (value == null && !required) {
6552 return;
6553 }
6554 if (type != null && type !== true && !skipCheck) {
6555 let isValid = false;
6556 const types = isArray(type) ? type : [type];
6557 const expectedTypes = [];
6558 for (let i = 0; i < types.length && !isValid; i++) {
6559 const { valid, expectedType } = assertType(value, types[i]);
6560 expectedTypes.push(expectedType || "");
6561 isValid = valid;
6562 }
6563 if (!isValid) {
6564 warn$1(getInvalidTypeMessage(name, value, expectedTypes));
6565 return;
6566 }
6567 }
6568 if (validator && !validator(value, props)) {
6569 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
6570 }
6571 }
6572 const isSimpleType = /* @__PURE__ */ makeMap(
6573 "String,Number,Boolean,Function,Symbol,BigInt"
6574 );
6575 function assertType(value, type) {
6576 let valid;
6577 const expectedType = getType(type);
6578 if (expectedType === "null") {
6579 valid = value === null;
6580 } else if (isSimpleType(expectedType)) {
6581 const t = typeof value;
6582 valid = t === expectedType.toLowerCase();
6583 if (!valid && t === "object") {
6584 valid = value instanceof type;
6585 }
6586 } else if (expectedType === "Object") {
6587 valid = isObject(value);
6588 } else if (expectedType === "Array") {
6589 valid = isArray(value);
6590 } else {
6591 valid = value instanceof type;
6592 }
6593 return {
6594 valid,
6595 expectedType
6596 };
6597 }
6598 function getInvalidTypeMessage(name, value, expectedTypes) {
6599 if (expectedTypes.length === 0) {
6600 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
6601 }
6602 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6603 const expectedType = expectedTypes[0];
6604 const receivedType = toRawType(value);
6605 const expectedValue = styleValue(value, expectedType);
6606 const receivedValue = styleValue(value, receivedType);
6607 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6608 message += ` with value ${expectedValue}`;
6609 }
6610 message += `, got ${receivedType} `;
6611 if (isExplicable(receivedType)) {
6612 message += `with value ${receivedValue}.`;
6613 }
6614 return message;
6615 }
6616 function styleValue(value, type) {
6617 if (type === "String") {
6618 return `"${value}"`;
6619 } else if (type === "Number") {
6620 return `${Number(value)}`;
6621 } else {
6622 return `${value}`;
6623 }
6624 }
6625 function isExplicable(type) {
6626 const explicitTypes = ["string", "number", "boolean"];
6627 return explicitTypes.some((elem) => type.toLowerCase() === elem);
6628 }
6629 function isBoolean(...args) {
6630 return args.some((elem) => elem.toLowerCase() === "boolean");
6631 }
6632
6633 const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6634 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6635 const normalizeSlot = (key, rawSlot, ctx) => {
6636 if (rawSlot._n) {
6637 return rawSlot;
6638 }
6639 const normalized = withCtx((...args) => {
6640 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
6641 warn$1(
6642 `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
6643 );
6644 }
6645 return normalizeSlotValue(rawSlot(...args));
6646 }, ctx);
6647 normalized._c = false;
6648 return normalized;
6649 };
6650 const normalizeObjectSlots = (rawSlots, slots, instance) => {
6651 const ctx = rawSlots._ctx;
6652 for (const key in rawSlots) {
6653 if (isInternalKey(key)) continue;
6654 const value = rawSlots[key];
6655 if (isFunction(value)) {
6656 slots[key] = normalizeSlot(key, value, ctx);
6657 } else if (value != null) {
6658 {
6659 warn$1(
6660 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6661 );
6662 }
6663 const normalized = normalizeSlotValue(value);
6664 slots[key] = () => normalized;
6665 }
6666 }
6667 };
6668 const normalizeVNodeSlots = (instance, children) => {
6669 if (!isKeepAlive(instance.vnode) && true) {
6670 warn$1(
6671 `Non-function value encountered for default slot. Prefer function slots for better performance.`
6672 );
6673 }
6674 const normalized = normalizeSlotValue(children);
6675 instance.slots.default = () => normalized;
6676 };
6677 const assignSlots = (slots, children, optimized) => {
6678 for (const key in children) {
6679 if (optimized || key !== "_") {
6680 slots[key] = children[key];
6681 }
6682 }
6683 };
6684 const initSlots = (instance, children, optimized) => {
6685 const slots = instance.slots = createInternalObject();
6686 if (instance.vnode.shapeFlag & 32) {
6687 const type = children._;
6688 if (type) {
6689 assignSlots(slots, children, optimized);
6690 if (optimized) {
6691 def(slots, "_", type, true);
6692 }
6693 } else {
6694 normalizeObjectSlots(children, slots);
6695 }
6696 } else if (children) {
6697 normalizeVNodeSlots(instance, children);
6698 }
6699 };
6700 const updateSlots = (instance, children, optimized) => {
6701 const { vnode, slots } = instance;
6702 let needDeletionCheck = true;
6703 let deletionComparisonTarget = EMPTY_OBJ;
6704 if (vnode.shapeFlag & 32) {
6705 const type = children._;
6706 if (type) {
6707 if (isHmrUpdating) {
6708 assignSlots(slots, children, optimized);
6709 trigger(instance, "set", "$slots");
6710 } else if (optimized && type === 1) {
6711 needDeletionCheck = false;
6712 } else {
6713 assignSlots(slots, children, optimized);
6714 }
6715 } else {
6716 needDeletionCheck = !children.$stable;
6717 normalizeObjectSlots(children, slots);
6718 }
6719 deletionComparisonTarget = children;
6720 } else if (children) {
6721 normalizeVNodeSlots(instance, children);
6722 deletionComparisonTarget = { default: 1 };
6723 }
6724 if (needDeletionCheck) {
6725 for (const key in slots) {
6726 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
6727 delete slots[key];
6728 }
6729 }
6730 }
6731 };
6732
6733 let supported;
6734 let perf;
6735 function startMeasure(instance, type) {
6736 if (instance.appContext.config.performance && isSupported()) {
6737 perf.mark(`vue-${type}-${instance.uid}`);
6738 }
6739 {
6740 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6741 }
6742 }
6743 function endMeasure(instance, type) {
6744 if (instance.appContext.config.performance && isSupported()) {
6745 const startTag = `vue-${type}-${instance.uid}`;
6746 const endTag = startTag + `:end`;
6747 perf.mark(endTag);
6748 perf.measure(
6749 `<${formatComponentName(instance, instance.type)}> ${type}`,
6750 startTag,
6751 endTag
6752 );
6753 perf.clearMarks(startTag);
6754 perf.clearMarks(endTag);
6755 }
6756 {
6757 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6758 }
6759 }
6760 function isSupported() {
6761 if (supported !== void 0) {
6762 return supported;
6763 }
6764 if (typeof window !== "undefined" && window.performance) {
6765 supported = true;
6766 perf = window.performance;
6767 } else {
6768 supported = false;
6769 }
6770 return supported;
6771 }
6772
6773 const queuePostRenderEffect = queueEffectWithSuspense ;
6774 function createRenderer(options) {
6775 return baseCreateRenderer(options);
6776 }
6777 function createHydrationRenderer(options) {
6778 return baseCreateRenderer(options, createHydrationFunctions);
6779 }
6780 function baseCreateRenderer(options, createHydrationFns) {
6781 const target = getGlobalThis();
6782 target.__VUE__ = true;
6783 {
6784 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6785 }
6786 const {
6787 insert: hostInsert,
6788 remove: hostRemove,
6789 patchProp: hostPatchProp,
6790 createElement: hostCreateElement,
6791 createText: hostCreateText,
6792 createComment: hostCreateComment,
6793 setText: hostSetText,
6794 setElementText: hostSetElementText,
6795 parentNode: hostParentNode,
6796 nextSibling: hostNextSibling,
6797 setScopeId: hostSetScopeId = NOOP,
6798 insertStaticContent: hostInsertStaticContent
6799 } = options;
6800 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
6801 if (n1 === n2) {
6802 return;
6803 }
6804 if (n1 && !isSameVNodeType(n1, n2)) {
6805 anchor = getNextHostNode(n1);
6806 unmount(n1, parentComponent, parentSuspense, true);
6807 n1 = null;
6808 }
6809 if (n2.patchFlag === -2) {
6810 optimized = false;
6811 n2.dynamicChildren = null;
6812 }
6813 const { type, ref, shapeFlag } = n2;
6814 switch (type) {
6815 case Text:
6816 processText(n1, n2, container, anchor);
6817 break;
6818 case Comment:
6819 processCommentNode(n1, n2, container, anchor);
6820 break;
6821 case Static:
6822 if (n1 == null) {
6823 mountStaticNode(n2, container, anchor, namespace);
6824 } else {
6825 patchStaticNode(n1, n2, container, namespace);
6826 }
6827 break;
6828 case Fragment:
6829 processFragment(
6830 n1,
6831 n2,
6832 container,
6833 anchor,
6834 parentComponent,
6835 parentSuspense,
6836 namespace,
6837 slotScopeIds,
6838 optimized
6839 );
6840 break;
6841 default:
6842 if (shapeFlag & 1) {
6843 processElement(
6844 n1,
6845 n2,
6846 container,
6847 anchor,
6848 parentComponent,
6849 parentSuspense,
6850 namespace,
6851 slotScopeIds,
6852 optimized
6853 );
6854 } else if (shapeFlag & 6) {
6855 processComponent(
6856 n1,
6857 n2,
6858 container,
6859 anchor,
6860 parentComponent,
6861 parentSuspense,
6862 namespace,
6863 slotScopeIds,
6864 optimized
6865 );
6866 } else if (shapeFlag & 64) {
6867 type.process(
6868 n1,
6869 n2,
6870 container,
6871 anchor,
6872 parentComponent,
6873 parentSuspense,
6874 namespace,
6875 slotScopeIds,
6876 optimized,
6877 internals
6878 );
6879 } else if (shapeFlag & 128) {
6880 type.process(
6881 n1,
6882 n2,
6883 container,
6884 anchor,
6885 parentComponent,
6886 parentSuspense,
6887 namespace,
6888 slotScopeIds,
6889 optimized,
6890 internals
6891 );
6892 } else {
6893 warn$1("Invalid VNode type:", type, `(${typeof type})`);
6894 }
6895 }
6896 if (ref != null && parentComponent) {
6897 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6898 }
6899 };
6900 const processText = (n1, n2, container, anchor) => {
6901 if (n1 == null) {
6902 hostInsert(
6903 n2.el = hostCreateText(n2.children),
6904 container,
6905 anchor
6906 );
6907 } else {
6908 const el = n2.el = n1.el;
6909 if (n2.children !== n1.children) {
6910 hostSetText(el, n2.children);
6911 }
6912 }
6913 };
6914 const processCommentNode = (n1, n2, container, anchor) => {
6915 if (n1 == null) {
6916 hostInsert(
6917 n2.el = hostCreateComment(n2.children || ""),
6918 container,
6919 anchor
6920 );
6921 } else {
6922 n2.el = n1.el;
6923 }
6924 };
6925 const mountStaticNode = (n2, container, anchor, namespace) => {
6926 [n2.el, n2.anchor] = hostInsertStaticContent(
6927 n2.children,
6928 container,
6929 anchor,
6930 namespace,
6931 n2.el,
6932 n2.anchor
6933 );
6934 };
6935 const patchStaticNode = (n1, n2, container, namespace) => {
6936 if (n2.children !== n1.children) {
6937 const anchor = hostNextSibling(n1.anchor);
6938 removeStaticNode(n1);
6939 [n2.el, n2.anchor] = hostInsertStaticContent(
6940 n2.children,
6941 container,
6942 anchor,
6943 namespace
6944 );
6945 } else {
6946 n2.el = n1.el;
6947 n2.anchor = n1.anchor;
6948 }
6949 };
6950 const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
6951 let next;
6952 while (el && el !== anchor) {
6953 next = hostNextSibling(el);
6954 hostInsert(el, container, nextSibling);
6955 el = next;
6956 }
6957 hostInsert(anchor, container, nextSibling);
6958 };
6959 const removeStaticNode = ({ el, anchor }) => {
6960 let next;
6961 while (el && el !== anchor) {
6962 next = hostNextSibling(el);
6963 hostRemove(el);
6964 el = next;
6965 }
6966 hostRemove(anchor);
6967 };
6968 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6969 if (n2.type === "svg") {
6970 namespace = "svg";
6971 } else if (n2.type === "math") {
6972 namespace = "mathml";
6973 }
6974 if (n1 == null) {
6975 mountElement(
6976 n2,
6977 container,
6978 anchor,
6979 parentComponent,
6980 parentSuspense,
6981 namespace,
6982 slotScopeIds,
6983 optimized
6984 );
6985 } else {
6986 patchElement(
6987 n1,
6988 n2,
6989 parentComponent,
6990 parentSuspense,
6991 namespace,
6992 slotScopeIds,
6993 optimized
6994 );
6995 }
6996 };
6997 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6998 let el;
6999 let vnodeHook;
7000 const { props, shapeFlag, transition, dirs } = vnode;
7001 el = vnode.el = hostCreateElement(
7002 vnode.type,
7003 namespace,
7004 props && props.is,
7005 props
7006 );
7007 if (shapeFlag & 8) {
7008 hostSetElementText(el, vnode.children);
7009 } else if (shapeFlag & 16) {
7010 mountChildren(
7011 vnode.children,
7012 el,
7013 null,
7014 parentComponent,
7015 parentSuspense,
7016 resolveChildrenNamespace(vnode, namespace),
7017 slotScopeIds,
7018 optimized
7019 );
7020 }
7021 if (dirs) {
7022 invokeDirectiveHook(vnode, null, parentComponent, "created");
7023 }
7024 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
7025 if (props) {
7026 for (const key in props) {
7027 if (key !== "value" && !isReservedProp(key)) {
7028 hostPatchProp(el, key, null, props[key], namespace, parentComponent);
7029 }
7030 }
7031 if ("value" in props) {
7032 hostPatchProp(el, "value", null, props.value, namespace);
7033 }
7034 if (vnodeHook = props.onVnodeBeforeMount) {
7035 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7036 }
7037 }
7038 {
7039 def(el, "__vnode", vnode, true);
7040 def(el, "__vueParentComponent", parentComponent, true);
7041 }
7042 if (dirs) {
7043 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7044 }
7045 const needCallTransitionHooks = needTransition(parentSuspense, transition);
7046 if (needCallTransitionHooks) {
7047 transition.beforeEnter(el);
7048 }
7049 hostInsert(el, container, anchor);
7050 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7051 queuePostRenderEffect(() => {
7052 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7053 needCallTransitionHooks && transition.enter(el);
7054 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7055 }, parentSuspense);
7056 }
7057 };
7058 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
7059 if (scopeId) {
7060 hostSetScopeId(el, scopeId);
7061 }
7062 if (slotScopeIds) {
7063 for (let i = 0; i < slotScopeIds.length; i++) {
7064 hostSetScopeId(el, slotScopeIds[i]);
7065 }
7066 }
7067 if (parentComponent) {
7068 let subTree = parentComponent.subTree;
7069 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7070 subTree = filterSingleRoot(subTree.children) || subTree;
7071 }
7072 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
7073 const parentVNode = parentComponent.vnode;
7074 setScopeId(
7075 el,
7076 parentVNode,
7077 parentVNode.scopeId,
7078 parentVNode.slotScopeIds,
7079 parentComponent.parent
7080 );
7081 }
7082 }
7083 };
7084 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
7085 for (let i = start; i < children.length; i++) {
7086 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
7087 patch(
7088 null,
7089 child,
7090 container,
7091 anchor,
7092 parentComponent,
7093 parentSuspense,
7094 namespace,
7095 slotScopeIds,
7096 optimized
7097 );
7098 }
7099 };
7100 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7101 const el = n2.el = n1.el;
7102 {
7103 el.__vnode = n2;
7104 }
7105 let { patchFlag, dynamicChildren, dirs } = n2;
7106 patchFlag |= n1.patchFlag & 16;
7107 const oldProps = n1.props || EMPTY_OBJ;
7108 const newProps = n2.props || EMPTY_OBJ;
7109 let vnodeHook;
7110 parentComponent && toggleRecurse(parentComponent, false);
7111 if (vnodeHook = newProps.onVnodeBeforeUpdate) {
7112 invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7113 }
7114 if (dirs) {
7115 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7116 }
7117 parentComponent && toggleRecurse(parentComponent, true);
7118 if (isHmrUpdating) {
7119 patchFlag = 0;
7120 optimized = false;
7121 dynamicChildren = null;
7122 }
7123 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
7124 hostSetElementText(el, "");
7125 }
7126 if (dynamicChildren) {
7127 patchBlockChildren(
7128 n1.dynamicChildren,
7129 dynamicChildren,
7130 el,
7131 parentComponent,
7132 parentSuspense,
7133 resolveChildrenNamespace(n2, namespace),
7134 slotScopeIds
7135 );
7136 {
7137 traverseStaticChildren(n1, n2);
7138 }
7139 } else if (!optimized) {
7140 patchChildren(
7141 n1,
7142 n2,
7143 el,
7144 null,
7145 parentComponent,
7146 parentSuspense,
7147 resolveChildrenNamespace(n2, namespace),
7148 slotScopeIds,
7149 false
7150 );
7151 }
7152 if (patchFlag > 0) {
7153 if (patchFlag & 16) {
7154 patchProps(el, oldProps, newProps, parentComponent, namespace);
7155 } else {
7156 if (patchFlag & 2) {
7157 if (oldProps.class !== newProps.class) {
7158 hostPatchProp(el, "class", null, newProps.class, namespace);
7159 }
7160 }
7161 if (patchFlag & 4) {
7162 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
7163 }
7164 if (patchFlag & 8) {
7165 const propsToUpdate = n2.dynamicProps;
7166 for (let i = 0; i < propsToUpdate.length; i++) {
7167 const key = propsToUpdate[i];
7168 const prev = oldProps[key];
7169 const next = newProps[key];
7170 if (next !== prev || key === "value") {
7171 hostPatchProp(el, key, prev, next, namespace, parentComponent);
7172 }
7173 }
7174 }
7175 }
7176 if (patchFlag & 1) {
7177 if (n1.children !== n2.children) {
7178 hostSetElementText(el, n2.children);
7179 }
7180 }
7181 } else if (!optimized && dynamicChildren == null) {
7182 patchProps(el, oldProps, newProps, parentComponent, namespace);
7183 }
7184 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7185 queuePostRenderEffect(() => {
7186 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7187 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7188 }, parentSuspense);
7189 }
7190 };
7191 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
7192 for (let i = 0; i < newChildren.length; i++) {
7193 const oldVNode = oldChildren[i];
7194 const newVNode = newChildren[i];
7195 const container = (
7196 // oldVNode may be an errored async setup() component inside Suspense
7197 // which will not have a mounted element
7198 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
7199 // of the Fragment itself so it can move its children.
7200 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
7201 // which also requires the correct parent container
7202 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
7203 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
7204 // In other cases, the parent container is not actually used so we
7205 // just pass the block element here to avoid a DOM parentNode call.
7206 fallbackContainer
7207 )
7208 );
7209 patch(
7210 oldVNode,
7211 newVNode,
7212 container,
7213 null,
7214 parentComponent,
7215 parentSuspense,
7216 namespace,
7217 slotScopeIds,
7218 true
7219 );
7220 }
7221 };
7222 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
7223 if (oldProps !== newProps) {
7224 if (oldProps !== EMPTY_OBJ) {
7225 for (const key in oldProps) {
7226 if (!isReservedProp(key) && !(key in newProps)) {
7227 hostPatchProp(
7228 el,
7229 key,
7230 oldProps[key],
7231 null,
7232 namespace,
7233 parentComponent
7234 );
7235 }
7236 }
7237 }
7238 for (const key in newProps) {
7239 if (isReservedProp(key)) continue;
7240 const next = newProps[key];
7241 const prev = oldProps[key];
7242 if (next !== prev && key !== "value") {
7243 hostPatchProp(el, key, prev, next, namespace, parentComponent);
7244 }
7245 }
7246 if ("value" in newProps) {
7247 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
7248 }
7249 }
7250 };
7251 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7252 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
7253 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
7254 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
7255 if (
7256 // #5523 dev root fragment may inherit directives
7257 isHmrUpdating || patchFlag & 2048
7258 ) {
7259 patchFlag = 0;
7260 optimized = false;
7261 dynamicChildren = null;
7262 }
7263 if (fragmentSlotScopeIds) {
7264 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
7265 }
7266 if (n1 == null) {
7267 hostInsert(fragmentStartAnchor, container, anchor);
7268 hostInsert(fragmentEndAnchor, container, anchor);
7269 mountChildren(
7270 // #10007
7271 // such fragment like `<></>` will be compiled into
7272 // a fragment which doesn't have a children.
7273 // In this case fallback to an empty array
7274 n2.children || [],
7275 container,
7276 fragmentEndAnchor,
7277 parentComponent,
7278 parentSuspense,
7279 namespace,
7280 slotScopeIds,
7281 optimized
7282 );
7283 } else {
7284 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
7285 // of renderSlot() with no valid children
7286 n1.dynamicChildren) {
7287 patchBlockChildren(
7288 n1.dynamicChildren,
7289 dynamicChildren,
7290 container,
7291 parentComponent,
7292 parentSuspense,
7293 namespace,
7294 slotScopeIds
7295 );
7296 {
7297 traverseStaticChildren(n1, n2);
7298 }
7299 } else {
7300 patchChildren(
7301 n1,
7302 n2,
7303 container,
7304 fragmentEndAnchor,
7305 parentComponent,
7306 parentSuspense,
7307 namespace,
7308 slotScopeIds,
7309 optimized
7310 );
7311 }
7312 }
7313 };
7314 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7315 n2.slotScopeIds = slotScopeIds;
7316 if (n1 == null) {
7317 if (n2.shapeFlag & 512) {
7318 parentComponent.ctx.activate(
7319 n2,
7320 container,
7321 anchor,
7322 namespace,
7323 optimized
7324 );
7325 } else {
7326 mountComponent(
7327 n2,
7328 container,
7329 anchor,
7330 parentComponent,
7331 parentSuspense,
7332 namespace,
7333 optimized
7334 );
7335 }
7336 } else {
7337 updateComponent(n1, n2, optimized);
7338 }
7339 };
7340 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
7341 const instance = (initialVNode.component = createComponentInstance(
7342 initialVNode,
7343 parentComponent,
7344 parentSuspense
7345 ));
7346 if (instance.type.__hmrId) {
7347 registerHMR(instance);
7348 }
7349 {
7350 pushWarningContext(initialVNode);
7351 startMeasure(instance, `mount`);
7352 }
7353 if (isKeepAlive(initialVNode)) {
7354 instance.ctx.renderer = internals;
7355 }
7356 {
7357 {
7358 startMeasure(instance, `init`);
7359 }
7360 setupComponent(instance, false, optimized);
7361 {
7362 endMeasure(instance, `init`);
7363 }
7364 }
7365 if (instance.asyncDep) {
7366 if (isHmrUpdating) initialVNode.el = null;
7367 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
7368 if (!initialVNode.el) {
7369 const placeholder = instance.subTree = createVNode(Comment);
7370 processCommentNode(null, placeholder, container, anchor);
7371 }
7372 } else {
7373 setupRenderEffect(
7374 instance,
7375 initialVNode,
7376 container,
7377 anchor,
7378 parentSuspense,
7379 namespace,
7380 optimized
7381 );
7382 }
7383 {
7384 popWarningContext();
7385 endMeasure(instance, `mount`);
7386 }
7387 };
7388 const updateComponent = (n1, n2, optimized) => {
7389 const instance = n2.component = n1.component;
7390 if (shouldUpdateComponent(n1, n2, optimized)) {
7391 if (instance.asyncDep && !instance.asyncResolved) {
7392 {
7393 pushWarningContext(n2);
7394 }
7395 updateComponentPreRender(instance, n2, optimized);
7396 {
7397 popWarningContext();
7398 }
7399 return;
7400 } else {
7401 instance.next = n2;
7402 instance.update();
7403 }
7404 } else {
7405 n2.el = n1.el;
7406 instance.vnode = n2;
7407 }
7408 };
7409 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7410 const componentUpdateFn = () => {
7411 if (!instance.isMounted) {
7412 let vnodeHook;
7413 const { el, props } = initialVNode;
7414 const { bm, m, parent, root, type } = instance;
7415 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
7416 toggleRecurse(instance, false);
7417 if (bm) {
7418 invokeArrayFns(bm);
7419 }
7420 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
7421 invokeVNodeHook(vnodeHook, parent, initialVNode);
7422 }
7423 toggleRecurse(instance, true);
7424 if (el && hydrateNode) {
7425 const hydrateSubTree = () => {
7426 {
7427 startMeasure(instance, `render`);
7428 }
7429 instance.subTree = renderComponentRoot(instance);
7430 {
7431 endMeasure(instance, `render`);
7432 }
7433 {
7434 startMeasure(instance, `hydrate`);
7435 }
7436 hydrateNode(
7437 el,
7438 instance.subTree,
7439 instance,
7440 parentSuspense,
7441 null
7442 );
7443 {
7444 endMeasure(instance, `hydrate`);
7445 }
7446 };
7447 if (isAsyncWrapperVNode && type.__asyncHydrate) {
7448 type.__asyncHydrate(
7449 el,
7450 instance,
7451 hydrateSubTree
7452 );
7453 } else {
7454 hydrateSubTree();
7455 }
7456 } else {
7457 if (root.ce) {
7458 root.ce._injectChildStyle(type);
7459 }
7460 {
7461 startMeasure(instance, `render`);
7462 }
7463 const subTree = instance.subTree = renderComponentRoot(instance);
7464 {
7465 endMeasure(instance, `render`);
7466 }
7467 {
7468 startMeasure(instance, `patch`);
7469 }
7470 patch(
7471 null,
7472 subTree,
7473 container,
7474 anchor,
7475 instance,
7476 parentSuspense,
7477 namespace
7478 );
7479 {
7480 endMeasure(instance, `patch`);
7481 }
7482 initialVNode.el = subTree.el;
7483 }
7484 if (m) {
7485 queuePostRenderEffect(m, parentSuspense);
7486 }
7487 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7488 const scopedInitialVNode = initialVNode;
7489 queuePostRenderEffect(
7490 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7491 parentSuspense
7492 );
7493 }
7494 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7495 instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7496 }
7497 instance.isMounted = true;
7498 {
7499 devtoolsComponentAdded(instance);
7500 }
7501 initialVNode = container = anchor = null;
7502 } else {
7503 let { next, bu, u, parent, vnode } = instance;
7504 {
7505 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
7506 if (nonHydratedAsyncRoot) {
7507 if (next) {
7508 next.el = vnode.el;
7509 updateComponentPreRender(instance, next, optimized);
7510 }
7511 nonHydratedAsyncRoot.asyncDep.then(() => {
7512 if (!instance.isUnmounted) {
7513 componentUpdateFn();
7514 }
7515 });
7516 return;
7517 }
7518 }
7519 let originNext = next;
7520 let vnodeHook;
7521 {
7522 pushWarningContext(next || instance.vnode);
7523 }
7524 toggleRecurse(instance, false);
7525 if (next) {
7526 next.el = vnode.el;
7527 updateComponentPreRender(instance, next, optimized);
7528 } else {
7529 next = vnode;
7530 }
7531 if (bu) {
7532 invokeArrayFns(bu);
7533 }
7534 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
7535 invokeVNodeHook(vnodeHook, parent, next, vnode);
7536 }
7537 toggleRecurse(instance, true);
7538 {
7539 startMeasure(instance, `render`);
7540 }
7541 const nextTree = renderComponentRoot(instance);
7542 {
7543 endMeasure(instance, `render`);
7544 }
7545 const prevTree = instance.subTree;
7546 instance.subTree = nextTree;
7547 {
7548 startMeasure(instance, `patch`);
7549 }
7550 patch(
7551 prevTree,
7552 nextTree,
7553 // parent may have changed if it's in a teleport
7554 hostParentNode(prevTree.el),
7555 // anchor may have changed if it's in a fragment
7556 getNextHostNode(prevTree),
7557 instance,
7558 parentSuspense,
7559 namespace
7560 );
7561 {
7562 endMeasure(instance, `patch`);
7563 }
7564 next.el = nextTree.el;
7565 if (originNext === null) {
7566 updateHOCHostEl(instance, nextTree.el);
7567 }
7568 if (u) {
7569 queuePostRenderEffect(u, parentSuspense);
7570 }
7571 if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7572 queuePostRenderEffect(
7573 () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7574 parentSuspense
7575 );
7576 }
7577 {
7578 devtoolsComponentUpdated(instance);
7579 }
7580 {
7581 popWarningContext();
7582 }
7583 }
7584 };
7585 instance.scope.on();
7586 const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
7587 instance.scope.off();
7588 const update = instance.update = effect.run.bind(effect);
7589 const job = instance.job = effect.runIfDirty.bind(effect);
7590 job.i = instance;
7591 job.id = instance.uid;
7592 effect.scheduler = () => queueJob(job);
7593 toggleRecurse(instance, true);
7594 {
7595 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7596 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7597 }
7598 update();
7599 };
7600 const updateComponentPreRender = (instance, nextVNode, optimized) => {
7601 nextVNode.component = instance;
7602 const prevProps = instance.vnode.props;
7603 instance.vnode = nextVNode;
7604 instance.next = null;
7605 updateProps(instance, nextVNode.props, prevProps, optimized);
7606 updateSlots(instance, nextVNode.children, optimized);
7607 pauseTracking();
7608 flushPreFlushCbs(instance);
7609 resetTracking();
7610 };
7611 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7612 const c1 = n1 && n1.children;
7613 const prevShapeFlag = n1 ? n1.shapeFlag : 0;
7614 const c2 = n2.children;
7615 const { patchFlag, shapeFlag } = n2;
7616 if (patchFlag > 0) {
7617 if (patchFlag & 128) {
7618 patchKeyedChildren(
7619 c1,
7620 c2,
7621 container,
7622 anchor,
7623 parentComponent,
7624 parentSuspense,
7625 namespace,
7626 slotScopeIds,
7627 optimized
7628 );
7629 return;
7630 } else if (patchFlag & 256) {
7631 patchUnkeyedChildren(
7632 c1,
7633 c2,
7634 container,
7635 anchor,
7636 parentComponent,
7637 parentSuspense,
7638 namespace,
7639 slotScopeIds,
7640 optimized
7641 );
7642 return;
7643 }
7644 }
7645 if (shapeFlag & 8) {
7646 if (prevShapeFlag & 16) {
7647 unmountChildren(c1, parentComponent, parentSuspense);
7648 }
7649 if (c2 !== c1) {
7650 hostSetElementText(container, c2);
7651 }
7652 } else {
7653 if (prevShapeFlag & 16) {
7654 if (shapeFlag & 16) {
7655 patchKeyedChildren(
7656 c1,
7657 c2,
7658 container,
7659 anchor,
7660 parentComponent,
7661 parentSuspense,
7662 namespace,
7663 slotScopeIds,
7664 optimized
7665 );
7666 } else {
7667 unmountChildren(c1, parentComponent, parentSuspense, true);
7668 }
7669 } else {
7670 if (prevShapeFlag & 8) {
7671 hostSetElementText(container, "");
7672 }
7673 if (shapeFlag & 16) {
7674 mountChildren(
7675 c2,
7676 container,
7677 anchor,
7678 parentComponent,
7679 parentSuspense,
7680 namespace,
7681 slotScopeIds,
7682 optimized
7683 );
7684 }
7685 }
7686 }
7687 };
7688 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7689 c1 = c1 || EMPTY_ARR;
7690 c2 = c2 || EMPTY_ARR;
7691 const oldLength = c1.length;
7692 const newLength = c2.length;
7693 const commonLength = Math.min(oldLength, newLength);
7694 let i;
7695 for (i = 0; i < commonLength; i++) {
7696 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7697 patch(
7698 c1[i],
7699 nextChild,
7700 container,
7701 null,
7702 parentComponent,
7703 parentSuspense,
7704 namespace,
7705 slotScopeIds,
7706 optimized
7707 );
7708 }
7709 if (oldLength > newLength) {
7710 unmountChildren(
7711 c1,
7712 parentComponent,
7713 parentSuspense,
7714 true,
7715 false,
7716 commonLength
7717 );
7718 } else {
7719 mountChildren(
7720 c2,
7721 container,
7722 anchor,
7723 parentComponent,
7724 parentSuspense,
7725 namespace,
7726 slotScopeIds,
7727 optimized,
7728 commonLength
7729 );
7730 }
7731 };
7732 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7733 let i = 0;
7734 const l2 = c2.length;
7735 let e1 = c1.length - 1;
7736 let e2 = l2 - 1;
7737 while (i <= e1 && i <= e2) {
7738 const n1 = c1[i];
7739 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7740 if (isSameVNodeType(n1, n2)) {
7741 patch(
7742 n1,
7743 n2,
7744 container,
7745 null,
7746 parentComponent,
7747 parentSuspense,
7748 namespace,
7749 slotScopeIds,
7750 optimized
7751 );
7752 } else {
7753 break;
7754 }
7755 i++;
7756 }
7757 while (i <= e1 && i <= e2) {
7758 const n1 = c1[e1];
7759 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
7760 if (isSameVNodeType(n1, n2)) {
7761 patch(
7762 n1,
7763 n2,
7764 container,
7765 null,
7766 parentComponent,
7767 parentSuspense,
7768 namespace,
7769 slotScopeIds,
7770 optimized
7771 );
7772 } else {
7773 break;
7774 }
7775 e1--;
7776 e2--;
7777 }
7778 if (i > e1) {
7779 if (i <= e2) {
7780 const nextPos = e2 + 1;
7781 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
7782 while (i <= e2) {
7783 patch(
7784 null,
7785 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
7786 container,
7787 anchor,
7788 parentComponent,
7789 parentSuspense,
7790 namespace,
7791 slotScopeIds,
7792 optimized
7793 );
7794 i++;
7795 }
7796 }
7797 } else if (i > e2) {
7798 while (i <= e1) {
7799 unmount(c1[i], parentComponent, parentSuspense, true);
7800 i++;
7801 }
7802 } else {
7803 const s1 = i;
7804 const s2 = i;
7805 const keyToNewIndexMap = /* @__PURE__ */ new Map();
7806 for (i = s2; i <= e2; i++) {
7807 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7808 if (nextChild.key != null) {
7809 if (keyToNewIndexMap.has(nextChild.key)) {
7810 warn$1(
7811 `Duplicate keys found during update:`,
7812 JSON.stringify(nextChild.key),
7813 `Make sure keys are unique.`
7814 );
7815 }
7816 keyToNewIndexMap.set(nextChild.key, i);
7817 }
7818 }
7819 let j;
7820 let patched = 0;
7821 const toBePatched = e2 - s2 + 1;
7822 let moved = false;
7823 let maxNewIndexSoFar = 0;
7824 const newIndexToOldIndexMap = new Array(toBePatched);
7825 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
7826 for (i = s1; i <= e1; i++) {
7827 const prevChild = c1[i];
7828 if (patched >= toBePatched) {
7829 unmount(prevChild, parentComponent, parentSuspense, true);
7830 continue;
7831 }
7832 let newIndex;
7833 if (prevChild.key != null) {
7834 newIndex = keyToNewIndexMap.get(prevChild.key);
7835 } else {
7836 for (j = s2; j <= e2; j++) {
7837 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
7838 newIndex = j;
7839 break;
7840 }
7841 }
7842 }
7843 if (newIndex === void 0) {
7844 unmount(prevChild, parentComponent, parentSuspense, true);
7845 } else {
7846 newIndexToOldIndexMap[newIndex - s2] = i + 1;
7847 if (newIndex >= maxNewIndexSoFar) {
7848 maxNewIndexSoFar = newIndex;
7849 } else {
7850 moved = true;
7851 }
7852 patch(
7853 prevChild,
7854 c2[newIndex],
7855 container,
7856 null,
7857 parentComponent,
7858 parentSuspense,
7859 namespace,
7860 slotScopeIds,
7861 optimized
7862 );
7863 patched++;
7864 }
7865 }
7866 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
7867 j = increasingNewIndexSequence.length - 1;
7868 for (i = toBePatched - 1; i >= 0; i--) {
7869 const nextIndex = s2 + i;
7870 const nextChild = c2[nextIndex];
7871 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7872 if (newIndexToOldIndexMap[i] === 0) {
7873 patch(
7874 null,
7875 nextChild,
7876 container,
7877 anchor,
7878 parentComponent,
7879 parentSuspense,
7880 namespace,
7881 slotScopeIds,
7882 optimized
7883 );
7884 } else if (moved) {
7885 if (j < 0 || i !== increasingNewIndexSequence[j]) {
7886 move(nextChild, container, anchor, 2);
7887 } else {
7888 j--;
7889 }
7890 }
7891 }
7892 }
7893 };
7894 const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
7895 const { el, type, transition, children, shapeFlag } = vnode;
7896 if (shapeFlag & 6) {
7897 move(vnode.component.subTree, container, anchor, moveType);
7898 return;
7899 }
7900 if (shapeFlag & 128) {
7901 vnode.suspense.move(container, anchor, moveType);
7902 return;
7903 }
7904 if (shapeFlag & 64) {
7905 type.move(vnode, container, anchor, internals);
7906 return;
7907 }
7908 if (type === Fragment) {
7909 hostInsert(el, container, anchor);
7910 for (let i = 0; i < children.length; i++) {
7911 move(children[i], container, anchor, moveType);
7912 }
7913 hostInsert(vnode.anchor, container, anchor);
7914 return;
7915 }
7916 if (type === Static) {
7917 moveStaticNode(vnode, container, anchor);
7918 return;
7919 }
7920 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7921 if (needTransition2) {
7922 if (moveType === 0) {
7923 transition.beforeEnter(el);
7924 hostInsert(el, container, anchor);
7925 queuePostRenderEffect(() => transition.enter(el), parentSuspense);
7926 } else {
7927 const { leave, delayLeave, afterLeave } = transition;
7928 const remove2 = () => hostInsert(el, container, anchor);
7929 const performLeave = () => {
7930 leave(el, () => {
7931 remove2();
7932 afterLeave && afterLeave();
7933 });
7934 };
7935 if (delayLeave) {
7936 delayLeave(el, remove2, performLeave);
7937 } else {
7938 performLeave();
7939 }
7940 }
7941 } else {
7942 hostInsert(el, container, anchor);
7943 }
7944 };
7945 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
7946 const {
7947 type,
7948 props,
7949 ref,
7950 children,
7951 dynamicChildren,
7952 shapeFlag,
7953 patchFlag,
7954 dirs,
7955 cacheIndex
7956 } = vnode;
7957 if (patchFlag === -2) {
7958 optimized = false;
7959 }
7960 if (ref != null) {
7961 setRef(ref, null, parentSuspense, vnode, true);
7962 }
7963 if (cacheIndex != null) {
7964 parentComponent.renderCache[cacheIndex] = void 0;
7965 }
7966 if (shapeFlag & 256) {
7967 parentComponent.ctx.deactivate(vnode);
7968 return;
7969 }
7970 const shouldInvokeDirs = shapeFlag & 1 && dirs;
7971 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
7972 let vnodeHook;
7973 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
7974 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7975 }
7976 if (shapeFlag & 6) {
7977 unmountComponent(vnode.component, parentSuspense, doRemove);
7978 } else {
7979 if (shapeFlag & 128) {
7980 vnode.suspense.unmount(parentSuspense, doRemove);
7981 return;
7982 }
7983 if (shouldInvokeDirs) {
7984 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
7985 }
7986 if (shapeFlag & 64) {
7987 vnode.type.remove(
7988 vnode,
7989 parentComponent,
7990 parentSuspense,
7991 internals,
7992 doRemove
7993 );
7994 } else if (dynamicChildren && // #5154
7995 // when v-once is used inside a block, setBlockTracking(-1) marks the
7996 // parent block with hasOnce: true
7997 // so that it doesn't take the fast path during unmount - otherwise
7998 // components nested in v-once are never unmounted.
7999 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
8000 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
8001 unmountChildren(
8002 dynamicChildren,
8003 parentComponent,
8004 parentSuspense,
8005 false,
8006 true
8007 );
8008 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
8009 unmountChildren(children, parentComponent, parentSuspense);
8010 }
8011 if (doRemove) {
8012 remove(vnode);
8013 }
8014 }
8015 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
8016 queuePostRenderEffect(() => {
8017 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8018 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8019 }, parentSuspense);
8020 }
8021 };
8022 const remove = (vnode) => {
8023 const { type, el, anchor, transition } = vnode;
8024 if (type === Fragment) {
8025 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
8026 vnode.children.forEach((child) => {
8027 if (child.type === Comment) {
8028 hostRemove(child.el);
8029 } else {
8030 remove(child);
8031 }
8032 });
8033 } else {
8034 removeFragment(el, anchor);
8035 }
8036 return;
8037 }
8038 if (type === Static) {
8039 removeStaticNode(vnode);
8040 return;
8041 }
8042 const performRemove = () => {
8043 hostRemove(el);
8044 if (transition && !transition.persisted && transition.afterLeave) {
8045 transition.afterLeave();
8046 }
8047 };
8048 if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8049 const { leave, delayLeave } = transition;
8050 const performLeave = () => leave(el, performRemove);
8051 if (delayLeave) {
8052 delayLeave(vnode.el, performRemove, performLeave);
8053 } else {
8054 performLeave();
8055 }
8056 } else {
8057 performRemove();
8058 }
8059 };
8060 const removeFragment = (cur, end) => {
8061 let next;
8062 while (cur !== end) {
8063 next = hostNextSibling(cur);
8064 hostRemove(cur);
8065 cur = next;
8066 }
8067 hostRemove(end);
8068 };
8069 const unmountComponent = (instance, parentSuspense, doRemove) => {
8070 if (instance.type.__hmrId) {
8071 unregisterHMR(instance);
8072 }
8073 const { bum, scope, job, subTree, um, m, a } = instance;
8074 invalidateMount(m);
8075 invalidateMount(a);
8076 if (bum) {
8077 invokeArrayFns(bum);
8078 }
8079 scope.stop();
8080 if (job) {
8081 job.flags |= 8;
8082 unmount(subTree, instance, parentSuspense, doRemove);
8083 }
8084 if (um) {
8085 queuePostRenderEffect(um, parentSuspense);
8086 }
8087 queuePostRenderEffect(() => {
8088 instance.isUnmounted = true;
8089 }, parentSuspense);
8090 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8091 parentSuspense.deps--;
8092 if (parentSuspense.deps === 0) {
8093 parentSuspense.resolve();
8094 }
8095 }
8096 {
8097 devtoolsComponentRemoved(instance);
8098 }
8099 };
8100 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8101 for (let i = start; i < children.length; i++) {
8102 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
8103 }
8104 };
8105 const getNextHostNode = (vnode) => {
8106 if (vnode.shapeFlag & 6) {
8107 return getNextHostNode(vnode.component.subTree);
8108 }
8109 if (vnode.shapeFlag & 128) {
8110 return vnode.suspense.next();
8111 }
8112 const el = hostNextSibling(vnode.anchor || vnode.el);
8113 const teleportEnd = el && el[TeleportEndKey];
8114 return teleportEnd ? hostNextSibling(teleportEnd) : el;
8115 };
8116 let isFlushing = false;
8117 const render = (vnode, container, namespace) => {
8118 if (vnode == null) {
8119 if (container._vnode) {
8120 unmount(container._vnode, null, null, true);
8121 }
8122 } else {
8123 patch(
8124 container._vnode || null,
8125 vnode,
8126 container,
8127 null,
8128 null,
8129 null,
8130 namespace
8131 );
8132 }
8133 container._vnode = vnode;
8134 if (!isFlushing) {
8135 isFlushing = true;
8136 flushPreFlushCbs();
8137 flushPostFlushCbs();
8138 isFlushing = false;
8139 }
8140 };
8141 const internals = {
8142 p: patch,
8143 um: unmount,
8144 m: move,
8145 r: remove,
8146 mt: mountComponent,
8147 mc: mountChildren,
8148 pc: patchChildren,
8149 pbc: patchBlockChildren,
8150 n: getNextHostNode,
8151 o: options
8152 };
8153 let hydrate;
8154 let hydrateNode;
8155 if (createHydrationFns) {
8156 [hydrate, hydrateNode] = createHydrationFns(
8157 internals
8158 );
8159 }
8160 return {
8161 render,
8162 hydrate,
8163 createApp: createAppAPI(render, hydrate)
8164 };
8165 }
8166 function resolveChildrenNamespace({ type, props }, currentNamespace) {
8167 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8168 }
8169 function toggleRecurse({ effect, job }, allowed) {
8170 if (allowed) {
8171 effect.flags |= 32;
8172 job.flags |= 4;
8173 } else {
8174 effect.flags &= ~32;
8175 job.flags &= ~4;
8176 }
8177 }
8178 function needTransition(parentSuspense, transition) {
8179 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8180 }
8181 function traverseStaticChildren(n1, n2, shallow = false) {
8182 const ch1 = n1.children;
8183 const ch2 = n2.children;
8184 if (isArray(ch1) && isArray(ch2)) {
8185 for (let i = 0; i < ch1.length; i++) {
8186 const c1 = ch1[i];
8187 let c2 = ch2[i];
8188 if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
8189 if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
8190 c2 = ch2[i] = cloneIfMounted(ch2[i]);
8191 c2.el = c1.el;
8192 }
8193 if (!shallow && c2.patchFlag !== -2)
8194 traverseStaticChildren(c1, c2);
8195 }
8196 if (c2.type === Text) {
8197 c2.el = c1.el;
8198 }
8199 if (c2.type === Comment && !c2.el) {
8200 c2.el = c1.el;
8201 }
8202 }
8203 }
8204 }
8205 function getSequence(arr) {
8206 const p = arr.slice();
8207 const result = [0];
8208 let i, j, u, v, c;
8209 const len = arr.length;
8210 for (i = 0; i < len; i++) {
8211 const arrI = arr[i];
8212 if (arrI !== 0) {
8213 j = result[result.length - 1];
8214 if (arr[j] < arrI) {
8215 p[i] = j;
8216 result.push(i);
8217 continue;
8218 }
8219 u = 0;
8220 v = result.length - 1;
8221 while (u < v) {
8222 c = u + v >> 1;
8223 if (arr[result[c]] < arrI) {
8224 u = c + 1;
8225 } else {
8226 v = c;
8227 }
8228 }
8229 if (arrI < arr[result[u]]) {
8230 if (u > 0) {
8231 p[i] = result[u - 1];
8232 }
8233 result[u] = i;
8234 }
8235 }
8236 }
8237 u = result.length;
8238 v = result[u - 1];
8239 while (u-- > 0) {
8240 result[u] = v;
8241 v = p[v];
8242 }
8243 return result;
8244 }
8245 function locateNonHydratedAsyncRoot(instance) {
8246 const subComponent = instance.subTree.component;
8247 if (subComponent) {
8248 if (subComponent.asyncDep && !subComponent.asyncResolved) {
8249 return subComponent;
8250 } else {
8251 return locateNonHydratedAsyncRoot(subComponent);
8252 }
8253 }
8254 }
8255 function invalidateMount(hooks) {
8256 if (hooks) {
8257 for (let i = 0; i < hooks.length; i++)
8258 hooks[i].flags |= 8;
8259 }
8260 }
8261
8262 const ssrContextKey = Symbol.for("v-scx");
8263 const useSSRContext = () => {
8264 {
8265 warn$1(`useSSRContext() is not supported in the global build.`);
8266 }
8267 };
8268
8269 function watchEffect(effect, options) {
8270 return doWatch(effect, null, options);
8271 }
8272 function watchPostEffect(effect, options) {
8273 return doWatch(
8274 effect,
8275 null,
8276 extend({}, options, { flush: "post" })
8277 );
8278 }
8279 function watchSyncEffect(effect, options) {
8280 return doWatch(
8281 effect,
8282 null,
8283 extend({}, options, { flush: "sync" })
8284 );
8285 }
8286 function watch(source, cb, options) {
8287 if (!isFunction(cb)) {
8288 warn$1(
8289 `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
8290 );
8291 }
8292 return doWatch(source, cb, options);
8293 }
8294 function doWatch(source, cb, options = EMPTY_OBJ) {
8295 const { immediate, deep, flush, once } = options;
8296 if (!cb) {
8297 if (immediate !== void 0) {
8298 warn$1(
8299 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
8300 );
8301 }
8302 if (deep !== void 0) {
8303 warn$1(
8304 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
8305 );
8306 }
8307 if (once !== void 0) {
8308 warn$1(
8309 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
8310 );
8311 }
8312 }
8313 const baseWatchOptions = extend({}, options);
8314 baseWatchOptions.onWarn = warn$1;
8315 const instance = currentInstance;
8316 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8317 let isPre = false;
8318 if (flush === "post") {
8319 baseWatchOptions.scheduler = (job) => {
8320 queuePostRenderEffect(job, instance && instance.suspense);
8321 };
8322 } else if (flush !== "sync") {
8323 isPre = true;
8324 baseWatchOptions.scheduler = (job, isFirstRun) => {
8325 if (isFirstRun) {
8326 job();
8327 } else {
8328 queueJob(job);
8329 }
8330 };
8331 }
8332 baseWatchOptions.augmentJob = (job) => {
8333 if (cb) {
8334 job.flags |= 4;
8335 }
8336 if (isPre) {
8337 job.flags |= 2;
8338 if (instance) {
8339 job.id = instance.uid;
8340 job.i = instance;
8341 }
8342 }
8343 };
8344 const watchHandle = watch$1(source, cb, baseWatchOptions);
8345 return watchHandle;
8346 }
8347 function instanceWatch(source, value, options) {
8348 const publicThis = this.proxy;
8349 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
8350 let cb;
8351 if (isFunction(value)) {
8352 cb = value;
8353 } else {
8354 cb = value.handler;
8355 options = value;
8356 }
8357 const reset = setCurrentInstance(this);
8358 const res = doWatch(getter, cb.bind(publicThis), options);
8359 reset();
8360 return res;
8361 }
8362 function createPathGetter(ctx, path) {
8363 const segments = path.split(".");
8364 return () => {
8365 let cur = ctx;
8366 for (let i = 0; i < segments.length && cur; i++) {
8367 cur = cur[segments[i]];
8368 }
8369 return cur;
8370 };
8371 }
8372
8373 function useModel(props, name, options = EMPTY_OBJ) {
8374 const i = getCurrentInstance();
8375 if (!i) {
8376 warn$1(`useModel() called without active instance.`);
8377 return ref();
8378 }
8379 const camelizedName = camelize(name);
8380 if (!i.propsOptions[0][camelizedName]) {
8381 warn$1(`useModel() called with prop "${name}" which is not declared.`);
8382 return ref();
8383 }
8384 const hyphenatedName = hyphenate(name);
8385 const modifiers = getModelModifiers(props, camelizedName);
8386 const res = customRef((track, trigger) => {
8387 let localValue;
8388 let prevSetValue = EMPTY_OBJ;
8389 let prevEmittedValue;
8390 watchSyncEffect(() => {
8391 const propValue = props[camelizedName];
8392 if (hasChanged(localValue, propValue)) {
8393 localValue = propValue;
8394 trigger();
8395 }
8396 });
8397 return {
8398 get() {
8399 track();
8400 return options.get ? options.get(localValue) : localValue;
8401 },
8402 set(value) {
8403 const emittedValue = options.set ? options.set(value) : value;
8404 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8405 return;
8406 }
8407 const rawProps = i.vnode.props;
8408 if (!(rawProps && // check if parent has passed v-model
8409 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8410 localValue = value;
8411 trigger();
8412 }
8413 i.emit(`update:${name}`, emittedValue);
8414 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8415 trigger();
8416 }
8417 prevSetValue = value;
8418 prevEmittedValue = emittedValue;
8419 }
8420 };
8421 });
8422 res[Symbol.iterator] = () => {
8423 let i2 = 0;
8424 return {
8425 next() {
8426 if (i2 < 2) {
8427 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
8428 } else {
8429 return { done: true };
8430 }
8431 }
8432 };
8433 };
8434 return res;
8435 }
8436 const getModelModifiers = (props, modelName) => {
8437 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
8438 };
8439
8440 function emit(instance, event, ...rawArgs) {
8441 if (instance.isUnmounted) return;
8442 const props = instance.vnode.props || EMPTY_OBJ;
8443 {
8444 const {
8445 emitsOptions,
8446 propsOptions: [propsOptions]
8447 } = instance;
8448 if (emitsOptions) {
8449 if (!(event in emitsOptions) && true) {
8450 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
8451 warn$1(
8452 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
8453 );
8454 }
8455 } else {
8456 const validator = emitsOptions[event];
8457 if (isFunction(validator)) {
8458 const isValid = validator(...rawArgs);
8459 if (!isValid) {
8460 warn$1(
8461 `Invalid event arguments: event validation failed for event "${event}".`
8462 );
8463 }
8464 }
8465 }
8466 }
8467 }
8468 let args = rawArgs;
8469 const isModelListener = event.startsWith("update:");
8470 const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8471 if (modifiers) {
8472 if (modifiers.trim) {
8473 args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8474 }
8475 if (modifiers.number) {
8476 args = rawArgs.map(looseToNumber);
8477 }
8478 }
8479 {
8480 devtoolsComponentEmit(instance, event, args);
8481 }
8482 {
8483 const lowerCaseEvent = event.toLowerCase();
8484 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
8485 warn$1(
8486 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
8487 instance,
8488 instance.type
8489 )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
8490 event
8491 )}" instead of "${event}".`
8492 );
8493 }
8494 }
8495 let handlerName;
8496 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
8497 props[handlerName = toHandlerKey(camelize(event))];
8498 if (!handler && isModelListener) {
8499 handler = props[handlerName = toHandlerKey(hyphenate(event))];
8500 }
8501 if (handler) {
8502 callWithAsyncErrorHandling(
8503 handler,
8504 instance,
8505 6,
8506 args
8507 );
8508 }
8509 const onceHandler = props[handlerName + `Once`];
8510 if (onceHandler) {
8511 if (!instance.emitted) {
8512 instance.emitted = {};
8513 } else if (instance.emitted[handlerName]) {
8514 return;
8515 }
8516 instance.emitted[handlerName] = true;
8517 callWithAsyncErrorHandling(
8518 onceHandler,
8519 instance,
8520 6,
8521 args
8522 );
8523 }
8524 }
8525 function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8526 const cache = appContext.emitsCache;
8527 const cached = cache.get(comp);
8528 if (cached !== void 0) {
8529 return cached;
8530 }
8531 const raw = comp.emits;
8532 let normalized = {};
8533 let hasExtends = false;
8534 if (!isFunction(comp)) {
8535 const extendEmits = (raw2) => {
8536 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
8537 if (normalizedFromExtend) {
8538 hasExtends = true;
8539 extend(normalized, normalizedFromExtend);
8540 }
8541 };
8542 if (!asMixin && appContext.mixins.length) {
8543 appContext.mixins.forEach(extendEmits);
8544 }
8545 if (comp.extends) {
8546 extendEmits(comp.extends);
8547 }
8548 if (comp.mixins) {
8549 comp.mixins.forEach(extendEmits);
8550 }
8551 }
8552 if (!raw && !hasExtends) {
8553 if (isObject(comp)) {
8554 cache.set(comp, null);
8555 }
8556 return null;
8557 }
8558 if (isArray(raw)) {
8559 raw.forEach((key) => normalized[key] = null);
8560 } else {
8561 extend(normalized, raw);
8562 }
8563 if (isObject(comp)) {
8564 cache.set(comp, normalized);
8565 }
8566 return normalized;
8567 }
8568 function isEmitListener(options, key) {
8569 if (!options || !isOn(key)) {
8570 return false;
8571 }
8572 key = key.slice(2).replace(/Once$/, "");
8573 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8574 }
8575
8576 let accessedAttrs = false;
8577 function markAttrsAccessed() {
8578 accessedAttrs = true;
8579 }
8580 function renderComponentRoot(instance) {
8581 const {
8582 type: Component,
8583 vnode,
8584 proxy,
8585 withProxy,
8586 propsOptions: [propsOptions],
8587 slots,
8588 attrs,
8589 emit,
8590 render,
8591 renderCache,
8592 props,
8593 data,
8594 setupState,
8595 ctx,
8596 inheritAttrs
8597 } = instance;
8598 const prev = setCurrentRenderingInstance(instance);
8599 let result;
8600 let fallthroughAttrs;
8601 {
8602 accessedAttrs = false;
8603 }
8604 try {
8605 if (vnode.shapeFlag & 4) {
8606 const proxyToUse = withProxy || proxy;
8607 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
8608 get(target, key, receiver) {
8609 warn$1(
8610 `Property '${String(
8611 key
8612 )}' was accessed via 'this'. Avoid using 'this' in templates.`
8613 );
8614 return Reflect.get(target, key, receiver);
8615 }
8616 }) : proxyToUse;
8617 result = normalizeVNode(
8618 render.call(
8619 thisProxy,
8620 proxyToUse,
8621 renderCache,
8622 true ? shallowReadonly(props) : props,
8623 setupState,
8624 data,
8625 ctx
8626 )
8627 );
8628 fallthroughAttrs = attrs;
8629 } else {
8630 const render2 = Component;
8631 if (attrs === props) {
8632 markAttrsAccessed();
8633 }
8634 result = normalizeVNode(
8635 render2.length > 1 ? render2(
8636 true ? shallowReadonly(props) : props,
8637 true ? {
8638 get attrs() {
8639 markAttrsAccessed();
8640 return shallowReadonly(attrs);
8641 },
8642 slots,
8643 emit
8644 } : { attrs, slots, emit }
8645 ) : render2(
8646 true ? shallowReadonly(props) : props,
8647 null
8648 )
8649 );
8650 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
8651 }
8652 } catch (err) {
8653 blockStack.length = 0;
8654 handleError(err, instance, 1);
8655 result = createVNode(Comment);
8656 }
8657 let root = result;
8658 let setRoot = void 0;
8659 if (result.patchFlag > 0 && result.patchFlag & 2048) {
8660 [root, setRoot] = getChildRoot(result);
8661 }
8662 if (fallthroughAttrs && inheritAttrs !== false) {
8663 const keys = Object.keys(fallthroughAttrs);
8664 const { shapeFlag } = root;
8665 if (keys.length) {
8666 if (shapeFlag & (1 | 6)) {
8667 if (propsOptions && keys.some(isModelListener)) {
8668 fallthroughAttrs = filterModelListeners(
8669 fallthroughAttrs,
8670 propsOptions
8671 );
8672 }
8673 root = cloneVNode(root, fallthroughAttrs, false, true);
8674 } else if (!accessedAttrs && root.type !== Comment) {
8675 const allAttrs = Object.keys(attrs);
8676 const eventAttrs = [];
8677 const extraAttrs = [];
8678 for (let i = 0, l = allAttrs.length; i < l; i++) {
8679 const key = allAttrs[i];
8680 if (isOn(key)) {
8681 if (!isModelListener(key)) {
8682 eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8683 }
8684 } else {
8685 extraAttrs.push(key);
8686 }
8687 }
8688 if (extraAttrs.length) {
8689 warn$1(
8690 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8691 );
8692 }
8693 if (eventAttrs.length) {
8694 warn$1(
8695 `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
8696 );
8697 }
8698 }
8699 }
8700 }
8701 if (vnode.dirs) {
8702 if (!isElementRoot(root)) {
8703 warn$1(
8704 `Runtime directive used on component with non-element root node. The directives will not function as intended.`
8705 );
8706 }
8707 root = cloneVNode(root, null, false, true);
8708 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8709 }
8710 if (vnode.transition) {
8711 if (!isElementRoot(root)) {
8712 warn$1(
8713 `Component inside <Transition> renders non-element root node that cannot be animated.`
8714 );
8715 }
8716 setTransitionHooks(root, vnode.transition);
8717 }
8718 if (setRoot) {
8719 setRoot(root);
8720 } else {
8721 result = root;
8722 }
8723 setCurrentRenderingInstance(prev);
8724 return result;
8725 }
8726 const getChildRoot = (vnode) => {
8727 const rawChildren = vnode.children;
8728 const dynamicChildren = vnode.dynamicChildren;
8729 const childRoot = filterSingleRoot(rawChildren, false);
8730 if (!childRoot) {
8731 return [vnode, void 0];
8732 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
8733 return getChildRoot(childRoot);
8734 }
8735 const index = rawChildren.indexOf(childRoot);
8736 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
8737 const setRoot = (updatedRoot) => {
8738 rawChildren[index] = updatedRoot;
8739 if (dynamicChildren) {
8740 if (dynamicIndex > -1) {
8741 dynamicChildren[dynamicIndex] = updatedRoot;
8742 } else if (updatedRoot.patchFlag > 0) {
8743 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
8744 }
8745 }
8746 };
8747 return [normalizeVNode(childRoot), setRoot];
8748 };
8749 function filterSingleRoot(children, recurse = true) {
8750 let singleRoot;
8751 for (let i = 0; i < children.length; i++) {
8752 const child = children[i];
8753 if (isVNode(child)) {
8754 if (child.type !== Comment || child.children === "v-if") {
8755 if (singleRoot) {
8756 return;
8757 } else {
8758 singleRoot = child;
8759 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
8760 return filterSingleRoot(singleRoot.children);
8761 }
8762 }
8763 }
8764 } else {
8765 return;
8766 }
8767 }
8768 return singleRoot;
8769 }
8770 const getFunctionalFallthrough = (attrs) => {
8771 let res;
8772 for (const key in attrs) {
8773 if (key === "class" || key === "style" || isOn(key)) {
8774 (res || (res = {}))[key] = attrs[key];
8775 }
8776 }
8777 return res;
8778 };
8779 const filterModelListeners = (attrs, props) => {
8780 const res = {};
8781 for (const key in attrs) {
8782 if (!isModelListener(key) || !(key.slice(9) in props)) {
8783 res[key] = attrs[key];
8784 }
8785 }
8786 return res;
8787 };
8788 const isElementRoot = (vnode) => {
8789 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
8790 };
8791 function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
8792 const { props: prevProps, children: prevChildren, component } = prevVNode;
8793 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
8794 const emits = component.emitsOptions;
8795 if ((prevChildren || nextChildren) && isHmrUpdating) {
8796 return true;
8797 }
8798 if (nextVNode.dirs || nextVNode.transition) {
8799 return true;
8800 }
8801 if (optimized && patchFlag >= 0) {
8802 if (patchFlag & 1024) {
8803 return true;
8804 }
8805 if (patchFlag & 16) {
8806 if (!prevProps) {
8807 return !!nextProps;
8808 }
8809 return hasPropsChanged(prevProps, nextProps, emits);
8810 } else if (patchFlag & 8) {
8811 const dynamicProps = nextVNode.dynamicProps;
8812 for (let i = 0; i < dynamicProps.length; i++) {
8813 const key = dynamicProps[i];
8814 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8815 return true;
8816 }
8817 }
8818 }
8819 } else {
8820 if (prevChildren || nextChildren) {
8821 if (!nextChildren || !nextChildren.$stable) {
8822 return true;
8823 }
8824 }
8825 if (prevProps === nextProps) {
8826 return false;
8827 }
8828 if (!prevProps) {
8829 return !!nextProps;
8830 }
8831 if (!nextProps) {
8832 return true;
8833 }
8834 return hasPropsChanged(prevProps, nextProps, emits);
8835 }
8836 return false;
8837 }
8838 function hasPropsChanged(prevProps, nextProps, emitsOptions) {
8839 const nextKeys = Object.keys(nextProps);
8840 if (nextKeys.length !== Object.keys(prevProps).length) {
8841 return true;
8842 }
8843 for (let i = 0; i < nextKeys.length; i++) {
8844 const key = nextKeys[i];
8845 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8846 return true;
8847 }
8848 }
8849 return false;
8850 }
8851 function updateHOCHostEl({ vnode, parent }, el) {
8852 while (parent) {
8853 const root = parent.subTree;
8854 if (root.suspense && root.suspense.activeBranch === vnode) {
8855 root.el = vnode.el;
8856 }
8857 if (root === vnode) {
8858 (vnode = parent.vnode).el = el;
8859 parent = parent.parent;
8860 } else {
8861 break;
8862 }
8863 }
8864 }
8865
8866 const isSuspense = (type) => type.__isSuspense;
8867 let suspenseId = 0;
8868 const SuspenseImpl = {
8869 name: "Suspense",
8870 // In order to make Suspense tree-shakable, we need to avoid importing it
8871 // directly in the renderer. The renderer checks for the __isSuspense flag
8872 // on a vnode's type and calls the `process` method, passing in renderer
8873 // internals.
8874 __isSuspense: true,
8875 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
8876 if (n1 == null) {
8877 mountSuspense(
8878 n2,
8879 container,
8880 anchor,
8881 parentComponent,
8882 parentSuspense,
8883 namespace,
8884 slotScopeIds,
8885 optimized,
8886 rendererInternals
8887 );
8888 } else {
8889 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
8890 n2.suspense = n1.suspense;
8891 n2.suspense.vnode = n2;
8892 n2.el = n1.el;
8893 return;
8894 }
8895 patchSuspense(
8896 n1,
8897 n2,
8898 container,
8899 anchor,
8900 parentComponent,
8901 namespace,
8902 slotScopeIds,
8903 optimized,
8904 rendererInternals
8905 );
8906 }
8907 },
8908 hydrate: hydrateSuspense,
8909 normalize: normalizeSuspenseChildren
8910 };
8911 const Suspense = SuspenseImpl ;
8912 function triggerEvent(vnode, name) {
8913 const eventListener = vnode.props && vnode.props[name];
8914 if (isFunction(eventListener)) {
8915 eventListener();
8916 }
8917 }
8918 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
8919 const {
8920 p: patch,
8921 o: { createElement }
8922 } = rendererInternals;
8923 const hiddenContainer = createElement("div");
8924 const suspense = vnode.suspense = createSuspenseBoundary(
8925 vnode,
8926 parentSuspense,
8927 parentComponent,
8928 container,
8929 hiddenContainer,
8930 anchor,
8931 namespace,
8932 slotScopeIds,
8933 optimized,
8934 rendererInternals
8935 );
8936 patch(
8937 null,
8938 suspense.pendingBranch = vnode.ssContent,
8939 hiddenContainer,
8940 null,
8941 parentComponent,
8942 suspense,
8943 namespace,
8944 slotScopeIds
8945 );
8946 if (suspense.deps > 0) {
8947 triggerEvent(vnode, "onPending");
8948 triggerEvent(vnode, "onFallback");
8949 patch(
8950 null,
8951 vnode.ssFallback,
8952 container,
8953 anchor,
8954 parentComponent,
8955 null,
8956 // fallback tree will not have suspense context
8957 namespace,
8958 slotScopeIds
8959 );
8960 setActiveBranch(suspense, vnode.ssFallback);
8961 } else {
8962 suspense.resolve(false, true);
8963 }
8964 }
8965 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
8966 const suspense = n2.suspense = n1.suspense;
8967 suspense.vnode = n2;
8968 n2.el = n1.el;
8969 const newBranch = n2.ssContent;
8970 const newFallback = n2.ssFallback;
8971 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
8972 if (pendingBranch) {
8973 suspense.pendingBranch = newBranch;
8974 if (isSameVNodeType(newBranch, pendingBranch)) {
8975 patch(
8976 pendingBranch,
8977 newBranch,
8978 suspense.hiddenContainer,
8979 null,
8980 parentComponent,
8981 suspense,
8982 namespace,
8983 slotScopeIds,
8984 optimized
8985 );
8986 if (suspense.deps <= 0) {
8987 suspense.resolve();
8988 } else if (isInFallback) {
8989 if (!isHydrating) {
8990 patch(
8991 activeBranch,
8992 newFallback,
8993 container,
8994 anchor,
8995 parentComponent,
8996 null,
8997 // fallback tree will not have suspense context
8998 namespace,
8999 slotScopeIds,
9000 optimized
9001 );
9002 setActiveBranch(suspense, newFallback);
9003 }
9004 }
9005 } else {
9006 suspense.pendingId = suspenseId++;
9007 if (isHydrating) {
9008 suspense.isHydrating = false;
9009 suspense.activeBranch = pendingBranch;
9010 } else {
9011 unmount(pendingBranch, parentComponent, suspense);
9012 }
9013 suspense.deps = 0;
9014 suspense.effects.length = 0;
9015 suspense.hiddenContainer = createElement("div");
9016 if (isInFallback) {
9017 patch(
9018 null,
9019 newBranch,
9020 suspense.hiddenContainer,
9021 null,
9022 parentComponent,
9023 suspense,
9024 namespace,
9025 slotScopeIds,
9026 optimized
9027 );
9028 if (suspense.deps <= 0) {
9029 suspense.resolve();
9030 } else {
9031 patch(
9032 activeBranch,
9033 newFallback,
9034 container,
9035 anchor,
9036 parentComponent,
9037 null,
9038 // fallback tree will not have suspense context
9039 namespace,
9040 slotScopeIds,
9041 optimized
9042 );
9043 setActiveBranch(suspense, newFallback);
9044 }
9045 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9046 patch(
9047 activeBranch,
9048 newBranch,
9049 container,
9050 anchor,
9051 parentComponent,
9052 suspense,
9053 namespace,
9054 slotScopeIds,
9055 optimized
9056 );
9057 suspense.resolve(true);
9058 } else {
9059 patch(
9060 null,
9061 newBranch,
9062 suspense.hiddenContainer,
9063 null,
9064 parentComponent,
9065 suspense,
9066 namespace,
9067 slotScopeIds,
9068 optimized
9069 );
9070 if (suspense.deps <= 0) {
9071 suspense.resolve();
9072 }
9073 }
9074 }
9075 } else {
9076 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9077 patch(
9078 activeBranch,
9079 newBranch,
9080 container,
9081 anchor,
9082 parentComponent,
9083 suspense,
9084 namespace,
9085 slotScopeIds,
9086 optimized
9087 );
9088 setActiveBranch(suspense, newBranch);
9089 } else {
9090 triggerEvent(n2, "onPending");
9091 suspense.pendingBranch = newBranch;
9092 if (newBranch.shapeFlag & 512) {
9093 suspense.pendingId = newBranch.component.suspenseId;
9094 } else {
9095 suspense.pendingId = suspenseId++;
9096 }
9097 patch(
9098 null,
9099 newBranch,
9100 suspense.hiddenContainer,
9101 null,
9102 parentComponent,
9103 suspense,
9104 namespace,
9105 slotScopeIds,
9106 optimized
9107 );
9108 if (suspense.deps <= 0) {
9109 suspense.resolve();
9110 } else {
9111 const { timeout, pendingId } = suspense;
9112 if (timeout > 0) {
9113 setTimeout(() => {
9114 if (suspense.pendingId === pendingId) {
9115 suspense.fallback(newFallback);
9116 }
9117 }, timeout);
9118 } else if (timeout === 0) {
9119 suspense.fallback(newFallback);
9120 }
9121 }
9122 }
9123 }
9124 }
9125 let hasWarned = false;
9126 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
9127 if (!hasWarned) {
9128 hasWarned = true;
9129 console[console.info ? "info" : "log"](
9130 `<Suspense> is an experimental feature and its API will likely change.`
9131 );
9132 }
9133 const {
9134 p: patch,
9135 m: move,
9136 um: unmount,
9137 n: next,
9138 o: { parentNode, remove }
9139 } = rendererInternals;
9140 let parentSuspenseId;
9141 const isSuspensible = isVNodeSuspensible(vnode);
9142 if (isSuspensible) {
9143 if (parentSuspense && parentSuspense.pendingBranch) {
9144 parentSuspenseId = parentSuspense.pendingId;
9145 parentSuspense.deps++;
9146 }
9147 }
9148 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
9149 {
9150 assertNumber(timeout, `Suspense timeout`);
9151 }
9152 const initialAnchor = anchor;
9153 const suspense = {
9154 vnode,
9155 parent: parentSuspense,
9156 parentComponent,
9157 namespace,
9158 container,
9159 hiddenContainer,
9160 deps: 0,
9161 pendingId: suspenseId++,
9162 timeout: typeof timeout === "number" ? timeout : -1,
9163 activeBranch: null,
9164 pendingBranch: null,
9165 isInFallback: !isHydrating,
9166 isHydrating,
9167 isUnmounted: false,
9168 effects: [],
9169 resolve(resume = false, sync = false) {
9170 {
9171 if (!resume && !suspense.pendingBranch) {
9172 throw new Error(
9173 `suspense.resolve() is called without a pending branch.`
9174 );
9175 }
9176 if (suspense.isUnmounted) {
9177 throw new Error(
9178 `suspense.resolve() is called on an already unmounted suspense boundary.`
9179 );
9180 }
9181 }
9182 const {
9183 vnode: vnode2,
9184 activeBranch,
9185 pendingBranch,
9186 pendingId,
9187 effects,
9188 parentComponent: parentComponent2,
9189 container: container2
9190 } = suspense;
9191 let delayEnter = false;
9192 if (suspense.isHydrating) {
9193 suspense.isHydrating = false;
9194 } else if (!resume) {
9195 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
9196 if (delayEnter) {
9197 activeBranch.transition.afterLeave = () => {
9198 if (pendingId === suspense.pendingId) {
9199 move(
9200 pendingBranch,
9201 container2,
9202 anchor === initialAnchor ? next(activeBranch) : anchor,
9203 0
9204 );
9205 queuePostFlushCb(effects);
9206 }
9207 };
9208 }
9209 if (activeBranch) {
9210 if (parentNode(activeBranch.el) === container2) {
9211 anchor = next(activeBranch);
9212 }
9213 unmount(activeBranch, parentComponent2, suspense, true);
9214 }
9215 if (!delayEnter) {
9216 move(pendingBranch, container2, anchor, 0);
9217 }
9218 }
9219 setActiveBranch(suspense, pendingBranch);
9220 suspense.pendingBranch = null;
9221 suspense.isInFallback = false;
9222 let parent = suspense.parent;
9223 let hasUnresolvedAncestor = false;
9224 while (parent) {
9225 if (parent.pendingBranch) {
9226 parent.effects.push(...effects);
9227 hasUnresolvedAncestor = true;
9228 break;
9229 }
9230 parent = parent.parent;
9231 }
9232 if (!hasUnresolvedAncestor && !delayEnter) {
9233 queuePostFlushCb(effects);
9234 }
9235 suspense.effects = [];
9236 if (isSuspensible) {
9237 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9238 parentSuspense.deps--;
9239 if (parentSuspense.deps === 0 && !sync) {
9240 parentSuspense.resolve();
9241 }
9242 }
9243 }
9244 triggerEvent(vnode2, "onResolve");
9245 },
9246 fallback(fallbackVNode) {
9247 if (!suspense.pendingBranch) {
9248 return;
9249 }
9250 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
9251 triggerEvent(vnode2, "onFallback");
9252 const anchor2 = next(activeBranch);
9253 const mountFallback = () => {
9254 if (!suspense.isInFallback) {
9255 return;
9256 }
9257 patch(
9258 null,
9259 fallbackVNode,
9260 container2,
9261 anchor2,
9262 parentComponent2,
9263 null,
9264 // fallback tree will not have suspense context
9265 namespace2,
9266 slotScopeIds,
9267 optimized
9268 );
9269 setActiveBranch(suspense, fallbackVNode);
9270 };
9271 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9272 if (delayEnter) {
9273 activeBranch.transition.afterLeave = mountFallback;
9274 }
9275 suspense.isInFallback = true;
9276 unmount(
9277 activeBranch,
9278 parentComponent2,
9279 null,
9280 // no suspense so unmount hooks fire now
9281 true
9282 // shouldRemove
9283 );
9284 if (!delayEnter) {
9285 mountFallback();
9286 }
9287 },
9288 move(container2, anchor2, type) {
9289 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
9290 suspense.container = container2;
9291 },
9292 next() {
9293 return suspense.activeBranch && next(suspense.activeBranch);
9294 },
9295 registerDep(instance, setupRenderEffect, optimized2) {
9296 const isInPendingSuspense = !!suspense.pendingBranch;
9297 if (isInPendingSuspense) {
9298 suspense.deps++;
9299 }
9300 const hydratedEl = instance.vnode.el;
9301 instance.asyncDep.catch((err) => {
9302 handleError(err, instance, 0);
9303 }).then((asyncSetupResult) => {
9304 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
9305 return;
9306 }
9307 instance.asyncResolved = true;
9308 const { vnode: vnode2 } = instance;
9309 {
9310 pushWarningContext(vnode2);
9311 }
9312 handleSetupResult(instance, asyncSetupResult, false);
9313 if (hydratedEl) {
9314 vnode2.el = hydratedEl;
9315 }
9316 const placeholder = !hydratedEl && instance.subTree.el;
9317 setupRenderEffect(
9318 instance,
9319 vnode2,
9320 // component may have been moved before resolve.
9321 // if this is not a hydration, instance.subTree will be the comment
9322 // placeholder.
9323 parentNode(hydratedEl || instance.subTree.el),
9324 // anchor will not be used if this is hydration, so only need to
9325 // consider the comment placeholder case.
9326 hydratedEl ? null : next(instance.subTree),
9327 suspense,
9328 namespace,
9329 optimized2
9330 );
9331 if (placeholder) {
9332 remove(placeholder);
9333 }
9334 updateHOCHostEl(instance, vnode2.el);
9335 {
9336 popWarningContext();
9337 }
9338 if (isInPendingSuspense && --suspense.deps === 0) {
9339 suspense.resolve();
9340 }
9341 });
9342 },
9343 unmount(parentSuspense2, doRemove) {
9344 suspense.isUnmounted = true;
9345 if (suspense.activeBranch) {
9346 unmount(
9347 suspense.activeBranch,
9348 parentComponent,
9349 parentSuspense2,
9350 doRemove
9351 );
9352 }
9353 if (suspense.pendingBranch) {
9354 unmount(
9355 suspense.pendingBranch,
9356 parentComponent,
9357 parentSuspense2,
9358 doRemove
9359 );
9360 }
9361 }
9362 };
9363 return suspense;
9364 }
9365 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
9366 const suspense = vnode.suspense = createSuspenseBoundary(
9367 vnode,
9368 parentSuspense,
9369 parentComponent,
9370 node.parentNode,
9371 // eslint-disable-next-line no-restricted-globals
9372 document.createElement("div"),
9373 null,
9374 namespace,
9375 slotScopeIds,
9376 optimized,
9377 rendererInternals,
9378 true
9379 );
9380 const result = hydrateNode(
9381 node,
9382 suspense.pendingBranch = vnode.ssContent,
9383 parentComponent,
9384 suspense,
9385 slotScopeIds,
9386 optimized
9387 );
9388 if (suspense.deps === 0) {
9389 suspense.resolve(false, true);
9390 }
9391 return result;
9392 }
9393 function normalizeSuspenseChildren(vnode) {
9394 const { shapeFlag, children } = vnode;
9395 const isSlotChildren = shapeFlag & 32;
9396 vnode.ssContent = normalizeSuspenseSlot(
9397 isSlotChildren ? children.default : children
9398 );
9399 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
9400 }
9401 function normalizeSuspenseSlot(s) {
9402 let block;
9403 if (isFunction(s)) {
9404 const trackBlock = isBlockTreeEnabled && s._c;
9405 if (trackBlock) {
9406 s._d = false;
9407 openBlock();
9408 }
9409 s = s();
9410 if (trackBlock) {
9411 s._d = true;
9412 block = currentBlock;
9413 closeBlock();
9414 }
9415 }
9416 if (isArray(s)) {
9417 const singleChild = filterSingleRoot(s);
9418 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
9419 warn$1(`<Suspense> slots expect a single root node.`);
9420 }
9421 s = singleChild;
9422 }
9423 s = normalizeVNode(s);
9424 if (block && !s.dynamicChildren) {
9425 s.dynamicChildren = block.filter((c) => c !== s);
9426 }
9427 return s;
9428 }
9429 function queueEffectWithSuspense(fn, suspense) {
9430 if (suspense && suspense.pendingBranch) {
9431 if (isArray(fn)) {
9432 suspense.effects.push(...fn);
9433 } else {
9434 suspense.effects.push(fn);
9435 }
9436 } else {
9437 queuePostFlushCb(fn);
9438 }
9439 }
9440 function setActiveBranch(suspense, branch) {
9441 suspense.activeBranch = branch;
9442 const { vnode, parentComponent } = suspense;
9443 let el = branch.el;
9444 while (!el && branch.component) {
9445 branch = branch.component.subTree;
9446 el = branch.el;
9447 }
9448 vnode.el = el;
9449 if (parentComponent && parentComponent.subTree === vnode) {
9450 parentComponent.vnode.el = el;
9451 updateHOCHostEl(parentComponent, el);
9452 }
9453 }
9454 function isVNodeSuspensible(vnode) {
9455 const suspensible = vnode.props && vnode.props.suspensible;
9456 return suspensible != null && suspensible !== false;
9457 }
9458
9459 const Fragment = Symbol.for("v-fgt");
9460 const Text = Symbol.for("v-txt");
9461 const Comment = Symbol.for("v-cmt");
9462 const Static = Symbol.for("v-stc");
9463 const blockStack = [];
9464 let currentBlock = null;
9465 function openBlock(disableTracking = false) {
9466 blockStack.push(currentBlock = disableTracking ? null : []);
9467 }
9468 function closeBlock() {
9469 blockStack.pop();
9470 currentBlock = blockStack[blockStack.length - 1] || null;
9471 }
9472 let isBlockTreeEnabled = 1;
9473 function setBlockTracking(value, inVOnce = false) {
9474 isBlockTreeEnabled += value;
9475 if (value < 0 && currentBlock && inVOnce) {
9476 currentBlock.hasOnce = true;
9477 }
9478 }
9479 function setupBlock(vnode) {
9480 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
9481 closeBlock();
9482 if (isBlockTreeEnabled > 0 && currentBlock) {
9483 currentBlock.push(vnode);
9484 }
9485 return vnode;
9486 }
9487 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
9488 return setupBlock(
9489 createBaseVNode(
9490 type,
9491 props,
9492 children,
9493 patchFlag,
9494 dynamicProps,
9495 shapeFlag,
9496 true
9497 )
9498 );
9499 }
9500 function createBlock(type, props, children, patchFlag, dynamicProps) {
9501 return setupBlock(
9502 createVNode(
9503 type,
9504 props,
9505 children,
9506 patchFlag,
9507 dynamicProps,
9508 true
9509 )
9510 );
9511 }
9512 function isVNode(value) {
9513 return value ? value.__v_isVNode === true : false;
9514 }
9515 function isSameVNodeType(n1, n2) {
9516 if (n2.shapeFlag & 6 && n1.component) {
9517 const dirtyInstances = hmrDirtyComponents.get(n2.type);
9518 if (dirtyInstances && dirtyInstances.has(n1.component)) {
9519 n1.shapeFlag &= ~256;
9520 n2.shapeFlag &= ~512;
9521 return false;
9522 }
9523 }
9524 return n1.type === n2.type && n1.key === n2.key;
9525 }
9526 let vnodeArgsTransformer;
9527 function transformVNodeArgs(transformer) {
9528 vnodeArgsTransformer = transformer;
9529 }
9530 const createVNodeWithArgsTransform = (...args) => {
9531 return _createVNode(
9532 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
9533 );
9534 };
9535 const normalizeKey = ({ key }) => key != null ? key : null;
9536 const normalizeRef = ({
9537 ref,
9538 ref_key,
9539 ref_for
9540 }) => {
9541 if (typeof ref === "number") {
9542 ref = "" + ref;
9543 }
9544 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
9545 };
9546 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
9547 const vnode = {
9548 __v_isVNode: true,
9549 __v_skip: true,
9550 type,
9551 props,
9552 key: props && normalizeKey(props),
9553 ref: props && normalizeRef(props),
9554 scopeId: currentScopeId,
9555 slotScopeIds: null,
9556 children,
9557 component: null,
9558 suspense: null,
9559 ssContent: null,
9560 ssFallback: null,
9561 dirs: null,
9562 transition: null,
9563 el: null,
9564 anchor: null,
9565 target: null,
9566 targetStart: null,
9567 targetAnchor: null,
9568 staticCount: 0,
9569 shapeFlag,
9570 patchFlag,
9571 dynamicProps,
9572 dynamicChildren: null,
9573 appContext: null,
9574 ctx: currentRenderingInstance
9575 };
9576 if (needFullChildrenNormalization) {
9577 normalizeChildren(vnode, children);
9578 if (shapeFlag & 128) {
9579 type.normalize(vnode);
9580 }
9581 } else if (children) {
9582 vnode.shapeFlag |= isString(children) ? 8 : 16;
9583 }
9584 if (vnode.key !== vnode.key) {
9585 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9586 }
9587 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
9588 !isBlockNode && // has current parent block
9589 currentBlock && // presence of a patch flag indicates this node needs patching on updates.
9590 // component nodes also should always be patched, because even if the
9591 // component doesn't need to update, it needs to persist the instance on to
9592 // the next vnode so that it can be properly unmounted later.
9593 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
9594 // vnode should not be considered dynamic due to handler caching.
9595 vnode.patchFlag !== 32) {
9596 currentBlock.push(vnode);
9597 }
9598 return vnode;
9599 }
9600 const createVNode = createVNodeWithArgsTransform ;
9601 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9602 if (!type || type === NULL_DYNAMIC_COMPONENT) {
9603 if (!type) {
9604 warn$1(`Invalid vnode type when creating vnode: ${type}.`);
9605 }
9606 type = Comment;
9607 }
9608 if (isVNode(type)) {
9609 const cloned = cloneVNode(
9610 type,
9611 props,
9612 true
9613 /* mergeRef: true */
9614 );
9615 if (children) {
9616 normalizeChildren(cloned, children);
9617 }
9618 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
9619 if (cloned.shapeFlag & 6) {
9620 currentBlock[currentBlock.indexOf(type)] = cloned;
9621 } else {
9622 currentBlock.push(cloned);
9623 }
9624 }
9625 cloned.patchFlag = -2;
9626 return cloned;
9627 }
9628 if (isClassComponent(type)) {
9629 type = type.__vccOpts;
9630 }
9631 if (props) {
9632 props = guardReactiveProps(props);
9633 let { class: klass, style } = props;
9634 if (klass && !isString(klass)) {
9635 props.class = normalizeClass(klass);
9636 }
9637 if (isObject(style)) {
9638 if (isProxy(style) && !isArray(style)) {
9639 style = extend({}, style);
9640 }
9641 props.style = normalizeStyle(style);
9642 }
9643 }
9644 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
9645 if (shapeFlag & 4 && isProxy(type)) {
9646 type = toRaw(type);
9647 warn$1(
9648 `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
9649 `
9650Component that was made reactive: `,
9651 type
9652 );
9653 }
9654 return createBaseVNode(
9655 type,
9656 props,
9657 children,
9658 patchFlag,
9659 dynamicProps,
9660 shapeFlag,
9661 isBlockNode,
9662 true
9663 );
9664 }
9665 function guardReactiveProps(props) {
9666 if (!props) return null;
9667 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
9668 }
9669 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
9670 const { props, ref, patchFlag, children, transition } = vnode;
9671 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
9672 const cloned = {
9673 __v_isVNode: true,
9674 __v_skip: true,
9675 type: vnode.type,
9676 props: mergedProps,
9677 key: mergedProps && normalizeKey(mergedProps),
9678 ref: extraProps && extraProps.ref ? (
9679 // #2078 in the case of <component :is="vnode" ref="extra"/>
9680 // if the vnode itself already has a ref, cloneVNode will need to merge
9681 // the refs so the single vnode can be set on multiple refs
9682 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
9683 ) : ref,
9684 scopeId: vnode.scopeId,
9685 slotScopeIds: vnode.slotScopeIds,
9686 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
9687 target: vnode.target,
9688 targetStart: vnode.targetStart,
9689 targetAnchor: vnode.targetAnchor,
9690 staticCount: vnode.staticCount,
9691 shapeFlag: vnode.shapeFlag,
9692 // if the vnode is cloned with extra props, we can no longer assume its
9693 // existing patch flag to be reliable and need to add the FULL_PROPS flag.
9694 // note: preserve flag for fragments since they use the flag for children
9695 // fast paths only.
9696 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
9697 dynamicProps: vnode.dynamicProps,
9698 dynamicChildren: vnode.dynamicChildren,
9699 appContext: vnode.appContext,
9700 dirs: vnode.dirs,
9701 transition,
9702 // These should technically only be non-null on mounted VNodes. However,
9703 // they *should* be copied for kept-alive vnodes. So we just always copy
9704 // them since them being non-null during a mount doesn't affect the logic as
9705 // they will simply be overwritten.
9706 component: vnode.component,
9707 suspense: vnode.suspense,
9708 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9709 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9710 el: vnode.el,
9711 anchor: vnode.anchor,
9712 ctx: vnode.ctx,
9713 ce: vnode.ce
9714 };
9715 if (transition && cloneTransition) {
9716 setTransitionHooks(
9717 cloned,
9718 transition.clone(cloned)
9719 );
9720 }
9721 return cloned;
9722 }
9723 function deepCloneVNode(vnode) {
9724 const cloned = cloneVNode(vnode);
9725 if (isArray(vnode.children)) {
9726 cloned.children = vnode.children.map(deepCloneVNode);
9727 }
9728 return cloned;
9729 }
9730 function createTextVNode(text = " ", flag = 0) {
9731 return createVNode(Text, null, text, flag);
9732 }
9733 function createStaticVNode(content, numberOfNodes) {
9734 const vnode = createVNode(Static, null, content);
9735 vnode.staticCount = numberOfNodes;
9736 return vnode;
9737 }
9738 function createCommentVNode(text = "", asBlock = false) {
9739 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
9740 }
9741 function normalizeVNode(child) {
9742 if (child == null || typeof child === "boolean") {
9743 return createVNode(Comment);
9744 } else if (isArray(child)) {
9745 return createVNode(
9746 Fragment,
9747 null,
9748 // #3666, avoid reference pollution when reusing vnode
9749 child.slice()
9750 );
9751 } else if (isVNode(child)) {
9752 return cloneIfMounted(child);
9753 } else {
9754 return createVNode(Text, null, String(child));
9755 }
9756 }
9757 function cloneIfMounted(child) {
9758 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
9759 }
9760 function normalizeChildren(vnode, children) {
9761 let type = 0;
9762 const { shapeFlag } = vnode;
9763 if (children == null) {
9764 children = null;
9765 } else if (isArray(children)) {
9766 type = 16;
9767 } else if (typeof children === "object") {
9768 if (shapeFlag & (1 | 64)) {
9769 const slot = children.default;
9770 if (slot) {
9771 slot._c && (slot._d = false);
9772 normalizeChildren(vnode, slot());
9773 slot._c && (slot._d = true);
9774 }
9775 return;
9776 } else {
9777 type = 32;
9778 const slotFlag = children._;
9779 if (!slotFlag && !isInternalObject(children)) {
9780 children._ctx = currentRenderingInstance;
9781 } else if (slotFlag === 3 && currentRenderingInstance) {
9782 if (currentRenderingInstance.slots._ === 1) {
9783 children._ = 1;
9784 } else {
9785 children._ = 2;
9786 vnode.patchFlag |= 1024;
9787 }
9788 }
9789 }
9790 } else if (isFunction(children)) {
9791 children = { default: children, _ctx: currentRenderingInstance };
9792 type = 32;
9793 } else {
9794 children = String(children);
9795 if (shapeFlag & 64) {
9796 type = 16;
9797 children = [createTextVNode(children)];
9798 } else {
9799 type = 8;
9800 }
9801 }
9802 vnode.children = children;
9803 vnode.shapeFlag |= type;
9804 }
9805 function mergeProps(...args) {
9806 const ret = {};
9807 for (let i = 0; i < args.length; i++) {
9808 const toMerge = args[i];
9809 for (const key in toMerge) {
9810 if (key === "class") {
9811 if (ret.class !== toMerge.class) {
9812 ret.class = normalizeClass([ret.class, toMerge.class]);
9813 }
9814 } else if (key === "style") {
9815 ret.style = normalizeStyle([ret.style, toMerge.style]);
9816 } else if (isOn(key)) {
9817 const existing = ret[key];
9818 const incoming = toMerge[key];
9819 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
9820 ret[key] = existing ? [].concat(existing, incoming) : incoming;
9821 }
9822 } else if (key !== "") {
9823 ret[key] = toMerge[key];
9824 }
9825 }
9826 }
9827 return ret;
9828 }
9829 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
9830 callWithAsyncErrorHandling(hook, instance, 7, [
9831 vnode,
9832 prevVNode
9833 ]);
9834 }
9835
9836 const emptyAppContext = createAppContext();
9837 let uid = 0;
9838 function createComponentInstance(vnode, parent, suspense) {
9839 const type = vnode.type;
9840 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
9841 const instance = {
9842 uid: uid++,
9843 vnode,
9844 type,
9845 parent,
9846 appContext,
9847 root: null,
9848 // to be immediately set
9849 next: null,
9850 subTree: null,
9851 // will be set synchronously right after creation
9852 effect: null,
9853 update: null,
9854 // will be set synchronously right after creation
9855 job: null,
9856 scope: new EffectScope(
9857 true
9858 /* detached */
9859 ),
9860 render: null,
9861 proxy: null,
9862 exposed: null,
9863 exposeProxy: null,
9864 withProxy: null,
9865 provides: parent ? parent.provides : Object.create(appContext.provides),
9866 ids: parent ? parent.ids : ["", 0, 0],
9867 accessCache: null,
9868 renderCache: [],
9869 // local resolved assets
9870 components: null,
9871 directives: null,
9872 // resolved props and emits options
9873 propsOptions: normalizePropsOptions(type, appContext),
9874 emitsOptions: normalizeEmitsOptions(type, appContext),
9875 // emit
9876 emit: null,
9877 // to be set immediately
9878 emitted: null,
9879 // props default value
9880 propsDefaults: EMPTY_OBJ,
9881 // inheritAttrs
9882 inheritAttrs: type.inheritAttrs,
9883 // state
9884 ctx: EMPTY_OBJ,
9885 data: EMPTY_OBJ,
9886 props: EMPTY_OBJ,
9887 attrs: EMPTY_OBJ,
9888 slots: EMPTY_OBJ,
9889 refs: EMPTY_OBJ,
9890 setupState: EMPTY_OBJ,
9891 setupContext: null,
9892 // suspense related
9893 suspense,
9894 suspenseId: suspense ? suspense.pendingId : 0,
9895 asyncDep: null,
9896 asyncResolved: false,
9897 // lifecycle hooks
9898 // not using enums here because it results in computed properties
9899 isMounted: false,
9900 isUnmounted: false,
9901 isDeactivated: false,
9902 bc: null,
9903 c: null,
9904 bm: null,
9905 m: null,
9906 bu: null,
9907 u: null,
9908 um: null,
9909 bum: null,
9910 da: null,
9911 a: null,
9912 rtg: null,
9913 rtc: null,
9914 ec: null,
9915 sp: null
9916 };
9917 {
9918 instance.ctx = createDevRenderContext(instance);
9919 }
9920 instance.root = parent ? parent.root : instance;
9921 instance.emit = emit.bind(null, instance);
9922 if (vnode.ce) {
9923 vnode.ce(instance);
9924 }
9925 return instance;
9926 }
9927 let currentInstance = null;
9928 const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9929 let internalSetCurrentInstance;
9930 let setInSSRSetupState;
9931 {
9932 internalSetCurrentInstance = (i) => {
9933 currentInstance = i;
9934 };
9935 setInSSRSetupState = (v) => {
9936 isInSSRComponentSetup = v;
9937 };
9938 }
9939 const setCurrentInstance = (instance) => {
9940 const prev = currentInstance;
9941 internalSetCurrentInstance(instance);
9942 instance.scope.on();
9943 return () => {
9944 instance.scope.off();
9945 internalSetCurrentInstance(prev);
9946 };
9947 };
9948 const unsetCurrentInstance = () => {
9949 currentInstance && currentInstance.scope.off();
9950 internalSetCurrentInstance(null);
9951 };
9952 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
9953 function validateComponentName(name, { isNativeTag }) {
9954 if (isBuiltInTag(name) || isNativeTag(name)) {
9955 warn$1(
9956 "Do not use built-in or reserved HTML elements as component id: " + name
9957 );
9958 }
9959 }
9960 function isStatefulComponent(instance) {
9961 return instance.vnode.shapeFlag & 4;
9962 }
9963 let isInSSRComponentSetup = false;
9964 function setupComponent(instance, isSSR = false, optimized = false) {
9965 isSSR && setInSSRSetupState(isSSR);
9966 const { props, children } = instance.vnode;
9967 const isStateful = isStatefulComponent(instance);
9968 initProps(instance, props, isStateful, isSSR);
9969 initSlots(instance, children, optimized);
9970 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9971 isSSR && setInSSRSetupState(false);
9972 return setupResult;
9973 }
9974 function setupStatefulComponent(instance, isSSR) {
9975 var _a;
9976 const Component = instance.type;
9977 {
9978 if (Component.name) {
9979 validateComponentName(Component.name, instance.appContext.config);
9980 }
9981 if (Component.components) {
9982 const names = Object.keys(Component.components);
9983 for (let i = 0; i < names.length; i++) {
9984 validateComponentName(names[i], instance.appContext.config);
9985 }
9986 }
9987 if (Component.directives) {
9988 const names = Object.keys(Component.directives);
9989 for (let i = 0; i < names.length; i++) {
9990 validateDirectiveName(names[i]);
9991 }
9992 }
9993 if (Component.compilerOptions && isRuntimeOnly()) {
9994 warn$1(
9995 `"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
9996 );
9997 }
9998 }
9999 instance.accessCache = /* @__PURE__ */ Object.create(null);
10000 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
10001 {
10002 exposePropsOnRenderContext(instance);
10003 }
10004 const { setup } = Component;
10005 if (setup) {
10006 pauseTracking();
10007 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10008 const reset = setCurrentInstance(instance);
10009 const setupResult = callWithErrorHandling(
10010 setup,
10011 instance,
10012 0,
10013 [
10014 shallowReadonly(instance.props) ,
10015 setupContext
10016 ]
10017 );
10018 const isAsyncSetup = isPromise(setupResult);
10019 resetTracking();
10020 reset();
10021 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
10022 markAsyncBoundary(instance);
10023 }
10024 if (isAsyncSetup) {
10025 setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10026 if (isSSR) {
10027 return setupResult.then((resolvedResult) => {
10028 handleSetupResult(instance, resolvedResult, isSSR);
10029 }).catch((e) => {
10030 handleError(e, instance, 0);
10031 });
10032 } else {
10033 instance.asyncDep = setupResult;
10034 if (!instance.suspense) {
10035 const name = (_a = Component.name) != null ? _a : "Anonymous";
10036 warn$1(
10037 `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
10038 );
10039 }
10040 }
10041 } else {
10042 handleSetupResult(instance, setupResult, isSSR);
10043 }
10044 } else {
10045 finishComponentSetup(instance, isSSR);
10046 }
10047 }
10048 function handleSetupResult(instance, setupResult, isSSR) {
10049 if (isFunction(setupResult)) {
10050 {
10051 instance.render = setupResult;
10052 }
10053 } else if (isObject(setupResult)) {
10054 if (isVNode(setupResult)) {
10055 warn$1(
10056 `setup() should not return VNodes directly - return a render function instead.`
10057 );
10058 }
10059 {
10060 instance.devtoolsRawSetupState = setupResult;
10061 }
10062 instance.setupState = proxyRefs(setupResult);
10063 {
10064 exposeSetupStateOnRenderContext(instance);
10065 }
10066 } else if (setupResult !== void 0) {
10067 warn$1(
10068 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
10069 );
10070 }
10071 finishComponentSetup(instance, isSSR);
10072 }
10073 let compile$1;
10074 let installWithProxy;
10075 function registerRuntimeCompiler(_compile) {
10076 compile$1 = _compile;
10077 installWithProxy = (i) => {
10078 if (i.render._rc) {
10079 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
10080 }
10081 };
10082 }
10083 const isRuntimeOnly = () => !compile$1;
10084 function finishComponentSetup(instance, isSSR, skipOptions) {
10085 const Component = instance.type;
10086 if (!instance.render) {
10087 if (!isSSR && compile$1 && !Component.render) {
10088 const template = Component.template || resolveMergedOptions(instance).template;
10089 if (template) {
10090 {
10091 startMeasure(instance, `compile`);
10092 }
10093 const { isCustomElement, compilerOptions } = instance.appContext.config;
10094 const { delimiters, compilerOptions: componentCompilerOptions } = Component;
10095 const finalCompilerOptions = extend(
10096 extend(
10097 {
10098 isCustomElement,
10099 delimiters
10100 },
10101 compilerOptions
10102 ),
10103 componentCompilerOptions
10104 );
10105 Component.render = compile$1(template, finalCompilerOptions);
10106 {
10107 endMeasure(instance, `compile`);
10108 }
10109 }
10110 }
10111 instance.render = Component.render || NOOP;
10112 if (installWithProxy) {
10113 installWithProxy(instance);
10114 }
10115 }
10116 {
10117 const reset = setCurrentInstance(instance);
10118 pauseTracking();
10119 try {
10120 applyOptions(instance);
10121 } finally {
10122 resetTracking();
10123 reset();
10124 }
10125 }
10126 if (!Component.render && instance.render === NOOP && !isSSR) {
10127 if (!compile$1 && Component.template) {
10128 warn$1(
10129 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
10130 );
10131 } else {
10132 warn$1(`Component is missing template or render function: `, Component);
10133 }
10134 }
10135 }
10136 const attrsProxyHandlers = {
10137 get(target, key) {
10138 markAttrsAccessed();
10139 track(target, "get", "");
10140 return target[key];
10141 },
10142 set() {
10143 warn$1(`setupContext.attrs is readonly.`);
10144 return false;
10145 },
10146 deleteProperty() {
10147 warn$1(`setupContext.attrs is readonly.`);
10148 return false;
10149 }
10150 } ;
10151 function getSlotsProxy(instance) {
10152 return new Proxy(instance.slots, {
10153 get(target, key) {
10154 track(instance, "get", "$slots");
10155 return target[key];
10156 }
10157 });
10158 }
10159 function createSetupContext(instance) {
10160 const expose = (exposed) => {
10161 {
10162 if (instance.exposed) {
10163 warn$1(`expose() should be called only once per setup().`);
10164 }
10165 if (exposed != null) {
10166 let exposedType = typeof exposed;
10167 if (exposedType === "object") {
10168 if (isArray(exposed)) {
10169 exposedType = "array";
10170 } else if (isRef(exposed)) {
10171 exposedType = "ref";
10172 }
10173 }
10174 if (exposedType !== "object") {
10175 warn$1(
10176 `expose() should be passed a plain object, received ${exposedType}.`
10177 );
10178 }
10179 }
10180 }
10181 instance.exposed = exposed || {};
10182 };
10183 {
10184 let attrsProxy;
10185 let slotsProxy;
10186 return Object.freeze({
10187 get attrs() {
10188 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
10189 },
10190 get slots() {
10191 return slotsProxy || (slotsProxy = getSlotsProxy(instance));
10192 },
10193 get emit() {
10194 return (event, ...args) => instance.emit(event, ...args);
10195 },
10196 expose
10197 });
10198 }
10199 }
10200 function getComponentPublicInstance(instance) {
10201 if (instance.exposed) {
10202 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
10203 get(target, key) {
10204 if (key in target) {
10205 return target[key];
10206 } else if (key in publicPropertiesMap) {
10207 return publicPropertiesMap[key](instance);
10208 }
10209 },
10210 has(target, key) {
10211 return key in target || key in publicPropertiesMap;
10212 }
10213 }));
10214 } else {
10215 return instance.proxy;
10216 }
10217 }
10218 const classifyRE = /(?:^|[-_])(\w)/g;
10219 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
10220 function getComponentName(Component, includeInferred = true) {
10221 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
10222 }
10223 function formatComponentName(instance, Component, isRoot = false) {
10224 let name = getComponentName(Component);
10225 if (!name && Component.__file) {
10226 const match = Component.__file.match(/([^/\\]+)\.\w+$/);
10227 if (match) {
10228 name = match[1];
10229 }
10230 }
10231 if (!name && instance && instance.parent) {
10232 const inferFromRegistry = (registry) => {
10233 for (const key in registry) {
10234 if (registry[key] === Component) {
10235 return key;
10236 }
10237 }
10238 };
10239 name = inferFromRegistry(
10240 instance.components || instance.parent.type.components
10241 ) || inferFromRegistry(instance.appContext.components);
10242 }
10243 return name ? classify(name) : isRoot ? `App` : `Anonymous`;
10244 }
10245 function isClassComponent(value) {
10246 return isFunction(value) && "__vccOpts" in value;
10247 }
10248
10249 const computed = (getterOrOptions, debugOptions) => {
10250 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10251 {
10252 const i = getCurrentInstance();
10253 if (i && i.appContext.config.warnRecursiveComputed) {
10254 c._warnRecursive = true;
10255 }
10256 }
10257 return c;
10258 };
10259
10260 function h(type, propsOrChildren, children) {
10261 const l = arguments.length;
10262 if (l === 2) {
10263 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10264 if (isVNode(propsOrChildren)) {
10265 return createVNode(type, null, [propsOrChildren]);
10266 }
10267 return createVNode(type, propsOrChildren);
10268 } else {
10269 return createVNode(type, null, propsOrChildren);
10270 }
10271 } else {
10272 if (l > 3) {
10273 children = Array.prototype.slice.call(arguments, 2);
10274 } else if (l === 3 && isVNode(children)) {
10275 children = [children];
10276 }
10277 return createVNode(type, propsOrChildren, children);
10278 }
10279 }
10280
10281 function initCustomFormatter() {
10282 if (typeof window === "undefined") {
10283 return;
10284 }
10285 const vueStyle = { style: "color:#3ba776" };
10286 const numberStyle = { style: "color:#1677ff" };
10287 const stringStyle = { style: "color:#f5222d" };
10288 const keywordStyle = { style: "color:#eb2f96" };
10289 const formatter = {
10290 __vue_custom_formatter: true,
10291 header(obj) {
10292 if (!isObject(obj)) {
10293 return null;
10294 }
10295 if (obj.__isVue) {
10296 return ["div", vueStyle, `VueInstance`];
10297 } else if (isRef(obj)) {
10298 return [
10299 "div",
10300 {},
10301 ["span", vueStyle, genRefFlag(obj)],
10302 "<",
10303 // avoid debugger accessing value affecting behavior
10304 formatValue("_value" in obj ? obj._value : obj),
10305 `>`
10306 ];
10307 } else if (isReactive(obj)) {
10308 return [
10309 "div",
10310 {},
10311 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
10312 "<",
10313 formatValue(obj),
10314 `>${isReadonly(obj) ? ` (readonly)` : ``}`
10315 ];
10316 } else if (isReadonly(obj)) {
10317 return [
10318 "div",
10319 {},
10320 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
10321 "<",
10322 formatValue(obj),
10323 ">"
10324 ];
10325 }
10326 return null;
10327 },
10328 hasBody(obj) {
10329 return obj && obj.__isVue;
10330 },
10331 body(obj) {
10332 if (obj && obj.__isVue) {
10333 return [
10334 "div",
10335 {},
10336 ...formatInstance(obj.$)
10337 ];
10338 }
10339 }
10340 };
10341 function formatInstance(instance) {
10342 const blocks = [];
10343 if (instance.type.props && instance.props) {
10344 blocks.push(createInstanceBlock("props", toRaw(instance.props)));
10345 }
10346 if (instance.setupState !== EMPTY_OBJ) {
10347 blocks.push(createInstanceBlock("setup", instance.setupState));
10348 }
10349 if (instance.data !== EMPTY_OBJ) {
10350 blocks.push(createInstanceBlock("data", toRaw(instance.data)));
10351 }
10352 const computed = extractKeys(instance, "computed");
10353 if (computed) {
10354 blocks.push(createInstanceBlock("computed", computed));
10355 }
10356 const injected = extractKeys(instance, "inject");
10357 if (injected) {
10358 blocks.push(createInstanceBlock("injected", injected));
10359 }
10360 blocks.push([
10361 "div",
10362 {},
10363 [
10364 "span",
10365 {
10366 style: keywordStyle.style + ";opacity:0.66"
10367 },
10368 "$ (internal): "
10369 ],
10370 ["object", { object: instance }]
10371 ]);
10372 return blocks;
10373 }
10374 function createInstanceBlock(type, target) {
10375 target = extend({}, target);
10376 if (!Object.keys(target).length) {
10377 return ["span", {}];
10378 }
10379 return [
10380 "div",
10381 { style: "line-height:1.25em;margin-bottom:0.6em" },
10382 [
10383 "div",
10384 {
10385 style: "color:#476582"
10386 },
10387 type
10388 ],
10389 [
10390 "div",
10391 {
10392 style: "padding-left:1.25em"
10393 },
10394 ...Object.keys(target).map((key) => {
10395 return [
10396 "div",
10397 {},
10398 ["span", keywordStyle, key + ": "],
10399 formatValue(target[key], false)
10400 ];
10401 })
10402 ]
10403 ];
10404 }
10405 function formatValue(v, asRaw = true) {
10406 if (typeof v === "number") {
10407 return ["span", numberStyle, v];
10408 } else if (typeof v === "string") {
10409 return ["span", stringStyle, JSON.stringify(v)];
10410 } else if (typeof v === "boolean") {
10411 return ["span", keywordStyle, v];
10412 } else if (isObject(v)) {
10413 return ["object", { object: asRaw ? toRaw(v) : v }];
10414 } else {
10415 return ["span", stringStyle, String(v)];
10416 }
10417 }
10418 function extractKeys(instance, type) {
10419 const Comp = instance.type;
10420 if (isFunction(Comp)) {
10421 return;
10422 }
10423 const extracted = {};
10424 for (const key in instance.ctx) {
10425 if (isKeyOfType(Comp, key, type)) {
10426 extracted[key] = instance.ctx[key];
10427 }
10428 }
10429 return extracted;
10430 }
10431 function isKeyOfType(Comp, key, type) {
10432 const opts = Comp[type];
10433 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
10434 return true;
10435 }
10436 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
10437 return true;
10438 }
10439 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
10440 return true;
10441 }
10442 }
10443 function genRefFlag(v) {
10444 if (isShallow(v)) {
10445 return `ShallowRef`;
10446 }
10447 if (v.effect) {
10448 return `ComputedRef`;
10449 }
10450 return `Ref`;
10451 }
10452 if (window.devtoolsFormatters) {
10453 window.devtoolsFormatters.push(formatter);
10454 } else {
10455 window.devtoolsFormatters = [formatter];
10456 }
10457 }
10458
10459 function withMemo(memo, render, cache, index) {
10460 const cached = cache[index];
10461 if (cached && isMemoSame(cached, memo)) {
10462 return cached;
10463 }
10464 const ret = render();
10465 ret.memo = memo.slice();
10466 ret.cacheIndex = index;
10467 return cache[index] = ret;
10468 }
10469 function isMemoSame(cached, memo) {
10470 const prev = cached.memo;
10471 if (prev.length != memo.length) {
10472 return false;
10473 }
10474 for (let i = 0; i < prev.length; i++) {
10475 if (hasChanged(prev[i], memo[i])) {
10476 return false;
10477 }
10478 }
10479 if (isBlockTreeEnabled > 0 && currentBlock) {
10480 currentBlock.push(cached);
10481 }
10482 return true;
10483 }
10484
10485 const version = "3.5.13";
10486 const warn = warn$1 ;
10487 const ErrorTypeStrings = ErrorTypeStrings$1 ;
10488 const devtools = devtools$1 ;
10489 const setDevtoolsHook = setDevtoolsHook$1 ;
10490 const ssrUtils = null;
10491 const resolveFilter = null;
10492 const compatUtils = null;
10493 const DeprecationTypes = null;
10494
10495 let policy = void 0;
10496 const tt = typeof window !== "undefined" && window.trustedTypes;
10497 if (tt) {
10498 try {
10499 policy = /* @__PURE__ */ tt.createPolicy("vue", {
10500 createHTML: (val) => val
10501 });
10502 } catch (e) {
10503 warn(`Error creating trusted types policy: ${e}`);
10504 }
10505 }
10506 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
10507 const svgNS = "http://www.w3.org/2000/svg";
10508 const mathmlNS = "http://www.w3.org/1998/Math/MathML";
10509 const doc = typeof document !== "undefined" ? document : null;
10510 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
10511 const nodeOps = {
10512 insert: (child, parent, anchor) => {
10513 parent.insertBefore(child, anchor || null);
10514 },
10515 remove: (child) => {
10516 const parent = child.parentNode;
10517 if (parent) {
10518 parent.removeChild(child);
10519 }
10520 },
10521 createElement: (tag, namespace, is, props) => {
10522 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
10523 if (tag === "select" && props && props.multiple != null) {
10524 el.setAttribute("multiple", props.multiple);
10525 }
10526 return el;
10527 },
10528 createText: (text) => doc.createTextNode(text),
10529 createComment: (text) => doc.createComment(text),
10530 setText: (node, text) => {
10531 node.nodeValue = text;
10532 },
10533 setElementText: (el, text) => {
10534 el.textContent = text;
10535 },
10536 parentNode: (node) => node.parentNode,
10537 nextSibling: (node) => node.nextSibling,
10538 querySelector: (selector) => doc.querySelector(selector),
10539 setScopeId(el, id) {
10540 el.setAttribute(id, "");
10541 },
10542 // __UNSAFE__
10543 // Reason: innerHTML.
10544 // Static content here can only come from compiled templates.
10545 // As long as the user only uses trusted templates, this is safe.
10546 insertStaticContent(content, parent, anchor, namespace, start, end) {
10547 const before = anchor ? anchor.previousSibling : parent.lastChild;
10548 if (start && (start === end || start.nextSibling)) {
10549 while (true) {
10550 parent.insertBefore(start.cloneNode(true), anchor);
10551 if (start === end || !(start = start.nextSibling)) break;
10552 }
10553 } else {
10554 templateContainer.innerHTML = unsafeToTrustedHTML(
10555 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
10556 );
10557 const template = templateContainer.content;
10558 if (namespace === "svg" || namespace === "mathml") {
10559 const wrapper = template.firstChild;
10560 while (wrapper.firstChild) {
10561 template.appendChild(wrapper.firstChild);
10562 }
10563 template.removeChild(wrapper);
10564 }
10565 parent.insertBefore(template, anchor);
10566 }
10567 return [
10568 // first
10569 before ? before.nextSibling : parent.firstChild,
10570 // last
10571 anchor ? anchor.previousSibling : parent.lastChild
10572 ];
10573 }
10574 };
10575
10576 const TRANSITION$1 = "transition";
10577 const ANIMATION = "animation";
10578 const vtcKey = Symbol("_vtc");
10579 const DOMTransitionPropsValidators = {
10580 name: String,
10581 type: String,
10582 css: {
10583 type: Boolean,
10584 default: true
10585 },
10586 duration: [String, Number, Object],
10587 enterFromClass: String,
10588 enterActiveClass: String,
10589 enterToClass: String,
10590 appearFromClass: String,
10591 appearActiveClass: String,
10592 appearToClass: String,
10593 leaveFromClass: String,
10594 leaveActiveClass: String,
10595 leaveToClass: String
10596 };
10597 const TransitionPropsValidators = /* @__PURE__ */ extend(
10598 {},
10599 BaseTransitionPropsValidators,
10600 DOMTransitionPropsValidators
10601 );
10602 const decorate$1 = (t) => {
10603 t.displayName = "Transition";
10604 t.props = TransitionPropsValidators;
10605 return t;
10606 };
10607 const Transition = /* @__PURE__ */ decorate$1(
10608 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10609 );
10610 const callHook = (hook, args = []) => {
10611 if (isArray(hook)) {
10612 hook.forEach((h2) => h2(...args));
10613 } else if (hook) {
10614 hook(...args);
10615 }
10616 };
10617 const hasExplicitCallback = (hook) => {
10618 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
10619 };
10620 function resolveTransitionProps(rawProps) {
10621 const baseProps = {};
10622 for (const key in rawProps) {
10623 if (!(key in DOMTransitionPropsValidators)) {
10624 baseProps[key] = rawProps[key];
10625 }
10626 }
10627 if (rawProps.css === false) {
10628 return baseProps;
10629 }
10630 const {
10631 name = "v",
10632 type,
10633 duration,
10634 enterFromClass = `${name}-enter-from`,
10635 enterActiveClass = `${name}-enter-active`,
10636 enterToClass = `${name}-enter-to`,
10637 appearFromClass = enterFromClass,
10638 appearActiveClass = enterActiveClass,
10639 appearToClass = enterToClass,
10640 leaveFromClass = `${name}-leave-from`,
10641 leaveActiveClass = `${name}-leave-active`,
10642 leaveToClass = `${name}-leave-to`
10643 } = rawProps;
10644 const durations = normalizeDuration(duration);
10645 const enterDuration = durations && durations[0];
10646 const leaveDuration = durations && durations[1];
10647 const {
10648 onBeforeEnter,
10649 onEnter,
10650 onEnterCancelled,
10651 onLeave,
10652 onLeaveCancelled,
10653 onBeforeAppear = onBeforeEnter,
10654 onAppear = onEnter,
10655 onAppearCancelled = onEnterCancelled
10656 } = baseProps;
10657 const finishEnter = (el, isAppear, done, isCancelled) => {
10658 el._enterCancelled = isCancelled;
10659 removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
10660 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
10661 done && done();
10662 };
10663 const finishLeave = (el, done) => {
10664 el._isLeaving = false;
10665 removeTransitionClass(el, leaveFromClass);
10666 removeTransitionClass(el, leaveToClass);
10667 removeTransitionClass(el, leaveActiveClass);
10668 done && done();
10669 };
10670 const makeEnterHook = (isAppear) => {
10671 return (el, done) => {
10672 const hook = isAppear ? onAppear : onEnter;
10673 const resolve = () => finishEnter(el, isAppear, done);
10674 callHook(hook, [el, resolve]);
10675 nextFrame(() => {
10676 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
10677 addTransitionClass(el, isAppear ? appearToClass : enterToClass);
10678 if (!hasExplicitCallback(hook)) {
10679 whenTransitionEnds(el, type, enterDuration, resolve);
10680 }
10681 });
10682 };
10683 };
10684 return extend(baseProps, {
10685 onBeforeEnter(el) {
10686 callHook(onBeforeEnter, [el]);
10687 addTransitionClass(el, enterFromClass);
10688 addTransitionClass(el, enterActiveClass);
10689 },
10690 onBeforeAppear(el) {
10691 callHook(onBeforeAppear, [el]);
10692 addTransitionClass(el, appearFromClass);
10693 addTransitionClass(el, appearActiveClass);
10694 },
10695 onEnter: makeEnterHook(false),
10696 onAppear: makeEnterHook(true),
10697 onLeave(el, done) {
10698 el._isLeaving = true;
10699 const resolve = () => finishLeave(el, done);
10700 addTransitionClass(el, leaveFromClass);
10701 if (!el._enterCancelled) {
10702 forceReflow();
10703 addTransitionClass(el, leaveActiveClass);
10704 } else {
10705 addTransitionClass(el, leaveActiveClass);
10706 forceReflow();
10707 }
10708 nextFrame(() => {
10709 if (!el._isLeaving) {
10710 return;
10711 }
10712 removeTransitionClass(el, leaveFromClass);
10713 addTransitionClass(el, leaveToClass);
10714 if (!hasExplicitCallback(onLeave)) {
10715 whenTransitionEnds(el, type, leaveDuration, resolve);
10716 }
10717 });
10718 callHook(onLeave, [el, resolve]);
10719 },
10720 onEnterCancelled(el) {
10721 finishEnter(el, false, void 0, true);
10722 callHook(onEnterCancelled, [el]);
10723 },
10724 onAppearCancelled(el) {
10725 finishEnter(el, true, void 0, true);
10726 callHook(onAppearCancelled, [el]);
10727 },
10728 onLeaveCancelled(el) {
10729 finishLeave(el);
10730 callHook(onLeaveCancelled, [el]);
10731 }
10732 });
10733 }
10734 function normalizeDuration(duration) {
10735 if (duration == null) {
10736 return null;
10737 } else if (isObject(duration)) {
10738 return [NumberOf(duration.enter), NumberOf(duration.leave)];
10739 } else {
10740 const n = NumberOf(duration);
10741 return [n, n];
10742 }
10743 }
10744 function NumberOf(val) {
10745 const res = toNumber(val);
10746 {
10747 assertNumber(res, "<transition> explicit duration");
10748 }
10749 return res;
10750 }
10751 function addTransitionClass(el, cls) {
10752 cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
10753 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
10754 }
10755 function removeTransitionClass(el, cls) {
10756 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
10757 const _vtc = el[vtcKey];
10758 if (_vtc) {
10759 _vtc.delete(cls);
10760 if (!_vtc.size) {
10761 el[vtcKey] = void 0;
10762 }
10763 }
10764 }
10765 function nextFrame(cb) {
10766 requestAnimationFrame(() => {
10767 requestAnimationFrame(cb);
10768 });
10769 }
10770 let endId = 0;
10771 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
10772 const id = el._endId = ++endId;
10773 const resolveIfNotStale = () => {
10774 if (id === el._endId) {
10775 resolve();
10776 }
10777 };
10778 if (explicitTimeout != null) {
10779 return setTimeout(resolveIfNotStale, explicitTimeout);
10780 }
10781 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
10782 if (!type) {
10783 return resolve();
10784 }
10785 const endEvent = type + "end";
10786 let ended = 0;
10787 const end = () => {
10788 el.removeEventListener(endEvent, onEnd);
10789 resolveIfNotStale();
10790 };
10791 const onEnd = (e) => {
10792 if (e.target === el && ++ended >= propCount) {
10793 end();
10794 }
10795 };
10796 setTimeout(() => {
10797 if (ended < propCount) {
10798 end();
10799 }
10800 }, timeout + 1);
10801 el.addEventListener(endEvent, onEnd);
10802 }
10803 function getTransitionInfo(el, expectedType) {
10804 const styles = window.getComputedStyle(el);
10805 const getStyleProperties = (key) => (styles[key] || "").split(", ");
10806 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
10807 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
10808 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
10809 const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
10810 const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
10811 const animationTimeout = getTimeout(animationDelays, animationDurations);
10812 let type = null;
10813 let timeout = 0;
10814 let propCount = 0;
10815 if (expectedType === TRANSITION$1) {
10816 if (transitionTimeout > 0) {
10817 type = TRANSITION$1;
10818 timeout = transitionTimeout;
10819 propCount = transitionDurations.length;
10820 }
10821 } else if (expectedType === ANIMATION) {
10822 if (animationTimeout > 0) {
10823 type = ANIMATION;
10824 timeout = animationTimeout;
10825 propCount = animationDurations.length;
10826 }
10827 } else {
10828 timeout = Math.max(transitionTimeout, animationTimeout);
10829 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
10830 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
10831 }
10832 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
10833 getStyleProperties(`${TRANSITION$1}Property`).toString()
10834 );
10835 return {
10836 type,
10837 timeout,
10838 propCount,
10839 hasTransform
10840 };
10841 }
10842 function getTimeout(delays, durations) {
10843 while (delays.length < durations.length) {
10844 delays = delays.concat(delays);
10845 }
10846 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
10847 }
10848 function toMs(s) {
10849 if (s === "auto") return 0;
10850 return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10851 }
10852 function forceReflow() {
10853 return document.body.offsetHeight;
10854 }
10855
10856 function patchClass(el, value, isSVG) {
10857 const transitionClasses = el[vtcKey];
10858 if (transitionClasses) {
10859 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
10860 }
10861 if (value == null) {
10862 el.removeAttribute("class");
10863 } else if (isSVG) {
10864 el.setAttribute("class", value);
10865 } else {
10866 el.className = value;
10867 }
10868 }
10869
10870 const vShowOriginalDisplay = Symbol("_vod");
10871 const vShowHidden = Symbol("_vsh");
10872 const vShow = {
10873 beforeMount(el, { value }, { transition }) {
10874 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10875 if (transition && value) {
10876 transition.beforeEnter(el);
10877 } else {
10878 setDisplay(el, value);
10879 }
10880 },
10881 mounted(el, { value }, { transition }) {
10882 if (transition && value) {
10883 transition.enter(el);
10884 }
10885 },
10886 updated(el, { value, oldValue }, { transition }) {
10887 if (!value === !oldValue) return;
10888 if (transition) {
10889 if (value) {
10890 transition.beforeEnter(el);
10891 setDisplay(el, true);
10892 transition.enter(el);
10893 } else {
10894 transition.leave(el, () => {
10895 setDisplay(el, false);
10896 });
10897 }
10898 } else {
10899 setDisplay(el, value);
10900 }
10901 },
10902 beforeUnmount(el, { value }) {
10903 setDisplay(el, value);
10904 }
10905 };
10906 {
10907 vShow.name = "show";
10908 }
10909 function setDisplay(el, value) {
10910 el.style.display = value ? el[vShowOriginalDisplay] : "none";
10911 el[vShowHidden] = !value;
10912 }
10913
10914 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
10915 function useCssVars(getter) {
10916 const instance = getCurrentInstance();
10917 if (!instance) {
10918 warn(`useCssVars is called without current active component instance.`);
10919 return;
10920 }
10921 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10922 Array.from(
10923 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10924 ).forEach((node) => setVarsOnNode(node, vars));
10925 };
10926 {
10927 instance.getCssVars = () => getter(instance.proxy);
10928 }
10929 const setVars = () => {
10930 const vars = getter(instance.proxy);
10931 if (instance.ce) {
10932 setVarsOnNode(instance.ce, vars);
10933 } else {
10934 setVarsOnVNode(instance.subTree, vars);
10935 }
10936 updateTeleports(vars);
10937 };
10938 onBeforeUpdate(() => {
10939 queuePostFlushCb(setVars);
10940 });
10941 onMounted(() => {
10942 watch(setVars, NOOP, { flush: "post" });
10943 const ob = new MutationObserver(setVars);
10944 ob.observe(instance.subTree.el.parentNode, { childList: true });
10945 onUnmounted(() => ob.disconnect());
10946 });
10947 }
10948 function setVarsOnVNode(vnode, vars) {
10949 if (vnode.shapeFlag & 128) {
10950 const suspense = vnode.suspense;
10951 vnode = suspense.activeBranch;
10952 if (suspense.pendingBranch && !suspense.isHydrating) {
10953 suspense.effects.push(() => {
10954 setVarsOnVNode(suspense.activeBranch, vars);
10955 });
10956 }
10957 }
10958 while (vnode.component) {
10959 vnode = vnode.component.subTree;
10960 }
10961 if (vnode.shapeFlag & 1 && vnode.el) {
10962 setVarsOnNode(vnode.el, vars);
10963 } else if (vnode.type === Fragment) {
10964 vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10965 } else if (vnode.type === Static) {
10966 let { el, anchor } = vnode;
10967 while (el) {
10968 setVarsOnNode(el, vars);
10969 if (el === anchor) break;
10970 el = el.nextSibling;
10971 }
10972 }
10973 }
10974 function setVarsOnNode(el, vars) {
10975 if (el.nodeType === 1) {
10976 const style = el.style;
10977 let cssText = "";
10978 for (const key in vars) {
10979 style.setProperty(`--${key}`, vars[key]);
10980 cssText += `--${key}: ${vars[key]};`;
10981 }
10982 style[CSS_VAR_TEXT] = cssText;
10983 }
10984 }
10985
10986 const displayRE = /(^|;)\s*display\s*:/;
10987 function patchStyle(el, prev, next) {
10988 const style = el.style;
10989 const isCssString = isString(next);
10990 let hasControlledDisplay = false;
10991 if (next && !isCssString) {
10992 if (prev) {
10993 if (!isString(prev)) {
10994 for (const key in prev) {
10995 if (next[key] == null) {
10996 setStyle(style, key, "");
10997 }
10998 }
10999 } else {
11000 for (const prevStyle of prev.split(";")) {
11001 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11002 if (next[key] == null) {
11003 setStyle(style, key, "");
11004 }
11005 }
11006 }
11007 }
11008 for (const key in next) {
11009 if (key === "display") {
11010 hasControlledDisplay = true;
11011 }
11012 setStyle(style, key, next[key]);
11013 }
11014 } else {
11015 if (isCssString) {
11016 if (prev !== next) {
11017 const cssVarText = style[CSS_VAR_TEXT];
11018 if (cssVarText) {
11019 next += ";" + cssVarText;
11020 }
11021 style.cssText = next;
11022 hasControlledDisplay = displayRE.test(next);
11023 }
11024 } else if (prev) {
11025 el.removeAttribute("style");
11026 }
11027 }
11028 if (vShowOriginalDisplay in el) {
11029 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11030 if (el[vShowHidden]) {
11031 style.display = "none";
11032 }
11033 }
11034 }
11035 const semicolonRE = /[^\\];\s*$/;
11036 const importantRE = /\s*!important$/;
11037 function setStyle(style, name, val) {
11038 if (isArray(val)) {
11039 val.forEach((v) => setStyle(style, name, v));
11040 } else {
11041 if (val == null) val = "";
11042 {
11043 if (semicolonRE.test(val)) {
11044 warn(
11045 `Unexpected semicolon at the end of '${name}' style value: '${val}'`
11046 );
11047 }
11048 }
11049 if (name.startsWith("--")) {
11050 style.setProperty(name, val);
11051 } else {
11052 const prefixed = autoPrefix(style, name);
11053 if (importantRE.test(val)) {
11054 style.setProperty(
11055 hyphenate(prefixed),
11056 val.replace(importantRE, ""),
11057 "important"
11058 );
11059 } else {
11060 style[prefixed] = val;
11061 }
11062 }
11063 }
11064 }
11065 const prefixes = ["Webkit", "Moz", "ms"];
11066 const prefixCache = {};
11067 function autoPrefix(style, rawName) {
11068 const cached = prefixCache[rawName];
11069 if (cached) {
11070 return cached;
11071 }
11072 let name = camelize(rawName);
11073 if (name !== "filter" && name in style) {
11074 return prefixCache[rawName] = name;
11075 }
11076 name = capitalize(name);
11077 for (let i = 0; i < prefixes.length; i++) {
11078 const prefixed = prefixes[i] + name;
11079 if (prefixed in style) {
11080 return prefixCache[rawName] = prefixed;
11081 }
11082 }
11083 return rawName;
11084 }
11085
11086 const xlinkNS = "http://www.w3.org/1999/xlink";
11087 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
11088 if (isSVG && key.startsWith("xlink:")) {
11089 if (value == null) {
11090 el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
11091 } else {
11092 el.setAttributeNS(xlinkNS, key, value);
11093 }
11094 } else {
11095 if (value == null || isBoolean && !includeBooleanAttr(value)) {
11096 el.removeAttribute(key);
11097 } else {
11098 el.setAttribute(
11099 key,
11100 isBoolean ? "" : isSymbol(value) ? String(value) : value
11101 );
11102 }
11103 }
11104 }
11105
11106 function patchDOMProp(el, key, value, parentComponent, attrName) {
11107 if (key === "innerHTML" || key === "textContent") {
11108 if (value != null) {
11109 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
11110 }
11111 return;
11112 }
11113 const tag = el.tagName;
11114 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11115 !tag.includes("-")) {
11116 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11117 const newValue = value == null ? (
11118 // #11647: value should be set as empty string for null and undefined,
11119 // but <input type="checkbox"> should be set as 'on'.
11120 el.type === "checkbox" ? "on" : ""
11121 ) : String(value);
11122 if (oldValue !== newValue || !("_value" in el)) {
11123 el.value = newValue;
11124 }
11125 if (value == null) {
11126 el.removeAttribute(key);
11127 }
11128 el._value = value;
11129 return;
11130 }
11131 let needRemove = false;
11132 if (value === "" || value == null) {
11133 const type = typeof el[key];
11134 if (type === "boolean") {
11135 value = includeBooleanAttr(value);
11136 } else if (value == null && type === "string") {
11137 value = "";
11138 needRemove = true;
11139 } else if (type === "number") {
11140 value = 0;
11141 needRemove = true;
11142 }
11143 }
11144 try {
11145 el[key] = value;
11146 } catch (e) {
11147 if (!needRemove) {
11148 warn(
11149 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
11150 e
11151 );
11152 }
11153 }
11154 needRemove && el.removeAttribute(attrName || key);
11155 }
11156
11157 function addEventListener(el, event, handler, options) {
11158 el.addEventListener(event, handler, options);
11159 }
11160 function removeEventListener(el, event, handler, options) {
11161 el.removeEventListener(event, handler, options);
11162 }
11163 const veiKey = Symbol("_vei");
11164 function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
11165 const invokers = el[veiKey] || (el[veiKey] = {});
11166 const existingInvoker = invokers[rawName];
11167 if (nextValue && existingInvoker) {
11168 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
11169 } else {
11170 const [name, options] = parseName(rawName);
11171 if (nextValue) {
11172 const invoker = invokers[rawName] = createInvoker(
11173 sanitizeEventValue(nextValue, rawName) ,
11174 instance
11175 );
11176 addEventListener(el, name, invoker, options);
11177 } else if (existingInvoker) {
11178 removeEventListener(el, name, existingInvoker, options);
11179 invokers[rawName] = void 0;
11180 }
11181 }
11182 }
11183 const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11184 function parseName(name) {
11185 let options;
11186 if (optionsModifierRE.test(name)) {
11187 options = {};
11188 let m;
11189 while (m = name.match(optionsModifierRE)) {
11190 name = name.slice(0, name.length - m[0].length);
11191 options[m[0].toLowerCase()] = true;
11192 }
11193 }
11194 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11195 return [event, options];
11196 }
11197 let cachedNow = 0;
11198 const p = /* @__PURE__ */ Promise.resolve();
11199 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
11200 function createInvoker(initialValue, instance) {
11201 const invoker = (e) => {
11202 if (!e._vts) {
11203 e._vts = Date.now();
11204 } else if (e._vts <= invoker.attached) {
11205 return;
11206 }
11207 callWithAsyncErrorHandling(
11208 patchStopImmediatePropagation(e, invoker.value),
11209 instance,
11210 5,
11211 [e]
11212 );
11213 };
11214 invoker.value = initialValue;
11215 invoker.attached = getNow();
11216 return invoker;
11217 }
11218 function sanitizeEventValue(value, propName) {
11219 if (isFunction(value) || isArray(value)) {
11220 return value;
11221 }
11222 warn(
11223 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
11224Expected function or array of functions, received type ${typeof value}.`
11225 );
11226 return NOOP;
11227 }
11228 function patchStopImmediatePropagation(e, value) {
11229 if (isArray(value)) {
11230 const originalStop = e.stopImmediatePropagation;
11231 e.stopImmediatePropagation = () => {
11232 originalStop.call(e);
11233 e._stopped = true;
11234 };
11235 return value.map(
11236 (fn) => (e2) => !e2._stopped && fn && fn(e2)
11237 );
11238 } else {
11239 return value;
11240 }
11241 }
11242
11243 const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11244 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11245 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
11246 const isSVG = namespace === "svg";
11247 if (key === "class") {
11248 patchClass(el, nextValue, isSVG);
11249 } else if (key === "style") {
11250 patchStyle(el, prevValue, nextValue);
11251 } else if (isOn(key)) {
11252 if (!isModelListener(key)) {
11253 patchEvent(el, key, prevValue, nextValue, parentComponent);
11254 }
11255 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
11256 patchDOMProp(el, key, nextValue);
11257 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
11258 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
11259 }
11260 } else if (
11261 // #11081 force set props for possible async custom element
11262 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
11263 ) {
11264 patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
11265 } else {
11266 if (key === "true-value") {
11267 el._trueValue = nextValue;
11268 } else if (key === "false-value") {
11269 el._falseValue = nextValue;
11270 }
11271 patchAttr(el, key, nextValue, isSVG);
11272 }
11273 };
11274 function shouldSetAsProp(el, key, value, isSVG) {
11275 if (isSVG) {
11276 if (key === "innerHTML" || key === "textContent") {
11277 return true;
11278 }
11279 if (key in el && isNativeOn(key) && isFunction(value)) {
11280 return true;
11281 }
11282 return false;
11283 }
11284 if (key === "spellcheck" || key === "draggable" || key === "translate") {
11285 return false;
11286 }
11287 if (key === "form") {
11288 return false;
11289 }
11290 if (key === "list" && el.tagName === "INPUT") {
11291 return false;
11292 }
11293 if (key === "type" && el.tagName === "TEXTAREA") {
11294 return false;
11295 }
11296 if (key === "width" || key === "height") {
11297 const tag = el.tagName;
11298 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11299 return false;
11300 }
11301 }
11302 if (isNativeOn(key) && isString(value)) {
11303 return false;
11304 }
11305 return key in el;
11306 }
11307
11308 const REMOVAL = {};
11309 /*! #__NO_SIDE_EFFECTS__ */
11310 // @__NO_SIDE_EFFECTS__
11311 function defineCustomElement(options, extraOptions, _createApp) {
11312 const Comp = defineComponent(options, extraOptions);
11313 if (isPlainObject(Comp)) extend(Comp, extraOptions);
11314 class VueCustomElement extends VueElement {
11315 constructor(initialProps) {
11316 super(Comp, initialProps, _createApp);
11317 }
11318 }
11319 VueCustomElement.def = Comp;
11320 return VueCustomElement;
11321 }
11322 /*! #__NO_SIDE_EFFECTS__ */
11323 const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11324 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11325 };
11326 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11327 };
11328 class VueElement extends BaseClass {
11329 constructor(_def, _props = {}, _createApp = createApp) {
11330 super();
11331 this._def = _def;
11332 this._props = _props;
11333 this._createApp = _createApp;
11334 this._isVueCE = true;
11335 /**
11336 * @internal
11337 */
11338 this._instance = null;
11339 /**
11340 * @internal
11341 */
11342 this._app = null;
11343 /**
11344 * @internal
11345 */
11346 this._nonce = this._def.nonce;
11347 this._connected = false;
11348 this._resolved = false;
11349 this._numberProps = null;
11350 this._styleChildren = /* @__PURE__ */ new WeakSet();
11351 this._ob = null;
11352 if (this.shadowRoot && _createApp !== createApp) {
11353 this._root = this.shadowRoot;
11354 } else {
11355 if (this.shadowRoot) {
11356 warn(
11357 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
11358 );
11359 }
11360 if (_def.shadowRoot !== false) {
11361 this.attachShadow({ mode: "open" });
11362 this._root = this.shadowRoot;
11363 } else {
11364 this._root = this;
11365 }
11366 }
11367 if (!this._def.__asyncLoader) {
11368 this._resolveProps(this._def);
11369 }
11370 }
11371 connectedCallback() {
11372 if (!this.isConnected) return;
11373 if (!this.shadowRoot) {
11374 this._parseSlots();
11375 }
11376 this._connected = true;
11377 let parent = this;
11378 while (parent = parent && (parent.parentNode || parent.host)) {
11379 if (parent instanceof VueElement) {
11380 this._parent = parent;
11381 break;
11382 }
11383 }
11384 if (!this._instance) {
11385 if (this._resolved) {
11386 this._setParent();
11387 this._update();
11388 } else {
11389 if (parent && parent._pendingResolve) {
11390 this._pendingResolve = parent._pendingResolve.then(() => {
11391 this._pendingResolve = void 0;
11392 this._resolveDef();
11393 });
11394 } else {
11395 this._resolveDef();
11396 }
11397 }
11398 }
11399 }
11400 _setParent(parent = this._parent) {
11401 if (parent) {
11402 this._instance.parent = parent._instance;
11403 this._instance.provides = parent._instance.provides;
11404 }
11405 }
11406 disconnectedCallback() {
11407 this._connected = false;
11408 nextTick(() => {
11409 if (!this._connected) {
11410 if (this._ob) {
11411 this._ob.disconnect();
11412 this._ob = null;
11413 }
11414 this._app && this._app.unmount();
11415 if (this._instance) this._instance.ce = void 0;
11416 this._app = this._instance = null;
11417 }
11418 });
11419 }
11420 /**
11421 * resolve inner component definition (handle possible async component)
11422 */
11423 _resolveDef() {
11424 if (this._pendingResolve) {
11425 return;
11426 }
11427 for (let i = 0; i < this.attributes.length; i++) {
11428 this._setAttr(this.attributes[i].name);
11429 }
11430 this._ob = new MutationObserver((mutations) => {
11431 for (const m of mutations) {
11432 this._setAttr(m.attributeName);
11433 }
11434 });
11435 this._ob.observe(this, { attributes: true });
11436 const resolve = (def, isAsync = false) => {
11437 this._resolved = true;
11438 this._pendingResolve = void 0;
11439 const { props, styles } = def;
11440 let numberProps;
11441 if (props && !isArray(props)) {
11442 for (const key in props) {
11443 const opt = props[key];
11444 if (opt === Number || opt && opt.type === Number) {
11445 if (key in this._props) {
11446 this._props[key] = toNumber(this._props[key]);
11447 }
11448 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
11449 }
11450 }
11451 }
11452 this._numberProps = numberProps;
11453 if (isAsync) {
11454 this._resolveProps(def);
11455 }
11456 if (this.shadowRoot) {
11457 this._applyStyles(styles);
11458 } else if (styles) {
11459 warn(
11460 "Custom element style injection is not supported when using shadowRoot: false"
11461 );
11462 }
11463 this._mount(def);
11464 };
11465 const asyncDef = this._def.__asyncLoader;
11466 if (asyncDef) {
11467 this._pendingResolve = asyncDef().then(
11468 (def) => resolve(this._def = def, true)
11469 );
11470 } else {
11471 resolve(this._def);
11472 }
11473 }
11474 _mount(def) {
11475 if (!def.name) {
11476 def.name = "VueElement";
11477 }
11478 this._app = this._createApp(def);
11479 if (def.configureApp) {
11480 def.configureApp(this._app);
11481 }
11482 this._app._ceVNode = this._createVNode();
11483 this._app.mount(this._root);
11484 const exposed = this._instance && this._instance.exposed;
11485 if (!exposed) return;
11486 for (const key in exposed) {
11487 if (!hasOwn(this, key)) {
11488 Object.defineProperty(this, key, {
11489 // unwrap ref to be consistent with public instance behavior
11490 get: () => unref(exposed[key])
11491 });
11492 } else {
11493 warn(`Exposed property "${key}" already exists on custom element.`);
11494 }
11495 }
11496 }
11497 _resolveProps(def) {
11498 const { props } = def;
11499 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
11500 for (const key of Object.keys(this)) {
11501 if (key[0] !== "_" && declaredPropKeys.includes(key)) {
11502 this._setProp(key, this[key]);
11503 }
11504 }
11505 for (const key of declaredPropKeys.map(camelize)) {
11506 Object.defineProperty(this, key, {
11507 get() {
11508 return this._getProp(key);
11509 },
11510 set(val) {
11511 this._setProp(key, val, true, true);
11512 }
11513 });
11514 }
11515 }
11516 _setAttr(key) {
11517 if (key.startsWith("data-v-")) return;
11518 const has = this.hasAttribute(key);
11519 let value = has ? this.getAttribute(key) : REMOVAL;
11520 const camelKey = camelize(key);
11521 if (has && this._numberProps && this._numberProps[camelKey]) {
11522 value = toNumber(value);
11523 }
11524 this._setProp(camelKey, value, false, true);
11525 }
11526 /**
11527 * @internal
11528 */
11529 _getProp(key) {
11530 return this._props[key];
11531 }
11532 /**
11533 * @internal
11534 */
11535 _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11536 if (val !== this._props[key]) {
11537 if (val === REMOVAL) {
11538 delete this._props[key];
11539 } else {
11540 this._props[key] = val;
11541 if (key === "key" && this._app) {
11542 this._app._ceVNode.key = val;
11543 }
11544 }
11545 if (shouldUpdate && this._instance) {
11546 this._update();
11547 }
11548 if (shouldReflect) {
11549 const ob = this._ob;
11550 ob && ob.disconnect();
11551 if (val === true) {
11552 this.setAttribute(hyphenate(key), "");
11553 } else if (typeof val === "string" || typeof val === "number") {
11554 this.setAttribute(hyphenate(key), val + "");
11555 } else if (!val) {
11556 this.removeAttribute(hyphenate(key));
11557 }
11558 ob && ob.observe(this, { attributes: true });
11559 }
11560 }
11561 }
11562 _update() {
11563 render(this._createVNode(), this._root);
11564 }
11565 _createVNode() {
11566 const baseProps = {};
11567 if (!this.shadowRoot) {
11568 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11569 }
11570 const vnode = createVNode(this._def, extend(baseProps, this._props));
11571 if (!this._instance) {
11572 vnode.ce = (instance) => {
11573 this._instance = instance;
11574 instance.ce = this;
11575 instance.isCE = true;
11576 {
11577 instance.ceReload = (newStyles) => {
11578 if (this._styles) {
11579 this._styles.forEach((s) => this._root.removeChild(s));
11580 this._styles.length = 0;
11581 }
11582 this._applyStyles(newStyles);
11583 this._instance = null;
11584 this._update();
11585 };
11586 }
11587 const dispatch = (event, args) => {
11588 this.dispatchEvent(
11589 new CustomEvent(
11590 event,
11591 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11592 )
11593 );
11594 };
11595 instance.emit = (event, ...args) => {
11596 dispatch(event, args);
11597 if (hyphenate(event) !== event) {
11598 dispatch(hyphenate(event), args);
11599 }
11600 };
11601 this._setParent();
11602 };
11603 }
11604 return vnode;
11605 }
11606 _applyStyles(styles, owner) {
11607 if (!styles) return;
11608 if (owner) {
11609 if (owner === this._def || this._styleChildren.has(owner)) {
11610 return;
11611 }
11612 this._styleChildren.add(owner);
11613 }
11614 const nonce = this._nonce;
11615 for (let i = styles.length - 1; i >= 0; i--) {
11616 const s = document.createElement("style");
11617 if (nonce) s.setAttribute("nonce", nonce);
11618 s.textContent = styles[i];
11619 this.shadowRoot.prepend(s);
11620 {
11621 if (owner) {
11622 if (owner.__hmrId) {
11623 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
11624 let entry = this._childStyles.get(owner.__hmrId);
11625 if (!entry) {
11626 this._childStyles.set(owner.__hmrId, entry = []);
11627 }
11628 entry.push(s);
11629 }
11630 } else {
11631 (this._styles || (this._styles = [])).push(s);
11632 }
11633 }
11634 }
11635 }
11636 /**
11637 * Only called when shadowRoot is false
11638 */
11639 _parseSlots() {
11640 const slots = this._slots = {};
11641 let n;
11642 while (n = this.firstChild) {
11643 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
11644 (slots[slotName] || (slots[slotName] = [])).push(n);
11645 this.removeChild(n);
11646 }
11647 }
11648 /**
11649 * Only called when shadowRoot is false
11650 */
11651 _renderSlots() {
11652 const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11653 const scopeId = this._instance.type.__scopeId;
11654 for (let i = 0; i < outlets.length; i++) {
11655 const o = outlets[i];
11656 const slotName = o.getAttribute("name") || "default";
11657 const content = this._slots[slotName];
11658 const parent = o.parentNode;
11659 if (content) {
11660 for (const n of content) {
11661 if (scopeId && n.nodeType === 1) {
11662 const id = scopeId + "-s";
11663 const walker = document.createTreeWalker(n, 1);
11664 n.setAttribute(id, "");
11665 let child;
11666 while (child = walker.nextNode()) {
11667 child.setAttribute(id, "");
11668 }
11669 }
11670 parent.insertBefore(n, o);
11671 }
11672 } else {
11673 while (o.firstChild) parent.insertBefore(o.firstChild, o);
11674 }
11675 parent.removeChild(o);
11676 }
11677 }
11678 /**
11679 * @internal
11680 */
11681 _injectChildStyle(comp) {
11682 this._applyStyles(comp.styles, comp);
11683 }
11684 /**
11685 * @internal
11686 */
11687 _removeChildStyle(comp) {
11688 {
11689 this._styleChildren.delete(comp);
11690 if (this._childStyles && comp.__hmrId) {
11691 const oldStyles = this._childStyles.get(comp.__hmrId);
11692 if (oldStyles) {
11693 oldStyles.forEach((s) => this._root.removeChild(s));
11694 oldStyles.length = 0;
11695 }
11696 }
11697 }
11698 }
11699 }
11700 function useHost(caller) {
11701 const instance = getCurrentInstance();
11702 const el = instance && instance.ce;
11703 if (el) {
11704 return el;
11705 } else {
11706 if (!instance) {
11707 warn(
11708 `${caller || "useHost"} called without an active component instance.`
11709 );
11710 } else {
11711 warn(
11712 `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
11713 );
11714 }
11715 }
11716 return null;
11717 }
11718 function useShadowRoot() {
11719 const el = useHost("useShadowRoot") ;
11720 return el && el.shadowRoot;
11721 }
11722
11723 function useCssModule(name = "$style") {
11724 {
11725 {
11726 warn(`useCssModule() is not supported in the global build.`);
11727 }
11728 return EMPTY_OBJ;
11729 }
11730 }
11731
11732 const positionMap = /* @__PURE__ */ new WeakMap();
11733 const newPositionMap = /* @__PURE__ */ new WeakMap();
11734 const moveCbKey = Symbol("_moveCb");
11735 const enterCbKey = Symbol("_enterCb");
11736 const decorate = (t) => {
11737 delete t.props.mode;
11738 return t;
11739 };
11740 const TransitionGroupImpl = /* @__PURE__ */ decorate({
11741 name: "TransitionGroup",
11742 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11743 tag: String,
11744 moveClass: String
11745 }),
11746 setup(props, { slots }) {
11747 const instance = getCurrentInstance();
11748 const state = useTransitionState();
11749 let prevChildren;
11750 let children;
11751 onUpdated(() => {
11752 if (!prevChildren.length) {
11753 return;
11754 }
11755 const moveClass = props.moveClass || `${props.name || "v"}-move`;
11756 if (!hasCSSTransform(
11757 prevChildren[0].el,
11758 instance.vnode.el,
11759 moveClass
11760 )) {
11761 return;
11762 }
11763 prevChildren.forEach(callPendingCbs);
11764 prevChildren.forEach(recordPosition);
11765 const movedChildren = prevChildren.filter(applyTranslation);
11766 forceReflow();
11767 movedChildren.forEach((c) => {
11768 const el = c.el;
11769 const style = el.style;
11770 addTransitionClass(el, moveClass);
11771 style.transform = style.webkitTransform = style.transitionDuration = "";
11772 const cb = el[moveCbKey] = (e) => {
11773 if (e && e.target !== el) {
11774 return;
11775 }
11776 if (!e || /transform$/.test(e.propertyName)) {
11777 el.removeEventListener("transitionend", cb);
11778 el[moveCbKey] = null;
11779 removeTransitionClass(el, moveClass);
11780 }
11781 };
11782 el.addEventListener("transitionend", cb);
11783 });
11784 });
11785 return () => {
11786 const rawProps = toRaw(props);
11787 const cssTransitionProps = resolveTransitionProps(rawProps);
11788 let tag = rawProps.tag || Fragment;
11789 prevChildren = [];
11790 if (children) {
11791 for (let i = 0; i < children.length; i++) {
11792 const child = children[i];
11793 if (child.el && child.el instanceof Element) {
11794 prevChildren.push(child);
11795 setTransitionHooks(
11796 child,
11797 resolveTransitionHooks(
11798 child,
11799 cssTransitionProps,
11800 state,
11801 instance
11802 )
11803 );
11804 positionMap.set(
11805 child,
11806 child.el.getBoundingClientRect()
11807 );
11808 }
11809 }
11810 }
11811 children = slots.default ? getTransitionRawChildren(slots.default()) : [];
11812 for (let i = 0; i < children.length; i++) {
11813 const child = children[i];
11814 if (child.key != null) {
11815 setTransitionHooks(
11816 child,
11817 resolveTransitionHooks(child, cssTransitionProps, state, instance)
11818 );
11819 } else if (child.type !== Text) {
11820 warn(`<TransitionGroup> children must be keyed.`);
11821 }
11822 }
11823 return createVNode(tag, null, children);
11824 };
11825 }
11826 });
11827 const TransitionGroup = TransitionGroupImpl;
11828 function callPendingCbs(c) {
11829 const el = c.el;
11830 if (el[moveCbKey]) {
11831 el[moveCbKey]();
11832 }
11833 if (el[enterCbKey]) {
11834 el[enterCbKey]();
11835 }
11836 }
11837 function recordPosition(c) {
11838 newPositionMap.set(c, c.el.getBoundingClientRect());
11839 }
11840 function applyTranslation(c) {
11841 const oldPos = positionMap.get(c);
11842 const newPos = newPositionMap.get(c);
11843 const dx = oldPos.left - newPos.left;
11844 const dy = oldPos.top - newPos.top;
11845 if (dx || dy) {
11846 const s = c.el.style;
11847 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
11848 s.transitionDuration = "0s";
11849 return c;
11850 }
11851 }
11852 function hasCSSTransform(el, root, moveClass) {
11853 const clone = el.cloneNode();
11854 const _vtc = el[vtcKey];
11855 if (_vtc) {
11856 _vtc.forEach((cls) => {
11857 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
11858 });
11859 }
11860 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
11861 clone.style.display = "none";
11862 const container = root.nodeType === 1 ? root : root.parentNode;
11863 container.appendChild(clone);
11864 const { hasTransform } = getTransitionInfo(clone);
11865 container.removeChild(clone);
11866 return hasTransform;
11867 }
11868
11869 const getModelAssigner = (vnode) => {
11870 const fn = vnode.props["onUpdate:modelValue"] || false;
11871 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
11872 };
11873 function onCompositionStart(e) {
11874 e.target.composing = true;
11875 }
11876 function onCompositionEnd(e) {
11877 const target = e.target;
11878 if (target.composing) {
11879 target.composing = false;
11880 target.dispatchEvent(new Event("input"));
11881 }
11882 }
11883 const assignKey = Symbol("_assign");
11884 const vModelText = {
11885 created(el, { modifiers: { lazy, trim, number } }, vnode) {
11886 el[assignKey] = getModelAssigner(vnode);
11887 const castToNumber = number || vnode.props && vnode.props.type === "number";
11888 addEventListener(el, lazy ? "change" : "input", (e) => {
11889 if (e.target.composing) return;
11890 let domValue = el.value;
11891 if (trim) {
11892 domValue = domValue.trim();
11893 }
11894 if (castToNumber) {
11895 domValue = looseToNumber(domValue);
11896 }
11897 el[assignKey](domValue);
11898 });
11899 if (trim) {
11900 addEventListener(el, "change", () => {
11901 el.value = el.value.trim();
11902 });
11903 }
11904 if (!lazy) {
11905 addEventListener(el, "compositionstart", onCompositionStart);
11906 addEventListener(el, "compositionend", onCompositionEnd);
11907 addEventListener(el, "change", onCompositionEnd);
11908 }
11909 },
11910 // set value on mounted so it's after min/max for type="range"
11911 mounted(el, { value }) {
11912 el.value = value == null ? "" : value;
11913 },
11914 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11915 el[assignKey] = getModelAssigner(vnode);
11916 if (el.composing) return;
11917 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
11918 const newValue = value == null ? "" : value;
11919 if (elValue === newValue) {
11920 return;
11921 }
11922 if (document.activeElement === el && el.type !== "range") {
11923 if (lazy && value === oldValue) {
11924 return;
11925 }
11926 if (trim && el.value.trim() === newValue) {
11927 return;
11928 }
11929 }
11930 el.value = newValue;
11931 }
11932 };
11933 const vModelCheckbox = {
11934 // #4096 array checkboxes need to be deep traversed
11935 deep: true,
11936 created(el, _, vnode) {
11937 el[assignKey] = getModelAssigner(vnode);
11938 addEventListener(el, "change", () => {
11939 const modelValue = el._modelValue;
11940 const elementValue = getValue(el);
11941 const checked = el.checked;
11942 const assign = el[assignKey];
11943 if (isArray(modelValue)) {
11944 const index = looseIndexOf(modelValue, elementValue);
11945 const found = index !== -1;
11946 if (checked && !found) {
11947 assign(modelValue.concat(elementValue));
11948 } else if (!checked && found) {
11949 const filtered = [...modelValue];
11950 filtered.splice(index, 1);
11951 assign(filtered);
11952 }
11953 } else if (isSet(modelValue)) {
11954 const cloned = new Set(modelValue);
11955 if (checked) {
11956 cloned.add(elementValue);
11957 } else {
11958 cloned.delete(elementValue);
11959 }
11960 assign(cloned);
11961 } else {
11962 assign(getCheckboxValue(el, checked));
11963 }
11964 });
11965 },
11966 // set initial checked on mount to wait for true-value/false-value
11967 mounted: setChecked,
11968 beforeUpdate(el, binding, vnode) {
11969 el[assignKey] = getModelAssigner(vnode);
11970 setChecked(el, binding, vnode);
11971 }
11972 };
11973 function setChecked(el, { value, oldValue }, vnode) {
11974 el._modelValue = value;
11975 let checked;
11976 if (isArray(value)) {
11977 checked = looseIndexOf(value, vnode.props.value) > -1;
11978 } else if (isSet(value)) {
11979 checked = value.has(vnode.props.value);
11980 } else {
11981 if (value === oldValue) return;
11982 checked = looseEqual(value, getCheckboxValue(el, true));
11983 }
11984 if (el.checked !== checked) {
11985 el.checked = checked;
11986 }
11987 }
11988 const vModelRadio = {
11989 created(el, { value }, vnode) {
11990 el.checked = looseEqual(value, vnode.props.value);
11991 el[assignKey] = getModelAssigner(vnode);
11992 addEventListener(el, "change", () => {
11993 el[assignKey](getValue(el));
11994 });
11995 },
11996 beforeUpdate(el, { value, oldValue }, vnode) {
11997 el[assignKey] = getModelAssigner(vnode);
11998 if (value !== oldValue) {
11999 el.checked = looseEqual(value, vnode.props.value);
12000 }
12001 }
12002 };
12003 const vModelSelect = {
12004 // <select multiple> value need to be deep traversed
12005 deep: true,
12006 created(el, { value, modifiers: { number } }, vnode) {
12007 const isSetModel = isSet(value);
12008 addEventListener(el, "change", () => {
12009 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12010 (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12011 );
12012 el[assignKey](
12013 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12014 );
12015 el._assigning = true;
12016 nextTick(() => {
12017 el._assigning = false;
12018 });
12019 });
12020 el[assignKey] = getModelAssigner(vnode);
12021 },
12022 // set value in mounted & updated because <select> relies on its children
12023 // <option>s.
12024 mounted(el, { value }) {
12025 setSelected(el, value);
12026 },
12027 beforeUpdate(el, _binding, vnode) {
12028 el[assignKey] = getModelAssigner(vnode);
12029 },
12030 updated(el, { value }) {
12031 if (!el._assigning) {
12032 setSelected(el, value);
12033 }
12034 }
12035 };
12036 function setSelected(el, value) {
12037 const isMultiple = el.multiple;
12038 const isArrayValue = isArray(value);
12039 if (isMultiple && !isArrayValue && !isSet(value)) {
12040 warn(
12041 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12042 );
12043 return;
12044 }
12045 for (let i = 0, l = el.options.length; i < l; i++) {
12046 const option = el.options[i];
12047 const optionValue = getValue(option);
12048 if (isMultiple) {
12049 if (isArrayValue) {
12050 const optionType = typeof optionValue;
12051 if (optionType === "string" || optionType === "number") {
12052 option.selected = value.some((v) => String(v) === String(optionValue));
12053 } else {
12054 option.selected = looseIndexOf(value, optionValue) > -1;
12055 }
12056 } else {
12057 option.selected = value.has(optionValue);
12058 }
12059 } else if (looseEqual(getValue(option), value)) {
12060 if (el.selectedIndex !== i) el.selectedIndex = i;
12061 return;
12062 }
12063 }
12064 if (!isMultiple && el.selectedIndex !== -1) {
12065 el.selectedIndex = -1;
12066 }
12067 }
12068 function getValue(el) {
12069 return "_value" in el ? el._value : el.value;
12070 }
12071 function getCheckboxValue(el, checked) {
12072 const key = checked ? "_trueValue" : "_falseValue";
12073 return key in el ? el[key] : checked;
12074 }
12075 const vModelDynamic = {
12076 created(el, binding, vnode) {
12077 callModelHook(el, binding, vnode, null, "created");
12078 },
12079 mounted(el, binding, vnode) {
12080 callModelHook(el, binding, vnode, null, "mounted");
12081 },
12082 beforeUpdate(el, binding, vnode, prevVNode) {
12083 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
12084 },
12085 updated(el, binding, vnode, prevVNode) {
12086 callModelHook(el, binding, vnode, prevVNode, "updated");
12087 }
12088 };
12089 function resolveDynamicModel(tagName, type) {
12090 switch (tagName) {
12091 case "SELECT":
12092 return vModelSelect;
12093 case "TEXTAREA":
12094 return vModelText;
12095 default:
12096 switch (type) {
12097 case "checkbox":
12098 return vModelCheckbox;
12099 case "radio":
12100 return vModelRadio;
12101 default:
12102 return vModelText;
12103 }
12104 }
12105 }
12106 function callModelHook(el, binding, vnode, prevVNode, hook) {
12107 const modelToUse = resolveDynamicModel(
12108 el.tagName,
12109 vnode.props && vnode.props.type
12110 );
12111 const fn = modelToUse[hook];
12112 fn && fn(el, binding, vnode, prevVNode);
12113 }
12114
12115 const systemModifiers = ["ctrl", "shift", "alt", "meta"];
12116 const modifierGuards = {
12117 stop: (e) => e.stopPropagation(),
12118 prevent: (e) => e.preventDefault(),
12119 self: (e) => e.target !== e.currentTarget,
12120 ctrl: (e) => !e.ctrlKey,
12121 shift: (e) => !e.shiftKey,
12122 alt: (e) => !e.altKey,
12123 meta: (e) => !e.metaKey,
12124 left: (e) => "button" in e && e.button !== 0,
12125 middle: (e) => "button" in e && e.button !== 1,
12126 right: (e) => "button" in e && e.button !== 2,
12127 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12128 };
12129 const withModifiers = (fn, modifiers) => {
12130 const cache = fn._withMods || (fn._withMods = {});
12131 const cacheKey = modifiers.join(".");
12132 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12133 for (let i = 0; i < modifiers.length; i++) {
12134 const guard = modifierGuards[modifiers[i]];
12135 if (guard && guard(event, modifiers)) return;
12136 }
12137 return fn(event, ...args);
12138 });
12139 };
12140 const keyNames = {
12141 esc: "escape",
12142 space: " ",
12143 up: "arrow-up",
12144 left: "arrow-left",
12145 right: "arrow-right",
12146 down: "arrow-down",
12147 delete: "backspace"
12148 };
12149 const withKeys = (fn, modifiers) => {
12150 const cache = fn._withKeys || (fn._withKeys = {});
12151 const cacheKey = modifiers.join(".");
12152 return cache[cacheKey] || (cache[cacheKey] = (event) => {
12153 if (!("key" in event)) {
12154 return;
12155 }
12156 const eventKey = hyphenate(event.key);
12157 if (modifiers.some(
12158 (k) => k === eventKey || keyNames[k] === eventKey
12159 )) {
12160 return fn(event);
12161 }
12162 });
12163 };
12164
12165 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
12166 let renderer;
12167 let enabledHydration = false;
12168 function ensureRenderer() {
12169 return renderer || (renderer = createRenderer(rendererOptions));
12170 }
12171 function ensureHydrationRenderer() {
12172 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
12173 enabledHydration = true;
12174 return renderer;
12175 }
12176 const render = (...args) => {
12177 ensureRenderer().render(...args);
12178 };
12179 const hydrate = (...args) => {
12180 ensureHydrationRenderer().hydrate(...args);
12181 };
12182 const createApp = (...args) => {
12183 const app = ensureRenderer().createApp(...args);
12184 {
12185 injectNativeTagCheck(app);
12186 injectCompilerOptionsCheck(app);
12187 }
12188 const { mount } = app;
12189 app.mount = (containerOrSelector) => {
12190 const container = normalizeContainer(containerOrSelector);
12191 if (!container) return;
12192 const component = app._component;
12193 if (!isFunction(component) && !component.render && !component.template) {
12194 component.template = container.innerHTML;
12195 }
12196 if (container.nodeType === 1) {
12197 container.textContent = "";
12198 }
12199 const proxy = mount(container, false, resolveRootNamespace(container));
12200 if (container instanceof Element) {
12201 container.removeAttribute("v-cloak");
12202 container.setAttribute("data-v-app", "");
12203 }
12204 return proxy;
12205 };
12206 return app;
12207 };
12208 const createSSRApp = (...args) => {
12209 const app = ensureHydrationRenderer().createApp(...args);
12210 {
12211 injectNativeTagCheck(app);
12212 injectCompilerOptionsCheck(app);
12213 }
12214 const { mount } = app;
12215 app.mount = (containerOrSelector) => {
12216 const container = normalizeContainer(containerOrSelector);
12217 if (container) {
12218 return mount(container, true, resolveRootNamespace(container));
12219 }
12220 };
12221 return app;
12222 };
12223 function resolveRootNamespace(container) {
12224 if (container instanceof SVGElement) {
12225 return "svg";
12226 }
12227 if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
12228 return "mathml";
12229 }
12230 }
12231 function injectNativeTagCheck(app) {
12232 Object.defineProperty(app.config, "isNativeTag", {
12233 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
12234 writable: false
12235 });
12236 }
12237 function injectCompilerOptionsCheck(app) {
12238 if (isRuntimeOnly()) {
12239 const isCustomElement = app.config.isCustomElement;
12240 Object.defineProperty(app.config, "isCustomElement", {
12241 get() {
12242 return isCustomElement;
12243 },
12244 set() {
12245 warn(
12246 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
12247 );
12248 }
12249 });
12250 const compilerOptions = app.config.compilerOptions;
12251 const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
12252- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
12253- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
12254- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
12255 Object.defineProperty(app.config, "compilerOptions", {
12256 get() {
12257 warn(msg);
12258 return compilerOptions;
12259 },
12260 set() {
12261 warn(msg);
12262 }
12263 });
12264 }
12265 }
12266 function normalizeContainer(container) {
12267 if (isString(container)) {
12268 const res = document.querySelector(container);
12269 if (!res) {
12270 warn(
12271 `Failed to mount app: mount target selector "${container}" returned null.`
12272 );
12273 }
12274 return res;
12275 }
12276 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
12277 warn(
12278 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
12279 );
12280 }
12281 return container;
12282 }
12283 const initDirectivesForSSR = NOOP;
12284
12285 function initDev() {
12286 {
12287 {
12288 console.info(
12289 `You are running a development build of Vue.
12290Make sure to use the production build (*.prod.js) when deploying for production.`
12291 );
12292 }
12293 initCustomFormatter();
12294 }
12295 }
12296
12297 const FRAGMENT = Symbol(`Fragment` );
12298 const TELEPORT = Symbol(`Teleport` );
12299 const SUSPENSE = Symbol(`Suspense` );
12300 const KEEP_ALIVE = Symbol(`KeepAlive` );
12301 const BASE_TRANSITION = Symbol(
12302 `BaseTransition`
12303 );
12304 const OPEN_BLOCK = Symbol(`openBlock` );
12305 const CREATE_BLOCK = Symbol(`createBlock` );
12306 const CREATE_ELEMENT_BLOCK = Symbol(
12307 `createElementBlock`
12308 );
12309 const CREATE_VNODE = Symbol(`createVNode` );
12310 const CREATE_ELEMENT_VNODE = Symbol(
12311 `createElementVNode`
12312 );
12313 const CREATE_COMMENT = Symbol(
12314 `createCommentVNode`
12315 );
12316 const CREATE_TEXT = Symbol(
12317 `createTextVNode`
12318 );
12319 const CREATE_STATIC = Symbol(
12320 `createStaticVNode`
12321 );
12322 const RESOLVE_COMPONENT = Symbol(
12323 `resolveComponent`
12324 );
12325 const RESOLVE_DYNAMIC_COMPONENT = Symbol(
12326 `resolveDynamicComponent`
12327 );
12328 const RESOLVE_DIRECTIVE = Symbol(
12329 `resolveDirective`
12330 );
12331 const RESOLVE_FILTER = Symbol(
12332 `resolveFilter`
12333 );
12334 const WITH_DIRECTIVES = Symbol(
12335 `withDirectives`
12336 );
12337 const RENDER_LIST = Symbol(`renderList` );
12338 const RENDER_SLOT = Symbol(`renderSlot` );
12339 const CREATE_SLOTS = Symbol(`createSlots` );
12340 const TO_DISPLAY_STRING = Symbol(
12341 `toDisplayString`
12342 );
12343 const MERGE_PROPS = Symbol(`mergeProps` );
12344 const NORMALIZE_CLASS = Symbol(
12345 `normalizeClass`
12346 );
12347 const NORMALIZE_STYLE = Symbol(
12348 `normalizeStyle`
12349 );
12350 const NORMALIZE_PROPS = Symbol(
12351 `normalizeProps`
12352 );
12353 const GUARD_REACTIVE_PROPS = Symbol(
12354 `guardReactiveProps`
12355 );
12356 const TO_HANDLERS = Symbol(`toHandlers` );
12357 const CAMELIZE = Symbol(`camelize` );
12358 const CAPITALIZE = Symbol(`capitalize` );
12359 const TO_HANDLER_KEY = Symbol(
12360 `toHandlerKey`
12361 );
12362 const SET_BLOCK_TRACKING = Symbol(
12363 `setBlockTracking`
12364 );
12365 const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
12366 const POP_SCOPE_ID = Symbol(`popScopeId` );
12367 const WITH_CTX = Symbol(`withCtx` );
12368 const UNREF = Symbol(`unref` );
12369 const IS_REF = Symbol(`isRef` );
12370 const WITH_MEMO = Symbol(`withMemo` );
12371 const IS_MEMO_SAME = Symbol(`isMemoSame` );
12372 const helperNameMap = {
12373 [FRAGMENT]: `Fragment`,
12374 [TELEPORT]: `Teleport`,
12375 [SUSPENSE]: `Suspense`,
12376 [KEEP_ALIVE]: `KeepAlive`,
12377 [BASE_TRANSITION]: `BaseTransition`,
12378 [OPEN_BLOCK]: `openBlock`,
12379 [CREATE_BLOCK]: `createBlock`,
12380 [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
12381 [CREATE_VNODE]: `createVNode`,
12382 [CREATE_ELEMENT_VNODE]: `createElementVNode`,
12383 [CREATE_COMMENT]: `createCommentVNode`,
12384 [CREATE_TEXT]: `createTextVNode`,
12385 [CREATE_STATIC]: `createStaticVNode`,
12386 [RESOLVE_COMPONENT]: `resolveComponent`,
12387 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
12388 [RESOLVE_DIRECTIVE]: `resolveDirective`,
12389 [RESOLVE_FILTER]: `resolveFilter`,
12390 [WITH_DIRECTIVES]: `withDirectives`,
12391 [RENDER_LIST]: `renderList`,
12392 [RENDER_SLOT]: `renderSlot`,
12393 [CREATE_SLOTS]: `createSlots`,
12394 [TO_DISPLAY_STRING]: `toDisplayString`,
12395 [MERGE_PROPS]: `mergeProps`,
12396 [NORMALIZE_CLASS]: `normalizeClass`,
12397 [NORMALIZE_STYLE]: `normalizeStyle`,
12398 [NORMALIZE_PROPS]: `normalizeProps`,
12399 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
12400 [TO_HANDLERS]: `toHandlers`,
12401 [CAMELIZE]: `camelize`,
12402 [CAPITALIZE]: `capitalize`,
12403 [TO_HANDLER_KEY]: `toHandlerKey`,
12404 [SET_BLOCK_TRACKING]: `setBlockTracking`,
12405 [PUSH_SCOPE_ID]: `pushScopeId`,
12406 [POP_SCOPE_ID]: `popScopeId`,
12407 [WITH_CTX]: `withCtx`,
12408 [UNREF]: `unref`,
12409 [IS_REF]: `isRef`,
12410 [WITH_MEMO]: `withMemo`,
12411 [IS_MEMO_SAME]: `isMemoSame`
12412 };
12413 function registerRuntimeHelpers(helpers) {
12414 Object.getOwnPropertySymbols(helpers).forEach((s) => {
12415 helperNameMap[s] = helpers[s];
12416 });
12417 }
12418
12419 const locStub = {
12420 start: { line: 1, column: 1, offset: 0 },
12421 end: { line: 1, column: 1, offset: 0 },
12422 source: ""
12423 };
12424 function createRoot(children, source = "") {
12425 return {
12426 type: 0,
12427 source,
12428 children,
12429 helpers: /* @__PURE__ */ new Set(),
12430 components: [],
12431 directives: [],
12432 hoists: [],
12433 imports: [],
12434 cached: [],
12435 temps: 0,
12436 codegenNode: void 0,
12437 loc: locStub
12438 };
12439 }
12440 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
12441 if (context) {
12442 if (isBlock) {
12443 context.helper(OPEN_BLOCK);
12444 context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
12445 } else {
12446 context.helper(getVNodeHelper(context.inSSR, isComponent));
12447 }
12448 if (directives) {
12449 context.helper(WITH_DIRECTIVES);
12450 }
12451 }
12452 return {
12453 type: 13,
12454 tag,
12455 props,
12456 children,
12457 patchFlag,
12458 dynamicProps,
12459 directives,
12460 isBlock,
12461 disableTracking,
12462 isComponent,
12463 loc
12464 };
12465 }
12466 function createArrayExpression(elements, loc = locStub) {
12467 return {
12468 type: 17,
12469 loc,
12470 elements
12471 };
12472 }
12473 function createObjectExpression(properties, loc = locStub) {
12474 return {
12475 type: 15,
12476 loc,
12477 properties
12478 };
12479 }
12480 function createObjectProperty(key, value) {
12481 return {
12482 type: 16,
12483 loc: locStub,
12484 key: isString(key) ? createSimpleExpression(key, true) : key,
12485 value
12486 };
12487 }
12488 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
12489 return {
12490 type: 4,
12491 loc,
12492 content,
12493 isStatic,
12494 constType: isStatic ? 3 : constType
12495 };
12496 }
12497 function createCompoundExpression(children, loc = locStub) {
12498 return {
12499 type: 8,
12500 loc,
12501 children
12502 };
12503 }
12504 function createCallExpression(callee, args = [], loc = locStub) {
12505 return {
12506 type: 14,
12507 loc,
12508 callee,
12509 arguments: args
12510 };
12511 }
12512 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
12513 return {
12514 type: 18,
12515 params,
12516 returns,
12517 newline,
12518 isSlot,
12519 loc
12520 };
12521 }
12522 function createConditionalExpression(test, consequent, alternate, newline = true) {
12523 return {
12524 type: 19,
12525 test,
12526 consequent,
12527 alternate,
12528 newline,
12529 loc: locStub
12530 };
12531 }
12532 function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
12533 return {
12534 type: 20,
12535 index,
12536 value,
12537 needPauseTracking,
12538 inVOnce,
12539 needArraySpread: false,
12540 loc: locStub
12541 };
12542 }
12543 function createBlockStatement(body) {
12544 return {
12545 type: 21,
12546 body,
12547 loc: locStub
12548 };
12549 }
12550 function getVNodeHelper(ssr, isComponent) {
12551 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
12552 }
12553 function getVNodeBlockHelper(ssr, isComponent) {
12554 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
12555 }
12556 function convertToBlock(node, { helper, removeHelper, inSSR }) {
12557 if (!node.isBlock) {
12558 node.isBlock = true;
12559 removeHelper(getVNodeHelper(inSSR, node.isComponent));
12560 helper(OPEN_BLOCK);
12561 helper(getVNodeBlockHelper(inSSR, node.isComponent));
12562 }
12563 }
12564
12565 const defaultDelimitersOpen = new Uint8Array([123, 123]);
12566 const defaultDelimitersClose = new Uint8Array([125, 125]);
12567 function isTagStartChar(c) {
12568 return c >= 97 && c <= 122 || c >= 65 && c <= 90;
12569 }
12570 function isWhitespace(c) {
12571 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
12572 }
12573 function isEndOfTagSection(c) {
12574 return c === 47 || c === 62 || isWhitespace(c);
12575 }
12576 function toCharCodes(str) {
12577 const ret = new Uint8Array(str.length);
12578 for (let i = 0; i < str.length; i++) {
12579 ret[i] = str.charCodeAt(i);
12580 }
12581 return ret;
12582 }
12583 const Sequences = {
12584 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
12585 // CDATA[
12586 CdataEnd: new Uint8Array([93, 93, 62]),
12587 // ]]>
12588 CommentEnd: new Uint8Array([45, 45, 62]),
12589 // `-->`
12590 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
12591 // `<\/script`
12592 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
12593 // `</style`
12594 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
12595 // `</title`
12596 TextareaEnd: new Uint8Array([
12597 60,
12598 47,
12599 116,
12600 101,
12601 120,
12602 116,
12603 97,
12604 114,
12605 101,
12606 97
12607 ])
12608 // `</textarea
12609 };
12610 class Tokenizer {
12611 constructor(stack, cbs) {
12612 this.stack = stack;
12613 this.cbs = cbs;
12614 /** The current state the tokenizer is in. */
12615 this.state = 1;
12616 /** The read buffer. */
12617 this.buffer = "";
12618 /** The beginning of the section that is currently being read. */
12619 this.sectionStart = 0;
12620 /** The index within the buffer that we are currently looking at. */
12621 this.index = 0;
12622 /** The start of the last entity. */
12623 this.entityStart = 0;
12624 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
12625 this.baseState = 1;
12626 /** For special parsing behavior inside of script and style tags. */
12627 this.inRCDATA = false;
12628 /** For disabling RCDATA tags handling */
12629 this.inXML = false;
12630 /** For disabling interpolation parsing in v-pre */
12631 this.inVPre = false;
12632 /** Record newline positions for fast line / column calculation */
12633 this.newlines = [];
12634 this.mode = 0;
12635 this.delimiterOpen = defaultDelimitersOpen;
12636 this.delimiterClose = defaultDelimitersClose;
12637 this.delimiterIndex = -1;
12638 this.currentSequence = void 0;
12639 this.sequenceIndex = 0;
12640 }
12641 get inSFCRoot() {
12642 return this.mode === 2 && this.stack.length === 0;
12643 }
12644 reset() {
12645 this.state = 1;
12646 this.mode = 0;
12647 this.buffer = "";
12648 this.sectionStart = 0;
12649 this.index = 0;
12650 this.baseState = 1;
12651 this.inRCDATA = false;
12652 this.currentSequence = void 0;
12653 this.newlines.length = 0;
12654 this.delimiterOpen = defaultDelimitersOpen;
12655 this.delimiterClose = defaultDelimitersClose;
12656 }
12657 /**
12658 * Generate Position object with line / column information using recorded
12659 * newline positions. We know the index is always going to be an already
12660 * processed index, so all the newlines up to this index should have been
12661 * recorded.
12662 */
12663 getPos(index) {
12664 let line = 1;
12665 let column = index + 1;
12666 for (let i = this.newlines.length - 1; i >= 0; i--) {
12667 const newlineIndex = this.newlines[i];
12668 if (index > newlineIndex) {
12669 line = i + 2;
12670 column = index - newlineIndex;
12671 break;
12672 }
12673 }
12674 return {
12675 column,
12676 line,
12677 offset: index
12678 };
12679 }
12680 peek() {
12681 return this.buffer.charCodeAt(this.index + 1);
12682 }
12683 stateText(c) {
12684 if (c === 60) {
12685 if (this.index > this.sectionStart) {
12686 this.cbs.ontext(this.sectionStart, this.index);
12687 }
12688 this.state = 5;
12689 this.sectionStart = this.index;
12690 } else if (!this.inVPre && c === this.delimiterOpen[0]) {
12691 this.state = 2;
12692 this.delimiterIndex = 0;
12693 this.stateInterpolationOpen(c);
12694 }
12695 }
12696 stateInterpolationOpen(c) {
12697 if (c === this.delimiterOpen[this.delimiterIndex]) {
12698 if (this.delimiterIndex === this.delimiterOpen.length - 1) {
12699 const start = this.index + 1 - this.delimiterOpen.length;
12700 if (start > this.sectionStart) {
12701 this.cbs.ontext(this.sectionStart, start);
12702 }
12703 this.state = 3;
12704 this.sectionStart = start;
12705 } else {
12706 this.delimiterIndex++;
12707 }
12708 } else if (this.inRCDATA) {
12709 this.state = 32;
12710 this.stateInRCDATA(c);
12711 } else {
12712 this.state = 1;
12713 this.stateText(c);
12714 }
12715 }
12716 stateInterpolation(c) {
12717 if (c === this.delimiterClose[0]) {
12718 this.state = 4;
12719 this.delimiterIndex = 0;
12720 this.stateInterpolationClose(c);
12721 }
12722 }
12723 stateInterpolationClose(c) {
12724 if (c === this.delimiterClose[this.delimiterIndex]) {
12725 if (this.delimiterIndex === this.delimiterClose.length - 1) {
12726 this.cbs.oninterpolation(this.sectionStart, this.index + 1);
12727 if (this.inRCDATA) {
12728 this.state = 32;
12729 } else {
12730 this.state = 1;
12731 }
12732 this.sectionStart = this.index + 1;
12733 } else {
12734 this.delimiterIndex++;
12735 }
12736 } else {
12737 this.state = 3;
12738 this.stateInterpolation(c);
12739 }
12740 }
12741 stateSpecialStartSequence(c) {
12742 const isEnd = this.sequenceIndex === this.currentSequence.length;
12743 const isMatch = isEnd ? (
12744 // If we are at the end of the sequence, make sure the tag name has ended
12745 isEndOfTagSection(c)
12746 ) : (
12747 // Otherwise, do a case-insensitive comparison
12748 (c | 32) === this.currentSequence[this.sequenceIndex]
12749 );
12750 if (!isMatch) {
12751 this.inRCDATA = false;
12752 } else if (!isEnd) {
12753 this.sequenceIndex++;
12754 return;
12755 }
12756 this.sequenceIndex = 0;
12757 this.state = 6;
12758 this.stateInTagName(c);
12759 }
12760 /** Look for an end tag. For <title> and <textarea>, also decode entities. */
12761 stateInRCDATA(c) {
12762 if (this.sequenceIndex === this.currentSequence.length) {
12763 if (c === 62 || isWhitespace(c)) {
12764 const endOfText = this.index - this.currentSequence.length;
12765 if (this.sectionStart < endOfText) {
12766 const actualIndex = this.index;
12767 this.index = endOfText;
12768 this.cbs.ontext(this.sectionStart, endOfText);
12769 this.index = actualIndex;
12770 }
12771 this.sectionStart = endOfText + 2;
12772 this.stateInClosingTagName(c);
12773 this.inRCDATA = false;
12774 return;
12775 }
12776 this.sequenceIndex = 0;
12777 }
12778 if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
12779 this.sequenceIndex += 1;
12780 } else if (this.sequenceIndex === 0) {
12781 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
12782 if (!this.inVPre && c === this.delimiterOpen[0]) {
12783 this.state = 2;
12784 this.delimiterIndex = 0;
12785 this.stateInterpolationOpen(c);
12786 }
12787 } else if (this.fastForwardTo(60)) {
12788 this.sequenceIndex = 1;
12789 }
12790 } else {
12791 this.sequenceIndex = Number(c === 60);
12792 }
12793 }
12794 stateCDATASequence(c) {
12795 if (c === Sequences.Cdata[this.sequenceIndex]) {
12796 if (++this.sequenceIndex === Sequences.Cdata.length) {
12797 this.state = 28;
12798 this.currentSequence = Sequences.CdataEnd;
12799 this.sequenceIndex = 0;
12800 this.sectionStart = this.index + 1;
12801 }
12802 } else {
12803 this.sequenceIndex = 0;
12804 this.state = 23;
12805 this.stateInDeclaration(c);
12806 }
12807 }
12808 /**
12809 * When we wait for one specific character, we can speed things up
12810 * by skipping through the buffer until we find it.
12811 *
12812 * @returns Whether the character was found.
12813 */
12814 fastForwardTo(c) {
12815 while (++this.index < this.buffer.length) {
12816 const cc = this.buffer.charCodeAt(this.index);
12817 if (cc === 10) {
12818 this.newlines.push(this.index);
12819 }
12820 if (cc === c) {
12821 return true;
12822 }
12823 }
12824 this.index = this.buffer.length - 1;
12825 return false;
12826 }
12827 /**
12828 * Comments and CDATA end with `-->` and `]]>`.
12829 *
12830 * Their common qualities are:
12831 * - Their end sequences have a distinct character they start with.
12832 * - That character is then repeated, so we have to check multiple repeats.
12833 * - All characters but the start character of the sequence can be skipped.
12834 */
12835 stateInCommentLike(c) {
12836 if (c === this.currentSequence[this.sequenceIndex]) {
12837 if (++this.sequenceIndex === this.currentSequence.length) {
12838 if (this.currentSequence === Sequences.CdataEnd) {
12839 this.cbs.oncdata(this.sectionStart, this.index - 2);
12840 } else {
12841 this.cbs.oncomment(this.sectionStart, this.index - 2);
12842 }
12843 this.sequenceIndex = 0;
12844 this.sectionStart = this.index + 1;
12845 this.state = 1;
12846 }
12847 } else if (this.sequenceIndex === 0) {
12848 if (this.fastForwardTo(this.currentSequence[0])) {
12849 this.sequenceIndex = 1;
12850 }
12851 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
12852 this.sequenceIndex = 0;
12853 }
12854 }
12855 startSpecial(sequence, offset) {
12856 this.enterRCDATA(sequence, offset);
12857 this.state = 31;
12858 }
12859 enterRCDATA(sequence, offset) {
12860 this.inRCDATA = true;
12861 this.currentSequence = sequence;
12862 this.sequenceIndex = offset;
12863 }
12864 stateBeforeTagName(c) {
12865 if (c === 33) {
12866 this.state = 22;
12867 this.sectionStart = this.index + 1;
12868 } else if (c === 63) {
12869 this.state = 24;
12870 this.sectionStart = this.index + 1;
12871 } else if (isTagStartChar(c)) {
12872 this.sectionStart = this.index;
12873 if (this.mode === 0) {
12874 this.state = 6;
12875 } else if (this.inSFCRoot) {
12876 this.state = 34;
12877 } else if (!this.inXML) {
12878 if (c === 116) {
12879 this.state = 30;
12880 } else {
12881 this.state = c === 115 ? 29 : 6;
12882 }
12883 } else {
12884 this.state = 6;
12885 }
12886 } else if (c === 47) {
12887 this.state = 8;
12888 } else {
12889 this.state = 1;
12890 this.stateText(c);
12891 }
12892 }
12893 stateInTagName(c) {
12894 if (isEndOfTagSection(c)) {
12895 this.handleTagName(c);
12896 }
12897 }
12898 stateInSFCRootTagName(c) {
12899 if (isEndOfTagSection(c)) {
12900 const tag = this.buffer.slice(this.sectionStart, this.index);
12901 if (tag !== "template") {
12902 this.enterRCDATA(toCharCodes(`</` + tag), 0);
12903 }
12904 this.handleTagName(c);
12905 }
12906 }
12907 handleTagName(c) {
12908 this.cbs.onopentagname(this.sectionStart, this.index);
12909 this.sectionStart = -1;
12910 this.state = 11;
12911 this.stateBeforeAttrName(c);
12912 }
12913 stateBeforeClosingTagName(c) {
12914 if (isWhitespace(c)) ; else if (c === 62) {
12915 {
12916 this.cbs.onerr(14, this.index);
12917 }
12918 this.state = 1;
12919 this.sectionStart = this.index + 1;
12920 } else {
12921 this.state = isTagStartChar(c) ? 9 : 27;
12922 this.sectionStart = this.index;
12923 }
12924 }
12925 stateInClosingTagName(c) {
12926 if (c === 62 || isWhitespace(c)) {
12927 this.cbs.onclosetag(this.sectionStart, this.index);
12928 this.sectionStart = -1;
12929 this.state = 10;
12930 this.stateAfterClosingTagName(c);
12931 }
12932 }
12933 stateAfterClosingTagName(c) {
12934 if (c === 62) {
12935 this.state = 1;
12936 this.sectionStart = this.index + 1;
12937 }
12938 }
12939 stateBeforeAttrName(c) {
12940 if (c === 62) {
12941 this.cbs.onopentagend(this.index);
12942 if (this.inRCDATA) {
12943 this.state = 32;
12944 } else {
12945 this.state = 1;
12946 }
12947 this.sectionStart = this.index + 1;
12948 } else if (c === 47) {
12949 this.state = 7;
12950 if (this.peek() !== 62) {
12951 this.cbs.onerr(22, this.index);
12952 }
12953 } else if (c === 60 && this.peek() === 47) {
12954 this.cbs.onopentagend(this.index);
12955 this.state = 5;
12956 this.sectionStart = this.index;
12957 } else if (!isWhitespace(c)) {
12958 if (c === 61) {
12959 this.cbs.onerr(
12960 19,
12961 this.index
12962 );
12963 }
12964 this.handleAttrStart(c);
12965 }
12966 }
12967 handleAttrStart(c) {
12968 if (c === 118 && this.peek() === 45) {
12969 this.state = 13;
12970 this.sectionStart = this.index;
12971 } else if (c === 46 || c === 58 || c === 64 || c === 35) {
12972 this.cbs.ondirname(this.index, this.index + 1);
12973 this.state = 14;
12974 this.sectionStart = this.index + 1;
12975 } else {
12976 this.state = 12;
12977 this.sectionStart = this.index;
12978 }
12979 }
12980 stateInSelfClosingTag(c) {
12981 if (c === 62) {
12982 this.cbs.onselfclosingtag(this.index);
12983 this.state = 1;
12984 this.sectionStart = this.index + 1;
12985 this.inRCDATA = false;
12986 } else if (!isWhitespace(c)) {
12987 this.state = 11;
12988 this.stateBeforeAttrName(c);
12989 }
12990 }
12991 stateInAttrName(c) {
12992 if (c === 61 || isEndOfTagSection(c)) {
12993 this.cbs.onattribname(this.sectionStart, this.index);
12994 this.handleAttrNameEnd(c);
12995 } else if (c === 34 || c === 39 || c === 60) {
12996 this.cbs.onerr(
12997 17,
12998 this.index
12999 );
13000 }
13001 }
13002 stateInDirName(c) {
13003 if (c === 61 || isEndOfTagSection(c)) {
13004 this.cbs.ondirname(this.sectionStart, this.index);
13005 this.handleAttrNameEnd(c);
13006 } else if (c === 58) {
13007 this.cbs.ondirname(this.sectionStart, this.index);
13008 this.state = 14;
13009 this.sectionStart = this.index + 1;
13010 } else if (c === 46) {
13011 this.cbs.ondirname(this.sectionStart, this.index);
13012 this.state = 16;
13013 this.sectionStart = this.index + 1;
13014 }
13015 }
13016 stateInDirArg(c) {
13017 if (c === 61 || isEndOfTagSection(c)) {
13018 this.cbs.ondirarg(this.sectionStart, this.index);
13019 this.handleAttrNameEnd(c);
13020 } else if (c === 91) {
13021 this.state = 15;
13022 } else if (c === 46) {
13023 this.cbs.ondirarg(this.sectionStart, this.index);
13024 this.state = 16;
13025 this.sectionStart = this.index + 1;
13026 }
13027 }
13028 stateInDynamicDirArg(c) {
13029 if (c === 93) {
13030 this.state = 14;
13031 } else if (c === 61 || isEndOfTagSection(c)) {
13032 this.cbs.ondirarg(this.sectionStart, this.index + 1);
13033 this.handleAttrNameEnd(c);
13034 {
13035 this.cbs.onerr(
13036 27,
13037 this.index
13038 );
13039 }
13040 }
13041 }
13042 stateInDirModifier(c) {
13043 if (c === 61 || isEndOfTagSection(c)) {
13044 this.cbs.ondirmodifier(this.sectionStart, this.index);
13045 this.handleAttrNameEnd(c);
13046 } else if (c === 46) {
13047 this.cbs.ondirmodifier(this.sectionStart, this.index);
13048 this.sectionStart = this.index + 1;
13049 }
13050 }
13051 handleAttrNameEnd(c) {
13052 this.sectionStart = this.index;
13053 this.state = 17;
13054 this.cbs.onattribnameend(this.index);
13055 this.stateAfterAttrName(c);
13056 }
13057 stateAfterAttrName(c) {
13058 if (c === 61) {
13059 this.state = 18;
13060 } else if (c === 47 || c === 62) {
13061 this.cbs.onattribend(0, this.sectionStart);
13062 this.sectionStart = -1;
13063 this.state = 11;
13064 this.stateBeforeAttrName(c);
13065 } else if (!isWhitespace(c)) {
13066 this.cbs.onattribend(0, this.sectionStart);
13067 this.handleAttrStart(c);
13068 }
13069 }
13070 stateBeforeAttrValue(c) {
13071 if (c === 34) {
13072 this.state = 19;
13073 this.sectionStart = this.index + 1;
13074 } else if (c === 39) {
13075 this.state = 20;
13076 this.sectionStart = this.index + 1;
13077 } else if (!isWhitespace(c)) {
13078 this.sectionStart = this.index;
13079 this.state = 21;
13080 this.stateInAttrValueNoQuotes(c);
13081 }
13082 }
13083 handleInAttrValue(c, quote) {
13084 if (c === quote || this.fastForwardTo(quote)) {
13085 this.cbs.onattribdata(this.sectionStart, this.index);
13086 this.sectionStart = -1;
13087 this.cbs.onattribend(
13088 quote === 34 ? 3 : 2,
13089 this.index + 1
13090 );
13091 this.state = 11;
13092 }
13093 }
13094 stateInAttrValueDoubleQuotes(c) {
13095 this.handleInAttrValue(c, 34);
13096 }
13097 stateInAttrValueSingleQuotes(c) {
13098 this.handleInAttrValue(c, 39);
13099 }
13100 stateInAttrValueNoQuotes(c) {
13101 if (isWhitespace(c) || c === 62) {
13102 this.cbs.onattribdata(this.sectionStart, this.index);
13103 this.sectionStart = -1;
13104 this.cbs.onattribend(1, this.index);
13105 this.state = 11;
13106 this.stateBeforeAttrName(c);
13107 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13108 this.cbs.onerr(
13109 18,
13110 this.index
13111 );
13112 } else ;
13113 }
13114 stateBeforeDeclaration(c) {
13115 if (c === 91) {
13116 this.state = 26;
13117 this.sequenceIndex = 0;
13118 } else {
13119 this.state = c === 45 ? 25 : 23;
13120 }
13121 }
13122 stateInDeclaration(c) {
13123 if (c === 62 || this.fastForwardTo(62)) {
13124 this.state = 1;
13125 this.sectionStart = this.index + 1;
13126 }
13127 }
13128 stateInProcessingInstruction(c) {
13129 if (c === 62 || this.fastForwardTo(62)) {
13130 this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13131 this.state = 1;
13132 this.sectionStart = this.index + 1;
13133 }
13134 }
13135 stateBeforeComment(c) {
13136 if (c === 45) {
13137 this.state = 28;
13138 this.currentSequence = Sequences.CommentEnd;
13139 this.sequenceIndex = 2;
13140 this.sectionStart = this.index + 1;
13141 } else {
13142 this.state = 23;
13143 }
13144 }
13145 stateInSpecialComment(c) {
13146 if (c === 62 || this.fastForwardTo(62)) {
13147 this.cbs.oncomment(this.sectionStart, this.index);
13148 this.state = 1;
13149 this.sectionStart = this.index + 1;
13150 }
13151 }
13152 stateBeforeSpecialS(c) {
13153 if (c === Sequences.ScriptEnd[3]) {
13154 this.startSpecial(Sequences.ScriptEnd, 4);
13155 } else if (c === Sequences.StyleEnd[3]) {
13156 this.startSpecial(Sequences.StyleEnd, 4);
13157 } else {
13158 this.state = 6;
13159 this.stateInTagName(c);
13160 }
13161 }
13162 stateBeforeSpecialT(c) {
13163 if (c === Sequences.TitleEnd[3]) {
13164 this.startSpecial(Sequences.TitleEnd, 4);
13165 } else if (c === Sequences.TextareaEnd[3]) {
13166 this.startSpecial(Sequences.TextareaEnd, 4);
13167 } else {
13168 this.state = 6;
13169 this.stateInTagName(c);
13170 }
13171 }
13172 startEntity() {
13173 }
13174 stateInEntity() {
13175 }
13176 /**
13177 * Iterates through the buffer, calling the function corresponding to the current state.
13178 *
13179 * States that are more likely to be hit are higher up, as a performance improvement.
13180 */
13181 parse(input) {
13182 this.buffer = input;
13183 while (this.index < this.buffer.length) {
13184 const c = this.buffer.charCodeAt(this.index);
13185 if (c === 10) {
13186 this.newlines.push(this.index);
13187 }
13188 switch (this.state) {
13189 case 1: {
13190 this.stateText(c);
13191 break;
13192 }
13193 case 2: {
13194 this.stateInterpolationOpen(c);
13195 break;
13196 }
13197 case 3: {
13198 this.stateInterpolation(c);
13199 break;
13200 }
13201 case 4: {
13202 this.stateInterpolationClose(c);
13203 break;
13204 }
13205 case 31: {
13206 this.stateSpecialStartSequence(c);
13207 break;
13208 }
13209 case 32: {
13210 this.stateInRCDATA(c);
13211 break;
13212 }
13213 case 26: {
13214 this.stateCDATASequence(c);
13215 break;
13216 }
13217 case 19: {
13218 this.stateInAttrValueDoubleQuotes(c);
13219 break;
13220 }
13221 case 12: {
13222 this.stateInAttrName(c);
13223 break;
13224 }
13225 case 13: {
13226 this.stateInDirName(c);
13227 break;
13228 }
13229 case 14: {
13230 this.stateInDirArg(c);
13231 break;
13232 }
13233 case 15: {
13234 this.stateInDynamicDirArg(c);
13235 break;
13236 }
13237 case 16: {
13238 this.stateInDirModifier(c);
13239 break;
13240 }
13241 case 28: {
13242 this.stateInCommentLike(c);
13243 break;
13244 }
13245 case 27: {
13246 this.stateInSpecialComment(c);
13247 break;
13248 }
13249 case 11: {
13250 this.stateBeforeAttrName(c);
13251 break;
13252 }
13253 case 6: {
13254 this.stateInTagName(c);
13255 break;
13256 }
13257 case 34: {
13258 this.stateInSFCRootTagName(c);
13259 break;
13260 }
13261 case 9: {
13262 this.stateInClosingTagName(c);
13263 break;
13264 }
13265 case 5: {
13266 this.stateBeforeTagName(c);
13267 break;
13268 }
13269 case 17: {
13270 this.stateAfterAttrName(c);
13271 break;
13272 }
13273 case 20: {
13274 this.stateInAttrValueSingleQuotes(c);
13275 break;
13276 }
13277 case 18: {
13278 this.stateBeforeAttrValue(c);
13279 break;
13280 }
13281 case 8: {
13282 this.stateBeforeClosingTagName(c);
13283 break;
13284 }
13285 case 10: {
13286 this.stateAfterClosingTagName(c);
13287 break;
13288 }
13289 case 29: {
13290 this.stateBeforeSpecialS(c);
13291 break;
13292 }
13293 case 30: {
13294 this.stateBeforeSpecialT(c);
13295 break;
13296 }
13297 case 21: {
13298 this.stateInAttrValueNoQuotes(c);
13299 break;
13300 }
13301 case 7: {
13302 this.stateInSelfClosingTag(c);
13303 break;
13304 }
13305 case 23: {
13306 this.stateInDeclaration(c);
13307 break;
13308 }
13309 case 22: {
13310 this.stateBeforeDeclaration(c);
13311 break;
13312 }
13313 case 25: {
13314 this.stateBeforeComment(c);
13315 break;
13316 }
13317 case 24: {
13318 this.stateInProcessingInstruction(c);
13319 break;
13320 }
13321 case 33: {
13322 this.stateInEntity();
13323 break;
13324 }
13325 }
13326 this.index++;
13327 }
13328 this.cleanup();
13329 this.finish();
13330 }
13331 /**
13332 * Remove data that has already been consumed from the buffer.
13333 */
13334 cleanup() {
13335 if (this.sectionStart !== this.index) {
13336 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13337 this.cbs.ontext(this.sectionStart, this.index);
13338 this.sectionStart = this.index;
13339 } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13340 this.cbs.onattribdata(this.sectionStart, this.index);
13341 this.sectionStart = this.index;
13342 }
13343 }
13344 }
13345 finish() {
13346 this.handleTrailingData();
13347 this.cbs.onend();
13348 }
13349 /** Handle any trailing data. */
13350 handleTrailingData() {
13351 const endIndex = this.buffer.length;
13352 if (this.sectionStart >= endIndex) {
13353 return;
13354 }
13355 if (this.state === 28) {
13356 if (this.currentSequence === Sequences.CdataEnd) {
13357 this.cbs.oncdata(this.sectionStart, endIndex);
13358 } else {
13359 this.cbs.oncomment(this.sectionStart, endIndex);
13360 }
13361 } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
13362 this.cbs.ontext(this.sectionStart, endIndex);
13363 }
13364 }
13365 emitCodePoint(cp, consumed) {
13366 }
13367 }
13368
13369 function defaultOnError(error) {
13370 throw error;
13371 }
13372 function defaultOnWarn(msg) {
13373 console.warn(`[Vue warn] ${msg.message}`);
13374 }
13375 function createCompilerError(code, loc, messages, additionalMessage) {
13376 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
13377 const error = new SyntaxError(String(msg));
13378 error.code = code;
13379 error.loc = loc;
13380 return error;
13381 }
13382 const errorMessages = {
13383 // parse errors
13384 [0]: "Illegal comment.",
13385 [1]: "CDATA section is allowed only in XML context.",
13386 [2]: "Duplicate attribute.",
13387 [3]: "End tag cannot have attributes.",
13388 [4]: "Illegal '/' in tags.",
13389 [5]: "Unexpected EOF in tag.",
13390 [6]: "Unexpected EOF in CDATA section.",
13391 [7]: "Unexpected EOF in comment.",
13392 [8]: "Unexpected EOF in script.",
13393 [9]: "Unexpected EOF in tag.",
13394 [10]: "Incorrectly closed comment.",
13395 [11]: "Incorrectly opened comment.",
13396 [12]: "Illegal tag name. Use '&lt;' to print '<'.",
13397 [13]: "Attribute value was expected.",
13398 [14]: "End tag name was expected.",
13399 [15]: "Whitespace was expected.",
13400 [16]: "Unexpected '<!--' in comment.",
13401 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
13402 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
13403 [19]: "Attribute name cannot start with '='.",
13404 [21]: "'<?' is allowed only in XML context.",
13405 [20]: `Unexpected null character.`,
13406 [22]: "Illegal '/' in tags.",
13407 // Vue-specific parse errors
13408 [23]: "Invalid end tag.",
13409 [24]: "Element is missing end tag.",
13410 [25]: "Interpolation end sign was not found.",
13411 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
13412 [26]: "Legal directive name was expected.",
13413 // transform errors
13414 [28]: `v-if/v-else-if is missing expression.`,
13415 [29]: `v-if/else branches must use unique keys.`,
13416 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
13417 [31]: `v-for is missing expression.`,
13418 [32]: `v-for has invalid expression.`,
13419 [33]: `<template v-for> key should be placed on the <template> tag.`,
13420 [34]: `v-bind is missing expression.`,
13421 [52]: `v-bind with same-name shorthand only allows static argument.`,
13422 [35]: `v-on is missing expression.`,
13423 [36]: `Unexpected custom directive on <slot> outlet.`,
13424 [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
13425 [38]: `Duplicate slot names found. `,
13426 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
13427 [40]: `v-slot can only be used on components or <template> tags.`,
13428 [41]: `v-model is missing expression.`,
13429 [42]: `v-model value must be a valid JavaScript member expression.`,
13430 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
13431 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
13432Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
13433 [45]: `Error parsing JavaScript expression: `,
13434 [46]: `<KeepAlive> expects exactly one child component.`,
13435 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
13436 // generic errors
13437 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13438 [48]: `ES module mode is not supported in this build of compiler.`,
13439 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13440 [50]: `"scopeId" option is only supported in module mode.`,
13441 // just to fulfill types
13442 [53]: ``
13443 };
13444
13445 const isStaticExp = (p) => p.type === 4 && p.isStatic;
13446 function isCoreComponent(tag) {
13447 switch (tag) {
13448 case "Teleport":
13449 case "teleport":
13450 return TELEPORT;
13451 case "Suspense":
13452 case "suspense":
13453 return SUSPENSE;
13454 case "KeepAlive":
13455 case "keep-alive":
13456 return KEEP_ALIVE;
13457 case "BaseTransition":
13458 case "base-transition":
13459 return BASE_TRANSITION;
13460 }
13461 }
13462 const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13463 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13464 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13465 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13466 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13467 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13468 const isMemberExpressionBrowser = (exp) => {
13469 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
13470 let state = 0 /* inMemberExp */;
13471 let stateStack = [];
13472 let currentOpenBracketCount = 0;
13473 let currentOpenParensCount = 0;
13474 let currentStringType = null;
13475 for (let i = 0; i < path.length; i++) {
13476 const char = path.charAt(i);
13477 switch (state) {
13478 case 0 /* inMemberExp */:
13479 if (char === "[") {
13480 stateStack.push(state);
13481 state = 1 /* inBrackets */;
13482 currentOpenBracketCount++;
13483 } else if (char === "(") {
13484 stateStack.push(state);
13485 state = 2 /* inParens */;
13486 currentOpenParensCount++;
13487 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
13488 return false;
13489 }
13490 break;
13491 case 1 /* inBrackets */:
13492 if (char === `'` || char === `"` || char === "`") {
13493 stateStack.push(state);
13494 state = 3 /* inString */;
13495 currentStringType = char;
13496 } else if (char === `[`) {
13497 currentOpenBracketCount++;
13498 } else if (char === `]`) {
13499 if (!--currentOpenBracketCount) {
13500 state = stateStack.pop();
13501 }
13502 }
13503 break;
13504 case 2 /* inParens */:
13505 if (char === `'` || char === `"` || char === "`") {
13506 stateStack.push(state);
13507 state = 3 /* inString */;
13508 currentStringType = char;
13509 } else if (char === `(`) {
13510 currentOpenParensCount++;
13511 } else if (char === `)`) {
13512 if (i === path.length - 1) {
13513 return false;
13514 }
13515 if (!--currentOpenParensCount) {
13516 state = stateStack.pop();
13517 }
13518 }
13519 break;
13520 case 3 /* inString */:
13521 if (char === currentStringType) {
13522 state = stateStack.pop();
13523 currentStringType = null;
13524 }
13525 break;
13526 }
13527 }
13528 return !currentOpenBracketCount && !currentOpenParensCount;
13529 };
13530 const isMemberExpression = isMemberExpressionBrowser ;
13531 const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
13532 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
13533 const isFnExpression = isFnExpressionBrowser ;
13534 function assert(condition, msg) {
13535 if (!condition) {
13536 throw new Error(msg || `unexpected compiler condition`);
13537 }
13538 }
13539 function findDir(node, name, allowEmpty = false) {
13540 for (let i = 0; i < node.props.length; i++) {
13541 const p = node.props[i];
13542 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
13543 return p;
13544 }
13545 }
13546 }
13547 function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
13548 for (let i = 0; i < node.props.length; i++) {
13549 const p = node.props[i];
13550 if (p.type === 6) {
13551 if (dynamicOnly) continue;
13552 if (p.name === name && (p.value || allowEmpty)) {
13553 return p;
13554 }
13555 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
13556 return p;
13557 }
13558 }
13559 }
13560 function isStaticArgOf(arg, name) {
13561 return !!(arg && isStaticExp(arg) && arg.content === name);
13562 }
13563 function hasDynamicKeyVBind(node) {
13564 return node.props.some(
13565 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
13566 p.arg.type !== 4 || // v-bind:[_ctx.foo]
13567 !p.arg.isStatic)
13568 // v-bind:[foo]
13569 );
13570 }
13571 function isText$1(node) {
13572 return node.type === 5 || node.type === 2;
13573 }
13574 function isVSlot(p) {
13575 return p.type === 7 && p.name === "slot";
13576 }
13577 function isTemplateNode(node) {
13578 return node.type === 1 && node.tagType === 3;
13579 }
13580 function isSlotOutlet(node) {
13581 return node.type === 1 && node.tagType === 2;
13582 }
13583 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
13584 function getUnnormalizedProps(props, callPath = []) {
13585 if (props && !isString(props) && props.type === 14) {
13586 const callee = props.callee;
13587 if (!isString(callee) && propsHelperSet.has(callee)) {
13588 return getUnnormalizedProps(
13589 props.arguments[0],
13590 callPath.concat(props)
13591 );
13592 }
13593 }
13594 return [props, callPath];
13595 }
13596 function injectProp(node, prop, context) {
13597 let propsWithInjection;
13598 let props = node.type === 13 ? node.props : node.arguments[2];
13599 let callPath = [];
13600 let parentCall;
13601 if (props && !isString(props) && props.type === 14) {
13602 const ret = getUnnormalizedProps(props);
13603 props = ret[0];
13604 callPath = ret[1];
13605 parentCall = callPath[callPath.length - 1];
13606 }
13607 if (props == null || isString(props)) {
13608 propsWithInjection = createObjectExpression([prop]);
13609 } else if (props.type === 14) {
13610 const first = props.arguments[0];
13611 if (!isString(first) && first.type === 15) {
13612 if (!hasProp(prop, first)) {
13613 first.properties.unshift(prop);
13614 }
13615 } else {
13616 if (props.callee === TO_HANDLERS) {
13617 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
13618 createObjectExpression([prop]),
13619 props
13620 ]);
13621 } else {
13622 props.arguments.unshift(createObjectExpression([prop]));
13623 }
13624 }
13625 !propsWithInjection && (propsWithInjection = props);
13626 } else if (props.type === 15) {
13627 if (!hasProp(prop, props)) {
13628 props.properties.unshift(prop);
13629 }
13630 propsWithInjection = props;
13631 } else {
13632 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
13633 createObjectExpression([prop]),
13634 props
13635 ]);
13636 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13637 parentCall = callPath[callPath.length - 2];
13638 }
13639 }
13640 if (node.type === 13) {
13641 if (parentCall) {
13642 parentCall.arguments[0] = propsWithInjection;
13643 } else {
13644 node.props = propsWithInjection;
13645 }
13646 } else {
13647 if (parentCall) {
13648 parentCall.arguments[0] = propsWithInjection;
13649 } else {
13650 node.arguments[2] = propsWithInjection;
13651 }
13652 }
13653 }
13654 function hasProp(prop, props) {
13655 let result = false;
13656 if (prop.key.type === 4) {
13657 const propKeyName = prop.key.content;
13658 result = props.properties.some(
13659 (p) => p.key.type === 4 && p.key.content === propKeyName
13660 );
13661 }
13662 return result;
13663 }
13664 function toValidAssetId(name, type) {
13665 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13666 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13667 })}`;
13668 }
13669 function getMemoedVNodeCall(node) {
13670 if (node.type === 14 && node.callee === WITH_MEMO) {
13671 return node.arguments[1].returns;
13672 } else {
13673 return node;
13674 }
13675 }
13676 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
13677
13678 const defaultParserOptions = {
13679 parseMode: "base",
13680 ns: 0,
13681 delimiters: [`{{`, `}}`],
13682 getNamespace: () => 0,
13683 isVoidTag: NO,
13684 isPreTag: NO,
13685 isIgnoreNewlineTag: NO,
13686 isCustomElement: NO,
13687 onError: defaultOnError,
13688 onWarn: defaultOnWarn,
13689 comments: true,
13690 prefixIdentifiers: false
13691 };
13692 let currentOptions = defaultParserOptions;
13693 let currentRoot = null;
13694 let currentInput = "";
13695 let currentOpenTag = null;
13696 let currentProp = null;
13697 let currentAttrValue = "";
13698 let currentAttrStartIndex = -1;
13699 let currentAttrEndIndex = -1;
13700 let inPre = 0;
13701 let inVPre = false;
13702 let currentVPreBoundary = null;
13703 const stack = [];
13704 const tokenizer = new Tokenizer(stack, {
13705 onerr: emitError,
13706 ontext(start, end) {
13707 onText(getSlice(start, end), start, end);
13708 },
13709 ontextentity(char, start, end) {
13710 onText(char, start, end);
13711 },
13712 oninterpolation(start, end) {
13713 if (inVPre) {
13714 return onText(getSlice(start, end), start, end);
13715 }
13716 let innerStart = start + tokenizer.delimiterOpen.length;
13717 let innerEnd = end - tokenizer.delimiterClose.length;
13718 while (isWhitespace(currentInput.charCodeAt(innerStart))) {
13719 innerStart++;
13720 }
13721 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
13722 innerEnd--;
13723 }
13724 let exp = getSlice(innerStart, innerEnd);
13725 if (exp.includes("&")) {
13726 {
13727 exp = currentOptions.decodeEntities(exp, false);
13728 }
13729 }
13730 addNode({
13731 type: 5,
13732 content: createExp(exp, false, getLoc(innerStart, innerEnd)),
13733 loc: getLoc(start, end)
13734 });
13735 },
13736 onopentagname(start, end) {
13737 const name = getSlice(start, end);
13738 currentOpenTag = {
13739 type: 1,
13740 tag: name,
13741 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
13742 tagType: 0,
13743 // will be refined on tag close
13744 props: [],
13745 children: [],
13746 loc: getLoc(start - 1, end),
13747 codegenNode: void 0
13748 };
13749 },
13750 onopentagend(end) {
13751 endOpenTag(end);
13752 },
13753 onclosetag(start, end) {
13754 const name = getSlice(start, end);
13755 if (!currentOptions.isVoidTag(name)) {
13756 let found = false;
13757 for (let i = 0; i < stack.length; i++) {
13758 const e = stack[i];
13759 if (e.tag.toLowerCase() === name.toLowerCase()) {
13760 found = true;
13761 if (i > 0) {
13762 emitError(24, stack[0].loc.start.offset);
13763 }
13764 for (let j = 0; j <= i; j++) {
13765 const el = stack.shift();
13766 onCloseTag(el, end, j < i);
13767 }
13768 break;
13769 }
13770 }
13771 if (!found) {
13772 emitError(23, backTrack(start, 60));
13773 }
13774 }
13775 },
13776 onselfclosingtag(end) {
13777 const name = currentOpenTag.tag;
13778 currentOpenTag.isSelfClosing = true;
13779 endOpenTag(end);
13780 if (stack[0] && stack[0].tag === name) {
13781 onCloseTag(stack.shift(), end);
13782 }
13783 },
13784 onattribname(start, end) {
13785 currentProp = {
13786 type: 6,
13787 name: getSlice(start, end),
13788 nameLoc: getLoc(start, end),
13789 value: void 0,
13790 loc: getLoc(start)
13791 };
13792 },
13793 ondirname(start, end) {
13794 const raw = getSlice(start, end);
13795 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
13796 if (!inVPre && name === "") {
13797 emitError(26, start);
13798 }
13799 if (inVPre || name === "") {
13800 currentProp = {
13801 type: 6,
13802 name: raw,
13803 nameLoc: getLoc(start, end),
13804 value: void 0,
13805 loc: getLoc(start)
13806 };
13807 } else {
13808 currentProp = {
13809 type: 7,
13810 name,
13811 rawName: raw,
13812 exp: void 0,
13813 arg: void 0,
13814 modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13815 loc: getLoc(start)
13816 };
13817 if (name === "pre") {
13818 inVPre = tokenizer.inVPre = true;
13819 currentVPreBoundary = currentOpenTag;
13820 const props = currentOpenTag.props;
13821 for (let i = 0; i < props.length; i++) {
13822 if (props[i].type === 7) {
13823 props[i] = dirToAttr(props[i]);
13824 }
13825 }
13826 }
13827 }
13828 },
13829 ondirarg(start, end) {
13830 if (start === end) return;
13831 const arg = getSlice(start, end);
13832 if (inVPre) {
13833 currentProp.name += arg;
13834 setLocEnd(currentProp.nameLoc, end);
13835 } else {
13836 const isStatic = arg[0] !== `[`;
13837 currentProp.arg = createExp(
13838 isStatic ? arg : arg.slice(1, -1),
13839 isStatic,
13840 getLoc(start, end),
13841 isStatic ? 3 : 0
13842 );
13843 }
13844 },
13845 ondirmodifier(start, end) {
13846 const mod = getSlice(start, end);
13847 if (inVPre) {
13848 currentProp.name += "." + mod;
13849 setLocEnd(currentProp.nameLoc, end);
13850 } else if (currentProp.name === "slot") {
13851 const arg = currentProp.arg;
13852 if (arg) {
13853 arg.content += "." + mod;
13854 setLocEnd(arg.loc, end);
13855 }
13856 } else {
13857 const exp = createSimpleExpression(mod, true, getLoc(start, end));
13858 currentProp.modifiers.push(exp);
13859 }
13860 },
13861 onattribdata(start, end) {
13862 currentAttrValue += getSlice(start, end);
13863 if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
13864 currentAttrEndIndex = end;
13865 },
13866 onattribentity(char, start, end) {
13867 currentAttrValue += char;
13868 if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
13869 currentAttrEndIndex = end;
13870 },
13871 onattribnameend(end) {
13872 const start = currentProp.loc.start.offset;
13873 const name = getSlice(start, end);
13874 if (currentProp.type === 7) {
13875 currentProp.rawName = name;
13876 }
13877 if (currentOpenTag.props.some(
13878 (p) => (p.type === 7 ? p.rawName : p.name) === name
13879 )) {
13880 emitError(2, start);
13881 }
13882 },
13883 onattribend(quote, end) {
13884 if (currentOpenTag && currentProp) {
13885 setLocEnd(currentProp.loc, end);
13886 if (quote !== 0) {
13887 if (currentAttrValue.includes("&")) {
13888 currentAttrValue = currentOptions.decodeEntities(
13889 currentAttrValue,
13890 true
13891 );
13892 }
13893 if (currentProp.type === 6) {
13894 if (currentProp.name === "class") {
13895 currentAttrValue = condense(currentAttrValue).trim();
13896 }
13897 if (quote === 1 && !currentAttrValue) {
13898 emitError(13, end);
13899 }
13900 currentProp.value = {
13901 type: 2,
13902 content: currentAttrValue,
13903 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
13904 };
13905 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
13906 tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
13907 }
13908 } else {
13909 let expParseMode = 0 /* Normal */;
13910 currentProp.exp = createExp(
13911 currentAttrValue,
13912 false,
13913 getLoc(currentAttrStartIndex, currentAttrEndIndex),
13914 0,
13915 expParseMode
13916 );
13917 if (currentProp.name === "for") {
13918 currentProp.forParseResult = parseForExpression(currentProp.exp);
13919 }
13920 }
13921 }
13922 if (currentProp.type !== 7 || currentProp.name !== "pre") {
13923 currentOpenTag.props.push(currentProp);
13924 }
13925 }
13926 currentAttrValue = "";
13927 currentAttrStartIndex = currentAttrEndIndex = -1;
13928 },
13929 oncomment(start, end) {
13930 if (currentOptions.comments) {
13931 addNode({
13932 type: 3,
13933 content: getSlice(start, end),
13934 loc: getLoc(start - 4, end + 3)
13935 });
13936 }
13937 },
13938 onend() {
13939 const end = currentInput.length;
13940 if (tokenizer.state !== 1) {
13941 switch (tokenizer.state) {
13942 case 5:
13943 case 8:
13944 emitError(5, end);
13945 break;
13946 case 3:
13947 case 4:
13948 emitError(
13949 25,
13950 tokenizer.sectionStart
13951 );
13952 break;
13953 case 28:
13954 if (tokenizer.currentSequence === Sequences.CdataEnd) {
13955 emitError(6, end);
13956 } else {
13957 emitError(7, end);
13958 }
13959 break;
13960 case 6:
13961 case 7:
13962 case 9:
13963 case 11:
13964 case 12:
13965 case 13:
13966 case 14:
13967 case 15:
13968 case 16:
13969 case 17:
13970 case 18:
13971 case 19:
13972 // "
13973 case 20:
13974 // '
13975 case 21:
13976 emitError(9, end);
13977 break;
13978 }
13979 }
13980 for (let index = 0; index < stack.length; index++) {
13981 onCloseTag(stack[index], end - 1);
13982 emitError(24, stack[index].loc.start.offset);
13983 }
13984 },
13985 oncdata(start, end) {
13986 if (stack[0].ns !== 0) {
13987 onText(getSlice(start, end), start, end);
13988 } else {
13989 emitError(1, start - 9);
13990 }
13991 },
13992 onprocessinginstruction(start) {
13993 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
13994 emitError(
13995 21,
13996 start - 1
13997 );
13998 }
13999 }
14000 });
14001 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14002 const stripParensRE = /^\(|\)$/g;
14003 function parseForExpression(input) {
14004 const loc = input.loc;
14005 const exp = input.content;
14006 const inMatch = exp.match(forAliasRE);
14007 if (!inMatch) return;
14008 const [, LHS, RHS] = inMatch;
14009 const createAliasExpression = (content, offset, asParam = false) => {
14010 const start = loc.start.offset + offset;
14011 const end = start + content.length;
14012 return createExp(
14013 content,
14014 false,
14015 getLoc(start, end),
14016 0,
14017 asParam ? 1 /* Params */ : 0 /* Normal */
14018 );
14019 };
14020 const result = {
14021 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14022 value: void 0,
14023 key: void 0,
14024 index: void 0,
14025 finalized: false
14026 };
14027 let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14028 const trimmedOffset = LHS.indexOf(valueContent);
14029 const iteratorMatch = valueContent.match(forIteratorRE);
14030 if (iteratorMatch) {
14031 valueContent = valueContent.replace(forIteratorRE, "").trim();
14032 const keyContent = iteratorMatch[1].trim();
14033 let keyOffset;
14034 if (keyContent) {
14035 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14036 result.key = createAliasExpression(keyContent, keyOffset, true);
14037 }
14038 if (iteratorMatch[2]) {
14039 const indexContent = iteratorMatch[2].trim();
14040 if (indexContent) {
14041 result.index = createAliasExpression(
14042 indexContent,
14043 exp.indexOf(
14044 indexContent,
14045 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14046 ),
14047 true
14048 );
14049 }
14050 }
14051 }
14052 if (valueContent) {
14053 result.value = createAliasExpression(valueContent, trimmedOffset, true);
14054 }
14055 return result;
14056 }
14057 function getSlice(start, end) {
14058 return currentInput.slice(start, end);
14059 }
14060 function endOpenTag(end) {
14061 if (tokenizer.inSFCRoot) {
14062 currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
14063 }
14064 addNode(currentOpenTag);
14065 const { tag, ns } = currentOpenTag;
14066 if (ns === 0 && currentOptions.isPreTag(tag)) {
14067 inPre++;
14068 }
14069 if (currentOptions.isVoidTag(tag)) {
14070 onCloseTag(currentOpenTag, end);
14071 } else {
14072 stack.unshift(currentOpenTag);
14073 if (ns === 1 || ns === 2) {
14074 tokenizer.inXML = true;
14075 }
14076 }
14077 currentOpenTag = null;
14078 }
14079 function onText(content, start, end) {
14080 {
14081 const tag = stack[0] && stack[0].tag;
14082 if (tag !== "script" && tag !== "style" && content.includes("&")) {
14083 content = currentOptions.decodeEntities(content, false);
14084 }
14085 }
14086 const parent = stack[0] || currentRoot;
14087 const lastNode = parent.children[parent.children.length - 1];
14088 if (lastNode && lastNode.type === 2) {
14089 lastNode.content += content;
14090 setLocEnd(lastNode.loc, end);
14091 } else {
14092 parent.children.push({
14093 type: 2,
14094 content,
14095 loc: getLoc(start, end)
14096 });
14097 }
14098 }
14099 function onCloseTag(el, end, isImplied = false) {
14100 if (isImplied) {
14101 setLocEnd(el.loc, backTrack(end, 60));
14102 } else {
14103 setLocEnd(el.loc, lookAhead(end, 62) + 1);
14104 }
14105 if (tokenizer.inSFCRoot) {
14106 if (el.children.length) {
14107 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14108 } else {
14109 el.innerLoc.end = extend({}, el.innerLoc.start);
14110 }
14111 el.innerLoc.source = getSlice(
14112 el.innerLoc.start.offset,
14113 el.innerLoc.end.offset
14114 );
14115 }
14116 const { tag, ns, children } = el;
14117 if (!inVPre) {
14118 if (tag === "slot") {
14119 el.tagType = 2;
14120 } else if (isFragmentTemplate(el)) {
14121 el.tagType = 3;
14122 } else if (isComponent(el)) {
14123 el.tagType = 1;
14124 }
14125 }
14126 if (!tokenizer.inRCDATA) {
14127 el.children = condenseWhitespace(children);
14128 }
14129 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14130 const first = children[0];
14131 if (first && first.type === 2) {
14132 first.content = first.content.replace(/^\r?\n/, "");
14133 }
14134 }
14135 if (ns === 0 && currentOptions.isPreTag(tag)) {
14136 inPre--;
14137 }
14138 if (currentVPreBoundary === el) {
14139 inVPre = tokenizer.inVPre = false;
14140 currentVPreBoundary = null;
14141 }
14142 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14143 tokenizer.inXML = false;
14144 }
14145 }
14146 function lookAhead(index, c) {
14147 let i = index;
14148 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
14149 return i;
14150 }
14151 function backTrack(index, c) {
14152 let i = index;
14153 while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
14154 return i;
14155 }
14156 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14157 function isFragmentTemplate({ tag, props }) {
14158 if (tag === "template") {
14159 for (let i = 0; i < props.length; i++) {
14160 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14161 return true;
14162 }
14163 }
14164 }
14165 return false;
14166 }
14167 function isComponent({ tag, props }) {
14168 if (currentOptions.isCustomElement(tag)) {
14169 return false;
14170 }
14171 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
14172 return true;
14173 }
14174 for (let i = 0; i < props.length; i++) {
14175 const p = props[i];
14176 if (p.type === 6) {
14177 if (p.name === "is" && p.value) {
14178 if (p.value.content.startsWith("vue:")) {
14179 return true;
14180 }
14181 }
14182 }
14183 }
14184 return false;
14185 }
14186 function isUpperCase(c) {
14187 return c > 64 && c < 91;
14188 }
14189 const windowsNewlineRE = /\r\n/g;
14190 function condenseWhitespace(nodes, tag) {
14191 const shouldCondense = currentOptions.whitespace !== "preserve";
14192 let removedWhitespace = false;
14193 for (let i = 0; i < nodes.length; i++) {
14194 const node = nodes[i];
14195 if (node.type === 2) {
14196 if (!inPre) {
14197 if (isAllWhitespace(node.content)) {
14198 const prev = nodes[i - 1] && nodes[i - 1].type;
14199 const next = nodes[i + 1] && nodes[i + 1].type;
14200 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14201 removedWhitespace = true;
14202 nodes[i] = null;
14203 } else {
14204 node.content = " ";
14205 }
14206 } else if (shouldCondense) {
14207 node.content = condense(node.content);
14208 }
14209 } else {
14210 node.content = node.content.replace(windowsNewlineRE, "\n");
14211 }
14212 }
14213 }
14214 return removedWhitespace ? nodes.filter(Boolean) : nodes;
14215 }
14216 function isAllWhitespace(str) {
14217 for (let i = 0; i < str.length; i++) {
14218 if (!isWhitespace(str.charCodeAt(i))) {
14219 return false;
14220 }
14221 }
14222 return true;
14223 }
14224 function hasNewlineChar(str) {
14225 for (let i = 0; i < str.length; i++) {
14226 const c = str.charCodeAt(i);
14227 if (c === 10 || c === 13) {
14228 return true;
14229 }
14230 }
14231 return false;
14232 }
14233 function condense(str) {
14234 let ret = "";
14235 let prevCharIsWhitespace = false;
14236 for (let i = 0; i < str.length; i++) {
14237 if (isWhitespace(str.charCodeAt(i))) {
14238 if (!prevCharIsWhitespace) {
14239 ret += " ";
14240 prevCharIsWhitespace = true;
14241 }
14242 } else {
14243 ret += str[i];
14244 prevCharIsWhitespace = false;
14245 }
14246 }
14247 return ret;
14248 }
14249 function addNode(node) {
14250 (stack[0] || currentRoot).children.push(node);
14251 }
14252 function getLoc(start, end) {
14253 return {
14254 start: tokenizer.getPos(start),
14255 // @ts-expect-error allow late attachment
14256 end: end == null ? end : tokenizer.getPos(end),
14257 // @ts-expect-error allow late attachment
14258 source: end == null ? end : getSlice(start, end)
14259 };
14260 }
14261 function cloneLoc(loc) {
14262 return getLoc(loc.start.offset, loc.end.offset);
14263 }
14264 function setLocEnd(loc, end) {
14265 loc.end = tokenizer.getPos(end);
14266 loc.source = getSlice(loc.start.offset, end);
14267 }
14268 function dirToAttr(dir) {
14269 const attr = {
14270 type: 6,
14271 name: dir.rawName,
14272 nameLoc: getLoc(
14273 dir.loc.start.offset,
14274 dir.loc.start.offset + dir.rawName.length
14275 ),
14276 value: void 0,
14277 loc: dir.loc
14278 };
14279 if (dir.exp) {
14280 const loc = dir.exp.loc;
14281 if (loc.end.offset < dir.loc.end.offset) {
14282 loc.start.offset--;
14283 loc.start.column--;
14284 loc.end.offset++;
14285 loc.end.column++;
14286 }
14287 attr.value = {
14288 type: 2,
14289 content: dir.exp.content,
14290 loc
14291 };
14292 }
14293 return attr;
14294 }
14295 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
14296 const exp = createSimpleExpression(content, isStatic, loc, constType);
14297 return exp;
14298 }
14299 function emitError(code, index, message) {
14300 currentOptions.onError(
14301 createCompilerError(code, getLoc(index, index), void 0, message)
14302 );
14303 }
14304 function reset() {
14305 tokenizer.reset();
14306 currentOpenTag = null;
14307 currentProp = null;
14308 currentAttrValue = "";
14309 currentAttrStartIndex = -1;
14310 currentAttrEndIndex = -1;
14311 stack.length = 0;
14312 }
14313 function baseParse(input, options) {
14314 reset();
14315 currentInput = input;
14316 currentOptions = extend({}, defaultParserOptions);
14317 if (options) {
14318 let key;
14319 for (key in options) {
14320 if (options[key] != null) {
14321 currentOptions[key] = options[key];
14322 }
14323 }
14324 }
14325 {
14326 if (!currentOptions.decodeEntities) {
14327 throw new Error(
14328 `[@vue/compiler-core] decodeEntities option is required in browser builds.`
14329 );
14330 }
14331 }
14332 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
14333 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
14334 const delimiters = options && options.delimiters;
14335 if (delimiters) {
14336 tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
14337 tokenizer.delimiterClose = toCharCodes(delimiters[1]);
14338 }
14339 const root = currentRoot = createRoot([], input);
14340 tokenizer.parse(currentInput);
14341 root.loc = getLoc(0, input.length);
14342 root.children = condenseWhitespace(root.children);
14343 currentRoot = null;
14344 return root;
14345 }
14346
14347 function cacheStatic(root, context) {
14348 walk(
14349 root,
14350 void 0,
14351 context,
14352 // Root node is unfortunately non-hoistable due to potential parent
14353 // fallthrough attributes.
14354 isSingleElementRoot(root, root.children[0])
14355 );
14356 }
14357 function isSingleElementRoot(root, child) {
14358 const { children } = root;
14359 return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14360 }
14361 function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14362 const { children } = node;
14363 const toCache = [];
14364 for (let i = 0; i < children.length; i++) {
14365 const child = children[i];
14366 if (child.type === 1 && child.tagType === 0) {
14367 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14368 if (constantType > 0) {
14369 if (constantType >= 2) {
14370 child.codegenNode.patchFlag = -1;
14371 toCache.push(child);
14372 continue;
14373 }
14374 } else {
14375 const codegenNode = child.codegenNode;
14376 if (codegenNode.type === 13) {
14377 const flag = codegenNode.patchFlag;
14378 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
14379 const props = getNodeProps(child);
14380 if (props) {
14381 codegenNode.props = context.hoist(props);
14382 }
14383 }
14384 if (codegenNode.dynamicProps) {
14385 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
14386 }
14387 }
14388 }
14389 } else if (child.type === 12) {
14390 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14391 if (constantType >= 2) {
14392 toCache.push(child);
14393 continue;
14394 }
14395 }
14396 if (child.type === 1) {
14397 const isComponent = child.tagType === 1;
14398 if (isComponent) {
14399 context.scopes.vSlot++;
14400 }
14401 walk(child, node, context, false, inFor);
14402 if (isComponent) {
14403 context.scopes.vSlot--;
14404 }
14405 } else if (child.type === 11) {
14406 walk(child, node, context, child.children.length === 1, true);
14407 } else if (child.type === 9) {
14408 for (let i2 = 0; i2 < child.branches.length; i2++) {
14409 walk(
14410 child.branches[i2],
14411 node,
14412 context,
14413 child.branches[i2].children.length === 1,
14414 inFor
14415 );
14416 }
14417 }
14418 }
14419 let cachedAsArray = false;
14420 if (toCache.length === children.length && node.type === 1) {
14421 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14422 node.codegenNode.children = getCacheExpression(
14423 createArrayExpression(node.codegenNode.children)
14424 );
14425 cachedAsArray = true;
14426 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14427 const slot = getSlotNode(node.codegenNode, "default");
14428 if (slot) {
14429 slot.returns = getCacheExpression(
14430 createArrayExpression(slot.returns)
14431 );
14432 cachedAsArray = true;
14433 }
14434 } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
14435 const slotName = findDir(node, "slot", true);
14436 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14437 if (slot) {
14438 slot.returns = getCacheExpression(
14439 createArrayExpression(slot.returns)
14440 );
14441 cachedAsArray = true;
14442 }
14443 }
14444 }
14445 if (!cachedAsArray) {
14446 for (const child of toCache) {
14447 child.codegenNode = context.cache(child.codegenNode);
14448 }
14449 }
14450 function getCacheExpression(value) {
14451 const exp = context.cache(value);
14452 if (inFor && context.hmr) {
14453 exp.needArraySpread = true;
14454 }
14455 return exp;
14456 }
14457 function getSlotNode(node2, name) {
14458 if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
14459 const slot = node2.children.properties.find(
14460 (p) => p.key === name || p.key.content === name
14461 );
14462 return slot && slot.value;
14463 }
14464 }
14465 if (toCache.length && context.transformHoist) {
14466 context.transformHoist(children, context, node);
14467 }
14468 }
14469 function getConstantType(node, context) {
14470 const { constantCache } = context;
14471 switch (node.type) {
14472 case 1:
14473 if (node.tagType !== 0) {
14474 return 0;
14475 }
14476 const cached = constantCache.get(node);
14477 if (cached !== void 0) {
14478 return cached;
14479 }
14480 const codegenNode = node.codegenNode;
14481 if (codegenNode.type !== 13) {
14482 return 0;
14483 }
14484 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
14485 return 0;
14486 }
14487 if (codegenNode.patchFlag === void 0) {
14488 let returnType2 = 3;
14489 const generatedPropsType = getGeneratedPropsConstantType(node, context);
14490 if (generatedPropsType === 0) {
14491 constantCache.set(node, 0);
14492 return 0;
14493 }
14494 if (generatedPropsType < returnType2) {
14495 returnType2 = generatedPropsType;
14496 }
14497 for (let i = 0; i < node.children.length; i++) {
14498 const childType = getConstantType(node.children[i], context);
14499 if (childType === 0) {
14500 constantCache.set(node, 0);
14501 return 0;
14502 }
14503 if (childType < returnType2) {
14504 returnType2 = childType;
14505 }
14506 }
14507 if (returnType2 > 1) {
14508 for (let i = 0; i < node.props.length; i++) {
14509 const p = node.props[i];
14510 if (p.type === 7 && p.name === "bind" && p.exp) {
14511 const expType = getConstantType(p.exp, context);
14512 if (expType === 0) {
14513 constantCache.set(node, 0);
14514 return 0;
14515 }
14516 if (expType < returnType2) {
14517 returnType2 = expType;
14518 }
14519 }
14520 }
14521 }
14522 if (codegenNode.isBlock) {
14523 for (let i = 0; i < node.props.length; i++) {
14524 const p = node.props[i];
14525 if (p.type === 7) {
14526 constantCache.set(node, 0);
14527 return 0;
14528 }
14529 }
14530 context.removeHelper(OPEN_BLOCK);
14531 context.removeHelper(
14532 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
14533 );
14534 codegenNode.isBlock = false;
14535 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
14536 }
14537 constantCache.set(node, returnType2);
14538 return returnType2;
14539 } else {
14540 constantCache.set(node, 0);
14541 return 0;
14542 }
14543 case 2:
14544 case 3:
14545 return 3;
14546 case 9:
14547 case 11:
14548 case 10:
14549 return 0;
14550 case 5:
14551 case 12:
14552 return getConstantType(node.content, context);
14553 case 4:
14554 return node.constType;
14555 case 8:
14556 let returnType = 3;
14557 for (let i = 0; i < node.children.length; i++) {
14558 const child = node.children[i];
14559 if (isString(child) || isSymbol(child)) {
14560 continue;
14561 }
14562 const childType = getConstantType(child, context);
14563 if (childType === 0) {
14564 return 0;
14565 } else if (childType < returnType) {
14566 returnType = childType;
14567 }
14568 }
14569 return returnType;
14570 case 20:
14571 return 2;
14572 default:
14573 return 0;
14574 }
14575 }
14576 const allowHoistedHelperSet = /* @__PURE__ */ new Set([
14577 NORMALIZE_CLASS,
14578 NORMALIZE_STYLE,
14579 NORMALIZE_PROPS,
14580 GUARD_REACTIVE_PROPS
14581 ]);
14582 function getConstantTypeOfHelperCall(value, context) {
14583 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
14584 const arg = value.arguments[0];
14585 if (arg.type === 4) {
14586 return getConstantType(arg, context);
14587 } else if (arg.type === 14) {
14588 return getConstantTypeOfHelperCall(arg, context);
14589 }
14590 }
14591 return 0;
14592 }
14593 function getGeneratedPropsConstantType(node, context) {
14594 let returnType = 3;
14595 const props = getNodeProps(node);
14596 if (props && props.type === 15) {
14597 const { properties } = props;
14598 for (let i = 0; i < properties.length; i++) {
14599 const { key, value } = properties[i];
14600 const keyType = getConstantType(key, context);
14601 if (keyType === 0) {
14602 return keyType;
14603 }
14604 if (keyType < returnType) {
14605 returnType = keyType;
14606 }
14607 let valueType;
14608 if (value.type === 4) {
14609 valueType = getConstantType(value, context);
14610 } else if (value.type === 14) {
14611 valueType = getConstantTypeOfHelperCall(value, context);
14612 } else {
14613 valueType = 0;
14614 }
14615 if (valueType === 0) {
14616 return valueType;
14617 }
14618 if (valueType < returnType) {
14619 returnType = valueType;
14620 }
14621 }
14622 }
14623 return returnType;
14624 }
14625 function getNodeProps(node) {
14626 const codegenNode = node.codegenNode;
14627 if (codegenNode.type === 13) {
14628 return codegenNode.props;
14629 }
14630 }
14631
14632 function createTransformContext(root, {
14633 filename = "",
14634 prefixIdentifiers = false,
14635 hoistStatic = false,
14636 hmr = false,
14637 cacheHandlers = false,
14638 nodeTransforms = [],
14639 directiveTransforms = {},
14640 transformHoist = null,
14641 isBuiltInComponent = NOOP,
14642 isCustomElement = NOOP,
14643 expressionPlugins = [],
14644 scopeId = null,
14645 slotted = true,
14646 ssr = false,
14647 inSSR = false,
14648 ssrCssVars = ``,
14649 bindingMetadata = EMPTY_OBJ,
14650 inline = false,
14651 isTS = false,
14652 onError = defaultOnError,
14653 onWarn = defaultOnWarn,
14654 compatConfig
14655 }) {
14656 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
14657 const context = {
14658 // options
14659 filename,
14660 selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14661 prefixIdentifiers,
14662 hoistStatic,
14663 hmr,
14664 cacheHandlers,
14665 nodeTransforms,
14666 directiveTransforms,
14667 transformHoist,
14668 isBuiltInComponent,
14669 isCustomElement,
14670 expressionPlugins,
14671 scopeId,
14672 slotted,
14673 ssr,
14674 inSSR,
14675 ssrCssVars,
14676 bindingMetadata,
14677 inline,
14678 isTS,
14679 onError,
14680 onWarn,
14681 compatConfig,
14682 // state
14683 root,
14684 helpers: /* @__PURE__ */ new Map(),
14685 components: /* @__PURE__ */ new Set(),
14686 directives: /* @__PURE__ */ new Set(),
14687 hoists: [],
14688 imports: [],
14689 cached: [],
14690 constantCache: /* @__PURE__ */ new WeakMap(),
14691 temps: 0,
14692 identifiers: /* @__PURE__ */ Object.create(null),
14693 scopes: {
14694 vFor: 0,
14695 vSlot: 0,
14696 vPre: 0,
14697 vOnce: 0
14698 },
14699 parent: null,
14700 grandParent: null,
14701 currentNode: root,
14702 childIndex: 0,
14703 inVOnce: false,
14704 // methods
14705 helper(name) {
14706 const count = context.helpers.get(name) || 0;
14707 context.helpers.set(name, count + 1);
14708 return name;
14709 },
14710 removeHelper(name) {
14711 const count = context.helpers.get(name);
14712 if (count) {
14713 const currentCount = count - 1;
14714 if (!currentCount) {
14715 context.helpers.delete(name);
14716 } else {
14717 context.helpers.set(name, currentCount);
14718 }
14719 }
14720 },
14721 helperString(name) {
14722 return `_${helperNameMap[context.helper(name)]}`;
14723 },
14724 replaceNode(node) {
14725 {
14726 if (!context.currentNode) {
14727 throw new Error(`Node being replaced is already removed.`);
14728 }
14729 if (!context.parent) {
14730 throw new Error(`Cannot replace root node.`);
14731 }
14732 }
14733 context.parent.children[context.childIndex] = context.currentNode = node;
14734 },
14735 removeNode(node) {
14736 if (!context.parent) {
14737 throw new Error(`Cannot remove root node.`);
14738 }
14739 const list = context.parent.children;
14740 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
14741 if (removalIndex < 0) {
14742 throw new Error(`node being removed is not a child of current parent`);
14743 }
14744 if (!node || node === context.currentNode) {
14745 context.currentNode = null;
14746 context.onNodeRemoved();
14747 } else {
14748 if (context.childIndex > removalIndex) {
14749 context.childIndex--;
14750 context.onNodeRemoved();
14751 }
14752 }
14753 context.parent.children.splice(removalIndex, 1);
14754 },
14755 onNodeRemoved: NOOP,
14756 addIdentifiers(exp) {
14757 },
14758 removeIdentifiers(exp) {
14759 },
14760 hoist(exp) {
14761 if (isString(exp)) exp = createSimpleExpression(exp);
14762 context.hoists.push(exp);
14763 const identifier = createSimpleExpression(
14764 `_hoisted_${context.hoists.length}`,
14765 false,
14766 exp.loc,
14767 2
14768 );
14769 identifier.hoisted = exp;
14770 return identifier;
14771 },
14772 cache(exp, isVNode = false, inVOnce = false) {
14773 const cacheExp = createCacheExpression(
14774 context.cached.length,
14775 exp,
14776 isVNode,
14777 inVOnce
14778 );
14779 context.cached.push(cacheExp);
14780 return cacheExp;
14781 }
14782 };
14783 return context;
14784 }
14785 function transform(root, options) {
14786 const context = createTransformContext(root, options);
14787 traverseNode(root, context);
14788 if (options.hoistStatic) {
14789 cacheStatic(root, context);
14790 }
14791 if (!options.ssr) {
14792 createRootCodegen(root, context);
14793 }
14794 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
14795 root.components = [...context.components];
14796 root.directives = [...context.directives];
14797 root.imports = context.imports;
14798 root.hoists = context.hoists;
14799 root.temps = context.temps;
14800 root.cached = context.cached;
14801 root.transformed = true;
14802 }
14803 function createRootCodegen(root, context) {
14804 const { helper } = context;
14805 const { children } = root;
14806 if (children.length === 1) {
14807 const child = children[0];
14808 if (isSingleElementRoot(root, child) && child.codegenNode) {
14809 const codegenNode = child.codegenNode;
14810 if (codegenNode.type === 13) {
14811 convertToBlock(codegenNode, context);
14812 }
14813 root.codegenNode = codegenNode;
14814 } else {
14815 root.codegenNode = child;
14816 }
14817 } else if (children.length > 1) {
14818 let patchFlag = 64;
14819 if (children.filter((c) => c.type !== 3).length === 1) {
14820 patchFlag |= 2048;
14821 }
14822 root.codegenNode = createVNodeCall(
14823 context,
14824 helper(FRAGMENT),
14825 void 0,
14826 root.children,
14827 patchFlag,
14828 void 0,
14829 void 0,
14830 true,
14831 void 0,
14832 false
14833 );
14834 } else ;
14835 }
14836 function traverseChildren(parent, context) {
14837 let i = 0;
14838 const nodeRemoved = () => {
14839 i--;
14840 };
14841 for (; i < parent.children.length; i++) {
14842 const child = parent.children[i];
14843 if (isString(child)) continue;
14844 context.grandParent = context.parent;
14845 context.parent = parent;
14846 context.childIndex = i;
14847 context.onNodeRemoved = nodeRemoved;
14848 traverseNode(child, context);
14849 }
14850 }
14851 function traverseNode(node, context) {
14852 context.currentNode = node;
14853 const { nodeTransforms } = context;
14854 const exitFns = [];
14855 for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
14856 const onExit = nodeTransforms[i2](node, context);
14857 if (onExit) {
14858 if (isArray(onExit)) {
14859 exitFns.push(...onExit);
14860 } else {
14861 exitFns.push(onExit);
14862 }
14863 }
14864 if (!context.currentNode) {
14865 return;
14866 } else {
14867 node = context.currentNode;
14868 }
14869 }
14870 switch (node.type) {
14871 case 3:
14872 if (!context.ssr) {
14873 context.helper(CREATE_COMMENT);
14874 }
14875 break;
14876 case 5:
14877 if (!context.ssr) {
14878 context.helper(TO_DISPLAY_STRING);
14879 }
14880 break;
14881 // for container types, further traverse downwards
14882 case 9:
14883 for (let i2 = 0; i2 < node.branches.length; i2++) {
14884 traverseNode(node.branches[i2], context);
14885 }
14886 break;
14887 case 10:
14888 case 11:
14889 case 1:
14890 case 0:
14891 traverseChildren(node, context);
14892 break;
14893 }
14894 context.currentNode = node;
14895 let i = exitFns.length;
14896 while (i--) {
14897 exitFns[i]();
14898 }
14899 }
14900 function createStructuralDirectiveTransform(name, fn) {
14901 const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
14902 return (node, context) => {
14903 if (node.type === 1) {
14904 const { props } = node;
14905 if (node.tagType === 3 && props.some(isVSlot)) {
14906 return;
14907 }
14908 const exitFns = [];
14909 for (let i = 0; i < props.length; i++) {
14910 const prop = props[i];
14911 if (prop.type === 7 && matches(prop.name)) {
14912 props.splice(i, 1);
14913 i--;
14914 const onExit = fn(node, prop, context);
14915 if (onExit) exitFns.push(onExit);
14916 }
14917 }
14918 return exitFns;
14919 }
14920 };
14921 }
14922
14923 const PURE_ANNOTATION = `/*@__PURE__*/`;
14924 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
14925 function createCodegenContext(ast, {
14926 mode = "function",
14927 prefixIdentifiers = mode === "module",
14928 sourceMap = false,
14929 filename = `template.vue.html`,
14930 scopeId = null,
14931 optimizeImports = false,
14932 runtimeGlobalName = `Vue`,
14933 runtimeModuleName = `vue`,
14934 ssrRuntimeModuleName = "vue/server-renderer",
14935 ssr = false,
14936 isTS = false,
14937 inSSR = false
14938 }) {
14939 const context = {
14940 mode,
14941 prefixIdentifiers,
14942 sourceMap,
14943 filename,
14944 scopeId,
14945 optimizeImports,
14946 runtimeGlobalName,
14947 runtimeModuleName,
14948 ssrRuntimeModuleName,
14949 ssr,
14950 isTS,
14951 inSSR,
14952 source: ast.source,
14953 code: ``,
14954 column: 1,
14955 line: 1,
14956 offset: 0,
14957 indentLevel: 0,
14958 pure: false,
14959 map: void 0,
14960 helper(key) {
14961 return `_${helperNameMap[key]}`;
14962 },
14963 push(code, newlineIndex = -2 /* None */, node) {
14964 context.code += code;
14965 },
14966 indent() {
14967 newline(++context.indentLevel);
14968 },
14969 deindent(withoutNewLine = false) {
14970 if (withoutNewLine) {
14971 --context.indentLevel;
14972 } else {
14973 newline(--context.indentLevel);
14974 }
14975 },
14976 newline() {
14977 newline(context.indentLevel);
14978 }
14979 };
14980 function newline(n) {
14981 context.push("\n" + ` `.repeat(n), 0 /* Start */);
14982 }
14983 return context;
14984 }
14985 function generate(ast, options = {}) {
14986 const context = createCodegenContext(ast, options);
14987 if (options.onContextCreated) options.onContextCreated(context);
14988 const {
14989 mode,
14990 push,
14991 prefixIdentifiers,
14992 indent,
14993 deindent,
14994 newline,
14995 scopeId,
14996 ssr
14997 } = context;
14998 const helpers = Array.from(ast.helpers);
14999 const hasHelpers = helpers.length > 0;
15000 const useWithBlock = !prefixIdentifiers && mode !== "module";
15001 const preambleContext = context;
15002 {
15003 genFunctionPreamble(ast, preambleContext);
15004 }
15005 const functionName = ssr ? `ssrRender` : `render`;
15006 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
15007 const signature = args.join(", ");
15008 {
15009 push(`function ${functionName}(${signature}) {`);
15010 }
15011 indent();
15012 if (useWithBlock) {
15013 push(`with (_ctx) {`);
15014 indent();
15015 if (hasHelpers) {
15016 push(
15017 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15018`,
15019 -1 /* End */
15020 );
15021 newline();
15022 }
15023 }
15024 if (ast.components.length) {
15025 genAssets(ast.components, "component", context);
15026 if (ast.directives.length || ast.temps > 0) {
15027 newline();
15028 }
15029 }
15030 if (ast.directives.length) {
15031 genAssets(ast.directives, "directive", context);
15032 if (ast.temps > 0) {
15033 newline();
15034 }
15035 }
15036 if (ast.temps > 0) {
15037 push(`let `);
15038 for (let i = 0; i < ast.temps; i++) {
15039 push(`${i > 0 ? `, ` : ``}_temp${i}`);
15040 }
15041 }
15042 if (ast.components.length || ast.directives.length || ast.temps) {
15043 push(`
15044`, 0 /* Start */);
15045 newline();
15046 }
15047 if (!ssr) {
15048 push(`return `);
15049 }
15050 if (ast.codegenNode) {
15051 genNode(ast.codegenNode, context);
15052 } else {
15053 push(`null`);
15054 }
15055 if (useWithBlock) {
15056 deindent();
15057 push(`}`);
15058 }
15059 deindent();
15060 push(`}`);
15061 return {
15062 ast,
15063 code: context.code,
15064 preamble: ``,
15065 map: context.map ? context.map.toJSON() : void 0
15066 };
15067 }
15068 function genFunctionPreamble(ast, context) {
15069 const {
15070 ssr,
15071 prefixIdentifiers,
15072 push,
15073 newline,
15074 runtimeModuleName,
15075 runtimeGlobalName,
15076 ssrRuntimeModuleName
15077 } = context;
15078 const VueBinding = runtimeGlobalName;
15079 const helpers = Array.from(ast.helpers);
15080 if (helpers.length > 0) {
15081 {
15082 push(`const _Vue = ${VueBinding}
15083`, -1 /* End */);
15084 if (ast.hoists.length) {
15085 const staticHelpers = [
15086 CREATE_VNODE,
15087 CREATE_ELEMENT_VNODE,
15088 CREATE_COMMENT,
15089 CREATE_TEXT,
15090 CREATE_STATIC
15091 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
15092 push(`const { ${staticHelpers} } = _Vue
15093`, -1 /* End */);
15094 }
15095 }
15096 }
15097 genHoists(ast.hoists, context);
15098 newline();
15099 push(`return `);
15100 }
15101 function genAssets(assets, type, { helper, push, newline, isTS }) {
15102 const resolver = helper(
15103 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
15104 );
15105 for (let i = 0; i < assets.length; i++) {
15106 let id = assets[i];
15107 const maybeSelfReference = id.endsWith("__self");
15108 if (maybeSelfReference) {
15109 id = id.slice(0, -6);
15110 }
15111 push(
15112 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
15113 );
15114 if (i < assets.length - 1) {
15115 newline();
15116 }
15117 }
15118 }
15119 function genHoists(hoists, context) {
15120 if (!hoists.length) {
15121 return;
15122 }
15123 context.pure = true;
15124 const { push, newline } = context;
15125 newline();
15126 for (let i = 0; i < hoists.length; i++) {
15127 const exp = hoists[i];
15128 if (exp) {
15129 push(`const _hoisted_${i + 1} = `);
15130 genNode(exp, context);
15131 newline();
15132 }
15133 }
15134 context.pure = false;
15135 }
15136 function isText(n) {
15137 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
15138 }
15139 function genNodeListAsArray(nodes, context) {
15140 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
15141 context.push(`[`);
15142 multilines && context.indent();
15143 genNodeList(nodes, context, multilines);
15144 multilines && context.deindent();
15145 context.push(`]`);
15146 }
15147 function genNodeList(nodes, context, multilines = false, comma = true) {
15148 const { push, newline } = context;
15149 for (let i = 0; i < nodes.length; i++) {
15150 const node = nodes[i];
15151 if (isString(node)) {
15152 push(node, -3 /* Unknown */);
15153 } else if (isArray(node)) {
15154 genNodeListAsArray(node, context);
15155 } else {
15156 genNode(node, context);
15157 }
15158 if (i < nodes.length - 1) {
15159 if (multilines) {
15160 comma && push(",");
15161 newline();
15162 } else {
15163 comma && push(", ");
15164 }
15165 }
15166 }
15167 }
15168 function genNode(node, context) {
15169 if (isString(node)) {
15170 context.push(node, -3 /* Unknown */);
15171 return;
15172 }
15173 if (isSymbol(node)) {
15174 context.push(context.helper(node));
15175 return;
15176 }
15177 switch (node.type) {
15178 case 1:
15179 case 9:
15180 case 11:
15181 assert(
15182 node.codegenNode != null,
15183 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
15184 );
15185 genNode(node.codegenNode, context);
15186 break;
15187 case 2:
15188 genText(node, context);
15189 break;
15190 case 4:
15191 genExpression(node, context);
15192 break;
15193 case 5:
15194 genInterpolation(node, context);
15195 break;
15196 case 12:
15197 genNode(node.codegenNode, context);
15198 break;
15199 case 8:
15200 genCompoundExpression(node, context);
15201 break;
15202 case 3:
15203 genComment(node, context);
15204 break;
15205 case 13:
15206 genVNodeCall(node, context);
15207 break;
15208 case 14:
15209 genCallExpression(node, context);
15210 break;
15211 case 15:
15212 genObjectExpression(node, context);
15213 break;
15214 case 17:
15215 genArrayExpression(node, context);
15216 break;
15217 case 18:
15218 genFunctionExpression(node, context);
15219 break;
15220 case 19:
15221 genConditionalExpression(node, context);
15222 break;
15223 case 20:
15224 genCacheExpression(node, context);
15225 break;
15226 case 21:
15227 genNodeList(node.body, context, true, false);
15228 break;
15229 // SSR only types
15230 case 22:
15231 break;
15232 case 23:
15233 break;
15234 case 24:
15235 break;
15236 case 25:
15237 break;
15238 case 26:
15239 break;
15240 /* v8 ignore start */
15241 case 10:
15242 break;
15243 default:
15244 {
15245 assert(false, `unhandled codegen node type: ${node.type}`);
15246 const exhaustiveCheck = node;
15247 return exhaustiveCheck;
15248 }
15249 }
15250 }
15251 function genText(node, context) {
15252 context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15253 }
15254 function genExpression(node, context) {
15255 const { content, isStatic } = node;
15256 context.push(
15257 isStatic ? JSON.stringify(content) : content,
15258 -3 /* Unknown */,
15259 node
15260 );
15261 }
15262 function genInterpolation(node, context) {
15263 const { push, helper, pure } = context;
15264 if (pure) push(PURE_ANNOTATION);
15265 push(`${helper(TO_DISPLAY_STRING)}(`);
15266 genNode(node.content, context);
15267 push(`)`);
15268 }
15269 function genCompoundExpression(node, context) {
15270 for (let i = 0; i < node.children.length; i++) {
15271 const child = node.children[i];
15272 if (isString(child)) {
15273 context.push(child, -3 /* Unknown */);
15274 } else {
15275 genNode(child, context);
15276 }
15277 }
15278 }
15279 function genExpressionAsPropertyKey(node, context) {
15280 const { push } = context;
15281 if (node.type === 8) {
15282 push(`[`);
15283 genCompoundExpression(node, context);
15284 push(`]`);
15285 } else if (node.isStatic) {
15286 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15287 push(text, -2 /* None */, node);
15288 } else {
15289 push(`[${node.content}]`, -3 /* Unknown */, node);
15290 }
15291 }
15292 function genComment(node, context) {
15293 const { push, helper, pure } = context;
15294 if (pure) {
15295 push(PURE_ANNOTATION);
15296 }
15297 push(
15298 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15299 -3 /* Unknown */,
15300 node
15301 );
15302 }
15303 function genVNodeCall(node, context) {
15304 const { push, helper, pure } = context;
15305 const {
15306 tag,
15307 props,
15308 children,
15309 patchFlag,
15310 dynamicProps,
15311 directives,
15312 isBlock,
15313 disableTracking,
15314 isComponent
15315 } = node;
15316 let patchFlagString;
15317 if (patchFlag) {
15318 {
15319 if (patchFlag < 0) {
15320 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
15321 } else {
15322 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
15323 patchFlagString = patchFlag + ` /* ${flagNames} */`;
15324 }
15325 }
15326 }
15327 if (directives) {
15328 push(helper(WITH_DIRECTIVES) + `(`);
15329 }
15330 if (isBlock) {
15331 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
15332 }
15333 if (pure) {
15334 push(PURE_ANNOTATION);
15335 }
15336 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15337 push(helper(callHelper) + `(`, -2 /* None */, node);
15338 genNodeList(
15339 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
15340 context
15341 );
15342 push(`)`);
15343 if (isBlock) {
15344 push(`)`);
15345 }
15346 if (directives) {
15347 push(`, `);
15348 genNode(directives, context);
15349 push(`)`);
15350 }
15351 }
15352 function genNullableArgs(args) {
15353 let i = args.length;
15354 while (i--) {
15355 if (args[i] != null) break;
15356 }
15357 return args.slice(0, i + 1).map((arg) => arg || `null`);
15358 }
15359 function genCallExpression(node, context) {
15360 const { push, helper, pure } = context;
15361 const callee = isString(node.callee) ? node.callee : helper(node.callee);
15362 if (pure) {
15363 push(PURE_ANNOTATION);
15364 }
15365 push(callee + `(`, -2 /* None */, node);
15366 genNodeList(node.arguments, context);
15367 push(`)`);
15368 }
15369 function genObjectExpression(node, context) {
15370 const { push, indent, deindent, newline } = context;
15371 const { properties } = node;
15372 if (!properties.length) {
15373 push(`{}`, -2 /* None */, node);
15374 return;
15375 }
15376 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
15377 push(multilines ? `{` : `{ `);
15378 multilines && indent();
15379 for (let i = 0; i < properties.length; i++) {
15380 const { key, value } = properties[i];
15381 genExpressionAsPropertyKey(key, context);
15382 push(`: `);
15383 genNode(value, context);
15384 if (i < properties.length - 1) {
15385 push(`,`);
15386 newline();
15387 }
15388 }
15389 multilines && deindent();
15390 push(multilines ? `}` : ` }`);
15391 }
15392 function genArrayExpression(node, context) {
15393 genNodeListAsArray(node.elements, context);
15394 }
15395 function genFunctionExpression(node, context) {
15396 const { push, indent, deindent } = context;
15397 const { params, returns, body, newline, isSlot } = node;
15398 if (isSlot) {
15399 push(`_${helperNameMap[WITH_CTX]}(`);
15400 }
15401 push(`(`, -2 /* None */, node);
15402 if (isArray(params)) {
15403 genNodeList(params, context);
15404 } else if (params) {
15405 genNode(params, context);
15406 }
15407 push(`) => `);
15408 if (newline || body) {
15409 push(`{`);
15410 indent();
15411 }
15412 if (returns) {
15413 if (newline) {
15414 push(`return `);
15415 }
15416 if (isArray(returns)) {
15417 genNodeListAsArray(returns, context);
15418 } else {
15419 genNode(returns, context);
15420 }
15421 } else if (body) {
15422 genNode(body, context);
15423 }
15424 if (newline || body) {
15425 deindent();
15426 push(`}`);
15427 }
15428 if (isSlot) {
15429 push(`)`);
15430 }
15431 }
15432 function genConditionalExpression(node, context) {
15433 const { test, consequent, alternate, newline: needNewline } = node;
15434 const { push, indent, deindent, newline } = context;
15435 if (test.type === 4) {
15436 const needsParens = !isSimpleIdentifier(test.content);
15437 needsParens && push(`(`);
15438 genExpression(test, context);
15439 needsParens && push(`)`);
15440 } else {
15441 push(`(`);
15442 genNode(test, context);
15443 push(`)`);
15444 }
15445 needNewline && indent();
15446 context.indentLevel++;
15447 needNewline || push(` `);
15448 push(`? `);
15449 genNode(consequent, context);
15450 context.indentLevel--;
15451 needNewline && newline();
15452 needNewline || push(` `);
15453 push(`: `);
15454 const isNested = alternate.type === 19;
15455 if (!isNested) {
15456 context.indentLevel++;
15457 }
15458 genNode(alternate, context);
15459 if (!isNested) {
15460 context.indentLevel--;
15461 }
15462 needNewline && deindent(
15463 true
15464 /* without newline */
15465 );
15466 }
15467 function genCacheExpression(node, context) {
15468 const { push, helper, indent, deindent, newline } = context;
15469 const { needPauseTracking, needArraySpread } = node;
15470 if (needArraySpread) {
15471 push(`[...(`);
15472 }
15473 push(`_cache[${node.index}] || (`);
15474 if (needPauseTracking) {
15475 indent();
15476 push(`${helper(SET_BLOCK_TRACKING)}(-1`);
15477 if (node.inVOnce) push(`, true`);
15478 push(`),`);
15479 newline();
15480 push(`(`);
15481 }
15482 push(`_cache[${node.index}] = `);
15483 genNode(node.value, context);
15484 if (needPauseTracking) {
15485 push(`).cacheIndex = ${node.index},`);
15486 newline();
15487 push(`${helper(SET_BLOCK_TRACKING)}(1),`);
15488 newline();
15489 push(`_cache[${node.index}]`);
15490 deindent();
15491 }
15492 push(`)`);
15493 if (needArraySpread) {
15494 push(`)]`);
15495 }
15496 }
15497
15498 const prohibitedKeywordRE = new RegExp(
15499 "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
15500 );
15501 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
15502 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
15503 const exp = node.content;
15504 if (!exp.trim()) {
15505 return;
15506 }
15507 try {
15508 new Function(
15509 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
15510 );
15511 } catch (e) {
15512 let message = e.message;
15513 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
15514 if (keywordMatch) {
15515 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
15516 }
15517 context.onError(
15518 createCompilerError(
15519 45,
15520 node.loc,
15521 void 0,
15522 message
15523 )
15524 );
15525 }
15526 }
15527
15528 const transformExpression = (node, context) => {
15529 if (node.type === 5) {
15530 node.content = processExpression(
15531 node.content,
15532 context
15533 );
15534 } else if (node.type === 1) {
15535 const memo = findDir(node, "memo");
15536 for (let i = 0; i < node.props.length; i++) {
15537 const dir = node.props[i];
15538 if (dir.type === 7 && dir.name !== "for") {
15539 const exp = dir.exp;
15540 const arg = dir.arg;
15541 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
15542 !(memo && arg && arg.type === 4 && arg.content === "key")) {
15543 dir.exp = processExpression(
15544 exp,
15545 context,
15546 // slot args must be processed as function params
15547 dir.name === "slot"
15548 );
15549 }
15550 if (arg && arg.type === 4 && !arg.isStatic) {
15551 dir.arg = processExpression(arg, context);
15552 }
15553 }
15554 }
15555 }
15556 };
15557 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
15558 {
15559 {
15560 validateBrowserExpression(node, context, asParams, asRawStatements);
15561 }
15562 return node;
15563 }
15564 }
15565
15566 const transformIf = createStructuralDirectiveTransform(
15567 /^(if|else|else-if)$/,
15568 (node, dir, context) => {
15569 return processIf(node, dir, context, (ifNode, branch, isRoot) => {
15570 const siblings = context.parent.children;
15571 let i = siblings.indexOf(ifNode);
15572 let key = 0;
15573 while (i-- >= 0) {
15574 const sibling = siblings[i];
15575 if (sibling && sibling.type === 9) {
15576 key += sibling.branches.length;
15577 }
15578 }
15579 return () => {
15580 if (isRoot) {
15581 ifNode.codegenNode = createCodegenNodeForBranch(
15582 branch,
15583 key,
15584 context
15585 );
15586 } else {
15587 const parentCondition = getParentCondition(ifNode.codegenNode);
15588 parentCondition.alternate = createCodegenNodeForBranch(
15589 branch,
15590 key + ifNode.branches.length - 1,
15591 context
15592 );
15593 }
15594 };
15595 });
15596 }
15597 );
15598 function processIf(node, dir, context, processCodegen) {
15599 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
15600 const loc = dir.exp ? dir.exp.loc : node.loc;
15601 context.onError(
15602 createCompilerError(28, dir.loc)
15603 );
15604 dir.exp = createSimpleExpression(`true`, false, loc);
15605 }
15606 if (dir.exp) {
15607 validateBrowserExpression(dir.exp, context);
15608 }
15609 if (dir.name === "if") {
15610 const branch = createIfBranch(node, dir);
15611 const ifNode = {
15612 type: 9,
15613 loc: cloneLoc(node.loc),
15614 branches: [branch]
15615 };
15616 context.replaceNode(ifNode);
15617 if (processCodegen) {
15618 return processCodegen(ifNode, branch, true);
15619 }
15620 } else {
15621 const siblings = context.parent.children;
15622 const comments = [];
15623 let i = siblings.indexOf(node);
15624 while (i-- >= -1) {
15625 const sibling = siblings[i];
15626 if (sibling && sibling.type === 3) {
15627 context.removeNode(sibling);
15628 comments.unshift(sibling);
15629 continue;
15630 }
15631 if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
15632 context.removeNode(sibling);
15633 continue;
15634 }
15635 if (sibling && sibling.type === 9) {
15636 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
15637 context.onError(
15638 createCompilerError(30, node.loc)
15639 );
15640 }
15641 context.removeNode();
15642 const branch = createIfBranch(node, dir);
15643 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15644 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15645 branch.children = [...comments, ...branch.children];
15646 }
15647 {
15648 const key = branch.userKey;
15649 if (key) {
15650 sibling.branches.forEach(({ userKey }) => {
15651 if (isSameKey(userKey, key)) {
15652 context.onError(
15653 createCompilerError(
15654 29,
15655 branch.userKey.loc
15656 )
15657 );
15658 }
15659 });
15660 }
15661 }
15662 sibling.branches.push(branch);
15663 const onExit = processCodegen && processCodegen(sibling, branch, false);
15664 traverseNode(branch, context);
15665 if (onExit) onExit();
15666 context.currentNode = null;
15667 } else {
15668 context.onError(
15669 createCompilerError(30, node.loc)
15670 );
15671 }
15672 break;
15673 }
15674 }
15675 }
15676 function createIfBranch(node, dir) {
15677 const isTemplateIf = node.tagType === 3;
15678 return {
15679 type: 10,
15680 loc: node.loc,
15681 condition: dir.name === "else" ? void 0 : dir.exp,
15682 children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
15683 userKey: findProp(node, `key`),
15684 isTemplateIf
15685 };
15686 }
15687 function createCodegenNodeForBranch(branch, keyIndex, context) {
15688 if (branch.condition) {
15689 return createConditionalExpression(
15690 branch.condition,
15691 createChildrenCodegenNode(branch, keyIndex, context),
15692 // make sure to pass in asBlock: true so that the comment node call
15693 // closes the current block.
15694 createCallExpression(context.helper(CREATE_COMMENT), [
15695 '"v-if"' ,
15696 "true"
15697 ])
15698 );
15699 } else {
15700 return createChildrenCodegenNode(branch, keyIndex, context);
15701 }
15702 }
15703 function createChildrenCodegenNode(branch, keyIndex, context) {
15704 const { helper } = context;
15705 const keyProperty = createObjectProperty(
15706 `key`,
15707 createSimpleExpression(
15708 `${keyIndex}`,
15709 false,
15710 locStub,
15711 2
15712 )
15713 );
15714 const { children } = branch;
15715 const firstChild = children[0];
15716 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
15717 if (needFragmentWrapper) {
15718 if (children.length === 1 && firstChild.type === 11) {
15719 const vnodeCall = firstChild.codegenNode;
15720 injectProp(vnodeCall, keyProperty, context);
15721 return vnodeCall;
15722 } else {
15723 let patchFlag = 64;
15724 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
15725 patchFlag |= 2048;
15726 }
15727 return createVNodeCall(
15728 context,
15729 helper(FRAGMENT),
15730 createObjectExpression([keyProperty]),
15731 children,
15732 patchFlag,
15733 void 0,
15734 void 0,
15735 true,
15736 false,
15737 false,
15738 branch.loc
15739 );
15740 }
15741 } else {
15742 const ret = firstChild.codegenNode;
15743 const vnodeCall = getMemoedVNodeCall(ret);
15744 if (vnodeCall.type === 13) {
15745 convertToBlock(vnodeCall, context);
15746 }
15747 injectProp(vnodeCall, keyProperty, context);
15748 return ret;
15749 }
15750 }
15751 function isSameKey(a, b) {
15752 if (!a || a.type !== b.type) {
15753 return false;
15754 }
15755 if (a.type === 6) {
15756 if (a.value.content !== b.value.content) {
15757 return false;
15758 }
15759 } else {
15760 const exp = a.exp;
15761 const branchExp = b.exp;
15762 if (exp.type !== branchExp.type) {
15763 return false;
15764 }
15765 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
15766 return false;
15767 }
15768 }
15769 return true;
15770 }
15771 function getParentCondition(node) {
15772 while (true) {
15773 if (node.type === 19) {
15774 if (node.alternate.type === 19) {
15775 node = node.alternate;
15776 } else {
15777 return node;
15778 }
15779 } else if (node.type === 20) {
15780 node = node.value;
15781 }
15782 }
15783 }
15784
15785 const transformBind = (dir, _node, context) => {
15786 const { modifiers, loc } = dir;
15787 const arg = dir.arg;
15788 let { exp } = dir;
15789 if (exp && exp.type === 4 && !exp.content.trim()) {
15790 {
15791 exp = void 0;
15792 }
15793 }
15794 if (!exp) {
15795 if (arg.type !== 4 || !arg.isStatic) {
15796 context.onError(
15797 createCompilerError(
15798 52,
15799 arg.loc
15800 )
15801 );
15802 return {
15803 props: [
15804 createObjectProperty(arg, createSimpleExpression("", true, loc))
15805 ]
15806 };
15807 }
15808 transformBindShorthand(dir);
15809 exp = dir.exp;
15810 }
15811 if (arg.type !== 4) {
15812 arg.children.unshift(`(`);
15813 arg.children.push(`) || ""`);
15814 } else if (!arg.isStatic) {
15815 arg.content = `${arg.content} || ""`;
15816 }
15817 if (modifiers.some((mod) => mod.content === "camel")) {
15818 if (arg.type === 4) {
15819 if (arg.isStatic) {
15820 arg.content = camelize(arg.content);
15821 } else {
15822 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
15823 }
15824 } else {
15825 arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
15826 arg.children.push(`)`);
15827 }
15828 }
15829 if (!context.inSSR) {
15830 if (modifiers.some((mod) => mod.content === "prop")) {
15831 injectPrefix(arg, ".");
15832 }
15833 if (modifiers.some((mod) => mod.content === "attr")) {
15834 injectPrefix(arg, "^");
15835 }
15836 }
15837 return {
15838 props: [createObjectProperty(arg, exp)]
15839 };
15840 };
15841 const transformBindShorthand = (dir, context) => {
15842 const arg = dir.arg;
15843 const propName = camelize(arg.content);
15844 dir.exp = createSimpleExpression(propName, false, arg.loc);
15845 };
15846 const injectPrefix = (arg, prefix) => {
15847 if (arg.type === 4) {
15848 if (arg.isStatic) {
15849 arg.content = prefix + arg.content;
15850 } else {
15851 arg.content = `\`${prefix}\${${arg.content}}\``;
15852 }
15853 } else {
15854 arg.children.unshift(`'${prefix}' + (`);
15855 arg.children.push(`)`);
15856 }
15857 };
15858
15859 const transformFor = createStructuralDirectiveTransform(
15860 "for",
15861 (node, dir, context) => {
15862 const { helper, removeHelper } = context;
15863 return processFor(node, dir, context, (forNode) => {
15864 const renderExp = createCallExpression(helper(RENDER_LIST), [
15865 forNode.source
15866 ]);
15867 const isTemplate = isTemplateNode(node);
15868 const memo = findDir(node, "memo");
15869 const keyProp = findProp(node, `key`, false, true);
15870 const isDirKey = keyProp && keyProp.type === 7;
15871 if (isDirKey && !keyProp.exp) {
15872 transformBindShorthand(keyProp);
15873 }
15874 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
15875 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
15876 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
15877 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
15878 forNode.codegenNode = createVNodeCall(
15879 context,
15880 helper(FRAGMENT),
15881 void 0,
15882 renderExp,
15883 fragmentFlag,
15884 void 0,
15885 void 0,
15886 true,
15887 !isStableFragment,
15888 false,
15889 node.loc
15890 );
15891 return () => {
15892 let childBlock;
15893 const { children } = forNode;
15894 if (isTemplate) {
15895 node.children.some((c) => {
15896 if (c.type === 1) {
15897 const key = findProp(c, "key");
15898 if (key) {
15899 context.onError(
15900 createCompilerError(
15901 33,
15902 key.loc
15903 )
15904 );
15905 return true;
15906 }
15907 }
15908 });
15909 }
15910 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
15911 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
15912 if (slotOutlet) {
15913 childBlock = slotOutlet.codegenNode;
15914 if (isTemplate && keyProperty) {
15915 injectProp(childBlock, keyProperty, context);
15916 }
15917 } else if (needFragmentWrapper) {
15918 childBlock = createVNodeCall(
15919 context,
15920 helper(FRAGMENT),
15921 keyProperty ? createObjectExpression([keyProperty]) : void 0,
15922 node.children,
15923 64,
15924 void 0,
15925 void 0,
15926 true,
15927 void 0,
15928 false
15929 );
15930 } else {
15931 childBlock = children[0].codegenNode;
15932 if (isTemplate && keyProperty) {
15933 injectProp(childBlock, keyProperty, context);
15934 }
15935 if (childBlock.isBlock !== !isStableFragment) {
15936 if (childBlock.isBlock) {
15937 removeHelper(OPEN_BLOCK);
15938 removeHelper(
15939 getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
15940 );
15941 } else {
15942 removeHelper(
15943 getVNodeHelper(context.inSSR, childBlock.isComponent)
15944 );
15945 }
15946 }
15947 childBlock.isBlock = !isStableFragment;
15948 if (childBlock.isBlock) {
15949 helper(OPEN_BLOCK);
15950 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
15951 } else {
15952 helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
15953 }
15954 }
15955 if (memo) {
15956 const loop = createFunctionExpression(
15957 createForLoopParams(forNode.parseResult, [
15958 createSimpleExpression(`_cached`)
15959 ])
15960 );
15961 loop.body = createBlockStatement([
15962 createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
15963 createCompoundExpression([
15964 `if (_cached`,
15965 ...keyExp ? [` && _cached.key === `, keyExp] : [],
15966 ` && ${context.helperString(
15967 IS_MEMO_SAME
15968 )}(_cached, _memo)) return _cached`
15969 ]),
15970 createCompoundExpression([`const _item = `, childBlock]),
15971 createSimpleExpression(`_item.memo = _memo`),
15972 createSimpleExpression(`return _item`)
15973 ]);
15974 renderExp.arguments.push(
15975 loop,
15976 createSimpleExpression(`_cache`),
15977 createSimpleExpression(String(context.cached.length))
15978 );
15979 context.cached.push(null);
15980 } else {
15981 renderExp.arguments.push(
15982 createFunctionExpression(
15983 createForLoopParams(forNode.parseResult),
15984 childBlock,
15985 true
15986 )
15987 );
15988 }
15989 };
15990 });
15991 }
15992 );
15993 function processFor(node, dir, context, processCodegen) {
15994 if (!dir.exp) {
15995 context.onError(
15996 createCompilerError(31, dir.loc)
15997 );
15998 return;
15999 }
16000 const parseResult = dir.forParseResult;
16001 if (!parseResult) {
16002 context.onError(
16003 createCompilerError(32, dir.loc)
16004 );
16005 return;
16006 }
16007 finalizeForParseResult(parseResult, context);
16008 const { addIdentifiers, removeIdentifiers, scopes } = context;
16009 const { source, value, key, index } = parseResult;
16010 const forNode = {
16011 type: 11,
16012 loc: dir.loc,
16013 source,
16014 valueAlias: value,
16015 keyAlias: key,
16016 objectIndexAlias: index,
16017 parseResult,
16018 children: isTemplateNode(node) ? node.children : [node]
16019 };
16020 context.replaceNode(forNode);
16021 scopes.vFor++;
16022 const onExit = processCodegen && processCodegen(forNode);
16023 return () => {
16024 scopes.vFor--;
16025 if (onExit) onExit();
16026 };
16027 }
16028 function finalizeForParseResult(result, context) {
16029 if (result.finalized) return;
16030 {
16031 validateBrowserExpression(result.source, context);
16032 if (result.key) {
16033 validateBrowserExpression(
16034 result.key,
16035 context,
16036 true
16037 );
16038 }
16039 if (result.index) {
16040 validateBrowserExpression(
16041 result.index,
16042 context,
16043 true
16044 );
16045 }
16046 if (result.value) {
16047 validateBrowserExpression(
16048 result.value,
16049 context,
16050 true
16051 );
16052 }
16053 }
16054 result.finalized = true;
16055 }
16056 function createForLoopParams({ value, key, index }, memoArgs = []) {
16057 return createParamsList([value, key, index, ...memoArgs]);
16058 }
16059 function createParamsList(args) {
16060 let i = args.length;
16061 while (i--) {
16062 if (args[i]) break;
16063 }
16064 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
16065 }
16066
16067 const defaultFallback = createSimpleExpression(`undefined`, false);
16068 const trackSlotScopes = (node, context) => {
16069 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
16070 const vSlot = findDir(node, "slot");
16071 if (vSlot) {
16072 vSlot.exp;
16073 context.scopes.vSlot++;
16074 return () => {
16075 context.scopes.vSlot--;
16076 };
16077 }
16078 }
16079 };
16080 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
16081 props,
16082 children,
16083 false,
16084 true,
16085 children.length ? children[0].loc : loc
16086 );
16087 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16088 context.helper(WITH_CTX);
16089 const { children, loc } = node;
16090 const slotsProperties = [];
16091 const dynamicSlots = [];
16092 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
16093 const onComponentSlot = findDir(node, "slot", true);
16094 if (onComponentSlot) {
16095 const { arg, exp } = onComponentSlot;
16096 if (arg && !isStaticExp(arg)) {
16097 hasDynamicSlots = true;
16098 }
16099 slotsProperties.push(
16100 createObjectProperty(
16101 arg || createSimpleExpression("default", true),
16102 buildSlotFn(exp, void 0, children, loc)
16103 )
16104 );
16105 }
16106 let hasTemplateSlots = false;
16107 let hasNamedDefaultSlot = false;
16108 const implicitDefaultChildren = [];
16109 const seenSlotNames = /* @__PURE__ */ new Set();
16110 let conditionalBranchIndex = 0;
16111 for (let i = 0; i < children.length; i++) {
16112 const slotElement = children[i];
16113 let slotDir;
16114 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
16115 if (slotElement.type !== 3) {
16116 implicitDefaultChildren.push(slotElement);
16117 }
16118 continue;
16119 }
16120 if (onComponentSlot) {
16121 context.onError(
16122 createCompilerError(37, slotDir.loc)
16123 );
16124 break;
16125 }
16126 hasTemplateSlots = true;
16127 const { children: slotChildren, loc: slotLoc } = slotElement;
16128 const {
16129 arg: slotName = createSimpleExpression(`default`, true),
16130 exp: slotProps,
16131 loc: dirLoc
16132 } = slotDir;
16133 let staticSlotName;
16134 if (isStaticExp(slotName)) {
16135 staticSlotName = slotName ? slotName.content : `default`;
16136 } else {
16137 hasDynamicSlots = true;
16138 }
16139 const vFor = findDir(slotElement, "for");
16140 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
16141 let vIf;
16142 let vElse;
16143 if (vIf = findDir(slotElement, "if")) {
16144 hasDynamicSlots = true;
16145 dynamicSlots.push(
16146 createConditionalExpression(
16147 vIf.exp,
16148 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
16149 defaultFallback
16150 )
16151 );
16152 } else if (vElse = findDir(
16153 slotElement,
16154 /^else(-if)?$/,
16155 true
16156 /* allowEmpty */
16157 )) {
16158 let j = i;
16159 let prev;
16160 while (j--) {
16161 prev = children[j];
16162 if (prev.type !== 3) {
16163 break;
16164 }
16165 }
16166 if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
16167 let conditional = dynamicSlots[dynamicSlots.length - 1];
16168 while (conditional.alternate.type === 19) {
16169 conditional = conditional.alternate;
16170 }
16171 conditional.alternate = vElse.exp ? createConditionalExpression(
16172 vElse.exp,
16173 buildDynamicSlot(
16174 slotName,
16175 slotFunction,
16176 conditionalBranchIndex++
16177 ),
16178 defaultFallback
16179 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
16180 } else {
16181 context.onError(
16182 createCompilerError(30, vElse.loc)
16183 );
16184 }
16185 } else if (vFor) {
16186 hasDynamicSlots = true;
16187 const parseResult = vFor.forParseResult;
16188 if (parseResult) {
16189 finalizeForParseResult(parseResult, context);
16190 dynamicSlots.push(
16191 createCallExpression(context.helper(RENDER_LIST), [
16192 parseResult.source,
16193 createFunctionExpression(
16194 createForLoopParams(parseResult),
16195 buildDynamicSlot(slotName, slotFunction),
16196 true
16197 )
16198 ])
16199 );
16200 } else {
16201 context.onError(
16202 createCompilerError(
16203 32,
16204 vFor.loc
16205 )
16206 );
16207 }
16208 } else {
16209 if (staticSlotName) {
16210 if (seenSlotNames.has(staticSlotName)) {
16211 context.onError(
16212 createCompilerError(
16213 38,
16214 dirLoc
16215 )
16216 );
16217 continue;
16218 }
16219 seenSlotNames.add(staticSlotName);
16220 if (staticSlotName === "default") {
16221 hasNamedDefaultSlot = true;
16222 }
16223 }
16224 slotsProperties.push(createObjectProperty(slotName, slotFunction));
16225 }
16226 }
16227 if (!onComponentSlot) {
16228 const buildDefaultSlotProperty = (props, children2) => {
16229 const fn = buildSlotFn(props, void 0, children2, loc);
16230 return createObjectProperty(`default`, fn);
16231 };
16232 if (!hasTemplateSlots) {
16233 slotsProperties.push(buildDefaultSlotProperty(void 0, children));
16234 } else if (implicitDefaultChildren.length && // #3766
16235 // with whitespace: 'preserve', whitespaces between slots will end up in
16236 // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
16237 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
16238 if (hasNamedDefaultSlot) {
16239 context.onError(
16240 createCompilerError(
16241 39,
16242 implicitDefaultChildren[0].loc
16243 )
16244 );
16245 } else {
16246 slotsProperties.push(
16247 buildDefaultSlotProperty(void 0, implicitDefaultChildren)
16248 );
16249 }
16250 }
16251 }
16252 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
16253 let slots = createObjectExpression(
16254 slotsProperties.concat(
16255 createObjectProperty(
16256 `_`,
16257 // 2 = compiled but dynamic = can skip normalization, but must run diff
16258 // 1 = compiled and static = can skip normalization AND diff as optimized
16259 createSimpleExpression(
16260 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
16261 false
16262 )
16263 )
16264 ),
16265 loc
16266 );
16267 if (dynamicSlots.length) {
16268 slots = createCallExpression(context.helper(CREATE_SLOTS), [
16269 slots,
16270 createArrayExpression(dynamicSlots)
16271 ]);
16272 }
16273 return {
16274 slots,
16275 hasDynamicSlots
16276 };
16277 }
16278 function buildDynamicSlot(name, fn, index) {
16279 const props = [
16280 createObjectProperty(`name`, name),
16281 createObjectProperty(`fn`, fn)
16282 ];
16283 if (index != null) {
16284 props.push(
16285 createObjectProperty(`key`, createSimpleExpression(String(index), true))
16286 );
16287 }
16288 return createObjectExpression(props);
16289 }
16290 function hasForwardedSlots(children) {
16291 for (let i = 0; i < children.length; i++) {
16292 const child = children[i];
16293 switch (child.type) {
16294 case 1:
16295 if (child.tagType === 2 || hasForwardedSlots(child.children)) {
16296 return true;
16297 }
16298 break;
16299 case 9:
16300 if (hasForwardedSlots(child.branches)) return true;
16301 break;
16302 case 10:
16303 case 11:
16304 if (hasForwardedSlots(child.children)) return true;
16305 break;
16306 }
16307 }
16308 return false;
16309 }
16310 function isNonWhitespaceContent(node) {
16311 if (node.type !== 2 && node.type !== 12)
16312 return true;
16313 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
16314 }
16315
16316 const directiveImportMap = /* @__PURE__ */ new WeakMap();
16317 const transformElement = (node, context) => {
16318 return function postTransformElement() {
16319 node = context.currentNode;
16320 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
16321 return;
16322 }
16323 const { tag, props } = node;
16324 const isComponent = node.tagType === 1;
16325 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
16326 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
16327 let vnodeProps;
16328 let vnodeChildren;
16329 let patchFlag = 0;
16330 let vnodeDynamicProps;
16331 let dynamicPropNames;
16332 let vnodeDirectives;
16333 let shouldUseBlock = (
16334 // dynamic component may resolve to plain elements
16335 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
16336 // updates inside get proper isSVG flag at runtime. (#639, #643)
16337 // This is technically web-specific, but splitting the logic out of core
16338 // leads to too much unnecessary complexity.
16339 (tag === "svg" || tag === "foreignObject" || tag === "math")
16340 );
16341 if (props.length > 0) {
16342 const propsBuildResult = buildProps(
16343 node,
16344 context,
16345 void 0,
16346 isComponent,
16347 isDynamicComponent
16348 );
16349 vnodeProps = propsBuildResult.props;
16350 patchFlag = propsBuildResult.patchFlag;
16351 dynamicPropNames = propsBuildResult.dynamicPropNames;
16352 const directives = propsBuildResult.directives;
16353 vnodeDirectives = directives && directives.length ? createArrayExpression(
16354 directives.map((dir) => buildDirectiveArgs(dir, context))
16355 ) : void 0;
16356 if (propsBuildResult.shouldUseBlock) {
16357 shouldUseBlock = true;
16358 }
16359 }
16360 if (node.children.length > 0) {
16361 if (vnodeTag === KEEP_ALIVE) {
16362 shouldUseBlock = true;
16363 patchFlag |= 1024;
16364 if (node.children.length > 1) {
16365 context.onError(
16366 createCompilerError(46, {
16367 start: node.children[0].loc.start,
16368 end: node.children[node.children.length - 1].loc.end,
16369 source: ""
16370 })
16371 );
16372 }
16373 }
16374 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
16375 vnodeTag !== TELEPORT && // explained above.
16376 vnodeTag !== KEEP_ALIVE;
16377 if (shouldBuildAsSlots) {
16378 const { slots, hasDynamicSlots } = buildSlots(node, context);
16379 vnodeChildren = slots;
16380 if (hasDynamicSlots) {
16381 patchFlag |= 1024;
16382 }
16383 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
16384 const child = node.children[0];
16385 const type = child.type;
16386 const hasDynamicTextChild = type === 5 || type === 8;
16387 if (hasDynamicTextChild && getConstantType(child, context) === 0) {
16388 patchFlag |= 1;
16389 }
16390 if (hasDynamicTextChild || type === 2) {
16391 vnodeChildren = child;
16392 } else {
16393 vnodeChildren = node.children;
16394 }
16395 } else {
16396 vnodeChildren = node.children;
16397 }
16398 }
16399 if (dynamicPropNames && dynamicPropNames.length) {
16400 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
16401 }
16402 node.codegenNode = createVNodeCall(
16403 context,
16404 vnodeTag,
16405 vnodeProps,
16406 vnodeChildren,
16407 patchFlag === 0 ? void 0 : patchFlag,
16408 vnodeDynamicProps,
16409 vnodeDirectives,
16410 !!shouldUseBlock,
16411 false,
16412 isComponent,
16413 node.loc
16414 );
16415 };
16416 };
16417 function resolveComponentType(node, context, ssr = false) {
16418 let { tag } = node;
16419 const isExplicitDynamic = isComponentTag(tag);
16420 const isProp = findProp(
16421 node,
16422 "is",
16423 false,
16424 true
16425 /* allow empty */
16426 );
16427 if (isProp) {
16428 if (isExplicitDynamic || false) {
16429 let exp;
16430 if (isProp.type === 6) {
16431 exp = isProp.value && createSimpleExpression(isProp.value.content, true);
16432 } else {
16433 exp = isProp.exp;
16434 if (!exp) {
16435 exp = createSimpleExpression(`is`, false, isProp.arg.loc);
16436 }
16437 }
16438 if (exp) {
16439 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16440 exp
16441 ]);
16442 }
16443 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
16444 tag = isProp.value.content.slice(4);
16445 }
16446 }
16447 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16448 if (builtIn) {
16449 if (!ssr) context.helper(builtIn);
16450 return builtIn;
16451 }
16452 context.helper(RESOLVE_COMPONENT);
16453 context.components.add(tag);
16454 return toValidAssetId(tag, `component`);
16455 }
16456 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
16457 const { tag, loc: elementLoc, children } = node;
16458 let properties = [];
16459 const mergeArgs = [];
16460 const runtimeDirectives = [];
16461 const hasChildren = children.length > 0;
16462 let shouldUseBlock = false;
16463 let patchFlag = 0;
16464 let hasRef = false;
16465 let hasClassBinding = false;
16466 let hasStyleBinding = false;
16467 let hasHydrationEventBinding = false;
16468 let hasDynamicKeys = false;
16469 let hasVnodeHook = false;
16470 const dynamicPropNames = [];
16471 const pushMergeArg = (arg) => {
16472 if (properties.length) {
16473 mergeArgs.push(
16474 createObjectExpression(dedupeProperties(properties), elementLoc)
16475 );
16476 properties = [];
16477 }
16478 if (arg) mergeArgs.push(arg);
16479 };
16480 const pushRefVForMarker = () => {
16481 if (context.scopes.vFor > 0) {
16482 properties.push(
16483 createObjectProperty(
16484 createSimpleExpression("ref_for", true),
16485 createSimpleExpression("true")
16486 )
16487 );
16488 }
16489 };
16490 const analyzePatchFlag = ({ key, value }) => {
16491 if (isStaticExp(key)) {
16492 const name = key.content;
16493 const isEventHandler = isOn(name);
16494 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
16495 // dedicated fast path.
16496 name.toLowerCase() !== "onclick" && // omit v-model handlers
16497 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
16498 !isReservedProp(name)) {
16499 hasHydrationEventBinding = true;
16500 }
16501 if (isEventHandler && isReservedProp(name)) {
16502 hasVnodeHook = true;
16503 }
16504 if (isEventHandler && value.type === 14) {
16505 value = value.arguments[0];
16506 }
16507 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
16508 return;
16509 }
16510 if (name === "ref") {
16511 hasRef = true;
16512 } else if (name === "class") {
16513 hasClassBinding = true;
16514 } else if (name === "style") {
16515 hasStyleBinding = true;
16516 } else if (name !== "key" && !dynamicPropNames.includes(name)) {
16517 dynamicPropNames.push(name);
16518 }
16519 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
16520 dynamicPropNames.push(name);
16521 }
16522 } else {
16523 hasDynamicKeys = true;
16524 }
16525 };
16526 for (let i = 0; i < props.length; i++) {
16527 const prop = props[i];
16528 if (prop.type === 6) {
16529 const { loc, name, nameLoc, value } = prop;
16530 let isStatic = true;
16531 if (name === "ref") {
16532 hasRef = true;
16533 pushRefVForMarker();
16534 }
16535 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
16536 continue;
16537 }
16538 properties.push(
16539 createObjectProperty(
16540 createSimpleExpression(name, true, nameLoc),
16541 createSimpleExpression(
16542 value ? value.content : "",
16543 isStatic,
16544 value ? value.loc : loc
16545 )
16546 )
16547 );
16548 } else {
16549 const { name, arg, exp, loc, modifiers } = prop;
16550 const isVBind = name === "bind";
16551 const isVOn = name === "on";
16552 if (name === "slot") {
16553 if (!isComponent) {
16554 context.onError(
16555 createCompilerError(40, loc)
16556 );
16557 }
16558 continue;
16559 }
16560 if (name === "once" || name === "memo") {
16561 continue;
16562 }
16563 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
16564 continue;
16565 }
16566 if (isVOn && ssr) {
16567 continue;
16568 }
16569 if (
16570 // #938: elements with dynamic keys should be forced into blocks
16571 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
16572 // before children
16573 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
16574 ) {
16575 shouldUseBlock = true;
16576 }
16577 if (isVBind && isStaticArgOf(arg, "ref")) {
16578 pushRefVForMarker();
16579 }
16580 if (!arg && (isVBind || isVOn)) {
16581 hasDynamicKeys = true;
16582 if (exp) {
16583 if (isVBind) {
16584 pushRefVForMarker();
16585 pushMergeArg();
16586 mergeArgs.push(exp);
16587 } else {
16588 pushMergeArg({
16589 type: 14,
16590 loc,
16591 callee: context.helper(TO_HANDLERS),
16592 arguments: isComponent ? [exp] : [exp, `true`]
16593 });
16594 }
16595 } else {
16596 context.onError(
16597 createCompilerError(
16598 isVBind ? 34 : 35,
16599 loc
16600 )
16601 );
16602 }
16603 continue;
16604 }
16605 if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16606 patchFlag |= 32;
16607 }
16608 const directiveTransform = context.directiveTransforms[name];
16609 if (directiveTransform) {
16610 const { props: props2, needRuntime } = directiveTransform(prop, node, context);
16611 !ssr && props2.forEach(analyzePatchFlag);
16612 if (isVOn && arg && !isStaticExp(arg)) {
16613 pushMergeArg(createObjectExpression(props2, elementLoc));
16614 } else {
16615 properties.push(...props2);
16616 }
16617 if (needRuntime) {
16618 runtimeDirectives.push(prop);
16619 if (isSymbol(needRuntime)) {
16620 directiveImportMap.set(prop, needRuntime);
16621 }
16622 }
16623 } else if (!isBuiltInDirective(name)) {
16624 runtimeDirectives.push(prop);
16625 if (hasChildren) {
16626 shouldUseBlock = true;
16627 }
16628 }
16629 }
16630 }
16631 let propsExpression = void 0;
16632 if (mergeArgs.length) {
16633 pushMergeArg();
16634 if (mergeArgs.length > 1) {
16635 propsExpression = createCallExpression(
16636 context.helper(MERGE_PROPS),
16637 mergeArgs,
16638 elementLoc
16639 );
16640 } else {
16641 propsExpression = mergeArgs[0];
16642 }
16643 } else if (properties.length) {
16644 propsExpression = createObjectExpression(
16645 dedupeProperties(properties),
16646 elementLoc
16647 );
16648 }
16649 if (hasDynamicKeys) {
16650 patchFlag |= 16;
16651 } else {
16652 if (hasClassBinding && !isComponent) {
16653 patchFlag |= 2;
16654 }
16655 if (hasStyleBinding && !isComponent) {
16656 patchFlag |= 4;
16657 }
16658 if (dynamicPropNames.length) {
16659 patchFlag |= 8;
16660 }
16661 if (hasHydrationEventBinding) {
16662 patchFlag |= 32;
16663 }
16664 }
16665 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16666 patchFlag |= 512;
16667 }
16668 if (!context.inSSR && propsExpression) {
16669 switch (propsExpression.type) {
16670 case 15:
16671 let classKeyIndex = -1;
16672 let styleKeyIndex = -1;
16673 let hasDynamicKey = false;
16674 for (let i = 0; i < propsExpression.properties.length; i++) {
16675 const key = propsExpression.properties[i].key;
16676 if (isStaticExp(key)) {
16677 if (key.content === "class") {
16678 classKeyIndex = i;
16679 } else if (key.content === "style") {
16680 styleKeyIndex = i;
16681 }
16682 } else if (!key.isHandlerKey) {
16683 hasDynamicKey = true;
16684 }
16685 }
16686 const classProp = propsExpression.properties[classKeyIndex];
16687 const styleProp = propsExpression.properties[styleKeyIndex];
16688 if (!hasDynamicKey) {
16689 if (classProp && !isStaticExp(classProp.value)) {
16690 classProp.value = createCallExpression(
16691 context.helper(NORMALIZE_CLASS),
16692 [classProp.value]
16693 );
16694 }
16695 if (styleProp && // the static style is compiled into an object,
16696 // so use `hasStyleBinding` to ensure that it is a dynamic style binding
16697 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
16698 // v-bind:style with static literal object
16699 styleProp.value.type === 17)) {
16700 styleProp.value = createCallExpression(
16701 context.helper(NORMALIZE_STYLE),
16702 [styleProp.value]
16703 );
16704 }
16705 } else {
16706 propsExpression = createCallExpression(
16707 context.helper(NORMALIZE_PROPS),
16708 [propsExpression]
16709 );
16710 }
16711 break;
16712 case 14:
16713 break;
16714 default:
16715 propsExpression = createCallExpression(
16716 context.helper(NORMALIZE_PROPS),
16717 [
16718 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
16719 propsExpression
16720 ])
16721 ]
16722 );
16723 break;
16724 }
16725 }
16726 return {
16727 props: propsExpression,
16728 directives: runtimeDirectives,
16729 patchFlag,
16730 dynamicPropNames,
16731 shouldUseBlock
16732 };
16733 }
16734 function dedupeProperties(properties) {
16735 const knownProps = /* @__PURE__ */ new Map();
16736 const deduped = [];
16737 for (let i = 0; i < properties.length; i++) {
16738 const prop = properties[i];
16739 if (prop.key.type === 8 || !prop.key.isStatic) {
16740 deduped.push(prop);
16741 continue;
16742 }
16743 const name = prop.key.content;
16744 const existing = knownProps.get(name);
16745 if (existing) {
16746 if (name === "style" || name === "class" || isOn(name)) {
16747 mergeAsArray(existing, prop);
16748 }
16749 } else {
16750 knownProps.set(name, prop);
16751 deduped.push(prop);
16752 }
16753 }
16754 return deduped;
16755 }
16756 function mergeAsArray(existing, incoming) {
16757 if (existing.value.type === 17) {
16758 existing.value.elements.push(incoming.value);
16759 } else {
16760 existing.value = createArrayExpression(
16761 [existing.value, incoming.value],
16762 existing.loc
16763 );
16764 }
16765 }
16766 function buildDirectiveArgs(dir, context) {
16767 const dirArgs = [];
16768 const runtime = directiveImportMap.get(dir);
16769 if (runtime) {
16770 dirArgs.push(context.helperString(runtime));
16771 } else {
16772 {
16773 context.helper(RESOLVE_DIRECTIVE);
16774 context.directives.add(dir.name);
16775 dirArgs.push(toValidAssetId(dir.name, `directive`));
16776 }
16777 }
16778 const { loc } = dir;
16779 if (dir.exp) dirArgs.push(dir.exp);
16780 if (dir.arg) {
16781 if (!dir.exp) {
16782 dirArgs.push(`void 0`);
16783 }
16784 dirArgs.push(dir.arg);
16785 }
16786 if (Object.keys(dir.modifiers).length) {
16787 if (!dir.arg) {
16788 if (!dir.exp) {
16789 dirArgs.push(`void 0`);
16790 }
16791 dirArgs.push(`void 0`);
16792 }
16793 const trueExpression = createSimpleExpression(`true`, false, loc);
16794 dirArgs.push(
16795 createObjectExpression(
16796 dir.modifiers.map(
16797 (modifier) => createObjectProperty(modifier, trueExpression)
16798 ),
16799 loc
16800 )
16801 );
16802 }
16803 return createArrayExpression(dirArgs, dir.loc);
16804 }
16805 function stringifyDynamicPropNames(props) {
16806 let propsNamesString = `[`;
16807 for (let i = 0, l = props.length; i < l; i++) {
16808 propsNamesString += JSON.stringify(props[i]);
16809 if (i < l - 1) propsNamesString += ", ";
16810 }
16811 return propsNamesString + `]`;
16812 }
16813 function isComponentTag(tag) {
16814 return tag === "component" || tag === "Component";
16815 }
16816
16817 const transformSlotOutlet = (node, context) => {
16818 if (isSlotOutlet(node)) {
16819 const { children, loc } = node;
16820 const { slotName, slotProps } = processSlotOutlet(node, context);
16821 const slotArgs = [
16822 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
16823 slotName,
16824 "{}",
16825 "undefined",
16826 "true"
16827 ];
16828 let expectedLen = 2;
16829 if (slotProps) {
16830 slotArgs[2] = slotProps;
16831 expectedLen = 3;
16832 }
16833 if (children.length) {
16834 slotArgs[3] = createFunctionExpression([], children, false, false, loc);
16835 expectedLen = 4;
16836 }
16837 if (context.scopeId && !context.slotted) {
16838 expectedLen = 5;
16839 }
16840 slotArgs.splice(expectedLen);
16841 node.codegenNode = createCallExpression(
16842 context.helper(RENDER_SLOT),
16843 slotArgs,
16844 loc
16845 );
16846 }
16847 };
16848 function processSlotOutlet(node, context) {
16849 let slotName = `"default"`;
16850 let slotProps = void 0;
16851 const nonNameProps = [];
16852 for (let i = 0; i < node.props.length; i++) {
16853 const p = node.props[i];
16854 if (p.type === 6) {
16855 if (p.value) {
16856 if (p.name === "name") {
16857 slotName = JSON.stringify(p.value.content);
16858 } else {
16859 p.name = camelize(p.name);
16860 nonNameProps.push(p);
16861 }
16862 }
16863 } else {
16864 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
16865 if (p.exp) {
16866 slotName = p.exp;
16867 } else if (p.arg && p.arg.type === 4) {
16868 const name = camelize(p.arg.content);
16869 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
16870 }
16871 } else {
16872 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
16873 p.arg.content = camelize(p.arg.content);
16874 }
16875 nonNameProps.push(p);
16876 }
16877 }
16878 }
16879 if (nonNameProps.length > 0) {
16880 const { props, directives } = buildProps(
16881 node,
16882 context,
16883 nonNameProps,
16884 false,
16885 false
16886 );
16887 slotProps = props;
16888 if (directives.length) {
16889 context.onError(
16890 createCompilerError(
16891 36,
16892 directives[0].loc
16893 )
16894 );
16895 }
16896 }
16897 return {
16898 slotName,
16899 slotProps
16900 };
16901 }
16902
16903 const transformOn$1 = (dir, node, context, augmentor) => {
16904 const { loc, modifiers, arg } = dir;
16905 if (!dir.exp && !modifiers.length) {
16906 context.onError(createCompilerError(35, loc));
16907 }
16908 let eventName;
16909 if (arg.type === 4) {
16910 if (arg.isStatic) {
16911 let rawName = arg.content;
16912 if (rawName.startsWith("vnode")) {
16913 context.onError(createCompilerError(51, arg.loc));
16914 }
16915 if (rawName.startsWith("vue:")) {
16916 rawName = `vnode-${rawName.slice(4)}`;
16917 }
16918 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
16919 // for non-element and vnode lifecycle event listeners, auto convert
16920 // it to camelCase. See issue #2249
16921 toHandlerKey(camelize(rawName))
16922 ) : (
16923 // preserve case for plain element listeners that have uppercase
16924 // letters, as these may be custom elements' custom events
16925 `on:${rawName}`
16926 );
16927 eventName = createSimpleExpression(eventString, true, arg.loc);
16928 } else {
16929 eventName = createCompoundExpression([
16930 `${context.helperString(TO_HANDLER_KEY)}(`,
16931 arg,
16932 `)`
16933 ]);
16934 }
16935 } else {
16936 eventName = arg;
16937 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
16938 eventName.children.push(`)`);
16939 }
16940 let exp = dir.exp;
16941 if (exp && !exp.content.trim()) {
16942 exp = void 0;
16943 }
16944 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
16945 if (exp) {
16946 const isMemberExp = isMemberExpression(exp);
16947 const isInlineStatement = !(isMemberExp || isFnExpression(exp));
16948 const hasMultipleStatements = exp.content.includes(`;`);
16949 {
16950 validateBrowserExpression(
16951 exp,
16952 context,
16953 false,
16954 hasMultipleStatements
16955 );
16956 }
16957 if (isInlineStatement || shouldCache && isMemberExp) {
16958 exp = createCompoundExpression([
16959 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
16960 exp,
16961 hasMultipleStatements ? `}` : `)`
16962 ]);
16963 }
16964 }
16965 let ret = {
16966 props: [
16967 createObjectProperty(
16968 eventName,
16969 exp || createSimpleExpression(`() => {}`, false, loc)
16970 )
16971 ]
16972 };
16973 if (augmentor) {
16974 ret = augmentor(ret);
16975 }
16976 if (shouldCache) {
16977 ret.props[0].value = context.cache(ret.props[0].value);
16978 }
16979 ret.props.forEach((p) => p.key.isHandlerKey = true);
16980 return ret;
16981 };
16982
16983 const transformText = (node, context) => {
16984 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
16985 return () => {
16986 const children = node.children;
16987 let currentContainer = void 0;
16988 let hasText = false;
16989 for (let i = 0; i < children.length; i++) {
16990 const child = children[i];
16991 if (isText$1(child)) {
16992 hasText = true;
16993 for (let j = i + 1; j < children.length; j++) {
16994 const next = children[j];
16995 if (isText$1(next)) {
16996 if (!currentContainer) {
16997 currentContainer = children[i] = createCompoundExpression(
16998 [child],
16999 child.loc
17000 );
17001 }
17002 currentContainer.children.push(` + `, next);
17003 children.splice(j, 1);
17004 j--;
17005 } else {
17006 currentContainer = void 0;
17007 break;
17008 }
17009 }
17010 }
17011 }
17012 if (!hasText || // if this is a plain element with a single text child, leave it
17013 // as-is since the runtime has dedicated fast path for this by directly
17014 // setting textContent of the element.
17015 // for component root it's always normalized anyway.
17016 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
17017 // custom directives can potentially add DOM elements arbitrarily,
17018 // we need to avoid setting textContent of the element at runtime
17019 // to avoid accidentally overwriting the DOM elements added
17020 // by the user through custom directives.
17021 !node.props.find(
17022 (p) => p.type === 7 && !context.directiveTransforms[p.name]
17023 ) && // in compat mode, <template> tags with no special directives
17024 // will be rendered as a fragment so its children must be
17025 // converted into vnodes.
17026 true)) {
17027 return;
17028 }
17029 for (let i = 0; i < children.length; i++) {
17030 const child = children[i];
17031 if (isText$1(child) || child.type === 8) {
17032 const callArgs = [];
17033 if (child.type !== 2 || child.content !== " ") {
17034 callArgs.push(child);
17035 }
17036 if (!context.ssr && getConstantType(child, context) === 0) {
17037 callArgs.push(
17038 1 + (` /* ${PatchFlagNames[1]} */` )
17039 );
17040 }
17041 children[i] = {
17042 type: 12,
17043 content: child,
17044 loc: child.loc,
17045 codegenNode: createCallExpression(
17046 context.helper(CREATE_TEXT),
17047 callArgs
17048 )
17049 };
17050 }
17051 }
17052 };
17053 }
17054 };
17055
17056 const seen$1 = /* @__PURE__ */ new WeakSet();
17057 const transformOnce = (node, context) => {
17058 if (node.type === 1 && findDir(node, "once", true)) {
17059 if (seen$1.has(node) || context.inVOnce || context.inSSR) {
17060 return;
17061 }
17062 seen$1.add(node);
17063 context.inVOnce = true;
17064 context.helper(SET_BLOCK_TRACKING);
17065 return () => {
17066 context.inVOnce = false;
17067 const cur = context.currentNode;
17068 if (cur.codegenNode) {
17069 cur.codegenNode = context.cache(
17070 cur.codegenNode,
17071 true,
17072 true
17073 );
17074 }
17075 };
17076 }
17077 };
17078
17079 const transformModel$1 = (dir, node, context) => {
17080 const { exp, arg } = dir;
17081 if (!exp) {
17082 context.onError(
17083 createCompilerError(41, dir.loc)
17084 );
17085 return createTransformProps();
17086 }
17087 const rawExp = exp.loc.source.trim();
17088 const expString = exp.type === 4 ? exp.content : rawExp;
17089 const bindingType = context.bindingMetadata[rawExp];
17090 if (bindingType === "props" || bindingType === "props-aliased") {
17091 context.onError(createCompilerError(44, exp.loc));
17092 return createTransformProps();
17093 }
17094 const maybeRef = false;
17095 if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
17096 context.onError(
17097 createCompilerError(42, exp.loc)
17098 );
17099 return createTransformProps();
17100 }
17101 const propName = arg ? arg : createSimpleExpression("modelValue", true);
17102 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
17103 let assignmentExp;
17104 const eventArg = context.isTS ? `($event: any)` : `$event`;
17105 {
17106 assignmentExp = createCompoundExpression([
17107 `${eventArg} => ((`,
17108 exp,
17109 `) = $event)`
17110 ]);
17111 }
17112 const props = [
17113 // modelValue: foo
17114 createObjectProperty(propName, dir.exp),
17115 // "onUpdate:modelValue": $event => (foo = $event)
17116 createObjectProperty(eventName, assignmentExp)
17117 ];
17118 if (dir.modifiers.length && node.tagType === 1) {
17119 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17120 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17121 props.push(
17122 createObjectProperty(
17123 modifiersKey,
17124 createSimpleExpression(
17125 `{ ${modifiers} }`,
17126 false,
17127 dir.loc,
17128 2
17129 )
17130 )
17131 );
17132 }
17133 return createTransformProps(props);
17134 };
17135 function createTransformProps(props = []) {
17136 return { props };
17137 }
17138
17139 const seen = /* @__PURE__ */ new WeakSet();
17140 const transformMemo = (node, context) => {
17141 if (node.type === 1) {
17142 const dir = findDir(node, "memo");
17143 if (!dir || seen.has(node)) {
17144 return;
17145 }
17146 seen.add(node);
17147 return () => {
17148 const codegenNode = node.codegenNode || context.currentNode.codegenNode;
17149 if (codegenNode && codegenNode.type === 13) {
17150 if (node.tagType !== 1) {
17151 convertToBlock(codegenNode, context);
17152 }
17153 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
17154 dir.exp,
17155 createFunctionExpression(void 0, codegenNode),
17156 `_cache`,
17157 String(context.cached.length)
17158 ]);
17159 context.cached.push(null);
17160 }
17161 };
17162 }
17163 };
17164
17165 function getBaseTransformPreset(prefixIdentifiers) {
17166 return [
17167 [
17168 transformOnce,
17169 transformIf,
17170 transformMemo,
17171 transformFor,
17172 ...[],
17173 ...[transformExpression] ,
17174 transformSlotOutlet,
17175 transformElement,
17176 trackSlotScopes,
17177 transformText
17178 ],
17179 {
17180 on: transformOn$1,
17181 bind: transformBind,
17182 model: transformModel$1
17183 }
17184 ];
17185 }
17186 function baseCompile(source, options = {}) {
17187 const onError = options.onError || defaultOnError;
17188 const isModuleMode = options.mode === "module";
17189 {
17190 if (options.prefixIdentifiers === true) {
17191 onError(createCompilerError(47));
17192 } else if (isModuleMode) {
17193 onError(createCompilerError(48));
17194 }
17195 }
17196 const prefixIdentifiers = false;
17197 if (options.cacheHandlers) {
17198 onError(createCompilerError(49));
17199 }
17200 if (options.scopeId && !isModuleMode) {
17201 onError(createCompilerError(50));
17202 }
17203 const resolvedOptions = extend({}, options, {
17204 prefixIdentifiers
17205 });
17206 const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
17207 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17208 transform(
17209 ast,
17210 extend({}, resolvedOptions, {
17211 nodeTransforms: [
17212 ...nodeTransforms,
17213 ...options.nodeTransforms || []
17214 // user transforms
17215 ],
17216 directiveTransforms: extend(
17217 {},
17218 directiveTransforms,
17219 options.directiveTransforms || {}
17220 // user transforms
17221 )
17222 })
17223 );
17224 return generate(ast, resolvedOptions);
17225 }
17226
17227 const noopDirectiveTransform = () => ({ props: [] });
17228
17229 const V_MODEL_RADIO = Symbol(`vModelRadio` );
17230 const V_MODEL_CHECKBOX = Symbol(
17231 `vModelCheckbox`
17232 );
17233 const V_MODEL_TEXT = Symbol(`vModelText` );
17234 const V_MODEL_SELECT = Symbol(
17235 `vModelSelect`
17236 );
17237 const V_MODEL_DYNAMIC = Symbol(
17238 `vModelDynamic`
17239 );
17240 const V_ON_WITH_MODIFIERS = Symbol(
17241 `vOnModifiersGuard`
17242 );
17243 const V_ON_WITH_KEYS = Symbol(
17244 `vOnKeysGuard`
17245 );
17246 const V_SHOW = Symbol(`vShow` );
17247 const TRANSITION = Symbol(`Transition` );
17248 const TRANSITION_GROUP = Symbol(
17249 `TransitionGroup`
17250 );
17251 registerRuntimeHelpers({
17252 [V_MODEL_RADIO]: `vModelRadio`,
17253 [V_MODEL_CHECKBOX]: `vModelCheckbox`,
17254 [V_MODEL_TEXT]: `vModelText`,
17255 [V_MODEL_SELECT]: `vModelSelect`,
17256 [V_MODEL_DYNAMIC]: `vModelDynamic`,
17257 [V_ON_WITH_MODIFIERS]: `withModifiers`,
17258 [V_ON_WITH_KEYS]: `withKeys`,
17259 [V_SHOW]: `vShow`,
17260 [TRANSITION]: `Transition`,
17261 [TRANSITION_GROUP]: `TransitionGroup`
17262 });
17263
17264 let decoder;
17265 function decodeHtmlBrowser(raw, asAttr = false) {
17266 if (!decoder) {
17267 decoder = document.createElement("div");
17268 }
17269 if (asAttr) {
17270 decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
17271 return decoder.children[0].getAttribute("foo");
17272 } else {
17273 decoder.innerHTML = raw;
17274 return decoder.textContent;
17275 }
17276 }
17277
17278 const parserOptions = {
17279 parseMode: "html",
17280 isVoidTag,
17281 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17282 isPreTag: (tag) => tag === "pre",
17283 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17284 decodeEntities: decodeHtmlBrowser ,
17285 isBuiltInComponent: (tag) => {
17286 if (tag === "Transition" || tag === "transition") {
17287 return TRANSITION;
17288 } else if (tag === "TransitionGroup" || tag === "transition-group") {
17289 return TRANSITION_GROUP;
17290 }
17291 },
17292 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17293 getNamespace(tag, parent, rootNamespace) {
17294 let ns = parent ? parent.ns : rootNamespace;
17295 if (parent && ns === 2) {
17296 if (parent.tag === "annotation-xml") {
17297 if (tag === "svg") {
17298 return 1;
17299 }
17300 if (parent.props.some(
17301 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
17302 )) {
17303 ns = 0;
17304 }
17305 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
17306 ns = 0;
17307 }
17308 } else if (parent && ns === 1) {
17309 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
17310 ns = 0;
17311 }
17312 }
17313 if (ns === 0) {
17314 if (tag === "svg") {
17315 return 1;
17316 }
17317 if (tag === "math") {
17318 return 2;
17319 }
17320 }
17321 return ns;
17322 }
17323 };
17324
17325 const transformStyle = (node) => {
17326 if (node.type === 1) {
17327 node.props.forEach((p, i) => {
17328 if (p.type === 6 && p.name === "style" && p.value) {
17329 node.props[i] = {
17330 type: 7,
17331 name: `bind`,
17332 arg: createSimpleExpression(`style`, true, p.loc),
17333 exp: parseInlineCSS(p.value.content, p.loc),
17334 modifiers: [],
17335 loc: p.loc
17336 };
17337 }
17338 });
17339 }
17340 };
17341 const parseInlineCSS = (cssText, loc) => {
17342 const normalized = parseStringStyle(cssText);
17343 return createSimpleExpression(
17344 JSON.stringify(normalized),
17345 false,
17346 loc,
17347 3
17348 );
17349 };
17350
17351 function createDOMCompilerError(code, loc) {
17352 return createCompilerError(
17353 code,
17354 loc,
17355 DOMErrorMessages
17356 );
17357 }
17358 const DOMErrorMessages = {
17359 [53]: `v-html is missing expression.`,
17360 [54]: `v-html will override element children.`,
17361 [55]: `v-text is missing expression.`,
17362 [56]: `v-text will override element children.`,
17363 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17364 [58]: `v-model argument is not supported on plain elements.`,
17365 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17366 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17367 [61]: `v-show is missing expression.`,
17368 [62]: `<Transition> expects exactly one child element or component.`,
17369 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17370 };
17371
17372 const transformVHtml = (dir, node, context) => {
17373 const { exp, loc } = dir;
17374 if (!exp) {
17375 context.onError(
17376 createDOMCompilerError(53, loc)
17377 );
17378 }
17379 if (node.children.length) {
17380 context.onError(
17381 createDOMCompilerError(54, loc)
17382 );
17383 node.children.length = 0;
17384 }
17385 return {
17386 props: [
17387 createObjectProperty(
17388 createSimpleExpression(`innerHTML`, true, loc),
17389 exp || createSimpleExpression("", true)
17390 )
17391 ]
17392 };
17393 };
17394
17395 const transformVText = (dir, node, context) => {
17396 const { exp, loc } = dir;
17397 if (!exp) {
17398 context.onError(
17399 createDOMCompilerError(55, loc)
17400 );
17401 }
17402 if (node.children.length) {
17403 context.onError(
17404 createDOMCompilerError(56, loc)
17405 );
17406 node.children.length = 0;
17407 }
17408 return {
17409 props: [
17410 createObjectProperty(
17411 createSimpleExpression(`textContent`, true),
17412 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
17413 context.helperString(TO_DISPLAY_STRING),
17414 [exp],
17415 loc
17416 ) : createSimpleExpression("", true)
17417 )
17418 ]
17419 };
17420 };
17421
17422 const transformModel = (dir, node, context) => {
17423 const baseResult = transformModel$1(dir, node, context);
17424 if (!baseResult.props.length || node.tagType === 1) {
17425 return baseResult;
17426 }
17427 if (dir.arg) {
17428 context.onError(
17429 createDOMCompilerError(
17430 58,
17431 dir.arg.loc
17432 )
17433 );
17434 }
17435 function checkDuplicatedValue() {
17436 const value = findDir(node, "bind");
17437 if (value && isStaticArgOf(value.arg, "value")) {
17438 context.onError(
17439 createDOMCompilerError(
17440 60,
17441 value.loc
17442 )
17443 );
17444 }
17445 }
17446 const { tag } = node;
17447 const isCustomElement = context.isCustomElement(tag);
17448 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
17449 let directiveToUse = V_MODEL_TEXT;
17450 let isInvalidType = false;
17451 if (tag === "input" || isCustomElement) {
17452 const type = findProp(node, `type`);
17453 if (type) {
17454 if (type.type === 7) {
17455 directiveToUse = V_MODEL_DYNAMIC;
17456 } else if (type.value) {
17457 switch (type.value.content) {
17458 case "radio":
17459 directiveToUse = V_MODEL_RADIO;
17460 break;
17461 case "checkbox":
17462 directiveToUse = V_MODEL_CHECKBOX;
17463 break;
17464 case "file":
17465 isInvalidType = true;
17466 context.onError(
17467 createDOMCompilerError(
17468 59,
17469 dir.loc
17470 )
17471 );
17472 break;
17473 default:
17474 checkDuplicatedValue();
17475 break;
17476 }
17477 }
17478 } else if (hasDynamicKeyVBind(node)) {
17479 directiveToUse = V_MODEL_DYNAMIC;
17480 } else {
17481 checkDuplicatedValue();
17482 }
17483 } else if (tag === "select") {
17484 directiveToUse = V_MODEL_SELECT;
17485 } else {
17486 checkDuplicatedValue();
17487 }
17488 if (!isInvalidType) {
17489 baseResult.needRuntime = context.helper(directiveToUse);
17490 }
17491 } else {
17492 context.onError(
17493 createDOMCompilerError(
17494 57,
17495 dir.loc
17496 )
17497 );
17498 }
17499 baseResult.props = baseResult.props.filter(
17500 (p) => !(p.key.type === 4 && p.key.content === "modelValue")
17501 );
17502 return baseResult;
17503 };
17504
17505 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
17506 const isNonKeyModifier = /* @__PURE__ */ makeMap(
17507 // event propagation management
17508 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
17509 );
17510 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
17511 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
17512 const resolveModifiers = (key, modifiers, context, loc) => {
17513 const keyModifiers = [];
17514 const nonKeyModifiers = [];
17515 const eventOptionModifiers = [];
17516 for (let i = 0; i < modifiers.length; i++) {
17517 const modifier = modifiers[i].content;
17518 if (isEventOptionModifier(modifier)) {
17519 eventOptionModifiers.push(modifier);
17520 } else {
17521 if (maybeKeyModifier(modifier)) {
17522 if (isStaticExp(key)) {
17523 if (isKeyboardEvent(key.content.toLowerCase())) {
17524 keyModifiers.push(modifier);
17525 } else {
17526 nonKeyModifiers.push(modifier);
17527 }
17528 } else {
17529 keyModifiers.push(modifier);
17530 nonKeyModifiers.push(modifier);
17531 }
17532 } else {
17533 if (isNonKeyModifier(modifier)) {
17534 nonKeyModifiers.push(modifier);
17535 } else {
17536 keyModifiers.push(modifier);
17537 }
17538 }
17539 }
17540 }
17541 return {
17542 keyModifiers,
17543 nonKeyModifiers,
17544 eventOptionModifiers
17545 };
17546 };
17547 const transformClick = (key, event) => {
17548 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
17549 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
17550 `(`,
17551 key,
17552 `) === "onClick" ? "${event}" : (`,
17553 key,
17554 `)`
17555 ]) : key;
17556 };
17557 const transformOn = (dir, node, context) => {
17558 return transformOn$1(dir, node, context, (baseResult) => {
17559 const { modifiers } = dir;
17560 if (!modifiers.length) return baseResult;
17561 let { key, value: handlerExp } = baseResult.props[0];
17562 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
17563 if (nonKeyModifiers.includes("right")) {
17564 key = transformClick(key, `onContextmenu`);
17565 }
17566 if (nonKeyModifiers.includes("middle")) {
17567 key = transformClick(key, `onMouseup`);
17568 }
17569 if (nonKeyModifiers.length) {
17570 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
17571 handlerExp,
17572 JSON.stringify(nonKeyModifiers)
17573 ]);
17574 }
17575 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
17576 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
17577 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
17578 handlerExp,
17579 JSON.stringify(keyModifiers)
17580 ]);
17581 }
17582 if (eventOptionModifiers.length) {
17583 const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
17584 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
17585 }
17586 return {
17587 props: [createObjectProperty(key, handlerExp)]
17588 };
17589 });
17590 };
17591
17592 const transformShow = (dir, node, context) => {
17593 const { exp, loc } = dir;
17594 if (!exp) {
17595 context.onError(
17596 createDOMCompilerError(61, loc)
17597 );
17598 }
17599 return {
17600 props: [],
17601 needRuntime: context.helper(V_SHOW)
17602 };
17603 };
17604
17605 const transformTransition = (node, context) => {
17606 if (node.type === 1 && node.tagType === 1) {
17607 const component = context.isBuiltInComponent(node.tag);
17608 if (component === TRANSITION) {
17609 return () => {
17610 if (!node.children.length) {
17611 return;
17612 }
17613 if (hasMultipleChildren(node)) {
17614 context.onError(
17615 createDOMCompilerError(
17616 62,
17617 {
17618 start: node.children[0].loc.start,
17619 end: node.children[node.children.length - 1].loc.end,
17620 source: ""
17621 }
17622 )
17623 );
17624 }
17625 const child = node.children[0];
17626 if (child.type === 1) {
17627 for (const p of child.props) {
17628 if (p.type === 7 && p.name === "show") {
17629 node.props.push({
17630 type: 6,
17631 name: "persisted",
17632 nameLoc: node.loc,
17633 value: void 0,
17634 loc: node.loc
17635 });
17636 }
17637 }
17638 }
17639 };
17640 }
17641 }
17642 };
17643 function hasMultipleChildren(node) {
17644 const children = node.children = node.children.filter(
17645 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
17646 );
17647 const child = children[0];
17648 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
17649 }
17650
17651 const ignoreSideEffectTags = (node, context) => {
17652 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
17653 context.onError(
17654 createDOMCompilerError(
17655 63,
17656 node.loc
17657 )
17658 );
17659 context.removeNode();
17660 }
17661 };
17662
17663 function isValidHTMLNesting(parent, child) {
17664 if (parent in onlyValidChildren) {
17665 return onlyValidChildren[parent].has(child);
17666 }
17667 if (child in onlyValidParents) {
17668 return onlyValidParents[child].has(parent);
17669 }
17670 if (parent in knownInvalidChildren) {
17671 if (knownInvalidChildren[parent].has(child)) return false;
17672 }
17673 if (child in knownInvalidParents) {
17674 if (knownInvalidParents[child].has(parent)) return false;
17675 }
17676 return true;
17677 }
17678 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
17679 const emptySet = /* @__PURE__ */ new Set([]);
17680 const onlyValidChildren = {
17681 head: /* @__PURE__ */ new Set([
17682 "base",
17683 "basefront",
17684 "bgsound",
17685 "link",
17686 "meta",
17687 "title",
17688 "noscript",
17689 "noframes",
17690 "style",
17691 "script",
17692 "template"
17693 ]),
17694 optgroup: /* @__PURE__ */ new Set(["option"]),
17695 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
17696 // table
17697 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
17698 tr: /* @__PURE__ */ new Set(["td", "th"]),
17699 colgroup: /* @__PURE__ */ new Set(["col"]),
17700 tbody: /* @__PURE__ */ new Set(["tr"]),
17701 thead: /* @__PURE__ */ new Set(["tr"]),
17702 tfoot: /* @__PURE__ */ new Set(["tr"]),
17703 // these elements can not have any children elements
17704 script: emptySet,
17705 iframe: emptySet,
17706 option: emptySet,
17707 textarea: emptySet,
17708 style: emptySet,
17709 title: emptySet
17710 };
17711 const onlyValidParents = {
17712 // sections
17713 html: emptySet,
17714 body: /* @__PURE__ */ new Set(["html"]),
17715 head: /* @__PURE__ */ new Set(["html"]),
17716 // table
17717 td: /* @__PURE__ */ new Set(["tr"]),
17718 colgroup: /* @__PURE__ */ new Set(["table"]),
17719 caption: /* @__PURE__ */ new Set(["table"]),
17720 tbody: /* @__PURE__ */ new Set(["table"]),
17721 tfoot: /* @__PURE__ */ new Set(["table"]),
17722 col: /* @__PURE__ */ new Set(["colgroup"]),
17723 th: /* @__PURE__ */ new Set(["tr"]),
17724 thead: /* @__PURE__ */ new Set(["table"]),
17725 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
17726 // data list
17727 dd: /* @__PURE__ */ new Set(["dl", "div"]),
17728 dt: /* @__PURE__ */ new Set(["dl", "div"]),
17729 // other
17730 figcaption: /* @__PURE__ */ new Set(["figure"]),
17731 // li: new Set(["ul", "ol"]),
17732 summary: /* @__PURE__ */ new Set(["details"]),
17733 area: /* @__PURE__ */ new Set(["map"])
17734 };
17735 const knownInvalidChildren = {
17736 p: /* @__PURE__ */ new Set([
17737 "address",
17738 "article",
17739 "aside",
17740 "blockquote",
17741 "center",
17742 "details",
17743 "dialog",
17744 "dir",
17745 "div",
17746 "dl",
17747 "fieldset",
17748 "figure",
17749 "footer",
17750 "form",
17751 "h1",
17752 "h2",
17753 "h3",
17754 "h4",
17755 "h5",
17756 "h6",
17757 "header",
17758 "hgroup",
17759 "hr",
17760 "li",
17761 "main",
17762 "nav",
17763 "menu",
17764 "ol",
17765 "p",
17766 "pre",
17767 "section",
17768 "table",
17769 "ul"
17770 ]),
17771 svg: /* @__PURE__ */ new Set([
17772 "b",
17773 "blockquote",
17774 "br",
17775 "code",
17776 "dd",
17777 "div",
17778 "dl",
17779 "dt",
17780 "em",
17781 "embed",
17782 "h1",
17783 "h2",
17784 "h3",
17785 "h4",
17786 "h5",
17787 "h6",
17788 "hr",
17789 "i",
17790 "img",
17791 "li",
17792 "menu",
17793 "meta",
17794 "ol",
17795 "p",
17796 "pre",
17797 "ruby",
17798 "s",
17799 "small",
17800 "span",
17801 "strong",
17802 "sub",
17803 "sup",
17804 "table",
17805 "u",
17806 "ul",
17807 "var"
17808 ])
17809 };
17810 const knownInvalidParents = {
17811 a: /* @__PURE__ */ new Set(["a"]),
17812 button: /* @__PURE__ */ new Set(["button"]),
17813 dd: /* @__PURE__ */ new Set(["dd", "dt"]),
17814 dt: /* @__PURE__ */ new Set(["dd", "dt"]),
17815 form: /* @__PURE__ */ new Set(["form"]),
17816 li: /* @__PURE__ */ new Set(["li"]),
17817 h1: headings,
17818 h2: headings,
17819 h3: headings,
17820 h4: headings,
17821 h5: headings,
17822 h6: headings
17823 };
17824
17825 const validateHtmlNesting = (node, context) => {
17826 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
17827 const error = new SyntaxError(
17828 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
17829 );
17830 error.loc = node.loc;
17831 context.onWarn(error);
17832 }
17833 };
17834
17835 const DOMNodeTransforms = [
17836 transformStyle,
17837 ...[transformTransition, validateHtmlNesting]
17838 ];
17839 const DOMDirectiveTransforms = {
17840 cloak: noopDirectiveTransform,
17841 html: transformVHtml,
17842 text: transformVText,
17843 model: transformModel,
17844 // override compiler-core
17845 on: transformOn,
17846 // override compiler-core
17847 show: transformShow
17848 };
17849 function compile(src, options = {}) {
17850 return baseCompile(
17851 src,
17852 extend({}, parserOptions, options, {
17853 nodeTransforms: [
17854 // ignore <script> and <tag>
17855 // this is not put inside DOMNodeTransforms because that list is used
17856 // by compiler-ssr to generate vnode fallback branches
17857 ignoreSideEffectTags,
17858 ...DOMNodeTransforms,
17859 ...options.nodeTransforms || []
17860 ],
17861 directiveTransforms: extend(
17862 {},
17863 DOMDirectiveTransforms,
17864 options.directiveTransforms || {}
17865 ),
17866 transformHoist: null
17867 })
17868 );
17869 }
17870
17871 {
17872 initDev();
17873 }
17874 const compileCache = /* @__PURE__ */ Object.create(null);
17875 function compileToFunction(template, options) {
17876 if (!isString(template)) {
17877 if (template.nodeType) {
17878 template = template.innerHTML;
17879 } else {
17880 warn(`invalid template option: `, template);
17881 return NOOP;
17882 }
17883 }
17884 const key = genCacheKey(template, options);
17885 const cached = compileCache[key];
17886 if (cached) {
17887 return cached;
17888 }
17889 if (template[0] === "#") {
17890 const el = document.querySelector(template);
17891 if (!el) {
17892 warn(`Template element not found or is empty: ${template}`);
17893 }
17894 template = el ? el.innerHTML : ``;
17895 }
17896 const opts = extend(
17897 {
17898 hoistStatic: true,
17899 onError: onError ,
17900 onWarn: (e) => onError(e, true)
17901 },
17902 options
17903 );
17904 if (!opts.isCustomElement && typeof customElements !== "undefined") {
17905 opts.isCustomElement = (tag) => !!customElements.get(tag);
17906 }
17907 const { code } = compile(template, opts);
17908 function onError(err, asWarning = false) {
17909 const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
17910 const codeFrame = err.loc && generateCodeFrame(
17911 template,
17912 err.loc.start.offset,
17913 err.loc.end.offset
17914 );
17915 warn(codeFrame ? `${message}
17916${codeFrame}` : message);
17917 }
17918 const render = new Function(code)() ;
17919 render._rc = true;
17920 return compileCache[key] = render;
17921 }
17922 registerRuntimeCompiler(compileToFunction);
17923
17924 exports.BaseTransition = BaseTransition;
17925 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
17926 exports.Comment = Comment;
17927 exports.DeprecationTypes = DeprecationTypes;
17928 exports.EffectScope = EffectScope;
17929 exports.ErrorCodes = ErrorCodes;
17930 exports.ErrorTypeStrings = ErrorTypeStrings;
17931 exports.Fragment = Fragment;
17932 exports.KeepAlive = KeepAlive;
17933 exports.ReactiveEffect = ReactiveEffect;
17934 exports.Static = Static;
17935 exports.Suspense = Suspense;
17936 exports.Teleport = Teleport;
17937 exports.Text = Text;
17938 exports.TrackOpTypes = TrackOpTypes;
17939 exports.Transition = Transition;
17940 exports.TransitionGroup = TransitionGroup;
17941 exports.TriggerOpTypes = TriggerOpTypes;
17942 exports.VueElement = VueElement;
17943 exports.assertNumber = assertNumber;
17944 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
17945 exports.callWithErrorHandling = callWithErrorHandling;
17946 exports.camelize = camelize;
17947 exports.capitalize = capitalize;
17948 exports.cloneVNode = cloneVNode;
17949 exports.compatUtils = compatUtils;
17950 exports.compile = compileToFunction;
17951 exports.computed = computed;
17952 exports.createApp = createApp;
17953 exports.createBlock = createBlock;
17954 exports.createCommentVNode = createCommentVNode;
17955 exports.createElementBlock = createElementBlock;
17956 exports.createElementVNode = createBaseVNode;
17957 exports.createHydrationRenderer = createHydrationRenderer;
17958 exports.createPropsRestProxy = createPropsRestProxy;
17959 exports.createRenderer = createRenderer;
17960 exports.createSSRApp = createSSRApp;
17961 exports.createSlots = createSlots;
17962 exports.createStaticVNode = createStaticVNode;
17963 exports.createTextVNode = createTextVNode;
17964 exports.createVNode = createVNode;
17965 exports.customRef = customRef;
17966 exports.defineAsyncComponent = defineAsyncComponent;
17967 exports.defineComponent = defineComponent;
17968 exports.defineCustomElement = defineCustomElement;
17969 exports.defineEmits = defineEmits;
17970 exports.defineExpose = defineExpose;
17971 exports.defineModel = defineModel;
17972 exports.defineOptions = defineOptions;
17973 exports.defineProps = defineProps;
17974 exports.defineSSRCustomElement = defineSSRCustomElement;
17975 exports.defineSlots = defineSlots;
17976 exports.devtools = devtools;
17977 exports.effect = effect;
17978 exports.effectScope = effectScope;
17979 exports.getCurrentInstance = getCurrentInstance;
17980 exports.getCurrentScope = getCurrentScope;
17981 exports.getCurrentWatcher = getCurrentWatcher;
17982 exports.getTransitionRawChildren = getTransitionRawChildren;
17983 exports.guardReactiveProps = guardReactiveProps;
17984 exports.h = h;
17985 exports.handleError = handleError;
17986 exports.hasInjectionContext = hasInjectionContext;
17987 exports.hydrate = hydrate;
17988 exports.hydrateOnIdle = hydrateOnIdle;
17989 exports.hydrateOnInteraction = hydrateOnInteraction;
17990 exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
17991 exports.hydrateOnVisible = hydrateOnVisible;
17992 exports.initCustomFormatter = initCustomFormatter;
17993 exports.initDirectivesForSSR = initDirectivesForSSR;
17994 exports.inject = inject;
17995 exports.isMemoSame = isMemoSame;
17996 exports.isProxy = isProxy;
17997 exports.isReactive = isReactive;
17998 exports.isReadonly = isReadonly;
17999 exports.isRef = isRef;
18000 exports.isRuntimeOnly = isRuntimeOnly;
18001 exports.isShallow = isShallow;
18002 exports.isVNode = isVNode;
18003 exports.markRaw = markRaw;
18004 exports.mergeDefaults = mergeDefaults;
18005 exports.mergeModels = mergeModels;
18006 exports.mergeProps = mergeProps;
18007 exports.nextTick = nextTick;
18008 exports.normalizeClass = normalizeClass;
18009 exports.normalizeProps = normalizeProps;
18010 exports.normalizeStyle = normalizeStyle;
18011 exports.onActivated = onActivated;
18012 exports.onBeforeMount = onBeforeMount;
18013 exports.onBeforeUnmount = onBeforeUnmount;
18014 exports.onBeforeUpdate = onBeforeUpdate;
18015 exports.onDeactivated = onDeactivated;
18016 exports.onErrorCaptured = onErrorCaptured;
18017 exports.onMounted = onMounted;
18018 exports.onRenderTracked = onRenderTracked;
18019 exports.onRenderTriggered = onRenderTriggered;
18020 exports.onScopeDispose = onScopeDispose;
18021 exports.onServerPrefetch = onServerPrefetch;
18022 exports.onUnmounted = onUnmounted;
18023 exports.onUpdated = onUpdated;
18024 exports.onWatcherCleanup = onWatcherCleanup;
18025 exports.openBlock = openBlock;
18026 exports.popScopeId = popScopeId;
18027 exports.provide = provide;
18028 exports.proxyRefs = proxyRefs;
18029 exports.pushScopeId = pushScopeId;
18030 exports.queuePostFlushCb = queuePostFlushCb;
18031 exports.reactive = reactive;
18032 exports.readonly = readonly;
18033 exports.ref = ref;
18034 exports.registerRuntimeCompiler = registerRuntimeCompiler;
18035 exports.render = render;
18036 exports.renderList = renderList;
18037 exports.renderSlot = renderSlot;
18038 exports.resolveComponent = resolveComponent;
18039 exports.resolveDirective = resolveDirective;
18040 exports.resolveDynamicComponent = resolveDynamicComponent;
18041 exports.resolveFilter = resolveFilter;
18042 exports.resolveTransitionHooks = resolveTransitionHooks;
18043 exports.setBlockTracking = setBlockTracking;
18044 exports.setDevtoolsHook = setDevtoolsHook;
18045 exports.setTransitionHooks = setTransitionHooks;
18046 exports.shallowReactive = shallowReactive;
18047 exports.shallowReadonly = shallowReadonly;
18048 exports.shallowRef = shallowRef;
18049 exports.ssrContextKey = ssrContextKey;
18050 exports.ssrUtils = ssrUtils;
18051 exports.stop = stop;
18052 exports.toDisplayString = toDisplayString;
18053 exports.toHandlerKey = toHandlerKey;
18054 exports.toHandlers = toHandlers;
18055 exports.toRaw = toRaw;
18056 exports.toRef = toRef;
18057 exports.toRefs = toRefs;
18058 exports.toValue = toValue;
18059 exports.transformVNodeArgs = transformVNodeArgs;
18060 exports.triggerRef = triggerRef;
18061 exports.unref = unref;
18062 exports.useAttrs = useAttrs;
18063 exports.useCssModule = useCssModule;
18064 exports.useCssVars = useCssVars;
18065 exports.useHost = useHost;
18066 exports.useId = useId;
18067 exports.useModel = useModel;
18068 exports.useSSRContext = useSSRContext;
18069 exports.useShadowRoot = useShadowRoot;
18070 exports.useSlots = useSlots;
18071 exports.useTemplateRef = useTemplateRef;
18072 exports.useTransitionState = useTransitionState;
18073 exports.vModelCheckbox = vModelCheckbox;
18074 exports.vModelDynamic = vModelDynamic;
18075 exports.vModelRadio = vModelRadio;
18076 exports.vModelSelect = vModelSelect;
18077 exports.vModelText = vModelText;
18078 exports.vShow = vShow;
18079 exports.version = version;
18080 exports.warn = warn;
18081 exports.watch = watch;
18082 exports.watchEffect = watchEffect;
18083 exports.watchPostEffect = watchPostEffect;
18084 exports.watchSyncEffect = watchSyncEffect;
18085 exports.withAsyncContext = withAsyncContext;
18086 exports.withCtx = withCtx;
18087 exports.withDefaults = withDefaults;
18088 exports.withDirectives = withDirectives;
18089 exports.withKeys = withKeys;
18090 exports.withMemo = withMemo;
18091 exports.withModifiers = withModifiers;
18092 exports.withScopeId = withScopeId;
18093
18094 return exports;
18095
18096})({});