@fortawesome/vue-fontawesome 3.0.0-1 → 3.0.0-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.es.js CHANGED
@@ -1,3391 +1,7 @@
1
+ import { h, defineComponent, computed, watch } from 'vue';
1
2
  import { parse, icon, config, text } from '@fortawesome/fontawesome-svg-core';
2
3
 
3
- /**
4
- * Make a map and return a function for checking if a key
5
- * is in that map.
6
- * IMPORTANT: all calls of this function must be prefixed with
7
- * \/\*#\_\_PURE\_\_\*\/
8
- * So that rollup can tree-shake them if necessary.
9
- */
10
- function makeMap(str, expectsLowerCase) {
11
- const map = Object.create(null);
12
- const list = str.split(',');
13
- for (let i = 0; i < list.length; i++) {
14
- map[list[i]] = true;
15
- }
16
- return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
17
- }
18
-
19
- const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
20
- 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
21
- 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl';
22
- const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
23
-
24
- /**
25
- * On the client we only need to offer special cases for boolean attributes that
26
- * have different names from their corresponding dom properties:
27
- * - itemscope -> N/A
28
- * - allowfullscreen -> allowFullscreen
29
- * - formnovalidate -> formNoValidate
30
- * - ismap -> isMap
31
- * - nomodule -> noModule
32
- * - novalidate -> noValidate
33
- * - readonly -> readOnly
34
- */
35
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
36
- const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
37
- /**
38
- * The full list is needed during SSR to produce the correct initial markup.
39
- */
40
- const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
41
- `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
42
- `loop,open,required,reversed,scoped,seamless,` +
43
- `checked,muted,multiple,selected`);
44
- /**
45
- * CSS properties that accept plain numbers
46
- */
47
- const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
48
- `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
49
- `columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
50
- `grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
51
- `grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
52
- `line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
53
- // SVG
54
- `fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
55
- `stroke-miterlimit,stroke-opacity,stroke-width`);
56
- /**
57
- * Known attributes, this is used for stringification of runtime static nodes
58
- * so that we don't stringify bindings that cannot be set from HTML.
59
- * Don't also forget to allow `data-*` and `aria-*`!
60
- * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
61
- */
62
- const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
63
- `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
64
- `border,buffered,capture,challenge,charset,checked,cite,class,code,` +
65
- `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
66
- `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
67
- `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
68
- `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
69
- `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
70
- `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
71
- `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
72
- `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
73
- `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
74
- `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
75
- `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
76
- `value,width,wrap`);
77
-
78
- function normalizeStyle(value) {
79
- if (isArray(value)) {
80
- const res = {};
81
- for (let i = 0; i < value.length; i++) {
82
- const item = value[i];
83
- const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
84
- if (normalized) {
85
- for (const key in normalized) {
86
- res[key] = normalized[key];
87
- }
88
- }
89
- }
90
- return res;
91
- }
92
- else if (isObject(value)) {
93
- return value;
94
- }
95
- }
96
- const listDelimiterRE = /;(?![^(]*\))/g;
97
- const propertyDelimiterRE = /:(.+)/;
98
- function parseStringStyle(cssText) {
99
- const ret = {};
100
- cssText.split(listDelimiterRE).forEach(item => {
101
- if (item) {
102
- const tmp = item.split(propertyDelimiterRE);
103
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
104
- }
105
- });
106
- return ret;
107
- }
108
- function normalizeClass(value) {
109
- let res = '';
110
- if (isString(value)) {
111
- res = value;
112
- }
113
- else if (isArray(value)) {
114
- for (let i = 0; i < value.length; i++) {
115
- res += normalizeClass(value[i]) + ' ';
116
- }
117
- }
118
- else if (isObject(value)) {
119
- for (const name in value) {
120
- if (value[name]) {
121
- res += name + ' ';
122
- }
123
- }
124
- }
125
- return res.trim();
126
- }
127
-
128
- // These tag configs are shared between compiler-dom and runtime-dom, so they
129
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
130
- const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
131
- 'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
132
- 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
133
- 'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
134
- 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
135
- 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
136
- 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
137
- 'option,output,progress,select,textarea,details,dialog,menu,' +
138
- 'summary,template,blockquote,iframe,tfoot';
139
- // https://developer.mozilla.org/en-US/docs/Web/SVG/Element
140
- const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
141
- 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
142
- 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
143
- 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
144
- 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
145
- 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
146
- 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
147
- 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
148
- 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
149
- 'text,textPath,title,tspan,unknown,use,view';
150
- const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
151
- const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
152
- const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
153
- const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
154
- const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
155
- ? Object.freeze({})
156
- : {};
157
- const EMPTY_ARR = [];
158
- const NOOP = () => { };
159
- const onRE = /^on[^a-z]/;
160
- const isOn = (key) => onRE.test(key);
161
- const isModelListener = (key) => key.startsWith('onUpdate:');
162
- const extend = Object.assign;
163
- const remove = (arr, el) => {
164
- const i = arr.indexOf(el);
165
- if (i > -1) {
166
- arr.splice(i, 1);
167
- }
168
- };
169
- const hasOwnProperty = Object.prototype.hasOwnProperty;
170
- const hasOwn = (val, key) => hasOwnProperty.call(val, key);
171
- const isArray = Array.isArray;
172
- const isFunction = (val) => typeof val === 'function';
173
- const isString = (val) => typeof val === 'string';
174
- const isSymbol = (val) => typeof val === 'symbol';
175
- const isObject = (val) => val !== null && typeof val === 'object';
176
- const isPromise = (val) => {
177
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
178
- };
179
- const objectToString = Object.prototype.toString;
180
- const toTypeString = (value) => objectToString.call(value);
181
- const toRawType = (value) => {
182
- return toTypeString(value).slice(8, -1);
183
- };
184
- const isReservedProp = /*#__PURE__*/ makeMap('key,ref,' +
185
- 'onVnodeBeforeMount,onVnodeMounted,' +
186
- 'onVnodeBeforeUpdate,onVnodeUpdated,' +
187
- 'onVnodeBeforeUnmount,onVnodeUnmounted');
188
- const cacheStringFunction = (fn) => {
189
- const cache = Object.create(null);
190
- return ((str) => {
191
- const hit = cache[str];
192
- return hit || (cache[str] = fn(str));
193
- });
194
- };
195
- const camelizeRE = /-(\w)/g;
196
- /**
197
- * @private
198
- */
199
- const camelize = cacheStringFunction((str) => {
200
- return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
201
- });
202
- const hyphenateRE = /\B([A-Z])/g;
203
- /**
204
- * @private
205
- */
206
- const hyphenate = cacheStringFunction((str) => {
207
- return str.replace(hyphenateRE, '-$1').toLowerCase();
208
- });
209
- /**
210
- * @private
211
- */
212
- const capitalize = cacheStringFunction((str) => {
213
- return str.charAt(0).toUpperCase() + str.slice(1);
214
- });
215
- // compare whether a value has changed, accounting for NaN.
216
- const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
217
- const def = (obj, key, value) => {
218
- Object.defineProperty(obj, key, {
219
- configurable: true,
220
- enumerable: false,
221
- value
222
- });
223
- };
224
- const toNumber = (val) => {
225
- const n = parseFloat(val);
226
- return isNaN(n) ? val : n;
227
- };
228
- let _globalThis;
229
- const getGlobalThis = () => {
230
- return (_globalThis ||
231
- (_globalThis =
232
- typeof globalThis !== 'undefined'
233
- ? globalThis
234
- : typeof self !== 'undefined'
235
- ? self
236
- : typeof window !== 'undefined'
237
- ? window
238
- : typeof global !== 'undefined'
239
- ? global
240
- : {}));
241
- };
242
-
243
- const targetMap = new WeakMap();
244
- const effectStack = [];
245
- let activeEffect;
246
- const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
247
- const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
248
- function isEffect(fn) {
249
- return fn && fn._isEffect === true;
250
- }
251
- function effect(fn, options = EMPTY_OBJ) {
252
- if (isEffect(fn)) {
253
- fn = fn.raw;
254
- }
255
- const effect = createReactiveEffect(fn, options);
256
- if (!options.lazy) {
257
- effect();
258
- }
259
- return effect;
260
- }
261
- function stop(effect) {
262
- if (effect.active) {
263
- cleanup(effect);
264
- if (effect.options.onStop) {
265
- effect.options.onStop();
266
- }
267
- effect.active = false;
268
- }
269
- }
270
- let uid = 0;
271
- function createReactiveEffect(fn, options) {
272
- const effect = function reactiveEffect() {
273
- if (!effect.active) {
274
- return options.scheduler ? undefined : fn();
275
- }
276
- if (!effectStack.includes(effect)) {
277
- cleanup(effect);
278
- try {
279
- enableTracking();
280
- effectStack.push(effect);
281
- activeEffect = effect;
282
- return fn();
283
- }
284
- finally {
285
- effectStack.pop();
286
- resetTracking();
287
- activeEffect = effectStack[effectStack.length - 1];
288
- }
289
- }
290
- };
291
- effect.id = uid++;
292
- effect._isEffect = true;
293
- effect.active = true;
294
- effect.raw = fn;
295
- effect.deps = [];
296
- effect.options = options;
297
- return effect;
298
- }
299
- function cleanup(effect) {
300
- const { deps } = effect;
301
- if (deps.length) {
302
- for (let i = 0; i < deps.length; i++) {
303
- deps[i].delete(effect);
304
- }
305
- deps.length = 0;
306
- }
307
- }
308
- let shouldTrack = true;
309
- const trackStack = [];
310
- function pauseTracking() {
311
- trackStack.push(shouldTrack);
312
- shouldTrack = false;
313
- }
314
- function enableTracking() {
315
- trackStack.push(shouldTrack);
316
- shouldTrack = true;
317
- }
318
- function resetTracking() {
319
- const last = trackStack.pop();
320
- shouldTrack = last === undefined ? true : last;
321
- }
322
- function track(target, type, key) {
323
- if (!shouldTrack || activeEffect === undefined) {
324
- return;
325
- }
326
- let depsMap = targetMap.get(target);
327
- if (!depsMap) {
328
- targetMap.set(target, (depsMap = new Map()));
329
- }
330
- let dep = depsMap.get(key);
331
- if (!dep) {
332
- depsMap.set(key, (dep = new Set()));
333
- }
334
- if (!dep.has(activeEffect)) {
335
- dep.add(activeEffect);
336
- activeEffect.deps.push(dep);
337
- if ((process.env.NODE_ENV !== 'production') && activeEffect.options.onTrack) {
338
- activeEffect.options.onTrack({
339
- effect: activeEffect,
340
- target,
341
- type,
342
- key
343
- });
344
- }
345
- }
346
- }
347
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
348
- const depsMap = targetMap.get(target);
349
- if (!depsMap) {
350
- // never been tracked
351
- return;
352
- }
353
- const effects = new Set();
354
- const add = (effectsToAdd) => {
355
- if (effectsToAdd) {
356
- effectsToAdd.forEach(effect => {
357
- if (effect !== activeEffect) {
358
- effects.add(effect);
359
- }
360
- });
361
- }
362
- };
363
- if (type === "clear" /* CLEAR */) {
364
- // collection being cleared
365
- // trigger all effects for target
366
- depsMap.forEach(add);
367
- }
368
- else if (key === 'length' && isArray(target)) {
369
- depsMap.forEach((dep, key) => {
370
- if (key === 'length' || key >= newValue) {
371
- add(dep);
372
- }
373
- });
374
- }
375
- else {
376
- // schedule runs for SET | ADD | DELETE
377
- if (key !== void 0) {
378
- add(depsMap.get(key));
379
- }
380
- // also run for iteration key on ADD | DELETE | Map.SET
381
- const isAddOrDelete = type === "add" /* ADD */ ||
382
- (type === "delete" /* DELETE */ && !isArray(target));
383
- if (isAddOrDelete ||
384
- (type === "set" /* SET */ && target instanceof Map)) {
385
- add(depsMap.get(isArray(target) ? 'length' : ITERATE_KEY));
386
- }
387
- if (isAddOrDelete && target instanceof Map) {
388
- add(depsMap.get(MAP_KEY_ITERATE_KEY));
389
- }
390
- }
391
- const run = (effect) => {
392
- if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) {
393
- effect.options.onTrigger({
394
- effect,
395
- target,
396
- key,
397
- type,
398
- newValue,
399
- oldValue,
400
- oldTarget
401
- });
402
- }
403
- if (effect.options.scheduler) {
404
- effect.options.scheduler(effect);
405
- }
406
- else {
407
- effect();
408
- }
409
- };
410
- effects.forEach(run);
411
- }
412
-
413
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
414
- .map(key => Symbol[key])
415
- .filter(isSymbol));
416
- const get = /*#__PURE__*/ createGetter();
417
- const shallowGet = /*#__PURE__*/ createGetter(false, true);
418
- const readonlyGet = /*#__PURE__*/ createGetter(true);
419
- const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
420
- const arrayInstrumentations = {};
421
- ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
422
- arrayInstrumentations[key] = function (...args) {
423
- const arr = toRaw(this);
424
- for (let i = 0, l = this.length; i < l; i++) {
425
- track(arr, "get" /* GET */, i + '');
426
- }
427
- // we run the method using the original args first (which may be reactive)
428
- const res = arr[key](...args);
429
- if (res === -1 || res === false) {
430
- // if that didn't work, run it again using raw values.
431
- return arr[key](...args.map(toRaw));
432
- }
433
- else {
434
- return res;
435
- }
436
- };
437
- });
438
- function createGetter(isReadonly = false, shallow = false) {
439
- return function get(target, key, receiver) {
440
- if (key === "__v_isReactive" /* IS_REACTIVE */) {
441
- return !isReadonly;
442
- }
443
- else if (key === "__v_isReadonly" /* IS_READONLY */) {
444
- return isReadonly;
445
- }
446
- else if (key === "__v_raw" /* RAW */ &&
447
- receiver ===
448
- (isReadonly
449
- ? target["__v_readonly" /* READONLY */]
450
- : target["__v_reactive" /* REACTIVE */])) {
451
- return target;
452
- }
453
- const targetIsArray = isArray(target);
454
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
455
- return Reflect.get(arrayInstrumentations, key, receiver);
456
- }
457
- const res = Reflect.get(target, key, receiver);
458
- if (isSymbol(key)
459
- ? builtInSymbols.has(key)
460
- : key === `__proto__` || key === `__v_isRef`) {
461
- return res;
462
- }
463
- if (!isReadonly) {
464
- track(target, "get" /* GET */, key);
465
- }
466
- if (shallow) {
467
- return res;
468
- }
469
- if (isRef(res)) {
470
- // ref unwrapping, only for Objects, not for Arrays.
471
- return targetIsArray ? res : res.value;
472
- }
473
- if (isObject(res)) {
474
- // Convert returned value into a proxy as well. we do the isObject check
475
- // here to avoid invalid value warning. Also need to lazy access readonly
476
- // and reactive here to avoid circular dependency.
477
- return isReadonly ? readonly(res) : reactive(res);
478
- }
479
- return res;
480
- };
481
- }
482
- const set = /*#__PURE__*/ createSetter();
483
- const shallowSet = /*#__PURE__*/ createSetter(true);
484
- function createSetter(shallow = false) {
485
- return function set(target, key, value, receiver) {
486
- const oldValue = target[key];
487
- if (!shallow) {
488
- value = toRaw(value);
489
- if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
490
- oldValue.value = value;
491
- return true;
492
- }
493
- }
494
- const hadKey = hasOwn(target, key);
495
- const result = Reflect.set(target, key, value, receiver);
496
- // don't trigger if target is something up in the prototype chain of original
497
- if (target === toRaw(receiver)) {
498
- if (!hadKey) {
499
- trigger(target, "add" /* ADD */, key, value);
500
- }
501
- else if (hasChanged(value, oldValue)) {
502
- trigger(target, "set" /* SET */, key, value, oldValue);
503
- }
504
- }
505
- return result;
506
- };
507
- }
508
- function deleteProperty(target, key) {
509
- const hadKey = hasOwn(target, key);
510
- const oldValue = target[key];
511
- const result = Reflect.deleteProperty(target, key);
512
- if (result && hadKey) {
513
- trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
514
- }
515
- return result;
516
- }
517
- function has(target, key) {
518
- const result = Reflect.has(target, key);
519
- if (!isSymbol(key) || !builtInSymbols.has(key)) {
520
- track(target, "has" /* HAS */, key);
521
- }
522
- return result;
523
- }
524
- function ownKeys(target) {
525
- track(target, "iterate" /* ITERATE */, ITERATE_KEY);
526
- return Reflect.ownKeys(target);
527
- }
528
- const mutableHandlers = {
529
- get,
530
- set,
531
- deleteProperty,
532
- has,
533
- ownKeys
534
- };
535
- const readonlyHandlers = {
536
- get: readonlyGet,
537
- has,
538
- ownKeys,
539
- set(target, key) {
540
- if ((process.env.NODE_ENV !== 'production')) {
541
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
542
- }
543
- return true;
544
- },
545
- deleteProperty(target, key) {
546
- if ((process.env.NODE_ENV !== 'production')) {
547
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
548
- }
549
- return true;
550
- }
551
- };
552
- const shallowReactiveHandlers = extend({}, mutableHandlers, {
553
- get: shallowGet,
554
- set: shallowSet
555
- });
556
- // Props handlers are special in the sense that it should not unwrap top-level
557
- // refs (in order to allow refs to be explicitly passed down), but should
558
- // retain the reactivity of the normal readonly object.
559
- const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
560
- get: shallowReadonlyGet
561
- });
562
-
563
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
564
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
565
- const toShallow = (value) => value;
566
- const getProto = (v) => Reflect.getPrototypeOf(v);
567
- function get$1(target, key, isReadonly = false, isShallow = false) {
568
- // #1772: readonly(reactive(Map)) should return readonly + reactive version
569
- // of the value
570
- target = target["__v_raw" /* RAW */];
571
- const rawTarget = toRaw(target);
572
- const rawKey = toRaw(key);
573
- if (key !== rawKey) {
574
- !isReadonly && track(rawTarget, "get" /* GET */, key);
575
- }
576
- !isReadonly && track(rawTarget, "get" /* GET */, rawKey);
577
- const { has } = getProto(rawTarget);
578
- const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
579
- if (has.call(rawTarget, key)) {
580
- return wrap(target.get(key));
581
- }
582
- else if (has.call(rawTarget, rawKey)) {
583
- return wrap(target.get(rawKey));
584
- }
585
- }
586
- function has$1(key, isReadonly = false) {
587
- const target = this["__v_raw" /* RAW */];
588
- const rawTarget = toRaw(target);
589
- const rawKey = toRaw(key);
590
- if (key !== rawKey) {
591
- !isReadonly && track(rawTarget, "has" /* HAS */, key);
592
- }
593
- !isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
594
- return target.has(key) || target.has(rawKey);
595
- }
596
- function size(target, isReadonly = false) {
597
- target = target["__v_raw" /* RAW */];
598
- !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
599
- return Reflect.get(target, 'size', target);
600
- }
601
- function add(value) {
602
- value = toRaw(value);
603
- const target = toRaw(this);
604
- const proto = getProto(target);
605
- const hadKey = proto.has.call(target, value);
606
- const result = proto.add.call(target, value);
607
- if (!hadKey) {
608
- trigger(target, "add" /* ADD */, value, value);
609
- }
610
- return result;
611
- }
612
- function set$1(key, value) {
613
- value = toRaw(value);
614
- const target = toRaw(this);
615
- const { has, get, set } = getProto(target);
616
- let hadKey = has.call(target, key);
617
- if (!hadKey) {
618
- key = toRaw(key);
619
- hadKey = has.call(target, key);
620
- }
621
- else if ((process.env.NODE_ENV !== 'production')) {
622
- checkIdentityKeys(target, has, key);
623
- }
624
- const oldValue = get.call(target, key);
625
- const result = set.call(target, key, value);
626
- if (!hadKey) {
627
- trigger(target, "add" /* ADD */, key, value);
628
- }
629
- else if (hasChanged(value, oldValue)) {
630
- trigger(target, "set" /* SET */, key, value, oldValue);
631
- }
632
- return result;
633
- }
634
- function deleteEntry(key) {
635
- const target = toRaw(this);
636
- const { has, get, delete: del } = getProto(target);
637
- let hadKey = has.call(target, key);
638
- if (!hadKey) {
639
- key = toRaw(key);
640
- hadKey = has.call(target, key);
641
- }
642
- else if ((process.env.NODE_ENV !== 'production')) {
643
- checkIdentityKeys(target, has, key);
644
- }
645
- const oldValue = get ? get.call(target, key) : undefined;
646
- // forward the operation before queueing reactions
647
- const result = del.call(target, key);
648
- if (hadKey) {
649
- trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
650
- }
651
- return result;
652
- }
653
- function clear() {
654
- const target = toRaw(this);
655
- const hadItems = target.size !== 0;
656
- const oldTarget = (process.env.NODE_ENV !== 'production')
657
- ? target instanceof Map
658
- ? new Map(target)
659
- : new Set(target)
660
- : undefined;
661
- // forward the operation before queueing reactions
662
- const result = getProto(target).clear.call(target);
663
- if (hadItems) {
664
- trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
665
- }
666
- return result;
667
- }
668
- function createForEach(isReadonly, isShallow) {
669
- return function forEach(callback, thisArg) {
670
- const observed = this;
671
- const target = toRaw(observed);
672
- const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
673
- !isReadonly && track(target, "iterate" /* ITERATE */, ITERATE_KEY);
674
- // important: create sure the callback is
675
- // 1. invoked with the reactive map as `this` and 3rd arg
676
- // 2. the value received should be a corresponding reactive/readonly.
677
- function wrappedCallback(value, key) {
678
- return callback.call(thisArg, wrap(value), wrap(key), observed);
679
- }
680
- return getProto(target).forEach.call(target, wrappedCallback);
681
- };
682
- }
683
- function createIterableMethod(method, isReadonly, isShallow) {
684
- return function (...args) {
685
- const target = this["__v_raw" /* RAW */];
686
- const rawTarget = toRaw(target);
687
- const isMap = rawTarget instanceof Map;
688
- const isPair = method === 'entries' || (method === Symbol.iterator && isMap);
689
- const isKeyOnly = method === 'keys' && isMap;
690
- const innerIterator = target[method](...args);
691
- const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
692
- !isReadonly &&
693
- track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
694
- // return a wrapped iterator which returns observed versions of the
695
- // values emitted from the real iterator
696
- return {
697
- // iterator protocol
698
- next() {
699
- const { value, done } = innerIterator.next();
700
- return done
701
- ? { value, done }
702
- : {
703
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
704
- done
705
- };
706
- },
707
- // iterable protocol
708
- [Symbol.iterator]() {
709
- return this;
710
- }
711
- };
712
- };
713
- }
714
- function createReadonlyMethod(type) {
715
- return function (...args) {
716
- if ((process.env.NODE_ENV !== 'production')) {
717
- const key = args[0] ? `on key "${args[0]}" ` : ``;
718
- console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
719
- }
720
- return type === "delete" /* DELETE */ ? false : this;
721
- };
722
- }
723
- const mutableInstrumentations = {
724
- get(key) {
725
- return get$1(this, key);
726
- },
727
- get size() {
728
- return size(this);
729
- },
730
- has: has$1,
731
- add,
732
- set: set$1,
733
- delete: deleteEntry,
734
- clear,
735
- forEach: createForEach(false, false)
736
- };
737
- const shallowInstrumentations = {
738
- get(key) {
739
- return get$1(this, key, false, true);
740
- },
741
- get size() {
742
- return size(this);
743
- },
744
- has: has$1,
745
- add,
746
- set: set$1,
747
- delete: deleteEntry,
748
- clear,
749
- forEach: createForEach(false, true)
750
- };
751
- const readonlyInstrumentations = {
752
- get(key) {
753
- return get$1(this, key, true);
754
- },
755
- get size() {
756
- return size(this, true);
757
- },
758
- has(key) {
759
- return has$1.call(this, key, true);
760
- },
761
- add: createReadonlyMethod("add" /* ADD */),
762
- set: createReadonlyMethod("set" /* SET */),
763
- delete: createReadonlyMethod("delete" /* DELETE */),
764
- clear: createReadonlyMethod("clear" /* CLEAR */),
765
- forEach: createForEach(true, false)
766
- };
767
- const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
768
- iteratorMethods.forEach(method => {
769
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
770
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
771
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
772
- });
773
- function createInstrumentationGetter(isReadonly, shallow) {
774
- const instrumentations = shallow
775
- ? shallowInstrumentations
776
- : isReadonly
777
- ? readonlyInstrumentations
778
- : mutableInstrumentations;
779
- return (target, key, receiver) => {
780
- if (key === "__v_isReactive" /* IS_REACTIVE */) {
781
- return !isReadonly;
782
- }
783
- else if (key === "__v_isReadonly" /* IS_READONLY */) {
784
- return isReadonly;
785
- }
786
- else if (key === "__v_raw" /* RAW */) {
787
- return target;
788
- }
789
- return Reflect.get(hasOwn(instrumentations, key) && key in target
790
- ? instrumentations
791
- : target, key, receiver);
792
- };
793
- }
794
- const mutableCollectionHandlers = {
795
- get: createInstrumentationGetter(false, false)
796
- };
797
- const readonlyCollectionHandlers = {
798
- get: createInstrumentationGetter(true, false)
799
- };
800
- function checkIdentityKeys(target, has, key) {
801
- const rawKey = toRaw(key);
802
- if (rawKey !== key && has.call(target, rawKey)) {
803
- const type = toRawType(target);
804
- console.warn(`Reactive ${type} contains both the raw and reactive ` +
805
- `versions of the same object${type === `Map` ? `as keys` : ``}, ` +
806
- `which can lead to inconsistencies. ` +
807
- `Avoid differentiating between the raw and reactive versions ` +
808
- `of an object and only use the reactive version if possible.`);
809
- }
810
- }
811
-
812
- function targetTypeMap(rawType) {
813
- switch (rawType) {
814
- case 'Object':
815
- case 'Array':
816
- return 1 /* COMMON */;
817
- case 'Map':
818
- case 'Set':
819
- case 'WeakMap':
820
- case 'WeakSet':
821
- return 2 /* COLLECTION */;
822
- default:
823
- return 0 /* INVALID */;
824
- }
825
- }
826
- function getTargetType(value) {
827
- return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
828
- ? 0 /* INVALID */
829
- : targetTypeMap(toRawType(value));
830
- }
831
- function reactive(target) {
832
- // if trying to observe a readonly proxy, return the readonly version.
833
- if (target && target["__v_isReadonly" /* IS_READONLY */]) {
834
- return target;
835
- }
836
- return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
837
- }
838
- function readonly(target) {
839
- return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
840
- }
841
- // Return a reactive-copy of the original object, where only the root level
842
- // properties are readonly, and does NOT unwrap refs nor recursively convert
843
- // returned properties.
844
- // This is used for creating the props proxy object for stateful components.
845
- function shallowReadonly(target) {
846
- return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
847
- }
848
- function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
849
- if (!isObject(target)) {
850
- if ((process.env.NODE_ENV !== 'production')) {
851
- console.warn(`value cannot be made reactive: ${String(target)}`);
852
- }
853
- return target;
854
- }
855
- // target is already a Proxy, return it.
856
- // exception: calling readonly() on a reactive object
857
- if (target["__v_raw" /* RAW */] &&
858
- !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
859
- return target;
860
- }
861
- // target already has corresponding Proxy
862
- const reactiveFlag = isReadonly
863
- ? "__v_readonly" /* READONLY */
864
- : "__v_reactive" /* REACTIVE */;
865
- if (hasOwn(target, reactiveFlag)) {
866
- return target[reactiveFlag];
867
- }
868
- // only a whitelist of value types can be observed.
869
- const targetType = getTargetType(target);
870
- if (targetType === 0 /* INVALID */) {
871
- return target;
872
- }
873
- const observed = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
874
- def(target, reactiveFlag, observed);
875
- return observed;
876
- }
877
- function isReactive(value) {
878
- if (isReadonly(value)) {
879
- return isReactive(value["__v_raw" /* RAW */]);
880
- }
881
- return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
882
- }
883
- function isReadonly(value) {
884
- return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
885
- }
886
- function isProxy(value) {
887
- return isReactive(value) || isReadonly(value);
888
- }
889
- function toRaw(observed) {
890
- return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
891
- }
892
- function isRef(r) {
893
- return r ? r.__v_isRef === true : false;
894
- }
895
-
896
- const stack = [];
897
- function pushWarningContext(vnode) {
898
- stack.push(vnode);
899
- }
900
- function popWarningContext() {
901
- stack.pop();
902
- }
903
- function warn(msg, ...args) {
904
- // avoid props formatting or warn handler tracking deps that might be mutated
905
- // during patch, leading to infinite recursion.
906
- pauseTracking();
907
- const instance = stack.length ? stack[stack.length - 1].component : null;
908
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
909
- const trace = getComponentTrace();
910
- if (appWarnHandler) {
911
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
912
- msg + args.join(''),
913
- instance && instance.proxy,
914
- trace
915
- .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
916
- .join('\n'),
917
- trace
918
- ]);
919
- }
920
- else {
921
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
922
- /* istanbul ignore if */
923
- if (trace.length &&
924
- // avoid spamming console during tests
925
- !false) {
926
- warnArgs.push(`\n`, ...formatTrace(trace));
927
- }
928
- console.warn(...warnArgs);
929
- }
930
- resetTracking();
931
- }
932
- function getComponentTrace() {
933
- let currentVNode = stack[stack.length - 1];
934
- if (!currentVNode) {
935
- return [];
936
- }
937
- // we can't just use the stack because it will be incomplete during updates
938
- // that did not start from the root. Re-construct the parent chain using
939
- // instance parent pointers.
940
- const normalizedStack = [];
941
- while (currentVNode) {
942
- const last = normalizedStack[0];
943
- if (last && last.vnode === currentVNode) {
944
- last.recurseCount++;
945
- }
946
- else {
947
- normalizedStack.push({
948
- vnode: currentVNode,
949
- recurseCount: 0
950
- });
951
- }
952
- const parentInstance = currentVNode.component && currentVNode.component.parent;
953
- currentVNode = parentInstance && parentInstance.vnode;
954
- }
955
- return normalizedStack;
956
- }
957
- /* istanbul ignore next */
958
- function formatTrace(trace) {
959
- const logs = [];
960
- trace.forEach((entry, i) => {
961
- logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
962
- });
963
- return logs;
964
- }
965
- function formatTraceEntry({ vnode, recurseCount }) {
966
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
967
- const isRoot = vnode.component ? vnode.component.parent == null : false;
968
- const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
969
- const close = `>` + postfix;
970
- return vnode.props
971
- ? [open, ...formatProps(vnode.props), close]
972
- : [open + close];
973
- }
974
- /* istanbul ignore next */
975
- function formatProps(props) {
976
- const res = [];
977
- const keys = Object.keys(props);
978
- keys.slice(0, 3).forEach(key => {
979
- res.push(...formatProp(key, props[key]));
980
- });
981
- if (keys.length > 3) {
982
- res.push(` ...`);
983
- }
984
- return res;
985
- }
986
- /* istanbul ignore next */
987
- function formatProp(key, value, raw) {
988
- if (isString(value)) {
989
- value = JSON.stringify(value);
990
- return raw ? value : [`${key}=${value}`];
991
- }
992
- else if (typeof value === 'number' ||
993
- typeof value === 'boolean' ||
994
- value == null) {
995
- return raw ? value : [`${key}=${value}`];
996
- }
997
- else if (isRef(value)) {
998
- value = formatProp(key, toRaw(value.value), true);
999
- return raw ? value : [`${key}=Ref<`, value, `>`];
1000
- }
1001
- else if (isFunction(value)) {
1002
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1003
- }
1004
- else {
1005
- value = toRaw(value);
1006
- return raw ? value : [`${key}=`, value];
1007
- }
1008
- }
1009
-
1010
- const ErrorTypeStrings = {
1011
- ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
1012
- ["c" /* CREATED */]: 'created hook',
1013
- ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
1014
- ["m" /* MOUNTED */]: 'mounted hook',
1015
- ["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
1016
- ["u" /* UPDATED */]: 'updated',
1017
- ["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
1018
- ["um" /* UNMOUNTED */]: 'unmounted hook',
1019
- ["a" /* ACTIVATED */]: 'activated hook',
1020
- ["da" /* DEACTIVATED */]: 'deactivated hook',
1021
- ["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
1022
- ["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
1023
- ["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
1024
- [0 /* SETUP_FUNCTION */]: 'setup function',
1025
- [1 /* RENDER_FUNCTION */]: 'render function',
1026
- [2 /* WATCH_GETTER */]: 'watcher getter',
1027
- [3 /* WATCH_CALLBACK */]: 'watcher callback',
1028
- [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
1029
- [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
1030
- [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
1031
- [7 /* VNODE_HOOK */]: 'vnode hook',
1032
- [8 /* DIRECTIVE_HOOK */]: 'directive hook',
1033
- [9 /* TRANSITION_HOOK */]: 'transition hook',
1034
- [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
1035
- [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
1036
- [12 /* FUNCTION_REF */]: 'ref function',
1037
- [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1038
- [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1039
- 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
1040
- };
1041
- function callWithErrorHandling(fn, instance, type, args) {
1042
- let res;
1043
- try {
1044
- res = args ? fn(...args) : fn();
1045
- }
1046
- catch (err) {
1047
- handleError(err, instance, type);
1048
- }
1049
- return res;
1050
- }
1051
- function callWithAsyncErrorHandling(fn, instance, type, args) {
1052
- if (isFunction(fn)) {
1053
- const res = callWithErrorHandling(fn, instance, type, args);
1054
- if (res && isPromise(res)) {
1055
- res.catch(err => {
1056
- handleError(err, instance, type);
1057
- });
1058
- }
1059
- return res;
1060
- }
1061
- const values = [];
1062
- for (let i = 0; i < fn.length; i++) {
1063
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1064
- }
1065
- return values;
1066
- }
1067
- function handleError(err, instance, type) {
1068
- const contextVNode = instance ? instance.vnode : null;
1069
- if (instance) {
1070
- let cur = instance.parent;
1071
- // the exposed instance is the render proxy to keep it consistent with 2.x
1072
- const exposedInstance = instance.proxy;
1073
- // in production the hook receives only the error code
1074
- const errorInfo = (process.env.NODE_ENV !== 'production') ? ErrorTypeStrings[type] : type;
1075
- while (cur) {
1076
- const errorCapturedHooks = cur.ec;
1077
- if (errorCapturedHooks) {
1078
- for (let i = 0; i < errorCapturedHooks.length; i++) {
1079
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo)) {
1080
- return;
1081
- }
1082
- }
1083
- }
1084
- cur = cur.parent;
1085
- }
1086
- // app-level handling
1087
- const appErrorHandler = instance.appContext.config.errorHandler;
1088
- if (appErrorHandler) {
1089
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
1090
- return;
1091
- }
1092
- }
1093
- logError(err, type, contextVNode);
1094
- }
1095
- function logError(err, type, contextVNode) {
1096
- if ((process.env.NODE_ENV !== 'production')) {
1097
- const info = ErrorTypeStrings[type];
1098
- if (contextVNode) {
1099
- pushWarningContext(contextVNode);
1100
- }
1101
- warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1102
- if (contextVNode) {
1103
- popWarningContext();
1104
- }
1105
- // crash in dev so it's more noticeable
1106
- throw err;
1107
- }
1108
- else {
1109
- // recover in prod to reduce the impact on end-user
1110
- console.error(err);
1111
- }
1112
- }
1113
-
1114
- let isFlushing = false;
1115
- let isFlushPending = false;
1116
- const queue = [];
1117
- let flushIndex = 0;
1118
- const pendingPreFlushCbs = [];
1119
- let activePreFlushCbs = null;
1120
- let preFlushIndex = 0;
1121
- const pendingPostFlushCbs = [];
1122
- let activePostFlushCbs = null;
1123
- let postFlushIndex = 0;
1124
- const resolvedPromise = Promise.resolve();
1125
- let currentFlushPromise = null;
1126
- let currentPreFlushParentJob = null;
1127
- const RECURSION_LIMIT = 100;
1128
- function nextTick(fn) {
1129
- const p = currentFlushPromise || resolvedPromise;
1130
- return fn ? p.then(fn) : p;
1131
- }
1132
- function queueJob(job) {
1133
- // the dedupe search uses the startIndex argument of Array.includes()
1134
- // by default the search index includes the current job that is being run
1135
- // so it cannot recursively trigger itself again.
1136
- // if the job is a watch() callback, the search will start with a +1 index to
1137
- // allow it recursively trigger itself - it is the user's responsibility to
1138
- // ensure it doesn't end up in an infinite loop.
1139
- if ((!queue.length ||
1140
- !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
1141
- job !== currentPreFlushParentJob) {
1142
- queue.push(job);
1143
- queueFlush();
1144
- }
1145
- }
1146
- function queueFlush() {
1147
- if (!isFlushing && !isFlushPending) {
1148
- isFlushPending = true;
1149
- currentFlushPromise = resolvedPromise.then(flushJobs);
1150
- }
1151
- }
1152
- function queueCb(cb, activeQueue, pendingQueue, index) {
1153
- if (!isArray(cb)) {
1154
- if (!activeQueue ||
1155
- !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
1156
- pendingQueue.push(cb);
1157
- }
1158
- }
1159
- else {
1160
- // if cb is an array, it is a component lifecycle hook which can only be
1161
- // triggered by a job, which is already deduped in the main queue, so
1162
- // we can skip duplicate check here to improve perf
1163
- pendingQueue.push(...cb);
1164
- }
1165
- queueFlush();
1166
- }
1167
- function queuePreFlushCb(cb) {
1168
- queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
1169
- }
1170
- function queuePostFlushCb(cb) {
1171
- queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
1172
- }
1173
- function flushPreFlushCbs(seen, parentJob = null) {
1174
- if (pendingPreFlushCbs.length) {
1175
- currentPreFlushParentJob = parentJob;
1176
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
1177
- pendingPreFlushCbs.length = 0;
1178
- if ((process.env.NODE_ENV !== 'production')) {
1179
- seen = seen || new Map();
1180
- }
1181
- for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
1182
- if ((process.env.NODE_ENV !== 'production')) {
1183
- checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex]);
1184
- }
1185
- activePreFlushCbs[preFlushIndex]();
1186
- }
1187
- activePreFlushCbs = null;
1188
- preFlushIndex = 0;
1189
- currentPreFlushParentJob = null;
1190
- // recursively flush until it drains
1191
- flushPreFlushCbs(seen, parentJob);
1192
- }
1193
- }
1194
- function flushPostFlushCbs(seen) {
1195
- if (pendingPostFlushCbs.length) {
1196
- activePostFlushCbs = [...new Set(pendingPostFlushCbs)];
1197
- pendingPostFlushCbs.length = 0;
1198
- if ((process.env.NODE_ENV !== 'production')) {
1199
- seen = seen || new Map();
1200
- }
1201
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1202
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1203
- if ((process.env.NODE_ENV !== 'production')) {
1204
- checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex]);
1205
- }
1206
- activePostFlushCbs[postFlushIndex]();
1207
- }
1208
- activePostFlushCbs = null;
1209
- postFlushIndex = 0;
1210
- }
1211
- }
1212
- const getId = (job) => job.id == null ? Infinity : job.id;
1213
- function flushJobs(seen) {
1214
- isFlushPending = false;
1215
- isFlushing = true;
1216
- if ((process.env.NODE_ENV !== 'production')) {
1217
- seen = seen || new Map();
1218
- }
1219
- flushPreFlushCbs(seen);
1220
- // Sort queue before flush.
1221
- // This ensures that:
1222
- // 1. Components are updated from parent to child. (because parent is always
1223
- // created before the child so its render effect will have smaller
1224
- // priority number)
1225
- // 2. If a component is unmounted during a parent component's update,
1226
- // its update can be skipped.
1227
- // Jobs can never be null before flush starts, since they are only invalidated
1228
- // during execution of another flushed job.
1229
- queue.sort((a, b) => getId(a) - getId(b));
1230
- try {
1231
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1232
- const job = queue[flushIndex];
1233
- if (job) {
1234
- if ((process.env.NODE_ENV !== 'production')) {
1235
- checkRecursiveUpdates(seen, job);
1236
- }
1237
- callWithErrorHandling(job, null, 14 /* SCHEDULER */);
1238
- }
1239
- }
1240
- }
1241
- finally {
1242
- flushIndex = 0;
1243
- queue.length = 0;
1244
- flushPostFlushCbs(seen);
1245
- isFlushing = false;
1246
- currentFlushPromise = null;
1247
- // some postFlushCb queued jobs!
1248
- // keep flushing until it drains.
1249
- if (queue.length || pendingPostFlushCbs.length) {
1250
- flushJobs(seen);
1251
- }
1252
- }
1253
- }
1254
- function checkRecursiveUpdates(seen, fn) {
1255
- if (!seen.has(fn)) {
1256
- seen.set(fn, 1);
1257
- }
1258
- else {
1259
- const count = seen.get(fn);
1260
- if (count > RECURSION_LIMIT) {
1261
- throw new Error(`Maximum recursive updates exceeded. ` +
1262
- `This means you have a reactive effect that is mutating its own ` +
1263
- `dependencies and thus recursively triggering itself. Possible sources ` +
1264
- `include component template, render function, updated hook or ` +
1265
- `watcher source function.`);
1266
- }
1267
- else {
1268
- seen.set(fn, count + 1);
1269
- }
1270
- }
1271
- }
1272
- const hmrDirtyComponents = new Set();
1273
- // Expose the HMR runtime on the global object
1274
- // This makes it entirely tree-shakable without polluting the exports and makes
1275
- // it easier to be used in toolings like vue-loader
1276
- // Note: for a component to be eligible for HMR it also needs the __hmrId option
1277
- // to be set so that its instances can be registered / removed.
1278
- if ((process.env.NODE_ENV !== 'production')) {
1279
- const globalObject = typeof global !== 'undefined'
1280
- ? global
1281
- : typeof self !== 'undefined'
1282
- ? self
1283
- : typeof window !== 'undefined'
1284
- ? window
1285
- : {};
1286
- globalObject.__VUE_HMR_RUNTIME__ = {
1287
- createRecord: tryWrap(createRecord),
1288
- rerender: tryWrap(rerender),
1289
- reload: tryWrap(reload)
1290
- };
1291
- }
1292
- const map = new Map();
1293
- function createRecord(id) {
1294
- if (map.has(id)) {
1295
- return false;
1296
- }
1297
- map.set(id, new Set());
1298
- return true;
1299
- }
1300
- function rerender(id, newRender) {
1301
- const record = map.get(id);
1302
- if (!record)
1303
- return;
1304
- // Array.from creates a snapshot which avoids the set being mutated during
1305
- // updates
1306
- Array.from(record).forEach(instance => {
1307
- if (newRender) {
1308
- instance.render = newRender;
1309
- }
1310
- instance.renderCache = [];
1311
- instance.update();
1312
- });
1313
- }
1314
- function reload(id, newComp) {
1315
- const record = map.get(id);
1316
- if (!record)
1317
- return;
1318
- // Array.from creates a snapshot which avoids the set being mutated during
1319
- // updates
1320
- Array.from(record).forEach(instance => {
1321
- const comp = instance.type;
1322
- if (!hmrDirtyComponents.has(comp)) {
1323
- // 1. Update existing comp definition to match new one
1324
- extend(comp, newComp);
1325
- for (const key in comp) {
1326
- if (!(key in newComp)) {
1327
- delete comp[key];
1328
- }
1329
- }
1330
- // 2. Mark component dirty. This forces the renderer to replace the component
1331
- // on patch.
1332
- hmrDirtyComponents.add(comp);
1333
- // 3. Make sure to unmark the component after the reload.
1334
- queuePostFlushCb(() => {
1335
- hmrDirtyComponents.delete(comp);
1336
- });
1337
- }
1338
- if (instance.parent) {
1339
- // 4. Force the parent instance to re-render. This will cause all updated
1340
- // components to be unmounted and re-mounted. Queue the update so that we
1341
- // don't end up forcing the same parent to re-render multiple times.
1342
- queueJob(instance.parent.update);
1343
- }
1344
- else if (instance.appContext.reload) {
1345
- // root instance mounted via createApp() has a reload method
1346
- instance.appContext.reload();
1347
- }
1348
- else if (typeof window !== 'undefined') {
1349
- // root instance inside tree created via raw render(). Force reload.
1350
- window.location.reload();
1351
- }
1352
- else {
1353
- console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
1354
- }
1355
- });
1356
- }
1357
- function tryWrap(fn) {
1358
- return (id, arg) => {
1359
- try {
1360
- return fn(id, arg);
1361
- }
1362
- catch (e) {
1363
- console.error(e);
1364
- console.warn(`[HMR] Something went wrong during Vue component hot-reload. ` +
1365
- `Full reload required.`);
1366
- }
1367
- };
1368
- }
1369
-
1370
- // mark the current rendering instance for asset resolution (e.g.
1371
- // resolveComponent, resolveDirective) during render
1372
- let currentRenderingInstance = null;
1373
- function markAttrsAccessed() {
1374
- }
1375
-
1376
- const isSuspense = (type) => type.__isSuspense;
1377
- function queueEffectWithSuspense(fn, suspense) {
1378
- if (suspense && !suspense.isResolved) {
1379
- if (isArray(fn)) {
1380
- suspense.effects.push(...fn);
1381
- }
1382
- else {
1383
- suspense.effects.push(fn);
1384
- }
1385
- }
1386
- else {
1387
- queuePostFlushCb(fn);
1388
- }
1389
- }
1390
-
1391
- // SFC scoped style ID management.
1392
- let currentScopeId = null;
1393
-
1394
- const isTeleport = (type) => type.__isTeleport;
1395
- const NULL_DYNAMIC_COMPONENT = Symbol();
1396
-
1397
- let isRenderingTemplateSlot = false;
1398
-
1399
- const Fragment = Symbol((process.env.NODE_ENV !== 'production') ? 'Fragment' : undefined);
1400
- const Text = Symbol((process.env.NODE_ENV !== 'production') ? 'Text' : undefined);
1401
- const Comment = Symbol((process.env.NODE_ENV !== 'production') ? 'Comment' : undefined);
1402
- const Static = Symbol((process.env.NODE_ENV !== 'production') ? 'Static' : undefined);
1403
- let currentBlock = null;
1404
- // Whether we should be tracking dynamic child nodes inside a block.
1405
- // Only tracks when this value is > 0
1406
- // We are not using a simple boolean because this value may need to be
1407
- // incremented/decremented by nested usage of v-once (see below)
1408
- let shouldTrack$1 = 1;
1409
- function isVNode(value) {
1410
- return value ? value.__v_isVNode === true : false;
1411
- }
1412
- function isSameVNodeType(n1, n2) {
1413
- if ((process.env.NODE_ENV !== 'production') &&
1414
- n2.shapeFlag & 6 /* COMPONENT */ &&
1415
- hmrDirtyComponents.has(n2.type)) {
1416
- // HMR only: if the component has been hot-updated, force a reload.
1417
- return false;
1418
- }
1419
- return n1.type === n2.type && n1.key === n2.key;
1420
- }
1421
- let vnodeArgsTransformer;
1422
- const createVNodeWithArgsTransform = (...args) => {
1423
- return _createVNode(...(vnodeArgsTransformer
1424
- ? vnodeArgsTransformer(args, currentRenderingInstance)
1425
- : args));
1426
- };
1427
- const InternalObjectKey = `__vInternal`;
1428
- const normalizeKey = ({ key }) => key != null ? key : null;
1429
- const normalizeRef = ({ ref: ref$$1 }) => {
1430
- return (ref$$1 != null
1431
- ? isArray(ref$$1)
1432
- ? ref$$1
1433
- : [currentRenderingInstance, ref$$1]
1434
- : null);
1435
- };
1436
- const createVNode = ((process.env.NODE_ENV !== 'production')
1437
- ? createVNodeWithArgsTransform
1438
- : _createVNode);
1439
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
1440
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
1441
- if ((process.env.NODE_ENV !== 'production') && !type) {
1442
- warn(`Invalid vnode type when creating vnode: ${type}.`);
1443
- }
1444
- type = Comment;
1445
- }
1446
- if (isVNode(type)) {
1447
- const cloned = cloneVNode(type, props);
1448
- if (children) {
1449
- normalizeChildren(cloned, children);
1450
- }
1451
- return cloned;
1452
- }
1453
- // class component normalization.
1454
- if (isFunction(type) && '__vccOpts' in type) {
1455
- type = type.__vccOpts;
1456
- }
1457
- // class & style normalization.
1458
- if (props) {
1459
- // for reactive or proxy objects, we need to clone it to enable mutation.
1460
- if (isProxy(props) || InternalObjectKey in props) {
1461
- props = extend({}, props);
1462
- }
1463
- let { class: klass, style } = props;
1464
- if (klass && !isString(klass)) {
1465
- props.class = normalizeClass(klass);
1466
- }
1467
- if (isObject(style)) {
1468
- // reactive state objects need to be cloned since they are likely to be
1469
- // mutated
1470
- if (isProxy(style) && !isArray(style)) {
1471
- style = extend({}, style);
1472
- }
1473
- props.style = normalizeStyle(style);
1474
- }
1475
- }
1476
- // encode the vnode type information into a bitmap
1477
- const shapeFlag = isString(type)
1478
- ? 1 /* ELEMENT */
1479
- : isSuspense(type)
1480
- ? 128 /* SUSPENSE */
1481
- : isTeleport(type)
1482
- ? 64 /* TELEPORT */
1483
- : isObject(type)
1484
- ? 4 /* STATEFUL_COMPONENT */
1485
- : isFunction(type)
1486
- ? 2 /* FUNCTIONAL_COMPONENT */
1487
- : 0;
1488
- if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
1489
- type = toRaw(type);
1490
- warn(`Vue received a Component which was made a reactive object. This can ` +
1491
- `lead to unnecessary performance overhead, and should be avoided by ` +
1492
- `marking the component with \`markRaw\` or using \`shallowRef\` ` +
1493
- `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
1494
- }
1495
- const vnode = {
1496
- __v_isVNode: true,
1497
- __v_skip: true,
1498
- type,
1499
- props,
1500
- key: props && normalizeKey(props),
1501
- ref: props && normalizeRef(props),
1502
- scopeId: currentScopeId,
1503
- children: null,
1504
- component: null,
1505
- suspense: null,
1506
- dirs: null,
1507
- transition: null,
1508
- el: null,
1509
- anchor: null,
1510
- target: null,
1511
- targetAnchor: null,
1512
- staticCount: 0,
1513
- shapeFlag,
1514
- patchFlag,
1515
- dynamicProps,
1516
- dynamicChildren: null,
1517
- appContext: null
1518
- };
1519
- // validate key
1520
- if ((process.env.NODE_ENV !== 'production') && vnode.key !== vnode.key) {
1521
- warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
1522
- }
1523
- normalizeChildren(vnode, children);
1524
- if ((shouldTrack$1 > 0 || isRenderingTemplateSlot) &&
1525
- // avoid a block node from tracking itself
1526
- !isBlockNode &&
1527
- // has current parent block
1528
- currentBlock &&
1529
- // presence of a patch flag indicates this node needs patching on updates.
1530
- // component nodes also should always be patched, because even if the
1531
- // component doesn't need to update, it needs to persist the instance on to
1532
- // the next vnode so that it can be properly unmounted later.
1533
- (patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
1534
- // the EVENTS flag is only for hydration and if it is the only flag, the
1535
- // vnode should not be considered dynamic due to handler caching.
1536
- patchFlag !== 32 /* HYDRATE_EVENTS */) {
1537
- currentBlock.push(vnode);
1538
- }
1539
- return vnode;
1540
- }
1541
- function cloneVNode(vnode, extraProps) {
1542
- // This is intentionally NOT using spread or extend to avoid the runtime
1543
- // key enumeration cost.
1544
- const { props, patchFlag } = vnode;
1545
- const mergedProps = extraProps
1546
- ? props
1547
- ? mergeProps(props, extraProps)
1548
- : extend({}, extraProps)
1549
- : props;
1550
- return {
1551
- __v_isVNode: true,
1552
- __v_skip: true,
1553
- type: vnode.type,
1554
- props: mergedProps,
1555
- key: mergedProps && normalizeKey(mergedProps),
1556
- ref: extraProps && extraProps.ref ? normalizeRef(extraProps) : vnode.ref,
1557
- scopeId: vnode.scopeId,
1558
- children: vnode.children,
1559
- target: vnode.target,
1560
- targetAnchor: vnode.targetAnchor,
1561
- staticCount: vnode.staticCount,
1562
- shapeFlag: vnode.shapeFlag,
1563
- // if the vnode is cloned with extra props, we can no longer assume its
1564
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
1565
- // note: perserve flag for fragments since they use the flag for children
1566
- // fast paths only.
1567
- patchFlag: extraProps && vnode.type !== Fragment
1568
- ? patchFlag === -1 // hoisted node
1569
- ? 16 /* FULL_PROPS */
1570
- : patchFlag | 16 /* FULL_PROPS */
1571
- : patchFlag,
1572
- dynamicProps: vnode.dynamicProps,
1573
- dynamicChildren: vnode.dynamicChildren,
1574
- appContext: vnode.appContext,
1575
- dirs: vnode.dirs,
1576
- transition: vnode.transition,
1577
- // These should technically only be non-null on mounted VNodes. However,
1578
- // they *should* be copied for kept-alive vnodes. So we just always copy
1579
- // them since them being non-null during a mount doesn't affect the logic as
1580
- // they will simply be overwritten.
1581
- component: vnode.component,
1582
- suspense: vnode.suspense,
1583
- el: vnode.el,
1584
- anchor: vnode.anchor
1585
- };
1586
- }
1587
- /**
1588
- * @private
1589
- */
1590
- function createTextVNode(text$$1 = ' ', flag = 0) {
1591
- return createVNode(Text, null, text$$1, flag);
1592
- }
1593
- function normalizeChildren(vnode, children) {
1594
- let type = 0;
1595
- const { shapeFlag } = vnode;
1596
- if (children == null) {
1597
- children = null;
1598
- }
1599
- else if (isArray(children)) {
1600
- type = 16 /* ARRAY_CHILDREN */;
1601
- }
1602
- else if (typeof children === 'object') {
1603
- // Normalize slot to plain children
1604
- if ((shapeFlag & 1 /* ELEMENT */ || shapeFlag & 64 /* TELEPORT */) &&
1605
- children.default) {
1606
- normalizeChildren(vnode, children.default());
1607
- return;
1608
- }
1609
- else {
1610
- type = 32 /* SLOTS_CHILDREN */;
1611
- const slotFlag = children._;
1612
- if (!slotFlag && !(InternalObjectKey in children)) {
1613
- children._ctx = currentRenderingInstance;
1614
- }
1615
- else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
1616
- // a child component receives forwarded slots from the parent.
1617
- // its slot type is determined by its parent's slot type.
1618
- if (currentRenderingInstance.vnode.patchFlag & 1024 /* DYNAMIC_SLOTS */) {
1619
- children._ = 2 /* DYNAMIC */;
1620
- vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
1621
- }
1622
- else {
1623
- children._ = 1 /* STABLE */;
1624
- }
1625
- }
1626
- }
1627
- }
1628
- else if (isFunction(children)) {
1629
- children = { default: children, _ctx: currentRenderingInstance };
1630
- type = 32 /* SLOTS_CHILDREN */;
1631
- }
1632
- else {
1633
- children = String(children);
1634
- // force teleport children to array so it can be moved around
1635
- if (shapeFlag & 64 /* TELEPORT */) {
1636
- type = 16 /* ARRAY_CHILDREN */;
1637
- children = [createTextVNode(children)];
1638
- }
1639
- else {
1640
- type = 8 /* TEXT_CHILDREN */;
1641
- }
1642
- }
1643
- vnode.children = children;
1644
- vnode.shapeFlag |= type;
1645
- }
1646
- function mergeProps(...args) {
1647
- const ret = extend({}, args[0]);
1648
- for (let i = 1; i < args.length; i++) {
1649
- const toMerge = args[i];
1650
- for (const key in toMerge) {
1651
- if (key === 'class') {
1652
- if (ret.class !== toMerge.class) {
1653
- ret.class = normalizeClass([ret.class, toMerge.class]);
1654
- }
1655
- }
1656
- else if (key === 'style') {
1657
- ret.style = normalizeStyle([ret.style, toMerge.style]);
1658
- }
1659
- else if (isOn(key)) {
1660
- const existing = ret[key];
1661
- const incoming = toMerge[key];
1662
- if (existing !== incoming) {
1663
- ret[key] = existing
1664
- ? [].concat(existing, toMerge[key])
1665
- : incoming;
1666
- }
1667
- }
1668
- else {
1669
- ret[key] = toMerge[key];
1670
- }
1671
- }
1672
- }
1673
- return ret;
1674
- }
1675
- function normalizePropsOptions(comp) {
1676
- if (comp.__props) {
1677
- return comp.__props;
1678
- }
1679
- const raw = comp.props;
1680
- const normalized = {};
1681
- const needCastKeys = [];
1682
- // apply mixin/extends props
1683
- let hasExtends = false;
1684
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
1685
- const extendProps = (raw) => {
1686
- const [props, keys] = normalizePropsOptions(raw);
1687
- extend(normalized, props);
1688
- if (keys)
1689
- needCastKeys.push(...keys);
1690
- };
1691
- if (comp.extends) {
1692
- hasExtends = true;
1693
- extendProps(comp.extends);
1694
- }
1695
- if (comp.mixins) {
1696
- hasExtends = true;
1697
- comp.mixins.forEach(extendProps);
1698
- }
1699
- }
1700
- if (!raw && !hasExtends) {
1701
- return (comp.__props = EMPTY_ARR);
1702
- }
1703
- if (isArray(raw)) {
1704
- for (let i = 0; i < raw.length; i++) {
1705
- if ((process.env.NODE_ENV !== 'production') && !isString(raw[i])) {
1706
- warn(`props must be strings when using array syntax.`, raw[i]);
1707
- }
1708
- const normalizedKey = camelize(raw[i]);
1709
- if (validatePropName(normalizedKey)) {
1710
- normalized[normalizedKey] = EMPTY_OBJ;
1711
- }
1712
- }
1713
- }
1714
- else if (raw) {
1715
- if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
1716
- warn(`invalid props options`, raw);
1717
- }
1718
- for (const key in raw) {
1719
- const normalizedKey = camelize(key);
1720
- if (validatePropName(normalizedKey)) {
1721
- const opt = raw[key];
1722
- const prop = (normalized[normalizedKey] =
1723
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
1724
- if (prop) {
1725
- const booleanIndex = getTypeIndex(Boolean, prop.type);
1726
- const stringIndex = getTypeIndex(String, prop.type);
1727
- prop[0 /* shouldCast */] = booleanIndex > -1;
1728
- prop[1 /* shouldCastTrue */] =
1729
- stringIndex < 0 || booleanIndex < stringIndex;
1730
- // if the prop needs boolean casting or default value
1731
- if (booleanIndex > -1 || hasOwn(prop, 'default')) {
1732
- needCastKeys.push(normalizedKey);
1733
- }
1734
- }
1735
- }
1736
- }
1737
- }
1738
- const normalizedEntry = [normalized, needCastKeys];
1739
- comp.__props = normalizedEntry;
1740
- return normalizedEntry;
1741
- }
1742
- // use function string name to check type constructors
1743
- // so that it works across vms / iframes.
1744
- function getType(ctor) {
1745
- const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
1746
- return match ? match[1] : '';
1747
- }
1748
- function isSameType(a, b) {
1749
- return getType(a) === getType(b);
1750
- }
1751
- function getTypeIndex(type, expectedTypes) {
1752
- if (isArray(expectedTypes)) {
1753
- for (let i = 0, len = expectedTypes.length; i < len; i++) {
1754
- if (isSameType(expectedTypes[i], type)) {
1755
- return i;
1756
- }
1757
- }
1758
- }
1759
- else if (isFunction(expectedTypes)) {
1760
- return isSameType(expectedTypes, type) ? 0 : -1;
1761
- }
1762
- return -1;
1763
- }
1764
- /**
1765
- * dev only
1766
- */
1767
- function validatePropName(key) {
1768
- if (key[0] !== '$') {
1769
- return true;
1770
- }
1771
- else if ((process.env.NODE_ENV !== 'production')) {
1772
- warn(`Invalid prop name: "${key}" is a reserved property.`);
1773
- }
1774
- return false;
1775
- }
1776
- const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol');
1777
-
1778
- function injectHook(type, hook, target = currentInstance, prepend = false) {
1779
- if (target) {
1780
- const hooks = target[type] || (target[type] = []);
1781
- // cache the error handling wrapper for injected hooks so the same hook
1782
- // can be properly deduped by the scheduler. "__weh" stands for "with error
1783
- // handling".
1784
- const wrappedHook = hook.__weh ||
1785
- (hook.__weh = (...args) => {
1786
- if (target.isUnmounted) {
1787
- return;
1788
- }
1789
- // disable tracking inside all lifecycle hooks
1790
- // since they can potentially be called inside effects.
1791
- pauseTracking();
1792
- // Set currentInstance during hook invocation.
1793
- // This assumes the hook does not synchronously trigger other hooks, which
1794
- // can only be false when the user does something really funky.
1795
- setCurrentInstance(target);
1796
- const res = callWithAsyncErrorHandling(hook, target, type, args);
1797
- setCurrentInstance(null);
1798
- resetTracking();
1799
- return res;
1800
- });
1801
- if (prepend) {
1802
- hooks.unshift(wrappedHook);
1803
- }
1804
- else {
1805
- hooks.push(wrappedHook);
1806
- }
1807
- }
1808
- else if ((process.env.NODE_ENV !== 'production')) {
1809
- const apiName = `on${capitalize(ErrorTypeStrings[type].replace(/ hook$/, ''))}`;
1810
- warn(`${apiName} is called when there is no active component instance to be ` +
1811
- `associated with. ` +
1812
- `Lifecycle injection APIs can only be used during execution of setup().` +
1813
- ( ` If you are using async setup(), make sure to register lifecycle ` +
1814
- `hooks before the first await statement.`
1815
- ));
1816
- }
1817
- }
1818
- const createHook = (lifecycle) => (hook, target = currentInstance) =>
1819
- // post-create lifecycle registrations are noops during SSR
1820
- !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
1821
- const onMounted = createHook("m" /* MOUNTED */);
1822
- const onUpdated = createHook("u" /* UPDATED */);
1823
- const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
1824
-
1825
- function useTransitionState() {
1826
- const state = {
1827
- isMounted: false,
1828
- isLeaving: false,
1829
- isUnmounting: false,
1830
- leavingVNodes: new Map()
1831
- };
1832
- onMounted(() => {
1833
- state.isMounted = true;
1834
- });
1835
- onBeforeUnmount(() => {
1836
- state.isUnmounting = true;
1837
- });
1838
- return state;
1839
- }
1840
- const TransitionHookValidator = [Function, Array];
1841
- const BaseTransitionImpl = {
1842
- name: `BaseTransition`,
1843
- props: {
1844
- mode: String,
1845
- appear: Boolean,
1846
- persisted: Boolean,
1847
- // enter
1848
- onBeforeEnter: TransitionHookValidator,
1849
- onEnter: TransitionHookValidator,
1850
- onAfterEnter: TransitionHookValidator,
1851
- onEnterCancelled: TransitionHookValidator,
1852
- // leave
1853
- onBeforeLeave: TransitionHookValidator,
1854
- onLeave: TransitionHookValidator,
1855
- onAfterLeave: TransitionHookValidator,
1856
- onLeaveCancelled: TransitionHookValidator,
1857
- // appear
1858
- onBeforeAppear: TransitionHookValidator,
1859
- onAppear: TransitionHookValidator,
1860
- onAfterAppear: TransitionHookValidator,
1861
- onAppearCancelled: TransitionHookValidator
1862
- },
1863
- setup(props, { slots }) {
1864
- const instance = getCurrentInstance();
1865
- const state = useTransitionState();
1866
- let prevTransitionKey;
1867
- return () => {
1868
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
1869
- if (!children || !children.length) {
1870
- return;
1871
- }
1872
- // warn multiple elements
1873
- if ((process.env.NODE_ENV !== 'production') && children.length > 1) {
1874
- warn('<transition> can only be used on a single element or component. Use ' +
1875
- '<transition-group> for lists.');
1876
- }
1877
- // there's no need to track reactivity for these props so use the raw
1878
- // props for a bit better perf
1879
- const rawProps = toRaw(props);
1880
- const { mode } = rawProps;
1881
- // check mode
1882
- if ((process.env.NODE_ENV !== 'production') && mode && !['in-out', 'out-in', 'default'].includes(mode)) {
1883
- warn(`invalid <transition> mode: ${mode}`);
1884
- }
1885
- // at this point children has a guaranteed length of 1.
1886
- const child = children[0];
1887
- if (state.isLeaving) {
1888
- return emptyPlaceholder(child);
1889
- }
1890
- // in the case of <transition><keep-alive/></transition>, we need to
1891
- // compare the type of the kept-alive children.
1892
- const innerChild = getKeepAliveChild(child);
1893
- if (!innerChild) {
1894
- return emptyPlaceholder(child);
1895
- }
1896
- const enterHooks = (innerChild.transition = resolveTransitionHooks(innerChild, rawProps, state, instance));
1897
- const oldChild = instance.subTree;
1898
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
1899
- let transitionKeyChanged = false;
1900
- const { getTransitionKey } = innerChild.type;
1901
- if (getTransitionKey) {
1902
- const key = getTransitionKey();
1903
- if (prevTransitionKey === undefined) {
1904
- prevTransitionKey = key;
1905
- }
1906
- else if (key !== prevTransitionKey) {
1907
- prevTransitionKey = key;
1908
- transitionKeyChanged = true;
1909
- }
1910
- }
1911
- // handle mode
1912
- if (oldInnerChild &&
1913
- oldInnerChild.type !== Comment &&
1914
- (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
1915
- const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
1916
- // update old tree's hooks in case of dynamic transition
1917
- setTransitionHooks(oldInnerChild, leavingHooks);
1918
- // switching between different views
1919
- if (mode === 'out-in') {
1920
- state.isLeaving = true;
1921
- // return placeholder node and queue update when leave finishes
1922
- leavingHooks.afterLeave = () => {
1923
- state.isLeaving = false;
1924
- instance.update();
1925
- };
1926
- return emptyPlaceholder(child);
1927
- }
1928
- else if (mode === 'in-out') {
1929
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
1930
- const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
1931
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
1932
- // early removal callback
1933
- el._leaveCb = () => {
1934
- earlyRemove();
1935
- el._leaveCb = undefined;
1936
- delete enterHooks.delayedLeave;
1937
- };
1938
- enterHooks.delayedLeave = delayedLeave;
1939
- };
1940
- }
1941
- }
1942
- return child;
1943
- };
1944
- }
1945
- };
1946
- // export the public type for h/tsx inference
1947
- // also to avoid inline import() in generated d.ts files
1948
- const BaseTransition = BaseTransitionImpl;
1949
- function getLeavingNodesForType(state, vnode) {
1950
- const { leavingVNodes } = state;
1951
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
1952
- if (!leavingVNodesCache) {
1953
- leavingVNodesCache = Object.create(null);
1954
- leavingVNodes.set(vnode.type, leavingVNodesCache);
1955
- }
1956
- return leavingVNodesCache;
1957
- }
1958
- // The transition hooks are attached to the vnode as vnode.transition
1959
- // and will be called at appropriate timing in the renderer.
1960
- function resolveTransitionHooks(vnode, { appear, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled }, state, instance) {
1961
- const key = String(vnode.key);
1962
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1963
- const callHook = (hook, args) => {
1964
- hook &&
1965
- callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
1966
- };
1967
- const hooks = {
1968
- persisted,
1969
- beforeEnter(el) {
1970
- let hook = onBeforeEnter;
1971
- if (!state.isMounted) {
1972
- if (appear) {
1973
- hook = onBeforeAppear || onBeforeEnter;
1974
- }
1975
- else {
1976
- return;
1977
- }
1978
- }
1979
- // for same element (v-show)
1980
- if (el._leaveCb) {
1981
- el._leaveCb(true /* cancelled */);
1982
- }
1983
- // for toggled element with same key (v-if)
1984
- const leavingVNode = leavingVNodesCache[key];
1985
- if (leavingVNode &&
1986
- isSameVNodeType(vnode, leavingVNode) &&
1987
- leavingVNode.el._leaveCb) {
1988
- // force early removal (not cancelled)
1989
- leavingVNode.el._leaveCb();
1990
- }
1991
- callHook(hook, [el]);
1992
- },
1993
- enter(el) {
1994
- let hook = onEnter;
1995
- let afterHook = onAfterEnter;
1996
- let cancelHook = onEnterCancelled;
1997
- if (!state.isMounted) {
1998
- if (appear) {
1999
- hook = onAppear || onEnter;
2000
- afterHook = onAfterAppear || onAfterEnter;
2001
- cancelHook = onAppearCancelled || onEnterCancelled;
2002
- }
2003
- else {
2004
- return;
2005
- }
2006
- }
2007
- let called = false;
2008
- const done = (el._enterCb = (cancelled) => {
2009
- if (called)
2010
- return;
2011
- called = true;
2012
- if (cancelled) {
2013
- callHook(cancelHook, [el]);
2014
- }
2015
- else {
2016
- callHook(afterHook, [el]);
2017
- }
2018
- if (hooks.delayedLeave) {
2019
- hooks.delayedLeave();
2020
- }
2021
- el._enterCb = undefined;
2022
- });
2023
- if (hook) {
2024
- hook(el, done);
2025
- if (hook.length <= 1) {
2026
- done();
2027
- }
2028
- }
2029
- else {
2030
- done();
2031
- }
2032
- },
2033
- leave(el, remove$$1) {
2034
- const key = String(vnode.key);
2035
- if (el._enterCb) {
2036
- el._enterCb(true /* cancelled */);
2037
- }
2038
- if (state.isUnmounting) {
2039
- return remove$$1();
2040
- }
2041
- callHook(onBeforeLeave, [el]);
2042
- let called = false;
2043
- const done = (el._leaveCb = (cancelled) => {
2044
- if (called)
2045
- return;
2046
- called = true;
2047
- remove$$1();
2048
- if (cancelled) {
2049
- callHook(onLeaveCancelled, [el]);
2050
- }
2051
- else {
2052
- callHook(onAfterLeave, [el]);
2053
- }
2054
- el._leaveCb = undefined;
2055
- if (leavingVNodesCache[key] === vnode) {
2056
- delete leavingVNodesCache[key];
2057
- }
2058
- });
2059
- leavingVNodesCache[key] = vnode;
2060
- if (onLeave) {
2061
- onLeave(el, done);
2062
- if (onLeave.length <= 1) {
2063
- done();
2064
- }
2065
- }
2066
- else {
2067
- done();
2068
- }
2069
- }
2070
- };
2071
- return hooks;
2072
- }
2073
- // the placeholder really only handles one special case: KeepAlive
2074
- // in the case of a KeepAlive in a leave phase we need to return a KeepAlive
2075
- // placeholder with empty content to avoid the KeepAlive instance from being
2076
- // unmounted.
2077
- function emptyPlaceholder(vnode) {
2078
- if (isKeepAlive(vnode)) {
2079
- vnode = cloneVNode(vnode);
2080
- vnode.children = null;
2081
- return vnode;
2082
- }
2083
- }
2084
- function getKeepAliveChild(vnode) {
2085
- return isKeepAlive(vnode)
2086
- ? vnode.children
2087
- ? vnode.children[0]
2088
- : undefined
2089
- : vnode;
2090
- }
2091
- function setTransitionHooks(vnode, hooks) {
2092
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
2093
- setTransitionHooks(vnode.component.subTree, hooks);
2094
- }
2095
- else {
2096
- vnode.transition = hooks;
2097
- }
2098
- }
2099
- function getTransitionRawChildren(children, keepComment = false) {
2100
- let ret = [];
2101
- let keyedFragmentCount = 0;
2102
- for (let i = 0; i < children.length; i++) {
2103
- const child = children[i];
2104
- // handle fragment children case, e.g. v-for
2105
- if (child.type === Fragment) {
2106
- if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
2107
- keyedFragmentCount++;
2108
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
2109
- }
2110
- // comment placeholders should be skipped, e.g. v-if
2111
- else if (keepComment || child.type !== Comment) {
2112
- ret.push(child);
2113
- }
2114
- }
2115
- // #1126 if a transition children list contains multiple sub fragments, these
2116
- // fragments will be merged into a flat children array. Since each v-for
2117
- // fragment may contain different static bindings inside, we need to de-top
2118
- // these children to force full diffs to ensure correct behavior.
2119
- if (keyedFragmentCount > 1) {
2120
- for (let i = 0; i < ret.length; i++) {
2121
- ret[i].patchFlag = -2 /* BAIL */;
2122
- }
2123
- }
2124
- return ret;
2125
- }
2126
-
2127
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2128
-
2129
- /**
2130
- Runtime helper for applying directives to a vnode. Example usage:
2131
-
2132
- const comp = resolveComponent('comp')
2133
- const foo = resolveDirective('foo')
2134
- const bar = resolveDirective('bar')
2135
-
2136
- return withDirectives(h(comp), [
2137
- [foo, this.x],
2138
- [bar, this.y]
2139
- ])
2140
- */
2141
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
2142
- function setDevtoolsHook(hook) {
2143
- }
2144
- const queuePostRenderEffect = queueEffectWithSuspense
2145
- ;
2146
- // initial value for watchers to trigger on undefined initial values
2147
- const INITIAL_WATCHER_VALUE = {};
2148
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {
2149
- if ((process.env.NODE_ENV !== 'production') && !cb) {
2150
- if (immediate !== undefined) {
2151
- warn(`watch() "immediate" option is only respected when using the ` +
2152
- `watch(source, callback, options?) signature.`);
2153
- }
2154
- if (deep !== undefined) {
2155
- warn(`watch() "deep" option is only respected when using the ` +
2156
- `watch(source, callback, options?) signature.`);
2157
- }
2158
- }
2159
- const warnInvalidSource = (s) => {
2160
- warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
2161
- `a reactive object, or an array of these types.`);
2162
- };
2163
- let getter;
2164
- const isRefSource = isRef(source);
2165
- if (isRefSource) {
2166
- getter = () => source.value;
2167
- }
2168
- else if (isReactive(source)) {
2169
- getter = () => source;
2170
- deep = true;
2171
- }
2172
- else if (isArray(source)) {
2173
- getter = () => source.map(s => {
2174
- if (isRef(s)) {
2175
- return s.value;
2176
- }
2177
- else if (isReactive(s)) {
2178
- return traverse(s);
2179
- }
2180
- else if (isFunction(s)) {
2181
- return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
2182
- }
2183
- else {
2184
- (process.env.NODE_ENV !== 'production') && warnInvalidSource(s);
2185
- }
2186
- });
2187
- }
2188
- else if (isFunction(source)) {
2189
- if (cb) {
2190
- // getter with cb
2191
- getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
2192
- }
2193
- else {
2194
- // no cb -> simple effect
2195
- getter = () => {
2196
- if (instance && instance.isUnmounted) {
2197
- return;
2198
- }
2199
- if (cleanup) {
2200
- cleanup();
2201
- }
2202
- return callWithErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onInvalidate]);
2203
- };
2204
- }
2205
- }
2206
- else {
2207
- getter = NOOP;
2208
- (process.env.NODE_ENV !== 'production') && warnInvalidSource(source);
2209
- }
2210
- if (cb && deep) {
2211
- const baseGetter = getter;
2212
- getter = () => traverse(baseGetter());
2213
- }
2214
- let cleanup;
2215
- const onInvalidate = (fn) => {
2216
- cleanup = runner.options.onStop = () => {
2217
- callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
2218
- };
2219
- };
2220
- let oldValue = isArray(source) ? [] : INITIAL_WATCHER_VALUE;
2221
- const job = () => {
2222
- if (!runner.active) {
2223
- return;
2224
- }
2225
- if (cb) {
2226
- // watch(source, cb)
2227
- const newValue = runner();
2228
- if (deep || isRefSource || hasChanged(newValue, oldValue)) {
2229
- // cleanup before running cb again
2230
- if (cleanup) {
2231
- cleanup();
2232
- }
2233
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
2234
- newValue,
2235
- // pass undefined as the old value when it's changed for the first time
2236
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
2237
- onInvalidate
2238
- ]);
2239
- oldValue = newValue;
2240
- }
2241
- }
2242
- else {
2243
- // watchEffect
2244
- runner();
2245
- }
2246
- };
2247
- // important: mark the job as a watcher callback so that scheduler knows it
2248
- // it is allowed to self-trigger (#1727)
2249
- job.allowRecurse = !!cb;
2250
- let scheduler;
2251
- if (flush === 'sync') {
2252
- scheduler = job;
2253
- }
2254
- else if (flush === 'pre') {
2255
- // ensure it's queued before component updates (which have positive ids)
2256
- job.id = -1;
2257
- scheduler = () => {
2258
- if (!instance || instance.isMounted) {
2259
- queuePreFlushCb(job);
2260
- }
2261
- else {
2262
- // with 'pre' option, the first call must happen before
2263
- // the component is mounted so it is called synchronously.
2264
- job();
2265
- }
2266
- };
2267
- }
2268
- else {
2269
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
2270
- }
2271
- const runner = effect(getter, {
2272
- lazy: true,
2273
- onTrack,
2274
- onTrigger,
2275
- scheduler
2276
- });
2277
- recordInstanceBoundEffect(runner);
2278
- // initial run
2279
- if (cb) {
2280
- if (immediate) {
2281
- job();
2282
- }
2283
- else {
2284
- oldValue = runner();
2285
- }
2286
- }
2287
- else {
2288
- runner();
2289
- }
2290
- return () => {
2291
- stop(runner);
2292
- if (instance) {
2293
- remove(instance.effects, runner);
2294
- }
2295
- };
2296
- }
2297
- // this.$watch
2298
- function instanceWatch(source, cb, options) {
2299
- const publicThis = this.proxy;
2300
- const getter = isString(source)
2301
- ? () => publicThis[source]
2302
- : source.bind(publicThis);
2303
- return doWatch(getter, cb.bind(publicThis), options, this);
2304
- }
2305
- function traverse(value, seen = new Set()) {
2306
- if (!isObject(value) || seen.has(value)) {
2307
- return value;
2308
- }
2309
- seen.add(value);
2310
- if (isArray(value)) {
2311
- for (let i = 0; i < value.length; i++) {
2312
- traverse(value[i], seen);
2313
- }
2314
- }
2315
- else if (value instanceof Map) {
2316
- value.forEach((v, key) => {
2317
- // to register mutation dep for existing keys
2318
- traverse(value.get(key), seen);
2319
- });
2320
- }
2321
- else if (value instanceof Set) {
2322
- value.forEach(v => {
2323
- traverse(v, seen);
2324
- });
2325
- }
2326
- else {
2327
- for (const key in value) {
2328
- traverse(value[key], seen);
2329
- }
2330
- }
2331
- return value;
2332
- }
2333
- let isInBeforeCreate = false;
2334
- function resolveMergedOptions(instance) {
2335
- const raw = instance.type;
2336
- const { __merged, mixins, extends: extendsOptions } = raw;
2337
- if (__merged)
2338
- return __merged;
2339
- const globalMixins = instance.appContext.mixins;
2340
- if (!globalMixins.length && !mixins && !extendsOptions)
2341
- return raw;
2342
- const options = {};
2343
- globalMixins.forEach(m => mergeOptions(options, m, instance));
2344
- extendsOptions && mergeOptions(options, extendsOptions, instance);
2345
- mixins && mixins.forEach(m => mergeOptions(options, m, instance));
2346
- mergeOptions(options, raw, instance);
2347
- return (raw.__merged = options);
2348
- }
2349
- function mergeOptions(to, from, instance) {
2350
- const strats = instance.appContext.config.optionMergeStrategies;
2351
- for (const key in from) {
2352
- if (strats && hasOwn(strats, key)) {
2353
- to[key] = strats[key](to[key], from[key], instance.proxy, key);
2354
- }
2355
- else if (!hasOwn(to, key)) {
2356
- to[key] = from[key];
2357
- }
2358
- }
2359
- }
2360
-
2361
- const publicPropertiesMap = extend(Object.create(null), {
2362
- $: i => i,
2363
- $el: i => i.vnode.el,
2364
- $data: i => i.data,
2365
- $props: i => ((process.env.NODE_ENV !== 'production') ? shallowReadonly(i.props) : i.props),
2366
- $attrs: i => ((process.env.NODE_ENV !== 'production') ? shallowReadonly(i.attrs) : i.attrs),
2367
- $slots: i => ((process.env.NODE_ENV !== 'production') ? shallowReadonly(i.slots) : i.slots),
2368
- $refs: i => ((process.env.NODE_ENV !== 'production') ? shallowReadonly(i.refs) : i.refs),
2369
- $parent: i => i.parent && i.parent.proxy,
2370
- $root: i => i.root && i.root.proxy,
2371
- $emit: i => i.emit,
2372
- $options: i => (__VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type),
2373
- $forceUpdate: i => () => queueJob(i.update),
2374
- $nextTick: () => nextTick,
2375
- $watch: i => (__VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
2376
- });
2377
- const PublicInstanceProxyHandlers = {
2378
- get({ _: instance }, key) {
2379
- const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
2380
- // let @vue/reactivity know it should never observe Vue public instances.
2381
- if (key === "__v_skip" /* SKIP */) {
2382
- return true;
2383
- }
2384
- // data / props / ctx
2385
- // This getter gets called for every property access on the render context
2386
- // during render and is a major hotspot. The most expensive part of this
2387
- // is the multiple hasOwn() calls. It's much faster to do a simple property
2388
- // access on a plain object, so we use an accessCache object (with null
2389
- // prototype) to memoize what access type a key corresponds to.
2390
- let normalizedProps;
2391
- if (key[0] !== '$') {
2392
- const n = accessCache[key];
2393
- if (n !== undefined) {
2394
- switch (n) {
2395
- case 0 /* SETUP */:
2396
- return setupState[key];
2397
- case 1 /* DATA */:
2398
- return data[key];
2399
- case 3 /* CONTEXT */:
2400
- return ctx[key];
2401
- case 2 /* PROPS */:
2402
- return props[key];
2403
- // default: just fallthrough
2404
- }
2405
- }
2406
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
2407
- accessCache[key] = 0 /* SETUP */;
2408
- return setupState[key];
2409
- }
2410
- else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
2411
- accessCache[key] = 1 /* DATA */;
2412
- return data[key];
2413
- }
2414
- else if (
2415
- // only cache other properties when instance has declared (thus stable)
2416
- // props
2417
- (normalizedProps = normalizePropsOptions(type)[0]) &&
2418
- hasOwn(normalizedProps, key)) {
2419
- accessCache[key] = 2 /* PROPS */;
2420
- return props[key];
2421
- }
2422
- else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
2423
- accessCache[key] = 3 /* CONTEXT */;
2424
- return ctx[key];
2425
- }
2426
- else if (!__VUE_OPTIONS_API__ || !isInBeforeCreate) {
2427
- accessCache[key] = 4 /* OTHER */;
2428
- }
2429
- }
2430
- const publicGetter = publicPropertiesMap[key];
2431
- let cssModule, globalProperties;
2432
- // public $xxx properties
2433
- if (publicGetter) {
2434
- if (key === '$attrs') {
2435
- track(instance, "get" /* GET */, key);
2436
- (process.env.NODE_ENV !== 'production') && markAttrsAccessed();
2437
- }
2438
- return publicGetter(instance);
2439
- }
2440
- else if (
2441
- // css module (injected by vue-loader)
2442
- (cssModule = type.__cssModules) &&
2443
- (cssModule = cssModule[key])) {
2444
- return cssModule;
2445
- }
2446
- else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
2447
- // user may set custom properties to `this` that start with `$`
2448
- accessCache[key] = 3 /* CONTEXT */;
2449
- return ctx[key];
2450
- }
2451
- else if (
2452
- // global properties
2453
- (globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key))) {
2454
- return globalProperties[key];
2455
- }
2456
- else if ((process.env.NODE_ENV !== 'production') &&
2457
- currentRenderingInstance &&
2458
- (!isString(key) ||
2459
- // #1091 avoid internal isRef/isVNode checks on component instance leading
2460
- // to infinite warning loop
2461
- key.indexOf('__v') !== 0)) {
2462
- if (data !== EMPTY_OBJ && key[0] === '$' && hasOwn(data, key)) {
2463
- warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
2464
- `character and is not proxied on the render context.`);
2465
- }
2466
- else {
2467
- warn(`Property ${JSON.stringify(key)} was accessed during render ` +
2468
- `but is not defined on instance.`);
2469
- }
2470
- }
2471
- },
2472
- set({ _: instance }, key, value) {
2473
- const { data, setupState, ctx } = instance;
2474
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
2475
- setupState[key] = value;
2476
- }
2477
- else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
2478
- data[key] = value;
2479
- }
2480
- else if (key in instance.props) {
2481
- (process.env.NODE_ENV !== 'production') &&
2482
- warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
2483
- return false;
2484
- }
2485
- if (key[0] === '$' && key.slice(1) in instance) {
2486
- (process.env.NODE_ENV !== 'production') &&
2487
- warn(`Attempting to mutate public property "${key}". ` +
2488
- `Properties starting with $ are reserved and readonly.`, instance);
2489
- return false;
2490
- }
2491
- else {
2492
- if ((process.env.NODE_ENV !== 'production') && key in instance.appContext.config.globalProperties) {
2493
- Object.defineProperty(ctx, key, {
2494
- enumerable: true,
2495
- configurable: true,
2496
- value
2497
- });
2498
- }
2499
- else {
2500
- ctx[key] = value;
2501
- }
2502
- }
2503
- return true;
2504
- },
2505
- has({ _: { data, setupState, accessCache, ctx, type, appContext } }, key) {
2506
- let normalizedProps;
2507
- return (accessCache[key] !== undefined ||
2508
- (data !== EMPTY_OBJ && hasOwn(data, key)) ||
2509
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
2510
- ((normalizedProps = normalizePropsOptions(type)[0]) &&
2511
- hasOwn(normalizedProps, key)) ||
2512
- hasOwn(ctx, key) ||
2513
- hasOwn(publicPropertiesMap, key) ||
2514
- hasOwn(appContext.config.globalProperties, key));
2515
- }
2516
- };
2517
- if ((process.env.NODE_ENV !== 'production') && !false) {
2518
- PublicInstanceProxyHandlers.ownKeys = (target) => {
2519
- warn(`Avoid app logic that relies on enumerating keys on a component instance. ` +
2520
- `The keys will be empty in production mode to avoid performance overhead.`);
2521
- return Reflect.ownKeys(target);
2522
- };
2523
- }
2524
- const RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, {
2525
- get(target, key) {
2526
- // fast path for unscopables when using `with` block
2527
- if (key === Symbol.unscopables) {
2528
- return;
2529
- }
2530
- return PublicInstanceProxyHandlers.get(target, key, target);
2531
- },
2532
- has(_, key) {
2533
- const has = key[0] !== '_' && !isGloballyWhitelisted(key);
2534
- if ((process.env.NODE_ENV !== 'production') && !has && PublicInstanceProxyHandlers.has(_, key)) {
2535
- warn(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`);
2536
- }
2537
- return has;
2538
- }
2539
- });
2540
- let currentInstance = null;
2541
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
2542
- const setCurrentInstance = (instance) => {
2543
- currentInstance = instance;
2544
- };
2545
- const isBuiltInTag = /*#__PURE__*/ makeMap('slot,component');
2546
- let isInSSRComponentSetup = false;
2547
- // record effects created during a component's setup() so that they can be
2548
- // stopped when the component unmounts
2549
- function recordInstanceBoundEffect(effect$$1) {
2550
- if (currentInstance) {
2551
- (currentInstance.effects || (currentInstance.effects = [])).push(effect$$1);
2552
- }
2553
- }
2554
- const classifyRE = /(?:^|[-_])(\w)/g;
2555
- const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
2556
- /* istanbul ignore next */
2557
- function formatComponentName(instance, Component, isRoot = false) {
2558
- let name = isFunction(Component)
2559
- ? Component.displayName || Component.name
2560
- : Component.name;
2561
- if (!name && Component.__file) {
2562
- const match = Component.__file.match(/([^/\\]+)\.vue$/);
2563
- if (match) {
2564
- name = match[1];
2565
- }
2566
- }
2567
- if (!name && instance && instance.parent) {
2568
- // try to infer the name based on reverse resolution
2569
- const inferFromRegistry = (registry) => {
2570
- for (const key in registry) {
2571
- if (registry[key] === Component) {
2572
- return key;
2573
- }
2574
- }
2575
- };
2576
- name =
2577
- inferFromRegistry(instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
2578
- }
2579
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
2580
- }
2581
-
2582
- // implementation, close to no-op
2583
- function defineComponent(options) {
2584
- return isFunction(options) ? { setup: options, name: options.name } : options;
2585
- }
2586
-
2587
- // Actual implementation
2588
- function h(type, propsOrChildren, children) {
2589
- if (arguments.length === 2) {
2590
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
2591
- // single vnode without props
2592
- if (isVNode(propsOrChildren)) {
2593
- return createVNode(type, null, [propsOrChildren]);
2594
- }
2595
- // props without children
2596
- return createVNode(type, propsOrChildren);
2597
- }
2598
- else {
2599
- // omit props
2600
- return createVNode(type, null, propsOrChildren);
2601
- }
2602
- }
2603
- else {
2604
- if (isVNode(children)) {
2605
- children = [children];
2606
- }
2607
- return createVNode(type, propsOrChildren, children);
2608
- }
2609
- }
2610
-
2611
- const ssrContextKey = Symbol((process.env.NODE_ENV !== 'production') ? `ssrContext` : ``);
2612
-
2613
- const svgNS = 'http://www.w3.org/2000/svg';
2614
- const doc = (typeof document !== 'undefined' ? document : null);
2615
- let tempContainer;
2616
- let tempSVGContainer;
2617
- const nodeOps = {
2618
- insert: (child, parent, anchor) => {
2619
- parent.insertBefore(child, anchor || null);
2620
- },
2621
- remove: child => {
2622
- const parent = child.parentNode;
2623
- if (parent) {
2624
- parent.removeChild(child);
2625
- }
2626
- },
2627
- createElement: (tag, isSVG, is) => isSVG
2628
- ? doc.createElementNS(svgNS, tag)
2629
- : doc.createElement(tag, is ? { is } : undefined),
2630
- createText: text$$1 => doc.createTextNode(text$$1),
2631
- createComment: text$$1 => doc.createComment(text$$1),
2632
- setText: (node, text$$1) => {
2633
- node.nodeValue = text$$1;
2634
- },
2635
- setElementText: (el, text$$1) => {
2636
- el.textContent = text$$1;
2637
- },
2638
- parentNode: node => node.parentNode,
2639
- nextSibling: node => node.nextSibling,
2640
- querySelector: selector => doc.querySelector(selector),
2641
- setScopeId(el, id) {
2642
- el.setAttribute(id, '');
2643
- },
2644
- cloneNode(el) {
2645
- return el.cloneNode(true);
2646
- },
2647
- // __UNSAFE__
2648
- // Reason: innerHTML.
2649
- // Static content here can only come from compiled templates.
2650
- // As long as the user only uses trusted templates, this is safe.
2651
- insertStaticContent(content, parent, anchor, isSVG) {
2652
- const temp = isSVG
2653
- ? tempSVGContainer ||
2654
- (tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
2655
- : tempContainer || (tempContainer = doc.createElement('div'));
2656
- temp.innerHTML = content;
2657
- const first = temp.firstChild;
2658
- let node = first;
2659
- let last = node;
2660
- while (node) {
2661
- last = node;
2662
- nodeOps.insert(node, parent, anchor);
2663
- node = temp.firstChild;
2664
- }
2665
- return [first, last];
2666
- }
2667
- };
2668
-
2669
- // compiler should normalize class + :class bindings on the same element
2670
- // into a single binding ['staticClass', dynamic]
2671
- function patchClass(el, value, isSVG) {
2672
- if (value == null) {
2673
- value = '';
2674
- }
2675
- if (isSVG) {
2676
- el.setAttribute('class', value);
2677
- }
2678
- else {
2679
- // directly setting className should be faster than setAttribute in theory
2680
- // if this is an element during a transition, take the temporary transition
2681
- // classes into account.
2682
- const transitionClasses = el._vtc;
2683
- if (transitionClasses) {
2684
- value = (value
2685
- ? [value, ...transitionClasses]
2686
- : [...transitionClasses]).join(' ');
2687
- }
2688
- el.className = value;
2689
- }
2690
- }
2691
-
2692
- function patchStyle(el, prev, next) {
2693
- const style = el.style;
2694
- if (!next) {
2695
- el.removeAttribute('style');
2696
- }
2697
- else if (isString(next)) {
2698
- if (prev !== next) {
2699
- style.cssText = next;
2700
- }
2701
- }
2702
- else {
2703
- for (const key in next) {
2704
- setStyle(style, key, next[key]);
2705
- }
2706
- if (prev && !isString(prev)) {
2707
- for (const key in prev) {
2708
- if (next[key] == null) {
2709
- setStyle(style, key, '');
2710
- }
2711
- }
2712
- }
2713
- }
2714
- }
2715
- const importantRE = /\s*!important$/;
2716
- function setStyle(style, name, val) {
2717
- if (isArray(val)) {
2718
- val.forEach(v => setStyle(style, name, v));
2719
- }
2720
- else {
2721
- if (name.startsWith('--')) {
2722
- // custom property definition
2723
- style.setProperty(name, val);
2724
- }
2725
- else {
2726
- const prefixed = autoPrefix(style, name);
2727
- if (importantRE.test(val)) {
2728
- // !important
2729
- style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
2730
- }
2731
- else {
2732
- style[prefixed] = val;
2733
- }
2734
- }
2735
- }
2736
- }
2737
- const prefixes = ['Webkit', 'Moz', 'ms'];
2738
- const prefixCache = {};
2739
- function autoPrefix(style, rawName) {
2740
- const cached = prefixCache[rawName];
2741
- if (cached) {
2742
- return cached;
2743
- }
2744
- let name = camelize(rawName);
2745
- if (name !== 'filter' && name in style) {
2746
- return (prefixCache[rawName] = name);
2747
- }
2748
- name = capitalize(name);
2749
- for (let i = 0; i < prefixes.length; i++) {
2750
- const prefixed = prefixes[i] + name;
2751
- if (prefixed in style) {
2752
- return (prefixCache[rawName] = prefixed);
2753
- }
2754
- }
2755
- return rawName;
2756
- }
2757
-
2758
- const xlinkNS = 'http://www.w3.org/1999/xlink';
2759
- function patchAttr(el, key, value, isSVG) {
2760
- if (isSVG && key.startsWith('xlink:')) {
2761
- if (value == null) {
2762
- el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
2763
- }
2764
- else {
2765
- el.setAttributeNS(xlinkNS, key, value);
2766
- }
2767
- }
2768
- else {
2769
- // note we are only checking boolean attributes that don't have a
2770
- // corresponding dom prop of the same name here.
2771
- const isBoolean = isSpecialBooleanAttr(key);
2772
- if (value == null || (isBoolean && value === false)) {
2773
- el.removeAttribute(key);
2774
- }
2775
- else {
2776
- el.setAttribute(key, isBoolean ? '' : value);
2777
- }
2778
- }
2779
- }
2780
-
2781
- // __UNSAFE__
2782
- // functions. The user is responsible for using them with only trusted content.
2783
- function patchDOMProp(el, key, value,
2784
- // the following args are passed only due to potential innerHTML/textContent
2785
- // overriding existing VNodes, in which case the old tree must be properly
2786
- // unmounted.
2787
- prevChildren, parentComponent, parentSuspense, unmountChildren) {
2788
- if (key === 'innerHTML' || key === 'textContent') {
2789
- if (prevChildren) {
2790
- unmountChildren(prevChildren, parentComponent, parentSuspense);
2791
- }
2792
- el[key] = value == null ? '' : value;
2793
- return;
2794
- }
2795
- if (key === 'value' && el.tagName !== 'PROGRESS') {
2796
- // store value as _value as well since
2797
- // non-string values will be stringified.
2798
- el._value = value;
2799
- el.value = value == null ? '' : value;
2800
- return;
2801
- }
2802
- if (value === '' && typeof el[key] === 'boolean') {
2803
- // e.g. <select multiple> compiles to { multiple: '' }
2804
- el[key] = true;
2805
- }
2806
- else if (value == null && typeof el[key] === 'string') {
2807
- // e.g. <div :id="null">
2808
- el[key] = '';
2809
- el.removeAttribute(key);
2810
- }
2811
- else {
2812
- // some properties perform value validation and throw
2813
- try {
2814
- el[key] = value;
2815
- }
2816
- catch (e) {
2817
- if ((process.env.NODE_ENV !== 'production')) {
2818
- warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
2819
- `value ${value} is invalid.`, e);
2820
- }
2821
- }
2822
- }
2823
- }
2824
-
2825
- // Async edge case fix requires storing an event listener's attach timestamp.
2826
- let _getNow = Date.now;
2827
- // Determine what event timestamp the browser is using. Annoyingly, the
2828
- // timestamp can either be hi-res (relative to page load) or low-res
2829
- // (relative to UNIX epoch), so in order to compare time we have to use the
2830
- // same timestamp type when saving the flush timestamp.
2831
- if (typeof document !== 'undefined' &&
2832
- _getNow() > document.createEvent('Event').timeStamp) {
2833
- // if the low-res timestamp which is bigger than the event timestamp
2834
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
2835
- // and we need to use the hi-res version for event listeners as well.
2836
- _getNow = () => performance.now();
2837
- }
2838
- // To avoid the overhead of repeatedly calling performance.now(), we cache
2839
- // and use the same timestamp for all event listeners attached in the same tick.
2840
- let cachedNow = 0;
2841
- const p = Promise.resolve();
2842
- const reset = () => {
2843
- cachedNow = 0;
2844
- };
2845
- const getNow = () => cachedNow || (p.then(reset), cachedNow = _getNow());
2846
- function addEventListener(el, event, handler, options) {
2847
- el.addEventListener(event, handler, options);
2848
- }
2849
- function removeEventListener(el, event, handler, options) {
2850
- el.removeEventListener(event, handler, options);
2851
- }
2852
- function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
2853
- // vei = vue event invokers
2854
- const invokers = el._vei || (el._vei = {});
2855
- const existingInvoker = invokers[rawName];
2856
- if (nextValue && existingInvoker) {
2857
- // patch
2858
- existingInvoker.value = nextValue;
2859
- }
2860
- else {
2861
- const [name, options] = parseName(rawName);
2862
- if (nextValue) {
2863
- // add
2864
- const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
2865
- addEventListener(el, name, invoker, options);
2866
- }
2867
- else if (existingInvoker) {
2868
- // remove
2869
- removeEventListener(el, name, existingInvoker, options);
2870
- invokers[rawName] = undefined;
2871
- }
2872
- }
2873
- }
2874
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
2875
- function parseName(name) {
2876
- let options;
2877
- if (optionsModifierRE.test(name)) {
2878
- options = {};
2879
- let m;
2880
- while ((m = name.match(optionsModifierRE))) {
2881
- name = name.slice(0, name.length - m[0].length);
2882
- options[m[0].toLowerCase()] = true;
2883
- }
2884
- }
2885
- return [name.slice(2).toLowerCase(), options];
2886
- }
2887
- function createInvoker(initialValue, instance) {
2888
- const invoker = (e) => {
2889
- // async edge case #6566: inner click event triggers patch, event handler
2890
- // attached to outer element during patch, and triggered again. This
2891
- // happens because browsers fire microtask ticks between event propagation.
2892
- // the solution is simple: we save the timestamp when a handler is attached,
2893
- // and the handler would only fire if the event passed to it was fired
2894
- // AFTER it was attached.
2895
- const timeStamp = e.timeStamp || _getNow();
2896
- if (timeStamp >= invoker.attached - 1) {
2897
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
2898
- }
2899
- };
2900
- invoker.value = initialValue;
2901
- invoker.attached = getNow();
2902
- return invoker;
2903
- }
2904
- function patchStopImmediatePropagation(e, value) {
2905
- if (isArray(value)) {
2906
- const originalStop = e.stopImmediatePropagation;
2907
- e.stopImmediatePropagation = () => {
2908
- originalStop.call(e);
2909
- e._stopped = true;
2910
- };
2911
- return value.map(fn => (e) => !e._stopped && fn(e));
2912
- }
2913
- else {
2914
- return value;
2915
- }
2916
- }
2917
-
2918
- const nativeOnRE = /^on[a-z]/;
2919
- const forcePatchProp = (_, key) => key === 'value';
2920
- const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
2921
- switch (key) {
2922
- // special
2923
- case 'class':
2924
- patchClass(el, nextValue, isSVG);
2925
- break;
2926
- case 'style':
2927
- patchStyle(el, prevValue, nextValue);
2928
- break;
2929
- default:
2930
- if (isOn(key)) {
2931
- // ignore v-model listeners
2932
- if (!isModelListener(key)) {
2933
- patchEvent(el, key, prevValue, nextValue, parentComponent);
2934
- }
2935
- }
2936
- else if (shouldSetAsProp(el, key, nextValue, isSVG)) {
2937
- patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
2938
- }
2939
- else {
2940
- // special case for <input v-model type="checkbox"> with
2941
- // :true-value & :false-value
2942
- // store value as dom properties since non-string values will be
2943
- // stringified.
2944
- if (key === 'true-value') {
2945
- el._trueValue = nextValue;
2946
- }
2947
- else if (key === 'false-value') {
2948
- el._falseValue = nextValue;
2949
- }
2950
- patchAttr(el, key, nextValue, isSVG);
2951
- }
2952
- break;
2953
- }
2954
- };
2955
- function shouldSetAsProp(el, key, value, isSVG) {
2956
- if (isSVG) {
2957
- // most keys must be set as attribute on svg elements to work
2958
- // ...except innerHTML
2959
- if (key === 'innerHTML') {
2960
- return true;
2961
- }
2962
- // or native onclick with function values
2963
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
2964
- return true;
2965
- }
2966
- return false;
2967
- }
2968
- // spellcheck and draggable are numerated attrs, however their
2969
- // corresponding DOM properties are actually booleans - this leads to
2970
- // setting it with a string "false" value leading it to be coerced to
2971
- // `true`, so we need to always treat them as attributes.
2972
- // Note that `contentEditable` doesn't have this problem: its DOM
2973
- // property is also enumerated string values.
2974
- if (key === 'spellcheck' || key === 'draggable') {
2975
- return false;
2976
- }
2977
- // #1787 form as an attribute must be a string, while it accepts an Element as
2978
- // a prop
2979
- if (key === 'form' && typeof value === 'string') {
2980
- return false;
2981
- }
2982
- // #1526 <input list> must be set as attribute
2983
- if (key === 'list' && el.tagName === 'INPUT') {
2984
- return false;
2985
- }
2986
- // native onclick with string value, must be set as attribute
2987
- if (nativeOnRE.test(key) && isString(value)) {
2988
- return false;
2989
- }
2990
- return key in el;
2991
- }
2992
-
2993
- const TRANSITION = 'transition';
2994
- const ANIMATION = 'animation';
2995
- // DOM Transition is a higher-order-component based on the platform-agnostic
2996
- // base Transition component, with DOM-specific logic.
2997
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
2998
- Transition.displayName = 'Transition';
2999
- const DOMTransitionPropsValidators = {
3000
- name: String,
3001
- type: String,
3002
- css: {
3003
- type: Boolean,
3004
- default: true
3005
- },
3006
- duration: [String, Number, Object],
3007
- enterFromClass: String,
3008
- enterActiveClass: String,
3009
- enterToClass: String,
3010
- appearFromClass: String,
3011
- appearActiveClass: String,
3012
- appearToClass: String,
3013
- leaveFromClass: String,
3014
- leaveActiveClass: String,
3015
- leaveToClass: String
3016
- };
3017
- const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend({}, BaseTransition.props, DOMTransitionPropsValidators));
3018
- function resolveTransitionProps(rawProps) {
3019
- let { name = 'v', type, css = true, duration, enterFromClass = `${name}-enter-from`, enterActiveClass = `${name}-enter-active`, enterToClass = `${name}-enter-to`, appearFromClass = enterFromClass, appearActiveClass = enterActiveClass, appearToClass = enterToClass, leaveFromClass = `${name}-leave-from`, leaveActiveClass = `${name}-leave-active`, leaveToClass = `${name}-leave-to` } = rawProps;
3020
- const baseProps = {};
3021
- for (const key in rawProps) {
3022
- if (!(key in DOMTransitionPropsValidators)) {
3023
- baseProps[key] = rawProps[key];
3024
- }
3025
- }
3026
- if (!css) {
3027
- return baseProps;
3028
- }
3029
- const durations = normalizeDuration(duration);
3030
- const enterDuration = durations && durations[0];
3031
- const leaveDuration = durations && durations[1];
3032
- const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
3033
- const finishEnter = (el, isAppear, done) => {
3034
- removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
3035
- removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
3036
- done && done();
3037
- };
3038
- const finishLeave = (el, done) => {
3039
- removeTransitionClass(el, leaveToClass);
3040
- removeTransitionClass(el, leaveActiveClass);
3041
- done && done();
3042
- };
3043
- const makeEnterHook = (isAppear) => {
3044
- return (el, done) => {
3045
- const hook = isAppear ? onAppear : onEnter;
3046
- const resolve = () => finishEnter(el, isAppear, done);
3047
- hook && hook(el, resolve);
3048
- nextFrame(() => {
3049
- removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
3050
- addTransitionClass(el, isAppear ? appearToClass : enterToClass);
3051
- if (!(hook && hook.length > 1)) {
3052
- if (enterDuration) {
3053
- setTimeout(resolve, enterDuration);
3054
- }
3055
- else {
3056
- whenTransitionEnds(el, type, resolve);
3057
- }
3058
- }
3059
- });
3060
- };
3061
- };
3062
- return extend(baseProps, {
3063
- onBeforeEnter(el) {
3064
- onBeforeEnter && onBeforeEnter(el);
3065
- addTransitionClass(el, enterActiveClass);
3066
- addTransitionClass(el, enterFromClass);
3067
- },
3068
- onBeforeAppear(el) {
3069
- onBeforeAppear && onBeforeAppear(el);
3070
- addTransitionClass(el, appearActiveClass);
3071
- addTransitionClass(el, appearFromClass);
3072
- },
3073
- onEnter: makeEnterHook(false),
3074
- onAppear: makeEnterHook(true),
3075
- onLeave(el, done) {
3076
- const resolve = () => finishLeave(el, done);
3077
- addTransitionClass(el, leaveActiveClass);
3078
- addTransitionClass(el, leaveFromClass);
3079
- nextFrame(() => {
3080
- removeTransitionClass(el, leaveFromClass);
3081
- addTransitionClass(el, leaveToClass);
3082
- if (!(onLeave && onLeave.length > 1)) {
3083
- if (leaveDuration) {
3084
- setTimeout(resolve, leaveDuration);
3085
- }
3086
- else {
3087
- whenTransitionEnds(el, type, resolve);
3088
- }
3089
- }
3090
- });
3091
- onLeave && onLeave(el, resolve);
3092
- },
3093
- onEnterCancelled(el) {
3094
- finishEnter(el, false);
3095
- onEnterCancelled && onEnterCancelled(el);
3096
- },
3097
- onAppearCancelled(el) {
3098
- finishEnter(el, true);
3099
- onAppearCancelled && onAppearCancelled(el);
3100
- },
3101
- onLeaveCancelled(el) {
3102
- finishLeave(el);
3103
- onLeaveCancelled && onLeaveCancelled(el);
3104
- }
3105
- });
3106
- }
3107
- function normalizeDuration(duration) {
3108
- if (duration == null) {
3109
- return null;
3110
- }
3111
- else if (isObject(duration)) {
3112
- return [NumberOf(duration.enter), NumberOf(duration.leave)];
3113
- }
3114
- else {
3115
- const n = NumberOf(duration);
3116
- return [n, n];
3117
- }
3118
- }
3119
- function NumberOf(val) {
3120
- const res = toNumber(val);
3121
- if ((process.env.NODE_ENV !== 'production'))
3122
- validateDuration(res);
3123
- return res;
3124
- }
3125
- function validateDuration(val) {
3126
- if (typeof val !== 'number') {
3127
- warn(`<transition> explicit duration is not a valid number - ` +
3128
- `got ${JSON.stringify(val)}.`);
3129
- }
3130
- else if (isNaN(val)) {
3131
- warn(`<transition> explicit duration is NaN - ` +
3132
- 'the duration expression might be incorrect.');
3133
- }
3134
- }
3135
- function addTransitionClass(el, cls) {
3136
- cls.split(/\s+/).forEach(c => c && el.classList.add(c));
3137
- (el._vtc ||
3138
- (el._vtc = new Set())).add(cls);
3139
- }
3140
- function removeTransitionClass(el, cls) {
3141
- cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
3142
- const { _vtc } = el;
3143
- if (_vtc) {
3144
- _vtc.delete(cls);
3145
- if (!_vtc.size) {
3146
- el._vtc = undefined;
3147
- }
3148
- }
3149
- }
3150
- function nextFrame(cb) {
3151
- requestAnimationFrame(() => {
3152
- requestAnimationFrame(cb);
3153
- });
3154
- }
3155
- function whenTransitionEnds(el, expectedType, cb) {
3156
- const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
3157
- if (!type) {
3158
- return cb();
3159
- }
3160
- const endEvent = type + 'end';
3161
- let ended = 0;
3162
- const end = () => {
3163
- el.removeEventListener(endEvent, onEnd);
3164
- cb();
3165
- };
3166
- const onEnd = (e) => {
3167
- if (e.target === el) {
3168
- if (++ended >= propCount) {
3169
- end();
3170
- }
3171
- }
3172
- };
3173
- setTimeout(() => {
3174
- if (ended < propCount) {
3175
- end();
3176
- }
3177
- }, timeout + 1);
3178
- el.addEventListener(endEvent, onEnd);
3179
- }
3180
- function getTransitionInfo(el, expectedType) {
3181
- const styles = window.getComputedStyle(el);
3182
- // JSDOM may return undefined for transition properties
3183
- const getStyleProperties = (key) => (styles[key] || '').split(', ');
3184
- const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
3185
- const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
3186
- const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
3187
- const animationDelays = getStyleProperties(ANIMATION + 'Delay');
3188
- const animationDurations = getStyleProperties(ANIMATION + 'Duration');
3189
- const animationTimeout = getTimeout(animationDelays, animationDurations);
3190
- let type = null;
3191
- let timeout = 0;
3192
- let propCount = 0;
3193
- /* istanbul ignore if */
3194
- if (expectedType === TRANSITION) {
3195
- if (transitionTimeout > 0) {
3196
- type = TRANSITION;
3197
- timeout = transitionTimeout;
3198
- propCount = transitionDurations.length;
3199
- }
3200
- }
3201
- else if (expectedType === ANIMATION) {
3202
- if (animationTimeout > 0) {
3203
- type = ANIMATION;
3204
- timeout = animationTimeout;
3205
- propCount = animationDurations.length;
3206
- }
3207
- }
3208
- else {
3209
- timeout = Math.max(transitionTimeout, animationTimeout);
3210
- type =
3211
- timeout > 0
3212
- ? transitionTimeout > animationTimeout
3213
- ? TRANSITION
3214
- : ANIMATION
3215
- : null;
3216
- propCount = type
3217
- ? type === TRANSITION
3218
- ? transitionDurations.length
3219
- : animationDurations.length
3220
- : 0;
3221
- }
3222
- const hasTransform = type === TRANSITION &&
3223
- /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
3224
- return {
3225
- type,
3226
- timeout,
3227
- propCount,
3228
- hasTransform
3229
- };
3230
- }
3231
- function getTimeout(delays, durations) {
3232
- while (delays.length < durations.length) {
3233
- delays = delays.concat(delays);
3234
- }
3235
- return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
3236
- }
3237
- // Old versions of Chromium (below 61.0.3163.100) formats floating pointer
3238
- // numbers in a locale-dependent way, using a comma instead of a dot.
3239
- // If comma is not replaced with a dot, the input will be rounded down
3240
- // (i.e. acting as a floor function) causing unexpected behaviors
3241
- function toMs(s) {
3242
- return Number(s.slice(0, -1).replace(',', '.')) * 1000;
3243
- }
3244
-
3245
- function toRaw$1(observed) {
3246
- return ((observed && toRaw$1(observed["__v_raw" /* RAW */])) || observed);
3247
- }
3248
-
3249
- const positionMap = new WeakMap();
3250
- const newPositionMap = new WeakMap();
3251
- const TransitionGroupImpl = {
3252
- name: 'TransitionGroup',
3253
- props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
3254
- tag: String,
3255
- moveClass: String
3256
- }),
3257
- setup(props, { slots }) {
3258
- const instance = getCurrentInstance();
3259
- const state = useTransitionState();
3260
- let prevChildren;
3261
- let children;
3262
- onUpdated(() => {
3263
- // children is guaranteed to exist after initial render
3264
- if (!prevChildren.length) {
3265
- return;
3266
- }
3267
- const moveClass = props.moveClass || `${props.name || 'v'}-move`;
3268
- if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
3269
- return;
3270
- }
3271
- // we divide the work into three loops to avoid mixing DOM reads and writes
3272
- // in each iteration - which helps prevent layout thrashing.
3273
- prevChildren.forEach(callPendingCbs);
3274
- prevChildren.forEach(recordPosition);
3275
- const movedChildren = prevChildren.filter(applyTranslation);
3276
- // force reflow to put everything in position
3277
- forceReflow();
3278
- movedChildren.forEach(c => {
3279
- const el = c.el;
3280
- const style = el.style;
3281
- addTransitionClass(el, moveClass);
3282
- style.transform = style.webkitTransform = style.transitionDuration = '';
3283
- const cb = (el._moveCb = (e) => {
3284
- if (e && e.target !== el) {
3285
- return;
3286
- }
3287
- if (!e || /transform$/.test(e.propertyName)) {
3288
- el.removeEventListener('transitionend', cb);
3289
- el._moveCb = null;
3290
- removeTransitionClass(el, moveClass);
3291
- }
3292
- });
3293
- el.addEventListener('transitionend', cb);
3294
- });
3295
- });
3296
- return () => {
3297
- const rawProps = toRaw$1(props);
3298
- const cssTransitionProps = resolveTransitionProps(rawProps);
3299
- const tag = rawProps.tag || Fragment;
3300
- prevChildren = children;
3301
- children = slots.default ? getTransitionRawChildren(slots.default()) : [];
3302
- for (let i = 0; i < children.length; i++) {
3303
- const child = children[i];
3304
- if (child.key != null) {
3305
- setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
3306
- }
3307
- else if ((process.env.NODE_ENV !== 'production')) {
3308
- warn(`<TransitionGroup> children must be keyed.`);
3309
- }
3310
- }
3311
- if (prevChildren) {
3312
- for (let i = 0; i < prevChildren.length; i++) {
3313
- const child = prevChildren[i];
3314
- setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
3315
- positionMap.set(child, child.el.getBoundingClientRect());
3316
- }
3317
- }
3318
- return createVNode(tag, null, children);
3319
- };
3320
- }
3321
- };
3322
- function callPendingCbs(c) {
3323
- const el = c.el;
3324
- if (el._moveCb) {
3325
- el._moveCb();
3326
- }
3327
- if (el._enterCb) {
3328
- el._enterCb();
3329
- }
3330
- }
3331
- function recordPosition(c) {
3332
- newPositionMap.set(c, c.el.getBoundingClientRect());
3333
- }
3334
- function applyTranslation(c) {
3335
- const oldPos = positionMap.get(c);
3336
- const newPos = newPositionMap.get(c);
3337
- const dx = oldPos.left - newPos.left;
3338
- const dy = oldPos.top - newPos.top;
3339
- if (dx || dy) {
3340
- const s = c.el.style;
3341
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
3342
- s.transitionDuration = '0s';
3343
- return c;
3344
- }
3345
- }
3346
- // this is put in a dedicated function to avoid the line from being treeshaken
3347
- function forceReflow() {
3348
- return document.body.offsetHeight;
3349
- }
3350
- function hasCSSTransform(el, root, moveClass) {
3351
- // Detect whether an element with the move class applied has
3352
- // CSS transitions. Since the element may be inside an entering
3353
- // transition at this very moment, we make a clone of it and remove
3354
- // all other transition classes applied to ensure only the move class
3355
- // is applied.
3356
- const clone = el.cloneNode();
3357
- if (el._vtc) {
3358
- el._vtc.forEach(cls => {
3359
- cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
3360
- });
3361
- }
3362
- moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
3363
- clone.style.display = 'none';
3364
- const container = (root.nodeType === 1
3365
- ? root
3366
- : root.parentNode);
3367
- container.appendChild(clone);
3368
- const { hasTransform } = getTransitionInfo(clone);
3369
- container.removeChild(clone);
3370
- return hasTransform;
3371
- }
3372
-
3373
- const rendererOptions = extend({ patchProp, forcePatchProp }, nodeOps);
3374
-
3375
- function initDev() {
3376
- const target = getGlobalThis();
3377
- target.__VUE__ = true;
3378
- setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
3379
- {
3380
- console.info(`You are running a development build of Vue.\n` +
3381
- `Make sure to use the production build (*.prod.js) when deploying for production.`);
3382
- }
3383
- }
3384
-
3385
- // This entry exports the runtime only, and is built as
3386
- (process.env.NODE_ENV !== 'production') && initDev();
3387
-
3388
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
+ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3389
5
 
