UNPKG

490 kBJavaScriptView Raw
1/**
2* vue v3.4.25
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6/*! #__NO_SIDE_EFFECTS__ */
7// @__NO_SIDE_EFFECTS__
8function makeMap(str, expectsLowerCase) {
9 const set = new Set(str.split(","));
10 return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
11}
12
13const EMPTY_OBJ = Object.freeze({}) ;
14const EMPTY_ARR = Object.freeze([]) ;
15const NOOP = () => {
16};
17const NO = () => false;
18const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
19(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
20const isModelListener = (key) => key.startsWith("onUpdate:");
21const extend = Object.assign;
22const remove = (arr, el) => {
23 const i = arr.indexOf(el);
24 if (i > -1) {
25 arr.splice(i, 1);
26 }
27};
28const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
29const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
30const isArray = Array.isArray;
31const isMap = (val) => toTypeString(val) === "[object Map]";
32const isSet = (val) => toTypeString(val) === "[object Set]";
33const isDate = (val) => toTypeString(val) === "[object Date]";
34const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
35const isFunction = (val) => typeof val === "function";
36const isString = (val) => typeof val === "string";
37const isSymbol = (val) => typeof val === "symbol";
38const isObject = (val) => val !== null && typeof val === "object";
39const isPromise = (val) => {
40 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
41};
42const objectToString = Object.prototype.toString;
43const toTypeString = (value) => objectToString.call(value);
44const toRawType = (value) => {
45 return toTypeString(value).slice(8, -1);
46};
47const isPlainObject = (val) => toTypeString(val) === "[object Object]";
48const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
49const isReservedProp = /* @__PURE__ */ makeMap(
50 // the leading comma is intentional so empty string "" is also included
51 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
52);
53const isBuiltInDirective = /* @__PURE__ */ makeMap(
54 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
55);
56const cacheStringFunction = (fn) => {
57 const cache = /* @__PURE__ */ Object.create(null);
58 return (str) => {
59 const hit = cache[str];
60 return hit || (cache[str] = fn(str));
61 };
62};
63const camelizeRE = /-(\w)/g;
64const camelize = cacheStringFunction((str) => {
65 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
66});
67const hyphenateRE = /\B([A-Z])/g;
68const hyphenate = cacheStringFunction(
69 (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
70);
71const capitalize = cacheStringFunction((str) => {
72 return str.charAt(0).toUpperCase() + str.slice(1);
73});
74const toHandlerKey = cacheStringFunction((str) => {
75 const s = str ? `on${capitalize(str)}` : ``;
76 return s;
77});
78const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
79const invokeArrayFns = (fns, arg) => {
80 for (let i = 0; i < fns.length; i++) {
81 fns[i](arg);
82 }
83};
84const def = (obj, key, value) => {
85 Object.defineProperty(obj, key, {
86 configurable: true,
87 enumerable: false,
88 value
89 });
90};
91const looseToNumber = (val) => {
92 const n = parseFloat(val);
93 return isNaN(n) ? val : n;
94};
95const toNumber = (val) => {
96 const n = isString(val) ? Number(val) : NaN;
97 return isNaN(n) ? val : n;
98};
99let _globalThis;
100const getGlobalThis = () => {
101 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
102};
103
104const PatchFlagNames = {
105 [1]: `TEXT`,
106 [2]: `CLASS`,
107 [4]: `STYLE`,
108 [8]: `PROPS`,
109 [16]: `FULL_PROPS`,
110 [32]: `NEED_HYDRATION`,
111 [64]: `STABLE_FRAGMENT`,
112 [128]: `KEYED_FRAGMENT`,
113 [256]: `UNKEYED_FRAGMENT`,
114 [512]: `NEED_PATCH`,
115 [1024]: `DYNAMIC_SLOTS`,
116 [2048]: `DEV_ROOT_FRAGMENT`,
117 [-1]: `HOISTED`,
118 [-2]: `BAIL`
119};
120
121const slotFlagsText = {
122 [1]: "STABLE",
123 [2]: "DYNAMIC",
124 [3]: "FORWARDED"
125};
126
127const 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";
128const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
129
130const range = 2;
131function generateCodeFrame(source, start = 0, end = source.length) {
132 let lines = source.split(/(\r?\n)/);
133 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
134 lines = lines.filter((_, idx) => idx % 2 === 0);
135 let count = 0;
136 const res = [];
137 for (let i = 0; i < lines.length; i++) {
138 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
139 if (count >= start) {
140 for (let j = i - range; j <= i + range || end > count; j++) {
141 if (j < 0 || j >= lines.length)
142 continue;
143 const line = j + 1;
144 res.push(
145 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
146 );
147 const lineLength = lines[j].length;
148 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
149 if (j === i) {
150 const pad = start - (count - (lineLength + newLineSeqLength));
151 const length = Math.max(
152 1,
153 end > count ? lineLength - pad : end - start
154 );
155 res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
156 } else if (j > i) {
157 if (end > count) {
158 const length = Math.max(Math.min(end - count, lineLength), 1);
159 res.push(` | ` + "^".repeat(length));
160 }
161 count += lineLength + newLineSeqLength;
162 }
163 }
164 break;
165 }
166 }
167 return res.join("\n");
168}
169
170function normalizeStyle(value) {
171 if (isArray(value)) {
172 const res = {};
173 for (let i = 0; i < value.length; i++) {
174 const item = value[i];
175 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
176 if (normalized) {
177 for (const key in normalized) {
178 res[key] = normalized[key];
179 }
180 }
181 }
182 return res;
183 } else if (isString(value) || isObject(value)) {
184 return value;
185 }
186}
187const listDelimiterRE = /;(?![^(]*\))/g;
188const propertyDelimiterRE = /:([^]+)/;
189const styleCommentRE = /\/\*[^]*?\*\//g;
190function parseStringStyle(cssText) {
191 const ret = {};
192 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
193 if (item) {
194 const tmp = item.split(propertyDelimiterRE);
195 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
196 }
197 });
198 return ret;
199}
200function stringifyStyle(styles) {
201 let ret = "";
202 if (!styles || isString(styles)) {
203 return ret;
204 }
205 for (const key in styles) {
206 const value = styles[key];
207 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
208 if (isString(value) || typeof value === "number") {
209 ret += `${normalizedKey}:${value};`;
210 }
211 }
212 return ret;
213}
214function normalizeClass(value) {
215 let res = "";
216 if (isString(value)) {
217 res = value;
218 } else if (isArray(value)) {
219 for (let i = 0; i < value.length; i++) {
220 const normalized = normalizeClass(value[i]);
221 if (normalized) {
222 res += normalized + " ";
223 }
224 }
225 } else if (isObject(value)) {
226 for (const name in value) {
227 if (value[name]) {
228 res += name + " ";
229 }
230 }
231 }
232 return res.trim();
233}
234function normalizeProps(props) {
235 if (!props)
236 return null;
237 let { class: klass, style } = props;
238 if (klass && !isString(klass)) {
239 props.class = normalizeClass(klass);
240 }
241 if (style) {
242 props.style = normalizeStyle(style);
243 }
244 return props;
245}
246
247const 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";
248const 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";
249const 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";
250const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
251const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
252const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
253const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
254const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
255
256const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
257const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
258const isBooleanAttr = /* @__PURE__ */ makeMap(
259 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
260);
261function includeBooleanAttr(value) {
262 return !!value || value === "";
263}
264const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
265 `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`
266);
267const isKnownSvgAttr = /* @__PURE__ */ makeMap(
268 `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`
269);
270function isRenderableAttrValue(value) {
271 if (value == null) {
272 return false;
273 }
274 const type = typeof value;
275 return type === "string" || type === "number" || type === "boolean";
276}
277
278function looseCompareArrays(a, b) {
279 if (a.length !== b.length)
280 return false;
281 let equal = true;
282 for (let i = 0; equal && i < a.length; i++) {
283 equal = looseEqual(a[i], b[i]);
284 }
285 return equal;
286}
287function looseEqual(a, b) {
288 if (a === b)
289 return true;
290 let aValidType = isDate(a);
291 let bValidType = isDate(b);
292 if (aValidType || bValidType) {
293 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
294 }
295 aValidType = isSymbol(a);
296 bValidType = isSymbol(b);
297 if (aValidType || bValidType) {
298 return a === b;
299 }
300 aValidType = isArray(a);
301 bValidType = isArray(b);
302 if (aValidType || bValidType) {
303 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
304 }
305 aValidType = isObject(a);
306 bValidType = isObject(b);
307 if (aValidType || bValidType) {
308 if (!aValidType || !bValidType) {
309 return false;
310 }
311 const aKeysCount = Object.keys(a).length;
312 const bKeysCount = Object.keys(b).length;
313 if (aKeysCount !== bKeysCount) {
314 return false;
315 }
316 for (const key in a) {
317 const aHasKey = a.hasOwnProperty(key);
318 const bHasKey = b.hasOwnProperty(key);
319 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
320 return false;
321 }
322 }
323 }
324 return String(a) === String(b);
325}
326function looseIndexOf(arr, val) {
327 return arr.findIndex((item) => looseEqual(item, val));
328}
329
330const toDisplayString = (val) => {
331 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
332};
333const replacer = (_key, val) => {
334 if (val && val.__v_isRef) {
335 return replacer(_key, val.value);
336 } else if (isMap(val)) {
337 return {
338 [`Map(${val.size})`]: [...val.entries()].reduce(
339 (entries, [key, val2], i) => {
340 entries[stringifySymbol(key, i) + " =>"] = val2;
341 return entries;
342 },
343 {}
344 )
345 };
346 } else if (isSet(val)) {
347 return {
348 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
349 };
350 } else if (isSymbol(val)) {
351 return stringifySymbol(val);
352 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
353 return String(val);
354 }
355 return val;
356};
357const stringifySymbol = (v, i = "") => {
358 var _a;
359 return (
360 // Symbol.description in es2019+ so we need to cast here to pass
361 // the lib: es2016 check
362 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
363 );
364};
365
366function warn$2(msg, ...args) {
367 console.warn(`[Vue warn] ${msg}`, ...args);
368}
369
370let activeEffectScope;
371class EffectScope {
372 constructor(detached = false) {
373 this.detached = detached;
374 /**
375 * @internal
376 */
377 this._active = true;
378 /**
379 * @internal
380 */
381 this.effects = [];
382 /**
383 * @internal
384 */
385 this.cleanups = [];
386 this.parent = activeEffectScope;
387 if (!detached && activeEffectScope) {
388 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
389 this
390 ) - 1;
391 }
392 }
393 get active() {
394 return this._active;
395 }
396 run(fn) {
397 if (this._active) {
398 const currentEffectScope = activeEffectScope;
399 try {
400 activeEffectScope = this;
401 return fn();
402 } finally {
403 activeEffectScope = currentEffectScope;
404 }
405 } else {
406 warn$2(`cannot run an inactive effect scope.`);
407 }
408 }
409 /**
410 * This should only be called on non-detached scopes
411 * @internal
412 */
413 on() {
414 activeEffectScope = this;
415 }
416 /**
417 * This should only be called on non-detached scopes
418 * @internal
419 */
420 off() {
421 activeEffectScope = this.parent;
422 }
423 stop(fromParent) {
424 if (this._active) {
425 let i, l;
426 for (i = 0, l = this.effects.length; i < l; i++) {
427 this.effects[i].stop();
428 }
429 for (i = 0, l = this.cleanups.length; i < l; i++) {
430 this.cleanups[i]();
431 }
432 if (this.scopes) {
433 for (i = 0, l = this.scopes.length; i < l; i++) {
434 this.scopes[i].stop(true);
435 }
436 }
437 if (!this.detached && this.parent && !fromParent) {
438 const last = this.parent.scopes.pop();
439 if (last && last !== this) {
440 this.parent.scopes[this.index] = last;
441 last.index = this.index;
442 }
443 }
444 this.parent = void 0;
445 this._active = false;
446 }
447 }
448}
449function effectScope(detached) {
450 return new EffectScope(detached);
451}
452function recordEffectScope(effect, scope = activeEffectScope) {
453 if (scope && scope.active) {
454 scope.effects.push(effect);
455 }
456}
457function getCurrentScope() {
458 return activeEffectScope;
459}
460function onScopeDispose(fn) {
461 if (activeEffectScope) {
462 activeEffectScope.cleanups.push(fn);
463 } else {
464 warn$2(
465 `onScopeDispose() is called when there is no active effect scope to be associated with.`
466 );
467 }
468}
469
470let activeEffect;
471class ReactiveEffect {
472 constructor(fn, trigger, scheduler, scope) {
473 this.fn = fn;
474 this.trigger = trigger;
475 this.scheduler = scheduler;
476 this.active = true;
477 this.deps = [];
478 /**
479 * @internal
480 */
481 this._dirtyLevel = 4;
482 /**
483 * @internal
484 */
485 this._trackId = 0;
486 /**
487 * @internal
488 */
489 this._runnings = 0;
490 /**
491 * @internal
492 */
493 this._shouldSchedule = false;
494 /**
495 * @internal
496 */
497 this._depsLength = 0;
498 recordEffectScope(this, scope);
499 }
500 get dirty() {
501 if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
502 this._dirtyLevel = 1;
503 pauseTracking();
504 for (let i = 0; i < this._depsLength; i++) {
505 const dep = this.deps[i];
506 if (dep.computed) {
507 triggerComputed(dep.computed);
508 if (this._dirtyLevel >= 4) {
509 break;
510 }
511 }
512 }
513 if (this._dirtyLevel === 1) {
514 this._dirtyLevel = 0;
515 }
516 resetTracking();
517 }
518 return this._dirtyLevel >= 4;
519 }
520 set dirty(v) {
521 this._dirtyLevel = v ? 4 : 0;
522 }
523 run() {
524 this._dirtyLevel = 0;
525 if (!this.active) {
526 return this.fn();
527 }
528 let lastShouldTrack = shouldTrack;
529 let lastEffect = activeEffect;
530 try {
531 shouldTrack = true;
532 activeEffect = this;
533 this._runnings++;
534 preCleanupEffect(this);
535 return this.fn();
536 } finally {
537 postCleanupEffect(this);
538 this._runnings--;
539 activeEffect = lastEffect;
540 shouldTrack = lastShouldTrack;
541 }
542 }
543 stop() {
544 var _a;
545 if (this.active) {
546 preCleanupEffect(this);
547 postCleanupEffect(this);
548 (_a = this.onStop) == null ? void 0 : _a.call(this);
549 this.active = false;
550 }
551 }
552}
553function triggerComputed(computed) {
554 return computed.value;
555}
556function preCleanupEffect(effect2) {
557 effect2._trackId++;
558 effect2._depsLength = 0;
559}
560function postCleanupEffect(effect2) {
561 if (effect2.deps.length > effect2._depsLength) {
562 for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
563 cleanupDepEffect(effect2.deps[i], effect2);
564 }
565 effect2.deps.length = effect2._depsLength;
566 }
567}
568function cleanupDepEffect(dep, effect2) {
569 const trackId = dep.get(effect2);
570 if (trackId !== void 0 && effect2._trackId !== trackId) {
571 dep.delete(effect2);
572 if (dep.size === 0) {
573 dep.cleanup();
574 }
575 }
576}
577function effect(fn, options) {
578 if (fn.effect instanceof ReactiveEffect) {
579 fn = fn.effect.fn;
580 }
581 const _effect = new ReactiveEffect(fn, NOOP, () => {
582 if (_effect.dirty) {
583 _effect.run();
584 }
585 });
586 if (options) {
587 extend(_effect, options);
588 if (options.scope)
589 recordEffectScope(_effect, options.scope);
590 }
591 if (!options || !options.lazy) {
592 _effect.run();
593 }
594 const runner = _effect.run.bind(_effect);
595 runner.effect = _effect;
596 return runner;
597}
598function stop(runner) {
599 runner.effect.stop();
600}
601let shouldTrack = true;
602let pauseScheduleStack = 0;
603const trackStack = [];
604function pauseTracking() {
605 trackStack.push(shouldTrack);
606 shouldTrack = false;
607}
608function resetTracking() {
609 const last = trackStack.pop();
610 shouldTrack = last === void 0 ? true : last;
611}
612function pauseScheduling() {
613 pauseScheduleStack++;
614}
615function resetScheduling() {
616 pauseScheduleStack--;
617 while (!pauseScheduleStack && queueEffectSchedulers.length) {
618 queueEffectSchedulers.shift()();
619 }
620}
621function trackEffect(effect2, dep, debuggerEventExtraInfo) {
622 var _a;
623 if (dep.get(effect2) !== effect2._trackId) {
624 dep.set(effect2, effect2._trackId);
625 const oldDep = effect2.deps[effect2._depsLength];
626 if (oldDep !== dep) {
627 if (oldDep) {
628 cleanupDepEffect(oldDep, effect2);
629 }
630 effect2.deps[effect2._depsLength++] = dep;
631 } else {
632 effect2._depsLength++;
633 }
634 {
635 (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
636 }
637 }
638}
639const queueEffectSchedulers = [];
640function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
641 var _a;
642 pauseScheduling();
643 for (const effect2 of dep.keys()) {
644 let tracking;
645 if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
646 effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
647 effect2._dirtyLevel = dirtyLevel;
648 }
649 if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
650 {
651 (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
652 }
653 effect2.trigger();
654 if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
655 effect2._shouldSchedule = false;
656 if (effect2.scheduler) {
657 queueEffectSchedulers.push(effect2.scheduler);
658 }
659 }
660 }
661 }
662 resetScheduling();
663}
664
665const createDep = (cleanup, computed) => {
666 const dep = /* @__PURE__ */ new Map();
667 dep.cleanup = cleanup;
668 dep.computed = computed;
669 return dep;
670};
671
672const targetMap = /* @__PURE__ */ new WeakMap();
673const ITERATE_KEY = Symbol("iterate" );
674const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
675function track(target, type, key) {
676 if (shouldTrack && activeEffect) {
677 let depsMap = targetMap.get(target);
678 if (!depsMap) {
679 targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
680 }
681 let dep = depsMap.get(key);
682 if (!dep) {
683 depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
684 }
685 trackEffect(
686 activeEffect,
687 dep,
688 {
689 target,
690 type,
691 key
692 }
693 );
694 }
695}
696function trigger(target, type, key, newValue, oldValue, oldTarget) {
697 const depsMap = targetMap.get(target);
698 if (!depsMap) {
699 return;
700 }
701 let deps = [];
702 if (type === "clear") {
703 deps = [...depsMap.values()];
704 } else if (key === "length" && isArray(target)) {
705 const newLength = Number(newValue);
706 depsMap.forEach((dep, key2) => {
707 if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
708 deps.push(dep);
709 }
710 });
711 } else {
712 if (key !== void 0) {
713 deps.push(depsMap.get(key));
714 }
715 switch (type) {
716 case "add":
717 if (!isArray(target)) {
718 deps.push(depsMap.get(ITERATE_KEY));
719 if (isMap(target)) {
720 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
721 }
722 } else if (isIntegerKey(key)) {
723 deps.push(depsMap.get("length"));
724 }
725 break;
726 case "delete":
727 if (!isArray(target)) {
728 deps.push(depsMap.get(ITERATE_KEY));
729 if (isMap(target)) {
730 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
731 }
732 }
733 break;
734 case "set":
735 if (isMap(target)) {
736 deps.push(depsMap.get(ITERATE_KEY));
737 }
738 break;
739 }
740 }
741 pauseScheduling();
742 for (const dep of deps) {
743 if (dep) {
744 triggerEffects(
745 dep,
746 4,
747 {
748 target,
749 type,
750 key,
751 newValue,
752 oldValue,
753 oldTarget
754 }
755 );
756 }
757 }
758 resetScheduling();
759}
760function getDepFromReactive(object, key) {
761 var _a;
762 return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
763}
764
765const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
766const builtInSymbols = new Set(
767 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
768);
769const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
770function createArrayInstrumentations() {
771 const instrumentations = {};
772 ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
773 instrumentations[key] = function(...args) {
774 const arr = toRaw(this);
775 for (let i = 0, l = this.length; i < l; i++) {
776 track(arr, "get", i + "");
777 }
778 const res = arr[key](...args);
779 if (res === -1 || res === false) {
780 return arr[key](...args.map(toRaw));
781 } else {
782 return res;
783 }
784 };
785 });
786 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
787 instrumentations[key] = function(...args) {
788 pauseTracking();
789 pauseScheduling();
790 const res = toRaw(this)[key].apply(this, args);
791 resetScheduling();
792 resetTracking();
793 return res;
794 };
795 });
796 return instrumentations;
797}
798function hasOwnProperty(key) {
799 if (!isSymbol(key))
800 key = String(key);
801 const obj = toRaw(this);
802 track(obj, "has", key);
803 return obj.hasOwnProperty(key);
804}
805class BaseReactiveHandler {
806 constructor(_isReadonly = false, _isShallow = false) {
807 this._isReadonly = _isReadonly;
808 this._isShallow = _isShallow;
809 }
810 get(target, key, receiver) {
811 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
812 if (key === "__v_isReactive") {
813 return !isReadonly2;
814 } else if (key === "__v_isReadonly") {
815 return isReadonly2;
816 } else if (key === "__v_isShallow") {
817 return isShallow2;
818 } else if (key === "__v_raw") {
819 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
820 // this means the reciever is a user proxy of the reactive proxy
821 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
822 return target;
823 }
824 return;
825 }
826 const targetIsArray = isArray(target);
827 if (!isReadonly2) {
828 if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
829 return Reflect.get(arrayInstrumentations, key, receiver);
830 }
831 if (key === "hasOwnProperty") {
832 return hasOwnProperty;
833 }
834 }
835 const res = Reflect.get(target, key, receiver);
836 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
837 return res;
838 }
839 if (!isReadonly2) {
840 track(target, "get", key);
841 }
842 if (isShallow2) {
843 return res;
844 }
845 if (isRef(res)) {
846 return targetIsArray && isIntegerKey(key) ? res : res.value;
847 }
848 if (isObject(res)) {
849 return isReadonly2 ? readonly(res) : reactive(res);
850 }
851 return res;
852 }
853}
854class MutableReactiveHandler extends BaseReactiveHandler {
855 constructor(isShallow2 = false) {
856 super(false, isShallow2);
857 }
858 set(target, key, value, receiver) {
859 let oldValue = target[key];
860 if (!this._isShallow) {
861 const isOldValueReadonly = isReadonly(oldValue);
862 if (!isShallow(value) && !isReadonly(value)) {
863 oldValue = toRaw(oldValue);
864 value = toRaw(value);
865 }
866 if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
867 if (isOldValueReadonly) {
868 return false;
869 } else {
870 oldValue.value = value;
871 return true;
872 }
873 }
874 }
875 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
876 const result = Reflect.set(target, key, value, receiver);
877 if (target === toRaw(receiver)) {
878 if (!hadKey) {
879 trigger(target, "add", key, value);
880 } else if (hasChanged(value, oldValue)) {
881 trigger(target, "set", key, value, oldValue);
882 }
883 }
884 return result;
885 }
886 deleteProperty(target, key) {
887 const hadKey = hasOwn(target, key);
888 const oldValue = target[key];
889 const result = Reflect.deleteProperty(target, key);
890 if (result && hadKey) {
891 trigger(target, "delete", key, void 0, oldValue);
892 }
893 return result;
894 }
895 has(target, key) {
896 const result = Reflect.has(target, key);
897 if (!isSymbol(key) || !builtInSymbols.has(key)) {
898 track(target, "has", key);
899 }
900 return result;
901 }
902 ownKeys(target) {
903 track(
904 target,
905 "iterate",
906 isArray(target) ? "length" : ITERATE_KEY
907 );
908 return Reflect.ownKeys(target);
909 }
910}
911class ReadonlyReactiveHandler extends BaseReactiveHandler {
912 constructor(isShallow2 = false) {
913 super(true, isShallow2);
914 }
915 set(target, key) {
916 {
917 warn$2(
918 `Set operation on key "${String(key)}" failed: target is readonly.`,
919 target
920 );
921 }
922 return true;
923 }
924 deleteProperty(target, key) {
925 {
926 warn$2(
927 `Delete operation on key "${String(key)}" failed: target is readonly.`,
928 target
929 );
930 }
931 return true;
932 }
933}
934const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
935const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
936const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
937 true
938);
939const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
940
941const toShallow = (value) => value;
942const getProto = (v) => Reflect.getPrototypeOf(v);
943function get(target, key, isReadonly = false, isShallow = false) {
944 target = target["__v_raw"];
945 const rawTarget = toRaw(target);
946 const rawKey = toRaw(key);
947 if (!isReadonly) {
948 if (hasChanged(key, rawKey)) {
949 track(rawTarget, "get", key);
950 }
951 track(rawTarget, "get", rawKey);
952 }
953 const { has: has2 } = getProto(rawTarget);
954 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
955 if (has2.call(rawTarget, key)) {
956 return wrap(target.get(key));
957 } else if (has2.call(rawTarget, rawKey)) {
958 return wrap(target.get(rawKey));
959 } else if (target !== rawTarget) {
960 target.get(key);
961 }
962}
963function has(key, isReadonly = false) {
964 const target = this["__v_raw"];
965 const rawTarget = toRaw(target);
966 const rawKey = toRaw(key);
967 if (!isReadonly) {
968 if (hasChanged(key, rawKey)) {
969 track(rawTarget, "has", key);
970 }
971 track(rawTarget, "has", rawKey);
972 }
973 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
974}
975function size(target, isReadonly = false) {
976 target = target["__v_raw"];
977 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
978 return Reflect.get(target, "size", target);
979}
980function add(value) {
981 value = toRaw(value);
982 const target = toRaw(this);
983 const proto = getProto(target);
984 const hadKey = proto.has.call(target, value);
985 if (!hadKey) {
986 target.add(value);
987 trigger(target, "add", value, value);
988 }
989 return this;
990}
991function set(key, value) {
992 value = toRaw(value);
993 const target = toRaw(this);
994 const { has: has2, get: get2 } = getProto(target);
995 let hadKey = has2.call(target, key);
996 if (!hadKey) {
997 key = toRaw(key);
998 hadKey = has2.call(target, key);
999 } else {
1000 checkIdentityKeys(target, has2, key);
1001 }
1002 const oldValue = get2.call(target, key);
1003 target.set(key, value);
1004 if (!hadKey) {
1005 trigger(target, "add", key, value);
1006 } else if (hasChanged(value, oldValue)) {
1007 trigger(target, "set", key, value, oldValue);
1008 }
1009 return this;
1010}
1011function deleteEntry(key) {
1012 const target = toRaw(this);
1013 const { has: has2, get: get2 } = getProto(target);
1014 let hadKey = has2.call(target, key);
1015 if (!hadKey) {
1016 key = toRaw(key);
1017 hadKey = has2.call(target, key);
1018 } else {
1019 checkIdentityKeys(target, has2, key);
1020 }
1021 const oldValue = get2 ? get2.call(target, key) : void 0;
1022 const result = target.delete(key);
1023 if (hadKey) {
1024 trigger(target, "delete", key, void 0, oldValue);
1025 }
1026 return result;
1027}
1028function clear() {
1029 const target = toRaw(this);
1030 const hadItems = target.size !== 0;
1031 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
1032 const result = target.clear();
1033 if (hadItems) {
1034 trigger(target, "clear", void 0, void 0, oldTarget);
1035 }
1036 return result;
1037}
1038function createForEach(isReadonly, isShallow) {
1039 return function forEach(callback, thisArg) {
1040 const observed = this;
1041 const target = observed["__v_raw"];
1042 const rawTarget = toRaw(target);
1043 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1044 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
1045 return target.forEach((value, key) => {
1046 return callback.call(thisArg, wrap(value), wrap(key), observed);
1047 });
1048 };
1049}
1050function createIterableMethod(method, isReadonly, isShallow) {
1051 return function(...args) {
1052 const target = this["__v_raw"];
1053 const rawTarget = toRaw(target);
1054 const targetIsMap = isMap(rawTarget);
1055 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1056 const isKeyOnly = method === "keys" && targetIsMap;
1057 const innerIterator = target[method](...args);
1058 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1059 !isReadonly && track(
1060 rawTarget,
1061 "iterate",
1062 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1063 );
1064 return {
1065 // iterator protocol
1066 next() {
1067 const { value, done } = innerIterator.next();
1068 return done ? { value, done } : {
1069 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1070 done
1071 };
1072 },
1073 // iterable protocol
1074 [Symbol.iterator]() {
1075 return this;
1076 }
1077 };
1078 };
1079}
1080function createReadonlyMethod(type) {
1081 return function(...args) {
1082 {
1083 const key = args[0] ? `on key "${args[0]}" ` : ``;
1084 warn$2(
1085 `${capitalize(type)} operation ${key}failed: target is readonly.`,
1086 toRaw(this)
1087 );
1088 }
1089 return type === "delete" ? false : type === "clear" ? void 0 : this;
1090 };
1091}
1092function createInstrumentations() {
1093 const mutableInstrumentations2 = {
1094 get(key) {
1095 return get(this, key);
1096 },
1097 get size() {
1098 return size(this);
1099 },
1100 has,
1101 add,
1102 set,
1103 delete: deleteEntry,
1104 clear,
1105 forEach: createForEach(false, false)
1106 };
1107 const shallowInstrumentations2 = {
1108 get(key) {
1109 return get(this, key, false, true);
1110 },
1111 get size() {
1112 return size(this);
1113 },
1114 has,
1115 add,
1116 set,
1117 delete: deleteEntry,
1118 clear,
1119 forEach: createForEach(false, true)
1120 };
1121 const readonlyInstrumentations2 = {
1122 get(key) {
1123 return get(this, key, true);
1124 },
1125 get size() {
1126 return size(this, true);
1127 },
1128 has(key) {
1129 return has.call(this, key, true);
1130 },
1131 add: createReadonlyMethod("add"),
1132 set: createReadonlyMethod("set"),
1133 delete: createReadonlyMethod("delete"),
1134 clear: createReadonlyMethod("clear"),
1135 forEach: createForEach(true, false)
1136 };
1137 const shallowReadonlyInstrumentations2 = {
1138 get(key) {
1139 return get(this, key, true, true);
1140 },
1141 get size() {
1142 return size(this, true);
1143 },
1144 has(key) {
1145 return has.call(this, key, true);
1146 },
1147 add: createReadonlyMethod("add"),
1148 set: createReadonlyMethod("set"),
1149 delete: createReadonlyMethod("delete"),
1150 clear: createReadonlyMethod("clear"),
1151 forEach: createForEach(true, true)
1152 };
1153 const iteratorMethods = [
1154 "keys",
1155 "values",
1156 "entries",
1157 Symbol.iterator
1158 ];
1159 iteratorMethods.forEach((method) => {
1160 mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1161 readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1162 shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1163 shallowReadonlyInstrumentations2[method] = createIterableMethod(
1164 method,
1165 true,
1166 true
1167 );
1168 });
1169 return [
1170 mutableInstrumentations2,
1171 readonlyInstrumentations2,
1172 shallowInstrumentations2,
1173 shallowReadonlyInstrumentations2
1174 ];
1175}
1176const [
1177 mutableInstrumentations,
1178 readonlyInstrumentations,
1179 shallowInstrumentations,
1180 shallowReadonlyInstrumentations
1181] = /* @__PURE__ */ createInstrumentations();
1182function createInstrumentationGetter(isReadonly, shallow) {
1183 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
1184 return (target, key, receiver) => {
1185 if (key === "__v_isReactive") {
1186 return !isReadonly;
1187 } else if (key === "__v_isReadonly") {
1188 return isReadonly;
1189 } else if (key === "__v_raw") {
1190 return target;
1191 }
1192 return Reflect.get(
1193 hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1194 key,
1195 receiver
1196 );
1197 };
1198}
1199const mutableCollectionHandlers = {
1200 get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1201};
1202const shallowCollectionHandlers = {
1203 get: /* @__PURE__ */ createInstrumentationGetter(false, true)
1204};
1205const readonlyCollectionHandlers = {
1206 get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1207};
1208const shallowReadonlyCollectionHandlers = {
1209 get: /* @__PURE__ */ createInstrumentationGetter(true, true)
1210};
1211function checkIdentityKeys(target, has2, key) {
1212 const rawKey = toRaw(key);
1213 if (rawKey !== key && has2.call(target, rawKey)) {
1214 const type = toRawType(target);
1215 warn$2(
1216 `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.`
1217 );
1218 }
1219}
1220
1221const reactiveMap = /* @__PURE__ */ new WeakMap();
1222const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1223const readonlyMap = /* @__PURE__ */ new WeakMap();
1224const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1225function targetTypeMap(rawType) {
1226 switch (rawType) {
1227 case "Object":
1228 case "Array":
1229 return 1 /* COMMON */;
1230 case "Map":
1231 case "Set":
1232 case "WeakMap":
1233 case "WeakSet":
1234 return 2 /* COLLECTION */;
1235 default:
1236 return 0 /* INVALID */;
1237 }
1238}
1239function getTargetType(value) {
1240 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1241}
1242function reactive(target) {
1243 if (isReadonly(target)) {
1244 return target;
1245 }
1246 return createReactiveObject(
1247 target,
1248 false,
1249 mutableHandlers,
1250 mutableCollectionHandlers,
1251 reactiveMap
1252 );
1253}
1254function shallowReactive(target) {
1255 return createReactiveObject(
1256 target,
1257 false,
1258 shallowReactiveHandlers,
1259 shallowCollectionHandlers,
1260 shallowReactiveMap
1261 );
1262}
1263function readonly(target) {
1264 return createReactiveObject(
1265 target,
1266 true,
1267 readonlyHandlers,
1268 readonlyCollectionHandlers,
1269 readonlyMap
1270 );
1271}
1272function shallowReadonly(target) {
1273 return createReactiveObject(
1274 target,
1275 true,
1276 shallowReadonlyHandlers,
1277 shallowReadonlyCollectionHandlers,
1278 shallowReadonlyMap
1279 );
1280}
1281function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1282 if (!isObject(target)) {
1283 {
1284 warn$2(`value cannot be made reactive: ${String(target)}`);
1285 }
1286 return target;
1287 }
1288 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1289 return target;
1290 }
1291 const existingProxy = proxyMap.get(target);
1292 if (existingProxy) {
1293 return existingProxy;
1294 }
1295 const targetType = getTargetType(target);
1296 if (targetType === 0 /* INVALID */) {
1297 return target;
1298 }
1299 const proxy = new Proxy(
1300 target,
1301 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1302 );
1303 proxyMap.set(target, proxy);
1304 return proxy;
1305}
1306function isReactive(value) {
1307 if (isReadonly(value)) {
1308 return isReactive(value["__v_raw"]);
1309 }
1310 return !!(value && value["__v_isReactive"]);
1311}
1312function isReadonly(value) {
1313 return !!(value && value["__v_isReadonly"]);
1314}
1315function isShallow(value) {
1316 return !!(value && value["__v_isShallow"]);
1317}
1318function isProxy(value) {
1319 return value ? !!value["__v_raw"] : false;
1320}
1321function toRaw(observed) {
1322 const raw = observed && observed["__v_raw"];
1323 return raw ? toRaw(raw) : observed;
1324}
1325function markRaw(value) {
1326 if (Object.isExtensible(value)) {
1327 def(value, "__v_skip", true);
1328 }
1329 return value;
1330}
1331const toReactive = (value) => isObject(value) ? reactive(value) : value;
1332const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1333
1334const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1335class ComputedRefImpl {
1336 constructor(getter, _setter, isReadonly, isSSR) {
1337 this.getter = getter;
1338 this._setter = _setter;
1339 this.dep = void 0;
1340 this.__v_isRef = true;
1341 this["__v_isReadonly"] = false;
1342 this.effect = new ReactiveEffect(
1343 () => getter(this._value),
1344 () => triggerRefValue(
1345 this,
1346 this.effect._dirtyLevel === 2 ? 2 : 3
1347 )
1348 );
1349 this.effect.computed = this;
1350 this.effect.active = this._cacheable = !isSSR;
1351 this["__v_isReadonly"] = isReadonly;
1352 }
1353 get value() {
1354 const self = toRaw(this);
1355 if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1356 triggerRefValue(self, 4);
1357 }
1358 trackRefValue(self);
1359 if (self.effect._dirtyLevel >= 2) {
1360 if (this._warnRecursive) {
1361 warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1362
1363getter: `, this.getter);
1364 }
1365 triggerRefValue(self, 2);
1366 }
1367 return self._value;
1368 }
1369 set value(newValue) {
1370 this._setter(newValue);
1371 }
1372 // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1373 get _dirty() {
1374 return this.effect.dirty;
1375 }
1376 set _dirty(v) {
1377 this.effect.dirty = v;
1378 }
1379 // #endregion
1380}
1381function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1382 let getter;
1383 let setter;
1384 const onlyGetter = isFunction(getterOrOptions);
1385 if (onlyGetter) {
1386 getter = getterOrOptions;
1387 setter = () => {
1388 warn$2("Write operation failed: computed value is readonly");
1389 } ;
1390 } else {
1391 getter = getterOrOptions.get;
1392 setter = getterOrOptions.set;
1393 }
1394 const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1395 if (debugOptions && !isSSR) {
1396 cRef.effect.onTrack = debugOptions.onTrack;
1397 cRef.effect.onTrigger = debugOptions.onTrigger;
1398 }
1399 return cRef;
1400}
1401
1402function trackRefValue(ref2) {
1403 var _a;
1404 if (shouldTrack && activeEffect) {
1405 ref2 = toRaw(ref2);
1406 trackEffect(
1407 activeEffect,
1408 (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1409 () => ref2.dep = void 0,
1410 ref2 instanceof ComputedRefImpl ? ref2 : void 0
1411 ),
1412 {
1413 target: ref2,
1414 type: "get",
1415 key: "value"
1416 }
1417 );
1418 }
1419}
1420function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1421 ref2 = toRaw(ref2);
1422 const dep = ref2.dep;
1423 if (dep) {
1424 triggerEffects(
1425 dep,
1426 dirtyLevel,
1427 {
1428 target: ref2,
1429 type: "set",
1430 key: "value",
1431 newValue: newVal
1432 }
1433 );
1434 }
1435}
1436function isRef(r) {
1437 return !!(r && r.__v_isRef === true);
1438}
1439function ref(value) {
1440 return createRef(value, false);
1441}
1442function shallowRef(value) {
1443 return createRef(value, true);
1444}
1445function createRef(rawValue, shallow) {
1446 if (isRef(rawValue)) {
1447 return rawValue;
1448 }
1449 return new RefImpl(rawValue, shallow);
1450}
1451class RefImpl {
1452 constructor(value, __v_isShallow) {
1453 this.__v_isShallow = __v_isShallow;
1454 this.dep = void 0;
1455 this.__v_isRef = true;
1456 this._rawValue = __v_isShallow ? value : toRaw(value);
1457 this._value = __v_isShallow ? value : toReactive(value);
1458 }
1459 get value() {
1460 trackRefValue(this);
1461 return this._value;
1462 }
1463 set value(newVal) {
1464 const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1465 newVal = useDirectValue ? newVal : toRaw(newVal);
1466 if (hasChanged(newVal, this._rawValue)) {
1467 this._rawValue = newVal;
1468 this._value = useDirectValue ? newVal : toReactive(newVal);
1469 triggerRefValue(this, 4, newVal);
1470 }
1471 }
1472}
1473function triggerRef(ref2) {
1474 triggerRefValue(ref2, 4, ref2.value );
1475}
1476function unref(ref2) {
1477 return isRef(ref2) ? ref2.value : ref2;
1478}
1479function toValue(source) {
1480 return isFunction(source) ? source() : unref(source);
1481}
1482const shallowUnwrapHandlers = {
1483 get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1484 set: (target, key, value, receiver) => {
1485 const oldValue = target[key];
1486 if (isRef(oldValue) && !isRef(value)) {
1487 oldValue.value = value;
1488 return true;
1489 } else {
1490 return Reflect.set(target, key, value, receiver);
1491 }
1492 }
1493};
1494function proxyRefs(objectWithRefs) {
1495 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1496}
1497class CustomRefImpl {
1498 constructor(factory) {
1499 this.dep = void 0;
1500 this.__v_isRef = true;
1501 const { get, set } = factory(
1502 () => trackRefValue(this),
1503 () => triggerRefValue(this)
1504 );
1505 this._get = get;
1506 this._set = set;
1507 }
1508 get value() {
1509 return this._get();
1510 }
1511 set value(newVal) {
1512 this._set(newVal);
1513 }
1514}
1515function customRef(factory) {
1516 return new CustomRefImpl(factory);
1517}
1518function toRefs(object) {
1519 if (!isProxy(object)) {
1520 warn$2(`toRefs() expects a reactive object but received a plain one.`);
1521 }
1522 const ret = isArray(object) ? new Array(object.length) : {};
1523 for (const key in object) {
1524 ret[key] = propertyToRef(object, key);
1525 }
1526 return ret;
1527}
1528class ObjectRefImpl {
1529 constructor(_object, _key, _defaultValue) {
1530 this._object = _object;
1531 this._key = _key;
1532 this._defaultValue = _defaultValue;
1533 this.__v_isRef = true;
1534 }
1535 get value() {
1536 const val = this._object[this._key];
1537 return val === void 0 ? this._defaultValue : val;
1538 }
1539 set value(newVal) {
1540 this._object[this._key] = newVal;
1541 }
1542 get dep() {
1543 return getDepFromReactive(toRaw(this._object), this._key);
1544 }
1545}
1546class GetterRefImpl {
1547 constructor(_getter) {
1548 this._getter = _getter;
1549 this.__v_isRef = true;
1550 this.__v_isReadonly = true;
1551 }
1552 get value() {
1553 return this._getter();
1554 }
1555}
1556function toRef(source, key, defaultValue) {
1557 if (isRef(source)) {
1558 return source;
1559 } else if (isFunction(source)) {
1560 return new GetterRefImpl(source);
1561 } else if (isObject(source) && arguments.length > 1) {
1562 return propertyToRef(source, key, defaultValue);
1563 } else {
1564 return ref(source);
1565 }
1566}
1567function propertyToRef(source, key, defaultValue) {
1568 const val = source[key];
1569 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1570}
1571
1572const TrackOpTypes = {
1573 "GET": "get",
1574 "HAS": "has",
1575 "ITERATE": "iterate"
1576};
1577const TriggerOpTypes = {
1578 "SET": "set",
1579 "ADD": "add",
1580 "DELETE": "delete",
1581 "CLEAR": "clear"
1582};
1583
1584const stack$1 = [];
1585function pushWarningContext(vnode) {
1586 stack$1.push(vnode);
1587}
1588function popWarningContext() {
1589 stack$1.pop();
1590}
1591function warn$1(msg, ...args) {
1592 pauseTracking();
1593 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1594 const appWarnHandler = instance && instance.appContext.config.warnHandler;
1595 const trace = getComponentTrace();
1596 if (appWarnHandler) {
1597 callWithErrorHandling(
1598 appWarnHandler,
1599 instance,
1600 11,
1601 [
1602 msg + args.map((a) => {
1603 var _a, _b;
1604 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1605 }).join(""),
1606 instance && instance.proxy,
1607 trace.map(
1608 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
1609 ).join("\n"),
1610 trace
1611 ]
1612 );
1613 } else {
1614 const warnArgs = [`[Vue warn]: ${msg}`, ...args];
1615 if (trace.length && // avoid spamming console during tests
1616 true) {
1617 warnArgs.push(`
1618`, ...formatTrace(trace));
1619 }
1620 console.warn(...warnArgs);
1621 }
1622 resetTracking();
1623}
1624function getComponentTrace() {
1625 let currentVNode = stack$1[stack$1.length - 1];
1626 if (!currentVNode) {
1627 return [];
1628 }
1629 const normalizedStack = [];
1630 while (currentVNode) {
1631 const last = normalizedStack[0];
1632 if (last && last.vnode === currentVNode) {
1633 last.recurseCount++;
1634 } else {
1635 normalizedStack.push({
1636 vnode: currentVNode,
1637 recurseCount: 0
1638 });
1639 }
1640 const parentInstance = currentVNode.component && currentVNode.component.parent;
1641 currentVNode = parentInstance && parentInstance.vnode;
1642 }
1643 return normalizedStack;
1644}
1645function formatTrace(trace) {
1646 const logs = [];
1647 trace.forEach((entry, i) => {
1648 logs.push(...i === 0 ? [] : [`
1649`], ...formatTraceEntry(entry));
1650 });
1651 return logs;
1652}
1653function formatTraceEntry({ vnode, recurseCount }) {
1654 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
1655 const isRoot = vnode.component ? vnode.component.parent == null : false;
1656 const open = ` at <${formatComponentName(
1657 vnode.component,
1658 vnode.type,
1659 isRoot
1660 )}`;
1661 const close = `>` + postfix;
1662 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
1663}
1664function formatProps(props) {
1665 const res = [];
1666 const keys = Object.keys(props);
1667 keys.slice(0, 3).forEach((key) => {
1668 res.push(...formatProp(key, props[key]));
1669 });
1670 if (keys.length > 3) {
1671 res.push(` ...`);
1672 }
1673 return res;
1674}
1675function formatProp(key, value, raw) {
1676 if (isString(value)) {
1677 value = JSON.stringify(value);
1678 return raw ? value : [`${key}=${value}`];
1679 } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
1680 return raw ? value : [`${key}=${value}`];
1681 } else if (isRef(value)) {
1682 value = formatProp(key, toRaw(value.value), true);
1683 return raw ? value : [`${key}=Ref<`, value, `>`];
1684 } else if (isFunction(value)) {
1685 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1686 } else {
1687 value = toRaw(value);
1688 return raw ? value : [`${key}=`, value];
1689 }
1690}
1691function assertNumber(val, type) {
1692 if (val === void 0) {
1693 return;
1694 } else if (typeof val !== "number") {
1695 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
1696 } else if (isNaN(val)) {
1697 warn$1(`${type} is NaN - the duration expression might be incorrect.`);
1698 }
1699}
1700
1701const ErrorCodes = {
1702 "SETUP_FUNCTION": 0,
1703 "0": "SETUP_FUNCTION",
1704 "RENDER_FUNCTION": 1,
1705 "1": "RENDER_FUNCTION",
1706 "WATCH_GETTER": 2,
1707 "2": "WATCH_GETTER",
1708 "WATCH_CALLBACK": 3,
1709 "3": "WATCH_CALLBACK",
1710 "WATCH_CLEANUP": 4,
1711 "4": "WATCH_CLEANUP",
1712 "NATIVE_EVENT_HANDLER": 5,
1713 "5": "NATIVE_EVENT_HANDLER",
1714 "COMPONENT_EVENT_HANDLER": 6,
1715 "6": "COMPONENT_EVENT_HANDLER",
1716 "VNODE_HOOK": 7,
1717 "7": "VNODE_HOOK",
1718 "DIRECTIVE_HOOK": 8,
1719 "8": "DIRECTIVE_HOOK",
1720 "TRANSITION_HOOK": 9,
1721 "9": "TRANSITION_HOOK",
1722 "APP_ERROR_HANDLER": 10,
1723 "10": "APP_ERROR_HANDLER",
1724 "APP_WARN_HANDLER": 11,
1725 "11": "APP_WARN_HANDLER",
1726 "FUNCTION_REF": 12,
1727 "12": "FUNCTION_REF",
1728 "ASYNC_COMPONENT_LOADER": 13,
1729 "13": "ASYNC_COMPONENT_LOADER",
1730 "SCHEDULER": 14,
1731 "14": "SCHEDULER"
1732};
1733const ErrorTypeStrings$1 = {
1734 ["sp"]: "serverPrefetch hook",
1735 ["bc"]: "beforeCreate hook",
1736 ["c"]: "created hook",
1737 ["bm"]: "beforeMount hook",
1738 ["m"]: "mounted hook",
1739 ["bu"]: "beforeUpdate hook",
1740 ["u"]: "updated",
1741 ["bum"]: "beforeUnmount hook",
1742 ["um"]: "unmounted hook",
1743 ["a"]: "activated hook",
1744 ["da"]: "deactivated hook",
1745 ["ec"]: "errorCaptured hook",
1746 ["rtc"]: "renderTracked hook",
1747 ["rtg"]: "renderTriggered hook",
1748 [0]: "setup function",
1749 [1]: "render function",
1750 [2]: "watcher getter",
1751 [3]: "watcher callback",
1752 [4]: "watcher cleanup function",
1753 [5]: "native event handler",
1754 [6]: "component event handler",
1755 [7]: "vnode hook",
1756 [8]: "directive hook",
1757 [9]: "transition hook",
1758 [10]: "app errorHandler",
1759 [11]: "app warnHandler",
1760 [12]: "ref function",
1761 [13]: "async component loader",
1762 [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1763};
1764function callWithErrorHandling(fn, instance, type, args) {
1765 try {
1766 return args ? fn(...args) : fn();
1767 } catch (err) {
1768 handleError(err, instance, type);
1769 }
1770}
1771function callWithAsyncErrorHandling(fn, instance, type, args) {
1772 if (isFunction(fn)) {
1773 const res = callWithErrorHandling(fn, instance, type, args);
1774 if (res && isPromise(res)) {
1775 res.catch((err) => {
1776 handleError(err, instance, type);
1777 });
1778 }
1779 return res;
1780 }
1781 if (isArray(fn)) {
1782 const values = [];
1783 for (let i = 0; i < fn.length; i++) {
1784 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1785 }
1786 return values;
1787 } else {
1788 warn$1(
1789 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1790 );
1791 }
1792}
1793function handleError(err, instance, type, throwInDev = true) {
1794 const contextVNode = instance ? instance.vnode : null;
1795 if (instance) {
1796 let cur = instance.parent;
1797 const exposedInstance = instance.proxy;
1798 const errorInfo = ErrorTypeStrings$1[type] ;
1799 while (cur) {
1800 const errorCapturedHooks = cur.ec;
1801 if (errorCapturedHooks) {
1802 for (let i = 0; i < errorCapturedHooks.length; i++) {
1803 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1804 return;
1805 }
1806 }
1807 }
1808 cur = cur.parent;
1809 }
1810 const appErrorHandler = instance.appContext.config.errorHandler;
1811 if (appErrorHandler) {
1812 pauseTracking();
1813 callWithErrorHandling(
1814 appErrorHandler,
1815 null,
1816 10,
1817 [err, exposedInstance, errorInfo]
1818 );
1819 resetTracking();
1820 return;
1821 }
1822 }
1823 logError(err, type, contextVNode, throwInDev);
1824}
1825function logError(err, type, contextVNode, throwInDev = true) {
1826 {
1827 const info = ErrorTypeStrings$1[type];
1828 if (contextVNode) {
1829 pushWarningContext(contextVNode);
1830 }
1831 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1832 if (contextVNode) {
1833 popWarningContext();
1834 }
1835 if (throwInDev) {
1836 throw err;
1837 } else {
1838 console.error(err);
1839 }
1840 }
1841}
1842
1843let isFlushing = false;
1844let isFlushPending = false;
1845const queue = [];
1846let flushIndex = 0;
1847const pendingPostFlushCbs = [];
1848let activePostFlushCbs = null;
1849let postFlushIndex = 0;
1850const resolvedPromise = /* @__PURE__ */ Promise.resolve();
1851let currentFlushPromise = null;
1852const RECURSION_LIMIT = 100;
1853function nextTick(fn) {
1854 const p = currentFlushPromise || resolvedPromise;
1855 return fn ? p.then(this ? fn.bind(this) : fn) : p;
1856}
1857function findInsertionIndex(id) {
1858 let start = flushIndex + 1;
1859 let end = queue.length;
1860 while (start < end) {
1861 const middle = start + end >>> 1;
1862 const middleJob = queue[middle];
1863 const middleJobId = getId(middleJob);
1864 if (middleJobId < id || middleJobId === id && middleJob.pre) {
1865 start = middle + 1;
1866 } else {
1867 end = middle;
1868 }
1869 }
1870 return start;
1871}
1872function queueJob(job) {
1873 if (!queue.length || !queue.includes(
1874 job,
1875 isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1876 )) {
1877 if (job.id == null) {
1878 queue.push(job);
1879 } else {
1880 queue.splice(findInsertionIndex(job.id), 0, job);
1881 }
1882 queueFlush();
1883 }
1884}
1885function queueFlush() {
1886 if (!isFlushing && !isFlushPending) {
1887 isFlushPending = true;
1888 currentFlushPromise = resolvedPromise.then(flushJobs);
1889 }
1890}
1891function invalidateJob(job) {
1892 const i = queue.indexOf(job);
1893 if (i > flushIndex) {
1894 queue.splice(i, 1);
1895 }
1896}
1897function queuePostFlushCb(cb) {
1898 if (!isArray(cb)) {
1899 if (!activePostFlushCbs || !activePostFlushCbs.includes(
1900 cb,
1901 cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1902 )) {
1903 pendingPostFlushCbs.push(cb);
1904 }
1905 } else {
1906 pendingPostFlushCbs.push(...cb);
1907 }
1908 queueFlush();
1909}
1910function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1911 {
1912 seen = seen || /* @__PURE__ */ new Map();
1913 }
1914 for (; i < queue.length; i++) {
1915 const cb = queue[i];
1916 if (cb && cb.pre) {
1917 if (instance && cb.id !== instance.uid) {
1918 continue;
1919 }
1920 if (checkRecursiveUpdates(seen, cb)) {
1921 continue;
1922 }
1923 queue.splice(i, 1);
1924 i--;
1925 cb();
1926 }
1927 }
1928}
1929function flushPostFlushCbs(seen) {
1930 if (pendingPostFlushCbs.length) {
1931 const deduped = [...new Set(pendingPostFlushCbs)].sort(
1932 (a, b) => getId(a) - getId(b)
1933 );
1934 pendingPostFlushCbs.length = 0;
1935 if (activePostFlushCbs) {
1936 activePostFlushCbs.push(...deduped);
1937 return;
1938 }
1939 activePostFlushCbs = deduped;
1940 {
1941 seen = seen || /* @__PURE__ */ new Map();
1942 }
1943 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1944 if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1945 continue;
1946 }
1947 activePostFlushCbs[postFlushIndex]();
1948 }
1949 activePostFlushCbs = null;
1950 postFlushIndex = 0;
1951 }
1952}
1953const getId = (job) => job.id == null ? Infinity : job.id;
1954const comparator = (a, b) => {
1955 const diff = getId(a) - getId(b);
1956 if (diff === 0) {
1957 if (a.pre && !b.pre)
1958 return -1;
1959 if (b.pre && !a.pre)
1960 return 1;
1961 }
1962 return diff;
1963};
1964function flushJobs(seen) {
1965 isFlushPending = false;
1966 isFlushing = true;
1967 {
1968 seen = seen || /* @__PURE__ */ new Map();
1969 }
1970 queue.sort(comparator);
1971 const check = (job) => checkRecursiveUpdates(seen, job) ;
1972 try {
1973 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1974 const job = queue[flushIndex];
1975 if (job && job.active !== false) {
1976 if (check(job)) {
1977 continue;
1978 }
1979 callWithErrorHandling(job, null, 14);
1980 }
1981 }
1982 } finally {
1983 flushIndex = 0;
1984 queue.length = 0;
1985 flushPostFlushCbs(seen);
1986 isFlushing = false;
1987 currentFlushPromise = null;
1988 if (queue.length || pendingPostFlushCbs.length) {
1989 flushJobs(seen);
1990 }
1991 }
1992}
1993function checkRecursiveUpdates(seen, fn) {
1994 if (!seen.has(fn)) {
1995 seen.set(fn, 1);
1996 } else {
1997 const count = seen.get(fn);
1998 if (count > RECURSION_LIMIT) {
1999 const instance = fn.ownerInstance;
2000 const componentName = instance && getComponentName(instance.type);
2001 handleError(
2002 `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.`,
2003 null,
2004 10
2005 );
2006 return true;
2007 } else {
2008 seen.set(fn, count + 1);
2009 }
2010 }
2011}
2012
2013let isHmrUpdating = false;
2014const hmrDirtyComponents = /* @__PURE__ */ new Set();
2015{
2016 getGlobalThis().__VUE_HMR_RUNTIME__ = {
2017 createRecord: tryWrap(createRecord),
2018 rerender: tryWrap(rerender),
2019 reload: tryWrap(reload)
2020 };
2021}
2022const map = /* @__PURE__ */ new Map();
2023function registerHMR(instance) {
2024 const id = instance.type.__hmrId;
2025 let record = map.get(id);
2026 if (!record) {
2027 createRecord(id, instance.type);
2028 record = map.get(id);
2029 }
2030 record.instances.add(instance);
2031}
2032function unregisterHMR(instance) {
2033 map.get(instance.type.__hmrId).instances.delete(instance);
2034}
2035function createRecord(id, initialDef) {
2036 if (map.has(id)) {
2037 return false;
2038 }
2039 map.set(id, {
2040 initialDef: normalizeClassComponent(initialDef),
2041 instances: /* @__PURE__ */ new Set()
2042 });
2043 return true;
2044}
2045function normalizeClassComponent(component) {
2046 return isClassComponent(component) ? component.__vccOpts : component;
2047}
2048function rerender(id, newRender) {
2049 const record = map.get(id);
2050 if (!record) {
2051 return;
2052 }
2053 record.initialDef.render = newRender;
2054 [...record.instances].forEach((instance) => {
2055 if (newRender) {
2056 instance.render = newRender;
2057 normalizeClassComponent(instance.type).render = newRender;
2058 }
2059 instance.renderCache = [];
2060 isHmrUpdating = true;
2061 instance.effect.dirty = true;
2062 instance.update();
2063 isHmrUpdating = false;
2064 });
2065}
2066function reload(id, newComp) {
2067 const record = map.get(id);
2068 if (!record)
2069 return;
2070 newComp = normalizeClassComponent(newComp);
2071 updateComponentDef(record.initialDef, newComp);
2072 const instances = [...record.instances];
2073 for (const instance of instances) {
2074 const oldComp = normalizeClassComponent(instance.type);
2075 if (!hmrDirtyComponents.has(oldComp)) {
2076 if (oldComp !== record.initialDef) {
2077 updateComponentDef(oldComp, newComp);
2078 }
2079 hmrDirtyComponents.add(oldComp);
2080 }
2081 instance.appContext.propsCache.delete(instance.type);
2082 instance.appContext.emitsCache.delete(instance.type);
2083 instance.appContext.optionsCache.delete(instance.type);
2084 if (instance.ceReload) {
2085 hmrDirtyComponents.add(oldComp);
2086 instance.ceReload(newComp.styles);
2087 hmrDirtyComponents.delete(oldComp);
2088 } else if (instance.parent) {
2089 instance.parent.effect.dirty = true;
2090 queueJob(instance.parent.update);
2091 } else if (instance.appContext.reload) {
2092 instance.appContext.reload();
2093 } else if (typeof window !== "undefined") {
2094 window.location.reload();
2095 } else {
2096 console.warn(
2097 "[HMR] Root or manually mounted instance modified. Full reload required."
2098 );
2099 }
2100 }
2101 queuePostFlushCb(() => {
2102 for (const instance of instances) {
2103 hmrDirtyComponents.delete(
2104 normalizeClassComponent(instance.type)
2105 );
2106 }
2107 });
2108}
2109function updateComponentDef(oldComp, newComp) {
2110 extend(oldComp, newComp);
2111 for (const key in oldComp) {
2112 if (key !== "__file" && !(key in newComp)) {
2113 delete oldComp[key];
2114 }
2115 }
2116}
2117function tryWrap(fn) {
2118 return (id, arg) => {
2119 try {
2120 return fn(id, arg);
2121 } catch (e) {
2122 console.error(e);
2123 console.warn(
2124 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
2125 );
2126 }
2127 };
2128}
2129
2130let devtools$1;
2131let buffer = [];
2132let devtoolsNotInstalled = false;
2133function emit$1(event, ...args) {
2134 if (devtools$1) {
2135 devtools$1.emit(event, ...args);
2136 } else if (!devtoolsNotInstalled) {
2137 buffer.push({ event, args });
2138 }
2139}
2140function setDevtoolsHook$1(hook, target) {
2141 var _a, _b;
2142 devtools$1 = hook;
2143 if (devtools$1) {
2144 devtools$1.enabled = true;
2145 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
2146 buffer = [];
2147 } else if (
2148 // handle late devtools injection - only do this if we are in an actual
2149 // browser environment to avoid the timer handle stalling test runner exit
2150 // (#4815)
2151 typeof window !== "undefined" && // some envs mock window but not fully
2152 window.HTMLElement && // also exclude jsdom
2153 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
2154 ) {
2155 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
2156 replay.push((newHook) => {
2157 setDevtoolsHook$1(newHook, target);
2158 });
2159 setTimeout(() => {
2160 if (!devtools$1) {
2161 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
2162 devtoolsNotInstalled = true;
2163 buffer = [];
2164 }
2165 }, 3e3);
2166 } else {
2167 devtoolsNotInstalled = true;
2168 buffer = [];
2169 }
2170}
2171function devtoolsInitApp(app, version) {
2172 emit$1("app:init" /* APP_INIT */, app, version, {
2173 Fragment,
2174 Text,
2175 Comment,
2176 Static
2177 });
2178}
2179function devtoolsUnmountApp(app) {
2180 emit$1("app:unmount" /* APP_UNMOUNT */, app);
2181}
2182const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2183 "component:added" /* COMPONENT_ADDED */
2184);
2185const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2186const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2187 "component:removed" /* COMPONENT_REMOVED */
2188);
2189const devtoolsComponentRemoved = (component) => {
2190 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
2191 !devtools$1.cleanupBuffer(component)) {
2192 _devtoolsComponentRemoved(component);
2193 }
2194};
2195/*! #__NO_SIDE_EFFECTS__ */
2196// @__NO_SIDE_EFFECTS__
2197function createDevtoolsComponentHook(hook) {
2198 return (component) => {
2199 emit$1(
2200 hook,
2201 component.appContext.app,
2202 component.uid,
2203 component.parent ? component.parent.uid : void 0,
2204 component
2205 );
2206 };
2207}
2208const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2209 "perf:start" /* PERFORMANCE_START */
2210);
2211const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2212 "perf:end" /* PERFORMANCE_END */
2213);
2214function createDevtoolsPerformanceHook(hook) {
2215 return (component, type, time) => {
2216 emit$1(hook, component.appContext.app, component.uid, component, type, time);
2217 };
2218}
2219function devtoolsComponentEmit(component, event, params) {
2220 emit$1(
2221 "component:emit" /* COMPONENT_EMIT */,
2222 component.appContext.app,
2223 component,
2224 event,
2225 params
2226 );
2227}
2228
2229function emit(instance, event, ...rawArgs) {
2230 if (instance.isUnmounted)
2231 return;
2232 const props = instance.vnode.props || EMPTY_OBJ;
2233 {
2234 const {
2235 emitsOptions,
2236 propsOptions: [propsOptions]
2237 } = instance;
2238 if (emitsOptions) {
2239 if (!(event in emitsOptions) && true) {
2240 if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
2241 warn$1(
2242 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
2243 );
2244 }
2245 } else {
2246 const validator = emitsOptions[event];
2247 if (isFunction(validator)) {
2248 const isValid = validator(...rawArgs);
2249 if (!isValid) {
2250 warn$1(
2251 `Invalid event arguments: event validation failed for event "${event}".`
2252 );
2253 }
2254 }
2255 }
2256 }
2257 }
2258 let args = rawArgs;
2259 const isModelListener = event.startsWith("update:");
2260 const modelArg = isModelListener && event.slice(7);
2261 if (modelArg && modelArg in props) {
2262 const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
2263 const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
2264 if (trim) {
2265 args = rawArgs.map((a) => isString(a) ? a.trim() : a);
2266 }
2267 if (number) {
2268 args = rawArgs.map(looseToNumber);
2269 }
2270 }
2271 {
2272 devtoolsComponentEmit(instance, event, args);
2273 }
2274 {
2275 const lowerCaseEvent = event.toLowerCase();
2276 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
2277 warn$1(
2278 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2279 instance,
2280 instance.type
2281 )} 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(
2282 event
2283 )}" instead of "${event}".`
2284 );
2285 }
2286 }
2287 let handlerName;
2288 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
2289 props[handlerName = toHandlerKey(camelize(event))];
2290 if (!handler && isModelListener) {
2291 handler = props[handlerName = toHandlerKey(hyphenate(event))];
2292 }
2293 if (handler) {
2294 callWithAsyncErrorHandling(
2295 handler,
2296 instance,
2297 6,
2298 args
2299 );
2300 }
2301 const onceHandler = props[handlerName + `Once`];
2302 if (onceHandler) {
2303 if (!instance.emitted) {
2304 instance.emitted = {};
2305 } else if (instance.emitted[handlerName]) {
2306 return;
2307 }
2308 instance.emitted[handlerName] = true;
2309 callWithAsyncErrorHandling(
2310 onceHandler,
2311 instance,
2312 6,
2313 args
2314 );
2315 }
2316}
2317function normalizeEmitsOptions(comp, appContext, asMixin = false) {
2318 const cache = appContext.emitsCache;
2319 const cached = cache.get(comp);
2320 if (cached !== void 0) {
2321 return cached;
2322 }
2323 const raw = comp.emits;
2324 let normalized = {};
2325 let hasExtends = false;
2326 if (!isFunction(comp)) {
2327 const extendEmits = (raw2) => {
2328 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
2329 if (normalizedFromExtend) {
2330 hasExtends = true;
2331 extend(normalized, normalizedFromExtend);
2332 }
2333 };
2334 if (!asMixin && appContext.mixins.length) {
2335 appContext.mixins.forEach(extendEmits);
2336 }
2337 if (comp.extends) {
2338 extendEmits(comp.extends);
2339 }
2340 if (comp.mixins) {
2341 comp.mixins.forEach(extendEmits);
2342 }
2343 }
2344 if (!raw && !hasExtends) {
2345 if (isObject(comp)) {
2346 cache.set(comp, null);
2347 }
2348 return null;
2349 }
2350 if (isArray(raw)) {
2351 raw.forEach((key) => normalized[key] = null);
2352 } else {
2353 extend(normalized, raw);
2354 }
2355 if (isObject(comp)) {
2356 cache.set(comp, normalized);
2357 }
2358 return normalized;
2359}
2360function isEmitListener(options, key) {
2361 if (!options || !isOn(key)) {
2362 return false;
2363 }
2364 key = key.slice(2).replace(/Once$/, "");
2365 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
2366}
2367
2368let currentRenderingInstance = null;
2369let currentScopeId = null;
2370function setCurrentRenderingInstance(instance) {
2371 const prev = currentRenderingInstance;
2372 currentRenderingInstance = instance;
2373 currentScopeId = instance && instance.type.__scopeId || null;
2374 return prev;
2375}
2376function pushScopeId(id) {
2377 currentScopeId = id;
2378}
2379function popScopeId() {
2380 currentScopeId = null;
2381}
2382const withScopeId = (_id) => withCtx;
2383function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2384 if (!ctx)
2385 return fn;
2386 if (fn._n) {
2387 return fn;
2388 }
2389 const renderFnWithContext = (...args) => {
2390 if (renderFnWithContext._d) {
2391 setBlockTracking(-1);
2392 }
2393 const prevInstance = setCurrentRenderingInstance(ctx);
2394 let res;
2395 try {
2396 res = fn(...args);
2397 } finally {
2398 setCurrentRenderingInstance(prevInstance);
2399 if (renderFnWithContext._d) {
2400 setBlockTracking(1);
2401 }
2402 }
2403 {
2404 devtoolsComponentUpdated(ctx);
2405 }
2406 return res;
2407 };
2408 renderFnWithContext._n = true;
2409 renderFnWithContext._c = true;
2410 renderFnWithContext._d = true;
2411 return renderFnWithContext;
2412}
2413
2414let accessedAttrs = false;
2415function markAttrsAccessed() {
2416 accessedAttrs = true;
2417}
2418function renderComponentRoot(instance) {
2419 const {
2420 type: Component,
2421 vnode,
2422 proxy,
2423 withProxy,
2424 propsOptions: [propsOptions],
2425 slots,
2426 attrs,
2427 emit,
2428 render,
2429 renderCache,
2430 props,
2431 data,
2432 setupState,
2433 ctx,
2434 inheritAttrs
2435 } = instance;
2436 const prev = setCurrentRenderingInstance(instance);
2437 let result;
2438 let fallthroughAttrs;
2439 {
2440 accessedAttrs = false;
2441 }
2442 try {
2443 if (vnode.shapeFlag & 4) {
2444 const proxyToUse = withProxy || proxy;
2445 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2446 get(target, key, receiver) {
2447 warn$1(
2448 `Property '${String(
2449 key
2450 )}' was accessed via 'this'. Avoid using 'this' in templates.`
2451 );
2452 return Reflect.get(target, key, receiver);
2453 }
2454 }) : proxyToUse;
2455 result = normalizeVNode(
2456 render.call(
2457 thisProxy,
2458 proxyToUse,
2459 renderCache,
2460 true ? shallowReadonly(props) : props,
2461 setupState,
2462 data,
2463 ctx
2464 )
2465 );
2466 fallthroughAttrs = attrs;
2467 } else {
2468 const render2 = Component;
2469 if (attrs === props) {
2470 markAttrsAccessed();
2471 }
2472 result = normalizeVNode(
2473 render2.length > 1 ? render2(
2474 true ? shallowReadonly(props) : props,
2475 true ? {
2476 get attrs() {
2477 markAttrsAccessed();
2478 return attrs;
2479 },
2480 slots,
2481 emit
2482 } : { attrs, slots, emit }
2483 ) : render2(
2484 true ? shallowReadonly(props) : props,
2485 null
2486 )
2487 );
2488 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
2489 }
2490 } catch (err) {
2491 blockStack.length = 0;
2492 handleError(err, instance, 1);
2493 result = createVNode(Comment);
2494 }
2495 let root = result;
2496 let setRoot = void 0;
2497 if (result.patchFlag > 0 && result.patchFlag & 2048) {
2498 [root, setRoot] = getChildRoot(result);
2499 }
2500 if (fallthroughAttrs && inheritAttrs !== false) {
2501 const keys = Object.keys(fallthroughAttrs);
2502 const { shapeFlag } = root;
2503 if (keys.length) {
2504 if (shapeFlag & (1 | 6)) {
2505 if (propsOptions && keys.some(isModelListener)) {
2506 fallthroughAttrs = filterModelListeners(
2507 fallthroughAttrs,
2508 propsOptions
2509 );
2510 }
2511 root = cloneVNode(root, fallthroughAttrs);
2512 } else if (!accessedAttrs && root.type !== Comment) {
2513 const allAttrs = Object.keys(attrs);
2514 const eventAttrs = [];
2515 const extraAttrs = [];
2516 for (let i = 0, l = allAttrs.length; i < l; i++) {
2517 const key = allAttrs[i];
2518 if (isOn(key)) {
2519 if (!isModelListener(key)) {
2520 eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2521 }
2522 } else {
2523 extraAttrs.push(key);
2524 }
2525 }
2526 if (extraAttrs.length) {
2527 warn$1(
2528 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
2529 );
2530 }
2531 if (eventAttrs.length) {
2532 warn$1(
2533 `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.`
2534 );
2535 }
2536 }
2537 }
2538 }
2539 if (vnode.dirs) {
2540 if (!isElementRoot(root)) {
2541 warn$1(
2542 `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2543 );
2544 }
2545 root = cloneVNode(root);
2546 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2547 }
2548 if (vnode.transition) {
2549 if (!isElementRoot(root)) {
2550 warn$1(
2551 `Component inside <Transition> renders non-element root node that cannot be animated.`
2552 );
2553 }
2554 root.transition = vnode.transition;
2555 }
2556 if (setRoot) {
2557 setRoot(root);
2558 } else {
2559 result = root;
2560 }
2561 setCurrentRenderingInstance(prev);
2562 return result;
2563}
2564const getChildRoot = (vnode) => {
2565 const rawChildren = vnode.children;
2566 const dynamicChildren = vnode.dynamicChildren;
2567 const childRoot = filterSingleRoot(rawChildren, false);
2568 if (!childRoot) {
2569 return [vnode, void 0];
2570 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
2571 return getChildRoot(childRoot);
2572 }
2573 const index = rawChildren.indexOf(childRoot);
2574 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
2575 const setRoot = (updatedRoot) => {
2576 rawChildren[index] = updatedRoot;
2577 if (dynamicChildren) {
2578 if (dynamicIndex > -1) {
2579 dynamicChildren[dynamicIndex] = updatedRoot;
2580 } else if (updatedRoot.patchFlag > 0) {
2581 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
2582 }
2583 }
2584 };
2585 return [normalizeVNode(childRoot), setRoot];
2586};
2587function filterSingleRoot(children, recurse = true) {
2588 let singleRoot;
2589 for (let i = 0; i < children.length; i++) {
2590 const child = children[i];
2591 if (isVNode(child)) {
2592 if (child.type !== Comment || child.children === "v-if") {
2593 if (singleRoot) {
2594 return;
2595 } else {
2596 singleRoot = child;
2597 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
2598 return filterSingleRoot(singleRoot.children);
2599 }
2600 }
2601 }
2602 } else {
2603 return;
2604 }
2605 }
2606 return singleRoot;
2607}
2608const getFunctionalFallthrough = (attrs) => {
2609 let res;
2610 for (const key in attrs) {
2611 if (key === "class" || key === "style" || isOn(key)) {
2612 (res || (res = {}))[key] = attrs[key];
2613 }
2614 }
2615 return res;
2616};
2617const filterModelListeners = (attrs, props) => {
2618 const res = {};
2619 for (const key in attrs) {
2620 if (!isModelListener(key) || !(key.slice(9) in props)) {
2621 res[key] = attrs[key];
2622 }
2623 }
2624 return res;
2625};
2626const isElementRoot = (vnode) => {
2627 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
2628};
2629function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2630 const { props: prevProps, children: prevChildren, component } = prevVNode;
2631 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
2632 const emits = component.emitsOptions;
2633 if ((prevChildren || nextChildren) && isHmrUpdating) {
2634 return true;
2635 }
2636 if (nextVNode.dirs || nextVNode.transition) {
2637 return true;
2638 }
2639 if (optimized && patchFlag >= 0) {
2640 if (patchFlag & 1024) {
2641 return true;
2642 }
2643 if (patchFlag & 16) {
2644 if (!prevProps) {
2645 return !!nextProps;
2646 }
2647 return hasPropsChanged(prevProps, nextProps, emits);
2648 } else if (patchFlag & 8) {
2649 const dynamicProps = nextVNode.dynamicProps;
2650 for (let i = 0; i < dynamicProps.length; i++) {
2651 const key = dynamicProps[i];
2652 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
2653 return true;
2654 }
2655 }
2656 }
2657 } else {
2658 if (prevChildren || nextChildren) {
2659 if (!nextChildren || !nextChildren.$stable) {
2660 return true;
2661 }
2662 }
2663 if (prevProps === nextProps) {
2664 return false;
2665 }
2666 if (!prevProps) {
2667 return !!nextProps;
2668 }
2669 if (!nextProps) {
2670 return true;
2671 }
2672 return hasPropsChanged(prevProps, nextProps, emits);
2673 }
2674 return false;
2675}
2676function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2677 const nextKeys = Object.keys(nextProps);
2678 if (nextKeys.length !== Object.keys(prevProps).length) {
2679 return true;
2680 }
2681 for (let i = 0; i < nextKeys.length; i++) {
2682 const key = nextKeys[i];
2683 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
2684 return true;
2685 }
2686 }
2687 return false;
2688}
2689function updateHOCHostEl({ vnode, parent }, el) {
2690 while (parent) {
2691 const root = parent.subTree;
2692 if (root.suspense && root.suspense.activeBranch === vnode) {
2693 root.el = vnode.el;
2694 }
2695 if (root === vnode) {
2696 (vnode = parent.vnode).el = el;
2697 parent = parent.parent;
2698 } else {
2699 break;
2700 }
2701 }
2702}
2703
2704const COMPONENTS = "components";
2705const DIRECTIVES = "directives";
2706function resolveComponent(name, maybeSelfReference) {
2707 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2708}
2709const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2710function resolveDynamicComponent(component) {
2711 if (isString(component)) {
2712 return resolveAsset(COMPONENTS, component, false) || component;
2713 } else {
2714 return component || NULL_DYNAMIC_COMPONENT;
2715 }
2716}
2717function resolveDirective(name) {
2718 return resolveAsset(DIRECTIVES, name);
2719}
2720function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2721 const instance = currentRenderingInstance || currentInstance;
2722 if (instance) {
2723 const Component = instance.type;
2724 if (type === COMPONENTS) {
2725 const selfName = getComponentName(
2726 Component,
2727 false
2728 );
2729 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2730 return Component;
2731 }
2732 }
2733 const res = (
2734 // local registration
2735 // check instance[type] first which is resolved for options API
2736 resolve(instance[type] || Component[type], name) || // global registration
2737 resolve(instance.appContext[type], name)
2738 );
2739 if (!res && maybeSelfReference) {
2740 return Component;
2741 }
2742 if (warnMissing && !res) {
2743 const extra = type === COMPONENTS ? `
2744If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2745 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2746 }
2747 return res;
2748 } else {
2749 warn$1(
2750 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2751 );
2752 }
2753}
2754function resolve(registry, name) {
2755 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2756}
2757
2758const isSuspense = (type) => type.__isSuspense;
2759let suspenseId = 0;
2760const SuspenseImpl = {
2761 name: "Suspense",
2762 // In order to make Suspense tree-shakable, we need to avoid importing it
2763 // directly in the renderer. The renderer checks for the __isSuspense flag
2764 // on a vnode's type and calls the `process` method, passing in renderer
2765 // internals.
2766 __isSuspense: true,
2767 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2768 if (n1 == null) {
2769 mountSuspense(
2770 n2,
2771 container,
2772 anchor,
2773 parentComponent,
2774 parentSuspense,
2775 namespace,
2776 slotScopeIds,
2777 optimized,
2778 rendererInternals
2779 );
2780 } else {
2781 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2782 n2.suspense = n1.suspense;
2783 n2.suspense.vnode = n2;
2784 n2.el = n1.el;
2785 return;
2786 }
2787 patchSuspense(
2788 n1,
2789 n2,
2790 container,
2791 anchor,
2792 parentComponent,
2793 namespace,
2794 slotScopeIds,
2795 optimized,
2796 rendererInternals
2797 );
2798 }
2799 },
2800 hydrate: hydrateSuspense,
2801 create: createSuspenseBoundary,
2802 normalize: normalizeSuspenseChildren
2803};
2804const Suspense = SuspenseImpl ;
2805function triggerEvent(vnode, name) {
2806 const eventListener = vnode.props && vnode.props[name];
2807 if (isFunction(eventListener)) {
2808 eventListener();
2809 }
2810}
2811function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2812 const {
2813 p: patch,
2814 o: { createElement }
2815 } = rendererInternals;
2816 const hiddenContainer = createElement("div");
2817 const suspense = vnode.suspense = createSuspenseBoundary(
2818 vnode,
2819 parentSuspense,
2820 parentComponent,
2821 container,
2822 hiddenContainer,
2823 anchor,
2824 namespace,
2825 slotScopeIds,
2826 optimized,
2827 rendererInternals
2828 );
2829 patch(
2830 null,
2831 suspense.pendingBranch = vnode.ssContent,
2832 hiddenContainer,
2833 null,
2834 parentComponent,
2835 suspense,
2836 namespace,
2837 slotScopeIds
2838 );
2839 if (suspense.deps > 0) {
2840 triggerEvent(vnode, "onPending");
2841 triggerEvent(vnode, "onFallback");
2842 patch(
2843 null,
2844 vnode.ssFallback,
2845 container,
2846 anchor,
2847 parentComponent,
2848 null,
2849 // fallback tree will not have suspense context
2850 namespace,
2851 slotScopeIds
2852 );
2853 setActiveBranch(suspense, vnode.ssFallback);
2854 } else {
2855 suspense.resolve(false, true);
2856 }
2857}
2858function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2859 const suspense = n2.suspense = n1.suspense;
2860 suspense.vnode = n2;
2861 n2.el = n1.el;
2862 const newBranch = n2.ssContent;
2863 const newFallback = n2.ssFallback;
2864 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
2865 if (pendingBranch) {
2866 suspense.pendingBranch = newBranch;
2867 if (isSameVNodeType(newBranch, pendingBranch)) {
2868 patch(
2869 pendingBranch,
2870 newBranch,
2871 suspense.hiddenContainer,
2872 null,
2873 parentComponent,
2874 suspense,
2875 namespace,
2876 slotScopeIds,
2877 optimized
2878 );
2879 if (suspense.deps <= 0) {
2880 suspense.resolve();
2881 } else if (isInFallback) {
2882 if (!isHydrating) {
2883 patch(
2884 activeBranch,
2885 newFallback,
2886 container,
2887 anchor,
2888 parentComponent,
2889 null,
2890 // fallback tree will not have suspense context
2891 namespace,
2892 slotScopeIds,
2893 optimized
2894 );
2895 setActiveBranch(suspense, newFallback);
2896 }
2897 }
2898 } else {
2899 suspense.pendingId = suspenseId++;
2900 if (isHydrating) {
2901 suspense.isHydrating = false;
2902 suspense.activeBranch = pendingBranch;
2903 } else {
2904 unmount(pendingBranch, parentComponent, suspense);
2905 }
2906 suspense.deps = 0;
2907 suspense.effects.length = 0;
2908 suspense.hiddenContainer = createElement("div");
2909 if (isInFallback) {
2910 patch(
2911 null,
2912 newBranch,
2913 suspense.hiddenContainer,
2914 null,
2915 parentComponent,
2916 suspense,
2917 namespace,
2918 slotScopeIds,
2919 optimized
2920 );
2921 if (suspense.deps <= 0) {
2922 suspense.resolve();
2923 } else {
2924 patch(
2925 activeBranch,
2926 newFallback,
2927 container,
2928 anchor,
2929 parentComponent,
2930 null,
2931 // fallback tree will not have suspense context
2932 namespace,
2933 slotScopeIds,
2934 optimized
2935 );
2936 setActiveBranch(suspense, newFallback);
2937 }
2938 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2939 patch(
2940 activeBranch,
2941 newBranch,
2942 container,
2943 anchor,
2944 parentComponent,
2945 suspense,
2946 namespace,
2947 slotScopeIds,
2948 optimized
2949 );
2950 suspense.resolve(true);
2951 } else {
2952 patch(
2953 null,
2954 newBranch,
2955 suspense.hiddenContainer,
2956 null,
2957 parentComponent,
2958 suspense,
2959 namespace,
2960 slotScopeIds,
2961 optimized
2962 );
2963 if (suspense.deps <= 0) {
2964 suspense.resolve();
2965 }
2966 }
2967 }
2968 } else {
2969 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2970 patch(
2971 activeBranch,
2972 newBranch,
2973 container,
2974 anchor,
2975 parentComponent,
2976 suspense,
2977 namespace,
2978 slotScopeIds,
2979 optimized
2980 );
2981 setActiveBranch(suspense, newBranch);
2982 } else {
2983 triggerEvent(n2, "onPending");
2984 suspense.pendingBranch = newBranch;
2985 if (newBranch.shapeFlag & 512) {
2986 suspense.pendingId = newBranch.component.suspenseId;
2987 } else {
2988 suspense.pendingId = suspenseId++;
2989 }
2990 patch(
2991 null,
2992 newBranch,
2993 suspense.hiddenContainer,
2994 null,
2995 parentComponent,
2996 suspense,
2997 namespace,
2998 slotScopeIds,
2999 optimized
3000 );
3001 if (suspense.deps <= 0) {
3002 suspense.resolve();
3003 } else {
3004 const { timeout, pendingId } = suspense;
3005 if (timeout > 0) {
3006 setTimeout(() => {
3007 if (suspense.pendingId === pendingId) {
3008 suspense.fallback(newFallback);
3009 }
3010 }, timeout);
3011 } else if (timeout === 0) {
3012 suspense.fallback(newFallback);
3013 }
3014 }
3015 }
3016 }
3017}
3018let hasWarned = false;
3019function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3020 if (!hasWarned) {
3021 hasWarned = true;
3022 console[console.info ? "info" : "log"](
3023 `<Suspense> is an experimental feature and its API will likely change.`
3024 );
3025 }
3026 const {
3027 p: patch,
3028 m: move,
3029 um: unmount,
3030 n: next,
3031 o: { parentNode, remove }
3032 } = rendererInternals;
3033 let parentSuspenseId;
3034 const isSuspensible = isVNodeSuspensible(vnode);
3035 if (isSuspensible) {
3036 if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3037 parentSuspenseId = parentSuspense.pendingId;
3038 parentSuspense.deps++;
3039 }
3040 }
3041 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3042 {
3043 assertNumber(timeout, `Suspense timeout`);
3044 }
3045 const initialAnchor = anchor;
3046 const suspense = {
3047 vnode,
3048 parent: parentSuspense,
3049 parentComponent,
3050 namespace,
3051 container,
3052 hiddenContainer,
3053 deps: 0,
3054 pendingId: suspenseId++,
3055 timeout: typeof timeout === "number" ? timeout : -1,
3056 activeBranch: null,
3057 pendingBranch: null,
3058 isInFallback: !isHydrating,
3059 isHydrating,
3060 isUnmounted: false,
3061 effects: [],
3062 resolve(resume = false, sync = false) {
3063 {
3064 if (!resume && !suspense.pendingBranch) {
3065 throw new Error(
3066 `suspense.resolve() is called without a pending branch.`
3067 );
3068 }
3069 if (suspense.isUnmounted) {
3070 throw new Error(
3071 `suspense.resolve() is called on an already unmounted suspense boundary.`
3072 );
3073 }
3074 }
3075 const {
3076 vnode: vnode2,
3077 activeBranch,
3078 pendingBranch,
3079 pendingId,
3080 effects,
3081 parentComponent: parentComponent2,
3082 container: container2
3083 } = suspense;
3084 let delayEnter = false;
3085 if (suspense.isHydrating) {
3086 suspense.isHydrating = false;
3087 } else if (!resume) {
3088 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3089 if (delayEnter) {
3090 activeBranch.transition.afterLeave = () => {
3091 if (pendingId === suspense.pendingId) {
3092 move(
3093 pendingBranch,
3094 container2,
3095 anchor === initialAnchor ? next(activeBranch) : anchor,
3096 0
3097 );
3098 queuePostFlushCb(effects);
3099 }
3100 };
3101 }
3102 if (activeBranch) {
3103 if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3104 anchor = next(activeBranch);
3105 }
3106 unmount(activeBranch, parentComponent2, suspense, true);
3107 }
3108 if (!delayEnter) {
3109 move(pendingBranch, container2, anchor, 0);
3110 }
3111 }
3112 setActiveBranch(suspense, pendingBranch);
3113 suspense.pendingBranch = null;
3114 suspense.isInFallback = false;
3115 let parent = suspense.parent;
3116 let hasUnresolvedAncestor = false;
3117 while (parent) {
3118 if (parent.pendingBranch) {
3119 parent.effects.push(...effects);
3120 hasUnresolvedAncestor = true;
3121 break;
3122 }
3123 parent = parent.parent;
3124 }
3125 if (!hasUnresolvedAncestor && !delayEnter) {
3126 queuePostFlushCb(effects);
3127 }
3128 suspense.effects = [];
3129 if (isSuspensible) {
3130 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3131 parentSuspense.deps--;
3132 if (parentSuspense.deps === 0 && !sync) {
3133 parentSuspense.resolve();
3134 }
3135 }
3136 }
3137 triggerEvent(vnode2, "onResolve");
3138 },
3139 fallback(fallbackVNode) {
3140 if (!suspense.pendingBranch) {
3141 return;
3142 }
3143 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
3144 triggerEvent(vnode2, "onFallback");
3145 const anchor2 = next(activeBranch);
3146 const mountFallback = () => {
3147 if (!suspense.isInFallback) {
3148 return;
3149 }
3150 patch(
3151 null,
3152 fallbackVNode,
3153 container2,
3154 anchor2,
3155 parentComponent2,
3156 null,
3157 // fallback tree will not have suspense context
3158 namespace2,
3159 slotScopeIds,
3160 optimized
3161 );
3162 setActiveBranch(suspense, fallbackVNode);
3163 };
3164 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
3165 if (delayEnter) {
3166 activeBranch.transition.afterLeave = mountFallback;
3167 }
3168 suspense.isInFallback = true;
3169 unmount(
3170 activeBranch,
3171 parentComponent2,
3172 null,
3173 // no suspense so unmount hooks fire now
3174 true
3175 // shouldRemove
3176 );
3177 if (!delayEnter) {
3178 mountFallback();
3179 }
3180 },
3181 move(container2, anchor2, type) {
3182 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
3183 suspense.container = container2;
3184 },
3185 next() {
3186 return suspense.activeBranch && next(suspense.activeBranch);
3187 },
3188 registerDep(instance, setupRenderEffect) {
3189 const isInPendingSuspense = !!suspense.pendingBranch;
3190 if (isInPendingSuspense) {
3191 suspense.deps++;
3192 }
3193 const hydratedEl = instance.vnode.el;
3194 instance.asyncDep.catch((err) => {
3195 handleError(err, instance, 0);
3196 }).then((asyncSetupResult) => {
3197 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
3198 return;
3199 }
3200 instance.asyncResolved = true;
3201 const { vnode: vnode2 } = instance;
3202 {
3203 pushWarningContext(vnode2);
3204 }
3205 handleSetupResult(instance, asyncSetupResult, false);
3206 if (hydratedEl) {
3207 vnode2.el = hydratedEl;
3208 }
3209 const placeholder = !hydratedEl && instance.subTree.el;
3210 setupRenderEffect(
3211 instance,
3212 vnode2,
3213 // component may have been moved before resolve.
3214 // if this is not a hydration, instance.subTree will be the comment
3215 // placeholder.
3216 parentNode(hydratedEl || instance.subTree.el),
3217 // anchor will not be used if this is hydration, so only need to
3218 // consider the comment placeholder case.
3219 hydratedEl ? null : next(instance.subTree),
3220 suspense,
3221 namespace,
3222 optimized
3223 );
3224 if (placeholder) {
3225 remove(placeholder);
3226 }
3227 updateHOCHostEl(instance, vnode2.el);
3228 {
3229 popWarningContext();
3230 }
3231 if (isInPendingSuspense && --suspense.deps === 0) {
3232 suspense.resolve();
3233 }
3234 });
3235 },
3236 unmount(parentSuspense2, doRemove) {
3237 suspense.isUnmounted = true;
3238 if (suspense.activeBranch) {
3239 unmount(
3240 suspense.activeBranch,
3241 parentComponent,
3242 parentSuspense2,
3243 doRemove
3244 );
3245 }
3246 if (suspense.pendingBranch) {
3247 unmount(
3248 suspense.pendingBranch,
3249 parentComponent,
3250 parentSuspense2,
3251 doRemove
3252 );
3253 }
3254 }
3255 };
3256 return suspense;
3257}
3258function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
3259 const suspense = vnode.suspense = createSuspenseBoundary(
3260 vnode,
3261 parentSuspense,
3262 parentComponent,
3263 node.parentNode,
3264 // eslint-disable-next-line no-restricted-globals
3265 document.createElement("div"),
3266 null,
3267 namespace,
3268 slotScopeIds,
3269 optimized,
3270 rendererInternals,
3271 true
3272 );
3273 const result = hydrateNode(
3274 node,
3275 suspense.pendingBranch = vnode.ssContent,
3276 parentComponent,
3277 suspense,
3278 slotScopeIds,
3279 optimized
3280 );
3281 if (suspense.deps === 0) {
3282 suspense.resolve(false, true);
3283 }
3284 return result;
3285}
3286function normalizeSuspenseChildren(vnode) {
3287 const { shapeFlag, children } = vnode;
3288 const isSlotChildren = shapeFlag & 32;
3289 vnode.ssContent = normalizeSuspenseSlot(
3290 isSlotChildren ? children.default : children
3291 );
3292 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
3293}
3294function normalizeSuspenseSlot(s) {
3295 let block;
3296 if (isFunction(s)) {
3297 const trackBlock = isBlockTreeEnabled && s._c;
3298 if (trackBlock) {
3299 s._d = false;
3300 openBlock();
3301 }
3302 s = s();
3303 if (trackBlock) {
3304 s._d = true;
3305 block = currentBlock;
3306 closeBlock();
3307 }
3308 }
3309 if (isArray(s)) {
3310 const singleChild = filterSingleRoot(s);
3311 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3312 warn$1(`<Suspense> slots expect a single root node.`);
3313 }
3314 s = singleChild;
3315 }
3316 s = normalizeVNode(s);
3317 if (block && !s.dynamicChildren) {
3318 s.dynamicChildren = block.filter((c) => c !== s);
3319 }
3320 return s;
3321}
3322function queueEffectWithSuspense(fn, suspense) {
3323 if (suspense && suspense.pendingBranch) {
3324 if (isArray(fn)) {
3325 suspense.effects.push(...fn);
3326 } else {
3327 suspense.effects.push(fn);
3328 }
3329 } else {
3330 queuePostFlushCb(fn);
3331 }
3332}
3333function setActiveBranch(suspense, branch) {
3334 suspense.activeBranch = branch;
3335 const { vnode, parentComponent } = suspense;
3336 let el = branch.el;
3337 while (!el && branch.component) {
3338 branch = branch.component.subTree;
3339 el = branch.el;
3340 }
3341 vnode.el = el;
3342 if (parentComponent && parentComponent.subTree === vnode) {
3343 parentComponent.vnode.el = el;
3344 updateHOCHostEl(parentComponent, el);
3345 }
3346}
3347function isVNodeSuspensible(vnode) {
3348 var _a;
3349 return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3350}
3351
3352const ssrContextKey = Symbol.for("v-scx");
3353const useSSRContext = () => {
3354 {
3355 const ctx = inject(ssrContextKey);
3356 if (!ctx) {
3357 warn$1(
3358 `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3359 );
3360 }
3361 return ctx;
3362 }
3363};
3364
3365function watchEffect(effect, options) {
3366 return doWatch(effect, null, options);
3367}
3368function watchPostEffect(effect, options) {
3369 return doWatch(
3370 effect,
3371 null,
3372 extend({}, options, { flush: "post" })
3373 );
3374}
3375function watchSyncEffect(effect, options) {
3376 return doWatch(
3377 effect,
3378 null,
3379 extend({}, options, { flush: "sync" })
3380 );
3381}
3382const INITIAL_WATCHER_VALUE = {};
3383function watch(source, cb, options) {
3384 if (!isFunction(cb)) {
3385 warn$1(
3386 `\`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.`
3387 );
3388 }
3389 return doWatch(source, cb, options);
3390}
3391function doWatch(source, cb, {
3392 immediate,
3393 deep,
3394 flush,
3395 once,
3396 onTrack,
3397 onTrigger
3398} = EMPTY_OBJ) {
3399 if (cb && once) {
3400 const _cb = cb;
3401 cb = (...args) => {
3402 _cb(...args);
3403 unwatch();
3404 };
3405 }
3406 if (deep !== void 0 && typeof deep === "number") {
3407 warn$1(
3408 `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
3409 );
3410 }
3411 if (!cb) {
3412 if (immediate !== void 0) {
3413 warn$1(
3414 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
3415 );
3416 }
3417 if (deep !== void 0) {
3418 warn$1(
3419 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
3420 );
3421 }
3422 if (once !== void 0) {
3423 warn$1(
3424 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
3425 );
3426 }
3427 }
3428 const warnInvalidSource = (s) => {
3429 warn$1(
3430 `Invalid watch source: `,
3431 s,
3432 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
3433 );
3434 };
3435 const instance = currentInstance;
3436 const reactiveGetter = (source2) => deep === true ? source2 : (
3437 // for deep: false, only traverse root-level properties
3438 traverse(source2, deep === false ? 1 : void 0)
3439 );
3440 let getter;
3441 let forceTrigger = false;
3442 let isMultiSource = false;
3443 if (isRef(source)) {
3444 getter = () => source.value;
3445 forceTrigger = isShallow(source);
3446 } else if (isReactive(source)) {
3447 getter = () => reactiveGetter(source);
3448 forceTrigger = true;
3449 } else if (isArray(source)) {
3450 isMultiSource = true;
3451 forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
3452 getter = () => source.map((s) => {
3453 if (isRef(s)) {
3454 return s.value;
3455 } else if (isReactive(s)) {
3456 return reactiveGetter(s);
3457 } else if (isFunction(s)) {
3458 return callWithErrorHandling(s, instance, 2);
3459 } else {
3460 warnInvalidSource(s);
3461 }
3462 });
3463 } else if (isFunction(source)) {
3464 if (cb) {
3465 getter = () => callWithErrorHandling(source, instance, 2);
3466 } else {
3467 getter = () => {
3468 if (cleanup) {
3469 cleanup();
3470 }
3471 return callWithAsyncErrorHandling(
3472 source,
3473 instance,
3474 3,
3475 [onCleanup]
3476 );
3477 };
3478 }
3479 } else {
3480 getter = NOOP;
3481 warnInvalidSource(source);
3482 }
3483 if (cb && deep) {
3484 const baseGetter = getter;
3485 getter = () => traverse(baseGetter());
3486 }
3487 let cleanup;
3488 let onCleanup = (fn) => {
3489 cleanup = effect.onStop = () => {
3490 callWithErrorHandling(fn, instance, 4);
3491 cleanup = effect.onStop = void 0;
3492 };
3493 };
3494 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3495 const job = () => {
3496 if (!effect.active || !effect.dirty) {
3497 return;
3498 }
3499 if (cb) {
3500 const newValue = effect.run();
3501 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
3502 if (cleanup) {
3503 cleanup();
3504 }
3505 callWithAsyncErrorHandling(cb, instance, 3, [
3506 newValue,
3507 // pass undefined as the old value when it's changed for the first time
3508 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
3509 onCleanup
3510 ]);
3511 oldValue = newValue;
3512 }
3513 } else {
3514 effect.run();
3515 }
3516 };
3517 job.allowRecurse = !!cb;
3518 let scheduler;
3519 if (flush === "sync") {
3520 scheduler = job;
3521 } else if (flush === "post") {
3522 scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
3523 } else {
3524 job.pre = true;
3525 if (instance)
3526 job.id = instance.uid;
3527 scheduler = () => queueJob(job);
3528 }
3529 const effect = new ReactiveEffect(getter, NOOP, scheduler);
3530 const scope = getCurrentScope();
3531 const unwatch = () => {
3532 effect.stop();
3533 if (scope) {
3534 remove(scope.effects, effect);
3535 }
3536 };
3537 {
3538 effect.onTrack = onTrack;
3539 effect.onTrigger = onTrigger;
3540 }
3541 if (cb) {
3542 if (immediate) {
3543 job();
3544 } else {
3545 oldValue = effect.run();
3546 }
3547 } else if (flush === "post") {
3548 queuePostRenderEffect(
3549 effect.run.bind(effect),
3550 instance && instance.suspense
3551 );
3552 } else {
3553 effect.run();
3554 }
3555 return unwatch;
3556}
3557function instanceWatch(source, value, options) {
3558 const publicThis = this.proxy;
3559 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
3560 let cb;
3561 if (isFunction(value)) {
3562 cb = value;
3563 } else {
3564 cb = value.handler;
3565 options = value;
3566 }
3567 const reset = setCurrentInstance(this);
3568 const res = doWatch(getter, cb.bind(publicThis), options);
3569 reset();
3570 return res;
3571}
3572function createPathGetter(ctx, path) {
3573 const segments = path.split(".");
3574 return () => {
3575 let cur = ctx;
3576 for (let i = 0; i < segments.length && cur; i++) {
3577 cur = cur[segments[i]];
3578 }
3579 return cur;
3580 };
3581}
3582function traverse(value, depth, currentDepth = 0, seen) {
3583 if (!isObject(value) || value["__v_skip"]) {
3584 return value;
3585 }
3586 if (depth && depth > 0) {
3587 if (currentDepth >= depth) {
3588 return value;
3589 }
3590 currentDepth++;
3591 }
3592 seen = seen || /* @__PURE__ */ new Set();
3593 if (seen.has(value)) {
3594 return value;
3595 }
3596 seen.add(value);
3597 if (isRef(value)) {
3598 traverse(value.value, depth, currentDepth, seen);
3599 } else if (isArray(value)) {
3600 for (let i = 0; i < value.length; i++) {
3601 traverse(value[i], depth, currentDepth, seen);
3602 }
3603 } else if (isSet(value) || isMap(value)) {
3604 value.forEach((v) => {
3605 traverse(v, depth, currentDepth, seen);
3606 });
3607 } else if (isPlainObject(value)) {
3608 for (const key in value) {
3609 traverse(value[key], depth, currentDepth, seen);
3610 }
3611 }
3612 return value;
3613}
3614
3615function validateDirectiveName(name) {
3616 if (isBuiltInDirective(name)) {
3617 warn$1("Do not use built-in directive ids as custom directive id: " + name);
3618 }
3619}
3620function withDirectives(vnode, directives) {
3621 if (currentRenderingInstance === null) {
3622 warn$1(`withDirectives can only be used inside render functions.`);
3623 return vnode;
3624 }
3625 const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3626 const bindings = vnode.dirs || (vnode.dirs = []);
3627 for (let i = 0; i < directives.length; i++) {
3628 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3629 if (dir) {
3630 if (isFunction(dir)) {
3631 dir = {
3632 mounted: dir,
3633 updated: dir
3634 };
3635 }
3636 if (dir.deep) {
3637 traverse(value);
3638 }
3639 bindings.push({
3640 dir,
3641 instance,
3642 value,
3643 oldValue: void 0,
3644 arg,
3645 modifiers
3646 });
3647 }
3648 }
3649 return vnode;
3650}
3651function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3652 const bindings = vnode.dirs;
3653 const oldBindings = prevVNode && prevVNode.dirs;
3654 for (let i = 0; i < bindings.length; i++) {
3655 const binding = bindings[i];
3656 if (oldBindings) {
3657 binding.oldValue = oldBindings[i].value;
3658 }
3659 let hook = binding.dir[name];
3660 if (hook) {
3661 pauseTracking();
3662 callWithAsyncErrorHandling(hook, instance, 8, [
3663 vnode.el,
3664 binding,
3665 vnode,
3666 prevVNode
3667 ]);
3668 resetTracking();
3669 }
3670 }
3671}
3672
3673const leaveCbKey = Symbol("_leaveCb");
3674const enterCbKey$1 = Symbol("_enterCb");
3675function useTransitionState() {
3676 const state = {
3677 isMounted: false,
3678 isLeaving: false,
3679 isUnmounting: false,
3680 leavingVNodes: /* @__PURE__ */ new Map()
3681 };
3682 onMounted(() => {
3683 state.isMounted = true;
3684 });
3685 onBeforeUnmount(() => {
3686 state.isUnmounting = true;
3687 });
3688 return state;
3689}
3690const TransitionHookValidator = [Function, Array];
3691const BaseTransitionPropsValidators = {
3692 mode: String,
3693 appear: Boolean,
3694 persisted: Boolean,
3695 // enter
3696 onBeforeEnter: TransitionHookValidator,
3697 onEnter: TransitionHookValidator,
3698 onAfterEnter: TransitionHookValidator,
3699 onEnterCancelled: TransitionHookValidator,
3700 // leave
3701 onBeforeLeave: TransitionHookValidator,
3702 onLeave: TransitionHookValidator,
3703 onAfterLeave: TransitionHookValidator,
3704 onLeaveCancelled: TransitionHookValidator,
3705 // appear
3706 onBeforeAppear: TransitionHookValidator,
3707 onAppear: TransitionHookValidator,
3708 onAfterAppear: TransitionHookValidator,
3709 onAppearCancelled: TransitionHookValidator
3710};
3711const BaseTransitionImpl = {
3712 name: `BaseTransition`,
3713 props: BaseTransitionPropsValidators,
3714 setup(props, { slots }) {
3715 const instance = getCurrentInstance();
3716 const state = useTransitionState();
3717 return () => {
3718 const children = slots.default && getTransitionRawChildren(slots.default(), true);
3719 if (!children || !children.length) {
3720 return;
3721 }
3722 let child = children[0];
3723 if (children.length > 1) {
3724 let hasFound = false;
3725 for (const c of children) {
3726 if (c.type !== Comment) {
3727 if (hasFound) {
3728 warn$1(
3729 "<transition> can only be used on a single element or component. Use <transition-group> for lists."
3730 );
3731 break;
3732 }
3733 child = c;
3734 hasFound = true;
3735 }
3736 }
3737 }
3738 const rawProps = toRaw(props);
3739 const { mode } = rawProps;
3740 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3741 warn$1(`invalid <transition> mode: ${mode}`);
3742 }
3743 if (state.isLeaving) {
3744 return emptyPlaceholder(child);
3745 }
3746 const innerChild = getKeepAliveChild(child);
3747 if (!innerChild) {
3748 return emptyPlaceholder(child);
3749 }
3750 const enterHooks = resolveTransitionHooks(
3751 innerChild,
3752 rawProps,
3753 state,
3754 instance
3755 );
3756 setTransitionHooks(innerChild, enterHooks);
3757 const oldChild = instance.subTree;
3758 const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
3759 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
3760 const leavingHooks = resolveTransitionHooks(
3761 oldInnerChild,
3762 rawProps,
3763 state,
3764 instance
3765 );
3766 setTransitionHooks(oldInnerChild, leavingHooks);
3767 if (mode === "out-in") {
3768 state.isLeaving = true;
3769 leavingHooks.afterLeave = () => {
3770 state.isLeaving = false;
3771 if (instance.update.active !== false) {
3772 instance.effect.dirty = true;
3773 instance.update();
3774 }
3775 };
3776 return emptyPlaceholder(child);
3777 } else if (mode === "in-out" && innerChild.type !== Comment) {
3778 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3779 const leavingVNodesCache = getLeavingNodesForType(
3780 state,
3781 oldInnerChild
3782 );
3783 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3784 el[leaveCbKey] = () => {
3785 earlyRemove();
3786 el[leaveCbKey] = void 0;
3787 delete enterHooks.delayedLeave;
3788 };
3789 enterHooks.delayedLeave = delayedLeave;
3790 };
3791 }
3792 }
3793 return child;
3794 };
3795 }
3796};
3797const BaseTransition = BaseTransitionImpl;
3798function getLeavingNodesForType(state, vnode) {
3799 const { leavingVNodes } = state;
3800 let leavingVNodesCache = leavingVNodes.get(vnode.type);
3801 if (!leavingVNodesCache) {
3802 leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3803 leavingVNodes.set(vnode.type, leavingVNodesCache);
3804 }
3805 return leavingVNodesCache;
3806}
3807function resolveTransitionHooks(vnode, props, state, instance) {
3808 const {
3809 appear,
3810 mode,
3811 persisted = false,
3812 onBeforeEnter,
3813 onEnter,
3814 onAfterEnter,
3815 onEnterCancelled,
3816 onBeforeLeave,
3817 onLeave,
3818 onAfterLeave,
3819 onLeaveCancelled,
3820 onBeforeAppear,
3821 onAppear,
3822 onAfterAppear,
3823 onAppearCancelled
3824 } = props;
3825 const key = String(vnode.key);
3826 const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3827 const callHook = (hook, args) => {
3828 hook && callWithAsyncErrorHandling(
3829 hook,
3830 instance,
3831 9,
3832 args
3833 );
3834 };
3835 const callAsyncHook = (hook, args) => {
3836 const done = args[1];
3837 callHook(hook, args);
3838 if (isArray(hook)) {
3839 if (hook.every((hook2) => hook2.length <= 1))
3840 done();
3841 } else if (hook.length <= 1) {
3842 done();
3843 }
3844 };
3845 const hooks = {
3846 mode,
3847 persisted,
3848 beforeEnter(el) {
3849 let hook = onBeforeEnter;
3850 if (!state.isMounted) {
3851 if (appear) {
3852 hook = onBeforeAppear || onBeforeEnter;
3853 } else {
3854 return;
3855 }
3856 }
3857 if (el[leaveCbKey]) {
3858 el[leaveCbKey](
3859 true
3860 /* cancelled */
3861 );
3862 }
3863 const leavingVNode = leavingVNodesCache[key];
3864 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3865 leavingVNode.el[leaveCbKey]();
3866 }
3867 callHook(hook, [el]);
3868 },
3869 enter(el) {
3870 let hook = onEnter;
3871 let afterHook = onAfterEnter;
3872 let cancelHook = onEnterCancelled;
3873 if (!state.isMounted) {
3874 if (appear) {
3875 hook = onAppear || onEnter;
3876 afterHook = onAfterAppear || onAfterEnter;
3877 cancelHook = onAppearCancelled || onEnterCancelled;
3878 } else {
3879 return;
3880 }
3881 }
3882 let called = false;
3883 const done = el[enterCbKey$1] = (cancelled) => {
3884 if (called)
3885 return;
3886 called = true;
3887 if (cancelled) {
3888 callHook(cancelHook, [el]);
3889 } else {
3890 callHook(afterHook, [el]);
3891 }
3892 if (hooks.delayedLeave) {
3893 hooks.delayedLeave();
3894 }
3895 el[enterCbKey$1] = void 0;
3896 };
3897 if (hook) {
3898 callAsyncHook(hook, [el, done]);
3899 } else {
3900 done();
3901 }
3902 },
3903 leave(el, remove) {
3904 const key2 = String(vnode.key);
3905 if (el[enterCbKey$1]) {
3906 el[enterCbKey$1](
3907 true
3908 /* cancelled */
3909 );
3910 }
3911 if (state.isUnmounting) {
3912 return remove();
3913 }
3914 callHook(onBeforeLeave, [el]);
3915 let called = false;
3916 const done = el[leaveCbKey] = (cancelled) => {
3917 if (called)
3918 return;
3919 called = true;
3920 remove();
3921 if (cancelled) {
3922 callHook(onLeaveCancelled, [el]);
3923 } else {
3924 callHook(onAfterLeave, [el]);
3925 }
3926 el[leaveCbKey] = void 0;
3927 if (leavingVNodesCache[key2] === vnode) {
3928 delete leavingVNodesCache[key2];
3929 }
3930 };
3931 leavingVNodesCache[key2] = vnode;
3932 if (onLeave) {
3933 callAsyncHook(onLeave, [el, done]);
3934 } else {
3935 done();
3936 }
3937 },
3938 clone(vnode2) {
3939 return resolveTransitionHooks(vnode2, props, state, instance);
3940 }
3941 };
3942 return hooks;
3943}
3944function emptyPlaceholder(vnode) {
3945 if (isKeepAlive(vnode)) {
3946 vnode = cloneVNode(vnode);
3947 vnode.children = null;
3948 return vnode;
3949 }
3950}
3951function getKeepAliveChild(vnode) {
3952 if (!isKeepAlive(vnode)) {
3953 return vnode;
3954 }
3955 if (vnode.component) {
3956 return vnode.component.subTree;
3957 }
3958 const { shapeFlag, children } = vnode;
3959 if (children) {
3960 if (shapeFlag & 16) {
3961 return children[0];
3962 }
3963 if (shapeFlag & 32 && isFunction(children.default)) {
3964 return children.default();
3965 }
3966 }
3967}
3968function setTransitionHooks(vnode, hooks) {
3969 if (vnode.shapeFlag & 6 && vnode.component) {
3970 setTransitionHooks(vnode.component.subTree, hooks);
3971 } else if (vnode.shapeFlag & 128) {
3972 vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3973 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3974 } else {
3975 vnode.transition = hooks;
3976 }
3977}
3978function getTransitionRawChildren(children, keepComment = false, parentKey) {
3979 let ret = [];
3980 let keyedFragmentCount = 0;
3981 for (let i = 0; i < children.length; i++) {
3982 let child = children[i];
3983 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
3984 if (child.type === Fragment) {
3985 if (child.patchFlag & 128)
3986 keyedFragmentCount++;
3987 ret = ret.concat(
3988 getTransitionRawChildren(child.children, keepComment, key)
3989 );
3990 } else if (keepComment || child.type !== Comment) {
3991 ret.push(key != null ? cloneVNode(child, { key }) : child);
3992 }
3993 }
3994 if (keyedFragmentCount > 1) {
3995 for (let i = 0; i < ret.length; i++) {
3996 ret[i].patchFlag = -2;
3997 }
3998 }
3999 return ret;
4000}
4001
4002/*! #__NO_SIDE_EFFECTS__ */
4003// @__NO_SIDE_EFFECTS__
4004function defineComponent(options, extraOptions) {
4005 return isFunction(options) ? (
4006 // #8326: extend call and options.name access are considered side-effects
4007 // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4008 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4009 ) : options;
4010}
4011
4012const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4013/*! #__NO_SIDE_EFFECTS__ */
4014// @__NO_SIDE_EFFECTS__
4015function defineAsyncComponent(source) {
4016 if (isFunction(source)) {
4017 source = { loader: source };
4018 }
4019 const {
4020 loader,
4021 loadingComponent,
4022 errorComponent,
4023 delay = 200,
4024 timeout,
4025 // undefined = never times out
4026 suspensible = true,
4027 onError: userOnError
4028 } = source;
4029 let pendingRequest = null;
4030 let resolvedComp;
4031 let retries = 0;
4032 const retry = () => {
4033 retries++;
4034 pendingRequest = null;
4035 return load();
4036 };
4037 const load = () => {
4038 let thisRequest;
4039 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4040 err = err instanceof Error ? err : new Error(String(err));
4041 if (userOnError) {
4042 return new Promise((resolve, reject) => {
4043 const userRetry = () => resolve(retry());
4044 const userFail = () => reject(err);
4045 userOnError(err, userRetry, userFail, retries + 1);
4046 });
4047 } else {
4048 throw err;
4049 }
4050 }).then((comp) => {
4051 if (thisRequest !== pendingRequest && pendingRequest) {
4052 return pendingRequest;
4053 }
4054 if (!comp) {
4055 warn$1(
4056 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
4057 );
4058 }
4059 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4060 comp = comp.default;
4061 }
4062 if (comp && !isObject(comp) && !isFunction(comp)) {
4063 throw new Error(`Invalid async component load result: ${comp}`);
4064 }
4065 resolvedComp = comp;
4066 return comp;
4067 }));
4068 };
4069 return defineComponent({
4070 name: "AsyncComponentWrapper",
4071 __asyncLoader: load,
4072 get __asyncResolved() {
4073 return resolvedComp;
4074 },
4075 setup() {
4076 const instance = currentInstance;
4077 if (resolvedComp) {
4078 return () => createInnerComp(resolvedComp, instance);
4079 }
4080 const onError = (err) => {
4081 pendingRequest = null;
4082 handleError(
4083 err,
4084 instance,
4085 13,
4086 !errorComponent
4087 );
4088 };
4089 if (suspensible && instance.suspense || false) {
4090 return load().then((comp) => {
4091 return () => createInnerComp(comp, instance);
4092 }).catch((err) => {
4093 onError(err);
4094 return () => errorComponent ? createVNode(errorComponent, {
4095 error: err
4096 }) : null;
4097 });
4098 }
4099 const loaded = ref(false);
4100 const error = ref();
4101 const delayed = ref(!!delay);
4102 if (delay) {
4103 setTimeout(() => {
4104 delayed.value = false;
4105 }, delay);
4106 }
4107 if (timeout != null) {
4108 setTimeout(() => {
4109 if (!loaded.value && !error.value) {
4110 const err = new Error(
4111 `Async component timed out after ${timeout}ms.`
4112 );
4113 onError(err);
4114 error.value = err;
4115 }
4116 }, timeout);
4117 }
4118 load().then(() => {
4119 loaded.value = true;
4120 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4121 instance.parent.effect.dirty = true;
4122 queueJob(instance.parent.update);
4123 }
4124 }).catch((err) => {
4125 onError(err);
4126 error.value = err;
4127 });
4128 return () => {
4129 if (loaded.value && resolvedComp) {
4130 return createInnerComp(resolvedComp, instance);
4131 } else if (error.value && errorComponent) {
4132 return createVNode(errorComponent, {
4133 error: error.value
4134 });
4135 } else if (loadingComponent && !delayed.value) {
4136 return createVNode(loadingComponent);
4137 }
4138 };
4139 }
4140 });
4141}
4142function createInnerComp(comp, parent) {
4143 const { ref: ref2, props, children, ce } = parent.vnode;
4144 const vnode = createVNode(comp, props, children);
4145 vnode.ref = ref2;
4146 vnode.ce = ce;
4147 delete parent.vnode.ce;
4148 return vnode;
4149}
4150
4151const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4152const KeepAliveImpl = {
4153 name: `KeepAlive`,
4154 // Marker for special handling inside the renderer. We are not using a ===
4155 // check directly on KeepAlive in the renderer, because importing it directly
4156 // would prevent it from being tree-shaken.
4157 __isKeepAlive: true,
4158 props: {
4159 include: [String, RegExp, Array],
4160 exclude: [String, RegExp, Array],
4161 max: [String, Number]
4162 },
4163 setup(props, { slots }) {
4164 const instance = getCurrentInstance();
4165 const sharedContext = instance.ctx;
4166 const cache = /* @__PURE__ */ new Map();
4167 const keys = /* @__PURE__ */ new Set();
4168 let current = null;
4169 {
4170 instance.__v_cache = cache;
4171 }
4172 const parentSuspense = instance.suspense;
4173 const {
4174 renderer: {
4175 p: patch,
4176 m: move,
4177 um: _unmount,
4178 o: { createElement }
4179 }
4180 } = sharedContext;
4181 const storageContainer = createElement("div");
4182 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4183 const instance2 = vnode.component;
4184 move(vnode, container, anchor, 0, parentSuspense);
4185 patch(
4186 instance2.vnode,
4187 vnode,
4188 container,
4189 anchor,
4190 instance2,
4191 parentSuspense,
4192 namespace,
4193 vnode.slotScopeIds,
4194 optimized
4195 );
4196 queuePostRenderEffect(() => {
4197 instance2.isDeactivated = false;
4198 if (instance2.a) {
4199 invokeArrayFns(instance2.a);
4200 }
4201 const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4202 if (vnodeHook) {
4203 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4204 }
4205 }, parentSuspense);
4206 {
4207 devtoolsComponentAdded(instance2);
4208 }
4209 };
4210 sharedContext.deactivate = (vnode) => {
4211 const instance2 = vnode.component;
4212 move(vnode, storageContainer, null, 1, parentSuspense);
4213 queuePostRenderEffect(() => {
4214 if (instance2.da) {
4215 invokeArrayFns(instance2.da);
4216 }
4217 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4218 if (vnodeHook) {
4219 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4220 }
4221 instance2.isDeactivated = true;
4222 }, parentSuspense);
4223 {
4224 devtoolsComponentAdded(instance2);
4225 }
4226 };
4227 function unmount(vnode) {
4228 resetShapeFlag(vnode);
4229 _unmount(vnode, instance, parentSuspense, true);
4230 }
4231 function pruneCache(filter) {
4232 cache.forEach((vnode, key) => {
4233 const name = getComponentName(vnode.type);
4234 if (name && (!filter || !filter(name))) {
4235 pruneCacheEntry(key);
4236 }
4237 });
4238 }
4239 function pruneCacheEntry(key) {
4240 const cached = cache.get(key);
4241 if (!current || !isSameVNodeType(cached, current)) {
4242 unmount(cached);
4243 } else if (current) {
4244 resetShapeFlag(current);
4245 }
4246 cache.delete(key);
4247 keys.delete(key);
4248 }
4249 watch(
4250 () => [props.include, props.exclude],
4251 ([include, exclude]) => {
4252 include && pruneCache((name) => matches(include, name));
4253 exclude && pruneCache((name) => !matches(exclude, name));
4254 },
4255 // prune post-render after `current` has been updated
4256 { flush: "post", deep: true }
4257 );
4258 let pendingCacheKey = null;
4259 const cacheSubtree = () => {
4260 if (pendingCacheKey != null) {
4261 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4262 }
4263 };
4264 onMounted(cacheSubtree);
4265 onUpdated(cacheSubtree);
4266 onBeforeUnmount(() => {
4267 cache.forEach((cached) => {
4268 const { subTree, suspense } = instance;
4269 const vnode = getInnerChild(subTree);
4270 if (cached.type === vnode.type && cached.key === vnode.key) {
4271 resetShapeFlag(vnode);
4272 const da = vnode.component.da;
4273 da && queuePostRenderEffect(da, suspense);
4274 return;
4275 }
4276 unmount(cached);
4277 });
4278 });
4279 return () => {
4280 pendingCacheKey = null;
4281 if (!slots.default) {
4282 return current = null;
4283 }
4284 const children = slots.default();
4285 const rawVNode = children[0];
4286 if (children.length > 1) {
4287 {
4288 warn$1(`KeepAlive should contain exactly one component child.`);
4289 }
4290 current = null;
4291 return children;
4292 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4293 current = null;
4294 return rawVNode;
4295 }
4296 let vnode = getInnerChild(rawVNode);
4297 const comp = vnode.type;
4298 const name = getComponentName(
4299 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4300 );
4301 const { include, exclude, max } = props;
4302 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4303 current = vnode;
4304 return rawVNode;
4305 }
4306 const key = vnode.key == null ? comp : vnode.key;
4307 const cachedVNode = cache.get(key);
4308 if (vnode.el) {
4309 vnode = cloneVNode(vnode);
4310 if (rawVNode.shapeFlag & 128) {
4311 rawVNode.ssContent = vnode;
4312 }
4313 }
4314 pendingCacheKey = key;
4315 if (cachedVNode) {
4316 vnode.el = cachedVNode.el;
4317 vnode.component = cachedVNode.component;
4318 if (vnode.transition) {
4319 setTransitionHooks(vnode, vnode.transition);
4320 }
4321 vnode.shapeFlag |= 512;
4322 keys.delete(key);
4323 keys.add(key);
4324 } else {
4325 keys.add(key);
4326 if (max && keys.size > parseInt(max, 10)) {
4327 pruneCacheEntry(keys.values().next().value);
4328 }
4329 }
4330 vnode.shapeFlag |= 256;
4331 current = vnode;
4332 return isSuspense(rawVNode.type) ? rawVNode : vnode;
4333 };
4334 }
4335};
4336const KeepAlive = KeepAliveImpl;
4337function matches(pattern, name) {
4338 if (isArray(pattern)) {
4339 return pattern.some((p) => matches(p, name));
4340 } else if (isString(pattern)) {
4341 return pattern.split(",").includes(name);
4342 } else if (isRegExp(pattern)) {
4343 return pattern.test(name);
4344 }
4345 return false;
4346}
4347function onActivated(hook, target) {
4348 registerKeepAliveHook(hook, "a", target);
4349}
4350function onDeactivated(hook, target) {
4351 registerKeepAliveHook(hook, "da", target);
4352}
4353function registerKeepAliveHook(hook, type, target = currentInstance) {
4354 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4355 let current = target;
4356 while (current) {
4357 if (current.isDeactivated) {
4358 return;
4359 }
4360 current = current.parent;
4361 }
4362 return hook();
4363 });
4364 injectHook(type, wrappedHook, target);
4365 if (target) {
4366 let current = target.parent;
4367 while (current && current.parent) {
4368 if (isKeepAlive(current.parent.vnode)) {
4369 injectToKeepAliveRoot(wrappedHook, type, target, current);
4370 }
4371 current = current.parent;
4372 }
4373 }
4374}
4375function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4376 const injected = injectHook(
4377 type,
4378 hook,
4379 keepAliveRoot,
4380 true
4381 /* prepend */
4382 );
4383 onUnmounted(() => {
4384 remove(keepAliveRoot[type], injected);
4385 }, target);
4386}
4387function resetShapeFlag(vnode) {
4388 vnode.shapeFlag &= ~256;
4389 vnode.shapeFlag &= ~512;
4390}
4391function getInnerChild(vnode) {
4392 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4393}
4394
4395function injectHook(type, hook, target = currentInstance, prepend = false) {
4396 if (target) {
4397 const hooks = target[type] || (target[type] = []);
4398 const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4399 if (target.isUnmounted) {
4400 return;
4401 }
4402 pauseTracking();
4403 const reset = setCurrentInstance(target);
4404 const res = callWithAsyncErrorHandling(hook, target, type, args);
4405 reset();
4406 resetTracking();
4407 return res;
4408 });
4409 if (prepend) {
4410 hooks.unshift(wrappedHook);
4411 } else {
4412 hooks.push(wrappedHook);
4413 }
4414 return wrappedHook;
4415 } else {
4416 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4417 warn$1(
4418 `${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.` )
4419 );
4420 }
4421}
4422const createHook = (lifecycle) => (hook, target = currentInstance) => (
4423 // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4424 (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
4425);
4426const onBeforeMount = createHook("bm");
4427const onMounted = createHook("m");
4428const onBeforeUpdate = createHook("bu");
4429const onUpdated = createHook("u");
4430const onBeforeUnmount = createHook("bum");
4431const onUnmounted = createHook("um");
4432const onServerPrefetch = createHook("sp");
4433const onRenderTriggered = createHook(
4434 "rtg"
4435);
4436const onRenderTracked = createHook(
4437 "rtc"
4438);
4439function onErrorCaptured(hook, target = currentInstance) {
4440 injectHook("ec", hook, target);
4441}
4442
4443function renderList(source, renderItem, cache, index) {
4444 let ret;
4445 const cached = cache && cache[index];
4446 if (isArray(source) || isString(source)) {
4447 ret = new Array(source.length);
4448 for (let i = 0, l = source.length; i < l; i++) {
4449 ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
4450 }
4451 } else if (typeof source === "number") {
4452 if (!Number.isInteger(source)) {
4453 warn$1(`The v-for range expect an integer value but got ${source}.`);
4454 }
4455 ret = new Array(source);
4456 for (let i = 0; i < source; i++) {
4457 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
4458 }
4459 } else if (isObject(source)) {
4460 if (source[Symbol.iterator]) {
4461 ret = Array.from(
4462 source,
4463 (item, i) => renderItem(item, i, void 0, cached && cached[i])
4464 );
4465 } else {
4466 const keys = Object.keys(source);
4467 ret = new Array(keys.length);
4468 for (let i = 0, l = keys.length; i < l; i++) {
4469 const key = keys[i];
4470 ret[i] = renderItem(source[key], key, i, cached && cached[i]);
4471 }
4472 }
4473 } else {
4474 ret = [];
4475 }
4476 if (cache) {
4477 cache[index] = ret;
4478 }
4479 return ret;
4480}
4481
4482function createSlots(slots, dynamicSlots) {
4483 for (let i = 0; i < dynamicSlots.length; i++) {
4484 const slot = dynamicSlots[i];
4485 if (isArray(slot)) {
4486 for (let j = 0; j < slot.length; j++) {
4487 slots[slot[j].name] = slot[j].fn;
4488 }
4489 } else if (slot) {
4490 slots[slot.name] = slot.key ? (...args) => {
4491 const res = slot.fn(...args);
4492 if (res)
4493 res.key = slot.key;
4494 return res;
4495 } : slot.fn;
4496 }
4497 }
4498 return slots;
4499}
4500
4501function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4502 if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
4503 if (name !== "default")
4504 props.name = name;
4505 return createVNode("slot", props, fallback && fallback());
4506 }
4507 let slot = slots[name];
4508 if (slot && slot.length > 1) {
4509 warn$1(
4510 `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.`
4511 );
4512 slot = () => [];
4513 }
4514 if (slot && slot._c) {
4515 slot._d = false;
4516 }
4517 openBlock();
4518 const validSlotContent = slot && ensureValidVNode(slot(props));
4519 const rendered = createBlock(
4520 Fragment,
4521 {
4522 key: props.key || // slot content array of a dynamic conditional slot may have a branch
4523 // key attached in the `createSlots` helper, respect that
4524 validSlotContent && validSlotContent.key || `_${name}`
4525 },
4526 validSlotContent || (fallback ? fallback() : []),
4527 validSlotContent && slots._ === 1 ? 64 : -2
4528 );
4529 if (!noSlotted && rendered.scopeId) {
4530 rendered.slotScopeIds = [rendered.scopeId + "-s"];
4531 }
4532 if (slot && slot._c) {
4533 slot._d = true;
4534 }
4535 return rendered;
4536}
4537function ensureValidVNode(vnodes) {
4538 return vnodes.some((child) => {
4539 if (!isVNode(child))
4540 return true;
4541 if (child.type === Comment)
4542 return false;
4543 if (child.type === Fragment && !ensureValidVNode(child.children))
4544 return false;
4545 return true;
4546 }) ? vnodes : null;
4547}
4548
4549function toHandlers(obj, preserveCaseIfNecessary) {
4550 const ret = {};
4551 if (!isObject(obj)) {
4552 warn$1(`v-on with no argument expects an object value.`);
4553 return ret;
4554 }
4555 for (const key in obj) {
4556 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
4557 }
4558 return ret;
4559}
4560
4561const getPublicInstance = (i) => {
4562 if (!i)
4563 return null;
4564 if (isStatefulComponent(i))
4565 return getExposeProxy(i) || i.proxy;
4566 return getPublicInstance(i.parent);
4567};
4568const publicPropertiesMap = (
4569 // Move PURE marker to new line to workaround compiler discarding it
4570 // due to type annotation
4571 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
4572 $: (i) => i,
4573 $el: (i) => i.vnode.el,
4574 $data: (i) => i.data,
4575 $props: (i) => shallowReadonly(i.props) ,
4576 $attrs: (i) => shallowReadonly(i.attrs) ,
4577 $slots: (i) => shallowReadonly(i.slots) ,
4578 $refs: (i) => shallowReadonly(i.refs) ,
4579 $parent: (i) => getPublicInstance(i.parent),
4580 $root: (i) => getPublicInstance(i.root),
4581 $emit: (i) => i.emit,
4582 $options: (i) => resolveMergedOptions(i) ,
4583 $forceUpdate: (i) => i.f || (i.f = () => {
4584 i.effect.dirty = true;
4585 queueJob(i.update);
4586 }),
4587 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
4588 $watch: (i) => instanceWatch.bind(i)
4589 })
4590);
4591const isReservedPrefix = (key) => key === "_" || key === "$";
4592const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4593const PublicInstanceProxyHandlers = {
4594 get({ _: instance }, key) {
4595 if (key === "__v_skip") {
4596 return true;
4597 }
4598 const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4599 if (key === "__isVue") {
4600 return true;
4601 }
4602 let normalizedProps;
4603 if (key[0] !== "$") {
4604 const n = accessCache[key];
4605 if (n !== void 0) {
4606 switch (n) {
4607 case 1 /* SETUP */:
4608 return setupState[key];
4609 case 2 /* DATA */:
4610 return data[key];
4611 case 4 /* CONTEXT */:
4612 return ctx[key];
4613 case 3 /* PROPS */:
4614 return props[key];
4615 }
4616 } else if (hasSetupBinding(setupState, key)) {
4617 accessCache[key] = 1 /* SETUP */;
4618 return setupState[key];
4619 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4620 accessCache[key] = 2 /* DATA */;
4621 return data[key];
4622 } else if (
4623 // only cache other properties when instance has declared (thus stable)
4624 // props
4625 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
4626 ) {
4627 accessCache[key] = 3 /* PROPS */;
4628 return props[key];
4629 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4630 accessCache[key] = 4 /* CONTEXT */;
4631 return ctx[key];
4632 } else if (shouldCacheAccess) {
4633 accessCache[key] = 0 /* OTHER */;
4634 }
4635 }
4636 const publicGetter = publicPropertiesMap[key];
4637 let cssModule, globalProperties;
4638 if (publicGetter) {
4639 if (key === "$attrs") {
4640 track(instance.attrs, "get", "");
4641 markAttrsAccessed();
4642 } else if (key === "$slots") {
4643 track(instance, "get", key);
4644 }
4645 return publicGetter(instance);
4646 } else if (
4647 // css module (injected by vue-loader)
4648 (cssModule = type.__cssModules) && (cssModule = cssModule[key])
4649 ) {
4650 return cssModule;
4651 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4652 accessCache[key] = 4 /* CONTEXT */;
4653 return ctx[key];
4654 } else if (
4655 // global properties
4656 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
4657 ) {
4658 {
4659 return globalProperties[key];
4660 }
4661 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
4662 // to infinite warning loop
4663 key.indexOf("__v") !== 0)) {
4664 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
4665 warn$1(
4666 `Property ${JSON.stringify(
4667 key
4668 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
4669 );
4670 } else if (instance === currentRenderingInstance) {
4671 warn$1(
4672 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
4673 );
4674 }
4675 }
4676 },
4677 set({ _: instance }, key, value) {
4678 const { data, setupState, ctx } = instance;
4679 if (hasSetupBinding(setupState, key)) {
4680 setupState[key] = value;
4681 return true;
4682 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
4683 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
4684 return false;
4685 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4686 data[key] = value;
4687 return true;
4688 } else if (hasOwn(instance.props, key)) {
4689 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
4690 return false;
4691 }
4692 if (key[0] === "$" && key.slice(1) in instance) {
4693 warn$1(
4694 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
4695 );
4696 return false;
4697 } else {
4698 if (key in instance.appContext.config.globalProperties) {
4699 Object.defineProperty(ctx, key, {
4700 enumerable: true,
4701 configurable: true,
4702 value
4703 });
4704 } else {
4705 ctx[key] = value;
4706 }
4707 }
4708 return true;
4709 },
4710 has({
4711 _: { data, setupState, accessCache, ctx, appContext, propsOptions }
4712 }, key) {
4713 let normalizedProps;
4714 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);
4715 },
4716 defineProperty(target, key, descriptor) {
4717 if (descriptor.get != null) {
4718 target._.accessCache[key] = 0;
4719 } else if (hasOwn(descriptor, "value")) {
4720 this.set(target, key, descriptor.value, null);
4721 }
4722 return Reflect.defineProperty(target, key, descriptor);
4723 }
4724};
4725{
4726 PublicInstanceProxyHandlers.ownKeys = (target) => {
4727 warn$1(
4728 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
4729 );
4730 return Reflect.ownKeys(target);
4731 };
4732}
4733const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
4734 {},
4735 PublicInstanceProxyHandlers,
4736 {
4737 get(target, key) {
4738 if (key === Symbol.unscopables) {
4739 return;
4740 }
4741 return PublicInstanceProxyHandlers.get(target, key, target);
4742 },
4743 has(_, key) {
4744 const has = key[0] !== "_" && !isGloballyAllowed(key);
4745 if (!has && PublicInstanceProxyHandlers.has(_, key)) {
4746 warn$1(
4747 `Property ${JSON.stringify(
4748 key
4749 )} should not start with _ which is a reserved prefix for Vue internals.`
4750 );
4751 }
4752 return has;
4753 }
4754 }
4755);
4756function createDevRenderContext(instance) {
4757 const target = {};
4758 Object.defineProperty(target, `_`, {
4759 configurable: true,
4760 enumerable: false,
4761 get: () => instance
4762 });
4763 Object.keys(publicPropertiesMap).forEach((key) => {
4764 Object.defineProperty(target, key, {
4765 configurable: true,
4766 enumerable: false,
4767 get: () => publicPropertiesMap[key](instance),
4768 // intercepted by the proxy so no need for implementation,
4769 // but needed to prevent set errors
4770 set: NOOP
4771 });
4772 });
4773 return target;
4774}
4775function exposePropsOnRenderContext(instance) {
4776 const {
4777 ctx,
4778 propsOptions: [propsOptions]
4779 } = instance;
4780 if (propsOptions) {
4781 Object.keys(propsOptions).forEach((key) => {
4782 Object.defineProperty(ctx, key, {
4783 enumerable: true,
4784 configurable: true,
4785 get: () => instance.props[key],
4786 set: NOOP
4787 });
4788 });
4789 }
4790}
4791function exposeSetupStateOnRenderContext(instance) {
4792 const { ctx, setupState } = instance;
4793 Object.keys(toRaw(setupState)).forEach((key) => {
4794 if (!setupState.__isScriptSetup) {
4795 if (isReservedPrefix(key[0])) {
4796 warn$1(
4797 `setup() return property ${JSON.stringify(
4798 key
4799 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
4800 );
4801 return;
4802 }
4803 Object.defineProperty(ctx, key, {
4804 enumerable: true,
4805 configurable: true,
4806 get: () => setupState[key],
4807 set: NOOP
4808 });
4809 }
4810 });
4811}
4812
4813const warnRuntimeUsage = (method) => warn$1(
4814 `${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.`
4815);
4816function defineProps() {
4817 {
4818 warnRuntimeUsage(`defineProps`);
4819 }
4820 return null;
4821}
4822function defineEmits() {
4823 {
4824 warnRuntimeUsage(`defineEmits`);
4825 }
4826 return null;
4827}
4828function defineExpose(exposed) {
4829 {
4830 warnRuntimeUsage(`defineExpose`);
4831 }
4832}
4833function defineOptions(options) {
4834 {
4835 warnRuntimeUsage(`defineOptions`);
4836 }
4837}
4838function defineSlots() {
4839 {
4840 warnRuntimeUsage(`defineSlots`);
4841 }
4842 return null;
4843}
4844function defineModel() {
4845 {
4846 warnRuntimeUsage("defineModel");
4847 }
4848}
4849function withDefaults(props, defaults) {
4850 {
4851 warnRuntimeUsage(`withDefaults`);
4852 }
4853 return null;
4854}
4855function useSlots() {
4856 return getContext().slots;
4857}
4858function useAttrs() {
4859 return getContext().attrs;
4860}
4861function getContext() {
4862 const i = getCurrentInstance();
4863 if (!i) {
4864 warn$1(`useContext() called without active instance.`);
4865 }
4866 return i.setupContext || (i.setupContext = createSetupContext(i));
4867}
4868function normalizePropsOrEmits(props) {
4869 return isArray(props) ? props.reduce(
4870 (normalized, p) => (normalized[p] = null, normalized),
4871 {}
4872 ) : props;
4873}
4874function mergeDefaults(raw, defaults) {
4875 const props = normalizePropsOrEmits(raw);
4876 for (const key in defaults) {
4877 if (key.startsWith("__skip"))
4878 continue;
4879 let opt = props[key];
4880 if (opt) {
4881 if (isArray(opt) || isFunction(opt)) {
4882 opt = props[key] = { type: opt, default: defaults[key] };
4883 } else {
4884 opt.default = defaults[key];
4885 }
4886 } else if (opt === null) {
4887 opt = props[key] = { default: defaults[key] };
4888 } else {
4889 warn$1(`props default key "${key}" has no corresponding declaration.`);
4890 }
4891 if (opt && defaults[`__skip_${key}`]) {
4892 opt.skipFactory = true;
4893 }
4894 }
4895 return props;
4896}
4897function mergeModels(a, b) {
4898 if (!a || !b)
4899 return a || b;
4900 if (isArray(a) && isArray(b))
4901 return a.concat(b);
4902 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
4903}
4904function createPropsRestProxy(props, excludedKeys) {
4905 const ret = {};
4906 for (const key in props) {
4907 if (!excludedKeys.includes(key)) {
4908 Object.defineProperty(ret, key, {
4909 enumerable: true,
4910 get: () => props[key]
4911 });
4912 }
4913 }
4914 return ret;
4915}
4916function withAsyncContext(getAwaitable) {
4917 const ctx = getCurrentInstance();
4918 if (!ctx) {
4919 warn$1(
4920 `withAsyncContext called without active current instance. This is likely a bug.`
4921 );
4922 }
4923 let awaitable = getAwaitable();
4924 unsetCurrentInstance();
4925 if (isPromise(awaitable)) {
4926 awaitable = awaitable.catch((e) => {
4927 setCurrentInstance(ctx);
4928 throw e;
4929 });
4930 }
4931 return [awaitable, () => setCurrentInstance(ctx)];
4932}
4933
4934function createDuplicateChecker() {
4935 const cache = /* @__PURE__ */ Object.create(null);
4936 return (type, key) => {
4937 if (cache[key]) {
4938 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
4939 } else {
4940 cache[key] = type;
4941 }
4942 };
4943}
4944let shouldCacheAccess = true;
4945function applyOptions(instance) {
4946 const options = resolveMergedOptions(instance);
4947 const publicThis = instance.proxy;
4948 const ctx = instance.ctx;
4949 shouldCacheAccess = false;
4950 if (options.beforeCreate) {
4951 callHook$1(options.beforeCreate, instance, "bc");
4952 }
4953 const {
4954 // state
4955 data: dataOptions,
4956 computed: computedOptions,
4957 methods,
4958 watch: watchOptions,
4959 provide: provideOptions,
4960 inject: injectOptions,
4961 // lifecycle
4962 created,
4963 beforeMount,
4964 mounted,
4965 beforeUpdate,
4966 updated,
4967 activated,
4968 deactivated,
4969 beforeDestroy,
4970 beforeUnmount,
4971 destroyed,
4972 unmounted,
4973 render,
4974 renderTracked,
4975 renderTriggered,
4976 errorCaptured,
4977 serverPrefetch,
4978 // public API
4979 expose,
4980 inheritAttrs,
4981 // assets
4982 components,
4983 directives,
4984 filters
4985 } = options;
4986 const checkDuplicateProperties = createDuplicateChecker() ;
4987 {
4988 const [propsOptions] = instance.propsOptions;
4989 if (propsOptions) {
4990 for (const key in propsOptions) {
4991 checkDuplicateProperties("Props" /* PROPS */, key);
4992 }
4993 }
4994 }
4995 if (injectOptions) {
4996 resolveInjections(injectOptions, ctx, checkDuplicateProperties);
4997 }
4998 if (methods) {
4999 for (const key in methods) {
5000 const methodHandler = methods[key];
5001 if (isFunction(methodHandler)) {
5002 {
5003 Object.defineProperty(ctx, key, {
5004 value: methodHandler.bind(publicThis),
5005 configurable: true,
5006 enumerable: true,
5007 writable: true
5008 });
5009 }
5010 {
5011 checkDuplicateProperties("Methods" /* METHODS */, key);
5012 }
5013 } else {
5014 warn$1(
5015 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
5016 );
5017 }
5018 }
5019 }
5020 if (dataOptions) {
5021 if (!isFunction(dataOptions)) {
5022 warn$1(
5023 `The data option must be a function. Plain object usage is no longer supported.`
5024 );
5025 }
5026 const data = dataOptions.call(publicThis, publicThis);
5027 if (isPromise(data)) {
5028 warn$1(
5029 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
5030 );
5031 }
5032 if (!isObject(data)) {
5033 warn$1(`data() should return an object.`);
5034 } else {
5035 instance.data = reactive(data);
5036 {
5037 for (const key in data) {
5038 checkDuplicateProperties("Data" /* DATA */, key);
5039 if (!isReservedPrefix(key[0])) {
5040 Object.defineProperty(ctx, key, {
5041 configurable: true,
5042 enumerable: true,
5043 get: () => data[key],
5044 set: NOOP
5045 });
5046 }
5047 }
5048 }
5049 }
5050 }
5051 shouldCacheAccess = true;
5052 if (computedOptions) {
5053 for (const key in computedOptions) {
5054 const opt = computedOptions[key];
5055 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
5056 if (get === NOOP) {
5057 warn$1(`Computed property "${key}" has no getter.`);
5058 }
5059 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
5060 warn$1(
5061 `Write operation failed: computed property "${key}" is readonly.`
5062 );
5063 } ;
5064 const c = computed({
5065 get,
5066 set
5067 });
5068 Object.defineProperty(ctx, key, {
5069 enumerable: true,
5070 configurable: true,
5071 get: () => c.value,
5072 set: (v) => c.value = v
5073 });
5074 {
5075 checkDuplicateProperties("Computed" /* COMPUTED */, key);
5076 }
5077 }
5078 }
5079 if (watchOptions) {
5080 for (const key in watchOptions) {
5081 createWatcher(watchOptions[key], ctx, publicThis, key);
5082 }
5083 }
5084 if (provideOptions) {
5085 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
5086 Reflect.ownKeys(provides).forEach((key) => {
5087 provide(key, provides[key]);
5088 });
5089 }
5090 if (created) {
5091 callHook$1(created, instance, "c");
5092 }
5093 function registerLifecycleHook(register, hook) {
5094 if (isArray(hook)) {
5095 hook.forEach((_hook) => register(_hook.bind(publicThis)));
5096 } else if (hook) {
5097 register(hook.bind(publicThis));
5098 }
5099 }
5100 registerLifecycleHook(onBeforeMount, beforeMount);
5101 registerLifecycleHook(onMounted, mounted);
5102 registerLifecycleHook(onBeforeUpdate, beforeUpdate);
5103 registerLifecycleHook(onUpdated, updated);
5104 registerLifecycleHook(onActivated, activated);
5105 registerLifecycleHook(onDeactivated, deactivated);
5106 registerLifecycleHook(onErrorCaptured, errorCaptured);
5107 registerLifecycleHook(onRenderTracked, renderTracked);
5108 registerLifecycleHook(onRenderTriggered, renderTriggered);
5109 registerLifecycleHook(onBeforeUnmount, beforeUnmount);
5110 registerLifecycleHook(onUnmounted, unmounted);
5111 registerLifecycleHook(onServerPrefetch, serverPrefetch);
5112 if (isArray(expose)) {
5113 if (expose.length) {
5114 const exposed = instance.exposed || (instance.exposed = {});
5115 expose.forEach((key) => {
5116 Object.defineProperty(exposed, key, {
5117 get: () => publicThis[key],
5118 set: (val) => publicThis[key] = val
5119 });
5120 });
5121 } else if (!instance.exposed) {
5122 instance.exposed = {};
5123 }
5124 }
5125 if (render && instance.render === NOOP) {
5126 instance.render = render;
5127 }
5128 if (inheritAttrs != null) {
5129 instance.inheritAttrs = inheritAttrs;
5130 }
5131 if (components)
5132 instance.components = components;
5133 if (directives)
5134 instance.directives = directives;
5135}
5136function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5137 if (isArray(injectOptions)) {
5138 injectOptions = normalizeInject(injectOptions);
5139 }
5140 for (const key in injectOptions) {
5141 const opt = injectOptions[key];
5142 let injected;
5143 if (isObject(opt)) {
5144 if ("default" in opt) {
5145 injected = inject(
5146 opt.from || key,
5147 opt.default,
5148 true
5149 );
5150 } else {
5151 injected = inject(opt.from || key);
5152 }
5153 } else {
5154 injected = inject(opt);
5155 }
5156 if (isRef(injected)) {
5157 Object.defineProperty(ctx, key, {
5158 enumerable: true,
5159 configurable: true,
5160 get: () => injected.value,
5161 set: (v) => injected.value = v
5162 });
5163 } else {
5164 ctx[key] = injected;
5165 }
5166 {
5167 checkDuplicateProperties("Inject" /* INJECT */, key);
5168 }
5169 }
5170}
5171function callHook$1(hook, instance, type) {
5172 callWithAsyncErrorHandling(
5173 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
5174 instance,
5175 type
5176 );
5177}
5178function createWatcher(raw, ctx, publicThis, key) {
5179 const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5180 if (isString(raw)) {
5181 const handler = ctx[raw];
5182 if (isFunction(handler)) {
5183 watch(getter, handler);
5184 } else {
5185 warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5186 }
5187 } else if (isFunction(raw)) {
5188 watch(getter, raw.bind(publicThis));
5189 } else if (isObject(raw)) {
5190 if (isArray(raw)) {
5191 raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
5192 } else {
5193 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
5194 if (isFunction(handler)) {
5195 watch(getter, handler, raw);
5196 } else {
5197 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
5198 }
5199 }
5200 } else {
5201 warn$1(`Invalid watch option: "${key}"`, raw);
5202 }
5203}
5204function resolveMergedOptions(instance) {
5205 const base = instance.type;
5206 const { mixins, extends: extendsOptions } = base;
5207 const {
5208 mixins: globalMixins,
5209 optionsCache: cache,
5210 config: { optionMergeStrategies }
5211 } = instance.appContext;
5212 const cached = cache.get(base);
5213 let resolved;
5214 if (cached) {
5215 resolved = cached;
5216 } else if (!globalMixins.length && !mixins && !extendsOptions) {
5217 {
5218 resolved = base;
5219 }
5220 } else {
5221 resolved = {};
5222 if (globalMixins.length) {
5223 globalMixins.forEach(
5224 (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
5225 );
5226 }
5227 mergeOptions(resolved, base, optionMergeStrategies);
5228 }
5229 if (isObject(base)) {
5230 cache.set(base, resolved);
5231 }
5232 return resolved;
5233}
5234function mergeOptions(to, from, strats, asMixin = false) {
5235 const { mixins, extends: extendsOptions } = from;
5236 if (extendsOptions) {
5237 mergeOptions(to, extendsOptions, strats, true);
5238 }
5239 if (mixins) {
5240 mixins.forEach(
5241 (m) => mergeOptions(to, m, strats, true)
5242 );
5243 }
5244 for (const key in from) {
5245 if (asMixin && key === "expose") {
5246 warn$1(
5247 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
5248 );
5249 } else {
5250 const strat = internalOptionMergeStrats[key] || strats && strats[key];
5251 to[key] = strat ? strat(to[key], from[key]) : from[key];
5252 }
5253 }
5254 return to;
5255}
5256const internalOptionMergeStrats = {
5257 data: mergeDataFn,
5258 props: mergeEmitsOrPropsOptions,
5259 emits: mergeEmitsOrPropsOptions,
5260 // objects
5261 methods: mergeObjectOptions,
5262 computed: mergeObjectOptions,
5263 // lifecycle
5264 beforeCreate: mergeAsArray$1,
5265 created: mergeAsArray$1,
5266 beforeMount: mergeAsArray$1,
5267 mounted: mergeAsArray$1,
5268 beforeUpdate: mergeAsArray$1,
5269 updated: mergeAsArray$1,
5270 beforeDestroy: mergeAsArray$1,
5271 beforeUnmount: mergeAsArray$1,
5272 destroyed: mergeAsArray$1,
5273 unmounted: mergeAsArray$1,
5274 activated: mergeAsArray$1,
5275 deactivated: mergeAsArray$1,
5276 errorCaptured: mergeAsArray$1,
5277 serverPrefetch: mergeAsArray$1,
5278 // assets
5279 components: mergeObjectOptions,
5280 directives: mergeObjectOptions,
5281 // watch
5282 watch: mergeWatchOptions,
5283 // provide / inject
5284 provide: mergeDataFn,
5285 inject: mergeInject
5286};
5287function mergeDataFn(to, from) {
5288 if (!from) {
5289 return to;
5290 }
5291 if (!to) {
5292 return from;
5293 }
5294 return function mergedDataFn() {
5295 return (extend)(
5296 isFunction(to) ? to.call(this, this) : to,
5297 isFunction(from) ? from.call(this, this) : from
5298 );
5299 };
5300}
5301function mergeInject(to, from) {
5302 return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
5303}
5304function normalizeInject(raw) {
5305 if (isArray(raw)) {
5306 const res = {};
5307 for (let i = 0; i < raw.length; i++) {
5308 res[raw[i]] = raw[i];
5309 }
5310 return res;
5311 }
5312 return raw;
5313}
5314function mergeAsArray$1(to, from) {
5315 return to ? [...new Set([].concat(to, from))] : from;
5316}
5317function mergeObjectOptions(to, from) {
5318 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5319}
5320function mergeEmitsOrPropsOptions(to, from) {
5321 if (to) {
5322 if (isArray(to) && isArray(from)) {
5323 return [.../* @__PURE__ */ new Set([...to, ...from])];
5324 }
5325 return extend(
5326 /* @__PURE__ */ Object.create(null),
5327 normalizePropsOrEmits(to),
5328 normalizePropsOrEmits(from != null ? from : {})
5329 );
5330 } else {
5331 return from;
5332 }
5333}
5334function mergeWatchOptions(to, from) {
5335 if (!to)
5336 return from;
5337 if (!from)
5338 return to;
5339 const merged = extend(/* @__PURE__ */ Object.create(null), to);
5340 for (const key in from) {
5341 merged[key] = mergeAsArray$1(to[key], from[key]);
5342 }
5343 return merged;
5344}
5345
5346function createAppContext() {
5347 return {
5348 app: null,
5349 config: {
5350 isNativeTag: NO,
5351 performance: false,
5352 globalProperties: {},
5353 optionMergeStrategies: {},
5354 errorHandler: void 0,
5355 warnHandler: void 0,
5356 compilerOptions: {}
5357 },
5358 mixins: [],
5359 components: {},
5360 directives: {},
5361 provides: /* @__PURE__ */ Object.create(null),
5362 optionsCache: /* @__PURE__ */ new WeakMap(),
5363 propsCache: /* @__PURE__ */ new WeakMap(),
5364 emitsCache: /* @__PURE__ */ new WeakMap()
5365 };
5366}
5367let uid$1 = 0;
5368function createAppAPI(render, hydrate) {
5369 return function createApp(rootComponent, rootProps = null) {
5370 if (!isFunction(rootComponent)) {
5371 rootComponent = extend({}, rootComponent);
5372 }
5373 if (rootProps != null && !isObject(rootProps)) {
5374 warn$1(`root props passed to app.mount() must be an object.`);
5375 rootProps = null;
5376 }
5377 const context = createAppContext();
5378 const installedPlugins = /* @__PURE__ */ new WeakSet();
5379 let isMounted = false;
5380 const app = context.app = {
5381 _uid: uid$1++,
5382 _component: rootComponent,
5383 _props: rootProps,
5384 _container: null,
5385 _context: context,
5386 _instance: null,
5387 version,
5388 get config() {
5389 return context.config;
5390 },
5391 set config(v) {
5392 {
5393 warn$1(
5394 `app.config cannot be replaced. Modify individual options instead.`
5395 );
5396 }
5397 },
5398 use(plugin, ...options) {
5399 if (installedPlugins.has(plugin)) {
5400 warn$1(`Plugin has already been applied to target app.`);
5401 } else if (plugin && isFunction(plugin.install)) {
5402 installedPlugins.add(plugin);
5403 plugin.install(app, ...options);
5404 } else if (isFunction(plugin)) {
5405 installedPlugins.add(plugin);
5406 plugin(app, ...options);
5407 } else {
5408 warn$1(
5409 `A plugin must either be a function or an object with an "install" function.`
5410 );
5411 }
5412 return app;
5413 },
5414 mixin(mixin) {
5415 {
5416 if (!context.mixins.includes(mixin)) {
5417 context.mixins.push(mixin);
5418 } else {
5419 warn$1(
5420 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
5421 );
5422 }
5423 }
5424 return app;
5425 },
5426 component(name, component) {
5427 {
5428 validateComponentName(name, context.config);
5429 }
5430 if (!component) {
5431 return context.components[name];
5432 }
5433 if (context.components[name]) {
5434 warn$1(`Component "${name}" has already been registered in target app.`);
5435 }
5436 context.components[name] = component;
5437 return app;
5438 },
5439 directive(name, directive) {
5440 {
5441 validateDirectiveName(name);
5442 }
5443 if (!directive) {
5444 return context.directives[name];
5445 }
5446 if (context.directives[name]) {
5447 warn$1(`Directive "${name}" has already been registered in target app.`);
5448 }
5449 context.directives[name] = directive;
5450 return app;
5451 },
5452 mount(rootContainer, isHydrate, namespace) {
5453 if (!isMounted) {
5454 if (rootContainer.__vue_app__) {
5455 warn$1(
5456 `There is already an app instance mounted on the host container.
5457 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
5458 );
5459 }
5460 const vnode = createVNode(rootComponent, rootProps);
5461 vnode.appContext = context;
5462 if (namespace === true) {
5463 namespace = "svg";
5464 } else if (namespace === false) {
5465 namespace = void 0;
5466 }
5467 {
5468 context.reload = () => {
5469 render(
5470 cloneVNode(vnode),
5471 rootContainer,
5472 namespace
5473 );
5474 };
5475 }
5476 if (isHydrate && hydrate) {
5477 hydrate(vnode, rootContainer);
5478 } else {
5479 render(vnode, rootContainer, namespace);
5480 }
5481 isMounted = true;
5482 app._container = rootContainer;
5483 rootContainer.__vue_app__ = app;
5484 {
5485 app._instance = vnode.component;
5486 devtoolsInitApp(app, version);
5487 }
5488 return getExposeProxy(vnode.component) || vnode.component.proxy;
5489 } else {
5490 warn$1(
5491 `App has already been mounted.
5492If 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)\``
5493 );
5494 }
5495 },
5496 unmount() {
5497 if (isMounted) {
5498 render(null, app._container);
5499 {
5500 app._instance = null;
5501 devtoolsUnmountApp(app);
5502 }
5503 delete app._container.__vue_app__;
5504 } else {
5505 warn$1(`Cannot unmount an app that is not mounted.`);
5506 }
5507 },
5508 provide(key, value) {
5509 if (key in context.provides) {
5510 warn$1(
5511 `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
5512 );
5513 }
5514 context.provides[key] = value;
5515 return app;
5516 },
5517 runWithContext(fn) {
5518 const lastApp = currentApp;
5519 currentApp = app;
5520 try {
5521 return fn();
5522 } finally {
5523 currentApp = lastApp;
5524 }
5525 }
5526 };
5527 return app;
5528 };
5529}
5530let currentApp = null;
5531
5532function provide(key, value) {
5533 if (!currentInstance) {
5534 {
5535 warn$1(`provide() can only be used inside setup().`);
5536 }
5537 } else {
5538 let provides = currentInstance.provides;
5539 const parentProvides = currentInstance.parent && currentInstance.parent.provides;
5540 if (parentProvides === provides) {
5541 provides = currentInstance.provides = Object.create(parentProvides);
5542 }
5543 provides[key] = value;
5544 }
5545}
5546function inject(key, defaultValue, treatDefaultAsFactory = false) {
5547 const instance = currentInstance || currentRenderingInstance;
5548 if (instance || currentApp) {
5549 const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5550 if (provides && key in provides) {
5551 return provides[key];
5552 } else if (arguments.length > 1) {
5553 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
5554 } else {
5555 warn$1(`injection "${String(key)}" not found.`);
5556 }
5557 } else {
5558 warn$1(`inject() can only be used inside setup() or functional components.`);
5559 }
5560}
5561function hasInjectionContext() {
5562 return !!(currentInstance || currentRenderingInstance || currentApp);
5563}
5564
5565const internalObjectProto = {};
5566const createInternalObject = () => Object.create(internalObjectProto);
5567const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5568
5569function initProps(instance, rawProps, isStateful, isSSR = false) {
5570 const props = {};
5571 const attrs = createInternalObject();
5572 instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5573 setFullProps(instance, rawProps, props, attrs);
5574 for (const key in instance.propsOptions[0]) {
5575 if (!(key in props)) {
5576 props[key] = void 0;
5577 }
5578 }
5579 {
5580 validateProps(rawProps || {}, props, instance);
5581 }
5582 if (isStateful) {
5583 instance.props = isSSR ? props : shallowReactive(props);
5584 } else {
5585 if (!instance.type.props) {
5586 instance.props = attrs;
5587 } else {
5588 instance.props = props;
5589 }
5590 }
5591 instance.attrs = attrs;
5592}
5593function isInHmrContext(instance) {
5594 while (instance) {
5595 if (instance.type.__hmrId)
5596 return true;
5597 instance = instance.parent;
5598 }
5599}
5600function updateProps(instance, rawProps, rawPrevProps, optimized) {
5601 const {
5602 props,
5603 attrs,
5604 vnode: { patchFlag }
5605 } = instance;
5606 const rawCurrentProps = toRaw(props);
5607 const [options] = instance.propsOptions;
5608 let hasAttrsChanged = false;
5609 if (
5610 // always force full diff in dev
5611 // - #1942 if hmr is enabled with sfc component
5612 // - vite#872 non-sfc component used by sfc component
5613 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
5614 ) {
5615 if (patchFlag & 8) {
5616 const propsToUpdate = instance.vnode.dynamicProps;
5617 for (let i = 0; i < propsToUpdate.length; i++) {
5618 let key = propsToUpdate[i];
5619 if (isEmitListener(instance.emitsOptions, key)) {
5620 continue;
5621 }
5622 const value = rawProps[key];
5623 if (options) {
5624 if (hasOwn(attrs, key)) {
5625 if (value !== attrs[key]) {
5626 attrs[key] = value;
5627 hasAttrsChanged = true;
5628 }
5629 } else {
5630 const camelizedKey = camelize(key);
5631 props[camelizedKey] = resolvePropValue(
5632 options,
5633 rawCurrentProps,
5634 camelizedKey,
5635 value,
5636 instance,
5637 false
5638 );
5639 }
5640 } else {
5641 if (value !== attrs[key]) {
5642 attrs[key] = value;
5643 hasAttrsChanged = true;
5644 }
5645 }
5646 }
5647 }
5648 } else {
5649 if (setFullProps(instance, rawProps, props, attrs)) {
5650 hasAttrsChanged = true;
5651 }
5652 let kebabKey;
5653 for (const key in rawCurrentProps) {
5654 if (!rawProps || // for camelCase
5655 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5656 // and converted to camelCase (#955)
5657 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5658 if (options) {
5659 if (rawPrevProps && // for camelCase
5660 (rawPrevProps[key] !== void 0 || // for kebab-case
5661 rawPrevProps[kebabKey] !== void 0)) {
5662 props[key] = resolvePropValue(
5663 options,
5664 rawCurrentProps,
5665 key,
5666 void 0,
5667 instance,
5668 true
5669 );
5670 }
5671 } else {
5672 delete props[key];
5673 }
5674 }
5675 }
5676 if (attrs !== rawCurrentProps) {
5677 for (const key in attrs) {
5678 if (!rawProps || !hasOwn(rawProps, key) && true) {
5679 delete attrs[key];
5680 hasAttrsChanged = true;
5681 }
5682 }
5683 }
5684 }
5685 if (hasAttrsChanged) {
5686 trigger(instance.attrs, "set", "");
5687 }
5688 {
5689 validateProps(rawProps || {}, props, instance);
5690 }
5691}
5692function setFullProps(instance, rawProps, props, attrs) {
5693 const [options, needCastKeys] = instance.propsOptions;
5694 let hasAttrsChanged = false;
5695 let rawCastValues;
5696 if (rawProps) {
5697 for (let key in rawProps) {
5698 if (isReservedProp(key)) {
5699 continue;
5700 }
5701 const value = rawProps[key];
5702 let camelKey;
5703 if (options && hasOwn(options, camelKey = camelize(key))) {
5704 if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5705 props[camelKey] = value;
5706 } else {
5707 (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5708 }
5709 } else if (!isEmitListener(instance.emitsOptions, key)) {
5710 if (!(key in attrs) || value !== attrs[key]) {
5711 attrs[key] = value;
5712 hasAttrsChanged = true;
5713 }
5714 }
5715 }
5716 }
5717 if (needCastKeys) {
5718 const rawCurrentProps = toRaw(props);
5719 const castValues = rawCastValues || EMPTY_OBJ;
5720 for (let i = 0; i < needCastKeys.length; i++) {
5721 const key = needCastKeys[i];
5722 props[key] = resolvePropValue(
5723 options,
5724 rawCurrentProps,
5725 key,
5726 castValues[key],
5727 instance,
5728 !hasOwn(castValues, key)
5729 );
5730 }
5731 }
5732 return hasAttrsChanged;
5733}
5734function resolvePropValue(options, props, key, value, instance, isAbsent) {
5735 const opt = options[key];
5736 if (opt != null) {
5737 const hasDefault = hasOwn(opt, "default");
5738 if (hasDefault && value === void 0) {
5739 const defaultValue = opt.default;
5740 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5741 const { propsDefaults } = instance;
5742 if (key in propsDefaults) {
5743 value = propsDefaults[key];
5744 } else {
5745 const reset = setCurrentInstance(instance);
5746 value = propsDefaults[key] = defaultValue.call(
5747 null,
5748 props
5749 );
5750 reset();
5751 }
5752 } else {
5753 value = defaultValue;
5754 }
5755 }
5756 if (opt[0 /* shouldCast */]) {
5757 if (isAbsent && !hasDefault) {
5758 value = false;
5759 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
5760 value = true;
5761 }
5762 }
5763 }
5764 return value;
5765}
5766function normalizePropsOptions(comp, appContext, asMixin = false) {
5767 const cache = appContext.propsCache;
5768 const cached = cache.get(comp);
5769 if (cached) {
5770 return cached;
5771 }
5772 const raw = comp.props;
5773 const normalized = {};
5774 const needCastKeys = [];
5775 let hasExtends = false;
5776 if (!isFunction(comp)) {
5777 const extendProps = (raw2) => {
5778 hasExtends = true;
5779 const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5780 extend(normalized, props);
5781 if (keys)
5782 needCastKeys.push(...keys);
5783 };
5784 if (!asMixin && appContext.mixins.length) {
5785 appContext.mixins.forEach(extendProps);
5786 }
5787 if (comp.extends) {
5788 extendProps(comp.extends);
5789 }
5790 if (comp.mixins) {
5791 comp.mixins.forEach(extendProps);
5792 }
5793 }
5794 if (!raw && !hasExtends) {
5795 if (isObject(comp)) {
5796 cache.set(comp, EMPTY_ARR);
5797 }
5798 return EMPTY_ARR;
5799 }
5800 if (isArray(raw)) {
5801 for (let i = 0; i < raw.length; i++) {
5802 if (!isString(raw[i])) {
5803 warn$1(`props must be strings when using array syntax.`, raw[i]);
5804 }
5805 const normalizedKey = camelize(raw[i]);
5806 if (validatePropName(normalizedKey)) {
5807 normalized[normalizedKey] = EMPTY_OBJ;
5808 }
5809 }
5810 } else if (raw) {
5811 if (!isObject(raw)) {
5812 warn$1(`invalid props options`, raw);
5813 }
5814 for (const key in raw) {
5815 const normalizedKey = camelize(key);
5816 if (validatePropName(normalizedKey)) {
5817 const opt = raw[key];
5818 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5819 if (prop) {
5820 const booleanIndex = getTypeIndex(Boolean, prop.type);
5821 const stringIndex = getTypeIndex(String, prop.type);
5822 prop[0 /* shouldCast */] = booleanIndex > -1;
5823 prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
5824 if (booleanIndex > -1 || hasOwn(prop, "default")) {
5825 needCastKeys.push(normalizedKey);
5826 }
5827 }
5828 }
5829 }
5830 }
5831 const res = [normalized, needCastKeys];
5832 if (isObject(comp)) {
5833 cache.set(comp, res);
5834 }
5835 return res;
5836}
5837function validatePropName(key) {
5838 if (key[0] !== "$" && !isReservedProp(key)) {
5839 return true;
5840 } else {
5841 warn$1(`Invalid prop name: "${key}" is a reserved property.`);
5842 }
5843 return false;
5844}
5845function getType(ctor) {
5846 if (ctor === null) {
5847 return "null";
5848 }
5849 if (typeof ctor === "function") {
5850 return ctor.name || "";
5851 } else if (typeof ctor === "object") {
5852 const name = ctor.constructor && ctor.constructor.name;
5853 return name || "";
5854 }
5855 return "";
5856}
5857function isSameType(a, b) {
5858 return getType(a) === getType(b);
5859}
5860function getTypeIndex(type, expectedTypes) {
5861 if (isArray(expectedTypes)) {
5862 return expectedTypes.findIndex((t) => isSameType(t, type));
5863 } else if (isFunction(expectedTypes)) {
5864 return isSameType(expectedTypes, type) ? 0 : -1;
5865 }
5866 return -1;
5867}
5868function validateProps(rawProps, props, instance) {
5869 const resolvedValues = toRaw(props);
5870 const options = instance.propsOptions[0];
5871 for (const key in options) {
5872 let opt = options[key];
5873 if (opt == null)
5874 continue;
5875 validateProp(
5876 key,
5877 resolvedValues[key],
5878 opt,
5879 shallowReadonly(resolvedValues) ,
5880 !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
5881 );
5882 }
5883}
5884function validateProp(name, value, prop, props, isAbsent) {
5885 const { type, required, validator, skipCheck } = prop;
5886 if (required && isAbsent) {
5887 warn$1('Missing required prop: "' + name + '"');
5888 return;
5889 }
5890 if (value == null && !required) {
5891 return;
5892 }
5893 if (type != null && type !== true && !skipCheck) {
5894 let isValid = false;
5895 const types = isArray(type) ? type : [type];
5896 const expectedTypes = [];
5897 for (let i = 0; i < types.length && !isValid; i++) {
5898 const { valid, expectedType } = assertType(value, types[i]);
5899 expectedTypes.push(expectedType || "");
5900 isValid = valid;
5901 }
5902 if (!isValid) {
5903 warn$1(getInvalidTypeMessage(name, value, expectedTypes));
5904 return;
5905 }
5906 }
5907 if (validator && !validator(value, props)) {
5908 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
5909 }
5910}
5911const isSimpleType = /* @__PURE__ */ makeMap(
5912 "String,Number,Boolean,Function,Symbol,BigInt"
5913);
5914function assertType(value, type) {
5915 let valid;
5916 const expectedType = getType(type);
5917 if (isSimpleType(expectedType)) {
5918 const t = typeof value;
5919 valid = t === expectedType.toLowerCase();
5920 if (!valid && t === "object") {
5921 valid = value instanceof type;
5922 }
5923 } else if (expectedType === "Object") {
5924 valid = isObject(value);
5925 } else if (expectedType === "Array") {
5926 valid = isArray(value);
5927 } else if (expectedType === "null") {
5928 valid = value === null;
5929 } else {
5930 valid = value instanceof type;
5931 }
5932 return {
5933 valid,
5934 expectedType
5935 };
5936}
5937function getInvalidTypeMessage(name, value, expectedTypes) {
5938 if (expectedTypes.length === 0) {
5939 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5940 }
5941 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5942 const expectedType = expectedTypes[0];
5943 const receivedType = toRawType(value);
5944 const expectedValue = styleValue(value, expectedType);
5945 const receivedValue = styleValue(value, receivedType);
5946 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5947 message += ` with value ${expectedValue}`;
5948 }
5949 message += `, got ${receivedType} `;
5950 if (isExplicable(receivedType)) {
5951 message += `with value ${receivedValue}.`;
5952 }
5953 return message;
5954}
5955function styleValue(value, type) {
5956 if (type === "String") {
5957 return `"${value}"`;
5958 } else if (type === "Number") {
5959 return `${Number(value)}`;
5960 } else {
5961 return `${value}`;
5962 }
5963}
5964function isExplicable(type) {
5965 const explicitTypes = ["string", "number", "boolean"];
5966 return explicitTypes.some((elem) => type.toLowerCase() === elem);
5967}
5968function isBoolean(...args) {
5969 return args.some((elem) => elem.toLowerCase() === "boolean");
5970}
5971
5972const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5973const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5974const normalizeSlot = (key, rawSlot, ctx) => {
5975 if (rawSlot._n) {
5976 return rawSlot;
5977 }
5978 const normalized = withCtx((...args) => {
5979 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
5980 warn$1(
5981 `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.`
5982 );
5983 }
5984 return normalizeSlotValue(rawSlot(...args));
5985 }, ctx);
5986 normalized._c = false;
5987 return normalized;
5988};
5989const normalizeObjectSlots = (rawSlots, slots, instance) => {
5990 const ctx = rawSlots._ctx;
5991 for (const key in rawSlots) {
5992 if (isInternalKey(key))
5993 continue;
5994 const value = rawSlots[key];
5995 if (isFunction(value)) {
5996 slots[key] = normalizeSlot(key, value, ctx);
5997 } else if (value != null) {
5998 {
5999 warn$1(
6000 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6001 );
6002 }
6003 const normalized = normalizeSlotValue(value);
6004 slots[key] = () => normalized;
6005 }
6006 }
6007};
6008const normalizeVNodeSlots = (instance, children) => {
6009 if (!isKeepAlive(instance.vnode) && true) {
6010 warn$1(
6011 `Non-function value encountered for default slot. Prefer function slots for better performance.`
6012 );
6013 }
6014 const normalized = normalizeSlotValue(children);
6015 instance.slots.default = () => normalized;
6016};
6017const initSlots = (instance, children) => {
6018 const slots = instance.slots = createInternalObject();
6019 if (instance.vnode.shapeFlag & 32) {
6020 const type = children._;
6021 if (type) {
6022 extend(slots, children);
6023 def(slots, "_", type);
6024 } else {
6025 normalizeObjectSlots(children, slots);
6026 }
6027 } else if (children) {
6028 normalizeVNodeSlots(instance, children);
6029 }
6030};
6031const updateSlots = (instance, children, optimized) => {
6032 const { vnode, slots } = instance;
6033 let needDeletionCheck = true;
6034 let deletionComparisonTarget = EMPTY_OBJ;
6035 if (vnode.shapeFlag & 32) {
6036 const type = children._;
6037 if (type) {
6038 if (isHmrUpdating) {
6039 extend(slots, children);
6040 trigger(instance, "set", "$slots");
6041 } else if (optimized && type === 1) {
6042 needDeletionCheck = false;
6043 } else {
6044 extend(slots, children);
6045 if (!optimized && type === 1) {
6046 delete slots._;
6047 }
6048 }
6049 } else {
6050 needDeletionCheck = !children.$stable;
6051 normalizeObjectSlots(children, slots);
6052 }
6053 deletionComparisonTarget = children;
6054 } else if (children) {
6055 normalizeVNodeSlots(instance, children);
6056 deletionComparisonTarget = { default: 1 };
6057 }
6058 if (needDeletionCheck) {
6059 for (const key in slots) {
6060 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
6061 delete slots[key];
6062 }
6063 }
6064 }
6065};
6066
6067function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6068 if (isArray(rawRef)) {
6069 rawRef.forEach(
6070 (r, i) => setRef(
6071 r,
6072 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
6073 parentSuspense,
6074 vnode,
6075 isUnmount
6076 )
6077 );
6078 return;
6079 }
6080 if (isAsyncWrapper(vnode) && !isUnmount) {
6081 return;
6082 }
6083 const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
6084 const value = isUnmount ? null : refValue;
6085 const { i: owner, r: ref } = rawRef;
6086 if (!owner) {
6087 warn$1(
6088 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
6089 );
6090 return;
6091 }
6092 const oldRef = oldRawRef && oldRawRef.r;
6093 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
6094 const setupState = owner.setupState;
6095 if (oldRef != null && oldRef !== ref) {
6096 if (isString(oldRef)) {
6097 refs[oldRef] = null;
6098 if (hasOwn(setupState, oldRef)) {
6099 setupState[oldRef] = null;
6100 }
6101 } else if (isRef(oldRef)) {
6102 oldRef.value = null;
6103 }
6104 }
6105 if (isFunction(ref)) {
6106 callWithErrorHandling(ref, owner, 12, [value, refs]);
6107 } else {
6108 const _isString = isString(ref);
6109 const _isRef = isRef(ref);
6110 if (_isString || _isRef) {
6111 const doSet = () => {
6112 if (rawRef.f) {
6113 const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
6114 if (isUnmount) {
6115 isArray(existing) && remove(existing, refValue);
6116 } else {
6117 if (!isArray(existing)) {
6118 if (_isString) {
6119 refs[ref] = [refValue];
6120 if (hasOwn(setupState, ref)) {
6121 setupState[ref] = refs[ref];
6122 }
6123 } else {
6124 ref.value = [refValue];
6125 if (rawRef.k)
6126 refs[rawRef.k] = ref.value;
6127 }
6128 } else if (!existing.includes(refValue)) {
6129 existing.push(refValue);
6130 }
6131 }
6132 } else if (_isString) {
6133 refs[ref] = value;
6134 if (hasOwn(setupState, ref)) {
6135 setupState[ref] = value;
6136 }
6137 } else if (_isRef) {
6138 ref.value = value;
6139 if (rawRef.k)
6140 refs[rawRef.k] = value;
6141 } else {
6142 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6143 }
6144 };
6145 if (value) {
6146 doSet.id = -1;
6147 queuePostRenderEffect(doSet, parentSuspense);
6148 } else {
6149 doSet();
6150 }
6151 } else {
6152 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6153 }
6154 }
6155}
6156
6157let hasMismatch = false;
6158const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
6159const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
6160const getContainerType = (container) => {
6161 if (isSVGContainer(container))
6162 return "svg";
6163 if (isMathMLContainer(container))
6164 return "mathml";
6165 return void 0;
6166};
6167const isComment = (node) => node.nodeType === 8 /* COMMENT */;
6168function createHydrationFunctions(rendererInternals) {
6169 const {
6170 mt: mountComponent,
6171 p: patch,
6172 o: {
6173 patchProp,
6174 createText,
6175 nextSibling,
6176 parentNode,
6177 remove,
6178 insert,
6179 createComment
6180 }
6181 } = rendererInternals;
6182 const hydrate = (vnode, container) => {
6183 if (!container.hasChildNodes()) {
6184 warn$1(
6185 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
6186 );
6187 patch(null, vnode, container);
6188 flushPostFlushCbs();
6189 container._vnode = vnode;
6190 return;
6191 }
6192 hasMismatch = false;
6193 hydrateNode(container.firstChild, vnode, null, null, null);
6194 flushPostFlushCbs();
6195 container._vnode = vnode;
6196 if (hasMismatch && true) {
6197 console.error(`Hydration completed but contains mismatches.`);
6198 }
6199 };
6200 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6201 optimized = optimized || !!vnode.dynamicChildren;
6202 const isFragmentStart = isComment(node) && node.data === "[";
6203 const onMismatch = () => handleMismatch(
6204 node,
6205 vnode,
6206 parentComponent,
6207 parentSuspense,
6208 slotScopeIds,
6209 isFragmentStart
6210 );
6211 const { type, ref, shapeFlag, patchFlag } = vnode;
6212 let domType = node.nodeType;
6213 vnode.el = node;
6214 {
6215 if (!("__vnode" in node)) {
6216 Object.defineProperty(node, "__vnode", {
6217 value: vnode,
6218 enumerable: false
6219 });
6220 }
6221 if (!("__vueParentComponent" in node)) {
6222 Object.defineProperty(node, "__vueParentComponent", {
6223 value: parentComponent,
6224 enumerable: false
6225 });
6226 }
6227 }
6228 if (patchFlag === -2) {
6229 optimized = false;
6230 vnode.dynamicChildren = null;
6231 }
6232 let nextNode = null;
6233 switch (type) {
6234 case Text:
6235 if (domType !== 3 /* TEXT */) {
6236 if (vnode.children === "") {
6237 insert(vnode.el = createText(""), parentNode(node), node);
6238 nextNode = node;
6239 } else {
6240 nextNode = onMismatch();
6241 }
6242 } else {
6243 if (node.data !== vnode.children) {
6244 hasMismatch = true;
6245 warn$1(
6246 `Hydration text mismatch in`,
6247 node.parentNode,
6248 `
6249 - rendered on server: ${JSON.stringify(
6250 node.data
6251 )}
6252 - expected on client: ${JSON.stringify(vnode.children)}`
6253 );
6254 node.data = vnode.children;
6255 }
6256 nextNode = nextSibling(node);
6257 }
6258 break;
6259 case Comment:
6260 if (isTemplateNode(node)) {
6261 nextNode = nextSibling(node);
6262 replaceNode(
6263 vnode.el = node.content.firstChild,
6264 node,
6265 parentComponent
6266 );
6267 } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6268 nextNode = onMismatch();
6269 } else {
6270 nextNode = nextSibling(node);
6271 }
6272 break;
6273 case Static:
6274 if (isFragmentStart) {
6275 node = nextSibling(node);
6276 domType = node.nodeType;
6277 }
6278 if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
6279 nextNode = node;
6280 const needToAdoptContent = !vnode.children.length;
6281 for (let i = 0; i < vnode.staticCount; i++) {
6282 if (needToAdoptContent)
6283 vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
6284 if (i === vnode.staticCount - 1) {
6285 vnode.anchor = nextNode;
6286 }
6287 nextNode = nextSibling(nextNode);
6288 }
6289 return isFragmentStart ? nextSibling(nextNode) : nextNode;
6290 } else {
6291 onMismatch();
6292 }
6293 break;
6294 case Fragment:
6295 if (!isFragmentStart) {
6296 nextNode = onMismatch();
6297 } else {
6298 nextNode = hydrateFragment(
6299 node,
6300 vnode,
6301 parentComponent,
6302 parentSuspense,
6303 slotScopeIds,
6304 optimized
6305 );
6306 }
6307 break;
6308 default:
6309 if (shapeFlag & 1) {
6310 if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6311 nextNode = onMismatch();
6312 } else {
6313 nextNode = hydrateElement(
6314 node,
6315 vnode,
6316 parentComponent,
6317 parentSuspense,
6318 slotScopeIds,
6319 optimized
6320 );
6321 }
6322 } else if (shapeFlag & 6) {
6323 vnode.slotScopeIds = slotScopeIds;
6324 const container = parentNode(node);
6325 if (isFragmentStart) {
6326 nextNode = locateClosingAnchor(node);
6327 } else if (isComment(node) && node.data === "teleport start") {
6328 nextNode = locateClosingAnchor(node, node.data, "teleport end");
6329 } else {
6330 nextNode = nextSibling(node);
6331 }
6332 mountComponent(
6333 vnode,
6334 container,
6335 null,
6336 parentComponent,
6337 parentSuspense,
6338 getContainerType(container),
6339 optimized
6340 );
6341 if (isAsyncWrapper(vnode)) {
6342 let subTree;
6343 if (isFragmentStart) {
6344 subTree = createVNode(Fragment);
6345 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
6346 } else {
6347 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
6348 }
6349 subTree.el = node;
6350 vnode.component.subTree = subTree;
6351 }
6352 } else if (shapeFlag & 64) {
6353 if (domType !== 8 /* COMMENT */) {
6354 nextNode = onMismatch();
6355 } else {
6356 nextNode = vnode.type.hydrate(
6357 node,
6358 vnode,
6359 parentComponent,
6360 parentSuspense,
6361 slotScopeIds,
6362 optimized,
6363 rendererInternals,
6364 hydrateChildren
6365 );
6366 }
6367 } else if (shapeFlag & 128) {
6368 nextNode = vnode.type.hydrate(
6369 node,
6370 vnode,
6371 parentComponent,
6372 parentSuspense,
6373 getContainerType(parentNode(node)),
6374 slotScopeIds,
6375 optimized,
6376 rendererInternals,
6377 hydrateNode
6378 );
6379 } else {
6380 warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
6381 }
6382 }
6383 if (ref != null) {
6384 setRef(ref, null, parentSuspense, vnode);
6385 }
6386 return nextNode;
6387 };
6388 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6389 optimized = optimized || !!vnode.dynamicChildren;
6390 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6391 const forcePatch = type === "input" || type === "option";
6392 {
6393 if (dirs) {
6394 invokeDirectiveHook(vnode, null, parentComponent, "created");
6395 }
6396 let needCallTransitionHooks = false;
6397 if (isTemplateNode(el)) {
6398 needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6399 const content = el.content.firstChild;
6400 if (needCallTransitionHooks) {
6401 transition.beforeEnter(content);
6402 }
6403 replaceNode(content, el, parentComponent);
6404 vnode.el = el = content;
6405 }
6406 if (shapeFlag & 16 && // skip if element has innerHTML / textContent
6407 !(props && (props.innerHTML || props.textContent))) {
6408 let next = hydrateChildren(
6409 el.firstChild,
6410 vnode,
6411 el,
6412 parentComponent,
6413 parentSuspense,
6414 slotScopeIds,
6415 optimized
6416 );
6417 let hasWarned = false;
6418 while (next) {
6419 hasMismatch = true;
6420 if (!hasWarned) {
6421 warn$1(
6422 `Hydration children mismatch on`,
6423 el,
6424 `
6425Server rendered element contains more child nodes than client vdom.`
6426 );
6427 hasWarned = true;
6428 }
6429 const cur = next;
6430 next = next.nextSibling;
6431 remove(cur);
6432 }
6433 } else if (shapeFlag & 8) {
6434 if (el.textContent !== vnode.children) {
6435 hasMismatch = true;
6436 warn$1(
6437 `Hydration text content mismatch on`,
6438 el,
6439 `
6440 - rendered on server: ${el.textContent}
6441 - expected on client: ${vnode.children}`
6442 );
6443 el.textContent = vnode.children;
6444 }
6445 }
6446 if (props) {
6447 {
6448 for (const key in props) {
6449 if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
6450 hasMismatch = true;
6451 }
6452 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6453 key[0] === ".") {
6454 patchProp(
6455 el,
6456 key,
6457 null,
6458 props[key],
6459 void 0,
6460 void 0,
6461 parentComponent
6462 );
6463 }
6464 }
6465 }
6466 }
6467 let vnodeHooks;
6468 if (vnodeHooks = props && props.onVnodeBeforeMount) {
6469 invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6470 }
6471 if (dirs) {
6472 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6473 }
6474 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6475 queueEffectWithSuspense(() => {
6476 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6477 needCallTransitionHooks && transition.enter(el);
6478 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6479 }, parentSuspense);
6480 }
6481 }
6482 return el.nextSibling;
6483 };
6484 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6485 optimized = optimized || !!parentVNode.dynamicChildren;
6486 const children = parentVNode.children;
6487 const l = children.length;
6488 let hasWarned = false;
6489 for (let i = 0; i < l; i++) {
6490 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
6491 if (node) {
6492 node = hydrateNode(
6493 node,
6494 vnode,
6495 parentComponent,
6496 parentSuspense,
6497 slotScopeIds,
6498 optimized
6499 );
6500 } else if (vnode.type === Text && !vnode.children) {
6501 continue;
6502 } else {
6503 hasMismatch = true;
6504 if (!hasWarned) {
6505 warn$1(
6506 `Hydration children mismatch on`,
6507 container,
6508 `
6509Server rendered element contains fewer child nodes than client vdom.`
6510 );
6511 hasWarned = true;
6512 }
6513 patch(
6514 null,
6515 vnode,
6516 container,
6517 null,
6518 parentComponent,
6519 parentSuspense,
6520 getContainerType(container),
6521 slotScopeIds
6522 );
6523 }
6524 }
6525 return node;
6526 };
6527 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6528 const { slotScopeIds: fragmentSlotScopeIds } = vnode;
6529 if (fragmentSlotScopeIds) {
6530 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
6531 }
6532 const container = parentNode(node);
6533 const next = hydrateChildren(
6534 nextSibling(node),
6535 vnode,
6536 container,
6537 parentComponent,
6538 parentSuspense,
6539 slotScopeIds,
6540 optimized
6541 );
6542 if (next && isComment(next) && next.data === "]") {
6543 return nextSibling(vnode.anchor = next);
6544 } else {
6545 hasMismatch = true;
6546 insert(vnode.anchor = createComment(`]`), container, next);
6547 return next;
6548 }
6549 };
6550 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
6551 hasMismatch = true;
6552 warn$1(
6553 `Hydration node mismatch:
6554- rendered on server:`,
6555 node,
6556 node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
6557 `
6558- expected on client:`,
6559 vnode.type
6560 );
6561 vnode.el = null;
6562 if (isFragment) {
6563 const end = locateClosingAnchor(node);
6564 while (true) {
6565 const next2 = nextSibling(node);
6566 if (next2 && next2 !== end) {
6567 remove(next2);
6568 } else {
6569 break;
6570 }
6571 }
6572 }
6573 const next = nextSibling(node);
6574 const container = parentNode(node);
6575 remove(node);
6576 patch(
6577 null,
6578 vnode,
6579 container,
6580 next,
6581 parentComponent,
6582 parentSuspense,
6583 getContainerType(container),
6584 slotScopeIds
6585 );
6586 return next;
6587 };
6588 const locateClosingAnchor = (node, open = "[", close = "]") => {
6589 let match = 0;
6590 while (node) {
6591 node = nextSibling(node);
6592 if (node && isComment(node)) {
6593 if (node.data === open)
6594 match++;
6595 if (node.data === close) {
6596 if (match === 0) {
6597 return nextSibling(node);
6598 } else {
6599 match--;
6600 }
6601 }
6602 }
6603 }
6604 return node;
6605 };
6606 const replaceNode = (newNode, oldNode, parentComponent) => {
6607 const parentNode2 = oldNode.parentNode;
6608 if (parentNode2) {
6609 parentNode2.replaceChild(newNode, oldNode);
6610 }
6611 let parent = parentComponent;
6612 while (parent) {
6613 if (parent.vnode.el === oldNode) {
6614 parent.vnode.el = parent.subTree.el = newNode;
6615 }
6616 parent = parent.parent;
6617 }
6618 };
6619 const isTemplateNode = (node) => {
6620 return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6621 };
6622 return [hydrate, hydrateNode];
6623}
6624function propHasMismatch(el, key, clientValue, vnode, instance) {
6625 var _a;
6626 let mismatchType;
6627 let mismatchKey;
6628 let actual;
6629 let expected;
6630 if (key === "class") {
6631 actual = el.getAttribute("class");
6632 expected = normalizeClass(clientValue);
6633 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6634 mismatchType = mismatchKey = `class`;
6635 }
6636 } else if (key === "style") {
6637 actual = el.getAttribute("style");
6638 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6639 const actualMap = toStyleMap(actual);
6640 const expectedMap = toStyleMap(expected);
6641 if (vnode.dirs) {
6642 for (const { dir, value } of vnode.dirs) {
6643 if (dir.name === "show" && !value) {
6644 expectedMap.set("display", "none");
6645 }
6646 }
6647 }
6648 const root = instance == null ? void 0 : instance.subTree;
6649 if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
6650 const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
6651 for (const key2 in cssVars) {
6652 expectedMap.set(`--${key2}`, String(cssVars[key2]));
6653 }
6654 }
6655 if (!isMapEqual(actualMap, expectedMap)) {
6656 mismatchType = mismatchKey = "style";
6657 }
6658 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6659 if (isBooleanAttr(key)) {
6660 actual = el.hasAttribute(key);
6661 expected = includeBooleanAttr(clientValue);
6662 } else if (clientValue == null) {
6663 actual = el.hasAttribute(key);
6664 expected = false;
6665 } else {
6666 if (el.hasAttribute(key)) {
6667 actual = el.getAttribute(key);
6668 } else if (key === "value" && el.tagName === "TEXTAREA") {
6669 actual = el.value;
6670 } else {
6671 actual = false;
6672 }
6673 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
6674 }
6675 if (actual !== expected) {
6676 mismatchType = `attribute`;
6677 mismatchKey = key;
6678 }
6679 }
6680 if (mismatchType) {
6681 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6682 const preSegment = `Hydration ${mismatchType} mismatch on`;
6683 const postSegment = `
6684 - rendered on server: ${format(actual)}
6685 - expected on client: ${format(expected)}
6686 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6687 You should fix the source of the mismatch.`;
6688 {
6689 warn$1(preSegment, el, postSegment);
6690 }
6691 return true;
6692 }
6693 return false;
6694}
6695function toClassSet(str) {
6696 return new Set(str.trim().split(/\s+/));
6697}
6698function isSetEqual(a, b) {
6699 if (a.size !== b.size) {
6700 return false;
6701 }
6702 for (const s of a) {
6703 if (!b.has(s)) {
6704 return false;
6705 }
6706 }
6707 return true;
6708}
6709function toStyleMap(str) {
6710 const styleMap = /* @__PURE__ */ new Map();
6711 for (const item of str.split(";")) {
6712 let [key, value] = item.split(":");
6713 key = key == null ? void 0 : key.trim();
6714 value = value == null ? void 0 : value.trim();
6715 if (key && value) {
6716 styleMap.set(key, value);
6717 }
6718 }
6719 return styleMap;
6720}
6721function isMapEqual(a, b) {
6722 if (a.size !== b.size) {
6723 return false;
6724 }
6725 for (const [key, value] of a) {
6726 if (value !== b.get(key)) {
6727 return false;
6728 }
6729 }
6730 return true;
6731}
6732
6733let supported;
6734let perf;
6735function 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}
6743function 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}
6760function 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
6773const queuePostRenderEffect = queueEffectWithSuspense ;
6774function createRenderer(options) {
6775 return baseCreateRenderer(options);
6776}
6777function createHydrationRenderer(options) {
6778 return baseCreateRenderer(options, createHydrationFunctions);
6779}
6780function 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(
7029 el,
7030 key,
7031 null,
7032 props[key],
7033 namespace,
7034 vnode.children,
7035 parentComponent,
7036 parentSuspense,
7037 unmountChildren
7038 );
7039 }
7040 }
7041 if ("value" in props) {
7042 hostPatchProp(el, "value", null, props.value, namespace);
7043 }
7044 if (vnodeHook = props.onVnodeBeforeMount) {
7045 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7046 }
7047 }
7048 {
7049 Object.defineProperty(el, "__vnode", {
7050 value: vnode,
7051 enumerable: false
7052 });
7053 Object.defineProperty(el, "__vueParentComponent", {
7054 value: parentComponent,
7055 enumerable: false
7056 });
7057 }
7058 if (dirs) {
7059 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7060 }
7061 const needCallTransitionHooks = needTransition(parentSuspense, transition);
7062 if (needCallTransitionHooks) {
7063 transition.beforeEnter(el);
7064 }
7065 hostInsert(el, container, anchor);
7066 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7067 queuePostRenderEffect(() => {
7068 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7069 needCallTransitionHooks && transition.enter(el);
7070 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7071 }, parentSuspense);
7072 }
7073 };
7074 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
7075 if (scopeId) {
7076 hostSetScopeId(el, scopeId);
7077 }
7078 if (slotScopeIds) {
7079 for (let i = 0; i < slotScopeIds.length; i++) {
7080 hostSetScopeId(el, slotScopeIds[i]);
7081 }
7082 }
7083 if (parentComponent) {
7084 let subTree = parentComponent.subTree;
7085 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7086 subTree = filterSingleRoot(subTree.children) || subTree;
7087 }
7088 if (vnode === subTree) {
7089 const parentVNode = parentComponent.vnode;
7090 setScopeId(
7091 el,
7092 parentVNode,
7093 parentVNode.scopeId,
7094 parentVNode.slotScopeIds,
7095 parentComponent.parent
7096 );
7097 }
7098 }
7099 };
7100 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
7101 for (let i = start; i < children.length; i++) {
7102 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
7103 patch(
7104 null,
7105 child,
7106 container,
7107 anchor,
7108 parentComponent,
7109 parentSuspense,
7110 namespace,
7111 slotScopeIds,
7112 optimized
7113 );
7114 }
7115 };
7116 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7117 const el = n2.el = n1.el;
7118 let { patchFlag, dynamicChildren, dirs } = n2;
7119 patchFlag |= n1.patchFlag & 16;
7120 const oldProps = n1.props || EMPTY_OBJ;
7121 const newProps = n2.props || EMPTY_OBJ;
7122 let vnodeHook;
7123 parentComponent && toggleRecurse(parentComponent, false);
7124 if (vnodeHook = newProps.onVnodeBeforeUpdate) {
7125 invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7126 }
7127 if (dirs) {
7128 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7129 }
7130 parentComponent && toggleRecurse(parentComponent, true);
7131 if (isHmrUpdating) {
7132 patchFlag = 0;
7133 optimized = false;
7134 dynamicChildren = null;
7135 }
7136 if (dynamicChildren) {
7137 patchBlockChildren(
7138 n1.dynamicChildren,
7139 dynamicChildren,
7140 el,
7141 parentComponent,
7142 parentSuspense,
7143 resolveChildrenNamespace(n2, namespace),
7144 slotScopeIds
7145 );
7146 {
7147 traverseStaticChildren(n1, n2);
7148 }
7149 } else if (!optimized) {
7150 patchChildren(
7151 n1,
7152 n2,
7153 el,
7154 null,
7155 parentComponent,
7156 parentSuspense,
7157 resolveChildrenNamespace(n2, namespace),
7158 slotScopeIds,
7159 false
7160 );
7161 }
7162 if (patchFlag > 0) {
7163 if (patchFlag & 16) {
7164 patchProps(
7165 el,
7166 n2,
7167 oldProps,
7168 newProps,
7169 parentComponent,
7170 parentSuspense,
7171 namespace
7172 );
7173 } else {
7174 if (patchFlag & 2) {
7175 if (oldProps.class !== newProps.class) {
7176 hostPatchProp(el, "class", null, newProps.class, namespace);
7177 }
7178 }
7179 if (patchFlag & 4) {
7180 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
7181 }
7182 if (patchFlag & 8) {
7183 const propsToUpdate = n2.dynamicProps;
7184 for (let i = 0; i < propsToUpdate.length; i++) {
7185 const key = propsToUpdate[i];
7186 const prev = oldProps[key];
7187 const next = newProps[key];
7188 if (next !== prev || key === "value") {
7189 hostPatchProp(
7190 el,
7191 key,
7192 prev,
7193 next,
7194 namespace,
7195 n1.children,
7196 parentComponent,
7197 parentSuspense,
7198 unmountChildren
7199 );
7200 }
7201 }
7202 }
7203 }
7204 if (patchFlag & 1) {
7205 if (n1.children !== n2.children) {
7206 hostSetElementText(el, n2.children);
7207 }
7208 }
7209 } else if (!optimized && dynamicChildren == null) {
7210 patchProps(
7211 el,
7212 n2,
7213 oldProps,
7214 newProps,
7215 parentComponent,
7216 parentSuspense,
7217 namespace
7218 );
7219 }
7220 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7221 queuePostRenderEffect(() => {
7222 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7223 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7224 }, parentSuspense);
7225 }
7226 };
7227 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
7228 for (let i = 0; i < newChildren.length; i++) {
7229 const oldVNode = oldChildren[i];
7230 const newVNode = newChildren[i];
7231 const container = (
7232 // oldVNode may be an errored async setup() component inside Suspense
7233 // which will not have a mounted element
7234 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
7235 // of the Fragment itself so it can move its children.
7236 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
7237 // which also requires the correct parent container
7238 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
7239 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
7240 // In other cases, the parent container is not actually used so we
7241 // just pass the block element here to avoid a DOM parentNode call.
7242 fallbackContainer
7243 )
7244 );
7245 patch(
7246 oldVNode,
7247 newVNode,
7248 container,
7249 null,
7250 parentComponent,
7251 parentSuspense,
7252 namespace,
7253 slotScopeIds,
7254 true
7255 );
7256 }
7257 };
7258 const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
7259 if (oldProps !== newProps) {
7260 if (oldProps !== EMPTY_OBJ) {
7261 for (const key in oldProps) {
7262 if (!isReservedProp(key) && !(key in newProps)) {
7263 hostPatchProp(
7264 el,
7265 key,
7266 oldProps[key],
7267 null,
7268 namespace,
7269 vnode.children,
7270 parentComponent,
7271 parentSuspense,
7272 unmountChildren
7273 );
7274 }
7275 }
7276 }
7277 for (const key in newProps) {
7278 if (isReservedProp(key))
7279 continue;
7280 const next = newProps[key];
7281 const prev = oldProps[key];
7282 if (next !== prev && key !== "value") {
7283 hostPatchProp(
7284 el,
7285 key,
7286 prev,
7287 next,
7288 namespace,
7289 vnode.children,
7290 parentComponent,
7291 parentSuspense,
7292 unmountChildren
7293 );
7294 }
7295 }
7296 if ("value" in newProps) {
7297 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
7298 }
7299 }
7300 };
7301 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7302 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
7303 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
7304 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
7305 if (
7306 // #5523 dev root fragment may inherit directives
7307 isHmrUpdating || patchFlag & 2048
7308 ) {
7309 patchFlag = 0;
7310 optimized = false;
7311 dynamicChildren = null;
7312 }
7313 if (fragmentSlotScopeIds) {
7314 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
7315 }
7316 if (n1 == null) {
7317 hostInsert(fragmentStartAnchor, container, anchor);
7318 hostInsert(fragmentEndAnchor, container, anchor);
7319 mountChildren(
7320 // #10007
7321 // such fragment like `<></>` will be compiled into
7322 // a fragment which doesn't have a children.
7323 // In this case fallback to an empty array
7324 n2.children || [],
7325 container,
7326 fragmentEndAnchor,
7327 parentComponent,
7328 parentSuspense,
7329 namespace,
7330 slotScopeIds,
7331 optimized
7332 );
7333 } else {
7334 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
7335 // of renderSlot() with no valid children
7336 n1.dynamicChildren) {
7337 patchBlockChildren(
7338 n1.dynamicChildren,
7339 dynamicChildren,
7340 container,
7341 parentComponent,
7342 parentSuspense,
7343 namespace,
7344 slotScopeIds
7345 );
7346 {
7347 traverseStaticChildren(n1, n2);
7348 }
7349 } else {
7350 patchChildren(
7351 n1,
7352 n2,
7353 container,
7354 fragmentEndAnchor,
7355 parentComponent,
7356 parentSuspense,
7357 namespace,
7358 slotScopeIds,
7359 optimized
7360 );
7361 }
7362 }
7363 };
7364 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7365 n2.slotScopeIds = slotScopeIds;
7366 if (n1 == null) {
7367 if (n2.shapeFlag & 512) {
7368 parentComponent.ctx.activate(
7369 n2,
7370 container,
7371 anchor,
7372 namespace,
7373 optimized
7374 );
7375 } else {
7376 mountComponent(
7377 n2,
7378 container,
7379 anchor,
7380 parentComponent,
7381 parentSuspense,
7382 namespace,
7383 optimized
7384 );
7385 }
7386 } else {
7387 updateComponent(n1, n2, optimized);
7388 }
7389 };
7390 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
7391 const instance = (initialVNode.component = createComponentInstance(
7392 initialVNode,
7393 parentComponent,
7394 parentSuspense
7395 ));
7396 if (instance.type.__hmrId) {
7397 registerHMR(instance);
7398 }
7399 {
7400 pushWarningContext(initialVNode);
7401 startMeasure(instance, `mount`);
7402 }
7403 if (isKeepAlive(initialVNode)) {
7404 instance.ctx.renderer = internals;
7405 }
7406 {
7407 {
7408 startMeasure(instance, `init`);
7409 }
7410 setupComponent(instance);
7411 {
7412 endMeasure(instance, `init`);
7413 }
7414 }
7415 if (instance.asyncDep) {
7416 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
7417 if (!initialVNode.el) {
7418 const placeholder = instance.subTree = createVNode(Comment);
7419 processCommentNode(null, placeholder, container, anchor);
7420 }
7421 } else {
7422 setupRenderEffect(
7423 instance,
7424 initialVNode,
7425 container,
7426 anchor,
7427 parentSuspense,
7428 namespace,
7429 optimized
7430 );
7431 }
7432 {
7433 popWarningContext();
7434 endMeasure(instance, `mount`);
7435 }
7436 };
7437 const updateComponent = (n1, n2, optimized) => {
7438 const instance = n2.component = n1.component;
7439 if (shouldUpdateComponent(n1, n2, optimized)) {
7440 if (instance.asyncDep && !instance.asyncResolved) {
7441 {
7442 pushWarningContext(n2);
7443 }
7444 updateComponentPreRender(instance, n2, optimized);
7445 {
7446 popWarningContext();
7447 }
7448 return;
7449 } else {
7450 instance.next = n2;
7451 invalidateJob(instance.update);
7452 instance.effect.dirty = true;
7453 instance.update();
7454 }
7455 } else {
7456 n2.el = n1.el;
7457 instance.vnode = n2;
7458 }
7459 };
7460 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7461 const componentUpdateFn = () => {
7462 if (!instance.isMounted) {
7463 let vnodeHook;
7464 const { el, props } = initialVNode;
7465 const { bm, m, parent } = instance;
7466 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
7467 toggleRecurse(instance, false);
7468 if (bm) {
7469 invokeArrayFns(bm);
7470 }
7471 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
7472 invokeVNodeHook(vnodeHook, parent, initialVNode);
7473 }
7474 toggleRecurse(instance, true);
7475 if (el && hydrateNode) {
7476 const hydrateSubTree = () => {
7477 {
7478 startMeasure(instance, `render`);
7479 }
7480 instance.subTree = renderComponentRoot(instance);
7481 {
7482 endMeasure(instance, `render`);
7483 }
7484 {
7485 startMeasure(instance, `hydrate`);
7486 }
7487 hydrateNode(
7488 el,
7489 instance.subTree,
7490 instance,
7491 parentSuspense,
7492 null
7493 );
7494 {
7495 endMeasure(instance, `hydrate`);
7496 }
7497 };
7498 if (isAsyncWrapperVNode) {
7499 initialVNode.type.__asyncLoader().then(
7500 // note: we are moving the render call into an async callback,
7501 // which means it won't track dependencies - but it's ok because
7502 // a server-rendered async wrapper is already in resolved state
7503 // and it will never need to change.
7504 () => !instance.isUnmounted && hydrateSubTree()
7505 );
7506 } else {
7507 hydrateSubTree();
7508 }
7509 } else {
7510 {
7511 startMeasure(instance, `render`);
7512 }
7513 const subTree = instance.subTree = renderComponentRoot(instance);
7514 {
7515 endMeasure(instance, `render`);
7516 }
7517 {
7518 startMeasure(instance, `patch`);
7519 }
7520 patch(
7521 null,
7522 subTree,
7523 container,
7524 anchor,
7525 instance,
7526 parentSuspense,
7527 namespace
7528 );
7529 {
7530 endMeasure(instance, `patch`);
7531 }
7532 initialVNode.el = subTree.el;
7533 }
7534 if (m) {
7535 queuePostRenderEffect(m, parentSuspense);
7536 }
7537 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7538 const scopedInitialVNode = initialVNode;
7539 queuePostRenderEffect(
7540 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7541 parentSuspense
7542 );
7543 }
7544 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7545 instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7546 }
7547 instance.isMounted = true;
7548 {
7549 devtoolsComponentAdded(instance);
7550 }
7551 initialVNode = container = anchor = null;
7552 } else {
7553 let { next, bu, u, parent, vnode } = instance;
7554 {
7555 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
7556 if (nonHydratedAsyncRoot) {
7557 if (next) {
7558 next.el = vnode.el;
7559 updateComponentPreRender(instance, next, optimized);
7560 }
7561 nonHydratedAsyncRoot.asyncDep.then(() => {
7562 if (!instance.isUnmounted) {
7563 componentUpdateFn();
7564 }
7565 });
7566 return;
7567 }
7568 }
7569 let originNext = next;
7570 let vnodeHook;
7571 {
7572 pushWarningContext(next || instance.vnode);
7573 }
7574 toggleRecurse(instance, false);
7575 if (next) {
7576 next.el = vnode.el;
7577 updateComponentPreRender(instance, next, optimized);
7578 } else {
7579 next = vnode;
7580 }
7581 if (bu) {
7582 invokeArrayFns(bu);
7583 }
7584 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
7585 invokeVNodeHook(vnodeHook, parent, next, vnode);
7586 }
7587 toggleRecurse(instance, true);
7588 {
7589 startMeasure(instance, `render`);
7590 }
7591 const nextTree = renderComponentRoot(instance);
7592 {
7593 endMeasure(instance, `render`);
7594 }
7595 const prevTree = instance.subTree;
7596 instance.subTree = nextTree;
7597 {
7598 startMeasure(instance, `patch`);
7599 }
7600 patch(
7601 prevTree,
7602 nextTree,
7603 // parent may have changed if it's in a teleport
7604 hostParentNode(prevTree.el),
7605 // anchor may have changed if it's in a fragment
7606 getNextHostNode(prevTree),
7607 instance,
7608 parentSuspense,
7609 namespace
7610 );
7611 {
7612 endMeasure(instance, `patch`);
7613 }
7614 next.el = nextTree.el;
7615 if (originNext === null) {
7616 updateHOCHostEl(instance, nextTree.el);
7617 }
7618 if (u) {
7619 queuePostRenderEffect(u, parentSuspense);
7620 }
7621 if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7622 queuePostRenderEffect(
7623 () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7624 parentSuspense
7625 );
7626 }
7627 {
7628 devtoolsComponentUpdated(instance);
7629 }
7630 {
7631 popWarningContext();
7632 }
7633 }
7634 };
7635 const effect = instance.effect = new ReactiveEffect(
7636 componentUpdateFn,
7637 NOOP,
7638 () => queueJob(update),
7639 instance.scope
7640 // track it in component's effect scope
7641 );
7642 const update = instance.update = () => {
7643 if (effect.dirty) {
7644 effect.run();
7645 }
7646 };
7647 update.id = instance.uid;
7648 toggleRecurse(instance, true);
7649 {
7650 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7651 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7652 update.ownerInstance = instance;
7653 }
7654 update();
7655 };
7656 const updateComponentPreRender = (instance, nextVNode, optimized) => {
7657 nextVNode.component = instance;
7658 const prevProps = instance.vnode.props;
7659 instance.vnode = nextVNode;
7660 instance.next = null;
7661 updateProps(instance, nextVNode.props, prevProps, optimized);
7662 updateSlots(instance, nextVNode.children, optimized);
7663 pauseTracking();
7664 flushPreFlushCbs(instance);
7665 resetTracking();
7666 };
7667 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7668 const c1 = n1 && n1.children;
7669 const prevShapeFlag = n1 ? n1.shapeFlag : 0;
7670 const c2 = n2.children;
7671 const { patchFlag, shapeFlag } = n2;
7672 if (patchFlag > 0) {
7673 if (patchFlag & 128) {
7674 patchKeyedChildren(
7675 c1,
7676 c2,
7677 container,
7678 anchor,
7679 parentComponent,
7680 parentSuspense,
7681 namespace,
7682 slotScopeIds,
7683 optimized
7684 );
7685 return;
7686 } else if (patchFlag & 256) {
7687 patchUnkeyedChildren(
7688 c1,
7689 c2,
7690 container,
7691 anchor,
7692 parentComponent,
7693 parentSuspense,
7694 namespace,
7695 slotScopeIds,
7696 optimized
7697 );
7698 return;
7699 }
7700 }
7701 if (shapeFlag & 8) {
7702 if (prevShapeFlag & 16) {
7703 unmountChildren(c1, parentComponent, parentSuspense);
7704 }
7705 if (c2 !== c1) {
7706 hostSetElementText(container, c2);
7707 }
7708 } else {
7709 if (prevShapeFlag & 16) {
7710 if (shapeFlag & 16) {
7711 patchKeyedChildren(
7712 c1,
7713 c2,
7714 container,
7715 anchor,
7716 parentComponent,
7717 parentSuspense,
7718 namespace,
7719 slotScopeIds,
7720 optimized
7721 );
7722 } else {
7723 unmountChildren(c1, parentComponent, parentSuspense, true);
7724 }
7725 } else {
7726 if (prevShapeFlag & 8) {
7727 hostSetElementText(container, "");
7728 }
7729 if (shapeFlag & 16) {
7730 mountChildren(
7731 c2,
7732 container,
7733 anchor,
7734 parentComponent,
7735 parentSuspense,
7736 namespace,
7737 slotScopeIds,
7738 optimized
7739 );
7740 }
7741 }
7742 }
7743 };
7744 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7745 c1 = c1 || EMPTY_ARR;
7746 c2 = c2 || EMPTY_ARR;
7747 const oldLength = c1.length;
7748 const newLength = c2.length;
7749 const commonLength = Math.min(oldLength, newLength);
7750 let i;
7751 for (i = 0; i < commonLength; i++) {
7752 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7753 patch(
7754 c1[i],
7755 nextChild,
7756 container,
7757 null,
7758 parentComponent,
7759 parentSuspense,
7760 namespace,
7761 slotScopeIds,
7762 optimized
7763 );
7764 }
7765 if (oldLength > newLength) {
7766 unmountChildren(
7767 c1,
7768 parentComponent,
7769 parentSuspense,
7770 true,
7771 false,
7772 commonLength
7773 );
7774 } else {
7775 mountChildren(
7776 c2,
7777 container,
7778 anchor,
7779 parentComponent,
7780 parentSuspense,
7781 namespace,
7782 slotScopeIds,
7783 optimized,
7784 commonLength
7785 );
7786 }
7787 };
7788 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7789 let i = 0;
7790 const l2 = c2.length;
7791 let e1 = c1.length - 1;
7792 let e2 = l2 - 1;
7793 while (i <= e1 && i <= e2) {
7794 const n1 = c1[i];
7795 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7796 if (isSameVNodeType(n1, n2)) {
7797 patch(
7798 n1,
7799 n2,
7800 container,
7801 null,
7802 parentComponent,
7803 parentSuspense,
7804 namespace,
7805 slotScopeIds,
7806 optimized
7807 );
7808 } else {
7809 break;
7810 }
7811 i++;
7812 }
7813 while (i <= e1 && i <= e2) {
7814 const n1 = c1[e1];
7815 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
7816 if (isSameVNodeType(n1, n2)) {
7817 patch(
7818 n1,
7819 n2,
7820 container,
7821 null,
7822 parentComponent,
7823 parentSuspense,
7824 namespace,
7825 slotScopeIds,
7826 optimized
7827 );
7828 } else {
7829 break;
7830 }
7831 e1--;
7832 e2--;
7833 }
7834 if (i > e1) {
7835 if (i <= e2) {
7836 const nextPos = e2 + 1;
7837 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
7838 while (i <= e2) {
7839 patch(
7840 null,
7841 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
7842 container,
7843 anchor,
7844 parentComponent,
7845 parentSuspense,
7846 namespace,
7847 slotScopeIds,
7848 optimized
7849 );
7850 i++;
7851 }
7852 }
7853 } else if (i > e2) {
7854 while (i <= e1) {
7855 unmount(c1[i], parentComponent, parentSuspense, true);
7856 i++;
7857 }
7858 } else {
7859 const s1 = i;
7860 const s2 = i;
7861 const keyToNewIndexMap = /* @__PURE__ */ new Map();
7862 for (i = s2; i <= e2; i++) {
7863 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7864 if (nextChild.key != null) {
7865 if (keyToNewIndexMap.has(nextChild.key)) {
7866 warn$1(
7867 `Duplicate keys found during update:`,
7868 JSON.stringify(nextChild.key),
7869 `Make sure keys are unique.`
7870 );
7871 }
7872 keyToNewIndexMap.set(nextChild.key, i);
7873 }
7874 }
7875 let j;
7876 let patched = 0;
7877 const toBePatched = e2 - s2 + 1;
7878 let moved = false;
7879 let maxNewIndexSoFar = 0;
7880 const newIndexToOldIndexMap = new Array(toBePatched);
7881 for (i = 0; i < toBePatched; i++)
7882 newIndexToOldIndexMap[i] = 0;
7883 for (i = s1; i <= e1; i++) {
7884 const prevChild = c1[i];
7885 if (patched >= toBePatched) {
7886 unmount(prevChild, parentComponent, parentSuspense, true);
7887 continue;
7888 }
7889 let newIndex;
7890 if (prevChild.key != null) {
7891 newIndex = keyToNewIndexMap.get(prevChild.key);
7892 } else {
7893 for (j = s2; j <= e2; j++) {
7894 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
7895 newIndex = j;
7896 break;
7897 }
7898 }
7899 }
7900 if (newIndex === void 0) {
7901 unmount(prevChild, parentComponent, parentSuspense, true);
7902 } else {
7903 newIndexToOldIndexMap[newIndex - s2] = i + 1;
7904 if (newIndex >= maxNewIndexSoFar) {
7905 maxNewIndexSoFar = newIndex;
7906 } else {
7907 moved = true;
7908 }
7909 patch(
7910 prevChild,
7911 c2[newIndex],
7912 container,
7913 null,
7914 parentComponent,
7915 parentSuspense,
7916 namespace,
7917 slotScopeIds,
7918 optimized
7919 );
7920 patched++;
7921 }
7922 }
7923 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
7924 j = increasingNewIndexSequence.length - 1;
7925 for (i = toBePatched - 1; i >= 0; i--) {
7926 const nextIndex = s2 + i;
7927 const nextChild = c2[nextIndex];
7928 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7929 if (newIndexToOldIndexMap[i] === 0) {
7930 patch(
7931 null,
7932 nextChild,
7933 container,
7934 anchor,
7935 parentComponent,
7936 parentSuspense,
7937 namespace,
7938 slotScopeIds,
7939 optimized
7940 );
7941 } else if (moved) {
7942 if (j < 0 || i !== increasingNewIndexSequence[j]) {
7943 move(nextChild, container, anchor, 2);
7944 } else {
7945 j--;
7946 }
7947 }
7948 }
7949 }
7950 };
7951 const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
7952 const { el, type, transition, children, shapeFlag } = vnode;
7953 if (shapeFlag & 6) {
7954 move(vnode.component.subTree, container, anchor, moveType);
7955 return;
7956 }
7957 if (shapeFlag & 128) {
7958 vnode.suspense.move(container, anchor, moveType);
7959 return;
7960 }
7961 if (shapeFlag & 64) {
7962 type.move(vnode, container, anchor, internals);
7963 return;
7964 }
7965 if (type === Fragment) {
7966 hostInsert(el, container, anchor);
7967 for (let i = 0; i < children.length; i++) {
7968 move(children[i], container, anchor, moveType);
7969 }
7970 hostInsert(vnode.anchor, container, anchor);
7971 return;
7972 }
7973 if (type === Static) {
7974 moveStaticNode(vnode, container, anchor);
7975 return;
7976 }
7977 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7978 if (needTransition2) {
7979 if (moveType === 0) {
7980 transition.beforeEnter(el);
7981 hostInsert(el, container, anchor);
7982 queuePostRenderEffect(() => transition.enter(el), parentSuspense);
7983 } else {
7984 const { leave, delayLeave, afterLeave } = transition;
7985 const remove2 = () => hostInsert(el, container, anchor);
7986 const performLeave = () => {
7987 leave(el, () => {
7988 remove2();
7989 afterLeave && afterLeave();
7990 });
7991 };
7992 if (delayLeave) {
7993 delayLeave(el, remove2, performLeave);
7994 } else {
7995 performLeave();
7996 }
7997 }
7998 } else {
7999 hostInsert(el, container, anchor);
8000 }
8001 };
8002 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
8003 const {
8004 type,
8005 props,
8006 ref,
8007 children,
8008 dynamicChildren,
8009 shapeFlag,
8010 patchFlag,
8011 dirs
8012 } = vnode;
8013 if (ref != null) {
8014 setRef(ref, null, parentSuspense, vnode, true);
8015 }
8016 if (shapeFlag & 256) {
8017 parentComponent.ctx.deactivate(vnode);
8018 return;
8019 }
8020 const shouldInvokeDirs = shapeFlag & 1 && dirs;
8021 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
8022 let vnodeHook;
8023 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
8024 invokeVNodeHook(vnodeHook, parentComponent, vnode);
8025 }
8026 if (shapeFlag & 6) {
8027 unmountComponent(vnode.component, parentSuspense, doRemove);
8028 } else {
8029 if (shapeFlag & 128) {
8030 vnode.suspense.unmount(parentSuspense, doRemove);
8031 return;
8032 }
8033 if (shouldInvokeDirs) {
8034 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
8035 }
8036 if (shapeFlag & 64) {
8037 vnode.type.remove(
8038 vnode,
8039 parentComponent,
8040 parentSuspense,
8041 optimized,
8042 internals,
8043 doRemove
8044 );
8045 } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
8046 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
8047 unmountChildren(
8048 dynamicChildren,
8049 parentComponent,
8050 parentSuspense,
8051 false,
8052 true
8053 );
8054 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
8055 unmountChildren(children, parentComponent, parentSuspense);
8056 }
8057 if (doRemove) {
8058 remove(vnode);
8059 }
8060 }
8061 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
8062 queuePostRenderEffect(() => {
8063 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8064 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8065 }, parentSuspense);
8066 }
8067 };
8068 const remove = (vnode) => {
8069 const { type, el, anchor, transition } = vnode;
8070 if (type === Fragment) {
8071 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
8072 vnode.children.forEach((child) => {
8073 if (child.type === Comment) {
8074 hostRemove(child.el);
8075 } else {
8076 remove(child);
8077 }
8078 });
8079 } else {
8080 removeFragment(el, anchor);
8081 }
8082 return;
8083 }
8084 if (type === Static) {
8085 removeStaticNode(vnode);
8086 return;
8087 }
8088 const performRemove = () => {
8089 hostRemove(el);
8090 if (transition && !transition.persisted && transition.afterLeave) {
8091 transition.afterLeave();
8092 }
8093 };
8094 if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8095 const { leave, delayLeave } = transition;
8096 const performLeave = () => leave(el, performRemove);
8097 if (delayLeave) {
8098 delayLeave(vnode.el, performRemove, performLeave);
8099 } else {
8100 performLeave();
8101 }
8102 } else {
8103 performRemove();
8104 }
8105 };
8106 const removeFragment = (cur, end) => {
8107 let next;
8108 while (cur !== end) {
8109 next = hostNextSibling(cur);
8110 hostRemove(cur);
8111 cur = next;
8112 }
8113 hostRemove(end);
8114 };
8115 const unmountComponent = (instance, parentSuspense, doRemove) => {
8116 if (instance.type.__hmrId) {
8117 unregisterHMR(instance);
8118 }
8119 const { bum, scope, update, subTree, um } = instance;
8120 if (bum) {
8121 invokeArrayFns(bum);
8122 }
8123 scope.stop();
8124 if (update) {
8125 update.active = false;
8126 unmount(subTree, instance, parentSuspense, doRemove);
8127 }
8128 if (um) {
8129 queuePostRenderEffect(um, parentSuspense);
8130 }
8131 queuePostRenderEffect(() => {
8132 instance.isUnmounted = true;
8133 }, parentSuspense);
8134 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8135 parentSuspense.deps--;
8136 if (parentSuspense.deps === 0) {
8137 parentSuspense.resolve();
8138 }
8139 }
8140 {
8141 devtoolsComponentRemoved(instance);
8142 }
8143 };
8144 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8145 for (let i = start; i < children.length; i++) {
8146 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
8147 }
8148 };
8149 const getNextHostNode = (vnode) => {
8150 if (vnode.shapeFlag & 6) {
8151 return getNextHostNode(vnode.component.subTree);
8152 }
8153 if (vnode.shapeFlag & 128) {
8154 return vnode.suspense.next();
8155 }
8156 return hostNextSibling(vnode.anchor || vnode.el);
8157 };
8158 let isFlushing = false;
8159 const render = (vnode, container, namespace) => {
8160 if (vnode == null) {
8161 if (container._vnode) {
8162 unmount(container._vnode, null, null, true);
8163 }
8164 } else {
8165 patch(
8166 container._vnode || null,
8167 vnode,
8168 container,
8169 null,
8170 null,
8171 null,
8172 namespace
8173 );
8174 }
8175 if (!isFlushing) {
8176 isFlushing = true;
8177 flushPreFlushCbs();
8178 flushPostFlushCbs();
8179 isFlushing = false;
8180 }
8181 container._vnode = vnode;
8182 };
8183 const internals = {
8184 p: patch,
8185 um: unmount,
8186 m: move,
8187 r: remove,
8188 mt: mountComponent,
8189 mc: mountChildren,
8190 pc: patchChildren,
8191 pbc: patchBlockChildren,
8192 n: getNextHostNode,
8193 o: options
8194 };
8195 let hydrate;
8196 let hydrateNode;
8197 if (createHydrationFns) {
8198 [hydrate, hydrateNode] = createHydrationFns(
8199 internals
8200 );
8201 }
8202 return {
8203 render,
8204 hydrate,
8205 createApp: createAppAPI(render, hydrate)
8206 };
8207}
8208function resolveChildrenNamespace({ type, props }, currentNamespace) {
8209 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8210}
8211function toggleRecurse({ effect, update }, allowed) {
8212 effect.allowRecurse = update.allowRecurse = allowed;
8213}
8214function needTransition(parentSuspense, transition) {
8215 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8216}
8217function traverseStaticChildren(n1, n2, shallow = false) {
8218 const ch1 = n1.children;
8219 const ch2 = n2.children;
8220 if (isArray(ch1) && isArray(ch2)) {
8221 for (let i = 0; i < ch1.length; i++) {
8222 const c1 = ch1[i];
8223 let c2 = ch2[i];
8224 if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
8225 if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
8226 c2 = ch2[i] = cloneIfMounted(ch2[i]);
8227 c2.el = c1.el;
8228 }
8229 if (!shallow)
8230 traverseStaticChildren(c1, c2);
8231 }
8232 if (c2.type === Text) {
8233 c2.el = c1.el;
8234 }
8235 if (c2.type === Comment && !c2.el) {
8236 c2.el = c1.el;
8237 }
8238 }
8239 }
8240}
8241function getSequence(arr) {
8242 const p = arr.slice();
8243 const result = [0];
8244 let i, j, u, v, c;
8245 const len = arr.length;
8246 for (i = 0; i < len; i++) {
8247 const arrI = arr[i];
8248 if (arrI !== 0) {
8249 j = result[result.length - 1];
8250 if (arr[j] < arrI) {
8251 p[i] = j;
8252 result.push(i);
8253 continue;
8254 }
8255 u = 0;
8256 v = result.length - 1;
8257 while (u < v) {
8258 c = u + v >> 1;
8259 if (arr[result[c]] < arrI) {
8260 u = c + 1;
8261 } else {
8262 v = c;
8263 }
8264 }
8265 if (arrI < arr[result[u]]) {
8266 if (u > 0) {
8267 p[i] = result[u - 1];
8268 }
8269 result[u] = i;
8270 }
8271 }
8272 }
8273 u = result.length;
8274 v = result[u - 1];
8275 while (u-- > 0) {
8276 result[u] = v;
8277 v = p[v];
8278 }
8279 return result;
8280}
8281function locateNonHydratedAsyncRoot(instance) {
8282 const subComponent = instance.subTree.component;
8283 if (subComponent) {
8284 if (subComponent.asyncDep && !subComponent.asyncResolved) {
8285 return subComponent;
8286 } else {
8287 return locateNonHydratedAsyncRoot(subComponent);
8288 }
8289 }
8290}
8291
8292const isTeleport = (type) => type.__isTeleport;
8293const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
8294const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
8295const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
8296const resolveTarget = (props, select) => {
8297 const targetSelector = props && props.to;
8298 if (isString(targetSelector)) {
8299 if (!select) {
8300 warn$1(
8301 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
8302 );
8303 return null;
8304 } else {
8305 const target = select(targetSelector);
8306 if (!target) {
8307 warn$1(
8308 `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.`
8309 );
8310 }
8311 return target;
8312 }
8313 } else {
8314 if (!targetSelector && !isTeleportDisabled(props)) {
8315 warn$1(`Invalid Teleport target: ${targetSelector}`);
8316 }
8317 return targetSelector;
8318 }
8319};
8320const TeleportImpl = {
8321 name: "Teleport",
8322 __isTeleport: true,
8323 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
8324 const {
8325 mc: mountChildren,
8326 pc: patchChildren,
8327 pbc: patchBlockChildren,
8328 o: { insert, querySelector, createText, createComment }
8329 } = internals;
8330 const disabled = isTeleportDisabled(n2.props);
8331 let { shapeFlag, children, dynamicChildren } = n2;
8332 if (isHmrUpdating) {
8333 optimized = false;
8334 dynamicChildren = null;
8335 }
8336 if (n1 == null) {
8337 const placeholder = n2.el = createComment("teleport start") ;
8338 const mainAnchor = n2.anchor = createComment("teleport end") ;
8339 insert(placeholder, container, anchor);
8340 insert(mainAnchor, container, anchor);
8341 const target = n2.target = resolveTarget(n2.props, querySelector);
8342 const targetAnchor = n2.targetAnchor = createText("");
8343 if (target) {
8344 insert(targetAnchor, target);
8345 if (namespace === "svg" || isTargetSVG(target)) {
8346 namespace = "svg";
8347 } else if (namespace === "mathml" || isTargetMathML(target)) {
8348 namespace = "mathml";
8349 }
8350 } else if (!disabled) {
8351 warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
8352 }
8353 const mount = (container2, anchor2) => {
8354 if (shapeFlag & 16) {
8355 mountChildren(
8356 children,
8357 container2,
8358 anchor2,
8359 parentComponent,
8360 parentSuspense,
8361 namespace,
8362 slotScopeIds,
8363 optimized
8364 );
8365 }
8366 };
8367 if (disabled) {
8368 mount(container, mainAnchor);
8369 } else if (target) {
8370 mount(target, targetAnchor);
8371 }
8372 } else {
8373 n2.el = n1.el;
8374 const mainAnchor = n2.anchor = n1.anchor;
8375 const target = n2.target = n1.target;
8376 const targetAnchor = n2.targetAnchor = n1.targetAnchor;
8377 const wasDisabled = isTeleportDisabled(n1.props);
8378 const currentContainer = wasDisabled ? container : target;
8379 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
8380 if (namespace === "svg" || isTargetSVG(target)) {
8381 namespace = "svg";
8382 } else if (namespace === "mathml" || isTargetMathML(target)) {
8383 namespace = "mathml";
8384 }
8385 if (dynamicChildren) {
8386 patchBlockChildren(
8387 n1.dynamicChildren,
8388 dynamicChildren,
8389 currentContainer,
8390 parentComponent,
8391 parentSuspense,
8392 namespace,
8393 slotScopeIds
8394 );
8395 traverseStaticChildren(n1, n2, true);
8396 } else if (!optimized) {
8397 patchChildren(
8398 n1,
8399 n2,
8400 currentContainer,
8401 currentAnchor,
8402 parentComponent,
8403 parentSuspense,
8404 namespace,
8405 slotScopeIds,
8406 false
8407 );
8408 }
8409 if (disabled) {
8410 if (!wasDisabled) {
8411 moveTeleport(
8412 n2,
8413 container,
8414 mainAnchor,
8415 internals,
8416 1
8417 );
8418 } else {
8419 if (n2.props && n1.props && n2.props.to !== n1.props.to) {
8420 n2.props.to = n1.props.to;
8421 }
8422 }
8423 } else {
8424 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
8425 const nextTarget = n2.target = resolveTarget(
8426 n2.props,
8427 querySelector
8428 );
8429 if (nextTarget) {
8430 moveTeleport(
8431 n2,
8432 nextTarget,
8433 null,
8434 internals,
8435 0
8436 );
8437 } else {
8438 warn$1(
8439 "Invalid Teleport target on update:",
8440 target,
8441 `(${typeof target})`
8442 );
8443 }
8444 } else if (wasDisabled) {
8445 moveTeleport(
8446 n2,
8447 target,
8448 targetAnchor,
8449 internals,
8450 1
8451 );
8452 }
8453 }
8454 }
8455 updateCssVars(n2);
8456 },
8457 remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8458 const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8459 if (target) {
8460 hostRemove(targetAnchor);
8461 }
8462 doRemove && hostRemove(anchor);
8463 if (shapeFlag & 16) {
8464 const shouldRemove = doRemove || !isTeleportDisabled(props);
8465 for (let i = 0; i < children.length; i++) {
8466 const child = children[i];
8467 unmount(
8468 child,
8469 parentComponent,
8470 parentSuspense,
8471 shouldRemove,
8472 !!child.dynamicChildren
8473 );
8474 }
8475 }
8476 },
8477 move: moveTeleport,
8478 hydrate: hydrateTeleport
8479};
8480function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
8481 if (moveType === 0) {
8482 insert(vnode.targetAnchor, container, parentAnchor);
8483 }
8484 const { el, anchor, shapeFlag, children, props } = vnode;
8485 const isReorder = moveType === 2;
8486 if (isReorder) {
8487 insert(el, container, parentAnchor);
8488 }
8489 if (!isReorder || isTeleportDisabled(props)) {
8490 if (shapeFlag & 16) {
8491 for (let i = 0; i < children.length; i++) {
8492 move(
8493 children[i],
8494 container,
8495 parentAnchor,
8496 2
8497 );
8498 }
8499 }
8500 }
8501 if (isReorder) {
8502 insert(anchor, container, parentAnchor);
8503 }
8504}
8505function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
8506 o: { nextSibling, parentNode, querySelector }
8507}, hydrateChildren) {
8508 const target = vnode.target = resolveTarget(
8509 vnode.props,
8510 querySelector
8511 );
8512 if (target) {
8513 const targetNode = target._lpa || target.firstChild;
8514 if (vnode.shapeFlag & 16) {
8515 if (isTeleportDisabled(vnode.props)) {
8516 vnode.anchor = hydrateChildren(
8517 nextSibling(node),
8518 vnode,
8519 parentNode(node),
8520 parentComponent,
8521 parentSuspense,
8522 slotScopeIds,
8523 optimized
8524 );
8525 vnode.targetAnchor = targetNode;
8526 } else {
8527 vnode.anchor = nextSibling(node);
8528 let targetAnchor = targetNode;
8529 while (targetAnchor) {
8530 targetAnchor = nextSibling(targetAnchor);
8531 if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
8532 vnode.targetAnchor = targetAnchor;
8533 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
8534 break;
8535 }
8536 }
8537 hydrateChildren(
8538 targetNode,
8539 vnode,
8540 target,
8541 parentComponent,
8542 parentSuspense,
8543 slotScopeIds,
8544 optimized
8545 );
8546 }
8547 }
8548 updateCssVars(vnode);
8549 }
8550 return vnode.anchor && nextSibling(vnode.anchor);
8551}
8552const Teleport = TeleportImpl;
8553function updateCssVars(vnode) {
8554 const ctx = vnode.ctx;
8555 if (ctx && ctx.ut) {
8556 let node = vnode.children[0].el;
8557 while (node && node !== vnode.targetAnchor) {
8558 if (node.nodeType === 1)
8559 node.setAttribute("data-v-owner", ctx.uid);
8560 node = node.nextSibling;
8561 }
8562 ctx.ut();
8563 }
8564}
8565
8566const Fragment = Symbol.for("v-fgt");
8567const Text = Symbol.for("v-txt");
8568const Comment = Symbol.for("v-cmt");
8569const Static = Symbol.for("v-stc");
8570const blockStack = [];
8571let currentBlock = null;
8572function openBlock(disableTracking = false) {
8573 blockStack.push(currentBlock = disableTracking ? null : []);
8574}
8575function closeBlock() {
8576 blockStack.pop();
8577 currentBlock = blockStack[blockStack.length - 1] || null;
8578}
8579let isBlockTreeEnabled = 1;
8580function setBlockTracking(value) {
8581 isBlockTreeEnabled += value;
8582}
8583function setupBlock(vnode) {
8584 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
8585 closeBlock();
8586 if (isBlockTreeEnabled > 0 && currentBlock) {
8587 currentBlock.push(vnode);
8588 }
8589 return vnode;
8590}
8591function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
8592 return setupBlock(
8593 createBaseVNode(
8594 type,
8595 props,
8596 children,
8597 patchFlag,
8598 dynamicProps,
8599 shapeFlag,
8600 true
8601 )
8602 );
8603}
8604function createBlock(type, props, children, patchFlag, dynamicProps) {
8605 return setupBlock(
8606 createVNode(
8607 type,
8608 props,
8609 children,
8610 patchFlag,
8611 dynamicProps,
8612 true
8613 )
8614 );
8615}
8616function isVNode(value) {
8617 return value ? value.__v_isVNode === true : false;
8618}
8619function isSameVNodeType(n1, n2) {
8620 if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
8621 n1.shapeFlag &= ~256;
8622 n2.shapeFlag &= ~512;
8623 return false;
8624 }
8625 return n1.type === n2.type && n1.key === n2.key;
8626}
8627let vnodeArgsTransformer;
8628function transformVNodeArgs(transformer) {
8629 vnodeArgsTransformer = transformer;
8630}
8631const createVNodeWithArgsTransform = (...args) => {
8632 return _createVNode(
8633 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8634 );
8635};
8636const normalizeKey = ({ key }) => key != null ? key : null;
8637const normalizeRef = ({
8638 ref,
8639 ref_key,
8640 ref_for
8641}) => {
8642 if (typeof ref === "number") {
8643 ref = "" + ref;
8644 }
8645 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
8646};
8647function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
8648 const vnode = {
8649 __v_isVNode: true,
8650 __v_skip: true,
8651 type,
8652 props,
8653 key: props && normalizeKey(props),
8654 ref: props && normalizeRef(props),
8655 scopeId: currentScopeId,
8656 slotScopeIds: null,
8657 children,
8658 component: null,
8659 suspense: null,
8660 ssContent: null,
8661 ssFallback: null,
8662 dirs: null,
8663 transition: null,
8664 el: null,
8665 anchor: null,
8666 target: null,
8667 targetAnchor: null,
8668 staticCount: 0,
8669 shapeFlag,
8670 patchFlag,
8671 dynamicProps,
8672 dynamicChildren: null,
8673 appContext: null,
8674 ctx: currentRenderingInstance
8675 };
8676 if (needFullChildrenNormalization) {
8677 normalizeChildren(vnode, children);
8678 if (shapeFlag & 128) {
8679 type.normalize(vnode);
8680 }
8681 } else if (children) {
8682 vnode.shapeFlag |= isString(children) ? 8 : 16;
8683 }
8684 if (vnode.key !== vnode.key) {
8685 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
8686 }
8687 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
8688 !isBlockNode && // has current parent block
8689 currentBlock && // presence of a patch flag indicates this node needs patching on updates.
8690 // component nodes also should always be patched, because even if the
8691 // component doesn't need to update, it needs to persist the instance on to
8692 // the next vnode so that it can be properly unmounted later.
8693 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
8694 // vnode should not be considered dynamic due to handler caching.
8695 vnode.patchFlag !== 32) {
8696 currentBlock.push(vnode);
8697 }
8698 return vnode;
8699}
8700const createVNode = createVNodeWithArgsTransform ;
8701function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
8702 if (!type || type === NULL_DYNAMIC_COMPONENT) {
8703 if (!type) {
8704 warn$1(`Invalid vnode type when creating vnode: ${type}.`);
8705 }
8706 type = Comment;
8707 }
8708 if (isVNode(type)) {
8709 const cloned = cloneVNode(
8710 type,
8711 props,
8712 true
8713 /* mergeRef: true */
8714 );
8715 if (children) {
8716 normalizeChildren(cloned, children);
8717 }
8718 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
8719 if (cloned.shapeFlag & 6) {
8720 currentBlock[currentBlock.indexOf(type)] = cloned;
8721 } else {
8722 currentBlock.push(cloned);
8723 }
8724 }
8725 cloned.patchFlag |= -2;
8726 return cloned;
8727 }
8728 if (isClassComponent(type)) {
8729 type = type.__vccOpts;
8730 }
8731 if (props) {
8732 props = guardReactiveProps(props);
8733 let { class: klass, style } = props;
8734 if (klass && !isString(klass)) {
8735 props.class = normalizeClass(klass);
8736 }
8737 if (isObject(style)) {
8738 if (isProxy(style) && !isArray(style)) {
8739 style = extend({}, style);
8740 }
8741 props.style = normalizeStyle(style);
8742 }
8743 }
8744 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
8745 if (shapeFlag & 4 && isProxy(type)) {
8746 type = toRaw(type);
8747 warn$1(
8748 `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\`.`,
8749 `
8750Component that was made reactive: `,
8751 type
8752 );
8753 }
8754 return createBaseVNode(
8755 type,
8756 props,
8757 children,
8758 patchFlag,
8759 dynamicProps,
8760 shapeFlag,
8761 isBlockNode,
8762 true
8763 );
8764}
8765function guardReactiveProps(props) {
8766 if (!props)
8767 return null;
8768 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
8769}
8770function cloneVNode(vnode, extraProps, mergeRef = false) {
8771 const { props, ref, patchFlag, children } = vnode;
8772 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
8773 const cloned = {
8774 __v_isVNode: true,
8775 __v_skip: true,
8776 type: vnode.type,
8777 props: mergedProps,
8778 key: mergedProps && normalizeKey(mergedProps),
8779 ref: extraProps && extraProps.ref ? (
8780 // #2078 in the case of <component :is="vnode" ref="extra"/>
8781 // if the vnode itself already has a ref, cloneVNode will need to merge
8782 // the refs so the single vnode can be set on multiple refs
8783 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
8784 ) : ref,
8785 scopeId: vnode.scopeId,
8786 slotScopeIds: vnode.slotScopeIds,
8787 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
8788 target: vnode.target,
8789 targetAnchor: vnode.targetAnchor,
8790 staticCount: vnode.staticCount,
8791 shapeFlag: vnode.shapeFlag,
8792 // if the vnode is cloned with extra props, we can no longer assume its
8793 // existing patch flag to be reliable and need to add the FULL_PROPS flag.
8794 // note: preserve flag for fragments since they use the flag for children
8795 // fast paths only.
8796 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
8797 dynamicProps: vnode.dynamicProps,
8798 dynamicChildren: vnode.dynamicChildren,
8799 appContext: vnode.appContext,
8800 dirs: vnode.dirs,
8801 transition: vnode.transition,
8802 // These should technically only be non-null on mounted VNodes. However,
8803 // they *should* be copied for kept-alive vnodes. So we just always copy
8804 // them since them being non-null during a mount doesn't affect the logic as
8805 // they will simply be overwritten.
8806 component: vnode.component,
8807 suspense: vnode.suspense,
8808 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
8809 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
8810 el: vnode.el,
8811 anchor: vnode.anchor,
8812 ctx: vnode.ctx,
8813 ce: vnode.ce
8814 };
8815 return cloned;
8816}
8817function deepCloneVNode(vnode) {
8818 const cloned = cloneVNode(vnode);
8819 if (isArray(vnode.children)) {
8820 cloned.children = vnode.children.map(deepCloneVNode);
8821 }
8822 return cloned;
8823}
8824function createTextVNode(text = " ", flag = 0) {
8825 return createVNode(Text, null, text, flag);
8826}
8827function createStaticVNode(content, numberOfNodes) {
8828 const vnode = createVNode(Static, null, content);
8829 vnode.staticCount = numberOfNodes;
8830 return vnode;
8831}
8832function createCommentVNode(text = "", asBlock = false) {
8833 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
8834}
8835function normalizeVNode(child) {
8836 if (child == null || typeof child === "boolean") {
8837 return createVNode(Comment);
8838 } else if (isArray(child)) {
8839 return createVNode(
8840 Fragment,
8841 null,
8842 // #3666, avoid reference pollution when reusing vnode
8843 child.slice()
8844 );
8845 } else if (typeof child === "object") {
8846 return cloneIfMounted(child);
8847 } else {
8848 return createVNode(Text, null, String(child));
8849 }
8850}
8851function cloneIfMounted(child) {
8852 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
8853}
8854function normalizeChildren(vnode, children) {
8855 let type = 0;
8856 const { shapeFlag } = vnode;
8857 if (children == null) {
8858 children = null;
8859 } else if (isArray(children)) {
8860 type = 16;
8861 } else if (typeof children === "object") {
8862 if (shapeFlag & (1 | 64)) {
8863 const slot = children.default;
8864 if (slot) {
8865 slot._c && (slot._d = false);
8866 normalizeChildren(vnode, slot());
8867 slot._c && (slot._d = true);
8868 }
8869 return;
8870 } else {
8871 type = 32;
8872 const slotFlag = children._;
8873 if (!slotFlag && !isInternalObject(children)) {
8874 children._ctx = currentRenderingInstance;
8875 } else if (slotFlag === 3 && currentRenderingInstance) {
8876 if (currentRenderingInstance.slots._ === 1) {
8877 children._ = 1;
8878 } else {
8879 children._ = 2;
8880 vnode.patchFlag |= 1024;
8881 }
8882 }
8883 }
8884 } else if (isFunction(children)) {
8885 children = { default: children, _ctx: currentRenderingInstance };
8886 type = 32;
8887 } else {
8888 children = String(children);
8889 if (shapeFlag & 64) {
8890 type = 16;
8891 children = [createTextVNode(children)];
8892 } else {
8893 type = 8;
8894 }
8895 }
8896 vnode.children = children;
8897 vnode.shapeFlag |= type;
8898}
8899function mergeProps(...args) {
8900 const ret = {};
8901 for (let i = 0; i < args.length; i++) {
8902 const toMerge = args[i];
8903 for (const key in toMerge) {
8904 if (key === "class") {
8905 if (ret.class !== toMerge.class) {
8906 ret.class = normalizeClass([ret.class, toMerge.class]);
8907 }
8908 } else if (key === "style") {
8909 ret.style = normalizeStyle([ret.style, toMerge.style]);
8910 } else if (isOn(key)) {
8911 const existing = ret[key];
8912 const incoming = toMerge[key];
8913 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
8914 ret[key] = existing ? [].concat(existing, incoming) : incoming;
8915 }
8916 } else if (key !== "") {
8917 ret[key] = toMerge[key];
8918 }
8919 }
8920 }
8921 return ret;
8922}
8923function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8924 callWithAsyncErrorHandling(hook, instance, 7, [
8925 vnode,
8926 prevVNode
8927 ]);
8928}
8929
8930const emptyAppContext = createAppContext();
8931let uid = 0;
8932function createComponentInstance(vnode, parent, suspense) {
8933 const type = vnode.type;
8934 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
8935 const instance = {
8936 uid: uid++,
8937 vnode,
8938 type,
8939 parent,
8940 appContext,
8941 root: null,
8942 // to be immediately set
8943 next: null,
8944 subTree: null,
8945 // will be set synchronously right after creation
8946 effect: null,
8947 update: null,
8948 // will be set synchronously right after creation
8949 scope: new EffectScope(
8950 true
8951 /* detached */
8952 ),
8953 render: null,
8954 proxy: null,
8955 exposed: null,
8956 exposeProxy: null,
8957 withProxy: null,
8958 provides: parent ? parent.provides : Object.create(appContext.provides),
8959 accessCache: null,
8960 renderCache: [],
8961 // local resolved assets
8962 components: null,
8963 directives: null,
8964 // resolved props and emits options
8965 propsOptions: normalizePropsOptions(type, appContext),
8966 emitsOptions: normalizeEmitsOptions(type, appContext),
8967 // emit
8968 emit: null,
8969 // to be set immediately
8970 emitted: null,
8971 // props default value
8972 propsDefaults: EMPTY_OBJ,
8973 // inheritAttrs
8974 inheritAttrs: type.inheritAttrs,
8975 // state
8976 ctx: EMPTY_OBJ,
8977 data: EMPTY_OBJ,
8978 props: EMPTY_OBJ,
8979 attrs: EMPTY_OBJ,
8980 slots: EMPTY_OBJ,
8981 refs: EMPTY_OBJ,
8982 setupState: EMPTY_OBJ,
8983 setupContext: null,
8984 attrsProxy: null,
8985 slotsProxy: null,
8986 // suspense related
8987 suspense,
8988 suspenseId: suspense ? suspense.pendingId : 0,
8989 asyncDep: null,
8990 asyncResolved: false,
8991 // lifecycle hooks
8992 // not using enums here because it results in computed properties
8993 isMounted: false,
8994 isUnmounted: false,
8995 isDeactivated: false,
8996 bc: null,
8997 c: null,
8998 bm: null,
8999 m: null,
9000 bu: null,
9001 u: null,
9002 um: null,
9003 bum: null,
9004 da: null,
9005 a: null,
9006 rtg: null,
9007 rtc: null,
9008 ec: null,
9009 sp: null
9010 };
9011 {
9012 instance.ctx = createDevRenderContext(instance);
9013 }
9014 instance.root = parent ? parent.root : instance;
9015 instance.emit = emit.bind(null, instance);
9016 if (vnode.ce) {
9017 vnode.ce(instance);
9018 }
9019 return instance;
9020}
9021let currentInstance = null;
9022const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9023let internalSetCurrentInstance;
9024let setInSSRSetupState;
9025{
9026 internalSetCurrentInstance = (i) => {
9027 currentInstance = i;
9028 };
9029 setInSSRSetupState = (v) => {
9030 isInSSRComponentSetup = v;
9031 };
9032}
9033const setCurrentInstance = (instance) => {
9034 const prev = currentInstance;
9035 internalSetCurrentInstance(instance);
9036 instance.scope.on();
9037 return () => {
9038 instance.scope.off();
9039 internalSetCurrentInstance(prev);
9040 };
9041};
9042const unsetCurrentInstance = () => {
9043 currentInstance && currentInstance.scope.off();
9044 internalSetCurrentInstance(null);
9045};
9046const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
9047function validateComponentName(name, { isNativeTag }) {
9048 if (isBuiltInTag(name) || isNativeTag(name)) {
9049 warn$1(
9050 "Do not use built-in or reserved HTML elements as component id: " + name
9051 );
9052 }
9053}
9054function isStatefulComponent(instance) {
9055 return instance.vnode.shapeFlag & 4;
9056}
9057let isInSSRComponentSetup = false;
9058function setupComponent(instance, isSSR = false) {
9059 isSSR && setInSSRSetupState(isSSR);
9060 const { props, children } = instance.vnode;
9061 const isStateful = isStatefulComponent(instance);
9062 initProps(instance, props, isStateful, isSSR);
9063 initSlots(instance, children);
9064 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9065 isSSR && setInSSRSetupState(false);
9066 return setupResult;
9067}
9068function setupStatefulComponent(instance, isSSR) {
9069 var _a;
9070 const Component = instance.type;
9071 {
9072 if (Component.name) {
9073 validateComponentName(Component.name, instance.appContext.config);
9074 }
9075 if (Component.components) {
9076 const names = Object.keys(Component.components);
9077 for (let i = 0; i < names.length; i++) {
9078 validateComponentName(names[i], instance.appContext.config);
9079 }
9080 }
9081 if (Component.directives) {
9082 const names = Object.keys(Component.directives);
9083 for (let i = 0; i < names.length; i++) {
9084 validateDirectiveName(names[i]);
9085 }
9086 }
9087 if (Component.compilerOptions && isRuntimeOnly()) {
9088 warn$1(
9089 `"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.`
9090 );
9091 }
9092 }
9093 instance.accessCache = /* @__PURE__ */ Object.create(null);
9094 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9095 {
9096 exposePropsOnRenderContext(instance);
9097 }
9098 const { setup } = Component;
9099 if (setup) {
9100 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9101 const reset = setCurrentInstance(instance);
9102 pauseTracking();
9103 const setupResult = callWithErrorHandling(
9104 setup,
9105 instance,
9106 0,
9107 [
9108 shallowReadonly(instance.props) ,
9109 setupContext
9110 ]
9111 );
9112 resetTracking();
9113 reset();
9114 if (isPromise(setupResult)) {
9115 setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9116 if (isSSR) {
9117 return setupResult.then((resolvedResult) => {
9118 handleSetupResult(instance, resolvedResult, isSSR);
9119 }).catch((e) => {
9120 handleError(e, instance, 0);
9121 });
9122 } else {
9123 instance.asyncDep = setupResult;
9124 if (!instance.suspense) {
9125 const name = (_a = Component.name) != null ? _a : "Anonymous";
9126 warn$1(
9127 `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.`
9128 );
9129 }
9130 }
9131 } else {
9132 handleSetupResult(instance, setupResult, isSSR);
9133 }
9134 } else {
9135 finishComponentSetup(instance, isSSR);
9136 }
9137}
9138function handleSetupResult(instance, setupResult, isSSR) {
9139 if (isFunction(setupResult)) {
9140 {
9141 instance.render = setupResult;
9142 }
9143 } else if (isObject(setupResult)) {
9144 if (isVNode(setupResult)) {
9145 warn$1(
9146 `setup() should not return VNodes directly - return a render function instead.`
9147 );
9148 }
9149 {
9150 instance.devtoolsRawSetupState = setupResult;
9151 }
9152 instance.setupState = proxyRefs(setupResult);
9153 {
9154 exposeSetupStateOnRenderContext(instance);
9155 }
9156 } else if (setupResult !== void 0) {
9157 warn$1(
9158 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
9159 );
9160 }
9161 finishComponentSetup(instance, isSSR);
9162}
9163let compile$1;
9164let installWithProxy;
9165function registerRuntimeCompiler(_compile) {
9166 compile$1 = _compile;
9167 installWithProxy = (i) => {
9168 if (i.render._rc) {
9169 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
9170 }
9171 };
9172}
9173const isRuntimeOnly = () => !compile$1;
9174function finishComponentSetup(instance, isSSR, skipOptions) {
9175 const Component = instance.type;
9176 if (!instance.render) {
9177 if (!isSSR && compile$1 && !Component.render) {
9178 const template = Component.template || resolveMergedOptions(instance).template;
9179 if (template) {
9180 {
9181 startMeasure(instance, `compile`);
9182 }
9183 const { isCustomElement, compilerOptions } = instance.appContext.config;
9184 const { delimiters, compilerOptions: componentCompilerOptions } = Component;
9185 const finalCompilerOptions = extend(
9186 extend(
9187 {
9188 isCustomElement,
9189 delimiters
9190 },
9191 compilerOptions
9192 ),
9193 componentCompilerOptions
9194 );
9195 Component.render = compile$1(template, finalCompilerOptions);
9196 {
9197 endMeasure(instance, `compile`);
9198 }
9199 }
9200 }
9201 instance.render = Component.render || NOOP;
9202 if (installWithProxy) {
9203 installWithProxy(instance);
9204 }
9205 }
9206 {
9207 const reset = setCurrentInstance(instance);
9208 pauseTracking();
9209 try {
9210 applyOptions(instance);
9211 } finally {
9212 resetTracking();
9213 reset();
9214 }
9215 }
9216 if (!Component.render && instance.render === NOOP && !isSSR) {
9217 if (!compile$1 && Component.template) {
9218 warn$1(
9219 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
9220 );
9221 } else {
9222 warn$1(`Component is missing template or render function.`);
9223 }
9224 }
9225}
9226const attrsProxyHandlers = {
9227 get(target, key) {
9228 markAttrsAccessed();
9229 track(target, "get", "");
9230 return target[key];
9231 },
9232 set() {
9233 warn$1(`setupContext.attrs is readonly.`);
9234 return false;
9235 },
9236 deleteProperty() {
9237 warn$1(`setupContext.attrs is readonly.`);
9238 return false;
9239 }
9240} ;
9241function getSlotsProxy(instance) {
9242 return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9243 get(target, key) {
9244 track(instance, "get", "$slots");
9245 return target[key];
9246 }
9247 }));
9248}
9249function createSetupContext(instance) {
9250 const expose = (exposed) => {
9251 {
9252 if (instance.exposed) {
9253 warn$1(`expose() should be called only once per setup().`);
9254 }
9255 if (exposed != null) {
9256 let exposedType = typeof exposed;
9257 if (exposedType === "object") {
9258 if (isArray(exposed)) {
9259 exposedType = "array";
9260 } else if (isRef(exposed)) {
9261 exposedType = "ref";
9262 }
9263 }
9264 if (exposedType !== "object") {
9265 warn$1(
9266 `expose() should be passed a plain object, received ${exposedType}.`
9267 );
9268 }
9269 }
9270 }
9271 instance.exposed = exposed || {};
9272 };
9273 {
9274 let attrsProxy;
9275 return Object.freeze({
9276 get attrs() {
9277 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9278 },
9279 get slots() {
9280 return getSlotsProxy(instance);
9281 },
9282 get emit() {
9283 return (event, ...args) => instance.emit(event, ...args);
9284 },
9285 expose
9286 });
9287 }
9288}
9289function getExposeProxy(instance) {
9290 if (instance.exposed) {
9291 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
9292 get(target, key) {
9293 if (key in target) {
9294 return target[key];
9295 } else if (key in publicPropertiesMap) {
9296 return publicPropertiesMap[key](instance);
9297 }
9298 },
9299 has(target, key) {
9300 return key in target || key in publicPropertiesMap;
9301 }
9302 }));
9303 }
9304}
9305const classifyRE = /(?:^|[-_])(\w)/g;
9306const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
9307function getComponentName(Component, includeInferred = true) {
9308 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
9309}
9310function formatComponentName(instance, Component, isRoot = false) {
9311 let name = getComponentName(Component);
9312 if (!name && Component.__file) {
9313 const match = Component.__file.match(/([^/\\]+)\.\w+$/);
9314 if (match) {
9315 name = match[1];
9316 }
9317 }
9318 if (!name && instance && instance.parent) {
9319 const inferFromRegistry = (registry) => {
9320 for (const key in registry) {
9321 if (registry[key] === Component) {
9322 return key;
9323 }
9324 }
9325 };
9326 name = inferFromRegistry(
9327 instance.components || instance.parent.type.components
9328 ) || inferFromRegistry(instance.appContext.components);
9329 }
9330 return name ? classify(name) : isRoot ? `App` : `Anonymous`;
9331}
9332function isClassComponent(value) {
9333 return isFunction(value) && "__vccOpts" in value;
9334}
9335
9336const computed = (getterOrOptions, debugOptions) => {
9337 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9338 {
9339 const i = getCurrentInstance();
9340 if (i && i.appContext.config.warnRecursiveComputed) {
9341 c._warnRecursive = true;
9342 }
9343 }
9344 return c;
9345};
9346
9347function useModel(props, name, options = EMPTY_OBJ) {
9348 const i = getCurrentInstance();
9349 if (!i) {
9350 warn$1(`useModel() called without active instance.`);
9351 return ref();
9352 }
9353 if (!i.propsOptions[0][name]) {
9354 warn$1(`useModel() called with prop "${name}" which is not declared.`);
9355 return ref();
9356 }
9357 const camelizedName = camelize(name);
9358 const hyphenatedName = hyphenate(name);
9359 const res = customRef((track, trigger) => {
9360 let localValue;
9361 watchSyncEffect(() => {
9362 const propValue = props[name];
9363 if (hasChanged(localValue, propValue)) {
9364 localValue = propValue;
9365 trigger();
9366 }
9367 });
9368 return {
9369 get() {
9370 track();
9371 return options.get ? options.get(localValue) : localValue;
9372 },
9373 set(value) {
9374 const rawProps = i.vnode.props;
9375 if (!(rawProps && // check if parent has passed v-model
9376 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9377 localValue = value;
9378 trigger();
9379 }
9380 i.emit(`update:${name}`, options.set ? options.set(value) : value);
9381 }
9382 };
9383 });
9384 const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9385 res[Symbol.iterator] = () => {
9386 let i2 = 0;
9387 return {
9388 next() {
9389 if (i2 < 2) {
9390 return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9391 } else {
9392 return { done: true };
9393 }
9394 }
9395 };
9396 };
9397 return res;
9398}
9399
9400function h(type, propsOrChildren, children) {
9401 const l = arguments.length;
9402 if (l === 2) {
9403 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
9404 if (isVNode(propsOrChildren)) {
9405 return createVNode(type, null, [propsOrChildren]);
9406 }
9407 return createVNode(type, propsOrChildren);
9408 } else {
9409 return createVNode(type, null, propsOrChildren);
9410 }
9411 } else {
9412 if (l > 3) {
9413 children = Array.prototype.slice.call(arguments, 2);
9414 } else if (l === 3 && isVNode(children)) {
9415 children = [children];
9416 }
9417 return createVNode(type, propsOrChildren, children);
9418 }
9419}
9420
9421function initCustomFormatter() {
9422 if (typeof window === "undefined") {
9423 return;
9424 }
9425 const vueStyle = { style: "color:#3ba776" };
9426 const numberStyle = { style: "color:#1677ff" };
9427 const stringStyle = { style: "color:#f5222d" };
9428 const keywordStyle = { style: "color:#eb2f96" };
9429 const formatter = {
9430 header(obj) {
9431 if (!isObject(obj)) {
9432 return null;
9433 }
9434 if (obj.__isVue) {
9435 return ["div", vueStyle, `VueInstance`];
9436 } else if (isRef(obj)) {
9437 return [
9438 "div",
9439 {},
9440 ["span", vueStyle, genRefFlag(obj)],
9441 "<",
9442 formatValue(obj.value),
9443 `>`
9444 ];
9445 } else if (isReactive(obj)) {
9446 return [
9447 "div",
9448 {},
9449 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
9450 "<",
9451 formatValue(obj),
9452 `>${isReadonly(obj) ? ` (readonly)` : ``}`
9453 ];
9454 } else if (isReadonly(obj)) {
9455 return [
9456 "div",
9457 {},
9458 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
9459 "<",
9460 formatValue(obj),
9461 ">"
9462 ];
9463 }
9464 return null;
9465 },
9466 hasBody(obj) {
9467 return obj && obj.__isVue;
9468 },
9469 body(obj) {
9470 if (obj && obj.__isVue) {
9471 return [
9472 "div",
9473 {},
9474 ...formatInstance(obj.$)
9475 ];
9476 }
9477 }
9478 };
9479 function formatInstance(instance) {
9480 const blocks = [];
9481 if (instance.type.props && instance.props) {
9482 blocks.push(createInstanceBlock("props", toRaw(instance.props)));
9483 }
9484 if (instance.setupState !== EMPTY_OBJ) {
9485 blocks.push(createInstanceBlock("setup", instance.setupState));
9486 }
9487 if (instance.data !== EMPTY_OBJ) {
9488 blocks.push(createInstanceBlock("data", toRaw(instance.data)));
9489 }
9490 const computed = extractKeys(instance, "computed");
9491 if (computed) {
9492 blocks.push(createInstanceBlock("computed", computed));
9493 }
9494 const injected = extractKeys(instance, "inject");
9495 if (injected) {
9496 blocks.push(createInstanceBlock("injected", injected));
9497 }
9498 blocks.push([
9499 "div",
9500 {},
9501 [
9502 "span",
9503 {
9504 style: keywordStyle.style + ";opacity:0.66"
9505 },
9506 "$ (internal): "
9507 ],
9508 ["object", { object: instance }]
9509 ]);
9510 return blocks;
9511 }
9512 function createInstanceBlock(type, target) {
9513 target = extend({}, target);
9514 if (!Object.keys(target).length) {
9515 return ["span", {}];
9516 }
9517 return [
9518 "div",
9519 { style: "line-height:1.25em;margin-bottom:0.6em" },
9520 [
9521 "div",
9522 {
9523 style: "color:#476582"
9524 },
9525 type
9526 ],
9527 [
9528 "div",
9529 {
9530 style: "padding-left:1.25em"
9531 },
9532 ...Object.keys(target).map((key) => {
9533 return [
9534 "div",
9535 {},
9536 ["span", keywordStyle, key + ": "],
9537 formatValue(target[key], false)
9538 ];
9539 })
9540 ]
9541 ];
9542 }
9543 function formatValue(v, asRaw = true) {
9544 if (typeof v === "number") {
9545 return ["span", numberStyle, v];
9546 } else if (typeof v === "string") {
9547 return ["span", stringStyle, JSON.stringify(v)];
9548 } else if (typeof v === "boolean") {
9549 return ["span", keywordStyle, v];
9550 } else if (isObject(v)) {
9551 return ["object", { object: asRaw ? toRaw(v) : v }];
9552 } else {
9553 return ["span", stringStyle, String(v)];
9554 }
9555 }
9556 function extractKeys(instance, type) {
9557 const Comp = instance.type;
9558 if (isFunction(Comp)) {
9559 return;
9560 }
9561 const extracted = {};
9562 for (const key in instance.ctx) {
9563 if (isKeyOfType(Comp, key, type)) {
9564 extracted[key] = instance.ctx[key];
9565 }
9566 }
9567 return extracted;
9568 }
9569 function isKeyOfType(Comp, key, type) {
9570 const opts = Comp[type];
9571 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
9572 return true;
9573 }
9574 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
9575 return true;
9576 }
9577 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
9578 return true;
9579 }
9580 }
9581 function genRefFlag(v) {
9582 if (isShallow(v)) {
9583 return `ShallowRef`;
9584 }
9585 if (v.effect) {
9586 return `ComputedRef`;
9587 }
9588 return `Ref`;
9589 }
9590 if (window.devtoolsFormatters) {
9591 window.devtoolsFormatters.push(formatter);
9592 } else {
9593 window.devtoolsFormatters = [formatter];
9594 }
9595}
9596
9597function withMemo(memo, render, cache, index) {
9598 const cached = cache[index];
9599 if (cached && isMemoSame(cached, memo)) {
9600 return cached;
9601 }
9602 const ret = render();
9603 ret.memo = memo.slice();
9604 return cache[index] = ret;
9605}
9606function isMemoSame(cached, memo) {
9607 const prev = cached.memo;
9608 if (prev.length != memo.length) {
9609 return false;
9610 }
9611 for (let i = 0; i < prev.length; i++) {
9612 if (hasChanged(prev[i], memo[i])) {
9613 return false;
9614 }
9615 }
9616 if (isBlockTreeEnabled > 0 && currentBlock) {
9617 currentBlock.push(cached);
9618 }
9619 return true;
9620}
9621
9622const version = "3.4.25";
9623const warn = warn$1 ;
9624const ErrorTypeStrings = ErrorTypeStrings$1 ;
9625const devtools = devtools$1 ;
9626const setDevtoolsHook = setDevtoolsHook$1 ;
9627const ssrUtils = null;
9628const resolveFilter = null;
9629const compatUtils = null;
9630const DeprecationTypes = null;
9631
9632const svgNS = "http://www.w3.org/2000/svg";
9633const mathmlNS = "http://www.w3.org/1998/Math/MathML";
9634const doc = typeof document !== "undefined" ? document : null;
9635const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
9636const nodeOps = {
9637 insert: (child, parent, anchor) => {
9638 parent.insertBefore(child, anchor || null);
9639 },
9640 remove: (child) => {
9641 const parent = child.parentNode;
9642 if (parent) {
9643 parent.removeChild(child);
9644 }
9645 },
9646 createElement: (tag, namespace, is, props) => {
9647 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
9648 if (tag === "select" && props && props.multiple != null) {
9649 el.setAttribute("multiple", props.multiple);
9650 }
9651 return el;
9652 },
9653 createText: (text) => doc.createTextNode(text),
9654 createComment: (text) => doc.createComment(text),
9655 setText: (node, text) => {
9656 node.nodeValue = text;
9657 },
9658 setElementText: (el, text) => {
9659 el.textContent = text;
9660 },
9661 parentNode: (node) => node.parentNode,
9662 nextSibling: (node) => node.nextSibling,
9663 querySelector: (selector) => doc.querySelector(selector),
9664 setScopeId(el, id) {
9665 el.setAttribute(id, "");
9666 },
9667 // __UNSAFE__
9668 // Reason: innerHTML.
9669 // Static content here can only come from compiled templates.
9670 // As long as the user only uses trusted templates, this is safe.
9671 insertStaticContent(content, parent, anchor, namespace, start, end) {
9672 const before = anchor ? anchor.previousSibling : parent.lastChild;
9673 if (start && (start === end || start.nextSibling)) {
9674 while (true) {
9675 parent.insertBefore(start.cloneNode(true), anchor);
9676 if (start === end || !(start = start.nextSibling))
9677 break;
9678 }
9679 } else {
9680 templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
9681 const template = templateContainer.content;
9682 if (namespace === "svg" || namespace === "mathml") {
9683 const wrapper = template.firstChild;
9684 while (wrapper.firstChild) {
9685 template.appendChild(wrapper.firstChild);
9686 }
9687 template.removeChild(wrapper);
9688 }
9689 parent.insertBefore(template, anchor);
9690 }
9691 return [
9692 // first
9693 before ? before.nextSibling : parent.firstChild,
9694 // last
9695 anchor ? anchor.previousSibling : parent.lastChild
9696 ];
9697 }
9698};
9699
9700const TRANSITION$1 = "transition";
9701const ANIMATION = "animation";
9702const vtcKey = Symbol("_vtc");
9703const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
9704Transition.displayName = "Transition";
9705const DOMTransitionPropsValidators = {
9706 name: String,
9707 type: String,
9708 css: {
9709 type: Boolean,
9710 default: true
9711 },
9712 duration: [String, Number, Object],
9713 enterFromClass: String,
9714 enterActiveClass: String,
9715 enterToClass: String,
9716 appearFromClass: String,
9717 appearActiveClass: String,
9718 appearToClass: String,
9719 leaveFromClass: String,
9720 leaveActiveClass: String,
9721 leaveToClass: String
9722};
9723const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
9724 {},
9725 BaseTransitionPropsValidators,
9726 DOMTransitionPropsValidators
9727);
9728const callHook = (hook, args = []) => {
9729 if (isArray(hook)) {
9730 hook.forEach((h2) => h2(...args));
9731 } else if (hook) {
9732 hook(...args);
9733 }
9734};
9735const hasExplicitCallback = (hook) => {
9736 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
9737};
9738function resolveTransitionProps(rawProps) {
9739 const baseProps = {};
9740 for (const key in rawProps) {
9741 if (!(key in DOMTransitionPropsValidators)) {
9742 baseProps[key] = rawProps[key];
9743 }
9744 }
9745 if (rawProps.css === false) {
9746 return baseProps;
9747 }
9748 const {
9749 name = "v",
9750 type,
9751 duration,
9752 enterFromClass = `${name}-enter-from`,
9753 enterActiveClass = `${name}-enter-active`,
9754 enterToClass = `${name}-enter-to`,
9755 appearFromClass = enterFromClass,
9756 appearActiveClass = enterActiveClass,
9757 appearToClass = enterToClass,
9758 leaveFromClass = `${name}-leave-from`,
9759 leaveActiveClass = `${name}-leave-active`,
9760 leaveToClass = `${name}-leave-to`
9761 } = rawProps;
9762 const durations = normalizeDuration(duration);
9763 const enterDuration = durations && durations[0];
9764 const leaveDuration = durations && durations[1];
9765 const {
9766 onBeforeEnter,
9767 onEnter,
9768 onEnterCancelled,
9769 onLeave,
9770 onLeaveCancelled,
9771 onBeforeAppear = onBeforeEnter,
9772 onAppear = onEnter,
9773 onAppearCancelled = onEnterCancelled
9774 } = baseProps;
9775 const finishEnter = (el, isAppear, done) => {
9776 removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
9777 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
9778 done && done();
9779 };
9780 const finishLeave = (el, done) => {
9781 el._isLeaving = false;
9782 removeTransitionClass(el, leaveFromClass);
9783 removeTransitionClass(el, leaveToClass);
9784 removeTransitionClass(el, leaveActiveClass);
9785 done && done();
9786 };
9787 const makeEnterHook = (isAppear) => {
9788 return (el, done) => {
9789 const hook = isAppear ? onAppear : onEnter;
9790 const resolve = () => finishEnter(el, isAppear, done);
9791 callHook(hook, [el, resolve]);
9792 nextFrame(() => {
9793 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
9794 addTransitionClass(el, isAppear ? appearToClass : enterToClass);
9795 if (!hasExplicitCallback(hook)) {
9796 whenTransitionEnds(el, type, enterDuration, resolve);
9797 }
9798 });
9799 };
9800 };
9801 return extend(baseProps, {
9802 onBeforeEnter(el) {
9803 callHook(onBeforeEnter, [el]);
9804 addTransitionClass(el, enterFromClass);
9805 addTransitionClass(el, enterActiveClass);
9806 },
9807 onBeforeAppear(el) {
9808 callHook(onBeforeAppear, [el]);
9809 addTransitionClass(el, appearFromClass);
9810 addTransitionClass(el, appearActiveClass);
9811 },
9812 onEnter: makeEnterHook(false),
9813 onAppear: makeEnterHook(true),
9814 onLeave(el, done) {
9815 el._isLeaving = true;
9816 const resolve = () => finishLeave(el, done);
9817 addTransitionClass(el, leaveFromClass);
9818 addTransitionClass(el, leaveActiveClass);
9819 forceReflow();
9820 nextFrame(() => {
9821 if (!el._isLeaving) {
9822 return;
9823 }
9824 removeTransitionClass(el, leaveFromClass);
9825 addTransitionClass(el, leaveToClass);
9826 if (!hasExplicitCallback(onLeave)) {
9827 whenTransitionEnds(el, type, leaveDuration, resolve);
9828 }
9829 });
9830 callHook(onLeave, [el, resolve]);
9831 },
9832 onEnterCancelled(el) {
9833 finishEnter(el, false);
9834 callHook(onEnterCancelled, [el]);
9835 },
9836 onAppearCancelled(el) {
9837 finishEnter(el, true);
9838 callHook(onAppearCancelled, [el]);
9839 },
9840 onLeaveCancelled(el) {
9841 finishLeave(el);
9842 callHook(onLeaveCancelled, [el]);
9843 }
9844 });
9845}
9846function normalizeDuration(duration) {
9847 if (duration == null) {
9848 return null;
9849 } else if (isObject(duration)) {
9850 return [NumberOf(duration.enter), NumberOf(duration.leave)];
9851 } else {
9852 const n = NumberOf(duration);
9853 return [n, n];
9854 }
9855}
9856function NumberOf(val) {
9857 const res = toNumber(val);
9858 {
9859 assertNumber(res, "<transition> explicit duration");
9860 }
9861 return res;
9862}
9863function addTransitionClass(el, cls) {
9864 cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
9865 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
9866}
9867function removeTransitionClass(el, cls) {
9868 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
9869 const _vtc = el[vtcKey];
9870 if (_vtc) {
9871 _vtc.delete(cls);
9872 if (!_vtc.size) {
9873 el[vtcKey] = void 0;
9874 }
9875 }
9876}
9877function nextFrame(cb) {
9878 requestAnimationFrame(() => {
9879 requestAnimationFrame(cb);
9880 });
9881}
9882let endId = 0;
9883function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
9884 const id = el._endId = ++endId;
9885 const resolveIfNotStale = () => {
9886 if (id === el._endId) {
9887 resolve();
9888 }
9889 };
9890 if (explicitTimeout) {
9891 return setTimeout(resolveIfNotStale, explicitTimeout);
9892 }
9893 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
9894 if (!type) {
9895 return resolve();
9896 }
9897 const endEvent = type + "end";
9898 let ended = 0;
9899 const end = () => {
9900 el.removeEventListener(endEvent, onEnd);
9901 resolveIfNotStale();
9902 };
9903 const onEnd = (e) => {
9904 if (e.target === el && ++ended >= propCount) {
9905 end();
9906 }
9907 };
9908 setTimeout(() => {
9909 if (ended < propCount) {
9910 end();
9911 }
9912 }, timeout + 1);
9913 el.addEventListener(endEvent, onEnd);
9914}
9915function getTransitionInfo(el, expectedType) {
9916 const styles = window.getComputedStyle(el);
9917 const getStyleProperties = (key) => (styles[key] || "").split(", ");
9918 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
9919 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
9920 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
9921 const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
9922 const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
9923 const animationTimeout = getTimeout(animationDelays, animationDurations);
9924 let type = null;
9925 let timeout = 0;
9926 let propCount = 0;
9927 if (expectedType === TRANSITION$1) {
9928 if (transitionTimeout > 0) {
9929 type = TRANSITION$1;
9930 timeout = transitionTimeout;
9931 propCount = transitionDurations.length;
9932 }
9933 } else if (expectedType === ANIMATION) {
9934 if (animationTimeout > 0) {
9935 type = ANIMATION;
9936 timeout = animationTimeout;
9937 propCount = animationDurations.length;
9938 }
9939 } else {
9940 timeout = Math.max(transitionTimeout, animationTimeout);
9941 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
9942 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
9943 }
9944 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
9945 getStyleProperties(`${TRANSITION$1}Property`).toString()
9946 );
9947 return {
9948 type,
9949 timeout,
9950 propCount,
9951 hasTransform
9952 };
9953}
9954function getTimeout(delays, durations) {
9955 while (delays.length < durations.length) {
9956 delays = delays.concat(delays);
9957 }
9958 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
9959}
9960function toMs(s) {
9961 if (s === "auto")
9962 return 0;
9963 return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
9964}
9965function forceReflow() {
9966 return document.body.offsetHeight;
9967}
9968
9969function patchClass(el, value, isSVG) {
9970 const transitionClasses = el[vtcKey];
9971 if (transitionClasses) {
9972 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
9973 }
9974 if (value == null) {
9975 el.removeAttribute("class");
9976 } else if (isSVG) {
9977 el.setAttribute("class", value);
9978 } else {
9979 el.className = value;
9980 }
9981}
9982
9983const vShowOriginalDisplay = Symbol("_vod");
9984const vShowHidden = Symbol("_vsh");
9985const vShow = {
9986 beforeMount(el, { value }, { transition }) {
9987 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
9988 if (transition && value) {
9989 transition.beforeEnter(el);
9990 } else {
9991 setDisplay(el, value);
9992 }
9993 },
9994 mounted(el, { value }, { transition }) {
9995 if (transition && value) {
9996 transition.enter(el);
9997 }
9998 },
9999 updated(el, { value, oldValue }, { transition }) {
10000 if (!value === !oldValue)
10001 return;
10002 if (transition) {
10003 if (value) {
10004 transition.beforeEnter(el);
10005 setDisplay(el, true);
10006 transition.enter(el);
10007 } else {
10008 transition.leave(el, () => {
10009 setDisplay(el, false);
10010 });
10011 }
10012 } else {
10013 setDisplay(el, value);
10014 }
10015 },
10016 beforeUnmount(el, { value }) {
10017 setDisplay(el, value);
10018 }
10019};
10020{
10021 vShow.name = "show";
10022}
10023function setDisplay(el, value) {
10024 el.style.display = value ? el[vShowOriginalDisplay] : "none";
10025 el[vShowHidden] = !value;
10026}
10027
10028const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
10029function useCssVars(getter) {
10030 const instance = getCurrentInstance();
10031 if (!instance) {
10032 warn(`useCssVars is called without current active component instance.`);
10033 return;
10034 }
10035 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10036 Array.from(
10037 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10038 ).forEach((node) => setVarsOnNode(node, vars));
10039 };
10040 {
10041 instance.getCssVars = () => getter(instance.proxy);
10042 }
10043 const setVars = () => {
10044 const vars = getter(instance.proxy);
10045 setVarsOnVNode(instance.subTree, vars);
10046 updateTeleports(vars);
10047 };
10048 onMounted(() => {
10049 watchPostEffect(setVars);
10050 const ob = new MutationObserver(setVars);
10051 ob.observe(instance.subTree.el.parentNode, { childList: true });
10052 onUnmounted(() => ob.disconnect());
10053 });
10054}
10055function setVarsOnVNode(vnode, vars) {
10056 if (vnode.shapeFlag & 128) {
10057 const suspense = vnode.suspense;
10058 vnode = suspense.activeBranch;
10059 if (suspense.pendingBranch && !suspense.isHydrating) {
10060 suspense.effects.push(() => {
10061 setVarsOnVNode(suspense.activeBranch, vars);
10062 });
10063 }
10064 }
10065 while (vnode.component) {
10066 vnode = vnode.component.subTree;
10067 }
10068 if (vnode.shapeFlag & 1 && vnode.el) {
10069 setVarsOnNode(vnode.el, vars);
10070 } else if (vnode.type === Fragment) {
10071 vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10072 } else if (vnode.type === Static) {
10073 let { el, anchor } = vnode;
10074 while (el) {
10075 setVarsOnNode(el, vars);
10076 if (el === anchor)
10077 break;
10078 el = el.nextSibling;
10079 }
10080 }
10081}
10082function setVarsOnNode(el, vars) {
10083 if (el.nodeType === 1) {
10084 const style = el.style;
10085 let cssText = "";
10086 for (const key in vars) {
10087 style.setProperty(`--${key}`, vars[key]);
10088 cssText += `--${key}: ${vars[key]};`;
10089 }
10090 style[CSS_VAR_TEXT] = cssText;
10091 }
10092}
10093
10094const displayRE = /(^|;)\s*display\s*:/;
10095function patchStyle(el, prev, next) {
10096 const style = el.style;
10097 const isCssString = isString(next);
10098 let hasControlledDisplay = false;
10099 if (next && !isCssString) {
10100 if (prev) {
10101 if (!isString(prev)) {
10102 for (const key in prev) {
10103 if (next[key] == null) {
10104 setStyle(style, key, "");
10105 }
10106 }
10107 } else {
10108 for (const prevStyle of prev.split(";")) {
10109 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
10110 if (next[key] == null) {
10111 setStyle(style, key, "");
10112 }
10113 }
10114 }
10115 }
10116 for (const key in next) {
10117 if (key === "display") {
10118 hasControlledDisplay = true;
10119 }
10120 setStyle(style, key, next[key]);
10121 }
10122 } else {
10123 if (isCssString) {
10124 if (prev !== next) {
10125 const cssVarText = style[CSS_VAR_TEXT];
10126 if (cssVarText) {
10127 next += ";" + cssVarText;
10128 }
10129 style.cssText = next;
10130 hasControlledDisplay = displayRE.test(next);
10131 }
10132 } else if (prev) {
10133 el.removeAttribute("style");
10134 }
10135 }
10136 if (vShowOriginalDisplay in el) {
10137 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
10138 if (el[vShowHidden]) {
10139 style.display = "none";
10140 }
10141 }
10142}
10143const semicolonRE = /[^\\];\s*$/;
10144const importantRE = /\s*!important$/;
10145function setStyle(style, name, val) {
10146 if (isArray(val)) {
10147 val.forEach((v) => setStyle(style, name, v));
10148 } else {
10149 if (val == null)
10150 val = "";
10151 {
10152 if (semicolonRE.test(val)) {
10153 warn(
10154 `Unexpected semicolon at the end of '${name}' style value: '${val}'`
10155 );
10156 }
10157 }
10158 if (name.startsWith("--")) {
10159 style.setProperty(name, val);
10160 } else {
10161 const prefixed = autoPrefix(style, name);
10162 if (importantRE.test(val)) {
10163 style.setProperty(
10164 hyphenate(prefixed),
10165 val.replace(importantRE, ""),
10166 "important"
10167 );
10168 } else {
10169 style[prefixed] = val;
10170 }
10171 }
10172 }
10173}
10174const prefixes = ["Webkit", "Moz", "ms"];
10175const prefixCache = {};
10176function autoPrefix(style, rawName) {
10177 const cached = prefixCache[rawName];
10178 if (cached) {
10179 return cached;
10180 }
10181 let name = camelize(rawName);
10182 if (name !== "filter" && name in style) {
10183 return prefixCache[rawName] = name;
10184 }
10185 name = capitalize(name);
10186 for (let i = 0; i < prefixes.length; i++) {
10187 const prefixed = prefixes[i] + name;
10188 if (prefixed in style) {
10189 return prefixCache[rawName] = prefixed;
10190 }
10191 }
10192 return rawName;
10193}
10194
10195const xlinkNS = "http://www.w3.org/1999/xlink";
10196function patchAttr(el, key, value, isSVG, instance) {
10197 if (isSVG && key.startsWith("xlink:")) {
10198 if (value == null) {
10199 el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
10200 } else {
10201 el.setAttributeNS(xlinkNS, key, value);
10202 }
10203 } else {
10204 const isBoolean = isSpecialBooleanAttr(key);
10205 if (value == null || isBoolean && !includeBooleanAttr(value)) {
10206 el.removeAttribute(key);
10207 } else {
10208 el.setAttribute(key, isBoolean ? "" : value);
10209 }
10210 }
10211}
10212
10213function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
10214 if (key === "innerHTML" || key === "textContent") {
10215 if (prevChildren) {
10216 unmountChildren(prevChildren, parentComponent, parentSuspense);
10217 }
10218 el[key] = value == null ? "" : value;
10219 return;
10220 }
10221 const tag = el.tagName;
10222 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10223 !tag.includes("-")) {
10224 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10225 const newValue = value == null ? "" : value;
10226 if (oldValue !== newValue || !("_value" in el)) {
10227 el.value = newValue;
10228 }
10229 if (value == null) {
10230 el.removeAttribute(key);
10231 }
10232 el._value = value;
10233 return;
10234 }
10235 let needRemove = false;
10236 if (value === "" || value == null) {
10237 const type = typeof el[key];
10238 if (type === "boolean") {
10239 value = includeBooleanAttr(value);
10240 } else if (value == null && type === "string") {
10241 value = "";
10242 needRemove = true;
10243 } else if (type === "number") {
10244 value = 0;
10245 needRemove = true;
10246 }
10247 }
10248 try {
10249 el[key] = value;
10250 } catch (e) {
10251 if (!needRemove) {
10252 warn(
10253 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
10254 e
10255 );
10256 }
10257 }
10258 needRemove && el.removeAttribute(key);
10259}
10260
10261function addEventListener(el, event, handler, options) {
10262 el.addEventListener(event, handler, options);
10263}
10264function removeEventListener(el, event, handler, options) {
10265 el.removeEventListener(event, handler, options);
10266}
10267const veiKey = Symbol("_vei");
10268function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10269 const invokers = el[veiKey] || (el[veiKey] = {});
10270 const existingInvoker = invokers[rawName];
10271 if (nextValue && existingInvoker) {
10272 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10273 } else {
10274 const [name, options] = parseName(rawName);
10275 if (nextValue) {
10276 const invoker = invokers[rawName] = createInvoker(
10277 sanitizeEventValue(nextValue, rawName) ,
10278 instance
10279 );
10280 addEventListener(el, name, invoker, options);
10281 } else if (existingInvoker) {
10282 removeEventListener(el, name, existingInvoker, options);
10283 invokers[rawName] = void 0;
10284 }
10285 }
10286}
10287const optionsModifierRE = /(?:Once|Passive|Capture)$/;
10288function parseName(name) {
10289 let options;
10290 if (optionsModifierRE.test(name)) {
10291 options = {};
10292 let m;
10293 while (m = name.match(optionsModifierRE)) {
10294 name = name.slice(0, name.length - m[0].length);
10295 options[m[0].toLowerCase()] = true;
10296 }
10297 }
10298 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
10299 return [event, options];
10300}
10301let cachedNow = 0;
10302const p = /* @__PURE__ */ Promise.resolve();
10303const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
10304function createInvoker(initialValue, instance) {
10305 const invoker = (e) => {
10306 if (!e._vts) {
10307 e._vts = Date.now();
10308 } else if (e._vts <= invoker.attached) {
10309 return;
10310 }
10311 callWithAsyncErrorHandling(
10312 patchStopImmediatePropagation(e, invoker.value),
10313 instance,
10314 5,
10315 [e]
10316 );
10317 };
10318 invoker.value = initialValue;
10319 invoker.attached = getNow();
10320 return invoker;
10321}
10322function sanitizeEventValue(value, propName) {
10323 if (isFunction(value) || isArray(value)) {
10324 return value;
10325 }
10326 warn(
10327 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10328Expected function or array of functions, received type ${typeof value}.`
10329 );
10330 return NOOP;
10331}
10332function patchStopImmediatePropagation(e, value) {
10333 if (isArray(value)) {
10334 const originalStop = e.stopImmediatePropagation;
10335 e.stopImmediatePropagation = () => {
10336 originalStop.call(e);
10337 e._stopped = true;
10338 };
10339 return value.map(
10340 (fn) => (e2) => !e2._stopped && fn && fn(e2)
10341 );
10342 } else {
10343 return value;
10344 }
10345}
10346
10347const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
10348key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
10349const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
10350 const isSVG = namespace === "svg";
10351 if (key === "class") {
10352 patchClass(el, nextValue, isSVG);
10353 } else if (key === "style") {
10354 patchStyle(el, prevValue, nextValue);
10355 } else if (isOn(key)) {
10356 if (!isModelListener(key)) {
10357 patchEvent(el, key, prevValue, nextValue, parentComponent);
10358 }
10359 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
10360 patchDOMProp(
10361 el,
10362 key,
10363 nextValue,
10364 prevChildren,
10365 parentComponent,
10366 parentSuspense,
10367 unmountChildren
10368 );
10369 } else {
10370 if (key === "true-value") {
10371 el._trueValue = nextValue;
10372 } else if (key === "false-value") {
10373 el._falseValue = nextValue;
10374 }
10375 patchAttr(el, key, nextValue, isSVG);
10376 }
10377};
10378function shouldSetAsProp(el, key, value, isSVG) {
10379 if (isSVG) {
10380 if (key === "innerHTML" || key === "textContent") {
10381 return true;
10382 }
10383 if (key in el && isNativeOn(key) && isFunction(value)) {
10384 return true;
10385 }
10386 return false;
10387 }
10388 if (key === "spellcheck" || key === "draggable" || key === "translate") {
10389 return false;
10390 }
10391 if (key === "form") {
10392 return false;
10393 }
10394 if (key === "list" && el.tagName === "INPUT") {
10395 return false;
10396 }
10397 if (key === "type" && el.tagName === "TEXTAREA") {
10398 return false;
10399 }
10400 if (key === "width" || key === "height") {
10401 const tag = el.tagName;
10402 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
10403 return false;
10404 }
10405 }
10406 if (isNativeOn(key) && isString(value)) {
10407 return false;
10408 }
10409 return key in el;
10410}
10411
10412/*! #__NO_SIDE_EFFECTS__ */
10413// @__NO_SIDE_EFFECTS__
10414function defineCustomElement(options, hydrate2) {
10415 const Comp = defineComponent(options);
10416 class VueCustomElement extends VueElement {
10417 constructor(initialProps) {
10418 super(Comp, initialProps, hydrate2);
10419 }
10420 }
10421 VueCustomElement.def = Comp;
10422 return VueCustomElement;
10423}
10424/*! #__NO_SIDE_EFFECTS__ */
10425const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
10426 return /* @__PURE__ */ defineCustomElement(options, hydrate);
10427};
10428const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10429};
10430class VueElement extends BaseClass {
10431 constructor(_def, _props = {}, hydrate2) {
10432 super();
10433 this._def = _def;
10434 this._props = _props;
10435 /**
10436 * @internal
10437 */
10438 this._instance = null;
10439 this._connected = false;
10440 this._resolved = false;
10441 this._numberProps = null;
10442 this._ob = null;
10443 if (this.shadowRoot && hydrate2) {
10444 hydrate2(this._createVNode(), this.shadowRoot);
10445 } else {
10446 if (this.shadowRoot) {
10447 warn(
10448 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
10449 );
10450 }
10451 this.attachShadow({ mode: "open" });
10452 if (!this._def.__asyncLoader) {
10453 this._resolveProps(this._def);
10454 }
10455 }
10456 }
10457 connectedCallback() {
10458 this._connected = true;
10459 if (!this._instance) {
10460 if (this._resolved) {
10461 this._update();
10462 } else {
10463 this._resolveDef();
10464 }
10465 }
10466 }
10467 disconnectedCallback() {
10468 this._connected = false;
10469 if (this._ob) {
10470 this._ob.disconnect();
10471 this._ob = null;
10472 }
10473 nextTick(() => {
10474 if (!this._connected) {
10475 render(null, this.shadowRoot);
10476 this._instance = null;
10477 }
10478 });
10479 }
10480 /**
10481 * resolve inner component definition (handle possible async component)
10482 */
10483 _resolveDef() {
10484 this._resolved = true;
10485 for (let i = 0; i < this.attributes.length; i++) {
10486 this._setAttr(this.attributes[i].name);
10487 }
10488 this._ob = new MutationObserver((mutations) => {
10489 for (const m of mutations) {
10490 this._setAttr(m.attributeName);
10491 }
10492 });
10493 this._ob.observe(this, { attributes: true });
10494 const resolve = (def, isAsync = false) => {
10495 const { props, styles } = def;
10496 let numberProps;
10497 if (props && !isArray(props)) {
10498 for (const key in props) {
10499 const opt = props[key];
10500 if (opt === Number || opt && opt.type === Number) {
10501 if (key in this._props) {
10502 this._props[key] = toNumber(this._props[key]);
10503 }
10504 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
10505 }
10506 }
10507 }
10508 this._numberProps = numberProps;
10509 if (isAsync) {
10510 this._resolveProps(def);
10511 }
10512 this._applyStyles(styles);
10513 this._update();
10514 };
10515 const asyncDef = this._def.__asyncLoader;
10516 if (asyncDef) {
10517 asyncDef().then((def) => resolve(def, true));
10518 } else {
10519 resolve(this._def);
10520 }
10521 }
10522 _resolveProps(def) {
10523 const { props } = def;
10524 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10525 for (const key of Object.keys(this)) {
10526 if (key[0] !== "_" && declaredPropKeys.includes(key)) {
10527 this._setProp(key, this[key], true, false);
10528 }
10529 }
10530 for (const key of declaredPropKeys.map(camelize)) {
10531 Object.defineProperty(this, key, {
10532 get() {
10533 return this._getProp(key);
10534 },
10535 set(val) {
10536 this._setProp(key, val);
10537 }
10538 });
10539 }
10540 }
10541 _setAttr(key) {
10542 let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10543 const camelKey = camelize(key);
10544 if (this._numberProps && this._numberProps[camelKey]) {
10545 value = toNumber(value);
10546 }
10547 this._setProp(camelKey, value, false);
10548 }
10549 /**
10550 * @internal
10551 */
10552 _getProp(key) {
10553 return this._props[key];
10554 }
10555 /**
10556 * @internal
10557 */
10558 _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
10559 if (val !== this._props[key]) {
10560 this._props[key] = val;
10561 if (shouldUpdate && this._instance) {
10562 this._update();
10563 }
10564 if (shouldReflect) {
10565 if (val === true) {
10566 this.setAttribute(hyphenate(key), "");
10567 } else if (typeof val === "string" || typeof val === "number") {
10568 this.setAttribute(hyphenate(key), val + "");
10569 } else if (!val) {
10570 this.removeAttribute(hyphenate(key));
10571 }
10572 }
10573 }
10574 }
10575 _update() {
10576 render(this._createVNode(), this.shadowRoot);
10577 }
10578 _createVNode() {
10579 const vnode = createVNode(this._def, extend({}, this._props));
10580 if (!this._instance) {
10581 vnode.ce = (instance) => {
10582 this._instance = instance;
10583 instance.isCE = true;
10584 {
10585 instance.ceReload = (newStyles) => {
10586 if (this._styles) {
10587 this._styles.forEach((s) => this.shadowRoot.removeChild(s));
10588 this._styles.length = 0;
10589 }
10590 this._applyStyles(newStyles);
10591 this._instance = null;
10592 this._update();
10593 };
10594 }
10595 const dispatch = (event, args) => {
10596 this.dispatchEvent(
10597 new CustomEvent(event, {
10598 detail: args
10599 })
10600 );
10601 };
10602 instance.emit = (event, ...args) => {
10603 dispatch(event, args);
10604 if (hyphenate(event) !== event) {
10605 dispatch(hyphenate(event), args);
10606 }
10607 };
10608 let parent = this;
10609 while (parent = parent && (parent.parentNode || parent.host)) {
10610 if (parent instanceof VueElement) {
10611 instance.parent = parent._instance;
10612 instance.provides = parent._instance.provides;
10613 break;
10614 }
10615 }
10616 };
10617 }
10618 return vnode;
10619 }
10620 _applyStyles(styles) {
10621 if (styles) {
10622 styles.forEach((css) => {
10623 const s = document.createElement("style");
10624 s.textContent = css;
10625 this.shadowRoot.appendChild(s);
10626 {
10627 (this._styles || (this._styles = [])).push(s);
10628 }
10629 });
10630 }
10631 }
10632}
10633
10634function useCssModule(name = "$style") {
10635 {
10636 const instance = getCurrentInstance();
10637 if (!instance) {
10638 warn(`useCssModule must be called inside setup()`);
10639 return EMPTY_OBJ;
10640 }
10641 const modules = instance.type.__cssModules;
10642 if (!modules) {
10643 warn(`Current instance does not have CSS modules injected.`);
10644 return EMPTY_OBJ;
10645 }
10646 const mod = modules[name];
10647 if (!mod) {
10648 warn(`Current instance does not have CSS module named "${name}".`);
10649 return EMPTY_OBJ;
10650 }
10651 return mod;
10652 }
10653}
10654
10655const positionMap = /* @__PURE__ */ new WeakMap();
10656const newPositionMap = /* @__PURE__ */ new WeakMap();
10657const moveCbKey = Symbol("_moveCb");
10658const enterCbKey = Symbol("_enterCb");
10659const TransitionGroupImpl = {
10660 name: "TransitionGroup",
10661 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
10662 tag: String,
10663 moveClass: String
10664 }),
10665 setup(props, { slots }) {
10666 const instance = getCurrentInstance();
10667 const state = useTransitionState();
10668 let prevChildren;
10669 let children;
10670 onUpdated(() => {
10671 if (!prevChildren.length) {
10672 return;
10673 }
10674 const moveClass = props.moveClass || `${props.name || "v"}-move`;
10675 if (!hasCSSTransform(
10676 prevChildren[0].el,
10677 instance.vnode.el,
10678 moveClass
10679 )) {
10680 return;
10681 }
10682 prevChildren.forEach(callPendingCbs);
10683 prevChildren.forEach(recordPosition);
10684 const movedChildren = prevChildren.filter(applyTranslation);
10685 forceReflow();
10686 movedChildren.forEach((c) => {
10687 const el = c.el;
10688 const style = el.style;
10689 addTransitionClass(el, moveClass);
10690 style.transform = style.webkitTransform = style.transitionDuration = "";
10691 const cb = el[moveCbKey] = (e) => {
10692 if (e && e.target !== el) {
10693 return;
10694 }
10695 if (!e || /transform$/.test(e.propertyName)) {
10696 el.removeEventListener("transitionend", cb);
10697 el[moveCbKey] = null;
10698 removeTransitionClass(el, moveClass);
10699 }
10700 };
10701 el.addEventListener("transitionend", cb);
10702 });
10703 });
10704 return () => {
10705 const rawProps = toRaw(props);
10706 const cssTransitionProps = resolveTransitionProps(rawProps);
10707 let tag = rawProps.tag || Fragment;
10708 prevChildren = [];
10709 if (children) {
10710 for (let i = 0; i < children.length; i++) {
10711 const child = children[i];
10712 if (child.el && child.el instanceof Element) {
10713 prevChildren.push(child);
10714 setTransitionHooks(
10715 child,
10716 resolveTransitionHooks(
10717 child,
10718 cssTransitionProps,
10719 state,
10720 instance
10721 )
10722 );
10723 positionMap.set(
10724 child,
10725 child.el.getBoundingClientRect()
10726 );
10727 }
10728 }
10729 }
10730 children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10731 for (let i = 0; i < children.length; i++) {
10732 const child = children[i];
10733 if (child.key != null) {
10734 setTransitionHooks(
10735 child,
10736 resolveTransitionHooks(child, cssTransitionProps, state, instance)
10737 );
10738 } else {
10739 warn(`<TransitionGroup> children must be keyed.`);
10740 }
10741 }
10742 return createVNode(tag, null, children);
10743 };
10744 }
10745};
10746const removeMode = (props) => delete props.mode;
10747/* @__PURE__ */ removeMode(TransitionGroupImpl.props);
10748const TransitionGroup = TransitionGroupImpl;
10749function callPendingCbs(c) {
10750 const el = c.el;
10751 if (el[moveCbKey]) {
10752 el[moveCbKey]();
10753 }
10754 if (el[enterCbKey]) {
10755 el[enterCbKey]();
10756 }
10757}
10758function recordPosition(c) {
10759 newPositionMap.set(c, c.el.getBoundingClientRect());
10760}
10761function applyTranslation(c) {
10762 const oldPos = positionMap.get(c);
10763 const newPos = newPositionMap.get(c);
10764 const dx = oldPos.left - newPos.left;
10765 const dy = oldPos.top - newPos.top;
10766 if (dx || dy) {
10767 const s = c.el.style;
10768 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
10769 s.transitionDuration = "0s";
10770 return c;
10771 }
10772}
10773function hasCSSTransform(el, root, moveClass) {
10774 const clone = el.cloneNode();
10775 const _vtc = el[vtcKey];
10776 if (_vtc) {
10777 _vtc.forEach((cls) => {
10778 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
10779 });
10780 }
10781 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
10782 clone.style.display = "none";
10783 const container = root.nodeType === 1 ? root : root.parentNode;
10784 container.appendChild(clone);
10785 const { hasTransform } = getTransitionInfo(clone);
10786 container.removeChild(clone);
10787 return hasTransform;
10788}
10789
10790const getModelAssigner = (vnode) => {
10791 const fn = vnode.props["onUpdate:modelValue"] || false;
10792 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
10793};
10794function onCompositionStart(e) {
10795 e.target.composing = true;
10796}
10797function onCompositionEnd(e) {
10798 const target = e.target;
10799 if (target.composing) {
10800 target.composing = false;
10801 target.dispatchEvent(new Event("input"));
10802 }
10803}
10804const assignKey = Symbol("_assign");
10805const vModelText = {
10806 created(el, { modifiers: { lazy, trim, number } }, vnode) {
10807 el[assignKey] = getModelAssigner(vnode);
10808 const castToNumber = number || vnode.props && vnode.props.type === "number";
10809 addEventListener(el, lazy ? "change" : "input", (e) => {
10810 if (e.target.composing)
10811 return;
10812 let domValue = el.value;
10813 if (trim) {
10814 domValue = domValue.trim();
10815 }
10816 if (castToNumber) {
10817 domValue = looseToNumber(domValue);
10818 }
10819 el[assignKey](domValue);
10820 });
10821 if (trim) {
10822 addEventListener(el, "change", () => {
10823 el.value = el.value.trim();
10824 });
10825 }
10826 if (!lazy) {
10827 addEventListener(el, "compositionstart", onCompositionStart);
10828 addEventListener(el, "compositionend", onCompositionEnd);
10829 addEventListener(el, "change", onCompositionEnd);
10830 }
10831 },
10832 // set value on mounted so it's after min/max for type="range"
10833 mounted(el, { value }) {
10834 el.value = value == null ? "" : value;
10835 },
10836 beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
10837 el[assignKey] = getModelAssigner(vnode);
10838 if (el.composing)
10839 return;
10840 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10841 const newValue = value == null ? "" : value;
10842 if (elValue === newValue) {
10843 return;
10844 }
10845 if (document.activeElement === el && el.type !== "range") {
10846 if (lazy) {
10847 return;
10848 }
10849 if (trim && el.value.trim() === newValue) {
10850 return;
10851 }
10852 }
10853 el.value = newValue;
10854 }
10855};
10856const vModelCheckbox = {
10857 // #4096 array checkboxes need to be deep traversed
10858 deep: true,
10859 created(el, _, vnode) {
10860 el[assignKey] = getModelAssigner(vnode);
10861 addEventListener(el, "change", () => {
10862 const modelValue = el._modelValue;
10863 const elementValue = getValue(el);
10864 const checked = el.checked;
10865 const assign = el[assignKey];
10866 if (isArray(modelValue)) {
10867 const index = looseIndexOf(modelValue, elementValue);
10868 const found = index !== -1;
10869 if (checked && !found) {
10870 assign(modelValue.concat(elementValue));
10871 } else if (!checked && found) {
10872 const filtered = [...modelValue];
10873 filtered.splice(index, 1);
10874 assign(filtered);
10875 }
10876 } else if (isSet(modelValue)) {
10877 const cloned = new Set(modelValue);
10878 if (checked) {
10879 cloned.add(elementValue);
10880 } else {
10881 cloned.delete(elementValue);
10882 }
10883 assign(cloned);
10884 } else {
10885 assign(getCheckboxValue(el, checked));
10886 }
10887 });
10888 },
10889 // set initial checked on mount to wait for true-value/false-value
10890 mounted: setChecked,
10891 beforeUpdate(el, binding, vnode) {
10892 el[assignKey] = getModelAssigner(vnode);
10893 setChecked(el, binding, vnode);
10894 }
10895};
10896function setChecked(el, { value, oldValue }, vnode) {
10897 el._modelValue = value;
10898 if (isArray(value)) {
10899 el.checked = looseIndexOf(value, vnode.props.value) > -1;
10900 } else if (isSet(value)) {
10901 el.checked = value.has(vnode.props.value);
10902 } else if (value !== oldValue) {
10903 el.checked = looseEqual(value, getCheckboxValue(el, true));
10904 }
10905}
10906const vModelRadio = {
10907 created(el, { value }, vnode) {
10908 el.checked = looseEqual(value, vnode.props.value);
10909 el[assignKey] = getModelAssigner(vnode);
10910 addEventListener(el, "change", () => {
10911 el[assignKey](getValue(el));
10912 });
10913 },
10914 beforeUpdate(el, { value, oldValue }, vnode) {
10915 el[assignKey] = getModelAssigner(vnode);
10916 if (value !== oldValue) {
10917 el.checked = looseEqual(value, vnode.props.value);
10918 }
10919 }
10920};
10921const vModelSelect = {
10922 // <select multiple> value need to be deep traversed
10923 deep: true,
10924 created(el, { value, modifiers: { number } }, vnode) {
10925 const isSetModel = isSet(value);
10926 addEventListener(el, "change", () => {
10927 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
10928 (o) => number ? looseToNumber(getValue(o)) : getValue(o)
10929 );
10930 el[assignKey](
10931 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
10932 );
10933 el._assigning = true;
10934 nextTick(() => {
10935 el._assigning = false;
10936 });
10937 });
10938 el[assignKey] = getModelAssigner(vnode);
10939 },
10940 // set value in mounted & updated because <select> relies on its children
10941 // <option>s.
10942 mounted(el, { value, modifiers: { number } }) {
10943 setSelected(el, value);
10944 },
10945 beforeUpdate(el, _binding, vnode) {
10946 el[assignKey] = getModelAssigner(vnode);
10947 },
10948 updated(el, { value, modifiers: { number } }) {
10949 if (!el._assigning) {
10950 setSelected(el, value);
10951 }
10952 }
10953};
10954function setSelected(el, value, number) {
10955 const isMultiple = el.multiple;
10956 const isArrayValue = isArray(value);
10957 if (isMultiple && !isArrayValue && !isSet(value)) {
10958 warn(
10959 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
10960 );
10961 return;
10962 }
10963 for (let i = 0, l = el.options.length; i < l; i++) {
10964 const option = el.options[i];
10965 const optionValue = getValue(option);
10966 if (isMultiple) {
10967 if (isArrayValue) {
10968 const optionType = typeof optionValue;
10969 if (optionType === "string" || optionType === "number") {
10970 option.selected = value.some((v) => String(v) === String(optionValue));
10971 } else {
10972 option.selected = looseIndexOf(value, optionValue) > -1;
10973 }
10974 } else {
10975 option.selected = value.has(optionValue);
10976 }
10977 } else if (looseEqual(getValue(option), value)) {
10978 if (el.selectedIndex !== i)
10979 el.selectedIndex = i;
10980 return;
10981 }
10982 }
10983 if (!isMultiple && el.selectedIndex !== -1) {
10984 el.selectedIndex = -1;
10985 }
10986}
10987function getValue(el) {
10988 return "_value" in el ? el._value : el.value;
10989}
10990function getCheckboxValue(el, checked) {
10991 const key = checked ? "_trueValue" : "_falseValue";
10992 return key in el ? el[key] : checked;
10993}
10994const vModelDynamic = {
10995 created(el, binding, vnode) {
10996 callModelHook(el, binding, vnode, null, "created");
10997 },
10998 mounted(el, binding, vnode) {
10999 callModelHook(el, binding, vnode, null, "mounted");
11000 },
11001 beforeUpdate(el, binding, vnode, prevVNode) {
11002 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
11003 },
11004 updated(el, binding, vnode, prevVNode) {
11005 callModelHook(el, binding, vnode, prevVNode, "updated");
11006 }
11007};
11008function resolveDynamicModel(tagName, type) {
11009 switch (tagName) {
11010 case "SELECT":
11011 return vModelSelect;
11012 case "TEXTAREA":
11013 return vModelText;
11014 default:
11015 switch (type) {
11016 case "checkbox":
11017 return vModelCheckbox;
11018 case "radio":
11019 return vModelRadio;
11020 default:
11021 return vModelText;
11022 }
11023 }
11024}
11025function callModelHook(el, binding, vnode, prevVNode, hook) {
11026 const modelToUse = resolveDynamicModel(
11027 el.tagName,
11028 vnode.props && vnode.props.type
11029 );
11030 const fn = modelToUse[hook];
11031 fn && fn(el, binding, vnode, prevVNode);
11032}
11033
11034const systemModifiers = ["ctrl", "shift", "alt", "meta"];
11035const modifierGuards = {
11036 stop: (e) => e.stopPropagation(),
11037 prevent: (e) => e.preventDefault(),
11038 self: (e) => e.target !== e.currentTarget,
11039 ctrl: (e) => !e.ctrlKey,
11040 shift: (e) => !e.shiftKey,
11041 alt: (e) => !e.altKey,
11042 meta: (e) => !e.metaKey,
11043 left: (e) => "button" in e && e.button !== 0,
11044 middle: (e) => "button" in e && e.button !== 1,
11045 right: (e) => "button" in e && e.button !== 2,
11046 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
11047};
11048const withModifiers = (fn, modifiers) => {
11049 const cache = fn._withMods || (fn._withMods = {});
11050 const cacheKey = modifiers.join(".");
11051 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
11052 for (let i = 0; i < modifiers.length; i++) {
11053 const guard = modifierGuards[modifiers[i]];
11054 if (guard && guard(event, modifiers))
11055 return;
11056 }
11057 return fn(event, ...args);
11058 });
11059};
11060const keyNames = {
11061 esc: "escape",
11062 space: " ",
11063 up: "arrow-up",
11064 left: "arrow-left",
11065 right: "arrow-right",
11066 down: "arrow-down",
11067 delete: "backspace"
11068};
11069const withKeys = (fn, modifiers) => {
11070 const cache = fn._withKeys || (fn._withKeys = {});
11071 const cacheKey = modifiers.join(".");
11072 return cache[cacheKey] || (cache[cacheKey] = (event) => {
11073 if (!("key" in event)) {
11074 return;
11075 }
11076 const eventKey = hyphenate(event.key);
11077 if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
11078 return fn(event);
11079 }
11080 });
11081};
11082
11083const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
11084let renderer;
11085let enabledHydration = false;
11086function ensureRenderer() {
11087 return renderer || (renderer = createRenderer(rendererOptions));
11088}
11089function ensureHydrationRenderer() {
11090 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
11091 enabledHydration = true;
11092 return renderer;
11093}
11094const render = (...args) => {
11095 ensureRenderer().render(...args);
11096};
11097const hydrate = (...args) => {
11098 ensureHydrationRenderer().hydrate(...args);
11099};
11100const createApp = (...args) => {
11101 const app = ensureRenderer().createApp(...args);
11102 {
11103 injectNativeTagCheck(app);
11104 injectCompilerOptionsCheck(app);
11105 }
11106 const { mount } = app;
11107 app.mount = (containerOrSelector) => {
11108 const container = normalizeContainer(containerOrSelector);
11109 if (!container)
11110 return;
11111 const component = app._component;
11112 if (!isFunction(component) && !component.render && !component.template) {
11113 component.template = container.innerHTML;
11114 }
11115 container.innerHTML = "";
11116 const proxy = mount(container, false, resolveRootNamespace(container));
11117 if (container instanceof Element) {
11118 container.removeAttribute("v-cloak");
11119 container.setAttribute("data-v-app", "");
11120 }
11121 return proxy;
11122 };
11123 return app;
11124};
11125const createSSRApp = (...args) => {
11126 const app = ensureHydrationRenderer().createApp(...args);
11127 {
11128 injectNativeTagCheck(app);
11129 injectCompilerOptionsCheck(app);
11130 }
11131 const { mount } = app;
11132 app.mount = (containerOrSelector) => {
11133 const container = normalizeContainer(containerOrSelector);
11134 if (container) {
11135 return mount(container, true, resolveRootNamespace(container));
11136 }
11137 };
11138 return app;
11139};
11140function resolveRootNamespace(container) {
11141 if (container instanceof SVGElement) {
11142 return "svg";
11143 }
11144 if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
11145 return "mathml";
11146 }
11147}
11148function injectNativeTagCheck(app) {
11149 Object.defineProperty(app.config, "isNativeTag", {
11150 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
11151 writable: false
11152 });
11153}
11154function injectCompilerOptionsCheck(app) {
11155 if (isRuntimeOnly()) {
11156 const isCustomElement = app.config.isCustomElement;
11157 Object.defineProperty(app.config, "isCustomElement", {
11158 get() {
11159 return isCustomElement;
11160 },
11161 set() {
11162 warn(
11163 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
11164 );
11165 }
11166 });
11167 const compilerOptions = app.config.compilerOptions;
11168 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.
11169- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
11170- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
11171- 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`;
11172 Object.defineProperty(app.config, "compilerOptions", {
11173 get() {
11174 warn(msg);
11175 return compilerOptions;
11176 },
11177 set() {
11178 warn(msg);
11179 }
11180 });
11181 }
11182}
11183function normalizeContainer(container) {
11184 if (isString(container)) {
11185 const res = document.querySelector(container);
11186 if (!res) {
11187 warn(
11188 `Failed to mount app: mount target selector "${container}" returned null.`
11189 );
11190 }
11191 return res;
11192 }
11193 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
11194 warn(
11195 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
11196 );
11197 }
11198 return container;
11199}
11200const initDirectivesForSSR = NOOP;
11201
11202var runtimeDom = /*#__PURE__*/Object.freeze({
11203 __proto__: null,
11204 BaseTransition: BaseTransition,
11205 BaseTransitionPropsValidators: BaseTransitionPropsValidators,
11206 Comment: Comment,
11207 DeprecationTypes: DeprecationTypes,
11208 EffectScope: EffectScope,
11209 ErrorCodes: ErrorCodes,
11210 ErrorTypeStrings: ErrorTypeStrings,
11211 Fragment: Fragment,
11212 KeepAlive: KeepAlive,
11213 ReactiveEffect: ReactiveEffect,
11214 Static: Static,
11215 Suspense: Suspense,
11216 Teleport: Teleport,
11217 Text: Text,
11218 TrackOpTypes: TrackOpTypes,
11219 Transition: Transition,
11220 TransitionGroup: TransitionGroup,
11221 TriggerOpTypes: TriggerOpTypes,
11222 VueElement: VueElement,
11223 assertNumber: assertNumber,
11224 callWithAsyncErrorHandling: callWithAsyncErrorHandling,
11225 callWithErrorHandling: callWithErrorHandling,
11226 camelize: camelize,
11227 capitalize: capitalize,
11228 cloneVNode: cloneVNode,
11229 compatUtils: compatUtils,
11230 computed: computed,
11231 createApp: createApp,
11232 createBlock: createBlock,
11233 createCommentVNode: createCommentVNode,
11234 createElementBlock: createElementBlock,
11235 createElementVNode: createBaseVNode,
11236 createHydrationRenderer: createHydrationRenderer,
11237 createPropsRestProxy: createPropsRestProxy,
11238 createRenderer: createRenderer,
11239 createSSRApp: createSSRApp,
11240 createSlots: createSlots,
11241 createStaticVNode: createStaticVNode,
11242 createTextVNode: createTextVNode,
11243 createVNode: createVNode,
11244 customRef: customRef,
11245 defineAsyncComponent: defineAsyncComponent,
11246 defineComponent: defineComponent,
11247 defineCustomElement: defineCustomElement,
11248 defineEmits: defineEmits,
11249 defineExpose: defineExpose,
11250 defineModel: defineModel,
11251 defineOptions: defineOptions,
11252 defineProps: defineProps,
11253 defineSSRCustomElement: defineSSRCustomElement,
11254 defineSlots: defineSlots,
11255 devtools: devtools,
11256 effect: effect,
11257 effectScope: effectScope,
11258 getCurrentInstance: getCurrentInstance,
11259 getCurrentScope: getCurrentScope,
11260 getTransitionRawChildren: getTransitionRawChildren,
11261 guardReactiveProps: guardReactiveProps,
11262 h: h,
11263 handleError: handleError,
11264 hasInjectionContext: hasInjectionContext,
11265 hydrate: hydrate,
11266 initCustomFormatter: initCustomFormatter,
11267 initDirectivesForSSR: initDirectivesForSSR,
11268 inject: inject,
11269 isMemoSame: isMemoSame,
11270 isProxy: isProxy,
11271 isReactive: isReactive,
11272 isReadonly: isReadonly,
11273 isRef: isRef,
11274 isRuntimeOnly: isRuntimeOnly,
11275 isShallow: isShallow,
11276 isVNode: isVNode,
11277 markRaw: markRaw,
11278 mergeDefaults: mergeDefaults,
11279 mergeModels: mergeModels,
11280 mergeProps: mergeProps,
11281 nextTick: nextTick,
11282 normalizeClass: normalizeClass,
11283 normalizeProps: normalizeProps,
11284 normalizeStyle: normalizeStyle,
11285 onActivated: onActivated,
11286 onBeforeMount: onBeforeMount,
11287 onBeforeUnmount: onBeforeUnmount,
11288 onBeforeUpdate: onBeforeUpdate,
11289 onDeactivated: onDeactivated,
11290 onErrorCaptured: onErrorCaptured,
11291 onMounted: onMounted,
11292 onRenderTracked: onRenderTracked,
11293 onRenderTriggered: onRenderTriggered,
11294 onScopeDispose: onScopeDispose,
11295 onServerPrefetch: onServerPrefetch,
11296 onUnmounted: onUnmounted,
11297 onUpdated: onUpdated,
11298 openBlock: openBlock,
11299 popScopeId: popScopeId,
11300 provide: provide,
11301 proxyRefs: proxyRefs,
11302 pushScopeId: pushScopeId,
11303 queuePostFlushCb: queuePostFlushCb,
11304 reactive: reactive,
11305 readonly: readonly,
11306 ref: ref,
11307 registerRuntimeCompiler: registerRuntimeCompiler,
11308 render: render,
11309 renderList: renderList,
11310 renderSlot: renderSlot,
11311 resolveComponent: resolveComponent,
11312 resolveDirective: resolveDirective,
11313 resolveDynamicComponent: resolveDynamicComponent,
11314 resolveFilter: resolveFilter,
11315 resolveTransitionHooks: resolveTransitionHooks,
11316 setBlockTracking: setBlockTracking,
11317 setDevtoolsHook: setDevtoolsHook,
11318 setTransitionHooks: setTransitionHooks,
11319 shallowReactive: shallowReactive,
11320 shallowReadonly: shallowReadonly,
11321 shallowRef: shallowRef,
11322 ssrContextKey: ssrContextKey,
11323 ssrUtils: ssrUtils,
11324 stop: stop,
11325 toDisplayString: toDisplayString,
11326 toHandlerKey: toHandlerKey,
11327 toHandlers: toHandlers,
11328 toRaw: toRaw,
11329 toRef: toRef,
11330 toRefs: toRefs,
11331 toValue: toValue,
11332 transformVNodeArgs: transformVNodeArgs,
11333 triggerRef: triggerRef,
11334 unref: unref,
11335 useAttrs: useAttrs,
11336 useCssModule: useCssModule,
11337 useCssVars: useCssVars,
11338 useModel: useModel,
11339 useSSRContext: useSSRContext,
11340 useSlots: useSlots,
11341 useTransitionState: useTransitionState,
11342 vModelCheckbox: vModelCheckbox,
11343 vModelDynamic: vModelDynamic,
11344 vModelRadio: vModelRadio,
11345 vModelSelect: vModelSelect,
11346 vModelText: vModelText,
11347 vShow: vShow,
11348 version: version,
11349 warn: warn,
11350 watch: watch,
11351 watchEffect: watchEffect,
11352 watchPostEffect: watchPostEffect,
11353 watchSyncEffect: watchSyncEffect,
11354 withAsyncContext: withAsyncContext,
11355 withCtx: withCtx,
11356 withDefaults: withDefaults,
11357 withDirectives: withDirectives,
11358 withKeys: withKeys,
11359 withMemo: withMemo,
11360 withModifiers: withModifiers,
11361 withScopeId: withScopeId
11362});
11363
11364function initDev() {
11365 {
11366 {
11367 console.info(
11368 `You are running a development build of Vue.
11369Make sure to use the production build (*.prod.js) when deploying for production.`
11370 );
11371 }
11372 initCustomFormatter();
11373 }
11374}
11375
11376const FRAGMENT = Symbol(`Fragment` );
11377const TELEPORT = Symbol(`Teleport` );
11378const SUSPENSE = Symbol(`Suspense` );
11379const KEEP_ALIVE = Symbol(`KeepAlive` );
11380const BASE_TRANSITION = Symbol(`BaseTransition` );
11381const OPEN_BLOCK = Symbol(`openBlock` );
11382const CREATE_BLOCK = Symbol(`createBlock` );
11383const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
11384const CREATE_VNODE = Symbol(`createVNode` );
11385const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
11386const CREATE_COMMENT = Symbol(`createCommentVNode` );
11387const CREATE_TEXT = Symbol(`createTextVNode` );
11388const CREATE_STATIC = Symbol(`createStaticVNode` );
11389const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
11390const RESOLVE_DYNAMIC_COMPONENT = Symbol(
11391 `resolveDynamicComponent`
11392);
11393const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
11394const RESOLVE_FILTER = Symbol(`resolveFilter` );
11395const WITH_DIRECTIVES = Symbol(`withDirectives` );
11396const RENDER_LIST = Symbol(`renderList` );
11397const RENDER_SLOT = Symbol(`renderSlot` );
11398const CREATE_SLOTS = Symbol(`createSlots` );
11399const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
11400const MERGE_PROPS = Symbol(`mergeProps` );
11401const NORMALIZE_CLASS = Symbol(`normalizeClass` );
11402const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
11403const NORMALIZE_PROPS = Symbol(`normalizeProps` );
11404const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
11405const TO_HANDLERS = Symbol(`toHandlers` );
11406const CAMELIZE = Symbol(`camelize` );
11407const CAPITALIZE = Symbol(`capitalize` );
11408const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
11409const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
11410const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
11411const POP_SCOPE_ID = Symbol(`popScopeId` );
11412const WITH_CTX = Symbol(`withCtx` );
11413const UNREF = Symbol(`unref` );
11414const IS_REF = Symbol(`isRef` );
11415const WITH_MEMO = Symbol(`withMemo` );
11416const IS_MEMO_SAME = Symbol(`isMemoSame` );
11417const helperNameMap = {
11418 [FRAGMENT]: `Fragment`,
11419 [TELEPORT]: `Teleport`,
11420 [SUSPENSE]: `Suspense`,
11421 [KEEP_ALIVE]: `KeepAlive`,
11422 [BASE_TRANSITION]: `BaseTransition`,
11423 [OPEN_BLOCK]: `openBlock`,
11424 [CREATE_BLOCK]: `createBlock`,
11425 [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
11426 [CREATE_VNODE]: `createVNode`,
11427 [CREATE_ELEMENT_VNODE]: `createElementVNode`,
11428 [CREATE_COMMENT]: `createCommentVNode`,
11429 [CREATE_TEXT]: `createTextVNode`,
11430 [CREATE_STATIC]: `createStaticVNode`,
11431 [RESOLVE_COMPONENT]: `resolveComponent`,
11432 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
11433 [RESOLVE_DIRECTIVE]: `resolveDirective`,
11434 [RESOLVE_FILTER]: `resolveFilter`,
11435 [WITH_DIRECTIVES]: `withDirectives`,
11436 [RENDER_LIST]: `renderList`,
11437 [RENDER_SLOT]: `renderSlot`,
11438 [CREATE_SLOTS]: `createSlots`,
11439 [TO_DISPLAY_STRING]: `toDisplayString`,
11440 [MERGE_PROPS]: `mergeProps`,
11441 [NORMALIZE_CLASS]: `normalizeClass`,
11442 [NORMALIZE_STYLE]: `normalizeStyle`,
11443 [NORMALIZE_PROPS]: `normalizeProps`,
11444 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
11445 [TO_HANDLERS]: `toHandlers`,
11446 [CAMELIZE]: `camelize`,
11447 [CAPITALIZE]: `capitalize`,
11448 [TO_HANDLER_KEY]: `toHandlerKey`,
11449 [SET_BLOCK_TRACKING]: `setBlockTracking`,
11450 [PUSH_SCOPE_ID]: `pushScopeId`,
11451 [POP_SCOPE_ID]: `popScopeId`,
11452 [WITH_CTX]: `withCtx`,
11453 [UNREF]: `unref`,
11454 [IS_REF]: `isRef`,
11455 [WITH_MEMO]: `withMemo`,
11456 [IS_MEMO_SAME]: `isMemoSame`
11457};
11458function registerRuntimeHelpers(helpers) {
11459 Object.getOwnPropertySymbols(helpers).forEach((s) => {
11460 helperNameMap[s] = helpers[s];
11461 });
11462}
11463
11464const locStub = {
11465 start: { line: 1, column: 1, offset: 0 },
11466 end: { line: 1, column: 1, offset: 0 },
11467 source: ""
11468};
11469function createRoot(children, source = "") {
11470 return {
11471 type: 0,
11472 source,
11473 children,
11474 helpers: /* @__PURE__ */ new Set(),
11475 components: [],
11476 directives: [],
11477 hoists: [],
11478 imports: [],
11479 cached: 0,
11480 temps: 0,
11481 codegenNode: void 0,
11482 loc: locStub
11483 };
11484}
11485function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
11486 if (context) {
11487 if (isBlock) {
11488 context.helper(OPEN_BLOCK);
11489 context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
11490 } else {
11491 context.helper(getVNodeHelper(context.inSSR, isComponent));
11492 }
11493 if (directives) {
11494 context.helper(WITH_DIRECTIVES);
11495 }
11496 }
11497 return {
11498 type: 13,
11499 tag,
11500 props,
11501 children,
11502 patchFlag,
11503 dynamicProps,
11504 directives,
11505 isBlock,
11506 disableTracking,
11507 isComponent,
11508 loc
11509 };
11510}
11511function createArrayExpression(elements, loc = locStub) {
11512 return {
11513 type: 17,
11514 loc,
11515 elements
11516 };
11517}
11518function createObjectExpression(properties, loc = locStub) {
11519 return {
11520 type: 15,
11521 loc,
11522 properties
11523 };
11524}
11525function createObjectProperty(key, value) {
11526 return {
11527 type: 16,
11528 loc: locStub,
11529 key: isString(key) ? createSimpleExpression(key, true) : key,
11530 value
11531 };
11532}
11533function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
11534 return {
11535 type: 4,
11536 loc,
11537 content,
11538 isStatic,
11539 constType: isStatic ? 3 : constType
11540 };
11541}
11542function createCompoundExpression(children, loc = locStub) {
11543 return {
11544 type: 8,
11545 loc,
11546 children
11547 };
11548}
11549function createCallExpression(callee, args = [], loc = locStub) {
11550 return {
11551 type: 14,
11552 loc,
11553 callee,
11554 arguments: args
11555 };
11556}
11557function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
11558 return {
11559 type: 18,
11560 params,
11561 returns,
11562 newline,
11563 isSlot,
11564 loc
11565 };
11566}
11567function createConditionalExpression(test, consequent, alternate, newline = true) {
11568 return {
11569 type: 19,
11570 test,
11571 consequent,
11572 alternate,
11573 newline,
11574 loc: locStub
11575 };
11576}
11577function createCacheExpression(index, value, isVNode = false) {
11578 return {
11579 type: 20,
11580 index,
11581 value,
11582 isVNode,
11583 loc: locStub
11584 };
11585}
11586function createBlockStatement(body) {
11587 return {
11588 type: 21,
11589 body,
11590 loc: locStub
11591 };
11592}
11593function getVNodeHelper(ssr, isComponent) {
11594 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
11595}
11596function getVNodeBlockHelper(ssr, isComponent) {
11597 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
11598}
11599function convertToBlock(node, { helper, removeHelper, inSSR }) {
11600 if (!node.isBlock) {
11601 node.isBlock = true;
11602 removeHelper(getVNodeHelper(inSSR, node.isComponent));
11603 helper(OPEN_BLOCK);
11604 helper(getVNodeBlockHelper(inSSR, node.isComponent));
11605 }
11606}
11607
11608const defaultDelimitersOpen = new Uint8Array([123, 123]);
11609const defaultDelimitersClose = new Uint8Array([125, 125]);
11610function isTagStartChar(c) {
11611 return c >= 97 && c <= 122 || c >= 65 && c <= 90;
11612}
11613function isWhitespace(c) {
11614 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
11615}
11616function isEndOfTagSection(c) {
11617 return c === 47 || c === 62 || isWhitespace(c);
11618}
11619function toCharCodes(str) {
11620 const ret = new Uint8Array(str.length);
11621 for (let i = 0; i < str.length; i++) {
11622 ret[i] = str.charCodeAt(i);
11623 }
11624 return ret;
11625}
11626const Sequences = {
11627 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
11628 // CDATA[
11629 CdataEnd: new Uint8Array([93, 93, 62]),
11630 // ]]>
11631 CommentEnd: new Uint8Array([45, 45, 62]),
11632 // `-->`
11633 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
11634 // `<\/script`
11635 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
11636 // `</style`
11637 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
11638 // `</title`
11639 TextareaEnd: new Uint8Array([
11640 60,
11641 47,
11642 116,
11643 101,
11644 120,
11645 116,
11646 97,
11647 114,
11648 101,
11649 97
11650 ])
11651 // `</textarea
11652};
11653class Tokenizer {
11654 constructor(stack, cbs) {
11655 this.stack = stack;
11656 this.cbs = cbs;
11657 /** The current state the tokenizer is in. */
11658 this.state = 1;
11659 /** The read buffer. */
11660 this.buffer = "";
11661 /** The beginning of the section that is currently being read. */
11662 this.sectionStart = 0;
11663 /** The index within the buffer that we are currently looking at. */
11664 this.index = 0;
11665 /** The start of the last entity. */
11666 this.entityStart = 0;
11667 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
11668 this.baseState = 1;
11669 /** For special parsing behavior inside of script and style tags. */
11670 this.inRCDATA = false;
11671 /** For disabling RCDATA tags handling */
11672 this.inXML = false;
11673 /** For disabling interpolation parsing in v-pre */
11674 this.inVPre = false;
11675 /** Record newline positions for fast line / column calculation */
11676 this.newlines = [];
11677 this.mode = 0;
11678 this.delimiterOpen = defaultDelimitersOpen;
11679 this.delimiterClose = defaultDelimitersClose;
11680 this.delimiterIndex = -1;
11681 this.currentSequence = void 0;
11682 this.sequenceIndex = 0;
11683 }
11684 get inSFCRoot() {
11685 return this.mode === 2 && this.stack.length === 0;
11686 }
11687 reset() {
11688 this.state = 1;
11689 this.mode = 0;
11690 this.buffer = "";
11691 this.sectionStart = 0;
11692 this.index = 0;
11693 this.baseState = 1;
11694 this.inRCDATA = false;
11695 this.currentSequence = void 0;
11696 this.newlines.length = 0;
11697 this.delimiterOpen = defaultDelimitersOpen;
11698 this.delimiterClose = defaultDelimitersClose;
11699 }
11700 /**
11701 * Generate Position object with line / column information using recorded
11702 * newline positions. We know the index is always going to be an already
11703 * processed index, so all the newlines up to this index should have been
11704 * recorded.
11705 */
11706 getPos(index) {
11707 let line = 1;
11708 let column = index + 1;
11709 for (let i = this.newlines.length - 1; i >= 0; i--) {
11710 const newlineIndex = this.newlines[i];
11711 if (index > newlineIndex) {
11712 line = i + 2;
11713 column = index - newlineIndex;
11714 break;
11715 }
11716 }
11717 return {
11718 column,
11719 line,
11720 offset: index
11721 };
11722 }
11723 peek() {
11724 return this.buffer.charCodeAt(this.index + 1);
11725 }
11726 stateText(c) {
11727 if (c === 60) {
11728 if (this.index > this.sectionStart) {
11729 this.cbs.ontext(this.sectionStart, this.index);
11730 }
11731 this.state = 5;
11732 this.sectionStart = this.index;
11733 } else if (!this.inVPre && c === this.delimiterOpen[0]) {
11734 this.state = 2;
11735 this.delimiterIndex = 0;
11736 this.stateInterpolationOpen(c);
11737 }
11738 }
11739 stateInterpolationOpen(c) {
11740 if (c === this.delimiterOpen[this.delimiterIndex]) {
11741 if (this.delimiterIndex === this.delimiterOpen.length - 1) {
11742 const start = this.index + 1 - this.delimiterOpen.length;
11743 if (start > this.sectionStart) {
11744 this.cbs.ontext(this.sectionStart, start);
11745 }
11746 this.state = 3;
11747 this.sectionStart = start;
11748 } else {
11749 this.delimiterIndex++;
11750 }
11751 } else if (this.inRCDATA) {
11752 this.state = 32;
11753 this.stateInRCDATA(c);
11754 } else {
11755 this.state = 1;
11756 this.stateText(c);
11757 }
11758 }
11759 stateInterpolation(c) {
11760 if (c === this.delimiterClose[0]) {
11761 this.state = 4;
11762 this.delimiterIndex = 0;
11763 this.stateInterpolationClose(c);
11764 }
11765 }
11766 stateInterpolationClose(c) {
11767 if (c === this.delimiterClose[this.delimiterIndex]) {
11768 if (this.delimiterIndex === this.delimiterClose.length - 1) {
11769 this.cbs.oninterpolation(this.sectionStart, this.index + 1);
11770 if (this.inRCDATA) {
11771 this.state = 32;
11772 } else {
11773 this.state = 1;
11774 }
11775 this.sectionStart = this.index + 1;
11776 } else {
11777 this.delimiterIndex++;
11778 }
11779 } else {
11780 this.state = 3;
11781 this.stateInterpolation(c);
11782 }
11783 }
11784 stateSpecialStartSequence(c) {
11785 const isEnd = this.sequenceIndex === this.currentSequence.length;
11786 const isMatch = isEnd ? (
11787 // If we are at the end of the sequence, make sure the tag name has ended
11788 isEndOfTagSection(c)
11789 ) : (
11790 // Otherwise, do a case-insensitive comparison
11791 (c | 32) === this.currentSequence[this.sequenceIndex]
11792 );
11793 if (!isMatch) {
11794 this.inRCDATA = false;
11795 } else if (!isEnd) {
11796 this.sequenceIndex++;
11797 return;
11798 }
11799 this.sequenceIndex = 0;
11800 this.state = 6;
11801 this.stateInTagName(c);
11802 }
11803 /** Look for an end tag. For <title> and <textarea>, also decode entities. */
11804 stateInRCDATA(c) {
11805 if (this.sequenceIndex === this.currentSequence.length) {
11806 if (c === 62 || isWhitespace(c)) {
11807 const endOfText = this.index - this.currentSequence.length;
11808 if (this.sectionStart < endOfText) {
11809 const actualIndex = this.index;
11810 this.index = endOfText;
11811 this.cbs.ontext(this.sectionStart, endOfText);
11812 this.index = actualIndex;
11813 }
11814 this.sectionStart = endOfText + 2;
11815 this.stateInClosingTagName(c);
11816 this.inRCDATA = false;
11817 return;
11818 }
11819 this.sequenceIndex = 0;
11820 }
11821 if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
11822 this.sequenceIndex += 1;
11823 } else if (this.sequenceIndex === 0) {
11824 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
11825 if (c === this.delimiterOpen[0]) {
11826 this.state = 2;
11827 this.delimiterIndex = 0;
11828 this.stateInterpolationOpen(c);
11829 }
11830 } else if (this.fastForwardTo(60)) {
11831 this.sequenceIndex = 1;
11832 }
11833 } else {
11834 this.sequenceIndex = Number(c === 60);
11835 }
11836 }
11837 stateCDATASequence(c) {
11838 if (c === Sequences.Cdata[this.sequenceIndex]) {
11839 if (++this.sequenceIndex === Sequences.Cdata.length) {
11840 this.state = 28;
11841 this.currentSequence = Sequences.CdataEnd;
11842 this.sequenceIndex = 0;
11843 this.sectionStart = this.index + 1;
11844 }
11845 } else {
11846 this.sequenceIndex = 0;
11847 this.state = 23;
11848 this.stateInDeclaration(c);
11849 }
11850 }
11851 /**
11852 * When we wait for one specific character, we can speed things up
11853 * by skipping through the buffer until we find it.
11854 *
11855 * @returns Whether the character was found.
11856 */
11857 fastForwardTo(c) {
11858 while (++this.index < this.buffer.length) {
11859 const cc = this.buffer.charCodeAt(this.index);
11860 if (cc === 10) {
11861 this.newlines.push(this.index);
11862 }
11863 if (cc === c) {
11864 return true;
11865 }
11866 }
11867 this.index = this.buffer.length - 1;
11868 return false;
11869 }
11870 /**
11871 * Comments and CDATA end with `-->` and `]]>`.
11872 *
11873 * Their common qualities are:
11874 * - Their end sequences have a distinct character they start with.
11875 * - That character is then repeated, so we have to check multiple repeats.
11876 * - All characters but the start character of the sequence can be skipped.
11877 */
11878 stateInCommentLike(c) {
11879 if (c === this.currentSequence[this.sequenceIndex]) {
11880 if (++this.sequenceIndex === this.currentSequence.length) {
11881 if (this.currentSequence === Sequences.CdataEnd) {
11882 this.cbs.oncdata(this.sectionStart, this.index - 2);
11883 } else {
11884 this.cbs.oncomment(this.sectionStart, this.index - 2);
11885 }
11886 this.sequenceIndex = 0;
11887 this.sectionStart = this.index + 1;
11888 this.state = 1;
11889 }
11890 } else if (this.sequenceIndex === 0) {
11891 if (this.fastForwardTo(this.currentSequence[0])) {
11892 this.sequenceIndex = 1;
11893 }
11894 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
11895 this.sequenceIndex = 0;
11896 }
11897 }
11898 startSpecial(sequence, offset) {
11899 this.enterRCDATA(sequence, offset);
11900 this.state = 31;
11901 }
11902 enterRCDATA(sequence, offset) {
11903 this.inRCDATA = true;
11904 this.currentSequence = sequence;
11905 this.sequenceIndex = offset;
11906 }
11907 stateBeforeTagName(c) {
11908 if (c === 33) {
11909 this.state = 22;
11910 this.sectionStart = this.index + 1;
11911 } else if (c === 63) {
11912 this.state = 24;
11913 this.sectionStart = this.index + 1;
11914 } else if (isTagStartChar(c)) {
11915 this.sectionStart = this.index;
11916 if (this.mode === 0) {
11917 this.state = 6;
11918 } else if (this.inSFCRoot) {
11919 this.state = 34;
11920 } else if (!this.inXML) {
11921 if (c === 116) {
11922 this.state = 30;
11923 } else {
11924 this.state = c === 115 ? 29 : 6;
11925 }
11926 } else {
11927 this.state = 6;
11928 }
11929 } else if (c === 47) {
11930 this.state = 8;
11931 } else {
11932 this.state = 1;
11933 this.stateText(c);
11934 }
11935 }
11936 stateInTagName(c) {
11937 if (isEndOfTagSection(c)) {
11938 this.handleTagName(c);
11939 }
11940 }
11941 stateInSFCRootTagName(c) {
11942 if (isEndOfTagSection(c)) {
11943 const tag = this.buffer.slice(this.sectionStart, this.index);
11944 if (tag !== "template") {
11945 this.enterRCDATA(toCharCodes(`</` + tag), 0);
11946 }
11947 this.handleTagName(c);
11948 }
11949 }
11950 handleTagName(c) {
11951 this.cbs.onopentagname(this.sectionStart, this.index);
11952 this.sectionStart = -1;
11953 this.state = 11;
11954 this.stateBeforeAttrName(c);
11955 }
11956 stateBeforeClosingTagName(c) {
11957 if (isWhitespace(c)) ; else if (c === 62) {
11958 {
11959 this.cbs.onerr(14, this.index);
11960 }
11961 this.state = 1;
11962 this.sectionStart = this.index + 1;
11963 } else {
11964 this.state = isTagStartChar(c) ? 9 : 27;
11965 this.sectionStart = this.index;
11966 }
11967 }
11968 stateInClosingTagName(c) {
11969 if (c === 62 || isWhitespace(c)) {
11970 this.cbs.onclosetag(this.sectionStart, this.index);
11971 this.sectionStart = -1;
11972 this.state = 10;
11973 this.stateAfterClosingTagName(c);
11974 }
11975 }
11976 stateAfterClosingTagName(c) {
11977 if (c === 62) {
11978 this.state = 1;
11979 this.sectionStart = this.index + 1;
11980 }
11981 }
11982 stateBeforeAttrName(c) {
11983 if (c === 62) {
11984 this.cbs.onopentagend(this.index);
11985 if (this.inRCDATA) {
11986 this.state = 32;
11987 } else {
11988 this.state = 1;
11989 }
11990 this.sectionStart = this.index + 1;
11991 } else if (c === 47) {
11992 this.state = 7;
11993 if (this.peek() !== 62) {
11994 this.cbs.onerr(22, this.index);
11995 }
11996 } else if (c === 60 && this.peek() === 47) {
11997 this.cbs.onopentagend(this.index);
11998 this.state = 5;
11999 this.sectionStart = this.index;
12000 } else if (!isWhitespace(c)) {
12001 if (c === 61) {
12002 this.cbs.onerr(
12003 19,
12004 this.index
12005 );
12006 }
12007 this.handleAttrStart(c);
12008 }
12009 }
12010 handleAttrStart(c) {
12011 if (c === 118 && this.peek() === 45) {
12012 this.state = 13;
12013 this.sectionStart = this.index;
12014 } else if (c === 46 || c === 58 || c === 64 || c === 35) {
12015 this.cbs.ondirname(this.index, this.index + 1);
12016 this.state = 14;
12017 this.sectionStart = this.index + 1;
12018 } else {
12019 this.state = 12;
12020 this.sectionStart = this.index;
12021 }
12022 }
12023 stateInSelfClosingTag(c) {
12024 if (c === 62) {
12025 this.cbs.onselfclosingtag(this.index);
12026 this.state = 1;
12027 this.sectionStart = this.index + 1;
12028 this.inRCDATA = false;
12029 } else if (!isWhitespace(c)) {
12030 this.state = 11;
12031 this.stateBeforeAttrName(c);
12032 }
12033 }
12034 stateInAttrName(c) {
12035 if (c === 61 || isEndOfTagSection(c)) {
12036 this.cbs.onattribname(this.sectionStart, this.index);
12037 this.handleAttrNameEnd(c);
12038 } else if (c === 34 || c === 39 || c === 60) {
12039 this.cbs.onerr(
12040 17,
12041 this.index
12042 );
12043 }
12044 }
12045 stateInDirName(c) {
12046 if (c === 61 || isEndOfTagSection(c)) {
12047 this.cbs.ondirname(this.sectionStart, this.index);
12048 this.handleAttrNameEnd(c);
12049 } else if (c === 58) {
12050 this.cbs.ondirname(this.sectionStart, this.index);
12051 this.state = 14;
12052 this.sectionStart = this.index + 1;
12053 } else if (c === 46) {
12054 this.cbs.ondirname(this.sectionStart, this.index);
12055 this.state = 16;
12056 this.sectionStart = this.index + 1;
12057 }
12058 }
12059 stateInDirArg(c) {
12060 if (c === 61 || isEndOfTagSection(c)) {
12061 this.cbs.ondirarg(this.sectionStart, this.index);
12062 this.handleAttrNameEnd(c);
12063 } else if (c === 91) {
12064 this.state = 15;
12065 } else if (c === 46) {
12066 this.cbs.ondirarg(this.sectionStart, this.index);
12067 this.state = 16;
12068 this.sectionStart = this.index + 1;
12069 }
12070 }
12071 stateInDynamicDirArg(c) {
12072 if (c === 93) {
12073 this.state = 14;
12074 } else if (c === 61 || isEndOfTagSection(c)) {
12075 this.cbs.ondirarg(this.sectionStart, this.index + 1);
12076 this.handleAttrNameEnd(c);
12077 {
12078 this.cbs.onerr(
12079 27,
12080 this.index
12081 );
12082 }
12083 }
12084 }
12085 stateInDirModifier(c) {
12086 if (c === 61 || isEndOfTagSection(c)) {
12087 this.cbs.ondirmodifier(this.sectionStart, this.index);
12088 this.handleAttrNameEnd(c);
12089 } else if (c === 46) {
12090 this.cbs.ondirmodifier(this.sectionStart, this.index);
12091 this.sectionStart = this.index + 1;
12092 }
12093 }
12094 handleAttrNameEnd(c) {
12095 this.sectionStart = this.index;
12096 this.state = 17;
12097 this.cbs.onattribnameend(this.index);
12098 this.stateAfterAttrName(c);
12099 }
12100 stateAfterAttrName(c) {
12101 if (c === 61) {
12102 this.state = 18;
12103 } else if (c === 47 || c === 62) {
12104 this.cbs.onattribend(0, this.sectionStart);
12105 this.sectionStart = -1;
12106 this.state = 11;
12107 this.stateBeforeAttrName(c);
12108 } else if (!isWhitespace(c)) {
12109 this.cbs.onattribend(0, this.sectionStart);
12110 this.handleAttrStart(c);
12111 }
12112 }
12113 stateBeforeAttrValue(c) {
12114 if (c === 34) {
12115 this.state = 19;
12116 this.sectionStart = this.index + 1;
12117 } else if (c === 39) {
12118 this.state = 20;
12119 this.sectionStart = this.index + 1;
12120 } else if (!isWhitespace(c)) {
12121 this.sectionStart = this.index;
12122 this.state = 21;
12123 this.stateInAttrValueNoQuotes(c);
12124 }
12125 }
12126 handleInAttrValue(c, quote) {
12127 if (c === quote || this.fastForwardTo(quote)) {
12128 this.cbs.onattribdata(this.sectionStart, this.index);
12129 this.sectionStart = -1;
12130 this.cbs.onattribend(
12131 quote === 34 ? 3 : 2,
12132 this.index + 1
12133 );
12134 this.state = 11;
12135 }
12136 }
12137 stateInAttrValueDoubleQuotes(c) {
12138 this.handleInAttrValue(c, 34);
12139 }
12140 stateInAttrValueSingleQuotes(c) {
12141 this.handleInAttrValue(c, 39);
12142 }
12143 stateInAttrValueNoQuotes(c) {
12144 if (isWhitespace(c) || c === 62) {
12145 this.cbs.onattribdata(this.sectionStart, this.index);
12146 this.sectionStart = -1;
12147 this.cbs.onattribend(1, this.index);
12148 this.state = 11;
12149 this.stateBeforeAttrName(c);
12150 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
12151 this.cbs.onerr(
12152 18,
12153 this.index
12154 );
12155 } else ;
12156 }
12157 stateBeforeDeclaration(c) {
12158 if (c === 91) {
12159 this.state = 26;
12160 this.sequenceIndex = 0;
12161 } else {
12162 this.state = c === 45 ? 25 : 23;
12163 }
12164 }
12165 stateInDeclaration(c) {
12166 if (c === 62 || this.fastForwardTo(62)) {
12167 this.state = 1;
12168 this.sectionStart = this.index + 1;
12169 }
12170 }
12171 stateInProcessingInstruction(c) {
12172 if (c === 62 || this.fastForwardTo(62)) {
12173 this.cbs.onprocessinginstruction(this.sectionStart, this.index);
12174 this.state = 1;
12175 this.sectionStart = this.index + 1;
12176 }
12177 }
12178 stateBeforeComment(c) {
12179 if (c === 45) {
12180 this.state = 28;
12181 this.currentSequence = Sequences.CommentEnd;
12182 this.sequenceIndex = 2;
12183 this.sectionStart = this.index + 1;
12184 } else {
12185 this.state = 23;
12186 }
12187 }
12188 stateInSpecialComment(c) {
12189 if (c === 62 || this.fastForwardTo(62)) {
12190 this.cbs.oncomment(this.sectionStart, this.index);
12191 this.state = 1;
12192 this.sectionStart = this.index + 1;
12193 }
12194 }
12195 stateBeforeSpecialS(c) {
12196 if (c === Sequences.ScriptEnd[3]) {
12197 this.startSpecial(Sequences.ScriptEnd, 4);
12198 } else if (c === Sequences.StyleEnd[3]) {
12199 this.startSpecial(Sequences.StyleEnd, 4);
12200 } else {
12201 this.state = 6;
12202 this.stateInTagName(c);
12203 }
12204 }
12205 stateBeforeSpecialT(c) {
12206 if (c === Sequences.TitleEnd[3]) {
12207 this.startSpecial(Sequences.TitleEnd, 4);
12208 } else if (c === Sequences.TextareaEnd[3]) {
12209 this.startSpecial(Sequences.TextareaEnd, 4);
12210 } else {
12211 this.state = 6;
12212 this.stateInTagName(c);
12213 }
12214 }
12215 startEntity() {
12216 }
12217 stateInEntity() {
12218 }
12219 /**
12220 * Iterates through the buffer, calling the function corresponding to the current state.
12221 *
12222 * States that are more likely to be hit are higher up, as a performance improvement.
12223 */
12224 parse(input) {
12225 this.buffer = input;
12226 while (this.index < this.buffer.length) {
12227 const c = this.buffer.charCodeAt(this.index);
12228 if (c === 10) {
12229 this.newlines.push(this.index);
12230 }
12231 switch (this.state) {
12232 case 1: {
12233 this.stateText(c);
12234 break;
12235 }
12236 case 2: {
12237 this.stateInterpolationOpen(c);
12238 break;
12239 }
12240 case 3: {
12241 this.stateInterpolation(c);
12242 break;
12243 }
12244 case 4: {
12245 this.stateInterpolationClose(c);
12246 break;
12247 }
12248 case 31: {
12249 this.stateSpecialStartSequence(c);
12250 break;
12251 }
12252 case 32: {
12253 this.stateInRCDATA(c);
12254 break;
12255 }
12256 case 26: {
12257 this.stateCDATASequence(c);
12258 break;
12259 }
12260 case 19: {
12261 this.stateInAttrValueDoubleQuotes(c);
12262 break;
12263 }
12264 case 12: {
12265 this.stateInAttrName(c);
12266 break;
12267 }
12268 case 13: {
12269 this.stateInDirName(c);
12270 break;
12271 }
12272 case 14: {
12273 this.stateInDirArg(c);
12274 break;
12275 }
12276 case 15: {
12277 this.stateInDynamicDirArg(c);
12278 break;
12279 }
12280 case 16: {
12281 this.stateInDirModifier(c);
12282 break;
12283 }
12284 case 28: {
12285 this.stateInCommentLike(c);
12286 break;
12287 }
12288 case 27: {
12289 this.stateInSpecialComment(c);
12290 break;
12291 }
12292 case 11: {
12293 this.stateBeforeAttrName(c);
12294 break;
12295 }
12296 case 6: {
12297 this.stateInTagName(c);
12298 break;
12299 }
12300 case 34: {
12301 this.stateInSFCRootTagName(c);
12302 break;
12303 }
12304 case 9: {
12305 this.stateInClosingTagName(c);
12306 break;
12307 }
12308 case 5: {
12309 this.stateBeforeTagName(c);
12310 break;
12311 }
12312 case 17: {
12313 this.stateAfterAttrName(c);
12314 break;
12315 }
12316 case 20: {
12317 this.stateInAttrValueSingleQuotes(c);
12318 break;
12319 }
12320 case 18: {
12321 this.stateBeforeAttrValue(c);
12322 break;
12323 }
12324 case 8: {
12325 this.stateBeforeClosingTagName(c);
12326 break;
12327 }
12328 case 10: {
12329 this.stateAfterClosingTagName(c);
12330 break;
12331 }
12332 case 29: {
12333 this.stateBeforeSpecialS(c);
12334 break;
12335 }
12336 case 30: {
12337 this.stateBeforeSpecialT(c);
12338 break;
12339 }
12340 case 21: {
12341 this.stateInAttrValueNoQuotes(c);
12342 break;
12343 }
12344 case 7: {
12345 this.stateInSelfClosingTag(c);
12346 break;
12347 }
12348 case 23: {
12349 this.stateInDeclaration(c);
12350 break;
12351 }
12352 case 22: {
12353 this.stateBeforeDeclaration(c);
12354 break;
12355 }
12356 case 25: {
12357 this.stateBeforeComment(c);
12358 break;
12359 }
12360 case 24: {
12361 this.stateInProcessingInstruction(c);
12362 break;
12363 }
12364 case 33: {
12365 this.stateInEntity();
12366 break;
12367 }
12368 }
12369 this.index++;
12370 }
12371 this.cleanup();
12372 this.finish();
12373 }
12374 /**
12375 * Remove data that has already been consumed from the buffer.
12376 */
12377 cleanup() {
12378 if (this.sectionStart !== this.index) {
12379 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
12380 this.cbs.ontext(this.sectionStart, this.index);
12381 this.sectionStart = this.index;
12382 } else if (this.state === 19 || this.state === 20 || this.state === 21) {
12383 this.cbs.onattribdata(this.sectionStart, this.index);
12384 this.sectionStart = this.index;
12385 }
12386 }
12387 }
12388 finish() {
12389 this.handleTrailingData();
12390 this.cbs.onend();
12391 }
12392 /** Handle any trailing data. */
12393 handleTrailingData() {
12394 const endIndex = this.buffer.length;
12395 if (this.sectionStart >= endIndex) {
12396 return;
12397 }
12398 if (this.state === 28) {
12399 if (this.currentSequence === Sequences.CdataEnd) {
12400 this.cbs.oncdata(this.sectionStart, endIndex);
12401 } else {
12402 this.cbs.oncomment(this.sectionStart, endIndex);
12403 }
12404 } 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 {
12405 this.cbs.ontext(this.sectionStart, endIndex);
12406 }
12407 }
12408 emitCodePoint(cp, consumed) {
12409 }
12410}
12411
12412function defaultOnError(error) {
12413 throw error;
12414}
12415function defaultOnWarn(msg) {
12416 console.warn(`[Vue warn] ${msg.message}`);
12417}
12418function createCompilerError(code, loc, messages, additionalMessage) {
12419 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
12420 const error = new SyntaxError(String(msg));
12421 error.code = code;
12422 error.loc = loc;
12423 return error;
12424}
12425const errorMessages = {
12426 // parse errors
12427 [0]: "Illegal comment.",
12428 [1]: "CDATA section is allowed only in XML context.",
12429 [2]: "Duplicate attribute.",
12430 [3]: "End tag cannot have attributes.",
12431 [4]: "Illegal '/' in tags.",
12432 [5]: "Unexpected EOF in tag.",
12433 [6]: "Unexpected EOF in CDATA section.",
12434 [7]: "Unexpected EOF in comment.",
12435 [8]: "Unexpected EOF in script.",
12436 [9]: "Unexpected EOF in tag.",
12437 [10]: "Incorrectly closed comment.",
12438 [11]: "Incorrectly opened comment.",
12439 [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12440 [13]: "Attribute value was expected.",
12441 [14]: "End tag name was expected.",
12442 [15]: "Whitespace was expected.",
12443 [16]: "Unexpected '<!--' in comment.",
12444 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12445 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12446 [19]: "Attribute name cannot start with '='.",
12447 [21]: "'<?' is allowed only in XML context.",
12448 [20]: `Unexpected null character.`,
12449 [22]: "Illegal '/' in tags.",
12450 // Vue-specific parse errors
12451 [23]: "Invalid end tag.",
12452 [24]: "Element is missing end tag.",
12453 [25]: "Interpolation end sign was not found.",
12454 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12455 [26]: "Legal directive name was expected.",
12456 // transform errors
12457 [28]: `v-if/v-else-if is missing expression.`,
12458 [29]: `v-if/else branches must use unique keys.`,
12459 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12460 [31]: `v-for is missing expression.`,
12461 [32]: `v-for has invalid expression.`,
12462 [33]: `<template v-for> key should be placed on the <template> tag.`,
12463 [34]: `v-bind is missing expression.`,
12464 [52]: `v-bind with same-name shorthand only allows static argument.`,
12465 [35]: `v-on is missing expression.`,
12466 [36]: `Unexpected custom directive on <slot> outlet.`,
12467 [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.`,
12468 [38]: `Duplicate slot names found. `,
12469 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12470 [40]: `v-slot can only be used on components or <template> tags.`,
12471 [41]: `v-model is missing expression.`,
12472 [42]: `v-model value must be a valid JavaScript member expression.`,
12473 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12474 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12475Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12476 [45]: `Error parsing JavaScript expression: `,
12477 [46]: `<KeepAlive> expects exactly one child component.`,
12478 [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.`,
12479 // generic errors
12480 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12481 [48]: `ES module mode is not supported in this build of compiler.`,
12482 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12483 [50]: `"scopeId" option is only supported in module mode.`,
12484 // just to fulfill types
12485 [53]: ``
12486};
12487
12488const isStaticExp = (p) => p.type === 4 && p.isStatic;
12489function isCoreComponent(tag) {
12490 switch (tag) {
12491 case "Teleport":
12492 case "teleport":
12493 return TELEPORT;
12494 case "Suspense":
12495 case "suspense":
12496 return SUSPENSE;
12497 case "KeepAlive":
12498 case "keep-alive":
12499 return KEEP_ALIVE;
12500 case "BaseTransition":
12501 case "base-transition":
12502 return BASE_TRANSITION;
12503 }
12504}
12505const nonIdentifierRE = /^\d|[^\$\w]/;
12506const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
12507const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
12508const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
12509const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
12510const isMemberExpressionBrowser = (path) => {
12511 path = path.trim().replace(whitespaceRE, (s) => s.trim());
12512 let state = 0 /* inMemberExp */;
12513 let stateStack = [];
12514 let currentOpenBracketCount = 0;
12515 let currentOpenParensCount = 0;
12516 let currentStringType = null;
12517 for (let i = 0; i < path.length; i++) {
12518 const char = path.charAt(i);
12519 switch (state) {
12520 case 0 /* inMemberExp */:
12521 if (char === "[") {
12522 stateStack.push(state);
12523 state = 1 /* inBrackets */;
12524 currentOpenBracketCount++;
12525 } else if (char === "(") {
12526 stateStack.push(state);
12527 state = 2 /* inParens */;
12528 currentOpenParensCount++;
12529 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
12530 return false;
12531 }
12532 break;
12533 case 1 /* inBrackets */:
12534 if (char === `'` || char === `"` || char === "`") {
12535 stateStack.push(state);
12536 state = 3 /* inString */;
12537 currentStringType = char;
12538 } else if (char === `[`) {
12539 currentOpenBracketCount++;
12540 } else if (char === `]`) {
12541 if (!--currentOpenBracketCount) {
12542 state = stateStack.pop();
12543 }
12544 }
12545 break;
12546 case 2 /* inParens */:
12547 if (char === `'` || char === `"` || char === "`") {
12548 stateStack.push(state);
12549 state = 3 /* inString */;
12550 currentStringType = char;
12551 } else if (char === `(`) {
12552 currentOpenParensCount++;
12553 } else if (char === `)`) {
12554 if (i === path.length - 1) {
12555 return false;
12556 }
12557 if (!--currentOpenParensCount) {
12558 state = stateStack.pop();
12559 }
12560 }
12561 break;
12562 case 3 /* inString */:
12563 if (char === currentStringType) {
12564 state = stateStack.pop();
12565 currentStringType = null;
12566 }
12567 break;
12568 }
12569 }
12570 return !currentOpenBracketCount && !currentOpenParensCount;
12571};
12572const isMemberExpression = isMemberExpressionBrowser ;
12573function assert(condition, msg) {
12574 if (!condition) {
12575 throw new Error(msg || `unexpected compiler condition`);
12576 }
12577}
12578function findDir(node, name, allowEmpty = false) {
12579 for (let i = 0; i < node.props.length; i++) {
12580 const p = node.props[i];
12581 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
12582 return p;
12583 }
12584 }
12585}
12586function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
12587 for (let i = 0; i < node.props.length; i++) {
12588 const p = node.props[i];
12589 if (p.type === 6) {
12590 if (dynamicOnly)
12591 continue;
12592 if (p.name === name && (p.value || allowEmpty)) {
12593 return p;
12594 }
12595 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
12596 return p;
12597 }
12598 }
12599}
12600function isStaticArgOf(arg, name) {
12601 return !!(arg && isStaticExp(arg) && arg.content === name);
12602}
12603function hasDynamicKeyVBind(node) {
12604 return node.props.some(
12605 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
12606 p.arg.type !== 4 || // v-bind:[_ctx.foo]
12607 !p.arg.isStatic)
12608 // v-bind:[foo]
12609 );
12610}
12611function isText$1(node) {
12612 return node.type === 5 || node.type === 2;
12613}
12614function isVSlot(p) {
12615 return p.type === 7 && p.name === "slot";
12616}
12617function isTemplateNode(node) {
12618 return node.type === 1 && node.tagType === 3;
12619}
12620function isSlotOutlet(node) {
12621 return node.type === 1 && node.tagType === 2;
12622}
12623const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
12624function getUnnormalizedProps(props, callPath = []) {
12625 if (props && !isString(props) && props.type === 14) {
12626 const callee = props.callee;
12627 if (!isString(callee) && propsHelperSet.has(callee)) {
12628 return getUnnormalizedProps(
12629 props.arguments[0],
12630 callPath.concat(props)
12631 );
12632 }
12633 }
12634 return [props, callPath];
12635}
12636function injectProp(node, prop, context) {
12637 let propsWithInjection;
12638 let props = node.type === 13 ? node.props : node.arguments[2];
12639 let callPath = [];
12640 let parentCall;
12641 if (props && !isString(props) && props.type === 14) {
12642 const ret = getUnnormalizedProps(props);
12643 props = ret[0];
12644 callPath = ret[1];
12645 parentCall = callPath[callPath.length - 1];
12646 }
12647 if (props == null || isString(props)) {
12648 propsWithInjection = createObjectExpression([prop]);
12649 } else if (props.type === 14) {
12650 const first = props.arguments[0];
12651 if (!isString(first) && first.type === 15) {
12652 if (!hasProp(prop, first)) {
12653 first.properties.unshift(prop);
12654 }
12655 } else {
12656 if (props.callee === TO_HANDLERS) {
12657 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
12658 createObjectExpression([prop]),
12659 props
12660 ]);
12661 } else {
12662 props.arguments.unshift(createObjectExpression([prop]));
12663 }
12664 }
12665 !propsWithInjection && (propsWithInjection = props);
12666 } else if (props.type === 15) {
12667 if (!hasProp(prop, props)) {
12668 props.properties.unshift(prop);
12669 }
12670 propsWithInjection = props;
12671 } else {
12672 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
12673 createObjectExpression([prop]),
12674 props
12675 ]);
12676 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
12677 parentCall = callPath[callPath.length - 2];
12678 }
12679 }
12680 if (node.type === 13) {
12681 if (parentCall) {
12682 parentCall.arguments[0] = propsWithInjection;
12683 } else {
12684 node.props = propsWithInjection;
12685 }
12686 } else {
12687 if (parentCall) {
12688 parentCall.arguments[0] = propsWithInjection;
12689 } else {
12690 node.arguments[2] = propsWithInjection;
12691 }
12692 }
12693}
12694function hasProp(prop, props) {
12695 let result = false;
12696 if (prop.key.type === 4) {
12697 const propKeyName = prop.key.content;
12698 result = props.properties.some(
12699 (p) => p.key.type === 4 && p.key.content === propKeyName
12700 );
12701 }
12702 return result;
12703}
12704function toValidAssetId(name, type) {
12705 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
12706 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
12707 })}`;
12708}
12709function getMemoedVNodeCall(node) {
12710 if (node.type === 14 && node.callee === WITH_MEMO) {
12711 return node.arguments[1].returns;
12712 } else {
12713 return node;
12714 }
12715}
12716const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
12717
12718const defaultParserOptions = {
12719 parseMode: "base",
12720 ns: 0,
12721 delimiters: [`{{`, `}}`],
12722 getNamespace: () => 0,
12723 isVoidTag: NO,
12724 isPreTag: NO,
12725 isCustomElement: NO,
12726 onError: defaultOnError,
12727 onWarn: defaultOnWarn,
12728 comments: true,
12729 prefixIdentifiers: false
12730};
12731let currentOptions = defaultParserOptions;
12732let currentRoot = null;
12733let currentInput = "";
12734let currentOpenTag = null;
12735let currentProp = null;
12736let currentAttrValue = "";
12737let currentAttrStartIndex = -1;
12738let currentAttrEndIndex = -1;
12739let inPre = 0;
12740let inVPre = false;
12741let currentVPreBoundary = null;
12742const stack = [];
12743const tokenizer = new Tokenizer(stack, {
12744 onerr: emitError,
12745 ontext(start, end) {
12746 onText(getSlice(start, end), start, end);
12747 },
12748 ontextentity(char, start, end) {
12749 onText(char, start, end);
12750 },
12751 oninterpolation(start, end) {
12752 if (inVPre) {
12753 return onText(getSlice(start, end), start, end);
12754 }
12755 let innerStart = start + tokenizer.delimiterOpen.length;
12756 let innerEnd = end - tokenizer.delimiterClose.length;
12757 while (isWhitespace(currentInput.charCodeAt(innerStart))) {
12758 innerStart++;
12759 }
12760 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
12761 innerEnd--;
12762 }
12763 let exp = getSlice(innerStart, innerEnd);
12764 if (exp.includes("&")) {
12765 {
12766 exp = currentOptions.decodeEntities(exp, false);
12767 }
12768 }
12769 addNode({
12770 type: 5,
12771 content: createExp(exp, false, getLoc(innerStart, innerEnd)),
12772 loc: getLoc(start, end)
12773 });
12774 },
12775 onopentagname(start, end) {
12776 const name = getSlice(start, end);
12777 currentOpenTag = {
12778 type: 1,
12779 tag: name,
12780 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
12781 tagType: 0,
12782 // will be refined on tag close
12783 props: [],
12784 children: [],
12785 loc: getLoc(start - 1, end),
12786 codegenNode: void 0
12787 };
12788 },
12789 onopentagend(end) {
12790 endOpenTag(end);
12791 },
12792 onclosetag(start, end) {
12793 const name = getSlice(start, end);
12794 if (!currentOptions.isVoidTag(name)) {
12795 let found = false;
12796 for (let i = 0; i < stack.length; i++) {
12797 const e = stack[i];
12798 if (e.tag.toLowerCase() === name.toLowerCase()) {
12799 found = true;
12800 if (i > 0) {
12801 emitError(24, stack[0].loc.start.offset);
12802 }
12803 for (let j = 0; j <= i; j++) {
12804 const el = stack.shift();
12805 onCloseTag(el, end, j < i);
12806 }
12807 break;
12808 }
12809 }
12810 if (!found) {
12811 emitError(23, backTrack(start, 60));
12812 }
12813 }
12814 },
12815 onselfclosingtag(end) {
12816 var _a;
12817 const name = currentOpenTag.tag;
12818 currentOpenTag.isSelfClosing = true;
12819 endOpenTag(end);
12820 if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
12821 onCloseTag(stack.shift(), end);
12822 }
12823 },
12824 onattribname(start, end) {
12825 currentProp = {
12826 type: 6,
12827 name: getSlice(start, end),
12828 nameLoc: getLoc(start, end),
12829 value: void 0,
12830 loc: getLoc(start)
12831 };
12832 },
12833 ondirname(start, end) {
12834 const raw = getSlice(start, end);
12835 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
12836 if (!inVPre && name === "") {
12837 emitError(26, start);
12838 }
12839 if (inVPre || name === "") {
12840 currentProp = {
12841 type: 6,
12842 name: raw,
12843 nameLoc: getLoc(start, end),
12844 value: void 0,
12845 loc: getLoc(start)
12846 };
12847 } else {
12848 currentProp = {
12849 type: 7,
12850 name,
12851 rawName: raw,
12852 exp: void 0,
12853 arg: void 0,
12854 modifiers: raw === "." ? ["prop"] : [],
12855 loc: getLoc(start)
12856 };
12857 if (name === "pre") {
12858 inVPre = tokenizer.inVPre = true;
12859 currentVPreBoundary = currentOpenTag;
12860 const props = currentOpenTag.props;
12861 for (let i = 0; i < props.length; i++) {
12862 if (props[i].type === 7) {
12863 props[i] = dirToAttr(props[i]);
12864 }
12865 }
12866 }
12867 }
12868 },
12869 ondirarg(start, end) {
12870 if (start === end)
12871 return;
12872 const arg = getSlice(start, end);
12873 if (inVPre) {
12874 currentProp.name += arg;
12875 setLocEnd(currentProp.nameLoc, end);
12876 } else {
12877 const isStatic = arg[0] !== `[`;
12878 currentProp.arg = createExp(
12879 isStatic ? arg : arg.slice(1, -1),
12880 isStatic,
12881 getLoc(start, end),
12882 isStatic ? 3 : 0
12883 );
12884 }
12885 },
12886 ondirmodifier(start, end) {
12887 const mod = getSlice(start, end);
12888 if (inVPre) {
12889 currentProp.name += "." + mod;
12890 setLocEnd(currentProp.nameLoc, end);
12891 } else if (currentProp.name === "slot") {
12892 const arg = currentProp.arg;
12893 if (arg) {
12894 arg.content += "." + mod;
12895 setLocEnd(arg.loc, end);
12896 }
12897 } else {
12898 currentProp.modifiers.push(mod);
12899 }
12900 },
12901 onattribdata(start, end) {
12902 currentAttrValue += getSlice(start, end);
12903 if (currentAttrStartIndex < 0)
12904 currentAttrStartIndex = start;
12905 currentAttrEndIndex = end;
12906 },
12907 onattribentity(char, start, end) {
12908 currentAttrValue += char;
12909 if (currentAttrStartIndex < 0)
12910 currentAttrStartIndex = start;
12911 currentAttrEndIndex = end;
12912 },
12913 onattribnameend(end) {
12914 const start = currentProp.loc.start.offset;
12915 const name = getSlice(start, end);
12916 if (currentProp.type === 7) {
12917 currentProp.rawName = name;
12918 }
12919 if (currentOpenTag.props.some(
12920 (p) => (p.type === 7 ? p.rawName : p.name) === name
12921 )) {
12922 emitError(2, start);
12923 }
12924 },
12925 onattribend(quote, end) {
12926 if (currentOpenTag && currentProp) {
12927 setLocEnd(currentProp.loc, end);
12928 if (quote !== 0) {
12929 if (currentAttrValue.includes("&")) {
12930 currentAttrValue = currentOptions.decodeEntities(
12931 currentAttrValue,
12932 true
12933 );
12934 }
12935 if (currentProp.type === 6) {
12936 if (currentProp.name === "class") {
12937 currentAttrValue = condense(currentAttrValue).trim();
12938 }
12939 if (quote === 1 && !currentAttrValue) {
12940 emitError(13, end);
12941 }
12942 currentProp.value = {
12943 type: 2,
12944 content: currentAttrValue,
12945 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
12946 };
12947 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
12948 tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
12949 }
12950 } else {
12951 let expParseMode = 0 /* Normal */;
12952 currentProp.exp = createExp(
12953 currentAttrValue,
12954 false,
12955 getLoc(currentAttrStartIndex, currentAttrEndIndex),
12956 0,
12957 expParseMode
12958 );
12959 if (currentProp.name === "for") {
12960 currentProp.forParseResult = parseForExpression(currentProp.exp);
12961 }
12962 }
12963 }
12964 if (currentProp.type !== 7 || currentProp.name !== "pre") {
12965 currentOpenTag.props.push(currentProp);
12966 }
12967 }
12968 currentAttrValue = "";
12969 currentAttrStartIndex = currentAttrEndIndex = -1;
12970 },
12971 oncomment(start, end) {
12972 if (currentOptions.comments) {
12973 addNode({
12974 type: 3,
12975 content: getSlice(start, end),
12976 loc: getLoc(start - 4, end + 3)
12977 });
12978 }
12979 },
12980 onend() {
12981 const end = currentInput.length;
12982 if (tokenizer.state !== 1) {
12983 switch (tokenizer.state) {
12984 case 5:
12985 case 8:
12986 emitError(5, end);
12987 break;
12988 case 3:
12989 case 4:
12990 emitError(
12991 25,
12992 tokenizer.sectionStart
12993 );
12994 break;
12995 case 28:
12996 if (tokenizer.currentSequence === Sequences.CdataEnd) {
12997 emitError(6, end);
12998 } else {
12999 emitError(7, end);
13000 }
13001 break;
13002 case 6:
13003 case 7:
13004 case 9:
13005 case 11:
13006 case 12:
13007 case 13:
13008 case 14:
13009 case 15:
13010 case 16:
13011 case 17:
13012 case 18:
13013 case 19:
13014 case 20:
13015 case 21:
13016 emitError(9, end);
13017 break;
13018 }
13019 }
13020 for (let index = 0; index < stack.length; index++) {
13021 onCloseTag(stack[index], end - 1);
13022 emitError(24, stack[index].loc.start.offset);
13023 }
13024 },
13025 oncdata(start, end) {
13026 if (stack[0].ns !== 0) {
13027 onText(getSlice(start, end), start, end);
13028 } else {
13029 emitError(1, start - 9);
13030 }
13031 },
13032 onprocessinginstruction(start) {
13033 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
13034 emitError(
13035 21,
13036 start - 1
13037 );
13038 }
13039 }
13040});
13041const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
13042const stripParensRE = /^\(|\)$/g;
13043function parseForExpression(input) {
13044 const loc = input.loc;
13045 const exp = input.content;
13046 const inMatch = exp.match(forAliasRE);
13047 if (!inMatch)
13048 return;
13049 const [, LHS, RHS] = inMatch;
13050 const createAliasExpression = (content, offset, asParam = false) => {
13051 const start = loc.start.offset + offset;
13052 const end = start + content.length;
13053 return createExp(
13054 content,
13055 false,
13056 getLoc(start, end),
13057 0,
13058 asParam ? 1 /* Params */ : 0 /* Normal */
13059 );
13060 };
13061 const result = {
13062 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
13063 value: void 0,
13064 key: void 0,
13065 index: void 0,
13066 finalized: false
13067 };
13068 let valueContent = LHS.trim().replace(stripParensRE, "").trim();
13069 const trimmedOffset = LHS.indexOf(valueContent);
13070 const iteratorMatch = valueContent.match(forIteratorRE);
13071 if (iteratorMatch) {
13072 valueContent = valueContent.replace(forIteratorRE, "").trim();
13073 const keyContent = iteratorMatch[1].trim();
13074 let keyOffset;
13075 if (keyContent) {
13076 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
13077 result.key = createAliasExpression(keyContent, keyOffset, true);
13078 }
13079 if (iteratorMatch[2]) {
13080 const indexContent = iteratorMatch[2].trim();
13081 if (indexContent) {
13082 result.index = createAliasExpression(
13083 indexContent,
13084 exp.indexOf(
13085 indexContent,
13086 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
13087 ),
13088 true
13089 );
13090 }
13091 }
13092 }
13093 if (valueContent) {
13094 result.value = createAliasExpression(valueContent, trimmedOffset, true);
13095 }
13096 return result;
13097}
13098function getSlice(start, end) {
13099 return currentInput.slice(start, end);
13100}
13101function endOpenTag(end) {
13102 if (tokenizer.inSFCRoot) {
13103 currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
13104 }
13105 addNode(currentOpenTag);
13106 const { tag, ns } = currentOpenTag;
13107 if (ns === 0 && currentOptions.isPreTag(tag)) {
13108 inPre++;
13109 }
13110 if (currentOptions.isVoidTag(tag)) {
13111 onCloseTag(currentOpenTag, end);
13112 } else {
13113 stack.unshift(currentOpenTag);
13114 if (ns === 1 || ns === 2) {
13115 tokenizer.inXML = true;
13116 }
13117 }
13118 currentOpenTag = null;
13119}
13120function onText(content, start, end) {
13121 var _a;
13122 {
13123 const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
13124 if (tag !== "script" && tag !== "style" && content.includes("&")) {
13125 content = currentOptions.decodeEntities(content, false);
13126 }
13127 }
13128 const parent = stack[0] || currentRoot;
13129 const lastNode = parent.children[parent.children.length - 1];
13130 if ((lastNode == null ? void 0 : lastNode.type) === 2) {
13131 lastNode.content += content;
13132 setLocEnd(lastNode.loc, end);
13133 } else {
13134 parent.children.push({
13135 type: 2,
13136 content,
13137 loc: getLoc(start, end)
13138 });
13139 }
13140}
13141function onCloseTag(el, end, isImplied = false) {
13142 if (isImplied) {
13143 setLocEnd(el.loc, backTrack(end, 60));
13144 } else {
13145 setLocEnd(el.loc, lookAhead(end, 62) + 1);
13146 }
13147 if (tokenizer.inSFCRoot) {
13148 if (el.children.length) {
13149 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
13150 } else {
13151 el.innerLoc.end = extend({}, el.innerLoc.start);
13152 }
13153 el.innerLoc.source = getSlice(
13154 el.innerLoc.start.offset,
13155 el.innerLoc.end.offset
13156 );
13157 }
13158 const { tag, ns } = el;
13159 if (!inVPre) {
13160 if (tag === "slot") {
13161 el.tagType = 2;
13162 } else if (isFragmentTemplate(el)) {
13163 el.tagType = 3;
13164 } else if (isComponent(el)) {
13165 el.tagType = 1;
13166 }
13167 }
13168 if (!tokenizer.inRCDATA) {
13169 el.children = condenseWhitespace(el.children, el.tag);
13170 }
13171 if (ns === 0 && currentOptions.isPreTag(tag)) {
13172 inPre--;
13173 }
13174 if (currentVPreBoundary === el) {
13175 inVPre = tokenizer.inVPre = false;
13176 currentVPreBoundary = null;
13177 }
13178 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
13179 tokenizer.inXML = false;
13180 }
13181}
13182function lookAhead(index, c) {
13183 let i = index;
13184 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13185 i++;
13186 return i;
13187}
13188function backTrack(index, c) {
13189 let i = index;
13190 while (currentInput.charCodeAt(i) !== c && i >= 0)
13191 i--;
13192 return i;
13193}
13194const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
13195function isFragmentTemplate({ tag, props }) {
13196 if (tag === "template") {
13197 for (let i = 0; i < props.length; i++) {
13198 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
13199 return true;
13200 }
13201 }
13202 }
13203 return false;
13204}
13205function isComponent({ tag, props }) {
13206 var _a;
13207 if (currentOptions.isCustomElement(tag)) {
13208 return false;
13209 }
13210 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13211 return true;
13212 }
13213 for (let i = 0; i < props.length; i++) {
13214 const p = props[i];
13215 if (p.type === 6) {
13216 if (p.name === "is" && p.value) {
13217 if (p.value.content.startsWith("vue:")) {
13218 return true;
13219 }
13220 }
13221 }
13222 }
13223 return false;
13224}
13225function isUpperCase(c) {
13226 return c > 64 && c < 91;
13227}
13228const windowsNewlineRE = /\r\n/g;
13229function condenseWhitespace(nodes, tag) {
13230 var _a, _b;
13231 const shouldCondense = currentOptions.whitespace !== "preserve";
13232 let removedWhitespace = false;
13233 for (let i = 0; i < nodes.length; i++) {
13234 const node = nodes[i];
13235 if (node.type === 2) {
13236 if (!inPre) {
13237 if (isAllWhitespace(node.content)) {
13238 const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
13239 const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
13240 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
13241 removedWhitespace = true;
13242 nodes[i] = null;
13243 } else {
13244 node.content = " ";
13245 }
13246 } else if (shouldCondense) {
13247 node.content = condense(node.content);
13248 }
13249 } else {
13250 node.content = node.content.replace(windowsNewlineRE, "\n");
13251 }
13252 }
13253 }
13254 if (inPre && tag && currentOptions.isPreTag(tag)) {
13255 const first = nodes[0];
13256 if (first && first.type === 2) {
13257 first.content = first.content.replace(/^\r?\n/, "");
13258 }
13259 }
13260 return removedWhitespace ? nodes.filter(Boolean) : nodes;
13261}
13262function isAllWhitespace(str) {
13263 for (let i = 0; i < str.length; i++) {
13264 if (!isWhitespace(str.charCodeAt(i))) {
13265 return false;
13266 }
13267 }
13268 return true;
13269}
13270function hasNewlineChar(str) {
13271 for (let i = 0; i < str.length; i++) {
13272 const c = str.charCodeAt(i);
13273 if (c === 10 || c === 13) {
13274 return true;
13275 }
13276 }
13277 return false;
13278}
13279function condense(str) {
13280 let ret = "";
13281 let prevCharIsWhitespace = false;
13282 for (let i = 0; i < str.length; i++) {
13283 if (isWhitespace(str.charCodeAt(i))) {
13284 if (!prevCharIsWhitespace) {
13285 ret += " ";
13286 prevCharIsWhitespace = true;
13287 }
13288 } else {
13289 ret += str[i];
13290 prevCharIsWhitespace = false;
13291 }
13292 }
13293 return ret;
13294}
13295function addNode(node) {
13296 (stack[0] || currentRoot).children.push(node);
13297}
13298function getLoc(start, end) {
13299 return {
13300 start: tokenizer.getPos(start),
13301 // @ts-expect-error allow late attachment
13302 end: end == null ? end : tokenizer.getPos(end),
13303 // @ts-expect-error allow late attachment
13304 source: end == null ? end : getSlice(start, end)
13305 };
13306}
13307function setLocEnd(loc, end) {
13308 loc.end = tokenizer.getPos(end);
13309 loc.source = getSlice(loc.start.offset, end);
13310}
13311function dirToAttr(dir) {
13312 const attr = {
13313 type: 6,
13314 name: dir.rawName,
13315 nameLoc: getLoc(
13316 dir.loc.start.offset,
13317 dir.loc.start.offset + dir.rawName.length
13318 ),
13319 value: void 0,
13320 loc: dir.loc
13321 };
13322 if (dir.exp) {
13323 const loc = dir.exp.loc;
13324 if (loc.end.offset < dir.loc.end.offset) {
13325 loc.start.offset--;
13326 loc.start.column--;
13327 loc.end.offset++;
13328 loc.end.column++;
13329 }
13330 attr.value = {
13331 type: 2,
13332 content: dir.exp.content,
13333 loc
13334 };
13335 }
13336 return attr;
13337}
13338function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
13339 const exp = createSimpleExpression(content, isStatic, loc, constType);
13340 return exp;
13341}
13342function emitError(code, index, message) {
13343 currentOptions.onError(
13344 createCompilerError(code, getLoc(index, index), void 0, message)
13345 );
13346}
13347function reset() {
13348 tokenizer.reset();
13349 currentOpenTag = null;
13350 currentProp = null;
13351 currentAttrValue = "";
13352 currentAttrStartIndex = -1;
13353 currentAttrEndIndex = -1;
13354 stack.length = 0;
13355}
13356function baseParse(input, options) {
13357 reset();
13358 currentInput = input;
13359 currentOptions = extend({}, defaultParserOptions);
13360 if (options) {
13361 let key;
13362 for (key in options) {
13363 if (options[key] != null) {
13364 currentOptions[key] = options[key];
13365 }
13366 }
13367 }
13368 {
13369 if (!currentOptions.decodeEntities) {
13370 throw new Error(
13371 `[@vue/compiler-core] decodeEntities option is required in browser builds.`
13372 );
13373 }
13374 }
13375 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
13376 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
13377 const delimiters = options == null ? void 0 : options.delimiters;
13378 if (delimiters) {
13379 tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
13380 tokenizer.delimiterClose = toCharCodes(delimiters[1]);
13381 }
13382 const root = currentRoot = createRoot([], input);
13383 tokenizer.parse(currentInput);
13384 root.loc = getLoc(0, input.length);
13385 root.children = condenseWhitespace(root.children);
13386 currentRoot = null;
13387 return root;
13388}
13389
13390function hoistStatic(root, context) {
13391 walk(
13392 root,
13393 context,
13394 // Root node is unfortunately non-hoistable due to potential parent
13395 // fallthrough attributes.
13396 isSingleElementRoot(root, root.children[0])
13397 );
13398}
13399function isSingleElementRoot(root, child) {
13400 const { children } = root;
13401 return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
13402}
13403function walk(node, context, doNotHoistNode = false) {
13404 const { children } = node;
13405 const originalCount = children.length;
13406 let hoistedCount = 0;
13407 for (let i = 0; i < children.length; i++) {
13408 const child = children[i];
13409 if (child.type === 1 && child.tagType === 0) {
13410 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
13411 if (constantType > 0) {
13412 if (constantType >= 2) {
13413 child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
13414 child.codegenNode = context.hoist(child.codegenNode);
13415 hoistedCount++;
13416 continue;
13417 }
13418 } else {
13419 const codegenNode = child.codegenNode;
13420 if (codegenNode.type === 13) {
13421 const flag = getPatchFlag(codegenNode);
13422 if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13423 const props = getNodeProps(child);
13424 if (props) {
13425 codegenNode.props = context.hoist(props);
13426 }
13427 }
13428 if (codegenNode.dynamicProps) {
13429 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
13430 }
13431 }
13432 }
13433 }
13434 if (child.type === 1) {
13435 const isComponent = child.tagType === 1;
13436 if (isComponent) {
13437 context.scopes.vSlot++;
13438 }
13439 walk(child, context);
13440 if (isComponent) {
13441 context.scopes.vSlot--;
13442 }
13443 } else if (child.type === 11) {
13444 walk(child, context, child.children.length === 1);
13445 } else if (child.type === 9) {
13446 for (let i2 = 0; i2 < child.branches.length; i2++) {
13447 walk(
13448 child.branches[i2],
13449 context,
13450 child.branches[i2].children.length === 1
13451 );
13452 }
13453 }
13454 }
13455 if (hoistedCount && context.transformHoist) {
13456 context.transformHoist(children, context, node);
13457 }
13458 if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
13459 const hoisted = context.hoist(
13460 createArrayExpression(node.codegenNode.children)
13461 );
13462 if (context.hmr) {
13463 hoisted.content = `[...${hoisted.content}]`;
13464 }
13465 node.codegenNode.children = hoisted;
13466 }
13467}
13468function getConstantType(node, context) {
13469 const { constantCache } = context;
13470 switch (node.type) {
13471 case 1:
13472 if (node.tagType !== 0) {
13473 return 0;
13474 }
13475 const cached = constantCache.get(node);
13476 if (cached !== void 0) {
13477 return cached;
13478 }
13479 const codegenNode = node.codegenNode;
13480 if (codegenNode.type !== 13) {
13481 return 0;
13482 }
13483 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
13484 return 0;
13485 }
13486 const flag = getPatchFlag(codegenNode);
13487 if (!flag) {
13488 let returnType2 = 3;
13489 const generatedPropsType = getGeneratedPropsConstantType(node, context);
13490 if (generatedPropsType === 0) {
13491 constantCache.set(node, 0);
13492 return 0;
13493 }
13494 if (generatedPropsType < returnType2) {
13495 returnType2 = generatedPropsType;
13496 }
13497 for (let i = 0; i < node.children.length; i++) {
13498 const childType = getConstantType(node.children[i], context);
13499 if (childType === 0) {
13500 constantCache.set(node, 0);
13501 return 0;
13502 }
13503 if (childType < returnType2) {
13504 returnType2 = childType;
13505 }
13506 }
13507 if (returnType2 > 1) {
13508 for (let i = 0; i < node.props.length; i++) {
13509 const p = node.props[i];
13510 if (p.type === 7 && p.name === "bind" && p.exp) {
13511 const expType = getConstantType(p.exp, context);
13512 if (expType === 0) {
13513 constantCache.set(node, 0);
13514 return 0;
13515 }
13516 if (expType < returnType2) {
13517 returnType2 = expType;
13518 }
13519 }
13520 }
13521 }
13522 if (codegenNode.isBlock) {
13523 for (let i = 0; i < node.props.length; i++) {
13524 const p = node.props[i];
13525 if (p.type === 7) {
13526 constantCache.set(node, 0);
13527 return 0;
13528 }
13529 }
13530 context.removeHelper(OPEN_BLOCK);
13531 context.removeHelper(
13532 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
13533 );
13534 codegenNode.isBlock = false;
13535 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
13536 }
13537 constantCache.set(node, returnType2);
13538 return returnType2;
13539 } else {
13540 constantCache.set(node, 0);
13541 return 0;
13542 }
13543 case 2:
13544 case 3:
13545 return 3;
13546 case 9:
13547 case 11:
13548 case 10:
13549 return 0;
13550 case 5:
13551 case 12:
13552 return getConstantType(node.content, context);
13553 case 4:
13554 return node.constType;
13555 case 8:
13556 let returnType = 3;
13557 for (let i = 0; i < node.children.length; i++) {
13558 const child = node.children[i];
13559 if (isString(child) || isSymbol(child)) {
13560 continue;
13561 }
13562 const childType = getConstantType(child, context);
13563 if (childType === 0) {
13564 return 0;
13565 } else if (childType < returnType) {
13566 returnType = childType;
13567 }
13568 }
13569 return returnType;
13570 default:
13571 return 0;
13572 }
13573}
13574const allowHoistedHelperSet = /* @__PURE__ */ new Set([
13575 NORMALIZE_CLASS,
13576 NORMALIZE_STYLE,
13577 NORMALIZE_PROPS,
13578 GUARD_REACTIVE_PROPS
13579]);
13580function getConstantTypeOfHelperCall(value, context) {
13581 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
13582 const arg = value.arguments[0];
13583 if (arg.type === 4) {
13584 return getConstantType(arg, context);
13585 } else if (arg.type === 14) {
13586 return getConstantTypeOfHelperCall(arg, context);
13587 }
13588 }
13589 return 0;
13590}
13591function getGeneratedPropsConstantType(node, context) {
13592 let returnType = 3;
13593 const props = getNodeProps(node);
13594 if (props && props.type === 15) {
13595 const { properties } = props;
13596 for (let i = 0; i < properties.length; i++) {
13597 const { key, value } = properties[i];
13598 const keyType = getConstantType(key, context);
13599 if (keyType === 0) {
13600 return keyType;
13601 }
13602 if (keyType < returnType) {
13603 returnType = keyType;
13604 }
13605 let valueType;
13606 if (value.type === 4) {
13607 valueType = getConstantType(value, context);
13608 } else if (value.type === 14) {
13609 valueType = getConstantTypeOfHelperCall(value, context);
13610 } else {
13611 valueType = 0;
13612 }
13613 if (valueType === 0) {
13614 return valueType;
13615 }
13616 if (valueType < returnType) {
13617 returnType = valueType;
13618 }
13619 }
13620 }
13621 return returnType;
13622}
13623function getNodeProps(node) {
13624 const codegenNode = node.codegenNode;
13625 if (codegenNode.type === 13) {
13626 return codegenNode.props;
13627 }
13628}
13629function getPatchFlag(node) {
13630 const flag = node.patchFlag;
13631 return flag ? parseInt(flag, 10) : void 0;
13632}
13633
13634function createTransformContext(root, {
13635 filename = "",
13636 prefixIdentifiers = false,
13637 hoistStatic: hoistStatic2 = false,
13638 hmr = false,
13639 cacheHandlers = false,
13640 nodeTransforms = [],
13641 directiveTransforms = {},
13642 transformHoist = null,
13643 isBuiltInComponent = NOOP,
13644 isCustomElement = NOOP,
13645 expressionPlugins = [],
13646 scopeId = null,
13647 slotted = true,
13648 ssr = false,
13649 inSSR = false,
13650 ssrCssVars = ``,
13651 bindingMetadata = EMPTY_OBJ,
13652 inline = false,
13653 isTS = false,
13654 onError = defaultOnError,
13655 onWarn = defaultOnWarn,
13656 compatConfig
13657}) {
13658 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
13659 const context = {
13660 // options
13661 filename,
13662 selfName: nameMatch && capitalize(camelize(nameMatch[1])),
13663 prefixIdentifiers,
13664 hoistStatic: hoistStatic2,
13665 hmr,
13666 cacheHandlers,
13667 nodeTransforms,
13668 directiveTransforms,
13669 transformHoist,
13670 isBuiltInComponent,
13671 isCustomElement,
13672 expressionPlugins,
13673 scopeId,
13674 slotted,
13675 ssr,
13676 inSSR,
13677 ssrCssVars,
13678 bindingMetadata,
13679 inline,
13680 isTS,
13681 onError,
13682 onWarn,
13683 compatConfig,
13684 // state
13685 root,
13686 helpers: /* @__PURE__ */ new Map(),
13687 components: /* @__PURE__ */ new Set(),
13688 directives: /* @__PURE__ */ new Set(),
13689 hoists: [],
13690 imports: [],
13691 constantCache: /* @__PURE__ */ new WeakMap(),
13692 temps: 0,
13693 cached: 0,
13694 identifiers: /* @__PURE__ */ Object.create(null),
13695 scopes: {
13696 vFor: 0,
13697 vSlot: 0,
13698 vPre: 0,
13699 vOnce: 0
13700 },
13701 parent: null,
13702 grandParent: null,
13703 currentNode: root,
13704 childIndex: 0,
13705 inVOnce: false,
13706 // methods
13707 helper(name) {
13708 const count = context.helpers.get(name) || 0;
13709 context.helpers.set(name, count + 1);
13710 return name;
13711 },
13712 removeHelper(name) {
13713 const count = context.helpers.get(name);
13714 if (count) {
13715 const currentCount = count - 1;
13716 if (!currentCount) {
13717 context.helpers.delete(name);
13718 } else {
13719 context.helpers.set(name, currentCount);
13720 }
13721 }
13722 },
13723 helperString(name) {
13724 return `_${helperNameMap[context.helper(name)]}`;
13725 },
13726 replaceNode(node) {
13727 {
13728 if (!context.currentNode) {
13729 throw new Error(`Node being replaced is already removed.`);
13730 }
13731 if (!context.parent) {
13732 throw new Error(`Cannot replace root node.`);
13733 }
13734 }
13735 context.parent.children[context.childIndex] = context.currentNode = node;
13736 },
13737 removeNode(node) {
13738 if (!context.parent) {
13739 throw new Error(`Cannot remove root node.`);
13740 }
13741 const list = context.parent.children;
13742 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
13743 if (removalIndex < 0) {
13744 throw new Error(`node being removed is not a child of current parent`);
13745 }
13746 if (!node || node === context.currentNode) {
13747 context.currentNode = null;
13748 context.onNodeRemoved();
13749 } else {
13750 if (context.childIndex > removalIndex) {
13751 context.childIndex--;
13752 context.onNodeRemoved();
13753 }
13754 }
13755 context.parent.children.splice(removalIndex, 1);
13756 },
13757 onNodeRemoved: NOOP,
13758 addIdentifiers(exp) {
13759 },
13760 removeIdentifiers(exp) {
13761 },
13762 hoist(exp) {
13763 if (isString(exp))
13764 exp = createSimpleExpression(exp);
13765 context.hoists.push(exp);
13766 const identifier = createSimpleExpression(
13767 `_hoisted_${context.hoists.length}`,
13768 false,
13769 exp.loc,
13770 2
13771 );
13772 identifier.hoisted = exp;
13773 return identifier;
13774 },
13775 cache(exp, isVNode = false) {
13776 return createCacheExpression(context.cached++, exp, isVNode);
13777 }
13778 };
13779 return context;
13780}
13781function transform(root, options) {
13782 const context = createTransformContext(root, options);
13783 traverseNode(root, context);
13784 if (options.hoistStatic) {
13785 hoistStatic(root, context);
13786 }
13787 if (!options.ssr) {
13788 createRootCodegen(root, context);
13789 }
13790 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
13791 root.components = [...context.components];
13792 root.directives = [...context.directives];
13793 root.imports = context.imports;
13794 root.hoists = context.hoists;
13795 root.temps = context.temps;
13796 root.cached = context.cached;
13797 root.transformed = true;
13798}
13799function createRootCodegen(root, context) {
13800 const { helper } = context;
13801 const { children } = root;
13802 if (children.length === 1) {
13803 const child = children[0];
13804 if (isSingleElementRoot(root, child) && child.codegenNode) {
13805 const codegenNode = child.codegenNode;
13806 if (codegenNode.type === 13) {
13807 convertToBlock(codegenNode, context);
13808 }
13809 root.codegenNode = codegenNode;
13810 } else {
13811 root.codegenNode = child;
13812 }
13813 } else if (children.length > 1) {
13814 let patchFlag = 64;
13815 let patchFlagText = PatchFlagNames[64];
13816 if (children.filter((c) => c.type !== 3).length === 1) {
13817 patchFlag |= 2048;
13818 patchFlagText += `, ${PatchFlagNames[2048]}`;
13819 }
13820 root.codegenNode = createVNodeCall(
13821 context,
13822 helper(FRAGMENT),
13823 void 0,
13824 root.children,
13825 patchFlag + (` /* ${patchFlagText} */` ),
13826 void 0,
13827 void 0,
13828 true,
13829 void 0,
13830 false
13831 );
13832 } else ;
13833}
13834function traverseChildren(parent, context) {
13835 let i = 0;
13836 const nodeRemoved = () => {
13837 i--;
13838 };
13839 for (; i < parent.children.length; i++) {
13840 const child = parent.children[i];
13841 if (isString(child))
13842 continue;
13843 context.grandParent = context.parent;
13844 context.parent = parent;
13845 context.childIndex = i;
13846 context.onNodeRemoved = nodeRemoved;
13847 traverseNode(child, context);
13848 }
13849}
13850function traverseNode(node, context) {
13851 context.currentNode = node;
13852 const { nodeTransforms } = context;
13853 const exitFns = [];
13854 for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
13855 const onExit = nodeTransforms[i2](node, context);
13856 if (onExit) {
13857 if (isArray(onExit)) {
13858 exitFns.push(...onExit);
13859 } else {
13860 exitFns.push(onExit);
13861 }
13862 }
13863 if (!context.currentNode) {
13864 return;
13865 } else {
13866 node = context.currentNode;
13867 }
13868 }
13869 switch (node.type) {
13870 case 3:
13871 if (!context.ssr) {
13872 context.helper(CREATE_COMMENT);
13873 }
13874 break;
13875 case 5:
13876 if (!context.ssr) {
13877 context.helper(TO_DISPLAY_STRING);
13878 }
13879 break;
13880 case 9:
13881 for (let i2 = 0; i2 < node.branches.length; i2++) {
13882 traverseNode(node.branches[i2], context);
13883 }
13884 break;
13885 case 10:
13886 case 11:
13887 case 1:
13888 case 0:
13889 traverseChildren(node, context);
13890 break;
13891 }
13892 context.currentNode = node;
13893 let i = exitFns.length;
13894 while (i--) {
13895 exitFns[i]();
13896 }
13897}
13898function createStructuralDirectiveTransform(name, fn) {
13899 const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
13900 return (node, context) => {
13901 if (node.type === 1) {
13902 const { props } = node;
13903 if (node.tagType === 3 && props.some(isVSlot)) {
13904 return;
13905 }
13906 const exitFns = [];
13907 for (let i = 0; i < props.length; i++) {
13908 const prop = props[i];
13909 if (prop.type === 7 && matches(prop.name)) {
13910 props.splice(i, 1);
13911 i--;
13912 const onExit = fn(node, prop, context);
13913 if (onExit)
13914 exitFns.push(onExit);
13915 }
13916 }
13917 return exitFns;
13918 }
13919 };
13920}
13921
13922const PURE_ANNOTATION = `/*#__PURE__*/`;
13923const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
13924function createCodegenContext(ast, {
13925 mode = "function",
13926 prefixIdentifiers = mode === "module",
13927 sourceMap = false,
13928 filename = `template.vue.html`,
13929 scopeId = null,
13930 optimizeImports = false,
13931 runtimeGlobalName = `Vue`,
13932 runtimeModuleName = `vue`,
13933 ssrRuntimeModuleName = "vue/server-renderer",
13934 ssr = false,
13935 isTS = false,
13936 inSSR = false
13937}) {
13938 const context = {
13939 mode,
13940 prefixIdentifiers,
13941 sourceMap,
13942 filename,
13943 scopeId,
13944 optimizeImports,
13945 runtimeGlobalName,
13946 runtimeModuleName,
13947 ssrRuntimeModuleName,
13948 ssr,
13949 isTS,
13950 inSSR,
13951 source: ast.source,
13952 code: ``,
13953 column: 1,
13954 line: 1,
13955 offset: 0,
13956 indentLevel: 0,
13957 pure: false,
13958 map: void 0,
13959 helper(key) {
13960 return `_${helperNameMap[key]}`;
13961 },
13962 push(code, newlineIndex = -2 /* None */, node) {
13963 context.code += code;
13964 },
13965 indent() {
13966 newline(++context.indentLevel);
13967 },
13968 deindent(withoutNewLine = false) {
13969 if (withoutNewLine) {
13970 --context.indentLevel;
13971 } else {
13972 newline(--context.indentLevel);
13973 }
13974 },
13975 newline() {
13976 newline(context.indentLevel);
13977 }
13978 };
13979 function newline(n) {
13980 context.push("\n" + ` `.repeat(n), 0 /* Start */);
13981 }
13982 return context;
13983}
13984function generate(ast, options = {}) {
13985 const context = createCodegenContext(ast, options);
13986 if (options.onContextCreated)
13987 options.onContextCreated(context);
13988 const {
13989 mode,
13990 push,
13991 prefixIdentifiers,
13992 indent,
13993 deindent,
13994 newline,
13995 scopeId,
13996 ssr
13997 } = context;
13998 const helpers = Array.from(ast.helpers);
13999 const hasHelpers = helpers.length > 0;
14000 const useWithBlock = !prefixIdentifiers && mode !== "module";
14001 const preambleContext = context;
14002 {
14003 genFunctionPreamble(ast, preambleContext);
14004 }
14005 const functionName = ssr ? `ssrRender` : `render`;
14006 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
14007 const signature = args.join(", ");
14008 {
14009 push(`function ${functionName}(${signature}) {`);
14010 }
14011 indent();
14012 if (useWithBlock) {
14013 push(`with (_ctx) {`);
14014 indent();
14015 if (hasHelpers) {
14016 push(
14017 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
14018`,
14019 -1 /* End */
14020 );
14021 newline();
14022 }
14023 }
14024 if (ast.components.length) {
14025 genAssets(ast.components, "component", context);
14026 if (ast.directives.length || ast.temps > 0) {
14027 newline();
14028 }
14029 }
14030 if (ast.directives.length) {
14031 genAssets(ast.directives, "directive", context);
14032 if (ast.temps > 0) {
14033 newline();
14034 }
14035 }
14036 if (ast.temps > 0) {
14037 push(`let `);
14038 for (let i = 0; i < ast.temps; i++) {
14039 push(`${i > 0 ? `, ` : ``}_temp${i}`);
14040 }
14041 }
14042 if (ast.components.length || ast.directives.length || ast.temps) {
14043 push(`
14044`, 0 /* Start */);
14045 newline();
14046 }
14047 if (!ssr) {
14048 push(`return `);
14049 }
14050 if (ast.codegenNode) {
14051 genNode(ast.codegenNode, context);
14052 } else {
14053 push(`null`);
14054 }
14055 if (useWithBlock) {
14056 deindent();
14057 push(`}`);
14058 }
14059 deindent();
14060 push(`}`);
14061 return {
14062 ast,
14063 code: context.code,
14064 preamble: ``,
14065 map: context.map ? context.map.toJSON() : void 0
14066 };
14067}
14068function genFunctionPreamble(ast, context) {
14069 const {
14070 ssr,
14071 prefixIdentifiers,
14072 push,
14073 newline,
14074 runtimeModuleName,
14075 runtimeGlobalName,
14076 ssrRuntimeModuleName
14077 } = context;
14078 const VueBinding = runtimeGlobalName;
14079 const helpers = Array.from(ast.helpers);
14080 if (helpers.length > 0) {
14081 {
14082 push(`const _Vue = ${VueBinding}
14083`, -1 /* End */);
14084 if (ast.hoists.length) {
14085 const staticHelpers = [
14086 CREATE_VNODE,
14087 CREATE_ELEMENT_VNODE,
14088 CREATE_COMMENT,
14089 CREATE_TEXT,
14090 CREATE_STATIC
14091 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
14092 push(`const { ${staticHelpers} } = _Vue
14093`, -1 /* End */);
14094 }
14095 }
14096 }
14097 genHoists(ast.hoists, context);
14098 newline();
14099 push(`return `);
14100}
14101function genAssets(assets, type, { helper, push, newline, isTS }) {
14102 const resolver = helper(
14103 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
14104 );
14105 for (let i = 0; i < assets.length; i++) {
14106 let id = assets[i];
14107 const maybeSelfReference = id.endsWith("__self");
14108 if (maybeSelfReference) {
14109 id = id.slice(0, -6);
14110 }
14111 push(
14112 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
14113 );
14114 if (i < assets.length - 1) {
14115 newline();
14116 }
14117 }
14118}
14119function genHoists(hoists, context) {
14120 if (!hoists.length) {
14121 return;
14122 }
14123 context.pure = true;
14124 const { push, newline, helper, scopeId, mode } = context;
14125 newline();
14126 for (let i = 0; i < hoists.length; i++) {
14127 const exp = hoists[i];
14128 if (exp) {
14129 push(
14130 `const _hoisted_${i + 1} = ${``}`
14131 );
14132 genNode(exp, context);
14133 newline();
14134 }
14135 }
14136 context.pure = false;
14137}
14138function isText(n) {
14139 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
14140}
14141function genNodeListAsArray(nodes, context) {
14142 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
14143 context.push(`[`);
14144 multilines && context.indent();
14145 genNodeList(nodes, context, multilines);
14146 multilines && context.deindent();
14147 context.push(`]`);
14148}
14149function genNodeList(nodes, context, multilines = false, comma = true) {
14150 const { push, newline } = context;
14151 for (let i = 0; i < nodes.length; i++) {
14152 const node = nodes[i];
14153 if (isString(node)) {
14154 push(node, -3 /* Unknown */);
14155 } else if (isArray(node)) {
14156 genNodeListAsArray(node, context);
14157 } else {
14158 genNode(node, context);
14159 }
14160 if (i < nodes.length - 1) {
14161 if (multilines) {
14162 comma && push(",");
14163 newline();
14164 } else {
14165 comma && push(", ");
14166 }
14167 }
14168 }
14169}
14170function genNode(node, context) {
14171 if (isString(node)) {
14172 context.push(node, -3 /* Unknown */);
14173 return;
14174 }
14175 if (isSymbol(node)) {
14176 context.push(context.helper(node));
14177 return;
14178 }
14179 switch (node.type) {
14180 case 1:
14181 case 9:
14182 case 11:
14183 assert(
14184 node.codegenNode != null,
14185 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
14186 );
14187 genNode(node.codegenNode, context);
14188 break;
14189 case 2:
14190 genText(node, context);
14191 break;
14192 case 4:
14193 genExpression(node, context);
14194 break;
14195 case 5:
14196 genInterpolation(node, context);
14197 break;
14198 case 12:
14199 genNode(node.codegenNode, context);
14200 break;
14201 case 8:
14202 genCompoundExpression(node, context);
14203 break;
14204 case 3:
14205 genComment(node, context);
14206 break;
14207 case 13:
14208 genVNodeCall(node, context);
14209 break;
14210 case 14:
14211 genCallExpression(node, context);
14212 break;
14213 case 15:
14214 genObjectExpression(node, context);
14215 break;
14216 case 17:
14217 genArrayExpression(node, context);
14218 break;
14219 case 18:
14220 genFunctionExpression(node, context);
14221 break;
14222 case 19:
14223 genConditionalExpression(node, context);
14224 break;
14225 case 20:
14226 genCacheExpression(node, context);
14227 break;
14228 case 21:
14229 genNodeList(node.body, context, true, false);
14230 break;
14231 case 22:
14232 break;
14233 case 23:
14234 break;
14235 case 24:
14236 break;
14237 case 25:
14238 break;
14239 case 26:
14240 break;
14241 case 10:
14242 break;
14243 default:
14244 {
14245 assert(false, `unhandled codegen node type: ${node.type}`);
14246 const exhaustiveCheck = node;
14247 return exhaustiveCheck;
14248 }
14249 }
14250}
14251function genText(node, context) {
14252 context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
14253}
14254function genExpression(node, context) {
14255 const { content, isStatic } = node;
14256 context.push(
14257 isStatic ? JSON.stringify(content) : content,
14258 -3 /* Unknown */,
14259 node
14260 );
14261}
14262function genInterpolation(node, context) {
14263 const { push, helper, pure } = context;
14264 if (pure)
14265 push(PURE_ANNOTATION);
14266 push(`${helper(TO_DISPLAY_STRING)}(`);
14267 genNode(node.content, context);
14268 push(`)`);
14269}
14270function genCompoundExpression(node, context) {
14271 for (let i = 0; i < node.children.length; i++) {
14272 const child = node.children[i];
14273 if (isString(child)) {
14274 context.push(child, -3 /* Unknown */);
14275 } else {
14276 genNode(child, context);
14277 }
14278 }
14279}
14280function genExpressionAsPropertyKey(node, context) {
14281 const { push } = context;
14282 if (node.type === 8) {
14283 push(`[`);
14284 genCompoundExpression(node, context);
14285 push(`]`);
14286 } else if (node.isStatic) {
14287 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
14288 push(text, -2 /* None */, node);
14289 } else {
14290 push(`[${node.content}]`, -3 /* Unknown */, node);
14291 }
14292}
14293function genComment(node, context) {
14294 const { push, helper, pure } = context;
14295 if (pure) {
14296 push(PURE_ANNOTATION);
14297 }
14298 push(
14299 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
14300 -3 /* Unknown */,
14301 node
14302 );
14303}
14304function genVNodeCall(node, context) {
14305 const { push, helper, pure } = context;
14306 const {
14307 tag,
14308 props,
14309 children,
14310 patchFlag,
14311 dynamicProps,
14312 directives,
14313 isBlock,
14314 disableTracking,
14315 isComponent
14316 } = node;
14317 if (directives) {
14318 push(helper(WITH_DIRECTIVES) + `(`);
14319 }
14320 if (isBlock) {
14321 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
14322 }
14323 if (pure) {
14324 push(PURE_ANNOTATION);
14325 }
14326 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
14327 push(helper(callHelper) + `(`, -2 /* None */, node);
14328 genNodeList(
14329 genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
14330 context
14331 );
14332 push(`)`);
14333 if (isBlock) {
14334 push(`)`);
14335 }
14336 if (directives) {
14337 push(`, `);
14338 genNode(directives, context);
14339 push(`)`);
14340 }
14341}
14342function genNullableArgs(args) {
14343 let i = args.length;
14344 while (i--) {
14345 if (args[i] != null)
14346 break;
14347 }
14348 return args.slice(0, i + 1).map((arg) => arg || `null`);
14349}
14350function genCallExpression(node, context) {
14351 const { push, helper, pure } = context;
14352 const callee = isString(node.callee) ? node.callee : helper(node.callee);
14353 if (pure) {
14354 push(PURE_ANNOTATION);
14355 }
14356 push(callee + `(`, -2 /* None */, node);
14357 genNodeList(node.arguments, context);
14358 push(`)`);
14359}
14360function genObjectExpression(node, context) {
14361 const { push, indent, deindent, newline } = context;
14362 const { properties } = node;
14363 if (!properties.length) {
14364 push(`{}`, -2 /* None */, node);
14365 return;
14366 }
14367 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
14368 push(multilines ? `{` : `{ `);
14369 multilines && indent();
14370 for (let i = 0; i < properties.length; i++) {
14371 const { key, value } = properties[i];
14372 genExpressionAsPropertyKey(key, context);
14373 push(`: `);
14374 genNode(value, context);
14375 if (i < properties.length - 1) {
14376 push(`,`);
14377 newline();
14378 }
14379 }
14380 multilines && deindent();
14381 push(multilines ? `}` : ` }`);
14382}
14383function genArrayExpression(node, context) {
14384 genNodeListAsArray(node.elements, context);
14385}
14386function genFunctionExpression(node, context) {
14387 const { push, indent, deindent } = context;
14388 const { params, returns, body, newline, isSlot } = node;
14389 if (isSlot) {
14390 push(`_${helperNameMap[WITH_CTX]}(`);
14391 }
14392 push(`(`, -2 /* None */, node);
14393 if (isArray(params)) {
14394 genNodeList(params, context);
14395 } else if (params) {
14396 genNode(params, context);
14397 }
14398 push(`) => `);
14399 if (newline || body) {
14400 push(`{`);
14401 indent();
14402 }
14403 if (returns) {
14404 if (newline) {
14405 push(`return `);
14406 }
14407 if (isArray(returns)) {
14408 genNodeListAsArray(returns, context);
14409 } else {
14410 genNode(returns, context);
14411 }
14412 } else if (body) {
14413 genNode(body, context);
14414 }
14415 if (newline || body) {
14416 deindent();
14417 push(`}`);
14418 }
14419 if (isSlot) {
14420 push(`)`);
14421 }
14422}
14423function genConditionalExpression(node, context) {
14424 const { test, consequent, alternate, newline: needNewline } = node;
14425 const { push, indent, deindent, newline } = context;
14426 if (test.type === 4) {
14427 const needsParens = !isSimpleIdentifier(test.content);
14428 needsParens && push(`(`);
14429 genExpression(test, context);
14430 needsParens && push(`)`);
14431 } else {
14432 push(`(`);
14433 genNode(test, context);
14434 push(`)`);
14435 }
14436 needNewline && indent();
14437 context.indentLevel++;
14438 needNewline || push(` `);
14439 push(`? `);
14440 genNode(consequent, context);
14441 context.indentLevel--;
14442 needNewline && newline();
14443 needNewline || push(` `);
14444 push(`: `);
14445 const isNested = alternate.type === 19;
14446 if (!isNested) {
14447 context.indentLevel++;
14448 }
14449 genNode(alternate, context);
14450 if (!isNested) {
14451 context.indentLevel--;
14452 }
14453 needNewline && deindent(
14454 true
14455 /* without newline */
14456 );
14457}
14458function genCacheExpression(node, context) {
14459 const { push, helper, indent, deindent, newline } = context;
14460 push(`_cache[${node.index}] || (`);
14461 if (node.isVNode) {
14462 indent();
14463 push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
14464 newline();
14465 }
14466 push(`_cache[${node.index}] = `);
14467 genNode(node.value, context);
14468 if (node.isVNode) {
14469 push(`,`);
14470 newline();
14471 push(`${helper(SET_BLOCK_TRACKING)}(1),`);
14472 newline();
14473 push(`_cache[${node.index}]`);
14474 deindent();
14475 }
14476 push(`)`);
14477}
14478
14479const prohibitedKeywordRE = new RegExp(
14480 "\\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"
14481);
14482const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
14483function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
14484 const exp = node.content;
14485 if (!exp.trim()) {
14486 return;
14487 }
14488 try {
14489 new Function(
14490 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
14491 );
14492 } catch (e) {
14493 let message = e.message;
14494 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
14495 if (keywordMatch) {
14496 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
14497 }
14498 context.onError(
14499 createCompilerError(
14500 45,
14501 node.loc,
14502 void 0,
14503 message
14504 )
14505 );
14506 }
14507}
14508
14509const transformExpression = (node, context) => {
14510 if (node.type === 5) {
14511 node.content = processExpression(
14512 node.content,
14513 context
14514 );
14515 } else if (node.type === 1) {
14516 for (let i = 0; i < node.props.length; i++) {
14517 const dir = node.props[i];
14518 if (dir.type === 7 && dir.name !== "for") {
14519 const exp = dir.exp;
14520 const arg = dir.arg;
14521 if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
14522 dir.exp = processExpression(
14523 exp,
14524 context,
14525 // slot args must be processed as function params
14526 dir.name === "slot"
14527 );
14528 }
14529 if (arg && arg.type === 4 && !arg.isStatic) {
14530 dir.arg = processExpression(arg, context);
14531 }
14532 }
14533 }
14534 }
14535};
14536function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
14537 {
14538 {
14539 validateBrowserExpression(node, context, asParams, asRawStatements);
14540 }
14541 return node;
14542 }
14543}
14544
14545const transformIf = createStructuralDirectiveTransform(
14546 /^(if|else|else-if)$/,
14547 (node, dir, context) => {
14548 return processIf(node, dir, context, (ifNode, branch, isRoot) => {
14549 const siblings = context.parent.children;
14550 let i = siblings.indexOf(ifNode);
14551 let key = 0;
14552 while (i-- >= 0) {
14553 const sibling = siblings[i];
14554 if (sibling && sibling.type === 9) {
14555 key += sibling.branches.length;
14556 }
14557 }
14558 return () => {
14559 if (isRoot) {
14560 ifNode.codegenNode = createCodegenNodeForBranch(
14561 branch,
14562 key,
14563 context
14564 );
14565 } else {
14566 const parentCondition = getParentCondition(ifNode.codegenNode);
14567 parentCondition.alternate = createCodegenNodeForBranch(
14568 branch,
14569 key + ifNode.branches.length - 1,
14570 context
14571 );
14572 }
14573 };
14574 });
14575 }
14576);
14577function processIf(node, dir, context, processCodegen) {
14578 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
14579 const loc = dir.exp ? dir.exp.loc : node.loc;
14580 context.onError(
14581 createCompilerError(28, dir.loc)
14582 );
14583 dir.exp = createSimpleExpression(`true`, false, loc);
14584 }
14585 if (dir.exp) {
14586 validateBrowserExpression(dir.exp, context);
14587 }
14588 if (dir.name === "if") {
14589 const branch = createIfBranch(node, dir);
14590 const ifNode = {
14591 type: 9,
14592 loc: node.loc,
14593 branches: [branch]
14594 };
14595 context.replaceNode(ifNode);
14596 if (processCodegen) {
14597 return processCodegen(ifNode, branch, true);
14598 }
14599 } else {
14600 const siblings = context.parent.children;
14601 const comments = [];
14602 let i = siblings.indexOf(node);
14603 while (i-- >= -1) {
14604 const sibling = siblings[i];
14605 if (sibling && sibling.type === 3) {
14606 context.removeNode(sibling);
14607 comments.unshift(sibling);
14608 continue;
14609 }
14610 if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
14611 context.removeNode(sibling);
14612 continue;
14613 }
14614 if (sibling && sibling.type === 9) {
14615 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
14616 context.onError(
14617 createCompilerError(30, node.loc)
14618 );
14619 }
14620 context.removeNode();
14621 const branch = createIfBranch(node, dir);
14622 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
14623 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
14624 branch.children = [...comments, ...branch.children];
14625 }
14626 {
14627 const key = branch.userKey;
14628 if (key) {
14629 sibling.branches.forEach(({ userKey }) => {
14630 if (isSameKey(userKey, key)) {
14631 context.onError(
14632 createCompilerError(
14633 29,
14634 branch.userKey.loc
14635 )
14636 );
14637 }
14638 });
14639 }
14640 }
14641 sibling.branches.push(branch);
14642 const onExit = processCodegen && processCodegen(sibling, branch, false);
14643 traverseNode(branch, context);
14644 if (onExit)
14645 onExit();
14646 context.currentNode = null;
14647 } else {
14648 context.onError(
14649 createCompilerError(30, node.loc)
14650 );
14651 }
14652 break;
14653 }
14654 }
14655}
14656function createIfBranch(node, dir) {
14657 const isTemplateIf = node.tagType === 3;
14658 return {
14659 type: 10,
14660 loc: node.loc,
14661 condition: dir.name === "else" ? void 0 : dir.exp,
14662 children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
14663 userKey: findProp(node, `key`),
14664 isTemplateIf
14665 };
14666}
14667function createCodegenNodeForBranch(branch, keyIndex, context) {
14668 if (branch.condition) {
14669 return createConditionalExpression(
14670 branch.condition,
14671 createChildrenCodegenNode(branch, keyIndex, context),
14672 // make sure to pass in asBlock: true so that the comment node call
14673 // closes the current block.
14674 createCallExpression(context.helper(CREATE_COMMENT), [
14675 '"v-if"' ,
14676 "true"
14677 ])
14678 );
14679 } else {
14680 return createChildrenCodegenNode(branch, keyIndex, context);
14681 }
14682}
14683function createChildrenCodegenNode(branch, keyIndex, context) {
14684 const { helper } = context;
14685 const keyProperty = createObjectProperty(
14686 `key`,
14687 createSimpleExpression(
14688 `${keyIndex}`,
14689 false,
14690 locStub,
14691 2
14692 )
14693 );
14694 const { children } = branch;
14695 const firstChild = children[0];
14696 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
14697 if (needFragmentWrapper) {
14698 if (children.length === 1 && firstChild.type === 11) {
14699 const vnodeCall = firstChild.codegenNode;
14700 injectProp(vnodeCall, keyProperty, context);
14701 return vnodeCall;
14702 } else {
14703 let patchFlag = 64;
14704 let patchFlagText = PatchFlagNames[64];
14705 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
14706 patchFlag |= 2048;
14707 patchFlagText += `, ${PatchFlagNames[2048]}`;
14708 }
14709 return createVNodeCall(
14710 context,
14711 helper(FRAGMENT),
14712 createObjectExpression([keyProperty]),
14713 children,
14714 patchFlag + (` /* ${patchFlagText} */` ),
14715 void 0,
14716 void 0,
14717 true,
14718 false,
14719 false,
14720 branch.loc
14721 );
14722 }
14723 } else {
14724 const ret = firstChild.codegenNode;
14725 const vnodeCall = getMemoedVNodeCall(ret);
14726 if (vnodeCall.type === 13) {
14727 convertToBlock(vnodeCall, context);
14728 }
14729 injectProp(vnodeCall, keyProperty, context);
14730 return ret;
14731 }
14732}
14733function isSameKey(a, b) {
14734 if (!a || a.type !== b.type) {
14735 return false;
14736 }
14737 if (a.type === 6) {
14738 if (a.value.content !== b.value.content) {
14739 return false;
14740 }
14741 } else {
14742 const exp = a.exp;
14743 const branchExp = b.exp;
14744 if (exp.type !== branchExp.type) {
14745 return false;
14746 }
14747 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
14748 return false;
14749 }
14750 }
14751 return true;
14752}
14753function getParentCondition(node) {
14754 while (true) {
14755 if (node.type === 19) {
14756 if (node.alternate.type === 19) {
14757 node = node.alternate;
14758 } else {
14759 return node;
14760 }
14761 } else if (node.type === 20) {
14762 node = node.value;
14763 }
14764 }
14765}
14766
14767const transformFor = createStructuralDirectiveTransform(
14768 "for",
14769 (node, dir, context) => {
14770 const { helper, removeHelper } = context;
14771 return processFor(node, dir, context, (forNode) => {
14772 const renderExp = createCallExpression(helper(RENDER_LIST), [
14773 forNode.source
14774 ]);
14775 const isTemplate = isTemplateNode(node);
14776 const memo = findDir(node, "memo");
14777 const keyProp = findProp(node, `key`);
14778 const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
14779 const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
14780 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
14781 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
14782 forNode.codegenNode = createVNodeCall(
14783 context,
14784 helper(FRAGMENT),
14785 void 0,
14786 renderExp,
14787 fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ),
14788 void 0,
14789 void 0,
14790 true,
14791 !isStableFragment,
14792 false,
14793 node.loc
14794 );
14795 return () => {
14796 let childBlock;
14797 const { children } = forNode;
14798 if (isTemplate) {
14799 node.children.some((c) => {
14800 if (c.type === 1) {
14801 const key = findProp(c, "key");
14802 if (key) {
14803 context.onError(
14804 createCompilerError(
14805 33,
14806 key.loc
14807 )
14808 );
14809 return true;
14810 }
14811 }
14812 });
14813 }
14814 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
14815 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
14816 if (slotOutlet) {
14817 childBlock = slotOutlet.codegenNode;
14818 if (isTemplate && keyProperty) {
14819 injectProp(childBlock, keyProperty, context);
14820 }
14821 } else if (needFragmentWrapper) {
14822 childBlock = createVNodeCall(
14823 context,
14824 helper(FRAGMENT),
14825 keyProperty ? createObjectExpression([keyProperty]) : void 0,
14826 node.children,
14827 64 + (` /* ${PatchFlagNames[64]} */` ),
14828 void 0,
14829 void 0,
14830 true,
14831 void 0,
14832 false
14833 );
14834 } else {
14835 childBlock = children[0].codegenNode;
14836 if (isTemplate && keyProperty) {
14837 injectProp(childBlock, keyProperty, context);
14838 }
14839 if (childBlock.isBlock !== !isStableFragment) {
14840 if (childBlock.isBlock) {
14841 removeHelper(OPEN_BLOCK);
14842 removeHelper(
14843 getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
14844 );
14845 } else {
14846 removeHelper(
14847 getVNodeHelper(context.inSSR, childBlock.isComponent)
14848 );
14849 }
14850 }
14851 childBlock.isBlock = !isStableFragment;
14852 if (childBlock.isBlock) {
14853 helper(OPEN_BLOCK);
14854 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14855 } else {
14856 helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14857 }
14858 }
14859 if (memo) {
14860 const loop = createFunctionExpression(
14861 createForLoopParams(forNode.parseResult, [
14862 createSimpleExpression(`_cached`)
14863 ])
14864 );
14865 loop.body = createBlockStatement([
14866 createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
14867 createCompoundExpression([
14868 `if (_cached`,
14869 ...keyExp ? [` && _cached.key === `, keyExp] : [],
14870 ` && ${context.helperString(
14871 IS_MEMO_SAME
14872 )}(_cached, _memo)) return _cached`
14873 ]),
14874 createCompoundExpression([`const _item = `, childBlock]),
14875 createSimpleExpression(`_item.memo = _memo`),
14876 createSimpleExpression(`return _item`)
14877 ]);
14878 renderExp.arguments.push(
14879 loop,
14880 createSimpleExpression(`_cache`),
14881 createSimpleExpression(String(context.cached++))
14882 );
14883 } else {
14884 renderExp.arguments.push(
14885 createFunctionExpression(
14886 createForLoopParams(forNode.parseResult),
14887 childBlock,
14888 true
14889 )
14890 );
14891 }
14892 };
14893 });
14894 }
14895);
14896function processFor(node, dir, context, processCodegen) {
14897 if (!dir.exp) {
14898 context.onError(
14899 createCompilerError(31, dir.loc)
14900 );
14901 return;
14902 }
14903 const parseResult = dir.forParseResult;
14904 if (!parseResult) {
14905 context.onError(
14906 createCompilerError(32, dir.loc)
14907 );
14908 return;
14909 }
14910 finalizeForParseResult(parseResult, context);
14911 const { addIdentifiers, removeIdentifiers, scopes } = context;
14912 const { source, value, key, index } = parseResult;
14913 const forNode = {
14914 type: 11,
14915 loc: dir.loc,
14916 source,
14917 valueAlias: value,
14918 keyAlias: key,
14919 objectIndexAlias: index,
14920 parseResult,
14921 children: isTemplateNode(node) ? node.children : [node]
14922 };
14923 context.replaceNode(forNode);
14924 scopes.vFor++;
14925 const onExit = processCodegen && processCodegen(forNode);
14926 return () => {
14927 scopes.vFor--;
14928 if (onExit)
14929 onExit();
14930 };
14931}
14932function finalizeForParseResult(result, context) {
14933 if (result.finalized)
14934 return;
14935 {
14936 validateBrowserExpression(result.source, context);
14937 if (result.key) {
14938 validateBrowserExpression(
14939 result.key,
14940 context,
14941 true
14942 );
14943 }
14944 if (result.index) {
14945 validateBrowserExpression(
14946 result.index,
14947 context,
14948 true
14949 );
14950 }
14951 if (result.value) {
14952 validateBrowserExpression(
14953 result.value,
14954 context,
14955 true
14956 );
14957 }
14958 }
14959 result.finalized = true;
14960}
14961function createForLoopParams({ value, key, index }, memoArgs = []) {
14962 return createParamsList([value, key, index, ...memoArgs]);
14963}
14964function createParamsList(args) {
14965 let i = args.length;
14966 while (i--) {
14967 if (args[i])
14968 break;
14969 }
14970 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
14971}
14972
14973const defaultFallback = createSimpleExpression(`undefined`, false);
14974const trackSlotScopes = (node, context) => {
14975 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
14976 const vSlot = findDir(node, "slot");
14977 if (vSlot) {
14978 vSlot.exp;
14979 context.scopes.vSlot++;
14980 return () => {
14981 context.scopes.vSlot--;
14982 };
14983 }
14984 }
14985};
14986const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
14987 props,
14988 children,
14989 false,
14990 true,
14991 children.length ? children[0].loc : loc
14992);
14993function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14994 context.helper(WITH_CTX);
14995 const { children, loc } = node;
14996 const slotsProperties = [];
14997 const dynamicSlots = [];
14998 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
14999 const onComponentSlot = findDir(node, "slot", true);
15000 if (onComponentSlot) {
15001 const { arg, exp } = onComponentSlot;
15002 if (arg && !isStaticExp(arg)) {
15003 hasDynamicSlots = true;
15004 }
15005 slotsProperties.push(
15006 createObjectProperty(
15007 arg || createSimpleExpression("default", true),
15008 buildSlotFn(exp, void 0, children, loc)
15009 )
15010 );
15011 }
15012 let hasTemplateSlots = false;
15013 let hasNamedDefaultSlot = false;
15014 const implicitDefaultChildren = [];
15015 const seenSlotNames = /* @__PURE__ */ new Set();
15016 let conditionalBranchIndex = 0;
15017 for (let i = 0; i < children.length; i++) {
15018 const slotElement = children[i];
15019 let slotDir;
15020 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
15021 if (slotElement.type !== 3) {
15022 implicitDefaultChildren.push(slotElement);
15023 }
15024 continue;
15025 }
15026 if (onComponentSlot) {
15027 context.onError(
15028 createCompilerError(37, slotDir.loc)
15029 );
15030 break;
15031 }
15032 hasTemplateSlots = true;
15033 const { children: slotChildren, loc: slotLoc } = slotElement;
15034 const {
15035 arg: slotName = createSimpleExpression(`default`, true),
15036 exp: slotProps,
15037 loc: dirLoc
15038 } = slotDir;
15039 let staticSlotName;
15040 if (isStaticExp(slotName)) {
15041 staticSlotName = slotName ? slotName.content : `default`;
15042 } else {
15043 hasDynamicSlots = true;
15044 }
15045 const vFor = findDir(slotElement, "for");
15046 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
15047 let vIf;
15048 let vElse;
15049 if (vIf = findDir(slotElement, "if")) {
15050 hasDynamicSlots = true;
15051 dynamicSlots.push(
15052 createConditionalExpression(
15053 vIf.exp,
15054 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
15055 defaultFallback
15056 )
15057 );
15058 } else if (vElse = findDir(
15059 slotElement,
15060 /^else(-if)?$/,
15061 true
15062 /* allowEmpty */
15063 )) {
15064 let j = i;
15065 let prev;
15066 while (j--) {
15067 prev = children[j];
15068 if (prev.type !== 3) {
15069 break;
15070 }
15071 }
15072 if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
15073 children.splice(i, 1);
15074 i--;
15075 let conditional = dynamicSlots[dynamicSlots.length - 1];
15076 while (conditional.alternate.type === 19) {
15077 conditional = conditional.alternate;
15078 }
15079 conditional.alternate = vElse.exp ? createConditionalExpression(
15080 vElse.exp,
15081 buildDynamicSlot(
15082 slotName,
15083 slotFunction,
15084 conditionalBranchIndex++
15085 ),
15086 defaultFallback
15087 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
15088 } else {
15089 context.onError(
15090 createCompilerError(30, vElse.loc)
15091 );
15092 }
15093 } else if (vFor) {
15094 hasDynamicSlots = true;
15095 const parseResult = vFor.forParseResult;
15096 if (parseResult) {
15097 finalizeForParseResult(parseResult, context);
15098 dynamicSlots.push(
15099 createCallExpression(context.helper(RENDER_LIST), [
15100 parseResult.source,
15101 createFunctionExpression(
15102 createForLoopParams(parseResult),
15103 buildDynamicSlot(slotName, slotFunction),
15104 true
15105 )
15106 ])
15107 );
15108 } else {
15109 context.onError(
15110 createCompilerError(
15111 32,
15112 vFor.loc
15113 )
15114 );
15115 }
15116 } else {
15117 if (staticSlotName) {
15118 if (seenSlotNames.has(staticSlotName)) {
15119 context.onError(
15120 createCompilerError(
15121 38,
15122 dirLoc
15123 )
15124 );
15125 continue;
15126 }
15127 seenSlotNames.add(staticSlotName);
15128 if (staticSlotName === "default") {
15129 hasNamedDefaultSlot = true;
15130 }
15131 }
15132 slotsProperties.push(createObjectProperty(slotName, slotFunction));
15133 }
15134 }
15135 if (!onComponentSlot) {
15136 const buildDefaultSlotProperty = (props, children2) => {
15137 const fn = buildSlotFn(props, void 0, children2, loc);
15138 return createObjectProperty(`default`, fn);
15139 };
15140 if (!hasTemplateSlots) {
15141 slotsProperties.push(buildDefaultSlotProperty(void 0, children));
15142 } else if (implicitDefaultChildren.length && // #3766
15143 // with whitespace: 'preserve', whitespaces between slots will end up in
15144 // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
15145 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
15146 if (hasNamedDefaultSlot) {
15147 context.onError(
15148 createCompilerError(
15149 39,
15150 implicitDefaultChildren[0].loc
15151 )
15152 );
15153 } else {
15154 slotsProperties.push(
15155 buildDefaultSlotProperty(void 0, implicitDefaultChildren)
15156 );
15157 }
15158 }
15159 }
15160 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
15161 let slots = createObjectExpression(
15162 slotsProperties.concat(
15163 createObjectProperty(
15164 `_`,
15165 // 2 = compiled but dynamic = can skip normalization, but must run diff
15166 // 1 = compiled and static = can skip normalization AND diff as optimized
15167 createSimpleExpression(
15168 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
15169 false
15170 )
15171 )
15172 ),
15173 loc
15174 );
15175 if (dynamicSlots.length) {
15176 slots = createCallExpression(context.helper(CREATE_SLOTS), [
15177 slots,
15178 createArrayExpression(dynamicSlots)
15179 ]);
15180 }
15181 return {
15182 slots,
15183 hasDynamicSlots
15184 };
15185}
15186function buildDynamicSlot(name, fn, index) {
15187 const props = [
15188 createObjectProperty(`name`, name),
15189 createObjectProperty(`fn`, fn)
15190 ];
15191 if (index != null) {
15192 props.push(
15193 createObjectProperty(`key`, createSimpleExpression(String(index), true))
15194 );
15195 }
15196 return createObjectExpression(props);
15197}
15198function hasForwardedSlots(children) {
15199 for (let i = 0; i < children.length; i++) {
15200 const child = children[i];
15201 switch (child.type) {
15202 case 1:
15203 if (child.tagType === 2 || hasForwardedSlots(child.children)) {
15204 return true;
15205 }
15206 break;
15207 case 9:
15208 if (hasForwardedSlots(child.branches))
15209 return true;
15210 break;
15211 case 10:
15212 case 11:
15213 if (hasForwardedSlots(child.children))
15214 return true;
15215 break;
15216 }
15217 }
15218 return false;
15219}
15220function isNonWhitespaceContent(node) {
15221 if (node.type !== 2 && node.type !== 12)
15222 return true;
15223 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
15224}
15225
15226const directiveImportMap = /* @__PURE__ */ new WeakMap();
15227const transformElement = (node, context) => {
15228 return function postTransformElement() {
15229 node = context.currentNode;
15230 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
15231 return;
15232 }
15233 const { tag, props } = node;
15234 const isComponent = node.tagType === 1;
15235 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
15236 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
15237 let vnodeProps;
15238 let vnodeChildren;
15239 let vnodePatchFlag;
15240 let patchFlag = 0;
15241 let vnodeDynamicProps;
15242 let dynamicPropNames;
15243 let vnodeDirectives;
15244 let shouldUseBlock = (
15245 // dynamic component may resolve to plain elements
15246 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
15247 // updates inside get proper isSVG flag at runtime. (#639, #643)
15248 // This is technically web-specific, but splitting the logic out of core
15249 // leads to too much unnecessary complexity.
15250 (tag === "svg" || tag === "foreignObject")
15251 );
15252 if (props.length > 0) {
15253 const propsBuildResult = buildProps(
15254 node,
15255 context,
15256 void 0,
15257 isComponent,
15258 isDynamicComponent
15259 );
15260 vnodeProps = propsBuildResult.props;
15261 patchFlag = propsBuildResult.patchFlag;
15262 dynamicPropNames = propsBuildResult.dynamicPropNames;
15263 const directives = propsBuildResult.directives;
15264 vnodeDirectives = directives && directives.length ? createArrayExpression(
15265 directives.map((dir) => buildDirectiveArgs(dir, context))
15266 ) : void 0;
15267 if (propsBuildResult.shouldUseBlock) {
15268 shouldUseBlock = true;
15269 }
15270 }
15271 if (node.children.length > 0) {
15272 if (vnodeTag === KEEP_ALIVE) {
15273 shouldUseBlock = true;
15274 patchFlag |= 1024;
15275 if (node.children.length > 1) {
15276 context.onError(
15277 createCompilerError(46, {
15278 start: node.children[0].loc.start,
15279 end: node.children[node.children.length - 1].loc.end,
15280 source: ""
15281 })
15282 );
15283 }
15284 }
15285 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
15286 vnodeTag !== TELEPORT && // explained above.
15287 vnodeTag !== KEEP_ALIVE;
15288 if (shouldBuildAsSlots) {
15289 const { slots, hasDynamicSlots } = buildSlots(node, context);
15290 vnodeChildren = slots;
15291 if (hasDynamicSlots) {
15292 patchFlag |= 1024;
15293 }
15294 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
15295 const child = node.children[0];
15296 const type = child.type;
15297 const hasDynamicTextChild = type === 5 || type === 8;
15298 if (hasDynamicTextChild && getConstantType(child, context) === 0) {
15299 patchFlag |= 1;
15300 }
15301 if (hasDynamicTextChild || type === 2) {
15302 vnodeChildren = child;
15303 } else {
15304 vnodeChildren = node.children;
15305 }
15306 } else {
15307 vnodeChildren = node.children;
15308 }
15309 }
15310 if (patchFlag !== 0) {
15311 {
15312 if (patchFlag < 0) {
15313 vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
15314 } else {
15315 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
15316 vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
15317 }
15318 }
15319 if (dynamicPropNames && dynamicPropNames.length) {
15320 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15321 }
15322 }
15323 node.codegenNode = createVNodeCall(
15324 context,
15325 vnodeTag,
15326 vnodeProps,
15327 vnodeChildren,
15328 vnodePatchFlag,
15329 vnodeDynamicProps,
15330 vnodeDirectives,
15331 !!shouldUseBlock,
15332 false,
15333 isComponent,
15334 node.loc
15335 );
15336 };
15337};
15338function resolveComponentType(node, context, ssr = false) {
15339 let { tag } = node;
15340 const isExplicitDynamic = isComponentTag(tag);
15341 const isProp = findProp(
15342 node,
15343 "is",
15344 false,
15345 true
15346 /* allow empty */
15347 );
15348 if (isProp) {
15349 if (isExplicitDynamic || false) {
15350 let exp;
15351 if (isProp.type === 6) {
15352 exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15353 } else {
15354 exp = isProp.exp;
15355 if (!exp) {
15356 exp = createSimpleExpression(`is`, false, isProp.loc);
15357 }
15358 }
15359 if (exp) {
15360 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15361 exp
15362 ]);
15363 }
15364 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
15365 tag = isProp.value.content.slice(4);
15366 }
15367 }
15368 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
15369 if (builtIn) {
15370 if (!ssr)
15371 context.helper(builtIn);
15372 return builtIn;
15373 }
15374 context.helper(RESOLVE_COMPONENT);
15375 context.components.add(tag);
15376 return toValidAssetId(tag, `component`);
15377}
15378function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
15379 const { tag, loc: elementLoc, children } = node;
15380 let properties = [];
15381 const mergeArgs = [];
15382 const runtimeDirectives = [];
15383 const hasChildren = children.length > 0;
15384 let shouldUseBlock = false;
15385 let patchFlag = 0;
15386 let hasRef = false;
15387 let hasClassBinding = false;
15388 let hasStyleBinding = false;
15389 let hasHydrationEventBinding = false;
15390 let hasDynamicKeys = false;
15391 let hasVnodeHook = false;
15392 const dynamicPropNames = [];
15393 const pushMergeArg = (arg) => {
15394 if (properties.length) {
15395 mergeArgs.push(
15396 createObjectExpression(dedupeProperties(properties), elementLoc)
15397 );
15398 properties = [];
15399 }
15400 if (arg)
15401 mergeArgs.push(arg);
15402 };
15403 const pushRefVForMarker = () => {
15404 if (context.scopes.vFor > 0) {
15405 properties.push(
15406 createObjectProperty(
15407 createSimpleExpression("ref_for", true),
15408 createSimpleExpression("true")
15409 )
15410 );
15411 }
15412 };
15413 const analyzePatchFlag = ({ key, value }) => {
15414 if (isStaticExp(key)) {
15415 const name = key.content;
15416 const isEventHandler = isOn(name);
15417 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
15418 // dedicated fast path.
15419 name.toLowerCase() !== "onclick" && // omit v-model handlers
15420 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
15421 !isReservedProp(name)) {
15422 hasHydrationEventBinding = true;
15423 }
15424 if (isEventHandler && isReservedProp(name)) {
15425 hasVnodeHook = true;
15426 }
15427 if (isEventHandler && value.type === 14) {
15428 value = value.arguments[0];
15429 }
15430 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
15431 return;
15432 }
15433 if (name === "ref") {
15434 hasRef = true;
15435 } else if (name === "class") {
15436 hasClassBinding = true;
15437 } else if (name === "style") {
15438 hasStyleBinding = true;
15439 } else if (name !== "key" && !dynamicPropNames.includes(name)) {
15440 dynamicPropNames.push(name);
15441 }
15442 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
15443 dynamicPropNames.push(name);
15444 }
15445 } else {
15446 hasDynamicKeys = true;
15447 }
15448 };
15449 for (let i = 0; i < props.length; i++) {
15450 const prop = props[i];
15451 if (prop.type === 6) {
15452 const { loc, name, nameLoc, value } = prop;
15453 let isStatic = true;
15454 if (name === "ref") {
15455 hasRef = true;
15456 pushRefVForMarker();
15457 }
15458 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
15459 continue;
15460 }
15461 properties.push(
15462 createObjectProperty(
15463 createSimpleExpression(name, true, nameLoc),
15464 createSimpleExpression(
15465 value ? value.content : "",
15466 isStatic,
15467 value ? value.loc : loc
15468 )
15469 )
15470 );
15471 } else {
15472 const { name, arg, exp, loc, modifiers } = prop;
15473 const isVBind = name === "bind";
15474 const isVOn = name === "on";
15475 if (name === "slot") {
15476 if (!isComponent) {
15477 context.onError(
15478 createCompilerError(40, loc)
15479 );
15480 }
15481 continue;
15482 }
15483 if (name === "once" || name === "memo") {
15484 continue;
15485 }
15486 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
15487 continue;
15488 }
15489 if (isVOn && ssr) {
15490 continue;
15491 }
15492 if (
15493 // #938: elements with dynamic keys should be forced into blocks
15494 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
15495 // before children
15496 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
15497 ) {
15498 shouldUseBlock = true;
15499 }
15500 if (isVBind && isStaticArgOf(arg, "ref")) {
15501 pushRefVForMarker();
15502 }
15503 if (!arg && (isVBind || isVOn)) {
15504 hasDynamicKeys = true;
15505 if (exp) {
15506 if (isVBind) {
15507 pushRefVForMarker();
15508 pushMergeArg();
15509 mergeArgs.push(exp);
15510 } else {
15511 pushMergeArg({
15512 type: 14,
15513 loc,
15514 callee: context.helper(TO_HANDLERS),
15515 arguments: isComponent ? [exp] : [exp, `true`]
15516 });
15517 }
15518 } else {
15519 context.onError(
15520 createCompilerError(
15521 isVBind ? 34 : 35,
15522 loc
15523 )
15524 );
15525 }
15526 continue;
15527 }
15528 if (isVBind && modifiers.includes("prop")) {
15529 patchFlag |= 32;
15530 }
15531 const directiveTransform = context.directiveTransforms[name];
15532 if (directiveTransform) {
15533 const { props: props2, needRuntime } = directiveTransform(prop, node, context);
15534 !ssr && props2.forEach(analyzePatchFlag);
15535 if (isVOn && arg && !isStaticExp(arg)) {
15536 pushMergeArg(createObjectExpression(props2, elementLoc));
15537 } else {
15538 properties.push(...props2);
15539 }
15540 if (needRuntime) {
15541 runtimeDirectives.push(prop);
15542 if (isSymbol(needRuntime)) {
15543 directiveImportMap.set(prop, needRuntime);
15544 }
15545 }
15546 } else if (!isBuiltInDirective(name)) {
15547 runtimeDirectives.push(prop);
15548 if (hasChildren) {
15549 shouldUseBlock = true;
15550 }
15551 }
15552 }
15553 }
15554 let propsExpression = void 0;
15555 if (mergeArgs.length) {
15556 pushMergeArg();
15557 if (mergeArgs.length > 1) {
15558 propsExpression = createCallExpression(
15559 context.helper(MERGE_PROPS),
15560 mergeArgs,
15561 elementLoc
15562 );
15563 } else {
15564 propsExpression = mergeArgs[0];
15565 }
15566 } else if (properties.length) {
15567 propsExpression = createObjectExpression(
15568 dedupeProperties(properties),
15569 elementLoc
15570 );
15571 }
15572 if (hasDynamicKeys) {
15573 patchFlag |= 16;
15574 } else {
15575 if (hasClassBinding && !isComponent) {
15576 patchFlag |= 2;
15577 }
15578 if (hasStyleBinding && !isComponent) {
15579 patchFlag |= 4;
15580 }
15581 if (dynamicPropNames.length) {
15582 patchFlag |= 8;
15583 }
15584 if (hasHydrationEventBinding) {
15585 patchFlag |= 32;
15586 }
15587 }
15588 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
15589 patchFlag |= 512;
15590 }
15591 if (!context.inSSR && propsExpression) {
15592 switch (propsExpression.type) {
15593 case 15:
15594 let classKeyIndex = -1;
15595 let styleKeyIndex = -1;
15596 let hasDynamicKey = false;
15597 for (let i = 0; i < propsExpression.properties.length; i++) {
15598 const key = propsExpression.properties[i].key;
15599 if (isStaticExp(key)) {
15600 if (key.content === "class") {
15601 classKeyIndex = i;
15602 } else if (key.content === "style") {
15603 styleKeyIndex = i;
15604 }
15605 } else if (!key.isHandlerKey) {
15606 hasDynamicKey = true;
15607 }
15608 }
15609 const classProp = propsExpression.properties[classKeyIndex];
15610 const styleProp = propsExpression.properties[styleKeyIndex];
15611 if (!hasDynamicKey) {
15612 if (classProp && !isStaticExp(classProp.value)) {
15613 classProp.value = createCallExpression(
15614 context.helper(NORMALIZE_CLASS),
15615 [classProp.value]
15616 );
15617 }
15618 if (styleProp && // the static style is compiled into an object,
15619 // so use `hasStyleBinding` to ensure that it is a dynamic style binding
15620 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
15621 // v-bind:style with static literal object
15622 styleProp.value.type === 17)) {
15623 styleProp.value = createCallExpression(
15624 context.helper(NORMALIZE_STYLE),
15625 [styleProp.value]
15626 );
15627 }
15628 } else {
15629 propsExpression = createCallExpression(
15630 context.helper(NORMALIZE_PROPS),
15631 [propsExpression]
15632 );
15633 }
15634 break;
15635 case 14:
15636 break;
15637 default:
15638 propsExpression = createCallExpression(
15639 context.helper(NORMALIZE_PROPS),
15640 [
15641 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
15642 propsExpression
15643 ])
15644 ]
15645 );
15646 break;
15647 }
15648 }
15649 return {
15650 props: propsExpression,
15651 directives: runtimeDirectives,
15652 patchFlag,
15653 dynamicPropNames,
15654 shouldUseBlock
15655 };
15656}
15657function dedupeProperties(properties) {
15658 const knownProps = /* @__PURE__ */ new Map();
15659 const deduped = [];
15660 for (let i = 0; i < properties.length; i++) {
15661 const prop = properties[i];
15662 if (prop.key.type === 8 || !prop.key.isStatic) {
15663 deduped.push(prop);
15664 continue;
15665 }
15666 const name = prop.key.content;
15667 const existing = knownProps.get(name);
15668 if (existing) {
15669 if (name === "style" || name === "class" || isOn(name)) {
15670 mergeAsArray(existing, prop);
15671 }
15672 } else {
15673 knownProps.set(name, prop);
15674 deduped.push(prop);
15675 }
15676 }
15677 return deduped;
15678}
15679function mergeAsArray(existing, incoming) {
15680 if (existing.value.type === 17) {
15681 existing.value.elements.push(incoming.value);
15682 } else {
15683 existing.value = createArrayExpression(
15684 [existing.value, incoming.value],
15685 existing.loc
15686 );
15687 }
15688}
15689function buildDirectiveArgs(dir, context) {
15690 const dirArgs = [];
15691 const runtime = directiveImportMap.get(dir);
15692 if (runtime) {
15693 dirArgs.push(context.helperString(runtime));
15694 } else {
15695 {
15696 context.helper(RESOLVE_DIRECTIVE);
15697 context.directives.add(dir.name);
15698 dirArgs.push(toValidAssetId(dir.name, `directive`));
15699 }
15700 }
15701 const { loc } = dir;
15702 if (dir.exp)
15703 dirArgs.push(dir.exp);
15704 if (dir.arg) {
15705 if (!dir.exp) {
15706 dirArgs.push(`void 0`);
15707 }
15708 dirArgs.push(dir.arg);
15709 }
15710 if (Object.keys(dir.modifiers).length) {
15711 if (!dir.arg) {
15712 if (!dir.exp) {
15713 dirArgs.push(`void 0`);
15714 }
15715 dirArgs.push(`void 0`);
15716 }
15717 const trueExpression = createSimpleExpression(`true`, false, loc);
15718 dirArgs.push(
15719 createObjectExpression(
15720 dir.modifiers.map(
15721 (modifier) => createObjectProperty(modifier, trueExpression)
15722 ),
15723 loc
15724 )
15725 );
15726 }
15727 return createArrayExpression(dirArgs, dir.loc);
15728}
15729function stringifyDynamicPropNames(props) {
15730 let propsNamesString = `[`;
15731 for (let i = 0, l = props.length; i < l; i++) {
15732 propsNamesString += JSON.stringify(props[i]);
15733 if (i < l - 1)
15734 propsNamesString += ", ";
15735 }
15736 return propsNamesString + `]`;
15737}
15738function isComponentTag(tag) {
15739 return tag === "component" || tag === "Component";
15740}
15741
15742const transformSlotOutlet = (node, context) => {
15743 if (isSlotOutlet(node)) {
15744 const { children, loc } = node;
15745 const { slotName, slotProps } = processSlotOutlet(node, context);
15746 const slotArgs = [
15747 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
15748 slotName,
15749 "{}",
15750 "undefined",
15751 "true"
15752 ];
15753 let expectedLen = 2;
15754 if (slotProps) {
15755 slotArgs[2] = slotProps;
15756 expectedLen = 3;
15757 }
15758 if (children.length) {
15759 slotArgs[3] = createFunctionExpression([], children, false, false, loc);
15760 expectedLen = 4;
15761 }
15762 if (context.scopeId && !context.slotted) {
15763 expectedLen = 5;
15764 }
15765 slotArgs.splice(expectedLen);
15766 node.codegenNode = createCallExpression(
15767 context.helper(RENDER_SLOT),
15768 slotArgs,
15769 loc
15770 );
15771 }
15772};
15773function processSlotOutlet(node, context) {
15774 let slotName = `"default"`;
15775 let slotProps = void 0;
15776 const nonNameProps = [];
15777 for (let i = 0; i < node.props.length; i++) {
15778 const p = node.props[i];
15779 if (p.type === 6) {
15780 if (p.value) {
15781 if (p.name === "name") {
15782 slotName = JSON.stringify(p.value.content);
15783 } else {
15784 p.name = camelize(p.name);
15785 nonNameProps.push(p);
15786 }
15787 }
15788 } else {
15789 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
15790 if (p.exp) {
15791 slotName = p.exp;
15792 } else if (p.arg && p.arg.type === 4) {
15793 const name = camelize(p.arg.content);
15794 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
15795 }
15796 } else {
15797 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
15798 p.arg.content = camelize(p.arg.content);
15799 }
15800 nonNameProps.push(p);
15801 }
15802 }
15803 }
15804 if (nonNameProps.length > 0) {
15805 const { props, directives } = buildProps(
15806 node,
15807 context,
15808 nonNameProps,
15809 false,
15810 false
15811 );
15812 slotProps = props;
15813 if (directives.length) {
15814 context.onError(
15815 createCompilerError(
15816 36,
15817 directives[0].loc
15818 )
15819 );
15820 }
15821 }
15822 return {
15823 slotName,
15824 slotProps
15825 };
15826}
15827
15828const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
15829const transformOn$1 = (dir, node, context, augmentor) => {
15830 const { loc, modifiers, arg } = dir;
15831 if (!dir.exp && !modifiers.length) {
15832 context.onError(createCompilerError(35, loc));
15833 }
15834 let eventName;
15835 if (arg.type === 4) {
15836 if (arg.isStatic) {
15837 let rawName = arg.content;
15838 if (rawName.startsWith("vnode")) {
15839 context.onError(createCompilerError(51, arg.loc));
15840 }
15841 if (rawName.startsWith("vue:")) {
15842 rawName = `vnode-${rawName.slice(4)}`;
15843 }
15844 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
15845 // for non-element and vnode lifecycle event listeners, auto convert
15846 // it to camelCase. See issue #2249
15847 toHandlerKey(camelize(rawName))
15848 ) : (
15849 // preserve case for plain element listeners that have uppercase
15850 // letters, as these may be custom elements' custom events
15851 `on:${rawName}`
15852 );
15853 eventName = createSimpleExpression(eventString, true, arg.loc);
15854 } else {
15855 eventName = createCompoundExpression([
15856 `${context.helperString(TO_HANDLER_KEY)}(`,
15857 arg,
15858 `)`
15859 ]);
15860 }
15861 } else {
15862 eventName = arg;
15863 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
15864 eventName.children.push(`)`);
15865 }
15866 let exp = dir.exp;
15867 if (exp && !exp.content.trim()) {
15868 exp = void 0;
15869 }
15870 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
15871 if (exp) {
15872 const isMemberExp = isMemberExpression(exp.content);
15873 const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
15874 const hasMultipleStatements = exp.content.includes(`;`);
15875 {
15876 validateBrowserExpression(
15877 exp,
15878 context,
15879 false,
15880 hasMultipleStatements
15881 );
15882 }
15883 if (isInlineStatement || shouldCache && isMemberExp) {
15884 exp = createCompoundExpression([
15885 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
15886 exp,
15887 hasMultipleStatements ? `}` : `)`
15888 ]);
15889 }
15890 }
15891 let ret = {
15892 props: [
15893 createObjectProperty(
15894 eventName,
15895 exp || createSimpleExpression(`() => {}`, false, loc)
15896 )
15897 ]
15898 };
15899 if (augmentor) {
15900 ret = augmentor(ret);
15901 }
15902 if (shouldCache) {
15903 ret.props[0].value = context.cache(ret.props[0].value);
15904 }
15905 ret.props.forEach((p) => p.key.isHandlerKey = true);
15906 return ret;
15907};
15908
15909const transformBind = (dir, _node, context) => {
15910 const { modifiers, loc } = dir;
15911 const arg = dir.arg;
15912 let { exp } = dir;
15913 if (exp && exp.type === 4 && !exp.content.trim()) {
15914 {
15915 exp = void 0;
15916 }
15917 }
15918 if (!exp) {
15919 if (arg.type !== 4 || !arg.isStatic) {
15920 context.onError(
15921 createCompilerError(
15922 52,
15923 arg.loc
15924 )
15925 );
15926 return {
15927 props: [
15928 createObjectProperty(arg, createSimpleExpression("", true, loc))
15929 ]
15930 };
15931 }
15932 const propName = camelize(arg.content);
15933 exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
15934 }
15935 if (arg.type !== 4) {
15936 arg.children.unshift(`(`);
15937 arg.children.push(`) || ""`);
15938 } else if (!arg.isStatic) {
15939 arg.content = `${arg.content} || ""`;
15940 }
15941 if (modifiers.includes("camel")) {
15942 if (arg.type === 4) {
15943 if (arg.isStatic) {
15944 arg.content = camelize(arg.content);
15945 } else {
15946 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
15947 }
15948 } else {
15949 arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
15950 arg.children.push(`)`);
15951 }
15952 }
15953 if (!context.inSSR) {
15954 if (modifiers.includes("prop")) {
15955 injectPrefix(arg, ".");
15956 }
15957 if (modifiers.includes("attr")) {
15958 injectPrefix(arg, "^");
15959 }
15960 }
15961 return {
15962 props: [createObjectProperty(arg, exp)]
15963 };
15964};
15965const injectPrefix = (arg, prefix) => {
15966 if (arg.type === 4) {
15967 if (arg.isStatic) {
15968 arg.content = prefix + arg.content;
15969 } else {
15970 arg.content = `\`${prefix}\${${arg.content}}\``;
15971 }
15972 } else {
15973 arg.children.unshift(`'${prefix}' + (`);
15974 arg.children.push(`)`);
15975 }
15976};
15977
15978const transformText = (node, context) => {
15979 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
15980 return () => {
15981 const children = node.children;
15982 let currentContainer = void 0;
15983 let hasText = false;
15984 for (let i = 0; i < children.length; i++) {
15985 const child = children[i];
15986 if (isText$1(child)) {
15987 hasText = true;
15988 for (let j = i + 1; j < children.length; j++) {
15989 const next = children[j];
15990 if (isText$1(next)) {
15991 if (!currentContainer) {
15992 currentContainer = children[i] = createCompoundExpression(
15993 [child],
15994 child.loc
15995 );
15996 }
15997 currentContainer.children.push(` + `, next);
15998 children.splice(j, 1);
15999 j--;
16000 } else {
16001 currentContainer = void 0;
16002 break;
16003 }
16004 }
16005 }
16006 }
16007 if (!hasText || // if this is a plain element with a single text child, leave it
16008 // as-is since the runtime has dedicated fast path for this by directly
16009 // setting textContent of the element.
16010 // for component root it's always normalized anyway.
16011 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
16012 // custom directives can potentially add DOM elements arbitrarily,
16013 // we need to avoid setting textContent of the element at runtime
16014 // to avoid accidentally overwriting the DOM elements added
16015 // by the user through custom directives.
16016 !node.props.find(
16017 (p) => p.type === 7 && !context.directiveTransforms[p.name]
16018 ) && // in compat mode, <template> tags with no special directives
16019 // will be rendered as a fragment so its children must be
16020 // converted into vnodes.
16021 true)) {
16022 return;
16023 }
16024 for (let i = 0; i < children.length; i++) {
16025 const child = children[i];
16026 if (isText$1(child) || child.type === 8) {
16027 const callArgs = [];
16028 if (child.type !== 2 || child.content !== " ") {
16029 callArgs.push(child);
16030 }
16031 if (!context.ssr && getConstantType(child, context) === 0) {
16032 callArgs.push(
16033 1 + (` /* ${PatchFlagNames[1]} */` )
16034 );
16035 }
16036 children[i] = {
16037 type: 12,
16038 content: child,
16039 loc: child.loc,
16040 codegenNode: createCallExpression(
16041 context.helper(CREATE_TEXT),
16042 callArgs
16043 )
16044 };
16045 }
16046 }
16047 };
16048 }
16049};
16050
16051const seen$1 = /* @__PURE__ */ new WeakSet();
16052const transformOnce = (node, context) => {
16053 if (node.type === 1 && findDir(node, "once", true)) {
16054 if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16055 return;
16056 }
16057 seen$1.add(node);
16058 context.inVOnce = true;
16059 context.helper(SET_BLOCK_TRACKING);
16060 return () => {
16061 context.inVOnce = false;
16062 const cur = context.currentNode;
16063 if (cur.codegenNode) {
16064 cur.codegenNode = context.cache(
16065 cur.codegenNode,
16066 true
16067 /* isVNode */
16068 );
16069 }
16070 };
16071 }
16072};
16073
16074const transformModel$1 = (dir, node, context) => {
16075 const { exp, arg } = dir;
16076 if (!exp) {
16077 context.onError(
16078 createCompilerError(41, dir.loc)
16079 );
16080 return createTransformProps();
16081 }
16082 const rawExp = exp.loc.source;
16083 const expString = exp.type === 4 ? exp.content : rawExp;
16084 const bindingType = context.bindingMetadata[rawExp];
16085 if (bindingType === "props" || bindingType === "props-aliased") {
16086 context.onError(createCompilerError(44, exp.loc));
16087 return createTransformProps();
16088 }
16089 const maybeRef = false;
16090 if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
16091 context.onError(
16092 createCompilerError(42, exp.loc)
16093 );
16094 return createTransformProps();
16095 }
16096 const propName = arg ? arg : createSimpleExpression("modelValue", true);
16097 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
16098 let assignmentExp;
16099 const eventArg = context.isTS ? `($event: any)` : `$event`;
16100 {
16101 assignmentExp = createCompoundExpression([
16102 `${eventArg} => ((`,
16103 exp,
16104 `) = $event)`
16105 ]);
16106 }
16107 const props = [
16108 // modelValue: foo
16109 createObjectProperty(propName, dir.exp),
16110 // "onUpdate:modelValue": $event => (foo = $event)
16111 createObjectProperty(eventName, assignmentExp)
16112 ];
16113 if (dir.modifiers.length && node.tagType === 1) {
16114 const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
16115 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
16116 props.push(
16117 createObjectProperty(
16118 modifiersKey,
16119 createSimpleExpression(
16120 `{ ${modifiers} }`,
16121 false,
16122 dir.loc,
16123 2
16124 )
16125 )
16126 );
16127 }
16128 return createTransformProps(props);
16129};
16130function createTransformProps(props = []) {
16131 return { props };
16132}
16133
16134const seen = /* @__PURE__ */ new WeakSet();
16135const transformMemo = (node, context) => {
16136 if (node.type === 1) {
16137 const dir = findDir(node, "memo");
16138 if (!dir || seen.has(node)) {
16139 return;
16140 }
16141 seen.add(node);
16142 return () => {
16143 const codegenNode = node.codegenNode || context.currentNode.codegenNode;
16144 if (codegenNode && codegenNode.type === 13) {
16145 if (node.tagType !== 1) {
16146 convertToBlock(codegenNode, context);
16147 }
16148 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
16149 dir.exp,
16150 createFunctionExpression(void 0, codegenNode),
16151 `_cache`,
16152 String(context.cached++)
16153 ]);
16154 }
16155 };
16156 }
16157};
16158
16159function getBaseTransformPreset(prefixIdentifiers) {
16160 return [
16161 [
16162 transformOnce,
16163 transformIf,
16164 transformMemo,
16165 transformFor,
16166 ...[],
16167 ...[transformExpression] ,
16168 transformSlotOutlet,
16169 transformElement,
16170 trackSlotScopes,
16171 transformText
16172 ],
16173 {
16174 on: transformOn$1,
16175 bind: transformBind,
16176 model: transformModel$1
16177 }
16178 ];
16179}
16180function baseCompile(source, options = {}) {
16181 const onError = options.onError || defaultOnError;
16182 const isModuleMode = options.mode === "module";
16183 {
16184 if (options.prefixIdentifiers === true) {
16185 onError(createCompilerError(47));
16186 } else if (isModuleMode) {
16187 onError(createCompilerError(48));
16188 }
16189 }
16190 const prefixIdentifiers = false;
16191 if (options.cacheHandlers) {
16192 onError(createCompilerError(49));
16193 }
16194 if (options.scopeId && !isModuleMode) {
16195 onError(createCompilerError(50));
16196 }
16197 const resolvedOptions = extend({}, options, {
16198 prefixIdentifiers
16199 });
16200 const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
16201 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
16202 transform(
16203 ast,
16204 extend({}, resolvedOptions, {
16205 nodeTransforms: [
16206 ...nodeTransforms,
16207 ...options.nodeTransforms || []
16208 // user transforms
16209 ],
16210 directiveTransforms: extend(
16211 {},
16212 directiveTransforms,
16213 options.directiveTransforms || {}
16214 // user transforms
16215 )
16216 })
16217 );
16218 return generate(ast, resolvedOptions);
16219}
16220
16221const noopDirectiveTransform = () => ({ props: [] });
16222
16223const V_MODEL_RADIO = Symbol(`vModelRadio` );
16224const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
16225const V_MODEL_TEXT = Symbol(`vModelText` );
16226const V_MODEL_SELECT = Symbol(`vModelSelect` );
16227const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
16228const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
16229const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
16230const V_SHOW = Symbol(`vShow` );
16231const TRANSITION = Symbol(`Transition` );
16232const TRANSITION_GROUP = Symbol(`TransitionGroup` );
16233registerRuntimeHelpers({
16234 [V_MODEL_RADIO]: `vModelRadio`,
16235 [V_MODEL_CHECKBOX]: `vModelCheckbox`,
16236 [V_MODEL_TEXT]: `vModelText`,
16237 [V_MODEL_SELECT]: `vModelSelect`,
16238 [V_MODEL_DYNAMIC]: `vModelDynamic`,
16239 [V_ON_WITH_MODIFIERS]: `withModifiers`,
16240 [V_ON_WITH_KEYS]: `withKeys`,
16241 [V_SHOW]: `vShow`,
16242 [TRANSITION]: `Transition`,
16243 [TRANSITION_GROUP]: `TransitionGroup`
16244});
16245
16246let decoder;
16247function decodeHtmlBrowser(raw, asAttr = false) {
16248 if (!decoder) {
16249 decoder = document.createElement("div");
16250 }
16251 if (asAttr) {
16252 decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
16253 return decoder.children[0].getAttribute("foo");
16254 } else {
16255 decoder.innerHTML = raw;
16256 return decoder.textContent;
16257 }
16258}
16259
16260const parserOptions = {
16261 parseMode: "html",
16262 isVoidTag,
16263 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
16264 isPreTag: (tag) => tag === "pre",
16265 decodeEntities: decodeHtmlBrowser ,
16266 isBuiltInComponent: (tag) => {
16267 if (tag === "Transition" || tag === "transition") {
16268 return TRANSITION;
16269 } else if (tag === "TransitionGroup" || tag === "transition-group") {
16270 return TRANSITION_GROUP;
16271 }
16272 },
16273 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
16274 getNamespace(tag, parent, rootNamespace) {
16275 let ns = parent ? parent.ns : rootNamespace;
16276 if (parent && ns === 2) {
16277 if (parent.tag === "annotation-xml") {
16278 if (tag === "svg") {
16279 return 1;
16280 }
16281 if (parent.props.some(
16282 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
16283 )) {
16284 ns = 0;
16285 }
16286 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
16287 ns = 0;
16288 }
16289 } else if (parent && ns === 1) {
16290 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
16291 ns = 0;
16292 }
16293 }
16294 if (ns === 0) {
16295 if (tag === "svg") {
16296 return 1;
16297 }
16298 if (tag === "math") {
16299 return 2;
16300 }
16301 }
16302 return ns;
16303 }
16304};
16305
16306const transformStyle = (node) => {
16307 if (node.type === 1) {
16308 node.props.forEach((p, i) => {
16309 if (p.type === 6 && p.name === "style" && p.value) {
16310 node.props[i] = {
16311 type: 7,
16312 name: `bind`,
16313 arg: createSimpleExpression(`style`, true, p.loc),
16314 exp: parseInlineCSS(p.value.content, p.loc),
16315 modifiers: [],
16316 loc: p.loc
16317 };
16318 }
16319 });
16320 }
16321};
16322const parseInlineCSS = (cssText, loc) => {
16323 const normalized = parseStringStyle(cssText);
16324 return createSimpleExpression(
16325 JSON.stringify(normalized),
16326 false,
16327 loc,
16328 3
16329 );
16330};
16331
16332function createDOMCompilerError(code, loc) {
16333 return createCompilerError(
16334 code,
16335 loc,
16336 DOMErrorMessages
16337 );
16338}
16339const DOMErrorMessages = {
16340 [53]: `v-html is missing expression.`,
16341 [54]: `v-html will override element children.`,
16342 [55]: `v-text is missing expression.`,
16343 [56]: `v-text will override element children.`,
16344 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
16345 [58]: `v-model argument is not supported on plain elements.`,
16346 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
16347 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
16348 [61]: `v-show is missing expression.`,
16349 [62]: `<Transition> expects exactly one child element or component.`,
16350 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
16351};
16352
16353const transformVHtml = (dir, node, context) => {
16354 const { exp, loc } = dir;
16355 if (!exp) {
16356 context.onError(
16357 createDOMCompilerError(53, loc)
16358 );
16359 }
16360 if (node.children.length) {
16361 context.onError(
16362 createDOMCompilerError(54, loc)
16363 );
16364 node.children.length = 0;
16365 }
16366 return {
16367 props: [
16368 createObjectProperty(
16369 createSimpleExpression(`innerHTML`, true, loc),
16370 exp || createSimpleExpression("", true)
16371 )
16372 ]
16373 };
16374};
16375
16376const transformVText = (dir, node, context) => {
16377 const { exp, loc } = dir;
16378 if (!exp) {
16379 context.onError(
16380 createDOMCompilerError(55, loc)
16381 );
16382 }
16383 if (node.children.length) {
16384 context.onError(
16385 createDOMCompilerError(56, loc)
16386 );
16387 node.children.length = 0;
16388 }
16389 return {
16390 props: [
16391 createObjectProperty(
16392 createSimpleExpression(`textContent`, true),
16393 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
16394 context.helperString(TO_DISPLAY_STRING),
16395 [exp],
16396 loc
16397 ) : createSimpleExpression("", true)
16398 )
16399 ]
16400 };
16401};
16402
16403const transformModel = (dir, node, context) => {
16404 const baseResult = transformModel$1(dir, node, context);
16405 if (!baseResult.props.length || node.tagType === 1) {
16406 return baseResult;
16407 }
16408 if (dir.arg) {
16409 context.onError(
16410 createDOMCompilerError(
16411 58,
16412 dir.arg.loc
16413 )
16414 );
16415 }
16416 function checkDuplicatedValue() {
16417 const value = findDir(node, "bind");
16418 if (value && isStaticArgOf(value.arg, "value")) {
16419 context.onError(
16420 createDOMCompilerError(
16421 60,
16422 value.loc
16423 )
16424 );
16425 }
16426 }
16427 const { tag } = node;
16428 const isCustomElement = context.isCustomElement(tag);
16429 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
16430 let directiveToUse = V_MODEL_TEXT;
16431 let isInvalidType = false;
16432 if (tag === "input" || isCustomElement) {
16433 const type = findProp(node, `type`);
16434 if (type) {
16435 if (type.type === 7) {
16436 directiveToUse = V_MODEL_DYNAMIC;
16437 } else if (type.value) {
16438 switch (type.value.content) {
16439 case "radio":
16440 directiveToUse = V_MODEL_RADIO;
16441 break;
16442 case "checkbox":
16443 directiveToUse = V_MODEL_CHECKBOX;
16444 break;
16445 case "file":
16446 isInvalidType = true;
16447 context.onError(
16448 createDOMCompilerError(
16449 59,
16450 dir.loc
16451 )
16452 );
16453 break;
16454 default:
16455 checkDuplicatedValue();
16456 break;
16457 }
16458 }
16459 } else if (hasDynamicKeyVBind(node)) {
16460 directiveToUse = V_MODEL_DYNAMIC;
16461 } else {
16462 checkDuplicatedValue();
16463 }
16464 } else if (tag === "select") {
16465 directiveToUse = V_MODEL_SELECT;
16466 } else {
16467 checkDuplicatedValue();
16468 }
16469 if (!isInvalidType) {
16470 baseResult.needRuntime = context.helper(directiveToUse);
16471 }
16472 } else {
16473 context.onError(
16474 createDOMCompilerError(
16475 57,
16476 dir.loc
16477 )
16478 );
16479 }
16480 baseResult.props = baseResult.props.filter(
16481 (p) => !(p.key.type === 4 && p.key.content === "modelValue")
16482 );
16483 return baseResult;
16484};
16485
16486const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
16487const isNonKeyModifier = /* @__PURE__ */ makeMap(
16488 // event propagation management
16489 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
16490);
16491const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
16492const isKeyboardEvent = /* @__PURE__ */ makeMap(
16493 `onkeyup,onkeydown,onkeypress`,
16494 true
16495);
16496const resolveModifiers = (key, modifiers, context, loc) => {
16497 const keyModifiers = [];
16498 const nonKeyModifiers = [];
16499 const eventOptionModifiers = [];
16500 for (let i = 0; i < modifiers.length; i++) {
16501 const modifier = modifiers[i];
16502 if (isEventOptionModifier(modifier)) {
16503 eventOptionModifiers.push(modifier);
16504 } else {
16505 if (maybeKeyModifier(modifier)) {
16506 if (isStaticExp(key)) {
16507 if (isKeyboardEvent(key.content)) {
16508 keyModifiers.push(modifier);
16509 } else {
16510 nonKeyModifiers.push(modifier);
16511 }
16512 } else {
16513 keyModifiers.push(modifier);
16514 nonKeyModifiers.push(modifier);
16515 }
16516 } else {
16517 if (isNonKeyModifier(modifier)) {
16518 nonKeyModifiers.push(modifier);
16519 } else {
16520 keyModifiers.push(modifier);
16521 }
16522 }
16523 }
16524 }
16525 return {
16526 keyModifiers,
16527 nonKeyModifiers,
16528 eventOptionModifiers
16529 };
16530};
16531const transformClick = (key, event) => {
16532 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
16533 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
16534 `(`,
16535 key,
16536 `) === "onClick" ? "${event}" : (`,
16537 key,
16538 `)`
16539 ]) : key;
16540};
16541const transformOn = (dir, node, context) => {
16542 return transformOn$1(dir, node, context, (baseResult) => {
16543 const { modifiers } = dir;
16544 if (!modifiers.length)
16545 return baseResult;
16546 let { key, value: handlerExp } = baseResult.props[0];
16547 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
16548 if (nonKeyModifiers.includes("right")) {
16549 key = transformClick(key, `onContextmenu`);
16550 }
16551 if (nonKeyModifiers.includes("middle")) {
16552 key = transformClick(key, `onMouseup`);
16553 }
16554 if (nonKeyModifiers.length) {
16555 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
16556 handlerExp,
16557 JSON.stringify(nonKeyModifiers)
16558 ]);
16559 }
16560 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
16561 (!isStaticExp(key) || isKeyboardEvent(key.content))) {
16562 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
16563 handlerExp,
16564 JSON.stringify(keyModifiers)
16565 ]);
16566 }
16567 if (eventOptionModifiers.length) {
16568 const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
16569 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
16570 }
16571 return {
16572 props: [createObjectProperty(key, handlerExp)]
16573 };
16574 });
16575};
16576
16577const transformShow = (dir, node, context) => {
16578 const { exp, loc } = dir;
16579 if (!exp) {
16580 context.onError(
16581 createDOMCompilerError(61, loc)
16582 );
16583 }
16584 return {
16585 props: [],
16586 needRuntime: context.helper(V_SHOW)
16587 };
16588};
16589
16590const transformTransition = (node, context) => {
16591 if (node.type === 1 && node.tagType === 1) {
16592 const component = context.isBuiltInComponent(node.tag);
16593 if (component === TRANSITION) {
16594 return () => {
16595 if (!node.children.length) {
16596 return;
16597 }
16598 if (hasMultipleChildren(node)) {
16599 context.onError(
16600 createDOMCompilerError(
16601 62,
16602 {
16603 start: node.children[0].loc.start,
16604 end: node.children[node.children.length - 1].loc.end,
16605 source: ""
16606 }
16607 )
16608 );
16609 }
16610 const child = node.children[0];
16611 if (child.type === 1) {
16612 for (const p of child.props) {
16613 if (p.type === 7 && p.name === "show") {
16614 node.props.push({
16615 type: 6,
16616 name: "persisted",
16617 nameLoc: node.loc,
16618 value: void 0,
16619 loc: node.loc
16620 });
16621 }
16622 }
16623 }
16624 };
16625 }
16626 }
16627};
16628function hasMultipleChildren(node) {
16629 const children = node.children = node.children.filter(
16630 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
16631 );
16632 const child = children[0];
16633 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
16634}
16635
16636const ignoreSideEffectTags = (node, context) => {
16637 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
16638 context.onError(
16639 createDOMCompilerError(
16640 63,
16641 node.loc
16642 )
16643 );
16644 context.removeNode();
16645 }
16646};
16647
16648const DOMNodeTransforms = [
16649 transformStyle,
16650 ...[transformTransition]
16651];
16652const DOMDirectiveTransforms = {
16653 cloak: noopDirectiveTransform,
16654 html: transformVHtml,
16655 text: transformVText,
16656 model: transformModel,
16657 // override compiler-core
16658 on: transformOn,
16659 // override compiler-core
16660 show: transformShow
16661};
16662function compile(src, options = {}) {
16663 return baseCompile(
16664 src,
16665 extend({}, parserOptions, options, {
16666 nodeTransforms: [
16667 // ignore <script> and <tag>
16668 // this is not put inside DOMNodeTransforms because that list is used
16669 // by compiler-ssr to generate vnode fallback branches
16670 ignoreSideEffectTags,
16671 ...DOMNodeTransforms,
16672 ...options.nodeTransforms || []
16673 ],
16674 directiveTransforms: extend(
16675 {},
16676 DOMDirectiveTransforms,
16677 options.directiveTransforms || {}
16678 ),
16679 transformHoist: null
16680 })
16681 );
16682}
16683
16684{
16685 initDev();
16686}
16687const compileCache = /* @__PURE__ */ new WeakMap();
16688function getCache(options) {
16689 let c = compileCache.get(options != null ? options : EMPTY_OBJ);
16690 if (!c) {
16691 c = /* @__PURE__ */ Object.create(null);
16692 compileCache.set(options != null ? options : EMPTY_OBJ, c);
16693 }
16694 return c;
16695}
16696function compileToFunction(template, options) {
16697 if (!isString(template)) {
16698 if (template.nodeType) {
16699 template = template.innerHTML;
16700 } else {
16701 warn(`invalid template option: `, template);
16702 return NOOP;
16703 }
16704 }
16705 const key = template;
16706 const cache = getCache(options);
16707 const cached = cache[key];
16708 if (cached) {
16709 return cached;
16710 }
16711 if (template[0] === "#") {
16712 const el = document.querySelector(template);
16713 if (!el) {
16714 warn(`Template element not found or is empty: ${template}`);
16715 }
16716 template = el ? el.innerHTML : ``;
16717 }
16718 const opts = extend(
16719 {
16720 hoistStatic: true,
16721 onError: onError ,
16722 onWarn: (e) => onError(e, true)
16723 },
16724 options
16725 );
16726 if (!opts.isCustomElement && typeof customElements !== "undefined") {
16727 opts.isCustomElement = (tag) => !!customElements.get(tag);
16728 }
16729 const { code } = compile(template, opts);
16730 function onError(err, asWarning = false) {
16731 const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
16732 const codeFrame = err.loc && generateCodeFrame(
16733 template,
16734 err.loc.start.offset,
16735 err.loc.end.offset
16736 );
16737 warn(codeFrame ? `${message}
16738${codeFrame}` : message);
16739 }
16740 const render = new Function("Vue", code)(runtimeDom);
16741 render._rc = true;
16742 return cache[key] = render;
16743}
16744registerRuntimeCompiler(compileToFunction);
16745
16746export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };