1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var Vue = (function (exports) {
|
7 | 'use strict';
|
8 |
|
9 |
|
10 |
|
11 | function makeMap(str, expectsLowerCase) {
|
12 | const set = new Set(str.split(","));
|
13 | return (val) => set.has(val);
|
14 | }
|
15 |
|
16 | const EMPTY_OBJ = Object.freeze({}) ;
|
17 | const EMPTY_ARR = Object.freeze([]) ;
|
18 | const NOOP = () => {
|
19 | };
|
20 | const NO = () => false;
|
21 | const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
22 | (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
23 | const isModelListener = (key) => key.startsWith("onUpdate:");
|
24 | const extend = Object.assign;
|
25 | const remove = (arr, el) => {
|
26 | const i = arr.indexOf(el);
|
27 | if (i > -1) {
|
28 | arr.splice(i, 1);
|
29 | }
|
30 | };
|
31 | const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
32 | const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
33 | const isArray = Array.isArray;
|
34 | const isMap = (val) => toTypeString(val) === "[object Map]";
|
35 | const isSet = (val) => toTypeString(val) === "[object Set]";
|
36 | const isDate = (val) => toTypeString(val) === "[object Date]";
|
37 | const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
38 | const isFunction = (val) => typeof val === "function";
|
39 | const isString = (val) => typeof val === "string";
|
40 | const isSymbol = (val) => typeof val === "symbol";
|
41 | const isObject = (val) => val !== null && typeof val === "object";
|
42 | const isPromise = (val) => {
|
43 | return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
44 | };
|
45 | const objectToString = Object.prototype.toString;
|
46 | const toTypeString = (value) => objectToString.call(value);
|
47 | const toRawType = (value) => {
|
48 | return toTypeString(value).slice(8, -1);
|
49 | };
|
50 | const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
51 | const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
52 | const isReservedProp = makeMap(
|
53 |
|
54 | ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
55 | );
|
56 | const isBuiltInDirective = makeMap(
|
57 | "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
58 | );
|
59 | const cacheStringFunction = (fn) => {
|
60 | const cache = Object.create(null);
|
61 | return (str) => {
|
62 | const hit = cache[str];
|
63 | return hit || (cache[str] = fn(str));
|
64 | };
|
65 | };
|
66 | const camelizeRE = /-(\w)/g;
|
67 | const camelize = cacheStringFunction((str) => {
|
68 | return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
69 | });
|
70 | const hyphenateRE = /\B([A-Z])/g;
|
71 | const hyphenate = cacheStringFunction(
|
72 | (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
73 | );
|
74 | const capitalize = cacheStringFunction((str) => {
|
75 | return str.charAt(0).toUpperCase() + str.slice(1);
|
76 | });
|
77 | const toHandlerKey = cacheStringFunction((str) => {
|
78 | const s = str ? `on${capitalize(str)}` : ``;
|
79 | return s;
|
80 | });
|
81 | const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
82 | const invokeArrayFns = (fns, arg) => {
|
83 | for (let i = 0; i < fns.length; i++) {
|
84 | fns[i](arg);
|
85 | }
|
86 | };
|
87 | const def = (obj, key, value) => {
|
88 | Object.defineProperty(obj, key, {
|
89 | configurable: true,
|
90 | enumerable: false,
|
91 | value
|
92 | });
|
93 | };
|
94 | const looseToNumber = (val) => {
|
95 | const n = parseFloat(val);
|
96 | return isNaN(n) ? val : n;
|
97 | };
|
98 | const toNumber = (val) => {
|
99 | const n = isString(val) ? Number(val) : NaN;
|
100 | return isNaN(n) ? val : n;
|
101 | };
|
102 | let _globalThis;
|
103 | const getGlobalThis = () => {
|
104 | return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
105 | };
|
106 |
|
107 | const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
108 | const isGloballyAllowed = makeMap(GLOBALS_ALLOWED);
|
109 |
|
110 | function normalizeStyle(value) {
|
111 | if (isArray(value)) {
|
112 | const res = {};
|
113 | for (let i = 0; i < value.length; i++) {
|
114 | const item = value[i];
|
115 | const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
116 | if (normalized) {
|
117 | for (const key in normalized) {
|
118 | res[key] = normalized[key];
|
119 | }
|
120 | }
|
121 | }
|
122 | return res;
|
123 | } else if (isString(value) || isObject(value)) {
|
124 | return value;
|
125 | }
|
126 | }
|
127 | const listDelimiterRE = /;(?![^(]*\))/g;
|
128 | const propertyDelimiterRE = /:([^]+)/;
|
129 | const styleCommentRE = /\/\*[^]*?\*\//g;
|
130 | function parseStringStyle(cssText) {
|
131 | const ret = {};
|
132 | cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
133 | if (item) {
|
134 | const tmp = item.split(propertyDelimiterRE);
|
135 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
136 | }
|
137 | });
|
138 | return ret;
|
139 | }
|
140 | function stringifyStyle(styles) {
|
141 | let ret = "";
|
142 | if (!styles || isString(styles)) {
|
143 | return ret;
|
144 | }
|
145 | for (const key in styles) {
|
146 | const value = styles[key];
|
147 | const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
148 | if (isString(value) || typeof value === "number") {
|
149 | ret += `${normalizedKey}:${value};`;
|
150 | }
|
151 | }
|
152 | return ret;
|
153 | }
|
154 | function normalizeClass(value) {
|
155 | let res = "";
|
156 | if (isString(value)) {
|
157 | res = value;
|
158 | } else if (isArray(value)) {
|
159 | for (let i = 0; i < value.length; i++) {
|
160 | const normalized = normalizeClass(value[i]);
|
161 | if (normalized) {
|
162 | res += normalized + " ";
|
163 | }
|
164 | }
|
165 | } else if (isObject(value)) {
|
166 | for (const name in value) {
|
167 | if (value[name]) {
|
168 | res += name + " ";
|
169 | }
|
170 | }
|
171 | }
|
172 | return res.trim();
|
173 | }
|
174 | function normalizeProps(props) {
|
175 | if (!props)
|
176 | return null;
|
177 | let { class: klass, style } = props;
|
178 | if (klass && !isString(klass)) {
|
179 | props.class = normalizeClass(klass);
|
180 | }
|
181 | if (style) {
|
182 | props.style = normalizeStyle(style);
|
183 | }
|
184 | return props;
|
185 | }
|
186 |
|
187 | const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
188 | const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
189 | const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
190 | const isHTMLTag = makeMap(HTML_TAGS);
|
191 | const isSVGTag = makeMap(SVG_TAGS);
|
192 | const isMathMLTag = makeMap(MATH_TAGS);
|
193 |
|
194 | const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
195 | const isSpecialBooleanAttr = makeMap(specialBooleanAttrs);
|
196 | const isBooleanAttr = makeMap(
|
197 | specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
198 | );
|
199 | function includeBooleanAttr(value) {
|
200 | return !!value || value === "";
|
201 | }
|
202 | const isKnownHtmlAttr = makeMap(
|
203 | `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`
|
204 | );
|
205 | const isKnownSvgAttr = makeMap(
|
206 | `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`
|
207 | );
|
208 | function isRenderableAttrValue(value) {
|
209 | if (value == null) {
|
210 | return false;
|
211 | }
|
212 | const type = typeof value;
|
213 | return type === "string" || type === "number" || type === "boolean";
|
214 | }
|
215 |
|
216 | function looseCompareArrays(a, b) {
|
217 | if (a.length !== b.length)
|
218 | return false;
|
219 | let equal = true;
|
220 | for (let i = 0; equal && i < a.length; i++) {
|
221 | equal = looseEqual(a[i], b[i]);
|
222 | }
|
223 | return equal;
|
224 | }
|
225 | function looseEqual(a, b) {
|
226 | if (a === b)
|
227 | return true;
|
228 | let aValidType = isDate(a);
|
229 | let bValidType = isDate(b);
|
230 | if (aValidType || bValidType) {
|
231 | return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
232 | }
|
233 | aValidType = isSymbol(a);
|
234 | bValidType = isSymbol(b);
|
235 | if (aValidType || bValidType) {
|
236 | return a === b;
|
237 | }
|
238 | aValidType = isArray(a);
|
239 | bValidType = isArray(b);
|
240 | if (aValidType || bValidType) {
|
241 | return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
242 | }
|
243 | aValidType = isObject(a);
|
244 | bValidType = isObject(b);
|
245 | if (aValidType || bValidType) {
|
246 | if (!aValidType || !bValidType) {
|
247 | return false;
|
248 | }
|
249 | const aKeysCount = Object.keys(a).length;
|
250 | const bKeysCount = Object.keys(b).length;
|
251 | if (aKeysCount !== bKeysCount) {
|
252 | return false;
|
253 | }
|
254 | for (const key in a) {
|
255 | const aHasKey = a.hasOwnProperty(key);
|
256 | const bHasKey = b.hasOwnProperty(key);
|
257 | if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
258 | return false;
|
259 | }
|
260 | }
|
261 | }
|
262 | return String(a) === String(b);
|
263 | }
|
264 | function looseIndexOf(arr, val) {
|
265 | return arr.findIndex((item) => looseEqual(item, val));
|
266 | }
|
267 |
|
268 | const toDisplayString = (val) => {
|
269 | return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
270 | };
|
271 | const replacer = (_key, val) => {
|
272 | if (val && val.__v_isRef) {
|
273 | return replacer(_key, val.value);
|
274 | } else if (isMap(val)) {
|
275 | return {
|
276 | [`Map(${val.size})`]: [...val.entries()].reduce(
|
277 | (entries, [key, val2], i) => {
|
278 | entries[stringifySymbol(key, i) + " =>"] = val2;
|
279 | return entries;
|
280 | },
|
281 | {}
|
282 | )
|
283 | };
|
284 | } else if (isSet(val)) {
|
285 | return {
|
286 | [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
287 | };
|
288 | } else if (isSymbol(val)) {
|
289 | return stringifySymbol(val);
|
290 | } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
291 | return String(val);
|
292 | }
|
293 | return val;
|
294 | };
|
295 | const stringifySymbol = (v, i = "") => {
|
296 | var _a;
|
297 | return (
|
298 |
|
299 |
|
300 | isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
|
301 | );
|
302 | };
|
303 |
|
304 | function warn$2(msg, ...args) {
|
305 | console.warn(`[Vue warn] ${msg}`, ...args);
|
306 | }
|
307 |
|
308 | let activeEffectScope;
|
309 | class EffectScope {
|
310 | constructor(detached = false) {
|
311 | this.detached = detached;
|
312 | |
313 |
|
314 |
|
315 | this._active = true;
|
316 | |
317 |
|
318 |
|
319 | this.effects = [];
|
320 | |
321 |
|
322 |
|
323 | this.cleanups = [];
|
324 | this.parent = activeEffectScope;
|
325 | if (!detached && activeEffectScope) {
|
326 | this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
327 | this
|
328 | ) - 1;
|
329 | }
|
330 | }
|
331 | get active() {
|
332 | return this._active;
|
333 | }
|
334 | run(fn) {
|
335 | if (this._active) {
|
336 | const currentEffectScope = activeEffectScope;
|
337 | try {
|
338 | activeEffectScope = this;
|
339 | return fn();
|
340 | } finally {
|
341 | activeEffectScope = currentEffectScope;
|
342 | }
|
343 | } else {
|
344 | warn$2(`cannot run an inactive effect scope.`);
|
345 | }
|
346 | }
|
347 | |
348 |
|
349 |
|
350 |
|
351 | on() {
|
352 | activeEffectScope = this;
|
353 | }
|
354 | |
355 |
|
356 |
|
357 |
|
358 | off() {
|
359 | activeEffectScope = this.parent;
|
360 | }
|
361 | stop(fromParent) {
|
362 | if (this._active) {
|
363 | let i, l;
|
364 | for (i = 0, l = this.effects.length; i < l; i++) {
|
365 | this.effects[i].stop();
|
366 | }
|
367 | for (i = 0, l = this.cleanups.length; i < l; i++) {
|
368 | this.cleanups[i]();
|
369 | }
|
370 | if (this.scopes) {
|
371 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
372 | this.scopes[i].stop(true);
|
373 | }
|
374 | }
|
375 | if (!this.detached && this.parent && !fromParent) {
|
376 | const last = this.parent.scopes.pop();
|
377 | if (last && last !== this) {
|
378 | this.parent.scopes[this.index] = last;
|
379 | last.index = this.index;
|
380 | }
|
381 | }
|
382 | this.parent = void 0;
|
383 | this._active = false;
|
384 | }
|
385 | }
|
386 | }
|
387 | function effectScope(detached) {
|
388 | return new EffectScope(detached);
|
389 | }
|
390 | function recordEffectScope(effect, scope = activeEffectScope) {
|
391 | if (scope && scope.active) {
|
392 | scope.effects.push(effect);
|
393 | }
|
394 | }
|
395 | function getCurrentScope() {
|
396 | return activeEffectScope;
|
397 | }
|
398 | function onScopeDispose(fn) {
|
399 | if (activeEffectScope) {
|
400 | activeEffectScope.cleanups.push(fn);
|
401 | } else {
|
402 | warn$2(
|
403 | `onScopeDispose() is called when there is no active effect scope to be associated with.`
|
404 | );
|
405 | }
|
406 | }
|
407 |
|
408 | let activeEffect;
|
409 | class ReactiveEffect {
|
410 | constructor(fn, trigger, scheduler, scope) {
|
411 | this.fn = fn;
|
412 | this.trigger = trigger;
|
413 | this.scheduler = scheduler;
|
414 | this.active = true;
|
415 | this.deps = [];
|
416 | |
417 |
|
418 |
|
419 | this._dirtyLevel = 4;
|
420 | |
421 |
|
422 |
|
423 | this._trackId = 0;
|
424 | |
425 |
|
426 |
|
427 | this._runnings = 0;
|
428 | |
429 |
|
430 |
|
431 | this._shouldSchedule = false;
|
432 | |
433 |
|
434 |
|
435 | this._depsLength = 0;
|
436 | recordEffectScope(this, scope);
|
437 | }
|
438 | get dirty() {
|
439 | if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
440 | this._dirtyLevel = 1;
|
441 | pauseTracking();
|
442 | for (let i = 0; i < this._depsLength; i++) {
|
443 | const dep = this.deps[i];
|
444 | if (dep.computed) {
|
445 | triggerComputed(dep.computed);
|
446 | if (this._dirtyLevel >= 4) {
|
447 | break;
|
448 | }
|
449 | }
|
450 | }
|
451 | if (this._dirtyLevel === 1) {
|
452 | this._dirtyLevel = 0;
|
453 | }
|
454 | resetTracking();
|
455 | }
|
456 | return this._dirtyLevel >= 4;
|
457 | }
|
458 | set dirty(v) {
|
459 | this._dirtyLevel = v ? 4 : 0;
|
460 | }
|
461 | run() {
|
462 | this._dirtyLevel = 0;
|
463 | if (!this.active) {
|
464 | return this.fn();
|
465 | }
|
466 | let lastShouldTrack = shouldTrack;
|
467 | let lastEffect = activeEffect;
|
468 | try {
|
469 | shouldTrack = true;
|
470 | activeEffect = this;
|
471 | this._runnings++;
|
472 | preCleanupEffect(this);
|
473 | return this.fn();
|
474 | } finally {
|
475 | postCleanupEffect(this);
|
476 | this._runnings--;
|
477 | activeEffect = lastEffect;
|
478 | shouldTrack = lastShouldTrack;
|
479 | }
|
480 | }
|
481 | stop() {
|
482 | var _a;
|
483 | if (this.active) {
|
484 | preCleanupEffect(this);
|
485 | postCleanupEffect(this);
|
486 | (_a = this.onStop) == null ? void 0 : _a.call(this);
|
487 | this.active = false;
|
488 | }
|
489 | }
|
490 | }
|
491 | function triggerComputed(computed) {
|
492 | return computed.value;
|
493 | }
|
494 | function preCleanupEffect(effect2) {
|
495 | effect2._trackId++;
|
496 | effect2._depsLength = 0;
|
497 | }
|
498 | function postCleanupEffect(effect2) {
|
499 | if (effect2.deps.length > effect2._depsLength) {
|
500 | for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
501 | cleanupDepEffect(effect2.deps[i], effect2);
|
502 | }
|
503 | effect2.deps.length = effect2._depsLength;
|
504 | }
|
505 | }
|
506 | function cleanupDepEffect(dep, effect2) {
|
507 | const trackId = dep.get(effect2);
|
508 | if (trackId !== void 0 && effect2._trackId !== trackId) {
|
509 | dep.delete(effect2);
|
510 | if (dep.size === 0) {
|
511 | dep.cleanup();
|
512 | }
|
513 | }
|
514 | }
|
515 | function effect(fn, options) {
|
516 | if (fn.effect instanceof ReactiveEffect) {
|
517 | fn = fn.effect.fn;
|
518 | }
|
519 | const _effect = new ReactiveEffect(fn, NOOP, () => {
|
520 | if (_effect.dirty) {
|
521 | _effect.run();
|
522 | }
|
523 | });
|
524 | if (options) {
|
525 | extend(_effect, options);
|
526 | if (options.scope)
|
527 | recordEffectScope(_effect, options.scope);
|
528 | }
|
529 | if (!options || !options.lazy) {
|
530 | _effect.run();
|
531 | }
|
532 | const runner = _effect.run.bind(_effect);
|
533 | runner.effect = _effect;
|
534 | return runner;
|
535 | }
|
536 | function stop(runner) {
|
537 | runner.effect.stop();
|
538 | }
|
539 | let shouldTrack = true;
|
540 | let pauseScheduleStack = 0;
|
541 | const trackStack = [];
|
542 | function pauseTracking() {
|
543 | trackStack.push(shouldTrack);
|
544 | shouldTrack = false;
|
545 | }
|
546 | function resetTracking() {
|
547 | const last = trackStack.pop();
|
548 | shouldTrack = last === void 0 ? true : last;
|
549 | }
|
550 | function pauseScheduling() {
|
551 | pauseScheduleStack++;
|
552 | }
|
553 | function resetScheduling() {
|
554 | pauseScheduleStack--;
|
555 | while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
556 | queueEffectSchedulers.shift()();
|
557 | }
|
558 | }
|
559 | function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
560 | var _a;
|
561 | if (dep.get(effect2) !== effect2._trackId) {
|
562 | dep.set(effect2, effect2._trackId);
|
563 | const oldDep = effect2.deps[effect2._depsLength];
|
564 | if (oldDep !== dep) {
|
565 | if (oldDep) {
|
566 | cleanupDepEffect(oldDep, effect2);
|
567 | }
|
568 | effect2.deps[effect2._depsLength++] = dep;
|
569 | } else {
|
570 | effect2._depsLength++;
|
571 | }
|
572 | {
|
573 | (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
574 | }
|
575 | }
|
576 | }
|
577 | const queueEffectSchedulers = [];
|
578 | function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
579 | var _a;
|
580 | pauseScheduling();
|
581 | for (const effect2 of dep.keys()) {
|
582 | let tracking;
|
583 | if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
584 | effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
|
585 | effect2._dirtyLevel = dirtyLevel;
|
586 | }
|
587 | if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
588 | {
|
589 | (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
590 | }
|
591 | effect2.trigger();
|
592 | if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
|
593 | effect2._shouldSchedule = false;
|
594 | if (effect2.scheduler) {
|
595 | queueEffectSchedulers.push(effect2.scheduler);
|
596 | }
|
597 | }
|
598 | }
|
599 | }
|
600 | resetScheduling();
|
601 | }
|
602 |
|
603 | const createDep = (cleanup, computed) => {
|
604 | const dep = new Map();
|
605 | dep.cleanup = cleanup;
|
606 | dep.computed = computed;
|
607 | return dep;
|
608 | };
|
609 |
|
610 | const targetMap = new WeakMap();
|
611 | const ITERATE_KEY = Symbol("iterate" );
|
612 | const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
613 | function track(target, type, key) {
|
614 | if (shouldTrack && activeEffect) {
|
615 | let depsMap = targetMap.get(target);
|
616 | if (!depsMap) {
|
617 | targetMap.set(target, depsMap = new Map());
|
618 | }
|
619 | let dep = depsMap.get(key);
|
620 | if (!dep) {
|
621 | depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
622 | }
|
623 | trackEffect(
|
624 | activeEffect,
|
625 | dep,
|
626 | {
|
627 | target,
|
628 | type,
|
629 | key
|
630 | }
|
631 | );
|
632 | }
|
633 | }
|
634 | function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
635 | const depsMap = targetMap.get(target);
|
636 | if (!depsMap) {
|
637 | return;
|
638 | }
|
639 | let deps = [];
|
640 | if (type === "clear") {
|
641 | deps = [...depsMap.values()];
|
642 | } else if (key === "length" && isArray(target)) {
|
643 | const newLength = Number(newValue);
|
644 | depsMap.forEach((dep, key2) => {
|
645 | if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
646 | deps.push(dep);
|
647 | }
|
648 | });
|
649 | } else {
|
650 | if (key !== void 0) {
|
651 | deps.push(depsMap.get(key));
|
652 | }
|
653 | switch (type) {
|
654 | case "add":
|
655 | if (!isArray(target)) {
|
656 | deps.push(depsMap.get(ITERATE_KEY));
|
657 | if (isMap(target)) {
|
658 | deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
659 | }
|
660 | } else if (isIntegerKey(key)) {
|
661 | deps.push(depsMap.get("length"));
|
662 | }
|
663 | break;
|
664 | case "delete":
|
665 | if (!isArray(target)) {
|
666 | deps.push(depsMap.get(ITERATE_KEY));
|
667 | if (isMap(target)) {
|
668 | deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
669 | }
|
670 | }
|
671 | break;
|
672 | case "set":
|
673 | if (isMap(target)) {
|
674 | deps.push(depsMap.get(ITERATE_KEY));
|
675 | }
|
676 | break;
|
677 | }
|
678 | }
|
679 | pauseScheduling();
|
680 | for (const dep of deps) {
|
681 | if (dep) {
|
682 | triggerEffects(
|
683 | dep,
|
684 | 4,
|
685 | {
|
686 | target,
|
687 | type,
|
688 | key,
|
689 | newValue,
|
690 | oldValue,
|
691 | oldTarget
|
692 | }
|
693 | );
|
694 | }
|
695 | }
|
696 | resetScheduling();
|
697 | }
|
698 | function getDepFromReactive(object, key) {
|
699 | var _a;
|
700 | return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
701 | }
|
702 |
|
703 | const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`);
|
704 | const builtInSymbols = new Set(
|
705 | Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
706 | );
|
707 | const arrayInstrumentations = createArrayInstrumentations();
|
708 | function createArrayInstrumentations() {
|
709 | const instrumentations = {};
|
710 | ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
711 | instrumentations[key] = function(...args) {
|
712 | const arr = toRaw(this);
|
713 | for (let i = 0, l = this.length; i < l; i++) {
|
714 | track(arr, "get", i + "");
|
715 | }
|
716 | const res = arr[key](...args);
|
717 | if (res === -1 || res === false) {
|
718 | return arr[key](...args.map(toRaw));
|
719 | } else {
|
720 | return res;
|
721 | }
|
722 | };
|
723 | });
|
724 | ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
725 | instrumentations[key] = function(...args) {
|
726 | pauseTracking();
|
727 | pauseScheduling();
|
728 | const res = toRaw(this)[key].apply(this, args);
|
729 | resetScheduling();
|
730 | resetTracking();
|
731 | return res;
|
732 | };
|
733 | });
|
734 | return instrumentations;
|
735 | }
|
736 | function hasOwnProperty(key) {
|
737 | if (!isSymbol(key))
|
738 | key = String(key);
|
739 | const obj = toRaw(this);
|
740 | track(obj, "has", key);
|
741 | return obj.hasOwnProperty(key);
|
742 | }
|
743 | class BaseReactiveHandler {
|
744 | constructor(_isReadonly = false, _isShallow = false) {
|
745 | this._isReadonly = _isReadonly;
|
746 | this._isShallow = _isShallow;
|
747 | }
|
748 | get(target, key, receiver) {
|
749 | const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
750 | if (key === "__v_isReactive") {
|
751 | return !isReadonly2;
|
752 | } else if (key === "__v_isReadonly") {
|
753 | return isReadonly2;
|
754 | } else if (key === "__v_isShallow") {
|
755 | return isShallow2;
|
756 | } else if (key === "__v_raw") {
|
757 | if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) ||
|
758 |
|
759 | Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
760 | return target;
|
761 | }
|
762 | return;
|
763 | }
|
764 | const targetIsArray = isArray(target);
|
765 | if (!isReadonly2) {
|
766 | if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
767 | return Reflect.get(arrayInstrumentations, key, receiver);
|
768 | }
|
769 | if (key === "hasOwnProperty") {
|
770 | return hasOwnProperty;
|
771 | }
|
772 | }
|
773 | const res = Reflect.get(target, key, receiver);
|
774 | if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
775 | return res;
|
776 | }
|
777 | if (!isReadonly2) {
|
778 | track(target, "get", key);
|
779 | }
|
780 | if (isShallow2) {
|
781 | return res;
|
782 | }
|
783 | if (isRef(res)) {
|
784 | return targetIsArray && isIntegerKey(key) ? res : res.value;
|
785 | }
|
786 | if (isObject(res)) {
|
787 | return isReadonly2 ? readonly(res) : reactive(res);
|
788 | }
|
789 | return res;
|
790 | }
|
791 | }
|
792 | class MutableReactiveHandler extends BaseReactiveHandler {
|
793 | constructor(isShallow2 = false) {
|
794 | super(false, isShallow2);
|
795 | }
|
796 | set(target, key, value, receiver) {
|
797 | let oldValue = target[key];
|
798 | if (!this._isShallow) {
|
799 | const isOldValueReadonly = isReadonly(oldValue);
|
800 | if (!isShallow(value) && !isReadonly(value)) {
|
801 | oldValue = toRaw(oldValue);
|
802 | value = toRaw(value);
|
803 | }
|
804 | if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
805 | if (isOldValueReadonly) {
|
806 | return false;
|
807 | } else {
|
808 | oldValue.value = value;
|
809 | return true;
|
810 | }
|
811 | }
|
812 | }
|
813 | const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
814 | const result = Reflect.set(target, key, value, receiver);
|
815 | if (target === toRaw(receiver)) {
|
816 | if (!hadKey) {
|
817 | trigger(target, "add", key, value);
|
818 | } else if (hasChanged(value, oldValue)) {
|
819 | trigger(target, "set", key, value, oldValue);
|
820 | }
|
821 | }
|
822 | return result;
|
823 | }
|
824 | deleteProperty(target, key) {
|
825 | const hadKey = hasOwn(target, key);
|
826 | const oldValue = target[key];
|
827 | const result = Reflect.deleteProperty(target, key);
|
828 | if (result && hadKey) {
|
829 | trigger(target, "delete", key, void 0, oldValue);
|
830 | }
|
831 | return result;
|
832 | }
|
833 | has(target, key) {
|
834 | const result = Reflect.has(target, key);
|
835 | if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
836 | track(target, "has", key);
|
837 | }
|
838 | return result;
|
839 | }
|
840 | ownKeys(target) {
|
841 | track(
|
842 | target,
|
843 | "iterate",
|
844 | isArray(target) ? "length" : ITERATE_KEY
|
845 | );
|
846 | return Reflect.ownKeys(target);
|
847 | }
|
848 | }
|
849 | class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
850 | constructor(isShallow2 = false) {
|
851 | super(true, isShallow2);
|
852 | }
|
853 | set(target, key) {
|
854 | {
|
855 | warn$2(
|
856 | `Set operation on key "${String(key)}" failed: target is readonly.`,
|
857 | target
|
858 | );
|
859 | }
|
860 | return true;
|
861 | }
|
862 | deleteProperty(target, key) {
|
863 | {
|
864 | warn$2(
|
865 | `Delete operation on key "${String(key)}" failed: target is readonly.`,
|
866 | target
|
867 | );
|
868 | }
|
869 | return true;
|
870 | }
|
871 | }
|
872 | const mutableHandlers = new MutableReactiveHandler();
|
873 | const readonlyHandlers = new ReadonlyReactiveHandler();
|
874 | const shallowReactiveHandlers = new MutableReactiveHandler(
|
875 | true
|
876 | );
|
877 | const shallowReadonlyHandlers = new ReadonlyReactiveHandler(true);
|
878 |
|
879 | const toShallow = (value) => value;
|
880 | const getProto = (v) => Reflect.getPrototypeOf(v);
|
881 | function get(target, key, isReadonly = false, isShallow = false) {
|
882 | target = target["__v_raw"];
|
883 | const rawTarget = toRaw(target);
|
884 | const rawKey = toRaw(key);
|
885 | if (!isReadonly) {
|
886 | if (hasChanged(key, rawKey)) {
|
887 | track(rawTarget, "get", key);
|
888 | }
|
889 | track(rawTarget, "get", rawKey);
|
890 | }
|
891 | const { has: has2 } = getProto(rawTarget);
|
892 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
893 | if (has2.call(rawTarget, key)) {
|
894 | return wrap(target.get(key));
|
895 | } else if (has2.call(rawTarget, rawKey)) {
|
896 | return wrap(target.get(rawKey));
|
897 | } else if (target !== rawTarget) {
|
898 | target.get(key);
|
899 | }
|
900 | }
|
901 | function has(key, isReadonly = false) {
|
902 | const target = this["__v_raw"];
|
903 | const rawTarget = toRaw(target);
|
904 | const rawKey = toRaw(key);
|
905 | if (!isReadonly) {
|
906 | if (hasChanged(key, rawKey)) {
|
907 | track(rawTarget, "has", key);
|
908 | }
|
909 | track(rawTarget, "has", rawKey);
|
910 | }
|
911 | return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
912 | }
|
913 | function size(target, isReadonly = false) {
|
914 | target = target["__v_raw"];
|
915 | !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
916 | return Reflect.get(target, "size", target);
|
917 | }
|
918 | function add(value) {
|
919 | value = toRaw(value);
|
920 | const target = toRaw(this);
|
921 | const proto = getProto(target);
|
922 | const hadKey = proto.has.call(target, value);
|
923 | if (!hadKey) {
|
924 | target.add(value);
|
925 | trigger(target, "add", value, value);
|
926 | }
|
927 | return this;
|
928 | }
|
929 | function set(key, value) {
|
930 | value = toRaw(value);
|
931 | const target = toRaw(this);
|
932 | const { has: has2, get: get2 } = getProto(target);
|
933 | let hadKey = has2.call(target, key);
|
934 | if (!hadKey) {
|
935 | key = toRaw(key);
|
936 | hadKey = has2.call(target, key);
|
937 | } else {
|
938 | checkIdentityKeys(target, has2, key);
|
939 | }
|
940 | const oldValue = get2.call(target, key);
|
941 | target.set(key, value);
|
942 | if (!hadKey) {
|
943 | trigger(target, "add", key, value);
|
944 | } else if (hasChanged(value, oldValue)) {
|
945 | trigger(target, "set", key, value, oldValue);
|
946 | }
|
947 | return this;
|
948 | }
|
949 | function deleteEntry(key) {
|
950 | const target = toRaw(this);
|
951 | const { has: has2, get: get2 } = getProto(target);
|
952 | let hadKey = has2.call(target, key);
|
953 | if (!hadKey) {
|
954 | key = toRaw(key);
|
955 | hadKey = has2.call(target, key);
|
956 | } else {
|
957 | checkIdentityKeys(target, has2, key);
|
958 | }
|
959 | const oldValue = get2 ? get2.call(target, key) : void 0;
|
960 | const result = target.delete(key);
|
961 | if (hadKey) {
|
962 | trigger(target, "delete", key, void 0, oldValue);
|
963 | }
|
964 | return result;
|
965 | }
|
966 | function clear() {
|
967 | const target = toRaw(this);
|
968 | const hadItems = target.size !== 0;
|
969 | const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
|
970 | const result = target.clear();
|
971 | if (hadItems) {
|
972 | trigger(target, "clear", void 0, void 0, oldTarget);
|
973 | }
|
974 | return result;
|
975 | }
|
976 | function createForEach(isReadonly, isShallow) {
|
977 | return function forEach(callback, thisArg) {
|
978 | const observed = this;
|
979 | const target = observed["__v_raw"];
|
980 | const rawTarget = toRaw(target);
|
981 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
982 | !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
|
983 | return target.forEach((value, key) => {
|
984 | return callback.call(thisArg, wrap(value), wrap(key), observed);
|
985 | });
|
986 | };
|
987 | }
|
988 | function createIterableMethod(method, isReadonly, isShallow) {
|
989 | return function(...args) {
|
990 | const target = this["__v_raw"];
|
991 | const rawTarget = toRaw(target);
|
992 | const targetIsMap = isMap(rawTarget);
|
993 | const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
994 | const isKeyOnly = method === "keys" && targetIsMap;
|
995 | const innerIterator = target[method](...args);
|
996 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
997 | !isReadonly && track(
|
998 | rawTarget,
|
999 | "iterate",
|
1000 | isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
1001 | );
|
1002 | return {
|
1003 |
|
1004 | next() {
|
1005 | const { value, done } = innerIterator.next();
|
1006 | return done ? { value, done } : {
|
1007 | value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
1008 | done
|
1009 | };
|
1010 | },
|
1011 |
|
1012 | [Symbol.iterator]() {
|
1013 | return this;
|
1014 | }
|
1015 | };
|
1016 | };
|
1017 | }
|
1018 | function createReadonlyMethod(type) {
|
1019 | return function(...args) {
|
1020 | {
|
1021 | const key = args[0] ? `on key "${args[0]}" ` : ``;
|
1022 | warn$2(
|
1023 | `${capitalize(type)} operation ${key}failed: target is readonly.`,
|
1024 | toRaw(this)
|
1025 | );
|
1026 | }
|
1027 | return type === "delete" ? false : type === "clear" ? void 0 : this;
|
1028 | };
|
1029 | }
|
1030 | function createInstrumentations() {
|
1031 | const mutableInstrumentations2 = {
|
1032 | get(key) {
|
1033 | return get(this, key);
|
1034 | },
|
1035 | get size() {
|
1036 | return size(this);
|
1037 | },
|
1038 | has,
|
1039 | add,
|
1040 | set,
|
1041 | delete: deleteEntry,
|
1042 | clear,
|
1043 | forEach: createForEach(false, false)
|
1044 | };
|
1045 | const shallowInstrumentations2 = {
|
1046 | get(key) {
|
1047 | return get(this, key, false, true);
|
1048 | },
|
1049 | get size() {
|
1050 | return size(this);
|
1051 | },
|
1052 | has,
|
1053 | add,
|
1054 | set,
|
1055 | delete: deleteEntry,
|
1056 | clear,
|
1057 | forEach: createForEach(false, true)
|
1058 | };
|
1059 | const readonlyInstrumentations2 = {
|
1060 | get(key) {
|
1061 | return get(this, key, true);
|
1062 | },
|
1063 | get size() {
|
1064 | return size(this, true);
|
1065 | },
|
1066 | has(key) {
|
1067 | return has.call(this, key, true);
|
1068 | },
|
1069 | add: createReadonlyMethod("add"),
|
1070 | set: createReadonlyMethod("set"),
|
1071 | delete: createReadonlyMethod("delete"),
|
1072 | clear: createReadonlyMethod("clear"),
|
1073 | forEach: createForEach(true, false)
|
1074 | };
|
1075 | const shallowReadonlyInstrumentations2 = {
|
1076 | get(key) {
|
1077 | return get(this, key, true, true);
|
1078 | },
|
1079 | get size() {
|
1080 | return size(this, true);
|
1081 | },
|
1082 | has(key) {
|
1083 | return has.call(this, key, true);
|
1084 | },
|
1085 | add: createReadonlyMethod("add"),
|
1086 | set: createReadonlyMethod("set"),
|
1087 | delete: createReadonlyMethod("delete"),
|
1088 | clear: createReadonlyMethod("clear"),
|
1089 | forEach: createForEach(true, true)
|
1090 | };
|
1091 | const iteratorMethods = [
|
1092 | "keys",
|
1093 | "values",
|
1094 | "entries",
|
1095 | Symbol.iterator
|
1096 | ];
|
1097 | iteratorMethods.forEach((method) => {
|
1098 | mutableInstrumentations2[method] = createIterableMethod(method, false, false);
|
1099 | readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
|
1100 | shallowInstrumentations2[method] = createIterableMethod(method, false, true);
|
1101 | shallowReadonlyInstrumentations2[method] = createIterableMethod(
|
1102 | method,
|
1103 | true,
|
1104 | true
|
1105 | );
|
1106 | });
|
1107 | return [
|
1108 | mutableInstrumentations2,
|
1109 | readonlyInstrumentations2,
|
1110 | shallowInstrumentations2,
|
1111 | shallowReadonlyInstrumentations2
|
1112 | ];
|
1113 | }
|
1114 | const [
|
1115 | mutableInstrumentations,
|
1116 | readonlyInstrumentations,
|
1117 | shallowInstrumentations,
|
1118 | shallowReadonlyInstrumentations
|
1119 | ] = createInstrumentations();
|
1120 | function createInstrumentationGetter(isReadonly, shallow) {
|
1121 | const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
|
1122 | return (target, key, receiver) => {
|
1123 | if (key === "__v_isReactive") {
|
1124 | return !isReadonly;
|
1125 | } else if (key === "__v_isReadonly") {
|
1126 | return isReadonly;
|
1127 | } else if (key === "__v_raw") {
|
1128 | return target;
|
1129 | }
|
1130 | return Reflect.get(
|
1131 | hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
1132 | key,
|
1133 | receiver
|
1134 | );
|
1135 | };
|
1136 | }
|
1137 | const mutableCollectionHandlers = {
|
1138 | get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
1139 | };
|
1140 | const shallowCollectionHandlers = {
|
1141 | get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
1142 | };
|
1143 | const readonlyCollectionHandlers = {
|
1144 | get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
1145 | };
|
1146 | const shallowReadonlyCollectionHandlers = {
|
1147 | get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
1148 | };
|
1149 | function checkIdentityKeys(target, has2, key) {
|
1150 | const rawKey = toRaw(key);
|
1151 | if (rawKey !== key && has2.call(target, rawKey)) {
|
1152 | const type = toRawType(target);
|
1153 | warn$2(
|
1154 | `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.`
|
1155 | );
|
1156 | }
|
1157 | }
|
1158 |
|
1159 | const reactiveMap = new WeakMap();
|
1160 | const shallowReactiveMap = new WeakMap();
|
1161 | const readonlyMap = new WeakMap();
|
1162 | const shallowReadonlyMap = new WeakMap();
|
1163 | function targetTypeMap(rawType) {
|
1164 | switch (rawType) {
|
1165 | case "Object":
|
1166 | case "Array":
|
1167 | return 1 ;
|
1168 | case "Map":
|
1169 | case "Set":
|
1170 | case "WeakMap":
|
1171 | case "WeakSet":
|
1172 | return 2 ;
|
1173 | default:
|
1174 | return 0 ;
|
1175 | }
|
1176 | }
|
1177 | function getTargetType(value) {
|
1178 | return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
1179 | }
|
1180 | function reactive(target) {
|
1181 | if (isReadonly(target)) {
|
1182 | return target;
|
1183 | }
|
1184 | return createReactiveObject(
|
1185 | target,
|
1186 | false,
|
1187 | mutableHandlers,
|
1188 | mutableCollectionHandlers,
|
1189 | reactiveMap
|
1190 | );
|
1191 | }
|
1192 | function shallowReactive(target) {
|
1193 | return createReactiveObject(
|
1194 | target,
|
1195 | false,
|
1196 | shallowReactiveHandlers,
|
1197 | shallowCollectionHandlers,
|
1198 | shallowReactiveMap
|
1199 | );
|
1200 | }
|
1201 | function readonly(target) {
|
1202 | return createReactiveObject(
|
1203 | target,
|
1204 | true,
|
1205 | readonlyHandlers,
|
1206 | readonlyCollectionHandlers,
|
1207 | readonlyMap
|
1208 | );
|
1209 | }
|
1210 | function shallowReadonly(target) {
|
1211 | return createReactiveObject(
|
1212 | target,
|
1213 | true,
|
1214 | shallowReadonlyHandlers,
|
1215 | shallowReadonlyCollectionHandlers,
|
1216 | shallowReadonlyMap
|
1217 | );
|
1218 | }
|
1219 | function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
1220 | if (!isObject(target)) {
|
1221 | {
|
1222 | warn$2(`value cannot be made reactive: ${String(target)}`);
|
1223 | }
|
1224 | return target;
|
1225 | }
|
1226 | if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
1227 | return target;
|
1228 | }
|
1229 | const existingProxy = proxyMap.get(target);
|
1230 | if (existingProxy) {
|
1231 | return existingProxy;
|
1232 | }
|
1233 | const targetType = getTargetType(target);
|
1234 | if (targetType === 0 ) {
|
1235 | return target;
|
1236 | }
|
1237 | const proxy = new Proxy(
|
1238 | target,
|
1239 | targetType === 2 ? collectionHandlers : baseHandlers
|
1240 | );
|
1241 | proxyMap.set(target, proxy);
|
1242 | return proxy;
|
1243 | }
|
1244 | function isReactive(value) {
|
1245 | if (isReadonly(value)) {
|
1246 | return isReactive(value["__v_raw"]);
|
1247 | }
|
1248 | return !!(value && value["__v_isReactive"]);
|
1249 | }
|
1250 | function isReadonly(value) {
|
1251 | return !!(value && value["__v_isReadonly"]);
|
1252 | }
|
1253 | function isShallow(value) {
|
1254 | return !!(value && value["__v_isShallow"]);
|
1255 | }
|
1256 | function isProxy(value) {
|
1257 | return value ? !!value["__v_raw"] : false;
|
1258 | }
|
1259 | function toRaw(observed) {
|
1260 | const raw = observed && observed["__v_raw"];
|
1261 | return raw ? toRaw(raw) : observed;
|
1262 | }
|
1263 | function markRaw(value) {
|
1264 | if (Object.isExtensible(value)) {
|
1265 | def(value, "__v_skip", true);
|
1266 | }
|
1267 | return value;
|
1268 | }
|
1269 | const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
1270 | const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
1271 |
|
1272 | const 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`;
|
1273 | class ComputedRefImpl {
|
1274 | constructor(getter, _setter, isReadonly, isSSR) {
|
1275 | this.getter = getter;
|
1276 | this._setter = _setter;
|
1277 | this.dep = void 0;
|
1278 | this.__v_isRef = true;
|
1279 | this["__v_isReadonly"] = false;
|
1280 | this.effect = new ReactiveEffect(
|
1281 | () => getter(this._value),
|
1282 | () => triggerRefValue(
|
1283 | this,
|
1284 | this.effect._dirtyLevel === 2 ? 2 : 3
|
1285 | )
|
1286 | );
|
1287 | this.effect.computed = this;
|
1288 | this.effect.active = this._cacheable = !isSSR;
|
1289 | this["__v_isReadonly"] = isReadonly;
|
1290 | }
|
1291 | get value() {
|
1292 | const self = toRaw(this);
|
1293 | if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
1294 | triggerRefValue(self, 4);
|
1295 | }
|
1296 | trackRefValue(self);
|
1297 | if (self.effect._dirtyLevel >= 2) {
|
1298 | if (this._warnRecursive) {
|
1299 | warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
1300 |
|
1301 | getter: `, this.getter);
|
1302 | }
|
1303 | triggerRefValue(self, 2);
|
1304 | }
|
1305 | return self._value;
|
1306 | }
|
1307 | set value(newValue) {
|
1308 | this._setter(newValue);
|
1309 | }
|
1310 |
|
1311 | get _dirty() {
|
1312 | return this.effect.dirty;
|
1313 | }
|
1314 | set _dirty(v) {
|
1315 | this.effect.dirty = v;
|
1316 | }
|
1317 |
|
1318 | }
|
1319 | function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
1320 | let getter;
|
1321 | let setter;
|
1322 | const onlyGetter = isFunction(getterOrOptions);
|
1323 | if (onlyGetter) {
|
1324 | getter = getterOrOptions;
|
1325 | setter = () => {
|
1326 | warn$2("Write operation failed: computed value is readonly");
|
1327 | } ;
|
1328 | } else {
|
1329 | getter = getterOrOptions.get;
|
1330 | setter = getterOrOptions.set;
|
1331 | }
|
1332 | const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
1333 | if (debugOptions && !isSSR) {
|
1334 | cRef.effect.onTrack = debugOptions.onTrack;
|
1335 | cRef.effect.onTrigger = debugOptions.onTrigger;
|
1336 | }
|
1337 | return cRef;
|
1338 | }
|
1339 |
|
1340 | function trackRefValue(ref2) {
|
1341 | var _a;
|
1342 | if (shouldTrack && activeEffect) {
|
1343 | ref2 = toRaw(ref2);
|
1344 | trackEffect(
|
1345 | activeEffect,
|
1346 | (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
1347 | () => ref2.dep = void 0,
|
1348 | ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
1349 | ),
|
1350 | {
|
1351 | target: ref2,
|
1352 | type: "get",
|
1353 | key: "value"
|
1354 | }
|
1355 | );
|
1356 | }
|
1357 | }
|
1358 | function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
1359 | ref2 = toRaw(ref2);
|
1360 | const dep = ref2.dep;
|
1361 | if (dep) {
|
1362 | triggerEffects(
|
1363 | dep,
|
1364 | dirtyLevel,
|
1365 | {
|
1366 | target: ref2,
|
1367 | type: "set",
|
1368 | key: "value",
|
1369 | newValue: newVal
|
1370 | }
|
1371 | );
|
1372 | }
|
1373 | }
|
1374 | function isRef(r) {
|
1375 | return !!(r && r.__v_isRef === true);
|
1376 | }
|
1377 | function ref(value) {
|
1378 | return createRef(value, false);
|
1379 | }
|
1380 | function shallowRef(value) {
|
1381 | return createRef(value, true);
|
1382 | }
|
1383 | function createRef(rawValue, shallow) {
|
1384 | if (isRef(rawValue)) {
|
1385 | return rawValue;
|
1386 | }
|
1387 | return new RefImpl(rawValue, shallow);
|
1388 | }
|
1389 | class RefImpl {
|
1390 | constructor(value, __v_isShallow) {
|
1391 | this.__v_isShallow = __v_isShallow;
|
1392 | this.dep = void 0;
|
1393 | this.__v_isRef = true;
|
1394 | this._rawValue = __v_isShallow ? value : toRaw(value);
|
1395 | this._value = __v_isShallow ? value : toReactive(value);
|
1396 | }
|
1397 | get value() {
|
1398 | trackRefValue(this);
|
1399 | return this._value;
|
1400 | }
|
1401 | set value(newVal) {
|
1402 | const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
1403 | newVal = useDirectValue ? newVal : toRaw(newVal);
|
1404 | if (hasChanged(newVal, this._rawValue)) {
|
1405 | this._rawValue = newVal;
|
1406 | this._value = useDirectValue ? newVal : toReactive(newVal);
|
1407 | triggerRefValue(this, 4, newVal);
|
1408 | }
|
1409 | }
|
1410 | }
|
1411 | function triggerRef(ref2) {
|
1412 | triggerRefValue(ref2, 4, ref2.value );
|
1413 | }
|
1414 | function unref(ref2) {
|
1415 | return isRef(ref2) ? ref2.value : ref2;
|
1416 | }
|
1417 | function toValue(source) {
|
1418 | return isFunction(source) ? source() : unref(source);
|
1419 | }
|
1420 | const shallowUnwrapHandlers = {
|
1421 | get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
1422 | set: (target, key, value, receiver) => {
|
1423 | const oldValue = target[key];
|
1424 | if (isRef(oldValue) && !isRef(value)) {
|
1425 | oldValue.value = value;
|
1426 | return true;
|
1427 | } else {
|
1428 | return Reflect.set(target, key, value, receiver);
|
1429 | }
|
1430 | }
|
1431 | };
|
1432 | function proxyRefs(objectWithRefs) {
|
1433 | return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
1434 | }
|
1435 | class CustomRefImpl {
|
1436 | constructor(factory) {
|
1437 | this.dep = void 0;
|
1438 | this.__v_isRef = true;
|
1439 | const { get, set } = factory(
|
1440 | () => trackRefValue(this),
|
1441 | () => triggerRefValue(this)
|
1442 | );
|
1443 | this._get = get;
|
1444 | this._set = set;
|
1445 | }
|
1446 | get value() {
|
1447 | return this._get();
|
1448 | }
|
1449 | set value(newVal) {
|
1450 | this._set(newVal);
|
1451 | }
|
1452 | }
|
1453 | function customRef(factory) {
|
1454 | return new CustomRefImpl(factory);
|
1455 | }
|
1456 | function toRefs(object) {
|
1457 | if (!isProxy(object)) {
|
1458 | warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
1459 | }
|
1460 | const ret = isArray(object) ? new Array(object.length) : {};
|
1461 | for (const key in object) {
|
1462 | ret[key] = propertyToRef(object, key);
|
1463 | }
|
1464 | return ret;
|
1465 | }
|
1466 | class ObjectRefImpl {
|
1467 | constructor(_object, _key, _defaultValue) {
|
1468 | this._object = _object;
|
1469 | this._key = _key;
|
1470 | this._defaultValue = _defaultValue;
|
1471 | this.__v_isRef = true;
|
1472 | }
|
1473 | get value() {
|
1474 | const val = this._object[this._key];
|
1475 | return val === void 0 ? this._defaultValue : val;
|
1476 | }
|
1477 | set value(newVal) {
|
1478 | this._object[this._key] = newVal;
|
1479 | }
|
1480 | get dep() {
|
1481 | return getDepFromReactive(toRaw(this._object), this._key);
|
1482 | }
|
1483 | }
|
1484 | class GetterRefImpl {
|
1485 | constructor(_getter) {
|
1486 | this._getter = _getter;
|
1487 | this.__v_isRef = true;
|
1488 | this.__v_isReadonly = true;
|
1489 | }
|
1490 | get value() {
|
1491 | return this._getter();
|
1492 | }
|
1493 | }
|
1494 | function toRef(source, key, defaultValue) {
|
1495 | if (isRef(source)) {
|
1496 | return source;
|
1497 | } else if (isFunction(source)) {
|
1498 | return new GetterRefImpl(source);
|
1499 | } else if (isObject(source) && arguments.length > 1) {
|
1500 | return propertyToRef(source, key, defaultValue);
|
1501 | } else {
|
1502 | return ref(source);
|
1503 | }
|
1504 | }
|
1505 | function propertyToRef(source, key, defaultValue) {
|
1506 | const val = source[key];
|
1507 | return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
1508 | }
|
1509 |
|
1510 | const TrackOpTypes = {
|
1511 | "GET": "get",
|
1512 | "HAS": "has",
|
1513 | "ITERATE": "iterate"
|
1514 | };
|
1515 | const TriggerOpTypes = {
|
1516 | "SET": "set",
|
1517 | "ADD": "add",
|
1518 | "DELETE": "delete",
|
1519 | "CLEAR": "clear"
|
1520 | };
|
1521 |
|
1522 | const stack = [];
|
1523 | function pushWarningContext(vnode) {
|
1524 | stack.push(vnode);
|
1525 | }
|
1526 | function popWarningContext() {
|
1527 | stack.pop();
|
1528 | }
|
1529 | function warn$1(msg, ...args) {
|
1530 | pauseTracking();
|
1531 | const instance = stack.length ? stack[stack.length - 1].component : null;
|
1532 | const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
1533 | const trace = getComponentTrace();
|
1534 | if (appWarnHandler) {
|
1535 | callWithErrorHandling(
|
1536 | appWarnHandler,
|
1537 | instance,
|
1538 | 11,
|
1539 | [
|
1540 | msg + args.map((a) => {
|
1541 | var _a, _b;
|
1542 | return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
1543 | }).join(""),
|
1544 | instance && instance.proxy,
|
1545 | trace.map(
|
1546 | ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
1547 | ).join("\n"),
|
1548 | trace
|
1549 | ]
|
1550 | );
|
1551 | } else {
|
1552 | const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
1553 | if (trace.length &&
|
1554 | true) {
|
1555 | warnArgs.push(`
|
1556 | `, ...formatTrace(trace));
|
1557 | }
|
1558 | console.warn(...warnArgs);
|
1559 | }
|
1560 | resetTracking();
|
1561 | }
|
1562 | function getComponentTrace() {
|
1563 | let currentVNode = stack[stack.length - 1];
|
1564 | if (!currentVNode) {
|
1565 | return [];
|
1566 | }
|
1567 | const normalizedStack = [];
|
1568 | while (currentVNode) {
|
1569 | const last = normalizedStack[0];
|
1570 | if (last && last.vnode === currentVNode) {
|
1571 | last.recurseCount++;
|
1572 | } else {
|
1573 | normalizedStack.push({
|
1574 | vnode: currentVNode,
|
1575 | recurseCount: 0
|
1576 | });
|
1577 | }
|
1578 | const parentInstance = currentVNode.component && currentVNode.component.parent;
|
1579 | currentVNode = parentInstance && parentInstance.vnode;
|
1580 | }
|
1581 | return normalizedStack;
|
1582 | }
|
1583 | function formatTrace(trace) {
|
1584 | const logs = [];
|
1585 | trace.forEach((entry, i) => {
|
1586 | logs.push(...i === 0 ? [] : [`
|
1587 | `], ...formatTraceEntry(entry));
|
1588 | });
|
1589 | return logs;
|
1590 | }
|
1591 | function formatTraceEntry({ vnode, recurseCount }) {
|
1592 | const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
1593 | const isRoot = vnode.component ? vnode.component.parent == null : false;
|
1594 | const open = ` at <${formatComponentName(
|
1595 | vnode.component,
|
1596 | vnode.type,
|
1597 | isRoot
|
1598 | )}`;
|
1599 | const close = `>` + postfix;
|
1600 | return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
1601 | }
|
1602 | function formatProps(props) {
|
1603 | const res = [];
|
1604 | const keys = Object.keys(props);
|
1605 | keys.slice(0, 3).forEach((key) => {
|
1606 | res.push(...formatProp(key, props[key]));
|
1607 | });
|
1608 | if (keys.length > 3) {
|
1609 | res.push(` ...`);
|
1610 | }
|
1611 | return res;
|
1612 | }
|
1613 | function formatProp(key, value, raw) {
|
1614 | if (isString(value)) {
|
1615 | value = JSON.stringify(value);
|
1616 | return raw ? value : [`${key}=${value}`];
|
1617 | } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
1618 | return raw ? value : [`${key}=${value}`];
|
1619 | } else if (isRef(value)) {
|
1620 | value = formatProp(key, toRaw(value.value), true);
|
1621 | return raw ? value : [`${key}=Ref<`, value, `>`];
|
1622 | } else if (isFunction(value)) {
|
1623 | return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
1624 | } else {
|
1625 | value = toRaw(value);
|
1626 | return raw ? value : [`${key}=`, value];
|
1627 | }
|
1628 | }
|
1629 | function assertNumber(val, type) {
|
1630 | if (val === void 0) {
|
1631 | return;
|
1632 | } else if (typeof val !== "number") {
|
1633 | warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
|
1634 | } else if (isNaN(val)) {
|
1635 | warn$1(`${type} is NaN - the duration expression might be incorrect.`);
|
1636 | }
|
1637 | }
|
1638 |
|
1639 | const ErrorCodes = {
|
1640 | "SETUP_FUNCTION": 0,
|
1641 | "0": "SETUP_FUNCTION",
|
1642 | "RENDER_FUNCTION": 1,
|
1643 | "1": "RENDER_FUNCTION",
|
1644 | "WATCH_GETTER": 2,
|
1645 | "2": "WATCH_GETTER",
|
1646 | "WATCH_CALLBACK": 3,
|
1647 | "3": "WATCH_CALLBACK",
|
1648 | "WATCH_CLEANUP": 4,
|
1649 | "4": "WATCH_CLEANUP",
|
1650 | "NATIVE_EVENT_HANDLER": 5,
|
1651 | "5": "NATIVE_EVENT_HANDLER",
|
1652 | "COMPONENT_EVENT_HANDLER": 6,
|
1653 | "6": "COMPONENT_EVENT_HANDLER",
|
1654 | "VNODE_HOOK": 7,
|
1655 | "7": "VNODE_HOOK",
|
1656 | "DIRECTIVE_HOOK": 8,
|
1657 | "8": "DIRECTIVE_HOOK",
|
1658 | "TRANSITION_HOOK": 9,
|
1659 | "9": "TRANSITION_HOOK",
|
1660 | "APP_ERROR_HANDLER": 10,
|
1661 | "10": "APP_ERROR_HANDLER",
|
1662 | "APP_WARN_HANDLER": 11,
|
1663 | "11": "APP_WARN_HANDLER",
|
1664 | "FUNCTION_REF": 12,
|
1665 | "12": "FUNCTION_REF",
|
1666 | "ASYNC_COMPONENT_LOADER": 13,
|
1667 | "13": "ASYNC_COMPONENT_LOADER",
|
1668 | "SCHEDULER": 14,
|
1669 | "14": "SCHEDULER"
|
1670 | };
|
1671 | const ErrorTypeStrings$1 = {
|
1672 | ["sp"]: "serverPrefetch hook",
|
1673 | ["bc"]: "beforeCreate hook",
|
1674 | ["c"]: "created hook",
|
1675 | ["bm"]: "beforeMount hook",
|
1676 | ["m"]: "mounted hook",
|
1677 | ["bu"]: "beforeUpdate hook",
|
1678 | ["u"]: "updated",
|
1679 | ["bum"]: "beforeUnmount hook",
|
1680 | ["um"]: "unmounted hook",
|
1681 | ["a"]: "activated hook",
|
1682 | ["da"]: "deactivated hook",
|
1683 | ["ec"]: "errorCaptured hook",
|
1684 | ["rtc"]: "renderTracked hook",
|
1685 | ["rtg"]: "renderTriggered hook",
|
1686 | [0]: "setup function",
|
1687 | [1]: "render function",
|
1688 | [2]: "watcher getter",
|
1689 | [3]: "watcher callback",
|
1690 | [4]: "watcher cleanup function",
|
1691 | [5]: "native event handler",
|
1692 | [6]: "component event handler",
|
1693 | [7]: "vnode hook",
|
1694 | [8]: "directive hook",
|
1695 | [9]: "transition hook",
|
1696 | [10]: "app errorHandler",
|
1697 | [11]: "app warnHandler",
|
1698 | [12]: "ref function",
|
1699 | [13]: "async component loader",
|
1700 | [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
1701 | };
|
1702 | function callWithErrorHandling(fn, instance, type, args) {
|
1703 | try {
|
1704 | return args ? fn(...args) : fn();
|
1705 | } catch (err) {
|
1706 | handleError(err, instance, type);
|
1707 | }
|
1708 | }
|
1709 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
1710 | if (isFunction(fn)) {
|
1711 | const res = callWithErrorHandling(fn, instance, type, args);
|
1712 | if (res && isPromise(res)) {
|
1713 | res.catch((err) => {
|
1714 | handleError(err, instance, type);
|
1715 | });
|
1716 | }
|
1717 | return res;
|
1718 | }
|
1719 | if (isArray(fn)) {
|
1720 | const values = [];
|
1721 | for (let i = 0; i < fn.length; i++) {
|
1722 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
1723 | }
|
1724 | return values;
|
1725 | } else {
|
1726 | warn$1(
|
1727 | `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
1728 | );
|
1729 | }
|
1730 | }
|
1731 | function handleError(err, instance, type, throwInDev = true) {
|
1732 | const contextVNode = instance ? instance.vnode : null;
|
1733 | if (instance) {
|
1734 | let cur = instance.parent;
|
1735 | const exposedInstance = instance.proxy;
|
1736 | const errorInfo = ErrorTypeStrings$1[type] ;
|
1737 | while (cur) {
|
1738 | const errorCapturedHooks = cur.ec;
|
1739 | if (errorCapturedHooks) {
|
1740 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
1741 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
1742 | return;
|
1743 | }
|
1744 | }
|
1745 | }
|
1746 | cur = cur.parent;
|
1747 | }
|
1748 | const appErrorHandler = instance.appContext.config.errorHandler;
|
1749 | if (appErrorHandler) {
|
1750 | pauseTracking();
|
1751 | callWithErrorHandling(
|
1752 | appErrorHandler,
|
1753 | null,
|
1754 | 10,
|
1755 | [err, exposedInstance, errorInfo]
|
1756 | );
|
1757 | resetTracking();
|
1758 | return;
|
1759 | }
|
1760 | }
|
1761 | logError(err, type, contextVNode, throwInDev);
|
1762 | }
|
1763 | function logError(err, type, contextVNode, throwInDev = true) {
|
1764 | {
|
1765 | const info = ErrorTypeStrings$1[type];
|
1766 | if (contextVNode) {
|
1767 | pushWarningContext(contextVNode);
|
1768 | }
|
1769 | warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
1770 | if (contextVNode) {
|
1771 | popWarningContext();
|
1772 | }
|
1773 | if (throwInDev) {
|
1774 | throw err;
|
1775 | } else {
|
1776 | console.error(err);
|
1777 | }
|
1778 | }
|
1779 | }
|
1780 |
|
1781 | let isFlushing = false;
|
1782 | let isFlushPending = false;
|
1783 | const queue = [];
|
1784 | let flushIndex = 0;
|
1785 | const pendingPostFlushCbs = [];
|
1786 | let activePostFlushCbs = null;
|
1787 | let postFlushIndex = 0;
|
1788 | const resolvedPromise = Promise.resolve();
|
1789 | let currentFlushPromise = null;
|
1790 | const RECURSION_LIMIT = 100;
|
1791 | function nextTick(fn) {
|
1792 | const p = currentFlushPromise || resolvedPromise;
|
1793 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
1794 | }
|
1795 | function findInsertionIndex(id) {
|
1796 | let start = flushIndex + 1;
|
1797 | let end = queue.length;
|
1798 | while (start < end) {
|
1799 | const middle = start + end >>> 1;
|
1800 | const middleJob = queue[middle];
|
1801 | const middleJobId = getId(middleJob);
|
1802 | if (middleJobId < id || middleJobId === id && middleJob.pre) {
|
1803 | start = middle + 1;
|
1804 | } else {
|
1805 | end = middle;
|
1806 | }
|
1807 | }
|
1808 | return start;
|
1809 | }
|
1810 | function queueJob(job) {
|
1811 | if (!queue.length || !queue.includes(
|
1812 | job,
|
1813 | isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
1814 | )) {
|
1815 | if (job.id == null) {
|
1816 | queue.push(job);
|
1817 | } else {
|
1818 | queue.splice(findInsertionIndex(job.id), 0, job);
|
1819 | }
|
1820 | queueFlush();
|
1821 | }
|
1822 | }
|
1823 | function queueFlush() {
|
1824 | if (!isFlushing && !isFlushPending) {
|
1825 | isFlushPending = true;
|
1826 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
1827 | }
|
1828 | }
|
1829 | function invalidateJob(job) {
|
1830 | const i = queue.indexOf(job);
|
1831 | if (i > flushIndex) {
|
1832 | queue.splice(i, 1);
|
1833 | }
|
1834 | }
|
1835 | function queuePostFlushCb(cb) {
|
1836 | if (!isArray(cb)) {
|
1837 | if (!activePostFlushCbs || !activePostFlushCbs.includes(
|
1838 | cb,
|
1839 | cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
1840 | )) {
|
1841 | pendingPostFlushCbs.push(cb);
|
1842 | }
|
1843 | } else {
|
1844 | pendingPostFlushCbs.push(...cb);
|
1845 | }
|
1846 | queueFlush();
|
1847 | }
|
1848 | function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
1849 | {
|
1850 | seen = seen || new Map();
|
1851 | }
|
1852 | for (; i < queue.length; i++) {
|
1853 | const cb = queue[i];
|
1854 | if (cb && cb.pre) {
|
1855 | if (instance && cb.id !== instance.uid) {
|
1856 | continue;
|
1857 | }
|
1858 | if (checkRecursiveUpdates(seen, cb)) {
|
1859 | continue;
|
1860 | }
|
1861 | queue.splice(i, 1);
|
1862 | i--;
|
1863 | cb();
|
1864 | }
|
1865 | }
|
1866 | }
|
1867 | function flushPostFlushCbs(seen) {
|
1868 | if (pendingPostFlushCbs.length) {
|
1869 | const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
1870 | (a, b) => getId(a) - getId(b)
|
1871 | );
|
1872 | pendingPostFlushCbs.length = 0;
|
1873 | if (activePostFlushCbs) {
|
1874 | activePostFlushCbs.push(...deduped);
|
1875 | return;
|
1876 | }
|
1877 | activePostFlushCbs = deduped;
|
1878 | {
|
1879 | seen = seen || new Map();
|
1880 | }
|
1881 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
1882 | if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
|
1883 | continue;
|
1884 | }
|
1885 | activePostFlushCbs[postFlushIndex]();
|
1886 | }
|
1887 | activePostFlushCbs = null;
|
1888 | postFlushIndex = 0;
|
1889 | }
|
1890 | }
|
1891 | const getId = (job) => job.id == null ? Infinity : job.id;
|
1892 | const comparator = (a, b) => {
|
1893 | const diff = getId(a) - getId(b);
|
1894 | if (diff === 0) {
|
1895 | if (a.pre && !b.pre)
|
1896 | return -1;
|
1897 | if (b.pre && !a.pre)
|
1898 | return 1;
|
1899 | }
|
1900 | return diff;
|
1901 | };
|
1902 | function flushJobs(seen) {
|
1903 | isFlushPending = false;
|
1904 | isFlushing = true;
|
1905 | {
|
1906 | seen = seen || new Map();
|
1907 | }
|
1908 | queue.sort(comparator);
|
1909 | const check = (job) => checkRecursiveUpdates(seen, job) ;
|
1910 | try {
|
1911 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
1912 | const job = queue[flushIndex];
|
1913 | if (job && job.active !== false) {
|
1914 | if (check(job)) {
|
1915 | continue;
|
1916 | }
|
1917 | callWithErrorHandling(job, null, 14);
|
1918 | }
|
1919 | }
|
1920 | } finally {
|
1921 | flushIndex = 0;
|
1922 | queue.length = 0;
|
1923 | flushPostFlushCbs(seen);
|
1924 | isFlushing = false;
|
1925 | currentFlushPromise = null;
|
1926 | if (queue.length || pendingPostFlushCbs.length) {
|
1927 | flushJobs(seen);
|
1928 | }
|
1929 | }
|
1930 | }
|
1931 | function checkRecursiveUpdates(seen, fn) {
|
1932 | if (!seen.has(fn)) {
|
1933 | seen.set(fn, 1);
|
1934 | } else {
|
1935 | const count = seen.get(fn);
|
1936 | if (count > RECURSION_LIMIT) {
|
1937 | const instance = fn.ownerInstance;
|
1938 | const componentName = instance && getComponentName(instance.type);
|
1939 | handleError(
|
1940 | `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.`,
|
1941 | null,
|
1942 | 10
|
1943 | );
|
1944 | return true;
|
1945 | } else {
|
1946 | seen.set(fn, count + 1);
|
1947 | }
|
1948 | }
|
1949 | }
|
1950 |
|
1951 | let isHmrUpdating = false;
|
1952 | const hmrDirtyComponents = new Set();
|
1953 | {
|
1954 | getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
1955 | createRecord: tryWrap(createRecord),
|
1956 | rerender: tryWrap(rerender),
|
1957 | reload: tryWrap(reload)
|
1958 | };
|
1959 | }
|
1960 | const map = new Map();
|
1961 | function registerHMR(instance) {
|
1962 | const id = instance.type.__hmrId;
|
1963 | let record = map.get(id);
|
1964 | if (!record) {
|
1965 | createRecord(id, instance.type);
|
1966 | record = map.get(id);
|
1967 | }
|
1968 | record.instances.add(instance);
|
1969 | }
|
1970 | function unregisterHMR(instance) {
|
1971 | map.get(instance.type.__hmrId).instances.delete(instance);
|
1972 | }
|
1973 | function createRecord(id, initialDef) {
|
1974 | if (map.has(id)) {
|
1975 | return false;
|
1976 | }
|
1977 | map.set(id, {
|
1978 | initialDef: normalizeClassComponent(initialDef),
|
1979 | instances: new Set()
|
1980 | });
|
1981 | return true;
|
1982 | }
|
1983 | function normalizeClassComponent(component) {
|
1984 | return isClassComponent(component) ? component.__vccOpts : component;
|
1985 | }
|
1986 | function rerender(id, newRender) {
|
1987 | const record = map.get(id);
|
1988 | if (!record) {
|
1989 | return;
|
1990 | }
|
1991 | record.initialDef.render = newRender;
|
1992 | [...record.instances].forEach((instance) => {
|
1993 | if (newRender) {
|
1994 | instance.render = newRender;
|
1995 | normalizeClassComponent(instance.type).render = newRender;
|
1996 | }
|
1997 | instance.renderCache = [];
|
1998 | isHmrUpdating = true;
|
1999 | instance.effect.dirty = true;
|
2000 | instance.update();
|
2001 | isHmrUpdating = false;
|
2002 | });
|
2003 | }
|
2004 | function reload(id, newComp) {
|
2005 | const record = map.get(id);
|
2006 | if (!record)
|
2007 | return;
|
2008 | newComp = normalizeClassComponent(newComp);
|
2009 | updateComponentDef(record.initialDef, newComp);
|
2010 | const instances = [...record.instances];
|
2011 | for (const instance of instances) {
|
2012 | const oldComp = normalizeClassComponent(instance.type);
|
2013 | if (!hmrDirtyComponents.has(oldComp)) {
|
2014 | if (oldComp !== record.initialDef) {
|
2015 | updateComponentDef(oldComp, newComp);
|
2016 | }
|
2017 | hmrDirtyComponents.add(oldComp);
|
2018 | }
|
2019 | instance.appContext.propsCache.delete(instance.type);
|
2020 | instance.appContext.emitsCache.delete(instance.type);
|
2021 | instance.appContext.optionsCache.delete(instance.type);
|
2022 | if (instance.ceReload) {
|
2023 | hmrDirtyComponents.add(oldComp);
|
2024 | instance.ceReload(newComp.styles);
|
2025 | hmrDirtyComponents.delete(oldComp);
|
2026 | } else if (instance.parent) {
|
2027 | instance.parent.effect.dirty = true;
|
2028 | queueJob(instance.parent.update);
|
2029 | } else if (instance.appContext.reload) {
|
2030 | instance.appContext.reload();
|
2031 | } else if (typeof window !== "undefined") {
|
2032 | window.location.reload();
|
2033 | } else {
|
2034 | console.warn(
|
2035 | "[HMR] Root or manually mounted instance modified. Full reload required."
|
2036 | );
|
2037 | }
|
2038 | }
|
2039 | queuePostFlushCb(() => {
|
2040 | for (const instance of instances) {
|
2041 | hmrDirtyComponents.delete(
|
2042 | normalizeClassComponent(instance.type)
|
2043 | );
|
2044 | }
|
2045 | });
|
2046 | }
|
2047 | function updateComponentDef(oldComp, newComp) {
|
2048 | extend(oldComp, newComp);
|
2049 | for (const key in oldComp) {
|
2050 | if (key !== "__file" && !(key in newComp)) {
|
2051 | delete oldComp[key];
|
2052 | }
|
2053 | }
|
2054 | }
|
2055 | function tryWrap(fn) {
|
2056 | return (id, arg) => {
|
2057 | try {
|
2058 | return fn(id, arg);
|
2059 | } catch (e) {
|
2060 | console.error(e);
|
2061 | console.warn(
|
2062 | `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
|
2063 | );
|
2064 | }
|
2065 | };
|
2066 | }
|
2067 |
|
2068 | let devtools$1;
|
2069 | let buffer = [];
|
2070 | let devtoolsNotInstalled = false;
|
2071 | function emit$1(event, ...args) {
|
2072 | if (devtools$1) {
|
2073 | devtools$1.emit(event, ...args);
|
2074 | } else if (!devtoolsNotInstalled) {
|
2075 | buffer.push({ event, args });
|
2076 | }
|
2077 | }
|
2078 | function setDevtoolsHook$1(hook, target) {
|
2079 | var _a, _b;
|
2080 | devtools$1 = hook;
|
2081 | if (devtools$1) {
|
2082 | devtools$1.enabled = true;
|
2083 | buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
|
2084 | buffer = [];
|
2085 | } else if (
|
2086 |
|
2087 |
|
2088 |
|
2089 | typeof window !== "undefined" &&
|
2090 | window.HTMLElement &&
|
2091 | !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
2092 | ) {
|
2093 | const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
2094 | replay.push((newHook) => {
|
2095 | setDevtoolsHook$1(newHook, target);
|
2096 | });
|
2097 | setTimeout(() => {
|
2098 | if (!devtools$1) {
|
2099 | target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
2100 | devtoolsNotInstalled = true;
|
2101 | buffer = [];
|
2102 | }
|
2103 | }, 3e3);
|
2104 | } else {
|
2105 | devtoolsNotInstalled = true;
|
2106 | buffer = [];
|
2107 | }
|
2108 | }
|
2109 | function devtoolsInitApp(app, version) {
|
2110 | emit$1("app:init" , app, version, {
|
2111 | Fragment,
|
2112 | Text,
|
2113 | Comment,
|
2114 | Static
|
2115 | });
|
2116 | }
|
2117 | function devtoolsUnmountApp(app) {
|
2118 | emit$1("app:unmount" , app);
|
2119 | }
|
2120 | const devtoolsComponentAdded = createDevtoolsComponentHook(
|
2121 | "component:added"
|
2122 | );
|
2123 | const devtoolsComponentUpdated = createDevtoolsComponentHook("component:updated" );
|
2124 | const _devtoolsComponentRemoved = createDevtoolsComponentHook(
|
2125 | "component:removed"
|
2126 | );
|
2127 | const devtoolsComponentRemoved = (component) => {
|
2128 | if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" &&
|
2129 | !devtools$1.cleanupBuffer(component)) {
|
2130 | _devtoolsComponentRemoved(component);
|
2131 | }
|
2132 | };
|
2133 |
|
2134 |
|
2135 | function createDevtoolsComponentHook(hook) {
|
2136 | return (component) => {
|
2137 | emit$1(
|
2138 | hook,
|
2139 | component.appContext.app,
|
2140 | component.uid,
|
2141 | component.parent ? component.parent.uid : void 0,
|
2142 | component
|
2143 | );
|
2144 | };
|
2145 | }
|
2146 | const devtoolsPerfStart = createDevtoolsPerformanceHook(
|
2147 | "perf:start"
|
2148 | );
|
2149 | const devtoolsPerfEnd = createDevtoolsPerformanceHook(
|
2150 | "perf:end"
|
2151 | );
|
2152 | function createDevtoolsPerformanceHook(hook) {
|
2153 | return (component, type, time) => {
|
2154 | emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
2155 | };
|
2156 | }
|
2157 | function devtoolsComponentEmit(component, event, params) {
|
2158 | emit$1(
|
2159 | "component:emit" ,
|
2160 | component.appContext.app,
|
2161 | component,
|
2162 | event,
|
2163 | params
|
2164 | );
|
2165 | }
|
2166 |
|
2167 | function emit(instance, event, ...rawArgs) {
|
2168 | if (instance.isUnmounted)
|
2169 | return;
|
2170 | const props = instance.vnode.props || EMPTY_OBJ;
|
2171 | {
|
2172 | const {
|
2173 | emitsOptions,
|
2174 | propsOptions: [propsOptions]
|
2175 | } = instance;
|
2176 | if (emitsOptions) {
|
2177 | if (!(event in emitsOptions) && true) {
|
2178 | if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
2179 | warn$1(
|
2180 | `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
|
2181 | );
|
2182 | }
|
2183 | } else {
|
2184 | const validator = emitsOptions[event];
|
2185 | if (isFunction(validator)) {
|
2186 | const isValid = validator(...rawArgs);
|
2187 | if (!isValid) {
|
2188 | warn$1(
|
2189 | `Invalid event arguments: event validation failed for event "${event}".`
|
2190 | );
|
2191 | }
|
2192 | }
|
2193 | }
|
2194 | }
|
2195 | }
|
2196 | let args = rawArgs;
|
2197 | const isModelListener = event.startsWith("update:");
|
2198 | const modelArg = isModelListener && event.slice(7);
|
2199 | if (modelArg && modelArg in props) {
|
2200 | const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
2201 | const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
|
2202 | if (trim) {
|
2203 | args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
2204 | }
|
2205 | if (number) {
|
2206 | args = rawArgs.map(looseToNumber);
|
2207 | }
|
2208 | }
|
2209 | {
|
2210 | devtoolsComponentEmit(instance, event, args);
|
2211 | }
|
2212 | {
|
2213 | const lowerCaseEvent = event.toLowerCase();
|
2214 | if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
2215 | warn$1(
|
2216 | `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
2217 | instance,
|
2218 | instance.type
|
2219 | )} 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(
|
2220 | event
|
2221 | )}" instead of "${event}".`
|
2222 | );
|
2223 | }
|
2224 | }
|
2225 | let handlerName;
|
2226 | let handler = props[handlerName = toHandlerKey(event)] ||
|
2227 | props[handlerName = toHandlerKey(camelize(event))];
|
2228 | if (!handler && isModelListener) {
|
2229 | handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
2230 | }
|
2231 | if (handler) {
|
2232 | callWithAsyncErrorHandling(
|
2233 | handler,
|
2234 | instance,
|
2235 | 6,
|
2236 | args
|
2237 | );
|
2238 | }
|
2239 | const onceHandler = props[handlerName + `Once`];
|
2240 | if (onceHandler) {
|
2241 | if (!instance.emitted) {
|
2242 | instance.emitted = {};
|
2243 | } else if (instance.emitted[handlerName]) {
|
2244 | return;
|
2245 | }
|
2246 | instance.emitted[handlerName] = true;
|
2247 | callWithAsyncErrorHandling(
|
2248 | onceHandler,
|
2249 | instance,
|
2250 | 6,
|
2251 | args
|
2252 | );
|
2253 | }
|
2254 | }
|
2255 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
2256 | const cache = appContext.emitsCache;
|
2257 | const cached = cache.get(comp);
|
2258 | if (cached !== void 0) {
|
2259 | return cached;
|
2260 | }
|
2261 | const raw = comp.emits;
|
2262 | let normalized = {};
|
2263 | let hasExtends = false;
|
2264 | if (!isFunction(comp)) {
|
2265 | const extendEmits = (raw2) => {
|
2266 | const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
2267 | if (normalizedFromExtend) {
|
2268 | hasExtends = true;
|
2269 | extend(normalized, normalizedFromExtend);
|
2270 | }
|
2271 | };
|
2272 | if (!asMixin && appContext.mixins.length) {
|
2273 | appContext.mixins.forEach(extendEmits);
|
2274 | }
|
2275 | if (comp.extends) {
|
2276 | extendEmits(comp.extends);
|
2277 | }
|
2278 | if (comp.mixins) {
|
2279 | comp.mixins.forEach(extendEmits);
|
2280 | }
|
2281 | }
|
2282 | if (!raw && !hasExtends) {
|
2283 | if (isObject(comp)) {
|
2284 | cache.set(comp, null);
|
2285 | }
|
2286 | return null;
|
2287 | }
|
2288 | if (isArray(raw)) {
|
2289 | raw.forEach((key) => normalized[key] = null);
|
2290 | } else {
|
2291 | extend(normalized, raw);
|
2292 | }
|
2293 | if (isObject(comp)) {
|
2294 | cache.set(comp, normalized);
|
2295 | }
|
2296 | return normalized;
|
2297 | }
|
2298 | function isEmitListener(options, key) {
|
2299 | if (!options || !isOn(key)) {
|
2300 | return false;
|
2301 | }
|
2302 | key = key.slice(2).replace(/Once$/, "");
|
2303 | return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
2304 | }
|
2305 |
|
2306 | let currentRenderingInstance = null;
|
2307 | let currentScopeId = null;
|
2308 | function setCurrentRenderingInstance(instance) {
|
2309 | const prev = currentRenderingInstance;
|
2310 | currentRenderingInstance = instance;
|
2311 | currentScopeId = instance && instance.type.__scopeId || null;
|
2312 | return prev;
|
2313 | }
|
2314 | function pushScopeId(id) {
|
2315 | currentScopeId = id;
|
2316 | }
|
2317 | function popScopeId() {
|
2318 | currentScopeId = null;
|
2319 | }
|
2320 | const withScopeId = (_id) => withCtx;
|
2321 | function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
2322 | if (!ctx)
|
2323 | return fn;
|
2324 | if (fn._n) {
|
2325 | return fn;
|
2326 | }
|
2327 | const renderFnWithContext = (...args) => {
|
2328 | if (renderFnWithContext._d) {
|
2329 | setBlockTracking(-1);
|
2330 | }
|
2331 | const prevInstance = setCurrentRenderingInstance(ctx);
|
2332 | let res;
|
2333 | try {
|
2334 | res = fn(...args);
|
2335 | } finally {
|
2336 | setCurrentRenderingInstance(prevInstance);
|
2337 | if (renderFnWithContext._d) {
|
2338 | setBlockTracking(1);
|
2339 | }
|
2340 | }
|
2341 | {
|
2342 | devtoolsComponentUpdated(ctx);
|
2343 | }
|
2344 | return res;
|
2345 | };
|
2346 | renderFnWithContext._n = true;
|
2347 | renderFnWithContext._c = true;
|
2348 | renderFnWithContext._d = true;
|
2349 | return renderFnWithContext;
|
2350 | }
|
2351 |
|
2352 | let accessedAttrs = false;
|
2353 | function markAttrsAccessed() {
|
2354 | accessedAttrs = true;
|
2355 | }
|
2356 | function renderComponentRoot(instance) {
|
2357 | const {
|
2358 | type: Component,
|
2359 | vnode,
|
2360 | proxy,
|
2361 | withProxy,
|
2362 | propsOptions: [propsOptions],
|
2363 | slots,
|
2364 | attrs,
|
2365 | emit,
|
2366 | render,
|
2367 | renderCache,
|
2368 | props,
|
2369 | data,
|
2370 | setupState,
|
2371 | ctx,
|
2372 | inheritAttrs
|
2373 | } = instance;
|
2374 | const prev = setCurrentRenderingInstance(instance);
|
2375 | let result;
|
2376 | let fallthroughAttrs;
|
2377 | {
|
2378 | accessedAttrs = false;
|
2379 | }
|
2380 | try {
|
2381 | if (vnode.shapeFlag & 4) {
|
2382 | const proxyToUse = withProxy || proxy;
|
2383 | const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
2384 | get(target, key, receiver) {
|
2385 | warn$1(
|
2386 | `Property '${String(
|
2387 | key
|
2388 | )}' was accessed via 'this'. Avoid using 'this' in templates.`
|
2389 | );
|
2390 | return Reflect.get(target, key, receiver);
|
2391 | }
|
2392 | }) : proxyToUse;
|
2393 | result = normalizeVNode(
|
2394 | render.call(
|
2395 | thisProxy,
|
2396 | proxyToUse,
|
2397 | renderCache,
|
2398 | true ? shallowReadonly(props) : props,
|
2399 | setupState,
|
2400 | data,
|
2401 | ctx
|
2402 | )
|
2403 | );
|
2404 | fallthroughAttrs = attrs;
|
2405 | } else {
|
2406 | const render2 = Component;
|
2407 | if (attrs === props) {
|
2408 | markAttrsAccessed();
|
2409 | }
|
2410 | result = normalizeVNode(
|
2411 | render2.length > 1 ? render2(
|
2412 | true ? shallowReadonly(props) : props,
|
2413 | true ? {
|
2414 | get attrs() {
|
2415 | markAttrsAccessed();
|
2416 | return attrs;
|
2417 | },
|
2418 | slots,
|
2419 | emit
|
2420 | } : { attrs, slots, emit }
|
2421 | ) : render2(
|
2422 | true ? shallowReadonly(props) : props,
|
2423 | null
|
2424 | )
|
2425 | );
|
2426 | fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
2427 | }
|
2428 | } catch (err) {
|
2429 | blockStack.length = 0;
|
2430 | handleError(err, instance, 1);
|
2431 | result = createVNode(Comment);
|
2432 | }
|
2433 | let root = result;
|
2434 | let setRoot = void 0;
|
2435 | if (result.patchFlag > 0 && result.patchFlag & 2048) {
|
2436 | [root, setRoot] = getChildRoot(result);
|
2437 | }
|
2438 | if (fallthroughAttrs && inheritAttrs !== false) {
|
2439 | const keys = Object.keys(fallthroughAttrs);
|
2440 | const { shapeFlag } = root;
|
2441 | if (keys.length) {
|
2442 | if (shapeFlag & (1 | 6)) {
|
2443 | if (propsOptions && keys.some(isModelListener)) {
|
2444 | fallthroughAttrs = filterModelListeners(
|
2445 | fallthroughAttrs,
|
2446 | propsOptions
|
2447 | );
|
2448 | }
|
2449 | root = cloneVNode(root, fallthroughAttrs);
|
2450 | } else if (!accessedAttrs && root.type !== Comment) {
|
2451 | const allAttrs = Object.keys(attrs);
|
2452 | const eventAttrs = [];
|
2453 | const extraAttrs = [];
|
2454 | for (let i = 0, l = allAttrs.length; i < l; i++) {
|
2455 | const key = allAttrs[i];
|
2456 | if (isOn(key)) {
|
2457 | if (!isModelListener(key)) {
|
2458 | eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
2459 | }
|
2460 | } else {
|
2461 | extraAttrs.push(key);
|
2462 | }
|
2463 | }
|
2464 | if (extraAttrs.length) {
|
2465 | warn$1(
|
2466 | `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
|
2467 | );
|
2468 | }
|
2469 | if (eventAttrs.length) {
|
2470 | warn$1(
|
2471 | `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.`
|
2472 | );
|
2473 | }
|
2474 | }
|
2475 | }
|
2476 | }
|
2477 | if (vnode.dirs) {
|
2478 | if (!isElementRoot(root)) {
|
2479 | warn$1(
|
2480 | `Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
2481 | );
|
2482 | }
|
2483 | root = cloneVNode(root);
|
2484 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
2485 | }
|
2486 | if (vnode.transition) {
|
2487 | if (!isElementRoot(root)) {
|
2488 | warn$1(
|
2489 | `Component inside <Transition> renders non-element root node that cannot be animated.`
|
2490 | );
|
2491 | }
|
2492 | root.transition = vnode.transition;
|
2493 | }
|
2494 | if (setRoot) {
|
2495 | setRoot(root);
|
2496 | } else {
|
2497 | result = root;
|
2498 | }
|
2499 | setCurrentRenderingInstance(prev);
|
2500 | return result;
|
2501 | }
|
2502 | const getChildRoot = (vnode) => {
|
2503 | const rawChildren = vnode.children;
|
2504 | const dynamicChildren = vnode.dynamicChildren;
|
2505 | const childRoot = filterSingleRoot(rawChildren, false);
|
2506 | if (!childRoot) {
|
2507 | return [vnode, void 0];
|
2508 | } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
|
2509 | return getChildRoot(childRoot);
|
2510 | }
|
2511 | const index = rawChildren.indexOf(childRoot);
|
2512 | const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
2513 | const setRoot = (updatedRoot) => {
|
2514 | rawChildren[index] = updatedRoot;
|
2515 | if (dynamicChildren) {
|
2516 | if (dynamicIndex > -1) {
|
2517 | dynamicChildren[dynamicIndex] = updatedRoot;
|
2518 | } else if (updatedRoot.patchFlag > 0) {
|
2519 | vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
2520 | }
|
2521 | }
|
2522 | };
|
2523 | return [normalizeVNode(childRoot), setRoot];
|
2524 | };
|
2525 | function filterSingleRoot(children, recurse = true) {
|
2526 | let singleRoot;
|
2527 | for (let i = 0; i < children.length; i++) {
|
2528 | const child = children[i];
|
2529 | if (isVNode(child)) {
|
2530 | if (child.type !== Comment || child.children === "v-if") {
|
2531 | if (singleRoot) {
|
2532 | return;
|
2533 | } else {
|
2534 | singleRoot = child;
|
2535 | if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
|
2536 | return filterSingleRoot(singleRoot.children);
|
2537 | }
|
2538 | }
|
2539 | }
|
2540 | } else {
|
2541 | return;
|
2542 | }
|
2543 | }
|
2544 | return singleRoot;
|
2545 | }
|
2546 | const getFunctionalFallthrough = (attrs) => {
|
2547 | let res;
|
2548 | for (const key in attrs) {
|
2549 | if (key === "class" || key === "style" || isOn(key)) {
|
2550 | (res || (res = {}))[key] = attrs[key];
|
2551 | }
|
2552 | }
|
2553 | return res;
|
2554 | };
|
2555 | const filterModelListeners = (attrs, props) => {
|
2556 | const res = {};
|
2557 | for (const key in attrs) {
|
2558 | if (!isModelListener(key) || !(key.slice(9) in props)) {
|
2559 | res[key] = attrs[key];
|
2560 | }
|
2561 | }
|
2562 | return res;
|
2563 | };
|
2564 | const isElementRoot = (vnode) => {
|
2565 | return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
|
2566 | };
|
2567 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
2568 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
2569 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
2570 | const emits = component.emitsOptions;
|
2571 | if ((prevChildren || nextChildren) && isHmrUpdating) {
|
2572 | return true;
|
2573 | }
|
2574 | if (nextVNode.dirs || nextVNode.transition) {
|
2575 | return true;
|
2576 | }
|
2577 | if (optimized && patchFlag >= 0) {
|
2578 | if (patchFlag & 1024) {
|
2579 | return true;
|
2580 | }
|
2581 | if (patchFlag & 16) {
|
2582 | if (!prevProps) {
|
2583 | return !!nextProps;
|
2584 | }
|
2585 | return hasPropsChanged(prevProps, nextProps, emits);
|
2586 | } else if (patchFlag & 8) {
|
2587 | const dynamicProps = nextVNode.dynamicProps;
|
2588 | for (let i = 0; i < dynamicProps.length; i++) {
|
2589 | const key = dynamicProps[i];
|
2590 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
2591 | return true;
|
2592 | }
|
2593 | }
|
2594 | }
|
2595 | } else {
|
2596 | if (prevChildren || nextChildren) {
|
2597 | if (!nextChildren || !nextChildren.$stable) {
|
2598 | return true;
|
2599 | }
|
2600 | }
|
2601 | if (prevProps === nextProps) {
|
2602 | return false;
|
2603 | }
|
2604 | if (!prevProps) {
|
2605 | return !!nextProps;
|
2606 | }
|
2607 | if (!nextProps) {
|
2608 | return true;
|
2609 | }
|
2610 | return hasPropsChanged(prevProps, nextProps, emits);
|
2611 | }
|
2612 | return false;
|
2613 | }
|
2614 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
2615 | const nextKeys = Object.keys(nextProps);
|
2616 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
2617 | return true;
|
2618 | }
|
2619 | for (let i = 0; i < nextKeys.length; i++) {
|
2620 | const key = nextKeys[i];
|
2621 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
2622 | return true;
|
2623 | }
|
2624 | }
|
2625 | return false;
|
2626 | }
|
2627 | function updateHOCHostEl({ vnode, parent }, el) {
|
2628 | while (parent) {
|
2629 | const root = parent.subTree;
|
2630 | if (root.suspense && root.suspense.activeBranch === vnode) {
|
2631 | root.el = vnode.el;
|
2632 | }
|
2633 | if (root === vnode) {
|
2634 | (vnode = parent.vnode).el = el;
|
2635 | parent = parent.parent;
|
2636 | } else {
|
2637 | break;
|
2638 | }
|
2639 | }
|
2640 | }
|
2641 |
|
2642 | const COMPONENTS = "components";
|
2643 | const DIRECTIVES = "directives";
|
2644 | function resolveComponent(name, maybeSelfReference) {
|
2645 | return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
2646 | }
|
2647 | const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
2648 | function resolveDynamicComponent(component) {
|
2649 | if (isString(component)) {
|
2650 | return resolveAsset(COMPONENTS, component, false) || component;
|
2651 | } else {
|
2652 | return component || NULL_DYNAMIC_COMPONENT;
|
2653 | }
|
2654 | }
|
2655 | function resolveDirective(name) {
|
2656 | return resolveAsset(DIRECTIVES, name);
|
2657 | }
|
2658 | function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
2659 | const instance = currentRenderingInstance || currentInstance;
|
2660 | if (instance) {
|
2661 | const Component = instance.type;
|
2662 | if (type === COMPONENTS) {
|
2663 | const selfName = getComponentName(
|
2664 | Component,
|
2665 | false
|
2666 | );
|
2667 | if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
2668 | return Component;
|
2669 | }
|
2670 | }
|
2671 | const res = (
|
2672 |
|
2673 |
|
2674 | resolve(instance[type] || Component[type], name) ||
|
2675 | resolve(instance.appContext[type], name)
|
2676 | );
|
2677 | if (!res && maybeSelfReference) {
|
2678 | return Component;
|
2679 | }
|
2680 | if (warnMissing && !res) {
|
2681 | const extra = type === COMPONENTS ? `
|
2682 | If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
2683 | warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
2684 | }
|
2685 | return res;
|
2686 | } else {
|
2687 | warn$1(
|
2688 | `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
2689 | );
|
2690 | }
|
2691 | }
|
2692 | function resolve(registry, name) {
|
2693 | return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
|
2694 | }
|
2695 |
|
2696 | const isSuspense = (type) => type.__isSuspense;
|
2697 | let suspenseId = 0;
|
2698 | const SuspenseImpl = {
|
2699 | name: "Suspense",
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 | __isSuspense: true,
|
2705 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
2706 | if (n1 == null) {
|
2707 | mountSuspense(
|
2708 | n2,
|
2709 | container,
|
2710 | anchor,
|
2711 | parentComponent,
|
2712 | parentSuspense,
|
2713 | namespace,
|
2714 | slotScopeIds,
|
2715 | optimized,
|
2716 | rendererInternals
|
2717 | );
|
2718 | } else {
|
2719 | if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
2720 | n2.suspense = n1.suspense;
|
2721 | n2.suspense.vnode = n2;
|
2722 | n2.el = n1.el;
|
2723 | return;
|
2724 | }
|
2725 | patchSuspense(
|
2726 | n1,
|
2727 | n2,
|
2728 | container,
|
2729 | anchor,
|
2730 | parentComponent,
|
2731 | namespace,
|
2732 | slotScopeIds,
|
2733 | optimized,
|
2734 | rendererInternals
|
2735 | );
|
2736 | }
|
2737 | },
|
2738 | hydrate: hydrateSuspense,
|
2739 | create: createSuspenseBoundary,
|
2740 | normalize: normalizeSuspenseChildren
|
2741 | };
|
2742 | const Suspense = SuspenseImpl ;
|
2743 | function triggerEvent(vnode, name) {
|
2744 | const eventListener = vnode.props && vnode.props[name];
|
2745 | if (isFunction(eventListener)) {
|
2746 | eventListener();
|
2747 | }
|
2748 | }
|
2749 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
2750 | const {
|
2751 | p: patch,
|
2752 | o: { createElement }
|
2753 | } = rendererInternals;
|
2754 | const hiddenContainer = createElement("div");
|
2755 | const suspense = vnode.suspense = createSuspenseBoundary(
|
2756 | vnode,
|
2757 | parentSuspense,
|
2758 | parentComponent,
|
2759 | container,
|
2760 | hiddenContainer,
|
2761 | anchor,
|
2762 | namespace,
|
2763 | slotScopeIds,
|
2764 | optimized,
|
2765 | rendererInternals
|
2766 | );
|
2767 | patch(
|
2768 | null,
|
2769 | suspense.pendingBranch = vnode.ssContent,
|
2770 | hiddenContainer,
|
2771 | null,
|
2772 | parentComponent,
|
2773 | suspense,
|
2774 | namespace,
|
2775 | slotScopeIds
|
2776 | );
|
2777 | if (suspense.deps > 0) {
|
2778 | triggerEvent(vnode, "onPending");
|
2779 | triggerEvent(vnode, "onFallback");
|
2780 | patch(
|
2781 | null,
|
2782 | vnode.ssFallback,
|
2783 | container,
|
2784 | anchor,
|
2785 | parentComponent,
|
2786 | null,
|
2787 |
|
2788 | namespace,
|
2789 | slotScopeIds
|
2790 | );
|
2791 | setActiveBranch(suspense, vnode.ssFallback);
|
2792 | } else {
|
2793 | suspense.resolve(false, true);
|
2794 | }
|
2795 | }
|
2796 | function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
2797 | const suspense = n2.suspense = n1.suspense;
|
2798 | suspense.vnode = n2;
|
2799 | n2.el = n1.el;
|
2800 | const newBranch = n2.ssContent;
|
2801 | const newFallback = n2.ssFallback;
|
2802 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
2803 | if (pendingBranch) {
|
2804 | suspense.pendingBranch = newBranch;
|
2805 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
2806 | patch(
|
2807 | pendingBranch,
|
2808 | newBranch,
|
2809 | suspense.hiddenContainer,
|
2810 | null,
|
2811 | parentComponent,
|
2812 | suspense,
|
2813 | namespace,
|
2814 | slotScopeIds,
|
2815 | optimized
|
2816 | );
|
2817 | if (suspense.deps <= 0) {
|
2818 | suspense.resolve();
|
2819 | } else if (isInFallback) {
|
2820 | if (!isHydrating) {
|
2821 | patch(
|
2822 | activeBranch,
|
2823 | newFallback,
|
2824 | container,
|
2825 | anchor,
|
2826 | parentComponent,
|
2827 | null,
|
2828 |
|
2829 | namespace,
|
2830 | slotScopeIds,
|
2831 | optimized
|
2832 | );
|
2833 | setActiveBranch(suspense, newFallback);
|
2834 | }
|
2835 | }
|
2836 | } else {
|
2837 | suspense.pendingId = suspenseId++;
|
2838 | if (isHydrating) {
|
2839 | suspense.isHydrating = false;
|
2840 | suspense.activeBranch = pendingBranch;
|
2841 | } else {
|
2842 | unmount(pendingBranch, parentComponent, suspense);
|
2843 | }
|
2844 | suspense.deps = 0;
|
2845 | suspense.effects.length = 0;
|
2846 | suspense.hiddenContainer = createElement("div");
|
2847 | if (isInFallback) {
|
2848 | patch(
|
2849 | null,
|
2850 | newBranch,
|
2851 | suspense.hiddenContainer,
|
2852 | null,
|
2853 | parentComponent,
|
2854 | suspense,
|
2855 | namespace,
|
2856 | slotScopeIds,
|
2857 | optimized
|
2858 | );
|
2859 | if (suspense.deps <= 0) {
|
2860 | suspense.resolve();
|
2861 | } else {
|
2862 | patch(
|
2863 | activeBranch,
|
2864 | newFallback,
|
2865 | container,
|
2866 | anchor,
|
2867 | parentComponent,
|
2868 | null,
|
2869 |
|
2870 | namespace,
|
2871 | slotScopeIds,
|
2872 | optimized
|
2873 | );
|
2874 | setActiveBranch(suspense, newFallback);
|
2875 | }
|
2876 | } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2877 | patch(
|
2878 | activeBranch,
|
2879 | newBranch,
|
2880 | container,
|
2881 | anchor,
|
2882 | parentComponent,
|
2883 | suspense,
|
2884 | namespace,
|
2885 | slotScopeIds,
|
2886 | optimized
|
2887 | );
|
2888 | suspense.resolve(true);
|
2889 | } else {
|
2890 | patch(
|
2891 | null,
|
2892 | newBranch,
|
2893 | suspense.hiddenContainer,
|
2894 | null,
|
2895 | parentComponent,
|
2896 | suspense,
|
2897 | namespace,
|
2898 | slotScopeIds,
|
2899 | optimized
|
2900 | );
|
2901 | if (suspense.deps <= 0) {
|
2902 | suspense.resolve();
|
2903 | }
|
2904 | }
|
2905 | }
|
2906 | } else {
|
2907 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2908 | patch(
|
2909 | activeBranch,
|
2910 | newBranch,
|
2911 | container,
|
2912 | anchor,
|
2913 | parentComponent,
|
2914 | suspense,
|
2915 | namespace,
|
2916 | slotScopeIds,
|
2917 | optimized
|
2918 | );
|
2919 | setActiveBranch(suspense, newBranch);
|
2920 | } else {
|
2921 | triggerEvent(n2, "onPending");
|
2922 | suspense.pendingBranch = newBranch;
|
2923 | if (newBranch.shapeFlag & 512) {
|
2924 | suspense.pendingId = newBranch.component.suspenseId;
|
2925 | } else {
|
2926 | suspense.pendingId = suspenseId++;
|
2927 | }
|
2928 | patch(
|
2929 | null,
|
2930 | newBranch,
|
2931 | suspense.hiddenContainer,
|
2932 | null,
|
2933 | parentComponent,
|
2934 | suspense,
|
2935 | namespace,
|
2936 | slotScopeIds,
|
2937 | optimized
|
2938 | );
|
2939 | if (suspense.deps <= 0) {
|
2940 | suspense.resolve();
|
2941 | } else {
|
2942 | const { timeout, pendingId } = suspense;
|
2943 | if (timeout > 0) {
|
2944 | setTimeout(() => {
|
2945 | if (suspense.pendingId === pendingId) {
|
2946 | suspense.fallback(newFallback);
|
2947 | }
|
2948 | }, timeout);
|
2949 | } else if (timeout === 0) {
|
2950 | suspense.fallback(newFallback);
|
2951 | }
|
2952 | }
|
2953 | }
|
2954 | }
|
2955 | }
|
2956 | let hasWarned = false;
|
2957 | function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
2958 | if (!hasWarned) {
|
2959 | hasWarned = true;
|
2960 | console[console.info ? "info" : "log"](
|
2961 | `<Suspense> is an experimental feature and its API will likely change.`
|
2962 | );
|
2963 | }
|
2964 | const {
|
2965 | p: patch,
|
2966 | m: move,
|
2967 | um: unmount,
|
2968 | n: next,
|
2969 | o: { parentNode, remove }
|
2970 | } = rendererInternals;
|
2971 | let parentSuspenseId;
|
2972 | const isSuspensible = isVNodeSuspensible(vnode);
|
2973 | if (isSuspensible) {
|
2974 | if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
2975 | parentSuspenseId = parentSuspense.pendingId;
|
2976 | parentSuspense.deps++;
|
2977 | }
|
2978 | }
|
2979 | const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
|
2980 | {
|
2981 | assertNumber(timeout, `Suspense timeout`);
|
2982 | }
|
2983 | const initialAnchor = anchor;
|
2984 | const suspense = {
|
2985 | vnode,
|
2986 | parent: parentSuspense,
|
2987 | parentComponent,
|
2988 | namespace,
|
2989 | container,
|
2990 | hiddenContainer,
|
2991 | deps: 0,
|
2992 | pendingId: suspenseId++,
|
2993 | timeout: typeof timeout === "number" ? timeout : -1,
|
2994 | activeBranch: null,
|
2995 | pendingBranch: null,
|
2996 | isInFallback: !isHydrating,
|
2997 | isHydrating,
|
2998 | isUnmounted: false,
|
2999 | effects: [],
|
3000 | resolve(resume = false, sync = false) {
|
3001 | {
|
3002 | if (!resume && !suspense.pendingBranch) {
|
3003 | throw new Error(
|
3004 | `suspense.resolve() is called without a pending branch.`
|
3005 | );
|
3006 | }
|
3007 | if (suspense.isUnmounted) {
|
3008 | throw new Error(
|
3009 | `suspense.resolve() is called on an already unmounted suspense boundary.`
|
3010 | );
|
3011 | }
|
3012 | }
|
3013 | const {
|
3014 | vnode: vnode2,
|
3015 | activeBranch,
|
3016 | pendingBranch,
|
3017 | pendingId,
|
3018 | effects,
|
3019 | parentComponent: parentComponent2,
|
3020 | container: container2
|
3021 | } = suspense;
|
3022 | let delayEnter = false;
|
3023 | if (suspense.isHydrating) {
|
3024 | suspense.isHydrating = false;
|
3025 | } else if (!resume) {
|
3026 | delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
3027 | if (delayEnter) {
|
3028 | activeBranch.transition.afterLeave = () => {
|
3029 | if (pendingId === suspense.pendingId) {
|
3030 | move(
|
3031 | pendingBranch,
|
3032 | container2,
|
3033 | anchor === initialAnchor ? next(activeBranch) : anchor,
|
3034 | 0
|
3035 | );
|
3036 | queuePostFlushCb(effects);
|
3037 | }
|
3038 | };
|
3039 | }
|
3040 | if (activeBranch) {
|
3041 | if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
|
3042 | anchor = next(activeBranch);
|
3043 | }
|
3044 | unmount(activeBranch, parentComponent2, suspense, true);
|
3045 | }
|
3046 | if (!delayEnter) {
|
3047 | move(pendingBranch, container2, anchor, 0);
|
3048 | }
|
3049 | }
|
3050 | setActiveBranch(suspense, pendingBranch);
|
3051 | suspense.pendingBranch = null;
|
3052 | suspense.isInFallback = false;
|
3053 | let parent = suspense.parent;
|
3054 | let hasUnresolvedAncestor = false;
|
3055 | while (parent) {
|
3056 | if (parent.pendingBranch) {
|
3057 | parent.effects.push(...effects);
|
3058 | hasUnresolvedAncestor = true;
|
3059 | break;
|
3060 | }
|
3061 | parent = parent.parent;
|
3062 | }
|
3063 | if (!hasUnresolvedAncestor && !delayEnter) {
|
3064 | queuePostFlushCb(effects);
|
3065 | }
|
3066 | suspense.effects = [];
|
3067 | if (isSuspensible) {
|
3068 | if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
3069 | parentSuspense.deps--;
|
3070 | if (parentSuspense.deps === 0 && !sync) {
|
3071 | parentSuspense.resolve();
|
3072 | }
|
3073 | }
|
3074 | }
|
3075 | triggerEvent(vnode2, "onResolve");
|
3076 | },
|
3077 | fallback(fallbackVNode) {
|
3078 | if (!suspense.pendingBranch) {
|
3079 | return;
|
3080 | }
|
3081 | const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
3082 | triggerEvent(vnode2, "onFallback");
|
3083 | const anchor2 = next(activeBranch);
|
3084 | const mountFallback = () => {
|
3085 | if (!suspense.isInFallback) {
|
3086 | return;
|
3087 | }
|
3088 | patch(
|
3089 | null,
|
3090 | fallbackVNode,
|
3091 | container2,
|
3092 | anchor2,
|
3093 | parentComponent2,
|
3094 | null,
|
3095 |
|
3096 | namespace2,
|
3097 | slotScopeIds,
|
3098 | optimized
|
3099 | );
|
3100 | setActiveBranch(suspense, fallbackVNode);
|
3101 | };
|
3102 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
3103 | if (delayEnter) {
|
3104 | activeBranch.transition.afterLeave = mountFallback;
|
3105 | }
|
3106 | suspense.isInFallback = true;
|
3107 | unmount(
|
3108 | activeBranch,
|
3109 | parentComponent2,
|
3110 | null,
|
3111 |
|
3112 | true
|
3113 |
|
3114 | );
|
3115 | if (!delayEnter) {
|
3116 | mountFallback();
|
3117 | }
|
3118 | },
|
3119 | move(container2, anchor2, type) {
|
3120 | suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
3121 | suspense.container = container2;
|
3122 | },
|
3123 | next() {
|
3124 | return suspense.activeBranch && next(suspense.activeBranch);
|
3125 | },
|
3126 | registerDep(instance, setupRenderEffect) {
|
3127 | const isInPendingSuspense = !!suspense.pendingBranch;
|
3128 | if (isInPendingSuspense) {
|
3129 | suspense.deps++;
|
3130 | }
|
3131 | const hydratedEl = instance.vnode.el;
|
3132 | instance.asyncDep.catch((err) => {
|
3133 | handleError(err, instance, 0);
|
3134 | }).then((asyncSetupResult) => {
|
3135 | if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
3136 | return;
|
3137 | }
|
3138 | instance.asyncResolved = true;
|
3139 | const { vnode: vnode2 } = instance;
|
3140 | {
|
3141 | pushWarningContext(vnode2);
|
3142 | }
|
3143 | handleSetupResult(instance, asyncSetupResult, false);
|
3144 | if (hydratedEl) {
|
3145 | vnode2.el = hydratedEl;
|
3146 | }
|
3147 | const placeholder = !hydratedEl && instance.subTree.el;
|
3148 | setupRenderEffect(
|
3149 | instance,
|
3150 | vnode2,
|
3151 |
|
3152 |
|
3153 |
|
3154 | parentNode(hydratedEl || instance.subTree.el),
|
3155 |
|
3156 |
|
3157 | hydratedEl ? null : next(instance.subTree),
|
3158 | suspense,
|
3159 | namespace,
|
3160 | optimized
|
3161 | );
|
3162 | if (placeholder) {
|
3163 | remove(placeholder);
|
3164 | }
|
3165 | updateHOCHostEl(instance, vnode2.el);
|
3166 | {
|
3167 | popWarningContext();
|
3168 | }
|
3169 | if (isInPendingSuspense && --suspense.deps === 0) {
|
3170 | suspense.resolve();
|
3171 | }
|
3172 | });
|
3173 | },
|
3174 | unmount(parentSuspense2, doRemove) {
|
3175 | suspense.isUnmounted = true;
|
3176 | if (suspense.activeBranch) {
|
3177 | unmount(
|
3178 | suspense.activeBranch,
|
3179 | parentComponent,
|
3180 | parentSuspense2,
|
3181 | doRemove
|
3182 | );
|
3183 | }
|
3184 | if (suspense.pendingBranch) {
|
3185 | unmount(
|
3186 | suspense.pendingBranch,
|
3187 | parentComponent,
|
3188 | parentSuspense2,
|
3189 | doRemove
|
3190 | );
|
3191 | }
|
3192 | }
|
3193 | };
|
3194 | return suspense;
|
3195 | }
|
3196 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
3197 | const suspense = vnode.suspense = createSuspenseBoundary(
|
3198 | vnode,
|
3199 | parentSuspense,
|
3200 | parentComponent,
|
3201 | node.parentNode,
|
3202 |
|
3203 | document.createElement("div"),
|
3204 | null,
|
3205 | namespace,
|
3206 | slotScopeIds,
|
3207 | optimized,
|
3208 | rendererInternals,
|
3209 | true
|
3210 | );
|
3211 | const result = hydrateNode(
|
3212 | node,
|
3213 | suspense.pendingBranch = vnode.ssContent,
|
3214 | parentComponent,
|
3215 | suspense,
|
3216 | slotScopeIds,
|
3217 | optimized
|
3218 | );
|
3219 | if (suspense.deps === 0) {
|
3220 | suspense.resolve(false, true);
|
3221 | }
|
3222 | return result;
|
3223 | }
|
3224 | function normalizeSuspenseChildren(vnode) {
|
3225 | const { shapeFlag, children } = vnode;
|
3226 | const isSlotChildren = shapeFlag & 32;
|
3227 | vnode.ssContent = normalizeSuspenseSlot(
|
3228 | isSlotChildren ? children.default : children
|
3229 | );
|
3230 | vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
3231 | }
|
3232 | function normalizeSuspenseSlot(s) {
|
3233 | let block;
|
3234 | if (isFunction(s)) {
|
3235 | const trackBlock = isBlockTreeEnabled && s._c;
|
3236 | if (trackBlock) {
|
3237 | s._d = false;
|
3238 | openBlock();
|
3239 | }
|
3240 | s = s();
|
3241 | if (trackBlock) {
|
3242 | s._d = true;
|
3243 | block = currentBlock;
|
3244 | closeBlock();
|
3245 | }
|
3246 | }
|
3247 | if (isArray(s)) {
|
3248 | const singleChild = filterSingleRoot(s);
|
3249 | if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
|
3250 | warn$1(`<Suspense> slots expect a single root node.`);
|
3251 | }
|
3252 | s = singleChild;
|
3253 | }
|
3254 | s = normalizeVNode(s);
|
3255 | if (block && !s.dynamicChildren) {
|
3256 | s.dynamicChildren = block.filter((c) => c !== s);
|
3257 | }
|
3258 | return s;
|
3259 | }
|
3260 | function queueEffectWithSuspense(fn, suspense) {
|
3261 | if (suspense && suspense.pendingBranch) {
|
3262 | if (isArray(fn)) {
|
3263 | suspense.effects.push(...fn);
|
3264 | } else {
|
3265 | suspense.effects.push(fn);
|
3266 | }
|
3267 | } else {
|
3268 | queuePostFlushCb(fn);
|
3269 | }
|
3270 | }
|
3271 | function setActiveBranch(suspense, branch) {
|
3272 | suspense.activeBranch = branch;
|
3273 | const { vnode, parentComponent } = suspense;
|
3274 | let el = branch.el;
|
3275 | while (!el && branch.component) {
|
3276 | branch = branch.component.subTree;
|
3277 | el = branch.el;
|
3278 | }
|
3279 | vnode.el = el;
|
3280 | if (parentComponent && parentComponent.subTree === vnode) {
|
3281 | parentComponent.vnode.el = el;
|
3282 | updateHOCHostEl(parentComponent, el);
|
3283 | }
|
3284 | }
|
3285 | function isVNodeSuspensible(vnode) {
|
3286 | var _a;
|
3287 | return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
3288 | }
|
3289 |
|
3290 | const ssrContextKey = Symbol.for("v-scx");
|
3291 | const useSSRContext = () => {
|
3292 | {
|
3293 | warn$1(`useSSRContext() is not supported in the global build.`);
|
3294 | }
|
3295 | };
|
3296 |
|
3297 | function watchEffect(effect, options) {
|
3298 | return doWatch(effect, null, options);
|
3299 | }
|
3300 | function watchPostEffect(effect, options) {
|
3301 | return doWatch(
|
3302 | effect,
|
3303 | null,
|
3304 | extend({}, options, { flush: "post" })
|
3305 | );
|
3306 | }
|
3307 | function watchSyncEffect(effect, options) {
|
3308 | return doWatch(
|
3309 | effect,
|
3310 | null,
|
3311 | extend({}, options, { flush: "sync" })
|
3312 | );
|
3313 | }
|
3314 | const INITIAL_WATCHER_VALUE = {};
|
3315 | function watch(source, cb, options) {
|
3316 | if (!isFunction(cb)) {
|
3317 | warn$1(
|
3318 | `\`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.`
|
3319 | );
|
3320 | }
|
3321 | return doWatch(source, cb, options);
|
3322 | }
|
3323 | function doWatch(source, cb, {
|
3324 | immediate,
|
3325 | deep,
|
3326 | flush,
|
3327 | once,
|
3328 | onTrack,
|
3329 | onTrigger
|
3330 | } = EMPTY_OBJ) {
|
3331 | if (cb && once) {
|
3332 | const _cb = cb;
|
3333 | cb = (...args) => {
|
3334 | _cb(...args);
|
3335 | unwatch();
|
3336 | };
|
3337 | }
|
3338 | if (deep !== void 0 && typeof deep === "number") {
|
3339 | warn$1(
|
3340 | `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
|
3341 | );
|
3342 | }
|
3343 | if (!cb) {
|
3344 | if (immediate !== void 0) {
|
3345 | warn$1(
|
3346 | `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
3347 | );
|
3348 | }
|
3349 | if (deep !== void 0) {
|
3350 | warn$1(
|
3351 | `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
3352 | );
|
3353 | }
|
3354 | if (once !== void 0) {
|
3355 | warn$1(
|
3356 | `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
3357 | );
|
3358 | }
|
3359 | }
|
3360 | const warnInvalidSource = (s) => {
|
3361 | warn$1(
|
3362 | `Invalid watch source: `,
|
3363 | s,
|
3364 | `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
3365 | );
|
3366 | };
|
3367 | const instance = currentInstance;
|
3368 | const reactiveGetter = (source2) => deep === true ? source2 : (
|
3369 |
|
3370 | traverse(source2, deep === false ? 1 : void 0)
|
3371 | );
|
3372 | let getter;
|
3373 | let forceTrigger = false;
|
3374 | let isMultiSource = false;
|
3375 | if (isRef(source)) {
|
3376 | getter = () => source.value;
|
3377 | forceTrigger = isShallow(source);
|
3378 | } else if (isReactive(source)) {
|
3379 | getter = () => reactiveGetter(source);
|
3380 | forceTrigger = true;
|
3381 | } else if (isArray(source)) {
|
3382 | isMultiSource = true;
|
3383 | forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
3384 | getter = () => source.map((s) => {
|
3385 | if (isRef(s)) {
|
3386 | return s.value;
|
3387 | } else if (isReactive(s)) {
|
3388 | return reactiveGetter(s);
|
3389 | } else if (isFunction(s)) {
|
3390 | return callWithErrorHandling(s, instance, 2);
|
3391 | } else {
|
3392 | warnInvalidSource(s);
|
3393 | }
|
3394 | });
|
3395 | } else if (isFunction(source)) {
|
3396 | if (cb) {
|
3397 | getter = () => callWithErrorHandling(source, instance, 2);
|
3398 | } else {
|
3399 | getter = () => {
|
3400 | if (cleanup) {
|
3401 | cleanup();
|
3402 | }
|
3403 | return callWithAsyncErrorHandling(
|
3404 | source,
|
3405 | instance,
|
3406 | 3,
|
3407 | [onCleanup]
|
3408 | );
|
3409 | };
|
3410 | }
|
3411 | } else {
|
3412 | getter = NOOP;
|
3413 | warnInvalidSource(source);
|
3414 | }
|
3415 | if (cb && deep) {
|
3416 | const baseGetter = getter;
|
3417 | getter = () => traverse(baseGetter());
|
3418 | }
|
3419 | let cleanup;
|
3420 | let onCleanup = (fn) => {
|
3421 | cleanup = effect.onStop = () => {
|
3422 | callWithErrorHandling(fn, instance, 4);
|
3423 | cleanup = effect.onStop = void 0;
|
3424 | };
|
3425 | };
|
3426 | let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
3427 | const job = () => {
|
3428 | if (!effect.active || !effect.dirty) {
|
3429 | return;
|
3430 | }
|
3431 | if (cb) {
|
3432 | const newValue = effect.run();
|
3433 | if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
|
3434 | if (cleanup) {
|
3435 | cleanup();
|
3436 | }
|
3437 | callWithAsyncErrorHandling(cb, instance, 3, [
|
3438 | newValue,
|
3439 |
|
3440 | oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
3441 | onCleanup
|
3442 | ]);
|
3443 | oldValue = newValue;
|
3444 | }
|
3445 | } else {
|
3446 | effect.run();
|
3447 | }
|
3448 | };
|
3449 | job.allowRecurse = !!cb;
|
3450 | let scheduler;
|
3451 | if (flush === "sync") {
|
3452 | scheduler = job;
|
3453 | } else if (flush === "post") {
|
3454 | scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
3455 | } else {
|
3456 | job.pre = true;
|
3457 | if (instance)
|
3458 | job.id = instance.uid;
|
3459 | scheduler = () => queueJob(job);
|
3460 | }
|
3461 | const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
3462 | const scope = getCurrentScope();
|
3463 | const unwatch = () => {
|
3464 | effect.stop();
|
3465 | if (scope) {
|
3466 | remove(scope.effects, effect);
|
3467 | }
|
3468 | };
|
3469 | {
|
3470 | effect.onTrack = onTrack;
|
3471 | effect.onTrigger = onTrigger;
|
3472 | }
|
3473 | if (cb) {
|
3474 | if (immediate) {
|
3475 | job();
|
3476 | } else {
|
3477 | oldValue = effect.run();
|
3478 | }
|
3479 | } else if (flush === "post") {
|
3480 | queuePostRenderEffect(
|
3481 | effect.run.bind(effect),
|
3482 | instance && instance.suspense
|
3483 | );
|
3484 | } else {
|
3485 | effect.run();
|
3486 | }
|
3487 | return unwatch;
|
3488 | }
|
3489 | function instanceWatch(source, value, options) {
|
3490 | const publicThis = this.proxy;
|
3491 | const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
3492 | let cb;
|
3493 | if (isFunction(value)) {
|
3494 | cb = value;
|
3495 | } else {
|
3496 | cb = value.handler;
|
3497 | options = value;
|
3498 | }
|
3499 | const reset = setCurrentInstance(this);
|
3500 | const res = doWatch(getter, cb.bind(publicThis), options);
|
3501 | reset();
|
3502 | return res;
|
3503 | }
|
3504 | function createPathGetter(ctx, path) {
|
3505 | const segments = path.split(".");
|
3506 | return () => {
|
3507 | let cur = ctx;
|
3508 | for (let i = 0; i < segments.length && cur; i++) {
|
3509 | cur = cur[segments[i]];
|
3510 | }
|
3511 | return cur;
|
3512 | };
|
3513 | }
|
3514 | function traverse(value, depth, currentDepth = 0, seen) {
|
3515 | if (!isObject(value) || value["__v_skip"]) {
|
3516 | return value;
|
3517 | }
|
3518 | if (depth && depth > 0) {
|
3519 | if (currentDepth >= depth) {
|
3520 | return value;
|
3521 | }
|
3522 | currentDepth++;
|
3523 | }
|
3524 | seen = seen || new Set();
|
3525 | if (seen.has(value)) {
|
3526 | return value;
|
3527 | }
|
3528 | seen.add(value);
|
3529 | if (isRef(value)) {
|
3530 | traverse(value.value, depth, currentDepth, seen);
|
3531 | } else if (isArray(value)) {
|
3532 | for (let i = 0; i < value.length; i++) {
|
3533 | traverse(value[i], depth, currentDepth, seen);
|
3534 | }
|
3535 | } else if (isSet(value) || isMap(value)) {
|
3536 | value.forEach((v) => {
|
3537 | traverse(v, depth, currentDepth, seen);
|
3538 | });
|
3539 | } else if (isPlainObject(value)) {
|
3540 | for (const key in value) {
|
3541 | traverse(value[key], depth, currentDepth, seen);
|
3542 | }
|
3543 | }
|
3544 | return value;
|
3545 | }
|
3546 |
|
3547 | function validateDirectiveName(name) {
|
3548 | if (isBuiltInDirective(name)) {
|
3549 | warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
3550 | }
|
3551 | }
|
3552 | function withDirectives(vnode, directives) {
|
3553 | if (currentRenderingInstance === null) {
|
3554 | warn$1(`withDirectives can only be used inside render functions.`);
|
3555 | return vnode;
|
3556 | }
|
3557 | const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
|
3558 | const bindings = vnode.dirs || (vnode.dirs = []);
|
3559 | for (let i = 0; i < directives.length; i++) {
|
3560 | let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
3561 | if (dir) {
|
3562 | if (isFunction(dir)) {
|
3563 | dir = {
|
3564 | mounted: dir,
|
3565 | updated: dir
|
3566 | };
|
3567 | }
|
3568 | if (dir.deep) {
|
3569 | traverse(value);
|
3570 | }
|
3571 | bindings.push({
|
3572 | dir,
|
3573 | instance,
|
3574 | value,
|
3575 | oldValue: void 0,
|
3576 | arg,
|
3577 | modifiers
|
3578 | });
|
3579 | }
|
3580 | }
|
3581 | return vnode;
|
3582 | }
|
3583 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
3584 | const bindings = vnode.dirs;
|
3585 | const oldBindings = prevVNode && prevVNode.dirs;
|
3586 | for (let i = 0; i < bindings.length; i++) {
|
3587 | const binding = bindings[i];
|
3588 | if (oldBindings) {
|
3589 | binding.oldValue = oldBindings[i].value;
|
3590 | }
|
3591 | let hook = binding.dir[name];
|
3592 | if (hook) {
|
3593 | pauseTracking();
|
3594 | callWithAsyncErrorHandling(hook, instance, 8, [
|
3595 | vnode.el,
|
3596 | binding,
|
3597 | vnode,
|
3598 | prevVNode
|
3599 | ]);
|
3600 | resetTracking();
|
3601 | }
|
3602 | }
|
3603 | }
|
3604 |
|
3605 | const leaveCbKey = Symbol("_leaveCb");
|
3606 | const enterCbKey$1 = Symbol("_enterCb");
|
3607 | function useTransitionState() {
|
3608 | const state = {
|
3609 | isMounted: false,
|
3610 | isLeaving: false,
|
3611 | isUnmounting: false,
|
3612 | leavingVNodes: new Map()
|
3613 | };
|
3614 | onMounted(() => {
|
3615 | state.isMounted = true;
|
3616 | });
|
3617 | onBeforeUnmount(() => {
|
3618 | state.isUnmounting = true;
|
3619 | });
|
3620 | return state;
|
3621 | }
|
3622 | const TransitionHookValidator = [Function, Array];
|
3623 | const BaseTransitionPropsValidators = {
|
3624 | mode: String,
|
3625 | appear: Boolean,
|
3626 | persisted: Boolean,
|
3627 |
|
3628 | onBeforeEnter: TransitionHookValidator,
|
3629 | onEnter: TransitionHookValidator,
|
3630 | onAfterEnter: TransitionHookValidator,
|
3631 | onEnterCancelled: TransitionHookValidator,
|
3632 |
|
3633 | onBeforeLeave: TransitionHookValidator,
|
3634 | onLeave: TransitionHookValidator,
|
3635 | onAfterLeave: TransitionHookValidator,
|
3636 | onLeaveCancelled: TransitionHookValidator,
|
3637 |
|
3638 | onBeforeAppear: TransitionHookValidator,
|
3639 | onAppear: TransitionHookValidator,
|
3640 | onAfterAppear: TransitionHookValidator,
|
3641 | onAppearCancelled: TransitionHookValidator
|
3642 | };
|
3643 | const BaseTransitionImpl = {
|
3644 | name: `BaseTransition`,
|
3645 | props: BaseTransitionPropsValidators,
|
3646 | setup(props, { slots }) {
|
3647 | const instance = getCurrentInstance();
|
3648 | const state = useTransitionState();
|
3649 | return () => {
|
3650 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
3651 | if (!children || !children.length) {
|
3652 | return;
|
3653 | }
|
3654 | let child = children[0];
|
3655 | if (children.length > 1) {
|
3656 | let hasFound = false;
|
3657 | for (const c of children) {
|
3658 | if (c.type !== Comment) {
|
3659 | if (hasFound) {
|
3660 | warn$1(
|
3661 | "<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
3662 | );
|
3663 | break;
|
3664 | }
|
3665 | child = c;
|
3666 | hasFound = true;
|
3667 | }
|
3668 | }
|
3669 | }
|
3670 | const rawProps = toRaw(props);
|
3671 | const { mode } = rawProps;
|
3672 | if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
3673 | warn$1(`invalid <transition> mode: ${mode}`);
|
3674 | }
|
3675 | if (state.isLeaving) {
|
3676 | return emptyPlaceholder(child);
|
3677 | }
|
3678 | const innerChild = getKeepAliveChild(child);
|
3679 | if (!innerChild) {
|
3680 | return emptyPlaceholder(child);
|
3681 | }
|
3682 | const enterHooks = resolveTransitionHooks(
|
3683 | innerChild,
|
3684 | rawProps,
|
3685 | state,
|
3686 | instance
|
3687 | );
|
3688 | setTransitionHooks(innerChild, enterHooks);
|
3689 | const oldChild = instance.subTree;
|
3690 | const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
3691 | if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
3692 | const leavingHooks = resolveTransitionHooks(
|
3693 | oldInnerChild,
|
3694 | rawProps,
|
3695 | state,
|
3696 | instance
|
3697 | );
|
3698 | setTransitionHooks(oldInnerChild, leavingHooks);
|
3699 | if (mode === "out-in") {
|
3700 | state.isLeaving = true;
|
3701 | leavingHooks.afterLeave = () => {
|
3702 | state.isLeaving = false;
|
3703 | if (instance.update.active !== false) {
|
3704 | instance.effect.dirty = true;
|
3705 | instance.update();
|
3706 | }
|
3707 | };
|
3708 | return emptyPlaceholder(child);
|
3709 | } else if (mode === "in-out" && innerChild.type !== Comment) {
|
3710 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
3711 | const leavingVNodesCache = getLeavingNodesForType(
|
3712 | state,
|
3713 | oldInnerChild
|
3714 | );
|
3715 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
3716 | el[leaveCbKey] = () => {
|
3717 | earlyRemove();
|
3718 | el[leaveCbKey] = void 0;
|
3719 | delete enterHooks.delayedLeave;
|
3720 | };
|
3721 | enterHooks.delayedLeave = delayedLeave;
|
3722 | };
|
3723 | }
|
3724 | }
|
3725 | return child;
|
3726 | };
|
3727 | }
|
3728 | };
|
3729 | const BaseTransition = BaseTransitionImpl;
|
3730 | function getLeavingNodesForType(state, vnode) {
|
3731 | const { leavingVNodes } = state;
|
3732 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
3733 | if (!leavingVNodesCache) {
|
3734 | leavingVNodesCache = Object.create(null);
|
3735 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
3736 | }
|
3737 | return leavingVNodesCache;
|
3738 | }
|
3739 | function resolveTransitionHooks(vnode, props, state, instance) {
|
3740 | const {
|
3741 | appear,
|
3742 | mode,
|
3743 | persisted = false,
|
3744 | onBeforeEnter,
|
3745 | onEnter,
|
3746 | onAfterEnter,
|
3747 | onEnterCancelled,
|
3748 | onBeforeLeave,
|
3749 | onLeave,
|
3750 | onAfterLeave,
|
3751 | onLeaveCancelled,
|
3752 | onBeforeAppear,
|
3753 | onAppear,
|
3754 | onAfterAppear,
|
3755 | onAppearCancelled
|
3756 | } = props;
|
3757 | const key = String(vnode.key);
|
3758 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
3759 | const callHook = (hook, args) => {
|
3760 | hook && callWithAsyncErrorHandling(
|
3761 | hook,
|
3762 | instance,
|
3763 | 9,
|
3764 | args
|
3765 | );
|
3766 | };
|
3767 | const callAsyncHook = (hook, args) => {
|
3768 | const done = args[1];
|
3769 | callHook(hook, args);
|
3770 | if (isArray(hook)) {
|
3771 | if (hook.every((hook2) => hook2.length <= 1))
|
3772 | done();
|
3773 | } else if (hook.length <= 1) {
|
3774 | done();
|
3775 | }
|
3776 | };
|
3777 | const hooks = {
|
3778 | mode,
|
3779 | persisted,
|
3780 | beforeEnter(el) {
|
3781 | let hook = onBeforeEnter;
|
3782 | if (!state.isMounted) {
|
3783 | if (appear) {
|
3784 | hook = onBeforeAppear || onBeforeEnter;
|
3785 | } else {
|
3786 | return;
|
3787 | }
|
3788 | }
|
3789 | if (el[leaveCbKey]) {
|
3790 | el[leaveCbKey](
|
3791 | true
|
3792 |
|
3793 | );
|
3794 | }
|
3795 | const leavingVNode = leavingVNodesCache[key];
|
3796 | if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
|
3797 | leavingVNode.el[leaveCbKey]();
|
3798 | }
|
3799 | callHook(hook, [el]);
|
3800 | },
|
3801 | enter(el) {
|
3802 | let hook = onEnter;
|
3803 | let afterHook = onAfterEnter;
|
3804 | let cancelHook = onEnterCancelled;
|
3805 | if (!state.isMounted) {
|
3806 | if (appear) {
|
3807 | hook = onAppear || onEnter;
|
3808 | afterHook = onAfterAppear || onAfterEnter;
|
3809 | cancelHook = onAppearCancelled || onEnterCancelled;
|
3810 | } else {
|
3811 | return;
|
3812 | }
|
3813 | }
|
3814 | let called = false;
|
3815 | const done = el[enterCbKey$1] = (cancelled) => {
|
3816 | if (called)
|
3817 | return;
|
3818 | called = true;
|
3819 | if (cancelled) {
|
3820 | callHook(cancelHook, [el]);
|
3821 | } else {
|
3822 | callHook(afterHook, [el]);
|
3823 | }
|
3824 | if (hooks.delayedLeave) {
|
3825 | hooks.delayedLeave();
|
3826 | }
|
3827 | el[enterCbKey$1] = void 0;
|
3828 | };
|
3829 | if (hook) {
|
3830 | callAsyncHook(hook, [el, done]);
|
3831 | } else {
|
3832 | done();
|
3833 | }
|
3834 | },
|
3835 | leave(el, remove) {
|
3836 | const key2 = String(vnode.key);
|
3837 | if (el[enterCbKey$1]) {
|
3838 | el[enterCbKey$1](
|
3839 | true
|
3840 |
|
3841 | );
|
3842 | }
|
3843 | if (state.isUnmounting) {
|
3844 | return remove();
|
3845 | }
|
3846 | callHook(onBeforeLeave, [el]);
|
3847 | let called = false;
|
3848 | const done = el[leaveCbKey] = (cancelled) => {
|
3849 | if (called)
|
3850 | return;
|
3851 | called = true;
|
3852 | remove();
|
3853 | if (cancelled) {
|
3854 | callHook(onLeaveCancelled, [el]);
|
3855 | } else {
|
3856 | callHook(onAfterLeave, [el]);
|
3857 | }
|
3858 | el[leaveCbKey] = void 0;
|
3859 | if (leavingVNodesCache[key2] === vnode) {
|
3860 | delete leavingVNodesCache[key2];
|
3861 | }
|
3862 | };
|
3863 | leavingVNodesCache[key2] = vnode;
|
3864 | if (onLeave) {
|
3865 | callAsyncHook(onLeave, [el, done]);
|
3866 | } else {
|
3867 | done();
|
3868 | }
|
3869 | },
|
3870 | clone(vnode2) {
|
3871 | return resolveTransitionHooks(vnode2, props, state, instance);
|
3872 | }
|
3873 | };
|
3874 | return hooks;
|
3875 | }
|
3876 | function emptyPlaceholder(vnode) {
|
3877 | if (isKeepAlive(vnode)) {
|
3878 | vnode = cloneVNode(vnode);
|
3879 | vnode.children = null;
|
3880 | return vnode;
|
3881 | }
|
3882 | }
|
3883 | function getKeepAliveChild(vnode) {
|
3884 | if (!isKeepAlive(vnode)) {
|
3885 | return vnode;
|
3886 | }
|
3887 | if (vnode.component) {
|
3888 | return vnode.component.subTree;
|
3889 | }
|
3890 | const { shapeFlag, children } = vnode;
|
3891 | if (children) {
|
3892 | if (shapeFlag & 16) {
|
3893 | return children[0];
|
3894 | }
|
3895 | if (shapeFlag & 32 && isFunction(children.default)) {
|
3896 | return children.default();
|
3897 | }
|
3898 | }
|
3899 | }
|
3900 | function setTransitionHooks(vnode, hooks) {
|
3901 | if (vnode.shapeFlag & 6 && vnode.component) {
|
3902 | setTransitionHooks(vnode.component.subTree, hooks);
|
3903 | } else if (vnode.shapeFlag & 128) {
|
3904 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
3905 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
3906 | } else {
|
3907 | vnode.transition = hooks;
|
3908 | }
|
3909 | }
|
3910 | function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
3911 | let ret = [];
|
3912 | let keyedFragmentCount = 0;
|
3913 | for (let i = 0; i < children.length; i++) {
|
3914 | let child = children[i];
|
3915 | const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
|
3916 | if (child.type === Fragment) {
|
3917 | if (child.patchFlag & 128)
|
3918 | keyedFragmentCount++;
|
3919 | ret = ret.concat(
|
3920 | getTransitionRawChildren(child.children, keepComment, key)
|
3921 | );
|
3922 | } else if (keepComment || child.type !== Comment) {
|
3923 | ret.push(key != null ? cloneVNode(child, { key }) : child);
|
3924 | }
|
3925 | }
|
3926 | if (keyedFragmentCount > 1) {
|
3927 | for (let i = 0; i < ret.length; i++) {
|
3928 | ret[i].patchFlag = -2;
|
3929 | }
|
3930 | }
|
3931 | return ret;
|
3932 | }
|
3933 |
|
3934 |
|
3935 |
|
3936 | function defineComponent(options, extraOptions) {
|
3937 | return isFunction(options) ? (
|
3938 |
|
3939 |
|
3940 | (() => extend({ name: options.name }, extraOptions, { setup: options }))()
|
3941 | ) : options;
|
3942 | }
|
3943 |
|
3944 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
3945 |
|
3946 |
|
3947 | function defineAsyncComponent(source) {
|
3948 | if (isFunction(source)) {
|
3949 | source = { loader: source };
|
3950 | }
|
3951 | const {
|
3952 | loader,
|
3953 | loadingComponent,
|
3954 | errorComponent,
|
3955 | delay = 200,
|
3956 | timeout,
|
3957 |
|
3958 | suspensible = true,
|
3959 | onError: userOnError
|
3960 | } = source;
|
3961 | let pendingRequest = null;
|
3962 | let resolvedComp;
|
3963 | let retries = 0;
|
3964 | const retry = () => {
|
3965 | retries++;
|
3966 | pendingRequest = null;
|
3967 | return load();
|
3968 | };
|
3969 | const load = () => {
|
3970 | let thisRequest;
|
3971 | return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
3972 | err = err instanceof Error ? err : new Error(String(err));
|
3973 | if (userOnError) {
|
3974 | return new Promise((resolve, reject) => {
|
3975 | const userRetry = () => resolve(retry());
|
3976 | const userFail = () => reject(err);
|
3977 | userOnError(err, userRetry, userFail, retries + 1);
|
3978 | });
|
3979 | } else {
|
3980 | throw err;
|
3981 | }
|
3982 | }).then((comp) => {
|
3983 | if (thisRequest !== pendingRequest && pendingRequest) {
|
3984 | return pendingRequest;
|
3985 | }
|
3986 | if (!comp) {
|
3987 | warn$1(
|
3988 | `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
|
3989 | );
|
3990 | }
|
3991 | if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
3992 | comp = comp.default;
|
3993 | }
|
3994 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
3995 | throw new Error(`Invalid async component load result: ${comp}`);
|
3996 | }
|
3997 | resolvedComp = comp;
|
3998 | return comp;
|
3999 | }));
|
4000 | };
|
4001 | return defineComponent({
|
4002 | name: "AsyncComponentWrapper",
|
4003 | __asyncLoader: load,
|
4004 | get __asyncResolved() {
|
4005 | return resolvedComp;
|
4006 | },
|
4007 | setup() {
|
4008 | const instance = currentInstance;
|
4009 | if (resolvedComp) {
|
4010 | return () => createInnerComp(resolvedComp, instance);
|
4011 | }
|
4012 | const onError = (err) => {
|
4013 | pendingRequest = null;
|
4014 | handleError(
|
4015 | err,
|
4016 | instance,
|
4017 | 13,
|
4018 | !errorComponent
|
4019 | );
|
4020 | };
|
4021 | if (suspensible && instance.suspense || false) {
|
4022 | return load().then((comp) => {
|
4023 | return () => createInnerComp(comp, instance);
|
4024 | }).catch((err) => {
|
4025 | onError(err);
|
4026 | return () => errorComponent ? createVNode(errorComponent, {
|
4027 | error: err
|
4028 | }) : null;
|
4029 | });
|
4030 | }
|
4031 | const loaded = ref(false);
|
4032 | const error = ref();
|
4033 | const delayed = ref(!!delay);
|
4034 | if (delay) {
|
4035 | setTimeout(() => {
|
4036 | delayed.value = false;
|
4037 | }, delay);
|
4038 | }
|
4039 | if (timeout != null) {
|
4040 | setTimeout(() => {
|
4041 | if (!loaded.value && !error.value) {
|
4042 | const err = new Error(
|
4043 | `Async component timed out after ${timeout}ms.`
|
4044 | );
|
4045 | onError(err);
|
4046 | error.value = err;
|
4047 | }
|
4048 | }, timeout);
|
4049 | }
|
4050 | load().then(() => {
|
4051 | loaded.value = true;
|
4052 | if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
4053 | instance.parent.effect.dirty = true;
|
4054 | queueJob(instance.parent.update);
|
4055 | }
|
4056 | }).catch((err) => {
|
4057 | onError(err);
|
4058 | error.value = err;
|
4059 | });
|
4060 | return () => {
|
4061 | if (loaded.value && resolvedComp) {
|
4062 | return createInnerComp(resolvedComp, instance);
|
4063 | } else if (error.value && errorComponent) {
|
4064 | return createVNode(errorComponent, {
|
4065 | error: error.value
|
4066 | });
|
4067 | } else if (loadingComponent && !delayed.value) {
|
4068 | return createVNode(loadingComponent);
|
4069 | }
|
4070 | };
|
4071 | }
|
4072 | });
|
4073 | }
|
4074 | function createInnerComp(comp, parent) {
|
4075 | const { ref: ref2, props, children, ce } = parent.vnode;
|
4076 | const vnode = createVNode(comp, props, children);
|
4077 | vnode.ref = ref2;
|
4078 | vnode.ce = ce;
|
4079 | delete parent.vnode.ce;
|
4080 | return vnode;
|
4081 | }
|
4082 |
|
4083 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
4084 | const KeepAliveImpl = {
|
4085 | name: `KeepAlive`,
|
4086 |
|
4087 |
|
4088 |
|
4089 | __isKeepAlive: true,
|
4090 | props: {
|
4091 | include: [String, RegExp, Array],
|
4092 | exclude: [String, RegExp, Array],
|
4093 | max: [String, Number]
|
4094 | },
|
4095 | setup(props, { slots }) {
|
4096 | const instance = getCurrentInstance();
|
4097 | const sharedContext = instance.ctx;
|
4098 | const cache = new Map();
|
4099 | const keys = new Set();
|
4100 | let current = null;
|
4101 | {
|
4102 | instance.__v_cache = cache;
|
4103 | }
|
4104 | const parentSuspense = instance.suspense;
|
4105 | const {
|
4106 | renderer: {
|
4107 | p: patch,
|
4108 | m: move,
|
4109 | um: _unmount,
|
4110 | o: { createElement }
|
4111 | }
|
4112 | } = sharedContext;
|
4113 | const storageContainer = createElement("div");
|
4114 | sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
4115 | const instance2 = vnode.component;
|
4116 | move(vnode, container, anchor, 0, parentSuspense);
|
4117 | patch(
|
4118 | instance2.vnode,
|
4119 | vnode,
|
4120 | container,
|
4121 | anchor,
|
4122 | instance2,
|
4123 | parentSuspense,
|
4124 | namespace,
|
4125 | vnode.slotScopeIds,
|
4126 | optimized
|
4127 | );
|
4128 | queuePostRenderEffect(() => {
|
4129 | instance2.isDeactivated = false;
|
4130 | if (instance2.a) {
|
4131 | invokeArrayFns(instance2.a);
|
4132 | }
|
4133 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
4134 | if (vnodeHook) {
|
4135 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4136 | }
|
4137 | }, parentSuspense);
|
4138 | {
|
4139 | devtoolsComponentAdded(instance2);
|
4140 | }
|
4141 | };
|
4142 | sharedContext.deactivate = (vnode) => {
|
4143 | const instance2 = vnode.component;
|
4144 | move(vnode, storageContainer, null, 1, parentSuspense);
|
4145 | queuePostRenderEffect(() => {
|
4146 | if (instance2.da) {
|
4147 | invokeArrayFns(instance2.da);
|
4148 | }
|
4149 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
4150 | if (vnodeHook) {
|
4151 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4152 | }
|
4153 | instance2.isDeactivated = true;
|
4154 | }, parentSuspense);
|
4155 | {
|
4156 | devtoolsComponentAdded(instance2);
|
4157 | }
|
4158 | };
|
4159 | function unmount(vnode) {
|
4160 | resetShapeFlag(vnode);
|
4161 | _unmount(vnode, instance, parentSuspense, true);
|
4162 | }
|
4163 | function pruneCache(filter) {
|
4164 | cache.forEach((vnode, key) => {
|
4165 | const name = getComponentName(vnode.type);
|
4166 | if (name && (!filter || !filter(name))) {
|
4167 | pruneCacheEntry(key);
|
4168 | }
|
4169 | });
|
4170 | }
|
4171 | function pruneCacheEntry(key) {
|
4172 | const cached = cache.get(key);
|
4173 | if (!current || !isSameVNodeType(cached, current)) {
|
4174 | unmount(cached);
|
4175 | } else if (current) {
|
4176 | resetShapeFlag(current);
|
4177 | }
|
4178 | cache.delete(key);
|
4179 | keys.delete(key);
|
4180 | }
|
4181 | watch(
|
4182 | () => [props.include, props.exclude],
|
4183 | ([include, exclude]) => {
|
4184 | include && pruneCache((name) => matches(include, name));
|
4185 | exclude && pruneCache((name) => !matches(exclude, name));
|
4186 | },
|
4187 |
|
4188 | { flush: "post", deep: true }
|
4189 | );
|
4190 | let pendingCacheKey = null;
|
4191 | const cacheSubtree = () => {
|
4192 | if (pendingCacheKey != null) {
|
4193 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
4194 | }
|
4195 | };
|
4196 | onMounted(cacheSubtree);
|
4197 | onUpdated(cacheSubtree);
|
4198 | onBeforeUnmount(() => {
|
4199 | cache.forEach((cached) => {
|
4200 | const { subTree, suspense } = instance;
|
4201 | const vnode = getInnerChild(subTree);
|
4202 | if (cached.type === vnode.type && cached.key === vnode.key) {
|
4203 | resetShapeFlag(vnode);
|
4204 | const da = vnode.component.da;
|
4205 | da && queuePostRenderEffect(da, suspense);
|
4206 | return;
|
4207 | }
|
4208 | unmount(cached);
|
4209 | });
|
4210 | });
|
4211 | return () => {
|
4212 | pendingCacheKey = null;
|
4213 | if (!slots.default) {
|
4214 | return current = null;
|
4215 | }
|
4216 | const children = slots.default();
|
4217 | const rawVNode = children[0];
|
4218 | if (children.length > 1) {
|
4219 | {
|
4220 | warn$1(`KeepAlive should contain exactly one component child.`);
|
4221 | }
|
4222 | current = null;
|
4223 | return children;
|
4224 | } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
4225 | current = null;
|
4226 | return rawVNode;
|
4227 | }
|
4228 | let vnode = getInnerChild(rawVNode);
|
4229 | const comp = vnode.type;
|
4230 | const name = getComponentName(
|
4231 | isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
4232 | );
|
4233 | const { include, exclude, max } = props;
|
4234 | if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
4235 | current = vnode;
|
4236 | return rawVNode;
|
4237 | }
|
4238 | const key = vnode.key == null ? comp : vnode.key;
|
4239 | const cachedVNode = cache.get(key);
|
4240 | if (vnode.el) {
|
4241 | vnode = cloneVNode(vnode);
|
4242 | if (rawVNode.shapeFlag & 128) {
|
4243 | rawVNode.ssContent = vnode;
|
4244 | }
|
4245 | }
|
4246 | pendingCacheKey = key;
|
4247 | if (cachedVNode) {
|
4248 | vnode.el = cachedVNode.el;
|
4249 | vnode.component = cachedVNode.component;
|
4250 | if (vnode.transition) {
|
4251 | setTransitionHooks(vnode, vnode.transition);
|
4252 | }
|
4253 | vnode.shapeFlag |= 512;
|
4254 | keys.delete(key);
|
4255 | keys.add(key);
|
4256 | } else {
|
4257 | keys.add(key);
|
4258 | if (max && keys.size > parseInt(max, 10)) {
|
4259 | pruneCacheEntry(keys.values().next().value);
|
4260 | }
|
4261 | }
|
4262 | vnode.shapeFlag |= 256;
|
4263 | current = vnode;
|
4264 | return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
4265 | };
|
4266 | }
|
4267 | };
|
4268 | const KeepAlive = KeepAliveImpl;
|
4269 | function matches(pattern, name) {
|
4270 | if (isArray(pattern)) {
|
4271 | return pattern.some((p) => matches(p, name));
|
4272 | } else if (isString(pattern)) {
|
4273 | return pattern.split(",").includes(name);
|
4274 | } else if (isRegExp(pattern)) {
|
4275 | return pattern.test(name);
|
4276 | }
|
4277 | return false;
|
4278 | }
|
4279 | function onActivated(hook, target) {
|
4280 | registerKeepAliveHook(hook, "a", target);
|
4281 | }
|
4282 | function onDeactivated(hook, target) {
|
4283 | registerKeepAliveHook(hook, "da", target);
|
4284 | }
|
4285 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
4286 | const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
4287 | let current = target;
|
4288 | while (current) {
|
4289 | if (current.isDeactivated) {
|
4290 | return;
|
4291 | }
|
4292 | current = current.parent;
|
4293 | }
|
4294 | return hook();
|
4295 | });
|
4296 | injectHook(type, wrappedHook, target);
|
4297 | if (target) {
|
4298 | let current = target.parent;
|
4299 | while (current && current.parent) {
|
4300 | if (isKeepAlive(current.parent.vnode)) {
|
4301 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
4302 | }
|
4303 | current = current.parent;
|
4304 | }
|
4305 | }
|
4306 | }
|
4307 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
4308 | const injected = injectHook(
|
4309 | type,
|
4310 | hook,
|
4311 | keepAliveRoot,
|
4312 | true
|
4313 |
|
4314 | );
|
4315 | onUnmounted(() => {
|
4316 | remove(keepAliveRoot[type], injected);
|
4317 | }, target);
|
4318 | }
|
4319 | function resetShapeFlag(vnode) {
|
4320 | vnode.shapeFlag &= ~256;
|
4321 | vnode.shapeFlag &= ~512;
|
4322 | }
|
4323 | function getInnerChild(vnode) {
|
4324 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
4325 | }
|
4326 |
|
4327 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
4328 | if (target) {
|
4329 | const hooks = target[type] || (target[type] = []);
|
4330 | const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
4331 | if (target.isUnmounted) {
|
4332 | return;
|
4333 | }
|
4334 | pauseTracking();
|
4335 | const reset = setCurrentInstance(target);
|
4336 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
4337 | reset();
|
4338 | resetTracking();
|
4339 | return res;
|
4340 | });
|
4341 | if (prepend) {
|
4342 | hooks.unshift(wrappedHook);
|
4343 | } else {
|
4344 | hooks.push(wrappedHook);
|
4345 | }
|
4346 | return wrappedHook;
|
4347 | } else {
|
4348 | const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
4349 | warn$1(
|
4350 | `${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.` )
|
4351 | );
|
4352 | }
|
4353 | }
|
4354 | const createHook = (lifecycle) => (hook, target = currentInstance) => (
|
4355 |
|
4356 | (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
|
4357 | );
|
4358 | const onBeforeMount = createHook("bm");
|
4359 | const onMounted = createHook("m");
|
4360 | const onBeforeUpdate = createHook("bu");
|
4361 | const onUpdated = createHook("u");
|
4362 | const onBeforeUnmount = createHook("bum");
|
4363 | const onUnmounted = createHook("um");
|
4364 | const onServerPrefetch = createHook("sp");
|
4365 | const onRenderTriggered = createHook(
|
4366 | "rtg"
|
4367 | );
|
4368 | const onRenderTracked = createHook(
|
4369 | "rtc"
|
4370 | );
|
4371 | function onErrorCaptured(hook, target = currentInstance) {
|
4372 | injectHook("ec", hook, target);
|
4373 | }
|
4374 |
|
4375 | function renderList(source, renderItem, cache, index) {
|
4376 | let ret;
|
4377 | const cached = cache && cache[index];
|
4378 | if (isArray(source) || isString(source)) {
|
4379 | ret = new Array(source.length);
|
4380 | for (let i = 0, l = source.length; i < l; i++) {
|
4381 | ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
|
4382 | }
|
4383 | } else if (typeof source === "number") {
|
4384 | if (!Number.isInteger(source)) {
|
4385 | warn$1(`The v-for range expect an integer value but got ${source}.`);
|
4386 | }
|
4387 | ret = new Array(source);
|
4388 | for (let i = 0; i < source; i++) {
|
4389 | ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
4390 | }
|
4391 | } else if (isObject(source)) {
|
4392 | if (source[Symbol.iterator]) {
|
4393 | ret = Array.from(
|
4394 | source,
|
4395 | (item, i) => renderItem(item, i, void 0, cached && cached[i])
|
4396 | );
|
4397 | } else {
|
4398 | const keys = Object.keys(source);
|
4399 | ret = new Array(keys.length);
|
4400 | for (let i = 0, l = keys.length; i < l; i++) {
|
4401 | const key = keys[i];
|
4402 | ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
4403 | }
|
4404 | }
|
4405 | } else {
|
4406 | ret = [];
|
4407 | }
|
4408 | if (cache) {
|
4409 | cache[index] = ret;
|
4410 | }
|
4411 | return ret;
|
4412 | }
|
4413 |
|
4414 | function createSlots(slots, dynamicSlots) {
|
4415 | for (let i = 0; i < dynamicSlots.length; i++) {
|
4416 | const slot = dynamicSlots[i];
|
4417 | if (isArray(slot)) {
|
4418 | for (let j = 0; j < slot.length; j++) {
|
4419 | slots[slot[j].name] = slot[j].fn;
|
4420 | }
|
4421 | } else if (slot) {
|
4422 | slots[slot.name] = slot.key ? (...args) => {
|
4423 | const res = slot.fn(...args);
|
4424 | if (res)
|
4425 | res.key = slot.key;
|
4426 | return res;
|
4427 | } : slot.fn;
|
4428 | }
|
4429 | }
|
4430 | return slots;
|
4431 | }
|
4432 |
|
4433 | function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
4434 | if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
|
4435 | if (name !== "default")
|
4436 | props.name = name;
|
4437 | return createVNode("slot", props, fallback && fallback());
|
4438 | }
|
4439 | let slot = slots[name];
|
4440 | if (slot && slot.length > 1) {
|
4441 | warn$1(
|
4442 | `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.`
|
4443 | );
|
4444 | slot = () => [];
|
4445 | }
|
4446 | if (slot && slot._c) {
|
4447 | slot._d = false;
|
4448 | }
|
4449 | openBlock();
|
4450 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
4451 | const rendered = createBlock(
|
4452 | Fragment,
|
4453 | {
|
4454 | key: props.key ||
|
4455 |
|
4456 | validSlotContent && validSlotContent.key || `_${name}`
|
4457 | },
|
4458 | validSlotContent || (fallback ? fallback() : []),
|
4459 | validSlotContent && slots._ === 1 ? 64 : -2
|
4460 | );
|
4461 | if (!noSlotted && rendered.scopeId) {
|
4462 | rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
4463 | }
|
4464 | if (slot && slot._c) {
|
4465 | slot._d = true;
|
4466 | }
|
4467 | return rendered;
|
4468 | }
|
4469 | function ensureValidVNode(vnodes) {
|
4470 | return vnodes.some((child) => {
|
4471 | if (!isVNode(child))
|
4472 | return true;
|
4473 | if (child.type === Comment)
|
4474 | return false;
|
4475 | if (child.type === Fragment && !ensureValidVNode(child.children))
|
4476 | return false;
|
4477 | return true;
|
4478 | }) ? vnodes : null;
|
4479 | }
|
4480 |
|
4481 | function toHandlers(obj, preserveCaseIfNecessary) {
|
4482 | const ret = {};
|
4483 | if (!isObject(obj)) {
|
4484 | warn$1(`v-on with no argument expects an object value.`);
|
4485 | return ret;
|
4486 | }
|
4487 | for (const key in obj) {
|
4488 | ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
|
4489 | }
|
4490 | return ret;
|
4491 | }
|
4492 |
|
4493 | const getPublicInstance = (i) => {
|
4494 | if (!i)
|
4495 | return null;
|
4496 | if (isStatefulComponent(i))
|
4497 | return getExposeProxy(i) || i.proxy;
|
4498 | return getPublicInstance(i.parent);
|
4499 | };
|
4500 | const publicPropertiesMap = (
|
4501 |
|
4502 |
|
4503 | extend( Object.create(null), {
|
4504 | $: (i) => i,
|
4505 | $el: (i) => i.vnode.el,
|
4506 | $data: (i) => i.data,
|
4507 | $props: (i) => shallowReadonly(i.props) ,
|
4508 | $attrs: (i) => shallowReadonly(i.attrs) ,
|
4509 | $slots: (i) => shallowReadonly(i.slots) ,
|
4510 | $refs: (i) => shallowReadonly(i.refs) ,
|
4511 | $parent: (i) => getPublicInstance(i.parent),
|
4512 | $root: (i) => getPublicInstance(i.root),
|
4513 | $emit: (i) => i.emit,
|
4514 | $options: (i) => resolveMergedOptions(i) ,
|
4515 | $forceUpdate: (i) => i.f || (i.f = () => {
|
4516 | i.effect.dirty = true;
|
4517 | queueJob(i.update);
|
4518 | }),
|
4519 | $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
4520 | $watch: (i) => instanceWatch.bind(i)
|
4521 | })
|
4522 | );
|
4523 | const isReservedPrefix = (key) => key === "_" || key === "$";
|
4524 | const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
4525 | const PublicInstanceProxyHandlers = {
|
4526 | get({ _: instance }, key) {
|
4527 | if (key === "__v_skip") {
|
4528 | return true;
|
4529 | }
|
4530 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
4531 | if (key === "__isVue") {
|
4532 | return true;
|
4533 | }
|
4534 | let normalizedProps;
|
4535 | if (key[0] !== "$") {
|
4536 | const n = accessCache[key];
|
4537 | if (n !== void 0) {
|
4538 | switch (n) {
|
4539 | case 1 :
|
4540 | return setupState[key];
|
4541 | case 2 :
|
4542 | return data[key];
|
4543 | case 4 :
|
4544 | return ctx[key];
|
4545 | case 3 :
|
4546 | return props[key];
|
4547 | }
|
4548 | } else if (hasSetupBinding(setupState, key)) {
|
4549 | accessCache[key] = 1 ;
|
4550 | return setupState[key];
|
4551 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
4552 | accessCache[key] = 2 ;
|
4553 | return data[key];
|
4554 | } else if (
|
4555 |
|
4556 |
|
4557 | (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
|
4558 | ) {
|
4559 | accessCache[key] = 3 ;
|
4560 | return props[key];
|
4561 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
4562 | accessCache[key] = 4 ;
|
4563 | return ctx[key];
|
4564 | } else if (shouldCacheAccess) {
|
4565 | accessCache[key] = 0 ;
|
4566 | }
|
4567 | }
|
4568 | const publicGetter = publicPropertiesMap[key];
|
4569 | let cssModule, globalProperties;
|
4570 | if (publicGetter) {
|
4571 | if (key === "$attrs") {
|
4572 | track(instance.attrs, "get", "");
|
4573 | markAttrsAccessed();
|
4574 | } else if (key === "$slots") {
|
4575 | track(instance, "get", key);
|
4576 | }
|
4577 | return publicGetter(instance);
|
4578 | } else if (
|
4579 |
|
4580 | (cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
4581 | ) {
|
4582 | return cssModule;
|
4583 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
4584 | accessCache[key] = 4 ;
|
4585 | return ctx[key];
|
4586 | } else if (
|
4587 |
|
4588 | globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
|
4589 | ) {
|
4590 | {
|
4591 | return globalProperties[key];
|
4592 | }
|
4593 | } else if (currentRenderingInstance && (!isString(key) ||
|
4594 |
|
4595 | key.indexOf("__v") !== 0)) {
|
4596 | if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
4597 | warn$1(
|
4598 | `Property ${JSON.stringify(
|
4599 | key
|
4600 | )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
|
4601 | );
|
4602 | } else if (instance === currentRenderingInstance) {
|
4603 | warn$1(
|
4604 | `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
4605 | );
|
4606 | }
|
4607 | }
|
4608 | },
|
4609 | set({ _: instance }, key, value) {
|
4610 | const { data, setupState, ctx } = instance;
|
4611 | if (hasSetupBinding(setupState, key)) {
|
4612 | setupState[key] = value;
|
4613 | return true;
|
4614 | } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
4615 | warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
4616 | return false;
|
4617 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
4618 | data[key] = value;
|
4619 | return true;
|
4620 | } else if (hasOwn(instance.props, key)) {
|
4621 | warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
4622 | return false;
|
4623 | }
|
4624 | if (key[0] === "$" && key.slice(1) in instance) {
|
4625 | warn$1(
|
4626 | `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
|
4627 | );
|
4628 | return false;
|
4629 | } else {
|
4630 | if (key in instance.appContext.config.globalProperties) {
|
4631 | Object.defineProperty(ctx, key, {
|
4632 | enumerable: true,
|
4633 | configurable: true,
|
4634 | value
|
4635 | });
|
4636 | } else {
|
4637 | ctx[key] = value;
|
4638 | }
|
4639 | }
|
4640 | return true;
|
4641 | },
|
4642 | has({
|
4643 | _: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
4644 | }, key) {
|
4645 | let normalizedProps;
|
4646 | 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);
|
4647 | },
|
4648 | defineProperty(target, key, descriptor) {
|
4649 | if (descriptor.get != null) {
|
4650 | target._.accessCache[key] = 0;
|
4651 | } else if (hasOwn(descriptor, "value")) {
|
4652 | this.set(target, key, descriptor.value, null);
|
4653 | }
|
4654 | return Reflect.defineProperty(target, key, descriptor);
|
4655 | }
|
4656 | };
|
4657 | {
|
4658 | PublicInstanceProxyHandlers.ownKeys = (target) => {
|
4659 | warn$1(
|
4660 | `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
4661 | );
|
4662 | return Reflect.ownKeys(target);
|
4663 | };
|
4664 | }
|
4665 | const RuntimeCompiledPublicInstanceProxyHandlers = extend(
|
4666 | {},
|
4667 | PublicInstanceProxyHandlers,
|
4668 | {
|
4669 | get(target, key) {
|
4670 | if (key === Symbol.unscopables) {
|
4671 | return;
|
4672 | }
|
4673 | return PublicInstanceProxyHandlers.get(target, key, target);
|
4674 | },
|
4675 | has(_, key) {
|
4676 | const has = key[0] !== "_" && !isGloballyAllowed(key);
|
4677 | if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
4678 | warn$1(
|
4679 | `Property ${JSON.stringify(
|
4680 | key
|
4681 | )} should not start with _ which is a reserved prefix for Vue internals.`
|
4682 | );
|
4683 | }
|
4684 | return has;
|
4685 | }
|
4686 | }
|
4687 | );
|
4688 | function createDevRenderContext(instance) {
|
4689 | const target = {};
|
4690 | Object.defineProperty(target, `_`, {
|
4691 | configurable: true,
|
4692 | enumerable: false,
|
4693 | get: () => instance
|
4694 | });
|
4695 | Object.keys(publicPropertiesMap).forEach((key) => {
|
4696 | Object.defineProperty(target, key, {
|
4697 | configurable: true,
|
4698 | enumerable: false,
|
4699 | get: () => publicPropertiesMap[key](instance),
|
4700 | // intercepted by the proxy so no need for implementation,
|
4701 | // but needed to prevent set errors
|
4702 | set: NOOP
|
4703 | });
|
4704 | });
|
4705 | return target;
|
4706 | }
|
4707 | function exposePropsOnRenderContext(instance) {
|
4708 | const {
|
4709 | ctx,
|
4710 | propsOptions: [propsOptions]
|
4711 | } = instance;
|
4712 | if (propsOptions) {
|
4713 | Object.keys(propsOptions).forEach((key) => {
|
4714 | Object.defineProperty(ctx, key, {
|
4715 | enumerable: true,
|
4716 | configurable: true,
|
4717 | get: () => instance.props[key],
|
4718 | set: NOOP
|
4719 | });
|
4720 | });
|
4721 | }
|
4722 | }
|
4723 | function exposeSetupStateOnRenderContext(instance) {
|
4724 | const { ctx, setupState } = instance;
|
4725 | Object.keys(toRaw(setupState)).forEach((key) => {
|
4726 | if (!setupState.__isScriptSetup) {
|
4727 | if (isReservedPrefix(key[0])) {
|
4728 | warn$1(
|
4729 | `setup() return property ${JSON.stringify(
|
4730 | key
|
4731 | )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
|
4732 | );
|
4733 | return;
|
4734 | }
|
4735 | Object.defineProperty(ctx, key, {
|
4736 | enumerable: true,
|
4737 | configurable: true,
|
4738 | get: () => setupState[key],
|
4739 | set: NOOP
|
4740 | });
|
4741 | }
|
4742 | });
|
4743 | }
|
4744 |
|
4745 | const warnRuntimeUsage = (method) => warn$1(
|
4746 | `${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.`
|
4747 | );
|
4748 | function defineProps() {
|
4749 | {
|
4750 | warnRuntimeUsage(`defineProps`);
|
4751 | }
|
4752 | return null;
|
4753 | }
|
4754 | function defineEmits() {
|
4755 | {
|
4756 | warnRuntimeUsage(`defineEmits`);
|
4757 | }
|
4758 | return null;
|
4759 | }
|
4760 | function defineExpose(exposed) {
|
4761 | {
|
4762 | warnRuntimeUsage(`defineExpose`);
|
4763 | }
|
4764 | }
|
4765 | function defineOptions(options) {
|
4766 | {
|
4767 | warnRuntimeUsage(`defineOptions`);
|
4768 | }
|
4769 | }
|
4770 | function defineSlots() {
|
4771 | {
|
4772 | warnRuntimeUsage(`defineSlots`);
|
4773 | }
|
4774 | return null;
|
4775 | }
|
4776 | function defineModel() {
|
4777 | {
|
4778 | warnRuntimeUsage("defineModel");
|
4779 | }
|
4780 | }
|
4781 | function withDefaults(props, defaults) {
|
4782 | {
|
4783 | warnRuntimeUsage(`withDefaults`);
|
4784 | }
|
4785 | return null;
|
4786 | }
|
4787 | function useSlots() {
|
4788 | return getContext().slots;
|
4789 | }
|
4790 | function useAttrs() {
|
4791 | return getContext().attrs;
|
4792 | }
|
4793 | function getContext() {
|
4794 | const i = getCurrentInstance();
|
4795 | if (!i) {
|
4796 | warn$1(`useContext() called without active instance.`);
|
4797 | }
|
4798 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
4799 | }
|
4800 | function normalizePropsOrEmits(props) {
|
4801 | return isArray(props) ? props.reduce(
|
4802 | (normalized, p) => (normalized[p] = null, normalized),
|
4803 | {}
|
4804 | ) : props;
|
4805 | }
|
4806 | function mergeDefaults(raw, defaults) {
|
4807 | const props = normalizePropsOrEmits(raw);
|
4808 | for (const key in defaults) {
|
4809 | if (key.startsWith("__skip"))
|
4810 | continue;
|
4811 | let opt = props[key];
|
4812 | if (opt) {
|
4813 | if (isArray(opt) || isFunction(opt)) {
|
4814 | opt = props[key] = { type: opt, default: defaults[key] };
|
4815 | } else {
|
4816 | opt.default = defaults[key];
|
4817 | }
|
4818 | } else if (opt === null) {
|
4819 | opt = props[key] = { default: defaults[key] };
|
4820 | } else {
|
4821 | warn$1(`props default key "${key}" has no corresponding declaration.`);
|
4822 | }
|
4823 | if (opt && defaults[`__skip_${key}`]) {
|
4824 | opt.skipFactory = true;
|
4825 | }
|
4826 | }
|
4827 | return props;
|
4828 | }
|
4829 | function mergeModels(a, b) {
|
4830 | if (!a || !b)
|
4831 | return a || b;
|
4832 | if (isArray(a) && isArray(b))
|
4833 | return a.concat(b);
|
4834 | return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
4835 | }
|
4836 | function createPropsRestProxy(props, excludedKeys) {
|
4837 | const ret = {};
|
4838 | for (const key in props) {
|
4839 | if (!excludedKeys.includes(key)) {
|
4840 | Object.defineProperty(ret, key, {
|
4841 | enumerable: true,
|
4842 | get: () => props[key]
|
4843 | });
|
4844 | }
|
4845 | }
|
4846 | return ret;
|
4847 | }
|
4848 | function withAsyncContext(getAwaitable) {
|
4849 | const ctx = getCurrentInstance();
|
4850 | if (!ctx) {
|
4851 | warn$1(
|
4852 | `withAsyncContext called without active current instance. This is likely a bug.`
|
4853 | );
|
4854 | }
|
4855 | let awaitable = getAwaitable();
|
4856 | unsetCurrentInstance();
|
4857 | if (isPromise(awaitable)) {
|
4858 | awaitable = awaitable.catch((e) => {
|
4859 | setCurrentInstance(ctx);
|
4860 | throw e;
|
4861 | });
|
4862 | }
|
4863 | return [awaitable, () => setCurrentInstance(ctx)];
|
4864 | }
|
4865 |
|
4866 | function createDuplicateChecker() {
|
4867 | const cache = /* @__PURE__ */ Object.create(null);
|
4868 | return (type, key) => {
|
4869 | if (cache[key]) {
|
4870 | warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
4871 | } else {
|
4872 | cache[key] = type;
|
4873 | }
|
4874 | };
|
4875 | }
|
4876 | let shouldCacheAccess = true;
|
4877 | function applyOptions(instance) {
|
4878 | const options = resolveMergedOptions(instance);
|
4879 | const publicThis = instance.proxy;
|
4880 | const ctx = instance.ctx;
|
4881 | shouldCacheAccess = false;
|
4882 | if (options.beforeCreate) {
|
4883 | callHook$1(options.beforeCreate, instance, "bc");
|
4884 | }
|
4885 | const {
|
4886 | // state
|
4887 | data: dataOptions,
|
4888 | computed: computedOptions,
|
4889 | methods,
|
4890 | watch: watchOptions,
|
4891 | provide: provideOptions,
|
4892 | inject: injectOptions,
|
4893 | // lifecycle
|
4894 | created,
|
4895 | beforeMount,
|
4896 | mounted,
|
4897 | beforeUpdate,
|
4898 | updated,
|
4899 | activated,
|
4900 | deactivated,
|
4901 | beforeDestroy,
|
4902 | beforeUnmount,
|
4903 | destroyed,
|
4904 | unmounted,
|
4905 | render,
|
4906 | renderTracked,
|
4907 | renderTriggered,
|
4908 | errorCaptured,
|
4909 | serverPrefetch,
|
4910 | // public API
|
4911 | expose,
|
4912 | inheritAttrs,
|
4913 | // assets
|
4914 | components,
|
4915 | directives,
|
4916 | filters
|
4917 | } = options;
|
4918 | const checkDuplicateProperties = createDuplicateChecker() ;
|
4919 | {
|
4920 | const [propsOptions] = instance.propsOptions;
|
4921 | if (propsOptions) {
|
4922 | for (const key in propsOptions) {
|
4923 | checkDuplicateProperties("Props" /* PROPS */, key);
|
4924 | }
|
4925 | }
|
4926 | }
|
4927 | if (injectOptions) {
|
4928 | resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
4929 | }
|
4930 | if (methods) {
|
4931 | for (const key in methods) {
|
4932 | const methodHandler = methods[key];
|
4933 | if (isFunction(methodHandler)) {
|
4934 | {
|
4935 | Object.defineProperty(ctx, key, {
|
4936 | value: methodHandler.bind(publicThis),
|
4937 | configurable: true,
|
4938 | enumerable: true,
|
4939 | writable: true
|
4940 | });
|
4941 | }
|
4942 | {
|
4943 | checkDuplicateProperties("Methods" /* METHODS */, key);
|
4944 | }
|
4945 | } else {
|
4946 | warn$1(
|
4947 | `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
4948 | );
|
4949 | }
|
4950 | }
|
4951 | }
|
4952 | if (dataOptions) {
|
4953 | if (!isFunction(dataOptions)) {
|
4954 | warn$1(
|
4955 | `The data option must be a function. Plain object usage is no longer supported.`
|
4956 | );
|
4957 | }
|
4958 | const data = dataOptions.call(publicThis, publicThis);
|
4959 | if (isPromise(data)) {
|
4960 | warn$1(
|
4961 | `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
|
4962 | );
|
4963 | }
|
4964 | if (!isObject(data)) {
|
4965 | warn$1(`data() should return an object.`);
|
4966 | } else {
|
4967 | instance.data = reactive(data);
|
4968 | {
|
4969 | for (const key in data) {
|
4970 | checkDuplicateProperties("Data" , key);
|
4971 | if (!isReservedPrefix(key[0])) {
|
4972 | Object.defineProperty(ctx, key, {
|
4973 | configurable: true,
|
4974 | enumerable: true,
|
4975 | get: () => data[key],
|
4976 | set: NOOP
|
4977 | });
|
4978 | }
|
4979 | }
|
4980 | }
|
4981 | }
|
4982 | }
|
4983 | shouldCacheAccess = true;
|
4984 | if (computedOptions) {
|
4985 | for (const key in computedOptions) {
|
4986 | const opt = computedOptions[key];
|
4987 | const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
4988 | if (get === NOOP) {
|
4989 | warn$1(`Computed property "${key}" has no getter.`);
|
4990 | }
|
4991 | const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
|
4992 | warn$1(
|
4993 | `Write operation failed: computed property "${key}" is readonly.`
|
4994 | );
|
4995 | } ;
|
4996 | const c = computed({
|
4997 | get,
|
4998 | set
|
4999 | });
|
5000 | Object.defineProperty(ctx, key, {
|
5001 | enumerable: true,
|
5002 | configurable: true,
|
5003 | get: () => c.value,
|
5004 | set: (v) => c.value = v
|
5005 | });
|
5006 | {
|
5007 | checkDuplicateProperties("Computed" , key);
|
5008 | }
|
5009 | }
|
5010 | }
|
5011 | if (watchOptions) {
|
5012 | for (const key in watchOptions) {
|
5013 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
5014 | }
|
5015 | }
|
5016 | if (provideOptions) {
|
5017 | const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
5018 | Reflect.ownKeys(provides).forEach((key) => {
|
5019 | provide(key, provides[key]);
|
5020 | });
|
5021 | }
|
5022 | if (created) {
|
5023 | callHook$1(created, instance, "c");
|
5024 | }
|
5025 | function registerLifecycleHook(register, hook) {
|
5026 | if (isArray(hook)) {
|
5027 | hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
5028 | } else if (hook) {
|
5029 | register(hook.bind(publicThis));
|
5030 | }
|
5031 | }
|
5032 | registerLifecycleHook(onBeforeMount, beforeMount);
|
5033 | registerLifecycleHook(onMounted, mounted);
|
5034 | registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
5035 | registerLifecycleHook(onUpdated, updated);
|
5036 | registerLifecycleHook(onActivated, activated);
|
5037 | registerLifecycleHook(onDeactivated, deactivated);
|
5038 | registerLifecycleHook(onErrorCaptured, errorCaptured);
|
5039 | registerLifecycleHook(onRenderTracked, renderTracked);
|
5040 | registerLifecycleHook(onRenderTriggered, renderTriggered);
|
5041 | registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
5042 | registerLifecycleHook(onUnmounted, unmounted);
|
5043 | registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
5044 | if (isArray(expose)) {
|
5045 | if (expose.length) {
|
5046 | const exposed = instance.exposed || (instance.exposed = {});
|
5047 | expose.forEach((key) => {
|
5048 | Object.defineProperty(exposed, key, {
|
5049 | get: () => publicThis[key],
|
5050 | set: (val) => publicThis[key] = val
|
5051 | });
|
5052 | });
|
5053 | } else if (!instance.exposed) {
|
5054 | instance.exposed = {};
|
5055 | }
|
5056 | }
|
5057 | if (render && instance.render === NOOP) {
|
5058 | instance.render = render;
|
5059 | }
|
5060 | if (inheritAttrs != null) {
|
5061 | instance.inheritAttrs = inheritAttrs;
|
5062 | }
|
5063 | if (components)
|
5064 | instance.components = components;
|
5065 | if (directives)
|
5066 | instance.directives = directives;
|
5067 | }
|
5068 | function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
|
5069 | if (isArray(injectOptions)) {
|
5070 | injectOptions = normalizeInject(injectOptions);
|
5071 | }
|
5072 | for (const key in injectOptions) {
|
5073 | const opt = injectOptions[key];
|
5074 | let injected;
|
5075 | if (isObject(opt)) {
|
5076 | if ("default" in opt) {
|
5077 | injected = inject(
|
5078 | opt.from || key,
|
5079 | opt.default,
|
5080 | true
|
5081 | );
|
5082 | } else {
|
5083 | injected = inject(opt.from || key);
|
5084 | }
|
5085 | } else {
|
5086 | injected = inject(opt);
|
5087 | }
|
5088 | if (isRef(injected)) {
|
5089 | Object.defineProperty(ctx, key, {
|
5090 | enumerable: true,
|
5091 | configurable: true,
|
5092 | get: () => injected.value,
|
5093 | set: (v) => injected.value = v
|
5094 | });
|
5095 | } else {
|
5096 | ctx[key] = injected;
|
5097 | }
|
5098 | {
|
5099 | checkDuplicateProperties("Inject" , key);
|
5100 | }
|
5101 | }
|
5102 | }
|
5103 | function callHook$1(hook, instance, type) {
|
5104 | callWithAsyncErrorHandling(
|
5105 | isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
5106 | instance,
|
5107 | type
|
5108 | );
|
5109 | }
|
5110 | function createWatcher(raw, ctx, publicThis, key) {
|
5111 | const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
5112 | if (isString(raw)) {
|
5113 | const handler = ctx[raw];
|
5114 | if (isFunction(handler)) {
|
5115 | watch(getter, handler);
|
5116 | } else {
|
5117 | warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
5118 | }
|
5119 | } else if (isFunction(raw)) {
|
5120 | watch(getter, raw.bind(publicThis));
|
5121 | } else if (isObject(raw)) {
|
5122 | if (isArray(raw)) {
|
5123 | raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
5124 | } else {
|
5125 | const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
5126 | if (isFunction(handler)) {
|
5127 | watch(getter, handler, raw);
|
5128 | } else {
|
5129 | warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
5130 | }
|
5131 | }
|
5132 | } else {
|
5133 | warn$1(`Invalid watch option: "${key}"`, raw);
|
5134 | }
|
5135 | }
|
5136 | function resolveMergedOptions(instance) {
|
5137 | const base = instance.type;
|
5138 | const { mixins, extends: extendsOptions } = base;
|
5139 | const {
|
5140 | mixins: globalMixins,
|
5141 | optionsCache: cache,
|
5142 | config: { optionMergeStrategies }
|
5143 | } = instance.appContext;
|
5144 | const cached = cache.get(base);
|
5145 | let resolved;
|
5146 | if (cached) {
|
5147 | resolved = cached;
|
5148 | } else if (!globalMixins.length && !mixins && !extendsOptions) {
|
5149 | {
|
5150 | resolved = base;
|
5151 | }
|
5152 | } else {
|
5153 | resolved = {};
|
5154 | if (globalMixins.length) {
|
5155 | globalMixins.forEach(
|
5156 | (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
5157 | );
|
5158 | }
|
5159 | mergeOptions(resolved, base, optionMergeStrategies);
|
5160 | }
|
5161 | if (isObject(base)) {
|
5162 | cache.set(base, resolved);
|
5163 | }
|
5164 | return resolved;
|
5165 | }
|
5166 | function mergeOptions(to, from, strats, asMixin = false) {
|
5167 | const { mixins, extends: extendsOptions } = from;
|
5168 | if (extendsOptions) {
|
5169 | mergeOptions(to, extendsOptions, strats, true);
|
5170 | }
|
5171 | if (mixins) {
|
5172 | mixins.forEach(
|
5173 | (m) => mergeOptions(to, m, strats, true)
|
5174 | );
|
5175 | }
|
5176 | for (const key in from) {
|
5177 | if (asMixin && key === "expose") {
|
5178 | warn$1(
|
5179 | `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
5180 | );
|
5181 | } else {
|
5182 | const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
5183 | to[key] = strat ? strat(to[key], from[key]) : from[key];
|
5184 | }
|
5185 | }
|
5186 | return to;
|
5187 | }
|
5188 | const internalOptionMergeStrats = {
|
5189 | data: mergeDataFn,
|
5190 | props: mergeEmitsOrPropsOptions,
|
5191 | emits: mergeEmitsOrPropsOptions,
|
5192 |
|
5193 | methods: mergeObjectOptions,
|
5194 | computed: mergeObjectOptions,
|
5195 |
|
5196 | beforeCreate: mergeAsArray,
|
5197 | created: mergeAsArray,
|
5198 | beforeMount: mergeAsArray,
|
5199 | mounted: mergeAsArray,
|
5200 | beforeUpdate: mergeAsArray,
|
5201 | updated: mergeAsArray,
|
5202 | beforeDestroy: mergeAsArray,
|
5203 | beforeUnmount: mergeAsArray,
|
5204 | destroyed: mergeAsArray,
|
5205 | unmounted: mergeAsArray,
|
5206 | activated: mergeAsArray,
|
5207 | deactivated: mergeAsArray,
|
5208 | errorCaptured: mergeAsArray,
|
5209 | serverPrefetch: mergeAsArray,
|
5210 |
|
5211 | components: mergeObjectOptions,
|
5212 | directives: mergeObjectOptions,
|
5213 |
|
5214 | watch: mergeWatchOptions,
|
5215 |
|
5216 | provide: mergeDataFn,
|
5217 | inject: mergeInject
|
5218 | };
|
5219 | function mergeDataFn(to, from) {
|
5220 | if (!from) {
|
5221 | return to;
|
5222 | }
|
5223 | if (!to) {
|
5224 | return from;
|
5225 | }
|
5226 | return function mergedDataFn() {
|
5227 | return (extend)(
|
5228 | isFunction(to) ? to.call(this, this) : to,
|
5229 | isFunction(from) ? from.call(this, this) : from
|
5230 | );
|
5231 | };
|
5232 | }
|
5233 | function mergeInject(to, from) {
|
5234 | return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
5235 | }
|
5236 | function normalizeInject(raw) {
|
5237 | if (isArray(raw)) {
|
5238 | const res = {};
|
5239 | for (let i = 0; i < raw.length; i++) {
|
5240 | res[raw[i]] = raw[i];
|
5241 | }
|
5242 | return res;
|
5243 | }
|
5244 | return raw;
|
5245 | }
|
5246 | function mergeAsArray(to, from) {
|
5247 | return to ? [...new Set([].concat(to, from))] : from;
|
5248 | }
|
5249 | function mergeObjectOptions(to, from) {
|
5250 | return to ? extend( Object.create(null), to, from) : from;
|
5251 | }
|
5252 | function mergeEmitsOrPropsOptions(to, from) {
|
5253 | if (to) {
|
5254 | if (isArray(to) && isArray(from)) {
|
5255 | return [... new Set([...to, ...from])];
|
5256 | }
|
5257 | return extend(
|
5258 | Object.create(null),
|
5259 | normalizePropsOrEmits(to),
|
5260 | normalizePropsOrEmits(from != null ? from : {})
|
5261 | );
|
5262 | } else {
|
5263 | return from;
|
5264 | }
|
5265 | }
|
5266 | function mergeWatchOptions(to, from) {
|
5267 | if (!to)
|
5268 | return from;
|
5269 | if (!from)
|
5270 | return to;
|
5271 | const merged = extend( Object.create(null), to);
|
5272 | for (const key in from) {
|
5273 | merged[key] = mergeAsArray(to[key], from[key]);
|
5274 | }
|
5275 | return merged;
|
5276 | }
|
5277 |
|
5278 | function createAppContext() {
|
5279 | return {
|
5280 | app: null,
|
5281 | config: {
|
5282 | isNativeTag: NO,
|
5283 | performance: false,
|
5284 | globalProperties: {},
|
5285 | optionMergeStrategies: {},
|
5286 | errorHandler: void 0,
|
5287 | warnHandler: void 0,
|
5288 | compilerOptions: {}
|
5289 | },
|
5290 | mixins: [],
|
5291 | components: {},
|
5292 | directives: {},
|
5293 | provides: Object.create(null),
|
5294 | optionsCache: new WeakMap(),
|
5295 | propsCache: new WeakMap(),
|
5296 | emitsCache: new WeakMap()
|
5297 | };
|
5298 | }
|
5299 | let uid$1 = 0;
|
5300 | function createAppAPI(render, hydrate) {
|
5301 | return function createApp(rootComponent, rootProps = null) {
|
5302 | if (!isFunction(rootComponent)) {
|
5303 | rootComponent = extend({}, rootComponent);
|
5304 | }
|
5305 | if (rootProps != null && !isObject(rootProps)) {
|
5306 | warn$1(`root props passed to app.mount() must be an object.`);
|
5307 | rootProps = null;
|
5308 | }
|
5309 | const context = createAppContext();
|
5310 | const installedPlugins = new WeakSet();
|
5311 | let isMounted = false;
|
5312 | const app = context.app = {
|
5313 | _uid: uid$1++,
|
5314 | _component: rootComponent,
|
5315 | _props: rootProps,
|
5316 | _container: null,
|
5317 | _context: context,
|
5318 | _instance: null,
|
5319 | version,
|
5320 | get config() {
|
5321 | return context.config;
|
5322 | },
|
5323 | set config(v) {
|
5324 | {
|
5325 | warn$1(
|
5326 | `app.config cannot be replaced. Modify individual options instead.`
|
5327 | );
|
5328 | }
|
5329 | },
|
5330 | use(plugin, ...options) {
|
5331 | if (installedPlugins.has(plugin)) {
|
5332 | warn$1(`Plugin has already been applied to target app.`);
|
5333 | } else if (plugin && isFunction(plugin.install)) {
|
5334 | installedPlugins.add(plugin);
|
5335 | plugin.install(app, ...options);
|
5336 | } else if (isFunction(plugin)) {
|
5337 | installedPlugins.add(plugin);
|
5338 | plugin(app, ...options);
|
5339 | } else {
|
5340 | warn$1(
|
5341 | `A plugin must either be a function or an object with an "install" function.`
|
5342 | );
|
5343 | }
|
5344 | return app;
|
5345 | },
|
5346 | mixin(mixin) {
|
5347 | {
|
5348 | if (!context.mixins.includes(mixin)) {
|
5349 | context.mixins.push(mixin);
|
5350 | } else {
|
5351 | warn$1(
|
5352 | "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
5353 | );
|
5354 | }
|
5355 | }
|
5356 | return app;
|
5357 | },
|
5358 | component(name, component) {
|
5359 | {
|
5360 | validateComponentName(name, context.config);
|
5361 | }
|
5362 | if (!component) {
|
5363 | return context.components[name];
|
5364 | }
|
5365 | if (context.components[name]) {
|
5366 | warn$1(`Component "${name}" has already been registered in target app.`);
|
5367 | }
|
5368 | context.components[name] = component;
|
5369 | return app;
|
5370 | },
|
5371 | directive(name, directive) {
|
5372 | {
|
5373 | validateDirectiveName(name);
|
5374 | }
|
5375 | if (!directive) {
|
5376 | return context.directives[name];
|
5377 | }
|
5378 | if (context.directives[name]) {
|
5379 | warn$1(`Directive "${name}" has already been registered in target app.`);
|
5380 | }
|
5381 | context.directives[name] = directive;
|
5382 | return app;
|
5383 | },
|
5384 | mount(rootContainer, isHydrate, namespace) {
|
5385 | if (!isMounted) {
|
5386 | if (rootContainer.__vue_app__) {
|
5387 | warn$1(
|
5388 | `There is already an app instance mounted on the host container.
|
5389 | If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
5390 | );
|
5391 | }
|
5392 | const vnode = createVNode(rootComponent, rootProps);
|
5393 | vnode.appContext = context;
|
5394 | if (namespace === true) {
|
5395 | namespace = "svg";
|
5396 | } else if (namespace === false) {
|
5397 | namespace = void 0;
|
5398 | }
|
5399 | {
|
5400 | context.reload = () => {
|
5401 | render(
|
5402 | cloneVNode(vnode),
|
5403 | rootContainer,
|
5404 | namespace
|
5405 | );
|
5406 | };
|
5407 | }
|
5408 | if (isHydrate && hydrate) {
|
5409 | hydrate(vnode, rootContainer);
|
5410 | } else {
|
5411 | render(vnode, rootContainer, namespace);
|
5412 | }
|
5413 | isMounted = true;
|
5414 | app._container = rootContainer;
|
5415 | rootContainer.__vue_app__ = app;
|
5416 | {
|
5417 | app._instance = vnode.component;
|
5418 | devtoolsInitApp(app, version);
|
5419 | }
|
5420 | return getExposeProxy(vnode.component) || vnode.component.proxy;
|
5421 | } else {
|
5422 | warn$1(
|
5423 | `App has already been mounted.
|
5424 | If 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)\``
|
5425 | );
|
5426 | }
|
5427 | },
|
5428 | unmount() {
|
5429 | if (isMounted) {
|
5430 | render(null, app._container);
|
5431 | {
|
5432 | app._instance = null;
|
5433 | devtoolsUnmountApp(app);
|
5434 | }
|
5435 | delete app._container.__vue_app__;
|
5436 | } else {
|
5437 | warn$1(`Cannot unmount an app that is not mounted.`);
|
5438 | }
|
5439 | },
|
5440 | provide(key, value) {
|
5441 | if (key in context.provides) {
|
5442 | warn$1(
|
5443 | `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
5444 | );
|
5445 | }
|
5446 | context.provides[key] = value;
|
5447 | return app;
|
5448 | },
|
5449 | runWithContext(fn) {
|
5450 | const lastApp = currentApp;
|
5451 | currentApp = app;
|
5452 | try {
|
5453 | return fn();
|
5454 | } finally {
|
5455 | currentApp = lastApp;
|
5456 | }
|
5457 | }
|
5458 | };
|
5459 | return app;
|
5460 | };
|
5461 | }
|
5462 | let currentApp = null;
|
5463 |
|
5464 | function provide(key, value) {
|
5465 | if (!currentInstance) {
|
5466 | {
|
5467 | warn$1(`provide() can only be used inside setup().`);
|
5468 | }
|
5469 | } else {
|
5470 | let provides = currentInstance.provides;
|
5471 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
5472 | if (parentProvides === provides) {
|
5473 | provides = currentInstance.provides = Object.create(parentProvides);
|
5474 | }
|
5475 | provides[key] = value;
|
5476 | }
|
5477 | }
|
5478 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
5479 | const instance = currentInstance || currentRenderingInstance;
|
5480 | if (instance || currentApp) {
|
5481 | const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
5482 | if (provides && key in provides) {
|
5483 | return provides[key];
|
5484 | } else if (arguments.length > 1) {
|
5485 | return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
5486 | } else {
|
5487 | warn$1(`injection "${String(key)}" not found.`);
|
5488 | }
|
5489 | } else {
|
5490 | warn$1(`inject() can only be used inside setup() or functional components.`);
|
5491 | }
|
5492 | }
|
5493 | function hasInjectionContext() {
|
5494 | return !!(currentInstance || currentRenderingInstance || currentApp);
|
5495 | }
|
5496 |
|
5497 | const internalObjectProto = {};
|
5498 | const createInternalObject = () => Object.create(internalObjectProto);
|
5499 | const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
5500 |
|
5501 | function initProps(instance, rawProps, isStateful, isSSR = false) {
|
5502 | const props = {};
|
5503 | const attrs = createInternalObject();
|
5504 | instance.propsDefaults = Object.create(null);
|
5505 | setFullProps(instance, rawProps, props, attrs);
|
5506 | for (const key in instance.propsOptions[0]) {
|
5507 | if (!(key in props)) {
|
5508 | props[key] = void 0;
|
5509 | }
|
5510 | }
|
5511 | {
|
5512 | validateProps(rawProps || {}, props, instance);
|
5513 | }
|
5514 | if (isStateful) {
|
5515 | instance.props = isSSR ? props : shallowReactive(props);
|
5516 | } else {
|
5517 | if (!instance.type.props) {
|
5518 | instance.props = attrs;
|
5519 | } else {
|
5520 | instance.props = props;
|
5521 | }
|
5522 | }
|
5523 | instance.attrs = attrs;
|
5524 | }
|
5525 | function isInHmrContext(instance) {
|
5526 | while (instance) {
|
5527 | if (instance.type.__hmrId)
|
5528 | return true;
|
5529 | instance = instance.parent;
|
5530 | }
|
5531 | }
|
5532 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
5533 | const {
|
5534 | props,
|
5535 | attrs,
|
5536 | vnode: { patchFlag }
|
5537 | } = instance;
|
5538 | const rawCurrentProps = toRaw(props);
|
5539 | const [options] = instance.propsOptions;
|
5540 | let hasAttrsChanged = false;
|
5541 | if (
|
5542 |
|
5543 |
|
5544 |
|
5545 | !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
|
5546 | ) {
|
5547 | if (patchFlag & 8) {
|
5548 | const propsToUpdate = instance.vnode.dynamicProps;
|
5549 | for (let i = 0; i < propsToUpdate.length; i++) {
|
5550 | let key = propsToUpdate[i];
|
5551 | if (isEmitListener(instance.emitsOptions, key)) {
|
5552 | continue;
|
5553 | }
|
5554 | const value = rawProps[key];
|
5555 | if (options) {
|
5556 | if (hasOwn(attrs, key)) {
|
5557 | if (value !== attrs[key]) {
|
5558 | attrs[key] = value;
|
5559 | hasAttrsChanged = true;
|
5560 | }
|
5561 | } else {
|
5562 | const camelizedKey = camelize(key);
|
5563 | props[camelizedKey] = resolvePropValue(
|
5564 | options,
|
5565 | rawCurrentProps,
|
5566 | camelizedKey,
|
5567 | value,
|
5568 | instance,
|
5569 | false
|
5570 | );
|
5571 | }
|
5572 | } else {
|
5573 | if (value !== attrs[key]) {
|
5574 | attrs[key] = value;
|
5575 | hasAttrsChanged = true;
|
5576 | }
|
5577 | }
|
5578 | }
|
5579 | }
|
5580 | } else {
|
5581 | if (setFullProps(instance, rawProps, props, attrs)) {
|
5582 | hasAttrsChanged = true;
|
5583 | }
|
5584 | let kebabKey;
|
5585 | for (const key in rawCurrentProps) {
|
5586 | if (!rawProps ||
|
5587 | !hasOwn(rawProps, key) &&
|
5588 |
|
5589 | ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
|
5590 | if (options) {
|
5591 | if (rawPrevProps &&
|
5592 | (rawPrevProps[key] !== void 0 ||
|
5593 | rawPrevProps[kebabKey] !== void 0)) {
|
5594 | props[key] = resolvePropValue(
|
5595 | options,
|
5596 | rawCurrentProps,
|
5597 | key,
|
5598 | void 0,
|
5599 | instance,
|
5600 | true
|
5601 | );
|
5602 | }
|
5603 | } else {
|
5604 | delete props[key];
|
5605 | }
|
5606 | }
|
5607 | }
|
5608 | if (attrs !== rawCurrentProps) {
|
5609 | for (const key in attrs) {
|
5610 | if (!rawProps || !hasOwn(rawProps, key) && true) {
|
5611 | delete attrs[key];
|
5612 | hasAttrsChanged = true;
|
5613 | }
|
5614 | }
|
5615 | }
|
5616 | }
|
5617 | if (hasAttrsChanged) {
|
5618 | trigger(instance.attrs, "set", "");
|
5619 | }
|
5620 | {
|
5621 | validateProps(rawProps || {}, props, instance);
|
5622 | }
|
5623 | }
|
5624 | function setFullProps(instance, rawProps, props, attrs) {
|
5625 | const [options, needCastKeys] = instance.propsOptions;
|
5626 | let hasAttrsChanged = false;
|
5627 | let rawCastValues;
|
5628 | if (rawProps) {
|
5629 | for (let key in rawProps) {
|
5630 | if (isReservedProp(key)) {
|
5631 | continue;
|
5632 | }
|
5633 | const value = rawProps[key];
|
5634 | let camelKey;
|
5635 | if (options && hasOwn(options, camelKey = camelize(key))) {
|
5636 | if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
5637 | props[camelKey] = value;
|
5638 | } else {
|
5639 | (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
5640 | }
|
5641 | } else if (!isEmitListener(instance.emitsOptions, key)) {
|
5642 | if (!(key in attrs) || value !== attrs[key]) {
|
5643 | attrs[key] = value;
|
5644 | hasAttrsChanged = true;
|
5645 | }
|
5646 | }
|
5647 | }
|
5648 | }
|
5649 | if (needCastKeys) {
|
5650 | const rawCurrentProps = toRaw(props);
|
5651 | const castValues = rawCastValues || EMPTY_OBJ;
|
5652 | for (let i = 0; i < needCastKeys.length; i++) {
|
5653 | const key = needCastKeys[i];
|
5654 | props[key] = resolvePropValue(
|
5655 | options,
|
5656 | rawCurrentProps,
|
5657 | key,
|
5658 | castValues[key],
|
5659 | instance,
|
5660 | !hasOwn(castValues, key)
|
5661 | );
|
5662 | }
|
5663 | }
|
5664 | return hasAttrsChanged;
|
5665 | }
|
5666 | function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
5667 | const opt = options[key];
|
5668 | if (opt != null) {
|
5669 | const hasDefault = hasOwn(opt, "default");
|
5670 | if (hasDefault && value === void 0) {
|
5671 | const defaultValue = opt.default;
|
5672 | if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
5673 | const { propsDefaults } = instance;
|
5674 | if (key in propsDefaults) {
|
5675 | value = propsDefaults[key];
|
5676 | } else {
|
5677 | const reset = setCurrentInstance(instance);
|
5678 | value = propsDefaults[key] = defaultValue.call(
|
5679 | null,
|
5680 | props
|
5681 | );
|
5682 | reset();
|
5683 | }
|
5684 | } else {
|
5685 | value = defaultValue;
|
5686 | }
|
5687 | }
|
5688 | if (opt[0 ]) {
|
5689 | if (isAbsent && !hasDefault) {
|
5690 | value = false;
|
5691 | } else if (opt[1 ] && (value === "" || value === hyphenate(key))) {
|
5692 | value = true;
|
5693 | }
|
5694 | }
|
5695 | }
|
5696 | return value;
|
5697 | }
|
5698 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
5699 | const cache = appContext.propsCache;
|
5700 | const cached = cache.get(comp);
|
5701 | if (cached) {
|
5702 | return cached;
|
5703 | }
|
5704 | const raw = comp.props;
|
5705 | const normalized = {};
|
5706 | const needCastKeys = [];
|
5707 | let hasExtends = false;
|
5708 | if (!isFunction(comp)) {
|
5709 | const extendProps = (raw2) => {
|
5710 | hasExtends = true;
|
5711 | const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
5712 | extend(normalized, props);
|
5713 | if (keys)
|
5714 | needCastKeys.push(...keys);
|
5715 | };
|
5716 | if (!asMixin && appContext.mixins.length) {
|
5717 | appContext.mixins.forEach(extendProps);
|
5718 | }
|
5719 | if (comp.extends) {
|
5720 | extendProps(comp.extends);
|
5721 | }
|
5722 | if (comp.mixins) {
|
5723 | comp.mixins.forEach(extendProps);
|
5724 | }
|
5725 | }
|
5726 | if (!raw && !hasExtends) {
|
5727 | if (isObject(comp)) {
|
5728 | cache.set(comp, EMPTY_ARR);
|
5729 | }
|
5730 | return EMPTY_ARR;
|
5731 | }
|
5732 | if (isArray(raw)) {
|
5733 | for (let i = 0; i < raw.length; i++) {
|
5734 | if (!isString(raw[i])) {
|
5735 | warn$1(`props must be strings when using array syntax.`, raw[i]);
|
5736 | }
|
5737 | const normalizedKey = camelize(raw[i]);
|
5738 | if (validatePropName(normalizedKey)) {
|
5739 | normalized[normalizedKey] = EMPTY_OBJ;
|
5740 | }
|
5741 | }
|
5742 | } else if (raw) {
|
5743 | if (!isObject(raw)) {
|
5744 | warn$1(`invalid props options`, raw);
|
5745 | }
|
5746 | for (const key in raw) {
|
5747 | const normalizedKey = camelize(key);
|
5748 | if (validatePropName(normalizedKey)) {
|
5749 | const opt = raw[key];
|
5750 | const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
|
5751 | if (prop) {
|
5752 | const booleanIndex = getTypeIndex(Boolean, prop.type);
|
5753 | const stringIndex = getTypeIndex(String, prop.type);
|
5754 | prop[0 ] = booleanIndex > -1;
|
5755 | prop[1 ] = stringIndex < 0 || booleanIndex < stringIndex;
|
5756 | if (booleanIndex > -1 || hasOwn(prop, "default")) {
|
5757 | needCastKeys.push(normalizedKey);
|
5758 | }
|
5759 | }
|
5760 | }
|
5761 | }
|
5762 | }
|
5763 | const res = [normalized, needCastKeys];
|
5764 | if (isObject(comp)) {
|
5765 | cache.set(comp, res);
|
5766 | }
|
5767 | return res;
|
5768 | }
|
5769 | function validatePropName(key) {
|
5770 | if (key[0] !== "$" && !isReservedProp(key)) {
|
5771 | return true;
|
5772 | } else {
|
5773 | warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
5774 | }
|
5775 | return false;
|
5776 | }
|
5777 | function getType(ctor) {
|
5778 | if (ctor === null) {
|
5779 | return "null";
|
5780 | }
|
5781 | if (typeof ctor === "function") {
|
5782 | return ctor.name || "";
|
5783 | } else if (typeof ctor === "object") {
|
5784 | const name = ctor.constructor && ctor.constructor.name;
|
5785 | return name || "";
|
5786 | }
|
5787 | return "";
|
5788 | }
|
5789 | function isSameType(a, b) {
|
5790 | return getType(a) === getType(b);
|
5791 | }
|
5792 | function getTypeIndex(type, expectedTypes) {
|
5793 | if (isArray(expectedTypes)) {
|
5794 | return expectedTypes.findIndex((t) => isSameType(t, type));
|
5795 | } else if (isFunction(expectedTypes)) {
|
5796 | return isSameType(expectedTypes, type) ? 0 : -1;
|
5797 | }
|
5798 | return -1;
|
5799 | }
|
5800 | function validateProps(rawProps, props, instance) {
|
5801 | const resolvedValues = toRaw(props);
|
5802 | const options = instance.propsOptions[0];
|
5803 | for (const key in options) {
|
5804 | let opt = options[key];
|
5805 | if (opt == null)
|
5806 | continue;
|
5807 | validateProp(
|
5808 | key,
|
5809 | resolvedValues[key],
|
5810 | opt,
|
5811 | shallowReadonly(resolvedValues) ,
|
5812 | !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
|
5813 | );
|
5814 | }
|
5815 | }
|
5816 | function validateProp(name, value, prop, props, isAbsent) {
|
5817 | const { type, required, validator, skipCheck } = prop;
|
5818 | if (required && isAbsent) {
|
5819 | warn$1('Missing required prop: "' + name + '"');
|
5820 | return;
|
5821 | }
|
5822 | if (value == null && !required) {
|
5823 | return;
|
5824 | }
|
5825 | if (type != null && type !== true && !skipCheck) {
|
5826 | let isValid = false;
|
5827 | const types = isArray(type) ? type : [type];
|
5828 | const expectedTypes = [];
|
5829 | for (let i = 0; i < types.length && !isValid; i++) {
|
5830 | const { valid, expectedType } = assertType(value, types[i]);
|
5831 | expectedTypes.push(expectedType || "");
|
5832 | isValid = valid;
|
5833 | }
|
5834 | if (!isValid) {
|
5835 | warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
5836 | return;
|
5837 | }
|
5838 | }
|
5839 | if (validator && !validator(value, props)) {
|
5840 | warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
5841 | }
|
5842 | }
|
5843 | const isSimpleType = makeMap(
|
5844 | "String,Number,Boolean,Function,Symbol,BigInt"
|
5845 | );
|
5846 | function assertType(value, type) {
|
5847 | let valid;
|
5848 | const expectedType = getType(type);
|
5849 | if (isSimpleType(expectedType)) {
|
5850 | const t = typeof value;
|
5851 | valid = t === expectedType.toLowerCase();
|
5852 | if (!valid && t === "object") {
|
5853 | valid = value instanceof type;
|
5854 | }
|
5855 | } else if (expectedType === "Object") {
|
5856 | valid = isObject(value);
|
5857 | } else if (expectedType === "Array") {
|
5858 | valid = isArray(value);
|
5859 | } else if (expectedType === "null") {
|
5860 | valid = value === null;
|
5861 | } else {
|
5862 | valid = value instanceof type;
|
5863 | }
|
5864 | return {
|
5865 | valid,
|
5866 | expectedType
|
5867 | };
|
5868 | }
|
5869 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
5870 | if (expectedTypes.length === 0) {
|
5871 | return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
5872 | }
|
5873 | let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
|
5874 | const expectedType = expectedTypes[0];
|
5875 | const receivedType = toRawType(value);
|
5876 | const expectedValue = styleValue(value, expectedType);
|
5877 | const receivedValue = styleValue(value, receivedType);
|
5878 | if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
5879 | message += ` with value ${expectedValue}`;
|
5880 | }
|
5881 | message += `, got ${receivedType} `;
|
5882 | if (isExplicable(receivedType)) {
|
5883 | message += `with value ${receivedValue}.`;
|
5884 | }
|
5885 | return message;
|
5886 | }
|
5887 | function styleValue(value, type) {
|
5888 | if (type === "String") {
|
5889 | return `"${value}"`;
|
5890 | } else if (type === "Number") {
|
5891 | return `${Number(value)}`;
|
5892 | } else {
|
5893 | return `${value}`;
|
5894 | }
|
5895 | }
|
5896 | function isExplicable(type) {
|
5897 | const explicitTypes = ["string", "number", "boolean"];
|
5898 | return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
5899 | }
|
5900 | function isBoolean(...args) {
|
5901 | return args.some((elem) => elem.toLowerCase() === "boolean");
|
5902 | }
|
5903 |
|
5904 | const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
5905 | const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
5906 | const normalizeSlot = (key, rawSlot, ctx) => {
|
5907 | if (rawSlot._n) {
|
5908 | return rawSlot;
|
5909 | }
|
5910 | const normalized = withCtx((...args) => {
|
5911 | if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
5912 | warn$1(
|
5913 | `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.`
|
5914 | );
|
5915 | }
|
5916 | return normalizeSlotValue(rawSlot(...args));
|
5917 | }, ctx);
|
5918 | normalized._c = false;
|
5919 | return normalized;
|
5920 | };
|
5921 | const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
5922 | const ctx = rawSlots._ctx;
|
5923 | for (const key in rawSlots) {
|
5924 | if (isInternalKey(key))
|
5925 | continue;
|
5926 | const value = rawSlots[key];
|
5927 | if (isFunction(value)) {
|
5928 | slots[key] = normalizeSlot(key, value, ctx);
|
5929 | } else if (value != null) {
|
5930 | {
|
5931 | warn$1(
|
5932 | `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
5933 | );
|
5934 | }
|
5935 | const normalized = normalizeSlotValue(value);
|
5936 | slots[key] = () => normalized;
|
5937 | }
|
5938 | }
|
5939 | };
|
5940 | const normalizeVNodeSlots = (instance, children) => {
|
5941 | if (!isKeepAlive(instance.vnode) && true) {
|
5942 | warn$1(
|
5943 | `Non-function value encountered for default slot. Prefer function slots for better performance.`
|
5944 | );
|
5945 | }
|
5946 | const normalized = normalizeSlotValue(children);
|
5947 | instance.slots.default = () => normalized;
|
5948 | };
|
5949 | const initSlots = (instance, children) => {
|
5950 | const slots = instance.slots = createInternalObject();
|
5951 | if (instance.vnode.shapeFlag & 32) {
|
5952 | const type = children._;
|
5953 | if (type) {
|
5954 | extend(slots, children);
|
5955 | def(slots, "_", type);
|
5956 | } else {
|
5957 | normalizeObjectSlots(children, slots);
|
5958 | }
|
5959 | } else if (children) {
|
5960 | normalizeVNodeSlots(instance, children);
|
5961 | }
|
5962 | };
|
5963 | const updateSlots = (instance, children, optimized) => {
|
5964 | const { vnode, slots } = instance;
|
5965 | let needDeletionCheck = true;
|
5966 | let deletionComparisonTarget = EMPTY_OBJ;
|
5967 | if (vnode.shapeFlag & 32) {
|
5968 | const type = children._;
|
5969 | if (type) {
|
5970 | if (isHmrUpdating) {
|
5971 | extend(slots, children);
|
5972 | trigger(instance, "set", "$slots");
|
5973 | } else if (optimized && type === 1) {
|
5974 | needDeletionCheck = false;
|
5975 | } else {
|
5976 | extend(slots, children);
|
5977 | if (!optimized && type === 1) {
|
5978 | delete slots._;
|
5979 | }
|
5980 | }
|
5981 | } else {
|
5982 | needDeletionCheck = !children.$stable;
|
5983 | normalizeObjectSlots(children, slots);
|
5984 | }
|
5985 | deletionComparisonTarget = children;
|
5986 | } else if (children) {
|
5987 | normalizeVNodeSlots(instance, children);
|
5988 | deletionComparisonTarget = { default: 1 };
|
5989 | }
|
5990 | if (needDeletionCheck) {
|
5991 | for (const key in slots) {
|
5992 | if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
|
5993 | delete slots[key];
|
5994 | }
|
5995 | }
|
5996 | }
|
5997 | };
|
5998 |
|
5999 | function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
6000 | if (isArray(rawRef)) {
|
6001 | rawRef.forEach(
|
6002 | (r, i) => setRef(
|
6003 | r,
|
6004 | oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
6005 | parentSuspense,
|
6006 | vnode,
|
6007 | isUnmount
|
6008 | )
|
6009 | );
|
6010 | return;
|
6011 | }
|
6012 | if (isAsyncWrapper(vnode) && !isUnmount) {
|
6013 | return;
|
6014 | }
|
6015 | const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
|
6016 | const value = isUnmount ? null : refValue;
|
6017 | const { i: owner, r: ref } = rawRef;
|
6018 | if (!owner) {
|
6019 | warn$1(
|
6020 | `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
|
6021 | );
|
6022 | return;
|
6023 | }
|
6024 | const oldRef = oldRawRef && oldRawRef.r;
|
6025 | const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
6026 | const setupState = owner.setupState;
|
6027 | if (oldRef != null && oldRef !== ref) {
|
6028 | if (isString(oldRef)) {
|
6029 | refs[oldRef] = null;
|
6030 | if (hasOwn(setupState, oldRef)) {
|
6031 | setupState[oldRef] = null;
|
6032 | }
|
6033 | } else if (isRef(oldRef)) {
|
6034 | oldRef.value = null;
|
6035 | }
|
6036 | }
|
6037 | if (isFunction(ref)) {
|
6038 | callWithErrorHandling(ref, owner, 12, [value, refs]);
|
6039 | } else {
|
6040 | const _isString = isString(ref);
|
6041 | const _isRef = isRef(ref);
|
6042 | if (_isString || _isRef) {
|
6043 | const doSet = () => {
|
6044 | if (rawRef.f) {
|
6045 | const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
|
6046 | if (isUnmount) {
|
6047 | isArray(existing) && remove(existing, refValue);
|
6048 | } else {
|
6049 | if (!isArray(existing)) {
|
6050 | if (_isString) {
|
6051 | refs[ref] = [refValue];
|
6052 | if (hasOwn(setupState, ref)) {
|
6053 | setupState[ref] = refs[ref];
|
6054 | }
|
6055 | } else {
|
6056 | ref.value = [refValue];
|
6057 | if (rawRef.k)
|
6058 | refs[rawRef.k] = ref.value;
|
6059 | }
|
6060 | } else if (!existing.includes(refValue)) {
|
6061 | existing.push(refValue);
|
6062 | }
|
6063 | }
|
6064 | } else if (_isString) {
|
6065 | refs[ref] = value;
|
6066 | if (hasOwn(setupState, ref)) {
|
6067 | setupState[ref] = value;
|
6068 | }
|
6069 | } else if (_isRef) {
|
6070 | ref.value = value;
|
6071 | if (rawRef.k)
|
6072 | refs[rawRef.k] = value;
|
6073 | } else {
|
6074 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
6075 | }
|
6076 | };
|
6077 | if (value) {
|
6078 | doSet.id = -1;
|
6079 | queuePostRenderEffect(doSet, parentSuspense);
|
6080 | } else {
|
6081 | doSet();
|
6082 | }
|
6083 | } else {
|
6084 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
6085 | }
|
6086 | }
|
6087 | }
|
6088 |
|
6089 | let hasMismatch = false;
|
6090 | const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
6091 | const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
6092 | const getContainerType = (container) => {
|
6093 | if (isSVGContainer(container))
|
6094 | return "svg";
|
6095 | if (isMathMLContainer(container))
|
6096 | return "mathml";
|
6097 | return void 0;
|
6098 | };
|
6099 | const isComment = (node) => node.nodeType === 8 ;
|
6100 | function createHydrationFunctions(rendererInternals) {
|
6101 | const {
|
6102 | mt: mountComponent,
|
6103 | p: patch,
|
6104 | o: {
|
6105 | patchProp,
|
6106 | createText,
|
6107 | nextSibling,
|
6108 | parentNode,
|
6109 | remove,
|
6110 | insert,
|
6111 | createComment
|
6112 | }
|
6113 | } = rendererInternals;
|
6114 | const hydrate = (vnode, container) => {
|
6115 | if (!container.hasChildNodes()) {
|
6116 | warn$1(
|
6117 | `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
|
6118 | );
|
6119 | patch(null, vnode, container);
|
6120 | flushPostFlushCbs();
|
6121 | container._vnode = vnode;
|
6122 | return;
|
6123 | }
|
6124 | hasMismatch = false;
|
6125 | hydrateNode(container.firstChild, vnode, null, null, null);
|
6126 | flushPostFlushCbs();
|
6127 | container._vnode = vnode;
|
6128 | if (hasMismatch && true) {
|
6129 | console.error(`Hydration completed but contains mismatches.`);
|
6130 | }
|
6131 | };
|
6132 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
6133 | optimized = optimized || !!vnode.dynamicChildren;
|
6134 | const isFragmentStart = isComment(node) && node.data === "[";
|
6135 | const onMismatch = () => handleMismatch(
|
6136 | node,
|
6137 | vnode,
|
6138 | parentComponent,
|
6139 | parentSuspense,
|
6140 | slotScopeIds,
|
6141 | isFragmentStart
|
6142 | );
|
6143 | const { type, ref, shapeFlag, patchFlag } = vnode;
|
6144 | let domType = node.nodeType;
|
6145 | vnode.el = node;
|
6146 | {
|
6147 | if (!("__vnode" in node)) {
|
6148 | Object.defineProperty(node, "__vnode", {
|
6149 | value: vnode,
|
6150 | enumerable: false
|
6151 | });
|
6152 | }
|
6153 | if (!("__vueParentComponent" in node)) {
|
6154 | Object.defineProperty(node, "__vueParentComponent", {
|
6155 | value: parentComponent,
|
6156 | enumerable: false
|
6157 | });
|
6158 | }
|
6159 | }
|
6160 | if (patchFlag === -2) {
|
6161 | optimized = false;
|
6162 | vnode.dynamicChildren = null;
|
6163 | }
|
6164 | let nextNode = null;
|
6165 | switch (type) {
|
6166 | case Text:
|
6167 | if (domType !== 3 ) {
|
6168 | if (vnode.children === "") {
|
6169 | insert(vnode.el = createText(""), parentNode(node), node);
|
6170 | nextNode = node;
|
6171 | } else {
|
6172 | nextNode = onMismatch();
|
6173 | }
|
6174 | } else {
|
6175 | if (node.data !== vnode.children) {
|
6176 | hasMismatch = true;
|
6177 | warn$1(
|
6178 | `Hydration text mismatch in`,
|
6179 | node.parentNode,
|
6180 | `
|
6181 | - rendered on server: ${JSON.stringify(
|
6182 | node.data
|
6183 | )}
|
6184 | - expected on client: ${JSON.stringify(vnode.children)}`
|
6185 | );
|
6186 | node.data = vnode.children;
|
6187 | }
|
6188 | nextNode = nextSibling(node);
|
6189 | }
|
6190 | break;
|
6191 | case Comment:
|
6192 | if (isTemplateNode(node)) {
|
6193 | nextNode = nextSibling(node);
|
6194 | replaceNode(
|
6195 | vnode.el = node.content.firstChild,
|
6196 | node,
|
6197 | parentComponent
|
6198 | );
|
6199 | } else if (domType !== 8 || isFragmentStart) {
|
6200 | nextNode = onMismatch();
|
6201 | } else {
|
6202 | nextNode = nextSibling(node);
|
6203 | }
|
6204 | break;
|
6205 | case Static:
|
6206 | if (isFragmentStart) {
|
6207 | node = nextSibling(node);
|
6208 | domType = node.nodeType;
|
6209 | }
|
6210 | if (domType === 1 || domType === 3 ) {
|
6211 | nextNode = node;
|
6212 | const needToAdoptContent = !vnode.children.length;
|
6213 | for (let i = 0; i < vnode.staticCount; i++) {
|
6214 | if (needToAdoptContent)
|
6215 | vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
|
6216 | if (i === vnode.staticCount - 1) {
|
6217 | vnode.anchor = nextNode;
|
6218 | }
|
6219 | nextNode = nextSibling(nextNode);
|
6220 | }
|
6221 | return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
6222 | } else {
|
6223 | onMismatch();
|
6224 | }
|
6225 | break;
|
6226 | case Fragment:
|
6227 | if (!isFragmentStart) {
|
6228 | nextNode = onMismatch();
|
6229 | } else {
|
6230 | nextNode = hydrateFragment(
|
6231 | node,
|
6232 | vnode,
|
6233 | parentComponent,
|
6234 | parentSuspense,
|
6235 | slotScopeIds,
|
6236 | optimized
|
6237 | );
|
6238 | }
|
6239 | break;
|
6240 | default:
|
6241 | if (shapeFlag & 1) {
|
6242 | if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
|
6243 | nextNode = onMismatch();
|
6244 | } else {
|
6245 | nextNode = hydrateElement(
|
6246 | node,
|
6247 | vnode,
|
6248 | parentComponent,
|
6249 | parentSuspense,
|
6250 | slotScopeIds,
|
6251 | optimized
|
6252 | );
|
6253 | }
|
6254 | } else if (shapeFlag & 6) {
|
6255 | vnode.slotScopeIds = slotScopeIds;
|
6256 | const container = parentNode(node);
|
6257 | if (isFragmentStart) {
|
6258 | nextNode = locateClosingAnchor(node);
|
6259 | } else if (isComment(node) && node.data === "teleport start") {
|
6260 | nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
6261 | } else {
|
6262 | nextNode = nextSibling(node);
|
6263 | }
|
6264 | mountComponent(
|
6265 | vnode,
|
6266 | container,
|
6267 | null,
|
6268 | parentComponent,
|
6269 | parentSuspense,
|
6270 | getContainerType(container),
|
6271 | optimized
|
6272 | );
|
6273 | if (isAsyncWrapper(vnode)) {
|
6274 | let subTree;
|
6275 | if (isFragmentStart) {
|
6276 | subTree = createVNode(Fragment);
|
6277 | subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
6278 | } else {
|
6279 | subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
6280 | }
|
6281 | subTree.el = node;
|
6282 | vnode.component.subTree = subTree;
|
6283 | }
|
6284 | } else if (shapeFlag & 64) {
|
6285 | if (domType !== 8 ) {
|
6286 | nextNode = onMismatch();
|
6287 | } else {
|
6288 | nextNode = vnode.type.hydrate(
|
6289 | node,
|
6290 | vnode,
|
6291 | parentComponent,
|
6292 | parentSuspense,
|
6293 | slotScopeIds,
|
6294 | optimized,
|
6295 | rendererInternals,
|
6296 | hydrateChildren
|
6297 | );
|
6298 | }
|
6299 | } else if (shapeFlag & 128) {
|
6300 | nextNode = vnode.type.hydrate(
|
6301 | node,
|
6302 | vnode,
|
6303 | parentComponent,
|
6304 | parentSuspense,
|
6305 | getContainerType(parentNode(node)),
|
6306 | slotScopeIds,
|
6307 | optimized,
|
6308 | rendererInternals,
|
6309 | hydrateNode
|
6310 | );
|
6311 | } else {
|
6312 | warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
6313 | }
|
6314 | }
|
6315 | if (ref != null) {
|
6316 | setRef(ref, null, parentSuspense, vnode);
|
6317 | }
|
6318 | return nextNode;
|
6319 | };
|
6320 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6321 | optimized = optimized || !!vnode.dynamicChildren;
|
6322 | const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
6323 | const forcePatch = type === "input" || type === "option";
|
6324 | {
|
6325 | if (dirs) {
|
6326 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
6327 | }
|
6328 | let needCallTransitionHooks = false;
|
6329 | if (isTemplateNode(el)) {
|
6330 | needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
6331 | const content = el.content.firstChild;
|
6332 | if (needCallTransitionHooks) {
|
6333 | transition.beforeEnter(content);
|
6334 | }
|
6335 | replaceNode(content, el, parentComponent);
|
6336 | vnode.el = el = content;
|
6337 | }
|
6338 | if (shapeFlag & 16 &&
|
6339 | !(props && (props.innerHTML || props.textContent))) {
|
6340 | let next = hydrateChildren(
|
6341 | el.firstChild,
|
6342 | vnode,
|
6343 | el,
|
6344 | parentComponent,
|
6345 | parentSuspense,
|
6346 | slotScopeIds,
|
6347 | optimized
|
6348 | );
|
6349 | let hasWarned = false;
|
6350 | while (next) {
|
6351 | hasMismatch = true;
|
6352 | if (!hasWarned) {
|
6353 | warn$1(
|
6354 | `Hydration children mismatch on`,
|
6355 | el,
|
6356 | `
|
6357 | Server rendered element contains more child nodes than client vdom.`
|
6358 | );
|
6359 | hasWarned = true;
|
6360 | }
|
6361 | const cur = next;
|
6362 | next = next.nextSibling;
|
6363 | remove(cur);
|
6364 | }
|
6365 | } else if (shapeFlag & 8) {
|
6366 | if (el.textContent !== vnode.children) {
|
6367 | hasMismatch = true;
|
6368 | warn$1(
|
6369 | `Hydration text content mismatch on`,
|
6370 | el,
|
6371 | `
|
6372 | - rendered on server: ${el.textContent}
|
6373 | - expected on client: ${vnode.children}`
|
6374 | );
|
6375 | el.textContent = vnode.children;
|
6376 | }
|
6377 | }
|
6378 | if (props) {
|
6379 | {
|
6380 | for (const key in props) {
|
6381 | if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
|
6382 | hasMismatch = true;
|
6383 | }
|
6384 | if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) ||
|
6385 | key[0] === ".") {
|
6386 | patchProp(
|
6387 | el,
|
6388 | key,
|
6389 | null,
|
6390 | props[key],
|
6391 | void 0,
|
6392 | void 0,
|
6393 | parentComponent
|
6394 | );
|
6395 | }
|
6396 | }
|
6397 | }
|
6398 | }
|
6399 | let vnodeHooks;
|
6400 | if (vnodeHooks = props && props.onVnodeBeforeMount) {
|
6401 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
6402 | }
|
6403 | if (dirs) {
|
6404 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
6405 | }
|
6406 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
6407 | queueEffectWithSuspense(() => {
|
6408 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
6409 | needCallTransitionHooks && transition.enter(el);
|
6410 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
6411 | }, parentSuspense);
|
6412 | }
|
6413 | }
|
6414 | return el.nextSibling;
|
6415 | };
|
6416 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6417 | optimized = optimized || !!parentVNode.dynamicChildren;
|
6418 | const children = parentVNode.children;
|
6419 | const l = children.length;
|
6420 | let hasWarned = false;
|
6421 | for (let i = 0; i < l; i++) {
|
6422 | const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
6423 | if (node) {
|
6424 | node = hydrateNode(
|
6425 | node,
|
6426 | vnode,
|
6427 | parentComponent,
|
6428 | parentSuspense,
|
6429 | slotScopeIds,
|
6430 | optimized
|
6431 | );
|
6432 | } else if (vnode.type === Text && !vnode.children) {
|
6433 | continue;
|
6434 | } else {
|
6435 | hasMismatch = true;
|
6436 | if (!hasWarned) {
|
6437 | warn$1(
|
6438 | `Hydration children mismatch on`,
|
6439 | container,
|
6440 | `
|
6441 | Server rendered element contains fewer child nodes than client vdom.`
|
6442 | );
|
6443 | hasWarned = true;
|
6444 | }
|
6445 | patch(
|
6446 | null,
|
6447 | vnode,
|
6448 | container,
|
6449 | null,
|
6450 | parentComponent,
|
6451 | parentSuspense,
|
6452 | getContainerType(container),
|
6453 | slotScopeIds
|
6454 | );
|
6455 | }
|
6456 | }
|
6457 | return node;
|
6458 | };
|
6459 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6460 | const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
6461 | if (fragmentSlotScopeIds) {
|
6462 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
6463 | }
|
6464 | const container = parentNode(node);
|
6465 | const next = hydrateChildren(
|
6466 | nextSibling(node),
|
6467 | vnode,
|
6468 | container,
|
6469 | parentComponent,
|
6470 | parentSuspense,
|
6471 | slotScopeIds,
|
6472 | optimized
|
6473 | );
|
6474 | if (next && isComment(next) && next.data === "]") {
|
6475 | return nextSibling(vnode.anchor = next);
|
6476 | } else {
|
6477 | hasMismatch = true;
|
6478 | insert(vnode.anchor = createComment(`]`), container, next);
|
6479 | return next;
|
6480 | }
|
6481 | };
|
6482 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
6483 | hasMismatch = true;
|
6484 | warn$1(
|
6485 | `Hydration node mismatch:
|
6486 | - rendered on server:`,
|
6487 | node,
|
6488 | node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
|
6489 | `
|
6490 | - expected on client:`,
|
6491 | vnode.type
|
6492 | );
|
6493 | vnode.el = null;
|
6494 | if (isFragment) {
|
6495 | const end = locateClosingAnchor(node);
|
6496 | while (true) {
|
6497 | const next2 = nextSibling(node);
|
6498 | if (next2 && next2 !== end) {
|
6499 | remove(next2);
|
6500 | } else {
|
6501 | break;
|
6502 | }
|
6503 | }
|
6504 | }
|
6505 | const next = nextSibling(node);
|
6506 | const container = parentNode(node);
|
6507 | remove(node);
|
6508 | patch(
|
6509 | null,
|
6510 | vnode,
|
6511 | container,
|
6512 | next,
|
6513 | parentComponent,
|
6514 | parentSuspense,
|
6515 | getContainerType(container),
|
6516 | slotScopeIds
|
6517 | );
|
6518 | return next;
|
6519 | };
|
6520 | const locateClosingAnchor = (node, open = "[", close = "]") => {
|
6521 | let match = 0;
|
6522 | while (node) {
|
6523 | node = nextSibling(node);
|
6524 | if (node && isComment(node)) {
|
6525 | if (node.data === open)
|
6526 | match++;
|
6527 | if (node.data === close) {
|
6528 | if (match === 0) {
|
6529 | return nextSibling(node);
|
6530 | } else {
|
6531 | match--;
|
6532 | }
|
6533 | }
|
6534 | }
|
6535 | }
|
6536 | return node;
|
6537 | };
|
6538 | const replaceNode = (newNode, oldNode, parentComponent) => {
|
6539 | const parentNode2 = oldNode.parentNode;
|
6540 | if (parentNode2) {
|
6541 | parentNode2.replaceChild(newNode, oldNode);
|
6542 | }
|
6543 | let parent = parentComponent;
|
6544 | while (parent) {
|
6545 | if (parent.vnode.el === oldNode) {
|
6546 | parent.vnode.el = parent.subTree.el = newNode;
|
6547 | }
|
6548 | parent = parent.parent;
|
6549 | }
|
6550 | };
|
6551 | const isTemplateNode = (node) => {
|
6552 | return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
|
6553 | };
|
6554 | return [hydrate, hydrateNode];
|
6555 | }
|
6556 | function propHasMismatch(el, key, clientValue, vnode, instance) {
|
6557 | var _a;
|
6558 | let mismatchType;
|
6559 | let mismatchKey;
|
6560 | let actual;
|
6561 | let expected;
|
6562 | if (key === "class") {
|
6563 | actual = el.getAttribute("class");
|
6564 | expected = normalizeClass(clientValue);
|
6565 | if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
6566 | mismatchType = mismatchKey = `class`;
|
6567 | }
|
6568 | } else if (key === "style") {
|
6569 | actual = el.getAttribute("style");
|
6570 | expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
|
6571 | const actualMap = toStyleMap(actual);
|
6572 | const expectedMap = toStyleMap(expected);
|
6573 | if (vnode.dirs) {
|
6574 | for (const { dir, value } of vnode.dirs) {
|
6575 | if (dir.name === "show" && !value) {
|
6576 | expectedMap.set("display", "none");
|
6577 | }
|
6578 | }
|
6579 | }
|
6580 | const root = instance == null ? void 0 : instance.subTree;
|
6581 | if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
|
6582 | const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
|
6583 | for (const key2 in cssVars) {
|
6584 | expectedMap.set(`--${key2}`, String(cssVars[key2]));
|
6585 | }
|
6586 | }
|
6587 | if (!isMapEqual(actualMap, expectedMap)) {
|
6588 | mismatchType = mismatchKey = "style";
|
6589 | }
|
6590 | } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
|
6591 | if (isBooleanAttr(key)) {
|
6592 | actual = el.hasAttribute(key);
|
6593 | expected = includeBooleanAttr(clientValue);
|
6594 | } else if (clientValue == null) {
|
6595 | actual = el.hasAttribute(key);
|
6596 | expected = false;
|
6597 | } else {
|
6598 | if (el.hasAttribute(key)) {
|
6599 | actual = el.getAttribute(key);
|
6600 | } else if (key === "value" && el.tagName === "TEXTAREA") {
|
6601 | actual = el.value;
|
6602 | } else {
|
6603 | actual = false;
|
6604 | }
|
6605 | expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
|
6606 | }
|
6607 | if (actual !== expected) {
|
6608 | mismatchType = `attribute`;
|
6609 | mismatchKey = key;
|
6610 | }
|
6611 | }
|
6612 | if (mismatchType) {
|
6613 | const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
6614 | const preSegment = `Hydration ${mismatchType} mismatch on`;
|
6615 | const postSegment = `
|
6616 | - rendered on server: ${format(actual)}
|
6617 | - expected on client: ${format(expected)}
|
6618 | Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
6619 | You should fix the source of the mismatch.`;
|
6620 | {
|
6621 | warn$1(preSegment, el, postSegment);
|
6622 | }
|
6623 | return true;
|
6624 | }
|
6625 | return false;
|
6626 | }
|
6627 | function toClassSet(str) {
|
6628 | return new Set(str.trim().split(/\s+/));
|
6629 | }
|
6630 | function isSetEqual(a, b) {
|
6631 | if (a.size !== b.size) {
|
6632 | return false;
|
6633 | }
|
6634 | for (const s of a) {
|
6635 | if (!b.has(s)) {
|
6636 | return false;
|
6637 | }
|
6638 | }
|
6639 | return true;
|
6640 | }
|
6641 | function toStyleMap(str) {
|
6642 | const styleMap = new Map();
|
6643 | for (const item of str.split(";")) {
|
6644 | let [key, value] = item.split(":");
|
6645 | key = key == null ? void 0 : key.trim();
|
6646 | value = value == null ? void 0 : value.trim();
|
6647 | if (key && value) {
|
6648 | styleMap.set(key, value);
|
6649 | }
|
6650 | }
|
6651 | return styleMap;
|
6652 | }
|
6653 | function isMapEqual(a, b) {
|
6654 | if (a.size !== b.size) {
|
6655 | return false;
|
6656 | }
|
6657 | for (const [key, value] of a) {
|
6658 | if (value !== b.get(key)) {
|
6659 | return false;
|
6660 | }
|
6661 | }
|
6662 | return true;
|
6663 | }
|
6664 |
|
6665 | let supported;
|
6666 | let perf;
|
6667 | function startMeasure(instance, type) {
|
6668 | if (instance.appContext.config.performance && isSupported()) {
|
6669 | perf.mark(`vue-${type}-${instance.uid}`);
|
6670 | }
|
6671 | {
|
6672 | devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
6673 | }
|
6674 | }
|
6675 | function endMeasure(instance, type) {
|
6676 | if (instance.appContext.config.performance && isSupported()) {
|
6677 | const startTag = `vue-${type}-${instance.uid}`;
|
6678 | const endTag = startTag + `:end`;
|
6679 | perf.mark(endTag);
|
6680 | perf.measure(
|
6681 | `<${formatComponentName(instance, instance.type)}> ${type}`,
|
6682 | startTag,
|
6683 | endTag
|
6684 | );
|
6685 | perf.clearMarks(startTag);
|
6686 | perf.clearMarks(endTag);
|
6687 | }
|
6688 | {
|
6689 | devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
6690 | }
|
6691 | }
|
6692 | function isSupported() {
|
6693 | if (supported !== void 0) {
|
6694 | return supported;
|
6695 | }
|
6696 | if (typeof window !== "undefined" && window.performance) {
|
6697 | supported = true;
|
6698 | perf = window.performance;
|
6699 | } else {
|
6700 | supported = false;
|
6701 | }
|
6702 | return supported;
|
6703 | }
|
6704 |
|
6705 | const queuePostRenderEffect = queueEffectWithSuspense ;
|
6706 | function createRenderer(options) {
|
6707 | return baseCreateRenderer(options);
|
6708 | }
|
6709 | function createHydrationRenderer(options) {
|
6710 | return baseCreateRenderer(options, createHydrationFunctions);
|
6711 | }
|
6712 | function baseCreateRenderer(options, createHydrationFns) {
|
6713 | const target = getGlobalThis();
|
6714 | target.__VUE__ = true;
|
6715 | {
|
6716 | setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
6717 | }
|
6718 | const {
|
6719 | insert: hostInsert,
|
6720 | remove: hostRemove,
|
6721 | patchProp: hostPatchProp,
|
6722 | createElement: hostCreateElement,
|
6723 | createText: hostCreateText,
|
6724 | createComment: hostCreateComment,
|
6725 | setText: hostSetText,
|
6726 | setElementText: hostSetElementText,
|
6727 | parentNode: hostParentNode,
|
6728 | nextSibling: hostNextSibling,
|
6729 | setScopeId: hostSetScopeId = NOOP,
|
6730 | insertStaticContent: hostInsertStaticContent
|
6731 | } = options;
|
6732 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
6733 | if (n1 === n2) {
|
6734 | return;
|
6735 | }
|
6736 | if (n1 && !isSameVNodeType(n1, n2)) {
|
6737 | anchor = getNextHostNode(n1);
|
6738 | unmount(n1, parentComponent, parentSuspense, true);
|
6739 | n1 = null;
|
6740 | }
|
6741 | if (n2.patchFlag === -2) {
|
6742 | optimized = false;
|
6743 | n2.dynamicChildren = null;
|
6744 | }
|
6745 | const { type, ref, shapeFlag } = n2;
|
6746 | switch (type) {
|
6747 | case Text:
|
6748 | processText(n1, n2, container, anchor);
|
6749 | break;
|
6750 | case Comment:
|
6751 | processCommentNode(n1, n2, container, anchor);
|
6752 | break;
|
6753 | case Static:
|
6754 | if (n1 == null) {
|
6755 | mountStaticNode(n2, container, anchor, namespace);
|
6756 | } else {
|
6757 | patchStaticNode(n1, n2, container, namespace);
|
6758 | }
|
6759 | break;
|
6760 | case Fragment:
|
6761 | processFragment(
|
6762 | n1,
|
6763 | n2,
|
6764 | container,
|
6765 | anchor,
|
6766 | parentComponent,
|
6767 | parentSuspense,
|
6768 | namespace,
|
6769 | slotScopeIds,
|
6770 | optimized
|
6771 | );
|
6772 | break;
|
6773 | default:
|
6774 | if (shapeFlag & 1) {
|
6775 | processElement(
|
6776 | n1,
|
6777 | n2,
|
6778 | container,
|
6779 | anchor,
|
6780 | parentComponent,
|
6781 | parentSuspense,
|
6782 | namespace,
|
6783 | slotScopeIds,
|
6784 | optimized
|
6785 | );
|
6786 | } else if (shapeFlag & 6) {
|
6787 | processComponent(
|
6788 | n1,
|
6789 | n2,
|
6790 | container,
|
6791 | anchor,
|
6792 | parentComponent,
|
6793 | parentSuspense,
|
6794 | namespace,
|
6795 | slotScopeIds,
|
6796 | optimized
|
6797 | );
|
6798 | } else if (shapeFlag & 64) {
|
6799 | type.process(
|
6800 | n1,
|
6801 | n2,
|
6802 | container,
|
6803 | anchor,
|
6804 | parentComponent,
|
6805 | parentSuspense,
|
6806 | namespace,
|
6807 | slotScopeIds,
|
6808 | optimized,
|
6809 | internals
|
6810 | );
|
6811 | } else if (shapeFlag & 128) {
|
6812 | type.process(
|
6813 | n1,
|
6814 | n2,
|
6815 | container,
|
6816 | anchor,
|
6817 | parentComponent,
|
6818 | parentSuspense,
|
6819 | namespace,
|
6820 | slotScopeIds,
|
6821 | optimized,
|
6822 | internals
|
6823 | );
|
6824 | } else {
|
6825 | warn$1("Invalid VNode type:", type, `(${typeof type})`);
|
6826 | }
|
6827 | }
|
6828 | if (ref != null && parentComponent) {
|
6829 | setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
6830 | }
|
6831 | };
|
6832 | const processText = (n1, n2, container, anchor) => {
|
6833 | if (n1 == null) {
|
6834 | hostInsert(
|
6835 | n2.el = hostCreateText(n2.children),
|
6836 | container,
|
6837 | anchor
|
6838 | );
|
6839 | } else {
|
6840 | const el = n2.el = n1.el;
|
6841 | if (n2.children !== n1.children) {
|
6842 | hostSetText(el, n2.children);
|
6843 | }
|
6844 | }
|
6845 | };
|
6846 | const processCommentNode = (n1, n2, container, anchor) => {
|
6847 | if (n1 == null) {
|
6848 | hostInsert(
|
6849 | n2.el = hostCreateComment(n2.children || ""),
|
6850 | container,
|
6851 | anchor
|
6852 | );
|
6853 | } else {
|
6854 | n2.el = n1.el;
|
6855 | }
|
6856 | };
|
6857 | const mountStaticNode = (n2, container, anchor, namespace) => {
|
6858 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6859 | n2.children,
|
6860 | container,
|
6861 | anchor,
|
6862 | namespace,
|
6863 | n2.el,
|
6864 | n2.anchor
|
6865 | );
|
6866 | };
|
6867 | const patchStaticNode = (n1, n2, container, namespace) => {
|
6868 | if (n2.children !== n1.children) {
|
6869 | const anchor = hostNextSibling(n1.anchor);
|
6870 | removeStaticNode(n1);
|
6871 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6872 | n2.children,
|
6873 | container,
|
6874 | anchor,
|
6875 | namespace
|
6876 | );
|
6877 | } else {
|
6878 | n2.el = n1.el;
|
6879 | n2.anchor = n1.anchor;
|
6880 | }
|
6881 | };
|
6882 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
6883 | let next;
|
6884 | while (el && el !== anchor) {
|
6885 | next = hostNextSibling(el);
|
6886 | hostInsert(el, container, nextSibling);
|
6887 | el = next;
|
6888 | }
|
6889 | hostInsert(anchor, container, nextSibling);
|
6890 | };
|
6891 | const removeStaticNode = ({ el, anchor }) => {
|
6892 | let next;
|
6893 | while (el && el !== anchor) {
|
6894 | next = hostNextSibling(el);
|
6895 | hostRemove(el);
|
6896 | el = next;
|
6897 | }
|
6898 | hostRemove(anchor);
|
6899 | };
|
6900 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6901 | if (n2.type === "svg") {
|
6902 | namespace = "svg";
|
6903 | } else if (n2.type === "math") {
|
6904 | namespace = "mathml";
|
6905 | }
|
6906 | if (n1 == null) {
|
6907 | mountElement(
|
6908 | n2,
|
6909 | container,
|
6910 | anchor,
|
6911 | parentComponent,
|
6912 | parentSuspense,
|
6913 | namespace,
|
6914 | slotScopeIds,
|
6915 | optimized
|
6916 | );
|
6917 | } else {
|
6918 | patchElement(
|
6919 | n1,
|
6920 | n2,
|
6921 | parentComponent,
|
6922 | parentSuspense,
|
6923 | namespace,
|
6924 | slotScopeIds,
|
6925 | optimized
|
6926 | );
|
6927 | }
|
6928 | };
|
6929 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6930 | let el;
|
6931 | let vnodeHook;
|
6932 | const { props, shapeFlag, transition, dirs } = vnode;
|
6933 | el = vnode.el = hostCreateElement(
|
6934 | vnode.type,
|
6935 | namespace,
|
6936 | props && props.is,
|
6937 | props
|
6938 | );
|
6939 | if (shapeFlag & 8) {
|
6940 | hostSetElementText(el, vnode.children);
|
6941 | } else if (shapeFlag & 16) {
|
6942 | mountChildren(
|
6943 | vnode.children,
|
6944 | el,
|
6945 | null,
|
6946 | parentComponent,
|
6947 | parentSuspense,
|
6948 | resolveChildrenNamespace(vnode, namespace),
|
6949 | slotScopeIds,
|
6950 | optimized
|
6951 | );
|
6952 | }
|
6953 | if (dirs) {
|
6954 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
6955 | }
|
6956 | setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
6957 | if (props) {
|
6958 | for (const key in props) {
|
6959 | if (key !== "value" && !isReservedProp(key)) {
|
6960 | hostPatchProp(
|
6961 | el,
|
6962 | key,
|
6963 | null,
|
6964 | props[key],
|
6965 | namespace,
|
6966 | vnode.children,
|
6967 | parentComponent,
|
6968 | parentSuspense,
|
6969 | unmountChildren
|
6970 | );
|
6971 | }
|
6972 | }
|
6973 | if ("value" in props) {
|
6974 | hostPatchProp(el, "value", null, props.value, namespace);
|
6975 | }
|
6976 | if (vnodeHook = props.onVnodeBeforeMount) {
|
6977 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6978 | }
|
6979 | }
|
6980 | {
|
6981 | Object.defineProperty(el, "__vnode", {
|
6982 | value: vnode,
|
6983 | enumerable: false
|
6984 | });
|
6985 | Object.defineProperty(el, "__vueParentComponent", {
|
6986 | value: parentComponent,
|
6987 | enumerable: false
|
6988 | });
|
6989 | }
|
6990 | if (dirs) {
|
6991 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
6992 | }
|
6993 | const needCallTransitionHooks = needTransition(parentSuspense, transition);
|
6994 | if (needCallTransitionHooks) {
|
6995 | transition.beforeEnter(el);
|
6996 | }
|
6997 | hostInsert(el, container, anchor);
|
6998 | if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
6999 | queuePostRenderEffect(() => {
|
7000 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7001 | needCallTransitionHooks && transition.enter(el);
|
7002 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
7003 | }, parentSuspense);
|
7004 | }
|
7005 | };
|
7006 | const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
7007 | if (scopeId) {
|
7008 | hostSetScopeId(el, scopeId);
|
7009 | }
|
7010 | if (slotScopeIds) {
|
7011 | for (let i = 0; i < slotScopeIds.length; i++) {
|
7012 | hostSetScopeId(el, slotScopeIds[i]);
|
7013 | }
|
7014 | }
|
7015 | if (parentComponent) {
|
7016 | let subTree = parentComponent.subTree;
|
7017 | if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
7018 | subTree = filterSingleRoot(subTree.children) || subTree;
|
7019 | }
|
7020 | if (vnode === subTree) {
|
7021 | const parentVNode = parentComponent.vnode;
|
7022 | setScopeId(
|
7023 | el,
|
7024 | parentVNode,
|
7025 | parentVNode.scopeId,
|
7026 | parentVNode.slotScopeIds,
|
7027 | parentComponent.parent
|
7028 | );
|
7029 | }
|
7030 | }
|
7031 | };
|
7032 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
7033 | for (let i = start; i < children.length; i++) {
|
7034 | const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
7035 | patch(
|
7036 | null,
|
7037 | child,
|
7038 | container,
|
7039 | anchor,
|
7040 | parentComponent,
|
7041 | parentSuspense,
|
7042 | namespace,
|
7043 | slotScopeIds,
|
7044 | optimized
|
7045 | );
|
7046 | }
|
7047 | };
|
7048 | const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7049 | const el = n2.el = n1.el;
|
7050 | let { patchFlag, dynamicChildren, dirs } = n2;
|
7051 | patchFlag |= n1.patchFlag & 16;
|
7052 | const oldProps = n1.props || EMPTY_OBJ;
|
7053 | const newProps = n2.props || EMPTY_OBJ;
|
7054 | let vnodeHook;
|
7055 | parentComponent && toggleRecurse(parentComponent, false);
|
7056 | if (vnodeHook = newProps.onVnodeBeforeUpdate) {
|
7057 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7058 | }
|
7059 | if (dirs) {
|
7060 | invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
7061 | }
|
7062 | parentComponent && toggleRecurse(parentComponent, true);
|
7063 | if (isHmrUpdating) {
|
7064 | patchFlag = 0;
|
7065 | optimized = false;
|
7066 | dynamicChildren = null;
|
7067 | }
|
7068 | if (dynamicChildren) {
|
7069 | patchBlockChildren(
|
7070 | n1.dynamicChildren,
|
7071 | dynamicChildren,
|
7072 | el,
|
7073 | parentComponent,
|
7074 | parentSuspense,
|
7075 | resolveChildrenNamespace(n2, namespace),
|
7076 | slotScopeIds
|
7077 | );
|
7078 | {
|
7079 | traverseStaticChildren(n1, n2);
|
7080 | }
|
7081 | } else if (!optimized) {
|
7082 | patchChildren(
|
7083 | n1,
|
7084 | n2,
|
7085 | el,
|
7086 | null,
|
7087 | parentComponent,
|
7088 | parentSuspense,
|
7089 | resolveChildrenNamespace(n2, namespace),
|
7090 | slotScopeIds,
|
7091 | false
|
7092 | );
|
7093 | }
|
7094 | if (patchFlag > 0) {
|
7095 | if (patchFlag & 16) {
|
7096 | patchProps(
|
7097 | el,
|
7098 | n2,
|
7099 | oldProps,
|
7100 | newProps,
|
7101 | parentComponent,
|
7102 | parentSuspense,
|
7103 | namespace
|
7104 | );
|
7105 | } else {
|
7106 | if (patchFlag & 2) {
|
7107 | if (oldProps.class !== newProps.class) {
|
7108 | hostPatchProp(el, "class", null, newProps.class, namespace);
|
7109 | }
|
7110 | }
|
7111 | if (patchFlag & 4) {
|
7112 | hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
|
7113 | }
|
7114 | if (patchFlag & 8) {
|
7115 | const propsToUpdate = n2.dynamicProps;
|
7116 | for (let i = 0; i < propsToUpdate.length; i++) {
|
7117 | const key = propsToUpdate[i];
|
7118 | const prev = oldProps[key];
|
7119 | const next = newProps[key];
|
7120 | if (next !== prev || key === "value") {
|
7121 | hostPatchProp(
|
7122 | el,
|
7123 | key,
|
7124 | prev,
|
7125 | next,
|
7126 | namespace,
|
7127 | n1.children,
|
7128 | parentComponent,
|
7129 | parentSuspense,
|
7130 | unmountChildren
|
7131 | );
|
7132 | }
|
7133 | }
|
7134 | }
|
7135 | }
|
7136 | if (patchFlag & 1) {
|
7137 | if (n1.children !== n2.children) {
|
7138 | hostSetElementText(el, n2.children);
|
7139 | }
|
7140 | }
|
7141 | } else if (!optimized && dynamicChildren == null) {
|
7142 | patchProps(
|
7143 | el,
|
7144 | n2,
|
7145 | oldProps,
|
7146 | newProps,
|
7147 | parentComponent,
|
7148 | parentSuspense,
|
7149 | namespace
|
7150 | );
|
7151 | }
|
7152 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
7153 | queuePostRenderEffect(() => {
|
7154 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7155 | dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
7156 | }, parentSuspense);
|
7157 | }
|
7158 | };
|
7159 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
7160 | for (let i = 0; i < newChildren.length; i++) {
|
7161 | const oldVNode = oldChildren[i];
|
7162 | const newVNode = newChildren[i];
|
7163 | const container = (
|
7164 |
|
7165 |
|
7166 | oldVNode.el &&
|
7167 |
|
7168 | (oldVNode.type === Fragment ||
|
7169 |
|
7170 | !isSameVNodeType(oldVNode, newVNode) ||
|
7171 | oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
|
7172 |
|
7173 |
|
7174 | fallbackContainer
|
7175 | )
|
7176 | );
|
7177 | patch(
|
7178 | oldVNode,
|
7179 | newVNode,
|
7180 | container,
|
7181 | null,
|
7182 | parentComponent,
|
7183 | parentSuspense,
|
7184 | namespace,
|
7185 | slotScopeIds,
|
7186 | true
|
7187 | );
|
7188 | }
|
7189 | };
|
7190 | const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
|
7191 | if (oldProps !== newProps) {
|
7192 | if (oldProps !== EMPTY_OBJ) {
|
7193 | for (const key in oldProps) {
|
7194 | if (!isReservedProp(key) && !(key in newProps)) {
|
7195 | hostPatchProp(
|
7196 | el,
|
7197 | key,
|
7198 | oldProps[key],
|
7199 | null,
|
7200 | namespace,
|
7201 | vnode.children,
|
7202 | parentComponent,
|
7203 | parentSuspense,
|
7204 | unmountChildren
|
7205 | );
|
7206 | }
|
7207 | }
|
7208 | }
|
7209 | for (const key in newProps) {
|
7210 | if (isReservedProp(key))
|
7211 | continue;
|
7212 | const next = newProps[key];
|
7213 | const prev = oldProps[key];
|
7214 | if (next !== prev && key !== "value") {
|
7215 | hostPatchProp(
|
7216 | el,
|
7217 | key,
|
7218 | prev,
|
7219 | next,
|
7220 | namespace,
|
7221 | vnode.children,
|
7222 | parentComponent,
|
7223 | parentSuspense,
|
7224 | unmountChildren
|
7225 | );
|
7226 | }
|
7227 | }
|
7228 | if ("value" in newProps) {
|
7229 | hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
|
7230 | }
|
7231 | }
|
7232 | };
|
7233 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7234 | const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
|
7235 | const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
|
7236 | let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
7237 | if (
|
7238 |
|
7239 | isHmrUpdating || patchFlag & 2048
|
7240 | ) {
|
7241 | patchFlag = 0;
|
7242 | optimized = false;
|
7243 | dynamicChildren = null;
|
7244 | }
|
7245 | if (fragmentSlotScopeIds) {
|
7246 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
7247 | }
|
7248 | if (n1 == null) {
|
7249 | hostInsert(fragmentStartAnchor, container, anchor);
|
7250 | hostInsert(fragmentEndAnchor, container, anchor);
|
7251 | mountChildren(
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 | n2.children || [],
|
7257 | container,
|
7258 | fragmentEndAnchor,
|
7259 | parentComponent,
|
7260 | parentSuspense,
|
7261 | namespace,
|
7262 | slotScopeIds,
|
7263 | optimized
|
7264 | );
|
7265 | } else {
|
7266 | if (patchFlag > 0 && patchFlag & 64 && dynamicChildren &&
|
7267 |
|
7268 | n1.dynamicChildren) {
|
7269 | patchBlockChildren(
|
7270 | n1.dynamicChildren,
|
7271 | dynamicChildren,
|
7272 | container,
|
7273 | parentComponent,
|
7274 | parentSuspense,
|
7275 | namespace,
|
7276 | slotScopeIds
|
7277 | );
|
7278 | {
|
7279 | traverseStaticChildren(n1, n2);
|
7280 | }
|
7281 | } else {
|
7282 | patchChildren(
|
7283 | n1,
|
7284 | n2,
|
7285 | container,
|
7286 | fragmentEndAnchor,
|
7287 | parentComponent,
|
7288 | parentSuspense,
|
7289 | namespace,
|
7290 | slotScopeIds,
|
7291 | optimized
|
7292 | );
|
7293 | }
|
7294 | }
|
7295 | };
|
7296 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7297 | n2.slotScopeIds = slotScopeIds;
|
7298 | if (n1 == null) {
|
7299 | if (n2.shapeFlag & 512) {
|
7300 | parentComponent.ctx.activate(
|
7301 | n2,
|
7302 | container,
|
7303 | anchor,
|
7304 | namespace,
|
7305 | optimized
|
7306 | );
|
7307 | } else {
|
7308 | mountComponent(
|
7309 | n2,
|
7310 | container,
|
7311 | anchor,
|
7312 | parentComponent,
|
7313 | parentSuspense,
|
7314 | namespace,
|
7315 | optimized
|
7316 | );
|
7317 | }
|
7318 | } else {
|
7319 | updateComponent(n1, n2, optimized);
|
7320 | }
|
7321 | };
|
7322 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
7323 | const instance = (initialVNode.component = createComponentInstance(
|
7324 | initialVNode,
|
7325 | parentComponent,
|
7326 | parentSuspense
|
7327 | ));
|
7328 | if (instance.type.__hmrId) {
|
7329 | registerHMR(instance);
|
7330 | }
|
7331 | {
|
7332 | pushWarningContext(initialVNode);
|
7333 | startMeasure(instance, `mount`);
|
7334 | }
|
7335 | if (isKeepAlive(initialVNode)) {
|
7336 | instance.ctx.renderer = internals;
|
7337 | }
|
7338 | {
|
7339 | {
|
7340 | startMeasure(instance, `init`);
|
7341 | }
|
7342 | setupComponent(instance);
|
7343 | {
|
7344 | endMeasure(instance, `init`);
|
7345 | }
|
7346 | }
|
7347 | if (instance.asyncDep) {
|
7348 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
|
7349 | if (!initialVNode.el) {
|
7350 | const placeholder = instance.subTree = createVNode(Comment);
|
7351 | processCommentNode(null, placeholder, container, anchor);
|
7352 | }
|
7353 | } else {
|
7354 | setupRenderEffect(
|
7355 | instance,
|
7356 | initialVNode,
|
7357 | container,
|
7358 | anchor,
|
7359 | parentSuspense,
|
7360 | namespace,
|
7361 | optimized
|
7362 | );
|
7363 | }
|
7364 | {
|
7365 | popWarningContext();
|
7366 | endMeasure(instance, `mount`);
|
7367 | }
|
7368 | };
|
7369 | const updateComponent = (n1, n2, optimized) => {
|
7370 | const instance = n2.component = n1.component;
|
7371 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
7372 | if (instance.asyncDep && !instance.asyncResolved) {
|
7373 | {
|
7374 | pushWarningContext(n2);
|
7375 | }
|
7376 | updateComponentPreRender(instance, n2, optimized);
|
7377 | {
|
7378 | popWarningContext();
|
7379 | }
|
7380 | return;
|
7381 | } else {
|
7382 | instance.next = n2;
|
7383 | invalidateJob(instance.update);
|
7384 | instance.effect.dirty = true;
|
7385 | instance.update();
|
7386 | }
|
7387 | } else {
|
7388 | n2.el = n1.el;
|
7389 | instance.vnode = n2;
|
7390 | }
|
7391 | };
|
7392 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
7393 | const componentUpdateFn = () => {
|
7394 | if (!instance.isMounted) {
|
7395 | let vnodeHook;
|
7396 | const { el, props } = initialVNode;
|
7397 | const { bm, m, parent } = instance;
|
7398 | const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
7399 | toggleRecurse(instance, false);
|
7400 | if (bm) {
|
7401 | invokeArrayFns(bm);
|
7402 | }
|
7403 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
|
7404 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
7405 | }
|
7406 | toggleRecurse(instance, true);
|
7407 | if (el && hydrateNode) {
|
7408 | const hydrateSubTree = () => {
|
7409 | {
|
7410 | startMeasure(instance, `render`);
|
7411 | }
|
7412 | instance.subTree = renderComponentRoot(instance);
|
7413 | {
|
7414 | endMeasure(instance, `render`);
|
7415 | }
|
7416 | {
|
7417 | startMeasure(instance, `hydrate`);
|
7418 | }
|
7419 | hydrateNode(
|
7420 | el,
|
7421 | instance.subTree,
|
7422 | instance,
|
7423 | parentSuspense,
|
7424 | null
|
7425 | );
|
7426 | {
|
7427 | endMeasure(instance, `hydrate`);
|
7428 | }
|
7429 | };
|
7430 | if (isAsyncWrapperVNode) {
|
7431 | initialVNode.type.__asyncLoader().then(
|
7432 |
|
7433 |
|
7434 |
|
7435 |
|
7436 | () => !instance.isUnmounted && hydrateSubTree()
|
7437 | );
|
7438 | } else {
|
7439 | hydrateSubTree();
|
7440 | }
|
7441 | } else {
|
7442 | {
|
7443 | startMeasure(instance, `render`);
|
7444 | }
|
7445 | const subTree = instance.subTree = renderComponentRoot(instance);
|
7446 | {
|
7447 | endMeasure(instance, `render`);
|
7448 | }
|
7449 | {
|
7450 | startMeasure(instance, `patch`);
|
7451 | }
|
7452 | patch(
|
7453 | null,
|
7454 | subTree,
|
7455 | container,
|
7456 | anchor,
|
7457 | instance,
|
7458 | parentSuspense,
|
7459 | namespace
|
7460 | );
|
7461 | {
|
7462 | endMeasure(instance, `patch`);
|
7463 | }
|
7464 | initialVNode.el = subTree.el;
|
7465 | }
|
7466 | if (m) {
|
7467 | queuePostRenderEffect(m, parentSuspense);
|
7468 | }
|
7469 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
7470 | const scopedInitialVNode = initialVNode;
|
7471 | queuePostRenderEffect(
|
7472 | () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
7473 | parentSuspense
|
7474 | );
|
7475 | }
|
7476 | if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
7477 | instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
7478 | }
|
7479 | instance.isMounted = true;
|
7480 | {
|
7481 | devtoolsComponentAdded(instance);
|
7482 | }
|
7483 | initialVNode = container = anchor = null;
|
7484 | } else {
|
7485 | let { next, bu, u, parent, vnode } = instance;
|
7486 | {
|
7487 | const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
|
7488 | if (nonHydratedAsyncRoot) {
|
7489 | if (next) {
|
7490 | next.el = vnode.el;
|
7491 | updateComponentPreRender(instance, next, optimized);
|
7492 | }
|
7493 | nonHydratedAsyncRoot.asyncDep.then(() => {
|
7494 | if (!instance.isUnmounted) {
|
7495 | componentUpdateFn();
|
7496 | }
|
7497 | });
|
7498 | return;
|
7499 | }
|
7500 | }
|
7501 | let originNext = next;
|
7502 | let vnodeHook;
|
7503 | {
|
7504 | pushWarningContext(next || instance.vnode);
|
7505 | }
|
7506 | toggleRecurse(instance, false);
|
7507 | if (next) {
|
7508 | next.el = vnode.el;
|
7509 | updateComponentPreRender(instance, next, optimized);
|
7510 | } else {
|
7511 | next = vnode;
|
7512 | }
|
7513 | if (bu) {
|
7514 | invokeArrayFns(bu);
|
7515 | }
|
7516 | if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
|
7517 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
7518 | }
|
7519 | toggleRecurse(instance, true);
|
7520 | {
|
7521 | startMeasure(instance, `render`);
|
7522 | }
|
7523 | const nextTree = renderComponentRoot(instance);
|
7524 | {
|
7525 | endMeasure(instance, `render`);
|
7526 | }
|
7527 | const prevTree = instance.subTree;
|
7528 | instance.subTree = nextTree;
|
7529 | {
|
7530 | startMeasure(instance, `patch`);
|
7531 | }
|
7532 | patch(
|
7533 | prevTree,
|
7534 | nextTree,
|
7535 |
|
7536 | hostParentNode(prevTree.el),
|
7537 |
|
7538 | getNextHostNode(prevTree),
|
7539 | instance,
|
7540 | parentSuspense,
|
7541 | namespace
|
7542 | );
|
7543 | {
|
7544 | endMeasure(instance, `patch`);
|
7545 | }
|
7546 | next.el = nextTree.el;
|
7547 | if (originNext === null) {
|
7548 | updateHOCHostEl(instance, nextTree.el);
|
7549 | }
|
7550 | if (u) {
|
7551 | queuePostRenderEffect(u, parentSuspense);
|
7552 | }
|
7553 | if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
7554 | queuePostRenderEffect(
|
7555 | () => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
7556 | parentSuspense
|
7557 | );
|
7558 | }
|
7559 | {
|
7560 | devtoolsComponentUpdated(instance);
|
7561 | }
|
7562 | {
|
7563 | popWarningContext();
|
7564 | }
|
7565 | }
|
7566 | };
|
7567 | const effect = instance.effect = new ReactiveEffect(
|
7568 | componentUpdateFn,
|
7569 | NOOP,
|
7570 | () => queueJob(update),
|
7571 | instance.scope
|
7572 |
|
7573 | );
|
7574 | const update = instance.update = () => {
|
7575 | if (effect.dirty) {
|
7576 | effect.run();
|
7577 | }
|
7578 | };
|
7579 | update.id = instance.uid;
|
7580 | toggleRecurse(instance, true);
|
7581 | {
|
7582 | effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
7583 | effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
7584 | update.ownerInstance = instance;
|
7585 | }
|
7586 | update();
|
7587 | };
|
7588 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
7589 | nextVNode.component = instance;
|
7590 | const prevProps = instance.vnode.props;
|
7591 | instance.vnode = nextVNode;
|
7592 | instance.next = null;
|
7593 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
7594 | updateSlots(instance, nextVNode.children, optimized);
|
7595 | pauseTracking();
|
7596 | flushPreFlushCbs(instance);
|
7597 | resetTracking();
|
7598 | };
|
7599 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
7600 | const c1 = n1 && n1.children;
|
7601 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
7602 | const c2 = n2.children;
|
7603 | const { patchFlag, shapeFlag } = n2;
|
7604 | if (patchFlag > 0) {
|
7605 | if (patchFlag & 128) {
|
7606 | patchKeyedChildren(
|
7607 | c1,
|
7608 | c2,
|
7609 | container,
|
7610 | anchor,
|
7611 | parentComponent,
|
7612 | parentSuspense,
|
7613 | namespace,
|
7614 | slotScopeIds,
|
7615 | optimized
|
7616 | );
|
7617 | return;
|
7618 | } else if (patchFlag & 256) {
|
7619 | patchUnkeyedChildren(
|
7620 | c1,
|
7621 | c2,
|
7622 | container,
|
7623 | anchor,
|
7624 | parentComponent,
|
7625 | parentSuspense,
|
7626 | namespace,
|
7627 | slotScopeIds,
|
7628 | optimized
|
7629 | );
|
7630 | return;
|
7631 | }
|
7632 | }
|
7633 | if (shapeFlag & 8) {
|
7634 | if (prevShapeFlag & 16) {
|
7635 | unmountChildren(c1, parentComponent, parentSuspense);
|
7636 | }
|
7637 | if (c2 !== c1) {
|
7638 | hostSetElementText(container, c2);
|
7639 | }
|
7640 | } else {
|
7641 | if (prevShapeFlag & 16) {
|
7642 | if (shapeFlag & 16) {
|
7643 | patchKeyedChildren(
|
7644 | c1,
|
7645 | c2,
|
7646 | container,
|
7647 | anchor,
|
7648 | parentComponent,
|
7649 | parentSuspense,
|
7650 | namespace,
|
7651 | slotScopeIds,
|
7652 | optimized
|
7653 | );
|
7654 | } else {
|
7655 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
7656 | }
|
7657 | } else {
|
7658 | if (prevShapeFlag & 8) {
|
7659 | hostSetElementText(container, "");
|
7660 | }
|
7661 | if (shapeFlag & 16) {
|
7662 | mountChildren(
|
7663 | c2,
|
7664 | container,
|
7665 | anchor,
|
7666 | parentComponent,
|
7667 | parentSuspense,
|
7668 | namespace,
|
7669 | slotScopeIds,
|
7670 | optimized
|
7671 | );
|
7672 | }
|
7673 | }
|
7674 | }
|
7675 | };
|
7676 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7677 | c1 = c1 || EMPTY_ARR;
|
7678 | c2 = c2 || EMPTY_ARR;
|
7679 | const oldLength = c1.length;
|
7680 | const newLength = c2.length;
|
7681 | const commonLength = Math.min(oldLength, newLength);
|
7682 | let i;
|
7683 | for (i = 0; i < commonLength; i++) {
|
7684 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7685 | patch(
|
7686 | c1[i],
|
7687 | nextChild,
|
7688 | container,
|
7689 | null,
|
7690 | parentComponent,
|
7691 | parentSuspense,
|
7692 | namespace,
|
7693 | slotScopeIds,
|
7694 | optimized
|
7695 | );
|
7696 | }
|
7697 | if (oldLength > newLength) {
|
7698 | unmountChildren(
|
7699 | c1,
|
7700 | parentComponent,
|
7701 | parentSuspense,
|
7702 | true,
|
7703 | false,
|
7704 | commonLength
|
7705 | );
|
7706 | } else {
|
7707 | mountChildren(
|
7708 | c2,
|
7709 | container,
|
7710 | anchor,
|
7711 | parentComponent,
|
7712 | parentSuspense,
|
7713 | namespace,
|
7714 | slotScopeIds,
|
7715 | optimized,
|
7716 | commonLength
|
7717 | );
|
7718 | }
|
7719 | };
|
7720 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7721 | let i = 0;
|
7722 | const l2 = c2.length;
|
7723 | let e1 = c1.length - 1;
|
7724 | let e2 = l2 - 1;
|
7725 | while (i <= e1 && i <= e2) {
|
7726 | const n1 = c1[i];
|
7727 | const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7728 | if (isSameVNodeType(n1, n2)) {
|
7729 | patch(
|
7730 | n1,
|
7731 | n2,
|
7732 | container,
|
7733 | null,
|
7734 | parentComponent,
|
7735 | parentSuspense,
|
7736 | namespace,
|
7737 | slotScopeIds,
|
7738 | optimized
|
7739 | );
|
7740 | } else {
|
7741 | break;
|
7742 | }
|
7743 | i++;
|
7744 | }
|
7745 | while (i <= e1 && i <= e2) {
|
7746 | const n1 = c1[e1];
|
7747 | const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
|
7748 | if (isSameVNodeType(n1, n2)) {
|
7749 | patch(
|
7750 | n1,
|
7751 | n2,
|
7752 | container,
|
7753 | null,
|
7754 | parentComponent,
|
7755 | parentSuspense,
|
7756 | namespace,
|
7757 | slotScopeIds,
|
7758 | optimized
|
7759 | );
|
7760 | } else {
|
7761 | break;
|
7762 | }
|
7763 | e1--;
|
7764 | e2--;
|
7765 | }
|
7766 | if (i > e1) {
|
7767 | if (i <= e2) {
|
7768 | const nextPos = e2 + 1;
|
7769 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
7770 | while (i <= e2) {
|
7771 | patch(
|
7772 | null,
|
7773 | c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
|
7774 | container,
|
7775 | anchor,
|
7776 | parentComponent,
|
7777 | parentSuspense,
|
7778 | namespace,
|
7779 | slotScopeIds,
|
7780 | optimized
|
7781 | );
|
7782 | i++;
|
7783 | }
|
7784 | }
|
7785 | } else if (i > e2) {
|
7786 | while (i <= e1) {
|
7787 | unmount(c1[i], parentComponent, parentSuspense, true);
|
7788 | i++;
|
7789 | }
|
7790 | } else {
|
7791 | const s1 = i;
|
7792 | const s2 = i;
|
7793 | const keyToNewIndexMap = new Map();
|
7794 | for (i = s2; i <= e2; i++) {
|
7795 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7796 | if (nextChild.key != null) {
|
7797 | if (keyToNewIndexMap.has(nextChild.key)) {
|
7798 | warn$1(
|
7799 | `Duplicate keys found during update:`,
|
7800 | JSON.stringify(nextChild.key),
|
7801 | `Make sure keys are unique.`
|
7802 | );
|
7803 | }
|
7804 | keyToNewIndexMap.set(nextChild.key, i);
|
7805 | }
|
7806 | }
|
7807 | let j;
|
7808 | let patched = 0;
|
7809 | const toBePatched = e2 - s2 + 1;
|
7810 | let moved = false;
|
7811 | let maxNewIndexSoFar = 0;
|
7812 | const newIndexToOldIndexMap = new Array(toBePatched);
|
7813 | for (i = 0; i < toBePatched; i++)
|
7814 | newIndexToOldIndexMap[i] = 0;
|
7815 | for (i = s1; i <= e1; i++) {
|
7816 | const prevChild = c1[i];
|
7817 | if (patched >= toBePatched) {
|
7818 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7819 | continue;
|
7820 | }
|
7821 | let newIndex;
|
7822 | if (prevChild.key != null) {
|
7823 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
7824 | } else {
|
7825 | for (j = s2; j <= e2; j++) {
|
7826 | if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
|
7827 | newIndex = j;
|
7828 | break;
|
7829 | }
|
7830 | }
|
7831 | }
|
7832 | if (newIndex === void 0) {
|
7833 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7834 | } else {
|
7835 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
7836 | if (newIndex >= maxNewIndexSoFar) {
|
7837 | maxNewIndexSoFar = newIndex;
|
7838 | } else {
|
7839 | moved = true;
|
7840 | }
|
7841 | patch(
|
7842 | prevChild,
|
7843 | c2[newIndex],
|
7844 | container,
|
7845 | null,
|
7846 | parentComponent,
|
7847 | parentSuspense,
|
7848 | namespace,
|
7849 | slotScopeIds,
|
7850 | optimized
|
7851 | );
|
7852 | patched++;
|
7853 | }
|
7854 | }
|
7855 | const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
|
7856 | j = increasingNewIndexSequence.length - 1;
|
7857 | for (i = toBePatched - 1; i >= 0; i--) {
|
7858 | const nextIndex = s2 + i;
|
7859 | const nextChild = c2[nextIndex];
|
7860 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
7861 | if (newIndexToOldIndexMap[i] === 0) {
|
7862 | patch(
|
7863 | null,
|
7864 | nextChild,
|
7865 | container,
|
7866 | anchor,
|
7867 | parentComponent,
|
7868 | parentSuspense,
|
7869 | namespace,
|
7870 | slotScopeIds,
|
7871 | optimized
|
7872 | );
|
7873 | } else if (moved) {
|
7874 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
7875 | move(nextChild, container, anchor, 2);
|
7876 | } else {
|
7877 | j--;
|
7878 | }
|
7879 | }
|
7880 | }
|
7881 | }
|
7882 | };
|
7883 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
7884 | const { el, type, transition, children, shapeFlag } = vnode;
|
7885 | if (shapeFlag & 6) {
|
7886 | move(vnode.component.subTree, container, anchor, moveType);
|
7887 | return;
|
7888 | }
|
7889 | if (shapeFlag & 128) {
|
7890 | vnode.suspense.move(container, anchor, moveType);
|
7891 | return;
|
7892 | }
|
7893 | if (shapeFlag & 64) {
|
7894 | type.move(vnode, container, anchor, internals);
|
7895 | return;
|
7896 | }
|
7897 | if (type === Fragment) {
|
7898 | hostInsert(el, container, anchor);
|
7899 | for (let i = 0; i < children.length; i++) {
|
7900 | move(children[i], container, anchor, moveType);
|
7901 | }
|
7902 | hostInsert(vnode.anchor, container, anchor);
|
7903 | return;
|
7904 | }
|
7905 | if (type === Static) {
|
7906 | moveStaticNode(vnode, container, anchor);
|
7907 | return;
|
7908 | }
|
7909 | const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
|
7910 | if (needTransition2) {
|
7911 | if (moveType === 0) {
|
7912 | transition.beforeEnter(el);
|
7913 | hostInsert(el, container, anchor);
|
7914 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
7915 | } else {
|
7916 | const { leave, delayLeave, afterLeave } = transition;
|
7917 | const remove2 = () => hostInsert(el, container, anchor);
|
7918 | const performLeave = () => {
|
7919 | leave(el, () => {
|
7920 | remove2();
|
7921 | afterLeave && afterLeave();
|
7922 | });
|
7923 | };
|
7924 | if (delayLeave) {
|
7925 | delayLeave(el, remove2, performLeave);
|
7926 | } else {
|
7927 | performLeave();
|
7928 | }
|
7929 | }
|
7930 | } else {
|
7931 | hostInsert(el, container, anchor);
|
7932 | }
|
7933 | };
|
7934 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
7935 | const {
|
7936 | type,
|
7937 | props,
|
7938 | ref,
|
7939 | children,
|
7940 | dynamicChildren,
|
7941 | shapeFlag,
|
7942 | patchFlag,
|
7943 | dirs
|
7944 | } = vnode;
|
7945 | if (ref != null) {
|
7946 | setRef(ref, null, parentSuspense, vnode, true);
|
7947 | }
|
7948 | if (shapeFlag & 256) {
|
7949 | parentComponent.ctx.deactivate(vnode);
|
7950 | return;
|
7951 | }
|
7952 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
7953 | const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
7954 | let vnodeHook;
|
7955 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
7956 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7957 | }
|
7958 | if (shapeFlag & 6) {
|
7959 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
7960 | } else {
|
7961 | if (shapeFlag & 128) {
|
7962 | vnode.suspense.unmount(parentSuspense, doRemove);
|
7963 | return;
|
7964 | }
|
7965 | if (shouldInvokeDirs) {
|
7966 | invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
7967 | }
|
7968 | if (shapeFlag & 64) {
|
7969 | vnode.type.remove(
|
7970 | vnode,
|
7971 | parentComponent,
|
7972 | parentSuspense,
|
7973 | optimized,
|
7974 | internals,
|
7975 | doRemove
|
7976 | );
|
7977 | } else if (dynamicChildren &&
|
7978 | (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
7979 | unmountChildren(
|
7980 | dynamicChildren,
|
7981 | parentComponent,
|
7982 | parentSuspense,
|
7983 | false,
|
7984 | true
|
7985 | );
|
7986 | } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
7987 | unmountChildren(children, parentComponent, parentSuspense);
|
7988 | }
|
7989 | if (doRemove) {
|
7990 | remove(vnode);
|
7991 | }
|
7992 | }
|
7993 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
7994 | queuePostRenderEffect(() => {
|
7995 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7996 | shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
7997 | }, parentSuspense);
|
7998 | }
|
7999 | };
|
8000 | const remove = (vnode) => {
|
8001 | const { type, el, anchor, transition } = vnode;
|
8002 | if (type === Fragment) {
|
8003 | if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
|
8004 | vnode.children.forEach((child) => {
|
8005 | if (child.type === Comment) {
|
8006 | hostRemove(child.el);
|
8007 | } else {
|
8008 | remove(child);
|
8009 | }
|
8010 | });
|
8011 | } else {
|
8012 | removeFragment(el, anchor);
|
8013 | }
|
8014 | return;
|
8015 | }
|
8016 | if (type === Static) {
|
8017 | removeStaticNode(vnode);
|
8018 | return;
|
8019 | }
|
8020 | const performRemove = () => {
|
8021 | hostRemove(el);
|
8022 | if (transition && !transition.persisted && transition.afterLeave) {
|
8023 | transition.afterLeave();
|
8024 | }
|
8025 | };
|
8026 | if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
|
8027 | const { leave, delayLeave } = transition;
|
8028 | const performLeave = () => leave(el, performRemove);
|
8029 | if (delayLeave) {
|
8030 | delayLeave(vnode.el, performRemove, performLeave);
|
8031 | } else {
|
8032 | performLeave();
|
8033 | }
|
8034 | } else {
|
8035 | performRemove();
|
8036 | }
|
8037 | };
|
8038 | const removeFragment = (cur, end) => {
|
8039 | let next;
|
8040 | while (cur !== end) {
|
8041 | next = hostNextSibling(cur);
|
8042 | hostRemove(cur);
|
8043 | cur = next;
|
8044 | }
|
8045 | hostRemove(end);
|
8046 | };
|
8047 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
8048 | if (instance.type.__hmrId) {
|
8049 | unregisterHMR(instance);
|
8050 | }
|
8051 | const { bum, scope, update, subTree, um } = instance;
|
8052 | if (bum) {
|
8053 | invokeArrayFns(bum);
|
8054 | }
|
8055 | scope.stop();
|
8056 | if (update) {
|
8057 | update.active = false;
|
8058 | unmount(subTree, instance, parentSuspense, doRemove);
|
8059 | }
|
8060 | if (um) {
|
8061 | queuePostRenderEffect(um, parentSuspense);
|
8062 | }
|
8063 | queuePostRenderEffect(() => {
|
8064 | instance.isUnmounted = true;
|
8065 | }, parentSuspense);
|
8066 | if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
8067 | parentSuspense.deps--;
|
8068 | if (parentSuspense.deps === 0) {
|
8069 | parentSuspense.resolve();
|
8070 | }
|
8071 | }
|
8072 | {
|
8073 | devtoolsComponentRemoved(instance);
|
8074 | }
|
8075 | };
|
8076 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
8077 | for (let i = start; i < children.length; i++) {
|
8078 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
8079 | }
|
8080 | };
|
8081 | const getNextHostNode = (vnode) => {
|
8082 | if (vnode.shapeFlag & 6) {
|
8083 | return getNextHostNode(vnode.component.subTree);
|
8084 | }
|
8085 | if (vnode.shapeFlag & 128) {
|
8086 | return vnode.suspense.next();
|
8087 | }
|
8088 | return hostNextSibling(vnode.anchor || vnode.el);
|
8089 | };
|
8090 | let isFlushing = false;
|
8091 | const render = (vnode, container, namespace) => {
|
8092 | if (vnode == null) {
|
8093 | if (container._vnode) {
|
8094 | unmount(container._vnode, null, null, true);
|
8095 | }
|
8096 | } else {
|
8097 | patch(
|
8098 | container._vnode || null,
|
8099 | vnode,
|
8100 | container,
|
8101 | null,
|
8102 | null,
|
8103 | null,
|
8104 | namespace
|
8105 | );
|
8106 | }
|
8107 | if (!isFlushing) {
|
8108 | isFlushing = true;
|
8109 | flushPreFlushCbs();
|
8110 | flushPostFlushCbs();
|
8111 | isFlushing = false;
|
8112 | }
|
8113 | container._vnode = vnode;
|
8114 | };
|
8115 | const internals = {
|
8116 | p: patch,
|
8117 | um: unmount,
|
8118 | m: move,
|
8119 | r: remove,
|
8120 | mt: mountComponent,
|
8121 | mc: mountChildren,
|
8122 | pc: patchChildren,
|
8123 | pbc: patchBlockChildren,
|
8124 | n: getNextHostNode,
|
8125 | o: options
|
8126 | };
|
8127 | let hydrate;
|
8128 | let hydrateNode;
|
8129 | if (createHydrationFns) {
|
8130 | [hydrate, hydrateNode] = createHydrationFns(
|
8131 | internals
|
8132 | );
|
8133 | }
|
8134 | return {
|
8135 | render,
|
8136 | hydrate,
|
8137 | createApp: createAppAPI(render, hydrate)
|
8138 | };
|
8139 | }
|
8140 | function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
8141 | return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
8142 | }
|
8143 | function toggleRecurse({ effect, update }, allowed) {
|
8144 | effect.allowRecurse = update.allowRecurse = allowed;
|
8145 | }
|
8146 | function needTransition(parentSuspense, transition) {
|
8147 | return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
8148 | }
|
8149 | function traverseStaticChildren(n1, n2, shallow = false) {
|
8150 | const ch1 = n1.children;
|
8151 | const ch2 = n2.children;
|
8152 | if (isArray(ch1) && isArray(ch2)) {
|
8153 | for (let i = 0; i < ch1.length; i++) {
|
8154 | const c1 = ch1[i];
|
8155 | let c2 = ch2[i];
|
8156 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
8157 | if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
|
8158 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
8159 | c2.el = c1.el;
|
8160 | }
|
8161 | if (!shallow)
|
8162 | traverseStaticChildren(c1, c2);
|
8163 | }
|
8164 | if (c2.type === Text) {
|
8165 | c2.el = c1.el;
|
8166 | }
|
8167 | if (c2.type === Comment && !c2.el) {
|
8168 | c2.el = c1.el;
|
8169 | }
|
8170 | }
|
8171 | }
|
8172 | }
|
8173 | function getSequence(arr) {
|
8174 | const p = arr.slice();
|
8175 | const result = [0];
|
8176 | let i, j, u, v, c;
|
8177 | const len = arr.length;
|
8178 | for (i = 0; i < len; i++) {
|
8179 | const arrI = arr[i];
|
8180 | if (arrI !== 0) {
|
8181 | j = result[result.length - 1];
|
8182 | if (arr[j] < arrI) {
|
8183 | p[i] = j;
|
8184 | result.push(i);
|
8185 | continue;
|
8186 | }
|
8187 | u = 0;
|
8188 | v = result.length - 1;
|
8189 | while (u < v) {
|
8190 | c = u + v >> 1;
|
8191 | if (arr[result[c]] < arrI) {
|
8192 | u = c + 1;
|
8193 | } else {
|
8194 | v = c;
|
8195 | }
|
8196 | }
|
8197 | if (arrI < arr[result[u]]) {
|
8198 | if (u > 0) {
|
8199 | p[i] = result[u - 1];
|
8200 | }
|
8201 | result[u] = i;
|
8202 | }
|
8203 | }
|
8204 | }
|
8205 | u = result.length;
|
8206 | v = result[u - 1];
|
8207 | while (u-- > 0) {
|
8208 | result[u] = v;
|
8209 | v = p[v];
|
8210 | }
|
8211 | return result;
|
8212 | }
|
8213 | function locateNonHydratedAsyncRoot(instance) {
|
8214 | const subComponent = instance.subTree.component;
|
8215 | if (subComponent) {
|
8216 | if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
8217 | return subComponent;
|
8218 | } else {
|
8219 | return locateNonHydratedAsyncRoot(subComponent);
|
8220 | }
|
8221 | }
|
8222 | }
|
8223 |
|
8224 | const isTeleport = (type) => type.__isTeleport;
|
8225 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
8226 | const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
8227 | const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
8228 | const resolveTarget = (props, select) => {
|
8229 | const targetSelector = props && props.to;
|
8230 | if (isString(targetSelector)) {
|
8231 | if (!select) {
|
8232 | warn$1(
|
8233 | `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
|
8234 | );
|
8235 | return null;
|
8236 | } else {
|
8237 | const target = select(targetSelector);
|
8238 | if (!target) {
|
8239 | warn$1(
|
8240 | `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.`
|
8241 | );
|
8242 | }
|
8243 | return target;
|
8244 | }
|
8245 | } else {
|
8246 | if (!targetSelector && !isTeleportDisabled(props)) {
|
8247 | warn$1(`Invalid Teleport target: ${targetSelector}`);
|
8248 | }
|
8249 | return targetSelector;
|
8250 | }
|
8251 | };
|
8252 | const TeleportImpl = {
|
8253 | name: "Teleport",
|
8254 | __isTeleport: true,
|
8255 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
8256 | const {
|
8257 | mc: mountChildren,
|
8258 | pc: patchChildren,
|
8259 | pbc: patchBlockChildren,
|
8260 | o: { insert, querySelector, createText, createComment }
|
8261 | } = internals;
|
8262 | const disabled = isTeleportDisabled(n2.props);
|
8263 | let { shapeFlag, children, dynamicChildren } = n2;
|
8264 | if (isHmrUpdating) {
|
8265 | optimized = false;
|
8266 | dynamicChildren = null;
|
8267 | }
|
8268 | if (n1 == null) {
|
8269 | const placeholder = n2.el = createComment("teleport start") ;
|
8270 | const mainAnchor = n2.anchor = createComment("teleport end") ;
|
8271 | insert(placeholder, container, anchor);
|
8272 | insert(mainAnchor, container, anchor);
|
8273 | const target = n2.target = resolveTarget(n2.props, querySelector);
|
8274 | const targetAnchor = n2.targetAnchor = createText("");
|
8275 | if (target) {
|
8276 | insert(targetAnchor, target);
|
8277 | if (namespace === "svg" || isTargetSVG(target)) {
|
8278 | namespace = "svg";
|
8279 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
8280 | namespace = "mathml";
|
8281 | }
|
8282 | } else if (!disabled) {
|
8283 | warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
8284 | }
|
8285 | const mount = (container2, anchor2) => {
|
8286 | if (shapeFlag & 16) {
|
8287 | mountChildren(
|
8288 | children,
|
8289 | container2,
|
8290 | anchor2,
|
8291 | parentComponent,
|
8292 | parentSuspense,
|
8293 | namespace,
|
8294 | slotScopeIds,
|
8295 | optimized
|
8296 | );
|
8297 | }
|
8298 | };
|
8299 | if (disabled) {
|
8300 | mount(container, mainAnchor);
|
8301 | } else if (target) {
|
8302 | mount(target, targetAnchor);
|
8303 | }
|
8304 | } else {
|
8305 | n2.el = n1.el;
|
8306 | const mainAnchor = n2.anchor = n1.anchor;
|
8307 | const target = n2.target = n1.target;
|
8308 | const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
8309 | const wasDisabled = isTeleportDisabled(n1.props);
|
8310 | const currentContainer = wasDisabled ? container : target;
|
8311 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
8312 | if (namespace === "svg" || isTargetSVG(target)) {
|
8313 | namespace = "svg";
|
8314 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
8315 | namespace = "mathml";
|
8316 | }
|
8317 | if (dynamicChildren) {
|
8318 | patchBlockChildren(
|
8319 | n1.dynamicChildren,
|
8320 | dynamicChildren,
|
8321 | currentContainer,
|
8322 | parentComponent,
|
8323 | parentSuspense,
|
8324 | namespace,
|
8325 | slotScopeIds
|
8326 | );
|
8327 | traverseStaticChildren(n1, n2, true);
|
8328 | } else if (!optimized) {
|
8329 | patchChildren(
|
8330 | n1,
|
8331 | n2,
|
8332 | currentContainer,
|
8333 | currentAnchor,
|
8334 | parentComponent,
|
8335 | parentSuspense,
|
8336 | namespace,
|
8337 | slotScopeIds,
|
8338 | false
|
8339 | );
|
8340 | }
|
8341 | if (disabled) {
|
8342 | if (!wasDisabled) {
|
8343 | moveTeleport(
|
8344 | n2,
|
8345 | container,
|
8346 | mainAnchor,
|
8347 | internals,
|
8348 | 1
|
8349 | );
|
8350 | } else {
|
8351 | if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
8352 | n2.props.to = n1.props.to;
|
8353 | }
|
8354 | }
|
8355 | } else {
|
8356 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
8357 | const nextTarget = n2.target = resolveTarget(
|
8358 | n2.props,
|
8359 | querySelector
|
8360 | );
|
8361 | if (nextTarget) {
|
8362 | moveTeleport(
|
8363 | n2,
|
8364 | nextTarget,
|
8365 | null,
|
8366 | internals,
|
8367 | 0
|
8368 | );
|
8369 | } else {
|
8370 | warn$1(
|
8371 | "Invalid Teleport target on update:",
|
8372 | target,
|
8373 | `(${typeof target})`
|
8374 | );
|
8375 | }
|
8376 | } else if (wasDisabled) {
|
8377 | moveTeleport(
|
8378 | n2,
|
8379 | target,
|
8380 | targetAnchor,
|
8381 | internals,
|
8382 | 1
|
8383 | );
|
8384 | }
|
8385 | }
|
8386 | }
|
8387 | updateCssVars(n2);
|
8388 | },
|
8389 | remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
8390 | const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
8391 | if (target) {
|
8392 | hostRemove(targetAnchor);
|
8393 | }
|
8394 | doRemove && hostRemove(anchor);
|
8395 | if (shapeFlag & 16) {
|
8396 | const shouldRemove = doRemove || !isTeleportDisabled(props);
|
8397 | for (let i = 0; i < children.length; i++) {
|
8398 | const child = children[i];
|
8399 | unmount(
|
8400 | child,
|
8401 | parentComponent,
|
8402 | parentSuspense,
|
8403 | shouldRemove,
|
8404 | !!child.dynamicChildren
|
8405 | );
|
8406 | }
|
8407 | }
|
8408 | },
|
8409 | move: moveTeleport,
|
8410 | hydrate: hydrateTeleport
|
8411 | };
|
8412 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
8413 | if (moveType === 0) {
|
8414 | insert(vnode.targetAnchor, container, parentAnchor);
|
8415 | }
|
8416 | const { el, anchor, shapeFlag, children, props } = vnode;
|
8417 | const isReorder = moveType === 2;
|
8418 | if (isReorder) {
|
8419 | insert(el, container, parentAnchor);
|
8420 | }
|
8421 | if (!isReorder || isTeleportDisabled(props)) {
|
8422 | if (shapeFlag & 16) {
|
8423 | for (let i = 0; i < children.length; i++) {
|
8424 | move(
|
8425 | children[i],
|
8426 | container,
|
8427 | parentAnchor,
|
8428 | 2
|
8429 | );
|
8430 | }
|
8431 | }
|
8432 | }
|
8433 | if (isReorder) {
|
8434 | insert(anchor, container, parentAnchor);
|
8435 | }
|
8436 | }
|
8437 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
8438 | o: { nextSibling, parentNode, querySelector }
|
8439 | }, hydrateChildren) {
|
8440 | const target = vnode.target = resolveTarget(
|
8441 | vnode.props,
|
8442 | querySelector
|
8443 | );
|
8444 | if (target) {
|
8445 | const targetNode = target._lpa || target.firstChild;
|
8446 | if (vnode.shapeFlag & 16) {
|
8447 | if (isTeleportDisabled(vnode.props)) {
|
8448 | vnode.anchor = hydrateChildren(
|
8449 | nextSibling(node),
|
8450 | vnode,
|
8451 | parentNode(node),
|
8452 | parentComponent,
|
8453 | parentSuspense,
|
8454 | slotScopeIds,
|
8455 | optimized
|
8456 | );
|
8457 | vnode.targetAnchor = targetNode;
|
8458 | } else {
|
8459 | vnode.anchor = nextSibling(node);
|
8460 | let targetAnchor = targetNode;
|
8461 | while (targetAnchor) {
|
8462 | targetAnchor = nextSibling(targetAnchor);
|
8463 | if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
|
8464 | vnode.targetAnchor = targetAnchor;
|
8465 | target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
8466 | break;
|
8467 | }
|
8468 | }
|
8469 | hydrateChildren(
|
8470 | targetNode,
|
8471 | vnode,
|
8472 | target,
|
8473 | parentComponent,
|
8474 | parentSuspense,
|
8475 | slotScopeIds,
|
8476 | optimized
|
8477 | );
|
8478 | }
|
8479 | }
|
8480 | updateCssVars(vnode);
|
8481 | }
|
8482 | return vnode.anchor && nextSibling(vnode.anchor);
|
8483 | }
|
8484 | const Teleport = TeleportImpl;
|
8485 | function updateCssVars(vnode) {
|
8486 | const ctx = vnode.ctx;
|
8487 | if (ctx && ctx.ut) {
|
8488 | let node = vnode.children[0].el;
|
8489 | while (node && node !== vnode.targetAnchor) {
|
8490 | if (node.nodeType === 1)
|
8491 | node.setAttribute("data-v-owner", ctx.uid);
|
8492 | node = node.nextSibling;
|
8493 | }
|
8494 | ctx.ut();
|
8495 | }
|
8496 | }
|
8497 |
|
8498 | const Fragment = Symbol.for("v-fgt");
|
8499 | const Text = Symbol.for("v-txt");
|
8500 | const Comment = Symbol.for("v-cmt");
|
8501 | const Static = Symbol.for("v-stc");
|
8502 | const blockStack = [];
|
8503 | let currentBlock = null;
|
8504 | function openBlock(disableTracking = false) {
|
8505 | blockStack.push(currentBlock = disableTracking ? null : []);
|
8506 | }
|
8507 | function closeBlock() {
|
8508 | blockStack.pop();
|
8509 | currentBlock = blockStack[blockStack.length - 1] || null;
|
8510 | }
|
8511 | let isBlockTreeEnabled = 1;
|
8512 | function setBlockTracking(value) {
|
8513 | isBlockTreeEnabled += value;
|
8514 | }
|
8515 | function setupBlock(vnode) {
|
8516 | vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
|
8517 | closeBlock();
|
8518 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
8519 | currentBlock.push(vnode);
|
8520 | }
|
8521 | return vnode;
|
8522 | }
|
8523 | function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
|
8524 | return setupBlock(
|
8525 | createBaseVNode(
|
8526 | type,
|
8527 | props,
|
8528 | children,
|
8529 | patchFlag,
|
8530 | dynamicProps,
|
8531 | shapeFlag,
|
8532 | true
|
8533 | )
|
8534 | );
|
8535 | }
|
8536 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
8537 | return setupBlock(
|
8538 | createVNode(
|
8539 | type,
|
8540 | props,
|
8541 | children,
|
8542 | patchFlag,
|
8543 | dynamicProps,
|
8544 | true
|
8545 | )
|
8546 | );
|
8547 | }
|
8548 | function isVNode(value) {
|
8549 | return value ? value.__v_isVNode === true : false;
|
8550 | }
|
8551 | function isSameVNodeType(n1, n2) {
|
8552 | if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
|
8553 | n1.shapeFlag &= ~256;
|
8554 | n2.shapeFlag &= ~512;
|
8555 | return false;
|
8556 | }
|
8557 | return n1.type === n2.type && n1.key === n2.key;
|
8558 | }
|
8559 | let vnodeArgsTransformer;
|
8560 | function transformVNodeArgs(transformer) {
|
8561 | vnodeArgsTransformer = transformer;
|
8562 | }
|
8563 | const createVNodeWithArgsTransform = (...args) => {
|
8564 | return _createVNode(
|
8565 | ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
|
8566 | );
|
8567 | };
|
8568 | const normalizeKey = ({ key }) => key != null ? key : null;
|
8569 | const normalizeRef = ({
|
8570 | ref,
|
8571 | ref_key,
|
8572 | ref_for
|
8573 | }) => {
|
8574 | if (typeof ref === "number") {
|
8575 | ref = "" + ref;
|
8576 | }
|
8577 | return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
8578 | };
|
8579 | function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
8580 | const vnode = {
|
8581 | __v_isVNode: true,
|
8582 | __v_skip: true,
|
8583 | type,
|
8584 | props,
|
8585 | key: props && normalizeKey(props),
|
8586 | ref: props && normalizeRef(props),
|
8587 | scopeId: currentScopeId,
|
8588 | slotScopeIds: null,
|
8589 | children,
|
8590 | component: null,
|
8591 | suspense: null,
|
8592 | ssContent: null,
|
8593 | ssFallback: null,
|
8594 | dirs: null,
|
8595 | transition: null,
|
8596 | el: null,
|
8597 | anchor: null,
|
8598 | target: null,
|
8599 | targetAnchor: null,
|
8600 | staticCount: 0,
|
8601 | shapeFlag,
|
8602 | patchFlag,
|
8603 | dynamicProps,
|
8604 | dynamicChildren: null,
|
8605 | appContext: null,
|
8606 | ctx: currentRenderingInstance
|
8607 | };
|
8608 | if (needFullChildrenNormalization) {
|
8609 | normalizeChildren(vnode, children);
|
8610 | if (shapeFlag & 128) {
|
8611 | type.normalize(vnode);
|
8612 | }
|
8613 | } else if (children) {
|
8614 | vnode.shapeFlag |= isString(children) ? 8 : 16;
|
8615 | }
|
8616 | if (vnode.key !== vnode.key) {
|
8617 | warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
8618 | }
|
8619 | if (isBlockTreeEnabled > 0 &&
|
8620 | !isBlockNode &&
|
8621 | currentBlock &&
|
8622 |
|
8623 |
|
8624 |
|
8625 | (vnode.patchFlag > 0 || shapeFlag & 6) &&
|
8626 |
|
8627 | vnode.patchFlag !== 32) {
|
8628 | currentBlock.push(vnode);
|
8629 | }
|
8630 | return vnode;
|
8631 | }
|
8632 | const createVNode = createVNodeWithArgsTransform ;
|
8633 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
8634 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
8635 | if (!type) {
|
8636 | warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
8637 | }
|
8638 | type = Comment;
|
8639 | }
|
8640 | if (isVNode(type)) {
|
8641 | const cloned = cloneVNode(
|
8642 | type,
|
8643 | props,
|
8644 | true
|
8645 |
|
8646 | );
|
8647 | if (children) {
|
8648 | normalizeChildren(cloned, children);
|
8649 | }
|
8650 | if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
8651 | if (cloned.shapeFlag & 6) {
|
8652 | currentBlock[currentBlock.indexOf(type)] = cloned;
|
8653 | } else {
|
8654 | currentBlock.push(cloned);
|
8655 | }
|
8656 | }
|
8657 | cloned.patchFlag |= -2;
|
8658 | return cloned;
|
8659 | }
|
8660 | if (isClassComponent(type)) {
|
8661 | type = type.__vccOpts;
|
8662 | }
|
8663 | if (props) {
|
8664 | props = guardReactiveProps(props);
|
8665 | let { class: klass, style } = props;
|
8666 | if (klass && !isString(klass)) {
|
8667 | props.class = normalizeClass(klass);
|
8668 | }
|
8669 | if (isObject(style)) {
|
8670 | if (isProxy(style) && !isArray(style)) {
|
8671 | style = extend({}, style);
|
8672 | }
|
8673 | props.style = normalizeStyle(style);
|
8674 | }
|
8675 | }
|
8676 | const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
8677 | if (shapeFlag & 4 && isProxy(type)) {
|
8678 | type = toRaw(type);
|
8679 | warn$1(
|
8680 | `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\`.`,
|
8681 | `
|
8682 | Component that was made reactive: `,
|
8683 | type
|
8684 | );
|
8685 | }
|
8686 | return createBaseVNode(
|
8687 | type,
|
8688 | props,
|
8689 | children,
|
8690 | patchFlag,
|
8691 | dynamicProps,
|
8692 | shapeFlag,
|
8693 | isBlockNode,
|
8694 | true
|
8695 | );
|
8696 | }
|
8697 | function guardReactiveProps(props) {
|
8698 | if (!props)
|
8699 | return null;
|
8700 | return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
8701 | }
|
8702 | function cloneVNode(vnode, extraProps, mergeRef = false) {
|
8703 | const { props, ref, patchFlag, children } = vnode;
|
8704 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
8705 | const cloned = {
|
8706 | __v_isVNode: true,
|
8707 | __v_skip: true,
|
8708 | type: vnode.type,
|
8709 | props: mergedProps,
|
8710 | key: mergedProps && normalizeKey(mergedProps),
|
8711 | ref: extraProps && extraProps.ref ? (
|
8712 |
|
8713 |
|
8714 |
|
8715 | mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
8716 | ) : ref,
|
8717 | scopeId: vnode.scopeId,
|
8718 | slotScopeIds: vnode.slotScopeIds,
|
8719 | children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
8720 | target: vnode.target,
|
8721 | targetAnchor: vnode.targetAnchor,
|
8722 | staticCount: vnode.staticCount,
|
8723 | shapeFlag: vnode.shapeFlag,
|
8724 |
|
8725 |
|
8726 |
|
8727 |
|
8728 | patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
8729 | dynamicProps: vnode.dynamicProps,
|
8730 | dynamicChildren: vnode.dynamicChildren,
|
8731 | appContext: vnode.appContext,
|
8732 | dirs: vnode.dirs,
|
8733 | transition: vnode.transition,
|
8734 |
|
8735 |
|
8736 |
|
8737 |
|
8738 | component: vnode.component,
|
8739 | suspense: vnode.suspense,
|
8740 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
8741 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
8742 | el: vnode.el,
|
8743 | anchor: vnode.anchor,
|
8744 | ctx: vnode.ctx,
|
8745 | ce: vnode.ce
|
8746 | };
|
8747 | return cloned;
|
8748 | }
|
8749 | function deepCloneVNode(vnode) {
|
8750 | const cloned = cloneVNode(vnode);
|
8751 | if (isArray(vnode.children)) {
|
8752 | cloned.children = vnode.children.map(deepCloneVNode);
|
8753 | }
|
8754 | return cloned;
|
8755 | }
|
8756 | function createTextVNode(text = " ", flag = 0) {
|
8757 | return createVNode(Text, null, text, flag);
|
8758 | }
|
8759 | function createStaticVNode(content, numberOfNodes) {
|
8760 | const vnode = createVNode(Static, null, content);
|
8761 | vnode.staticCount = numberOfNodes;
|
8762 | return vnode;
|
8763 | }
|
8764 | function createCommentVNode(text = "", asBlock = false) {
|
8765 | return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
|
8766 | }
|
8767 | function normalizeVNode(child) {
|
8768 | if (child == null || typeof child === "boolean") {
|
8769 | return createVNode(Comment);
|
8770 | } else if (isArray(child)) {
|
8771 | return createVNode(
|
8772 | Fragment,
|
8773 | null,
|
8774 |
|
8775 | child.slice()
|
8776 | );
|
8777 | } else if (typeof child === "object") {
|
8778 | return cloneIfMounted(child);
|
8779 | } else {
|
8780 | return createVNode(Text, null, String(child));
|
8781 | }
|
8782 | }
|
8783 | function cloneIfMounted(child) {
|
8784 | return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
8785 | }
|
8786 | function normalizeChildren(vnode, children) {
|
8787 | let type = 0;
|
8788 | const { shapeFlag } = vnode;
|
8789 | if (children == null) {
|
8790 | children = null;
|
8791 | } else if (isArray(children)) {
|
8792 | type = 16;
|
8793 | } else if (typeof children === "object") {
|
8794 | if (shapeFlag & (1 | 64)) {
|
8795 | const slot = children.default;
|
8796 | if (slot) {
|
8797 | slot._c && (slot._d = false);
|
8798 | normalizeChildren(vnode, slot());
|
8799 | slot._c && (slot._d = true);
|
8800 | }
|
8801 | return;
|
8802 | } else {
|
8803 | type = 32;
|
8804 | const slotFlag = children._;
|
8805 | if (!slotFlag && !isInternalObject(children)) {
|
8806 | children._ctx = currentRenderingInstance;
|
8807 | } else if (slotFlag === 3 && currentRenderingInstance) {
|
8808 | if (currentRenderingInstance.slots._ === 1) {
|
8809 | children._ = 1;
|
8810 | } else {
|
8811 | children._ = 2;
|
8812 | vnode.patchFlag |= 1024;
|
8813 | }
|
8814 | }
|
8815 | }
|
8816 | } else if (isFunction(children)) {
|
8817 | children = { default: children, _ctx: currentRenderingInstance };
|
8818 | type = 32;
|
8819 | } else {
|
8820 | children = String(children);
|
8821 | if (shapeFlag & 64) {
|
8822 | type = 16;
|
8823 | children = [createTextVNode(children)];
|
8824 | } else {
|
8825 | type = 8;
|
8826 | }
|
8827 | }
|
8828 | vnode.children = children;
|
8829 | vnode.shapeFlag |= type;
|
8830 | }
|
8831 | function mergeProps(...args) {
|
8832 | const ret = {};
|
8833 | for (let i = 0; i < args.length; i++) {
|
8834 | const toMerge = args[i];
|
8835 | for (const key in toMerge) {
|
8836 | if (key === "class") {
|
8837 | if (ret.class !== toMerge.class) {
|
8838 | ret.class = normalizeClass([ret.class, toMerge.class]);
|
8839 | }
|
8840 | } else if (key === "style") {
|
8841 | ret.style = normalizeStyle([ret.style, toMerge.style]);
|
8842 | } else if (isOn(key)) {
|
8843 | const existing = ret[key];
|
8844 | const incoming = toMerge[key];
|
8845 | if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
8846 | ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
8847 | }
|
8848 | } else if (key !== "") {
|
8849 | ret[key] = toMerge[key];
|
8850 | }
|
8851 | }
|
8852 | }
|
8853 | return ret;
|
8854 | }
|
8855 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
8856 | callWithAsyncErrorHandling(hook, instance, 7, [
|
8857 | vnode,
|
8858 | prevVNode
|
8859 | ]);
|
8860 | }
|
8861 |
|
8862 | const emptyAppContext = createAppContext();
|
8863 | let uid = 0;
|
8864 | function createComponentInstance(vnode, parent, suspense) {
|
8865 | const type = vnode.type;
|
8866 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
8867 | const instance = {
|
8868 | uid: uid++,
|
8869 | vnode,
|
8870 | type,
|
8871 | parent,
|
8872 | appContext,
|
8873 | root: null,
|
8874 |
|
8875 | next: null,
|
8876 | subTree: null,
|
8877 |
|
8878 | effect: null,
|
8879 | update: null,
|
8880 |
|
8881 | scope: new EffectScope(
|
8882 | true
|
8883 |
|
8884 | ),
|
8885 | render: null,
|
8886 | proxy: null,
|
8887 | exposed: null,
|
8888 | exposeProxy: null,
|
8889 | withProxy: null,
|
8890 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
8891 | accessCache: null,
|
8892 | renderCache: [],
|
8893 |
|
8894 | components: null,
|
8895 | directives: null,
|
8896 |
|
8897 | propsOptions: normalizePropsOptions(type, appContext),
|
8898 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
8899 |
|
8900 | emit: null,
|
8901 |
|
8902 | emitted: null,
|
8903 |
|
8904 | propsDefaults: EMPTY_OBJ,
|
8905 |
|
8906 | inheritAttrs: type.inheritAttrs,
|
8907 |
|
8908 | ctx: EMPTY_OBJ,
|
8909 | data: EMPTY_OBJ,
|
8910 | props: EMPTY_OBJ,
|
8911 | attrs: EMPTY_OBJ,
|
8912 | slots: EMPTY_OBJ,
|
8913 | refs: EMPTY_OBJ,
|
8914 | setupState: EMPTY_OBJ,
|
8915 | setupContext: null,
|
8916 | attrsProxy: null,
|
8917 | slotsProxy: null,
|
8918 |
|
8919 | suspense,
|
8920 | suspenseId: suspense ? suspense.pendingId : 0,
|
8921 | asyncDep: null,
|
8922 | asyncResolved: false,
|
8923 |
|
8924 |
|
8925 | isMounted: false,
|
8926 | isUnmounted: false,
|
8927 | isDeactivated: false,
|
8928 | bc: null,
|
8929 | c: null,
|
8930 | bm: null,
|
8931 | m: null,
|
8932 | bu: null,
|
8933 | u: null,
|
8934 | um: null,
|
8935 | bum: null,
|
8936 | da: null,
|
8937 | a: null,
|
8938 | rtg: null,
|
8939 | rtc: null,
|
8940 | ec: null,
|
8941 | sp: null
|
8942 | };
|
8943 | {
|
8944 | instance.ctx = createDevRenderContext(instance);
|
8945 | }
|
8946 | instance.root = parent ? parent.root : instance;
|
8947 | instance.emit = emit.bind(null, instance);
|
8948 | if (vnode.ce) {
|
8949 | vnode.ce(instance);
|
8950 | }
|
8951 | return instance;
|
8952 | }
|
8953 | let currentInstance = null;
|
8954 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
8955 | let internalSetCurrentInstance;
|
8956 | let setInSSRSetupState;
|
8957 | {
|
8958 | internalSetCurrentInstance = (i) => {
|
8959 | currentInstance = i;
|
8960 | };
|
8961 | setInSSRSetupState = (v) => {
|
8962 | isInSSRComponentSetup = v;
|
8963 | };
|
8964 | }
|
8965 | const setCurrentInstance = (instance) => {
|
8966 | const prev = currentInstance;
|
8967 | internalSetCurrentInstance(instance);
|
8968 | instance.scope.on();
|
8969 | return () => {
|
8970 | instance.scope.off();
|
8971 | internalSetCurrentInstance(prev);
|
8972 | };
|
8973 | };
|
8974 | const unsetCurrentInstance = () => {
|
8975 | currentInstance && currentInstance.scope.off();
|
8976 | internalSetCurrentInstance(null);
|
8977 | };
|
8978 | const isBuiltInTag = makeMap("slot,component");
|
8979 | function validateComponentName(name, { isNativeTag }) {
|
8980 | if (isBuiltInTag(name) || isNativeTag(name)) {
|
8981 | warn$1(
|
8982 | "Do not use built-in or reserved HTML elements as component id: " + name
|
8983 | );
|
8984 | }
|
8985 | }
|
8986 | function isStatefulComponent(instance) {
|
8987 | return instance.vnode.shapeFlag & 4;
|
8988 | }
|
8989 | let isInSSRComponentSetup = false;
|
8990 | function setupComponent(instance, isSSR = false) {
|
8991 | isSSR && setInSSRSetupState(isSSR);
|
8992 | const { props, children } = instance.vnode;
|
8993 | const isStateful = isStatefulComponent(instance);
|
8994 | initProps(instance, props, isStateful, isSSR);
|
8995 | initSlots(instance, children);
|
8996 | const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
8997 | isSSR && setInSSRSetupState(false);
|
8998 | return setupResult;
|
8999 | }
|
9000 | function setupStatefulComponent(instance, isSSR) {
|
9001 | var _a;
|
9002 | const Component = instance.type;
|
9003 | {
|
9004 | if (Component.name) {
|
9005 | validateComponentName(Component.name, instance.appContext.config);
|
9006 | }
|
9007 | if (Component.components) {
|
9008 | const names = Object.keys(Component.components);
|
9009 | for (let i = 0; i < names.length; i++) {
|
9010 | validateComponentName(names[i], instance.appContext.config);
|
9011 | }
|
9012 | }
|
9013 | if (Component.directives) {
|
9014 | const names = Object.keys(Component.directives);
|
9015 | for (let i = 0; i < names.length; i++) {
|
9016 | validateDirectiveName(names[i]);
|
9017 | }
|
9018 | }
|
9019 | if (Component.compilerOptions && isRuntimeOnly()) {
|
9020 | warn$1(
|
9021 | `"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.`
|
9022 | );
|
9023 | }
|
9024 | }
|
9025 | instance.accessCache = Object.create(null);
|
9026 | instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
9027 | {
|
9028 | exposePropsOnRenderContext(instance);
|
9029 | }
|
9030 | const { setup } = Component;
|
9031 | if (setup) {
|
9032 | const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
9033 | const reset = setCurrentInstance(instance);
|
9034 | pauseTracking();
|
9035 | const setupResult = callWithErrorHandling(
|
9036 | setup,
|
9037 | instance,
|
9038 | 0,
|
9039 | [
|
9040 | shallowReadonly(instance.props) ,
|
9041 | setupContext
|
9042 | ]
|
9043 | );
|
9044 | resetTracking();
|
9045 | reset();
|
9046 | if (isPromise(setupResult)) {
|
9047 | setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
9048 | if (isSSR) {
|
9049 | return setupResult.then((resolvedResult) => {
|
9050 | handleSetupResult(instance, resolvedResult, isSSR);
|
9051 | }).catch((e) => {
|
9052 | handleError(e, instance, 0);
|
9053 | });
|
9054 | } else {
|
9055 | instance.asyncDep = setupResult;
|
9056 | if (!instance.suspense) {
|
9057 | const name = (_a = Component.name) != null ? _a : "Anonymous";
|
9058 | warn$1(
|
9059 | `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.`
|
9060 | );
|
9061 | }
|
9062 | }
|
9063 | } else {
|
9064 | handleSetupResult(instance, setupResult, isSSR);
|
9065 | }
|
9066 | } else {
|
9067 | finishComponentSetup(instance, isSSR);
|
9068 | }
|
9069 | }
|
9070 | function handleSetupResult(instance, setupResult, isSSR) {
|
9071 | if (isFunction(setupResult)) {
|
9072 | {
|
9073 | instance.render = setupResult;
|
9074 | }
|
9075 | } else if (isObject(setupResult)) {
|
9076 | if (isVNode(setupResult)) {
|
9077 | warn$1(
|
9078 | `setup() should not return VNodes directly - return a render function instead.`
|
9079 | );
|
9080 | }
|
9081 | {
|
9082 | instance.devtoolsRawSetupState = setupResult;
|
9083 | }
|
9084 | instance.setupState = proxyRefs(setupResult);
|
9085 | {
|
9086 | exposeSetupStateOnRenderContext(instance);
|
9087 | }
|
9088 | } else if (setupResult !== void 0) {
|
9089 | warn$1(
|
9090 | `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
|
9091 | );
|
9092 | }
|
9093 | finishComponentSetup(instance, isSSR);
|
9094 | }
|
9095 | let compile$1;
|
9096 | let installWithProxy;
|
9097 | function registerRuntimeCompiler(_compile) {
|
9098 | compile$1 = _compile;
|
9099 | installWithProxy = (i) => {
|
9100 | if (i.render._rc) {
|
9101 | i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
9102 | }
|
9103 | };
|
9104 | }
|
9105 | const isRuntimeOnly = () => !compile$1;
|
9106 | function finishComponentSetup(instance, isSSR, skipOptions) {
|
9107 | const Component = instance.type;
|
9108 | if (!instance.render) {
|
9109 | if (!isSSR && compile$1 && !Component.render) {
|
9110 | const template = Component.template || resolveMergedOptions(instance).template;
|
9111 | if (template) {
|
9112 | {
|
9113 | startMeasure(instance, `compile`);
|
9114 | }
|
9115 | const { isCustomElement, compilerOptions } = instance.appContext.config;
|
9116 | const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
9117 | const finalCompilerOptions = extend(
|
9118 | extend(
|
9119 | {
|
9120 | isCustomElement,
|
9121 | delimiters
|
9122 | },
|
9123 | compilerOptions
|
9124 | ),
|
9125 | componentCompilerOptions
|
9126 | );
|
9127 | Component.render = compile$1(template, finalCompilerOptions);
|
9128 | {
|
9129 | endMeasure(instance, `compile`);
|
9130 | }
|
9131 | }
|
9132 | }
|
9133 | instance.render = Component.render || NOOP;
|
9134 | if (installWithProxy) {
|
9135 | installWithProxy(instance);
|
9136 | }
|
9137 | }
|
9138 | {
|
9139 | const reset = setCurrentInstance(instance);
|
9140 | pauseTracking();
|
9141 | try {
|
9142 | applyOptions(instance);
|
9143 | } finally {
|
9144 | resetTracking();
|
9145 | reset();
|
9146 | }
|
9147 | }
|
9148 | if (!Component.render && instance.render === NOOP && !isSSR) {
|
9149 | if (!compile$1 && Component.template) {
|
9150 | warn$1(
|
9151 | `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
9152 | );
|
9153 | } else {
|
9154 | warn$1(`Component is missing template or render function.`);
|
9155 | }
|
9156 | }
|
9157 | }
|
9158 | const attrsProxyHandlers = {
|
9159 | get(target, key) {
|
9160 | markAttrsAccessed();
|
9161 | track(target, "get", "");
|
9162 | return target[key];
|
9163 | },
|
9164 | set() {
|
9165 | warn$1(`setupContext.attrs is readonly.`);
|
9166 | return false;
|
9167 | },
|
9168 | deleteProperty() {
|
9169 | warn$1(`setupContext.attrs is readonly.`);
|
9170 | return false;
|
9171 | }
|
9172 | } ;
|
9173 | function getSlotsProxy(instance) {
|
9174 | return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
9175 | get(target, key) {
|
9176 | track(instance, "get", "$slots");
|
9177 | return target[key];
|
9178 | }
|
9179 | }));
|
9180 | }
|
9181 | function createSetupContext(instance) {
|
9182 | const expose = (exposed) => {
|
9183 | {
|
9184 | if (instance.exposed) {
|
9185 | warn$1(`expose() should be called only once per setup().`);
|
9186 | }
|
9187 | if (exposed != null) {
|
9188 | let exposedType = typeof exposed;
|
9189 | if (exposedType === "object") {
|
9190 | if (isArray(exposed)) {
|
9191 | exposedType = "array";
|
9192 | } else if (isRef(exposed)) {
|
9193 | exposedType = "ref";
|
9194 | }
|
9195 | }
|
9196 | if (exposedType !== "object") {
|
9197 | warn$1(
|
9198 | `expose() should be passed a plain object, received ${exposedType}.`
|
9199 | );
|
9200 | }
|
9201 | }
|
9202 | }
|
9203 | instance.exposed = exposed || {};
|
9204 | };
|
9205 | {
|
9206 | let attrsProxy;
|
9207 | return Object.freeze({
|
9208 | get attrs() {
|
9209 | return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
|
9210 | },
|
9211 | get slots() {
|
9212 | return getSlotsProxy(instance);
|
9213 | },
|
9214 | get emit() {
|
9215 | return (event, ...args) => instance.emit(event, ...args);
|
9216 | },
|
9217 | expose
|
9218 | });
|
9219 | }
|
9220 | }
|
9221 | function getExposeProxy(instance) {
|
9222 | if (instance.exposed) {
|
9223 | return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
9224 | get(target, key) {
|
9225 | if (key in target) {
|
9226 | return target[key];
|
9227 | } else if (key in publicPropertiesMap) {
|
9228 | return publicPropertiesMap[key](instance);
|
9229 | }
|
9230 | },
|
9231 | has(target, key) {
|
9232 | return key in target || key in publicPropertiesMap;
|
9233 | }
|
9234 | }));
|
9235 | }
|
9236 | }
|
9237 | const classifyRE = /(?:^|[-_])(\w)/g;
|
9238 | const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
9239 | function getComponentName(Component, includeInferred = true) {
|
9240 | return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
9241 | }
|
9242 | function formatComponentName(instance, Component, isRoot = false) {
|
9243 | let name = getComponentName(Component);
|
9244 | if (!name && Component.__file) {
|
9245 | const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
9246 | if (match) {
|
9247 | name = match[1];
|
9248 | }
|
9249 | }
|
9250 | if (!name && instance && instance.parent) {
|
9251 | const inferFromRegistry = (registry) => {
|
9252 | for (const key in registry) {
|
9253 | if (registry[key] === Component) {
|
9254 | return key;
|
9255 | }
|
9256 | }
|
9257 | };
|
9258 | name = inferFromRegistry(
|
9259 | instance.components || instance.parent.type.components
|
9260 | ) || inferFromRegistry(instance.appContext.components);
|
9261 | }
|
9262 | return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
9263 | }
|
9264 | function isClassComponent(value) {
|
9265 | return isFunction(value) && "__vccOpts" in value;
|
9266 | }
|
9267 |
|
9268 | const computed = (getterOrOptions, debugOptions) => {
|
9269 | const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
9270 | {
|
9271 | const i = getCurrentInstance();
|
9272 | if (i && i.appContext.config.warnRecursiveComputed) {
|
9273 | c._warnRecursive = true;
|
9274 | }
|
9275 | }
|
9276 | return c;
|
9277 | };
|
9278 |
|
9279 | function useModel(props, name, options = EMPTY_OBJ) {
|
9280 | const i = getCurrentInstance();
|
9281 | if (!i) {
|
9282 | warn$1(`useModel() called without active instance.`);
|
9283 | return ref();
|
9284 | }
|
9285 | if (!i.propsOptions[0][name]) {
|
9286 | warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
9287 | return ref();
|
9288 | }
|
9289 | const camelizedName = camelize(name);
|
9290 | const hyphenatedName = hyphenate(name);
|
9291 | const res = customRef((track, trigger) => {
|
9292 | let localValue;
|
9293 | watchSyncEffect(() => {
|
9294 | const propValue = props[name];
|
9295 | if (hasChanged(localValue, propValue)) {
|
9296 | localValue = propValue;
|
9297 | trigger();
|
9298 | }
|
9299 | });
|
9300 | return {
|
9301 | get() {
|
9302 | track();
|
9303 | return options.get ? options.get(localValue) : localValue;
|
9304 | },
|
9305 | set(value) {
|
9306 | const rawProps = i.vnode.props;
|
9307 | if (!(rawProps &&
|
9308 | (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
|
9309 | localValue = value;
|
9310 | trigger();
|
9311 | }
|
9312 | i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
9313 | }
|
9314 | };
|
9315 | });
|
9316 | const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
9317 | res[Symbol.iterator] = () => {
|
9318 | let i2 = 0;
|
9319 | return {
|
9320 | next() {
|
9321 | if (i2 < 2) {
|
9322 | return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
9323 | } else {
|
9324 | return { done: true };
|
9325 | }
|
9326 | }
|
9327 | };
|
9328 | };
|
9329 | return res;
|
9330 | }
|
9331 |
|
9332 | function h(type, propsOrChildren, children) {
|
9333 | const l = arguments.length;
|
9334 | if (l === 2) {
|
9335 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
9336 | if (isVNode(propsOrChildren)) {
|
9337 | return createVNode(type, null, [propsOrChildren]);
|
9338 | }
|
9339 | return createVNode(type, propsOrChildren);
|
9340 | } else {
|
9341 | return createVNode(type, null, propsOrChildren);
|
9342 | }
|
9343 | } else {
|
9344 | if (l > 3) {
|
9345 | children = Array.prototype.slice.call(arguments, 2);
|
9346 | } else if (l === 3 && isVNode(children)) {
|
9347 | children = [children];
|
9348 | }
|
9349 | return createVNode(type, propsOrChildren, children);
|
9350 | }
|
9351 | }
|
9352 |
|
9353 | function initCustomFormatter() {
|
9354 | if (typeof window === "undefined") {
|
9355 | return;
|
9356 | }
|
9357 | const vueStyle = { style: "color:#3ba776" };
|
9358 | const numberStyle = { style: "color:#1677ff" };
|
9359 | const stringStyle = { style: "color:#f5222d" };
|
9360 | const keywordStyle = { style: "color:#eb2f96" };
|
9361 | const formatter = {
|
9362 | header(obj) {
|
9363 | if (!isObject(obj)) {
|
9364 | return null;
|
9365 | }
|
9366 | if (obj.__isVue) {
|
9367 | return ["div", vueStyle, `VueInstance`];
|
9368 | } else if (isRef(obj)) {
|
9369 | return [
|
9370 | "div",
|
9371 | {},
|
9372 | ["span", vueStyle, genRefFlag(obj)],
|
9373 | "<",
|
9374 | formatValue(obj.value),
|
9375 | `>`
|
9376 | ];
|
9377 | } else if (isReactive(obj)) {
|
9378 | return [
|
9379 | "div",
|
9380 | {},
|
9381 | ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
9382 | "<",
|
9383 | formatValue(obj),
|
9384 | `>${isReadonly(obj) ? ` (readonly)` : ``}`
|
9385 | ];
|
9386 | } else if (isReadonly(obj)) {
|
9387 | return [
|
9388 | "div",
|
9389 | {},
|
9390 | ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
9391 | "<",
|
9392 | formatValue(obj),
|
9393 | ">"
|
9394 | ];
|
9395 | }
|
9396 | return null;
|
9397 | },
|
9398 | hasBody(obj) {
|
9399 | return obj && obj.__isVue;
|
9400 | },
|
9401 | body(obj) {
|
9402 | if (obj && obj.__isVue) {
|
9403 | return [
|
9404 | "div",
|
9405 | {},
|
9406 | ...formatInstance(obj.$)
|
9407 | ];
|
9408 | }
|
9409 | }
|
9410 | };
|
9411 | function formatInstance(instance) {
|
9412 | const blocks = [];
|
9413 | if (instance.type.props && instance.props) {
|
9414 | blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
9415 | }
|
9416 | if (instance.setupState !== EMPTY_OBJ) {
|
9417 | blocks.push(createInstanceBlock("setup", instance.setupState));
|
9418 | }
|
9419 | if (instance.data !== EMPTY_OBJ) {
|
9420 | blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
9421 | }
|
9422 | const computed = extractKeys(instance, "computed");
|
9423 | if (computed) {
|
9424 | blocks.push(createInstanceBlock("computed", computed));
|
9425 | }
|
9426 | const injected = extractKeys(instance, "inject");
|
9427 | if (injected) {
|
9428 | blocks.push(createInstanceBlock("injected", injected));
|
9429 | }
|
9430 | blocks.push([
|
9431 | "div",
|
9432 | {},
|
9433 | [
|
9434 | "span",
|
9435 | {
|
9436 | style: keywordStyle.style + ";opacity:0.66"
|
9437 | },
|
9438 | "$ (internal): "
|
9439 | ],
|
9440 | ["object", { object: instance }]
|
9441 | ]);
|
9442 | return blocks;
|
9443 | }
|
9444 | function createInstanceBlock(type, target) {
|
9445 | target = extend({}, target);
|
9446 | if (!Object.keys(target).length) {
|
9447 | return ["span", {}];
|
9448 | }
|
9449 | return [
|
9450 | "div",
|
9451 | { style: "line-height:1.25em;margin-bottom:0.6em" },
|
9452 | [
|
9453 | "div",
|
9454 | {
|
9455 | style: "color:#476582"
|
9456 | },
|
9457 | type
|
9458 | ],
|
9459 | [
|
9460 | "div",
|
9461 | {
|
9462 | style: "padding-left:1.25em"
|
9463 | },
|
9464 | ...Object.keys(target).map((key) => {
|
9465 | return [
|
9466 | "div",
|
9467 | {},
|
9468 | ["span", keywordStyle, key + ": "],
|
9469 | formatValue(target[key], false)
|
9470 | ];
|
9471 | })
|
9472 | ]
|
9473 | ];
|
9474 | }
|
9475 | function formatValue(v, asRaw = true) {
|
9476 | if (typeof v === "number") {
|
9477 | return ["span", numberStyle, v];
|
9478 | } else if (typeof v === "string") {
|
9479 | return ["span", stringStyle, JSON.stringify(v)];
|
9480 | } else if (typeof v === "boolean") {
|
9481 | return ["span", keywordStyle, v];
|
9482 | } else if (isObject(v)) {
|
9483 | return ["object", { object: asRaw ? toRaw(v) : v }];
|
9484 | } else {
|
9485 | return ["span", stringStyle, String(v)];
|
9486 | }
|
9487 | }
|
9488 | function extractKeys(instance, type) {
|
9489 | const Comp = instance.type;
|
9490 | if (isFunction(Comp)) {
|
9491 | return;
|
9492 | }
|
9493 | const extracted = {};
|
9494 | for (const key in instance.ctx) {
|
9495 | if (isKeyOfType(Comp, key, type)) {
|
9496 | extracted[key] = instance.ctx[key];
|
9497 | }
|
9498 | }
|
9499 | return extracted;
|
9500 | }
|
9501 | function isKeyOfType(Comp, key, type) {
|
9502 | const opts = Comp[type];
|
9503 | if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
9504 | return true;
|
9505 | }
|
9506 | if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
9507 | return true;
|
9508 | }
|
9509 | if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
9510 | return true;
|
9511 | }
|
9512 | }
|
9513 | function genRefFlag(v) {
|
9514 | if (isShallow(v)) {
|
9515 | return `ShallowRef`;
|
9516 | }
|
9517 | if (v.effect) {
|
9518 | return `ComputedRef`;
|
9519 | }
|
9520 | return `Ref`;
|
9521 | }
|
9522 | if (window.devtoolsFormatters) {
|
9523 | window.devtoolsFormatters.push(formatter);
|
9524 | } else {
|
9525 | window.devtoolsFormatters = [formatter];
|
9526 | }
|
9527 | }
|
9528 |
|
9529 | function withMemo(memo, render, cache, index) {
|
9530 | const cached = cache[index];
|
9531 | if (cached && isMemoSame(cached, memo)) {
|
9532 | return cached;
|
9533 | }
|
9534 | const ret = render();
|
9535 | ret.memo = memo.slice();
|
9536 | return cache[index] = ret;
|
9537 | }
|
9538 | function isMemoSame(cached, memo) {
|
9539 | const prev = cached.memo;
|
9540 | if (prev.length != memo.length) {
|
9541 | return false;
|
9542 | }
|
9543 | for (let i = 0; i < prev.length; i++) {
|
9544 | if (hasChanged(prev[i], memo[i])) {
|
9545 | return false;
|
9546 | }
|
9547 | }
|
9548 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
9549 | currentBlock.push(cached);
|
9550 | }
|
9551 | return true;
|
9552 | }
|
9553 |
|
9554 | const version = "3.4.25";
|
9555 | const warn = warn$1 ;
|
9556 | const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
9557 | const devtools = devtools$1 ;
|
9558 | const setDevtoolsHook = setDevtoolsHook$1 ;
|
9559 | const ssrUtils = null;
|
9560 | const resolveFilter = null;
|
9561 | const compatUtils = null;
|
9562 | const DeprecationTypes = null;
|
9563 |
|
9564 | const svgNS = "http://www.w3.org/2000/svg";
|
9565 | const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
9566 | const doc = typeof document !== "undefined" ? document : null;
|
9567 | const templateContainer = doc && doc.createElement("template");
|
9568 | const nodeOps = {
|
9569 | insert: (child, parent, anchor) => {
|
9570 | parent.insertBefore(child, anchor || null);
|
9571 | },
|
9572 | remove: (child) => {
|
9573 | const parent = child.parentNode;
|
9574 | if (parent) {
|
9575 | parent.removeChild(child);
|
9576 | }
|
9577 | },
|
9578 | createElement: (tag, namespace, is, props) => {
|
9579 | const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
|
9580 | if (tag === "select" && props && props.multiple != null) {
|
9581 | el.setAttribute("multiple", props.multiple);
|
9582 | }
|
9583 | return el;
|
9584 | },
|
9585 | createText: (text) => doc.createTextNode(text),
|
9586 | createComment: (text) => doc.createComment(text),
|
9587 | setText: (node, text) => {
|
9588 | node.nodeValue = text;
|
9589 | },
|
9590 | setElementText: (el, text) => {
|
9591 | el.textContent = text;
|
9592 | },
|
9593 | parentNode: (node) => node.parentNode,
|
9594 | nextSibling: (node) => node.nextSibling,
|
9595 | querySelector: (selector) => doc.querySelector(selector),
|
9596 | setScopeId(el, id) {
|
9597 | el.setAttribute(id, "");
|
9598 | },
|
9599 |
|
9600 |
|
9601 |
|
9602 |
|
9603 | insertStaticContent(content, parent, anchor, namespace, start, end) {
|
9604 | const before = anchor ? anchor.previousSibling : parent.lastChild;
|
9605 | if (start && (start === end || start.nextSibling)) {
|
9606 | while (true) {
|
9607 | parent.insertBefore(start.cloneNode(true), anchor);
|
9608 | if (start === end || !(start = start.nextSibling))
|
9609 | break;
|
9610 | }
|
9611 | } else {
|
9612 | templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
|
9613 | const template = templateContainer.content;
|
9614 | if (namespace === "svg" || namespace === "mathml") {
|
9615 | const wrapper = template.firstChild;
|
9616 | while (wrapper.firstChild) {
|
9617 | template.appendChild(wrapper.firstChild);
|
9618 | }
|
9619 | template.removeChild(wrapper);
|
9620 | }
|
9621 | parent.insertBefore(template, anchor);
|
9622 | }
|
9623 | return [
|
9624 |
|
9625 | before ? before.nextSibling : parent.firstChild,
|
9626 |
|
9627 | anchor ? anchor.previousSibling : parent.lastChild
|
9628 | ];
|
9629 | }
|
9630 | };
|
9631 |
|
9632 | const TRANSITION = "transition";
|
9633 | const ANIMATION = "animation";
|
9634 | const vtcKey = Symbol("_vtc");
|
9635 | const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
|
9636 | Transition.displayName = "Transition";
|
9637 | const DOMTransitionPropsValidators = {
|
9638 | name: String,
|
9639 | type: String,
|
9640 | css: {
|
9641 | type: Boolean,
|
9642 | default: true
|
9643 | },
|
9644 | duration: [String, Number, Object],
|
9645 | enterFromClass: String,
|
9646 | enterActiveClass: String,
|
9647 | enterToClass: String,
|
9648 | appearFromClass: String,
|
9649 | appearActiveClass: String,
|
9650 | appearToClass: String,
|
9651 | leaveFromClass: String,
|
9652 | leaveActiveClass: String,
|
9653 | leaveToClass: String
|
9654 | };
|
9655 | const TransitionPropsValidators = Transition.props = extend(
|
9656 | {},
|
9657 | BaseTransitionPropsValidators,
|
9658 | DOMTransitionPropsValidators
|
9659 | );
|
9660 | const callHook = (hook, args = []) => {
|
9661 | if (isArray(hook)) {
|
9662 | hook.forEach((h2) => h2(...args));
|
9663 | } else if (hook) {
|
9664 | hook(...args);
|
9665 | }
|
9666 | };
|
9667 | const hasExplicitCallback = (hook) => {
|
9668 | return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
9669 | };
|
9670 | function resolveTransitionProps(rawProps) {
|
9671 | const baseProps = {};
|
9672 | for (const key in rawProps) {
|
9673 | if (!(key in DOMTransitionPropsValidators)) {
|
9674 | baseProps[key] = rawProps[key];
|
9675 | }
|
9676 | }
|
9677 | if (rawProps.css === false) {
|
9678 | return baseProps;
|
9679 | }
|
9680 | const {
|
9681 | name = "v",
|
9682 | type,
|
9683 | duration,
|
9684 | enterFromClass = `${name}-enter-from`,
|
9685 | enterActiveClass = `${name}-enter-active`,
|
9686 | enterToClass = `${name}-enter-to`,
|
9687 | appearFromClass = enterFromClass,
|
9688 | appearActiveClass = enterActiveClass,
|
9689 | appearToClass = enterToClass,
|
9690 | leaveFromClass = `${name}-leave-from`,
|
9691 | leaveActiveClass = `${name}-leave-active`,
|
9692 | leaveToClass = `${name}-leave-to`
|
9693 | } = rawProps;
|
9694 | const durations = normalizeDuration(duration);
|
9695 | const enterDuration = durations && durations[0];
|
9696 | const leaveDuration = durations && durations[1];
|
9697 | const {
|
9698 | onBeforeEnter,
|
9699 | onEnter,
|
9700 | onEnterCancelled,
|
9701 | onLeave,
|
9702 | onLeaveCancelled,
|
9703 | onBeforeAppear = onBeforeEnter,
|
9704 | onAppear = onEnter,
|
9705 | onAppearCancelled = onEnterCancelled
|
9706 | } = baseProps;
|
9707 | const finishEnter = (el, isAppear, done) => {
|
9708 | removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9709 | removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
9710 | done && done();
|
9711 | };
|
9712 | const finishLeave = (el, done) => {
|
9713 | el._isLeaving = false;
|
9714 | removeTransitionClass(el, leaveFromClass);
|
9715 | removeTransitionClass(el, leaveToClass);
|
9716 | removeTransitionClass(el, leaveActiveClass);
|
9717 | done && done();
|
9718 | };
|
9719 | const makeEnterHook = (isAppear) => {
|
9720 | return (el, done) => {
|
9721 | const hook = isAppear ? onAppear : onEnter;
|
9722 | const resolve = () => finishEnter(el, isAppear, done);
|
9723 | callHook(hook, [el, resolve]);
|
9724 | nextFrame(() => {
|
9725 | removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
9726 | addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9727 | if (!hasExplicitCallback(hook)) {
|
9728 | whenTransitionEnds(el, type, enterDuration, resolve);
|
9729 | }
|
9730 | });
|
9731 | };
|
9732 | };
|
9733 | return extend(baseProps, {
|
9734 | onBeforeEnter(el) {
|
9735 | callHook(onBeforeEnter, [el]);
|
9736 | addTransitionClass(el, enterFromClass);
|
9737 | addTransitionClass(el, enterActiveClass);
|
9738 | },
|
9739 | onBeforeAppear(el) {
|
9740 | callHook(onBeforeAppear, [el]);
|
9741 | addTransitionClass(el, appearFromClass);
|
9742 | addTransitionClass(el, appearActiveClass);
|
9743 | },
|
9744 | onEnter: makeEnterHook(false),
|
9745 | onAppear: makeEnterHook(true),
|
9746 | onLeave(el, done) {
|
9747 | el._isLeaving = true;
|
9748 | const resolve = () => finishLeave(el, done);
|
9749 | addTransitionClass(el, leaveFromClass);
|
9750 | addTransitionClass(el, leaveActiveClass);
|
9751 | forceReflow();
|
9752 | nextFrame(() => {
|
9753 | if (!el._isLeaving) {
|
9754 | return;
|
9755 | }
|
9756 | removeTransitionClass(el, leaveFromClass);
|
9757 | addTransitionClass(el, leaveToClass);
|
9758 | if (!hasExplicitCallback(onLeave)) {
|
9759 | whenTransitionEnds(el, type, leaveDuration, resolve);
|
9760 | }
|
9761 | });
|
9762 | callHook(onLeave, [el, resolve]);
|
9763 | },
|
9764 | onEnterCancelled(el) {
|
9765 | finishEnter(el, false);
|
9766 | callHook(onEnterCancelled, [el]);
|
9767 | },
|
9768 | onAppearCancelled(el) {
|
9769 | finishEnter(el, true);
|
9770 | callHook(onAppearCancelled, [el]);
|
9771 | },
|
9772 | onLeaveCancelled(el) {
|
9773 | finishLeave(el);
|
9774 | callHook(onLeaveCancelled, [el]);
|
9775 | }
|
9776 | });
|
9777 | }
|
9778 | function normalizeDuration(duration) {
|
9779 | if (duration == null) {
|
9780 | return null;
|
9781 | } else if (isObject(duration)) {
|
9782 | return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
9783 | } else {
|
9784 | const n = NumberOf(duration);
|
9785 | return [n, n];
|
9786 | }
|
9787 | }
|
9788 | function NumberOf(val) {
|
9789 | const res = toNumber(val);
|
9790 | {
|
9791 | assertNumber(res, "<transition> explicit duration");
|
9792 | }
|
9793 | return res;
|
9794 | }
|
9795 | function addTransitionClass(el, cls) {
|
9796 | cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
9797 | (el[vtcKey] || (el[vtcKey] = new Set())).add(cls);
|
9798 | }
|
9799 | function removeTransitionClass(el, cls) {
|
9800 | cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
9801 | const _vtc = el[vtcKey];
|
9802 | if (_vtc) {
|
9803 | _vtc.delete(cls);
|
9804 | if (!_vtc.size) {
|
9805 | el[vtcKey] = void 0;
|
9806 | }
|
9807 | }
|
9808 | }
|
9809 | function nextFrame(cb) {
|
9810 | requestAnimationFrame(() => {
|
9811 | requestAnimationFrame(cb);
|
9812 | });
|
9813 | }
|
9814 | let endId = 0;
|
9815 | function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
9816 | const id = el._endId = ++endId;
|
9817 | const resolveIfNotStale = () => {
|
9818 | if (id === el._endId) {
|
9819 | resolve();
|
9820 | }
|
9821 | };
|
9822 | if (explicitTimeout) {
|
9823 | return setTimeout(resolveIfNotStale, explicitTimeout);
|
9824 | }
|
9825 | const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
9826 | if (!type) {
|
9827 | return resolve();
|
9828 | }
|
9829 | const endEvent = type + "end";
|
9830 | let ended = 0;
|
9831 | const end = () => {
|
9832 | el.removeEventListener(endEvent, onEnd);
|
9833 | resolveIfNotStale();
|
9834 | };
|
9835 | const onEnd = (e) => {
|
9836 | if (e.target === el && ++ended >= propCount) {
|
9837 | end();
|
9838 | }
|
9839 | };
|
9840 | setTimeout(() => {
|
9841 | if (ended < propCount) {
|
9842 | end();
|
9843 | }
|
9844 | }, timeout + 1);
|
9845 | el.addEventListener(endEvent, onEnd);
|
9846 | }
|
9847 | function getTransitionInfo(el, expectedType) {
|
9848 | const styles = window.getComputedStyle(el);
|
9849 | const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
9850 | const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
9851 | const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
9852 | const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
9853 | const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
9854 | const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
9855 | const animationTimeout = getTimeout(animationDelays, animationDurations);
|
9856 | let type = null;
|
9857 | let timeout = 0;
|
9858 | let propCount = 0;
|
9859 | if (expectedType === TRANSITION) {
|
9860 | if (transitionTimeout > 0) {
|
9861 | type = TRANSITION;
|
9862 | timeout = transitionTimeout;
|
9863 | propCount = transitionDurations.length;
|
9864 | }
|
9865 | } else if (expectedType === ANIMATION) {
|
9866 | if (animationTimeout > 0) {
|
9867 | type = ANIMATION;
|
9868 | timeout = animationTimeout;
|
9869 | propCount = animationDurations.length;
|
9870 | }
|
9871 | } else {
|
9872 | timeout = Math.max(transitionTimeout, animationTimeout);
|
9873 | type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
9874 | propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
9875 | }
|
9876 | const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
|
9877 | getStyleProperties(`${TRANSITION}Property`).toString()
|
9878 | );
|
9879 | return {
|
9880 | type,
|
9881 | timeout,
|
9882 | propCount,
|
9883 | hasTransform
|
9884 | };
|
9885 | }
|
9886 | function getTimeout(delays, durations) {
|
9887 | while (delays.length < durations.length) {
|
9888 | delays = delays.concat(delays);
|
9889 | }
|
9890 | return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
9891 | }
|
9892 | function toMs(s) {
|
9893 | if (s === "auto")
|
9894 | return 0;
|
9895 | return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
9896 | }
|
9897 | function forceReflow() {
|
9898 | return document.body.offsetHeight;
|
9899 | }
|
9900 |
|
9901 | function patchClass(el, value, isSVG) {
|
9902 | const transitionClasses = el[vtcKey];
|
9903 | if (transitionClasses) {
|
9904 | value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
9905 | }
|
9906 | if (value == null) {
|
9907 | el.removeAttribute("class");
|
9908 | } else if (isSVG) {
|
9909 | el.setAttribute("class", value);
|
9910 | } else {
|
9911 | el.className = value;
|
9912 | }
|
9913 | }
|
9914 |
|
9915 | const vShowOriginalDisplay = Symbol("_vod");
|
9916 | const vShowHidden = Symbol("_vsh");
|
9917 | const vShow = {
|
9918 | beforeMount(el, { value }, { transition }) {
|
9919 | el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
9920 | if (transition && value) {
|
9921 | transition.beforeEnter(el);
|
9922 | } else {
|
9923 | setDisplay(el, value);
|
9924 | }
|
9925 | },
|
9926 | mounted(el, { value }, { transition }) {
|
9927 | if (transition && value) {
|
9928 | transition.enter(el);
|
9929 | }
|
9930 | },
|
9931 | updated(el, { value, oldValue }, { transition }) {
|
9932 | if (!value === !oldValue)
|
9933 | return;
|
9934 | if (transition) {
|
9935 | if (value) {
|
9936 | transition.beforeEnter(el);
|
9937 | setDisplay(el, true);
|
9938 | transition.enter(el);
|
9939 | } else {
|
9940 | transition.leave(el, () => {
|
9941 | setDisplay(el, false);
|
9942 | });
|
9943 | }
|
9944 | } else {
|
9945 | setDisplay(el, value);
|
9946 | }
|
9947 | },
|
9948 | beforeUnmount(el, { value }) {
|
9949 | setDisplay(el, value);
|
9950 | }
|
9951 | };
|
9952 | {
|
9953 | vShow.name = "show";
|
9954 | }
|
9955 | function setDisplay(el, value) {
|
9956 | el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
9957 | el[vShowHidden] = !value;
|
9958 | }
|
9959 |
|
9960 | const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
|
9961 | function useCssVars(getter) {
|
9962 | const instance = getCurrentInstance();
|
9963 | if (!instance) {
|
9964 | warn(`useCssVars is called without current active component instance.`);
|
9965 | return;
|
9966 | }
|
9967 | const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
|
9968 | Array.from(
|
9969 | document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
|
9970 | ).forEach((node) => setVarsOnNode(node, vars));
|
9971 | };
|
9972 | {
|
9973 | instance.getCssVars = () => getter(instance.proxy);
|
9974 | }
|
9975 | const setVars = () => {
|
9976 | const vars = getter(instance.proxy);
|
9977 | setVarsOnVNode(instance.subTree, vars);
|
9978 | updateTeleports(vars);
|
9979 | };
|
9980 | onMounted(() => {
|
9981 | watchPostEffect(setVars);
|
9982 | const ob = new MutationObserver(setVars);
|
9983 | ob.observe(instance.subTree.el.parentNode, { childList: true });
|
9984 | onUnmounted(() => ob.disconnect());
|
9985 | });
|
9986 | }
|
9987 | function setVarsOnVNode(vnode, vars) {
|
9988 | if (vnode.shapeFlag & 128) {
|
9989 | const suspense = vnode.suspense;
|
9990 | vnode = suspense.activeBranch;
|
9991 | if (suspense.pendingBranch && !suspense.isHydrating) {
|
9992 | suspense.effects.push(() => {
|
9993 | setVarsOnVNode(suspense.activeBranch, vars);
|
9994 | });
|
9995 | }
|
9996 | }
|
9997 | while (vnode.component) {
|
9998 | vnode = vnode.component.subTree;
|
9999 | }
|
10000 | if (vnode.shapeFlag & 1 && vnode.el) {
|
10001 | setVarsOnNode(vnode.el, vars);
|
10002 | } else if (vnode.type === Fragment) {
|
10003 | vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
10004 | } else if (vnode.type === Static) {
|
10005 | let { el, anchor } = vnode;
|
10006 | while (el) {
|
10007 | setVarsOnNode(el, vars);
|
10008 | if (el === anchor)
|
10009 | break;
|
10010 | el = el.nextSibling;
|
10011 | }
|
10012 | }
|
10013 | }
|
10014 | function setVarsOnNode(el, vars) {
|
10015 | if (el.nodeType === 1) {
|
10016 | const style = el.style;
|
10017 | let cssText = "";
|
10018 | for (const key in vars) {
|
10019 | style.setProperty(`--${key}`, vars[key]);
|
10020 | cssText += `--${key}: ${vars[key]};`;
|
10021 | }
|
10022 | style[CSS_VAR_TEXT] = cssText;
|
10023 | }
|
10024 | }
|
10025 |
|
10026 | const displayRE = /(^|;)\s*display\s*:/;
|
10027 | function patchStyle(el, prev, next) {
|
10028 | const style = el.style;
|
10029 | const isCssString = isString(next);
|
10030 | let hasControlledDisplay = false;
|
10031 | if (next && !isCssString) {
|
10032 | if (prev) {
|
10033 | if (!isString(prev)) {
|
10034 | for (const key in prev) {
|
10035 | if (next[key] == null) {
|
10036 | setStyle(style, key, "");
|
10037 | }
|
10038 | }
|
10039 | } else {
|
10040 | for (const prevStyle of prev.split(";")) {
|
10041 | const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
10042 | if (next[key] == null) {
|
10043 | setStyle(style, key, "");
|
10044 | }
|
10045 | }
|
10046 | }
|
10047 | }
|
10048 | for (const key in next) {
|
10049 | if (key === "display") {
|
10050 | hasControlledDisplay = true;
|
10051 | }
|
10052 | setStyle(style, key, next[key]);
|
10053 | }
|
10054 | } else {
|
10055 | if (isCssString) {
|
10056 | if (prev !== next) {
|
10057 | const cssVarText = style[CSS_VAR_TEXT];
|
10058 | if (cssVarText) {
|
10059 | next += ";" + cssVarText;
|
10060 | }
|
10061 | style.cssText = next;
|
10062 | hasControlledDisplay = displayRE.test(next);
|
10063 | }
|
10064 | } else if (prev) {
|
10065 | el.removeAttribute("style");
|
10066 | }
|
10067 | }
|
10068 | if (vShowOriginalDisplay in el) {
|
10069 | el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
10070 | if (el[vShowHidden]) {
|
10071 | style.display = "none";
|
10072 | }
|
10073 | }
|
10074 | }
|
10075 | const semicolonRE = /[^\\];\s*$/;
|
10076 | const importantRE = /\s*!important$/;
|
10077 | function setStyle(style, name, val) {
|
10078 | if (isArray(val)) {
|
10079 | val.forEach((v) => setStyle(style, name, v));
|
10080 | } else {
|
10081 | if (val == null)
|
10082 | val = "";
|
10083 | {
|
10084 | if (semicolonRE.test(val)) {
|
10085 | warn(
|
10086 | `Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
10087 | );
|
10088 | }
|
10089 | }
|
10090 | if (name.startsWith("--")) {
|
10091 | style.setProperty(name, val);
|
10092 | } else {
|
10093 | const prefixed = autoPrefix(style, name);
|
10094 | if (importantRE.test(val)) {
|
10095 | style.setProperty(
|
10096 | hyphenate(prefixed),
|
10097 | val.replace(importantRE, ""),
|
10098 | "important"
|
10099 | );
|
10100 | } else {
|
10101 | style[prefixed] = val;
|
10102 | }
|
10103 | }
|
10104 | }
|
10105 | }
|
10106 | const prefixes = ["Webkit", "Moz", "ms"];
|
10107 | const prefixCache = {};
|
10108 | function autoPrefix(style, rawName) {
|
10109 | const cached = prefixCache[rawName];
|
10110 | if (cached) {
|
10111 | return cached;
|
10112 | }
|
10113 | let name = camelize(rawName);
|
10114 | if (name !== "filter" && name in style) {
|
10115 | return prefixCache[rawName] = name;
|
10116 | }
|
10117 | name = capitalize(name);
|
10118 | for (let i = 0; i < prefixes.length; i++) {
|
10119 | const prefixed = prefixes[i] + name;
|
10120 | if (prefixed in style) {
|
10121 | return prefixCache[rawName] = prefixed;
|
10122 | }
|
10123 | }
|
10124 | return rawName;
|
10125 | }
|
10126 |
|
10127 | const xlinkNS = "http://www.w3.org/1999/xlink";
|
10128 | function patchAttr(el, key, value, isSVG, instance) {
|
10129 | if (isSVG && key.startsWith("xlink:")) {
|
10130 | if (value == null) {
|
10131 | el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
10132 | } else {
|
10133 | el.setAttributeNS(xlinkNS, key, value);
|
10134 | }
|
10135 | } else {
|
10136 | const isBoolean = isSpecialBooleanAttr(key);
|
10137 | if (value == null || isBoolean && !includeBooleanAttr(value)) {
|
10138 | el.removeAttribute(key);
|
10139 | } else {
|
10140 | el.setAttribute(key, isBoolean ? "" : value);
|
10141 | }
|
10142 | }
|
10143 | }
|
10144 |
|
10145 | function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
10146 | if (key === "innerHTML" || key === "textContent") {
|
10147 | if (prevChildren) {
|
10148 | unmountChildren(prevChildren, parentComponent, parentSuspense);
|
10149 | }
|
10150 | el[key] = value == null ? "" : value;
|
10151 | return;
|
10152 | }
|
10153 | const tag = el.tagName;
|
10154 | if (key === "value" && tag !== "PROGRESS" &&
|
10155 | !tag.includes("-")) {
|
10156 | const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
10157 | const newValue = value == null ? "" : value;
|
10158 | if (oldValue !== newValue || !("_value" in el)) {
|
10159 | el.value = newValue;
|
10160 | }
|
10161 | if (value == null) {
|
10162 | el.removeAttribute(key);
|
10163 | }
|
10164 | el._value = value;
|
10165 | return;
|
10166 | }
|
10167 | let needRemove = false;
|
10168 | if (value === "" || value == null) {
|
10169 | const type = typeof el[key];
|
10170 | if (type === "boolean") {
|
10171 | value = includeBooleanAttr(value);
|
10172 | } else if (value == null && type === "string") {
|
10173 | value = "";
|
10174 | needRemove = true;
|
10175 | } else if (type === "number") {
|
10176 | value = 0;
|
10177 | needRemove = true;
|
10178 | }
|
10179 | }
|
10180 | try {
|
10181 | el[key] = value;
|
10182 | } catch (e) {
|
10183 | if (!needRemove) {
|
10184 | warn(
|
10185 | `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
|
10186 | e
|
10187 | );
|
10188 | }
|
10189 | }
|
10190 | needRemove && el.removeAttribute(key);
|
10191 | }
|
10192 |
|
10193 | function addEventListener(el, event, handler, options) {
|
10194 | el.addEventListener(event, handler, options);
|
10195 | }
|
10196 | function removeEventListener(el, event, handler, options) {
|
10197 | el.removeEventListener(event, handler, options);
|
10198 | }
|
10199 | const veiKey = Symbol("_vei");
|
10200 | function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
10201 | const invokers = el[veiKey] || (el[veiKey] = {});
|
10202 | const existingInvoker = invokers[rawName];
|
10203 | if (nextValue && existingInvoker) {
|
10204 | existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
|
10205 | } else {
|
10206 | const [name, options] = parseName(rawName);
|
10207 | if (nextValue) {
|
10208 | const invoker = invokers[rawName] = createInvoker(
|
10209 | sanitizeEventValue(nextValue, rawName) ,
|
10210 | instance
|
10211 | );
|
10212 | addEventListener(el, name, invoker, options);
|
10213 | } else if (existingInvoker) {
|
10214 | removeEventListener(el, name, existingInvoker, options);
|
10215 | invokers[rawName] = void 0;
|
10216 | }
|
10217 | }
|
10218 | }
|
10219 | const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
10220 | function parseName(name) {
|
10221 | let options;
|
10222 | if (optionsModifierRE.test(name)) {
|
10223 | options = {};
|
10224 | let m;
|
10225 | while (m = name.match(optionsModifierRE)) {
|
10226 | name = name.slice(0, name.length - m[0].length);
|
10227 | options[m[0].toLowerCase()] = true;
|
10228 | }
|
10229 | }
|
10230 | const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
|
10231 | return [event, options];
|
10232 | }
|
10233 | let cachedNow = 0;
|
10234 | const p = Promise.resolve();
|
10235 | const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
10236 | function createInvoker(initialValue, instance) {
|
10237 | const invoker = (e) => {
|
10238 | if (!e._vts) {
|
10239 | e._vts = Date.now();
|
10240 | } else if (e._vts <= invoker.attached) {
|
10241 | return;
|
10242 | }
|
10243 | callWithAsyncErrorHandling(
|
10244 | patchStopImmediatePropagation(e, invoker.value),
|
10245 | instance,
|
10246 | 5,
|
10247 | [e]
|
10248 | );
|
10249 | };
|
10250 | invoker.value = initialValue;
|
10251 | invoker.attached = getNow();
|
10252 | return invoker;
|
10253 | }
|
10254 | function sanitizeEventValue(value, propName) {
|
10255 | if (isFunction(value) || isArray(value)) {
|
10256 | return value;
|
10257 | }
|
10258 | warn(
|
10259 | `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
|
10260 | Expected function or array of functions, received type ${typeof value}.`
|
10261 | );
|
10262 | return NOOP;
|
10263 | }
|
10264 | function patchStopImmediatePropagation(e, value) {
|
10265 | if (isArray(value)) {
|
10266 | const originalStop = e.stopImmediatePropagation;
|
10267 | e.stopImmediatePropagation = () => {
|
10268 | originalStop.call(e);
|
10269 | e._stopped = true;
|
10270 | };
|
10271 | return value.map(
|
10272 | (fn) => (e2) => !e2._stopped && fn && fn(e2)
|
10273 | );
|
10274 | } else {
|
10275 | return value;
|
10276 | }
|
10277 | }
|
10278 |
|
10279 | const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
10280 | key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
10281 | const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
10282 | const isSVG = namespace === "svg";
|
10283 | if (key === "class") {
|
10284 | patchClass(el, nextValue, isSVG);
|
10285 | } else if (key === "style") {
|
10286 | patchStyle(el, prevValue, nextValue);
|
10287 | } else if (isOn(key)) {
|
10288 | if (!isModelListener(key)) {
|
10289 | patchEvent(el, key, prevValue, nextValue, parentComponent);
|
10290 | }
|
10291 | } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
10292 | patchDOMProp(
|
10293 | el,
|
10294 | key,
|
10295 | nextValue,
|
10296 | prevChildren,
|
10297 | parentComponent,
|
10298 | parentSuspense,
|
10299 | unmountChildren
|
10300 | );
|
10301 | } else {
|
10302 | if (key === "true-value") {
|
10303 | el._trueValue = nextValue;
|
10304 | } else if (key === "false-value") {
|
10305 | el._falseValue = nextValue;
|
10306 | }
|
10307 | patchAttr(el, key, nextValue, isSVG);
|
10308 | }
|
10309 | };
|
10310 | function shouldSetAsProp(el, key, value, isSVG) {
|
10311 | if (isSVG) {
|
10312 | if (key === "innerHTML" || key === "textContent") {
|
10313 | return true;
|
10314 | }
|
10315 | if (key in el && isNativeOn(key) && isFunction(value)) {
|
10316 | return true;
|
10317 | }
|
10318 | return false;
|
10319 | }
|
10320 | if (key === "spellcheck" || key === "draggable" || key === "translate") {
|
10321 | return false;
|
10322 | }
|
10323 | if (key === "form") {
|
10324 | return false;
|
10325 | }
|
10326 | if (key === "list" && el.tagName === "INPUT") {
|
10327 | return false;
|
10328 | }
|
10329 | if (key === "type" && el.tagName === "TEXTAREA") {
|
10330 | return false;
|
10331 | }
|
10332 | if (key === "width" || key === "height") {
|
10333 | const tag = el.tagName;
|
10334 | if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
10335 | return false;
|
10336 | }
|
10337 | }
|
10338 | if (isNativeOn(key) && isString(value)) {
|
10339 | return false;
|
10340 | }
|
10341 | return key in el;
|
10342 | }
|
10343 |
|
10344 |
|
10345 |
|
10346 | function defineCustomElement(options, hydrate2) {
|
10347 | const Comp = defineComponent(options);
|
10348 | class VueCustomElement extends VueElement {
|
10349 | constructor(initialProps) {
|
10350 | super(Comp, initialProps, hydrate2);
|
10351 | }
|
10352 | }
|
10353 | VueCustomElement.def = Comp;
|
10354 | return VueCustomElement;
|
10355 | }
|
10356 |
|
10357 | const defineSSRCustomElement = (options) => {
|
10358 | return defineCustomElement(options, hydrate);
|
10359 | };
|
10360 | const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
10361 | };
|
10362 | class VueElement extends BaseClass {
|
10363 | constructor(_def, _props = {}, hydrate2) {
|
10364 | super();
|
10365 | this._def = _def;
|
10366 | this._props = _props;
|
10367 | |
10368 |
|
10369 |
|
10370 | this._instance = null;
|
10371 | this._connected = false;
|
10372 | this._resolved = false;
|
10373 | this._numberProps = null;
|
10374 | this._ob = null;
|
10375 | if (this.shadowRoot && hydrate2) {
|
10376 | hydrate2(this._createVNode(), this.shadowRoot);
|
10377 | } else {
|
10378 | if (this.shadowRoot) {
|
10379 | warn(
|
10380 | `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
10381 | );
|
10382 | }
|
10383 | this.attachShadow({ mode: "open" });
|
10384 | if (!this._def.__asyncLoader) {
|
10385 | this._resolveProps(this._def);
|
10386 | }
|
10387 | }
|
10388 | }
|
10389 | connectedCallback() {
|
10390 | this._connected = true;
|
10391 | if (!this._instance) {
|
10392 | if (this._resolved) {
|
10393 | this._update();
|
10394 | } else {
|
10395 | this._resolveDef();
|
10396 | }
|
10397 | }
|
10398 | }
|
10399 | disconnectedCallback() {
|
10400 | this._connected = false;
|
10401 | if (this._ob) {
|
10402 | this._ob.disconnect();
|
10403 | this._ob = null;
|
10404 | }
|
10405 | nextTick(() => {
|
10406 | if (!this._connected) {
|
10407 | render(null, this.shadowRoot);
|
10408 | this._instance = null;
|
10409 | }
|
10410 | });
|
10411 | }
|
10412 | |
10413 |
|
10414 |
|
10415 | _resolveDef() {
|
10416 | this._resolved = true;
|
10417 | for (let i = 0; i < this.attributes.length; i++) {
|
10418 | this._setAttr(this.attributes[i].name);
|
10419 | }
|
10420 | this._ob = new MutationObserver((mutations) => {
|
10421 | for (const m of mutations) {
|
10422 | this._setAttr(m.attributeName);
|
10423 | }
|
10424 | });
|
10425 | this._ob.observe(this, { attributes: true });
|
10426 | const resolve = (def, isAsync = false) => {
|
10427 | const { props, styles } = def;
|
10428 | let numberProps;
|
10429 | if (props && !isArray(props)) {
|
10430 | for (const key in props) {
|
10431 | const opt = props[key];
|
10432 | if (opt === Number || opt && opt.type === Number) {
|
10433 | if (key in this._props) {
|
10434 | this._props[key] = toNumber(this._props[key]);
|
10435 | }
|
10436 | (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
|
10437 | }
|
10438 | }
|
10439 | }
|
10440 | this._numberProps = numberProps;
|
10441 | if (isAsync) {
|
10442 | this._resolveProps(def);
|
10443 | }
|
10444 | this._applyStyles(styles);
|
10445 | this._update();
|
10446 | };
|
10447 | const asyncDef = this._def.__asyncLoader;
|
10448 | if (asyncDef) {
|
10449 | asyncDef().then((def) => resolve(def, true));
|
10450 | } else {
|
10451 | resolve(this._def);
|
10452 | }
|
10453 | }
|
10454 | _resolveProps(def) {
|
10455 | const { props } = def;
|
10456 | const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
10457 | for (const key of Object.keys(this)) {
|
10458 | if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
10459 | this._setProp(key, this[key], true, false);
|
10460 | }
|
10461 | }
|
10462 | for (const key of declaredPropKeys.map(camelize)) {
|
10463 | Object.defineProperty(this, key, {
|
10464 | get() {
|
10465 | return this._getProp(key);
|
10466 | },
|
10467 | set(val) {
|
10468 | this._setProp(key, val);
|
10469 | }
|
10470 | });
|
10471 | }
|
10472 | }
|
10473 | _setAttr(key) {
|
10474 | let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
|
10475 | const camelKey = camelize(key);
|
10476 | if (this._numberProps && this._numberProps[camelKey]) {
|
10477 | value = toNumber(value);
|
10478 | }
|
10479 | this._setProp(camelKey, value, false);
|
10480 | }
|
10481 | |
10482 |
|
10483 |
|
10484 | _getProp(key) {
|
10485 | return this._props[key];
|
10486 | }
|
10487 | |
10488 |
|
10489 |
|
10490 | _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
10491 | if (val !== this._props[key]) {
|
10492 | this._props[key] = val;
|
10493 | if (shouldUpdate && this._instance) {
|
10494 | this._update();
|
10495 | }
|
10496 | if (shouldReflect) {
|
10497 | if (val === true) {
|
10498 | this.setAttribute(hyphenate(key), "");
|
10499 | } else if (typeof val === "string" || typeof val === "number") {
|
10500 | this.setAttribute(hyphenate(key), val + "");
|
10501 | } else if (!val) {
|
10502 | this.removeAttribute(hyphenate(key));
|
10503 | }
|
10504 | }
|
10505 | }
|
10506 | }
|
10507 | _update() {
|
10508 | render(this._createVNode(), this.shadowRoot);
|
10509 | }
|
10510 | _createVNode() {
|
10511 | const vnode = createVNode(this._def, extend({}, this._props));
|
10512 | if (!this._instance) {
|
10513 | vnode.ce = (instance) => {
|
10514 | this._instance = instance;
|
10515 | instance.isCE = true;
|
10516 | {
|
10517 | instance.ceReload = (newStyles) => {
|
10518 | if (this._styles) {
|
10519 | this._styles.forEach((s) => this.shadowRoot.removeChild(s));
|
10520 | this._styles.length = 0;
|
10521 | }
|
10522 | this._applyStyles(newStyles);
|
10523 | this._instance = null;
|
10524 | this._update();
|
10525 | };
|
10526 | }
|
10527 | const dispatch = (event, args) => {
|
10528 | this.dispatchEvent(
|
10529 | new CustomEvent(event, {
|
10530 | detail: args
|
10531 | })
|
10532 | );
|
10533 | };
|
10534 | instance.emit = (event, ...args) => {
|
10535 | dispatch(event, args);
|
10536 | if (hyphenate(event) !== event) {
|
10537 | dispatch(hyphenate(event), args);
|
10538 | }
|
10539 | };
|
10540 | let parent = this;
|
10541 | while (parent = parent && (parent.parentNode || parent.host)) {
|
10542 | if (parent instanceof VueElement) {
|
10543 | instance.parent = parent._instance;
|
10544 | instance.provides = parent._instance.provides;
|
10545 | break;
|
10546 | }
|
10547 | }
|
10548 | };
|
10549 | }
|
10550 | return vnode;
|
10551 | }
|
10552 | _applyStyles(styles) {
|
10553 | if (styles) {
|
10554 | styles.forEach((css) => {
|
10555 | const s = document.createElement("style");
|
10556 | s.textContent = css;
|
10557 | this.shadowRoot.appendChild(s);
|
10558 | {
|
10559 | (this._styles || (this._styles = [])).push(s);
|
10560 | }
|
10561 | });
|
10562 | }
|
10563 | }
|
10564 | }
|
10565 |
|
10566 | function useCssModule(name = "$style") {
|
10567 | {
|
10568 | {
|
10569 | warn(`useCssModule() is not supported in the global build.`);
|
10570 | }
|
10571 | return EMPTY_OBJ;
|
10572 | }
|
10573 | }
|
10574 |
|
10575 | const positionMap = new WeakMap();
|
10576 | const newPositionMap = new WeakMap();
|
10577 | const moveCbKey = Symbol("_moveCb");
|
10578 | const enterCbKey = Symbol("_enterCb");
|
10579 | const TransitionGroupImpl = {
|
10580 | name: "TransitionGroup",
|
10581 | props: extend({}, TransitionPropsValidators, {
|
10582 | tag: String,
|
10583 | moveClass: String
|
10584 | }),
|
10585 | setup(props, { slots }) {
|
10586 | const instance = getCurrentInstance();
|
10587 | const state = useTransitionState();
|
10588 | let prevChildren;
|
10589 | let children;
|
10590 | onUpdated(() => {
|
10591 | if (!prevChildren.length) {
|
10592 | return;
|
10593 | }
|
10594 | const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
10595 | if (!hasCSSTransform(
|
10596 | prevChildren[0].el,
|
10597 | instance.vnode.el,
|
10598 | moveClass
|
10599 | )) {
|
10600 | return;
|
10601 | }
|
10602 | prevChildren.forEach(callPendingCbs);
|
10603 | prevChildren.forEach(recordPosition);
|
10604 | const movedChildren = prevChildren.filter(applyTranslation);
|
10605 | forceReflow();
|
10606 | movedChildren.forEach((c) => {
|
10607 | const el = c.el;
|
10608 | const style = el.style;
|
10609 | addTransitionClass(el, moveClass);
|
10610 | style.transform = style.webkitTransform = style.transitionDuration = "";
|
10611 | const cb = el[moveCbKey] = (e) => {
|
10612 | if (e && e.target !== el) {
|
10613 | return;
|
10614 | }
|
10615 | if (!e || /transform$/.test(e.propertyName)) {
|
10616 | el.removeEventListener("transitionend", cb);
|
10617 | el[moveCbKey] = null;
|
10618 | removeTransitionClass(el, moveClass);
|
10619 | }
|
10620 | };
|
10621 | el.addEventListener("transitionend", cb);
|
10622 | });
|
10623 | });
|
10624 | return () => {
|
10625 | const rawProps = toRaw(props);
|
10626 | const cssTransitionProps = resolveTransitionProps(rawProps);
|
10627 | let tag = rawProps.tag || Fragment;
|
10628 | prevChildren = [];
|
10629 | if (children) {
|
10630 | for (let i = 0; i < children.length; i++) {
|
10631 | const child = children[i];
|
10632 | if (child.el && child.el instanceof Element) {
|
10633 | prevChildren.push(child);
|
10634 | setTransitionHooks(
|
10635 | child,
|
10636 | resolveTransitionHooks(
|
10637 | child,
|
10638 | cssTransitionProps,
|
10639 | state,
|
10640 | instance
|
10641 | )
|
10642 | );
|
10643 | positionMap.set(
|
10644 | child,
|
10645 | child.el.getBoundingClientRect()
|
10646 | );
|
10647 | }
|
10648 | }
|
10649 | }
|
10650 | children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
10651 | for (let i = 0; i < children.length; i++) {
|
10652 | const child = children[i];
|
10653 | if (child.key != null) {
|
10654 | setTransitionHooks(
|
10655 | child,
|
10656 | resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
10657 | );
|
10658 | } else {
|
10659 | warn(`<TransitionGroup> children must be keyed.`);
|
10660 | }
|
10661 | }
|
10662 | return createVNode(tag, null, children);
|
10663 | };
|
10664 | }
|
10665 | };
|
10666 | const removeMode = (props) => delete props.mode;
|
10667 | removeMode(TransitionGroupImpl.props);
|
10668 | const TransitionGroup = TransitionGroupImpl;
|
10669 | function callPendingCbs(c) {
|
10670 | const el = c.el;
|
10671 | if (el[moveCbKey]) {
|
10672 | el[moveCbKey]();
|
10673 | }
|
10674 | if (el[enterCbKey]) {
|
10675 | el[enterCbKey]();
|
10676 | }
|
10677 | }
|
10678 | function recordPosition(c) {
|
10679 | newPositionMap.set(c, c.el.getBoundingClientRect());
|
10680 | }
|
10681 | function applyTranslation(c) {
|
10682 | const oldPos = positionMap.get(c);
|
10683 | const newPos = newPositionMap.get(c);
|
10684 | const dx = oldPos.left - newPos.left;
|
10685 | const dy = oldPos.top - newPos.top;
|
10686 | if (dx || dy) {
|
10687 | const s = c.el.style;
|
10688 | s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
10689 | s.transitionDuration = "0s";
|
10690 | return c;
|
10691 | }
|
10692 | }
|
10693 | function hasCSSTransform(el, root, moveClass) {
|
10694 | const clone = el.cloneNode();
|
10695 | const _vtc = el[vtcKey];
|
10696 | if (_vtc) {
|
10697 | _vtc.forEach((cls) => {
|
10698 | cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
10699 | });
|
10700 | }
|
10701 | moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
|
10702 | clone.style.display = "none";
|
10703 | const container = root.nodeType === 1 ? root : root.parentNode;
|
10704 | container.appendChild(clone);
|
10705 | const { hasTransform } = getTransitionInfo(clone);
|
10706 | container.removeChild(clone);
|
10707 | return hasTransform;
|
10708 | }
|
10709 |
|
10710 | const getModelAssigner = (vnode) => {
|
10711 | const fn = vnode.props["onUpdate:modelValue"] || false;
|
10712 | return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
|
10713 | };
|
10714 | function onCompositionStart(e) {
|
10715 | e.target.composing = true;
|
10716 | }
|
10717 | function onCompositionEnd(e) {
|
10718 | const target = e.target;
|
10719 | if (target.composing) {
|
10720 | target.composing = false;
|
10721 | target.dispatchEvent(new Event("input"));
|
10722 | }
|
10723 | }
|
10724 | const assignKey = Symbol("_assign");
|
10725 | const vModelText = {
|
10726 | created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
10727 | el[assignKey] = getModelAssigner(vnode);
|
10728 | const castToNumber = number || vnode.props && vnode.props.type === "number";
|
10729 | addEventListener(el, lazy ? "change" : "input", (e) => {
|
10730 | if (e.target.composing)
|
10731 | return;
|
10732 | let domValue = el.value;
|
10733 | if (trim) {
|
10734 | domValue = domValue.trim();
|
10735 | }
|
10736 | if (castToNumber) {
|
10737 | domValue = looseToNumber(domValue);
|
10738 | }
|
10739 | el[assignKey](domValue);
|
10740 | });
|
10741 | if (trim) {
|
10742 | addEventListener(el, "change", () => {
|
10743 | el.value = el.value.trim();
|
10744 | });
|
10745 | }
|
10746 | if (!lazy) {
|
10747 | addEventListener(el, "compositionstart", onCompositionStart);
|
10748 | addEventListener(el, "compositionend", onCompositionEnd);
|
10749 | addEventListener(el, "change", onCompositionEnd);
|
10750 | }
|
10751 | },
|
10752 |
|
10753 | mounted(el, { value }) {
|
10754 | el.value = value == null ? "" : value;
|
10755 | },
|
10756 | beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
10757 | el[assignKey] = getModelAssigner(vnode);
|
10758 | if (el.composing)
|
10759 | return;
|
10760 | const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
10761 | const newValue = value == null ? "" : value;
|
10762 | if (elValue === newValue) {
|
10763 | return;
|
10764 | }
|
10765 | if (document.activeElement === el && el.type !== "range") {
|
10766 | if (lazy) {
|
10767 | return;
|
10768 | }
|
10769 | if (trim && el.value.trim() === newValue) {
|
10770 | return;
|
10771 | }
|
10772 | }
|
10773 | el.value = newValue;
|
10774 | }
|
10775 | };
|
10776 | const vModelCheckbox = {
|
10777 |
|
10778 | deep: true,
|
10779 | created(el, _, vnode) {
|
10780 | el[assignKey] = getModelAssigner(vnode);
|
10781 | addEventListener(el, "change", () => {
|
10782 | const modelValue = el._modelValue;
|
10783 | const elementValue = getValue(el);
|
10784 | const checked = el.checked;
|
10785 | const assign = el[assignKey];
|
10786 | if (isArray(modelValue)) {
|
10787 | const index = looseIndexOf(modelValue, elementValue);
|
10788 | const found = index !== -1;
|
10789 | if (checked && !found) {
|
10790 | assign(modelValue.concat(elementValue));
|
10791 | } else if (!checked && found) {
|
10792 | const filtered = [...modelValue];
|
10793 | filtered.splice(index, 1);
|
10794 | assign(filtered);
|
10795 | }
|
10796 | } else if (isSet(modelValue)) {
|
10797 | const cloned = new Set(modelValue);
|
10798 | if (checked) {
|
10799 | cloned.add(elementValue);
|
10800 | } else {
|
10801 | cloned.delete(elementValue);
|
10802 | }
|
10803 | assign(cloned);
|
10804 | } else {
|
10805 | assign(getCheckboxValue(el, checked));
|
10806 | }
|
10807 | });
|
10808 | },
|
10809 |
|
10810 | mounted: setChecked,
|
10811 | beforeUpdate(el, binding, vnode) {
|
10812 | el[assignKey] = getModelAssigner(vnode);
|
10813 | setChecked(el, binding, vnode);
|
10814 | }
|
10815 | };
|
10816 | function setChecked(el, { value, oldValue }, vnode) {
|
10817 | el._modelValue = value;
|
10818 | if (isArray(value)) {
|
10819 | el.checked = looseIndexOf(value, vnode.props.value) > -1;
|
10820 | } else if (isSet(value)) {
|
10821 | el.checked = value.has(vnode.props.value);
|
10822 | } else if (value !== oldValue) {
|
10823 | el.checked = looseEqual(value, getCheckboxValue(el, true));
|
10824 | }
|
10825 | }
|
10826 | const vModelRadio = {
|
10827 | created(el, { value }, vnode) {
|
10828 | el.checked = looseEqual(value, vnode.props.value);
|
10829 | el[assignKey] = getModelAssigner(vnode);
|
10830 | addEventListener(el, "change", () => {
|
10831 | el[assignKey](getValue(el));
|
10832 | });
|
10833 | },
|
10834 | beforeUpdate(el, { value, oldValue }, vnode) {
|
10835 | el[assignKey] = getModelAssigner(vnode);
|
10836 | if (value !== oldValue) {
|
10837 | el.checked = looseEqual(value, vnode.props.value);
|
10838 | }
|
10839 | }
|
10840 | };
|
10841 | const vModelSelect = {
|
10842 |
|
10843 | deep: true,
|
10844 | created(el, { value, modifiers: { number } }, vnode) {
|
10845 | const isSetModel = isSet(value);
|
10846 | addEventListener(el, "change", () => {
|
10847 | const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
10848 | (o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
10849 | );
|
10850 | el[assignKey](
|
10851 | el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
10852 | );
|
10853 | el._assigning = true;
|
10854 | nextTick(() => {
|
10855 | el._assigning = false;
|
10856 | });
|
10857 | });
|
10858 | el[assignKey] = getModelAssigner(vnode);
|
10859 | },
|
10860 |
|
10861 |
|
10862 | mounted(el, { value, modifiers: { number } }) {
|
10863 | setSelected(el, value);
|
10864 | },
|
10865 | beforeUpdate(el, _binding, vnode) {
|
10866 | el[assignKey] = getModelAssigner(vnode);
|
10867 | },
|
10868 | updated(el, { value, modifiers: { number } }) {
|
10869 | if (!el._assigning) {
|
10870 | setSelected(el, value);
|
10871 | }
|
10872 | }
|
10873 | };
|
10874 | function setSelected(el, value, number) {
|
10875 | const isMultiple = el.multiple;
|
10876 | const isArrayValue = isArray(value);
|
10877 | if (isMultiple && !isArrayValue && !isSet(value)) {
|
10878 | warn(
|
10879 | `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
|
10880 | );
|
10881 | return;
|
10882 | }
|
10883 | for (let i = 0, l = el.options.length; i < l; i++) {
|
10884 | const option = el.options[i];
|
10885 | const optionValue = getValue(option);
|
10886 | if (isMultiple) {
|
10887 | if (isArrayValue) {
|
10888 | const optionType = typeof optionValue;
|
10889 | if (optionType === "string" || optionType === "number") {
|
10890 | option.selected = value.some((v) => String(v) === String(optionValue));
|
10891 | } else {
|
10892 | option.selected = looseIndexOf(value, optionValue) > -1;
|
10893 | }
|
10894 | } else {
|
10895 | option.selected = value.has(optionValue);
|
10896 | }
|
10897 | } else if (looseEqual(getValue(option), value)) {
|
10898 | if (el.selectedIndex !== i)
|
10899 | el.selectedIndex = i;
|
10900 | return;
|
10901 | }
|
10902 | }
|
10903 | if (!isMultiple && el.selectedIndex !== -1) {
|
10904 | el.selectedIndex = -1;
|
10905 | }
|
10906 | }
|
10907 | function getValue(el) {
|
10908 | return "_value" in el ? el._value : el.value;
|
10909 | }
|
10910 | function getCheckboxValue(el, checked) {
|
10911 | const key = checked ? "_trueValue" : "_falseValue";
|
10912 | return key in el ? el[key] : checked;
|
10913 | }
|
10914 | const vModelDynamic = {
|
10915 | created(el, binding, vnode) {
|
10916 | callModelHook(el, binding, vnode, null, "created");
|
10917 | },
|
10918 | mounted(el, binding, vnode) {
|
10919 | callModelHook(el, binding, vnode, null, "mounted");
|
10920 | },
|
10921 | beforeUpdate(el, binding, vnode, prevVNode) {
|
10922 | callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
10923 | },
|
10924 | updated(el, binding, vnode, prevVNode) {
|
10925 | callModelHook(el, binding, vnode, prevVNode, "updated");
|
10926 | }
|
10927 | };
|
10928 | function resolveDynamicModel(tagName, type) {
|
10929 | switch (tagName) {
|
10930 | case "SELECT":
|
10931 | return vModelSelect;
|
10932 | case "TEXTAREA":
|
10933 | return vModelText;
|
10934 | default:
|
10935 | switch (type) {
|
10936 | case "checkbox":
|
10937 | return vModelCheckbox;
|
10938 | case "radio":
|
10939 | return vModelRadio;
|
10940 | default:
|
10941 | return vModelText;
|
10942 | }
|
10943 | }
|
10944 | }
|
10945 | function callModelHook(el, binding, vnode, prevVNode, hook) {
|
10946 | const modelToUse = resolveDynamicModel(
|
10947 | el.tagName,
|
10948 | vnode.props && vnode.props.type
|
10949 | );
|
10950 | const fn = modelToUse[hook];
|
10951 | fn && fn(el, binding, vnode, prevVNode);
|
10952 | }
|
10953 |
|
10954 | const systemModifiers = ["ctrl", "shift", "alt", "meta"];
|
10955 | const modifierGuards = {
|
10956 | stop: (e) => e.stopPropagation(),
|
10957 | prevent: (e) => e.preventDefault(),
|
10958 | self: (e) => e.target !== e.currentTarget,
|
10959 | ctrl: (e) => !e.ctrlKey,
|
10960 | shift: (e) => !e.shiftKey,
|
10961 | alt: (e) => !e.altKey,
|
10962 | meta: (e) => !e.metaKey,
|
10963 | left: (e) => "button" in e && e.button !== 0,
|
10964 | middle: (e) => "button" in e && e.button !== 1,
|
10965 | right: (e) => "button" in e && e.button !== 2,
|
10966 | exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
10967 | };
|
10968 | const withModifiers = (fn, modifiers) => {
|
10969 | const cache = fn._withMods || (fn._withMods = {});
|
10970 | const cacheKey = modifiers.join(".");
|
10971 | return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
10972 | for (let i = 0; i < modifiers.length; i++) {
|
10973 | const guard = modifierGuards[modifiers[i]];
|
10974 | if (guard && guard(event, modifiers))
|
10975 | return;
|
10976 | }
|
10977 | return fn(event, ...args);
|
10978 | });
|
10979 | };
|
10980 | const keyNames = {
|
10981 | esc: "escape",
|
10982 | space: " ",
|
10983 | up: "arrow-up",
|
10984 | left: "arrow-left",
|
10985 | right: "arrow-right",
|
10986 | down: "arrow-down",
|
10987 | delete: "backspace"
|
10988 | };
|
10989 | const withKeys = (fn, modifiers) => {
|
10990 | const cache = fn._withKeys || (fn._withKeys = {});
|
10991 | const cacheKey = modifiers.join(".");
|
10992 | return cache[cacheKey] || (cache[cacheKey] = (event) => {
|
10993 | if (!("key" in event)) {
|
10994 | return;
|
10995 | }
|
10996 | const eventKey = hyphenate(event.key);
|
10997 | if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
|
10998 | return fn(event);
|
10999 | }
|
11000 | });
|
11001 | };
|
11002 |
|
11003 | const rendererOptions = extend({ patchProp }, nodeOps);
|
11004 | let renderer;
|
11005 | let enabledHydration = false;
|
11006 | function ensureRenderer() {
|
11007 | return renderer || (renderer = createRenderer(rendererOptions));
|
11008 | }
|
11009 | function ensureHydrationRenderer() {
|
11010 | renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
|
11011 | enabledHydration = true;
|
11012 | return renderer;
|
11013 | }
|
11014 | const render = (...args) => {
|
11015 | ensureRenderer().render(...args);
|
11016 | };
|
11017 | const hydrate = (...args) => {
|
11018 | ensureHydrationRenderer().hydrate(...args);
|
11019 | };
|
11020 | const createApp = (...args) => {
|
11021 | const app = ensureRenderer().createApp(...args);
|
11022 | {
|
11023 | injectNativeTagCheck(app);
|
11024 | injectCompilerOptionsCheck(app);
|
11025 | }
|
11026 | const { mount } = app;
|
11027 | app.mount = (containerOrSelector) => {
|
11028 | const container = normalizeContainer(containerOrSelector);
|
11029 | if (!container)
|
11030 | return;
|
11031 | const component = app._component;
|
11032 | if (!isFunction(component) && !component.render && !component.template) {
|
11033 | component.template = container.innerHTML;
|
11034 | }
|
11035 | container.innerHTML = "";
|
11036 | const proxy = mount(container, false, resolveRootNamespace(container));
|
11037 | if (container instanceof Element) {
|
11038 | container.removeAttribute("v-cloak");
|
11039 | container.setAttribute("data-v-app", "");
|
11040 | }
|
11041 | return proxy;
|
11042 | };
|
11043 | return app;
|
11044 | };
|
11045 | const createSSRApp = (...args) => {
|
11046 | const app = ensureHydrationRenderer().createApp(...args);
|
11047 | {
|
11048 | injectNativeTagCheck(app);
|
11049 | injectCompilerOptionsCheck(app);
|
11050 | }
|
11051 | const { mount } = app;
|
11052 | app.mount = (containerOrSelector) => {
|
11053 | const container = normalizeContainer(containerOrSelector);
|
11054 | if (container) {
|
11055 | return mount(container, true, resolveRootNamespace(container));
|
11056 | }
|
11057 | };
|
11058 | return app;
|
11059 | };
|
11060 | function resolveRootNamespace(container) {
|
11061 | if (container instanceof SVGElement) {
|
11062 | return "svg";
|
11063 | }
|
11064 | if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
|
11065 | return "mathml";
|
11066 | }
|
11067 | }
|
11068 | function injectNativeTagCheck(app) {
|
11069 | Object.defineProperty(app.config, "isNativeTag", {
|
11070 | value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
|
11071 | writable: false
|
11072 | });
|
11073 | }
|
11074 | function injectCompilerOptionsCheck(app) {
|
11075 | if (isRuntimeOnly()) {
|
11076 | const isCustomElement = app.config.isCustomElement;
|
11077 | Object.defineProperty(app.config, "isCustomElement", {
|
11078 | get() {
|
11079 | return isCustomElement;
|
11080 | },
|
11081 | set() {
|
11082 | warn(
|
11083 | `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
|
11084 | );
|
11085 | }
|
11086 | });
|
11087 | const compilerOptions = app.config.compilerOptions;
|
11088 | 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.
|
11089 | - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
|
11090 | - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
|
11091 | - 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`;
|
11092 | Object.defineProperty(app.config, "compilerOptions", {
|
11093 | get() {
|
11094 | warn(msg);
|
11095 | return compilerOptions;
|
11096 | },
|
11097 | set() {
|
11098 | warn(msg);
|
11099 | }
|
11100 | });
|
11101 | }
|
11102 | }
|
11103 | function normalizeContainer(container) {
|
11104 | if (isString(container)) {
|
11105 | const res = document.querySelector(container);
|
11106 | if (!res) {
|
11107 | warn(
|
11108 | `Failed to mount app: mount target selector "${container}" returned null.`
|
11109 | );
|
11110 | }
|
11111 | return res;
|
11112 | }
|
11113 | if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
|
11114 | warn(
|
11115 | `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
|
11116 | );
|
11117 | }
|
11118 | return container;
|
11119 | }
|
11120 | const initDirectivesForSSR = NOOP;
|
11121 |
|
11122 | function initDev() {
|
11123 | {
|
11124 | {
|
11125 | console.info(
|
11126 | `You are running a development build of Vue.
|
11127 | Make sure to use the production build (*.prod.js) when deploying for production.`
|
11128 | );
|
11129 | }
|
11130 | initCustomFormatter();
|
11131 | }
|
11132 | }
|
11133 |
|
11134 | {
|
11135 | initDev();
|
11136 | }
|
11137 | const compile = () => {
|
11138 | {
|
11139 | warn(
|
11140 | `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
11141 | );
|
11142 | }
|
11143 | };
|
11144 |
|
11145 | exports.BaseTransition = BaseTransition;
|
11146 | exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
11147 | exports.Comment = Comment;
|
11148 | exports.DeprecationTypes = DeprecationTypes;
|
11149 | exports.EffectScope = EffectScope;
|
11150 | exports.ErrorCodes = ErrorCodes;
|
11151 | exports.ErrorTypeStrings = ErrorTypeStrings;
|
11152 | exports.Fragment = Fragment;
|
11153 | exports.KeepAlive = KeepAlive;
|
11154 | exports.ReactiveEffect = ReactiveEffect;
|
11155 | exports.Static = Static;
|
11156 | exports.Suspense = Suspense;
|
11157 | exports.Teleport = Teleport;
|
11158 | exports.Text = Text;
|
11159 | exports.TrackOpTypes = TrackOpTypes;
|
11160 | exports.Transition = Transition;
|
11161 | exports.TransitionGroup = TransitionGroup;
|
11162 | exports.TriggerOpTypes = TriggerOpTypes;
|
11163 | exports.VueElement = VueElement;
|
11164 | exports.assertNumber = assertNumber;
|
11165 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
11166 | exports.callWithErrorHandling = callWithErrorHandling;
|
11167 | exports.camelize = camelize;
|
11168 | exports.capitalize = capitalize;
|
11169 | exports.cloneVNode = cloneVNode;
|
11170 | exports.compatUtils = compatUtils;
|
11171 | exports.compile = compile;
|
11172 | exports.computed = computed;
|
11173 | exports.createApp = createApp;
|
11174 | exports.createBlock = createBlock;
|
11175 | exports.createCommentVNode = createCommentVNode;
|
11176 | exports.createElementBlock = createElementBlock;
|
11177 | exports.createElementVNode = createBaseVNode;
|
11178 | exports.createHydrationRenderer = createHydrationRenderer;
|
11179 | exports.createPropsRestProxy = createPropsRestProxy;
|
11180 | exports.createRenderer = createRenderer;
|
11181 | exports.createSSRApp = createSSRApp;
|
11182 | exports.createSlots = createSlots;
|
11183 | exports.createStaticVNode = createStaticVNode;
|
11184 | exports.createTextVNode = createTextVNode;
|
11185 | exports.createVNode = createVNode;
|
11186 | exports.customRef = customRef;
|
11187 | exports.defineAsyncComponent = defineAsyncComponent;
|
11188 | exports.defineComponent = defineComponent;
|
11189 | exports.defineCustomElement = defineCustomElement;
|
11190 | exports.defineEmits = defineEmits;
|
11191 | exports.defineExpose = defineExpose;
|
11192 | exports.defineModel = defineModel;
|
11193 | exports.defineOptions = defineOptions;
|
11194 | exports.defineProps = defineProps;
|
11195 | exports.defineSSRCustomElement = defineSSRCustomElement;
|
11196 | exports.defineSlots = defineSlots;
|
11197 | exports.devtools = devtools;
|
11198 | exports.effect = effect;
|
11199 | exports.effectScope = effectScope;
|
11200 | exports.getCurrentInstance = getCurrentInstance;
|
11201 | exports.getCurrentScope = getCurrentScope;
|
11202 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
11203 | exports.guardReactiveProps = guardReactiveProps;
|
11204 | exports.h = h;
|
11205 | exports.handleError = handleError;
|
11206 | exports.hasInjectionContext = hasInjectionContext;
|
11207 | exports.hydrate = hydrate;
|
11208 | exports.initCustomFormatter = initCustomFormatter;
|
11209 | exports.initDirectivesForSSR = initDirectivesForSSR;
|
11210 | exports.inject = inject;
|
11211 | exports.isMemoSame = isMemoSame;
|
11212 | exports.isProxy = isProxy;
|
11213 | exports.isReactive = isReactive;
|
11214 | exports.isReadonly = isReadonly;
|
11215 | exports.isRef = isRef;
|
11216 | exports.isRuntimeOnly = isRuntimeOnly;
|
11217 | exports.isShallow = isShallow;
|
11218 | exports.isVNode = isVNode;
|
11219 | exports.markRaw = markRaw;
|
11220 | exports.mergeDefaults = mergeDefaults;
|
11221 | exports.mergeModels = mergeModels;
|
11222 | exports.mergeProps = mergeProps;
|
11223 | exports.nextTick = nextTick;
|
11224 | exports.normalizeClass = normalizeClass;
|
11225 | exports.normalizeProps = normalizeProps;
|
11226 | exports.normalizeStyle = normalizeStyle;
|
11227 | exports.onActivated = onActivated;
|
11228 | exports.onBeforeMount = onBeforeMount;
|
11229 | exports.onBeforeUnmount = onBeforeUnmount;
|
11230 | exports.onBeforeUpdate = onBeforeUpdate;
|
11231 | exports.onDeactivated = onDeactivated;
|
11232 | exports.onErrorCaptured = onErrorCaptured;
|
11233 | exports.onMounted = onMounted;
|
11234 | exports.onRenderTracked = onRenderTracked;
|
11235 | exports.onRenderTriggered = onRenderTriggered;
|
11236 | exports.onScopeDispose = onScopeDispose;
|
11237 | exports.onServerPrefetch = onServerPrefetch;
|
11238 | exports.onUnmounted = onUnmounted;
|
11239 | exports.onUpdated = onUpdated;
|
11240 | exports.openBlock = openBlock;
|
11241 | exports.popScopeId = popScopeId;
|
11242 | exports.provide = provide;
|
11243 | exports.proxyRefs = proxyRefs;
|
11244 | exports.pushScopeId = pushScopeId;
|
11245 | exports.queuePostFlushCb = queuePostFlushCb;
|
11246 | exports.reactive = reactive;
|
11247 | exports.readonly = readonly;
|
11248 | exports.ref = ref;
|
11249 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
11250 | exports.render = render;
|
11251 | exports.renderList = renderList;
|
11252 | exports.renderSlot = renderSlot;
|
11253 | exports.resolveComponent = resolveComponent;
|
11254 | exports.resolveDirective = resolveDirective;
|
11255 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
11256 | exports.resolveFilter = resolveFilter;
|
11257 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
11258 | exports.setBlockTracking = setBlockTracking;
|
11259 | exports.setDevtoolsHook = setDevtoolsHook;
|
11260 | exports.setTransitionHooks = setTransitionHooks;
|
11261 | exports.shallowReactive = shallowReactive;
|
11262 | exports.shallowReadonly = shallowReadonly;
|
11263 | exports.shallowRef = shallowRef;
|
11264 | exports.ssrContextKey = ssrContextKey;
|
11265 | exports.ssrUtils = ssrUtils;
|
11266 | exports.stop = stop;
|
11267 | exports.toDisplayString = toDisplayString;
|
11268 | exports.toHandlerKey = toHandlerKey;
|
11269 | exports.toHandlers = toHandlers;
|
11270 | exports.toRaw = toRaw;
|
11271 | exports.toRef = toRef;
|
11272 | exports.toRefs = toRefs;
|
11273 | exports.toValue = toValue;
|
11274 | exports.transformVNodeArgs = transformVNodeArgs;
|
11275 | exports.triggerRef = triggerRef;
|
11276 | exports.unref = unref;
|
11277 | exports.useAttrs = useAttrs;
|
11278 | exports.useCssModule = useCssModule;
|
11279 | exports.useCssVars = useCssVars;
|
11280 | exports.useModel = useModel;
|
11281 | exports.useSSRContext = useSSRContext;
|
11282 | exports.useSlots = useSlots;
|
11283 | exports.useTransitionState = useTransitionState;
|
11284 | exports.vModelCheckbox = vModelCheckbox;
|
11285 | exports.vModelDynamic = vModelDynamic;
|
11286 | exports.vModelRadio = vModelRadio;
|
11287 | exports.vModelSelect = vModelSelect;
|
11288 | exports.vModelText = vModelText;
|
11289 | exports.vShow = vShow;
|
11290 | exports.version = version;
|
11291 | exports.warn = warn;
|
11292 | exports.watch = watch;
|
11293 | exports.watchEffect = watchEffect;
|
11294 | exports.watchPostEffect = watchPostEffect;
|
11295 | exports.watchSyncEffect = watchSyncEffect;
|
11296 | exports.withAsyncContext = withAsyncContext;
|
11297 | exports.withCtx = withCtx;
|
11298 | exports.withDefaults = withDefaults;
|
11299 | exports.withDirectives = withDirectives;
|
11300 | exports.withKeys = withKeys;
|
11301 | exports.withMemo = withMemo;
|
11302 | exports.withModifiers = withModifiers;
|
11303 | exports.withScopeId = withScopeId;
|
11304 |
|
11305 | return exports;
|
11306 |
|
11307 | })({});
|