3390
6
  function createCommonjsModule(fn, module) {
3391
7
  return module = { exports: {} }, fn(module, module.exports), module.exports;
@@ -3615,13 +231,13 @@ function classToObject(classes) {
3615
231
  }
3616
232
 
3617
233
  /**
3618
- * Converts a FontAwesome abstract element of an icon into a Vue render function.
234
+ * Converts a FontAwesome abstract element of an icon into a Vue VNode.
3619
235
  * @param {AbstractElement | String} abstractElement The element to convert.
3620
236
  * @param {Object} props The user-defined props.
3621
237
  * @param {Object} attrs The user-defined native HTML attributes.
3622
- * @returns {Function | String}
238
+ * @returns {VNode}
3623
239
  */
3624
- function convert$1(abstractElement) {
240
+ function convert(abstractElement) {
3625
241
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3626
242
  var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3627
243
 
@@ -3630,12 +246,9 @@ function convert$1(abstractElement) {
3630
246
  return abstractElement;
3631
247
  }
3632
248
 
3633
- // Converting abstract element children into Vue render functions, then we'll execute
3634
- // them to retrieve VDOM elements
249
+ // Converting abstract element children into Vue VNodes
3635
250
  var children = (abstractElement.children || []).map(function (child) {
3636
- return convert$1(child);
3637
- }).map(function (renderFn) {
3638
- return typeof renderFn === 'string' ? renderFn : renderFn();
251
+ return convert(child);
3639
252
  });
3640
253
 
3641
254
  // Converting abstract element attributes into valid Vue format
@@ -3660,19 +273,17 @@ function convert$1(abstractElement) {
3660
273
  style: {}
3661
274
  });
3662
275
 
3663
- // Now, we'll return the render function of the
276
+ // Now, we'll return the VNode
3664
277
 
3665
278
  var _attrs$class = attrs.class,
3666
279
  _attrs$style = attrs.style,
3667
280
  aStyle = _attrs$style === undefined ? {} : _attrs$style,
3668
281
  otherAttrs = objectWithoutProperties(attrs, ['class', 'style']);
3669
282
 
3670
- return function () {
3671
- return h(abstractElement.tag, _extends({}, props, {
3672
- class: mixins.class,
3673
- style: _extends({}, mixins.style, aStyle)
3674
- }, mixins.attrs, otherAttrs), children);
3675
- };
283
+ return h(abstractElement.tag, _extends({}, props, {
284
+ class: mixins.class,
285
+ style: _extends({}, mixins.style, aStyle)
286
+ }, mixins.attrs, otherAttrs), children);
3676
287
  }
3677
288
 
3678
289
  var PRODUCTION = false;
@@ -3816,25 +427,39 @@ var FontAwesomeIcon = defineComponent({
3816
427
 
3817
428
  setup: function setup(props, _ref) {
3818
429
  var attrs = _ref.attrs;
3819
- var symbol = props.symbol,
3820
- title = props.title;
3821
430
 
3822
- var icon$$1 = normalizeIconArgs(props.icon);
3823
- var classes = objectWithKey('classes', classList(props));
3824
- var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
3825
- var mask = objectWithKey('mask', normalizeIconArgs(props.mask));
431
+ var icon$$1 = computed(function () {
432
+ return normalizeIconArgs(props.icon);
433
+ });
434
+ var classes = computed(function () {
435
+ return objectWithKey('classes', classList(props));
436
+ });
437
+ var transform = computed(function () {
438
+ return objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
439
+ });
440
+ var mask = computed(function () {
441
+ return objectWithKey('mask', normalizeIconArgs(props.mask));
442
+ });
3826
443
 
3827
- var renderedIcon = icon(icon$$1, _extends({}, classes, transform, mask, {
3828
- symbol: symbol,
3829
- title: title
3830
- }));
444
+ var renderedIcon = computed(function () {
445
+ return icon(icon$$1.value, _extends({}, classes.value, transform.value, mask.value, {
446
+ symbol: props.symbol,
447
+ title: props.title
448
+ }));
449
+ });
3831
450
 
3832
- if (!renderedIcon) {
3833
- return log('Could not find one or more icon(s)', icon$$1, mask);
3834
- }
451
+ watch(renderedIcon, function (value) {
452
+ if (!value) {
453
+ return log('Could not find one or more icon(s)', icon$$1.value, mask.value);
454
+ }
455
+ }, { immediate: true });
3835
456
 
3836
- var abstractElement = renderedIcon.abstract[0];
3837
- return convert$1(abstractElement, {}, attrs);
457
+ var vnode = computed(function () {
458
+ return renderedIcon.value ? convert(renderedIcon.value.abstract[0], {}, attrs) : null;
459
+ });
460
+ return function () {
461
+ return vnode.value;
462
+ };
3838
463
  }
3839
464
  });
3840
465
 
@@ -3853,10 +478,12 @@ var FontAwesomeLayers = defineComponent({
3853
478
  var familyPrefix = config.familyPrefix;
3854
479
 
3855
480
 
3856
- var className = [familyPrefix + '-layers'].concat(toConsumableArray(props.fixedWidth ? [familyPrefix + '-fw'] : []));
481
+ var className = computed(function () {
482
+ return [familyPrefix + '-layers'].concat(toConsumableArray(props.fixedWidth ? [familyPrefix + '-fw'] : []));
483
+ });
3857
484
 
3858
485
  return function () {
3859
- return h('div', { class: className }, slots.default ? slots.default() : []);
486
+ return h('div', { class: className.value }, slots.default ? slots.default() : []);
3860
487
  };
3861
488
  }
3862
489
  });
@@ -3891,17 +518,28 @@ var FontAwesomeLayersText = defineComponent({
3891
518
  var familyPrefix = config.familyPrefix;
3892
519
 
3893
520
 
3894
- var classes = objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : [])));
3895
- var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
3896
- var renderedText = text(props.value.toString(), _extends({}, transform, classes));
3897
-
3898
- var abstract = renderedText.abstract;
521
+ var classes = computed(function () {
522
+ return objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : [])));
523
+ });
524
+ var transform = computed(function () {
525
+ return objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
526
+ });
527
+ var abstractElement = computed(function () {
528
+ var _text = text(props.value.toString(), _extends({}, transform.value, classes.value)),
529
+ abstract = _text.abstract;
3899
530
 
3900
- if (props.counter) {
3901
- abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
3902
- }
531
+ if (props.counter) {
532
+ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
533
+ }
534
+ return abstract[0];
535
+ });
3903
536
 
3904
- return convert$1(abstract[0], {}, attrs);
537
+ var vnode = computed(function () {
538
+ return convert(abstractElement.value, {}, attrs);
539
+ });
540
+ return function () {
541
+ return vnode.value;
542
+ };
3905
543
  }
3906
544
  });
3907
545