1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var Vue = (function (exports) {
|
7 | 'use strict';
|
8 |
|
9 | function makeMap(str, expectsLowerCase) {
|
10 | const set = new Set(str.split(","));
|
11 | return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
12 | }
|
13 |
|
14 | const EMPTY_OBJ = Object.freeze({}) ;
|
15 | const EMPTY_ARR = Object.freeze([]) ;
|
16 | const NOOP = () => {
|
17 | };
|
18 | const NO = () => false;
|
19 | const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
20 | (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
21 | const isModelListener = (key) => key.startsWith("onUpdate:");
|
22 | const extend = Object.assign;
|
23 | const remove = (arr, el) => {
|
24 | const i = arr.indexOf(el);
|
25 | if (i > -1) {
|
26 | arr.splice(i, 1);
|
27 | }
|
28 | };
|
29 | const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
30 | const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
31 | const isArray = Array.isArray;
|
32 | const isMap = (val) => toTypeString(val) === "[object Map]";
|
33 | const isSet = (val) => toTypeString(val) === "[object Set]";
|
34 | const isDate = (val) => toTypeString(val) === "[object Date]";
|
35 | const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
36 | const isFunction = (val) => typeof val === "function";
|
37 | const isString = (val) => typeof val === "string";
|
38 | const isSymbol = (val) => typeof val === "symbol";
|
39 | const isObject = (val) => val !== null && typeof val === "object";
|
40 | const isPromise = (val) => {
|
41 | return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
42 | };
|
43 | const objectToString = Object.prototype.toString;
|
44 | const toTypeString = (value) => objectToString.call(value);
|
45 | const toRawType = (value) => {
|
46 | return toTypeString(value).slice(8, -1);
|
47 | };
|
48 | const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
49 | const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
50 | const isReservedProp = makeMap(
|
51 |
|
52 | ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
53 | );
|
54 | const isBuiltInDirective = makeMap(
|
55 | "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
56 | );
|
57 | const cacheStringFunction = (fn) => {
|
58 | const cache = Object.create(null);
|
59 | return (str) => {
|
60 | const hit = cache[str];
|
61 | return hit || (cache[str] = fn(str));
|
62 | };
|
63 | };
|
64 | const camelizeRE = /-(\w)/g;
|
65 | const camelize = cacheStringFunction((str) => {
|
66 | return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
67 | });
|
68 | const hyphenateRE = /\B([A-Z])/g;
|
69 | const hyphenate = cacheStringFunction(
|
70 | (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
71 | );
|
72 | const capitalize = cacheStringFunction((str) => {
|
73 | return str.charAt(0).toUpperCase() + str.slice(1);
|
74 | });
|
75 | const toHandlerKey = cacheStringFunction((str) => {
|
76 | const s = str ? `on${capitalize(str)}` : ``;
|
77 | return s;
|
78 | });
|
79 | const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
80 | const invokeArrayFns = (fns, arg) => {
|
81 | for (let i = 0; i < fns.length; i++) {
|
82 | fns[i](arg);
|
83 | }
|
84 | };
|
85 | const def = (obj, key, value) => {
|
86 | Object.defineProperty(obj, key, {
|
87 | configurable: true,
|
88 | enumerable: false,
|
89 | value
|
90 | });
|
91 | };
|
92 | const looseToNumber = (val) => {
|
93 | const n = parseFloat(val);
|
94 | return isNaN(n) ? val : n;
|
95 | };
|
96 | const toNumber = (val) => {
|
97 | const n = isString(val) ? Number(val) : NaN;
|
98 | return isNaN(n) ? val : n;
|
99 | };
|
100 | let _globalThis;
|
101 | const getGlobalThis = () => {
|
102 | return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
103 | };
|
104 |
|
105 | 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";
|
106 | const isGloballyAllowed = makeMap(GLOBALS_ALLOWED);
|
107 |
|
108 | function normalizeStyle(value) {
|
109 | if (isArray(value)) {
|
110 | const res = {};
|
111 | for (let i = 0; i < value.length; i++) {
|
112 | const item = value[i];
|
113 | const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
114 | if (normalized) {
|
115 | for (const key in normalized) {
|
116 | res[key] = normalized[key];
|
117 | }
|
118 | }
|
119 | }
|
120 | return res;
|
121 | } else if (isString(value) || isObject(value)) {
|
122 | return value;
|
123 | }
|
124 | }
|
125 | const listDelimiterRE = /;(?![^(]*\))/g;
|
126 | const propertyDelimiterRE = /:([^]+)/;
|
127 | const styleCommentRE = /\/\*[^]*?\*\//g;
|
128 | function parseStringStyle(cssText) {
|
129 | const ret = {};
|
130 | cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
131 | if (item) {
|
132 | const tmp = item.split(propertyDelimiterRE);
|
133 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
134 | }
|
135 | });
|
136 | return ret;
|
137 | }
|
138 | function stringifyStyle(styles) {
|
139 | let ret = "";
|
140 | if (!styles || isString(styles)) {
|
141 | return ret;
|
142 | }
|
143 | for (const key in styles) {
|
144 | const value = styles[key];
|
145 | const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
146 | if (isString(value) || typeof value === "number") {
|
147 | ret += `${normalizedKey}:${value};`;
|
148 | }
|
149 | }
|
150 | return ret;
|
151 | }
|
152 | function normalizeClass(value) {
|
153 | let res = "";
|
154 | if (isString(value)) {
|
155 | res = value;
|
156 | } else if (isArray(value)) {
|
157 | for (let i = 0; i < value.length; i++) {
|
158 | const normalized = normalizeClass(value[i]);
|
159 | if (normalized) {
|
160 | res += normalized + " ";
|
161 | }
|
162 | }
|
163 | } else if (isObject(value)) {
|
164 | for (const name in value) {
|
165 | if (value[name]) {
|
166 | res += name + " ";
|
167 | }
|
168 | }
|
169 | }
|
170 | return res.trim();
|
171 | }
|
172 | function normalizeProps(props) {
|
173 | if (!props)
|
174 | return null;
|
175 | let { class: klass, style } = props;
|
176 | if (klass && !isString(klass)) {
|
177 | props.class = normalizeClass(klass);
|
178 | }
|
179 | if (style) {
|
180 | props.style = normalizeStyle(style);
|
181 | }
|
182 | return props;
|
183 | }
|
184 |
|
185 | 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";
|
186 | 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";
|
187 | 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";
|
188 | const isHTMLTag = makeMap(HTML_TAGS);
|
189 | const isSVGTag = makeMap(SVG_TAGS);
|
190 | const isMathMLTag = makeMap(MATH_TAGS);
|
191 |
|
192 | const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
193 | const isSpecialBooleanAttr = makeMap(specialBooleanAttrs);
|
194 | const isBooleanAttr = makeMap(
|
195 | specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
196 | );
|
197 | function includeBooleanAttr(value) {
|
198 | return !!value || value === "";
|
199 | }
|
200 | const isKnownHtmlAttr = makeMap(
|
201 | `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`
|
202 | );
|
203 | const isKnownSvgAttr = makeMap(
|
204 | `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`
|
205 | );
|
206 | function isRenderableAttrValue(value) {
|
207 | if (value == null) {
|
208 | return false;
|
209 | }
|
210 | const type = typeof value;
|
211 | return type === "string" || type === "number" || type === "boolean";
|
212 | }
|
213 |
|
214 | function looseCompareArrays(a, b) {
|
215 | if (a.length !== b.length)
|
216 | return false;
|
217 | let equal = true;
|
218 | for (let i = 0; equal && i < a.length; i++) {
|
219 | equal = looseEqual(a[i], b[i]);
|
220 | }
|
221 | return equal;
|
222 | }
|
223 | function looseEqual(a, b) {
|
224 | if (a === b)
|
225 | return true;
|
226 | let aValidType = isDate(a);
|
227 | let bValidType = isDate(b);
|
228 | if (aValidType || bValidType) {
|
229 | return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
230 | }
|
231 | aValidType = isSymbol(a);
|
232 | bValidType = isSymbol(b);
|
233 | if (aValidType || bValidType) {
|
234 | return a === b;
|
235 | }
|
236 | aValidType = isArray(a);
|
237 | bValidType = isArray(b);
|
238 | if (aValidType || bValidType) {
|
239 | return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
240 | }
|
241 | aValidType = isObject(a);
|
242 | bValidType = isObject(b);
|
243 | if (aValidType || bValidType) {
|
244 | if (!aValidType || !bValidType) {
|
245 | return false;
|
246 | }
|
247 | const aKeysCount = Object.keys(a).length;
|
248 | const bKeysCount = Object.keys(b).length;
|
249 | if (aKeysCount !== bKeysCount) {
|
250 | return false;
|
251 | }
|
252 | for (const key in a) {
|
253 | const aHasKey = a.hasOwnProperty(key);
|
254 | const bHasKey = b.hasOwnProperty(key);
|
255 | if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
256 | return false;
|
257 | }
|
258 | }
|
259 | }
|
260 | return String(a) === String(b);
|
261 | }
|
262 | function looseIndexOf(arr, val) {
|
263 | return arr.findIndex((item) => looseEqual(item, val));
|
264 | }
|
265 |
|
266 | const toDisplayString = (val) => {
|
267 | return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
268 | };
|
269 | const replacer = (_key, val) => {
|
270 | if (val && val.__v_isRef) {
|
271 | return replacer(_key, val.value);
|
272 | } else if (isMap(val)) {
|
273 | return {
|
274 | [`Map(${val.size})`]: [...val.entries()].reduce(
|
275 | (entries, [key, val2], i) => {
|
276 | entries[stringifySymbol(key, i) + " =>"] = val2;
|
277 | return entries;
|
278 | },
|
279 | {}
|
280 | )
|
281 | };
|
282 | } else if (isSet(val)) {
|
283 | return {
|
284 | [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
285 | };
|
286 | } else if (isSymbol(val)) {
|
287 | return stringifySymbol(val);
|
288 | } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
289 | return String(val);
|
290 | }
|
291 | return val;
|
292 | };
|
293 | const stringifySymbol = (v, i = "") => {
|
294 | var _a;
|
295 | return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
296 | };
|
297 |
|
298 | function warn$2(msg, ...args) {
|
299 | console.warn(`[Vue warn] ${msg}`, ...args);
|
300 | }
|
301 |
|
302 | let activeEffectScope;
|
303 | class EffectScope {
|
304 | constructor(detached = false) {
|
305 | this.detached = detached;
|
306 | |
307 |
|
308 |
|
309 | this._active = true;
|
310 | |
311 |
|
312 |
|
313 | this.effects = [];
|
314 | |
315 |
|
316 |
|
317 | this.cleanups = [];
|
318 | this.parent = activeEffectScope;
|
319 | if (!detached && activeEffectScope) {
|
320 | this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
321 | this
|
322 | ) - 1;
|
323 | }
|
324 | }
|
325 | get active() {
|
326 | return this._active;
|
327 | }
|
328 | run(fn) {
|
329 | if (this._active) {
|
330 | const currentEffectScope = activeEffectScope;
|
331 | try {
|
332 | activeEffectScope = this;
|
333 | return fn();
|
334 | } finally {
|
335 | activeEffectScope = currentEffectScope;
|
336 | }
|
337 | } else {
|
338 | warn$2(`cannot run an inactive effect scope.`);
|
339 | }
|
340 | }
|
341 | |
342 |
|
343 |
|
344 |
|
345 | on() {
|
346 | activeEffectScope = this;
|
347 | }
|
348 | |
349 |
|
350 |
|
351 |
|
352 | off() {
|
353 | activeEffectScope = this.parent;
|
354 | }
|
355 | stop(fromParent) {
|
356 | if (this._active) {
|
357 | let i, l;
|
358 | for (i = 0, l = this.effects.length; i < l; i++) {
|
359 | this.effects[i].stop();
|
360 | }
|
361 | for (i = 0, l = this.cleanups.length; i < l; i++) {
|
362 | this.cleanups[i]();
|
363 | }
|
364 | if (this.scopes) {
|
365 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
366 | this.scopes[i].stop(true);
|
367 | }
|
368 | }
|
369 | if (!this.detached && this.parent && !fromParent) {
|
370 | const last = this.parent.scopes.pop();
|
371 | if (last && last !== this) {
|
372 | this.parent.scopes[this.index] = last;
|
373 | last.index = this.index;
|
374 | }
|
375 | }
|
376 | this.parent = void 0;
|
377 | this._active = false;
|
378 | }
|
379 | }
|
380 | }
|
381 | function effectScope(detached) {
|
382 | return new EffectScope(detached);
|
383 | }
|
384 | function recordEffectScope(effect, scope = activeEffectScope) {
|
385 | if (scope && scope.active) {
|
386 | scope.effects.push(effect);
|
387 | }
|
388 | }
|
389 | function getCurrentScope() {
|
390 | return activeEffectScope;
|
391 | }
|
392 | function onScopeDispose(fn) {
|
393 | if (activeEffectScope) {
|
394 | activeEffectScope.cleanups.push(fn);
|
395 | } else {
|
396 | warn$2(
|
397 | `onScopeDispose() is called when there is no active effect scope to be associated with.`
|
398 | );
|
399 | }
|
400 | }
|
401 |
|
402 | let activeEffect;
|
403 | class ReactiveEffect {
|
404 | constructor(fn, trigger, scheduler, scope) {
|
405 | this.fn = fn;
|
406 | this.trigger = trigger;
|
407 | this.scheduler = scheduler;
|
408 | this.active = true;
|
409 | this.deps = [];
|
410 | |
411 |
|
412 |
|
413 | this._dirtyLevel = 4;
|
414 | |
415 |
|
416 |
|
417 | this._trackId = 0;
|
418 | |
419 |
|
420 |
|
421 | this._runnings = 0;
|
422 | |
423 |
|
424 |
|
425 | this._shouldSchedule = false;
|
426 | |
427 |
|
428 |
|
429 | this._depsLength = 0;
|
430 | recordEffectScope(this, scope);
|
431 | }
|
432 | get dirty() {
|
433 | if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
434 | this._dirtyLevel = 1;
|
435 | pauseTracking();
|
436 | for (let i = 0; i < this._depsLength; i++) {
|
437 | const dep = this.deps[i];
|
438 | if (dep.computed) {
|
439 | triggerComputed(dep.computed);
|
440 | if (this._dirtyLevel >= 4) {
|
441 | break;
|
442 | }
|
443 | }
|
444 | }
|
445 | if (this._dirtyLevel === 1) {
|
446 | this._dirtyLevel = 0;
|
447 | }
|
448 | resetTracking();
|
449 | }
|
450 | return this._dirtyLevel >= 4;
|
451 | }
|
452 | set dirty(v) {
|
453 | this._dirtyLevel = v ? 4 : 0;
|
454 | }
|
455 | run() {
|
456 | this._dirtyLevel = 0;
|
457 | if (!this.active) {
|
458 | return this.fn();
|
459 | }
|
460 | let lastShouldTrack = shouldTrack;
|
461 | let lastEffect = activeEffect;
|
462 | try {
|
463 | shouldTrack = true;
|
464 | activeEffect = this;
|
465 | this._runnings++;
|
466 | preCleanupEffect(this);
|
467 | return this.fn();
|
468 | } finally {
|
469 | postCleanupEffect(this);
|
470 | this._runnings--;
|
471 | activeEffect = lastEffect;
|
472 | shouldTrack = lastShouldTrack;
|
473 | }
|
474 | }
|
475 | stop() {
|
476 | var _a;
|
477 | if (this.active) {
|
478 | preCleanupEffect(this);
|
479 | postCleanupEffect(this);
|
480 | (_a = this.onStop) == null ? void 0 : _a.call(this);
|
481 | this.active = false;
|
482 | }
|
483 | }
|
484 | }
|
485 | function triggerComputed(computed) {
|
486 | return computed.value;
|
487 | }
|
488 | function preCleanupEffect(effect2) {
|
489 | effect2._trackId++;
|
490 | effect2._depsLength = 0;
|
491 | }
|
492 | function postCleanupEffect(effect2) {
|
493 | if (effect2.deps.length > effect2._depsLength) {
|
494 | for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
495 | cleanupDepEffect(effect2.deps[i], effect2);
|
496 | }
|
497 | effect2.deps.length = effect2._depsLength;
|
498 | }
|
499 | }
|
500 | function cleanupDepEffect(dep, effect2) {
|
501 | const trackId = dep.get(effect2);
|
502 | if (trackId !== void 0 && effect2._trackId !== trackId) {
|
503 | dep.delete(effect2);
|
504 | if (dep.size === 0) {
|
505 | dep.cleanup();
|
506 | }
|
507 | }
|
508 | }
|
509 | function effect(fn, options) {
|
510 | if (fn.effect instanceof ReactiveEffect) {
|
511 | fn = fn.effect.fn;
|
512 | }
|
513 | const _effect = new ReactiveEffect(fn, NOOP, () => {
|
514 | if (_effect.dirty) {
|
515 | _effect.run();
|
516 | }
|
517 | });
|
518 | if (options) {
|
519 | extend(_effect, options);
|
520 | if (options.scope)
|
521 | recordEffectScope(_effect, options.scope);
|
522 | }
|
523 | if (!options || !options.lazy) {
|
524 | _effect.run();
|
525 | }
|
526 | const runner = _effect.run.bind(_effect);
|
527 | runner.effect = _effect;
|
528 | return runner;
|
529 | }
|
530 | function stop(runner) {
|
531 | runner.effect.stop();
|
532 | }
|
533 | let shouldTrack = true;
|
534 | let pauseScheduleStack = 0;
|
535 | const trackStack = [];
|
536 | function pauseTracking() {
|
537 | trackStack.push(shouldTrack);
|
538 | shouldTrack = false;
|
539 | }
|
540 | function resetTracking() {
|
541 | const last = trackStack.pop();
|
542 | shouldTrack = last === void 0 ? true : last;
|
543 | }
|
544 | function pauseScheduling() {
|
545 | pauseScheduleStack++;
|
546 | }
|
547 | function resetScheduling() {
|
548 | pauseScheduleStack--;
|
549 | while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
550 | queueEffectSchedulers.shift()();
|
551 | }
|
552 | }
|
553 | function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
554 | var _a;
|
555 | if (dep.get(effect2) !== effect2._trackId) {
|
556 | dep.set(effect2, effect2._trackId);
|
557 | const oldDep = effect2.deps[effect2._depsLength];
|
558 | if (oldDep !== dep) {
|
559 | if (oldDep) {
|
560 | cleanupDepEffect(oldDep, effect2);
|
561 | }
|
562 | effect2.deps[effect2._depsLength++] = dep;
|
563 | } else {
|
564 | effect2._depsLength++;
|
565 | }
|
566 | {
|
567 | (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
568 | }
|
569 | }
|
570 | }
|
571 | const queueEffectSchedulers = [];
|
572 | function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
573 | var _a;
|
574 | pauseScheduling();
|
575 | for (const effect2 of dep.keys()) {
|
576 | let tracking;
|
577 | if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
578 | effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
|
579 | effect2._dirtyLevel = dirtyLevel;
|
580 | }
|
581 | if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
582 | {
|
583 | (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
584 | }
|
585 | effect2.trigger();
|
586 | if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
|
587 | effect2._shouldSchedule = false;
|
588 | if (effect2.scheduler) {
|
589 | queueEffectSchedulers.push(effect2.scheduler);
|
590 | }
|
591 | }
|
592 | }
|
593 | }
|
594 | resetScheduling();
|
595 | }
|
596 |
|
597 | const createDep = (cleanup, computed) => {
|
598 | const dep = new Map();
|
599 | dep.cleanup = cleanup;
|
600 | dep.computed = computed;
|
601 | return dep;
|
602 | };
|
603 |
|
604 | const targetMap = new WeakMap();
|
605 | const ITERATE_KEY = Symbol("iterate" );
|
606 | const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
607 | function track(target, type, key) {
|
608 | if (shouldTrack && activeEffect) {
|
609 | let depsMap = targetMap.get(target);
|
610 | if (!depsMap) {
|
611 | targetMap.set(target, depsMap = new Map());
|
612 | }
|
613 | let dep = depsMap.get(key);
|
614 | if (!dep) {
|
615 | depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
616 | }
|
617 | trackEffect(
|
618 | activeEffect,
|
619 | dep,
|
620 | {
|
621 | target,
|
622 | type,
|
623 | key
|
624 | }
|
625 | );
|
626 | }
|
627 | }
|
628 | function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
629 | const depsMap = targetMap.get(target);
|
630 | if (!depsMap) {
|
631 | return;
|
632 | }
|
633 | let deps = [];
|
634 | if (type === "clear") {
|
635 | deps = [...depsMap.values()];
|
636 | } else if (key === "length" && isArray(target)) {
|
637 | const newLength = Number(newValue);
|
638 | depsMap.forEach((dep, key2) => {
|
639 | if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
640 | deps.push(dep);
|
641 | }
|
642 | });
|
643 | } else {
|
644 | if (key !== void 0) {
|
645 | deps.push(depsMap.get(key));
|
646 | }
|
647 | switch (type) {
|
648 | case "add":
|
649 | if (!isArray(target)) {
|
650 | deps.push(depsMap.get(ITERATE_KEY));
|
651 | if (isMap(target)) {
|
652 | deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
653 | }
|
654 | } else if (isIntegerKey(key)) {
|
655 | deps.push(depsMap.get("length"));
|
656 | }
|
657 | break;
|
658 | case "delete":
|
659 | if (!isArray(target)) {
|
660 | deps.push(depsMap.get(ITERATE_KEY));
|
661 | if (isMap(target)) {
|
662 | deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
663 | }
|
664 | }
|
665 | break;
|
666 | case "set":
|
667 | if (isMap(target)) {
|
668 | deps.push(depsMap.get(ITERATE_KEY));
|
669 | }
|
670 | break;
|
671 | }
|
672 | }
|
673 | pauseScheduling();
|
674 | for (const dep of deps) {
|
675 | if (dep) {
|
676 | triggerEffects(
|
677 | dep,
|
678 | 4,
|
679 | {
|
680 | target,
|
681 | type,
|
682 | key,
|
683 | newValue,
|
684 | oldValue,
|
685 | oldTarget
|
686 | }
|
687 | );
|
688 | }
|
689 | }
|
690 | resetScheduling();
|
691 | }
|
692 | function getDepFromReactive(object, key) {
|
693 | var _a;
|
694 | return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
695 | }
|
696 |
|
697 | const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`);
|
698 | const builtInSymbols = new Set(
|
699 | Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
700 | );
|
701 | const arrayInstrumentations = createArrayInstrumentations();
|
702 | function createArrayInstrumentations() {
|
703 | const instrumentations = {};
|
704 | ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
705 | instrumentations[key] = function(...args) {
|
706 | const arr = toRaw(this);
|
707 | for (let i = 0, l = this.length; i < l; i++) {
|
708 | track(arr, "get", i + "");
|
709 | }
|
710 | const res = arr[key](...args);
|
711 | if (res === -1 || res === false) {
|
712 | return arr[key](...args.map(toRaw));
|
713 | } else {
|
714 | return res;
|
715 | }
|
716 | };
|
717 | });
|
718 | ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
719 | instrumentations[key] = function(...args) {
|
720 | pauseTracking();
|
721 | pauseScheduling();
|
722 | const res = toRaw(this)[key].apply(this, args);
|
723 | resetScheduling();
|
724 | resetTracking();
|
725 | return res;
|
726 | };
|
727 | });
|
728 | return instrumentations;
|
729 | }
|
730 | function hasOwnProperty(key) {
|
731 | const obj = toRaw(this);
|
732 | track(obj, "has", key);
|
733 | return obj.hasOwnProperty(key);
|
734 | }
|
735 | class BaseReactiveHandler {
|
736 | constructor(_isReadonly = false, _isShallow = false) {
|
737 | this._isReadonly = _isReadonly;
|
738 | this._isShallow = _isShallow;
|
739 | }
|
740 | get(target, key, receiver) {
|
741 | const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
742 | if (key === "__v_isReactive") {
|
743 | return !isReadonly2;
|
744 | } else if (key === "__v_isReadonly") {
|
745 | return isReadonly2;
|
746 | } else if (key === "__v_isShallow") {
|
747 | return isShallow2;
|
748 | } else if (key === "__v_raw") {
|
749 | if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) ||
|
750 |
|
751 | Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
752 | return target;
|
753 | }
|
754 | return;
|
755 | }
|
756 | const targetIsArray = isArray(target);
|
757 | if (!isReadonly2) {
|
758 | if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
759 | return Reflect.get(arrayInstrumentations, key, receiver);
|
760 | }
|
761 | if (key === "hasOwnProperty") {
|
762 | return hasOwnProperty;
|
763 | }
|
764 | }
|
765 | const res = Reflect.get(target, key, receiver);
|
766 | if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
767 | return res;
|
768 | }
|
769 | if (!isReadonly2) {
|
770 | track(target, "get", key);
|
771 | }
|
772 | if (isShallow2) {
|
773 | return res;
|
774 | }
|
775 | if (isRef(res)) {
|
776 | return targetIsArray && isIntegerKey(key) ? res : res.value;
|
777 | }
|
778 | if (isObject(res)) {
|
779 | return isReadonly2 ? readonly(res) : reactive(res);
|
780 | }
|
781 | return res;
|
782 | }
|
783 | }
|
784 | class MutableReactiveHandler extends BaseReactiveHandler {
|
785 | constructor(isShallow2 = false) {
|
786 | super(false, isShallow2);
|
787 | }
|
788 | set(target, key, value, receiver) {
|
789 | let oldValue = target[key];
|
790 | if (!this._isShallow) {
|
791 | const isOldValueReadonly = isReadonly(oldValue);
|
792 | if (!isShallow(value) && !isReadonly(value)) {
|
793 | oldValue = toRaw(oldValue);
|
794 | value = toRaw(value);
|
795 | }
|
796 | if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
797 | if (isOldValueReadonly) {
|
798 | return false;
|
799 | } else {
|
800 | oldValue.value = value;
|
801 | return true;
|
802 | }
|
803 | }
|
804 | }
|
805 | const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
806 | const result = Reflect.set(target, key, value, receiver);
|
807 | if (target === toRaw(receiver)) {
|
808 | if (!hadKey) {
|
809 | trigger(target, "add", key, value);
|
810 | } else if (hasChanged(value, oldValue)) {
|
811 | trigger(target, "set", key, value, oldValue);
|
812 | }
|
813 | }
|
814 | return result;
|
815 | }
|
816 | deleteProperty(target, key) {
|
817 | const hadKey = hasOwn(target, key);
|
818 | const oldValue = target[key];
|
819 | const result = Reflect.deleteProperty(target, key);
|
820 | if (result && hadKey) {
|
821 | trigger(target, "delete", key, void 0, oldValue);
|
822 | }
|
823 | return result;
|
824 | }
|
825 | has(target, key) {
|
826 | const result = Reflect.has(target, key);
|
827 | if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
828 | track(target, "has", key);
|
829 | }
|
830 | return result;
|
831 | }
|
832 | ownKeys(target) {
|
833 | track(
|
834 | target,
|
835 | "iterate",
|
836 | isArray(target) ? "length" : ITERATE_KEY
|
837 | );
|
838 | return Reflect.ownKeys(target);
|
839 | }
|
840 | }
|
841 | class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
842 | constructor(isShallow2 = false) {
|
843 | super(true, isShallow2);
|
844 | }
|
845 | set(target, key) {
|
846 | {
|
847 | warn$2(
|
848 | `Set operation on key "${String(key)}" failed: target is readonly.`,
|
849 | target
|
850 | );
|
851 | }
|
852 | return true;
|
853 | }
|
854 | deleteProperty(target, key) {
|
855 | {
|
856 | warn$2(
|
857 | `Delete operation on key "${String(key)}" failed: target is readonly.`,
|
858 | target
|
859 | );
|
860 | }
|
861 | return true;
|
862 | }
|
863 | }
|
864 | const mutableHandlers = new MutableReactiveHandler();
|
865 | const readonlyHandlers = new ReadonlyReactiveHandler();
|
866 | const shallowReactiveHandlers = new MutableReactiveHandler(
|
867 | true
|
868 | );
|
869 | const shallowReadonlyHandlers = new ReadonlyReactiveHandler(true);
|
870 |
|
871 | const toShallow = (value) => value;
|
872 | const getProto = (v) => Reflect.getPrototypeOf(v);
|
873 | function get(target, key, isReadonly = false, isShallow = false) {
|
874 | target = target["__v_raw"];
|
875 | const rawTarget = toRaw(target);
|
876 | const rawKey = toRaw(key);
|
877 | if (!isReadonly) {
|
878 | if (hasChanged(key, rawKey)) {
|
879 | track(rawTarget, "get", key);
|
880 | }
|
881 | track(rawTarget, "get", rawKey);
|
882 | }
|
883 | const { has: has2 } = getProto(rawTarget);
|
884 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
885 | if (has2.call(rawTarget, key)) {
|
886 | return wrap(target.get(key));
|
887 | } else if (has2.call(rawTarget, rawKey)) {
|
888 | return wrap(target.get(rawKey));
|
889 | } else if (target !== rawTarget) {
|
890 | target.get(key);
|
891 | }
|
892 | }
|
893 | function has(key, isReadonly = false) {
|
894 | const target = this["__v_raw"];
|
895 | const rawTarget = toRaw(target);
|
896 | const rawKey = toRaw(key);
|
897 | if (!isReadonly) {
|
898 | if (hasChanged(key, rawKey)) {
|
899 | track(rawTarget, "has", key);
|
900 | }
|
901 | track(rawTarget, "has", rawKey);
|
902 | }
|
903 | return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
904 | }
|
905 | function size(target, isReadonly = false) {
|
906 | target = target["__v_raw"];
|
907 | !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
908 | return Reflect.get(target, "size", target);
|
909 | }
|
910 | function add(value) {
|
911 | value = toRaw(value);
|
912 | const target = toRaw(this);
|
913 | const proto = getProto(target);
|
914 | const hadKey = proto.has.call(target, value);
|
915 | if (!hadKey) {
|
916 | target.add(value);
|
917 | trigger(target, "add", value, value);
|
918 | }
|
919 | return this;
|
920 | }
|
921 | function set(key, value) {
|
922 | value = toRaw(value);
|
923 | const target = toRaw(this);
|
924 | const { has: has2, get: get2 } = getProto(target);
|
925 | let hadKey = has2.call(target, key);
|
926 | if (!hadKey) {
|
927 | key = toRaw(key);
|
928 | hadKey = has2.call(target, key);
|
929 | } else {
|
930 | checkIdentityKeys(target, has2, key);
|
931 | }
|
932 | const oldValue = get2.call(target, key);
|
933 | target.set(key, value);
|
934 | if (!hadKey) {
|
935 | trigger(target, "add", key, value);
|
936 | } else if (hasChanged(value, oldValue)) {
|
937 | trigger(target, "set", key, value, oldValue);
|
938 | }
|
939 | return this;
|
940 | }
|
941 | function deleteEntry(key) {
|
942 | const target = toRaw(this);
|
943 | const { has: has2, get: get2 } = getProto(target);
|
944 | let hadKey = has2.call(target, key);
|
945 | if (!hadKey) {
|
946 | key = toRaw(key);
|
947 | hadKey = has2.call(target, key);
|
948 | } else {
|
949 | checkIdentityKeys(target, has2, key);
|
950 | }
|
951 | const oldValue = get2 ? get2.call(target, key) : void 0;
|
952 | const result = target.delete(key);
|
953 | if (hadKey) {
|
954 | trigger(target, "delete", key, void 0, oldValue);
|
955 | }
|
956 | return result;
|
957 | }
|
958 | function clear() {
|
959 | const target = toRaw(this);
|
960 | const hadItems = target.size !== 0;
|
961 | const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
|
962 | const result = target.clear();
|
963 | if (hadItems) {
|
964 | trigger(target, "clear", void 0, void 0, oldTarget);
|
965 | }
|
966 | return result;
|
967 | }
|
968 | function createForEach(isReadonly, isShallow) {
|
969 | return function forEach(callback, thisArg) {
|
970 | const observed = this;
|
971 | const target = observed["__v_raw"];
|
972 | const rawTarget = toRaw(target);
|
973 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
974 | !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
|
975 | return target.forEach((value, key) => {
|
976 | return callback.call(thisArg, wrap(value), wrap(key), observed);
|
977 | });
|
978 | };
|
979 | }
|
980 | function createIterableMethod(method, isReadonly, isShallow) {
|
981 | return function(...args) {
|
982 | const target = this["__v_raw"];
|
983 | const rawTarget = toRaw(target);
|
984 | const targetIsMap = isMap(rawTarget);
|
985 | const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
986 | const isKeyOnly = method === "keys" && targetIsMap;
|
987 | const innerIterator = target[method](...args);
|
988 | const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
989 | !isReadonly && track(
|
990 | rawTarget,
|
991 | "iterate",
|
992 | isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
993 | );
|
994 | return {
|
995 |
|
996 | next() {
|
997 | const { value, done } = innerIterator.next();
|
998 | return done ? { value, done } : {
|
999 | value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
1000 | done
|
1001 | };
|
1002 | },
|
1003 |
|
1004 | [Symbol.iterator]() {
|
1005 | return this;
|
1006 | }
|
1007 | };
|
1008 | };
|
1009 | }
|
1010 | function createReadonlyMethod(type) {
|
1011 | return function(...args) {
|
1012 | {
|
1013 | const key = args[0] ? `on key "${args[0]}" ` : ``;
|
1014 | warn$2(
|
1015 | `${capitalize(type)} operation ${key}failed: target is readonly.`,
|
1016 | toRaw(this)
|
1017 | );
|
1018 | }
|
1019 | return type === "delete" ? false : type === "clear" ? void 0 : this;
|
1020 | };
|
1021 | }
|
1022 | function createInstrumentations() {
|
1023 | const mutableInstrumentations2 = {
|
1024 | get(key) {
|
1025 | return get(this, key);
|
1026 | },
|
1027 | get size() {
|
1028 | return size(this);
|
1029 | },
|
1030 | has,
|
1031 | add,
|
1032 | set,
|
1033 | delete: deleteEntry,
|
1034 | clear,
|
1035 | forEach: createForEach(false, false)
|
1036 | };
|
1037 | const shallowInstrumentations2 = {
|
1038 | get(key) {
|
1039 | return get(this, key, false, true);
|
1040 | },
|
1041 | get size() {
|
1042 | return size(this);
|
1043 | },
|
1044 | has,
|
1045 | add,
|
1046 | set,
|
1047 | delete: deleteEntry,
|
1048 | clear,
|
1049 | forEach: createForEach(false, true)
|
1050 | };
|
1051 | const readonlyInstrumentations2 = {
|
1052 | get(key) {
|
1053 | return get(this, key, true);
|
1054 | },
|
1055 | get size() {
|
1056 | return size(this, true);
|
1057 | },
|
1058 | has(key) {
|
1059 | return has.call(this, key, true);
|
1060 | },
|
1061 | add: createReadonlyMethod("add"),
|
1062 | set: createReadonlyMethod("set"),
|
1063 | delete: createReadonlyMethod("delete"),
|
1064 | clear: createReadonlyMethod("clear"),
|
1065 | forEach: createForEach(true, false)
|
1066 | };
|
1067 | const shallowReadonlyInstrumentations2 = {
|
1068 | get(key) {
|
1069 | return get(this, key, true, true);
|
1070 | },
|
1071 | get size() {
|
1072 | return size(this, true);
|
1073 | },
|
1074 | has(key) {
|
1075 | return has.call(this, key, true);
|
1076 | },
|
1077 | add: createReadonlyMethod("add"),
|
1078 | set: createReadonlyMethod("set"),
|
1079 | delete: createReadonlyMethod("delete"),
|
1080 | clear: createReadonlyMethod("clear"),
|
1081 | forEach: createForEach(true, true)
|
1082 | };
|
1083 | const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
|
1084 | iteratorMethods.forEach((method) => {
|
1085 | mutableInstrumentations2[method] = createIterableMethod(
|
1086 | method,
|
1087 | false,
|
1088 | false
|
1089 | );
|
1090 | readonlyInstrumentations2[method] = createIterableMethod(
|
1091 | method,
|
1092 | true,
|
1093 | false
|
1094 | );
|
1095 | shallowInstrumentations2[method] = createIterableMethod(
|
1096 | method,
|
1097 | false,
|
1098 | true
|
1099 | );
|
1100 | shallowReadonlyInstrumentations2[method] = createIterableMethod(
|
1101 | method,
|
1102 | true,
|
1103 | true
|
1104 | );
|
1105 | });
|
1106 | return [
|
1107 | mutableInstrumentations2,
|
1108 | readonlyInstrumentations2,
|
1109 | shallowInstrumentations2,
|
1110 | shallowReadonlyInstrumentations2
|
1111 | ];
|
1112 | }
|
1113 | const [
|
1114 | mutableInstrumentations,
|
1115 | readonlyInstrumentations,
|
1116 | shallowInstrumentations,
|
1117 | shallowReadonlyInstrumentations
|
1118 | ] = createInstrumentations();
|
1119 | function createInstrumentationGetter(isReadonly, shallow) {
|
1120 | const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
|
1121 | return (target, key, receiver) => {
|
1122 | if (key === "__v_isReactive") {
|
1123 | return !isReadonly;
|
1124 | } else if (key === "__v_isReadonly") {
|
1125 | return isReadonly;
|
1126 | } else if (key === "__v_raw") {
|
1127 | return target;
|
1128 | }
|
1129 | return Reflect.get(
|
1130 | hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
1131 | key,
|
1132 | receiver
|
1133 | );
|
1134 | };
|
1135 | }
|
1136 | const mutableCollectionHandlers = {
|
1137 | get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
1138 | };
|
1139 | const shallowCollectionHandlers = {
|
1140 | get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
1141 | };
|
1142 | const readonlyCollectionHandlers = {
|
1143 | get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
1144 | };
|
1145 | const shallowReadonlyCollectionHandlers = {
|
1146 | get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
1147 | };
|
1148 | function checkIdentityKeys(target, has2, key) {
|
1149 | const rawKey = toRaw(key);
|
1150 | if (rawKey !== key && has2.call(target, rawKey)) {
|
1151 | const type = toRawType(target);
|
1152 | warn$2(
|
1153 | `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.`
|
1154 | );
|
1155 | }
|
1156 | }
|
1157 |
|
1158 | const reactiveMap = new WeakMap();
|
1159 | const shallowReactiveMap = new WeakMap();
|
1160 | const readonlyMap = new WeakMap();
|
1161 | const shallowReadonlyMap = new WeakMap();
|
1162 | function targetTypeMap(rawType) {
|
1163 | switch (rawType) {
|
1164 | case "Object":
|
1165 | case "Array":
|
1166 | return 1 ;
|
1167 | case "Map":
|
1168 | case "Set":
|
1169 | case "WeakMap":
|
1170 | case "WeakSet":
|
1171 | return 2 ;
|
1172 | default:
|
1173 | return 0 ;
|
1174 | }
|
1175 | }
|
1176 | function getTargetType(value) {
|
1177 | return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
1178 | }
|
1179 | function reactive(target) {
|
1180 | if (isReadonly(target)) {
|
1181 | return target;
|
1182 | }
|
1183 | return createReactiveObject(
|
1184 | target,
|
1185 | false,
|
1186 | mutableHandlers,
|
1187 | mutableCollectionHandlers,
|
1188 | reactiveMap
|
1189 | );
|
1190 | }
|
1191 | function shallowReactive(target) {
|
1192 | return createReactiveObject(
|
1193 | target,
|
1194 | false,
|
1195 | shallowReactiveHandlers,
|
1196 | shallowCollectionHandlers,
|
1197 | shallowReactiveMap
|
1198 | );
|
1199 | }
|
1200 | function readonly(target) {
|
1201 | return createReactiveObject(
|
1202 | target,
|
1203 | true,
|
1204 | readonlyHandlers,
|
1205 | readonlyCollectionHandlers,
|
1206 | readonlyMap
|
1207 | );
|
1208 | }
|
1209 | function shallowReadonly(target) {
|
1210 | return createReactiveObject(
|
1211 | target,
|
1212 | true,
|
1213 | shallowReadonlyHandlers,
|
1214 | shallowReadonlyCollectionHandlers,
|
1215 | shallowReadonlyMap
|
1216 | );
|
1217 | }
|
1218 | function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
1219 | if (!isObject(target)) {
|
1220 | {
|
1221 | warn$2(`value cannot be made reactive: ${String(target)}`);
|
1222 | }
|
1223 | return target;
|
1224 | }
|
1225 | if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
1226 | return target;
|
1227 | }
|
1228 | const existingProxy = proxyMap.get(target);
|
1229 | if (existingProxy) {
|
1230 | return existingProxy;
|
1231 | }
|
1232 | const targetType = getTargetType(target);
|
1233 | if (targetType === 0 ) {
|
1234 | return target;
|
1235 | }
|
1236 | const proxy = new Proxy(
|
1237 | target,
|
1238 | targetType === 2 ? collectionHandlers : baseHandlers
|
1239 | );
|
1240 | proxyMap.set(target, proxy);
|
1241 | return proxy;
|
1242 | }
|
1243 | function isReactive(value) {
|
1244 | if (isReadonly(value)) {
|
1245 | return isReactive(value["__v_raw"]);
|
1246 | }
|
1247 | return !!(value && value["__v_isReactive"]);
|
1248 | }
|
1249 | function isReadonly(value) {
|
1250 | return !!(value && value["__v_isReadonly"]);
|
1251 | }
|
1252 | function isShallow(value) {
|
1253 | return !!(value && value["__v_isShallow"]);
|
1254 | }
|
1255 | function isProxy(value) {
|
1256 | return isReactive(value) || isReadonly(value);
|
1257 | }
|
1258 | function toRaw(observed) {
|
1259 | const raw = observed && observed["__v_raw"];
|
1260 | return raw ? toRaw(raw) : observed;
|
1261 | }
|
1262 | function markRaw(value) {
|
1263 | if (Object.isExtensible(value)) {
|
1264 | def(value, "__v_skip", true);
|
1265 | }
|
1266 | return value;
|
1267 | }
|
1268 | const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
1269 | const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
1270 |
|
1271 | 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`;
|
1272 | class ComputedRefImpl {
|
1273 | constructor(getter, _setter, isReadonly, isSSR) {
|
1274 | this.getter = getter;
|
1275 | this._setter = _setter;
|
1276 | this.dep = void 0;
|
1277 | this.__v_isRef = true;
|
1278 | this["__v_isReadonly"] = false;
|
1279 | this.effect = new ReactiveEffect(
|
1280 | () => getter(this._value),
|
1281 | () => triggerRefValue(
|
1282 | this,
|
1283 | this.effect._dirtyLevel === 2 ? 2 : 3
|
1284 | )
|
1285 | );
|
1286 | this.effect.computed = this;
|
1287 | this.effect.active = this._cacheable = !isSSR;
|
1288 | this["__v_isReadonly"] = isReadonly;
|
1289 | }
|
1290 | get value() {
|
1291 | const self = toRaw(this);
|
1292 | if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
1293 | triggerRefValue(self, 4);
|
1294 | }
|
1295 | trackRefValue(self);
|
1296 | if (self.effect._dirtyLevel >= 2) {
|
1297 | if (this._warnRecursive) {
|
1298 | warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
1299 |
|
1300 | getter: `, this.getter);
|
1301 | }
|
1302 | triggerRefValue(self, 2);
|
1303 | }
|
1304 | return self._value;
|
1305 | }
|
1306 | set value(newValue) {
|
1307 | this._setter(newValue);
|
1308 | }
|
1309 |
|
1310 | get _dirty() {
|
1311 | return this.effect.dirty;
|
1312 | }
|
1313 | set _dirty(v) {
|
1314 | this.effect.dirty = v;
|
1315 | }
|
1316 |
|
1317 | }
|
1318 | function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
1319 | let getter;
|
1320 | let setter;
|
1321 | const onlyGetter = isFunction(getterOrOptions);
|
1322 | if (onlyGetter) {
|
1323 | getter = getterOrOptions;
|
1324 | setter = () => {
|
1325 | warn$2("Write operation failed: computed value is readonly");
|
1326 | } ;
|
1327 | } else {
|
1328 | getter = getterOrOptions.get;
|
1329 | setter = getterOrOptions.set;
|
1330 | }
|
1331 | const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
1332 | if (debugOptions && !isSSR) {
|
1333 | cRef.effect.onTrack = debugOptions.onTrack;
|
1334 | cRef.effect.onTrigger = debugOptions.onTrigger;
|
1335 | }
|
1336 | return cRef;
|
1337 | }
|
1338 |
|
1339 | function trackRefValue(ref2) {
|
1340 | var _a;
|
1341 | if (shouldTrack && activeEffect) {
|
1342 | ref2 = toRaw(ref2);
|
1343 | trackEffect(
|
1344 | activeEffect,
|
1345 | (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
1346 | () => ref2.dep = void 0,
|
1347 | ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
1348 | ),
|
1349 | {
|
1350 | target: ref2,
|
1351 | type: "get",
|
1352 | key: "value"
|
1353 | }
|
1354 | );
|
1355 | }
|
1356 | }
|
1357 | function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
1358 | ref2 = toRaw(ref2);
|
1359 | const dep = ref2.dep;
|
1360 | if (dep) {
|
1361 | triggerEffects(
|
1362 | dep,
|
1363 | dirtyLevel,
|
1364 | {
|
1365 | target: ref2,
|
1366 | type: "set",
|
1367 | key: "value",
|
1368 | newValue: newVal
|
1369 | }
|
1370 | );
|
1371 | }
|
1372 | }
|
1373 | function isRef(r) {
|
1374 | return !!(r && r.__v_isRef === true);
|
1375 | }
|
1376 | function ref(value) {
|
1377 | return createRef(value, false);
|
1378 | }
|
1379 | function shallowRef(value) {
|
1380 | return createRef(value, true);
|
1381 | }
|
1382 | function createRef(rawValue, shallow) {
|
1383 | if (isRef(rawValue)) {
|
1384 | return rawValue;
|
1385 | }
|
1386 | return new RefImpl(rawValue, shallow);
|
1387 | }
|
1388 | class RefImpl {
|
1389 | constructor(value, __v_isShallow) {
|
1390 | this.__v_isShallow = __v_isShallow;
|
1391 | this.dep = void 0;
|
1392 | this.__v_isRef = true;
|
1393 | this._rawValue = __v_isShallow ? value : toRaw(value);
|
1394 | this._value = __v_isShallow ? value : toReactive(value);
|
1395 | }
|
1396 | get value() {
|
1397 | trackRefValue(this);
|
1398 | return this._value;
|
1399 | }
|
1400 | set value(newVal) {
|
1401 | const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
1402 | newVal = useDirectValue ? newVal : toRaw(newVal);
|
1403 | if (hasChanged(newVal, this._rawValue)) {
|
1404 | this._rawValue = newVal;
|
1405 | this._value = useDirectValue ? newVal : toReactive(newVal);
|
1406 | triggerRefValue(this, 4, newVal);
|
1407 | }
|
1408 | }
|
1409 | }
|
1410 | function triggerRef(ref2) {
|
1411 | triggerRefValue(ref2, 4, ref2.value );
|
1412 | }
|
1413 | function unref(ref2) {
|
1414 | return isRef(ref2) ? ref2.value : ref2;
|
1415 | }
|
1416 | function toValue(source) {
|
1417 | return isFunction(source) ? source() : unref(source);
|
1418 | }
|
1419 | const shallowUnwrapHandlers = {
|
1420 | get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
1421 | set: (target, key, value, receiver) => {
|
1422 | const oldValue = target[key];
|
1423 | if (isRef(oldValue) && !isRef(value)) {
|
1424 | oldValue.value = value;
|
1425 | return true;
|
1426 | } else {
|
1427 | return Reflect.set(target, key, value, receiver);
|
1428 | }
|
1429 | }
|
1430 | };
|
1431 | function proxyRefs(objectWithRefs) {
|
1432 | return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
1433 | }
|
1434 | class CustomRefImpl {
|
1435 | constructor(factory) {
|
1436 | this.dep = void 0;
|
1437 | this.__v_isRef = true;
|
1438 | const { get, set } = factory(
|
1439 | () => trackRefValue(this),
|
1440 | () => triggerRefValue(this)
|
1441 | );
|
1442 | this._get = get;
|
1443 | this._set = set;
|
1444 | }
|
1445 | get value() {
|
1446 | return this._get();
|
1447 | }
|
1448 | set value(newVal) {
|
1449 | this._set(newVal);
|
1450 | }
|
1451 | }
|
1452 | function customRef(factory) {
|
1453 | return new CustomRefImpl(factory);
|
1454 | }
|
1455 | function toRefs(object) {
|
1456 | if (!isProxy(object)) {
|
1457 | warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
1458 | }
|
1459 | const ret = isArray(object) ? new Array(object.length) : {};
|
1460 | for (const key in object) {
|
1461 | ret[key] = propertyToRef(object, key);
|
1462 | }
|
1463 | return ret;
|
1464 | }
|
1465 | class ObjectRefImpl {
|
1466 | constructor(_object, _key, _defaultValue) {
|
1467 | this._object = _object;
|
1468 | this._key = _key;
|
1469 | this._defaultValue = _defaultValue;
|
1470 | this.__v_isRef = true;
|
1471 | }
|
1472 | get value() {
|
1473 | const val = this._object[this._key];
|
1474 | return val === void 0 ? this._defaultValue : val;
|
1475 | }
|
1476 | set value(newVal) {
|
1477 | this._object[this._key] = newVal;
|
1478 | }
|
1479 | get dep() {
|
1480 | return getDepFromReactive(toRaw(this._object), this._key);
|
1481 | }
|
1482 | }
|
1483 | class GetterRefImpl {
|
1484 | constructor(_getter) {
|
1485 | this._getter = _getter;
|
1486 | this.__v_isRef = true;
|
1487 | this.__v_isReadonly = true;
|
1488 | }
|
1489 | get value() {
|
1490 | return this._getter();
|
1491 | }
|
1492 | }
|
1493 | function toRef(source, key, defaultValue) {
|
1494 | if (isRef(source)) {
|
1495 | return source;
|
1496 | } else if (isFunction(source)) {
|
1497 | return new GetterRefImpl(source);
|
1498 | } else if (isObject(source) && arguments.length > 1) {
|
1499 | return propertyToRef(source, key, defaultValue);
|
1500 | } else {
|
1501 | return ref(source);
|
1502 | }
|
1503 | }
|
1504 | function propertyToRef(source, key, defaultValue) {
|
1505 | const val = source[key];
|
1506 | return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
1507 | }
|
1508 |
|
1509 | const TrackOpTypes = {
|
1510 | "GET": "get",
|
1511 | "HAS": "has",
|
1512 | "ITERATE": "iterate"
|
1513 | };
|
1514 | const TriggerOpTypes = {
|
1515 | "SET": "set",
|
1516 | "ADD": "add",
|
1517 | "DELETE": "delete",
|
1518 | "CLEAR": "clear"
|
1519 | };
|
1520 |
|
1521 | const stack = [];
|
1522 | function pushWarningContext(vnode) {
|
1523 | stack.push(vnode);
|
1524 | }
|
1525 | function popWarningContext() {
|
1526 | stack.pop();
|
1527 | }
|
1528 | function warn$1(msg, ...args) {
|
1529 | pauseTracking();
|
1530 | const instance = stack.length ? stack[stack.length - 1].component : null;
|
1531 | const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
1532 | const trace = getComponentTrace();
|
1533 | if (appWarnHandler) {
|
1534 | callWithErrorHandling(
|
1535 | appWarnHandler,
|
1536 | instance,
|
1537 | 11,
|
1538 | [
|
1539 | msg + args.map((a) => {
|
1540 | var _a, _b;
|
1541 | return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
1542 | }).join(""),
|
1543 | instance && instance.proxy,
|
1544 | trace.map(
|
1545 | ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
1546 | ).join("\n"),
|
1547 | trace
|
1548 | ]
|
1549 | );
|
1550 | } else {
|
1551 | const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
1552 | if (trace.length &&
|
1553 | true) {
|
1554 | warnArgs.push(`
|
1555 | `, ...formatTrace(trace));
|
1556 | }
|
1557 | console.warn(...warnArgs);
|
1558 | }
|
1559 | resetTracking();
|
1560 | }
|
1561 | function getComponentTrace() {
|
1562 | let currentVNode = stack[stack.length - 1];
|
1563 | if (!currentVNode) {
|
1564 | return [];
|
1565 | }
|
1566 | const normalizedStack = [];
|
1567 | while (currentVNode) {
|
1568 | const last = normalizedStack[0];
|
1569 | if (last && last.vnode === currentVNode) {
|
1570 | last.recurseCount++;
|
1571 | } else {
|
1572 | normalizedStack.push({
|
1573 | vnode: currentVNode,
|
1574 | recurseCount: 0
|
1575 | });
|
1576 | }
|
1577 | const parentInstance = currentVNode.component && currentVNode.component.parent;
|
1578 | currentVNode = parentInstance && parentInstance.vnode;
|
1579 | }
|
1580 | return normalizedStack;
|
1581 | }
|
1582 | function formatTrace(trace) {
|
1583 | const logs = [];
|
1584 | trace.forEach((entry, i) => {
|
1585 | logs.push(...i === 0 ? [] : [`
|
1586 | `], ...formatTraceEntry(entry));
|
1587 | });
|
1588 | return logs;
|
1589 | }
|
1590 | function formatTraceEntry({ vnode, recurseCount }) {
|
1591 | const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
1592 | const isRoot = vnode.component ? vnode.component.parent == null : false;
|
1593 | const open = ` at <${formatComponentName(
|
1594 | vnode.component,
|
1595 | vnode.type,
|
1596 | isRoot
|
1597 | )}`;
|
1598 | const close = `>` + postfix;
|
1599 | return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
1600 | }
|
1601 | function formatProps(props) {
|
1602 | const res = [];
|
1603 | const keys = Object.keys(props);
|
1604 | keys.slice(0, 3).forEach((key) => {
|
1605 | res.push(...formatProp(key, props[key]));
|
1606 | });
|
1607 | if (keys.length > 3) {
|
1608 | res.push(` ...`);
|
1609 | }
|
1610 | return res;
|
1611 | }
|
1612 | function formatProp(key, value, raw) {
|
1613 | if (isString(value)) {
|
1614 | value = JSON.stringify(value);
|
1615 | return raw ? value : [`${key}=${value}`];
|
1616 | } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
1617 | return raw ? value : [`${key}=${value}`];
|
1618 | } else if (isRef(value)) {
|
1619 | value = formatProp(key, toRaw(value.value), true);
|
1620 | return raw ? value : [`${key}=Ref<`, value, `>`];
|
1621 | } else if (isFunction(value)) {
|
1622 | return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
1623 | } else {
|
1624 | value = toRaw(value);
|
1625 | return raw ? value : [`${key}=`, value];
|
1626 | }
|
1627 | }
|
1628 | function assertNumber(val, type) {
|
1629 | if (val === void 0) {
|
1630 | return;
|
1631 | } else if (typeof val !== "number") {
|
1632 | warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
|
1633 | } else if (isNaN(val)) {
|
1634 | warn$1(`${type} is NaN - the duration expression might be incorrect.`);
|
1635 | }
|
1636 | }
|
1637 |
|
1638 | const ErrorCodes = {
|
1639 | "SETUP_FUNCTION": 0,
|
1640 | "0": "SETUP_FUNCTION",
|
1641 | "RENDER_FUNCTION": 1,
|
1642 | "1": "RENDER_FUNCTION",
|
1643 | "WATCH_GETTER": 2,
|
1644 | "2": "WATCH_GETTER",
|
1645 | "WATCH_CALLBACK": 3,
|
1646 | "3": "WATCH_CALLBACK",
|
1647 | "WATCH_CLEANUP": 4,
|
1648 | "4": "WATCH_CLEANUP",
|
1649 | "NATIVE_EVENT_HANDLER": 5,
|
1650 | "5": "NATIVE_EVENT_HANDLER",
|
1651 | "COMPONENT_EVENT_HANDLER": 6,
|
1652 | "6": "COMPONENT_EVENT_HANDLER",
|
1653 | "VNODE_HOOK": 7,
|
1654 | "7": "VNODE_HOOK",
|
1655 | "DIRECTIVE_HOOK": 8,
|
1656 | "8": "DIRECTIVE_HOOK",
|
1657 | "TRANSITION_HOOK": 9,
|
1658 | "9": "TRANSITION_HOOK",
|
1659 | "APP_ERROR_HANDLER": 10,
|
1660 | "10": "APP_ERROR_HANDLER",
|
1661 | "APP_WARN_HANDLER": 11,
|
1662 | "11": "APP_WARN_HANDLER",
|
1663 | "FUNCTION_REF": 12,
|
1664 | "12": "FUNCTION_REF",
|
1665 | "ASYNC_COMPONENT_LOADER": 13,
|
1666 | "13": "ASYNC_COMPONENT_LOADER",
|
1667 | "SCHEDULER": 14,
|
1668 | "14": "SCHEDULER"
|
1669 | };
|
1670 | const ErrorTypeStrings$1 = {
|
1671 | ["sp"]: "serverPrefetch hook",
|
1672 | ["bc"]: "beforeCreate hook",
|
1673 | ["c"]: "created hook",
|
1674 | ["bm"]: "beforeMount hook",
|
1675 | ["m"]: "mounted hook",
|
1676 | ["bu"]: "beforeUpdate hook",
|
1677 | ["u"]: "updated",
|
1678 | ["bum"]: "beforeUnmount hook",
|
1679 | ["um"]: "unmounted hook",
|
1680 | ["a"]: "activated hook",
|
1681 | ["da"]: "deactivated hook",
|
1682 | ["ec"]: "errorCaptured hook",
|
1683 | ["rtc"]: "renderTracked hook",
|
1684 | ["rtg"]: "renderTriggered hook",
|
1685 | [0]: "setup function",
|
1686 | [1]: "render function",
|
1687 | [2]: "watcher getter",
|
1688 | [3]: "watcher callback",
|
1689 | [4]: "watcher cleanup function",
|
1690 | [5]: "native event handler",
|
1691 | [6]: "component event handler",
|
1692 | [7]: "vnode hook",
|
1693 | [8]: "directive hook",
|
1694 | [9]: "transition hook",
|
1695 | [10]: "app errorHandler",
|
1696 | [11]: "app warnHandler",
|
1697 | [12]: "ref function",
|
1698 | [13]: "async component loader",
|
1699 | [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
1700 | };
|
1701 | function callWithErrorHandling(fn, instance, type, args) {
|
1702 | try {
|
1703 | return args ? fn(...args) : fn();
|
1704 | } catch (err) {
|
1705 | handleError(err, instance, type);
|
1706 | }
|
1707 | }
|
1708 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
1709 | if (isFunction(fn)) {
|
1710 | const res = callWithErrorHandling(fn, instance, type, args);
|
1711 | if (res && isPromise(res)) {
|
1712 | res.catch((err) => {
|
1713 | handleError(err, instance, type);
|
1714 | });
|
1715 | }
|
1716 | return res;
|
1717 | }
|
1718 | const values = [];
|
1719 | for (let i = 0; i < fn.length; i++) {
|
1720 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
1721 | }
|
1722 | return values;
|
1723 | }
|
1724 | function handleError(err, instance, type, throwInDev = true) {
|
1725 | const contextVNode = instance ? instance.vnode : null;
|
1726 | if (instance) {
|
1727 | let cur = instance.parent;
|
1728 | const exposedInstance = instance.proxy;
|
1729 | const errorInfo = ErrorTypeStrings$1[type] ;
|
1730 | while (cur) {
|
1731 | const errorCapturedHooks = cur.ec;
|
1732 | if (errorCapturedHooks) {
|
1733 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
1734 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
1735 | return;
|
1736 | }
|
1737 | }
|
1738 | }
|
1739 | cur = cur.parent;
|
1740 | }
|
1741 | const appErrorHandler = instance.appContext.config.errorHandler;
|
1742 | if (appErrorHandler) {
|
1743 | callWithErrorHandling(
|
1744 | appErrorHandler,
|
1745 | null,
|
1746 | 10,
|
1747 | [err, exposedInstance, errorInfo]
|
1748 | );
|
1749 | return;
|
1750 | }
|
1751 | }
|
1752 | logError(err, type, contextVNode, throwInDev);
|
1753 | }
|
1754 | function logError(err, type, contextVNode, throwInDev = true) {
|
1755 | {
|
1756 | const info = ErrorTypeStrings$1[type];
|
1757 | if (contextVNode) {
|
1758 | pushWarningContext(contextVNode);
|
1759 | }
|
1760 | warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
1761 | if (contextVNode) {
|
1762 | popWarningContext();
|
1763 | }
|
1764 | if (throwInDev) {
|
1765 | throw err;
|
1766 | } else {
|
1767 | console.error(err);
|
1768 | }
|
1769 | }
|
1770 | }
|
1771 |
|
1772 | let isFlushing = false;
|
1773 | let isFlushPending = false;
|
1774 | const queue = [];
|
1775 | let flushIndex = 0;
|
1776 | const pendingPostFlushCbs = [];
|
1777 | let activePostFlushCbs = null;
|
1778 | let postFlushIndex = 0;
|
1779 | const resolvedPromise = Promise.resolve();
|
1780 | let currentFlushPromise = null;
|
1781 | const RECURSION_LIMIT = 100;
|
1782 | function nextTick(fn) {
|
1783 | const p = currentFlushPromise || resolvedPromise;
|
1784 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
1785 | }
|
1786 | function findInsertionIndex(id) {
|
1787 | let start = flushIndex + 1;
|
1788 | let end = queue.length;
|
1789 | while (start < end) {
|
1790 | const middle = start + end >>> 1;
|
1791 | const middleJob = queue[middle];
|
1792 | const middleJobId = getId(middleJob);
|
1793 | if (middleJobId < id || middleJobId === id && middleJob.pre) {
|
1794 | start = middle + 1;
|
1795 | } else {
|
1796 | end = middle;
|
1797 | }
|
1798 | }
|
1799 | return start;
|
1800 | }
|
1801 | function queueJob(job) {
|
1802 | if (!queue.length || !queue.includes(
|
1803 | job,
|
1804 | isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
1805 | )) {
|
1806 | if (job.id == null) {
|
1807 | queue.push(job);
|
1808 | } else {
|
1809 | queue.splice(findInsertionIndex(job.id), 0, job);
|
1810 | }
|
1811 | queueFlush();
|
1812 | }
|
1813 | }
|
1814 | function queueFlush() {
|
1815 | if (!isFlushing && !isFlushPending) {
|
1816 | isFlushPending = true;
|
1817 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
1818 | }
|
1819 | }
|
1820 | function invalidateJob(job) {
|
1821 | const i = queue.indexOf(job);
|
1822 | if (i > flushIndex) {
|
1823 | queue.splice(i, 1);
|
1824 | }
|
1825 | }
|
1826 | function queuePostFlushCb(cb) {
|
1827 | if (!isArray(cb)) {
|
1828 | if (!activePostFlushCbs || !activePostFlushCbs.includes(
|
1829 | cb,
|
1830 | cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
1831 | )) {
|
1832 | pendingPostFlushCbs.push(cb);
|
1833 | }
|
1834 | } else {
|
1835 | pendingPostFlushCbs.push(...cb);
|
1836 | }
|
1837 | queueFlush();
|
1838 | }
|
1839 | function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
1840 | {
|
1841 | seen = seen || new Map();
|
1842 | }
|
1843 | for (; i < queue.length; i++) {
|
1844 | const cb = queue[i];
|
1845 | if (cb && cb.pre) {
|
1846 | if (instance && cb.id !== instance.uid) {
|
1847 | continue;
|
1848 | }
|
1849 | if (checkRecursiveUpdates(seen, cb)) {
|
1850 | continue;
|
1851 | }
|
1852 | queue.splice(i, 1);
|
1853 | i--;
|
1854 | cb();
|
1855 | }
|
1856 | }
|
1857 | }
|
1858 | function flushPostFlushCbs(seen) {
|
1859 | if (pendingPostFlushCbs.length) {
|
1860 | const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
1861 | (a, b) => getId(a) - getId(b)
|
1862 | );
|
1863 | pendingPostFlushCbs.length = 0;
|
1864 | if (activePostFlushCbs) {
|
1865 | activePostFlushCbs.push(...deduped);
|
1866 | return;
|
1867 | }
|
1868 | activePostFlushCbs = deduped;
|
1869 | {
|
1870 | seen = seen || new Map();
|
1871 | }
|
1872 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
1873 | if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
|
1874 | continue;
|
1875 | }
|
1876 | activePostFlushCbs[postFlushIndex]();
|
1877 | }
|
1878 | activePostFlushCbs = null;
|
1879 | postFlushIndex = 0;
|
1880 | }
|
1881 | }
|
1882 | const getId = (job) => job.id == null ? Infinity : job.id;
|
1883 | const comparator = (a, b) => {
|
1884 | const diff = getId(a) - getId(b);
|
1885 | if (diff === 0) {
|
1886 | if (a.pre && !b.pre)
|
1887 | return -1;
|
1888 | if (b.pre && !a.pre)
|
1889 | return 1;
|
1890 | }
|
1891 | return diff;
|
1892 | };
|
1893 | function flushJobs(seen) {
|
1894 | isFlushPending = false;
|
1895 | isFlushing = true;
|
1896 | {
|
1897 | seen = seen || new Map();
|
1898 | }
|
1899 | queue.sort(comparator);
|
1900 | const check = (job) => checkRecursiveUpdates(seen, job) ;
|
1901 | try {
|
1902 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
1903 | const job = queue[flushIndex];
|
1904 | if (job && job.active !== false) {
|
1905 | if (check(job)) {
|
1906 | continue;
|
1907 | }
|
1908 | callWithErrorHandling(job, null, 14);
|
1909 | }
|
1910 | }
|
1911 | } finally {
|
1912 | flushIndex = 0;
|
1913 | queue.length = 0;
|
1914 | flushPostFlushCbs(seen);
|
1915 | isFlushing = false;
|
1916 | currentFlushPromise = null;
|
1917 | if (queue.length || pendingPostFlushCbs.length) {
|
1918 | flushJobs(seen);
|
1919 | }
|
1920 | }
|
1921 | }
|
1922 | function checkRecursiveUpdates(seen, fn) {
|
1923 | if (!seen.has(fn)) {
|
1924 | seen.set(fn, 1);
|
1925 | } else {
|
1926 | const count = seen.get(fn);
|
1927 | if (count > RECURSION_LIMIT) {
|
1928 | const instance = fn.ownerInstance;
|
1929 | const componentName = instance && getComponentName(instance.type);
|
1930 | handleError(
|
1931 | `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.`,
|
1932 | null,
|
1933 | 10
|
1934 | );
|
1935 | return true;
|
1936 | } else {
|
1937 | seen.set(fn, count + 1);
|
1938 | }
|
1939 | }
|
1940 | }
|
1941 |
|
1942 | let isHmrUpdating = false;
|
1943 | const hmrDirtyComponents = new Set();
|
1944 | {
|
1945 | getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
1946 | createRecord: tryWrap(createRecord),
|
1947 | rerender: tryWrap(rerender),
|
1948 | reload: tryWrap(reload)
|
1949 | };
|
1950 | }
|
1951 | const map = new Map();
|
1952 | function registerHMR(instance) {
|
1953 | const id = instance.type.__hmrId;
|
1954 | let record = map.get(id);
|
1955 | if (!record) {
|
1956 | createRecord(id, instance.type);
|
1957 | record = map.get(id);
|
1958 | }
|
1959 | record.instances.add(instance);
|
1960 | }
|
1961 | function unregisterHMR(instance) {
|
1962 | map.get(instance.type.__hmrId).instances.delete(instance);
|
1963 | }
|
1964 | function createRecord(id, initialDef) {
|
1965 | if (map.has(id)) {
|
1966 | return false;
|
1967 | }
|
1968 | map.set(id, {
|
1969 | initialDef: normalizeClassComponent(initialDef),
|
1970 | instances: new Set()
|
1971 | });
|
1972 | return true;
|
1973 | }
|
1974 | function normalizeClassComponent(component) {
|
1975 | return isClassComponent(component) ? component.__vccOpts : component;
|
1976 | }
|
1977 | function rerender(id, newRender) {
|
1978 | const record = map.get(id);
|
1979 | if (!record) {
|
1980 | return;
|
1981 | }
|
1982 | record.initialDef.render = newRender;
|
1983 | [...record.instances].forEach((instance) => {
|
1984 | if (newRender) {
|
1985 | instance.render = newRender;
|
1986 | normalizeClassComponent(instance.type).render = newRender;
|
1987 | }
|
1988 | instance.renderCache = [];
|
1989 | isHmrUpdating = true;
|
1990 | instance.effect.dirty = true;
|
1991 | instance.update();
|
1992 | isHmrUpdating = false;
|
1993 | });
|
1994 | }
|
1995 | function reload(id, newComp) {
|
1996 | const record = map.get(id);
|
1997 | if (!record)
|
1998 | return;
|
1999 | newComp = normalizeClassComponent(newComp);
|
2000 | updateComponentDef(record.initialDef, newComp);
|
2001 | const instances = [...record.instances];
|
2002 | for (const instance of instances) {
|
2003 | const oldComp = normalizeClassComponent(instance.type);
|
2004 | if (!hmrDirtyComponents.has(oldComp)) {
|
2005 | if (oldComp !== record.initialDef) {
|
2006 | updateComponentDef(oldComp, newComp);
|
2007 | }
|
2008 | hmrDirtyComponents.add(oldComp);
|
2009 | }
|
2010 | instance.appContext.propsCache.delete(instance.type);
|
2011 | instance.appContext.emitsCache.delete(instance.type);
|
2012 | instance.appContext.optionsCache.delete(instance.type);
|
2013 | if (instance.ceReload) {
|
2014 | hmrDirtyComponents.add(oldComp);
|
2015 | instance.ceReload(newComp.styles);
|
2016 | hmrDirtyComponents.delete(oldComp);
|
2017 | } else if (instance.parent) {
|
2018 | instance.parent.effect.dirty = true;
|
2019 | queueJob(instance.parent.update);
|
2020 | } else if (instance.appContext.reload) {
|
2021 | instance.appContext.reload();
|
2022 | } else if (typeof window !== "undefined") {
|
2023 | window.location.reload();
|
2024 | } else {
|
2025 | console.warn(
|
2026 | "[HMR] Root or manually mounted instance modified. Full reload required."
|
2027 | );
|
2028 | }
|
2029 | }
|
2030 | queuePostFlushCb(() => {
|
2031 | for (const instance of instances) {
|
2032 | hmrDirtyComponents.delete(
|
2033 | normalizeClassComponent(instance.type)
|
2034 | );
|
2035 | }
|
2036 | });
|
2037 | }
|
2038 | function updateComponentDef(oldComp, newComp) {
|
2039 | extend(oldComp, newComp);
|
2040 | for (const key in oldComp) {
|
2041 | if (key !== "__file" && !(key in newComp)) {
|
2042 | delete oldComp[key];
|
2043 | }
|
2044 | }
|
2045 | }
|
2046 | function tryWrap(fn) {
|
2047 | return (id, arg) => {
|
2048 | try {
|
2049 | return fn(id, arg);
|
2050 | } catch (e) {
|
2051 | console.error(e);
|
2052 | console.warn(
|
2053 | `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
|
2054 | );
|
2055 | }
|
2056 | };
|
2057 | }
|
2058 |
|
2059 | let devtools$1;
|
2060 | let buffer = [];
|
2061 | let devtoolsNotInstalled = false;
|
2062 | function emit$1(event, ...args) {
|
2063 | if (devtools$1) {
|
2064 | devtools$1.emit(event, ...args);
|
2065 | } else if (!devtoolsNotInstalled) {
|
2066 | buffer.push({ event, args });
|
2067 | }
|
2068 | }
|
2069 | function setDevtoolsHook$1(hook, target) {
|
2070 | var _a, _b;
|
2071 | devtools$1 = hook;
|
2072 | if (devtools$1) {
|
2073 | devtools$1.enabled = true;
|
2074 | buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
|
2075 | buffer = [];
|
2076 | } else if (
|
2077 |
|
2078 |
|
2079 |
|
2080 | typeof window !== "undefined" &&
|
2081 | window.HTMLElement &&
|
2082 | !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
2083 | ) {
|
2084 | const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
2085 | replay.push((newHook) => {
|
2086 | setDevtoolsHook$1(newHook, target);
|
2087 | });
|
2088 | setTimeout(() => {
|
2089 | if (!devtools$1) {
|
2090 | target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
2091 | devtoolsNotInstalled = true;
|
2092 | buffer = [];
|
2093 | }
|
2094 | }, 3e3);
|
2095 | } else {
|
2096 | devtoolsNotInstalled = true;
|
2097 | buffer = [];
|
2098 | }
|
2099 | }
|
2100 | function devtoolsInitApp(app, version) {
|
2101 | emit$1("app:init" , app, version, {
|
2102 | Fragment,
|
2103 | Text,
|
2104 | Comment,
|
2105 | Static
|
2106 | });
|
2107 | }
|
2108 | function devtoolsUnmountApp(app) {
|
2109 | emit$1("app:unmount" , app);
|
2110 | }
|
2111 | const devtoolsComponentAdded = createDevtoolsComponentHook(
|
2112 | "component:added"
|
2113 | );
|
2114 | const devtoolsComponentUpdated = createDevtoolsComponentHook("component:updated" );
|
2115 | const _devtoolsComponentRemoved = createDevtoolsComponentHook(
|
2116 | "component:removed"
|
2117 | );
|
2118 | const devtoolsComponentRemoved = (component) => {
|
2119 | if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" &&
|
2120 | !devtools$1.cleanupBuffer(component)) {
|
2121 | _devtoolsComponentRemoved(component);
|
2122 | }
|
2123 | };
|
2124 | function createDevtoolsComponentHook(hook) {
|
2125 | return (component) => {
|
2126 | emit$1(
|
2127 | hook,
|
2128 | component.appContext.app,
|
2129 | component.uid,
|
2130 | component.parent ? component.parent.uid : void 0,
|
2131 | component
|
2132 | );
|
2133 | };
|
2134 | }
|
2135 | const devtoolsPerfStart = createDevtoolsPerformanceHook(
|
2136 | "perf:start"
|
2137 | );
|
2138 | const devtoolsPerfEnd = createDevtoolsPerformanceHook(
|
2139 | "perf:end"
|
2140 | );
|
2141 | function createDevtoolsPerformanceHook(hook) {
|
2142 | return (component, type, time) => {
|
2143 | emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
2144 | };
|
2145 | }
|
2146 | function devtoolsComponentEmit(component, event, params) {
|
2147 | emit$1(
|
2148 | "component:emit" ,
|
2149 | component.appContext.app,
|
2150 | component,
|
2151 | event,
|
2152 | params
|
2153 | );
|
2154 | }
|
2155 |
|
2156 | function emit(instance, event, ...rawArgs) {
|
2157 | if (instance.isUnmounted)
|
2158 | return;
|
2159 | const props = instance.vnode.props || EMPTY_OBJ;
|
2160 | {
|
2161 | const {
|
2162 | emitsOptions,
|
2163 | propsOptions: [propsOptions]
|
2164 | } = instance;
|
2165 | if (emitsOptions) {
|
2166 | if (!(event in emitsOptions) && true) {
|
2167 | if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
2168 | warn$1(
|
2169 | `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
|
2170 | );
|
2171 | }
|
2172 | } else {
|
2173 | const validator = emitsOptions[event];
|
2174 | if (isFunction(validator)) {
|
2175 | const isValid = validator(...rawArgs);
|
2176 | if (!isValid) {
|
2177 | warn$1(
|
2178 | `Invalid event arguments: event validation failed for event "${event}".`
|
2179 | );
|
2180 | }
|
2181 | }
|
2182 | }
|
2183 | }
|
2184 | }
|
2185 | let args = rawArgs;
|
2186 | const isModelListener = event.startsWith("update:");
|
2187 | const modelArg = isModelListener && event.slice(7);
|
2188 | if (modelArg && modelArg in props) {
|
2189 | const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
2190 | const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
|
2191 | if (trim) {
|
2192 | args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
2193 | }
|
2194 | if (number) {
|
2195 | args = rawArgs.map(looseToNumber);
|
2196 | }
|
2197 | }
|
2198 | {
|
2199 | devtoolsComponentEmit(instance, event, args);
|
2200 | }
|
2201 | {
|
2202 | const lowerCaseEvent = event.toLowerCase();
|
2203 | if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
2204 | warn$1(
|
2205 | `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
2206 | instance,
|
2207 | instance.type
|
2208 | )} 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(
|
2209 | event
|
2210 | )}" instead of "${event}".`
|
2211 | );
|
2212 | }
|
2213 | }
|
2214 | let handlerName;
|
2215 | let handler = props[handlerName = toHandlerKey(event)] ||
|
2216 | props[handlerName = toHandlerKey(camelize(event))];
|
2217 | if (!handler && isModelListener) {
|
2218 | handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
2219 | }
|
2220 | if (handler) {
|
2221 | callWithAsyncErrorHandling(
|
2222 | handler,
|
2223 | instance,
|
2224 | 6,
|
2225 | args
|
2226 | );
|
2227 | }
|
2228 | const onceHandler = props[handlerName + `Once`];
|
2229 | if (onceHandler) {
|
2230 | if (!instance.emitted) {
|
2231 | instance.emitted = {};
|
2232 | } else if (instance.emitted[handlerName]) {
|
2233 | return;
|
2234 | }
|
2235 | instance.emitted[handlerName] = true;
|
2236 | callWithAsyncErrorHandling(
|
2237 | onceHandler,
|
2238 | instance,
|
2239 | 6,
|
2240 | args
|
2241 | );
|
2242 | }
|
2243 | }
|
2244 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
2245 | const cache = appContext.emitsCache;
|
2246 | const cached = cache.get(comp);
|
2247 | if (cached !== void 0) {
|
2248 | return cached;
|
2249 | }
|
2250 | const raw = comp.emits;
|
2251 | let normalized = {};
|
2252 | let hasExtends = false;
|
2253 | if (!isFunction(comp)) {
|
2254 | const extendEmits = (raw2) => {
|
2255 | const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
2256 | if (normalizedFromExtend) {
|
2257 | hasExtends = true;
|
2258 | extend(normalized, normalizedFromExtend);
|
2259 | }
|
2260 | };
|
2261 | if (!asMixin && appContext.mixins.length) {
|
2262 | appContext.mixins.forEach(extendEmits);
|
2263 | }
|
2264 | if (comp.extends) {
|
2265 | extendEmits(comp.extends);
|
2266 | }
|
2267 | if (comp.mixins) {
|
2268 | comp.mixins.forEach(extendEmits);
|
2269 | }
|
2270 | }
|
2271 | if (!raw && !hasExtends) {
|
2272 | if (isObject(comp)) {
|
2273 | cache.set(comp, null);
|
2274 | }
|
2275 | return null;
|
2276 | }
|
2277 | if (isArray(raw)) {
|
2278 | raw.forEach((key) => normalized[key] = null);
|
2279 | } else {
|
2280 | extend(normalized, raw);
|
2281 | }
|
2282 | if (isObject(comp)) {
|
2283 | cache.set(comp, normalized);
|
2284 | }
|
2285 | return normalized;
|
2286 | }
|
2287 | function isEmitListener(options, key) {
|
2288 | if (!options || !isOn(key)) {
|
2289 | return false;
|
2290 | }
|
2291 | key = key.slice(2).replace(/Once$/, "");
|
2292 | return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
2293 | }
|
2294 |
|
2295 | let currentRenderingInstance = null;
|
2296 | let currentScopeId = null;
|
2297 | function setCurrentRenderingInstance(instance) {
|
2298 | const prev = currentRenderingInstance;
|
2299 | currentRenderingInstance = instance;
|
2300 | currentScopeId = instance && instance.type.__scopeId || null;
|
2301 | return prev;
|
2302 | }
|
2303 | function pushScopeId(id) {
|
2304 | currentScopeId = id;
|
2305 | }
|
2306 | function popScopeId() {
|
2307 | currentScopeId = null;
|
2308 | }
|
2309 | const withScopeId = (_id) => withCtx;
|
2310 | function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
2311 | if (!ctx)
|
2312 | return fn;
|
2313 | if (fn._n) {
|
2314 | return fn;
|
2315 | }
|
2316 | const renderFnWithContext = (...args) => {
|
2317 | if (renderFnWithContext._d) {
|
2318 | setBlockTracking(-1);
|
2319 | }
|
2320 | const prevInstance = setCurrentRenderingInstance(ctx);
|
2321 | let res;
|
2322 | try {
|
2323 | res = fn(...args);
|
2324 | } finally {
|
2325 | setCurrentRenderingInstance(prevInstance);
|
2326 | if (renderFnWithContext._d) {
|
2327 | setBlockTracking(1);
|
2328 | }
|
2329 | }
|
2330 | {
|
2331 | devtoolsComponentUpdated(ctx);
|
2332 | }
|
2333 | return res;
|
2334 | };
|
2335 | renderFnWithContext._n = true;
|
2336 | renderFnWithContext._c = true;
|
2337 | renderFnWithContext._d = true;
|
2338 | return renderFnWithContext;
|
2339 | }
|
2340 |
|
2341 | let accessedAttrs = false;
|
2342 | function markAttrsAccessed() {
|
2343 | accessedAttrs = true;
|
2344 | }
|
2345 | function renderComponentRoot(instance) {
|
2346 | const {
|
2347 | type: Component,
|
2348 | vnode,
|
2349 | proxy,
|
2350 | withProxy,
|
2351 | props,
|
2352 | propsOptions: [propsOptions],
|
2353 | slots,
|
2354 | attrs,
|
2355 | emit,
|
2356 | render,
|
2357 | renderCache,
|
2358 | data,
|
2359 | setupState,
|
2360 | ctx,
|
2361 | inheritAttrs
|
2362 | } = instance;
|
2363 | let result;
|
2364 | let fallthroughAttrs;
|
2365 | const prev = setCurrentRenderingInstance(instance);
|
2366 | {
|
2367 | accessedAttrs = false;
|
2368 | }
|
2369 | try {
|
2370 | if (vnode.shapeFlag & 4) {
|
2371 | const proxyToUse = withProxy || proxy;
|
2372 | const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
2373 | get(target, key, receiver) {
|
2374 | warn$1(
|
2375 | `Property '${String(
|
2376 | key
|
2377 | )}' was accessed via 'this'. Avoid using 'this' in templates.`
|
2378 | );
|
2379 | return Reflect.get(target, key, receiver);
|
2380 | }
|
2381 | }) : proxyToUse;
|
2382 | result = normalizeVNode(
|
2383 | render.call(
|
2384 | thisProxy,
|
2385 | proxyToUse,
|
2386 | renderCache,
|
2387 | props,
|
2388 | setupState,
|
2389 | data,
|
2390 | ctx
|
2391 | )
|
2392 | );
|
2393 | fallthroughAttrs = attrs;
|
2394 | } else {
|
2395 | const render2 = Component;
|
2396 | if (attrs === props) {
|
2397 | markAttrsAccessed();
|
2398 | }
|
2399 | result = normalizeVNode(
|
2400 | render2.length > 1 ? render2(
|
2401 | props,
|
2402 | true ? {
|
2403 | get attrs() {
|
2404 | markAttrsAccessed();
|
2405 | return attrs;
|
2406 | },
|
2407 | slots,
|
2408 | emit
|
2409 | } : { attrs, slots, emit }
|
2410 | ) : render2(
|
2411 | props,
|
2412 | null
|
2413 |
|
2414 | )
|
2415 | );
|
2416 | fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
2417 | }
|
2418 | } catch (err) {
|
2419 | blockStack.length = 0;
|
2420 | handleError(err, instance, 1);
|
2421 | result = createVNode(Comment);
|
2422 | }
|
2423 | let root = result;
|
2424 | let setRoot = void 0;
|
2425 | if (result.patchFlag > 0 && result.patchFlag & 2048) {
|
2426 | [root, setRoot] = getChildRoot(result);
|
2427 | }
|
2428 | if (fallthroughAttrs && inheritAttrs !== false) {
|
2429 | const keys = Object.keys(fallthroughAttrs);
|
2430 | const { shapeFlag } = root;
|
2431 | if (keys.length) {
|
2432 | if (shapeFlag & (1 | 6)) {
|
2433 | if (propsOptions && keys.some(isModelListener)) {
|
2434 | fallthroughAttrs = filterModelListeners(
|
2435 | fallthroughAttrs,
|
2436 | propsOptions
|
2437 | );
|
2438 | }
|
2439 | root = cloneVNode(root, fallthroughAttrs);
|
2440 | } else if (!accessedAttrs && root.type !== Comment) {
|
2441 | const allAttrs = Object.keys(attrs);
|
2442 | const eventAttrs = [];
|
2443 | const extraAttrs = [];
|
2444 | for (let i = 0, l = allAttrs.length; i < l; i++) {
|
2445 | const key = allAttrs[i];
|
2446 | if (isOn(key)) {
|
2447 | if (!isModelListener(key)) {
|
2448 | eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
2449 | }
|
2450 | } else {
|
2451 | extraAttrs.push(key);
|
2452 | }
|
2453 | }
|
2454 | if (extraAttrs.length) {
|
2455 | warn$1(
|
2456 | `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
|
2457 | );
|
2458 | }
|
2459 | if (eventAttrs.length) {
|
2460 | warn$1(
|
2461 | `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.`
|
2462 | );
|
2463 | }
|
2464 | }
|
2465 | }
|
2466 | }
|
2467 | if (vnode.dirs) {
|
2468 | if (!isElementRoot(root)) {
|
2469 | warn$1(
|
2470 | `Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
2471 | );
|
2472 | }
|
2473 | root = cloneVNode(root);
|
2474 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
2475 | }
|
2476 | if (vnode.transition) {
|
2477 | if (!isElementRoot(root)) {
|
2478 | warn$1(
|
2479 | `Component inside <Transition> renders non-element root node that cannot be animated.`
|
2480 | );
|
2481 | }
|
2482 | root.transition = vnode.transition;
|
2483 | }
|
2484 | if (setRoot) {
|
2485 | setRoot(root);
|
2486 | } else {
|
2487 | result = root;
|
2488 | }
|
2489 | setCurrentRenderingInstance(prev);
|
2490 | return result;
|
2491 | }
|
2492 | const getChildRoot = (vnode) => {
|
2493 | const rawChildren = vnode.children;
|
2494 | const dynamicChildren = vnode.dynamicChildren;
|
2495 | const childRoot = filterSingleRoot(rawChildren, false);
|
2496 | if (!childRoot) {
|
2497 | return [vnode, void 0];
|
2498 | } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
|
2499 | return getChildRoot(childRoot);
|
2500 | }
|
2501 | const index = rawChildren.indexOf(childRoot);
|
2502 | const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
2503 | const setRoot = (updatedRoot) => {
|
2504 | rawChildren[index] = updatedRoot;
|
2505 | if (dynamicChildren) {
|
2506 | if (dynamicIndex > -1) {
|
2507 | dynamicChildren[dynamicIndex] = updatedRoot;
|
2508 | } else if (updatedRoot.patchFlag > 0) {
|
2509 | vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
2510 | }
|
2511 | }
|
2512 | };
|
2513 | return [normalizeVNode(childRoot), setRoot];
|
2514 | };
|
2515 | function filterSingleRoot(children, recurse = true) {
|
2516 | let singleRoot;
|
2517 | for (let i = 0; i < children.length; i++) {
|
2518 | const child = children[i];
|
2519 | if (isVNode(child)) {
|
2520 | if (child.type !== Comment || child.children === "v-if") {
|
2521 | if (singleRoot) {
|
2522 | return;
|
2523 | } else {
|
2524 | singleRoot = child;
|
2525 | if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
|
2526 | return filterSingleRoot(singleRoot.children);
|
2527 | }
|
2528 | }
|
2529 | }
|
2530 | } else {
|
2531 | return;
|
2532 | }
|
2533 | }
|
2534 | return singleRoot;
|
2535 | }
|
2536 | const getFunctionalFallthrough = (attrs) => {
|
2537 | let res;
|
2538 | for (const key in attrs) {
|
2539 | if (key === "class" || key === "style" || isOn(key)) {
|
2540 | (res || (res = {}))[key] = attrs[key];
|
2541 | }
|
2542 | }
|
2543 | return res;
|
2544 | };
|
2545 | const filterModelListeners = (attrs, props) => {
|
2546 | const res = {};
|
2547 | for (const key in attrs) {
|
2548 | if (!isModelListener(key) || !(key.slice(9) in props)) {
|
2549 | res[key] = attrs[key];
|
2550 | }
|
2551 | }
|
2552 | return res;
|
2553 | };
|
2554 | const isElementRoot = (vnode) => {
|
2555 | return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
|
2556 | };
|
2557 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
2558 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
2559 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
2560 | const emits = component.emitsOptions;
|
2561 | if ((prevChildren || nextChildren) && isHmrUpdating) {
|
2562 | return true;
|
2563 | }
|
2564 | if (nextVNode.dirs || nextVNode.transition) {
|
2565 | return true;
|
2566 | }
|
2567 | if (optimized && patchFlag >= 0) {
|
2568 | if (patchFlag & 1024) {
|
2569 | return true;
|
2570 | }
|
2571 | if (patchFlag & 16) {
|
2572 | if (!prevProps) {
|
2573 | return !!nextProps;
|
2574 | }
|
2575 | return hasPropsChanged(prevProps, nextProps, emits);
|
2576 | } else if (patchFlag & 8) {
|
2577 | const dynamicProps = nextVNode.dynamicProps;
|
2578 | for (let i = 0; i < dynamicProps.length; i++) {
|
2579 | const key = dynamicProps[i];
|
2580 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
2581 | return true;
|
2582 | }
|
2583 | }
|
2584 | }
|
2585 | } else {
|
2586 | if (prevChildren || nextChildren) {
|
2587 | if (!nextChildren || !nextChildren.$stable) {
|
2588 | return true;
|
2589 | }
|
2590 | }
|
2591 | if (prevProps === nextProps) {
|
2592 | return false;
|
2593 | }
|
2594 | if (!prevProps) {
|
2595 | return !!nextProps;
|
2596 | }
|
2597 | if (!nextProps) {
|
2598 | return true;
|
2599 | }
|
2600 | return hasPropsChanged(prevProps, nextProps, emits);
|
2601 | }
|
2602 | return false;
|
2603 | }
|
2604 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
2605 | const nextKeys = Object.keys(nextProps);
|
2606 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
2607 | return true;
|
2608 | }
|
2609 | for (let i = 0; i < nextKeys.length; i++) {
|
2610 | const key = nextKeys[i];
|
2611 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
2612 | return true;
|
2613 | }
|
2614 | }
|
2615 | return false;
|
2616 | }
|
2617 | function updateHOCHostEl({ vnode, parent }, el) {
|
2618 | while (parent) {
|
2619 | const root = parent.subTree;
|
2620 | if (root.suspense && root.suspense.activeBranch === vnode) {
|
2621 | root.el = vnode.el;
|
2622 | }
|
2623 | if (root === vnode) {
|
2624 | (vnode = parent.vnode).el = el;
|
2625 | parent = parent.parent;
|
2626 | } else {
|
2627 | break;
|
2628 | }
|
2629 | }
|
2630 | }
|
2631 |
|
2632 | const COMPONENTS = "components";
|
2633 | const DIRECTIVES = "directives";
|
2634 | function resolveComponent(name, maybeSelfReference) {
|
2635 | return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
2636 | }
|
2637 | const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
2638 | function resolveDynamicComponent(component) {
|
2639 | if (isString(component)) {
|
2640 | return resolveAsset(COMPONENTS, component, false) || component;
|
2641 | } else {
|
2642 | return component || NULL_DYNAMIC_COMPONENT;
|
2643 | }
|
2644 | }
|
2645 | function resolveDirective(name) {
|
2646 | return resolveAsset(DIRECTIVES, name);
|
2647 | }
|
2648 | function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
2649 | const instance = currentRenderingInstance || currentInstance;
|
2650 | if (instance) {
|
2651 | const Component = instance.type;
|
2652 | if (type === COMPONENTS) {
|
2653 | const selfName = getComponentName(
|
2654 | Component,
|
2655 | false
|
2656 | );
|
2657 | if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
2658 | return Component;
|
2659 | }
|
2660 | }
|
2661 | const res = (
|
2662 |
|
2663 |
|
2664 | resolve(instance[type] || Component[type], name) ||
|
2665 | resolve(instance.appContext[type], name)
|
2666 | );
|
2667 | if (!res && maybeSelfReference) {
|
2668 | return Component;
|
2669 | }
|
2670 | if (warnMissing && !res) {
|
2671 | const extra = type === COMPONENTS ? `
|
2672 | If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
2673 | warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
2674 | }
|
2675 | return res;
|
2676 | } else {
|
2677 | warn$1(
|
2678 | `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
2679 | );
|
2680 | }
|
2681 | }
|
2682 | function resolve(registry, name) {
|
2683 | return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
|
2684 | }
|
2685 |
|
2686 | const isSuspense = (type) => type.__isSuspense;
|
2687 | let suspenseId = 0;
|
2688 | const SuspenseImpl = {
|
2689 | name: "Suspense",
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 | __isSuspense: true,
|
2695 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
2696 | if (n1 == null) {
|
2697 | mountSuspense(
|
2698 | n2,
|
2699 | container,
|
2700 | anchor,
|
2701 | parentComponent,
|
2702 | parentSuspense,
|
2703 | namespace,
|
2704 | slotScopeIds,
|
2705 | optimized,
|
2706 | rendererInternals
|
2707 | );
|
2708 | } else {
|
2709 | if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
2710 | n2.suspense = n1.suspense;
|
2711 | n2.suspense.vnode = n2;
|
2712 | n2.el = n1.el;
|
2713 | return;
|
2714 | }
|
2715 | patchSuspense(
|
2716 | n1,
|
2717 | n2,
|
2718 | container,
|
2719 | anchor,
|
2720 | parentComponent,
|
2721 | namespace,
|
2722 | slotScopeIds,
|
2723 | optimized,
|
2724 | rendererInternals
|
2725 | );
|
2726 | }
|
2727 | },
|
2728 | hydrate: hydrateSuspense,
|
2729 | create: createSuspenseBoundary,
|
2730 | normalize: normalizeSuspenseChildren
|
2731 | };
|
2732 | const Suspense = SuspenseImpl ;
|
2733 | function triggerEvent(vnode, name) {
|
2734 | const eventListener = vnode.props && vnode.props[name];
|
2735 | if (isFunction(eventListener)) {
|
2736 | eventListener();
|
2737 | }
|
2738 | }
|
2739 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
2740 | const {
|
2741 | p: patch,
|
2742 | o: { createElement }
|
2743 | } = rendererInternals;
|
2744 | const hiddenContainer = createElement("div");
|
2745 | const suspense = vnode.suspense = createSuspenseBoundary(
|
2746 | vnode,
|
2747 | parentSuspense,
|
2748 | parentComponent,
|
2749 | container,
|
2750 | hiddenContainer,
|
2751 | anchor,
|
2752 | namespace,
|
2753 | slotScopeIds,
|
2754 | optimized,
|
2755 | rendererInternals
|
2756 | );
|
2757 | patch(
|
2758 | null,
|
2759 | suspense.pendingBranch = vnode.ssContent,
|
2760 | hiddenContainer,
|
2761 | null,
|
2762 | parentComponent,
|
2763 | suspense,
|
2764 | namespace,
|
2765 | slotScopeIds
|
2766 | );
|
2767 | if (suspense.deps > 0) {
|
2768 | triggerEvent(vnode, "onPending");
|
2769 | triggerEvent(vnode, "onFallback");
|
2770 | patch(
|
2771 | null,
|
2772 | vnode.ssFallback,
|
2773 | container,
|
2774 | anchor,
|
2775 | parentComponent,
|
2776 | null,
|
2777 |
|
2778 | namespace,
|
2779 | slotScopeIds
|
2780 | );
|
2781 | setActiveBranch(suspense, vnode.ssFallback);
|
2782 | } else {
|
2783 | suspense.resolve(false, true);
|
2784 | }
|
2785 | }
|
2786 | function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
2787 | const suspense = n2.suspense = n1.suspense;
|
2788 | suspense.vnode = n2;
|
2789 | n2.el = n1.el;
|
2790 | const newBranch = n2.ssContent;
|
2791 | const newFallback = n2.ssFallback;
|
2792 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
2793 | if (pendingBranch) {
|
2794 | suspense.pendingBranch = newBranch;
|
2795 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
2796 | patch(
|
2797 | pendingBranch,
|
2798 | newBranch,
|
2799 | suspense.hiddenContainer,
|
2800 | null,
|
2801 | parentComponent,
|
2802 | suspense,
|
2803 | namespace,
|
2804 | slotScopeIds,
|
2805 | optimized
|
2806 | );
|
2807 | if (suspense.deps <= 0) {
|
2808 | suspense.resolve();
|
2809 | } else if (isInFallback) {
|
2810 | if (!isHydrating) {
|
2811 | patch(
|
2812 | activeBranch,
|
2813 | newFallback,
|
2814 | container,
|
2815 | anchor,
|
2816 | parentComponent,
|
2817 | null,
|
2818 |
|
2819 | namespace,
|
2820 | slotScopeIds,
|
2821 | optimized
|
2822 | );
|
2823 | setActiveBranch(suspense, newFallback);
|
2824 | }
|
2825 | }
|
2826 | } else {
|
2827 | suspense.pendingId = suspenseId++;
|
2828 | if (isHydrating) {
|
2829 | suspense.isHydrating = false;
|
2830 | suspense.activeBranch = pendingBranch;
|
2831 | } else {
|
2832 | unmount(pendingBranch, parentComponent, suspense);
|
2833 | }
|
2834 | suspense.deps = 0;
|
2835 | suspense.effects.length = 0;
|
2836 | suspense.hiddenContainer = createElement("div");
|
2837 | if (isInFallback) {
|
2838 | patch(
|
2839 | null,
|
2840 | newBranch,
|
2841 | suspense.hiddenContainer,
|
2842 | null,
|
2843 | parentComponent,
|
2844 | suspense,
|
2845 | namespace,
|
2846 | slotScopeIds,
|
2847 | optimized
|
2848 | );
|
2849 | if (suspense.deps <= 0) {
|
2850 | suspense.resolve();
|
2851 | } else {
|
2852 | patch(
|
2853 | activeBranch,
|
2854 | newFallback,
|
2855 | container,
|
2856 | anchor,
|
2857 | parentComponent,
|
2858 | null,
|
2859 |
|
2860 | namespace,
|
2861 | slotScopeIds,
|
2862 | optimized
|
2863 | );
|
2864 | setActiveBranch(suspense, newFallback);
|
2865 | }
|
2866 | } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2867 | patch(
|
2868 | activeBranch,
|
2869 | newBranch,
|
2870 | container,
|
2871 | anchor,
|
2872 | parentComponent,
|
2873 | suspense,
|
2874 | namespace,
|
2875 | slotScopeIds,
|
2876 | optimized
|
2877 | );
|
2878 | suspense.resolve(true);
|
2879 | } else {
|
2880 | patch(
|
2881 | null,
|
2882 | newBranch,
|
2883 | suspense.hiddenContainer,
|
2884 | null,
|
2885 | parentComponent,
|
2886 | suspense,
|
2887 | namespace,
|
2888 | slotScopeIds,
|
2889 | optimized
|
2890 | );
|
2891 | if (suspense.deps <= 0) {
|
2892 | suspense.resolve();
|
2893 | }
|
2894 | }
|
2895 | }
|
2896 | } else {
|
2897 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
2898 | patch(
|
2899 | activeBranch,
|
2900 | newBranch,
|
2901 | container,
|
2902 | anchor,
|
2903 | parentComponent,
|
2904 | suspense,
|
2905 | namespace,
|
2906 | slotScopeIds,
|
2907 | optimized
|
2908 | );
|
2909 | setActiveBranch(suspense, newBranch);
|
2910 | } else {
|
2911 | triggerEvent(n2, "onPending");
|
2912 | suspense.pendingBranch = newBranch;
|
2913 | if (newBranch.shapeFlag & 512) {
|
2914 | suspense.pendingId = newBranch.component.suspenseId;
|
2915 | } else {
|
2916 | suspense.pendingId = suspenseId++;
|
2917 | }
|
2918 | patch(
|
2919 | null,
|
2920 | newBranch,
|
2921 | suspense.hiddenContainer,
|
2922 | null,
|
2923 | parentComponent,
|
2924 | suspense,
|
2925 | namespace,
|
2926 | slotScopeIds,
|
2927 | optimized
|
2928 | );
|
2929 | if (suspense.deps <= 0) {
|
2930 | suspense.resolve();
|
2931 | } else {
|
2932 | const { timeout, pendingId } = suspense;
|
2933 | if (timeout > 0) {
|
2934 | setTimeout(() => {
|
2935 | if (suspense.pendingId === pendingId) {
|
2936 | suspense.fallback(newFallback);
|
2937 | }
|
2938 | }, timeout);
|
2939 | } else if (timeout === 0) {
|
2940 | suspense.fallback(newFallback);
|
2941 | }
|
2942 | }
|
2943 | }
|
2944 | }
|
2945 | }
|
2946 | let hasWarned = false;
|
2947 | function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
2948 | if (!hasWarned) {
|
2949 | hasWarned = true;
|
2950 | console[console.info ? "info" : "log"](
|
2951 | `<Suspense> is an experimental feature and its API will likely change.`
|
2952 | );
|
2953 | }
|
2954 | const {
|
2955 | p: patch,
|
2956 | m: move,
|
2957 | um: unmount,
|
2958 | n: next,
|
2959 | o: { parentNode, remove }
|
2960 | } = rendererInternals;
|
2961 | let parentSuspenseId;
|
2962 | const isSuspensible = isVNodeSuspensible(vnode);
|
2963 | if (isSuspensible) {
|
2964 | if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
2965 | parentSuspenseId = parentSuspense.pendingId;
|
2966 | parentSuspense.deps++;
|
2967 | }
|
2968 | }
|
2969 | const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
|
2970 | {
|
2971 | assertNumber(timeout, `Suspense timeout`);
|
2972 | }
|
2973 | const initialAnchor = anchor;
|
2974 | const suspense = {
|
2975 | vnode,
|
2976 | parent: parentSuspense,
|
2977 | parentComponent,
|
2978 | namespace,
|
2979 | container,
|
2980 | hiddenContainer,
|
2981 | deps: 0,
|
2982 | pendingId: suspenseId++,
|
2983 | timeout: typeof timeout === "number" ? timeout : -1,
|
2984 | activeBranch: null,
|
2985 | pendingBranch: null,
|
2986 | isInFallback: !isHydrating,
|
2987 | isHydrating,
|
2988 | isUnmounted: false,
|
2989 | effects: [],
|
2990 | resolve(resume = false, sync = false) {
|
2991 | {
|
2992 | if (!resume && !suspense.pendingBranch) {
|
2993 | throw new Error(
|
2994 | `suspense.resolve() is called without a pending branch.`
|
2995 | );
|
2996 | }
|
2997 | if (suspense.isUnmounted) {
|
2998 | throw new Error(
|
2999 | `suspense.resolve() is called on an already unmounted suspense boundary.`
|
3000 | );
|
3001 | }
|
3002 | }
|
3003 | const {
|
3004 | vnode: vnode2,
|
3005 | activeBranch,
|
3006 | pendingBranch,
|
3007 | pendingId,
|
3008 | effects,
|
3009 | parentComponent: parentComponent2,
|
3010 | container: container2
|
3011 | } = suspense;
|
3012 | let delayEnter = false;
|
3013 | if (suspense.isHydrating) {
|
3014 | suspense.isHydrating = false;
|
3015 | } else if (!resume) {
|
3016 | delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
3017 | if (delayEnter) {
|
3018 | activeBranch.transition.afterLeave = () => {
|
3019 | if (pendingId === suspense.pendingId) {
|
3020 | move(
|
3021 | pendingBranch,
|
3022 | container2,
|
3023 | anchor === initialAnchor ? next(activeBranch) : anchor,
|
3024 | 0
|
3025 | );
|
3026 | queuePostFlushCb(effects);
|
3027 | }
|
3028 | };
|
3029 | }
|
3030 | if (activeBranch) {
|
3031 | if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
|
3032 | anchor = next(activeBranch);
|
3033 | }
|
3034 | unmount(activeBranch, parentComponent2, suspense, true);
|
3035 | }
|
3036 | if (!delayEnter) {
|
3037 | move(pendingBranch, container2, anchor, 0);
|
3038 | }
|
3039 | }
|
3040 | setActiveBranch(suspense, pendingBranch);
|
3041 | suspense.pendingBranch = null;
|
3042 | suspense.isInFallback = false;
|
3043 | let parent = suspense.parent;
|
3044 | let hasUnresolvedAncestor = false;
|
3045 | while (parent) {
|
3046 | if (parent.pendingBranch) {
|
3047 | parent.effects.push(...effects);
|
3048 | hasUnresolvedAncestor = true;
|
3049 | break;
|
3050 | }
|
3051 | parent = parent.parent;
|
3052 | }
|
3053 | if (!hasUnresolvedAncestor && !delayEnter) {
|
3054 | queuePostFlushCb(effects);
|
3055 | }
|
3056 | suspense.effects = [];
|
3057 | if (isSuspensible) {
|
3058 | if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
3059 | parentSuspense.deps--;
|
3060 | if (parentSuspense.deps === 0 && !sync) {
|
3061 | parentSuspense.resolve();
|
3062 | }
|
3063 | }
|
3064 | }
|
3065 | triggerEvent(vnode2, "onResolve");
|
3066 | },
|
3067 | fallback(fallbackVNode) {
|
3068 | if (!suspense.pendingBranch) {
|
3069 | return;
|
3070 | }
|
3071 | const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
3072 | triggerEvent(vnode2, "onFallback");
|
3073 | const anchor2 = next(activeBranch);
|
3074 | const mountFallback = () => {
|
3075 | if (!suspense.isInFallback) {
|
3076 | return;
|
3077 | }
|
3078 | patch(
|
3079 | null,
|
3080 | fallbackVNode,
|
3081 | container2,
|
3082 | anchor2,
|
3083 | parentComponent2,
|
3084 | null,
|
3085 |
|
3086 | namespace2,
|
3087 | slotScopeIds,
|
3088 | optimized
|
3089 | );
|
3090 | setActiveBranch(suspense, fallbackVNode);
|
3091 | };
|
3092 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
3093 | if (delayEnter) {
|
3094 | activeBranch.transition.afterLeave = mountFallback;
|
3095 | }
|
3096 | suspense.isInFallback = true;
|
3097 | unmount(
|
3098 | activeBranch,
|
3099 | parentComponent2,
|
3100 | null,
|
3101 |
|
3102 | true
|
3103 |
|
3104 | );
|
3105 | if (!delayEnter) {
|
3106 | mountFallback();
|
3107 | }
|
3108 | },
|
3109 | move(container2, anchor2, type) {
|
3110 | suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
3111 | suspense.container = container2;
|
3112 | },
|
3113 | next() {
|
3114 | return suspense.activeBranch && next(suspense.activeBranch);
|
3115 | },
|
3116 | registerDep(instance, setupRenderEffect) {
|
3117 | const isInPendingSuspense = !!suspense.pendingBranch;
|
3118 | if (isInPendingSuspense) {
|
3119 | suspense.deps++;
|
3120 | }
|
3121 | const hydratedEl = instance.vnode.el;
|
3122 | instance.asyncDep.catch((err) => {
|
3123 | handleError(err, instance, 0);
|
3124 | }).then((asyncSetupResult) => {
|
3125 | if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
3126 | return;
|
3127 | }
|
3128 | instance.asyncResolved = true;
|
3129 | const { vnode: vnode2 } = instance;
|
3130 | {
|
3131 | pushWarningContext(vnode2);
|
3132 | }
|
3133 | handleSetupResult(instance, asyncSetupResult, false);
|
3134 | if (hydratedEl) {
|
3135 | vnode2.el = hydratedEl;
|
3136 | }
|
3137 | const placeholder = !hydratedEl && instance.subTree.el;
|
3138 | setupRenderEffect(
|
3139 | instance,
|
3140 | vnode2,
|
3141 |
|
3142 |
|
3143 |
|
3144 | parentNode(hydratedEl || instance.subTree.el),
|
3145 |
|
3146 |
|
3147 | hydratedEl ? null : next(instance.subTree),
|
3148 | suspense,
|
3149 | namespace,
|
3150 | optimized
|
3151 | );
|
3152 | if (placeholder) {
|
3153 | remove(placeholder);
|
3154 | }
|
3155 | updateHOCHostEl(instance, vnode2.el);
|
3156 | {
|
3157 | popWarningContext();
|
3158 | }
|
3159 | if (isInPendingSuspense && --suspense.deps === 0) {
|
3160 | suspense.resolve();
|
3161 | }
|
3162 | });
|
3163 | },
|
3164 | unmount(parentSuspense2, doRemove) {
|
3165 | suspense.isUnmounted = true;
|
3166 | if (suspense.activeBranch) {
|
3167 | unmount(
|
3168 | suspense.activeBranch,
|
3169 | parentComponent,
|
3170 | parentSuspense2,
|
3171 | doRemove
|
3172 | );
|
3173 | }
|
3174 | if (suspense.pendingBranch) {
|
3175 | unmount(
|
3176 | suspense.pendingBranch,
|
3177 | parentComponent,
|
3178 | parentSuspense2,
|
3179 | doRemove
|
3180 | );
|
3181 | }
|
3182 | }
|
3183 | };
|
3184 | return suspense;
|
3185 | }
|
3186 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
3187 | const suspense = vnode.suspense = createSuspenseBoundary(
|
3188 | vnode,
|
3189 | parentSuspense,
|
3190 | parentComponent,
|
3191 | node.parentNode,
|
3192 |
|
3193 | document.createElement("div"),
|
3194 | null,
|
3195 | namespace,
|
3196 | slotScopeIds,
|
3197 | optimized,
|
3198 | rendererInternals,
|
3199 | true
|
3200 | );
|
3201 | const result = hydrateNode(
|
3202 | node,
|
3203 | suspense.pendingBranch = vnode.ssContent,
|
3204 | parentComponent,
|
3205 | suspense,
|
3206 | slotScopeIds,
|
3207 | optimized
|
3208 | );
|
3209 | if (suspense.deps === 0) {
|
3210 | suspense.resolve(false, true);
|
3211 | }
|
3212 | return result;
|
3213 | }
|
3214 | function normalizeSuspenseChildren(vnode) {
|
3215 | const { shapeFlag, children } = vnode;
|
3216 | const isSlotChildren = shapeFlag & 32;
|
3217 | vnode.ssContent = normalizeSuspenseSlot(
|
3218 | isSlotChildren ? children.default : children
|
3219 | );
|
3220 | vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
3221 | }
|
3222 | function normalizeSuspenseSlot(s) {
|
3223 | let block;
|
3224 | if (isFunction(s)) {
|
3225 | const trackBlock = isBlockTreeEnabled && s._c;
|
3226 | if (trackBlock) {
|
3227 | s._d = false;
|
3228 | openBlock();
|
3229 | }
|
3230 | s = s();
|
3231 | if (trackBlock) {
|
3232 | s._d = true;
|
3233 | block = currentBlock;
|
3234 | closeBlock();
|
3235 | }
|
3236 | }
|
3237 | if (isArray(s)) {
|
3238 | const singleChild = filterSingleRoot(s);
|
3239 | if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
|
3240 | warn$1(`<Suspense> slots expect a single root node.`);
|
3241 | }
|
3242 | s = singleChild;
|
3243 | }
|
3244 | s = normalizeVNode(s);
|
3245 | if (block && !s.dynamicChildren) {
|
3246 | s.dynamicChildren = block.filter((c) => c !== s);
|
3247 | }
|
3248 | return s;
|
3249 | }
|
3250 | function queueEffectWithSuspense(fn, suspense) {
|
3251 | if (suspense && suspense.pendingBranch) {
|
3252 | if (isArray(fn)) {
|
3253 | suspense.effects.push(...fn);
|
3254 | } else {
|
3255 | suspense.effects.push(fn);
|
3256 | }
|
3257 | } else {
|
3258 | queuePostFlushCb(fn);
|
3259 | }
|
3260 | }
|
3261 | function setActiveBranch(suspense, branch) {
|
3262 | suspense.activeBranch = branch;
|
3263 | const { vnode, parentComponent } = suspense;
|
3264 | let el = branch.el;
|
3265 | while (!el && branch.component) {
|
3266 | branch = branch.component.subTree;
|
3267 | el = branch.el;
|
3268 | }
|
3269 | vnode.el = el;
|
3270 | if (parentComponent && parentComponent.subTree === vnode) {
|
3271 | parentComponent.vnode.el = el;
|
3272 | updateHOCHostEl(parentComponent, el);
|
3273 | }
|
3274 | }
|
3275 | function isVNodeSuspensible(vnode) {
|
3276 | var _a;
|
3277 | return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
3278 | }
|
3279 |
|
3280 | const ssrContextKey = Symbol.for("v-scx");
|
3281 | const useSSRContext = () => {
|
3282 | {
|
3283 | warn$1(`useSSRContext() is not supported in the global build.`);
|
3284 | }
|
3285 | };
|
3286 |
|
3287 | function watchEffect(effect, options) {
|
3288 | return doWatch(effect, null, options);
|
3289 | }
|
3290 | function watchPostEffect(effect, options) {
|
3291 | return doWatch(
|
3292 | effect,
|
3293 | null,
|
3294 | extend({}, options, { flush: "post" })
|
3295 | );
|
3296 | }
|
3297 | function watchSyncEffect(effect, options) {
|
3298 | return doWatch(
|
3299 | effect,
|
3300 | null,
|
3301 | extend({}, options, { flush: "sync" })
|
3302 | );
|
3303 | }
|
3304 | const INITIAL_WATCHER_VALUE = {};
|
3305 | function watch(source, cb, options) {
|
3306 | if (!isFunction(cb)) {
|
3307 | warn$1(
|
3308 | `\`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.`
|
3309 | );
|
3310 | }
|
3311 | return doWatch(source, cb, options);
|
3312 | }
|
3313 | function doWatch(source, cb, {
|
3314 | immediate,
|
3315 | deep,
|
3316 | flush,
|
3317 | once,
|
3318 | onTrack,
|
3319 | onTrigger
|
3320 | } = EMPTY_OBJ) {
|
3321 | if (cb && once) {
|
3322 | const _cb = cb;
|
3323 | cb = (...args) => {
|
3324 | _cb(...args);
|
3325 | unwatch();
|
3326 | };
|
3327 | }
|
3328 | if (deep !== void 0 && typeof deep === "number") {
|
3329 | warn$1(
|
3330 | `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
|
3331 | );
|
3332 | }
|
3333 | if (!cb) {
|
3334 | if (immediate !== void 0) {
|
3335 | warn$1(
|
3336 | `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
3337 | );
|
3338 | }
|
3339 | if (deep !== void 0) {
|
3340 | warn$1(
|
3341 | `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
3342 | );
|
3343 | }
|
3344 | if (once !== void 0) {
|
3345 | warn$1(
|
3346 | `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
3347 | );
|
3348 | }
|
3349 | }
|
3350 | const warnInvalidSource = (s) => {
|
3351 | warn$1(
|
3352 | `Invalid watch source: `,
|
3353 | s,
|
3354 | `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
3355 | );
|
3356 | };
|
3357 | const instance = currentInstance;
|
3358 | const reactiveGetter = (source2) => deep === true ? source2 : (
|
3359 |
|
3360 | traverse(source2, deep === false ? 1 : void 0)
|
3361 | );
|
3362 | let getter;
|
3363 | let forceTrigger = false;
|
3364 | let isMultiSource = false;
|
3365 | if (isRef(source)) {
|
3366 | getter = () => source.value;
|
3367 | forceTrigger = isShallow(source);
|
3368 | } else if (isReactive(source)) {
|
3369 | getter = () => reactiveGetter(source);
|
3370 | forceTrigger = true;
|
3371 | } else if (isArray(source)) {
|
3372 | isMultiSource = true;
|
3373 | forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
3374 | getter = () => source.map((s) => {
|
3375 | if (isRef(s)) {
|
3376 | return s.value;
|
3377 | } else if (isReactive(s)) {
|
3378 | return reactiveGetter(s);
|
3379 | } else if (isFunction(s)) {
|
3380 | return callWithErrorHandling(s, instance, 2);
|
3381 | } else {
|
3382 | warnInvalidSource(s);
|
3383 | }
|
3384 | });
|
3385 | } else if (isFunction(source)) {
|
3386 | if (cb) {
|
3387 | getter = () => callWithErrorHandling(source, instance, 2);
|
3388 | } else {
|
3389 | getter = () => {
|
3390 | if (cleanup) {
|
3391 | cleanup();
|
3392 | }
|
3393 | return callWithAsyncErrorHandling(
|
3394 | source,
|
3395 | instance,
|
3396 | 3,
|
3397 | [onCleanup]
|
3398 | );
|
3399 | };
|
3400 | }
|
3401 | } else {
|
3402 | getter = NOOP;
|
3403 | warnInvalidSource(source);
|
3404 | }
|
3405 | if (cb && deep) {
|
3406 | const baseGetter = getter;
|
3407 | getter = () => traverse(baseGetter());
|
3408 | }
|
3409 | let cleanup;
|
3410 | let onCleanup = (fn) => {
|
3411 | cleanup = effect.onStop = () => {
|
3412 | callWithErrorHandling(fn, instance, 4);
|
3413 | cleanup = effect.onStop = void 0;
|
3414 | };
|
3415 | };
|
3416 | let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
3417 | const job = () => {
|
3418 | if (!effect.active || !effect.dirty) {
|
3419 | return;
|
3420 | }
|
3421 | if (cb) {
|
3422 | const newValue = effect.run();
|
3423 | if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
|
3424 | if (cleanup) {
|
3425 | cleanup();
|
3426 | }
|
3427 | callWithAsyncErrorHandling(cb, instance, 3, [
|
3428 | newValue,
|
3429 |
|
3430 | oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
3431 | onCleanup
|
3432 | ]);
|
3433 | oldValue = newValue;
|
3434 | }
|
3435 | } else {
|
3436 | effect.run();
|
3437 | }
|
3438 | };
|
3439 | job.allowRecurse = !!cb;
|
3440 | let scheduler;
|
3441 | if (flush === "sync") {
|
3442 | scheduler = job;
|
3443 | } else if (flush === "post") {
|
3444 | scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
3445 | } else {
|
3446 | job.pre = true;
|
3447 | if (instance)
|
3448 | job.id = instance.uid;
|
3449 | scheduler = () => queueJob(job);
|
3450 | }
|
3451 | const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
3452 | const scope = getCurrentScope();
|
3453 | const unwatch = () => {
|
3454 | effect.stop();
|
3455 | if (scope) {
|
3456 | remove(scope.effects, effect);
|
3457 | }
|
3458 | };
|
3459 | {
|
3460 | effect.onTrack = onTrack;
|
3461 | effect.onTrigger = onTrigger;
|
3462 | }
|
3463 | if (cb) {
|
3464 | if (immediate) {
|
3465 | job();
|
3466 | } else {
|
3467 | oldValue = effect.run();
|
3468 | }
|
3469 | } else if (flush === "post") {
|
3470 | queuePostRenderEffect(
|
3471 | effect.run.bind(effect),
|
3472 | instance && instance.suspense
|
3473 | );
|
3474 | } else {
|
3475 | effect.run();
|
3476 | }
|
3477 | return unwatch;
|
3478 | }
|
3479 | function instanceWatch(source, value, options) {
|
3480 | const publicThis = this.proxy;
|
3481 | const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
3482 | let cb;
|
3483 | if (isFunction(value)) {
|
3484 | cb = value;
|
3485 | } else {
|
3486 | cb = value.handler;
|
3487 | options = value;
|
3488 | }
|
3489 | const reset = setCurrentInstance(this);
|
3490 | const res = doWatch(getter, cb.bind(publicThis), options);
|
3491 | reset();
|
3492 | return res;
|
3493 | }
|
3494 | function createPathGetter(ctx, path) {
|
3495 | const segments = path.split(".");
|
3496 | return () => {
|
3497 | let cur = ctx;
|
3498 | for (let i = 0; i < segments.length && cur; i++) {
|
3499 | cur = cur[segments[i]];
|
3500 | }
|
3501 | return cur;
|
3502 | };
|
3503 | }
|
3504 | function traverse(value, depth, currentDepth = 0, seen) {
|
3505 | if (!isObject(value) || value["__v_skip"]) {
|
3506 | return value;
|
3507 | }
|
3508 | if (depth && depth > 0) {
|
3509 | if (currentDepth >= depth) {
|
3510 | return value;
|
3511 | }
|
3512 | currentDepth++;
|
3513 | }
|
3514 | seen = seen || new Set();
|
3515 | if (seen.has(value)) {
|
3516 | return value;
|
3517 | }
|
3518 | seen.add(value);
|
3519 | if (isRef(value)) {
|
3520 | traverse(value.value, depth, currentDepth, seen);
|
3521 | } else if (isArray(value)) {
|
3522 | for (let i = 0; i < value.length; i++) {
|
3523 | traverse(value[i], depth, currentDepth, seen);
|
3524 | }
|
3525 | } else if (isSet(value) || isMap(value)) {
|
3526 | value.forEach((v) => {
|
3527 | traverse(v, depth, currentDepth, seen);
|
3528 | });
|
3529 | } else if (isPlainObject(value)) {
|
3530 | for (const key in value) {
|
3531 | traverse(value[key], depth, currentDepth, seen);
|
3532 | }
|
3533 | }
|
3534 | return value;
|
3535 | }
|
3536 |
|
3537 | function validateDirectiveName(name) {
|
3538 | if (isBuiltInDirective(name)) {
|
3539 | warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
3540 | }
|
3541 | }
|
3542 | function withDirectives(vnode, directives) {
|
3543 | if (currentRenderingInstance === null) {
|
3544 | warn$1(`withDirectives can only be used inside render functions.`);
|
3545 | return vnode;
|
3546 | }
|
3547 | const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
|
3548 | const bindings = vnode.dirs || (vnode.dirs = []);
|
3549 | for (let i = 0; i < directives.length; i++) {
|
3550 | let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
3551 | if (dir) {
|
3552 | if (isFunction(dir)) {
|
3553 | dir = {
|
3554 | mounted: dir,
|
3555 | updated: dir
|
3556 | };
|
3557 | }
|
3558 | if (dir.deep) {
|
3559 | traverse(value);
|
3560 | }
|
3561 | bindings.push({
|
3562 | dir,
|
3563 | instance,
|
3564 | value,
|
3565 | oldValue: void 0,
|
3566 | arg,
|
3567 | modifiers
|
3568 | });
|
3569 | }
|
3570 | }
|
3571 | return vnode;
|
3572 | }
|
3573 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
3574 | const bindings = vnode.dirs;
|
3575 | const oldBindings = prevVNode && prevVNode.dirs;
|
3576 | for (let i = 0; i < bindings.length; i++) {
|
3577 | const binding = bindings[i];
|
3578 | if (oldBindings) {
|
3579 | binding.oldValue = oldBindings[i].value;
|
3580 | }
|
3581 | let hook = binding.dir[name];
|
3582 | if (hook) {
|
3583 | pauseTracking();
|
3584 | callWithAsyncErrorHandling(hook, instance, 8, [
|
3585 | vnode.el,
|
3586 | binding,
|
3587 | vnode,
|
3588 | prevVNode
|
3589 | ]);
|
3590 | resetTracking();
|
3591 | }
|
3592 | }
|
3593 | }
|
3594 |
|
3595 | const leaveCbKey = Symbol("_leaveCb");
|
3596 | const enterCbKey$1 = Symbol("_enterCb");
|
3597 | function useTransitionState() {
|
3598 | const state = {
|
3599 | isMounted: false,
|
3600 | isLeaving: false,
|
3601 | isUnmounting: false,
|
3602 | leavingVNodes: new Map()
|
3603 | };
|
3604 | onMounted(() => {
|
3605 | state.isMounted = true;
|
3606 | });
|
3607 | onBeforeUnmount(() => {
|
3608 | state.isUnmounting = true;
|
3609 | });
|
3610 | return state;
|
3611 | }
|
3612 | const TransitionHookValidator = [Function, Array];
|
3613 | const BaseTransitionPropsValidators = {
|
3614 | mode: String,
|
3615 | appear: Boolean,
|
3616 | persisted: Boolean,
|
3617 |
|
3618 | onBeforeEnter: TransitionHookValidator,
|
3619 | onEnter: TransitionHookValidator,
|
3620 | onAfterEnter: TransitionHookValidator,
|
3621 | onEnterCancelled: TransitionHookValidator,
|
3622 |
|
3623 | onBeforeLeave: TransitionHookValidator,
|
3624 | onLeave: TransitionHookValidator,
|
3625 | onAfterLeave: TransitionHookValidator,
|
3626 | onLeaveCancelled: TransitionHookValidator,
|
3627 |
|
3628 | onBeforeAppear: TransitionHookValidator,
|
3629 | onAppear: TransitionHookValidator,
|
3630 | onAfterAppear: TransitionHookValidator,
|
3631 | onAppearCancelled: TransitionHookValidator
|
3632 | };
|
3633 | const BaseTransitionImpl = {
|
3634 | name: `BaseTransition`,
|
3635 | props: BaseTransitionPropsValidators,
|
3636 | setup(props, { slots }) {
|
3637 | const instance = getCurrentInstance();
|
3638 | const state = useTransitionState();
|
3639 | return () => {
|
3640 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
3641 | if (!children || !children.length) {
|
3642 | return;
|
3643 | }
|
3644 | let child = children[0];
|
3645 | if (children.length > 1) {
|
3646 | let hasFound = false;
|
3647 | for (const c of children) {
|
3648 | if (c.type !== Comment) {
|
3649 | if (hasFound) {
|
3650 | warn$1(
|
3651 | "<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
3652 | );
|
3653 | break;
|
3654 | }
|
3655 | child = c;
|
3656 | hasFound = true;
|
3657 | }
|
3658 | }
|
3659 | }
|
3660 | const rawProps = toRaw(props);
|
3661 | const { mode } = rawProps;
|
3662 | if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
3663 | warn$1(`invalid <transition> mode: ${mode}`);
|
3664 | }
|
3665 | if (state.isLeaving) {
|
3666 | return emptyPlaceholder(child);
|
3667 | }
|
3668 | const innerChild = getKeepAliveChild(child);
|
3669 | if (!innerChild) {
|
3670 | return emptyPlaceholder(child);
|
3671 | }
|
3672 | const enterHooks = resolveTransitionHooks(
|
3673 | innerChild,
|
3674 | rawProps,
|
3675 | state,
|
3676 | instance
|
3677 | );
|
3678 | setTransitionHooks(innerChild, enterHooks);
|
3679 | const oldChild = instance.subTree;
|
3680 | const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
3681 | if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
3682 | const leavingHooks = resolveTransitionHooks(
|
3683 | oldInnerChild,
|
3684 | rawProps,
|
3685 | state,
|
3686 | instance
|
3687 | );
|
3688 | setTransitionHooks(oldInnerChild, leavingHooks);
|
3689 | if (mode === "out-in") {
|
3690 | state.isLeaving = true;
|
3691 | leavingHooks.afterLeave = () => {
|
3692 | state.isLeaving = false;
|
3693 | if (instance.update.active !== false) {
|
3694 | instance.effect.dirty = true;
|
3695 | instance.update();
|
3696 | }
|
3697 | };
|
3698 | return emptyPlaceholder(child);
|
3699 | } else if (mode === "in-out" && innerChild.type !== Comment) {
|
3700 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
3701 | const leavingVNodesCache = getLeavingNodesForType(
|
3702 | state,
|
3703 | oldInnerChild
|
3704 | );
|
3705 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
3706 | el[leaveCbKey] = () => {
|
3707 | earlyRemove();
|
3708 | el[leaveCbKey] = void 0;
|
3709 | delete enterHooks.delayedLeave;
|
3710 | };
|
3711 | enterHooks.delayedLeave = delayedLeave;
|
3712 | };
|
3713 | }
|
3714 | }
|
3715 | return child;
|
3716 | };
|
3717 | }
|
3718 | };
|
3719 | const BaseTransition = BaseTransitionImpl;
|
3720 | function getLeavingNodesForType(state, vnode) {
|
3721 | const { leavingVNodes } = state;
|
3722 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
3723 | if (!leavingVNodesCache) {
|
3724 | leavingVNodesCache = Object.create(null);
|
3725 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
3726 | }
|
3727 | return leavingVNodesCache;
|
3728 | }
|
3729 | function resolveTransitionHooks(vnode, props, state, instance) {
|
3730 | const {
|
3731 | appear,
|
3732 | mode,
|
3733 | persisted = false,
|
3734 | onBeforeEnter,
|
3735 | onEnter,
|
3736 | onAfterEnter,
|
3737 | onEnterCancelled,
|
3738 | onBeforeLeave,
|
3739 | onLeave,
|
3740 | onAfterLeave,
|
3741 | onLeaveCancelled,
|
3742 | onBeforeAppear,
|
3743 | onAppear,
|
3744 | onAfterAppear,
|
3745 | onAppearCancelled
|
3746 | } = props;
|
3747 | const key = String(vnode.key);
|
3748 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
3749 | const callHook = (hook, args) => {
|
3750 | hook && callWithAsyncErrorHandling(
|
3751 | hook,
|
3752 | instance,
|
3753 | 9,
|
3754 | args
|
3755 | );
|
3756 | };
|
3757 | const callAsyncHook = (hook, args) => {
|
3758 | const done = args[1];
|
3759 | callHook(hook, args);
|
3760 | if (isArray(hook)) {
|
3761 | if (hook.every((hook2) => hook2.length <= 1))
|
3762 | done();
|
3763 | } else if (hook.length <= 1) {
|
3764 | done();
|
3765 | }
|
3766 | };
|
3767 | const hooks = {
|
3768 | mode,
|
3769 | persisted,
|
3770 | beforeEnter(el) {
|
3771 | let hook = onBeforeEnter;
|
3772 | if (!state.isMounted) {
|
3773 | if (appear) {
|
3774 | hook = onBeforeAppear || onBeforeEnter;
|
3775 | } else {
|
3776 | return;
|
3777 | }
|
3778 | }
|
3779 | if (el[leaveCbKey]) {
|
3780 | el[leaveCbKey](
|
3781 | true
|
3782 |
|
3783 | );
|
3784 | }
|
3785 | const leavingVNode = leavingVNodesCache[key];
|
3786 | if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
|
3787 | leavingVNode.el[leaveCbKey]();
|
3788 | }
|
3789 | callHook(hook, [el]);
|
3790 | },
|
3791 | enter(el) {
|
3792 | let hook = onEnter;
|
3793 | let afterHook = onAfterEnter;
|
3794 | let cancelHook = onEnterCancelled;
|
3795 | if (!state.isMounted) {
|
3796 | if (appear) {
|
3797 | hook = onAppear || onEnter;
|
3798 | afterHook = onAfterAppear || onAfterEnter;
|
3799 | cancelHook = onAppearCancelled || onEnterCancelled;
|
3800 | } else {
|
3801 | return;
|
3802 | }
|
3803 | }
|
3804 | let called = false;
|
3805 | const done = el[enterCbKey$1] = (cancelled) => {
|
3806 | if (called)
|
3807 | return;
|
3808 | called = true;
|
3809 | if (cancelled) {
|
3810 | callHook(cancelHook, [el]);
|
3811 | } else {
|
3812 | callHook(afterHook, [el]);
|
3813 | }
|
3814 | if (hooks.delayedLeave) {
|
3815 | hooks.delayedLeave();
|
3816 | }
|
3817 | el[enterCbKey$1] = void 0;
|
3818 | };
|
3819 | if (hook) {
|
3820 | callAsyncHook(hook, [el, done]);
|
3821 | } else {
|
3822 | done();
|
3823 | }
|
3824 | },
|
3825 | leave(el, remove) {
|
3826 | const key2 = String(vnode.key);
|
3827 | if (el[enterCbKey$1]) {
|
3828 | el[enterCbKey$1](
|
3829 | true
|
3830 |
|
3831 | );
|
3832 | }
|
3833 | if (state.isUnmounting) {
|
3834 | return remove();
|
3835 | }
|
3836 | callHook(onBeforeLeave, [el]);
|
3837 | let called = false;
|
3838 | const done = el[leaveCbKey] = (cancelled) => {
|
3839 | if (called)
|
3840 | return;
|
3841 | called = true;
|
3842 | remove();
|
3843 | if (cancelled) {
|
3844 | callHook(onLeaveCancelled, [el]);
|
3845 | } else {
|
3846 | callHook(onAfterLeave, [el]);
|
3847 | }
|
3848 | el[leaveCbKey] = void 0;
|
3849 | if (leavingVNodesCache[key2] === vnode) {
|
3850 | delete leavingVNodesCache[key2];
|
3851 | }
|
3852 | };
|
3853 | leavingVNodesCache[key2] = vnode;
|
3854 | if (onLeave) {
|
3855 | callAsyncHook(onLeave, [el, done]);
|
3856 | } else {
|
3857 | done();
|
3858 | }
|
3859 | },
|
3860 | clone(vnode2) {
|
3861 | return resolveTransitionHooks(vnode2, props, state, instance);
|
3862 | }
|
3863 | };
|
3864 | return hooks;
|
3865 | }
|
3866 | function emptyPlaceholder(vnode) {
|
3867 | if (isKeepAlive(vnode)) {
|
3868 | vnode = cloneVNode(vnode);
|
3869 | vnode.children = null;
|
3870 | return vnode;
|
3871 | }
|
3872 | }
|
3873 | function getKeepAliveChild(vnode) {
|
3874 | return isKeepAlive(vnode) ? (
|
3875 |
|
3876 |
|
3877 | vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
|
3878 | ) : vnode;
|
3879 | }
|
3880 | function setTransitionHooks(vnode, hooks) {
|
3881 | if (vnode.shapeFlag & 6 && vnode.component) {
|
3882 | setTransitionHooks(vnode.component.subTree, hooks);
|
3883 | } else if (vnode.shapeFlag & 128) {
|
3884 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
3885 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
3886 | } else {
|
3887 | vnode.transition = hooks;
|
3888 | }
|
3889 | }
|
3890 | function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
3891 | let ret = [];
|
3892 | let keyedFragmentCount = 0;
|
3893 | for (let i = 0; i < children.length; i++) {
|
3894 | let child = children[i];
|
3895 | const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
|
3896 | if (child.type === Fragment) {
|
3897 | if (child.patchFlag & 128)
|
3898 | keyedFragmentCount++;
|
3899 | ret = ret.concat(
|
3900 | getTransitionRawChildren(child.children, keepComment, key)
|
3901 | );
|
3902 | } else if (keepComment || child.type !== Comment) {
|
3903 | ret.push(key != null ? cloneVNode(child, { key }) : child);
|
3904 | }
|
3905 | }
|
3906 | if (keyedFragmentCount > 1) {
|
3907 | for (let i = 0; i < ret.length; i++) {
|
3908 | ret[i].patchFlag = -2;
|
3909 | }
|
3910 | }
|
3911 | return ret;
|
3912 | }
|
3913 |
|
3914 |
|
3915 |
|
3916 | function defineComponent(options, extraOptions) {
|
3917 | return isFunction(options) ? (
|
3918 |
|
3919 |
|
3920 | (() => extend({ name: options.name }, extraOptions, { setup: options }))()
|
3921 | ) : options;
|
3922 | }
|
3923 |
|
3924 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
3925 |
|
3926 |
|
3927 | function defineAsyncComponent(source) {
|
3928 | if (isFunction(source)) {
|
3929 | source = { loader: source };
|
3930 | }
|
3931 | const {
|
3932 | loader,
|
3933 | loadingComponent,
|
3934 | errorComponent,
|
3935 | delay = 200,
|
3936 | timeout,
|
3937 |
|
3938 | suspensible = true,
|
3939 | onError: userOnError
|
3940 | } = source;
|
3941 | let pendingRequest = null;
|
3942 | let resolvedComp;
|
3943 | let retries = 0;
|
3944 | const retry = () => {
|
3945 | retries++;
|
3946 | pendingRequest = null;
|
3947 | return load();
|
3948 | };
|
3949 | const load = () => {
|
3950 | let thisRequest;
|
3951 | return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
3952 | err = err instanceof Error ? err : new Error(String(err));
|
3953 | if (userOnError) {
|
3954 | return new Promise((resolve, reject) => {
|
3955 | const userRetry = () => resolve(retry());
|
3956 | const userFail = () => reject(err);
|
3957 | userOnError(err, userRetry, userFail, retries + 1);
|
3958 | });
|
3959 | } else {
|
3960 | throw err;
|
3961 | }
|
3962 | }).then((comp) => {
|
3963 | if (thisRequest !== pendingRequest && pendingRequest) {
|
3964 | return pendingRequest;
|
3965 | }
|
3966 | if (!comp) {
|
3967 | warn$1(
|
3968 | `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
|
3969 | );
|
3970 | }
|
3971 | if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
3972 | comp = comp.default;
|
3973 | }
|
3974 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
3975 | throw new Error(`Invalid async component load result: ${comp}`);
|
3976 | }
|
3977 | resolvedComp = comp;
|
3978 | return comp;
|
3979 | }));
|
3980 | };
|
3981 | return defineComponent({
|
3982 | name: "AsyncComponentWrapper",
|
3983 | __asyncLoader: load,
|
3984 | get __asyncResolved() {
|
3985 | return resolvedComp;
|
3986 | },
|
3987 | setup() {
|
3988 | const instance = currentInstance;
|
3989 | if (resolvedComp) {
|
3990 | return () => createInnerComp(resolvedComp, instance);
|
3991 | }
|
3992 | const onError = (err) => {
|
3993 | pendingRequest = null;
|
3994 | handleError(
|
3995 | err,
|
3996 | instance,
|
3997 | 13,
|
3998 | !errorComponent
|
3999 | );
|
4000 | };
|
4001 | if (suspensible && instance.suspense || false) {
|
4002 | return load().then((comp) => {
|
4003 | return () => createInnerComp(comp, instance);
|
4004 | }).catch((err) => {
|
4005 | onError(err);
|
4006 | return () => errorComponent ? createVNode(errorComponent, {
|
4007 | error: err
|
4008 | }) : null;
|
4009 | });
|
4010 | }
|
4011 | const loaded = ref(false);
|
4012 | const error = ref();
|
4013 | const delayed = ref(!!delay);
|
4014 | if (delay) {
|
4015 | setTimeout(() => {
|
4016 | delayed.value = false;
|
4017 | }, delay);
|
4018 | }
|
4019 | if (timeout != null) {
|
4020 | setTimeout(() => {
|
4021 | if (!loaded.value && !error.value) {
|
4022 | const err = new Error(
|
4023 | `Async component timed out after ${timeout}ms.`
|
4024 | );
|
4025 | onError(err);
|
4026 | error.value = err;
|
4027 | }
|
4028 | }, timeout);
|
4029 | }
|
4030 | load().then(() => {
|
4031 | loaded.value = true;
|
4032 | if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
4033 | instance.parent.effect.dirty = true;
|
4034 | queueJob(instance.parent.update);
|
4035 | }
|
4036 | }).catch((err) => {
|
4037 | onError(err);
|
4038 | error.value = err;
|
4039 | });
|
4040 | return () => {
|
4041 | if (loaded.value && resolvedComp) {
|
4042 | return createInnerComp(resolvedComp, instance);
|
4043 | } else if (error.value && errorComponent) {
|
4044 | return createVNode(errorComponent, {
|
4045 | error: error.value
|
4046 | });
|
4047 | } else if (loadingComponent && !delayed.value) {
|
4048 | return createVNode(loadingComponent);
|
4049 | }
|
4050 | };
|
4051 | }
|
4052 | });
|
4053 | }
|
4054 | function createInnerComp(comp, parent) {
|
4055 | const { ref: ref2, props, children, ce } = parent.vnode;
|
4056 | const vnode = createVNode(comp, props, children);
|
4057 | vnode.ref = ref2;
|
4058 | vnode.ce = ce;
|
4059 | delete parent.vnode.ce;
|
4060 | return vnode;
|
4061 | }
|
4062 |
|
4063 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
4064 | const KeepAliveImpl = {
|
4065 | name: `KeepAlive`,
|
4066 |
|
4067 |
|
4068 |
|
4069 | __isKeepAlive: true,
|
4070 | props: {
|
4071 | include: [String, RegExp, Array],
|
4072 | exclude: [String, RegExp, Array],
|
4073 | max: [String, Number]
|
4074 | },
|
4075 | setup(props, { slots }) {
|
4076 | const instance = getCurrentInstance();
|
4077 | const sharedContext = instance.ctx;
|
4078 | const cache = new Map();
|
4079 | const keys = new Set();
|
4080 | let current = null;
|
4081 | {
|
4082 | instance.__v_cache = cache;
|
4083 | }
|
4084 | const parentSuspense = instance.suspense;
|
4085 | const {
|
4086 | renderer: {
|
4087 | p: patch,
|
4088 | m: move,
|
4089 | um: _unmount,
|
4090 | o: { createElement }
|
4091 | }
|
4092 | } = sharedContext;
|
4093 | const storageContainer = createElement("div");
|
4094 | sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
4095 | const instance2 = vnode.component;
|
4096 | move(vnode, container, anchor, 0, parentSuspense);
|
4097 | patch(
|
4098 | instance2.vnode,
|
4099 | vnode,
|
4100 | container,
|
4101 | anchor,
|
4102 | instance2,
|
4103 | parentSuspense,
|
4104 | namespace,
|
4105 | vnode.slotScopeIds,
|
4106 | optimized
|
4107 | );
|
4108 | queuePostRenderEffect(() => {
|
4109 | instance2.isDeactivated = false;
|
4110 | if (instance2.a) {
|
4111 | invokeArrayFns(instance2.a);
|
4112 | }
|
4113 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
4114 | if (vnodeHook) {
|
4115 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4116 | }
|
4117 | }, parentSuspense);
|
4118 | {
|
4119 | devtoolsComponentAdded(instance2);
|
4120 | }
|
4121 | };
|
4122 | sharedContext.deactivate = (vnode) => {
|
4123 | const instance2 = vnode.component;
|
4124 | move(vnode, storageContainer, null, 1, parentSuspense);
|
4125 | queuePostRenderEffect(() => {
|
4126 | if (instance2.da) {
|
4127 | invokeArrayFns(instance2.da);
|
4128 | }
|
4129 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
4130 | if (vnodeHook) {
|
4131 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4132 | }
|
4133 | instance2.isDeactivated = true;
|
4134 | }, parentSuspense);
|
4135 | {
|
4136 | devtoolsComponentAdded(instance2);
|
4137 | }
|
4138 | };
|
4139 | function unmount(vnode) {
|
4140 | resetShapeFlag(vnode);
|
4141 | _unmount(vnode, instance, parentSuspense, true);
|
4142 | }
|
4143 | function pruneCache(filter) {
|
4144 | cache.forEach((vnode, key) => {
|
4145 | const name = getComponentName(vnode.type);
|
4146 | if (name && (!filter || !filter(name))) {
|
4147 | pruneCacheEntry(key);
|
4148 | }
|
4149 | });
|
4150 | }
|
4151 | function pruneCacheEntry(key) {
|
4152 | const cached = cache.get(key);
|
4153 | if (!current || !isSameVNodeType(cached, current)) {
|
4154 | unmount(cached);
|
4155 | } else if (current) {
|
4156 | resetShapeFlag(current);
|
4157 | }
|
4158 | cache.delete(key);
|
4159 | keys.delete(key);
|
4160 | }
|
4161 | watch(
|
4162 | () => [props.include, props.exclude],
|
4163 | ([include, exclude]) => {
|
4164 | include && pruneCache((name) => matches(include, name));
|
4165 | exclude && pruneCache((name) => !matches(exclude, name));
|
4166 | },
|
4167 |
|
4168 | { flush: "post", deep: true }
|
4169 | );
|
4170 | let pendingCacheKey = null;
|
4171 | const cacheSubtree = () => {
|
4172 | if (pendingCacheKey != null) {
|
4173 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
4174 | }
|
4175 | };
|
4176 | onMounted(cacheSubtree);
|
4177 | onUpdated(cacheSubtree);
|
4178 | onBeforeUnmount(() => {
|
4179 | cache.forEach((cached) => {
|
4180 | const { subTree, suspense } = instance;
|
4181 | const vnode = getInnerChild(subTree);
|
4182 | if (cached.type === vnode.type && cached.key === vnode.key) {
|
4183 | resetShapeFlag(vnode);
|
4184 | const da = vnode.component.da;
|
4185 | da && queuePostRenderEffect(da, suspense);
|
4186 | return;
|
4187 | }
|
4188 | unmount(cached);
|
4189 | });
|
4190 | });
|
4191 | return () => {
|
4192 | pendingCacheKey = null;
|
4193 | if (!slots.default) {
|
4194 | return null;
|
4195 | }
|
4196 | const children = slots.default();
|
4197 | const rawVNode = children[0];
|
4198 | if (children.length > 1) {
|
4199 | {
|
4200 | warn$1(`KeepAlive should contain exactly one component child.`);
|
4201 | }
|
4202 | current = null;
|
4203 | return children;
|
4204 | } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
4205 | current = null;
|
4206 | return rawVNode;
|
4207 | }
|
4208 | let vnode = getInnerChild(rawVNode);
|
4209 | const comp = vnode.type;
|
4210 | const name = getComponentName(
|
4211 | isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
4212 | );
|
4213 | const { include, exclude, max } = props;
|
4214 | if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
4215 | current = vnode;
|
4216 | return rawVNode;
|
4217 | }
|
4218 | const key = vnode.key == null ? comp : vnode.key;
|
4219 | const cachedVNode = cache.get(key);
|
4220 | if (vnode.el) {
|
4221 | vnode = cloneVNode(vnode);
|
4222 | if (rawVNode.shapeFlag & 128) {
|
4223 | rawVNode.ssContent = vnode;
|
4224 | }
|
4225 | }
|
4226 | pendingCacheKey = key;
|
4227 | if (cachedVNode) {
|
4228 | vnode.el = cachedVNode.el;
|
4229 | vnode.component = cachedVNode.component;
|
4230 | if (vnode.transition) {
|
4231 | setTransitionHooks(vnode, vnode.transition);
|
4232 | }
|
4233 | vnode.shapeFlag |= 512;
|
4234 | keys.delete(key);
|
4235 | keys.add(key);
|
4236 | } else {
|
4237 | keys.add(key);
|
4238 | if (max && keys.size > parseInt(max, 10)) {
|
4239 | pruneCacheEntry(keys.values().next().value);
|
4240 | }
|
4241 | }
|
4242 | vnode.shapeFlag |= 256;
|
4243 | current = vnode;
|
4244 | return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
4245 | };
|
4246 | }
|
4247 | };
|
4248 | const KeepAlive = KeepAliveImpl;
|
4249 | function matches(pattern, name) {
|
4250 | if (isArray(pattern)) {
|
4251 | return pattern.some((p) => matches(p, name));
|
4252 | } else if (isString(pattern)) {
|
4253 | return pattern.split(",").includes(name);
|
4254 | } else if (isRegExp(pattern)) {
|
4255 | return pattern.test(name);
|
4256 | }
|
4257 | return false;
|
4258 | }
|
4259 | function onActivated(hook, target) {
|
4260 | registerKeepAliveHook(hook, "a", target);
|
4261 | }
|
4262 | function onDeactivated(hook, target) {
|
4263 | registerKeepAliveHook(hook, "da", target);
|
4264 | }
|
4265 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
4266 | const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
4267 | let current = target;
|
4268 | while (current) {
|
4269 | if (current.isDeactivated) {
|
4270 | return;
|
4271 | }
|
4272 | current = current.parent;
|
4273 | }
|
4274 | return hook();
|
4275 | });
|
4276 | injectHook(type, wrappedHook, target);
|
4277 | if (target) {
|
4278 | let current = target.parent;
|
4279 | while (current && current.parent) {
|
4280 | if (isKeepAlive(current.parent.vnode)) {
|
4281 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
4282 | }
|
4283 | current = current.parent;
|
4284 | }
|
4285 | }
|
4286 | }
|
4287 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
4288 | const injected = injectHook(
|
4289 | type,
|
4290 | hook,
|
4291 | keepAliveRoot,
|
4292 | true
|
4293 |
|
4294 | );
|
4295 | onUnmounted(() => {
|
4296 | remove(keepAliveRoot[type], injected);
|
4297 | }, target);
|
4298 | }
|
4299 | function resetShapeFlag(vnode) {
|
4300 | vnode.shapeFlag &= ~256;
|
4301 | vnode.shapeFlag &= ~512;
|
4302 | }
|
4303 | function getInnerChild(vnode) {
|
4304 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
4305 | }
|
4306 |
|
4307 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
4308 | if (target) {
|
4309 | const hooks = target[type] || (target[type] = []);
|
4310 | const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
4311 | if (target.isUnmounted) {
|
4312 | return;
|
4313 | }
|
4314 | pauseTracking();
|
4315 | const reset = setCurrentInstance(target);
|
4316 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
4317 | reset();
|
4318 | resetTracking();
|
4319 | return res;
|
4320 | });
|
4321 | if (prepend) {
|
4322 | hooks.unshift(wrappedHook);
|
4323 | } else {
|
4324 | hooks.push(wrappedHook);
|
4325 | }
|
4326 | return wrappedHook;
|
4327 | } else {
|
4328 | const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
4329 | warn$1(
|
4330 | `${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.` )
|
4331 | );
|
4332 | }
|
4333 | }
|
4334 | const createHook = (lifecycle) => (hook, target = currentInstance) => (
|
4335 |
|
4336 | (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
|
4337 | );
|
4338 | const onBeforeMount = createHook("bm");
|
4339 | const onMounted = createHook("m");
|
4340 | const onBeforeUpdate = createHook("bu");
|
4341 | const onUpdated = createHook("u");
|
4342 | const onBeforeUnmount = createHook("bum");
|
4343 | const onUnmounted = createHook("um");
|
4344 | const onServerPrefetch = createHook("sp");
|
4345 | const onRenderTriggered = createHook(
|
4346 | "rtg"
|
4347 | );
|
4348 | const onRenderTracked = createHook(
|
4349 | "rtc"
|
4350 | );
|
4351 | function onErrorCaptured(hook, target = currentInstance) {
|
4352 | injectHook("ec", hook, target);
|
4353 | }
|
4354 |
|
4355 | function renderList(source, renderItem, cache, index) {
|
4356 | let ret;
|
4357 | const cached = cache && cache[index];
|
4358 | if (isArray(source) || isString(source)) {
|
4359 | ret = new Array(source.length);
|
4360 | for (let i = 0, l = source.length; i < l; i++) {
|
4361 | ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
|
4362 | }
|
4363 | } else if (typeof source === "number") {
|
4364 | if (!Number.isInteger(source)) {
|
4365 | warn$1(`The v-for range expect an integer value but got ${source}.`);
|
4366 | }
|
4367 | ret = new Array(source);
|
4368 | for (let i = 0; i < source; i++) {
|
4369 | ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
4370 | }
|
4371 | } else if (isObject(source)) {
|
4372 | if (source[Symbol.iterator]) {
|
4373 | ret = Array.from(
|
4374 | source,
|
4375 | (item, i) => renderItem(item, i, void 0, cached && cached[i])
|
4376 | );
|
4377 | } else {
|
4378 | const keys = Object.keys(source);
|
4379 | ret = new Array(keys.length);
|
4380 | for (let i = 0, l = keys.length; i < l; i++) {
|
4381 | const key = keys[i];
|
4382 | ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
4383 | }
|
4384 | }
|
4385 | } else {
|
4386 | ret = [];
|
4387 | }
|
4388 | if (cache) {
|
4389 | cache[index] = ret;
|
4390 | }
|
4391 | return ret;
|
4392 | }
|
4393 |
|
4394 | function createSlots(slots, dynamicSlots) {
|
4395 | for (let i = 0; i < dynamicSlots.length; i++) {
|
4396 | const slot = dynamicSlots[i];
|
4397 | if (isArray(slot)) {
|
4398 | for (let j = 0; j < slot.length; j++) {
|
4399 | slots[slot[j].name] = slot[j].fn;
|
4400 | }
|
4401 | } else if (slot) {
|
4402 | slots[slot.name] = slot.key ? (...args) => {
|
4403 | const res = slot.fn(...args);
|
4404 | if (res)
|
4405 | res.key = slot.key;
|
4406 | return res;
|
4407 | } : slot.fn;
|
4408 | }
|
4409 | }
|
4410 | return slots;
|
4411 | }
|
4412 |
|
4413 | function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
4414 | if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
|
4415 | if (name !== "default")
|
4416 | props.name = name;
|
4417 | return createVNode("slot", props, fallback && fallback());
|
4418 | }
|
4419 | let slot = slots[name];
|
4420 | if (slot && slot.length > 1) {
|
4421 | warn$1(
|
4422 | `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.`
|
4423 | );
|
4424 | slot = () => [];
|
4425 | }
|
4426 | if (slot && slot._c) {
|
4427 | slot._d = false;
|
4428 | }
|
4429 | openBlock();
|
4430 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
4431 | const rendered = createBlock(
|
4432 | Fragment,
|
4433 | {
|
4434 | key: props.key ||
|
4435 |
|
4436 | validSlotContent && validSlotContent.key || `_${name}`
|
4437 | },
|
4438 | validSlotContent || (fallback ? fallback() : []),
|
4439 | validSlotContent && slots._ === 1 ? 64 : -2
|
4440 | );
|
4441 | if (!noSlotted && rendered.scopeId) {
|
4442 | rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
4443 | }
|
4444 | if (slot && slot._c) {
|
4445 | slot._d = true;
|
4446 | }
|
4447 | return rendered;
|
4448 | }
|
4449 | function ensureValidVNode(vnodes) {
|
4450 | return vnodes.some((child) => {
|
4451 | if (!isVNode(child))
|
4452 | return true;
|
4453 | if (child.type === Comment)
|
4454 | return false;
|
4455 | if (child.type === Fragment && !ensureValidVNode(child.children))
|
4456 | return false;
|
4457 | return true;
|
4458 | }) ? vnodes : null;
|
4459 | }
|
4460 |
|
4461 | function toHandlers(obj, preserveCaseIfNecessary) {
|
4462 | const ret = {};
|
4463 | if (!isObject(obj)) {
|
4464 | warn$1(`v-on with no argument expects an object value.`);
|
4465 | return ret;
|
4466 | }
|
4467 | for (const key in obj) {
|
4468 | ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
|
4469 | }
|
4470 | return ret;
|
4471 | }
|
4472 |
|
4473 | const getPublicInstance = (i) => {
|
4474 | if (!i)
|
4475 | return null;
|
4476 | if (isStatefulComponent(i))
|
4477 | return getExposeProxy(i) || i.proxy;
|
4478 | return getPublicInstance(i.parent);
|
4479 | };
|
4480 | const publicPropertiesMap = (
|
4481 |
|
4482 |
|
4483 | extend( Object.create(null), {
|
4484 | $: (i) => i,
|
4485 | $el: (i) => i.vnode.el,
|
4486 | $data: (i) => i.data,
|
4487 | $props: (i) => shallowReadonly(i.props) ,
|
4488 | $attrs: (i) => shallowReadonly(i.attrs) ,
|
4489 | $slots: (i) => shallowReadonly(i.slots) ,
|
4490 | $refs: (i) => shallowReadonly(i.refs) ,
|
4491 | $parent: (i) => getPublicInstance(i.parent),
|
4492 | $root: (i) => getPublicInstance(i.root),
|
4493 | $emit: (i) => i.emit,
|
4494 | $options: (i) => resolveMergedOptions(i) ,
|
4495 | $forceUpdate: (i) => i.f || (i.f = () => {
|
4496 | i.effect.dirty = true;
|
4497 | queueJob(i.update);
|
4498 | }),
|
4499 | $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
4500 | $watch: (i) => instanceWatch.bind(i)
|
4501 | })
|
4502 | );
|
4503 | const isReservedPrefix = (key) => key === "_" || key === "$";
|
4504 | const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
4505 | const PublicInstanceProxyHandlers = {
|
4506 | get({ _: instance }, key) {
|
4507 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
4508 | if (key === "__isVue") {
|
4509 | return true;
|
4510 | }
|
4511 | let normalizedProps;
|
4512 | if (key[0] !== "$") {
|
4513 | const n = accessCache[key];
|
4514 | if (n !== void 0) {
|
4515 | switch (n) {
|
4516 | case 1 :
|
4517 | return setupState[key];
|
4518 | case 2 :
|
4519 | return data[key];
|
4520 | case 4 :
|
4521 | return ctx[key];
|
4522 | case 3 :
|
4523 | return props[key];
|
4524 | }
|
4525 | } else if (hasSetupBinding(setupState, key)) {
|
4526 | accessCache[key] = 1 ;
|
4527 | return setupState[key];
|
4528 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
4529 | accessCache[key] = 2 ;
|
4530 | return data[key];
|
4531 | } else if (
|
4532 |
|
4533 |
|
4534 | (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
|
4535 | ) {
|
4536 | accessCache[key] = 3 ;
|
4537 | return props[key];
|
4538 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
4539 | accessCache[key] = 4 ;
|
4540 | return ctx[key];
|
4541 | } else if (shouldCacheAccess) {
|
4542 | accessCache[key] = 0 ;
|
4543 | }
|
4544 | }
|
4545 | const publicGetter = publicPropertiesMap[key];
|
4546 | let cssModule, globalProperties;
|
4547 | if (publicGetter) {
|
4548 | if (key === "$attrs") {
|
4549 | track(instance, "get", key);
|
4550 | markAttrsAccessed();
|
4551 | } else if (key === "$slots") {
|
4552 | track(instance, "get", key);
|
4553 | }
|
4554 | return publicGetter(instance);
|
4555 | } else if (
|
4556 |
|
4557 | (cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
4558 | ) {
|
4559 | return cssModule;
|
4560 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
4561 | accessCache[key] = 4 ;
|
4562 | return ctx[key];
|
4563 | } else if (
|
4564 |
|
4565 | globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
|
4566 | ) {
|
4567 | {
|
4568 | return globalProperties[key];
|
4569 | }
|
4570 | } else if (currentRenderingInstance && (!isString(key) ||
|
4571 |
|
4572 | key.indexOf("__v") !== 0)) {
|
4573 | if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
4574 | warn$1(
|
4575 | `Property ${JSON.stringify(
|
4576 | key
|
4577 | )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
|
4578 | );
|
4579 | } else if (instance === currentRenderingInstance) {
|
4580 | warn$1(
|
4581 | `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
4582 | );
|
4583 | }
|
4584 | }
|
4585 | },
|
4586 | set({ _: instance }, key, value) {
|
4587 | const { data, setupState, ctx } = instance;
|
4588 | if (hasSetupBinding(setupState, key)) {
|
4589 | setupState[key] = value;
|
4590 | return true;
|
4591 | } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
4592 | warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
4593 | return false;
|
4594 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
4595 | data[key] = value;
|
4596 | return true;
|
4597 | } else if (hasOwn(instance.props, key)) {
|
4598 | warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
4599 | return false;
|
4600 | }
|
4601 | if (key[0] === "$" && key.slice(1) in instance) {
|
4602 | warn$1(
|
4603 | `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
|
4604 | );
|
4605 | return false;
|
4606 | } else {
|
4607 | if (key in instance.appContext.config.globalProperties) {
|
4608 | Object.defineProperty(ctx, key, {
|
4609 | enumerable: true,
|
4610 | configurable: true,
|
4611 | value
|
4612 | });
|
4613 | } else {
|
4614 | ctx[key] = value;
|
4615 | }
|
4616 | }
|
4617 | return true;
|
4618 | },
|
4619 | has({
|
4620 | _: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
4621 | }, key) {
|
4622 | let normalizedProps;
|
4623 | 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);
|
4624 | },
|
4625 | defineProperty(target, key, descriptor) {
|
4626 | if (descriptor.get != null) {
|
4627 | target._.accessCache[key] = 0;
|
4628 | } else if (hasOwn(descriptor, "value")) {
|
4629 | this.set(target, key, descriptor.value, null);
|
4630 | }
|
4631 | return Reflect.defineProperty(target, key, descriptor);
|
4632 | }
|
4633 | };
|
4634 | {
|
4635 | PublicInstanceProxyHandlers.ownKeys = (target) => {
|
4636 | warn$1(
|
4637 | `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
4638 | );
|
4639 | return Reflect.ownKeys(target);
|
4640 | };
|
4641 | }
|
4642 | const RuntimeCompiledPublicInstanceProxyHandlers = extend(
|
4643 | {},
|
4644 | PublicInstanceProxyHandlers,
|
4645 | {
|
4646 | get(target, key) {
|
4647 | if (key === Symbol.unscopables) {
|
4648 | return;
|
4649 | }
|
4650 | return PublicInstanceProxyHandlers.get(target, key, target);
|
4651 | },
|
4652 | has(_, key) {
|
4653 | const has = key[0] !== "_" && !isGloballyAllowed(key);
|
4654 | if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
4655 | warn$1(
|
4656 | `Property ${JSON.stringify(
|
4657 | key
|
4658 | )} should not start with _ which is a reserved prefix for Vue internals.`
|
4659 | );
|
4660 | }
|
4661 | return has;
|
4662 | }
|
4663 | }
|
4664 | );
|
4665 | function createDevRenderContext(instance) {
|
4666 | const target = {};
|
4667 | Object.defineProperty(target, `_`, {
|
4668 | configurable: true,
|
4669 | enumerable: false,
|
4670 | get: () => instance
|
4671 | });
|
4672 | Object.keys(publicPropertiesMap).forEach((key) => {
|
4673 | Object.defineProperty(target, key, {
|
4674 | configurable: true,
|
4675 | enumerable: false,
|
4676 | get: () => publicPropertiesMap[key](instance),
|
4677 | // intercepted by the proxy so no need for implementation,
|
4678 | // but needed to prevent set errors
|
4679 | set: NOOP
|
4680 | });
|
4681 | });
|
4682 | return target;
|
4683 | }
|
4684 | function exposePropsOnRenderContext(instance) {
|
4685 | const {
|
4686 | ctx,
|
4687 | propsOptions: [propsOptions]
|
4688 | } = instance;
|
4689 | if (propsOptions) {
|
4690 | Object.keys(propsOptions).forEach((key) => {
|
4691 | Object.defineProperty(ctx, key, {
|
4692 | enumerable: true,
|
4693 | configurable: true,
|
4694 | get: () => instance.props[key],
|
4695 | set: NOOP
|
4696 | });
|
4697 | });
|
4698 | }
|
4699 | }
|
4700 | function exposeSetupStateOnRenderContext(instance) {
|
4701 | const { ctx, setupState } = instance;
|
4702 | Object.keys(toRaw(setupState)).forEach((key) => {
|
4703 | if (!setupState.__isScriptSetup) {
|
4704 | if (isReservedPrefix(key[0])) {
|
4705 | warn$1(
|
4706 | `setup() return property ${JSON.stringify(
|
4707 | key
|
4708 | )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
|
4709 | );
|
4710 | return;
|
4711 | }
|
4712 | Object.defineProperty(ctx, key, {
|
4713 | enumerable: true,
|
4714 | configurable: true,
|
4715 | get: () => setupState[key],
|
4716 | set: NOOP
|
4717 | });
|
4718 | }
|
4719 | });
|
4720 | }
|
4721 |
|
4722 | const warnRuntimeUsage = (method) => warn$1(
|
4723 | `${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.`
|
4724 | );
|
4725 | function defineProps() {
|
4726 | {
|
4727 | warnRuntimeUsage(`defineProps`);
|
4728 | }
|
4729 | return null;
|
4730 | }
|
4731 | function defineEmits() {
|
4732 | {
|
4733 | warnRuntimeUsage(`defineEmits`);
|
4734 | }
|
4735 | return null;
|
4736 | }
|
4737 | function defineExpose(exposed) {
|
4738 | {
|
4739 | warnRuntimeUsage(`defineExpose`);
|
4740 | }
|
4741 | }
|
4742 | function defineOptions(options) {
|
4743 | {
|
4744 | warnRuntimeUsage(`defineOptions`);
|
4745 | }
|
4746 | }
|
4747 | function defineSlots() {
|
4748 | {
|
4749 | warnRuntimeUsage(`defineSlots`);
|
4750 | }
|
4751 | return null;
|
4752 | }
|
4753 | function defineModel() {
|
4754 | {
|
4755 | warnRuntimeUsage("defineModel");
|
4756 | }
|
4757 | }
|
4758 | function withDefaults(props, defaults) {
|
4759 | {
|
4760 | warnRuntimeUsage(`withDefaults`);
|
4761 | }
|
4762 | return null;
|
4763 | }
|
4764 | function useSlots() {
|
4765 | return getContext().slots;
|
4766 | }
|
4767 | function useAttrs() {
|
4768 | return getContext().attrs;
|
4769 | }
|
4770 | function getContext() {
|
4771 | const i = getCurrentInstance();
|
4772 | if (!i) {
|
4773 | warn$1(`useContext() called without active instance.`);
|
4774 | }
|
4775 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
4776 | }
|
4777 | function normalizePropsOrEmits(props) {
|
4778 | return isArray(props) ? props.reduce(
|
4779 | (normalized, p) => (normalized[p] = null, normalized),
|
4780 | {}
|
4781 | ) : props;
|
4782 | }
|
4783 | function mergeDefaults(raw, defaults) {
|
4784 | const props = normalizePropsOrEmits(raw);
|
4785 | for (const key in defaults) {
|
4786 | if (key.startsWith("__skip"))
|
4787 | continue;
|
4788 | let opt = props[key];
|
4789 | if (opt) {
|
4790 | if (isArray(opt) || isFunction(opt)) {
|
4791 | opt = props[key] = { type: opt, default: defaults[key] };
|
4792 | } else {
|
4793 | opt.default = defaults[key];
|
4794 | }
|
4795 | } else if (opt === null) {
|
4796 | opt = props[key] = { default: defaults[key] };
|
4797 | } else {
|
4798 | warn$1(`props default key "${key}" has no corresponding declaration.`);
|
4799 | }
|
4800 | if (opt && defaults[`__skip_${key}`]) {
|
4801 | opt.skipFactory = true;
|
4802 | }
|
4803 | }
|
4804 | return props;
|
4805 | }
|
4806 | function mergeModels(a, b) {
|
4807 | if (!a || !b)
|
4808 | return a || b;
|
4809 | if (isArray(a) && isArray(b))
|
4810 | return a.concat(b);
|
4811 | return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
4812 | }
|
4813 | function createPropsRestProxy(props, excludedKeys) {
|
4814 | const ret = {};
|
4815 | for (const key in props) {
|
4816 | if (!excludedKeys.includes(key)) {
|
4817 | Object.defineProperty(ret, key, {
|
4818 | enumerable: true,
|
4819 | get: () => props[key]
|
4820 | });
|
4821 | }
|
4822 | }
|
4823 | return ret;
|
4824 | }
|
4825 | function withAsyncContext(getAwaitable) {
|
4826 | const ctx = getCurrentInstance();
|
4827 | if (!ctx) {
|
4828 | warn$1(
|
4829 | `withAsyncContext called without active current instance. This is likely a bug.`
|
4830 | );
|
4831 | }
|
4832 | let awaitable = getAwaitable();
|
4833 | unsetCurrentInstance();
|
4834 | if (isPromise(awaitable)) {
|
4835 | awaitable = awaitable.catch((e) => {
|
4836 | setCurrentInstance(ctx);
|
4837 | throw e;
|
4838 | });
|
4839 | }
|
4840 | return [awaitable, () => setCurrentInstance(ctx)];
|
4841 | }
|
4842 |
|
4843 | function createDuplicateChecker() {
|
4844 | const cache = /* @__PURE__ */ Object.create(null);
|
4845 | return (type, key) => {
|
4846 | if (cache[key]) {
|
4847 | warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
4848 | } else {
|
4849 | cache[key] = type;
|
4850 | }
|
4851 | };
|
4852 | }
|
4853 | let shouldCacheAccess = true;
|
4854 | function applyOptions(instance) {
|
4855 | const options = resolveMergedOptions(instance);
|
4856 | const publicThis = instance.proxy;
|
4857 | const ctx = instance.ctx;
|
4858 | shouldCacheAccess = false;
|
4859 | if (options.beforeCreate) {
|
4860 | callHook$1(options.beforeCreate, instance, "bc");
|
4861 | }
|
4862 | const {
|
4863 | // state
|
4864 | data: dataOptions,
|
4865 | computed: computedOptions,
|
4866 | methods,
|
4867 | watch: watchOptions,
|
4868 | provide: provideOptions,
|
4869 | inject: injectOptions,
|
4870 | // lifecycle
|
4871 | created,
|
4872 | beforeMount,
|
4873 | mounted,
|
4874 | beforeUpdate,
|
4875 | updated,
|
4876 | activated,
|
4877 | deactivated,
|
4878 | beforeDestroy,
|
4879 | beforeUnmount,
|
4880 | destroyed,
|
4881 | unmounted,
|
4882 | render,
|
4883 | renderTracked,
|
4884 | renderTriggered,
|
4885 | errorCaptured,
|
4886 | serverPrefetch,
|
4887 | // public API
|
4888 | expose,
|
4889 | inheritAttrs,
|
4890 | // assets
|
4891 | components,
|
4892 | directives,
|
4893 | filters
|
4894 | } = options;
|
4895 | const checkDuplicateProperties = createDuplicateChecker() ;
|
4896 | {
|
4897 | const [propsOptions] = instance.propsOptions;
|
4898 | if (propsOptions) {
|
4899 | for (const key in propsOptions) {
|
4900 | checkDuplicateProperties("Props" /* PROPS */, key);
|
4901 | }
|
4902 | }
|
4903 | }
|
4904 | if (injectOptions) {
|
4905 | resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
4906 | }
|
4907 | if (methods) {
|
4908 | for (const key in methods) {
|
4909 | const methodHandler = methods[key];
|
4910 | if (isFunction(methodHandler)) {
|
4911 | {
|
4912 | Object.defineProperty(ctx, key, {
|
4913 | value: methodHandler.bind(publicThis),
|
4914 | configurable: true,
|
4915 | enumerable: true,
|
4916 | writable: true
|
4917 | });
|
4918 | }
|
4919 | {
|
4920 | checkDuplicateProperties("Methods" /* METHODS */, key);
|
4921 | }
|
4922 | } else {
|
4923 | warn$1(
|
4924 | `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
4925 | );
|
4926 | }
|
4927 | }
|
4928 | }
|
4929 | if (dataOptions) {
|
4930 | if (!isFunction(dataOptions)) {
|
4931 | warn$1(
|
4932 | `The data option must be a function. Plain object usage is no longer supported.`
|
4933 | );
|
4934 | }
|
4935 | const data = dataOptions.call(publicThis, publicThis);
|
4936 | if (isPromise(data)) {
|
4937 | warn$1(
|
4938 | `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
|
4939 | );
|
4940 | }
|
4941 | if (!isObject(data)) {
|
4942 | warn$1(`data() should return an object.`);
|
4943 | } else {
|
4944 | instance.data = reactive(data);
|
4945 | {
|
4946 | for (const key in data) {
|
4947 | checkDuplicateProperties("Data" , key);
|
4948 | if (!isReservedPrefix(key[0])) {
|
4949 | Object.defineProperty(ctx, key, {
|
4950 | configurable: true,
|
4951 | enumerable: true,
|
4952 | get: () => data[key],
|
4953 | set: NOOP
|
4954 | });
|
4955 | }
|
4956 | }
|
4957 | }
|
4958 | }
|
4959 | }
|
4960 | shouldCacheAccess = true;
|
4961 | if (computedOptions) {
|
4962 | for (const key in computedOptions) {
|
4963 | const opt = computedOptions[key];
|
4964 | const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
4965 | if (get === NOOP) {
|
4966 | warn$1(`Computed property "${key}" has no getter.`);
|
4967 | }
|
4968 | const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
|
4969 | warn$1(
|
4970 | `Write operation failed: computed property "${key}" is readonly.`
|
4971 | );
|
4972 | } ;
|
4973 | const c = computed({
|
4974 | get,
|
4975 | set
|
4976 | });
|
4977 | Object.defineProperty(ctx, key, {
|
4978 | enumerable: true,
|
4979 | configurable: true,
|
4980 | get: () => c.value,
|
4981 | set: (v) => c.value = v
|
4982 | });
|
4983 | {
|
4984 | checkDuplicateProperties("Computed" , key);
|
4985 | }
|
4986 | }
|
4987 | }
|
4988 | if (watchOptions) {
|
4989 | for (const key in watchOptions) {
|
4990 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
4991 | }
|
4992 | }
|
4993 | if (provideOptions) {
|
4994 | const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
4995 | Reflect.ownKeys(provides).forEach((key) => {
|
4996 | provide(key, provides[key]);
|
4997 | });
|
4998 | }
|
4999 | if (created) {
|
5000 | callHook$1(created, instance, "c");
|
5001 | }
|
5002 | function registerLifecycleHook(register, hook) {
|
5003 | if (isArray(hook)) {
|
5004 | hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
5005 | } else if (hook) {
|
5006 | register(hook.bind(publicThis));
|
5007 | }
|
5008 | }
|
5009 | registerLifecycleHook(onBeforeMount, beforeMount);
|
5010 | registerLifecycleHook(onMounted, mounted);
|
5011 | registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
5012 | registerLifecycleHook(onUpdated, updated);
|
5013 | registerLifecycleHook(onActivated, activated);
|
5014 | registerLifecycleHook(onDeactivated, deactivated);
|
5015 | registerLifecycleHook(onErrorCaptured, errorCaptured);
|
5016 | registerLifecycleHook(onRenderTracked, renderTracked);
|
5017 | registerLifecycleHook(onRenderTriggered, renderTriggered);
|
5018 | registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
5019 | registerLifecycleHook(onUnmounted, unmounted);
|
5020 | registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
5021 | if (isArray(expose)) {
|
5022 | if (expose.length) {
|
5023 | const exposed = instance.exposed || (instance.exposed = {});
|
5024 | expose.forEach((key) => {
|
5025 | Object.defineProperty(exposed, key, {
|
5026 | get: () => publicThis[key],
|
5027 | set: (val) => publicThis[key] = val
|
5028 | });
|
5029 | });
|
5030 | } else if (!instance.exposed) {
|
5031 | instance.exposed = {};
|
5032 | }
|
5033 | }
|
5034 | if (render && instance.render === NOOP) {
|
5035 | instance.render = render;
|
5036 | }
|
5037 | if (inheritAttrs != null) {
|
5038 | instance.inheritAttrs = inheritAttrs;
|
5039 | }
|
5040 | if (components)
|
5041 | instance.components = components;
|
5042 | if (directives)
|
5043 | instance.directives = directives;
|
5044 | }
|
5045 | function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
|
5046 | if (isArray(injectOptions)) {
|
5047 | injectOptions = normalizeInject(injectOptions);
|
5048 | }
|
5049 | for (const key in injectOptions) {
|
5050 | const opt = injectOptions[key];
|
5051 | let injected;
|
5052 | if (isObject(opt)) {
|
5053 | if ("default" in opt) {
|
5054 | injected = inject(
|
5055 | opt.from || key,
|
5056 | opt.default,
|
5057 | true
|
5058 | );
|
5059 | } else {
|
5060 | injected = inject(opt.from || key);
|
5061 | }
|
5062 | } else {
|
5063 | injected = inject(opt);
|
5064 | }
|
5065 | if (isRef(injected)) {
|
5066 | Object.defineProperty(ctx, key, {
|
5067 | enumerable: true,
|
5068 | configurable: true,
|
5069 | get: () => injected.value,
|
5070 | set: (v) => injected.value = v
|
5071 | });
|
5072 | } else {
|
5073 | ctx[key] = injected;
|
5074 | }
|
5075 | {
|
5076 | checkDuplicateProperties("Inject" , key);
|
5077 | }
|
5078 | }
|
5079 | }
|
5080 | function callHook$1(hook, instance, type) {
|
5081 | callWithAsyncErrorHandling(
|
5082 | isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
5083 | instance,
|
5084 | type
|
5085 | );
|
5086 | }
|
5087 | function createWatcher(raw, ctx, publicThis, key) {
|
5088 | const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
5089 | if (isString(raw)) {
|
5090 | const handler = ctx[raw];
|
5091 | if (isFunction(handler)) {
|
5092 | watch(getter, handler);
|
5093 | } else {
|
5094 | warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
5095 | }
|
5096 | } else if (isFunction(raw)) {
|
5097 | watch(getter, raw.bind(publicThis));
|
5098 | } else if (isObject(raw)) {
|
5099 | if (isArray(raw)) {
|
5100 | raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
5101 | } else {
|
5102 | const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
5103 | if (isFunction(handler)) {
|
5104 | watch(getter, handler, raw);
|
5105 | } else {
|
5106 | warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
5107 | }
|
5108 | }
|
5109 | } else {
|
5110 | warn$1(`Invalid watch option: "${key}"`, raw);
|
5111 | }
|
5112 | }
|
5113 | function resolveMergedOptions(instance) {
|
5114 | const base = instance.type;
|
5115 | const { mixins, extends: extendsOptions } = base;
|
5116 | const {
|
5117 | mixins: globalMixins,
|
5118 | optionsCache: cache,
|
5119 | config: { optionMergeStrategies }
|
5120 | } = instance.appContext;
|
5121 | const cached = cache.get(base);
|
5122 | let resolved;
|
5123 | if (cached) {
|
5124 | resolved = cached;
|
5125 | } else if (!globalMixins.length && !mixins && !extendsOptions) {
|
5126 | {
|
5127 | resolved = base;
|
5128 | }
|
5129 | } else {
|
5130 | resolved = {};
|
5131 | if (globalMixins.length) {
|
5132 | globalMixins.forEach(
|
5133 | (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
5134 | );
|
5135 | }
|
5136 | mergeOptions(resolved, base, optionMergeStrategies);
|
5137 | }
|
5138 | if (isObject(base)) {
|
5139 | cache.set(base, resolved);
|
5140 | }
|
5141 | return resolved;
|
5142 | }
|
5143 | function mergeOptions(to, from, strats, asMixin = false) {
|
5144 | const { mixins, extends: extendsOptions } = from;
|
5145 | if (extendsOptions) {
|
5146 | mergeOptions(to, extendsOptions, strats, true);
|
5147 | }
|
5148 | if (mixins) {
|
5149 | mixins.forEach(
|
5150 | (m) => mergeOptions(to, m, strats, true)
|
5151 | );
|
5152 | }
|
5153 | for (const key in from) {
|
5154 | if (asMixin && key === "expose") {
|
5155 | warn$1(
|
5156 | `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
5157 | );
|
5158 | } else {
|
5159 | const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
5160 | to[key] = strat ? strat(to[key], from[key]) : from[key];
|
5161 | }
|
5162 | }
|
5163 | return to;
|
5164 | }
|
5165 | const internalOptionMergeStrats = {
|
5166 | data: mergeDataFn,
|
5167 | props: mergeEmitsOrPropsOptions,
|
5168 | emits: mergeEmitsOrPropsOptions,
|
5169 |
|
5170 | methods: mergeObjectOptions,
|
5171 | computed: mergeObjectOptions,
|
5172 |
|
5173 | beforeCreate: mergeAsArray,
|
5174 | created: mergeAsArray,
|
5175 | beforeMount: mergeAsArray,
|
5176 | mounted: mergeAsArray,
|
5177 | beforeUpdate: mergeAsArray,
|
5178 | updated: mergeAsArray,
|
5179 | beforeDestroy: mergeAsArray,
|
5180 | beforeUnmount: mergeAsArray,
|
5181 | destroyed: mergeAsArray,
|
5182 | unmounted: mergeAsArray,
|
5183 | activated: mergeAsArray,
|
5184 | deactivated: mergeAsArray,
|
5185 | errorCaptured: mergeAsArray,
|
5186 | serverPrefetch: mergeAsArray,
|
5187 |
|
5188 | components: mergeObjectOptions,
|
5189 | directives: mergeObjectOptions,
|
5190 |
|
5191 | watch: mergeWatchOptions,
|
5192 |
|
5193 | provide: mergeDataFn,
|
5194 | inject: mergeInject
|
5195 | };
|
5196 | function mergeDataFn(to, from) {
|
5197 | if (!from) {
|
5198 | return to;
|
5199 | }
|
5200 | if (!to) {
|
5201 | return from;
|
5202 | }
|
5203 | return function mergedDataFn() {
|
5204 | return (extend)(
|
5205 | isFunction(to) ? to.call(this, this) : to,
|
5206 | isFunction(from) ? from.call(this, this) : from
|
5207 | );
|
5208 | };
|
5209 | }
|
5210 | function mergeInject(to, from) {
|
5211 | return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
5212 | }
|
5213 | function normalizeInject(raw) {
|
5214 | if (isArray(raw)) {
|
5215 | const res = {};
|
5216 | for (let i = 0; i < raw.length; i++) {
|
5217 | res[raw[i]] = raw[i];
|
5218 | }
|
5219 | return res;
|
5220 | }
|
5221 | return raw;
|
5222 | }
|
5223 | function mergeAsArray(to, from) {
|
5224 | return to ? [...new Set([].concat(to, from))] : from;
|
5225 | }
|
5226 | function mergeObjectOptions(to, from) {
|
5227 | return to ? extend( Object.create(null), to, from) : from;
|
5228 | }
|
5229 | function mergeEmitsOrPropsOptions(to, from) {
|
5230 | if (to) {
|
5231 | if (isArray(to) && isArray(from)) {
|
5232 | return [... new Set([...to, ...from])];
|
5233 | }
|
5234 | return extend(
|
5235 | Object.create(null),
|
5236 | normalizePropsOrEmits(to),
|
5237 | normalizePropsOrEmits(from != null ? from : {})
|
5238 | );
|
5239 | } else {
|
5240 | return from;
|
5241 | }
|
5242 | }
|
5243 | function mergeWatchOptions(to, from) {
|
5244 | if (!to)
|
5245 | return from;
|
5246 | if (!from)
|
5247 | return to;
|
5248 | const merged = extend( Object.create(null), to);
|
5249 | for (const key in from) {
|
5250 | merged[key] = mergeAsArray(to[key], from[key]);
|
5251 | }
|
5252 | return merged;
|
5253 | }
|
5254 |
|
5255 | function createAppContext() {
|
5256 | return {
|
5257 | app: null,
|
5258 | config: {
|
5259 | isNativeTag: NO,
|
5260 | performance: false,
|
5261 | globalProperties: {},
|
5262 | optionMergeStrategies: {},
|
5263 | errorHandler: void 0,
|
5264 | warnHandler: void 0,
|
5265 | compilerOptions: {}
|
5266 | },
|
5267 | mixins: [],
|
5268 | components: {},
|
5269 | directives: {},
|
5270 | provides: Object.create(null),
|
5271 | optionsCache: new WeakMap(),
|
5272 | propsCache: new WeakMap(),
|
5273 | emitsCache: new WeakMap()
|
5274 | };
|
5275 | }
|
5276 | let uid$1 = 0;
|
5277 | function createAppAPI(render, hydrate) {
|
5278 | return function createApp(rootComponent, rootProps = null) {
|
5279 | if (!isFunction(rootComponent)) {
|
5280 | rootComponent = extend({}, rootComponent);
|
5281 | }
|
5282 | if (rootProps != null && !isObject(rootProps)) {
|
5283 | warn$1(`root props passed to app.mount() must be an object.`);
|
5284 | rootProps = null;
|
5285 | }
|
5286 | const context = createAppContext();
|
5287 | const installedPlugins = new WeakSet();
|
5288 | let isMounted = false;
|
5289 | const app = context.app = {
|
5290 | _uid: uid$1++,
|
5291 | _component: rootComponent,
|
5292 | _props: rootProps,
|
5293 | _container: null,
|
5294 | _context: context,
|
5295 | _instance: null,
|
5296 | version,
|
5297 | get config() {
|
5298 | return context.config;
|
5299 | },
|
5300 | set config(v) {
|
5301 | {
|
5302 | warn$1(
|
5303 | `app.config cannot be replaced. Modify individual options instead.`
|
5304 | );
|
5305 | }
|
5306 | },
|
5307 | use(plugin, ...options) {
|
5308 | if (installedPlugins.has(plugin)) {
|
5309 | warn$1(`Plugin has already been applied to target app.`);
|
5310 | } else if (plugin && isFunction(plugin.install)) {
|
5311 | installedPlugins.add(plugin);
|
5312 | plugin.install(app, ...options);
|
5313 | } else if (isFunction(plugin)) {
|
5314 | installedPlugins.add(plugin);
|
5315 | plugin(app, ...options);
|
5316 | } else {
|
5317 | warn$1(
|
5318 | `A plugin must either be a function or an object with an "install" function.`
|
5319 | );
|
5320 | }
|
5321 | return app;
|
5322 | },
|
5323 | mixin(mixin) {
|
5324 | {
|
5325 | if (!context.mixins.includes(mixin)) {
|
5326 | context.mixins.push(mixin);
|
5327 | } else {
|
5328 | warn$1(
|
5329 | "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
5330 | );
|
5331 | }
|
5332 | }
|
5333 | return app;
|
5334 | },
|
5335 | component(name, component) {
|
5336 | {
|
5337 | validateComponentName(name, context.config);
|
5338 | }
|
5339 | if (!component) {
|
5340 | return context.components[name];
|
5341 | }
|
5342 | if (context.components[name]) {
|
5343 | warn$1(`Component "${name}" has already been registered in target app.`);
|
5344 | }
|
5345 | context.components[name] = component;
|
5346 | return app;
|
5347 | },
|
5348 | directive(name, directive) {
|
5349 | {
|
5350 | validateDirectiveName(name);
|
5351 | }
|
5352 | if (!directive) {
|
5353 | return context.directives[name];
|
5354 | }
|
5355 | if (context.directives[name]) {
|
5356 | warn$1(`Directive "${name}" has already been registered in target app.`);
|
5357 | }
|
5358 | context.directives[name] = directive;
|
5359 | return app;
|
5360 | },
|
5361 | mount(rootContainer, isHydrate, namespace) {
|
5362 | if (!isMounted) {
|
5363 | if (rootContainer.__vue_app__) {
|
5364 | warn$1(
|
5365 | `There is already an app instance mounted on the host container.
|
5366 | If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
5367 | );
|
5368 | }
|
5369 | const vnode = createVNode(rootComponent, rootProps);
|
5370 | vnode.appContext = context;
|
5371 | if (namespace === true) {
|
5372 | namespace = "svg";
|
5373 | } else if (namespace === false) {
|
5374 | namespace = void 0;
|
5375 | }
|
5376 | {
|
5377 | context.reload = () => {
|
5378 | render(
|
5379 | cloneVNode(vnode),
|
5380 | rootContainer,
|
5381 | namespace
|
5382 | );
|
5383 | };
|
5384 | }
|
5385 | if (isHydrate && hydrate) {
|
5386 | hydrate(vnode, rootContainer);
|
5387 | } else {
|
5388 | render(vnode, rootContainer, namespace);
|
5389 | }
|
5390 | isMounted = true;
|
5391 | app._container = rootContainer;
|
5392 | rootContainer.__vue_app__ = app;
|
5393 | {
|
5394 | app._instance = vnode.component;
|
5395 | devtoolsInitApp(app, version);
|
5396 | }
|
5397 | return getExposeProxy(vnode.component) || vnode.component.proxy;
|
5398 | } else {
|
5399 | warn$1(
|
5400 | `App has already been mounted.
|
5401 | 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)\``
|
5402 | );
|
5403 | }
|
5404 | },
|
5405 | unmount() {
|
5406 | if (isMounted) {
|
5407 | render(null, app._container);
|
5408 | {
|
5409 | app._instance = null;
|
5410 | devtoolsUnmountApp(app);
|
5411 | }
|
5412 | delete app._container.__vue_app__;
|
5413 | } else {
|
5414 | warn$1(`Cannot unmount an app that is not mounted.`);
|
5415 | }
|
5416 | },
|
5417 | provide(key, value) {
|
5418 | if (key in context.provides) {
|
5419 | warn$1(
|
5420 | `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
5421 | );
|
5422 | }
|
5423 | context.provides[key] = value;
|
5424 | return app;
|
5425 | },
|
5426 | runWithContext(fn) {
|
5427 | const lastApp = currentApp;
|
5428 | currentApp = app;
|
5429 | try {
|
5430 | return fn();
|
5431 | } finally {
|
5432 | currentApp = lastApp;
|
5433 | }
|
5434 | }
|
5435 | };
|
5436 | return app;
|
5437 | };
|
5438 | }
|
5439 | let currentApp = null;
|
5440 |
|
5441 | function provide(key, value) {
|
5442 | if (!currentInstance) {
|
5443 | {
|
5444 | warn$1(`provide() can only be used inside setup().`);
|
5445 | }
|
5446 | } else {
|
5447 | let provides = currentInstance.provides;
|
5448 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
5449 | if (parentProvides === provides) {
|
5450 | provides = currentInstance.provides = Object.create(parentProvides);
|
5451 | }
|
5452 | provides[key] = value;
|
5453 | }
|
5454 | }
|
5455 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
5456 | const instance = currentInstance || currentRenderingInstance;
|
5457 | if (instance || currentApp) {
|
5458 | const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
5459 | if (provides && key in provides) {
|
5460 | return provides[key];
|
5461 | } else if (arguments.length > 1) {
|
5462 | return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
5463 | } else {
|
5464 | warn$1(`injection "${String(key)}" not found.`);
|
5465 | }
|
5466 | } else {
|
5467 | warn$1(`inject() can only be used inside setup() or functional components.`);
|
5468 | }
|
5469 | }
|
5470 | function hasInjectionContext() {
|
5471 | return !!(currentInstance || currentRenderingInstance || currentApp);
|
5472 | }
|
5473 |
|
5474 | function initProps(instance, rawProps, isStateful, isSSR = false) {
|
5475 | const props = {};
|
5476 | const attrs = {};
|
5477 | def(attrs, InternalObjectKey, 1);
|
5478 | instance.propsDefaults = Object.create(null);
|
5479 | setFullProps(instance, rawProps, props, attrs);
|
5480 | for (const key in instance.propsOptions[0]) {
|
5481 | if (!(key in props)) {
|
5482 | props[key] = void 0;
|
5483 | }
|
5484 | }
|
5485 | {
|
5486 | validateProps(rawProps || {}, props, instance);
|
5487 | }
|
5488 | if (isStateful) {
|
5489 | instance.props = isSSR ? props : shallowReactive(props);
|
5490 | } else {
|
5491 | if (!instance.type.props) {
|
5492 | instance.props = attrs;
|
5493 | } else {
|
5494 | instance.props = props;
|
5495 | }
|
5496 | }
|
5497 | instance.attrs = attrs;
|
5498 | }
|
5499 | function isInHmrContext(instance) {
|
5500 | while (instance) {
|
5501 | if (instance.type.__hmrId)
|
5502 | return true;
|
5503 | instance = instance.parent;
|
5504 | }
|
5505 | }
|
5506 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
5507 | const {
|
5508 | props,
|
5509 | attrs,
|
5510 | vnode: { patchFlag }
|
5511 | } = instance;
|
5512 | const rawCurrentProps = toRaw(props);
|
5513 | const [options] = instance.propsOptions;
|
5514 | let hasAttrsChanged = false;
|
5515 | if (
|
5516 |
|
5517 |
|
5518 |
|
5519 | !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
|
5520 | ) {
|
5521 | if (patchFlag & 8) {
|
5522 | const propsToUpdate = instance.vnode.dynamicProps;
|
5523 | for (let i = 0; i < propsToUpdate.length; i++) {
|
5524 | let key = propsToUpdate[i];
|
5525 | if (isEmitListener(instance.emitsOptions, key)) {
|
5526 | continue;
|
5527 | }
|
5528 | const value = rawProps[key];
|
5529 | if (options) {
|
5530 | if (hasOwn(attrs, key)) {
|
5531 | if (value !== attrs[key]) {
|
5532 | attrs[key] = value;
|
5533 | hasAttrsChanged = true;
|
5534 | }
|
5535 | } else {
|
5536 | const camelizedKey = camelize(key);
|
5537 | props[camelizedKey] = resolvePropValue(
|
5538 | options,
|
5539 | rawCurrentProps,
|
5540 | camelizedKey,
|
5541 | value,
|
5542 | instance,
|
5543 | false
|
5544 | );
|
5545 | }
|
5546 | } else {
|
5547 | if (value !== attrs[key]) {
|
5548 | attrs[key] = value;
|
5549 | hasAttrsChanged = true;
|
5550 | }
|
5551 | }
|
5552 | }
|
5553 | }
|
5554 | } else {
|
5555 | if (setFullProps(instance, rawProps, props, attrs)) {
|
5556 | hasAttrsChanged = true;
|
5557 | }
|
5558 | let kebabKey;
|
5559 | for (const key in rawCurrentProps) {
|
5560 | if (!rawProps ||
|
5561 | !hasOwn(rawProps, key) &&
|
5562 |
|
5563 | ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
|
5564 | if (options) {
|
5565 | if (rawPrevProps &&
|
5566 | (rawPrevProps[key] !== void 0 ||
|
5567 | rawPrevProps[kebabKey] !== void 0)) {
|
5568 | props[key] = resolvePropValue(
|
5569 | options,
|
5570 | rawCurrentProps,
|
5571 | key,
|
5572 | void 0,
|
5573 | instance,
|
5574 | true
|
5575 | );
|
5576 | }
|
5577 | } else {
|
5578 | delete props[key];
|
5579 | }
|
5580 | }
|
5581 | }
|
5582 | if (attrs !== rawCurrentProps) {
|
5583 | for (const key in attrs) {
|
5584 | if (!rawProps || !hasOwn(rawProps, key) && true) {
|
5585 | delete attrs[key];
|
5586 | hasAttrsChanged = true;
|
5587 | }
|
5588 | }
|
5589 | }
|
5590 | }
|
5591 | if (hasAttrsChanged) {
|
5592 | trigger(instance, "set", "$attrs");
|
5593 | }
|
5594 | {
|
5595 | validateProps(rawProps || {}, props, instance);
|
5596 | }
|
5597 | }
|
5598 | function setFullProps(instance, rawProps, props, attrs) {
|
5599 | const [options, needCastKeys] = instance.propsOptions;
|
5600 | let hasAttrsChanged = false;
|
5601 | let rawCastValues;
|
5602 | if (rawProps) {
|
5603 | for (let key in rawProps) {
|
5604 | if (isReservedProp(key)) {
|
5605 | continue;
|
5606 | }
|
5607 | const value = rawProps[key];
|
5608 | let camelKey;
|
5609 | if (options && hasOwn(options, camelKey = camelize(key))) {
|
5610 | if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
5611 | props[camelKey] = value;
|
5612 | } else {
|
5613 | (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
5614 | }
|
5615 | } else if (!isEmitListener(instance.emitsOptions, key)) {
|
5616 | if (!(key in attrs) || value !== attrs[key]) {
|
5617 | attrs[key] = value;
|
5618 | hasAttrsChanged = true;
|
5619 | }
|
5620 | }
|
5621 | }
|
5622 | }
|
5623 | if (needCastKeys) {
|
5624 | const rawCurrentProps = toRaw(props);
|
5625 | const castValues = rawCastValues || EMPTY_OBJ;
|
5626 | for (let i = 0; i < needCastKeys.length; i++) {
|
5627 | const key = needCastKeys[i];
|
5628 | props[key] = resolvePropValue(
|
5629 | options,
|
5630 | rawCurrentProps,
|
5631 | key,
|
5632 | castValues[key],
|
5633 | instance,
|
5634 | !hasOwn(castValues, key)
|
5635 | );
|
5636 | }
|
5637 | }
|
5638 | return hasAttrsChanged;
|
5639 | }
|
5640 | function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
5641 | const opt = options[key];
|
5642 | if (opt != null) {
|
5643 | const hasDefault = hasOwn(opt, "default");
|
5644 | if (hasDefault && value === void 0) {
|
5645 | const defaultValue = opt.default;
|
5646 | if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
5647 | const { propsDefaults } = instance;
|
5648 | if (key in propsDefaults) {
|
5649 | value = propsDefaults[key];
|
5650 | } else {
|
5651 | const reset = setCurrentInstance(instance);
|
5652 | value = propsDefaults[key] = defaultValue.call(
|
5653 | null,
|
5654 | props
|
5655 | );
|
5656 | reset();
|
5657 | }
|
5658 | } else {
|
5659 | value = defaultValue;
|
5660 | }
|
5661 | }
|
5662 | if (opt[0 ]) {
|
5663 | if (isAbsent && !hasDefault) {
|
5664 | value = false;
|
5665 | } else if (opt[1 ] && (value === "" || value === hyphenate(key))) {
|
5666 | value = true;
|
5667 | }
|
5668 | }
|
5669 | }
|
5670 | return value;
|
5671 | }
|
5672 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
5673 | const cache = appContext.propsCache;
|
5674 | const cached = cache.get(comp);
|
5675 | if (cached) {
|
5676 | return cached;
|
5677 | }
|
5678 | const raw = comp.props;
|
5679 | const normalized = {};
|
5680 | const needCastKeys = [];
|
5681 | let hasExtends = false;
|
5682 | if (!isFunction(comp)) {
|
5683 | const extendProps = (raw2) => {
|
5684 | hasExtends = true;
|
5685 | const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
5686 | extend(normalized, props);
|
5687 | if (keys)
|
5688 | needCastKeys.push(...keys);
|
5689 | };
|
5690 | if (!asMixin && appContext.mixins.length) {
|
5691 | appContext.mixins.forEach(extendProps);
|
5692 | }
|
5693 | if (comp.extends) {
|
5694 | extendProps(comp.extends);
|
5695 | }
|
5696 | if (comp.mixins) {
|
5697 | comp.mixins.forEach(extendProps);
|
5698 | }
|
5699 | }
|
5700 | if (!raw && !hasExtends) {
|
5701 | if (isObject(comp)) {
|
5702 | cache.set(comp, EMPTY_ARR);
|
5703 | }
|
5704 | return EMPTY_ARR;
|
5705 | }
|
5706 | if (isArray(raw)) {
|
5707 | for (let i = 0; i < raw.length; i++) {
|
5708 | if (!isString(raw[i])) {
|
5709 | warn$1(`props must be strings when using array syntax.`, raw[i]);
|
5710 | }
|
5711 | const normalizedKey = camelize(raw[i]);
|
5712 | if (validatePropName(normalizedKey)) {
|
5713 | normalized[normalizedKey] = EMPTY_OBJ;
|
5714 | }
|
5715 | }
|
5716 | } else if (raw) {
|
5717 | if (!isObject(raw)) {
|
5718 | warn$1(`invalid props options`, raw);
|
5719 | }
|
5720 | for (const key in raw) {
|
5721 | const normalizedKey = camelize(key);
|
5722 | if (validatePropName(normalizedKey)) {
|
5723 | const opt = raw[key];
|
5724 | const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
|
5725 | if (prop) {
|
5726 | const booleanIndex = getTypeIndex(Boolean, prop.type);
|
5727 | const stringIndex = getTypeIndex(String, prop.type);
|
5728 | prop[0 ] = booleanIndex > -1;
|
5729 | prop[1 ] = stringIndex < 0 || booleanIndex < stringIndex;
|
5730 | if (booleanIndex > -1 || hasOwn(prop, "default")) {
|
5731 | needCastKeys.push(normalizedKey);
|
5732 | }
|
5733 | }
|
5734 | }
|
5735 | }
|
5736 | }
|
5737 | const res = [normalized, needCastKeys];
|
5738 | if (isObject(comp)) {
|
5739 | cache.set(comp, res);
|
5740 | }
|
5741 | return res;
|
5742 | }
|
5743 | function validatePropName(key) {
|
5744 | if (key[0] !== "$" && !isReservedProp(key)) {
|
5745 | return true;
|
5746 | } else {
|
5747 | warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
5748 | }
|
5749 | return false;
|
5750 | }
|
5751 | function getType(ctor) {
|
5752 | if (ctor === null) {
|
5753 | return "null";
|
5754 | }
|
5755 | if (typeof ctor === "function") {
|
5756 | return ctor.name || "";
|
5757 | } else if (typeof ctor === "object") {
|
5758 | const name = ctor.constructor && ctor.constructor.name;
|
5759 | return name || "";
|
5760 | }
|
5761 | return "";
|
5762 | }
|
5763 | function isSameType(a, b) {
|
5764 | return getType(a) === getType(b);
|
5765 | }
|
5766 | function getTypeIndex(type, expectedTypes) {
|
5767 | if (isArray(expectedTypes)) {
|
5768 | return expectedTypes.findIndex((t) => isSameType(t, type));
|
5769 | } else if (isFunction(expectedTypes)) {
|
5770 | return isSameType(expectedTypes, type) ? 0 : -1;
|
5771 | }
|
5772 | return -1;
|
5773 | }
|
5774 | function validateProps(rawProps, props, instance) {
|
5775 | const resolvedValues = toRaw(props);
|
5776 | const options = instance.propsOptions[0];
|
5777 | for (const key in options) {
|
5778 | let opt = options[key];
|
5779 | if (opt == null)
|
5780 | continue;
|
5781 | validateProp(
|
5782 | key,
|
5783 | resolvedValues[key],
|
5784 | opt,
|
5785 | shallowReadonly(resolvedValues) ,
|
5786 | !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
|
5787 | );
|
5788 | }
|
5789 | }
|
5790 | function validateProp(name, value, prop, props, isAbsent) {
|
5791 | const { type, required, validator, skipCheck } = prop;
|
5792 | if (required && isAbsent) {
|
5793 | warn$1('Missing required prop: "' + name + '"');
|
5794 | return;
|
5795 | }
|
5796 | if (value == null && !required) {
|
5797 | return;
|
5798 | }
|
5799 | if (type != null && type !== true && !skipCheck) {
|
5800 | let isValid = false;
|
5801 | const types = isArray(type) ? type : [type];
|
5802 | const expectedTypes = [];
|
5803 | for (let i = 0; i < types.length && !isValid; i++) {
|
5804 | const { valid, expectedType } = assertType(value, types[i]);
|
5805 | expectedTypes.push(expectedType || "");
|
5806 | isValid = valid;
|
5807 | }
|
5808 | if (!isValid) {
|
5809 | warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
5810 | return;
|
5811 | }
|
5812 | }
|
5813 | if (validator && !validator(value, props)) {
|
5814 | warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
5815 | }
|
5816 | }
|
5817 | const isSimpleType = makeMap(
|
5818 | "String,Number,Boolean,Function,Symbol,BigInt"
|
5819 | );
|
5820 | function assertType(value, type) {
|
5821 | let valid;
|
5822 | const expectedType = getType(type);
|
5823 | if (isSimpleType(expectedType)) {
|
5824 | const t = typeof value;
|
5825 | valid = t === expectedType.toLowerCase();
|
5826 | if (!valid && t === "object") {
|
5827 | valid = value instanceof type;
|
5828 | }
|
5829 | } else if (expectedType === "Object") {
|
5830 | valid = isObject(value);
|
5831 | } else if (expectedType === "Array") {
|
5832 | valid = isArray(value);
|
5833 | } else if (expectedType === "null") {
|
5834 | valid = value === null;
|
5835 | } else {
|
5836 | valid = value instanceof type;
|
5837 | }
|
5838 | return {
|
5839 | valid,
|
5840 | expectedType
|
5841 | };
|
5842 | }
|
5843 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
5844 | if (expectedTypes.length === 0) {
|
5845 | return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
5846 | }
|
5847 | let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
|
5848 | const expectedType = expectedTypes[0];
|
5849 | const receivedType = toRawType(value);
|
5850 | const expectedValue = styleValue(value, expectedType);
|
5851 | const receivedValue = styleValue(value, receivedType);
|
5852 | if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
5853 | message += ` with value ${expectedValue}`;
|
5854 | }
|
5855 | message += `, got ${receivedType} `;
|
5856 | if (isExplicable(receivedType)) {
|
5857 | message += `with value ${receivedValue}.`;
|
5858 | }
|
5859 | return message;
|
5860 | }
|
5861 | function styleValue(value, type) {
|
5862 | if (type === "String") {
|
5863 | return `"${value}"`;
|
5864 | } else if (type === "Number") {
|
5865 | return `${Number(value)}`;
|
5866 | } else {
|
5867 | return `${value}`;
|
5868 | }
|
5869 | }
|
5870 | function isExplicable(type) {
|
5871 | const explicitTypes = ["string", "number", "boolean"];
|
5872 | return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
5873 | }
|
5874 | function isBoolean(...args) {
|
5875 | return args.some((elem) => elem.toLowerCase() === "boolean");
|
5876 | }
|
5877 |
|
5878 | const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
5879 | const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
5880 | const normalizeSlot = (key, rawSlot, ctx) => {
|
5881 | if (rawSlot._n) {
|
5882 | return rawSlot;
|
5883 | }
|
5884 | const normalized = withCtx((...args) => {
|
5885 | if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
5886 | warn$1(
|
5887 | `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.`
|
5888 | );
|
5889 | }
|
5890 | return normalizeSlotValue(rawSlot(...args));
|
5891 | }, ctx);
|
5892 | normalized._c = false;
|
5893 | return normalized;
|
5894 | };
|
5895 | const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
5896 | const ctx = rawSlots._ctx;
|
5897 | for (const key in rawSlots) {
|
5898 | if (isInternalKey(key))
|
5899 | continue;
|
5900 | const value = rawSlots[key];
|
5901 | if (isFunction(value)) {
|
5902 | slots[key] = normalizeSlot(key, value, ctx);
|
5903 | } else if (value != null) {
|
5904 | {
|
5905 | warn$1(
|
5906 | `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
5907 | );
|
5908 | }
|
5909 | const normalized = normalizeSlotValue(value);
|
5910 | slots[key] = () => normalized;
|
5911 | }
|
5912 | }
|
5913 | };
|
5914 | const normalizeVNodeSlots = (instance, children) => {
|
5915 | if (!isKeepAlive(instance.vnode) && true) {
|
5916 | warn$1(
|
5917 | `Non-function value encountered for default slot. Prefer function slots for better performance.`
|
5918 | );
|
5919 | }
|
5920 | const normalized = normalizeSlotValue(children);
|
5921 | instance.slots.default = () => normalized;
|
5922 | };
|
5923 | const initSlots = (instance, children) => {
|
5924 | if (instance.vnode.shapeFlag & 32) {
|
5925 | const type = children._;
|
5926 | if (type) {
|
5927 | instance.slots = toRaw(children);
|
5928 | def(children, "_", type);
|
5929 | } else {
|
5930 | normalizeObjectSlots(
|
5931 | children,
|
5932 | instance.slots = {});
|
5933 | }
|
5934 | } else {
|
5935 | instance.slots = {};
|
5936 | if (children) {
|
5937 | normalizeVNodeSlots(instance, children);
|
5938 | }
|
5939 | }
|
5940 | def(instance.slots, InternalObjectKey, 1);
|
5941 | };
|
5942 | const updateSlots = (instance, children, optimized) => {
|
5943 | const { vnode, slots } = instance;
|
5944 | let needDeletionCheck = true;
|
5945 | let deletionComparisonTarget = EMPTY_OBJ;
|
5946 | if (vnode.shapeFlag & 32) {
|
5947 | const type = children._;
|
5948 | if (type) {
|
5949 | if (isHmrUpdating) {
|
5950 | extend(slots, children);
|
5951 | trigger(instance, "set", "$slots");
|
5952 | } else if (optimized && type === 1) {
|
5953 | needDeletionCheck = false;
|
5954 | } else {
|
5955 | extend(slots, children);
|
5956 | if (!optimized && type === 1) {
|
5957 | delete slots._;
|
5958 | }
|
5959 | }
|
5960 | } else {
|
5961 | needDeletionCheck = !children.$stable;
|
5962 | normalizeObjectSlots(children, slots);
|
5963 | }
|
5964 | deletionComparisonTarget = children;
|
5965 | } else if (children) {
|
5966 | normalizeVNodeSlots(instance, children);
|
5967 | deletionComparisonTarget = { default: 1 };
|
5968 | }
|
5969 | if (needDeletionCheck) {
|
5970 | for (const key in slots) {
|
5971 | if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
|
5972 | delete slots[key];
|
5973 | }
|
5974 | }
|
5975 | }
|
5976 | };
|
5977 |
|
5978 | function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
5979 | if (isArray(rawRef)) {
|
5980 | rawRef.forEach(
|
5981 | (r, i) => setRef(
|
5982 | r,
|
5983 | oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
5984 | parentSuspense,
|
5985 | vnode,
|
5986 | isUnmount
|
5987 | )
|
5988 | );
|
5989 | return;
|
5990 | }
|
5991 | if (isAsyncWrapper(vnode) && !isUnmount) {
|
5992 | return;
|
5993 | }
|
5994 | const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
|
5995 | const value = isUnmount ? null : refValue;
|
5996 | const { i: owner, r: ref } = rawRef;
|
5997 | if (!owner) {
|
5998 | warn$1(
|
5999 | `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
|
6000 | );
|
6001 | return;
|
6002 | }
|
6003 | const oldRef = oldRawRef && oldRawRef.r;
|
6004 | const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
6005 | const setupState = owner.setupState;
|
6006 | if (oldRef != null && oldRef !== ref) {
|
6007 | if (isString(oldRef)) {
|
6008 | refs[oldRef] = null;
|
6009 | if (hasOwn(setupState, oldRef)) {
|
6010 | setupState[oldRef] = null;
|
6011 | }
|
6012 | } else if (isRef(oldRef)) {
|
6013 | oldRef.value = null;
|
6014 | }
|
6015 | }
|
6016 | if (isFunction(ref)) {
|
6017 | callWithErrorHandling(ref, owner, 12, [value, refs]);
|
6018 | } else {
|
6019 | const _isString = isString(ref);
|
6020 | const _isRef = isRef(ref);
|
6021 | if (_isString || _isRef) {
|
6022 | const doSet = () => {
|
6023 | if (rawRef.f) {
|
6024 | const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
|
6025 | if (isUnmount) {
|
6026 | isArray(existing) && remove(existing, refValue);
|
6027 | } else {
|
6028 | if (!isArray(existing)) {
|
6029 | if (_isString) {
|
6030 | refs[ref] = [refValue];
|
6031 | if (hasOwn(setupState, ref)) {
|
6032 | setupState[ref] = refs[ref];
|
6033 | }
|
6034 | } else {
|
6035 | ref.value = [refValue];
|
6036 | if (rawRef.k)
|
6037 | refs[rawRef.k] = ref.value;
|
6038 | }
|
6039 | } else if (!existing.includes(refValue)) {
|
6040 | existing.push(refValue);
|
6041 | }
|
6042 | }
|
6043 | } else if (_isString) {
|
6044 | refs[ref] = value;
|
6045 | if (hasOwn(setupState, ref)) {
|
6046 | setupState[ref] = value;
|
6047 | }
|
6048 | } else if (_isRef) {
|
6049 | ref.value = value;
|
6050 | if (rawRef.k)
|
6051 | refs[rawRef.k] = value;
|
6052 | } else {
|
6053 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
6054 | }
|
6055 | };
|
6056 | if (value) {
|
6057 | doSet.id = -1;
|
6058 | queuePostRenderEffect(doSet, parentSuspense);
|
6059 | } else {
|
6060 | doSet();
|
6061 | }
|
6062 | } else {
|
6063 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
6064 | }
|
6065 | }
|
6066 | }
|
6067 |
|
6068 | let hasMismatch = false;
|
6069 | const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
6070 | const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
6071 | const getContainerType = (container) => {
|
6072 | if (isSVGContainer(container))
|
6073 | return "svg";
|
6074 | if (isMathMLContainer(container))
|
6075 | return "mathml";
|
6076 | return void 0;
|
6077 | };
|
6078 | const isComment = (node) => node.nodeType === 8 ;
|
6079 | function createHydrationFunctions(rendererInternals) {
|
6080 | const {
|
6081 | mt: mountComponent,
|
6082 | p: patch,
|
6083 | o: {
|
6084 | patchProp,
|
6085 | createText,
|
6086 | nextSibling,
|
6087 | parentNode,
|
6088 | remove,
|
6089 | insert,
|
6090 | createComment
|
6091 | }
|
6092 | } = rendererInternals;
|
6093 | const hydrate = (vnode, container) => {
|
6094 | if (!container.hasChildNodes()) {
|
6095 | warn$1(
|
6096 | `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
|
6097 | );
|
6098 | patch(null, vnode, container);
|
6099 | flushPostFlushCbs();
|
6100 | container._vnode = vnode;
|
6101 | return;
|
6102 | }
|
6103 | hasMismatch = false;
|
6104 | hydrateNode(container.firstChild, vnode, null, null, null);
|
6105 | flushPostFlushCbs();
|
6106 | container._vnode = vnode;
|
6107 | if (hasMismatch && true) {
|
6108 | console.error(`Hydration completed but contains mismatches.`);
|
6109 | }
|
6110 | };
|
6111 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
6112 | const isFragmentStart = isComment(node) && node.data === "[";
|
6113 | const onMismatch = () => handleMismatch(
|
6114 | node,
|
6115 | vnode,
|
6116 | parentComponent,
|
6117 | parentSuspense,
|
6118 | slotScopeIds,
|
6119 | isFragmentStart
|
6120 | );
|
6121 | const { type, ref, shapeFlag, patchFlag } = vnode;
|
6122 | let domType = node.nodeType;
|
6123 | vnode.el = node;
|
6124 | {
|
6125 | if (!("__vnode" in node)) {
|
6126 | Object.defineProperty(node, "__vnode", {
|
6127 | value: vnode,
|
6128 | enumerable: false
|
6129 | });
|
6130 | }
|
6131 | if (!("__vueParentComponent" in node)) {
|
6132 | Object.defineProperty(node, "__vueParentComponent", {
|
6133 | value: parentComponent,
|
6134 | enumerable: false
|
6135 | });
|
6136 | }
|
6137 | }
|
6138 | if (patchFlag === -2) {
|
6139 | optimized = false;
|
6140 | vnode.dynamicChildren = null;
|
6141 | }
|
6142 | let nextNode = null;
|
6143 | switch (type) {
|
6144 | case Text:
|
6145 | if (domType !== 3 ) {
|
6146 | if (vnode.children === "") {
|
6147 | insert(vnode.el = createText(""), parentNode(node), node);
|
6148 | nextNode = node;
|
6149 | } else {
|
6150 | nextNode = onMismatch();
|
6151 | }
|
6152 | } else {
|
6153 | if (node.data !== vnode.children) {
|
6154 | hasMismatch = true;
|
6155 | warn$1(
|
6156 | `Hydration text mismatch in`,
|
6157 | node.parentNode,
|
6158 | `
|
6159 | - rendered on server: ${JSON.stringify(
|
6160 | node.data
|
6161 | )}
|
6162 | - expected on client: ${JSON.stringify(vnode.children)}`
|
6163 | );
|
6164 | node.data = vnode.children;
|
6165 | }
|
6166 | nextNode = nextSibling(node);
|
6167 | }
|
6168 | break;
|
6169 | case Comment:
|
6170 | if (isTemplateNode(node)) {
|
6171 | nextNode = nextSibling(node);
|
6172 | replaceNode(
|
6173 | vnode.el = node.content.firstChild,
|
6174 | node,
|
6175 | parentComponent
|
6176 | );
|
6177 | } else if (domType !== 8 || isFragmentStart) {
|
6178 | nextNode = onMismatch();
|
6179 | } else {
|
6180 | nextNode = nextSibling(node);
|
6181 | }
|
6182 | break;
|
6183 | case Static:
|
6184 | if (isFragmentStart) {
|
6185 | node = nextSibling(node);
|
6186 | domType = node.nodeType;
|
6187 | }
|
6188 | if (domType === 1 || domType === 3 ) {
|
6189 | nextNode = node;
|
6190 | const needToAdoptContent = !vnode.children.length;
|
6191 | for (let i = 0; i < vnode.staticCount; i++) {
|
6192 | if (needToAdoptContent)
|
6193 | vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
|
6194 | if (i === vnode.staticCount - 1) {
|
6195 | vnode.anchor = nextNode;
|
6196 | }
|
6197 | nextNode = nextSibling(nextNode);
|
6198 | }
|
6199 | return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
6200 | } else {
|
6201 | onMismatch();
|
6202 | }
|
6203 | break;
|
6204 | case Fragment:
|
6205 | if (!isFragmentStart) {
|
6206 | nextNode = onMismatch();
|
6207 | } else {
|
6208 | nextNode = hydrateFragment(
|
6209 | node,
|
6210 | vnode,
|
6211 | parentComponent,
|
6212 | parentSuspense,
|
6213 | slotScopeIds,
|
6214 | optimized
|
6215 | );
|
6216 | }
|
6217 | break;
|
6218 | default:
|
6219 | if (shapeFlag & 1) {
|
6220 | if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
|
6221 | nextNode = onMismatch();
|
6222 | } else {
|
6223 | nextNode = hydrateElement(
|
6224 | node,
|
6225 | vnode,
|
6226 | parentComponent,
|
6227 | parentSuspense,
|
6228 | slotScopeIds,
|
6229 | optimized
|
6230 | );
|
6231 | }
|
6232 | } else if (shapeFlag & 6) {
|
6233 | vnode.slotScopeIds = slotScopeIds;
|
6234 | const container = parentNode(node);
|
6235 | if (isFragmentStart) {
|
6236 | nextNode = locateClosingAnchor(node);
|
6237 | } else if (isComment(node) && node.data === "teleport start") {
|
6238 | nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
6239 | } else {
|
6240 | nextNode = nextSibling(node);
|
6241 | }
|
6242 | mountComponent(
|
6243 | vnode,
|
6244 | container,
|
6245 | null,
|
6246 | parentComponent,
|
6247 | parentSuspense,
|
6248 | getContainerType(container),
|
6249 | optimized
|
6250 | );
|
6251 | if (isAsyncWrapper(vnode)) {
|
6252 | let subTree;
|
6253 | if (isFragmentStart) {
|
6254 | subTree = createVNode(Fragment);
|
6255 | subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
6256 | } else {
|
6257 | subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
6258 | }
|
6259 | subTree.el = node;
|
6260 | vnode.component.subTree = subTree;
|
6261 | }
|
6262 | } else if (shapeFlag & 64) {
|
6263 | if (domType !== 8 ) {
|
6264 | nextNode = onMismatch();
|
6265 | } else {
|
6266 | nextNode = vnode.type.hydrate(
|
6267 | node,
|
6268 | vnode,
|
6269 | parentComponent,
|
6270 | parentSuspense,
|
6271 | slotScopeIds,
|
6272 | optimized,
|
6273 | rendererInternals,
|
6274 | hydrateChildren
|
6275 | );
|
6276 | }
|
6277 | } else if (shapeFlag & 128) {
|
6278 | nextNode = vnode.type.hydrate(
|
6279 | node,
|
6280 | vnode,
|
6281 | parentComponent,
|
6282 | parentSuspense,
|
6283 | getContainerType(parentNode(node)),
|
6284 | slotScopeIds,
|
6285 | optimized,
|
6286 | rendererInternals,
|
6287 | hydrateNode
|
6288 | );
|
6289 | } else {
|
6290 | warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
6291 | }
|
6292 | }
|
6293 | if (ref != null) {
|
6294 | setRef(ref, null, parentSuspense, vnode);
|
6295 | }
|
6296 | return nextNode;
|
6297 | };
|
6298 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6299 | optimized = optimized || !!vnode.dynamicChildren;
|
6300 | const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
6301 | const forcePatch = type === "input" || type === "option";
|
6302 | {
|
6303 | if (dirs) {
|
6304 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
6305 | }
|
6306 | let needCallTransitionHooks = false;
|
6307 | if (isTemplateNode(el)) {
|
6308 | needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
6309 | const content = el.content.firstChild;
|
6310 | if (needCallTransitionHooks) {
|
6311 | transition.beforeEnter(content);
|
6312 | }
|
6313 | replaceNode(content, el, parentComponent);
|
6314 | vnode.el = el = content;
|
6315 | }
|
6316 | if (shapeFlag & 16 &&
|
6317 | !(props && (props.innerHTML || props.textContent))) {
|
6318 | let next = hydrateChildren(
|
6319 | el.firstChild,
|
6320 | vnode,
|
6321 | el,
|
6322 | parentComponent,
|
6323 | parentSuspense,
|
6324 | slotScopeIds,
|
6325 | optimized
|
6326 | );
|
6327 | let hasWarned = false;
|
6328 | while (next) {
|
6329 | hasMismatch = true;
|
6330 | if (!hasWarned) {
|
6331 | warn$1(
|
6332 | `Hydration children mismatch on`,
|
6333 | el,
|
6334 | `
|
6335 | Server rendered element contains more child nodes than client vdom.`
|
6336 | );
|
6337 | hasWarned = true;
|
6338 | }
|
6339 | const cur = next;
|
6340 | next = next.nextSibling;
|
6341 | remove(cur);
|
6342 | }
|
6343 | } else if (shapeFlag & 8) {
|
6344 | if (el.textContent !== vnode.children) {
|
6345 | hasMismatch = true;
|
6346 | warn$1(
|
6347 | `Hydration text content mismatch on`,
|
6348 | el,
|
6349 | `
|
6350 | - rendered on server: ${el.textContent}
|
6351 | - expected on client: ${vnode.children}`
|
6352 | );
|
6353 | el.textContent = vnode.children;
|
6354 | }
|
6355 | }
|
6356 | if (props) {
|
6357 | {
|
6358 | for (const key in props) {
|
6359 | if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
|
6360 | hasMismatch = true;
|
6361 | }
|
6362 | if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) ||
|
6363 | key[0] === ".") {
|
6364 | patchProp(
|
6365 | el,
|
6366 | key,
|
6367 | null,
|
6368 | props[key],
|
6369 | void 0,
|
6370 | void 0,
|
6371 | parentComponent
|
6372 | );
|
6373 | }
|
6374 | }
|
6375 | }
|
6376 | }
|
6377 | let vnodeHooks;
|
6378 | if (vnodeHooks = props && props.onVnodeBeforeMount) {
|
6379 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
6380 | }
|
6381 | if (dirs) {
|
6382 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
6383 | }
|
6384 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
6385 | queueEffectWithSuspense(() => {
|
6386 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
6387 | needCallTransitionHooks && transition.enter(el);
|
6388 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
6389 | }, parentSuspense);
|
6390 | }
|
6391 | }
|
6392 | return el.nextSibling;
|
6393 | };
|
6394 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6395 | optimized = optimized || !!parentVNode.dynamicChildren;
|
6396 | const children = parentVNode.children;
|
6397 | const l = children.length;
|
6398 | let hasWarned = false;
|
6399 | for (let i = 0; i < l; i++) {
|
6400 | const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
6401 | if (node) {
|
6402 | node = hydrateNode(
|
6403 | node,
|
6404 | vnode,
|
6405 | parentComponent,
|
6406 | parentSuspense,
|
6407 | slotScopeIds,
|
6408 | optimized
|
6409 | );
|
6410 | } else if (vnode.type === Text && !vnode.children) {
|
6411 | continue;
|
6412 | } else {
|
6413 | hasMismatch = true;
|
6414 | if (!hasWarned) {
|
6415 | warn$1(
|
6416 | `Hydration children mismatch on`,
|
6417 | container,
|
6418 | `
|
6419 | Server rendered element contains fewer child nodes than client vdom.`
|
6420 | );
|
6421 | hasWarned = true;
|
6422 | }
|
6423 | patch(
|
6424 | null,
|
6425 | vnode,
|
6426 | container,
|
6427 | null,
|
6428 | parentComponent,
|
6429 | parentSuspense,
|
6430 | getContainerType(container),
|
6431 | slotScopeIds
|
6432 | );
|
6433 | }
|
6434 | }
|
6435 | return node;
|
6436 | };
|
6437 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
6438 | const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
6439 | if (fragmentSlotScopeIds) {
|
6440 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
6441 | }
|
6442 | const container = parentNode(node);
|
6443 | const next = hydrateChildren(
|
6444 | nextSibling(node),
|
6445 | vnode,
|
6446 | container,
|
6447 | parentComponent,
|
6448 | parentSuspense,
|
6449 | slotScopeIds,
|
6450 | optimized
|
6451 | );
|
6452 | if (next && isComment(next) && next.data === "]") {
|
6453 | return nextSibling(vnode.anchor = next);
|
6454 | } else {
|
6455 | hasMismatch = true;
|
6456 | insert(vnode.anchor = createComment(`]`), container, next);
|
6457 | return next;
|
6458 | }
|
6459 | };
|
6460 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
6461 | hasMismatch = true;
|
6462 | warn$1(
|
6463 | `Hydration node mismatch:
|
6464 | - rendered on server:`,
|
6465 | node,
|
6466 | node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
|
6467 | `
|
6468 | - expected on client:`,
|
6469 | vnode.type
|
6470 | );
|
6471 | vnode.el = null;
|
6472 | if (isFragment) {
|
6473 | const end = locateClosingAnchor(node);
|
6474 | while (true) {
|
6475 | const next2 = nextSibling(node);
|
6476 | if (next2 && next2 !== end) {
|
6477 | remove(next2);
|
6478 | } else {
|
6479 | break;
|
6480 | }
|
6481 | }
|
6482 | }
|
6483 | const next = nextSibling(node);
|
6484 | const container = parentNode(node);
|
6485 | remove(node);
|
6486 | patch(
|
6487 | null,
|
6488 | vnode,
|
6489 | container,
|
6490 | next,
|
6491 | parentComponent,
|
6492 | parentSuspense,
|
6493 | getContainerType(container),
|
6494 | slotScopeIds
|
6495 | );
|
6496 | return next;
|
6497 | };
|
6498 | const locateClosingAnchor = (node, open = "[", close = "]") => {
|
6499 | let match = 0;
|
6500 | while (node) {
|
6501 | node = nextSibling(node);
|
6502 | if (node && isComment(node)) {
|
6503 | if (node.data === open)
|
6504 | match++;
|
6505 | if (node.data === close) {
|
6506 | if (match === 0) {
|
6507 | return nextSibling(node);
|
6508 | } else {
|
6509 | match--;
|
6510 | }
|
6511 | }
|
6512 | }
|
6513 | }
|
6514 | return node;
|
6515 | };
|
6516 | const replaceNode = (newNode, oldNode, parentComponent) => {
|
6517 | const parentNode2 = oldNode.parentNode;
|
6518 | if (parentNode2) {
|
6519 | parentNode2.replaceChild(newNode, oldNode);
|
6520 | }
|
6521 | let parent = parentComponent;
|
6522 | while (parent) {
|
6523 | if (parent.vnode.el === oldNode) {
|
6524 | parent.vnode.el = parent.subTree.el = newNode;
|
6525 | }
|
6526 | parent = parent.parent;
|
6527 | }
|
6528 | };
|
6529 | const isTemplateNode = (node) => {
|
6530 | return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
|
6531 | };
|
6532 | return [hydrate, hydrateNode];
|
6533 | }
|
6534 | function propHasMismatch(el, key, clientValue, vnode, instance) {
|
6535 | var _a;
|
6536 | let mismatchType;
|
6537 | let mismatchKey;
|
6538 | let actual;
|
6539 | let expected;
|
6540 | if (key === "class") {
|
6541 | actual = el.getAttribute("class");
|
6542 | expected = normalizeClass(clientValue);
|
6543 | if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
6544 | mismatchType = mismatchKey = `class`;
|
6545 | }
|
6546 | } else if (key === "style") {
|
6547 | actual = el.getAttribute("style");
|
6548 | expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
|
6549 | const actualMap = toStyleMap(actual);
|
6550 | const expectedMap = toStyleMap(expected);
|
6551 | if (vnode.dirs) {
|
6552 | for (const { dir, value } of vnode.dirs) {
|
6553 | if (dir.name === "show" && !value) {
|
6554 | expectedMap.set("display", "none");
|
6555 | }
|
6556 | }
|
6557 | }
|
6558 | const root = instance == null ? void 0 : instance.subTree;
|
6559 | if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
|
6560 | const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
|
6561 | for (const key2 in cssVars) {
|
6562 | expectedMap.set(`--${key2}`, String(cssVars[key2]));
|
6563 | }
|
6564 | }
|
6565 | if (!isMapEqual(actualMap, expectedMap)) {
|
6566 | mismatchType = mismatchKey = "style";
|
6567 | }
|
6568 | } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
|
6569 | if (isBooleanAttr(key)) {
|
6570 | actual = el.hasAttribute(key);
|
6571 | expected = includeBooleanAttr(clientValue);
|
6572 | } else if (clientValue == null) {
|
6573 | actual = el.hasAttribute(key);
|
6574 | expected = false;
|
6575 | } else {
|
6576 | if (el.hasAttribute(key)) {
|
6577 | actual = el.getAttribute(key);
|
6578 | } else if (key === "value" && el.tagName === "TEXTAREA") {
|
6579 | actual = el.value;
|
6580 | } else {
|
6581 | actual = false;
|
6582 | }
|
6583 | expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
|
6584 | }
|
6585 | if (actual !== expected) {
|
6586 | mismatchType = `attribute`;
|
6587 | mismatchKey = key;
|
6588 | }
|
6589 | }
|
6590 | if (mismatchType) {
|
6591 | const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
6592 | const preSegment = `Hydration ${mismatchType} mismatch on`;
|
6593 | const postSegment = `
|
6594 | - rendered on server: ${format(actual)}
|
6595 | - expected on client: ${format(expected)}
|
6596 | Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
6597 | You should fix the source of the mismatch.`;
|
6598 | {
|
6599 | warn$1(preSegment, el, postSegment);
|
6600 | }
|
6601 | return true;
|
6602 | }
|
6603 | return false;
|
6604 | }
|
6605 | function toClassSet(str) {
|
6606 | return new Set(str.trim().split(/\s+/));
|
6607 | }
|
6608 | function isSetEqual(a, b) {
|
6609 | if (a.size !== b.size) {
|
6610 | return false;
|
6611 | }
|
6612 | for (const s of a) {
|
6613 | if (!b.has(s)) {
|
6614 | return false;
|
6615 | }
|
6616 | }
|
6617 | return true;
|
6618 | }
|
6619 | function toStyleMap(str) {
|
6620 | const styleMap = new Map();
|
6621 | for (const item of str.split(";")) {
|
6622 | let [key, value] = item.split(":");
|
6623 | key = key == null ? void 0 : key.trim();
|
6624 | value = value == null ? void 0 : value.trim();
|
6625 | if (key && value) {
|
6626 | styleMap.set(key, value);
|
6627 | }
|
6628 | }
|
6629 | return styleMap;
|
6630 | }
|
6631 | function isMapEqual(a, b) {
|
6632 | if (a.size !== b.size) {
|
6633 | return false;
|
6634 | }
|
6635 | for (const [key, value] of a) {
|
6636 | if (value !== b.get(key)) {
|
6637 | return false;
|
6638 | }
|
6639 | }
|
6640 | return true;
|
6641 | }
|
6642 |
|
6643 | let supported;
|
6644 | let perf;
|
6645 | function startMeasure(instance, type) {
|
6646 | if (instance.appContext.config.performance && isSupported()) {
|
6647 | perf.mark(`vue-${type}-${instance.uid}`);
|
6648 | }
|
6649 | {
|
6650 | devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
6651 | }
|
6652 | }
|
6653 | function endMeasure(instance, type) {
|
6654 | if (instance.appContext.config.performance && isSupported()) {
|
6655 | const startTag = `vue-${type}-${instance.uid}`;
|
6656 | const endTag = startTag + `:end`;
|
6657 | perf.mark(endTag);
|
6658 | perf.measure(
|
6659 | `<${formatComponentName(instance, instance.type)}> ${type}`,
|
6660 | startTag,
|
6661 | endTag
|
6662 | );
|
6663 | perf.clearMarks(startTag);
|
6664 | perf.clearMarks(endTag);
|
6665 | }
|
6666 | {
|
6667 | devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
6668 | }
|
6669 | }
|
6670 | function isSupported() {
|
6671 | if (supported !== void 0) {
|
6672 | return supported;
|
6673 | }
|
6674 | if (typeof window !== "undefined" && window.performance) {
|
6675 | supported = true;
|
6676 | perf = window.performance;
|
6677 | } else {
|
6678 | supported = false;
|
6679 | }
|
6680 | return supported;
|
6681 | }
|
6682 |
|
6683 | const queuePostRenderEffect = queueEffectWithSuspense ;
|
6684 | function createRenderer(options) {
|
6685 | return baseCreateRenderer(options);
|
6686 | }
|
6687 | function createHydrationRenderer(options) {
|
6688 | return baseCreateRenderer(options, createHydrationFunctions);
|
6689 | }
|
6690 | function baseCreateRenderer(options, createHydrationFns) {
|
6691 | const target = getGlobalThis();
|
6692 | target.__VUE__ = true;
|
6693 | {
|
6694 | setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
6695 | }
|
6696 | const {
|
6697 | insert: hostInsert,
|
6698 | remove: hostRemove,
|
6699 | patchProp: hostPatchProp,
|
6700 | createElement: hostCreateElement,
|
6701 | createText: hostCreateText,
|
6702 | createComment: hostCreateComment,
|
6703 | setText: hostSetText,
|
6704 | setElementText: hostSetElementText,
|
6705 | parentNode: hostParentNode,
|
6706 | nextSibling: hostNextSibling,
|
6707 | setScopeId: hostSetScopeId = NOOP,
|
6708 | insertStaticContent: hostInsertStaticContent
|
6709 | } = options;
|
6710 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
6711 | if (n1 === n2) {
|
6712 | return;
|
6713 | }
|
6714 | if (n1 && !isSameVNodeType(n1, n2)) {
|
6715 | anchor = getNextHostNode(n1);
|
6716 | unmount(n1, parentComponent, parentSuspense, true);
|
6717 | n1 = null;
|
6718 | }
|
6719 | if (n2.patchFlag === -2) {
|
6720 | optimized = false;
|
6721 | n2.dynamicChildren = null;
|
6722 | }
|
6723 | const { type, ref, shapeFlag } = n2;
|
6724 | switch (type) {
|
6725 | case Text:
|
6726 | processText(n1, n2, container, anchor);
|
6727 | break;
|
6728 | case Comment:
|
6729 | processCommentNode(n1, n2, container, anchor);
|
6730 | break;
|
6731 | case Static:
|
6732 | if (n1 == null) {
|
6733 | mountStaticNode(n2, container, anchor, namespace);
|
6734 | } else {
|
6735 | patchStaticNode(n1, n2, container, namespace);
|
6736 | }
|
6737 | break;
|
6738 | case Fragment:
|
6739 | processFragment(
|
6740 | n1,
|
6741 | n2,
|
6742 | container,
|
6743 | anchor,
|
6744 | parentComponent,
|
6745 | parentSuspense,
|
6746 | namespace,
|
6747 | slotScopeIds,
|
6748 | optimized
|
6749 | );
|
6750 | break;
|
6751 | default:
|
6752 | if (shapeFlag & 1) {
|
6753 | processElement(
|
6754 | n1,
|
6755 | n2,
|
6756 | container,
|
6757 | anchor,
|
6758 | parentComponent,
|
6759 | parentSuspense,
|
6760 | namespace,
|
6761 | slotScopeIds,
|
6762 | optimized
|
6763 | );
|
6764 | } else if (shapeFlag & 6) {
|
6765 | processComponent(
|
6766 | n1,
|
6767 | n2,
|
6768 | container,
|
6769 | anchor,
|
6770 | parentComponent,
|
6771 | parentSuspense,
|
6772 | namespace,
|
6773 | slotScopeIds,
|
6774 | optimized
|
6775 | );
|
6776 | } else if (shapeFlag & 64) {
|
6777 | type.process(
|
6778 | n1,
|
6779 | n2,
|
6780 | container,
|
6781 | anchor,
|
6782 | parentComponent,
|
6783 | parentSuspense,
|
6784 | namespace,
|
6785 | slotScopeIds,
|
6786 | optimized,
|
6787 | internals
|
6788 | );
|
6789 | } else if (shapeFlag & 128) {
|
6790 | type.process(
|
6791 | n1,
|
6792 | n2,
|
6793 | container,
|
6794 | anchor,
|
6795 | parentComponent,
|
6796 | parentSuspense,
|
6797 | namespace,
|
6798 | slotScopeIds,
|
6799 | optimized,
|
6800 | internals
|
6801 | );
|
6802 | } else {
|
6803 | warn$1("Invalid VNode type:", type, `(${typeof type})`);
|
6804 | }
|
6805 | }
|
6806 | if (ref != null && parentComponent) {
|
6807 | setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
6808 | }
|
6809 | };
|
6810 | const processText = (n1, n2, container, anchor) => {
|
6811 | if (n1 == null) {
|
6812 | hostInsert(
|
6813 | n2.el = hostCreateText(n2.children),
|
6814 | container,
|
6815 | anchor
|
6816 | );
|
6817 | } else {
|
6818 | const el = n2.el = n1.el;
|
6819 | if (n2.children !== n1.children) {
|
6820 | hostSetText(el, n2.children);
|
6821 | }
|
6822 | }
|
6823 | };
|
6824 | const processCommentNode = (n1, n2, container, anchor) => {
|
6825 | if (n1 == null) {
|
6826 | hostInsert(
|
6827 | n2.el = hostCreateComment(n2.children || ""),
|
6828 | container,
|
6829 | anchor
|
6830 | );
|
6831 | } else {
|
6832 | n2.el = n1.el;
|
6833 | }
|
6834 | };
|
6835 | const mountStaticNode = (n2, container, anchor, namespace) => {
|
6836 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6837 | n2.children,
|
6838 | container,
|
6839 | anchor,
|
6840 | namespace,
|
6841 | n2.el,
|
6842 | n2.anchor
|
6843 | );
|
6844 | };
|
6845 | const patchStaticNode = (n1, n2, container, namespace) => {
|
6846 | if (n2.children !== n1.children) {
|
6847 | const anchor = hostNextSibling(n1.anchor);
|
6848 | removeStaticNode(n1);
|
6849 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6850 | n2.children,
|
6851 | container,
|
6852 | anchor,
|
6853 | namespace
|
6854 | );
|
6855 | } else {
|
6856 | n2.el = n1.el;
|
6857 | n2.anchor = n1.anchor;
|
6858 | }
|
6859 | };
|
6860 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
6861 | let next;
|
6862 | while (el && el !== anchor) {
|
6863 | next = hostNextSibling(el);
|
6864 | hostInsert(el, container, nextSibling);
|
6865 | el = next;
|
6866 | }
|
6867 | hostInsert(anchor, container, nextSibling);
|
6868 | };
|
6869 | const removeStaticNode = ({ el, anchor }) => {
|
6870 | let next;
|
6871 | while (el && el !== anchor) {
|
6872 | next = hostNextSibling(el);
|
6873 | hostRemove(el);
|
6874 | el = next;
|
6875 | }
|
6876 | hostRemove(anchor);
|
6877 | };
|
6878 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6879 | if (n2.type === "svg") {
|
6880 | namespace = "svg";
|
6881 | } else if (n2.type === "math") {
|
6882 | namespace = "mathml";
|
6883 | }
|
6884 | if (n1 == null) {
|
6885 | mountElement(
|
6886 | n2,
|
6887 | container,
|
6888 | anchor,
|
6889 | parentComponent,
|
6890 | parentSuspense,
|
6891 | namespace,
|
6892 | slotScopeIds,
|
6893 | optimized
|
6894 | );
|
6895 | } else {
|
6896 | patchElement(
|
6897 | n1,
|
6898 | n2,
|
6899 | parentComponent,
|
6900 | parentSuspense,
|
6901 | namespace,
|
6902 | slotScopeIds,
|
6903 | optimized
|
6904 | );
|
6905 | }
|
6906 | };
|
6907 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6908 | let el;
|
6909 | let vnodeHook;
|
6910 | const { props, shapeFlag, transition, dirs } = vnode;
|
6911 | el = vnode.el = hostCreateElement(
|
6912 | vnode.type,
|
6913 | namespace,
|
6914 | props && props.is,
|
6915 | props
|
6916 | );
|
6917 | if (shapeFlag & 8) {
|
6918 | hostSetElementText(el, vnode.children);
|
6919 | } else if (shapeFlag & 16) {
|
6920 | mountChildren(
|
6921 | vnode.children,
|
6922 | el,
|
6923 | null,
|
6924 | parentComponent,
|
6925 | parentSuspense,
|
6926 | resolveChildrenNamespace(vnode, namespace),
|
6927 | slotScopeIds,
|
6928 | optimized
|
6929 | );
|
6930 | }
|
6931 | if (dirs) {
|
6932 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
6933 | }
|
6934 | setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
6935 | if (props) {
|
6936 | for (const key in props) {
|
6937 | if (key !== "value" && !isReservedProp(key)) {
|
6938 | hostPatchProp(
|
6939 | el,
|
6940 | key,
|
6941 | null,
|
6942 | props[key],
|
6943 | namespace,
|
6944 | vnode.children,
|
6945 | parentComponent,
|
6946 | parentSuspense,
|
6947 | unmountChildren
|
6948 | );
|
6949 | }
|
6950 | }
|
6951 | if ("value" in props) {
|
6952 | hostPatchProp(el, "value", null, props.value, namespace);
|
6953 | }
|
6954 | if (vnodeHook = props.onVnodeBeforeMount) {
|
6955 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6956 | }
|
6957 | }
|
6958 | {
|
6959 | Object.defineProperty(el, "__vnode", {
|
6960 | value: vnode,
|
6961 | enumerable: false
|
6962 | });
|
6963 | Object.defineProperty(el, "__vueParentComponent", {
|
6964 | value: parentComponent,
|
6965 | enumerable: false
|
6966 | });
|
6967 | }
|
6968 | if (dirs) {
|
6969 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
6970 | }
|
6971 | const needCallTransitionHooks = needTransition(parentSuspense, transition);
|
6972 | if (needCallTransitionHooks) {
|
6973 | transition.beforeEnter(el);
|
6974 | }
|
6975 | hostInsert(el, container, anchor);
|
6976 | if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
6977 | queuePostRenderEffect(() => {
|
6978 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6979 | needCallTransitionHooks && transition.enter(el);
|
6980 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
6981 | }, parentSuspense);
|
6982 | }
|
6983 | };
|
6984 | const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
6985 | if (scopeId) {
|
6986 | hostSetScopeId(el, scopeId);
|
6987 | }
|
6988 | if (slotScopeIds) {
|
6989 | for (let i = 0; i < slotScopeIds.length; i++) {
|
6990 | hostSetScopeId(el, slotScopeIds[i]);
|
6991 | }
|
6992 | }
|
6993 | if (parentComponent) {
|
6994 | let subTree = parentComponent.subTree;
|
6995 | if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
6996 | subTree = filterSingleRoot(subTree.children) || subTree;
|
6997 | }
|
6998 | if (vnode === subTree) {
|
6999 | const parentVNode = parentComponent.vnode;
|
7000 | setScopeId(
|
7001 | el,
|
7002 | parentVNode,
|
7003 | parentVNode.scopeId,
|
7004 | parentVNode.slotScopeIds,
|
7005 | parentComponent.parent
|
7006 | );
|
7007 | }
|
7008 | }
|
7009 | };
|
7010 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
7011 | for (let i = start; i < children.length; i++) {
|
7012 | const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
7013 | patch(
|
7014 | null,
|
7015 | child,
|
7016 | container,
|
7017 | anchor,
|
7018 | parentComponent,
|
7019 | parentSuspense,
|
7020 | namespace,
|
7021 | slotScopeIds,
|
7022 | optimized
|
7023 | );
|
7024 | }
|
7025 | };
|
7026 | const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7027 | const el = n2.el = n1.el;
|
7028 | let { patchFlag, dynamicChildren, dirs } = n2;
|
7029 | patchFlag |= n1.patchFlag & 16;
|
7030 | const oldProps = n1.props || EMPTY_OBJ;
|
7031 | const newProps = n2.props || EMPTY_OBJ;
|
7032 | let vnodeHook;
|
7033 | parentComponent && toggleRecurse(parentComponent, false);
|
7034 | if (vnodeHook = newProps.onVnodeBeforeUpdate) {
|
7035 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7036 | }
|
7037 | if (dirs) {
|
7038 | invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
7039 | }
|
7040 | parentComponent && toggleRecurse(parentComponent, true);
|
7041 | if (isHmrUpdating) {
|
7042 | patchFlag = 0;
|
7043 | optimized = false;
|
7044 | dynamicChildren = null;
|
7045 | }
|
7046 | if (dynamicChildren) {
|
7047 | patchBlockChildren(
|
7048 | n1.dynamicChildren,
|
7049 | dynamicChildren,
|
7050 | el,
|
7051 | parentComponent,
|
7052 | parentSuspense,
|
7053 | resolveChildrenNamespace(n2, namespace),
|
7054 | slotScopeIds
|
7055 | );
|
7056 | {
|
7057 | traverseStaticChildren(n1, n2);
|
7058 | }
|
7059 | } else if (!optimized) {
|
7060 | patchChildren(
|
7061 | n1,
|
7062 | n2,
|
7063 | el,
|
7064 | null,
|
7065 | parentComponent,
|
7066 | parentSuspense,
|
7067 | resolveChildrenNamespace(n2, namespace),
|
7068 | slotScopeIds,
|
7069 | false
|
7070 | );
|
7071 | }
|
7072 | if (patchFlag > 0) {
|
7073 | if (patchFlag & 16) {
|
7074 | patchProps(
|
7075 | el,
|
7076 | n2,
|
7077 | oldProps,
|
7078 | newProps,
|
7079 | parentComponent,
|
7080 | parentSuspense,
|
7081 | namespace
|
7082 | );
|
7083 | } else {
|
7084 | if (patchFlag & 2) {
|
7085 | if (oldProps.class !== newProps.class) {
|
7086 | hostPatchProp(el, "class", null, newProps.class, namespace);
|
7087 | }
|
7088 | }
|
7089 | if (patchFlag & 4) {
|
7090 | hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
|
7091 | }
|
7092 | if (patchFlag & 8) {
|
7093 | const propsToUpdate = n2.dynamicProps;
|
7094 | for (let i = 0; i < propsToUpdate.length; i++) {
|
7095 | const key = propsToUpdate[i];
|
7096 | const prev = oldProps[key];
|
7097 | const next = newProps[key];
|
7098 | if (next !== prev || key === "value") {
|
7099 | hostPatchProp(
|
7100 | el,
|
7101 | key,
|
7102 | prev,
|
7103 | next,
|
7104 | namespace,
|
7105 | n1.children,
|
7106 | parentComponent,
|
7107 | parentSuspense,
|
7108 | unmountChildren
|
7109 | );
|
7110 | }
|
7111 | }
|
7112 | }
|
7113 | }
|
7114 | if (patchFlag & 1) {
|
7115 | if (n1.children !== n2.children) {
|
7116 | hostSetElementText(el, n2.children);
|
7117 | }
|
7118 | }
|
7119 | } else if (!optimized && dynamicChildren == null) {
|
7120 | patchProps(
|
7121 | el,
|
7122 | n2,
|
7123 | oldProps,
|
7124 | newProps,
|
7125 | parentComponent,
|
7126 | parentSuspense,
|
7127 | namespace
|
7128 | );
|
7129 | }
|
7130 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
7131 | queuePostRenderEffect(() => {
|
7132 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7133 | dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
7134 | }, parentSuspense);
|
7135 | }
|
7136 | };
|
7137 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
7138 | for (let i = 0; i < newChildren.length; i++) {
|
7139 | const oldVNode = oldChildren[i];
|
7140 | const newVNode = newChildren[i];
|
7141 | const container = (
|
7142 |
|
7143 |
|
7144 | oldVNode.el &&
|
7145 |
|
7146 | (oldVNode.type === Fragment ||
|
7147 |
|
7148 | !isSameVNodeType(oldVNode, newVNode) ||
|
7149 | oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
|
7150 |
|
7151 |
|
7152 | fallbackContainer
|
7153 | )
|
7154 | );
|
7155 | patch(
|
7156 | oldVNode,
|
7157 | newVNode,
|
7158 | container,
|
7159 | null,
|
7160 | parentComponent,
|
7161 | parentSuspense,
|
7162 | namespace,
|
7163 | slotScopeIds,
|
7164 | true
|
7165 | );
|
7166 | }
|
7167 | };
|
7168 | const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
|
7169 | if (oldProps !== newProps) {
|
7170 | if (oldProps !== EMPTY_OBJ) {
|
7171 | for (const key in oldProps) {
|
7172 | if (!isReservedProp(key) && !(key in newProps)) {
|
7173 | hostPatchProp(
|
7174 | el,
|
7175 | key,
|
7176 | oldProps[key],
|
7177 | null,
|
7178 | namespace,
|
7179 | vnode.children,
|
7180 | parentComponent,
|
7181 | parentSuspense,
|
7182 | unmountChildren
|
7183 | );
|
7184 | }
|
7185 | }
|
7186 | }
|
7187 | for (const key in newProps) {
|
7188 | if (isReservedProp(key))
|
7189 | continue;
|
7190 | const next = newProps[key];
|
7191 | const prev = oldProps[key];
|
7192 | if (next !== prev && key !== "value") {
|
7193 | hostPatchProp(
|
7194 | el,
|
7195 | key,
|
7196 | prev,
|
7197 | next,
|
7198 | namespace,
|
7199 | vnode.children,
|
7200 | parentComponent,
|
7201 | parentSuspense,
|
7202 | unmountChildren
|
7203 | );
|
7204 | }
|
7205 | }
|
7206 | if ("value" in newProps) {
|
7207 | hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
|
7208 | }
|
7209 | }
|
7210 | };
|
7211 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7212 | const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
|
7213 | const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
|
7214 | let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
7215 | if (
|
7216 |
|
7217 | isHmrUpdating || patchFlag & 2048
|
7218 | ) {
|
7219 | patchFlag = 0;
|
7220 | optimized = false;
|
7221 | dynamicChildren = null;
|
7222 | }
|
7223 | if (fragmentSlotScopeIds) {
|
7224 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
7225 | }
|
7226 | if (n1 == null) {
|
7227 | hostInsert(fragmentStartAnchor, container, anchor);
|
7228 | hostInsert(fragmentEndAnchor, container, anchor);
|
7229 | mountChildren(
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 | n2.children || [],
|
7235 | container,
|
7236 | fragmentEndAnchor,
|
7237 | parentComponent,
|
7238 | parentSuspense,
|
7239 | namespace,
|
7240 | slotScopeIds,
|
7241 | optimized
|
7242 | );
|
7243 | } else {
|
7244 | if (patchFlag > 0 && patchFlag & 64 && dynamicChildren &&
|
7245 |
|
7246 | n1.dynamicChildren) {
|
7247 | patchBlockChildren(
|
7248 | n1.dynamicChildren,
|
7249 | dynamicChildren,
|
7250 | container,
|
7251 | parentComponent,
|
7252 | parentSuspense,
|
7253 | namespace,
|
7254 | slotScopeIds
|
7255 | );
|
7256 | {
|
7257 | traverseStaticChildren(n1, n2);
|
7258 | }
|
7259 | } else {
|
7260 | patchChildren(
|
7261 | n1,
|
7262 | n2,
|
7263 | container,
|
7264 | fragmentEndAnchor,
|
7265 | parentComponent,
|
7266 | parentSuspense,
|
7267 | namespace,
|
7268 | slotScopeIds,
|
7269 | optimized
|
7270 | );
|
7271 | }
|
7272 | }
|
7273 | };
|
7274 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7275 | n2.slotScopeIds = slotScopeIds;
|
7276 | if (n1 == null) {
|
7277 | if (n2.shapeFlag & 512) {
|
7278 | parentComponent.ctx.activate(
|
7279 | n2,
|
7280 | container,
|
7281 | anchor,
|
7282 | namespace,
|
7283 | optimized
|
7284 | );
|
7285 | } else {
|
7286 | mountComponent(
|
7287 | n2,
|
7288 | container,
|
7289 | anchor,
|
7290 | parentComponent,
|
7291 | parentSuspense,
|
7292 | namespace,
|
7293 | optimized
|
7294 | );
|
7295 | }
|
7296 | } else {
|
7297 | updateComponent(n1, n2, optimized);
|
7298 | }
|
7299 | };
|
7300 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
7301 | const instance = (initialVNode.component = createComponentInstance(
|
7302 | initialVNode,
|
7303 | parentComponent,
|
7304 | parentSuspense
|
7305 | ));
|
7306 | if (instance.type.__hmrId) {
|
7307 | registerHMR(instance);
|
7308 | }
|
7309 | {
|
7310 | pushWarningContext(initialVNode);
|
7311 | startMeasure(instance, `mount`);
|
7312 | }
|
7313 | if (isKeepAlive(initialVNode)) {
|
7314 | instance.ctx.renderer = internals;
|
7315 | }
|
7316 | {
|
7317 | {
|
7318 | startMeasure(instance, `init`);
|
7319 | }
|
7320 | setupComponent(instance);
|
7321 | {
|
7322 | endMeasure(instance, `init`);
|
7323 | }
|
7324 | }
|
7325 | if (instance.asyncDep) {
|
7326 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
|
7327 | if (!initialVNode.el) {
|
7328 | const placeholder = instance.subTree = createVNode(Comment);
|
7329 | processCommentNode(null, placeholder, container, anchor);
|
7330 | }
|
7331 | } else {
|
7332 | setupRenderEffect(
|
7333 | instance,
|
7334 | initialVNode,
|
7335 | container,
|
7336 | anchor,
|
7337 | parentSuspense,
|
7338 | namespace,
|
7339 | optimized
|
7340 | );
|
7341 | }
|
7342 | {
|
7343 | popWarningContext();
|
7344 | endMeasure(instance, `mount`);
|
7345 | }
|
7346 | };
|
7347 | const updateComponent = (n1, n2, optimized) => {
|
7348 | const instance = n2.component = n1.component;
|
7349 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
7350 | if (instance.asyncDep && !instance.asyncResolved) {
|
7351 | {
|
7352 | pushWarningContext(n2);
|
7353 | }
|
7354 | updateComponentPreRender(instance, n2, optimized);
|
7355 | {
|
7356 | popWarningContext();
|
7357 | }
|
7358 | return;
|
7359 | } else {
|
7360 | instance.next = n2;
|
7361 | invalidateJob(instance.update);
|
7362 | instance.effect.dirty = true;
|
7363 | instance.update();
|
7364 | }
|
7365 | } else {
|
7366 | n2.el = n1.el;
|
7367 | instance.vnode = n2;
|
7368 | }
|
7369 | };
|
7370 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
7371 | const componentUpdateFn = () => {
|
7372 | if (!instance.isMounted) {
|
7373 | let vnodeHook;
|
7374 | const { el, props } = initialVNode;
|
7375 | const { bm, m, parent } = instance;
|
7376 | const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
7377 | toggleRecurse(instance, false);
|
7378 | if (bm) {
|
7379 | invokeArrayFns(bm);
|
7380 | }
|
7381 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
|
7382 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
7383 | }
|
7384 | toggleRecurse(instance, true);
|
7385 | if (el && hydrateNode) {
|
7386 | const hydrateSubTree = () => {
|
7387 | {
|
7388 | startMeasure(instance, `render`);
|
7389 | }
|
7390 | instance.subTree = renderComponentRoot(instance);
|
7391 | {
|
7392 | endMeasure(instance, `render`);
|
7393 | }
|
7394 | {
|
7395 | startMeasure(instance, `hydrate`);
|
7396 | }
|
7397 | hydrateNode(
|
7398 | el,
|
7399 | instance.subTree,
|
7400 | instance,
|
7401 | parentSuspense,
|
7402 | null
|
7403 | );
|
7404 | {
|
7405 | endMeasure(instance, `hydrate`);
|
7406 | }
|
7407 | };
|
7408 | if (isAsyncWrapperVNode) {
|
7409 | initialVNode.type.__asyncLoader().then(
|
7410 |
|
7411 |
|
7412 |
|
7413 |
|
7414 | () => !instance.isUnmounted && hydrateSubTree()
|
7415 | );
|
7416 | } else {
|
7417 | hydrateSubTree();
|
7418 | }
|
7419 | } else {
|
7420 | {
|
7421 | startMeasure(instance, `render`);
|
7422 | }
|
7423 | const subTree = instance.subTree = renderComponentRoot(instance);
|
7424 | {
|
7425 | endMeasure(instance, `render`);
|
7426 | }
|
7427 | {
|
7428 | startMeasure(instance, `patch`);
|
7429 | }
|
7430 | patch(
|
7431 | null,
|
7432 | subTree,
|
7433 | container,
|
7434 | anchor,
|
7435 | instance,
|
7436 | parentSuspense,
|
7437 | namespace
|
7438 | );
|
7439 | {
|
7440 | endMeasure(instance, `patch`);
|
7441 | }
|
7442 | initialVNode.el = subTree.el;
|
7443 | }
|
7444 | if (m) {
|
7445 | queuePostRenderEffect(m, parentSuspense);
|
7446 | }
|
7447 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
7448 | const scopedInitialVNode = initialVNode;
|
7449 | queuePostRenderEffect(
|
7450 | () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
7451 | parentSuspense
|
7452 | );
|
7453 | }
|
7454 | if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
7455 | instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
7456 | }
|
7457 | instance.isMounted = true;
|
7458 | {
|
7459 | devtoolsComponentAdded(instance);
|
7460 | }
|
7461 | initialVNode = container = anchor = null;
|
7462 | } else {
|
7463 | let { next, bu, u, parent, vnode } = instance;
|
7464 | {
|
7465 | const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
|
7466 | if (nonHydratedAsyncRoot) {
|
7467 | if (next) {
|
7468 | next.el = vnode.el;
|
7469 | updateComponentPreRender(instance, next, optimized);
|
7470 | }
|
7471 | nonHydratedAsyncRoot.asyncDep.then(() => {
|
7472 | if (!instance.isUnmounted) {
|
7473 | componentUpdateFn();
|
7474 | }
|
7475 | });
|
7476 | return;
|
7477 | }
|
7478 | }
|
7479 | let originNext = next;
|
7480 | let vnodeHook;
|
7481 | {
|
7482 | pushWarningContext(next || instance.vnode);
|
7483 | }
|
7484 | toggleRecurse(instance, false);
|
7485 | if (next) {
|
7486 | next.el = vnode.el;
|
7487 | updateComponentPreRender(instance, next, optimized);
|
7488 | } else {
|
7489 | next = vnode;
|
7490 | }
|
7491 | if (bu) {
|
7492 | invokeArrayFns(bu);
|
7493 | }
|
7494 | if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
|
7495 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
7496 | }
|
7497 | toggleRecurse(instance, true);
|
7498 | {
|
7499 | startMeasure(instance, `render`);
|
7500 | }
|
7501 | const nextTree = renderComponentRoot(instance);
|
7502 | {
|
7503 | endMeasure(instance, `render`);
|
7504 | }
|
7505 | const prevTree = instance.subTree;
|
7506 | instance.subTree = nextTree;
|
7507 | {
|
7508 | startMeasure(instance, `patch`);
|
7509 | }
|
7510 | patch(
|
7511 | prevTree,
|
7512 | nextTree,
|
7513 |
|
7514 | hostParentNode(prevTree.el),
|
7515 |
|
7516 | getNextHostNode(prevTree),
|
7517 | instance,
|
7518 | parentSuspense,
|
7519 | namespace
|
7520 | );
|
7521 | {
|
7522 | endMeasure(instance, `patch`);
|
7523 | }
|
7524 | next.el = nextTree.el;
|
7525 | if (originNext === null) {
|
7526 | updateHOCHostEl(instance, nextTree.el);
|
7527 | }
|
7528 | if (u) {
|
7529 | queuePostRenderEffect(u, parentSuspense);
|
7530 | }
|
7531 | if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
7532 | queuePostRenderEffect(
|
7533 | () => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
7534 | parentSuspense
|
7535 | );
|
7536 | }
|
7537 | {
|
7538 | devtoolsComponentUpdated(instance);
|
7539 | }
|
7540 | {
|
7541 | popWarningContext();
|
7542 | }
|
7543 | }
|
7544 | };
|
7545 | const effect = instance.effect = new ReactiveEffect(
|
7546 | componentUpdateFn,
|
7547 | NOOP,
|
7548 | () => queueJob(update),
|
7549 | instance.scope
|
7550 |
|
7551 | );
|
7552 | const update = instance.update = () => {
|
7553 | if (effect.dirty) {
|
7554 | effect.run();
|
7555 | }
|
7556 | };
|
7557 | update.id = instance.uid;
|
7558 | toggleRecurse(instance, true);
|
7559 | {
|
7560 | effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
7561 | effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
7562 | update.ownerInstance = instance;
|
7563 | }
|
7564 | update();
|
7565 | };
|
7566 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
7567 | nextVNode.component = instance;
|
7568 | const prevProps = instance.vnode.props;
|
7569 | instance.vnode = nextVNode;
|
7570 | instance.next = null;
|
7571 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
7572 | updateSlots(instance, nextVNode.children, optimized);
|
7573 | pauseTracking();
|
7574 | flushPreFlushCbs(instance);
|
7575 | resetTracking();
|
7576 | };
|
7577 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
7578 | const c1 = n1 && n1.children;
|
7579 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
7580 | const c2 = n2.children;
|
7581 | const { patchFlag, shapeFlag } = n2;
|
7582 | if (patchFlag > 0) {
|
7583 | if (patchFlag & 128) {
|
7584 | patchKeyedChildren(
|
7585 | c1,
|
7586 | c2,
|
7587 | container,
|
7588 | anchor,
|
7589 | parentComponent,
|
7590 | parentSuspense,
|
7591 | namespace,
|
7592 | slotScopeIds,
|
7593 | optimized
|
7594 | );
|
7595 | return;
|
7596 | } else if (patchFlag & 256) {
|
7597 | patchUnkeyedChildren(
|
7598 | c1,
|
7599 | c2,
|
7600 | container,
|
7601 | anchor,
|
7602 | parentComponent,
|
7603 | parentSuspense,
|
7604 | namespace,
|
7605 | slotScopeIds,
|
7606 | optimized
|
7607 | );
|
7608 | return;
|
7609 | }
|
7610 | }
|
7611 | if (shapeFlag & 8) {
|
7612 | if (prevShapeFlag & 16) {
|
7613 | unmountChildren(c1, parentComponent, parentSuspense);
|
7614 | }
|
7615 | if (c2 !== c1) {
|
7616 | hostSetElementText(container, c2);
|
7617 | }
|
7618 | } else {
|
7619 | if (prevShapeFlag & 16) {
|
7620 | if (shapeFlag & 16) {
|
7621 | patchKeyedChildren(
|
7622 | c1,
|
7623 | c2,
|
7624 | container,
|
7625 | anchor,
|
7626 | parentComponent,
|
7627 | parentSuspense,
|
7628 | namespace,
|
7629 | slotScopeIds,
|
7630 | optimized
|
7631 | );
|
7632 | } else {
|
7633 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
7634 | }
|
7635 | } else {
|
7636 | if (prevShapeFlag & 8) {
|
7637 | hostSetElementText(container, "");
|
7638 | }
|
7639 | if (shapeFlag & 16) {
|
7640 | mountChildren(
|
7641 | c2,
|
7642 | container,
|
7643 | anchor,
|
7644 | parentComponent,
|
7645 | parentSuspense,
|
7646 | namespace,
|
7647 | slotScopeIds,
|
7648 | optimized
|
7649 | );
|
7650 | }
|
7651 | }
|
7652 | }
|
7653 | };
|
7654 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7655 | c1 = c1 || EMPTY_ARR;
|
7656 | c2 = c2 || EMPTY_ARR;
|
7657 | const oldLength = c1.length;
|
7658 | const newLength = c2.length;
|
7659 | const commonLength = Math.min(oldLength, newLength);
|
7660 | let i;
|
7661 | for (i = 0; i < commonLength; i++) {
|
7662 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7663 | patch(
|
7664 | c1[i],
|
7665 | nextChild,
|
7666 | container,
|
7667 | null,
|
7668 | parentComponent,
|
7669 | parentSuspense,
|
7670 | namespace,
|
7671 | slotScopeIds,
|
7672 | optimized
|
7673 | );
|
7674 | }
|
7675 | if (oldLength > newLength) {
|
7676 | unmountChildren(
|
7677 | c1,
|
7678 | parentComponent,
|
7679 | parentSuspense,
|
7680 | true,
|
7681 | false,
|
7682 | commonLength
|
7683 | );
|
7684 | } else {
|
7685 | mountChildren(
|
7686 | c2,
|
7687 | container,
|
7688 | anchor,
|
7689 | parentComponent,
|
7690 | parentSuspense,
|
7691 | namespace,
|
7692 | slotScopeIds,
|
7693 | optimized,
|
7694 | commonLength
|
7695 | );
|
7696 | }
|
7697 | };
|
7698 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7699 | let i = 0;
|
7700 | const l2 = c2.length;
|
7701 | let e1 = c1.length - 1;
|
7702 | let e2 = l2 - 1;
|
7703 | while (i <= e1 && i <= e2) {
|
7704 | const n1 = c1[i];
|
7705 | const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7706 | if (isSameVNodeType(n1, n2)) {
|
7707 | patch(
|
7708 | n1,
|
7709 | n2,
|
7710 | container,
|
7711 | null,
|
7712 | parentComponent,
|
7713 | parentSuspense,
|
7714 | namespace,
|
7715 | slotScopeIds,
|
7716 | optimized
|
7717 | );
|
7718 | } else {
|
7719 | break;
|
7720 | }
|
7721 | i++;
|
7722 | }
|
7723 | while (i <= e1 && i <= e2) {
|
7724 | const n1 = c1[e1];
|
7725 | const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
|
7726 | if (isSameVNodeType(n1, n2)) {
|
7727 | patch(
|
7728 | n1,
|
7729 | n2,
|
7730 | container,
|
7731 | null,
|
7732 | parentComponent,
|
7733 | parentSuspense,
|
7734 | namespace,
|
7735 | slotScopeIds,
|
7736 | optimized
|
7737 | );
|
7738 | } else {
|
7739 | break;
|
7740 | }
|
7741 | e1--;
|
7742 | e2--;
|
7743 | }
|
7744 | if (i > e1) {
|
7745 | if (i <= e2) {
|
7746 | const nextPos = e2 + 1;
|
7747 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
7748 | while (i <= e2) {
|
7749 | patch(
|
7750 | null,
|
7751 | c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
|
7752 | container,
|
7753 | anchor,
|
7754 | parentComponent,
|
7755 | parentSuspense,
|
7756 | namespace,
|
7757 | slotScopeIds,
|
7758 | optimized
|
7759 | );
|
7760 | i++;
|
7761 | }
|
7762 | }
|
7763 | } else if (i > e2) {
|
7764 | while (i <= e1) {
|
7765 | unmount(c1[i], parentComponent, parentSuspense, true);
|
7766 | i++;
|
7767 | }
|
7768 | } else {
|
7769 | const s1 = i;
|
7770 | const s2 = i;
|
7771 | const keyToNewIndexMap = new Map();
|
7772 | for (i = s2; i <= e2; i++) {
|
7773 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7774 | if (nextChild.key != null) {
|
7775 | if (keyToNewIndexMap.has(nextChild.key)) {
|
7776 | warn$1(
|
7777 | `Duplicate keys found during update:`,
|
7778 | JSON.stringify(nextChild.key),
|
7779 | `Make sure keys are unique.`
|
7780 | );
|
7781 | }
|
7782 | keyToNewIndexMap.set(nextChild.key, i);
|
7783 | }
|
7784 | }
|
7785 | let j;
|
7786 | let patched = 0;
|
7787 | const toBePatched = e2 - s2 + 1;
|
7788 | let moved = false;
|
7789 | let maxNewIndexSoFar = 0;
|
7790 | const newIndexToOldIndexMap = new Array(toBePatched);
|
7791 | for (i = 0; i < toBePatched; i++)
|
7792 | newIndexToOldIndexMap[i] = 0;
|
7793 | for (i = s1; i <= e1; i++) {
|
7794 | const prevChild = c1[i];
|
7795 | if (patched >= toBePatched) {
|
7796 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7797 | continue;
|
7798 | }
|
7799 | let newIndex;
|
7800 | if (prevChild.key != null) {
|
7801 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
7802 | } else {
|
7803 | for (j = s2; j <= e2; j++) {
|
7804 | if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
|
7805 | newIndex = j;
|
7806 | break;
|
7807 | }
|
7808 | }
|
7809 | }
|
7810 | if (newIndex === void 0) {
|
7811 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7812 | } else {
|
7813 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
7814 | if (newIndex >= maxNewIndexSoFar) {
|
7815 | maxNewIndexSoFar = newIndex;
|
7816 | } else {
|
7817 | moved = true;
|
7818 | }
|
7819 | patch(
|
7820 | prevChild,
|
7821 | c2[newIndex],
|
7822 | container,
|
7823 | null,
|
7824 | parentComponent,
|
7825 | parentSuspense,
|
7826 | namespace,
|
7827 | slotScopeIds,
|
7828 | optimized
|
7829 | );
|
7830 | patched++;
|
7831 | }
|
7832 | }
|
7833 | const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
|
7834 | j = increasingNewIndexSequence.length - 1;
|
7835 | for (i = toBePatched - 1; i >= 0; i--) {
|
7836 | const nextIndex = s2 + i;
|
7837 | const nextChild = c2[nextIndex];
|
7838 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
7839 | if (newIndexToOldIndexMap[i] === 0) {
|
7840 | patch(
|
7841 | null,
|
7842 | nextChild,
|
7843 | container,
|
7844 | anchor,
|
7845 | parentComponent,
|
7846 | parentSuspense,
|
7847 | namespace,
|
7848 | slotScopeIds,
|
7849 | optimized
|
7850 | );
|
7851 | } else if (moved) {
|
7852 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
7853 | move(nextChild, container, anchor, 2);
|
7854 | } else {
|
7855 | j--;
|
7856 | }
|
7857 | }
|
7858 | }
|
7859 | }
|
7860 | };
|
7861 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
7862 | const { el, type, transition, children, shapeFlag } = vnode;
|
7863 | if (shapeFlag & 6) {
|
7864 | move(vnode.component.subTree, container, anchor, moveType);
|
7865 | return;
|
7866 | }
|
7867 | if (shapeFlag & 128) {
|
7868 | vnode.suspense.move(container, anchor, moveType);
|
7869 | return;
|
7870 | }
|
7871 | if (shapeFlag & 64) {
|
7872 | type.move(vnode, container, anchor, internals);
|
7873 | return;
|
7874 | }
|
7875 | if (type === Fragment) {
|
7876 | hostInsert(el, container, anchor);
|
7877 | for (let i = 0; i < children.length; i++) {
|
7878 | move(children[i], container, anchor, moveType);
|
7879 | }
|
7880 | hostInsert(vnode.anchor, container, anchor);
|
7881 | return;
|
7882 | }
|
7883 | if (type === Static) {
|
7884 | moveStaticNode(vnode, container, anchor);
|
7885 | return;
|
7886 | }
|
7887 | const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
|
7888 | if (needTransition2) {
|
7889 | if (moveType === 0) {
|
7890 | transition.beforeEnter(el);
|
7891 | hostInsert(el, container, anchor);
|
7892 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
7893 | } else {
|
7894 | const { leave, delayLeave, afterLeave } = transition;
|
7895 | const remove2 = () => hostInsert(el, container, anchor);
|
7896 | const performLeave = () => {
|
7897 | leave(el, () => {
|
7898 | remove2();
|
7899 | afterLeave && afterLeave();
|
7900 | });
|
7901 | };
|
7902 | if (delayLeave) {
|
7903 | delayLeave(el, remove2, performLeave);
|
7904 | } else {
|
7905 | performLeave();
|
7906 | }
|
7907 | }
|
7908 | } else {
|
7909 | hostInsert(el, container, anchor);
|
7910 | }
|
7911 | };
|
7912 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
7913 | const {
|
7914 | type,
|
7915 | props,
|
7916 | ref,
|
7917 | children,
|
7918 | dynamicChildren,
|
7919 | shapeFlag,
|
7920 | patchFlag,
|
7921 | dirs
|
7922 | } = vnode;
|
7923 | if (ref != null) {
|
7924 | setRef(ref, null, parentSuspense, vnode, true);
|
7925 | }
|
7926 | if (shapeFlag & 256) {
|
7927 | parentComponent.ctx.deactivate(vnode);
|
7928 | return;
|
7929 | }
|
7930 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
7931 | const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
7932 | let vnodeHook;
|
7933 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
7934 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7935 | }
|
7936 | if (shapeFlag & 6) {
|
7937 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
7938 | } else {
|
7939 | if (shapeFlag & 128) {
|
7940 | vnode.suspense.unmount(parentSuspense, doRemove);
|
7941 | return;
|
7942 | }
|
7943 | if (shouldInvokeDirs) {
|
7944 | invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
7945 | }
|
7946 | if (shapeFlag & 64) {
|
7947 | vnode.type.remove(
|
7948 | vnode,
|
7949 | parentComponent,
|
7950 | parentSuspense,
|
7951 | optimized,
|
7952 | internals,
|
7953 | doRemove
|
7954 | );
|
7955 | } else if (dynamicChildren &&
|
7956 | (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
7957 | unmountChildren(
|
7958 | dynamicChildren,
|
7959 | parentComponent,
|
7960 | parentSuspense,
|
7961 | false,
|
7962 | true
|
7963 | );
|
7964 | } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
7965 | unmountChildren(children, parentComponent, parentSuspense);
|
7966 | }
|
7967 | if (doRemove) {
|
7968 | remove(vnode);
|
7969 | }
|
7970 | }
|
7971 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
7972 | queuePostRenderEffect(() => {
|
7973 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7974 | shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
7975 | }, parentSuspense);
|
7976 | }
|
7977 | };
|
7978 | const remove = (vnode) => {
|
7979 | const { type, el, anchor, transition } = vnode;
|
7980 | if (type === Fragment) {
|
7981 | if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
|
7982 | vnode.children.forEach((child) => {
|
7983 | if (child.type === Comment) {
|
7984 | hostRemove(child.el);
|
7985 | } else {
|
7986 | remove(child);
|
7987 | }
|
7988 | });
|
7989 | } else {
|
7990 | removeFragment(el, anchor);
|
7991 | }
|
7992 | return;
|
7993 | }
|
7994 | if (type === Static) {
|
7995 | removeStaticNode(vnode);
|
7996 | return;
|
7997 | }
|
7998 | const performRemove = () => {
|
7999 | hostRemove(el);
|
8000 | if (transition && !transition.persisted && transition.afterLeave) {
|
8001 | transition.afterLeave();
|
8002 | }
|
8003 | };
|
8004 | if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
|
8005 | const { leave, delayLeave } = transition;
|
8006 | const performLeave = () => leave(el, performRemove);
|
8007 | if (delayLeave) {
|
8008 | delayLeave(vnode.el, performRemove, performLeave);
|
8009 | } else {
|
8010 | performLeave();
|
8011 | }
|
8012 | } else {
|
8013 | performRemove();
|
8014 | }
|
8015 | };
|
8016 | const removeFragment = (cur, end) => {
|
8017 | let next;
|
8018 | while (cur !== end) {
|
8019 | next = hostNextSibling(cur);
|
8020 | hostRemove(cur);
|
8021 | cur = next;
|
8022 | }
|
8023 | hostRemove(end);
|
8024 | };
|
8025 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
8026 | if (instance.type.__hmrId) {
|
8027 | unregisterHMR(instance);
|
8028 | }
|
8029 | const { bum, scope, update, subTree, um } = instance;
|
8030 | if (bum) {
|
8031 | invokeArrayFns(bum);
|
8032 | }
|
8033 | scope.stop();
|
8034 | if (update) {
|
8035 | update.active = false;
|
8036 | unmount(subTree, instance, parentSuspense, doRemove);
|
8037 | }
|
8038 | if (um) {
|
8039 | queuePostRenderEffect(um, parentSuspense);
|
8040 | }
|
8041 | queuePostRenderEffect(() => {
|
8042 | instance.isUnmounted = true;
|
8043 | }, parentSuspense);
|
8044 | if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
8045 | parentSuspense.deps--;
|
8046 | if (parentSuspense.deps === 0) {
|
8047 | parentSuspense.resolve();
|
8048 | }
|
8049 | }
|
8050 | {
|
8051 | devtoolsComponentRemoved(instance);
|
8052 | }
|
8053 | };
|
8054 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
8055 | for (let i = start; i < children.length; i++) {
|
8056 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
8057 | }
|
8058 | };
|
8059 | const getNextHostNode = (vnode) => {
|
8060 | if (vnode.shapeFlag & 6) {
|
8061 | return getNextHostNode(vnode.component.subTree);
|
8062 | }
|
8063 | if (vnode.shapeFlag & 128) {
|
8064 | return vnode.suspense.next();
|
8065 | }
|
8066 | return hostNextSibling(vnode.anchor || vnode.el);
|
8067 | };
|
8068 | let isFlushing = false;
|
8069 | const render = (vnode, container, namespace) => {
|
8070 | if (vnode == null) {
|
8071 | if (container._vnode) {
|
8072 | unmount(container._vnode, null, null, true);
|
8073 | }
|
8074 | } else {
|
8075 | patch(
|
8076 | container._vnode || null,
|
8077 | vnode,
|
8078 | container,
|
8079 | null,
|
8080 | null,
|
8081 | null,
|
8082 | namespace
|
8083 | );
|
8084 | }
|
8085 | if (!isFlushing) {
|
8086 | isFlushing = true;
|
8087 | flushPreFlushCbs();
|
8088 | flushPostFlushCbs();
|
8089 | isFlushing = false;
|
8090 | }
|
8091 | container._vnode = vnode;
|
8092 | };
|
8093 | const internals = {
|
8094 | p: patch,
|
8095 | um: unmount,
|
8096 | m: move,
|
8097 | r: remove,
|
8098 | mt: mountComponent,
|
8099 | mc: mountChildren,
|
8100 | pc: patchChildren,
|
8101 | pbc: patchBlockChildren,
|
8102 | n: getNextHostNode,
|
8103 | o: options
|
8104 | };
|
8105 | let hydrate;
|
8106 | let hydrateNode;
|
8107 | if (createHydrationFns) {
|
8108 | [hydrate, hydrateNode] = createHydrationFns(
|
8109 | internals
|
8110 | );
|
8111 | }
|
8112 | return {
|
8113 | render,
|
8114 | hydrate,
|
8115 | createApp: createAppAPI(render, hydrate)
|
8116 | };
|
8117 | }
|
8118 | function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
8119 | return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
8120 | }
|
8121 | function toggleRecurse({ effect, update }, allowed) {
|
8122 | effect.allowRecurse = update.allowRecurse = allowed;
|
8123 | }
|
8124 | function needTransition(parentSuspense, transition) {
|
8125 | return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
8126 | }
|
8127 | function traverseStaticChildren(n1, n2, shallow = false) {
|
8128 | const ch1 = n1.children;
|
8129 | const ch2 = n2.children;
|
8130 | if (isArray(ch1) && isArray(ch2)) {
|
8131 | for (let i = 0; i < ch1.length; i++) {
|
8132 | const c1 = ch1[i];
|
8133 | let c2 = ch2[i];
|
8134 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
8135 | if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
|
8136 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
8137 | c2.el = c1.el;
|
8138 | }
|
8139 | if (!shallow)
|
8140 | traverseStaticChildren(c1, c2);
|
8141 | }
|
8142 | if (c2.type === Text) {
|
8143 | c2.el = c1.el;
|
8144 | }
|
8145 | if (c2.type === Comment && !c2.el) {
|
8146 | c2.el = c1.el;
|
8147 | }
|
8148 | }
|
8149 | }
|
8150 | }
|
8151 | function getSequence(arr) {
|
8152 | const p = arr.slice();
|
8153 | const result = [0];
|
8154 | let i, j, u, v, c;
|
8155 | const len = arr.length;
|
8156 | for (i = 0; i < len; i++) {
|
8157 | const arrI = arr[i];
|
8158 | if (arrI !== 0) {
|
8159 | j = result[result.length - 1];
|
8160 | if (arr[j] < arrI) {
|
8161 | p[i] = j;
|
8162 | result.push(i);
|
8163 | continue;
|
8164 | }
|
8165 | u = 0;
|
8166 | v = result.length - 1;
|
8167 | while (u < v) {
|
8168 | c = u + v >> 1;
|
8169 | if (arr[result[c]] < arrI) {
|
8170 | u = c + 1;
|
8171 | } else {
|
8172 | v = c;
|
8173 | }
|
8174 | }
|
8175 | if (arrI < arr[result[u]]) {
|
8176 | if (u > 0) {
|
8177 | p[i] = result[u - 1];
|
8178 | }
|
8179 | result[u] = i;
|
8180 | }
|
8181 | }
|
8182 | }
|
8183 | u = result.length;
|
8184 | v = result[u - 1];
|
8185 | while (u-- > 0) {
|
8186 | result[u] = v;
|
8187 | v = p[v];
|
8188 | }
|
8189 | return result;
|
8190 | }
|
8191 | function locateNonHydratedAsyncRoot(instance) {
|
8192 | const subComponent = instance.subTree.component;
|
8193 | if (subComponent) {
|
8194 | if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
8195 | return subComponent;
|
8196 | } else {
|
8197 | return locateNonHydratedAsyncRoot(subComponent);
|
8198 | }
|
8199 | }
|
8200 | }
|
8201 |
|
8202 | const isTeleport = (type) => type.__isTeleport;
|
8203 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
8204 | const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
8205 | const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
8206 | const resolveTarget = (props, select) => {
|
8207 | const targetSelector = props && props.to;
|
8208 | if (isString(targetSelector)) {
|
8209 | if (!select) {
|
8210 | warn$1(
|
8211 | `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
|
8212 | );
|
8213 | return null;
|
8214 | } else {
|
8215 | const target = select(targetSelector);
|
8216 | if (!target) {
|
8217 | warn$1(
|
8218 | `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.`
|
8219 | );
|
8220 | }
|
8221 | return target;
|
8222 | }
|
8223 | } else {
|
8224 | if (!targetSelector && !isTeleportDisabled(props)) {
|
8225 | warn$1(`Invalid Teleport target: ${targetSelector}`);
|
8226 | }
|
8227 | return targetSelector;
|
8228 | }
|
8229 | };
|
8230 | const TeleportImpl = {
|
8231 | name: "Teleport",
|
8232 | __isTeleport: true,
|
8233 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
8234 | const {
|
8235 | mc: mountChildren,
|
8236 | pc: patchChildren,
|
8237 | pbc: patchBlockChildren,
|
8238 | o: { insert, querySelector, createText, createComment }
|
8239 | } = internals;
|
8240 | const disabled = isTeleportDisabled(n2.props);
|
8241 | let { shapeFlag, children, dynamicChildren } = n2;
|
8242 | if (isHmrUpdating) {
|
8243 | optimized = false;
|
8244 | dynamicChildren = null;
|
8245 | }
|
8246 | if (n1 == null) {
|
8247 | const placeholder = n2.el = createComment("teleport start") ;
|
8248 | const mainAnchor = n2.anchor = createComment("teleport end") ;
|
8249 | insert(placeholder, container, anchor);
|
8250 | insert(mainAnchor, container, anchor);
|
8251 | const target = n2.target = resolveTarget(n2.props, querySelector);
|
8252 | const targetAnchor = n2.targetAnchor = createText("");
|
8253 | if (target) {
|
8254 | insert(targetAnchor, target);
|
8255 | if (namespace === "svg" || isTargetSVG(target)) {
|
8256 | namespace = "svg";
|
8257 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
8258 | namespace = "mathml";
|
8259 | }
|
8260 | } else if (!disabled) {
|
8261 | warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
8262 | }
|
8263 | const mount = (container2, anchor2) => {
|
8264 | if (shapeFlag & 16) {
|
8265 | mountChildren(
|
8266 | children,
|
8267 | container2,
|
8268 | anchor2,
|
8269 | parentComponent,
|
8270 | parentSuspense,
|
8271 | namespace,
|
8272 | slotScopeIds,
|
8273 | optimized
|
8274 | );
|
8275 | }
|
8276 | };
|
8277 | if (disabled) {
|
8278 | mount(container, mainAnchor);
|
8279 | } else if (target) {
|
8280 | mount(target, targetAnchor);
|
8281 | }
|
8282 | } else {
|
8283 | n2.el = n1.el;
|
8284 | const mainAnchor = n2.anchor = n1.anchor;
|
8285 | const target = n2.target = n1.target;
|
8286 | const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
8287 | const wasDisabled = isTeleportDisabled(n1.props);
|
8288 | const currentContainer = wasDisabled ? container : target;
|
8289 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
8290 | if (namespace === "svg" || isTargetSVG(target)) {
|
8291 | namespace = "svg";
|
8292 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
8293 | namespace = "mathml";
|
8294 | }
|
8295 | if (dynamicChildren) {
|
8296 | patchBlockChildren(
|
8297 | n1.dynamicChildren,
|
8298 | dynamicChildren,
|
8299 | currentContainer,
|
8300 | parentComponent,
|
8301 | parentSuspense,
|
8302 | namespace,
|
8303 | slotScopeIds
|
8304 | );
|
8305 | traverseStaticChildren(n1, n2, true);
|
8306 | } else if (!optimized) {
|
8307 | patchChildren(
|
8308 | n1,
|
8309 | n2,
|
8310 | currentContainer,
|
8311 | currentAnchor,
|
8312 | parentComponent,
|
8313 | parentSuspense,
|
8314 | namespace,
|
8315 | slotScopeIds,
|
8316 | false
|
8317 | );
|
8318 | }
|
8319 | if (disabled) {
|
8320 | if (!wasDisabled) {
|
8321 | moveTeleport(
|
8322 | n2,
|
8323 | container,
|
8324 | mainAnchor,
|
8325 | internals,
|
8326 | 1
|
8327 | );
|
8328 | } else {
|
8329 | if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
8330 | n2.props.to = n1.props.to;
|
8331 | }
|
8332 | }
|
8333 | } else {
|
8334 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
8335 | const nextTarget = n2.target = resolveTarget(
|
8336 | n2.props,
|
8337 | querySelector
|
8338 | );
|
8339 | if (nextTarget) {
|
8340 | moveTeleport(
|
8341 | n2,
|
8342 | nextTarget,
|
8343 | null,
|
8344 | internals,
|
8345 | 0
|
8346 | );
|
8347 | } else {
|
8348 | warn$1(
|
8349 | "Invalid Teleport target on update:",
|
8350 | target,
|
8351 | `(${typeof target})`
|
8352 | );
|
8353 | }
|
8354 | } else if (wasDisabled) {
|
8355 | moveTeleport(
|
8356 | n2,
|
8357 | target,
|
8358 | targetAnchor,
|
8359 | internals,
|
8360 | 1
|
8361 | );
|
8362 | }
|
8363 | }
|
8364 | }
|
8365 | updateCssVars(n2);
|
8366 | },
|
8367 | remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
8368 | const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
8369 | if (target) {
|
8370 | hostRemove(targetAnchor);
|
8371 | }
|
8372 | doRemove && hostRemove(anchor);
|
8373 | if (shapeFlag & 16) {
|
8374 | const shouldRemove = doRemove || !isTeleportDisabled(props);
|
8375 | for (let i = 0; i < children.length; i++) {
|
8376 | const child = children[i];
|
8377 | unmount(
|
8378 | child,
|
8379 | parentComponent,
|
8380 | parentSuspense,
|
8381 | shouldRemove,
|
8382 | !!child.dynamicChildren
|
8383 | );
|
8384 | }
|
8385 | }
|
8386 | },
|
8387 | move: moveTeleport,
|
8388 | hydrate: hydrateTeleport
|
8389 | };
|
8390 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
8391 | if (moveType === 0) {
|
8392 | insert(vnode.targetAnchor, container, parentAnchor);
|
8393 | }
|
8394 | const { el, anchor, shapeFlag, children, props } = vnode;
|
8395 | const isReorder = moveType === 2;
|
8396 | if (isReorder) {
|
8397 | insert(el, container, parentAnchor);
|
8398 | }
|
8399 | if (!isReorder || isTeleportDisabled(props)) {
|
8400 | if (shapeFlag & 16) {
|
8401 | for (let i = 0; i < children.length; i++) {
|
8402 | move(
|
8403 | children[i],
|
8404 | container,
|
8405 | parentAnchor,
|
8406 | 2
|
8407 | );
|
8408 | }
|
8409 | }
|
8410 | }
|
8411 | if (isReorder) {
|
8412 | insert(anchor, container, parentAnchor);
|
8413 | }
|
8414 | }
|
8415 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
8416 | o: { nextSibling, parentNode, querySelector }
|
8417 | }, hydrateChildren) {
|
8418 | const target = vnode.target = resolveTarget(
|
8419 | vnode.props,
|
8420 | querySelector
|
8421 | );
|
8422 | if (target) {
|
8423 | const targetNode = target._lpa || target.firstChild;
|
8424 | if (vnode.shapeFlag & 16) {
|
8425 | if (isTeleportDisabled(vnode.props)) {
|
8426 | vnode.anchor = hydrateChildren(
|
8427 | nextSibling(node),
|
8428 | vnode,
|
8429 | parentNode(node),
|
8430 | parentComponent,
|
8431 | parentSuspense,
|
8432 | slotScopeIds,
|
8433 | optimized
|
8434 | );
|
8435 | vnode.targetAnchor = targetNode;
|
8436 | } else {
|
8437 | vnode.anchor = nextSibling(node);
|
8438 | let targetAnchor = targetNode;
|
8439 | while (targetAnchor) {
|
8440 | targetAnchor = nextSibling(targetAnchor);
|
8441 | if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
|
8442 | vnode.targetAnchor = targetAnchor;
|
8443 | target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
8444 | break;
|
8445 | }
|
8446 | }
|
8447 | hydrateChildren(
|
8448 | targetNode,
|
8449 | vnode,
|
8450 | target,
|
8451 | parentComponent,
|
8452 | parentSuspense,
|
8453 | slotScopeIds,
|
8454 | optimized
|
8455 | );
|
8456 | }
|
8457 | }
|
8458 | updateCssVars(vnode);
|
8459 | }
|
8460 | return vnode.anchor && nextSibling(vnode.anchor);
|
8461 | }
|
8462 | const Teleport = TeleportImpl;
|
8463 | function updateCssVars(vnode) {
|
8464 | const ctx = vnode.ctx;
|
8465 | if (ctx && ctx.ut) {
|
8466 | let node = vnode.children[0].el;
|
8467 | while (node && node !== vnode.targetAnchor) {
|
8468 | if (node.nodeType === 1)
|
8469 | node.setAttribute("data-v-owner", ctx.uid);
|
8470 | node = node.nextSibling;
|
8471 | }
|
8472 | ctx.ut();
|
8473 | }
|
8474 | }
|
8475 |
|
8476 | const Fragment = Symbol.for("v-fgt");
|
8477 | const Text = Symbol.for("v-txt");
|
8478 | const Comment = Symbol.for("v-cmt");
|
8479 | const Static = Symbol.for("v-stc");
|
8480 | const blockStack = [];
|
8481 | let currentBlock = null;
|
8482 | function openBlock(disableTracking = false) {
|
8483 | blockStack.push(currentBlock = disableTracking ? null : []);
|
8484 | }
|
8485 | function closeBlock() {
|
8486 | blockStack.pop();
|
8487 | currentBlock = blockStack[blockStack.length - 1] || null;
|
8488 | }
|
8489 | let isBlockTreeEnabled = 1;
|
8490 | function setBlockTracking(value) {
|
8491 | isBlockTreeEnabled += value;
|
8492 | }
|
8493 | function setupBlock(vnode) {
|
8494 | vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
|
8495 | closeBlock();
|
8496 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
8497 | currentBlock.push(vnode);
|
8498 | }
|
8499 | return vnode;
|
8500 | }
|
8501 | function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
|
8502 | return setupBlock(
|
8503 | createBaseVNode(
|
8504 | type,
|
8505 | props,
|
8506 | children,
|
8507 | patchFlag,
|
8508 | dynamicProps,
|
8509 | shapeFlag,
|
8510 | true
|
8511 | )
|
8512 | );
|
8513 | }
|
8514 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
8515 | return setupBlock(
|
8516 | createVNode(
|
8517 | type,
|
8518 | props,
|
8519 | children,
|
8520 | patchFlag,
|
8521 | dynamicProps,
|
8522 | true
|
8523 | )
|
8524 | );
|
8525 | }
|
8526 | function isVNode(value) {
|
8527 | return value ? value.__v_isVNode === true : false;
|
8528 | }
|
8529 | function isSameVNodeType(n1, n2) {
|
8530 | if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
|
8531 | n1.shapeFlag &= ~256;
|
8532 | n2.shapeFlag &= ~512;
|
8533 | return false;
|
8534 | }
|
8535 | return n1.type === n2.type && n1.key === n2.key;
|
8536 | }
|
8537 | let vnodeArgsTransformer;
|
8538 | function transformVNodeArgs(transformer) {
|
8539 | vnodeArgsTransformer = transformer;
|
8540 | }
|
8541 | const createVNodeWithArgsTransform = (...args) => {
|
8542 | return _createVNode(
|
8543 | ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
|
8544 | );
|
8545 | };
|
8546 | const InternalObjectKey = `__vInternal`;
|
8547 | const normalizeKey = ({ key }) => key != null ? key : null;
|
8548 | const normalizeRef = ({
|
8549 | ref,
|
8550 | ref_key,
|
8551 | ref_for
|
8552 | }) => {
|
8553 | if (typeof ref === "number") {
|
8554 | ref = "" + ref;
|
8555 | }
|
8556 | return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
8557 | };
|
8558 | function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
8559 | const vnode = {
|
8560 | __v_isVNode: true,
|
8561 | __v_skip: true,
|
8562 | type,
|
8563 | props,
|
8564 | key: props && normalizeKey(props),
|
8565 | ref: props && normalizeRef(props),
|
8566 | scopeId: currentScopeId,
|
8567 | slotScopeIds: null,
|
8568 | children,
|
8569 | component: null,
|
8570 | suspense: null,
|
8571 | ssContent: null,
|
8572 | ssFallback: null,
|
8573 | dirs: null,
|
8574 | transition: null,
|
8575 | el: null,
|
8576 | anchor: null,
|
8577 | target: null,
|
8578 | targetAnchor: null,
|
8579 | staticCount: 0,
|
8580 | shapeFlag,
|
8581 | patchFlag,
|
8582 | dynamicProps,
|
8583 | dynamicChildren: null,
|
8584 | appContext: null,
|
8585 | ctx: currentRenderingInstance
|
8586 | };
|
8587 | if (needFullChildrenNormalization) {
|
8588 | normalizeChildren(vnode, children);
|
8589 | if (shapeFlag & 128) {
|
8590 | type.normalize(vnode);
|
8591 | }
|
8592 | } else if (children) {
|
8593 | vnode.shapeFlag |= isString(children) ? 8 : 16;
|
8594 | }
|
8595 | if (vnode.key !== vnode.key) {
|
8596 | warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
8597 | }
|
8598 | if (isBlockTreeEnabled > 0 &&
|
8599 | !isBlockNode &&
|
8600 | currentBlock &&
|
8601 |
|
8602 |
|
8603 |
|
8604 | (vnode.patchFlag > 0 || shapeFlag & 6) &&
|
8605 |
|
8606 | vnode.patchFlag !== 32) {
|
8607 | currentBlock.push(vnode);
|
8608 | }
|
8609 | return vnode;
|
8610 | }
|
8611 | const createVNode = createVNodeWithArgsTransform ;
|
8612 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
8613 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
8614 | if (!type) {
|
8615 | warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
8616 | }
|
8617 | type = Comment;
|
8618 | }
|
8619 | if (isVNode(type)) {
|
8620 | const cloned = cloneVNode(
|
8621 | type,
|
8622 | props,
|
8623 | true
|
8624 |
|
8625 | );
|
8626 | if (children) {
|
8627 | normalizeChildren(cloned, children);
|
8628 | }
|
8629 | if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
8630 | if (cloned.shapeFlag & 6) {
|
8631 | currentBlock[currentBlock.indexOf(type)] = cloned;
|
8632 | } else {
|
8633 | currentBlock.push(cloned);
|
8634 | }
|
8635 | }
|
8636 | cloned.patchFlag |= -2;
|
8637 | return cloned;
|
8638 | }
|
8639 | if (isClassComponent(type)) {
|
8640 | type = type.__vccOpts;
|
8641 | }
|
8642 | if (props) {
|
8643 | props = guardReactiveProps(props);
|
8644 | let { class: klass, style } = props;
|
8645 | if (klass && !isString(klass)) {
|
8646 | props.class = normalizeClass(klass);
|
8647 | }
|
8648 | if (isObject(style)) {
|
8649 | if (isProxy(style) && !isArray(style)) {
|
8650 | style = extend({}, style);
|
8651 | }
|
8652 | props.style = normalizeStyle(style);
|
8653 | }
|
8654 | }
|
8655 | const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
8656 | if (shapeFlag & 4 && isProxy(type)) {
|
8657 | type = toRaw(type);
|
8658 | warn$1(
|
8659 | `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\`.`,
|
8660 | `
|
8661 | Component that was made reactive: `,
|
8662 | type
|
8663 | );
|
8664 | }
|
8665 | return createBaseVNode(
|
8666 | type,
|
8667 | props,
|
8668 | children,
|
8669 | patchFlag,
|
8670 | dynamicProps,
|
8671 | shapeFlag,
|
8672 | isBlockNode,
|
8673 | true
|
8674 | );
|
8675 | }
|
8676 | function guardReactiveProps(props) {
|
8677 | if (!props)
|
8678 | return null;
|
8679 | return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
|
8680 | }
|
8681 | function cloneVNode(vnode, extraProps, mergeRef = false) {
|
8682 | const { props, ref, patchFlag, children } = vnode;
|
8683 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
8684 | const cloned = {
|
8685 | __v_isVNode: true,
|
8686 | __v_skip: true,
|
8687 | type: vnode.type,
|
8688 | props: mergedProps,
|
8689 | key: mergedProps && normalizeKey(mergedProps),
|
8690 | ref: extraProps && extraProps.ref ? (
|
8691 |
|
8692 |
|
8693 |
|
8694 | mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
8695 | ) : ref,
|
8696 | scopeId: vnode.scopeId,
|
8697 | slotScopeIds: vnode.slotScopeIds,
|
8698 | children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
8699 | target: vnode.target,
|
8700 | targetAnchor: vnode.targetAnchor,
|
8701 | staticCount: vnode.staticCount,
|
8702 | shapeFlag: vnode.shapeFlag,
|
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 | patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
8708 | dynamicProps: vnode.dynamicProps,
|
8709 | dynamicChildren: vnode.dynamicChildren,
|
8710 | appContext: vnode.appContext,
|
8711 | dirs: vnode.dirs,
|
8712 | transition: vnode.transition,
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 | component: vnode.component,
|
8718 | suspense: vnode.suspense,
|
8719 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
8720 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
8721 | el: vnode.el,
|
8722 | anchor: vnode.anchor,
|
8723 | ctx: vnode.ctx,
|
8724 | ce: vnode.ce
|
8725 | };
|
8726 | return cloned;
|
8727 | }
|
8728 | function deepCloneVNode(vnode) {
|
8729 | const cloned = cloneVNode(vnode);
|
8730 | if (isArray(vnode.children)) {
|
8731 | cloned.children = vnode.children.map(deepCloneVNode);
|
8732 | }
|
8733 | return cloned;
|
8734 | }
|
8735 | function createTextVNode(text = " ", flag = 0) {
|
8736 | return createVNode(Text, null, text, flag);
|
8737 | }
|
8738 | function createStaticVNode(content, numberOfNodes) {
|
8739 | const vnode = createVNode(Static, null, content);
|
8740 | vnode.staticCount = numberOfNodes;
|
8741 | return vnode;
|
8742 | }
|
8743 | function createCommentVNode(text = "", asBlock = false) {
|
8744 | return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
|
8745 | }
|
8746 | function normalizeVNode(child) {
|
8747 | if (child == null || typeof child === "boolean") {
|
8748 | return createVNode(Comment);
|
8749 | } else if (isArray(child)) {
|
8750 | return createVNode(
|
8751 | Fragment,
|
8752 | null,
|
8753 |
|
8754 | child.slice()
|
8755 | );
|
8756 | } else if (typeof child === "object") {
|
8757 | return cloneIfMounted(child);
|
8758 | } else {
|
8759 | return createVNode(Text, null, String(child));
|
8760 | }
|
8761 | }
|
8762 | function cloneIfMounted(child) {
|
8763 | return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
8764 | }
|
8765 | function normalizeChildren(vnode, children) {
|
8766 | let type = 0;
|
8767 | const { shapeFlag } = vnode;
|
8768 | if (children == null) {
|
8769 | children = null;
|
8770 | } else if (isArray(children)) {
|
8771 | type = 16;
|
8772 | } else if (typeof children === "object") {
|
8773 | if (shapeFlag & (1 | 64)) {
|
8774 | const slot = children.default;
|
8775 | if (slot) {
|
8776 | slot._c && (slot._d = false);
|
8777 | normalizeChildren(vnode, slot());
|
8778 | slot._c && (slot._d = true);
|
8779 | }
|
8780 | return;
|
8781 | } else {
|
8782 | type = 32;
|
8783 | const slotFlag = children._;
|
8784 | if (!slotFlag && !(InternalObjectKey in children)) {
|
8785 | children._ctx = currentRenderingInstance;
|
8786 | } else if (slotFlag === 3 && currentRenderingInstance) {
|
8787 | if (currentRenderingInstance.slots._ === 1) {
|
8788 | children._ = 1;
|
8789 | } else {
|
8790 | children._ = 2;
|
8791 | vnode.patchFlag |= 1024;
|
8792 | }
|
8793 | }
|
8794 | }
|
8795 | } else if (isFunction(children)) {
|
8796 | children = { default: children, _ctx: currentRenderingInstance };
|
8797 | type = 32;
|
8798 | } else {
|
8799 | children = String(children);
|
8800 | if (shapeFlag & 64) {
|
8801 | type = 16;
|
8802 | children = [createTextVNode(children)];
|
8803 | } else {
|
8804 | type = 8;
|
8805 | }
|
8806 | }
|
8807 | vnode.children = children;
|
8808 | vnode.shapeFlag |= type;
|
8809 | }
|
8810 | function mergeProps(...args) {
|
8811 | const ret = {};
|
8812 | for (let i = 0; i < args.length; i++) {
|
8813 | const toMerge = args[i];
|
8814 | for (const key in toMerge) {
|
8815 | if (key === "class") {
|
8816 | if (ret.class !== toMerge.class) {
|
8817 | ret.class = normalizeClass([ret.class, toMerge.class]);
|
8818 | }
|
8819 | } else if (key === "style") {
|
8820 | ret.style = normalizeStyle([ret.style, toMerge.style]);
|
8821 | } else if (isOn(key)) {
|
8822 | const existing = ret[key];
|
8823 | const incoming = toMerge[key];
|
8824 | if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
8825 | ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
8826 | }
|
8827 | } else if (key !== "") {
|
8828 | ret[key] = toMerge[key];
|
8829 | }
|
8830 | }
|
8831 | }
|
8832 | return ret;
|
8833 | }
|
8834 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
8835 | callWithAsyncErrorHandling(hook, instance, 7, [
|
8836 | vnode,
|
8837 | prevVNode
|
8838 | ]);
|
8839 | }
|
8840 |
|
8841 | const emptyAppContext = createAppContext();
|
8842 | let uid = 0;
|
8843 | function createComponentInstance(vnode, parent, suspense) {
|
8844 | const type = vnode.type;
|
8845 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
8846 | const instance = {
|
8847 | uid: uid++,
|
8848 | vnode,
|
8849 | type,
|
8850 | parent,
|
8851 | appContext,
|
8852 | root: null,
|
8853 |
|
8854 | next: null,
|
8855 | subTree: null,
|
8856 |
|
8857 | effect: null,
|
8858 | update: null,
|
8859 |
|
8860 | scope: new EffectScope(
|
8861 | true
|
8862 |
|
8863 | ),
|
8864 | render: null,
|
8865 | proxy: null,
|
8866 | exposed: null,
|
8867 | exposeProxy: null,
|
8868 | withProxy: null,
|
8869 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
8870 | accessCache: null,
|
8871 | renderCache: [],
|
8872 |
|
8873 | components: null,
|
8874 | directives: null,
|
8875 |
|
8876 | propsOptions: normalizePropsOptions(type, appContext),
|
8877 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
8878 |
|
8879 | emit: null,
|
8880 |
|
8881 | emitted: null,
|
8882 |
|
8883 | propsDefaults: EMPTY_OBJ,
|
8884 |
|
8885 | inheritAttrs: type.inheritAttrs,
|
8886 |
|
8887 | ctx: EMPTY_OBJ,
|
8888 | data: EMPTY_OBJ,
|
8889 | props: EMPTY_OBJ,
|
8890 | attrs: EMPTY_OBJ,
|
8891 | slots: EMPTY_OBJ,
|
8892 | refs: EMPTY_OBJ,
|
8893 | setupState: EMPTY_OBJ,
|
8894 | setupContext: null,
|
8895 | attrsProxy: null,
|
8896 | slotsProxy: null,
|
8897 |
|
8898 | suspense,
|
8899 | suspenseId: suspense ? suspense.pendingId : 0,
|
8900 | asyncDep: null,
|
8901 | asyncResolved: false,
|
8902 |
|
8903 |
|
8904 | isMounted: false,
|
8905 | isUnmounted: false,
|
8906 | isDeactivated: false,
|
8907 | bc: null,
|
8908 | c: null,
|
8909 | bm: null,
|
8910 | m: null,
|
8911 | bu: null,
|
8912 | u: null,
|
8913 | um: null,
|
8914 | bum: null,
|
8915 | da: null,
|
8916 | a: null,
|
8917 | rtg: null,
|
8918 | rtc: null,
|
8919 | ec: null,
|
8920 | sp: null
|
8921 | };
|
8922 | {
|
8923 | instance.ctx = createDevRenderContext(instance);
|
8924 | }
|
8925 | instance.root = parent ? parent.root : instance;
|
8926 | instance.emit = emit.bind(null, instance);
|
8927 | if (vnode.ce) {
|
8928 | vnode.ce(instance);
|
8929 | }
|
8930 | return instance;
|
8931 | }
|
8932 | let currentInstance = null;
|
8933 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
8934 | let internalSetCurrentInstance;
|
8935 | let setInSSRSetupState;
|
8936 | {
|
8937 | internalSetCurrentInstance = (i) => {
|
8938 | currentInstance = i;
|
8939 | };
|
8940 | setInSSRSetupState = (v) => {
|
8941 | isInSSRComponentSetup = v;
|
8942 | };
|
8943 | }
|
8944 | const setCurrentInstance = (instance) => {
|
8945 | const prev = currentInstance;
|
8946 | internalSetCurrentInstance(instance);
|
8947 | instance.scope.on();
|
8948 | return () => {
|
8949 | instance.scope.off();
|
8950 | internalSetCurrentInstance(prev);
|
8951 | };
|
8952 | };
|
8953 | const unsetCurrentInstance = () => {
|
8954 | currentInstance && currentInstance.scope.off();
|
8955 | internalSetCurrentInstance(null);
|
8956 | };
|
8957 | const isBuiltInTag = makeMap("slot,component");
|
8958 | function validateComponentName(name, { isNativeTag }) {
|
8959 | if (isBuiltInTag(name) || isNativeTag(name)) {
|
8960 | warn$1(
|
8961 | "Do not use built-in or reserved HTML elements as component id: " + name
|
8962 | );
|
8963 | }
|
8964 | }
|
8965 | function isStatefulComponent(instance) {
|
8966 | return instance.vnode.shapeFlag & 4;
|
8967 | }
|
8968 | let isInSSRComponentSetup = false;
|
8969 | function setupComponent(instance, isSSR = false) {
|
8970 | isSSR && setInSSRSetupState(isSSR);
|
8971 | const { props, children } = instance.vnode;
|
8972 | const isStateful = isStatefulComponent(instance);
|
8973 | initProps(instance, props, isStateful, isSSR);
|
8974 | initSlots(instance, children);
|
8975 | const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
8976 | isSSR && setInSSRSetupState(false);
|
8977 | return setupResult;
|
8978 | }
|
8979 | function setupStatefulComponent(instance, isSSR) {
|
8980 | var _a;
|
8981 | const Component = instance.type;
|
8982 | {
|
8983 | if (Component.name) {
|
8984 | validateComponentName(Component.name, instance.appContext.config);
|
8985 | }
|
8986 | if (Component.components) {
|
8987 | const names = Object.keys(Component.components);
|
8988 | for (let i = 0; i < names.length; i++) {
|
8989 | validateComponentName(names[i], instance.appContext.config);
|
8990 | }
|
8991 | }
|
8992 | if (Component.directives) {
|
8993 | const names = Object.keys(Component.directives);
|
8994 | for (let i = 0; i < names.length; i++) {
|
8995 | validateDirectiveName(names[i]);
|
8996 | }
|
8997 | }
|
8998 | if (Component.compilerOptions && isRuntimeOnly()) {
|
8999 | warn$1(
|
9000 | `"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.`
|
9001 | );
|
9002 | }
|
9003 | }
|
9004 | instance.accessCache = Object.create(null);
|
9005 | instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
|
9006 | {
|
9007 | exposePropsOnRenderContext(instance);
|
9008 | }
|
9009 | const { setup } = Component;
|
9010 | if (setup) {
|
9011 | const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
9012 | const reset = setCurrentInstance(instance);
|
9013 | pauseTracking();
|
9014 | const setupResult = callWithErrorHandling(
|
9015 | setup,
|
9016 | instance,
|
9017 | 0,
|
9018 | [
|
9019 | shallowReadonly(instance.props) ,
|
9020 | setupContext
|
9021 | ]
|
9022 | );
|
9023 | resetTracking();
|
9024 | reset();
|
9025 | if (isPromise(setupResult)) {
|
9026 | setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
9027 | if (isSSR) {
|
9028 | return setupResult.then((resolvedResult) => {
|
9029 | handleSetupResult(instance, resolvedResult, isSSR);
|
9030 | }).catch((e) => {
|
9031 | handleError(e, instance, 0);
|
9032 | });
|
9033 | } else {
|
9034 | instance.asyncDep = setupResult;
|
9035 | if (!instance.suspense) {
|
9036 | const name = (_a = Component.name) != null ? _a : "Anonymous";
|
9037 | warn$1(
|
9038 | `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.`
|
9039 | );
|
9040 | }
|
9041 | }
|
9042 | } else {
|
9043 | handleSetupResult(instance, setupResult, isSSR);
|
9044 | }
|
9045 | } else {
|
9046 | finishComponentSetup(instance, isSSR);
|
9047 | }
|
9048 | }
|
9049 | function handleSetupResult(instance, setupResult, isSSR) {
|
9050 | if (isFunction(setupResult)) {
|
9051 | {
|
9052 | instance.render = setupResult;
|
9053 | }
|
9054 | } else if (isObject(setupResult)) {
|
9055 | if (isVNode(setupResult)) {
|
9056 | warn$1(
|
9057 | `setup() should not return VNodes directly - return a render function instead.`
|
9058 | );
|
9059 | }
|
9060 | {
|
9061 | instance.devtoolsRawSetupState = setupResult;
|
9062 | }
|
9063 | instance.setupState = proxyRefs(setupResult);
|
9064 | {
|
9065 | exposeSetupStateOnRenderContext(instance);
|
9066 | }
|
9067 | } else if (setupResult !== void 0) {
|
9068 | warn$1(
|
9069 | `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
|
9070 | );
|
9071 | }
|
9072 | finishComponentSetup(instance, isSSR);
|
9073 | }
|
9074 | let compile$1;
|
9075 | let installWithProxy;
|
9076 | function registerRuntimeCompiler(_compile) {
|
9077 | compile$1 = _compile;
|
9078 | installWithProxy = (i) => {
|
9079 | if (i.render._rc) {
|
9080 | i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
9081 | }
|
9082 | };
|
9083 | }
|
9084 | const isRuntimeOnly = () => !compile$1;
|
9085 | function finishComponentSetup(instance, isSSR, skipOptions) {
|
9086 | const Component = instance.type;
|
9087 | if (!instance.render) {
|
9088 | if (!isSSR && compile$1 && !Component.render) {
|
9089 | const template = Component.template || resolveMergedOptions(instance).template;
|
9090 | if (template) {
|
9091 | {
|
9092 | startMeasure(instance, `compile`);
|
9093 | }
|
9094 | const { isCustomElement, compilerOptions } = instance.appContext.config;
|
9095 | const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
9096 | const finalCompilerOptions = extend(
|
9097 | extend(
|
9098 | {
|
9099 | isCustomElement,
|
9100 | delimiters
|
9101 | },
|
9102 | compilerOptions
|
9103 | ),
|
9104 | componentCompilerOptions
|
9105 | );
|
9106 | Component.render = compile$1(template, finalCompilerOptions);
|
9107 | {
|
9108 | endMeasure(instance, `compile`);
|
9109 | }
|
9110 | }
|
9111 | }
|
9112 | instance.render = Component.render || NOOP;
|
9113 | if (installWithProxy) {
|
9114 | installWithProxy(instance);
|
9115 | }
|
9116 | }
|
9117 | {
|
9118 | const reset = setCurrentInstance(instance);
|
9119 | pauseTracking();
|
9120 | try {
|
9121 | applyOptions(instance);
|
9122 | } finally {
|
9123 | resetTracking();
|
9124 | reset();
|
9125 | }
|
9126 | }
|
9127 | if (!Component.render && instance.render === NOOP && !isSSR) {
|
9128 | if (!compile$1 && Component.template) {
|
9129 | warn$1(
|
9130 | `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
9131 | );
|
9132 | } else {
|
9133 | warn$1(`Component is missing template or render function.`);
|
9134 | }
|
9135 | }
|
9136 | }
|
9137 | function getAttrsProxy(instance) {
|
9138 | return instance.attrsProxy || (instance.attrsProxy = new Proxy(
|
9139 | instance.attrs,
|
9140 | {
|
9141 | get(target, key) {
|
9142 | markAttrsAccessed();
|
9143 | track(instance, "get", "$attrs");
|
9144 | return target[key];
|
9145 | },
|
9146 | set() {
|
9147 | warn$1(`setupContext.attrs is readonly.`);
|
9148 | return false;
|
9149 | },
|
9150 | deleteProperty() {
|
9151 | warn$1(`setupContext.attrs is readonly.`);
|
9152 | return false;
|
9153 | }
|
9154 | }
|
9155 | ));
|
9156 | }
|
9157 | function getSlotsProxy(instance) {
|
9158 | return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
9159 | get(target, key) {
|
9160 | track(instance, "get", "$slots");
|
9161 | return target[key];
|
9162 | }
|
9163 | }));
|
9164 | }
|
9165 | function createSetupContext(instance) {
|
9166 | const expose = (exposed) => {
|
9167 | {
|
9168 | if (instance.exposed) {
|
9169 | warn$1(`expose() should be called only once per setup().`);
|
9170 | }
|
9171 | if (exposed != null) {
|
9172 | let exposedType = typeof exposed;
|
9173 | if (exposedType === "object") {
|
9174 | if (isArray(exposed)) {
|
9175 | exposedType = "array";
|
9176 | } else if (isRef(exposed)) {
|
9177 | exposedType = "ref";
|
9178 | }
|
9179 | }
|
9180 | if (exposedType !== "object") {
|
9181 | warn$1(
|
9182 | `expose() should be passed a plain object, received ${exposedType}.`
|
9183 | );
|
9184 | }
|
9185 | }
|
9186 | }
|
9187 | instance.exposed = exposed || {};
|
9188 | };
|
9189 | {
|
9190 | return Object.freeze({
|
9191 | get attrs() {
|
9192 | return getAttrsProxy(instance);
|
9193 | },
|
9194 | get slots() {
|
9195 | return getSlotsProxy(instance);
|
9196 | },
|
9197 | get emit() {
|
9198 | return (event, ...args) => instance.emit(event, ...args);
|
9199 | },
|
9200 | expose
|
9201 | });
|
9202 | }
|
9203 | }
|
9204 | function getExposeProxy(instance) {
|
9205 | if (instance.exposed) {
|
9206 | return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
9207 | get(target, key) {
|
9208 | if (key in target) {
|
9209 | return target[key];
|
9210 | } else if (key in publicPropertiesMap) {
|
9211 | return publicPropertiesMap[key](instance);
|
9212 | }
|
9213 | },
|
9214 | has(target, key) {
|
9215 | return key in target || key in publicPropertiesMap;
|
9216 | }
|
9217 | }));
|
9218 | }
|
9219 | }
|
9220 | const classifyRE = /(?:^|[-_])(\w)/g;
|
9221 | const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
9222 | function getComponentName(Component, includeInferred = true) {
|
9223 | return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
9224 | }
|
9225 | function formatComponentName(instance, Component, isRoot = false) {
|
9226 | let name = getComponentName(Component);
|
9227 | if (!name && Component.__file) {
|
9228 | const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
9229 | if (match) {
|
9230 | name = match[1];
|
9231 | }
|
9232 | }
|
9233 | if (!name && instance && instance.parent) {
|
9234 | const inferFromRegistry = (registry) => {
|
9235 | for (const key in registry) {
|
9236 | if (registry[key] === Component) {
|
9237 | return key;
|
9238 | }
|
9239 | }
|
9240 | };
|
9241 | name = inferFromRegistry(
|
9242 | instance.components || instance.parent.type.components
|
9243 | ) || inferFromRegistry(instance.appContext.components);
|
9244 | }
|
9245 | return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
9246 | }
|
9247 | function isClassComponent(value) {
|
9248 | return isFunction(value) && "__vccOpts" in value;
|
9249 | }
|
9250 |
|
9251 | const computed = (getterOrOptions, debugOptions) => {
|
9252 | const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
9253 | {
|
9254 | const i = getCurrentInstance();
|
9255 | if (i && i.appContext.config.warnRecursiveComputed) {
|
9256 | c._warnRecursive = true;
|
9257 | }
|
9258 | }
|
9259 | return c;
|
9260 | };
|
9261 |
|
9262 | function useModel(props, name, options = EMPTY_OBJ) {
|
9263 | const i = getCurrentInstance();
|
9264 | if (!i) {
|
9265 | warn$1(`useModel() called without active instance.`);
|
9266 | return ref();
|
9267 | }
|
9268 | if (!i.propsOptions[0][name]) {
|
9269 | warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
9270 | return ref();
|
9271 | }
|
9272 | const camelizedName = camelize(name);
|
9273 | const hyphenatedName = hyphenate(name);
|
9274 | const res = customRef((track, trigger) => {
|
9275 | let localValue;
|
9276 | watchSyncEffect(() => {
|
9277 | const propValue = props[name];
|
9278 | if (hasChanged(localValue, propValue)) {
|
9279 | localValue = propValue;
|
9280 | trigger();
|
9281 | }
|
9282 | });
|
9283 | return {
|
9284 | get() {
|
9285 | track();
|
9286 | return options.get ? options.get(localValue) : localValue;
|
9287 | },
|
9288 | set(value) {
|
9289 | const rawProps = i.vnode.props;
|
9290 | if (!(rawProps &&
|
9291 | (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
|
9292 | localValue = value;
|
9293 | trigger();
|
9294 | }
|
9295 | i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
9296 | }
|
9297 | };
|
9298 | });
|
9299 | const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
9300 | res[Symbol.iterator] = () => {
|
9301 | let i2 = 0;
|
9302 | return {
|
9303 | next() {
|
9304 | if (i2 < 2) {
|
9305 | return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
9306 | } else {
|
9307 | return { done: true };
|
9308 | }
|
9309 | }
|
9310 | };
|
9311 | };
|
9312 | return res;
|
9313 | }
|
9314 |
|
9315 | function h(type, propsOrChildren, children) {
|
9316 | const l = arguments.length;
|
9317 | if (l === 2) {
|
9318 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
9319 | if (isVNode(propsOrChildren)) {
|
9320 | return createVNode(type, null, [propsOrChildren]);
|
9321 | }
|
9322 | return createVNode(type, propsOrChildren);
|
9323 | } else {
|
9324 | return createVNode(type, null, propsOrChildren);
|
9325 | }
|
9326 | } else {
|
9327 | if (l > 3) {
|
9328 | children = Array.prototype.slice.call(arguments, 2);
|
9329 | } else if (l === 3 && isVNode(children)) {
|
9330 | children = [children];
|
9331 | }
|
9332 | return createVNode(type, propsOrChildren, children);
|
9333 | }
|
9334 | }
|
9335 |
|
9336 | function initCustomFormatter() {
|
9337 | if (typeof window === "undefined") {
|
9338 | return;
|
9339 | }
|
9340 | const vueStyle = { style: "color:#3ba776" };
|
9341 | const numberStyle = { style: "color:#1677ff" };
|
9342 | const stringStyle = { style: "color:#f5222d" };
|
9343 | const keywordStyle = { style: "color:#eb2f96" };
|
9344 | const formatter = {
|
9345 | header(obj) {
|
9346 | if (!isObject(obj)) {
|
9347 | return null;
|
9348 | }
|
9349 | if (obj.__isVue) {
|
9350 | return ["div", vueStyle, `VueInstance`];
|
9351 | } else if (isRef(obj)) {
|
9352 | return [
|
9353 | "div",
|
9354 | {},
|
9355 | ["span", vueStyle, genRefFlag(obj)],
|
9356 | "<",
|
9357 | formatValue(obj.value),
|
9358 | `>`
|
9359 | ];
|
9360 | } else if (isReactive(obj)) {
|
9361 | return [
|
9362 | "div",
|
9363 | {},
|
9364 | ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
9365 | "<",
|
9366 | formatValue(obj),
|
9367 | `>${isReadonly(obj) ? ` (readonly)` : ``}`
|
9368 | ];
|
9369 | } else if (isReadonly(obj)) {
|
9370 | return [
|
9371 | "div",
|
9372 | {},
|
9373 | ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
9374 | "<",
|
9375 | formatValue(obj),
|
9376 | ">"
|
9377 | ];
|
9378 | }
|
9379 | return null;
|
9380 | },
|
9381 | hasBody(obj) {
|
9382 | return obj && obj.__isVue;
|
9383 | },
|
9384 | body(obj) {
|
9385 | if (obj && obj.__isVue) {
|
9386 | return [
|
9387 | "div",
|
9388 | {},
|
9389 | ...formatInstance(obj.$)
|
9390 | ];
|
9391 | }
|
9392 | }
|
9393 | };
|
9394 | function formatInstance(instance) {
|
9395 | const blocks = [];
|
9396 | if (instance.type.props && instance.props) {
|
9397 | blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
9398 | }
|
9399 | if (instance.setupState !== EMPTY_OBJ) {
|
9400 | blocks.push(createInstanceBlock("setup", instance.setupState));
|
9401 | }
|
9402 | if (instance.data !== EMPTY_OBJ) {
|
9403 | blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
9404 | }
|
9405 | const computed = extractKeys(instance, "computed");
|
9406 | if (computed) {
|
9407 | blocks.push(createInstanceBlock("computed", computed));
|
9408 | }
|
9409 | const injected = extractKeys(instance, "inject");
|
9410 | if (injected) {
|
9411 | blocks.push(createInstanceBlock("injected", injected));
|
9412 | }
|
9413 | blocks.push([
|
9414 | "div",
|
9415 | {},
|
9416 | [
|
9417 | "span",
|
9418 | {
|
9419 | style: keywordStyle.style + ";opacity:0.66"
|
9420 | },
|
9421 | "$ (internal): "
|
9422 | ],
|
9423 | ["object", { object: instance }]
|
9424 | ]);
|
9425 | return blocks;
|
9426 | }
|
9427 | function createInstanceBlock(type, target) {
|
9428 | target = extend({}, target);
|
9429 | if (!Object.keys(target).length) {
|
9430 | return ["span", {}];
|
9431 | }
|
9432 | return [
|
9433 | "div",
|
9434 | { style: "line-height:1.25em;margin-bottom:0.6em" },
|
9435 | [
|
9436 | "div",
|
9437 | {
|
9438 | style: "color:#476582"
|
9439 | },
|
9440 | type
|
9441 | ],
|
9442 | [
|
9443 | "div",
|
9444 | {
|
9445 | style: "padding-left:1.25em"
|
9446 | },
|
9447 | ...Object.keys(target).map((key) => {
|
9448 | return [
|
9449 | "div",
|
9450 | {},
|
9451 | ["span", keywordStyle, key + ": "],
|
9452 | formatValue(target[key], false)
|
9453 | ];
|
9454 | })
|
9455 | ]
|
9456 | ];
|
9457 | }
|
9458 | function formatValue(v, asRaw = true) {
|
9459 | if (typeof v === "number") {
|
9460 | return ["span", numberStyle, v];
|
9461 | } else if (typeof v === "string") {
|
9462 | return ["span", stringStyle, JSON.stringify(v)];
|
9463 | } else if (typeof v === "boolean") {
|
9464 | return ["span", keywordStyle, v];
|
9465 | } else if (isObject(v)) {
|
9466 | return ["object", { object: asRaw ? toRaw(v) : v }];
|
9467 | } else {
|
9468 | return ["span", stringStyle, String(v)];
|
9469 | }
|
9470 | }
|
9471 | function extractKeys(instance, type) {
|
9472 | const Comp = instance.type;
|
9473 | if (isFunction(Comp)) {
|
9474 | return;
|
9475 | }
|
9476 | const extracted = {};
|
9477 | for (const key in instance.ctx) {
|
9478 | if (isKeyOfType(Comp, key, type)) {
|
9479 | extracted[key] = instance.ctx[key];
|
9480 | }
|
9481 | }
|
9482 | return extracted;
|
9483 | }
|
9484 | function isKeyOfType(Comp, key, type) {
|
9485 | const opts = Comp[type];
|
9486 | if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
9487 | return true;
|
9488 | }
|
9489 | if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
9490 | return true;
|
9491 | }
|
9492 | if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
9493 | return true;
|
9494 | }
|
9495 | }
|
9496 | function genRefFlag(v) {
|
9497 | if (isShallow(v)) {
|
9498 | return `ShallowRef`;
|
9499 | }
|
9500 | if (v.effect) {
|
9501 | return `ComputedRef`;
|
9502 | }
|
9503 | return `Ref`;
|
9504 | }
|
9505 | if (window.devtoolsFormatters) {
|
9506 | window.devtoolsFormatters.push(formatter);
|
9507 | } else {
|
9508 | window.devtoolsFormatters = [formatter];
|
9509 | }
|
9510 | }
|
9511 |
|
9512 | function withMemo(memo, render, cache, index) {
|
9513 | const cached = cache[index];
|
9514 | if (cached && isMemoSame(cached, memo)) {
|
9515 | return cached;
|
9516 | }
|
9517 | const ret = render();
|
9518 | ret.memo = memo.slice();
|
9519 | return cache[index] = ret;
|
9520 | }
|
9521 | function isMemoSame(cached, memo) {
|
9522 | const prev = cached.memo;
|
9523 | if (prev.length != memo.length) {
|
9524 | return false;
|
9525 | }
|
9526 | for (let i = 0; i < prev.length; i++) {
|
9527 | if (hasChanged(prev[i], memo[i])) {
|
9528 | return false;
|
9529 | }
|
9530 | }
|
9531 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
9532 | currentBlock.push(cached);
|
9533 | }
|
9534 | return true;
|
9535 | }
|
9536 |
|
9537 | const version = "3.4.21";
|
9538 | const warn = warn$1 ;
|
9539 | const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
9540 | const devtools = devtools$1 ;
|
9541 | const setDevtoolsHook = setDevtoolsHook$1 ;
|
9542 | const ssrUtils = null;
|
9543 | const resolveFilter = null;
|
9544 | const compatUtils = null;
|
9545 | const DeprecationTypes = null;
|
9546 |
|
9547 | const svgNS = "http://www.w3.org/2000/svg";
|
9548 | const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
9549 | const doc = typeof document !== "undefined" ? document : null;
|
9550 | const templateContainer = doc && doc.createElement("template");
|
9551 | const nodeOps = {
|
9552 | insert: (child, parent, anchor) => {
|
9553 | parent.insertBefore(child, anchor || null);
|
9554 | },
|
9555 | remove: (child) => {
|
9556 | const parent = child.parentNode;
|
9557 | if (parent) {
|
9558 | parent.removeChild(child);
|
9559 | }
|
9560 | },
|
9561 | createElement: (tag, namespace, is, props) => {
|
9562 | const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
|
9563 | if (tag === "select" && props && props.multiple != null) {
|
9564 | el.setAttribute("multiple", props.multiple);
|
9565 | }
|
9566 | return el;
|
9567 | },
|
9568 | createText: (text) => doc.createTextNode(text),
|
9569 | createComment: (text) => doc.createComment(text),
|
9570 | setText: (node, text) => {
|
9571 | node.nodeValue = text;
|
9572 | },
|
9573 | setElementText: (el, text) => {
|
9574 | el.textContent = text;
|
9575 | },
|
9576 | parentNode: (node) => node.parentNode,
|
9577 | nextSibling: (node) => node.nextSibling,
|
9578 | querySelector: (selector) => doc.querySelector(selector),
|
9579 | setScopeId(el, id) {
|
9580 | el.setAttribute(id, "");
|
9581 | },
|
9582 |
|
9583 |
|
9584 |
|
9585 |
|
9586 | insertStaticContent(content, parent, anchor, namespace, start, end) {
|
9587 | const before = anchor ? anchor.previousSibling : parent.lastChild;
|
9588 | if (start && (start === end || start.nextSibling)) {
|
9589 | while (true) {
|
9590 | parent.insertBefore(start.cloneNode(true), anchor);
|
9591 | if (start === end || !(start = start.nextSibling))
|
9592 | break;
|
9593 | }
|
9594 | } else {
|
9595 | templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
|
9596 | const template = templateContainer.content;
|
9597 | if (namespace === "svg" || namespace === "mathml") {
|
9598 | const wrapper = template.firstChild;
|
9599 | while (wrapper.firstChild) {
|
9600 | template.appendChild(wrapper.firstChild);
|
9601 | }
|
9602 | template.removeChild(wrapper);
|
9603 | }
|
9604 | parent.insertBefore(template, anchor);
|
9605 | }
|
9606 | return [
|
9607 |
|
9608 | before ? before.nextSibling : parent.firstChild,
|
9609 |
|
9610 | anchor ? anchor.previousSibling : parent.lastChild
|
9611 | ];
|
9612 | }
|
9613 | };
|
9614 |
|
9615 | const TRANSITION = "transition";
|
9616 | const ANIMATION = "animation";
|
9617 | const vtcKey = Symbol("_vtc");
|
9618 | const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
|
9619 | Transition.displayName = "Transition";
|
9620 | const DOMTransitionPropsValidators = {
|
9621 | name: String,
|
9622 | type: String,
|
9623 | css: {
|
9624 | type: Boolean,
|
9625 | default: true
|
9626 | },
|
9627 | duration: [String, Number, Object],
|
9628 | enterFromClass: String,
|
9629 | enterActiveClass: String,
|
9630 | enterToClass: String,
|
9631 | appearFromClass: String,
|
9632 | appearActiveClass: String,
|
9633 | appearToClass: String,
|
9634 | leaveFromClass: String,
|
9635 | leaveActiveClass: String,
|
9636 | leaveToClass: String
|
9637 | };
|
9638 | const TransitionPropsValidators = Transition.props = extend(
|
9639 | {},
|
9640 | BaseTransitionPropsValidators,
|
9641 | DOMTransitionPropsValidators
|
9642 | );
|
9643 | const callHook = (hook, args = []) => {
|
9644 | if (isArray(hook)) {
|
9645 | hook.forEach((h2) => h2(...args));
|
9646 | } else if (hook) {
|
9647 | hook(...args);
|
9648 | }
|
9649 | };
|
9650 | const hasExplicitCallback = (hook) => {
|
9651 | return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
9652 | };
|
9653 | function resolveTransitionProps(rawProps) {
|
9654 | const baseProps = {};
|
9655 | for (const key in rawProps) {
|
9656 | if (!(key in DOMTransitionPropsValidators)) {
|
9657 | baseProps[key] = rawProps[key];
|
9658 | }
|
9659 | }
|
9660 | if (rawProps.css === false) {
|
9661 | return baseProps;
|
9662 | }
|
9663 | const {
|
9664 | name = "v",
|
9665 | type,
|
9666 | duration,
|
9667 | enterFromClass = `${name}-enter-from`,
|
9668 | enterActiveClass = `${name}-enter-active`,
|
9669 | enterToClass = `${name}-enter-to`,
|
9670 | appearFromClass = enterFromClass,
|
9671 | appearActiveClass = enterActiveClass,
|
9672 | appearToClass = enterToClass,
|
9673 | leaveFromClass = `${name}-leave-from`,
|
9674 | leaveActiveClass = `${name}-leave-active`,
|
9675 | leaveToClass = `${name}-leave-to`
|
9676 | } = rawProps;
|
9677 | const durations = normalizeDuration(duration);
|
9678 | const enterDuration = durations && durations[0];
|
9679 | const leaveDuration = durations && durations[1];
|
9680 | const {
|
9681 | onBeforeEnter,
|
9682 | onEnter,
|
9683 | onEnterCancelled,
|
9684 | onLeave,
|
9685 | onLeaveCancelled,
|
9686 | onBeforeAppear = onBeforeEnter,
|
9687 | onAppear = onEnter,
|
9688 | onAppearCancelled = onEnterCancelled
|
9689 | } = baseProps;
|
9690 | const finishEnter = (el, isAppear, done) => {
|
9691 | removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9692 | removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
9693 | done && done();
|
9694 | };
|
9695 | const finishLeave = (el, done) => {
|
9696 | el._isLeaving = false;
|
9697 | removeTransitionClass(el, leaveFromClass);
|
9698 | removeTransitionClass(el, leaveToClass);
|
9699 | removeTransitionClass(el, leaveActiveClass);
|
9700 | done && done();
|
9701 | };
|
9702 | const makeEnterHook = (isAppear) => {
|
9703 | return (el, done) => {
|
9704 | const hook = isAppear ? onAppear : onEnter;
|
9705 | const resolve = () => finishEnter(el, isAppear, done);
|
9706 | callHook(hook, [el, resolve]);
|
9707 | nextFrame(() => {
|
9708 | removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
9709 | addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
9710 | if (!hasExplicitCallback(hook)) {
|
9711 | whenTransitionEnds(el, type, enterDuration, resolve);
|
9712 | }
|
9713 | });
|
9714 | };
|
9715 | };
|
9716 | return extend(baseProps, {
|
9717 | onBeforeEnter(el) {
|
9718 | callHook(onBeforeEnter, [el]);
|
9719 | addTransitionClass(el, enterFromClass);
|
9720 | addTransitionClass(el, enterActiveClass);
|
9721 | },
|
9722 | onBeforeAppear(el) {
|
9723 | callHook(onBeforeAppear, [el]);
|
9724 | addTransitionClass(el, appearFromClass);
|
9725 | addTransitionClass(el, appearActiveClass);
|
9726 | },
|
9727 | onEnter: makeEnterHook(false),
|
9728 | onAppear: makeEnterHook(true),
|
9729 | onLeave(el, done) {
|
9730 | el._isLeaving = true;
|
9731 | const resolve = () => finishLeave(el, done);
|
9732 | addTransitionClass(el, leaveFromClass);
|
9733 | forceReflow();
|
9734 | addTransitionClass(el, leaveActiveClass);
|
9735 | nextFrame(() => {
|
9736 | if (!el._isLeaving) {
|
9737 | return;
|
9738 | }
|
9739 | removeTransitionClass(el, leaveFromClass);
|
9740 | addTransitionClass(el, leaveToClass);
|
9741 | if (!hasExplicitCallback(onLeave)) {
|
9742 | whenTransitionEnds(el, type, leaveDuration, resolve);
|
9743 | }
|
9744 | });
|
9745 | callHook(onLeave, [el, resolve]);
|
9746 | },
|
9747 | onEnterCancelled(el) {
|
9748 | finishEnter(el, false);
|
9749 | callHook(onEnterCancelled, [el]);
|
9750 | },
|
9751 | onAppearCancelled(el) {
|
9752 | finishEnter(el, true);
|
9753 | callHook(onAppearCancelled, [el]);
|
9754 | },
|
9755 | onLeaveCancelled(el) {
|
9756 | finishLeave(el);
|
9757 | callHook(onLeaveCancelled, [el]);
|
9758 | }
|
9759 | });
|
9760 | }
|
9761 | function normalizeDuration(duration) {
|
9762 | if (duration == null) {
|
9763 | return null;
|
9764 | } else if (isObject(duration)) {
|
9765 | return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
9766 | } else {
|
9767 | const n = NumberOf(duration);
|
9768 | return [n, n];
|
9769 | }
|
9770 | }
|
9771 | function NumberOf(val) {
|
9772 | const res = toNumber(val);
|
9773 | {
|
9774 | assertNumber(res, "<transition> explicit duration");
|
9775 | }
|
9776 | return res;
|
9777 | }
|
9778 | function addTransitionClass(el, cls) {
|
9779 | cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
9780 | (el[vtcKey] || (el[vtcKey] = new Set())).add(cls);
|
9781 | }
|
9782 | function removeTransitionClass(el, cls) {
|
9783 | cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
9784 | const _vtc = el[vtcKey];
|
9785 | if (_vtc) {
|
9786 | _vtc.delete(cls);
|
9787 | if (!_vtc.size) {
|
9788 | el[vtcKey] = void 0;
|
9789 | }
|
9790 | }
|
9791 | }
|
9792 | function nextFrame(cb) {
|
9793 | requestAnimationFrame(() => {
|
9794 | requestAnimationFrame(cb);
|
9795 | });
|
9796 | }
|
9797 | let endId = 0;
|
9798 | function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
9799 | const id = el._endId = ++endId;
|
9800 | const resolveIfNotStale = () => {
|
9801 | if (id === el._endId) {
|
9802 | resolve();
|
9803 | }
|
9804 | };
|
9805 | if (explicitTimeout) {
|
9806 | return setTimeout(resolveIfNotStale, explicitTimeout);
|
9807 | }
|
9808 | const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
9809 | if (!type) {
|
9810 | return resolve();
|
9811 | }
|
9812 | const endEvent = type + "end";
|
9813 | let ended = 0;
|
9814 | const end = () => {
|
9815 | el.removeEventListener(endEvent, onEnd);
|
9816 | resolveIfNotStale();
|
9817 | };
|
9818 | const onEnd = (e) => {
|
9819 | if (e.target === el && ++ended >= propCount) {
|
9820 | end();
|
9821 | }
|
9822 | };
|
9823 | setTimeout(() => {
|
9824 | if (ended < propCount) {
|
9825 | end();
|
9826 | }
|
9827 | }, timeout + 1);
|
9828 | el.addEventListener(endEvent, onEnd);
|
9829 | }
|
9830 | function getTransitionInfo(el, expectedType) {
|
9831 | const styles = window.getComputedStyle(el);
|
9832 | const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
9833 | const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
9834 | const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
9835 | const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
9836 | const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
9837 | const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
9838 | const animationTimeout = getTimeout(animationDelays, animationDurations);
|
9839 | let type = null;
|
9840 | let timeout = 0;
|
9841 | let propCount = 0;
|
9842 | if (expectedType === TRANSITION) {
|
9843 | if (transitionTimeout > 0) {
|
9844 | type = TRANSITION;
|
9845 | timeout = transitionTimeout;
|
9846 | propCount = transitionDurations.length;
|
9847 | }
|
9848 | } else if (expectedType === ANIMATION) {
|
9849 | if (animationTimeout > 0) {
|
9850 | type = ANIMATION;
|
9851 | timeout = animationTimeout;
|
9852 | propCount = animationDurations.length;
|
9853 | }
|
9854 | } else {
|
9855 | timeout = Math.max(transitionTimeout, animationTimeout);
|
9856 | type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
9857 | propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
9858 | }
|
9859 | const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
|
9860 | getStyleProperties(`${TRANSITION}Property`).toString()
|
9861 | );
|
9862 | return {
|
9863 | type,
|
9864 | timeout,
|
9865 | propCount,
|
9866 | hasTransform
|
9867 | };
|
9868 | }
|
9869 | function getTimeout(delays, durations) {
|
9870 | while (delays.length < durations.length) {
|
9871 | delays = delays.concat(delays);
|
9872 | }
|
9873 | return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
9874 | }
|
9875 | function toMs(s) {
|
9876 | if (s === "auto")
|
9877 | return 0;
|
9878 | return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
9879 | }
|
9880 | function forceReflow() {
|
9881 | return document.body.offsetHeight;
|
9882 | }
|
9883 |
|
9884 | function patchClass(el, value, isSVG) {
|
9885 | const transitionClasses = el[vtcKey];
|
9886 | if (transitionClasses) {
|
9887 | value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
9888 | }
|
9889 | if (value == null) {
|
9890 | el.removeAttribute("class");
|
9891 | } else if (isSVG) {
|
9892 | el.setAttribute("class", value);
|
9893 | } else {
|
9894 | el.className = value;
|
9895 | }
|
9896 | }
|
9897 |
|
9898 | const vShowOriginalDisplay = Symbol("_vod");
|
9899 | const vShowHidden = Symbol("_vsh");
|
9900 | const vShow = {
|
9901 | beforeMount(el, { value }, { transition }) {
|
9902 | el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
9903 | if (transition && value) {
|
9904 | transition.beforeEnter(el);
|
9905 | } else {
|
9906 | setDisplay(el, value);
|
9907 | }
|
9908 | },
|
9909 | mounted(el, { value }, { transition }) {
|
9910 | if (transition && value) {
|
9911 | transition.enter(el);
|
9912 | }
|
9913 | },
|
9914 | updated(el, { value, oldValue }, { transition }) {
|
9915 | if (!value === !oldValue)
|
9916 | return;
|
9917 | if (transition) {
|
9918 | if (value) {
|
9919 | transition.beforeEnter(el);
|
9920 | setDisplay(el, true);
|
9921 | transition.enter(el);
|
9922 | } else {
|
9923 | transition.leave(el, () => {
|
9924 | setDisplay(el, false);
|
9925 | });
|
9926 | }
|
9927 | } else {
|
9928 | setDisplay(el, value);
|
9929 | }
|
9930 | },
|
9931 | beforeUnmount(el, { value }) {
|
9932 | setDisplay(el, value);
|
9933 | }
|
9934 | };
|
9935 | {
|
9936 | vShow.name = "show";
|
9937 | }
|
9938 | function setDisplay(el, value) {
|
9939 | el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
9940 | el[vShowHidden] = !value;
|
9941 | }
|
9942 |
|
9943 | const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
|
9944 | function useCssVars(getter) {
|
9945 | const instance = getCurrentInstance();
|
9946 | if (!instance) {
|
9947 | warn(`useCssVars is called without current active component instance.`);
|
9948 | return;
|
9949 | }
|
9950 | const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
|
9951 | Array.from(
|
9952 | document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
|
9953 | ).forEach((node) => setVarsOnNode(node, vars));
|
9954 | };
|
9955 | {
|
9956 | instance.getCssVars = () => getter(instance.proxy);
|
9957 | }
|
9958 | const setVars = () => {
|
9959 | const vars = getter(instance.proxy);
|
9960 | setVarsOnVNode(instance.subTree, vars);
|
9961 | updateTeleports(vars);
|
9962 | };
|
9963 | watchPostEffect(setVars);
|
9964 | onMounted(() => {
|
9965 | const ob = new MutationObserver(setVars);
|
9966 | ob.observe(instance.subTree.el.parentNode, { childList: true });
|
9967 | onUnmounted(() => ob.disconnect());
|
9968 | });
|
9969 | }
|
9970 | function setVarsOnVNode(vnode, vars) {
|
9971 | if (vnode.shapeFlag & 128) {
|
9972 | const suspense = vnode.suspense;
|
9973 | vnode = suspense.activeBranch;
|
9974 | if (suspense.pendingBranch && !suspense.isHydrating) {
|
9975 | suspense.effects.push(() => {
|
9976 | setVarsOnVNode(suspense.activeBranch, vars);
|
9977 | });
|
9978 | }
|
9979 | }
|
9980 | while (vnode.component) {
|
9981 | vnode = vnode.component.subTree;
|
9982 | }
|
9983 | if (vnode.shapeFlag & 1 && vnode.el) {
|
9984 | setVarsOnNode(vnode.el, vars);
|
9985 | } else if (vnode.type === Fragment) {
|
9986 | vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
9987 | } else if (vnode.type === Static) {
|
9988 | let { el, anchor } = vnode;
|
9989 | while (el) {
|
9990 | setVarsOnNode(el, vars);
|
9991 | if (el === anchor)
|
9992 | break;
|
9993 | el = el.nextSibling;
|
9994 | }
|
9995 | }
|
9996 | }
|
9997 | function setVarsOnNode(el, vars) {
|
9998 | if (el.nodeType === 1) {
|
9999 | const style = el.style;
|
10000 | let cssText = "";
|
10001 | for (const key in vars) {
|
10002 | style.setProperty(`--${key}`, vars[key]);
|
10003 | cssText += `--${key}: ${vars[key]};`;
|
10004 | }
|
10005 | style[CSS_VAR_TEXT] = cssText;
|
10006 | }
|
10007 | }
|
10008 |
|
10009 | const displayRE = /(^|;)\s*display\s*:/;
|
10010 | function patchStyle(el, prev, next) {
|
10011 | const style = el.style;
|
10012 | const isCssString = isString(next);
|
10013 | let hasControlledDisplay = false;
|
10014 | if (next && !isCssString) {
|
10015 | if (prev) {
|
10016 | if (!isString(prev)) {
|
10017 | for (const key in prev) {
|
10018 | if (next[key] == null) {
|
10019 | setStyle(style, key, "");
|
10020 | }
|
10021 | }
|
10022 | } else {
|
10023 | for (const prevStyle of prev.split(";")) {
|
10024 | const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
10025 | if (next[key] == null) {
|
10026 | setStyle(style, key, "");
|
10027 | }
|
10028 | }
|
10029 | }
|
10030 | }
|
10031 | for (const key in next) {
|
10032 | if (key === "display") {
|
10033 | hasControlledDisplay = true;
|
10034 | }
|
10035 | setStyle(style, key, next[key]);
|
10036 | }
|
10037 | } else {
|
10038 | if (isCssString) {
|
10039 | if (prev !== next) {
|
10040 | const cssVarText = style[CSS_VAR_TEXT];
|
10041 | if (cssVarText) {
|
10042 | next += ";" + cssVarText;
|
10043 | }
|
10044 | style.cssText = next;
|
10045 | hasControlledDisplay = displayRE.test(next);
|
10046 | }
|
10047 | } else if (prev) {
|
10048 | el.removeAttribute("style");
|
10049 | }
|
10050 | }
|
10051 | if (vShowOriginalDisplay in el) {
|
10052 | el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
10053 | if (el[vShowHidden]) {
|
10054 | style.display = "none";
|
10055 | }
|
10056 | }
|
10057 | }
|
10058 | const semicolonRE = /[^\\];\s*$/;
|
10059 | const importantRE = /\s*!important$/;
|
10060 | function setStyle(style, name, val) {
|
10061 | if (isArray(val)) {
|
10062 | val.forEach((v) => setStyle(style, name, v));
|
10063 | } else {
|
10064 | if (val == null)
|
10065 | val = "";
|
10066 | {
|
10067 | if (semicolonRE.test(val)) {
|
10068 | warn(
|
10069 | `Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
10070 | );
|
10071 | }
|
10072 | }
|
10073 | if (name.startsWith("--")) {
|
10074 | style.setProperty(name, val);
|
10075 | } else {
|
10076 | const prefixed = autoPrefix(style, name);
|
10077 | if (importantRE.test(val)) {
|
10078 | style.setProperty(
|
10079 | hyphenate(prefixed),
|
10080 | val.replace(importantRE, ""),
|
10081 | "important"
|
10082 | );
|
10083 | } else {
|
10084 | style[prefixed] = val;
|
10085 | }
|
10086 | }
|
10087 | }
|
10088 | }
|
10089 | const prefixes = ["Webkit", "Moz", "ms"];
|
10090 | const prefixCache = {};
|
10091 | function autoPrefix(style, rawName) {
|
10092 | const cached = prefixCache[rawName];
|
10093 | if (cached) {
|
10094 | return cached;
|
10095 | }
|
10096 | let name = camelize(rawName);
|
10097 | if (name !== "filter" && name in style) {
|
10098 | return prefixCache[rawName] = name;
|
10099 | }
|
10100 | name = capitalize(name);
|
10101 | for (let i = 0; i < prefixes.length; i++) {
|
10102 | const prefixed = prefixes[i] + name;
|
10103 | if (prefixed in style) {
|
10104 | return prefixCache[rawName] = prefixed;
|
10105 | }
|
10106 | }
|
10107 | return rawName;
|
10108 | }
|
10109 |
|
10110 | const xlinkNS = "http://www.w3.org/1999/xlink";
|
10111 | function patchAttr(el, key, value, isSVG, instance) {
|
10112 | if (isSVG && key.startsWith("xlink:")) {
|
10113 | if (value == null) {
|
10114 | el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
10115 | } else {
|
10116 | el.setAttributeNS(xlinkNS, key, value);
|
10117 | }
|
10118 | } else {
|
10119 | const isBoolean = isSpecialBooleanAttr(key);
|
10120 | if (value == null || isBoolean && !includeBooleanAttr(value)) {
|
10121 | el.removeAttribute(key);
|
10122 | } else {
|
10123 | el.setAttribute(key, isBoolean ? "" : value);
|
10124 | }
|
10125 | }
|
10126 | }
|
10127 |
|
10128 | function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
10129 | if (key === "innerHTML" || key === "textContent") {
|
10130 | if (prevChildren) {
|
10131 | unmountChildren(prevChildren, parentComponent, parentSuspense);
|
10132 | }
|
10133 | el[key] = value == null ? "" : value;
|
10134 | return;
|
10135 | }
|
10136 | const tag = el.tagName;
|
10137 | if (key === "value" && tag !== "PROGRESS" &&
|
10138 | !tag.includes("-")) {
|
10139 | const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
10140 | const newValue = value == null ? "" : value;
|
10141 | if (oldValue !== newValue || !("_value" in el)) {
|
10142 | el.value = newValue;
|
10143 | }
|
10144 | if (value == null) {
|
10145 | el.removeAttribute(key);
|
10146 | }
|
10147 | el._value = value;
|
10148 | return;
|
10149 | }
|
10150 | let needRemove = false;
|
10151 | if (value === "" || value == null) {
|
10152 | const type = typeof el[key];
|
10153 | if (type === "boolean") {
|
10154 | value = includeBooleanAttr(value);
|
10155 | } else if (value == null && type === "string") {
|
10156 | value = "";
|
10157 | needRemove = true;
|
10158 | } else if (type === "number") {
|
10159 | value = 0;
|
10160 | needRemove = true;
|
10161 | }
|
10162 | }
|
10163 | try {
|
10164 | el[key] = value;
|
10165 | } catch (e) {
|
10166 | if (!needRemove) {
|
10167 | warn(
|
10168 | `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
|
10169 | e
|
10170 | );
|
10171 | }
|
10172 | }
|
10173 | needRemove && el.removeAttribute(key);
|
10174 | }
|
10175 |
|
10176 | function addEventListener(el, event, handler, options) {
|
10177 | el.addEventListener(event, handler, options);
|
10178 | }
|
10179 | function removeEventListener(el, event, handler, options) {
|
10180 | el.removeEventListener(event, handler, options);
|
10181 | }
|
10182 | const veiKey = Symbol("_vei");
|
10183 | function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
10184 | const invokers = el[veiKey] || (el[veiKey] = {});
|
10185 | const existingInvoker = invokers[rawName];
|
10186 | if (nextValue && existingInvoker) {
|
10187 | existingInvoker.value = nextValue;
|
10188 | } else {
|
10189 | const [name, options] = parseName(rawName);
|
10190 | if (nextValue) {
|
10191 | const invoker = invokers[rawName] = createInvoker(nextValue, instance);
|
10192 | addEventListener(el, name, invoker, options);
|
10193 | } else if (existingInvoker) {
|
10194 | removeEventListener(el, name, existingInvoker, options);
|
10195 | invokers[rawName] = void 0;
|
10196 | }
|
10197 | }
|
10198 | }
|
10199 | const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
10200 | function parseName(name) {
|
10201 | let options;
|
10202 | if (optionsModifierRE.test(name)) {
|
10203 | options = {};
|
10204 | let m;
|
10205 | while (m = name.match(optionsModifierRE)) {
|
10206 | name = name.slice(0, name.length - m[0].length);
|
10207 | options[m[0].toLowerCase()] = true;
|
10208 | }
|
10209 | }
|
10210 | const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
|
10211 | return [event, options];
|
10212 | }
|
10213 | let cachedNow = 0;
|
10214 | const p = Promise.resolve();
|
10215 | const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
10216 | function createInvoker(initialValue, instance) {
|
10217 | const invoker = (e) => {
|
10218 | if (!e._vts) {
|
10219 | e._vts = Date.now();
|
10220 | } else if (e._vts <= invoker.attached) {
|
10221 | return;
|
10222 | }
|
10223 | callWithAsyncErrorHandling(
|
10224 | patchStopImmediatePropagation(e, invoker.value),
|
10225 | instance,
|
10226 | 5,
|
10227 | [e]
|
10228 | );
|
10229 | };
|
10230 | invoker.value = initialValue;
|
10231 | invoker.attached = getNow();
|
10232 | return invoker;
|
10233 | }
|
10234 | function patchStopImmediatePropagation(e, value) {
|
10235 | if (isArray(value)) {
|
10236 | const originalStop = e.stopImmediatePropagation;
|
10237 | e.stopImmediatePropagation = () => {
|
10238 | originalStop.call(e);
|
10239 | e._stopped = true;
|
10240 | };
|
10241 | return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
|
10242 | } else {
|
10243 | return value;
|
10244 | }
|
10245 | }
|
10246 |
|
10247 | const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
10248 | key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
10249 | const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
10250 | const isSVG = namespace === "svg";
|
10251 | if (key === "class") {
|
10252 | patchClass(el, nextValue, isSVG);
|
10253 | } else if (key === "style") {
|
10254 | patchStyle(el, prevValue, nextValue);
|
10255 | } else if (isOn(key)) {
|
10256 | if (!isModelListener(key)) {
|
10257 | patchEvent(el, key, prevValue, nextValue, parentComponent);
|
10258 | }
|
10259 | } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
10260 | patchDOMProp(
|
10261 | el,
|
10262 | key,
|
10263 | nextValue,
|
10264 | prevChildren,
|
10265 | parentComponent,
|
10266 | parentSuspense,
|
10267 | unmountChildren
|
10268 | );
|
10269 | } else {
|
10270 | if (key === "true-value") {
|
10271 | el._trueValue = nextValue;
|
10272 | } else if (key === "false-value") {
|
10273 | el._falseValue = nextValue;
|
10274 | }
|
10275 | patchAttr(el, key, nextValue, isSVG);
|
10276 | }
|
10277 | };
|
10278 | function shouldSetAsProp(el, key, value, isSVG) {
|
10279 | if (isSVG) {
|
10280 | if (key === "innerHTML" || key === "textContent") {
|
10281 | return true;
|
10282 | }
|
10283 | if (key in el && isNativeOn(key) && isFunction(value)) {
|
10284 | return true;
|
10285 | }
|
10286 | return false;
|
10287 | }
|
10288 | if (key === "spellcheck" || key === "draggable" || key === "translate") {
|
10289 | return false;
|
10290 | }
|
10291 | if (key === "form") {
|
10292 | return false;
|
10293 | }
|
10294 | if (key === "list" && el.tagName === "INPUT") {
|
10295 | return false;
|
10296 | }
|
10297 | if (key === "type" && el.tagName === "TEXTAREA") {
|
10298 | return false;
|
10299 | }
|
10300 | if (key === "width" || key === "height") {
|
10301 | const tag = el.tagName;
|
10302 | if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
10303 | return false;
|
10304 | }
|
10305 | }
|
10306 | if (isNativeOn(key) && isString(value)) {
|
10307 | return false;
|
10308 | }
|
10309 | return key in el;
|
10310 | }
|
10311 |
|
10312 |
|
10313 |
|
10314 | function defineCustomElement(options, hydrate2) {
|
10315 | const Comp = defineComponent(options);
|
10316 | class VueCustomElement extends VueElement {
|
10317 | constructor(initialProps) {
|
10318 | super(Comp, initialProps, hydrate2);
|
10319 | }
|
10320 | }
|
10321 | VueCustomElement.def = Comp;
|
10322 | return VueCustomElement;
|
10323 | }
|
10324 |
|
10325 | const defineSSRCustomElement = (options) => {
|
10326 | return defineCustomElement(options, hydrate);
|
10327 | };
|
10328 | const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
10329 | };
|
10330 | class VueElement extends BaseClass {
|
10331 | constructor(_def, _props = {}, hydrate2) {
|
10332 | super();
|
10333 | this._def = _def;
|
10334 | this._props = _props;
|
10335 | |
10336 |
|
10337 |
|
10338 | this._instance = null;
|
10339 | this._connected = false;
|
10340 | this._resolved = false;
|
10341 | this._numberProps = null;
|
10342 | this._ob = null;
|
10343 | if (this.shadowRoot && hydrate2) {
|
10344 | hydrate2(this._createVNode(), this.shadowRoot);
|
10345 | } else {
|
10346 | if (this.shadowRoot) {
|
10347 | warn(
|
10348 | `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
10349 | );
|
10350 | }
|
10351 | this.attachShadow({ mode: "open" });
|
10352 | if (!this._def.__asyncLoader) {
|
10353 | this._resolveProps(this._def);
|
10354 | }
|
10355 | }
|
10356 | }
|
10357 | connectedCallback() {
|
10358 | this._connected = true;
|
10359 | if (!this._instance) {
|
10360 | if (this._resolved) {
|
10361 | this._update();
|
10362 | } else {
|
10363 | this._resolveDef();
|
10364 | }
|
10365 | }
|
10366 | }
|
10367 | disconnectedCallback() {
|
10368 | this._connected = false;
|
10369 | if (this._ob) {
|
10370 | this._ob.disconnect();
|
10371 | this._ob = null;
|
10372 | }
|
10373 | nextTick(() => {
|
10374 | if (!this._connected) {
|
10375 | render(null, this.shadowRoot);
|
10376 | this._instance = null;
|
10377 | }
|
10378 | });
|
10379 | }
|
10380 | |
10381 |
|
10382 |
|
10383 | _resolveDef() {
|
10384 | this._resolved = true;
|
10385 | for (let i = 0; i < this.attributes.length; i++) {
|
10386 | this._setAttr(this.attributes[i].name);
|
10387 | }
|
10388 | this._ob = new MutationObserver((mutations) => {
|
10389 | for (const m of mutations) {
|
10390 | this._setAttr(m.attributeName);
|
10391 | }
|
10392 | });
|
10393 | this._ob.observe(this, { attributes: true });
|
10394 | const resolve = (def, isAsync = false) => {
|
10395 | const { props, styles } = def;
|
10396 | let numberProps;
|
10397 | if (props && !isArray(props)) {
|
10398 | for (const key in props) {
|
10399 | const opt = props[key];
|
10400 | if (opt === Number || opt && opt.type === Number) {
|
10401 | if (key in this._props) {
|
10402 | this._props[key] = toNumber(this._props[key]);
|
10403 | }
|
10404 | (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
|
10405 | }
|
10406 | }
|
10407 | }
|
10408 | this._numberProps = numberProps;
|
10409 | if (isAsync) {
|
10410 | this._resolveProps(def);
|
10411 | }
|
10412 | this._applyStyles(styles);
|
10413 | this._update();
|
10414 | };
|
10415 | const asyncDef = this._def.__asyncLoader;
|
10416 | if (asyncDef) {
|
10417 | asyncDef().then((def) => resolve(def, true));
|
10418 | } else {
|
10419 | resolve(this._def);
|
10420 | }
|
10421 | }
|
10422 | _resolveProps(def) {
|
10423 | const { props } = def;
|
10424 | const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
10425 | for (const key of Object.keys(this)) {
|
10426 | if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
10427 | this._setProp(key, this[key], true, false);
|
10428 | }
|
10429 | }
|
10430 | for (const key of declaredPropKeys.map(camelize)) {
|
10431 | Object.defineProperty(this, key, {
|
10432 | get() {
|
10433 | return this._getProp(key);
|
10434 | },
|
10435 | set(val) {
|
10436 | this._setProp(key, val);
|
10437 | }
|
10438 | });
|
10439 | }
|
10440 | }
|
10441 | _setAttr(key) {
|
10442 | let value = this.getAttribute(key);
|
10443 | const camelKey = camelize(key);
|
10444 | if (this._numberProps && this._numberProps[camelKey]) {
|
10445 | value = toNumber(value);
|
10446 | }
|
10447 | this._setProp(camelKey, value, false);
|
10448 | }
|
10449 | |
10450 |
|
10451 |
|
10452 | _getProp(key) {
|
10453 | return this._props[key];
|
10454 | }
|
10455 | |
10456 |
|
10457 |
|
10458 | _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
|
10459 | if (val !== this._props[key]) {
|
10460 | this._props[key] = val;
|
10461 | if (shouldUpdate && this._instance) {
|
10462 | this._update();
|
10463 | }
|
10464 | if (shouldReflect) {
|
10465 | if (val === true) {
|
10466 | this.setAttribute(hyphenate(key), "");
|
10467 | } else if (typeof val === "string" || typeof val === "number") {
|
10468 | this.setAttribute(hyphenate(key), val + "");
|
10469 | } else if (!val) {
|
10470 | this.removeAttribute(hyphenate(key));
|
10471 | }
|
10472 | }
|
10473 | }
|
10474 | }
|
10475 | _update() {
|
10476 | render(this._createVNode(), this.shadowRoot);
|
10477 | }
|
10478 | _createVNode() {
|
10479 | const vnode = createVNode(this._def, extend({}, this._props));
|
10480 | if (!this._instance) {
|
10481 | vnode.ce = (instance) => {
|
10482 | this._instance = instance;
|
10483 | instance.isCE = true;
|
10484 | {
|
10485 | instance.ceReload = (newStyles) => {
|
10486 | if (this._styles) {
|
10487 | this._styles.forEach((s) => this.shadowRoot.removeChild(s));
|
10488 | this._styles.length = 0;
|
10489 | }
|
10490 | this._applyStyles(newStyles);
|
10491 | this._instance = null;
|
10492 | this._update();
|
10493 | };
|
10494 | }
|
10495 | const dispatch = (event, args) => {
|
10496 | this.dispatchEvent(
|
10497 | new CustomEvent(event, {
|
10498 | detail: args
|
10499 | })
|
10500 | );
|
10501 | };
|
10502 | instance.emit = (event, ...args) => {
|
10503 | dispatch(event, args);
|
10504 | if (hyphenate(event) !== event) {
|
10505 | dispatch(hyphenate(event), args);
|
10506 | }
|
10507 | };
|
10508 | let parent = this;
|
10509 | while (parent = parent && (parent.parentNode || parent.host)) {
|
10510 | if (parent instanceof VueElement) {
|
10511 | instance.parent = parent._instance;
|
10512 | instance.provides = parent._instance.provides;
|
10513 | break;
|
10514 | }
|
10515 | }
|
10516 | };
|
10517 | }
|
10518 | return vnode;
|
10519 | }
|
10520 | _applyStyles(styles) {
|
10521 | if (styles) {
|
10522 | styles.forEach((css) => {
|
10523 | const s = document.createElement("style");
|
10524 | s.textContent = css;
|
10525 | this.shadowRoot.appendChild(s);
|
10526 | {
|
10527 | (this._styles || (this._styles = [])).push(s);
|
10528 | }
|
10529 | });
|
10530 | }
|
10531 | }
|
10532 | }
|
10533 |
|
10534 | function useCssModule(name = "$style") {
|
10535 | {
|
10536 | {
|
10537 | warn(`useCssModule() is not supported in the global build.`);
|
10538 | }
|
10539 | return EMPTY_OBJ;
|
10540 | }
|
10541 | }
|
10542 |
|
10543 | const positionMap = new WeakMap();
|
10544 | const newPositionMap = new WeakMap();
|
10545 | const moveCbKey = Symbol("_moveCb");
|
10546 | const enterCbKey = Symbol("_enterCb");
|
10547 | const TransitionGroupImpl = {
|
10548 | name: "TransitionGroup",
|
10549 | props: extend({}, TransitionPropsValidators, {
|
10550 | tag: String,
|
10551 | moveClass: String
|
10552 | }),
|
10553 | setup(props, { slots }) {
|
10554 | const instance = getCurrentInstance();
|
10555 | const state = useTransitionState();
|
10556 | let prevChildren;
|
10557 | let children;
|
10558 | onUpdated(() => {
|
10559 | if (!prevChildren.length) {
|
10560 | return;
|
10561 | }
|
10562 | const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
10563 | if (!hasCSSTransform(
|
10564 | prevChildren[0].el,
|
10565 | instance.vnode.el,
|
10566 | moveClass
|
10567 | )) {
|
10568 | return;
|
10569 | }
|
10570 | prevChildren.forEach(callPendingCbs);
|
10571 | prevChildren.forEach(recordPosition);
|
10572 | const movedChildren = prevChildren.filter(applyTranslation);
|
10573 | forceReflow();
|
10574 | movedChildren.forEach((c) => {
|
10575 | const el = c.el;
|
10576 | const style = el.style;
|
10577 | addTransitionClass(el, moveClass);
|
10578 | style.transform = style.webkitTransform = style.transitionDuration = "";
|
10579 | const cb = el[moveCbKey] = (e) => {
|
10580 | if (e && e.target !== el) {
|
10581 | return;
|
10582 | }
|
10583 | if (!e || /transform$/.test(e.propertyName)) {
|
10584 | el.removeEventListener("transitionend", cb);
|
10585 | el[moveCbKey] = null;
|
10586 | removeTransitionClass(el, moveClass);
|
10587 | }
|
10588 | };
|
10589 | el.addEventListener("transitionend", cb);
|
10590 | });
|
10591 | });
|
10592 | return () => {
|
10593 | const rawProps = toRaw(props);
|
10594 | const cssTransitionProps = resolveTransitionProps(rawProps);
|
10595 | let tag = rawProps.tag || Fragment;
|
10596 | prevChildren = children;
|
10597 | children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
10598 | for (let i = 0; i < children.length; i++) {
|
10599 | const child = children[i];
|
10600 | if (child.key != null) {
|
10601 | setTransitionHooks(
|
10602 | child,
|
10603 | resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
10604 | );
|
10605 | } else {
|
10606 | warn(`<TransitionGroup> children must be keyed.`);
|
10607 | }
|
10608 | }
|
10609 | if (prevChildren) {
|
10610 | for (let i = 0; i < prevChildren.length; i++) {
|
10611 | const child = prevChildren[i];
|
10612 | setTransitionHooks(
|
10613 | child,
|
10614 | resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
10615 | );
|
10616 | positionMap.set(child, child.el.getBoundingClientRect());
|
10617 | }
|
10618 | }
|
10619 | return createVNode(tag, null, children);
|
10620 | };
|
10621 | }
|
10622 | };
|
10623 | const removeMode = (props) => delete props.mode;
|
10624 | removeMode(TransitionGroupImpl.props);
|
10625 | const TransitionGroup = TransitionGroupImpl;
|
10626 | function callPendingCbs(c) {
|
10627 | const el = c.el;
|
10628 | if (el[moveCbKey]) {
|
10629 | el[moveCbKey]();
|
10630 | }
|
10631 | if (el[enterCbKey]) {
|
10632 | el[enterCbKey]();
|
10633 | }
|
10634 | }
|
10635 | function recordPosition(c) {
|
10636 | newPositionMap.set(c, c.el.getBoundingClientRect());
|
10637 | }
|
10638 | function applyTranslation(c) {
|
10639 | const oldPos = positionMap.get(c);
|
10640 | const newPos = newPositionMap.get(c);
|
10641 | const dx = oldPos.left - newPos.left;
|
10642 | const dy = oldPos.top - newPos.top;
|
10643 | if (dx || dy) {
|
10644 | const s = c.el.style;
|
10645 | s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
10646 | s.transitionDuration = "0s";
|
10647 | return c;
|
10648 | }
|
10649 | }
|
10650 | function hasCSSTransform(el, root, moveClass) {
|
10651 | const clone = el.cloneNode();
|
10652 | const _vtc = el[vtcKey];
|
10653 | if (_vtc) {
|
10654 | _vtc.forEach((cls) => {
|
10655 | cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
10656 | });
|
10657 | }
|
10658 | moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
|
10659 | clone.style.display = "none";
|
10660 | const container = root.nodeType === 1 ? root : root.parentNode;
|
10661 | container.appendChild(clone);
|
10662 | const { hasTransform } = getTransitionInfo(clone);
|
10663 | container.removeChild(clone);
|
10664 | return hasTransform;
|
10665 | }
|
10666 |
|
10667 | const getModelAssigner = (vnode) => {
|
10668 | const fn = vnode.props["onUpdate:modelValue"] || false;
|
10669 | return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
|
10670 | };
|
10671 | function onCompositionStart(e) {
|
10672 | e.target.composing = true;
|
10673 | }
|
10674 | function onCompositionEnd(e) {
|
10675 | const target = e.target;
|
10676 | if (target.composing) {
|
10677 | target.composing = false;
|
10678 | target.dispatchEvent(new Event("input"));
|
10679 | }
|
10680 | }
|
10681 | const assignKey = Symbol("_assign");
|
10682 | const vModelText = {
|
10683 | created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
10684 | el[assignKey] = getModelAssigner(vnode);
|
10685 | const castToNumber = number || vnode.props && vnode.props.type === "number";
|
10686 | addEventListener(el, lazy ? "change" : "input", (e) => {
|
10687 | if (e.target.composing)
|
10688 | return;
|
10689 | let domValue = el.value;
|
10690 | if (trim) {
|
10691 | domValue = domValue.trim();
|
10692 | }
|
10693 | if (castToNumber) {
|
10694 | domValue = looseToNumber(domValue);
|
10695 | }
|
10696 | el[assignKey](domValue);
|
10697 | });
|
10698 | if (trim) {
|
10699 | addEventListener(el, "change", () => {
|
10700 | el.value = el.value.trim();
|
10701 | });
|
10702 | }
|
10703 | if (!lazy) {
|
10704 | addEventListener(el, "compositionstart", onCompositionStart);
|
10705 | addEventListener(el, "compositionend", onCompositionEnd);
|
10706 | addEventListener(el, "change", onCompositionEnd);
|
10707 | }
|
10708 | },
|
10709 |
|
10710 | mounted(el, { value }) {
|
10711 | el.value = value == null ? "" : value;
|
10712 | },
|
10713 | beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
10714 | el[assignKey] = getModelAssigner(vnode);
|
10715 | if (el.composing)
|
10716 | return;
|
10717 | const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
|
10718 | const newValue = value == null ? "" : value;
|
10719 | if (elValue === newValue) {
|
10720 | return;
|
10721 | }
|
10722 | if (document.activeElement === el && el.type !== "range") {
|
10723 | if (lazy) {
|
10724 | return;
|
10725 | }
|
10726 | if (trim && el.value.trim() === newValue) {
|
10727 | return;
|
10728 | }
|
10729 | }
|
10730 | el.value = newValue;
|
10731 | }
|
10732 | };
|
10733 | const vModelCheckbox = {
|
10734 |
|
10735 | deep: true,
|
10736 | created(el, _, vnode) {
|
10737 | el[assignKey] = getModelAssigner(vnode);
|
10738 | addEventListener(el, "change", () => {
|
10739 | const modelValue = el._modelValue;
|
10740 | const elementValue = getValue(el);
|
10741 | const checked = el.checked;
|
10742 | const assign = el[assignKey];
|
10743 | if (isArray(modelValue)) {
|
10744 | const index = looseIndexOf(modelValue, elementValue);
|
10745 | const found = index !== -1;
|
10746 | if (checked && !found) {
|
10747 | assign(modelValue.concat(elementValue));
|
10748 | } else if (!checked && found) {
|
10749 | const filtered = [...modelValue];
|
10750 | filtered.splice(index, 1);
|
10751 | assign(filtered);
|
10752 | }
|
10753 | } else if (isSet(modelValue)) {
|
10754 | const cloned = new Set(modelValue);
|
10755 | if (checked) {
|
10756 | cloned.add(elementValue);
|
10757 | } else {
|
10758 | cloned.delete(elementValue);
|
10759 | }
|
10760 | assign(cloned);
|
10761 | } else {
|
10762 | assign(getCheckboxValue(el, checked));
|
10763 | }
|
10764 | });
|
10765 | },
|
10766 |
|
10767 | mounted: setChecked,
|
10768 | beforeUpdate(el, binding, vnode) {
|
10769 | el[assignKey] = getModelAssigner(vnode);
|
10770 | setChecked(el, binding, vnode);
|
10771 | }
|
10772 | };
|
10773 | function setChecked(el, { value, oldValue }, vnode) {
|
10774 | el._modelValue = value;
|
10775 | if (isArray(value)) {
|
10776 | el.checked = looseIndexOf(value, vnode.props.value) > -1;
|
10777 | } else if (isSet(value)) {
|
10778 | el.checked = value.has(vnode.props.value);
|
10779 | } else if (value !== oldValue) {
|
10780 | el.checked = looseEqual(value, getCheckboxValue(el, true));
|
10781 | }
|
10782 | }
|
10783 | const vModelRadio = {
|
10784 | created(el, { value }, vnode) {
|
10785 | el.checked = looseEqual(value, vnode.props.value);
|
10786 | el[assignKey] = getModelAssigner(vnode);
|
10787 | addEventListener(el, "change", () => {
|
10788 | el[assignKey](getValue(el));
|
10789 | });
|
10790 | },
|
10791 | beforeUpdate(el, { value, oldValue }, vnode) {
|
10792 | el[assignKey] = getModelAssigner(vnode);
|
10793 | if (value !== oldValue) {
|
10794 | el.checked = looseEqual(value, vnode.props.value);
|
10795 | }
|
10796 | }
|
10797 | };
|
10798 | const vModelSelect = {
|
10799 |
|
10800 | deep: true,
|
10801 | created(el, { value, modifiers: { number } }, vnode) {
|
10802 | const isSetModel = isSet(value);
|
10803 | addEventListener(el, "change", () => {
|
10804 | const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
10805 | (o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
10806 | );
|
10807 | el[assignKey](
|
10808 | el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
10809 | );
|
10810 | el._assigning = true;
|
10811 | nextTick(() => {
|
10812 | el._assigning = false;
|
10813 | });
|
10814 | });
|
10815 | el[assignKey] = getModelAssigner(vnode);
|
10816 | },
|
10817 |
|
10818 |
|
10819 | mounted(el, { value, modifiers: { number } }) {
|
10820 | setSelected(el, value, number);
|
10821 | },
|
10822 | beforeUpdate(el, _binding, vnode) {
|
10823 | el[assignKey] = getModelAssigner(vnode);
|
10824 | },
|
10825 | updated(el, { value, modifiers: { number } }) {
|
10826 | if (!el._assigning) {
|
10827 | setSelected(el, value, number);
|
10828 | }
|
10829 | }
|
10830 | };
|
10831 | function setSelected(el, value, number) {
|
10832 | const isMultiple = el.multiple;
|
10833 | const isArrayValue = isArray(value);
|
10834 | if (isMultiple && !isArrayValue && !isSet(value)) {
|
10835 | warn(
|
10836 | `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
|
10837 | );
|
10838 | return;
|
10839 | }
|
10840 | for (let i = 0, l = el.options.length; i < l; i++) {
|
10841 | const option = el.options[i];
|
10842 | const optionValue = getValue(option);
|
10843 | if (isMultiple) {
|
10844 | if (isArrayValue) {
|
10845 | const optionType = typeof optionValue;
|
10846 | if (optionType === "string" || optionType === "number") {
|
10847 | option.selected = value.includes(
|
10848 | number ? looseToNumber(optionValue) : optionValue
|
10849 | );
|
10850 | } else {
|
10851 | option.selected = looseIndexOf(value, optionValue) > -1;
|
10852 | }
|
10853 | } else {
|
10854 | option.selected = value.has(optionValue);
|
10855 | }
|
10856 | } else if (looseEqual(getValue(option), value)) {
|
10857 | if (el.selectedIndex !== i)
|
10858 | el.selectedIndex = i;
|
10859 | return;
|
10860 | }
|
10861 | }
|
10862 | if (!isMultiple && el.selectedIndex !== -1) {
|
10863 | el.selectedIndex = -1;
|
10864 | }
|
10865 | }
|
10866 | function getValue(el) {
|
10867 | return "_value" in el ? el._value : el.value;
|
10868 | }
|
10869 | function getCheckboxValue(el, checked) {
|
10870 | const key = checked ? "_trueValue" : "_falseValue";
|
10871 | return key in el ? el[key] : checked;
|
10872 | }
|
10873 | const vModelDynamic = {
|
10874 | created(el, binding, vnode) {
|
10875 | callModelHook(el, binding, vnode, null, "created");
|
10876 | },
|
10877 | mounted(el, binding, vnode) {
|
10878 | callModelHook(el, binding, vnode, null, "mounted");
|
10879 | },
|
10880 | beforeUpdate(el, binding, vnode, prevVNode) {
|
10881 | callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
10882 | },
|
10883 | updated(el, binding, vnode, prevVNode) {
|
10884 | callModelHook(el, binding, vnode, prevVNode, "updated");
|
10885 | }
|
10886 | };
|
10887 | function resolveDynamicModel(tagName, type) {
|
10888 | switch (tagName) {
|
10889 | case "SELECT":
|
10890 | return vModelSelect;
|
10891 | case "TEXTAREA":
|
10892 | return vModelText;
|
10893 | default:
|
10894 | switch (type) {
|
10895 | case "checkbox":
|
10896 | return vModelCheckbox;
|
10897 | case "radio":
|
10898 | return vModelRadio;
|
10899 | default:
|
10900 | return vModelText;
|
10901 | }
|
10902 | }
|
10903 | }
|
10904 | function callModelHook(el, binding, vnode, prevVNode, hook) {
|
10905 | const modelToUse = resolveDynamicModel(
|
10906 | el.tagName,
|
10907 | vnode.props && vnode.props.type
|
10908 | );
|
10909 | const fn = modelToUse[hook];
|
10910 | fn && fn(el, binding, vnode, prevVNode);
|
10911 | }
|
10912 |
|
10913 | const systemModifiers = ["ctrl", "shift", "alt", "meta"];
|
10914 | const modifierGuards = {
|
10915 | stop: (e) => e.stopPropagation(),
|
10916 | prevent: (e) => e.preventDefault(),
|
10917 | self: (e) => e.target !== e.currentTarget,
|
10918 | ctrl: (e) => !e.ctrlKey,
|
10919 | shift: (e) => !e.shiftKey,
|
10920 | alt: (e) => !e.altKey,
|
10921 | meta: (e) => !e.metaKey,
|
10922 | left: (e) => "button" in e && e.button !== 0,
|
10923 | middle: (e) => "button" in e && e.button !== 1,
|
10924 | right: (e) => "button" in e && e.button !== 2,
|
10925 | exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
10926 | };
|
10927 | const withModifiers = (fn, modifiers) => {
|
10928 | const cache = fn._withMods || (fn._withMods = {});
|
10929 | const cacheKey = modifiers.join(".");
|
10930 | return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
10931 | for (let i = 0; i < modifiers.length; i++) {
|
10932 | const guard = modifierGuards[modifiers[i]];
|
10933 | if (guard && guard(event, modifiers))
|
10934 | return;
|
10935 | }
|
10936 | return fn(event, ...args);
|
10937 | });
|
10938 | };
|
10939 | const keyNames = {
|
10940 | esc: "escape",
|
10941 | space: " ",
|
10942 | up: "arrow-up",
|
10943 | left: "arrow-left",
|
10944 | right: "arrow-right",
|
10945 | down: "arrow-down",
|
10946 | delete: "backspace"
|
10947 | };
|
10948 | const withKeys = (fn, modifiers) => {
|
10949 | const cache = fn._withKeys || (fn._withKeys = {});
|
10950 | const cacheKey = modifiers.join(".");
|
10951 | return cache[cacheKey] || (cache[cacheKey] = (event) => {
|
10952 | if (!("key" in event)) {
|
10953 | return;
|
10954 | }
|
10955 | const eventKey = hyphenate(event.key);
|
10956 | if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
|
10957 | return fn(event);
|
10958 | }
|
10959 | });
|
10960 | };
|
10961 |
|
10962 | const rendererOptions = extend({ patchProp }, nodeOps);
|
10963 | let renderer;
|
10964 | let enabledHydration = false;
|
10965 | function ensureRenderer() {
|
10966 | return renderer || (renderer = createRenderer(rendererOptions));
|
10967 | }
|
10968 | function ensureHydrationRenderer() {
|
10969 | renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
|
10970 | enabledHydration = true;
|
10971 | return renderer;
|
10972 | }
|
10973 | const render = (...args) => {
|
10974 | ensureRenderer().render(...args);
|
10975 | };
|
10976 | const hydrate = (...args) => {
|
10977 | ensureHydrationRenderer().hydrate(...args);
|
10978 | };
|
10979 | const createApp = (...args) => {
|
10980 | const app = ensureRenderer().createApp(...args);
|
10981 | {
|
10982 | injectNativeTagCheck(app);
|
10983 | injectCompilerOptionsCheck(app);
|
10984 | }
|
10985 | const { mount } = app;
|
10986 | app.mount = (containerOrSelector) => {
|
10987 | const container = normalizeContainer(containerOrSelector);
|
10988 | if (!container)
|
10989 | return;
|
10990 | const component = app._component;
|
10991 | if (!isFunction(component) && !component.render && !component.template) {
|
10992 | component.template = container.innerHTML;
|
10993 | }
|
10994 | container.innerHTML = "";
|
10995 | const proxy = mount(container, false, resolveRootNamespace(container));
|
10996 | if (container instanceof Element) {
|
10997 | container.removeAttribute("v-cloak");
|
10998 | container.setAttribute("data-v-app", "");
|
10999 | }
|
11000 | return proxy;
|
11001 | };
|
11002 | return app;
|
11003 | };
|
11004 | const createSSRApp = (...args) => {
|
11005 | const app = ensureHydrationRenderer().createApp(...args);
|
11006 | {
|
11007 | injectNativeTagCheck(app);
|
11008 | injectCompilerOptionsCheck(app);
|
11009 | }
|
11010 | const { mount } = app;
|
11011 | app.mount = (containerOrSelector) => {
|
11012 | const container = normalizeContainer(containerOrSelector);
|
11013 | if (container) {
|
11014 | return mount(container, true, resolveRootNamespace(container));
|
11015 | }
|
11016 | };
|
11017 | return app;
|
11018 | };
|
11019 | function resolveRootNamespace(container) {
|
11020 | if (container instanceof SVGElement) {
|
11021 | return "svg";
|
11022 | }
|
11023 | if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
|
11024 | return "mathml";
|
11025 | }
|
11026 | }
|
11027 | function injectNativeTagCheck(app) {
|
11028 | Object.defineProperty(app.config, "isNativeTag", {
|
11029 | value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
|
11030 | writable: false
|
11031 | });
|
11032 | }
|
11033 | function injectCompilerOptionsCheck(app) {
|
11034 | if (isRuntimeOnly()) {
|
11035 | const isCustomElement = app.config.isCustomElement;
|
11036 | Object.defineProperty(app.config, "isCustomElement", {
|
11037 | get() {
|
11038 | return isCustomElement;
|
11039 | },
|
11040 | set() {
|
11041 | warn(
|
11042 | `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
|
11043 | );
|
11044 | }
|
11045 | });
|
11046 | const compilerOptions = app.config.compilerOptions;
|
11047 | 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.
|
11048 | - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
|
11049 | - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
|
11050 | - 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`;
|
11051 | Object.defineProperty(app.config, "compilerOptions", {
|
11052 | get() {
|
11053 | warn(msg);
|
11054 | return compilerOptions;
|
11055 | },
|
11056 | set() {
|
11057 | warn(msg);
|
11058 | }
|
11059 | });
|
11060 | }
|
11061 | }
|
11062 | function normalizeContainer(container) {
|
11063 | if (isString(container)) {
|
11064 | const res = document.querySelector(container);
|
11065 | if (!res) {
|
11066 | warn(
|
11067 | `Failed to mount app: mount target selector "${container}" returned null.`
|
11068 | );
|
11069 | }
|
11070 | return res;
|
11071 | }
|
11072 | if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
|
11073 | warn(
|
11074 | `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
|
11075 | );
|
11076 | }
|
11077 | return container;
|
11078 | }
|
11079 | const initDirectivesForSSR = NOOP;
|
11080 |
|
11081 | function initDev() {
|
11082 | {
|
11083 | {
|
11084 | console.info(
|
11085 | `You are running a development build of Vue.
|
11086 | Make sure to use the production build (*.prod.js) when deploying for production.`
|
11087 | );
|
11088 | }
|
11089 | initCustomFormatter();
|
11090 | }
|
11091 | }
|
11092 |
|
11093 | {
|
11094 | initDev();
|
11095 | }
|
11096 | const compile = () => {
|
11097 | {
|
11098 | warn(
|
11099 | `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
11100 | );
|
11101 | }
|
11102 | };
|
11103 |
|
11104 | exports.BaseTransition = BaseTransition;
|
11105 | exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
11106 | exports.Comment = Comment;
|
11107 | exports.DeprecationTypes = DeprecationTypes;
|
11108 | exports.EffectScope = EffectScope;
|
11109 | exports.ErrorCodes = ErrorCodes;
|
11110 | exports.ErrorTypeStrings = ErrorTypeStrings;
|
11111 | exports.Fragment = Fragment;
|
11112 | exports.KeepAlive = KeepAlive;
|
11113 | exports.ReactiveEffect = ReactiveEffect;
|
11114 | exports.Static = Static;
|
11115 | exports.Suspense = Suspense;
|
11116 | exports.Teleport = Teleport;
|
11117 | exports.Text = Text;
|
11118 | exports.TrackOpTypes = TrackOpTypes;
|
11119 | exports.Transition = Transition;
|
11120 | exports.TransitionGroup = TransitionGroup;
|
11121 | exports.TriggerOpTypes = TriggerOpTypes;
|
11122 | exports.VueElement = VueElement;
|
11123 | exports.assertNumber = assertNumber;
|
11124 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
11125 | exports.callWithErrorHandling = callWithErrorHandling;
|
11126 | exports.camelize = camelize;
|
11127 | exports.capitalize = capitalize;
|
11128 | exports.cloneVNode = cloneVNode;
|
11129 | exports.compatUtils = compatUtils;
|
11130 | exports.compile = compile;
|
11131 | exports.computed = computed;
|
11132 | exports.createApp = createApp;
|
11133 | exports.createBlock = createBlock;
|
11134 | exports.createCommentVNode = createCommentVNode;
|
11135 | exports.createElementBlock = createElementBlock;
|
11136 | exports.createElementVNode = createBaseVNode;
|
11137 | exports.createHydrationRenderer = createHydrationRenderer;
|
11138 | exports.createPropsRestProxy = createPropsRestProxy;
|
11139 | exports.createRenderer = createRenderer;
|
11140 | exports.createSSRApp = createSSRApp;
|
11141 | exports.createSlots = createSlots;
|
11142 | exports.createStaticVNode = createStaticVNode;
|
11143 | exports.createTextVNode = createTextVNode;
|
11144 | exports.createVNode = createVNode;
|
11145 | exports.customRef = customRef;
|
11146 | exports.defineAsyncComponent = defineAsyncComponent;
|
11147 | exports.defineComponent = defineComponent;
|
11148 | exports.defineCustomElement = defineCustomElement;
|
11149 | exports.defineEmits = defineEmits;
|
11150 | exports.defineExpose = defineExpose;
|
11151 | exports.defineModel = defineModel;
|
11152 | exports.defineOptions = defineOptions;
|
11153 | exports.defineProps = defineProps;
|
11154 | exports.defineSSRCustomElement = defineSSRCustomElement;
|
11155 | exports.defineSlots = defineSlots;
|
11156 | exports.devtools = devtools;
|
11157 | exports.effect = effect;
|
11158 | exports.effectScope = effectScope;
|
11159 | exports.getCurrentInstance = getCurrentInstance;
|
11160 | exports.getCurrentScope = getCurrentScope;
|
11161 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
11162 | exports.guardReactiveProps = guardReactiveProps;
|
11163 | exports.h = h;
|
11164 | exports.handleError = handleError;
|
11165 | exports.hasInjectionContext = hasInjectionContext;
|
11166 | exports.hydrate = hydrate;
|
11167 | exports.initCustomFormatter = initCustomFormatter;
|
11168 | exports.initDirectivesForSSR = initDirectivesForSSR;
|
11169 | exports.inject = inject;
|
11170 | exports.isMemoSame = isMemoSame;
|
11171 | exports.isProxy = isProxy;
|
11172 | exports.isReactive = isReactive;
|
11173 | exports.isReadonly = isReadonly;
|
11174 | exports.isRef = isRef;
|
11175 | exports.isRuntimeOnly = isRuntimeOnly;
|
11176 | exports.isShallow = isShallow;
|
11177 | exports.isVNode = isVNode;
|
11178 | exports.markRaw = markRaw;
|
11179 | exports.mergeDefaults = mergeDefaults;
|
11180 | exports.mergeModels = mergeModels;
|
11181 | exports.mergeProps = mergeProps;
|
11182 | exports.nextTick = nextTick;
|
11183 | exports.normalizeClass = normalizeClass;
|
11184 | exports.normalizeProps = normalizeProps;
|
11185 | exports.normalizeStyle = normalizeStyle;
|
11186 | exports.onActivated = onActivated;
|
11187 | exports.onBeforeMount = onBeforeMount;
|
11188 | exports.onBeforeUnmount = onBeforeUnmount;
|
11189 | exports.onBeforeUpdate = onBeforeUpdate;
|
11190 | exports.onDeactivated = onDeactivated;
|
11191 | exports.onErrorCaptured = onErrorCaptured;
|
11192 | exports.onMounted = onMounted;
|
11193 | exports.onRenderTracked = onRenderTracked;
|
11194 | exports.onRenderTriggered = onRenderTriggered;
|
11195 | exports.onScopeDispose = onScopeDispose;
|
11196 | exports.onServerPrefetch = onServerPrefetch;
|
11197 | exports.onUnmounted = onUnmounted;
|
11198 | exports.onUpdated = onUpdated;
|
11199 | exports.openBlock = openBlock;
|
11200 | exports.popScopeId = popScopeId;
|
11201 | exports.provide = provide;
|
11202 | exports.proxyRefs = proxyRefs;
|
11203 | exports.pushScopeId = pushScopeId;
|
11204 | exports.queuePostFlushCb = queuePostFlushCb;
|
11205 | exports.reactive = reactive;
|
11206 | exports.readonly = readonly;
|
11207 | exports.ref = ref;
|
11208 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
11209 | exports.render = render;
|
11210 | exports.renderList = renderList;
|
11211 | exports.renderSlot = renderSlot;
|
11212 | exports.resolveComponent = resolveComponent;
|
11213 | exports.resolveDirective = resolveDirective;
|
11214 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
11215 | exports.resolveFilter = resolveFilter;
|
11216 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
11217 | exports.setBlockTracking = setBlockTracking;
|
11218 | exports.setDevtoolsHook = setDevtoolsHook;
|
11219 | exports.setTransitionHooks = setTransitionHooks;
|
11220 | exports.shallowReactive = shallowReactive;
|
11221 | exports.shallowReadonly = shallowReadonly;
|
11222 | exports.shallowRef = shallowRef;
|
11223 | exports.ssrContextKey = ssrContextKey;
|
11224 | exports.ssrUtils = ssrUtils;
|
11225 | exports.stop = stop;
|
11226 | exports.toDisplayString = toDisplayString;
|
11227 | exports.toHandlerKey = toHandlerKey;
|
11228 | exports.toHandlers = toHandlers;
|
11229 | exports.toRaw = toRaw;
|
11230 | exports.toRef = toRef;
|
11231 | exports.toRefs = toRefs;
|
11232 | exports.toValue = toValue;
|
11233 | exports.transformVNodeArgs = transformVNodeArgs;
|
11234 | exports.triggerRef = triggerRef;
|
11235 | exports.unref = unref;
|
11236 | exports.useAttrs = useAttrs;
|
11237 | exports.useCssModule = useCssModule;
|
11238 | exports.useCssVars = useCssVars;
|
11239 | exports.useModel = useModel;
|
11240 | exports.useSSRContext = useSSRContext;
|
11241 | exports.useSlots = useSlots;
|
11242 | exports.useTransitionState = useTransitionState;
|
11243 | exports.vModelCheckbox = vModelCheckbox;
|
11244 | exports.vModelDynamic = vModelDynamic;
|
11245 | exports.vModelRadio = vModelRadio;
|
11246 | exports.vModelSelect = vModelSelect;
|
11247 | exports.vModelText = vModelText;
|
11248 | exports.vShow = vShow;
|
11249 | exports.version = version;
|
11250 | exports.warn = warn;
|
11251 | exports.watch = watch;
|
11252 | exports.watchEffect = watchEffect;
|
11253 | exports.watchPostEffect = watchPostEffect;
|
11254 | exports.watchSyncEffect = watchSyncEffect;
|
11255 | exports.withAsyncContext = withAsyncContext;
|
11256 | exports.withCtx = withCtx;
|
11257 | exports.withDefaults = withDefaults;
|
11258 | exports.withDirectives = withDirectives;
|
11259 | exports.withKeys = withKeys;
|
11260 | exports.withMemo = withMemo;
|
11261 | exports.withModifiers = withModifiers;
|
11262 | exports.withScopeId = withScopeId;
|
11263 |
|
11264 | return exports;
|
11265 |
|
11266 | })({});
|