vendor: 4,518 bytes, lines 1-128
1/** 2* vue v3.4.21 3* (c) 2018-present Yuxi (Evan) You and Vue contributors 4* @license MIT 5**/ 6var Vue = (function (exports) { 7 'use strict'; 8 9 function makeMap(str, expectsLowerCase) { 10 const set = new Set(str.split(",")); 11 return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); 12 } 13 14 const EMPTY_OBJ = Object.freeze({}) ; 15 const EMPTY_ARR = Object.freeze([]) ; 16 const NOOP = () => { 17 }; 18 const NO = () => false; 19 const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter 20 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); 21 const isModelListener = (key) => key.startsWith("onUpdate:"); 22 const extend = Object.assign; 23 const remove = (arr, el) => { 24 const i = arr.indexOf(el); 25 if (i > -1) { 26 arr.splice(i, 1); 27 } 28 }; 29 const hasOwnProperty$1 = Object.prototype.hasOwnProperty; 30 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); 31 const isArray = Array.isArray; 32 const isMap = (val) => toTypeString(val) === "[object Map]"; 33 const isSet = (val) => toTypeString(val) === "[object Set]"; 34 const isDate = (val) => toTypeString(val) === "[object Date]"; 35 const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 36 const isFunction = (val) => typeof val === "function"; 37 const isString = (val) => typeof val === "string"; 38 const isSymbol = (val) => typeof val === "symbol"; 39 const isObject = (val) => val !== null && typeof val === "object"; 40 const isPromise = (val) => { 41 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); 42 }; 43 const objectToString = Object.prototype.toString; 44 const toTypeString = (value) => objectToString.call(value); 45 const toRawType = (value) => { 46 return toTypeString(value).slice(8, -1); 47 }; 48 const isPlainObject = (val) => toTypeString(val) === "[object Object]"; 49 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 50 const isReservedProp = /* @__PURE__ */ makeMap( 51 // the leading comma is intentional so empty string "" is also included 52 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 53 ); 54 const isBuiltInDirective = /* @__PURE__ */ makeMap( 55 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" 56 ); 57 const cacheStringFunction = (fn) => { 58 const cache = /* @__PURE__ */ Object.create(null); 59 return (str) => { 60 const hit = cache[str]; 61 return hit || (cache[str] = fn(str)); 62 }; 63 }; 64 const camelizeRE = /-(\w)/g; 65 const camelize = cacheStringFunction((str) => { 66 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 67 }); 68 const hyphenateRE = /\B([A-Z])/g; 69 const hyphenate = cacheStringFunction( 70 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 71 ); 72 const capitalize = cacheStringFunction((str) => { 73 return str.charAt(0).toUpperCase() + str.slice(1); 74 }); 75 const toHandlerKey = cacheStringFunction((str) => { 76 const s = str ? `on${capitalize(str)}` : ``; 77 return s; 78 }); 79 const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 80 const invokeArrayFns = (fns, arg) => { 81 for (let i = 0; i < fns.length; i++) { 82 fns[i](arg); 83 } 84 }; 85 const def = (obj, key, value) => { 86 Object.defineProperty(obj, key, { 87 configurable: true, 88 enumerable: false, 89 value 90 }); 91 }; 92 const looseToNumber = (val) => { 93 const n = parseFloat(val); 94 return isNaN(n) ? val : n; 95 }; 96 const toNumber = (val) => { 97 const n = isString(val) ? Number(val) : NaN; 98 return isNaN(n) ? val : n; 99 }; 100 let _globalThis; 101 const getGlobalThis = () => { 102 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 103 }; 104 105 const PatchFlagNames = { 106 [1]: `TEXT`, 107 [2]: `CLASS`, 108 [4]: `STYLE`, 109 [8]: `PROPS`, 110 [16]: `FULL_PROPS`, 111 [32]: `NEED_HYDRATION`, 112 [64]: `STABLE_FRAGMENT`, 113 [128]: `KEYED_FRAGMENT`, 114 [256]: `UNKEYED_FRAGMENT`, 115 [512]: `NEED_PATCH`, 116 [1024]: `DYNAMIC_SLOTS`, 117 [2048]: `DEV_ROOT_FRAGMENT`, 118 [-1]: `HOISTED`, 119 [-2]: `BAIL` 120 }; 121 122 const slotFlagsText = { 123 [1]: "STABLE", 124 [2]: "DYNAMIC", 125 [3]: "FORWARDED" 126 }; 127 128 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decode
vendor: 5,578 bytes, lines 128-251
128URI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; 129 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); 130 131 const range = 2; 132 function generateCodeFrame(source, start = 0, end = source.length) { 133 let lines = source.split(/(\r?\n)/); 134 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); 135 lines = lines.filter((_, idx) => idx % 2 === 0); 136 let count = 0; 137 const res = []; 138 for (let i = 0; i < lines.length; i++) { 139 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); 140 if (count >= start) { 141 for (let j = i - range; j <= i + range || end > count; j++) { 142 if (j < 0 || j >= lines.length) 143 continue; 144 const line = j + 1; 145 res.push( 146 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` 147 ); 148 const lineLength = lines[j].length; 149 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; 150 if (j === i) { 151 const pad = start - (count - (lineLength + newLineSeqLength)); 152 const length = Math.max( 153 1, 154 end > count ? lineLength - pad : end - start 155 ); 156 res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); 157 } else if (j > i) { 158 if (end > count) { 159 const length = Math.max(Math.min(end - count, lineLength), 1); 160 res.push(` | ` + "^".repeat(length)); 161 } 162 count += lineLength + newLineSeqLength; 163 } 164 } 165 break; 166 } 167 } 168 return res.join("\n"); 169 } 170 171 function normalizeStyle(value) { 172 if (isArray(value)) { 173 const res = {}; 174 for (let i = 0; i < value.length; i++) { 175 const item = value[i]; 176 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); 177 if (normalized) { 178 for (const key in normalized) { 179 res[key] = normalized[key]; 180 } 181 } 182 } 183 return res; 184 } else if (isString(value) || isObject(value)) { 185 return value; 186 } 187 } 188 const listDelimiterRE = /;(?![^(]*\))/g; 189 const propertyDelimiterRE = /:([^]+)/; 190 const styleCommentRE = /\/\*[^]*?\*\//g; 191 function parseStringStyle(cssText) { 192 const ret = {}; 193 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { 194 if (item) { 195 const tmp = item.split(propertyDelimiterRE); 196 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 197 } 198 }); 199 return ret; 200 } 201 function stringifyStyle(styles) { 202 let ret = ""; 203 if (!styles || isString(styles)) { 204 return ret; 205 } 206 for (const key in styles) { 207 const value = styles[key]; 208 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); 209 if (isString(value) || typeof value === "number") { 210 ret += `${normalizedKey}:${value};`; 211 } 212 } 213 return ret; 214 } 215 function normalizeClass(value) { 216 let res = ""; 217 if (isString(value)) { 218 res = value; 219 } else if (isArray(value)) { 220 for (let i = 0; i < value.length; i++) { 221 const normalized = normalizeClass(value[i]); 222 if (normalized) { 223 res += normalized + " "; 224 } 225 } 226 } else if (isObject(value)) { 227 for (const name in value) { 228 if (value[name]) { 229 res += name + " "; 230 } 231 } 232 } 233 return res.trim(); 234 } 235 function normalizeProps(props) { 236 if (!props) 237 return null; 238 let { class: klass, style } = props; 239 if (klass && !isString(klass)) { 240 props.class = normalizeClass(klass); 241 } 242 if (style) { 243 props.style = normalizeStyle(style); 244 } 245 return props; 246 } 247 248 const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; 249 const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; 250 const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; 251 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
252 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); 253 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); 254 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); 255 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); 256 257 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 258 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 259 const isBooleanAttr = /* @__PURE__ */ makeMap( 260 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` 261 ); 262 function includeBooleanAttr(value) { 263 return !!value || value === ""; 264 } 265 const isKnownHtmlAttr = /* @__PURE__ */ makeMap( 266 `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` 267 ); 268 const isKnownSvgAttr = /* @__PURE__ */ makeMap( 269 `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode
269-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` 270 ); 271 function isRenderableAttrValue(value) { 272 if (value == null) { 273 return false; 274 } 275 const type = typeof value; 276 return type === "string" || type === "number" || type === "boolean"; 277 } 278 279 function looseCompareArrays(a, b) { 280 if (a.length !== b.length) 281 return false; 282 let equal = true; 283 for (let i = 0; equal && i < a.length; i++) { 284 equal = looseEqual(a[i], b[i]); 285 } 286 return equal; 287 } 288 function looseEqual(a, b) { 289 if (a === b) 290 return true; 291 let aValidType = isDate(a); 292 let bValidType = isDate(b); 293 if (aValidType || bValidType) { 294 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 295 } 296 aValidType = isSymbol(a); 297 bValidType = isSymbol(b); 298 if (aValidType || bValidType) { 299 return a === b; 300 } 301 aValidType = isArray(a); 302 bValidType = isArray(b); 303 if (aValidType || bValidType) { 304 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 305 } 306 aValidType = isObject(a); 307 bValidType = isObject(b); 308 if (aValidType || bValidType) { 309 if (!aValidType || !bValidType) { 310 return false; 311 } 312 const aKeysCount = Object.keys(a).length; 313 const bKeysCount = Object.keys(b).length; 314 if (aKeysCount !== bKeysCount) { 315 return false; 316 } 317 for (const key in a) { 318 const aHasKey = a.hasOwnProperty(key); 319 const bHasKey = b.hasOwnProperty(key); 320 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 321 return false; 322 } 323 } 324 } 325 return String(a) === String(b); 326 } 327 function looseIndexOf(arr, val) { 328 return arr.findIndex((item) => looseEqual(item, val)); 329 } 330 331 const toDisplayString = (val) => { 332 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); 333 }; 334 const replacer = (_key, val) => { 335 if (val && val.__v_isRef) { 336 return replacer(_key, val.value); 337 } else if (isMap(val)) { 338 return { 339 [`Map(${val.size})`]: [...val.entries()].reduce( 340 (entries, [key, val2], i) => { 341 entries[stringifySymbol(key, i) + " =>"] = val2; 342 return entries; 343 }, 344 {} 345 ) 346 }; 347 } else if (isSet(val)) { 348 return { 349 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) 350 }; 351 } else if (isSymbol(val)) { 352 return stringifySymbol(val); 353 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { 354 return String(val); 355 } 356 return val; 357 }; 358 const stringifySymbol = (v, i = "") => { 359 var _a; 360 return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v; 361 }; 362 363 function warn$2(msg, ...args) { 364 console.warn(`[Vue warn] ${msg}`, ...args); 365 } 366 367 let activeEffectScope; 368 class EffectScope { 369 constructor(detached = false) { 370 this.detached = detached; 371 /** 372 * @internal 373 */ 374 this._active = true; 375 /** 376 * @internal 377 */ 378 this.effects = []; 379 /** 380 * @internal 381 */ 382 this.cleanups = []; 383 this.parent = activeEffectScope; 384 if (!detached && activeEffectScope) { 385 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 386 this 387 ) - 1; 388 } 389 } 390 get active() { 391 return this._active; 392 } 393 run(fn) { 394 if (this._active) { 395 const currentEffectScope = activeEffectScope; 396 try { 397 activeEffectScope = this; 398 return fn(); 399 } finally { 400 activeEffectScope = currentEffectScope; 401 } 402 } else { 403 warn$2(`cannot run an inactive effect scope.`); 404 } 405 } 406 /** 407 * This should only be called on non-detached scopes 408 * @internal 409 */ 410 on() { 411 activeEffectScope = this; 412 } 413 /** 414 * This should only be called on non-detached scopes 415 * @internal 416 */ 417 off() { 418 activeEffectScope = this.parent; 419 } 420 stop(fromParent) { 421 if (this._active) { 422 let i, l; 423 for (i = 0, l = this.effects.length; i < l; i++) { 424 this.effects[i].stop(); 425 } 426 for (i = 0, l = this.cleanups.length; i < l; i++) { 427 this.cleanups[i](); 428 } 429 if (this.scopes) { 430 for (i = 0, l = this.scopes.length; i < l; i++) { 431 this.scopes[i].stop(true); 432 } 433 } 434 if (!this.detached && this.parent && !fromParent) { 435 const last = this.parent.scopes.pop(); 436 if (last && last !== this) { 437 this.parent.scopes[this.index] = last; 438 last.index = this.index; 439 } 440 } 441 this.parent = void 0; 442 this._active = false;
vendor: 33,228 bytes, lines 443-1581
443 } 444 } 445 } 446 function effectScope(detached) { 447 return new EffectScope(detached); 448 } 449 function recordEffectScope(effect, scope = activeEffectScope) { 450 if (scope && scope.active) { 451 scope.effects.push(effect); 452 } 453 } 454 function getCurrentScope() { 455 return activeEffectScope; 456 } 457 function onScopeDispose(fn) { 458 if (activeEffectScope) { 459 activeEffectScope.cleanups.push(fn); 460 } else { 461 warn$2( 462 `onScopeDispose() is called when there is no active effect scope to be associated with.` 463 ); 464 } 465 } 466 467 let activeEffect; 468 class ReactiveEffect { 469 constructor(fn, trigger, scheduler, scope) { 470 this.fn = fn; 471 this.trigger = trigger; 472 this.scheduler = scheduler; 473 this.active = true; 474 this.deps = []; 475 /** 476 * @internal 477 */ 478 this._dirtyLevel = 4; 479 /** 480 * @internal 481 */ 482 this._trackId = 0; 483 /** 484 * @internal 485 */ 486 this._runnings = 0; 487 /** 488 * @internal 489 */ 490 this._shouldSchedule = false; 491 /** 492 * @internal 493 */ 494 this._depsLength = 0; 495 recordEffectScope(this, scope); 496 } 497 get dirty() { 498 if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { 499 this._dirtyLevel = 1; 500 pauseTracking(); 501 for (let i = 0; i < this._depsLength; i++) { 502 const dep = this.deps[i]; 503 if (dep.computed) { 504 triggerComputed(dep.computed); 505 if (this._dirtyLevel >= 4) { 506 break; 507 } 508 } 509 } 510 if (this._dirtyLevel === 1) { 511 this._dirtyLevel = 0; 512 } 513 resetTracking(); 514 } 515 return this._dirtyLevel >= 4; 516 } 517 set dirty(v) { 518 this._dirtyLevel = v ? 4 : 0; 519 } 520 run() { 521 this._dirtyLevel = 0; 522 if (!this.active) { 523 return this.fn(); 524 } 525 let lastShouldTrack = shouldTrack; 526 let lastEffect = activeEffect; 527 try { 528 shouldTrack = true; 529 activeEffect = this; 530 this._runnings++; 531 preCleanupEffect(this); 532 return this.fn(); 533 } finally { 534 postCleanupEffect(this); 535 this._runnings--; 536 activeEffect = lastEffect; 537 shouldTrack = lastShouldTrack; 538 } 539 } 540 stop() { 541 var _a; 542 if (this.active) { 543 preCleanupEffect(this); 544 postCleanupEffect(this); 545 (_a = this.onStop) == null ? void 0 : _a.call(this); 546 this.active = false; 547 } 548 } 549 } 550 function triggerComputed(computed) { 551 return computed.value; 552 } 553 function preCleanupEffect(effect2) { 554 effect2._trackId++; 555 effect2._depsLength = 0; 556 } 557 function postCleanupEffect(effect2) { 558 if (effect2.deps.length > effect2._depsLength) { 559 for (let i = effect2._depsLength; i < effect2.deps.length; i++) { 560 cleanupDepEffect(effect2.deps[i], effect2); 561 } 562 effect2.deps.length = effect2._depsLength; 563 } 564 } 565 function cleanupDepEffect(dep, effect2) { 566 const trackId = dep.get(effect2); 567 if (trackId !== void 0 && effect2._trackId !== trackId) { 568 dep.delete(effect2); 569 if (dep.size === 0) { 570 dep.cleanup(); 571 } 572 } 573 } 574 function effect(fn, options) { 575 if (fn.effect instanceof ReactiveEffect) { 576 fn = fn.effect.fn; 577 } 578 const _effect = new ReactiveEffect(fn, NOOP, () => { 579 if (_effect.dirty) { 580 _effect.run(); 581 } 582 }); 583 if (options) { 584 extend(_effect, options); 585 if (options.scope) 586 recordEffectScope(_effect, options.scope); 587 } 588 if (!options || !options.lazy) { 589 _effect.run(); 590 } 591 const runner = _effect.run.bind(_effect); 592 runner.effect = _effect; 593 return runner; 594 } 595 function stop(runner) { 596 runner.effect.stop(); 597 } 598 let shouldTrack = true; 599 let pauseScheduleStack = 0; 600 const trackStack = []; 601 function pauseTracking() { 602 trackStack.push(shouldTrack); 603 shouldTrack = false; 604 } 605 function resetTracking() { 606 const last = trackStack.pop(); 607 shouldTrack = last === void 0 ? true : last; 608 } 609 function pauseScheduling() { 610 pauseScheduleStack++; 611 } 612 function resetScheduling() { 613 pauseScheduleStack--; 614 while (!pauseScheduleStack && queueEffectSchedulers.length) { 615 queueEffectSchedulers.shift()(); 616 } 617 } 618 function trackEffect(effect2, dep, debuggerEventExtraInfo) { 619 var _a; 620 if (dep.get(effect2) !== effect2._trackId) { 621 dep.set(effect2, effect2._trackId); 622 const oldDep = effect2.deps[effect2._depsLength]; 623 if (oldDep !== dep) { 624 if (oldDep) { 625 cleanupDepEffect(oldDep, effect2); 626 } 627 effect2.deps[effect2._depsLength++] = dep; 628 } else { 629 effect2._depsLength++; 630 } 631 { 632 (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); 633 } 634 } 635 } 636 const queueEffectSchedulers = []; 637 function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { 638 var _a; 639 pauseScheduling(); 640 for (const effect2 of dep.keys()) { 641 let tracking; 642 if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { 643 effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); 644 effect2._dirtyLevel = dirtyLevel; 645 } 646 if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { 647 { 648 (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); 649 } 650 effect2.trigger(); 651 if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { 652 effect2._shouldSchedule = false; 653 if (effect2.scheduler) { 654 queueEffectSchedulers.push(effect2.scheduler); 655 } 656 } 657 } 658 } 659 resetScheduling(); 660 } 661 662 const createDep = (cleanup, computed) => { 663 const dep = /* @__PURE__ */ new Map(); 664 dep.cleanup = cleanup; 665 dep.computed = computed; 666 return dep; 667 }; 668 669 const targetMap = /* @__PURE__ */ new WeakMap(); 670 const ITERATE_KEY = Symbol("iterate" ); 671 const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" ); 672 function track(target, type, key) { 673 if (shouldTrack && activeEffect) { 674 let depsMap = targetMap.get(target); 675 if (!depsMap) { 676 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 677 } 678 let dep = depsMap.get(key); 679 if (!dep) { 680 depsMap.set(key, dep = createDep(() => depsMap.delete(key))); 681 } 682 trackEffect( 683 activeEffect, 684 dep, 685 { 686 target, 687 type, 688 key 689 } 690 ); 691 } 692 } 693 function trigger(target, type, key, newValue, oldValue, oldTarget) { 694 const depsMap = targetMap.get(target); 695 if (!depsMap) { 696 return; 697 } 698 let deps = []; 699 if (type === "clear") { 700 deps = [...depsMap.values()]; 701 } else if (key === "length" && isArray(target)) { 702 const newLength = Number(newValue); 703 depsMap.forEach((dep, key2) => { 704 if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { 705 deps.push(dep); 706 } 707 }); 708 } else { 709 if (key !== void 0) { 710 deps.push(depsMap.get(key)); 711 } 712 switch (type) { 713 case "add": 714 if (!isArray(target)) { 715 deps.push(depsMap.get(ITERATE_KEY)); 716 if (isMap(target)) { 717 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); 718 } 719 } else if (isIntegerKey(key)) { 720 deps.push(depsMap.get("length")); 721 } 722 break; 723 case "delete": 724 if (!isArray(target)) { 725 deps.push(depsMap.get(ITERATE_KEY)); 726 if (isMap(target)) { 727 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); 728 } 729 } 730 break; 731 case "set": 732 if (isMap(target)) { 733 deps.push(depsMap.get(ITERATE_KEY)); 734 } 735 break; 736 } 737 } 738 pauseScheduling(); 739 for (const dep of deps) { 740 if (dep) { 741 triggerEffects( 742 dep, 743 4, 744 { 745 target, 746 type, 747 key, 748 newValue, 749 oldValue, 750 oldTarget 751 } 752 ); 753 } 754 } 755 resetScheduling(); 756 } 757 function getDepFromReactive(object, key) { 758 var _a; 759 return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key); 760 } 761 762 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 763 const builtInSymbols = new Set( 764 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 765 ); 766 const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); 767 function createArrayInstrumentations() { 768 const instrumentations = {}; 769 ["includes", "indexOf", "lastIndexOf"].forEach((key) => { 770 instrumentations[key] = function(...args) { 771 const arr = toRaw(this); 772 for (let i = 0, l = this.length; i < l; i++) { 773 track(arr, "get", i + ""); 774 } 775 const res = arr[key](...args); 776 if (res === -1 || res === false) { 777 return arr[key](...args.map(toRaw)); 778 } else { 779 return res; 780 } 781 }; 782 }); 783 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { 784 instrumentations[key] = function(...args) { 785 pauseTracking(); 786 pauseScheduling(); 787 const res = toRaw(this)[key].apply(this, args); 788 resetScheduling(); 789 resetTracking(); 790 return res; 791 }; 792 }); 793 return instrumentations; 794 } 795 function hasOwnProperty(key) { 796 const obj = toRaw(this); 797 track(obj, "has", key); 798 return obj.hasOwnProperty(key); 799 } 800 class BaseReactiveHandler { 801 constructor(_isReadonly = false, _isShallow = false) { 802 this._isReadonly = _isReadonly; 803 this._isShallow = _isShallow; 804 } 805 get(target, key, receiver) { 806 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 807 if (key === "__v_isReactive") { 808 return !isReadonly2; 809 } else if (key === "__v_isReadonly") { 810 return isReadonly2; 811 } else if (key === "__v_isShallow") { 812 return isShallow2; 813 } else if (key === "__v_raw") { 814 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 815 // this means the reciever is a user proxy of the reactive proxy 816 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 817 return target; 818 } 819 return; 820 } 821 const targetIsArray = isArray(target); 822 if (!isReadonly2) { 823 if (targetIsArray && hasOwn(arrayInstrumentations, key)) { 824 return Reflect.get(arrayInstrumentations, key, receiver); 825 } 826 if (key === "hasOwnProperty") { 827 return hasOwnProperty; 828 } 829 } 830 const res = Reflect.get(target, key, receiver); 831 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 832 return res; 833 } 834 if (!isReadonly2) { 835 track(target, "get", key); 836 } 837 if (isShallow2) { 838 return res; 839 } 840 if (isRef(res)) { 841 return targetIsArray && isIntegerKey(key) ? res : res.value; 842 } 843 if (isObject(res)) { 844 return isReadonly2 ? readonly(res) : reactive(res); 845 } 846 return res; 847 } 848 } 849 class MutableReactiveHandler extends BaseReactiveHandler { 850 constructor(isShallow2 = false) { 851 super(false, isShallow2); 852 } 853 set(target, key, value, receiver) { 854 let oldValue = target[key]; 855 if (!this._isShallow) { 856 const isOldValueReadonly = isReadonly(oldValue); 857 if (!isShallow(value) && !isReadonly(value)) { 858 oldValue = toRaw(oldValue); 859 value = toRaw(value); 860 } 861 if (!isArray(target) && isRef(oldValue) && !isRef(value)) { 862 if (isOldValueReadonly) { 863 return false; 864 } else { 865 oldValue.value = value; 866 return true; 867 } 868 } 869 } 870 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 871 const result = Reflect.set(target, key, value, receiver); 872 if (target === toRaw(receiver)) { 873 if (!hadKey) { 874 trigger(target, "add", key, value); 875 } else if (hasChanged(value, oldValue)) { 876 trigger(target, "set", key, value, oldValue); 877 } 878 } 879 return result; 880 } 881 deleteProperty(target, key) { 882 const hadKey = hasOwn(target, key); 883 const oldValue = target[key]; 884 const result = Reflect.deleteProperty(target, key); 885 if (result && hadKey) { 886 trigger(target, "delete", key, void 0, oldValue); 887 } 888 return result; 889 } 890 has(target, key) { 891 const result = Reflect.has(target, key); 892 if (!isSymbol(key) || !builtInSymbols.has(key)) { 893 track(target, "has", key); 894 } 895 return result; 896 } 897 ownKeys(target) { 898 track( 899 target, 900 "iterate", 901 isArray(target) ? "length" : ITERATE_KEY 902 ); 903 return Reflect.ownKeys(target); 904 } 905 } 906 class ReadonlyReactiveHandler extends BaseReactiveHandler { 907 constructor(isShallow2 = false) { 908 super(true, isShallow2); 909 } 910 set(target, key) { 911 { 912 warn$2( 913 `Set operation on key "${String(key)}" failed: target is readonly.`, 914 target 915 ); 916 } 917 return true; 918 } 919 deleteProperty(target, key) { 920 { 921 warn$2( 922 `Delete operation on key "${String(key)}" failed: target is readonly.`, 923 target 924 ); 925 } 926 return true; 927 } 928 } 929 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 930 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 931 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( 932 true 933 ); 934 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 935 936 const toShallow = (value) => value; 937 const getProto = (v) => Reflect.getPrototypeOf(v); 938 function get(target, key, isReadonly = false, isShallow = false) { 939 target = target["__v_raw"]; 940 const rawTarget = toRaw(target); 941 const rawKey = toRaw(key); 942 if (!isReadonly) { 943 if (hasChanged(key, rawKey)) { 944 track(rawTarget, "get", key); 945 } 946 track(rawTarget, "get", rawKey); 947 } 948 const { has: has2 } = getProto(rawTarget); 949 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 950 if (has2.call(rawTarget, key)) { 951 return wrap(target.get(key)); 952 } else if (has2.call(rawTarget, rawKey)) { 953 return wrap(target.get(rawKey)); 954 } else if (target !== rawTarget) { 955 target.get(key); 956 } 957 } 958 function has(key, isReadonly = false) { 959 const target = this["__v_raw"]; 960 const rawTarget = toRaw(target); 961 const rawKey = toRaw(key); 962 if (!isReadonly) { 963 if (hasChanged(key, rawKey)) { 964 track(rawTarget, "has", key); 965 } 966 track(rawTarget, "has", rawKey); 967 } 968 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 969 } 970 function size(target, isReadonly = false) { 971 target = target["__v_raw"]; 972 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY); 973 return Reflect.get(target, "size", target); 974 } 975 function add(value) { 976 value = toRaw(value); 977 const target = toRaw(this); 978 const proto = getProto(target); 979 const hadKey = proto.has.call(target, value); 980 if (!hadKey) { 981 target.add(value); 982 trigger(target, "add", value, value); 983 } 984 return this; 985 } 986 function set(key, value) { 987 value = toRaw(value); 988 const target = toRaw(this); 989 const { has: has2, get: get2 } = getProto(target); 990 let hadKey = has2.call(target, key); 991 if (!hadKey) { 992 key = toRaw(key); 993 hadKey = has2.call(target, key); 994 } else { 995 checkIdentityKeys(target, has2, key); 996 } 997 const oldValue = get2.call(target, key); 998 target.set(key, value); 999 if (!hadKey) { 1000 trigger(target, "add", key, value); 1001 } else if (hasChanged(value, oldValue)) { 1002 trigger(target, "set", key, value, oldValue); 1003 } 1004 return this; 1005 } 1006 function deleteEntry(key) { 1007 const target = toRaw(this); 1008 const { has: has2, get: get2 } = getProto(target); 1009 let hadKey = has2.call(target, key); 1010 if (!hadKey) { 1011 key = toRaw(key); 1012 hadKey = has2.call(target, key); 1013 } else { 1014 checkIdentityKeys(target, has2, key); 1015 } 1016 const oldValue = get2 ? get2.call(target, key) : void 0; 1017 const result = target.delete(key); 1018 if (hadKey) { 1019 trigger(target, "delete", key, void 0, oldValue); 1020 } 1021 return result; 1022 } 1023 function clear() { 1024 const target = toRaw(this); 1025 const hadItems = target.size !== 0; 1026 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; 1027 const result = target.clear(); 1028 if (hadItems) { 1029 trigger(target, "clear", void 0, void 0, oldTarget); 1030 } 1031 return result; 1032 } 1033 function createForEach(isReadonly, isShallow) { 1034 return function forEach(callback, thisArg) { 1035 const observed = this; 1036 const target = observed["__v_raw"]; 1037 const rawTarget = toRaw(target); 1038 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 1039 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY); 1040 return target.forEach((value, key) => { 1041 return callback.call(thisArg, wrap(value), wrap(key), observed); 1042 }); 1043 }; 1044 } 1045 function createIterableMethod(method, isReadonly, isShallow) { 1046 return function(...args) { 1047 const target = this["__v_raw"]; 1048 const rawTarget = toRaw(target); 1049 const targetIsMap = isMap(rawTarget); 1050 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1051 const isKeyOnly = method === "keys" && targetIsMap; 1052 const innerIterator = target[method](...args); 1053 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 1054 !isReadonly && track( 1055 rawTarget, 1056 "iterate", 1057 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1058 ); 1059 return { 1060 // iterator protocol 1061 next() { 1062 const { value, done } = innerIterator.next(); 1063 return done ? { value, done } : { 1064 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1065 done 1066 }; 1067 }, 1068 // iterable protocol 1069 [Symbol.iterator]() { 1070 return this; 1071 } 1072 }; 1073 }; 1074 } 1075 function createReadonlyMethod(type) { 1076 return function(...args) { 1077 { 1078 const key = args[0] ? `on key "${args[0]}" ` : ``; 1079 warn$2( 1080 `${capitalize(type)} operation ${key}failed: target is readonly.`, 1081 toRaw(this) 1082 ); 1083 } 1084 return type === "delete" ? false : type === "clear" ? void 0 : this; 1085 }; 1086 } 1087 function createInstrumentations() { 1088 const mutableInstrumentations2 = { 1089 get(key) { 1090 return get(this, key); 1091 }, 1092 get size() { 1093 return size(this); 1094 }, 1095 has, 1096 add, 1097 set, 1098 delete: deleteEntry, 1099 clear, 1100 forEach: createForEach(false, false) 1101 }; 1102 const shallowInstrumentations2 = { 1103 get(key) { 1104 return get(this, key, false, true); 1105 }, 1106 get size() { 1107 return size(this); 1108 }, 1109 has, 1110 add, 1111 set, 1112 delete: deleteEntry, 1113 clear, 1114 forEach: createForEach(false, true) 1115 }; 1116 const readonlyInstrumentations2 = { 1117 get(key) { 1118 return get(this, key, true); 1119 }, 1120 get size() { 1121 return size(this, true); 1122 }, 1123 has(key) { 1124 return has.call(this, key, true); 1125 }, 1126 add: createReadonlyMethod("add"), 1127 set: createReadonlyMethod("set"), 1128 delete: createReadonlyMethod("delete"), 1129 clear: createReadonlyMethod("clear"), 1130 forEach: createForEach(true, false) 1131 }; 1132 const shallowReadonlyInstrumentations2 = { 1133 get(key) { 1134 return get(this, key, true, true); 1135 }, 1136 get size() { 1137 return size(this, true); 1138 }, 1139 has(key) { 1140 return has.call(this, key, true); 1141 }, 1142 add: createReadonlyMethod("add"), 1143 set: createReadonlyMethod("set"), 1144 delete: createReadonlyMethod("delete"), 1145 clear: createReadonlyMethod("clear"), 1146 forEach: createForEach(true, true) 1147 }; 1148 const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; 1149 iteratorMethods.forEach((method) => { 1150 mutableInstrumentations2[method] = createIterableMethod( 1151 method, 1152 false, 1153 false 1154 ); 1155 readonlyInstrumentations2[method] = createIterableMethod( 1156 method, 1157 true, 1158 false 1159 ); 1160 shallowInstrumentations2[method] = createIterableMethod( 1161 method, 1162 false, 1163 true 1164 ); 1165 shallowReadonlyInstrumentations2[method] = createIterableMethod( 1166 method, 1167 true, 1168 true 1169 ); 1170 }); 1171 return [ 1172 mutableInstrumentations2, 1173 readonlyInstrumentations2, 1174 shallowInstrumentations2, 1175 shallowReadonlyInstrumentations2 1176 ]; 1177 } 1178 const [ 1179 mutableInstrumentations, 1180 readonlyInstrumentations, 1181 shallowInstrumentations, 1182 shallowReadonlyInstrumentations 1183 ] = /* @__PURE__ */ createInstrumentations(); 1184 function createInstrumentationGetter(isReadonly, shallow) { 1185 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; 1186 return (target, key, receiver) => { 1187 if (key === "__v_isReactive") { 1188 return !isReadonly; 1189 } else if (key === "__v_isReadonly") { 1190 return isReadonly; 1191 } else if (key === "__v_raw") { 1192 return target; 1193 } 1194 return Reflect.get( 1195 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1196 key, 1197 receiver 1198 ); 1199 }; 1200 } 1201 const mutableCollectionHandlers = { 1202 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1203 }; 1204 const shallowCollectionHandlers = { 1205 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1206 }; 1207 const readonlyCollectionHandlers = { 1208 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1209 }; 1210 const shallowReadonlyCollectionHandlers = { 1211 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1212 }; 1213 function checkIdentityKeys(target, has2, key) { 1214 const rawKey = toRaw(key); 1215 if (rawKey !== key && has2.call(target, rawKey)) { 1216 const type = toRawType(target); 1217 warn$2( 1218 `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` 1219 ); 1220 } 1221 } 1222 1223 const reactiveMap = /* @__PURE__ */ new WeakMap(); 1224 const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1225 const readonlyMap = /* @__PURE__ */ new WeakMap(); 1226 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1227 function targetTypeMap(rawType) { 1228 switch (rawType) { 1229 case "Object": 1230 case "Array": 1231 return 1 /* COMMON */; 1232 case "Map": 1233 case "Set": 1234 case "WeakMap": 1235 case "WeakSet": 1236 return 2 /* COLLECTION */; 1237 default: 1238 return 0 /* INVALID */; 1239 } 1240 } 1241 function getTargetType(value) { 1242 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); 1243 } 1244 function reactive(target) { 1245 if (isReadonly(target)) { 1246 return target; 1247 } 1248 return createReactiveObject( 1249 target, 1250 false, 1251 mutableHandlers, 1252 mutableCollectionHandlers, 1253 reactiveMap 1254 ); 1255 } 1256 function shallowReactive(target) { 1257 return createReactiveObject( 1258 target, 1259 false, 1260 shallowReactiveHandlers, 1261 shallowCollectionHandlers, 1262 shallowReactiveMap 1263 ); 1264 } 1265 function readonly(target) { 1266 return createReactiveObject( 1267 target, 1268 true, 1269 readonlyHandlers, 1270 readonlyCollectionHandlers, 1271 readonlyMap 1272 ); 1273 } 1274 function shallowReadonly(target) { 1275 return createReactiveObject( 1276 target, 1277 true, 1278 shallowReadonlyHandlers, 1279 shallowReadonlyCollectionHandlers, 1280 shallowReadonlyMap 1281 ); 1282 } 1283 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1284 if (!isObject(target)) { 1285 { 1286 warn$2(`value cannot be made reactive: ${String(target)}`); 1287 } 1288 return target; 1289 } 1290 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1291 return target; 1292 } 1293 const existingProxy = proxyMap.get(target); 1294 if (existingProxy) { 1295 return existingProxy; 1296 } 1297 const targetType = getTargetType(target); 1298 if (targetType === 0 /* INVALID */) { 1299 return target; 1300 } 1301 const proxy = new Proxy( 1302 target, 1303 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers 1304 ); 1305 proxyMap.set(target, proxy); 1306 return proxy; 1307 } 1308 function isReactive(value) { 1309 if (isReadonly(value)) { 1310 return isReactive(value["__v_raw"]); 1311 } 1312 return !!(value && value["__v_isReactive"]); 1313 } 1314 function isReadonly(value) { 1315 return !!(value && value["__v_isReadonly"]); 1316 } 1317 function isShallow(value) { 1318 return !!(value && value["__v_isShallow"]); 1319 } 1320 function isProxy(value) { 1321 return isReactive(value) || isReadonly(value); 1322 } 1323 function toRaw(observed) { 1324 const raw = observed && observed["__v_raw"]; 1325 return raw ? toRaw(raw) : observed; 1326 } 1327 function markRaw(value) { 1328 if (Object.isExtensible(value)) { 1329 def(value, "__v_skip", true); 1330 } 1331 return value; 1332 } 1333 const toReactive = (value) => isObject(value) ? reactive(value) : value; 1334 const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1335 1336 const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; 1337 class ComputedRefImpl { 1338 constructor(getter, _setter, isReadonly, isSSR) { 1339 this.getter = getter; 1340 this._setter = _setter; 1341 this.dep = void 0; 1342 this.__v_isRef = true; 1343 this["__v_isReadonly"] = false; 1344 this.effect = new ReactiveEffect( 1345 () => getter(this._value), 1346 () => triggerRefValue( 1347 this, 1348 this.effect._dirtyLevel === 2 ? 2 : 3 1349 ) 1350 ); 1351 this.effect.computed = this; 1352 this.effect.active = this._cacheable = !isSSR; 1353 this["__v_isReadonly"] = isReadonly; 1354 } 1355 get value() { 1356 const self = toRaw(this); 1357 if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) { 1358 triggerRefValue(self, 4); 1359 } 1360 trackRefValue(self); 1361 if (self.effect._dirtyLevel >= 2) { 1362 if (this._warnRecursive) { 1363 warn$2(COMPUTED_SIDE_EFFECT_WARN, ` 1364 1365getter: `, this.getter); 1366 } 1367 triggerRefValue(self, 2); 1368 } 1369 return self._value; 1370 } 1371 set value(newValue) { 1372 this._setter(newValue); 1373 } 1374 // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x 1375 get _dirty() { 1376 return this.effect.dirty; 1377 } 1378 set _dirty(v) { 1379 this.effect.dirty = v; 1380 } 1381 // #endregion 1382 } 1383 function computed$1(getterOrOptions, debugOptions, isSSR = false) { 1384 let getter; 1385 let setter; 1386 const onlyGetter = isFunction(getterOrOptions); 1387 if (onlyGetter) { 1388 getter = getterOrOptions; 1389 setter = () => { 1390 warn$2("Write operation failed: computed value is readonly"); 1391 } ; 1392 } else { 1393 getter = getterOrOptions.get; 1394 setter = getterOrOptions.set; 1395 } 1396 const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); 1397 if (debugOptions && !isSSR) { 1398 cRef.effect.onTrack = debugOptions.onTrack; 1399 cRef.effect.onTrigger = debugOptions.onTrigger; 1400 } 1401 return cRef; 1402 } 1403 1404 function trackRefValue(ref2) { 1405 var _a; 1406 if (shouldTrack && activeEffect) { 1407 ref2 = toRaw(ref2); 1408 trackEffect( 1409 activeEffect, 1410 (_a = ref2.dep) != null ? _a : ref2.dep = createDep( 1411 () => ref2.dep = void 0, 1412 ref2 instanceof ComputedRefImpl ? ref2 : void 0 1413 ), 1414 { 1415 target: ref2, 1416 type: "get", 1417 key: "value" 1418 } 1419 ); 1420 } 1421 } 1422 function triggerRefValue(ref2, dirtyLevel = 4, newVal) { 1423 ref2 = toRaw(ref2); 1424 const dep = ref2.dep; 1425 if (dep) { 1426 triggerEffects( 1427 dep, 1428 dirtyLevel, 1429 { 1430 target: ref2, 1431 type: "set", 1432 key: "value", 1433 newValue: newVal 1434 } 1435 ); 1436 } 1437 } 1438 function isRef(r) { 1439 return !!(r && r.__v_isRef === true); 1440 } 1441 function ref(value) { 1442 return createRef(value, false); 1443 } 1444 function shallowRef(value) { 1445 return createRef(value, true); 1446 } 1447 function createRef(rawValue, shallow) { 1448 if (isRef(rawValue)) { 1449 return rawValue; 1450 } 1451 return new RefImpl(rawValue, shallow); 1452 } 1453 class RefImpl { 1454 constructor(value, __v_isShallow) { 1455 this.__v_isShallow = __v_isShallow; 1456 this.dep = void 0; 1457 this.__v_isRef = true; 1458 this._rawValue = __v_isShallow ? value : toRaw(value); 1459 this._value = __v_isShallow ? value : toReactive(value); 1460 } 1461 get value() { 1462 trackRefValue(this); 1463 return this._value; 1464 } 1465 set value(newVal) { 1466 const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); 1467 newVal = useDirectValue ? newVal : toRaw(newVal); 1468 if (hasChanged(newVal, this._rawValue)) { 1469 this._rawValue = newVal; 1470 this._value = useDirectValue ? newVal : toReactive(newVal); 1471 triggerRefValue(this, 4, newVal); 1472 } 1473 } 1474 } 1475 function triggerRef(ref2) { 1476 triggerRefValue(ref2, 4, ref2.value ); 1477 } 1478 function unref(ref2) { 1479 return isRef(ref2) ? ref2.value : ref2; 1480 } 1481 function toValue(source) { 1482 return isFunction(source) ? source() : unref(source); 1483 } 1484 const shallowUnwrapHandlers = { 1485 get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), 1486 set: (target, key, value, receiver) => { 1487 const oldValue = target[key]; 1488 if (isRef(oldValue) && !isRef(value)) { 1489 oldValue.value = value; 1490 return true; 1491 } else { 1492 return Reflect.set(target, key, value, receiver); 1493 } 1494 } 1495 }; 1496 function proxyRefs(objectWithRefs) { 1497 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1498 } 1499 class CustomRefImpl { 1500 constructor(factory) { 1501 this.dep = void 0; 1502 this.__v_isRef = true; 1503 const { get, set } = factory( 1504 () => trackRefValue(this), 1505 () => triggerRefValue(this) 1506 ); 1507 this._get = get; 1508 this._set = set; 1509 } 1510 get value() { 1511 return this._get(); 1512 } 1513 set value(newVal) { 1514 this._set(newVal); 1515 } 1516 } 1517 function customRef(factory) { 1518 return new CustomRefImpl(factory); 1519 } 1520 function toRefs(object) { 1521 if (!isProxy(object)) { 1522 warn$2(`toRefs() expects a reactive object but received a plain one.`); 1523 } 1524 const ret = isArray(object) ? new Array(object.length) : {}; 1525 for (const key in object) { 1526 ret[key] = propertyToRef(object, key); 1527 } 1528 return ret; 1529 } 1530 class ObjectRefImpl { 1531 constructor(_object, _key, _defaultValue) { 1532 this._object = _object; 1533 this._key = _key; 1534 this._defaultValue = _defaultValue; 1535 this.__v_isRef = true; 1536 } 1537 get value() { 1538 const val = this._object[this._key]; 1539 return val === void 0 ? this._defaultValue : val; 1540 } 1541 set value(newVal) { 1542 this._object[this._key] = newVal; 1543 } 1544 get dep() { 1545 return getDepFromReactive(toRaw(this._object), this._key); 1546 } 1547 } 1548 class GetterRefImpl { 1549 constructor(_getter) { 1550 this._getter = _getter; 1551 this.__v_isRef = true; 1552 this.__v_isReadonly = true; 1553 } 1554 get value() { 1555 return this._getter(); 1556 } 1557 } 1558 function toRef(source, key, defaultValue) { 1559 if (isRef(source)) { 1560 return source; 1561 } else if (isFunction(source)) { 1562 return new GetterRefImpl(source); 1563 } else if (isObject(source) && arguments.length > 1) { 1564 return propertyToRef(source, key, defaultValue); 1565 } else { 1566 return ref(source); 1567 } 1568 } 1569 function propertyToRef(source, key, defaultValue) { 1570 const val = source[key]; 1571 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); 1572 } 1573 1574 const TrackOpTypes = { 1575 "GET": "get", 1576 "HAS": "has", 1577 "ITERATE": "iterate" 1578 }; 1579 const TriggerOpTypes = { 1580 "SET": "set", 1581 "ADD": "add",
vendor: 6,505 bytes, lines 1582-1795
1582 "DELETE": "delete", 1583 "CLEAR": "clear" 1584 }; 1585 1586 const stack$1 = []; 1587 function pushWarningContext(vnode) { 1588 stack$1.push(vnode); 1589 } 1590 function popWarningContext() { 1591 stack$1.pop(); 1592 } 1593 function warn$1(msg, ...args) { 1594 pauseTracking(); 1595 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null; 1596 const appWarnHandler = instance && instance.appContext.config.warnHandler; 1597 const trace = getComponentTrace(); 1598 if (appWarnHandler) { 1599 callWithErrorHandling( 1600 appWarnHandler, 1601 instance, 1602 11, 1603 [ 1604 msg + args.map((a) => { 1605 var _a, _b; 1606 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); 1607 }).join(""), 1608 instance && instance.proxy, 1609 trace.map( 1610 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 1611 ).join("\n"), 1612 trace 1613 ] 1614 ); 1615 } else { 1616 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 1617 if (trace.length && // avoid spamming console during tests 1618 true) { 1619 warnArgs.push(` 1620`, ...formatTrace(trace)); 1621 } 1622 console.warn(...warnArgs); 1623 } 1624 resetTracking(); 1625 } 1626 function getComponentTrace() { 1627 let currentVNode = stack$1[stack$1.length - 1]; 1628 if (!currentVNode) { 1629 return []; 1630 } 1631 const normalizedStack = []; 1632 while (currentVNode) { 1633 const last = normalizedStack[0]; 1634 if (last && last.vnode === currentVNode) { 1635 last.recurseCount++; 1636 } else { 1637 normalizedStack.push({ 1638 vnode: currentVNode, 1639 recurseCount: 0 1640 }); 1641 } 1642 const parentInstance = currentVNode.component && currentVNode.component.parent; 1643 currentVNode = parentInstance && parentInstance.vnode; 1644 } 1645 return normalizedStack; 1646 } 1647 function formatTrace(trace) { 1648 const logs = []; 1649 trace.forEach((entry, i) => { 1650 logs.push(...i === 0 ? [] : [` 1651`], ...formatTraceEntry(entry)); 1652 }); 1653 return logs; 1654 } 1655 function formatTraceEntry({ vnode, recurseCount }) { 1656 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 1657 const isRoot = vnode.component ? vnode.component.parent == null : false; 1658 const open = ` at <${formatComponentName( 1659 vnode.component, 1660 vnode.type, 1661 isRoot 1662 )}`; 1663 const close = `>` + postfix; 1664 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; 1665 } 1666 function formatProps(props) { 1667 const res = []; 1668 const keys = Object.keys(props); 1669 keys.slice(0, 3).forEach((key) => { 1670 res.push(...formatProp(key, props[key])); 1671 }); 1672 if (keys.length > 3) { 1673 res.push(` ...`); 1674 } 1675 return res; 1676 } 1677 function formatProp(key, value, raw) { 1678 if (isString(value)) { 1679 value = JSON.stringify(value); 1680 return raw ? value : [`${key}=${value}`]; 1681 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 1682 return raw ? value : [`${key}=${value}`]; 1683 } else if (isRef(value)) { 1684 value = formatProp(key, toRaw(value.value), true); 1685 return raw ? value : [`${key}=Ref<`, value, `>`]; 1686 } else if (isFunction(value)) { 1687 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 1688 } else { 1689 value = toRaw(value); 1690 return raw ? value : [`${key}=`, value]; 1691 } 1692 } 1693 function assertNumber(val, type) { 1694 if (val === void 0) { 1695 return; 1696 } else if (typeof val !== "number") { 1697 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); 1698 } else if (isNaN(val)) { 1699 warn$1(`${type} is NaN - the duration expression might be incorrect.`); 1700 } 1701 } 1702 1703 const ErrorCodes = { 1704 "SETUP_FUNCTION": 0, 1705 "0": "SETUP_FUNCTION", 1706 "RENDER_FUNCTION": 1, 1707 "1": "RENDER_FUNCTION", 1708 "WATCH_GETTER": 2, 1709 "2": "WATCH_GETTER", 1710 "WATCH_CALLBACK": 3, 1711 "3": "WATCH_CALLBACK", 1712 "WATCH_CLEANUP": 4, 1713 "4": "WATCH_CLEANUP", 1714 "NATIVE_EVENT_HANDLER": 5, 1715 "5": "NATIVE_EVENT_HANDLER", 1716 "COMPONENT_EVENT_HANDLER": 6, 1717 "6": "COMPONENT_EVENT_HANDLER", 1718 "VNODE_HOOK": 7, 1719 "7": "VNODE_HOOK", 1720 "DIRECTIVE_HOOK": 8, 1721 "8": "DIRECTIVE_HOOK", 1722 "TRANSITION_HOOK": 9, 1723 "9": "TRANSITION_HOOK", 1724 "APP_ERROR_HANDLER": 10, 1725 "10": "APP_ERROR_HANDLER", 1726 "APP_WARN_HANDLER": 11, 1727 "11": "APP_WARN_HANDLER", 1728 "FUNCTION_REF": 12, 1729 "12": "FUNCTION_REF", 1730 "ASYNC_COMPONENT_LOADER": 13, 1731 "13": "ASYNC_COMPONENT_LOADER", 1732 "SCHEDULER": 14, 1733 "14": "SCHEDULER" 1734 }; 1735 const ErrorTypeStrings$1 = { 1736 ["sp"]: "serverPrefetch hook", 1737 ["bc"]: "beforeCreate hook", 1738 ["c"]: "created hook", 1739 ["bm"]: "beforeMount hook", 1740 ["m"]: "mounted hook", 1741 ["bu"]: "beforeUpdate hook", 1742 ["u"]: "updated", 1743 ["bum"]: "beforeUnmount hook", 1744 ["um"]: "unmounted hook", 1745 ["a"]: "activated hook", 1746 ["da"]: "deactivated hook", 1747 ["ec"]: "errorCaptured hook", 1748 ["rtc"]: "renderTracked hook", 1749 ["rtg"]: "renderTriggered hook", 1750 [0]: "setup function", 1751 [1]: "render function", 1752 [2]: "watcher getter", 1753 [3]: "watcher callback", 1754 [4]: "watcher cleanup function", 1755 [5]: "native event handler", 1756 [6]: "component event handler", 1757 [7]: "vnode hook", 1758 [8]: "directive hook", 1759 [9]: "transition hook", 1760 [10]: "app errorHandler", 1761 [11]: "app warnHandler", 1762 [12]: "ref function", 1763 [13]: "async component loader", 1764 [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ." 1765 }; 1766 function callWithErrorHandling(fn, instance, type, args) { 1767 try { 1768 return args ? fn(...args) : fn(); 1769 } catch (err) { 1770 handleError(err, instance, type); 1771 } 1772 } 1773 function callWithAsyncErrorHandling(fn, instance, type, args) { 1774 if (isFunction(fn)) { 1775 const res = callWithErrorHandling(fn, instance, type, args); 1776 if (res && isPromise(res)) { 1777 res.catch((err) => { 1778 handleError(err, instance, type); 1779 }); 1780 } 1781 return res; 1782 } 1783 const values = []; 1784 for (let i = 0; i < fn.length; i++) { 1785 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); 1786 } 1787 return values; 1788 } 1789 function handleError(err, instance, type, throwInDev = true) { 1790 const contextVNode = instance ? instance.vnode : null; 1791 if (instance) { 1792 let cur = instance.parent; 1793 const exposedInstance = instance.proxy; 1794 const errorInfo = ErrorTypeStrings$1[type] ; 1795 while (cur) {
1796 const errorCapturedHooks = cur.ec; 1797 if (errorCapturedHooks) { 1798 for (let i = 0; i < errorCapturedHooks.length; i++) { 1799 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 1800 return; 1801 } 1802 } 1803 } 1804 cur = cur.parent; 1805 } 1806 const appErrorHandler = instance.appContext.config.errorHandler; 1807 if (appErrorHandler) { 1808 callWithErrorHandling( 1809 appErrorHandler, 1810 null, 1811 10, 1812 [err, exposedInstance, errorInfo] 1813 ); 1814 return; 1815 } 1816 } 1817 logError(err, type, contextVNode, throwInDev); 1818 } 1819 function logError(err, type, contextVNode, throwInDev = true) { 1820 { 1821 const info = ErrorTypeStrings$1[type]; 1822 if (contextVNode) { 1823 pushWarningContext(contextVNode); 1824 } 1825 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); 1826 if (contextVNode) { 1827 popWarningContext(); 1828 } 1829 if (throwInDev) { 1830 throw err; 1831 } else { 1832 console.error(err); 1833 } 1834 } 1835 } 1836 1837 let isFlushing = false; 1838 let isFlushPending = false; 1839 const queue = []; 1840 let flushIndex = 0; 1841 const pendingPostFlushCbs = []; 1842 let activePostFlushCbs = null; 1843 let postFlushIndex = 0; 1844 const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 1845 let currentFlushPromise = null; 1846 const RECURSION_LIMIT = 100; 1847 function nextTick(fn) { 1848 const p = currentFlushPromise || resolvedPromise; 1849 return fn ? p.then(this ? fn.bind(this) : fn) : p; 1850 } 1851 function findInsertionIndex(id) { 1852 let start = flushIndex + 1; 1853 let end = queue.length; 1854 while (start < end) { 1855 const middle = start + end >>> 1; 1856 const middleJob = queue[middle]; 1857 const middleJobId = getId(middleJob); 1858 if (middleJobId < id || middleJobId === id && middleJob.pre) { 1859 start = middle + 1; 1860 } else { 1861 end = middle; 1862 } 1863 } 1864 return start; 1865 } 1866 function queueJob(job) { 1867 if (!queue.length || !queue.includes( 1868 job, 1869 isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex 1870 )) { 1871 if (job.id == null) { 1872 queue.push(job); 1873 } else { 1874 queue.splice(findInsertionIndex(job.id), 0, job); 1875 } 1876 queueFlush(); 1877 } 1878 } 1879 function queueFlush() { 1880 if (!isFlushing && !isFlushPending) { 1881 isFlushPending = true; 1882 currentFlushPromise = resolvedPromise.then(flushJobs); 1883 } 1884 }
1885 function invalidateJob(job) { 1886 const i = queue.indexOf(job); 1887 if (i > flushIndex) { 1888 queue.splice(i, 1); 1889 } 1890 } 1891 function queuePostFlushCb(cb) { 1892 if (!isArray(cb)) { 1893 if (!activePostFlushCbs || !activePostFlushCbs.includes( 1894 cb, 1895 cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex 1896 )) { 1897 pendingPostFlushCbs.push(cb); 1898 } 1899 } else { 1900 pendingPostFlushCbs.push(...cb); 1901 } 1902 queueFlush(); 1903 } 1904 function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) { 1905 { 1906 seen = seen || /* @__PURE__ */ new Map(); 1907 } 1908 for (; i < queue.length; i++) { 1909 const cb = queue[i]; 1910 if (cb && cb.pre) { 1911 if (instance && cb.id !== instance.uid) { 1912 continue; 1913 } 1914 if (checkRecursiveUpdates(seen, cb)) { 1915 continue; 1916 } 1917 queue.splice(i, 1); 1918 i--; 1919 cb(); 1920 } 1921 } 1922 } 1923 function flushPostFlushCbs(seen) { 1924 if (pendingPostFlushCbs.length) { 1925 const deduped = [...new Set(pendingPostFlushCbs)].sort( 1926 (a, b) => getId(a) - getId(b) 1927 ); 1928 pendingPostFlushCbs.length = 0; 1929 if (activePostFlushCbs) { 1930 activePostFlushCbs.push(...deduped); 1931 return; 1932 } 1933 activePostFlushCbs = deduped; 1934 { 1935 seen = seen || /* @__PURE__ */ new Map(); 1936 } 1937 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 1938 if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) { 1939 continue; 1940 } 1941 activePostFlushCbs[postFlushIndex](); 1942 } 1943 activePostFlushCbs = null; 1944 postFlushIndex = 0; 1945 } 1946 } 1947 const getId = (job) => job.id == null ? Infinity : job.id; 1948 const comparator = (a, b) => { 1949 const diff = getId(a) - getId(b); 1950 if (diff === 0) { 1951 if (a.pre && !b.pre) 1952 return -1; 1953 if (b.pre && !a.pre) 1954 return 1; 1955 } 1956 return diff; 1957 }; 1958 function flushJobs(seen) { 1959 isFlushPending = false; 1960 isFlushing = true; 1961 { 1962 seen = seen || /* @__PURE__ */ new Map(); 1963 } 1964 queue.sort(comparator); 1965 const check = (job) => checkRecursiveUpdates(seen, job) ; 1966 try { 1967 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 1968 const job = queue[flushIndex]; 1969 if (job && job.active !== false) { 1970 if (check(job)) { 1971 continue; 1972 } 1973 callWithErrorHandling(job, null, 14); 1974 } 1975 } 1976 } finally { 1977 flushIndex = 0; 1978 queue.length = 0; 1979 flushPostFlushCbs(seen); 1980 isFlushing = false; 1981 currentFlushPromise = null; 1982 if (queue.length || pendingPostFlushCbs.length) { 1983 flushJobs(seen); 1984 } 1985 } 1986 } 1987 function checkRecursiveUpdates(seen, fn) { 1988 if (!seen.has(fn)) { 1989 seen.set(fn, 1); 1990 } else { 1991 const count = seen.get(fn); 1992 if (count > RECURSION_LIMIT) { 1993 const instance = fn.ownerInstance; 1994 const componentName = instance && getComponentName(instance.type); 1995 handleError( 1996 `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, 1997 null, 1998 10 1999 ); 2000 return true; 2001 } else { 2002 seen.set(fn, count + 1); 2003 } 2004 } 2005 } 2006 2007 let isHmrUpdating = false; 2008 const hmrDirtyComponents = /* @__PURE__ */ new Set(); 2009 { 2010 getGlobalThis().__VUE_HMR_RUNTIME__ = { 2011 createRecord: tryWrap(createRecord), 2012 rerender: tryWrap(rerender), 2013 reload: tryWrap(reload) 2014 }; 2015 } 2016 const map = /* @__PURE__ */ new Map(); 2017 function registerHMR(instance) { 2018 const id = instance.type.__hmrId; 2019 let record = map.get(id); 2020 if (!record) { 2021 createRecord(id, instance.type); 2022 record = map.get(id); 2023 } 2024 record.instances.add(instance); 2025 } 2026 function unregisterHMR(instance) { 2027 map.get(instance.type.__hmrId).instances.delete(instance); 2028 } 2029 function createRecord(id, initialDef) { 2030 if (map.has(id)) { 2031 return false;
vendor: 24,935 bytes, lines 2032-2845
2032 } 2033 map.set(id, { 2034 initialDef: normalizeClassComponent(initialDef), 2035 instances: /* @__PURE__ */ new Set() 2036 }); 2037 return true; 2038 } 2039 function normalizeClassComponent(component) { 2040 return isClassComponent(component) ? component.__vccOpts : component; 2041 } 2042 function rerender(id, newRender) { 2043 const record = map.get(id); 2044 if (!record) { 2045 return; 2046 } 2047 record.initialDef.render = newRender; 2048 [...record.instances].forEach((instance) => { 2049 if (newRender) { 2050 instance.render = newRender; 2051 normalizeClassComponent(instance.type).render = newRender; 2052 } 2053 instance.renderCache = []; 2054 isHmrUpdating = true; 2055 instance.effect.dirty = true; 2056 instance.update(); 2057 isHmrUpdating = false; 2058 }); 2059 } 2060 function reload(id, newComp) { 2061 const record = map.get(id); 2062 if (!record) 2063 return; 2064 newComp = normalizeClassComponent(newComp); 2065 updateComponentDef(record.initialDef, newComp); 2066 const instances = [...record.instances]; 2067 for (const instance of instances) { 2068 const oldComp = normalizeClassComponent(instance.type); 2069 if (!hmrDirtyComponents.has(oldComp)) { 2070 if (oldComp !== record.initialDef) { 2071 updateComponentDef(oldComp, newComp); 2072 } 2073 hmrDirtyComponents.add(oldComp); 2074 } 2075 instance.appContext.propsCache.delete(instance.type); 2076 instance.appContext.emitsCache.delete(instance.type); 2077 instance.appContext.optionsCache.delete(instance.type); 2078 if (instance.ceReload) { 2079 hmrDirtyComponents.add(oldComp); 2080 instance.ceReload(newComp.styles); 2081 hmrDirtyComponents.delete(oldComp); 2082 } else if (instance.parent) { 2083 instance.parent.effect.dirty = true; 2084 queueJob(instance.parent.update); 2085 } else if (instance.appContext.reload) { 2086 instance.appContext.reload(); 2087 } else if (typeof window !== "undefined") { 2088 window.location.reload(); 2089 } else { 2090 console.warn( 2091 "[HMR] Root or manually mounted instance modified. Full reload required." 2092 ); 2093 } 2094 } 2095 queuePostFlushCb(() => { 2096 for (const instance of instances) { 2097 hmrDirtyComponents.delete( 2098 normalizeClassComponent(instance.type) 2099 ); 2100 } 2101 }); 2102 } 2103 function updateComponentDef(oldComp, newComp) { 2104 extend(oldComp, newComp); 2105 for (const key in oldComp) { 2106 if (key !== "__file" && !(key in newComp)) { 2107 delete oldComp[key]; 2108 } 2109 } 2110 } 2111 function tryWrap(fn) { 2112 return (id, arg) => { 2113 try { 2114 return fn(id, arg); 2115 } catch (e) { 2116 console.error(e); 2117 console.warn( 2118 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` 2119 ); 2120 } 2121 }; 2122 } 2123 2124 let devtools$1; 2125 let buffer = []; 2126 let devtoolsNotInstalled = false; 2127 function emit$1(event, ...args) { 2128 if (devtools$1) { 2129 devtools$1.emit(event, ...args); 2130 } else if (!devtoolsNotInstalled) { 2131 buffer.push({ event, args }); 2132 } 2133 } 2134 function setDevtoolsHook$1(hook, target) { 2135 var _a, _b; 2136 devtools$1 = hook; 2137 if (devtools$1) { 2138 devtools$1.enabled = true; 2139 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); 2140 buffer = []; 2141 } else if ( 2142 // handle late devtools injection - only do this if we are in an actual 2143 // browser environment to avoid the timer handle stalling test runner exit 2144 // (#4815) 2145 typeof window !== "undefined" && // some envs mock window but not fully 2146 window.HTMLElement && // also exclude jsdom 2147 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) 2148 ) { 2149 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 2150 replay.push((newHook) => { 2151 setDevtoolsHook$1(newHook, target); 2152 }); 2153 setTimeout(() => { 2154 if (!devtools$1) { 2155 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 2156 devtoolsNotInstalled = true; 2157 buffer = []; 2158 } 2159 }, 3e3); 2160 } else { 2161 devtoolsNotInstalled = true; 2162 buffer = []; 2163 } 2164 } 2165 function devtoolsInitApp(app, version) { 2166 emit$1("app:init" /* APP_INIT */, app, version, { 2167 Fragment, 2168 Text, 2169 Comment, 2170 Static 2171 }); 2172 } 2173 function devtoolsUnmountApp(app) { 2174 emit$1("app:unmount" /* APP_UNMOUNT */, app); 2175 } 2176 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook( 2177 "component:added" /* COMPONENT_ADDED */ 2178 ); 2179 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */); 2180 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( 2181 "component:removed" /* COMPONENT_REMOVED */ 2182 ); 2183 const devtoolsComponentRemoved = (component) => { 2184 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered 2185 !devtools$1.cleanupBuffer(component)) { 2186 _devtoolsComponentRemoved(component); 2187 } 2188 }; 2189 function createDevtoolsComponentHook(hook) { 2190 return (component) => { 2191 emit$1( 2192 hook, 2193 component.appContext.app, 2194 component.uid, 2195 component.parent ? component.parent.uid : void 0, 2196 component 2197 ); 2198 }; 2199 } 2200 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook( 2201 "perf:start" /* PERFORMANCE_START */ 2202 ); 2203 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook( 2204 "perf:end" /* PERFORMANCE_END */ 2205 ); 2206 function createDevtoolsPerformanceHook(hook) { 2207 return (component, type, time) => { 2208 emit$1(hook, component.appContext.app, component.uid, component, type, time); 2209 }; 2210 } 2211 function devtoolsComponentEmit(component, event, params) { 2212 emit$1( 2213 "component:emit" /* COMPONENT_EMIT */, 2214 component.appContext.app, 2215 component, 2216 event, 2217 params 2218 ); 2219 } 2220 2221 function emit(instance, event, ...rawArgs) { 2222 if (instance.isUnmounted) 2223 return; 2224 const props = instance.vnode.props || EMPTY_OBJ; 2225 { 2226 const { 2227 emitsOptions, 2228 propsOptions: [propsOptions] 2229 } = instance; 2230 if (emitsOptions) { 2231 if (!(event in emitsOptions) && true) { 2232 if (!propsOptions || !(toHandlerKey(event) in propsOptions)) { 2233 warn$1( 2234 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.` 2235 ); 2236 } 2237 } else { 2238 const validator = emitsOptions[event]; 2239 if (isFunction(validator)) { 2240 const isValid = validator(...rawArgs); 2241 if (!isValid) { 2242 warn$1( 2243 `Invalid event arguments: event validation failed for event "${event}".` 2244 ); 2245 } 2246 } 2247 } 2248 } 2249 } 2250 let args = rawArgs; 2251 const isModelListener = event.startsWith("update:"); 2252 const modelArg = isModelListener && event.slice(7); 2253 if (modelArg && modelArg in props) { 2254 const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; 2255 const { number, trim } = props[modifiersKey] || EMPTY_OBJ; 2256 if (trim) { 2257 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 2258 } 2259 if (number) { 2260 args = rawArgs.map(looseToNumber); 2261 } 2262 } 2263 { 2264 devtoolsComponentEmit(instance, event, args); 2265 } 2266 { 2267 const lowerCaseEvent = event.toLowerCase(); 2268 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 2269 warn$1( 2270 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 2271 instance, 2272 instance.type 2273 )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate( 2274 event 2275 )}" instead of "${event}".` 2276 ); 2277 } 2278 } 2279 let handlerName; 2280 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 2281 props[handlerName = toHandlerKey(camelize(event))]; 2282 if (!handler && isModelListener) { 2283 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 2284 } 2285 if (handler) { 2286 callWithAsyncErrorHandling( 2287 handler, 2288 instance, 2289 6, 2290 args 2291 ); 2292 } 2293 const onceHandler = props[handlerName + `Once`]; 2294 if (onceHandler) { 2295 if (!instance.emitted) { 2296 instance.emitted = {}; 2297 } else if (instance.emitted[handlerName]) { 2298 return; 2299 } 2300 instance.emitted[handlerName] = true; 2301 callWithAsyncErrorHandling( 2302 onceHandler, 2303 instance, 2304 6, 2305 args 2306 ); 2307 } 2308 } 2309 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 2310 const cache = appContext.emitsCache; 2311 const cached = cache.get(comp); 2312 if (cached !== void 0) { 2313 return cached; 2314 } 2315 const raw = comp.emits; 2316 let normalized = {}; 2317 let hasExtends = false; 2318 if (!isFunction(comp)) { 2319 const extendEmits = (raw2) => { 2320 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 2321 if (normalizedFromExtend) { 2322 hasExtends = true; 2323 extend(normalized, normalizedFromExtend); 2324 } 2325 }; 2326 if (!asMixin && appContext.mixins.length) { 2327 appContext.mixins.forEach(extendEmits); 2328 } 2329 if (comp.extends) { 2330 extendEmits(comp.extends); 2331 } 2332 if (comp.mixins) { 2333 comp.mixins.forEach(extendEmits); 2334 } 2335 } 2336 if (!raw && !hasExtends) { 2337 if (isObject(comp)) { 2338 cache.set(comp, null); 2339 } 2340 return null; 2341 } 2342 if (isArray(raw)) { 2343 raw.forEach((key) => normalized[key] = null); 2344 } else { 2345 extend(normalized, raw); 2346 } 2347 if (isObject(comp)) { 2348 cache.set(comp, normalized); 2349 } 2350 return normalized; 2351 } 2352 function isEmitListener(options, key) { 2353 if (!options || !isOn(key)) { 2354 return false; 2355 } 2356 key = key.slice(2).replace(/Once$/, ""); 2357 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 2358 } 2359 2360 let currentRenderingInstance = null; 2361 let currentScopeId = null; 2362 function setCurrentRenderingInstance(instance) { 2363 const prev = currentRenderingInstance; 2364 currentRenderingInstance = instance; 2365 currentScopeId = instance && instance.type.__scopeId || null; 2366 return prev; 2367 } 2368 function pushScopeId(id) { 2369 currentScopeId = id; 2370 } 2371 function popScopeId() { 2372 currentScopeId = null; 2373 } 2374 const withScopeId = (_id) => withCtx; 2375 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 2376 if (!ctx) 2377 return fn; 2378 if (fn._n) { 2379 return fn; 2380 } 2381 const renderFnWithContext = (...args) => { 2382 if (renderFnWithContext._d) { 2383 setBlockTracking(-1); 2384 } 2385 const prevInstance = setCurrentRenderingInstance(ctx); 2386 let res; 2387 try { 2388 res = fn(...args); 2389 } finally { 2390 setCurrentRenderingInstance(prevInstance); 2391 if (renderFnWithContext._d) { 2392 setBlockTracking(1); 2393 } 2394 } 2395 { 2396 devtoolsComponentUpdated(ctx); 2397 } 2398 return res; 2399 }; 2400 renderFnWithContext._n = true; 2401 renderFnWithContext._c = true; 2402 renderFnWithContext._d = true; 2403 return renderFnWithContext; 2404 } 2405 2406 let accessedAttrs = false; 2407 function markAttrsAccessed() { 2408 accessedAttrs = true; 2409 } 2410 function renderComponentRoot(instance) { 2411 const { 2412 type: Component, 2413 vnode, 2414 proxy, 2415 withProxy, 2416 props, 2417 propsOptions: [propsOptions], 2418 slots, 2419 attrs, 2420 emit, 2421 render, 2422 renderCache, 2423 data, 2424 setupState, 2425 ctx, 2426 inheritAttrs 2427 } = instance; 2428 let result; 2429 let fallthroughAttrs; 2430 const prev = setCurrentRenderingInstance(instance); 2431 { 2432 accessedAttrs = false; 2433 } 2434 try { 2435 if (vnode.shapeFlag & 4) { 2436 const proxyToUse = withProxy || proxy; 2437 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 2438 get(target, key, receiver) { 2439 warn$1( 2440 `Property '${String( 2441 key 2442 )}' was accessed via 'this'. Avoid using 'this' in templates.` 2443 ); 2444 return Reflect.get(target, key, receiver); 2445 } 2446 }) : proxyToUse; 2447 result = normalizeVNode( 2448 render.call( 2449 thisProxy, 2450 proxyToUse, 2451 renderCache, 2452 props, 2453 setupState, 2454 data, 2455 ctx 2456 ) 2457 ); 2458 fallthroughAttrs = attrs; 2459 } else { 2460 const render2 = Component; 2461 if (attrs === props) { 2462 markAttrsAccessed(); 2463 } 2464 result = normalizeVNode( 2465 render2.length > 1 ? render2( 2466 props, 2467 true ? { 2468 get attrs() { 2469 markAttrsAccessed(); 2470 return attrs; 2471 }, 2472 slots, 2473 emit 2474 } : { attrs, slots, emit } 2475 ) : render2( 2476 props, 2477 null 2478 /* we know it doesn't need it */ 2479 ) 2480 ); 2481 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 2482 } 2483 } catch (err) { 2484 blockStack.length = 0; 2485 handleError(err, instance, 1); 2486 result = createVNode(Comment); 2487 } 2488 let root = result; 2489 let setRoot = void 0; 2490 if (result.patchFlag > 0 && result.patchFlag & 2048) { 2491 [root, setRoot] = getChildRoot(result); 2492 } 2493 if (fallthroughAttrs && inheritAttrs !== false) { 2494 const keys = Object.keys(fallthroughAttrs); 2495 const { shapeFlag } = root; 2496 if (keys.length) { 2497 if (shapeFlag & (1 | 6)) { 2498 if (propsOptions && keys.some(isModelListener)) { 2499 fallthroughAttrs = filterModelListeners( 2500 fallthroughAttrs, 2501 propsOptions 2502 ); 2503 } 2504 root = cloneVNode(root, fallthroughAttrs); 2505 } else if (!accessedAttrs && root.type !== Comment) { 2506 const allAttrs = Object.keys(attrs); 2507 const eventAttrs = []; 2508 const extraAttrs = []; 2509 for (let i = 0, l = allAttrs.length; i < l; i++) { 2510 const key = allAttrs[i]; 2511 if (isOn(key)) { 2512 if (!isModelListener(key)) { 2513 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 2514 } 2515 } else { 2516 extraAttrs.push(key); 2517 } 2518 } 2519 if (extraAttrs.length) { 2520 warn$1( 2521 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.` 2522 ); 2523 } 2524 if (eventAttrs.length) { 2525 warn$1( 2526 `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.` 2527 ); 2528 } 2529 } 2530 } 2531 } 2532 if (vnode.dirs) { 2533 if (!isElementRoot(root)) { 2534 warn$1( 2535 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 2536 ); 2537 } 2538 root = cloneVNode(root); 2539 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 2540 } 2541 if (vnode.transition) { 2542 if (!isElementRoot(root)) { 2543 warn$1( 2544 `Component inside <Transition> renders non-element root node that cannot be animated.` 2545 ); 2546 } 2547 root.transition = vnode.transition; 2548 } 2549 if (setRoot) { 2550 setRoot(root); 2551 } else { 2552 result = root; 2553 } 2554 setCurrentRenderingInstance(prev); 2555 return result; 2556 } 2557 const getChildRoot = (vnode) => { 2558 const rawChildren = vnode.children; 2559 const dynamicChildren = vnode.dynamicChildren; 2560 const childRoot = filterSingleRoot(rawChildren, false); 2561 if (!childRoot) { 2562 return [vnode, void 0]; 2563 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 2564 return getChildRoot(childRoot); 2565 } 2566 const index = rawChildren.indexOf(childRoot); 2567 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 2568 const setRoot = (updatedRoot) => { 2569 rawChildren[index] = updatedRoot; 2570 if (dynamicChildren) { 2571 if (dynamicIndex > -1) { 2572 dynamicChildren[dynamicIndex] = updatedRoot; 2573 } else if (updatedRoot.patchFlag > 0) { 2574 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 2575 } 2576 } 2577 }; 2578 return [normalizeVNode(childRoot), setRoot]; 2579 }; 2580 function filterSingleRoot(children, recurse = true) { 2581 let singleRoot; 2582 for (let i = 0; i < children.length; i++) { 2583 const child = children[i]; 2584 if (isVNode(child)) { 2585 if (child.type !== Comment || child.children === "v-if") { 2586 if (singleRoot) { 2587 return; 2588 } else { 2589 singleRoot = child; 2590 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 2591 return filterSingleRoot(singleRoot.children); 2592 } 2593 } 2594 } 2595 } else { 2596 return; 2597 } 2598 } 2599 return singleRoot; 2600 } 2601 const getFunctionalFallthrough = (attrs) => { 2602 let res; 2603 for (const key in attrs) { 2604 if (key === "class" || key === "style" || isOn(key)) { 2605 (res || (res = {}))[key] = attrs[key]; 2606 } 2607 } 2608 return res; 2609 }; 2610 const filterModelListeners = (attrs, props) => { 2611 const res = {}; 2612 for (const key in attrs) { 2613 if (!isModelListener(key) || !(key.slice(9) in props)) { 2614 res[key] = attrs[key]; 2615 } 2616 } 2617 return res; 2618 }; 2619 const isElementRoot = (vnode) => { 2620 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 2621 }; 2622 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 2623 const { props: prevProps, children: prevChildren, component } = prevVNode; 2624 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 2625 const emits = component.emitsOptions; 2626 if ((prevChildren || nextChildren) && isHmrUpdating) { 2627 return true; 2628 } 2629 if (nextVNode.dirs || nextVNode.transition) { 2630 return true; 2631 } 2632 if (optimized && patchFlag >= 0) { 2633 if (patchFlag & 1024) { 2634 return true; 2635 } 2636 if (patchFlag & 16) { 2637 if (!prevProps) { 2638 return !!nextProps; 2639 } 2640 return hasPropsChanged(prevProps, nextProps, emits); 2641 } else if (patchFlag & 8) { 2642 const dynamicProps = nextVNode.dynamicProps; 2643 for (let i = 0; i < dynamicProps.length; i++) { 2644 const key = dynamicProps[i]; 2645 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 2646 return true; 2647 } 2648 } 2649 } 2650 } else { 2651 if (prevChildren || nextChildren) { 2652 if (!nextChildren || !nextChildren.$stable) { 2653 return true; 2654 } 2655 } 2656 if (prevProps === nextProps) { 2657 return false; 2658 } 2659 if (!prevProps) { 2660 return !!nextProps; 2661 } 2662 if (!nextProps) { 2663 return true; 2664 } 2665 return hasPropsChanged(prevProps, nextProps, emits); 2666 } 2667 return false; 2668 } 2669 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 2670 const nextKeys = Object.keys(nextProps); 2671 if (nextKeys.length !== Object.keys(prevProps).length) { 2672 return true; 2673 } 2674 for (let i = 0; i < nextKeys.length; i++) { 2675 const key = nextKeys[i]; 2676 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 2677 return true; 2678 } 2679 } 2680 return false; 2681 } 2682 function updateHOCHostEl({ vnode, parent }, el) { 2683 while (parent) { 2684 const root = parent.subTree; 2685 if (root.suspense && root.suspense.activeBranch === vnode) { 2686 root.el = vnode.el; 2687 } 2688 if (root === vnode) { 2689 (vnode = parent.vnode).el = el; 2690 parent = parent.parent; 2691 } else { 2692 break; 2693 } 2694 } 2695 } 2696 2697 const COMPONENTS = "components"; 2698 const DIRECTIVES = "directives"; 2699 function resolveComponent(name, maybeSelfReference) { 2700 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 2701 } 2702 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 2703 function resolveDynamicComponent(component) { 2704 if (isString(component)) { 2705 return resolveAsset(COMPONENTS, component, false) || component; 2706 } else { 2707 return component || NULL_DYNAMIC_COMPONENT; 2708 } 2709 } 2710 function resolveDirective(name) { 2711 return resolveAsset(DIRECTIVES, name); 2712 } 2713 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 2714 const instance = currentRenderingInstance || currentInstance; 2715 if (instance) { 2716 const Component = instance.type; 2717 if (type === COMPONENTS) { 2718 const selfName = getComponentName( 2719 Component, 2720 false 2721 ); 2722 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 2723 return Component; 2724 } 2725 } 2726 const res = ( 2727 // local registration 2728 // check instance[type] first which is resolved for options API 2729 resolve(instance[type] || Component[type], name) || // global registration 2730 resolve(instance.appContext[type], name) 2731 ); 2732 if (!res && maybeSelfReference) { 2733 return Component; 2734 } 2735 if (warnMissing && !res) { 2736 const extra = type === COMPONENTS ? ` 2737If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 2738 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 2739 } 2740 return res; 2741 } else { 2742 warn$1( 2743 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 2744 ); 2745 } 2746 } 2747 function resolve(registry, name) { 2748 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 2749 } 2750 2751 const isSuspense = (type) => type.__isSuspense; 2752 let suspenseId = 0; 2753 const SuspenseImpl = { 2754 name: "Suspense", 2755 // In order to make Suspense tree-shakable, we need to avoid importing it 2756 // directly in the renderer. The renderer checks for the __isSuspense flag 2757 // on a vnode's type and calls the `process` method, passing in renderer 2758 // internals. 2759 __isSuspense: true, 2760 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 2761 if (n1 == null) { 2762 mountSuspense( 2763 n2, 2764 container, 2765 anchor, 2766 parentComponent, 2767 parentSuspense, 2768 namespace, 2769 slotScopeIds, 2770 optimized, 2771 rendererInternals 2772 ); 2773 } else { 2774 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 2775 n2.suspense = n1.suspense; 2776 n2.suspense.vnode = n2; 2777 n2.el = n1.el; 2778 return; 2779 } 2780 patchSuspense( 2781 n1, 2782 n2, 2783 container, 2784 anchor, 2785 parentComponent, 2786 namespace, 2787 slotScopeIds, 2788 optimized, 2789 rendererInternals 2790 ); 2791 } 2792 }, 2793 hydrate: hydrateSuspense, 2794 create: createSuspenseBoundary, 2795 normalize: normalizeSuspenseChildren 2796 }; 2797 const Suspense = SuspenseImpl ; 2798 function triggerEvent(vnode, name) { 2799 const eventListener = vnode.props && vnode.props[name]; 2800 if (isFunction(eventListener)) { 2801 eventListener(); 2802 } 2803 } 2804 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 2805 const { 2806 p: patch, 2807 o: { createElement } 2808 } = rendererInternals; 2809 const hiddenContainer = createElement("div"); 2810 const suspense = vnode.suspense = createSuspenseBoundary( 2811 vnode, 2812 parentSuspense, 2813 parentComponent, 2814 container, 2815 hiddenContainer, 2816 anchor, 2817 namespace, 2818 slotScopeIds, 2819 optimized, 2820 rendererInternals 2821 ); 2822 patch( 2823 null, 2824 suspense.pendingBranch = vnode.ssContent, 2825 hiddenContainer, 2826 null, 2827 parentComponent, 2828 suspense, 2829 namespace, 2830 slotScopeIds 2831 ); 2832 if (suspense.deps > 0) { 2833 triggerEvent(vnode, "onPending"); 2834 triggerEvent(vnode, "onFallback"); 2835 patch( 2836 null, 2837 vnode.ssFallback, 2838 container, 2839 anchor, 2840 parentComponent, 2841 null, 2842 // fallback tree will not have suspense context 2843 namespace, 2844 slotScopeIds 2845 );
2846 setActiveBranch(suspense, vnode.ssFallback); 2847 } else { 2848 suspense.resolve(false, true); 2849 } 2850 } 2851 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 2852 const suspense = n2.suspense = n1.suspense; 2853 suspense.vnode = n2; 2854 n2.el = n1.el; 2855 const newBranch = n2.ssContent; 2856 const newFallback = n2.ssFallback; 2857 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 2858 if (pendingBranch) { 2859 suspense.pendingBranch = newBranch; 2860 if (isSameVNodeType(newBranch, pendingBranch)) { 2861 patch( 2862 pendingBranch, 2863 newBranch, 2864 suspense.hiddenContainer, 2865 null, 2866 parentComponent, 2867 suspense, 2868 namespace, 2869 slotScopeIds, 2870 optimized 2871 ); 2872 if (suspense.deps <= 0) { 2873 suspense.resolve(); 2874 } else if (isInFallback) { 2875 if (!isHydrating) { 2876 patch( 2877 activeBranch, 2878 newFallback, 2879 container, 2880 anchor, 2881 parentComponent, 2882 null, 2883 // fallback tree will not have suspense context 2884 namespace, 2885 slotScopeIds, 2886 optimized 2887 );
vendor: 1,147 bytes, lines 2888-2928
2888 setActiveBranch(suspense, newFallback); 2889 } 2890 } 2891 } else { 2892 suspense.pendingId = suspenseId++; 2893 if (isHydrating) { 2894 suspense.isHydrating = false; 2895 suspense.activeBranch = pendingBranch; 2896 } else { 2897 unmount(pendingBranch, parentComponent, suspense); 2898 } 2899 suspense.deps = 0; 2900 suspense.effects.length = 0; 2901 suspense.hiddenContainer = createElement("div"); 2902 if (isInFallback) { 2903 patch( 2904 null, 2905 newBranch, 2906 suspense.hiddenContainer, 2907 null, 2908 parentComponent, 2909 suspense, 2910 namespace, 2911 slotScopeIds, 2912 optimized 2913 ); 2914 if (suspense.deps <= 0) { 2915 suspense.resolve(); 2916 } else { 2917 patch( 2918 activeBranch, 2919 newFallback, 2920 container, 2921 anchor, 2922 parentComponent, 2923 null, 2924 // fallback tree will not have suspense context 2925 namespace, 2926 slotScopeIds, 2927 optimized 2928 );
vendor: 4,167 bytes, lines 2929-3077
2929 setActiveBranch(suspense, newFallback); 2930 } 2931 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 2932 patch( 2933 activeBranch, 2934 newBranch, 2935 container, 2936 anchor, 2937 parentComponent, 2938 suspense, 2939 namespace, 2940 slotScopeIds, 2941 optimized 2942 ); 2943 suspense.resolve(true); 2944 } else { 2945 patch( 2946 null, 2947 newBranch, 2948 suspense.hiddenContainer, 2949 null, 2950 parentComponent, 2951 suspense, 2952 namespace, 2953 slotScopeIds, 2954 optimized 2955 ); 2956 if (suspense.deps <= 0) { 2957 suspense.resolve(); 2958 } 2959 } 2960 } 2961 } else { 2962 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 2963 patch( 2964 activeBranch, 2965 newBranch, 2966 container, 2967 anchor, 2968 parentComponent, 2969 suspense, 2970 namespace, 2971 slotScopeIds, 2972 optimized 2973 ); 2974 setActiveBranch(suspense, newBranch); 2975 } else { 2976 triggerEvent(n2, "onPending"); 2977 suspense.pendingBranch = newBranch; 2978 if (newBranch.shapeFlag & 512) { 2979 suspense.pendingId = newBranch.component.suspenseId; 2980 } else { 2981 suspense.pendingId = suspenseId++; 2982 } 2983 patch( 2984 null, 2985 newBranch, 2986 suspense.hiddenContainer, 2987 null, 2988 parentComponent, 2989 suspense, 2990 namespace, 2991 slotScopeIds, 2992 optimized 2993 ); 2994 if (suspense.deps <= 0) { 2995 suspense.resolve(); 2996 } else { 2997 const { timeout, pendingId } = suspense; 2998 if (timeout > 0) { 2999 setTimeout(() => { 3000 if (suspense.pendingId === pendingId) { 3001 suspense.fallback(newFallback); 3002 } 3003 }, timeout); 3004 } else if (timeout === 0) { 3005 suspense.fallback(newFallback); 3006 } 3007 } 3008 } 3009 } 3010 } 3011 let hasWarned = false; 3012 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 3013 if (!hasWarned) { 3014 hasWarned = true; 3015 console[console.info ? "info" : "log"]( 3016 `<Suspense> is an experimental feature and its API will likely change.` 3017 ); 3018 } 3019 const { 3020 p: patch, 3021 m: move, 3022 um: unmount, 3023 n: next, 3024 o: { parentNode, remove } 3025 } = rendererInternals; 3026 let parentSuspenseId; 3027 const isSuspensible = isVNodeSuspensible(vnode); 3028 if (isSuspensible) { 3029 if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) { 3030 parentSuspenseId = parentSuspense.pendingId; 3031 parentSuspense.deps++; 3032 } 3033 } 3034 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 3035 { 3036 assertNumber(timeout, `Suspense timeout`); 3037 } 3038 const initialAnchor = anchor; 3039 const suspense = { 3040 vnode, 3041 parent: parentSuspense, 3042 parentComponent, 3043 namespace, 3044 container, 3045 hiddenContainer, 3046 deps: 0, 3047 pendingId: suspenseId++, 3048 timeout: typeof timeout === "number" ? timeout : -1, 3049 activeBranch: null, 3050 pendingBranch: null, 3051 isInFallback: !isHydrating, 3052 isHydrating, 3053 isUnmounted: false, 3054 effects: [], 3055 resolve(resume = false, sync = false) { 3056 { 3057 if (!resume && !suspense.pendingBranch) { 3058 throw new Error( 3059 `suspense.resolve() is called without a pending branch.` 3060 ); 3061 } 3062 if (suspense.isUnmounted) { 3063 throw new Error( 3064 `suspense.resolve() is called on an already unmounted suspense boundary.` 3065 ); 3066 } 3067 } 3068 const { 3069 vnode: vnode2, 3070 activeBranch, 3071 pendingBranch, 3072 pendingId, 3073 effects, 3074 parentComponent: parentComponent2, 3075 container: container2 3076 } = suspense; 3077 let delayEnter = false;
3078 if (suspense.isHydrating) { 3079 suspense.isHydrating = false; 3080 } else if (!resume) { 3081 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 3082 if (delayEnter) { 3083 activeBranch.transition.afterLeave = () => { 3084 if (pendingId === suspense.pendingId) { 3085 move( 3086 pendingBranch, 3087 container2, 3088 anchor === initialAnchor ? next(activeBranch) : anchor, 3089 0 3090 ); 3091 queuePostFlushCb(effects); 3092 } 3093 }; 3094 } 3095 if (activeBranch) { 3096 if (parentNode(activeBranch.el) !== suspense.hiddenContainer) { 3097 anchor = next(activeBranch); 3098 } 3099 unmount(activeBranch, parentComponent2, suspense, true); 3100 } 3101 if (!delayEnter) { 3102 move(pendingBranch, container2, anchor, 0); 3103 } 3104 } 3105 setActiveBranch(suspense, pendingBranch); 3106 suspense.pendingBranch = null; 3107 suspense.isInFallback = false; 3108 let parent = suspense.parent; 3109 let hasUnresolvedAncestor = false; 3110 while (parent) { 3111 if (parent.pendingBranch) { 3112 parent.effects.push(...effects); 3113 hasUnresolvedAncestor = true; 3114 break; 3115 } 3116 parent = parent.parent; 3117 } 3118 if (!hasUnresolvedAncestor && !delayEnter) { 3119 queuePostFlushCb(effects); 3120 } 3121 suspense.effects = []; 3122 if (isSuspensible) { 3123 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 3124 parentSuspense.deps--; 3125 if (parentSuspense.deps === 0 && !sync) { 3126 parentSuspense.resolve(); 3127 } 3128 } 3129 } 3130 triggerEvent(vnode2, "onResolve"); 3131 }, 3132 fallback(fallbackVNode) { 3133 if (!suspense.pendingBranch) { 3134 return; 3135 } 3136 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 3137 triggerEvent(vnode2, "onFallback"); 3138 const anchor2 = next(activeBranch); 3139 const mountFallback = () => { 3140 if (!suspense.isInFallback) { 3141 return; 3142 } 3143 patch( 3144 null, 3145 fallbackVNode, 3146 container2, 3147 anchor2, 3148 parentComponent2, 3149 null, 3150 // fallback tree will not have suspense context 3151 namespace2, 3152 slotScopeIds, 3153 optimized 3154 );
vendor: 4,341 bytes, lines 3155-3292
3155 setActiveBranch(suspense, fallbackVNode); 3156 }; 3157 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 3158 if (delayEnter) { 3159 activeBranch.transition.afterLeave = mountFallback; 3160 } 3161 suspense.isInFallback = true; 3162 unmount( 3163 activeBranch, 3164 parentComponent2, 3165 null, 3166 // no suspense so unmount hooks fire now 3167 true 3168 // shouldRemove 3169 ); 3170 if (!delayEnter) { 3171 mountFallback(); 3172 } 3173 }, 3174 move(container2, anchor2, type) { 3175 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 3176 suspense.container = container2; 3177 }, 3178 next() { 3179 return suspense.activeBranch && next(suspense.activeBranch); 3180 }, 3181 registerDep(instance, setupRenderEffect) { 3182 const isInPendingSuspense = !!suspense.pendingBranch; 3183 if (isInPendingSuspense) { 3184 suspense.deps++; 3185 } 3186 const hydratedEl = instance.vnode.el; 3187 instance.asyncDep.catch((err) => { 3188 handleError(err, instance, 0); 3189 }).then((asyncSetupResult) => { 3190 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 3191 return; 3192 } 3193 instance.asyncResolved = true; 3194 const { vnode: vnode2 } = instance; 3195 { 3196 pushWarningContext(vnode2); 3197 } 3198 handleSetupResult(instance, asyncSetupResult, false); 3199 if (hydratedEl) { 3200 vnode2.el = hydratedEl; 3201 } 3202 const placeholder = !hydratedEl && instance.subTree.el; 3203 setupRenderEffect( 3204 instance, 3205 vnode2, 3206 // component may have been moved before resolve. 3207 // if this is not a hydration, instance.subTree will be the comment 3208 // placeholder. 3209 parentNode(hydratedEl || instance.subTree.el), 3210 // anchor will not be used if this is hydration, so only need to 3211 // consider the comment placeholder case. 3212 hydratedEl ? null : next(instance.subTree), 3213 suspense, 3214 namespace, 3215 optimized 3216 ); 3217 if (placeholder) { 3218 remove(placeholder); 3219 } 3220 updateHOCHostEl(instance, vnode2.el); 3221 { 3222 popWarningContext(); 3223 } 3224 if (isInPendingSuspense && --suspense.deps === 0) { 3225 suspense.resolve(); 3226 } 3227 }); 3228 }, 3229 unmount(parentSuspense2, doRemove) { 3230 suspense.isUnmounted = true; 3231 if (suspense.activeBranch) { 3232 unmount( 3233 suspense.activeBranch, 3234 parentComponent, 3235 parentSuspense2, 3236 doRemove 3237 ); 3238 } 3239 if (suspense.pendingBranch) { 3240 unmount( 3241 suspense.pendingBranch, 3242 parentComponent, 3243 parentSuspense2, 3244 doRemove 3245 ); 3246 } 3247 } 3248 }; 3249 return suspense; 3250 } 3251 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 3252 const suspense = vnode.suspense = createSuspenseBoundary( 3253 vnode, 3254 parentSuspense, 3255 parentComponent, 3256 node.parentNode, 3257 // eslint-disable-next-line no-restricted-globals 3258 document.createElement("div"), 3259 null, 3260 namespace, 3261 slotScopeIds, 3262 optimized, 3263 rendererInternals, 3264 true 3265 ); 3266 const result = hydrateNode( 3267 node, 3268 suspense.pendingBranch = vnode.ssContent, 3269 parentComponent, 3270 suspense, 3271 slotScopeIds, 3272 optimized 3273 ); 3274 if (suspense.deps === 0) { 3275 suspense.resolve(false, true); 3276 } 3277 return result; 3278 } 3279 function normalizeSuspenseChildren(vnode) { 3280 const { shapeFlag, children } = vnode; 3281 const isSlotChildren = shapeFlag & 32; 3282 vnode.ssContent = normalizeSuspenseSlot( 3283 isSlotChildren ? children.default : children 3284 ); 3285 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 3286 } 3287 function normalizeSuspenseSlot(s) { 3288 let block; 3289 if (isFunction(s)) { 3290 const trackBlock = isBlockTreeEnabled && s._c; 3291 if (trackBlock) { 3292 s._d = false;
3293 openBlock(); 3294 } 3295 s = s(); 3296 if (trackBlock) { 3297 s._d = true; 3298 block = currentBlock; 3299 closeBlock(); 3300 } 3301 } 3302 if (isArray(s)) { 3303 const singleChild = filterSingleRoot(s); 3304 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 3305 warn$1(`<Suspense> slots expect a single root node.`); 3306 } 3307 s = singleChild; 3308 } 3309 s = normalizeVNode(s); 3310 if (block && !s.dynamicChildren) { 3311 s.dynamicChildren = block.filter((c) => c !== s); 3312 } 3313 return s; 3314 } 3315 function queueEffectWithSuspense(fn, suspense) { 3316 if (suspense && suspense.pendingBranch) { 3317 if (isArray(fn)) { 3318 suspense.effects.push(...fn); 3319 } else { 3320 suspense.effects.push(fn); 3321 } 3322 } else { 3323 queuePostFlushCb(fn); 3324 } 3325 } 3326 function setActiveBranch(suspense, branch) { 3327 suspense.activeBranch = branch; 3328 const { vnode, parentComponent } = suspense; 3329 let el = branch.el; 3330 while (!el && branch.component) { 3331 branch = branch.component.subTree; 3332 el = branch.el; 3333 } 3334 vnode.el = el; 3335 if (parentComponent && parentComponent.subTree === vnode) { 3336 parentComponent.vnode.el = el; 3337 updateHOCHostEl(parentComponent, el); 3338 } 3339 } 3340 function isVNodeSuspensible(vnode) { 3341 var _a; 3342 return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false; 3343 } 3344 3345 const ssrContextKey = Symbol.for("v-scx"); 3346 const useSSRContext = () => { 3347 { 3348 warn$1(`useSSRContext() is not supported in the global build.`); 3349 } 3350 }; 3351 3352 function watchEffect(effect, options) { 3353 return doWatch(effect, null, options); 3354 } 3355 function watchPostEffect(effect, options) { 3356 return doWatch( 3357 effect, 3358 null, 3359 extend({}, options, { flush: "post" }) 3360 ); 3361 } 3362 function watchSyncEffect(effect, options) { 3363 return doWatch( 3364 effect, 3365 null, 3366 extend({}, options, { flush: "sync" }) 3367 ); 3368 } 3369 const INITIAL_WATCHER_VALUE = {}; 3370 function watch(source, cb, options) { 3371 if (!isFunction(cb)) { 3372 warn$1( 3373 `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.` 3374 ); 3375 } 3376 return doWatch(source, cb, options); 3377 } 3378 function doWatch(source, cb, { 3379 immediate, 3380 deep, 3381 flush, 3382 once, 3383 onTrack, 3384 onTrigger 3385 } = EMPTY_OBJ) { 3386 if (cb && once) { 3387 const _cb = cb; 3388 cb = (...args) => { 3389 _cb(...args); 3390 unwatch(); 3391 }; 3392 } 3393 if (deep !== void 0 && typeof deep === "number") { 3394 warn$1( 3395 `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.` 3396 ); 3397 } 3398 if (!cb) { 3399 if (immediate !== void 0) { 3400 warn$1( 3401 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 3402 ); 3403 } 3404 if (deep !== void 0) { 3405 warn$1( 3406 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 3407 ); 3408 } 3409 if (once !== void 0) { 3410 warn$1( 3411 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 3412 ); 3413 } 3414 } 3415 const warnInvalidSource = (s) => { 3416 warn$1( 3417 `Invalid watch source: `, 3418 s, 3419 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` 3420 ); 3421 }; 3422 const instance = currentInstance; 3423 const reactiveGetter = (source2) => deep === true ? source2 : ( 3424 // for deep: false, only traverse root-level properties 3425 traverse(source2, deep === false ? 1 : void 0) 3426 ); 3427 let getter; 3428 let forceTrigger = false; 3429 let isMultiSource = false;
vendor: 4,296 bytes, lines 3430-3578
3430 if (isRef(source)) { 3431 getter = () => source.value; 3432 forceTrigger = isShallow(source); 3433 } else if (isReactive(source)) { 3434 getter = () => reactiveGetter(source); 3435 forceTrigger = true; 3436 } else if (isArray(source)) { 3437 isMultiSource = true; 3438 forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); 3439 getter = () => source.map((s) => { 3440 if (isRef(s)) { 3441 return s.value; 3442 } else if (isReactive(s)) { 3443 return reactiveGetter(s); 3444 } else if (isFunction(s)) { 3445 return callWithErrorHandling(s, instance, 2); 3446 } else { 3447 warnInvalidSource(s); 3448 } 3449 }); 3450 } else if (isFunction(source)) { 3451 if (cb) { 3452 getter = () => callWithErrorHandling(source, instance, 2); 3453 } else { 3454 getter = () => { 3455 if (cleanup) { 3456 cleanup(); 3457 } 3458 return callWithAsyncErrorHandling( 3459 source, 3460 instance, 3461 3, 3462 [onCleanup] 3463 ); 3464 }; 3465 } 3466 } else { 3467 getter = NOOP; 3468 warnInvalidSource(source); 3469 } 3470 if (cb && deep) { 3471 const baseGetter = getter; 3472 getter = () => traverse(baseGetter()); 3473 } 3474 let cleanup; 3475 let onCleanup = (fn) => { 3476 cleanup = effect.onStop = () => { 3477 callWithErrorHandling(fn, instance, 4); 3478 cleanup = effect.onStop = void 0; 3479 }; 3480 }; 3481 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 3482 const job = () => { 3483 if (!effect.active || !effect.dirty) { 3484 return; 3485 } 3486 if (cb) { 3487 const newValue = effect.run(); 3488 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) { 3489 if (cleanup) { 3490 cleanup(); 3491 } 3492 callWithAsyncErrorHandling(cb, instance, 3, [ 3493 newValue, 3494 // pass undefined as the old value when it's changed for the first time 3495 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 3496 onCleanup 3497 ]); 3498 oldValue = newValue; 3499 } 3500 } else { 3501 effect.run(); 3502 } 3503 }; 3504 job.allowRecurse = !!cb; 3505 let scheduler; 3506 if (flush === "sync") { 3507 scheduler = job; 3508 } else if (flush === "post") { 3509 scheduler = () => queuePostRenderEffect(job, instance && instance.suspense); 3510 } else { 3511 job.pre = true; 3512 if (instance) 3513 job.id = instance.uid; 3514 scheduler = () => queueJob(job); 3515 } 3516 const effect = new ReactiveEffect(getter, NOOP, scheduler); 3517 const scope = getCurrentScope(); 3518 const unwatch = () => { 3519 effect.stop(); 3520 if (scope) { 3521 remove(scope.effects, effect); 3522 } 3523 }; 3524 { 3525 effect.onTrack = onTrack; 3526 effect.onTrigger = onTrigger; 3527 } 3528 if (cb) { 3529 if (immediate) { 3530 job(); 3531 } else { 3532 oldValue = effect.run(); 3533 } 3534 } else if (flush === "post") { 3535 queuePostRenderEffect( 3536 effect.run.bind(effect), 3537 instance && instance.suspense 3538 ); 3539 } else { 3540 effect.run(); 3541 } 3542 return unwatch; 3543 } 3544 function instanceWatch(source, value, options) { 3545 const publicThis = this.proxy; 3546 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 3547 let cb; 3548 if (isFunction(value)) { 3549 cb = value; 3550 } else { 3551 cb = value.handler; 3552 options = value; 3553 } 3554 const reset = setCurrentInstance(this); 3555 const res = doWatch(getter, cb.bind(publicThis), options); 3556 reset(); 3557 return res; 3558 } 3559 function createPathGetter(ctx, path) { 3560 const segments = path.split("."); 3561 return () => { 3562 let cur = ctx; 3563 for (let i = 0; i < segments.length && cur; i++) { 3564 cur = cur[segments[i]]; 3565 } 3566 return cur; 3567 }; 3568 } 3569 function traverse(value, depth, currentDepth = 0, seen) { 3570 if (!isObject(value) || value["__v_skip"]) { 3571 return value; 3572 } 3573 if (depth && depth > 0) { 3574 if (currentDepth >= depth) { 3575 return value; 3576 } 3577 currentDepth++; 3578 }
vendor: 4,446 bytes, lines 3579-3727
3579 seen = seen || /* @__PURE__ */ new Set(); 3580 if (seen.has(value)) { 3581 return value; 3582 } 3583 seen.add(value); 3584 if (isRef(value)) { 3585 traverse(value.value, depth, currentDepth, seen); 3586 } else if (isArray(value)) { 3587 for (let i = 0; i < value.length; i++) { 3588 traverse(value[i], depth, currentDepth, seen); 3589 } 3590 } else if (isSet(value) || isMap(value)) { 3591 value.forEach((v) => { 3592 traverse(v, depth, currentDepth, seen); 3593 }); 3594 } else if (isPlainObject(value)) { 3595 for (const key in value) { 3596 traverse(value[key], depth, currentDepth, seen); 3597 } 3598 } 3599 return value; 3600 } 3601 3602 function validateDirectiveName(name) { 3603 if (isBuiltInDirective(name)) { 3604 warn$1("Do not use built-in directive ids as custom directive id: " + name); 3605 } 3606 } 3607 function withDirectives(vnode, directives) { 3608 if (currentRenderingInstance === null) { 3609 warn$1(`withDirectives can only be used inside render functions.`); 3610 return vnode; 3611 } 3612 const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy; 3613 const bindings = vnode.dirs || (vnode.dirs = []); 3614 for (let i = 0; i < directives.length; i++) { 3615 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 3616 if (dir) { 3617 if (isFunction(dir)) { 3618 dir = { 3619 mounted: dir, 3620 updated: dir 3621 }; 3622 } 3623 if (dir.deep) { 3624 traverse(value); 3625 } 3626 bindings.push({ 3627 dir, 3628 instance, 3629 value, 3630 oldValue: void 0, 3631 arg, 3632 modifiers 3633 }); 3634 } 3635 } 3636 return vnode; 3637 } 3638 function invokeDirectiveHook(vnode, prevVNode, instance, name) { 3639 const bindings = vnode.dirs; 3640 const oldBindings = prevVNode && prevVNode.dirs; 3641 for (let i = 0; i < bindings.length; i++) { 3642 const binding = bindings[i]; 3643 if (oldBindings) { 3644 binding.oldValue = oldBindings[i].value; 3645 } 3646 let hook = binding.dir[name]; 3647 if (hook) { 3648 pauseTracking(); 3649 callWithAsyncErrorHandling(hook, instance, 8, [ 3650 vnode.el, 3651 binding, 3652 vnode, 3653 prevVNode 3654 ]); 3655 resetTracking(); 3656 } 3657 } 3658 } 3659 3660 const leaveCbKey = Symbol("_leaveCb"); 3661 const enterCbKey$1 = Symbol("_enterCb"); 3662 function useTransitionState() { 3663 const state = { 3664 isMounted: false, 3665 isLeaving: false, 3666 isUnmounting: false, 3667 leavingVNodes: /* @__PURE__ */ new Map() 3668 }; 3669 onMounted(() => { 3670 state.isMounted = true; 3671 }); 3672 onBeforeUnmount(() => { 3673 state.isUnmounting = true; 3674 }); 3675 return state; 3676 } 3677 const TransitionHookValidator = [Function, Array]; 3678 const BaseTransitionPropsValidators = { 3679 mode: String, 3680 appear: Boolean, 3681 persisted: Boolean, 3682 // enter 3683 onBeforeEnter: TransitionHookValidator, 3684 onEnter: TransitionHookValidator, 3685 onAfterEnter: TransitionHookValidator, 3686 onEnterCancelled: TransitionHookValidator, 3687 // leave 3688 onBeforeLeave: TransitionHookValidator, 3689 onLeave: TransitionHookValidator, 3690 onAfterLeave: TransitionHookValidator, 3691 onLeaveCancelled: TransitionHookValidator, 3692 // appear 3693 onBeforeAppear: TransitionHookValidator, 3694 onAppear: TransitionHookValidator, 3695 onAfterAppear: TransitionHookValidator, 3696 onAppearCancelled: TransitionHookValidator 3697 }; 3698 const BaseTransitionImpl = { 3699 name: `BaseTransition`, 3700 props: BaseTransitionPropsValidators, 3701 setup(props, { slots }) { 3702 const instance = getCurrentInstance(); 3703 const state = useTransitionState(); 3704 return () => { 3705 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3706 if (!children || !children.length) { 3707 return; 3708 } 3709 let child = children[0]; 3710 if (children.length > 1) { 3711 let hasFound = false; 3712 for (const c of children) { 3713 if (c.type !== Comment) { 3714 if (hasFound) { 3715 warn$1( 3716 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3717 ); 3718 break; 3719 } 3720 child = c; 3721 hasFound = true; 3722 } 3723 } 3724 } 3725 const rawProps = toRaw(props); 3726 const { mode } = rawProps; 3727 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
vendor: 7,831 bytes, lines 3728-3984
3728 warn$1(`invalid <transition> mode: ${mode}`); 3729 } 3730 if (state.isLeaving) { 3731 return emptyPlaceholder(child); 3732 } 3733 const innerChild = getKeepAliveChild(child); 3734 if (!innerChild) { 3735 return emptyPlaceholder(child); 3736 } 3737 const enterHooks = resolveTransitionHooks( 3738 innerChild, 3739 rawProps, 3740 state, 3741 instance 3742 ); 3743 setTransitionHooks(innerChild, enterHooks); 3744 const oldChild = instance.subTree; 3745 const oldInnerChild = oldChild && getKeepAliveChild(oldChild); 3746 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) { 3747 const leavingHooks = resolveTransitionHooks( 3748 oldInnerChild, 3749 rawProps, 3750 state, 3751 instance 3752 ); 3753 setTransitionHooks(oldInnerChild, leavingHooks); 3754 if (mode === "out-in") { 3755 state.isLeaving = true; 3756 leavingHooks.afterLeave = () => { 3757 state.isLeaving = false; 3758 if (instance.update.active !== false) { 3759 instance.effect.dirty = true; 3760 instance.update(); 3761 } 3762 }; 3763 return emptyPlaceholder(child); 3764 } else if (mode === "in-out" && innerChild.type !== Comment) { 3765 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3766 const leavingVNodesCache = getLeavingNodesForType( 3767 state, 3768 oldInnerChild 3769 ); 3770 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3771 el[leaveCbKey] = () => { 3772 earlyRemove(); 3773 el[leaveCbKey] = void 0; 3774 delete enterHooks.delayedLeave; 3775 }; 3776 enterHooks.delayedLeave = delayedLeave; 3777 }; 3778 } 3779 } 3780 return child; 3781 }; 3782 } 3783 }; 3784 const BaseTransition = BaseTransitionImpl; 3785 function getLeavingNodesForType(state, vnode) { 3786 const { leavingVNodes } = state; 3787 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3788 if (!leavingVNodesCache) { 3789 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3790 leavingVNodes.set(vnode.type, leavingVNodesCache); 3791 } 3792 return leavingVNodesCache; 3793 } 3794 function resolveTransitionHooks(vnode, props, state, instance) { 3795 const { 3796 appear, 3797 mode, 3798 persisted = false, 3799 onBeforeEnter, 3800 onEnter, 3801 onAfterEnter, 3802 onEnterCancelled, 3803 onBeforeLeave, 3804 onLeave, 3805 onAfterLeave, 3806 onLeaveCancelled, 3807 onBeforeAppear, 3808 onAppear, 3809 onAfterAppear, 3810 onAppearCancelled 3811 } = props; 3812 const key = String(vnode.key); 3813 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3814 const callHook = (hook, args) => { 3815 hook && callWithAsyncErrorHandling( 3816 hook, 3817 instance, 3818 9, 3819 args 3820 ); 3821 }; 3822 const callAsyncHook = (hook, args) => { 3823 const done = args[1]; 3824 callHook(hook, args); 3825 if (isArray(hook)) { 3826 if (hook.every((hook2) => hook2.length <= 1)) 3827 done(); 3828 } else if (hook.length <= 1) { 3829 done(); 3830 } 3831 }; 3832 const hooks = { 3833 mode, 3834 persisted, 3835 beforeEnter(el) { 3836 let hook = onBeforeEnter; 3837 if (!state.isMounted) { 3838 if (appear) { 3839 hook = onBeforeAppear || onBeforeEnter; 3840 } else { 3841 return; 3842 } 3843 } 3844 if (el[leaveCbKey]) { 3845 el[leaveCbKey]( 3846 true 3847 /* cancelled */ 3848 ); 3849 } 3850 const leavingVNode = leavingVNodesCache[key]; 3851 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3852 leavingVNode.el[leaveCbKey](); 3853 } 3854 callHook(hook, [el]); 3855 }, 3856 enter(el) { 3857 let hook = onEnter; 3858 let afterHook = onAfterEnter; 3859 let cancelHook = onEnterCancelled; 3860 if (!state.isMounted) { 3861 if (appear) { 3862 hook = onAppear || onEnter; 3863 afterHook = onAfterAppear || onAfterEnter; 3864 cancelHook = onAppearCancelled || onEnterCancelled; 3865 } else { 3866 return; 3867 } 3868 } 3869 let called = false; 3870 const done = el[enterCbKey$1] = (cancelled) => { 3871 if (called) 3872 return; 3873 called = true; 3874 if (cancelled) { 3875 callHook(cancelHook, [el]); 3876 } else { 3877 callHook(afterHook, [el]); 3878 } 3879 if (hooks.delayedLeave) { 3880 hooks.delayedLeave(); 3881 } 3882 el[enterCbKey$1] = void 0; 3883 }; 3884 if (hook) { 3885 callAsyncHook(hook, [el, done]); 3886 } else { 3887 done(); 3888 } 3889 }, 3890 leave(el, remove) { 3891 const key2 = String(vnode.key); 3892 if (el[enterCbKey$1]) { 3893 el[enterCbKey$1]( 3894 true 3895 /* cancelled */ 3896 ); 3897 } 3898 if (state.isUnmounting) { 3899 return remove(); 3900 } 3901 callHook(onBeforeLeave, [el]); 3902 let called = false; 3903 const done = el[leaveCbKey] = (cancelled) => { 3904 if (called) 3905 return; 3906 called = true; 3907 remove(); 3908 if (cancelled) { 3909 callHook(onLeaveCancelled, [el]); 3910 } else { 3911 callHook(onAfterLeave, [el]); 3912 } 3913 el[leaveCbKey] = void 0; 3914 if (leavingVNodesCache[key2] === vnode) { 3915 delete leavingVNodesCache[key2]; 3916 } 3917 }; 3918 leavingVNodesCache[key2] = vnode; 3919 if (onLeave) { 3920 callAsyncHook(onLeave, [el, done]); 3921 } else { 3922 done(); 3923 } 3924 }, 3925 clone(vnode2) { 3926 return resolveTransitionHooks(vnode2, props, state, instance); 3927 } 3928 }; 3929 return hooks; 3930 } 3931 function emptyPlaceholder(vnode) { 3932 if (isKeepAlive(vnode)) { 3933 vnode = cloneVNode(vnode); 3934 vnode.children = null; 3935 return vnode; 3936 } 3937 } 3938 function getKeepAliveChild(vnode) { 3939 return isKeepAlive(vnode) ? ( 3940 // #7121 ensure get the child component subtree in case 3941 // it's been replaced during HMR 3942 vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0 3943 ) : vnode; 3944 } 3945 function setTransitionHooks(vnode, hooks) { 3946 if (vnode.shapeFlag & 6 && vnode.component) { 3947 setTransitionHooks(vnode.component.subTree, hooks); 3948 } else if (vnode.shapeFlag & 128) { 3949 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3950 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3951 } else { 3952 vnode.transition = hooks; 3953 } 3954 } 3955 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3956 let ret = []; 3957 let keyedFragmentCount = 0; 3958 for (let i = 0; i < children.length; i++) { 3959 let child = children[i]; 3960 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3961 if (child.type === Fragment) { 3962 if (child.patchFlag & 128) 3963 keyedFragmentCount++; 3964 ret = ret.concat( 3965 getTransitionRawChildren(child.children, keepComment, key) 3966 ); 3967 } else if (keepComment || child.type !== Comment) { 3968 ret.push(key != null ? cloneVNode(child, { key }) : child); 3969 } 3970 } 3971 if (keyedFragmentCount > 1) { 3972 for (let i = 0; i < ret.length; i++) { 3973 ret[i].patchFlag = -2; 3974 } 3975 } 3976 return ret; 3977 } 3978 3979 /*! #__NO_SIDE_EFFECTS__ */ 3980 // @__NO_SIDE_EFFECTS__ 3981 function defineComponent(options, extraOptions) { 3982 return isFunction(options) ? ( 3983 // #8326: extend call and options.name access are considered side-effects 3984 // by Rollup, so we have to wrap it in a pure-annotated IIFE.
vendor: 4,692 bytes, lines 3985-4135
3985 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3986 ) : options; 3987 } 3988 3989 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 3990 /*! #__NO_SIDE_EFFECTS__ */ 3991 // @__NO_SIDE_EFFECTS__ 3992 function defineAsyncComponent(source) { 3993 if (isFunction(source)) { 3994 source = { loader: source }; 3995 } 3996 const { 3997 loader, 3998 loadingComponent, 3999 errorComponent, 4000 delay = 200, 4001 timeout, 4002 // undefined = never times out 4003 suspensible = true, 4004 onError: userOnError 4005 } = source; 4006 let pendingRequest = null; 4007 let resolvedComp; 4008 let retries = 0; 4009 const retry = () => { 4010 retries++; 4011 pendingRequest = null; 4012 return load(); 4013 }; 4014 const load = () => { 4015 let thisRequest; 4016 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4017 err = err instanceof Error ? err : new Error(String(err)); 4018 if (userOnError) { 4019 return new Promise((resolve, reject) => { 4020 const userRetry = () => resolve(retry()); 4021 const userFail = () => reject(err); 4022 userOnError(err, userRetry, userFail, retries + 1); 4023 }); 4024 } else { 4025 throw err; 4026 } 4027 }).then((comp) => { 4028 if (thisRequest !== pendingRequest && pendingRequest) { 4029 return pendingRequest; 4030 } 4031 if (!comp) { 4032 warn$1( 4033 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4034 ); 4035 } 4036 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4037 comp = comp.default; 4038 } 4039 if (comp && !isObject(comp) && !isFunction(comp)) { 4040 throw new Error(`Invalid async component load result: ${comp}`); 4041 } 4042 resolvedComp = comp; 4043 return comp; 4044 })); 4045 }; 4046 return defineComponent({ 4047 name: "AsyncComponentWrapper", 4048 __asyncLoader: load, 4049 get __asyncResolved() { 4050 return resolvedComp; 4051 }, 4052 setup() { 4053 const instance = currentInstance; 4054 if (resolvedComp) { 4055 return () => createInnerComp(resolvedComp, instance); 4056 } 4057 const onError = (err) => { 4058 pendingRequest = null; 4059 handleError( 4060 err, 4061 instance, 4062 13, 4063 !errorComponent 4064 ); 4065 }; 4066 if (suspensible && instance.suspense || false) { 4067 return load().then((comp) => { 4068 return () => createInnerComp(comp, instance); 4069 }).catch((err) => { 4070 onError(err); 4071 return () => errorComponent ? createVNode(errorComponent, { 4072 error: err 4073 }) : null; 4074 }); 4075 } 4076 const loaded = ref(false); 4077 const error = ref(); 4078 const delayed = ref(!!delay); 4079 if (delay) { 4080 setTimeout(() => { 4081 delayed.value = false; 4082 }, delay); 4083 } 4084 if (timeout != null) { 4085 setTimeout(() => { 4086 if (!loaded.value && !error.value) { 4087 const err = new Error( 4088 `Async component timed out after ${timeout}ms.` 4089 ); 4090 onError(err); 4091 error.value = err; 4092 } 4093 }, timeout); 4094 } 4095 load().then(() => { 4096 loaded.value = true; 4097 if (instance.parent && isKeepAlive(instance.parent.vnode)) { 4098 instance.parent.effect.dirty = true; 4099 queueJob(instance.parent.update); 4100 } 4101 }).catch((err) => { 4102 onError(err); 4103 error.value = err; 4104 }); 4105 return () => { 4106 if (loaded.value && resolvedComp) { 4107 return createInnerComp(resolvedComp, instance); 4108 } else if (error.value && errorComponent) { 4109 return createVNode(errorComponent, { 4110 error: error.value 4111 }); 4112 } else if (loadingComponent && !delayed.value) { 4113 return createVNode(loadingComponent); 4114 } 4115 }; 4116 } 4117 }); 4118 } 4119 function createInnerComp(comp, parent) { 4120 const { ref: ref2, props, children, ce } = parent.vnode; 4121 const vnode = createVNode(comp, props, children); 4122 vnode.ref = ref2; 4123 vnode.ce = ce; 4124 delete parent.vnode.ce; 4125 return vnode; 4126 } 4127 4128 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 4129 const KeepAliveImpl = { 4130 name: `KeepAlive`, 4131 // Marker for special handling inside the renderer. We are not using a === 4132 // check directly on KeepAlive in the renderer, because importing it directly 4133 // would prevent it from being tree-shaken. 4134 __isKeepAlive: true, 4135 props: {
vendor: 4,821 bytes, lines 4136-4282
4136 include: [String, RegExp, Array], 4137 exclude: [String, RegExp, Array], 4138 max: [String, Number] 4139 }, 4140 setup(props, { slots }) { 4141 const instance = getCurrentInstance(); 4142 const sharedContext = instance.ctx; 4143 const cache = /* @__PURE__ */ new Map(); 4144 const keys = /* @__PURE__ */ new Set(); 4145 let current = null; 4146 { 4147 instance.__v_cache = cache; 4148 } 4149 const parentSuspense = instance.suspense; 4150 const { 4151 renderer: { 4152 p: patch, 4153 m: move, 4154 um: _unmount, 4155 o: { createElement } 4156 } 4157 } = sharedContext; 4158 const storageContainer = createElement("div"); 4159 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 4160 const instance2 = vnode.component; 4161 move(vnode, container, anchor, 0, parentSuspense); 4162 patch( 4163 instance2.vnode, 4164 vnode, 4165 container, 4166 anchor, 4167 instance2, 4168 parentSuspense, 4169 namespace, 4170 vnode.slotScopeIds, 4171 optimized 4172 ); 4173 queuePostRenderEffect(() => { 4174 instance2.isDeactivated = false; 4175 if (instance2.a) { 4176 invokeArrayFns(instance2.a); 4177 } 4178 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 4179 if (vnodeHook) { 4180 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4181 } 4182 }, parentSuspense); 4183 { 4184 devtoolsComponentAdded(instance2); 4185 } 4186 }; 4187 sharedContext.deactivate = (vnode) => { 4188 const instance2 = vnode.component; 4189 move(vnode, storageContainer, null, 1, parentSuspense); 4190 queuePostRenderEffect(() => { 4191 if (instance2.da) { 4192 invokeArrayFns(instance2.da); 4193 } 4194 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 4195 if (vnodeHook) { 4196 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4197 } 4198 instance2.isDeactivated = true; 4199 }, parentSuspense); 4200 { 4201 devtoolsComponentAdded(instance2); 4202 } 4203 }; 4204 function unmount(vnode) { 4205 resetShapeFlag(vnode); 4206 _unmount(vnode, instance, parentSuspense, true); 4207 } 4208 function pruneCache(filter) { 4209 cache.forEach((vnode, key) => { 4210 const name = getComponentName(vnode.type); 4211 if (name && (!filter || !filter(name))) { 4212 pruneCacheEntry(key); 4213 } 4214 }); 4215 } 4216 function pruneCacheEntry(key) { 4217 const cached = cache.get(key); 4218 if (!current || !isSameVNodeType(cached, current)) { 4219 unmount(cached); 4220 } else if (current) { 4221 resetShapeFlag(current); 4222 } 4223 cache.delete(key); 4224 keys.delete(key); 4225 } 4226 watch( 4227 () => [props.include, props.exclude], 4228 ([include, exclude]) => { 4229 include && pruneCache((name) => matches(include, name)); 4230 exclude && pruneCache((name) => !matches(exclude, name)); 4231 }, 4232 // prune post-render after `current` has been updated 4233 { flush: "post", deep: true } 4234 ); 4235 let pendingCacheKey = null; 4236 const cacheSubtree = () => { 4237 if (pendingCacheKey != null) { 4238 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4239 } 4240 }; 4241 onMounted(cacheSubtree); 4242 onUpdated(cacheSubtree); 4243 onBeforeUnmount(() => { 4244 cache.forEach((cached) => { 4245 const { subTree, suspense } = instance; 4246 const vnode = getInnerChild(subTree); 4247 if (cached.type === vnode.type && cached.key === vnode.key) { 4248 resetShapeFlag(vnode); 4249 const da = vnode.component.da; 4250 da && queuePostRenderEffect(da, suspense); 4251 return; 4252 } 4253 unmount(cached); 4254 }); 4255 }); 4256 return () => { 4257 pendingCacheKey = null; 4258 if (!slots.default) { 4259 return null; 4260 } 4261 const children = slots.default(); 4262 const rawVNode = children[0]; 4263 if (children.length > 1) { 4264 { 4265 warn$1(`KeepAlive should contain exactly one component child.`); 4266 } 4267 current = null; 4268 return children; 4269 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 4270 current = null; 4271 return rawVNode; 4272 } 4273 let vnode = getInnerChild(rawVNode); 4274 const comp = vnode.type; 4275 const name = getComponentName( 4276 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 4277 ); 4278 const { include, exclude, max } = props; 4279 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 4280 current = vnode; 4281 return rawVNode; 4282 }
vendor: 24,528 bytes, lines 4283-5059
4283 const key = vnode.key == null ? comp : vnode.key; 4284 const cachedVNode = cache.get(key); 4285 if (vnode.el) { 4286 vnode = cloneVNode(vnode); 4287 if (rawVNode.shapeFlag & 128) { 4288 rawVNode.ssContent = vnode; 4289 } 4290 } 4291 pendingCacheKey = key; 4292 if (cachedVNode) { 4293 vnode.el = cachedVNode.el; 4294 vnode.component = cachedVNode.component; 4295 if (vnode.transition) { 4296 setTransitionHooks(vnode, vnode.transition); 4297 } 4298 vnode.shapeFlag |= 512; 4299 keys.delete(key); 4300 keys.add(key); 4301 } else { 4302 keys.add(key); 4303 if (max && keys.size > parseInt(max, 10)) { 4304 pruneCacheEntry(keys.values().next().value); 4305 } 4306 } 4307 vnode.shapeFlag |= 256; 4308 current = vnode; 4309 return isSuspense(rawVNode.type) ? rawVNode : vnode; 4310 }; 4311 } 4312 }; 4313 const KeepAlive = KeepAliveImpl; 4314 function matches(pattern, name) { 4315 if (isArray(pattern)) { 4316 return pattern.some((p) => matches(p, name)); 4317 } else if (isString(pattern)) { 4318 return pattern.split(",").includes(name); 4319 } else if (isRegExp(pattern)) { 4320 return pattern.test(name); 4321 } 4322 return false; 4323 } 4324 function onActivated(hook, target) { 4325 registerKeepAliveHook(hook, "a", target); 4326 } 4327 function onDeactivated(hook, target) { 4328 registerKeepAliveHook(hook, "da", target); 4329 } 4330 function registerKeepAliveHook(hook, type, target = currentInstance) { 4331 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 4332 let current = target; 4333 while (current) { 4334 if (current.isDeactivated) { 4335 return; 4336 } 4337 current = current.parent; 4338 } 4339 return hook(); 4340 }); 4341 injectHook(type, wrappedHook, target); 4342 if (target) { 4343 let current = target.parent; 4344 while (current && current.parent) { 4345 if (isKeepAlive(current.parent.vnode)) { 4346 injectToKeepAliveRoot(wrappedHook, type, target, current); 4347 } 4348 current = current.parent; 4349 } 4350 } 4351 } 4352 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 4353 const injected = injectHook( 4354 type, 4355 hook, 4356 keepAliveRoot, 4357 true 4358 /* prepend */ 4359 ); 4360 onUnmounted(() => { 4361 remove(keepAliveRoot[type], injected); 4362 }, target); 4363 } 4364 function resetShapeFlag(vnode) { 4365 vnode.shapeFlag &= ~256; 4366 vnode.shapeFlag &= ~512; 4367 } 4368 function getInnerChild(vnode) { 4369 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 4370 } 4371 4372 function injectHook(type, hook, target = currentInstance, prepend = false) { 4373 if (target) { 4374 const hooks = target[type] || (target[type] = []); 4375 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 4376 if (target.isUnmounted) { 4377 return; 4378 } 4379 pauseTracking(); 4380 const reset = setCurrentInstance(target); 4381 const res = callWithAsyncErrorHandling(hook, target, type, args); 4382 reset(); 4383 resetTracking(); 4384 return res; 4385 }); 4386 if (prepend) { 4387 hooks.unshift(wrappedHook); 4388 } else { 4389 hooks.push(wrappedHook); 4390 } 4391 return wrappedHook; 4392 } else { 4393 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 4394 warn$1( 4395 `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` ) 4396 ); 4397 } 4398 } 4399 const createHook = (lifecycle) => (hook, target = currentInstance) => ( 4400 // post-create lifecycle registrations are noops during SSR (except for serverPrefetch) 4401 (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target) 4402 ); 4403 const onBeforeMount = createHook("bm"); 4404 const onMounted = createHook("m"); 4405 const onBeforeUpdate = createHook("bu"); 4406 const onUpdated = createHook("u"); 4407 const onBeforeUnmount = createHook("bum"); 4408 const onUnmounted = createHook("um"); 4409 const onServerPrefetch = createHook("sp"); 4410 const onRenderTriggered = createHook( 4411 "rtg" 4412 ); 4413 const onRenderTracked = createHook( 4414 "rtc" 4415 ); 4416 function onErrorCaptured(hook, target = currentInstance) { 4417 injectHook("ec", hook, target); 4418 } 4419 4420 function renderList(source, renderItem, cache, index) { 4421 let ret; 4422 const cached = cache && cache[index]; 4423 if (isArray(source) || isString(source)) { 4424 ret = new Array(source.length); 4425 for (let i = 0, l = source.length; i < l; i++) { 4426 ret[i] = renderItem(source[i], i, void 0, cached && cached[i]); 4427 } 4428 } else if (typeof source === "number") { 4429 if (!Number.isInteger(source)) { 4430 warn$1(`The v-for range expect an integer value but got ${source}.`); 4431 } 4432 ret = new Array(source); 4433 for (let i = 0; i < source; i++) { 4434 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 4435 } 4436 } else if (isObject(source)) { 4437 if (source[Symbol.iterator]) { 4438 ret = Array.from( 4439 source, 4440 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 4441 ); 4442 } else { 4443 const keys = Object.keys(source); 4444 ret = new Array(keys.length); 4445 for (let i = 0, l = keys.length; i < l; i++) { 4446 const key = keys[i]; 4447 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 4448 } 4449 } 4450 } else { 4451 ret = []; 4452 } 4453 if (cache) { 4454 cache[index] = ret; 4455 } 4456 return ret; 4457 } 4458 4459 function createSlots(slots, dynamicSlots) { 4460 for (let i = 0; i < dynamicSlots.length; i++) { 4461 const slot = dynamicSlots[i]; 4462 if (isArray(slot)) { 4463 for (let j = 0; j < slot.length; j++) { 4464 slots[slot[j].name] = slot[j].fn; 4465 } 4466 } else if (slot) { 4467 slots[slot.name] = slot.key ? (...args) => { 4468 const res = slot.fn(...args); 4469 if (res) 4470 res.key = slot.key; 4471 return res; 4472 } : slot.fn; 4473 } 4474 } 4475 return slots; 4476 } 4477 4478 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 4479 if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) { 4480 if (name !== "default") 4481 props.name = name; 4482 return createVNode("slot", props, fallback && fallback()); 4483 } 4484 let slot = slots[name]; 4485 if (slot && slot.length > 1) { 4486 warn$1( 4487 `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.` 4488 ); 4489 slot = () => []; 4490 } 4491 if (slot && slot._c) { 4492 slot._d = false; 4493 } 4494 openBlock(); 4495 const validSlotContent = slot && ensureValidVNode(slot(props)); 4496 const rendered = createBlock( 4497 Fragment, 4498 { 4499 key: props.key || // slot content array of a dynamic conditional slot may have a branch 4500 // key attached in the `createSlots` helper, respect that 4501 validSlotContent && validSlotContent.key || `_${name}` 4502 }, 4503 validSlotContent || (fallback ? fallback() : []), 4504 validSlotContent && slots._ === 1 ? 64 : -2 4505 ); 4506 if (!noSlotted && rendered.scopeId) { 4507 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 4508 } 4509 if (slot && slot._c) { 4510 slot._d = true; 4511 } 4512 return rendered; 4513 } 4514 function ensureValidVNode(vnodes) { 4515 return vnodes.some((child) => { 4516 if (!isVNode(child)) 4517 return true; 4518 if (child.type === Comment) 4519 return false; 4520 if (child.type === Fragment && !ensureValidVNode(child.children)) 4521 return false; 4522 return true; 4523 }) ? vnodes : null; 4524 } 4525 4526 function toHandlers(obj, preserveCaseIfNecessary) { 4527 const ret = {}; 4528 if (!isObject(obj)) { 4529 warn$1(`v-on with no argument expects an object value.`); 4530 return ret; 4531 } 4532 for (const key in obj) { 4533 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 4534 } 4535 return ret; 4536 } 4537 4538 const getPublicInstance = (i) => { 4539 if (!i) 4540 return null; 4541 if (isStatefulComponent(i)) 4542 return getExposeProxy(i) || i.proxy; 4543 return getPublicInstance(i.parent); 4544 }; 4545 const publicPropertiesMap = ( 4546 // Move PURE marker to new line to workaround compiler discarding it 4547 // due to type annotation 4548 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 4549 $: (i) => i, 4550 $el: (i) => i.vnode.el, 4551 $data: (i) => i.data, 4552 $props: (i) => shallowReadonly(i.props) , 4553 $attrs: (i) => shallowReadonly(i.attrs) , 4554 $slots: (i) => shallowReadonly(i.slots) , 4555 $refs: (i) => shallowReadonly(i.refs) , 4556 $parent: (i) => getPublicInstance(i.parent), 4557 $root: (i) => getPublicInstance(i.root), 4558 $emit: (i) => i.emit, 4559 $options: (i) => resolveMergedOptions(i) , 4560 $forceUpdate: (i) => i.f || (i.f = () => { 4561 i.effect.dirty = true; 4562 queueJob(i.update); 4563 }), 4564 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 4565 $watch: (i) => instanceWatch.bind(i) 4566 }) 4567 ); 4568 const isReservedPrefix = (key) => key === "_" || key === "$"; 4569 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 4570 const PublicInstanceProxyHandlers = { 4571 get({ _: instance }, key) { 4572 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 4573 if (key === "__isVue") { 4574 return true; 4575 } 4576 let normalizedProps; 4577 if (key[0] !== "$") { 4578 const n = accessCache[key]; 4579 if (n !== void 0) { 4580 switch (n) { 4581 case 1 /* SETUP */: 4582 return setupState[key]; 4583 case 2 /* DATA */: 4584 return data[key]; 4585 case 4 /* CONTEXT */: 4586 return ctx[key]; 4587 case 3 /* PROPS */: 4588 return props[key]; 4589 } 4590 } else if (hasSetupBinding(setupState, key)) { 4591 accessCache[key] = 1 /* SETUP */; 4592 return setupState[key]; 4593 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 4594 accessCache[key] = 2 /* DATA */; 4595 return data[key]; 4596 } else if ( 4597 // only cache other properties when instance has declared (thus stable) 4598 // props 4599 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 4600 ) { 4601 accessCache[key] = 3 /* PROPS */; 4602 return props[key]; 4603 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 4604 accessCache[key] = 4 /* CONTEXT */; 4605 return ctx[key]; 4606 } else if (shouldCacheAccess) { 4607 accessCache[key] = 0 /* OTHER */; 4608 } 4609 } 4610 const publicGetter = publicPropertiesMap[key]; 4611 let cssModule, globalProperties; 4612 if (publicGetter) { 4613 if (key === "$attrs") { 4614 track(instance, "get", key); 4615 markAttrsAccessed(); 4616 } else if (key === "$slots") { 4617 track(instance, "get", key); 4618 } 4619 return publicGetter(instance); 4620 } else if ( 4621 // css module (injected by vue-loader) 4622 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 4623 ) { 4624 return cssModule; 4625 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 4626 accessCache[key] = 4 /* CONTEXT */; 4627 return ctx[key]; 4628 } else if ( 4629 // global properties 4630 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 4631 ) { 4632 { 4633 return globalProperties[key]; 4634 } 4635 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 4636 // to infinite warning loop 4637 key.indexOf("__v") !== 0)) { 4638 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 4639 warn$1( 4640 `Property ${JSON.stringify( 4641 key 4642 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 4643 ); 4644 } else if (instance === currentRenderingInstance) { 4645 warn$1( 4646 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 4647 ); 4648 } 4649 } 4650 }, 4651 set({ _: instance }, key, value) { 4652 const { data, setupState, ctx } = instance; 4653 if (hasSetupBinding(setupState, key)) { 4654 setupState[key] = value; 4655 return true; 4656 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 4657 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 4658 return false; 4659 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 4660 data[key] = value; 4661 return true; 4662 } else if (hasOwn(instance.props, key)) { 4663 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 4664 return false; 4665 } 4666 if (key[0] === "$" && key.slice(1) in instance) { 4667 warn$1( 4668 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 4669 ); 4670 return false; 4671 } else { 4672 if (key in instance.appContext.config.globalProperties) { 4673 Object.defineProperty(ctx, key, { 4674 enumerable: true, 4675 configurable: true, 4676 value 4677 }); 4678 } else { 4679 ctx[key] = value; 4680 } 4681 } 4682 return true; 4683 }, 4684 has({ 4685 _: { data, setupState, accessCache, ctx, appContext, propsOptions } 4686 }, key) { 4687 let normalizedProps; 4688 return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); 4689 }, 4690 defineProperty(target, key, descriptor) { 4691 if (descriptor.get != null) { 4692 target._.accessCache[key] = 0; 4693 } else if (hasOwn(descriptor, "value")) { 4694 this.set(target, key, descriptor.value, null); 4695 } 4696 return Reflect.defineProperty(target, key, descriptor); 4697 } 4698 }; 4699 { 4700 PublicInstanceProxyHandlers.ownKeys = (target) => { 4701 warn$1( 4702 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 4703 ); 4704 return Reflect.ownKeys(target); 4705 }; 4706 } 4707 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend( 4708 {}, 4709 PublicInstanceProxyHandlers, 4710 { 4711 get(target, key) { 4712 if (key === Symbol.unscopables) { 4713 return; 4714 } 4715 return PublicInstanceProxyHandlers.get(target, key, target); 4716 }, 4717 has(_, key) { 4718 const has = key[0] !== "_" && !isGloballyAllowed(key); 4719 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 4720 warn$1( 4721 `Property ${JSON.stringify( 4722 key 4723 )} should not start with _ which is a reserved prefix for Vue internals.` 4724 ); 4725 } 4726 return has; 4727 } 4728 } 4729 ); 4730 function createDevRenderContext(instance) { 4731 const target = {}; 4732 Object.defineProperty(target, `_`, { 4733 configurable: true, 4734 enumerable: false, 4735 get: () => instance 4736 }); 4737 Object.keys(publicPropertiesMap).forEach((key) => { 4738 Object.defineProperty(target, key, { 4739 configurable: true, 4740 enumerable: false, 4741 get: () => publicPropertiesMap[key](instance), 4742 // intercepted by the proxy so no need for implementation, 4743 // but needed to prevent set errors 4744 set: NOOP 4745 }); 4746 }); 4747 return target; 4748 } 4749 function exposePropsOnRenderContext(instance) { 4750 const { 4751 ctx, 4752 propsOptions: [propsOptions] 4753 } = instance; 4754 if (propsOptions) { 4755 Object.keys(propsOptions).forEach((key) => { 4756 Object.defineProperty(ctx, key, { 4757 enumerable: true, 4758 configurable: true, 4759 get: () => instance.props[key], 4760 set: NOOP 4761 }); 4762 }); 4763 } 4764 } 4765 function exposeSetupStateOnRenderContext(instance) { 4766 const { ctx, setupState } = instance; 4767 Object.keys(toRaw(setupState)).forEach((key) => { 4768 if (!setupState.__isScriptSetup) { 4769 if (isReservedPrefix(key[0])) { 4770 warn$1( 4771 `setup() return property ${JSON.stringify( 4772 key 4773 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 4774 ); 4775 return; 4776 } 4777 Object.defineProperty(ctx, key, { 4778 enumerable: true, 4779 configurable: true, 4780 get: () => setupState[key], 4781 set: NOOP 4782 }); 4783 } 4784 }); 4785 } 4786 4787 const warnRuntimeUsage = (method) => warn$1( 4788 `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.` 4789 ); 4790 function defineProps() { 4791 { 4792 warnRuntimeUsage(`defineProps`); 4793 } 4794 return null; 4795 } 4796 function defineEmits() { 4797 { 4798 warnRuntimeUsage(`defineEmits`); 4799 } 4800 return null; 4801 } 4802 function defineExpose(exposed) { 4803 { 4804 warnRuntimeUsage(`defineExpose`); 4805 } 4806 } 4807 function defineOptions(options) { 4808 { 4809 warnRuntimeUsage(`defineOptions`); 4810 } 4811 } 4812 function defineSlots() { 4813 { 4814 warnRuntimeUsage(`defineSlots`); 4815 } 4816 return null; 4817 } 4818 function defineModel() { 4819 { 4820 warnRuntimeUsage("defineModel"); 4821 } 4822 } 4823 function withDefaults(props, defaults) { 4824 { 4825 warnRuntimeUsage(`withDefaults`); 4826 } 4827 return null; 4828 } 4829 function useSlots() { 4830 return getContext().slots; 4831 } 4832 function useAttrs() { 4833 return getContext().attrs; 4834 } 4835 function getContext() { 4836 const i = getCurrentInstance(); 4837 if (!i) { 4838 warn$1(`useContext() called without active instance.`); 4839 } 4840 return i.setupContext || (i.setupContext = createSetupContext(i)); 4841 } 4842 function normalizePropsOrEmits(props) { 4843 return isArray(props) ? props.reduce( 4844 (normalized, p) => (normalized[p] = null, normalized), 4845 {} 4846 ) : props; 4847 } 4848 function mergeDefaults(raw, defaults) { 4849 const props = normalizePropsOrEmits(raw); 4850 for (const key in defaults) { 4851 if (key.startsWith("__skip")) 4852 continue; 4853 let opt = props[key]; 4854 if (opt) { 4855 if (isArray(opt) || isFunction(opt)) { 4856 opt = props[key] = { type: opt, default: defaults[key] }; 4857 } else { 4858 opt.default = defaults[key]; 4859 } 4860 } else if (opt === null) { 4861 opt = props[key] = { default: defaults[key] }; 4862 } else { 4863 warn$1(`props default key "${key}" has no corresponding declaration.`); 4864 } 4865 if (opt && defaults[`__skip_${key}`]) { 4866 opt.skipFactory = true; 4867 } 4868 } 4869 return props; 4870 } 4871 function mergeModels(a, b) { 4872 if (!a || !b) 4873 return a || b; 4874 if (isArray(a) && isArray(b)) 4875 return a.concat(b); 4876 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 4877 } 4878 function createPropsRestProxy(props, excludedKeys) { 4879 const ret = {}; 4880 for (const key in props) { 4881 if (!excludedKeys.includes(key)) { 4882 Object.defineProperty(ret, key, { 4883 enumerable: true, 4884 get: () => props[key] 4885 }); 4886 } 4887 } 4888 return ret; 4889 } 4890 function withAsyncContext(getAwaitable) { 4891 const ctx = getCurrentInstance(); 4892 if (!ctx) { 4893 warn$1( 4894 `withAsyncContext called without active current instance. This is likely a bug.` 4895 ); 4896 } 4897 let awaitable = getAwaitable(); 4898 unsetCurrentInstance(); 4899 if (isPromise(awaitable)) { 4900 awaitable = awaitable.catch((e) => { 4901 setCurrentInstance(ctx); 4902 throw e; 4903 }); 4904 } 4905 return [awaitable, () => setCurrentInstance(ctx)]; 4906 } 4907 4908 function createDuplicateChecker() { 4909 const cache = /* @__PURE__ */ Object.create(null); 4910 return (type, key) => { 4911 if (cache[key]) { 4912 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 4913 } else { 4914 cache[key] = type; 4915 } 4916 }; 4917 } 4918 let shouldCacheAccess = true; 4919 function applyOptions(instance) { 4920 const options = resolveMergedOptions(instance); 4921 const publicThis = instance.proxy; 4922 const ctx = instance.ctx; 4923 shouldCacheAccess = false; 4924 if (options.beforeCreate) { 4925 callHook$1(options.beforeCreate, instance, "bc"); 4926 } 4927 const { 4928 // state 4929 data: dataOptions, 4930 computed: computedOptions, 4931 methods, 4932 watch: watchOptions, 4933 provide: provideOptions, 4934 inject: injectOptions, 4935 // lifecycle 4936 created, 4937 beforeMount, 4938 mounted, 4939 beforeUpdate, 4940 updated, 4941 activated, 4942 deactivated, 4943 beforeDestroy, 4944 beforeUnmount, 4945 destroyed, 4946 unmounted, 4947 render, 4948 renderTracked, 4949 renderTriggered, 4950 errorCaptured, 4951 serverPrefetch, 4952 // public API 4953 expose, 4954 inheritAttrs, 4955 // assets 4956 components, 4957 directives, 4958 filters 4959 } = options; 4960 const checkDuplicateProperties = createDuplicateChecker() ; 4961 { 4962 const [propsOptions] = instance.propsOptions; 4963 if (propsOptions) { 4964 for (const key in propsOptions) { 4965 checkDuplicateProperties("Props" /* PROPS */, key); 4966 } 4967 } 4968 } 4969 if (injectOptions) { 4970 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 4971 } 4972 if (methods) { 4973 for (const key in methods) { 4974 const methodHandler = methods[key]; 4975 if (isFunction(methodHandler)) { 4976 { 4977 Object.defineProperty(ctx, key, { 4978 value: methodHandler.bind(publicThis), 4979 configurable: true, 4980 enumerable: true, 4981 writable: true 4982 }); 4983 } 4984 { 4985 checkDuplicateProperties("Methods" /* METHODS */, key); 4986 } 4987 } else { 4988 warn$1( 4989 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 4990 ); 4991 } 4992 } 4993 } 4994 if (dataOptions) { 4995 if (!isFunction(dataOptions)) { 4996 warn$1( 4997 `The data option must be a function. Plain object usage is no longer supported.` 4998 ); 4999 } 5000 const data = dataOptions.call(publicThis, publicThis); 5001 if (isPromise(data)) { 5002 warn$1( 5003 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5004 ); 5005 } 5006 if (!isObject(data)) { 5007 warn$1(`data() should return an object.`); 5008 } else { 5009 instance.data = reactive(data); 5010 { 5011 for (const key in data) { 5012 checkDuplicateProperties("Data" /* DATA */, key); 5013 if (!isReservedPrefix(key[0])) { 5014 Object.defineProperty(ctx, key, { 5015 configurable: true, 5016 enumerable: true, 5017 get: () => data[key], 5018 set: NOOP 5019 }); 5020 } 5021 } 5022 } 5023 } 5024 } 5025 shouldCacheAccess = true; 5026 if (computedOptions) { 5027 for (const key in computedOptions) { 5028 const opt = computedOptions[key]; 5029 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5030 if (get === NOOP) { 5031 warn$1(`Computed property "${key}" has no getter.`); 5032 } 5033 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5034 warn$1( 5035 `Write operation failed: computed property "${key}" is readonly.` 5036 ); 5037 } ; 5038 const c = computed({ 5039 get, 5040 set 5041 }); 5042 Object.defineProperty(ctx, key, { 5043 enumerable: true, 5044 configurable: true, 5045 get: () => c.value, 5046 set: (v) => c.value = v 5047 }); 5048 { 5049 checkDuplicateProperties("Computed" /* COMPUTED */, key); 5050 } 5051 } 5052 } 5053 if (watchOptions) { 5054 for (const key in watchOptions) { 5055 createWatcher(watchOptions[key], ctx, publicThis, key); 5056 } 5057 } 5058 if (provideOptions) { 5059 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
vendor: 3,344 bytes, lines 5060-5162
5060 Reflect.ownKeys(provides).forEach((key) => { 5061 provide(key, provides[key]); 5062 }); 5063 } 5064 if (created) { 5065 callHook$1(created, instance, "c"); 5066 } 5067 function registerLifecycleHook(register, hook) { 5068 if (isArray(hook)) { 5069 hook.forEach((_hook) => register(_hook.bind(publicThis))); 5070 } else if (hook) { 5071 register(hook.bind(publicThis)); 5072 } 5073 } 5074 registerLifecycleHook(onBeforeMount, beforeMount); 5075 registerLifecycleHook(onMounted, mounted); 5076 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 5077 registerLifecycleHook(onUpdated, updated); 5078 registerLifecycleHook(onActivated, activated); 5079 registerLifecycleHook(onDeactivated, deactivated); 5080 registerLifecycleHook(onErrorCaptured, errorCaptured); 5081 registerLifecycleHook(onRenderTracked, renderTracked); 5082 registerLifecycleHook(onRenderTriggered, renderTriggered); 5083 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 5084 registerLifecycleHook(onUnmounted, unmounted); 5085 registerLifecycleHook(onServerPrefetch, serverPrefetch); 5086 if (isArray(expose)) { 5087 if (expose.length) { 5088 const exposed = instance.exposed || (instance.exposed = {}); 5089 expose.forEach((key) => { 5090 Object.defineProperty(exposed, key, { 5091 get: () => publicThis[key], 5092 set: (val) => publicThis[key] = val 5093 }); 5094 }); 5095 } else if (!instance.exposed) { 5096 instance.exposed = {}; 5097 } 5098 } 5099 if (render && instance.render === NOOP) { 5100 instance.render = render; 5101 } 5102 if (inheritAttrs != null) { 5103 instance.inheritAttrs = inheritAttrs; 5104 } 5105 if (components) 5106 instance.components = components; 5107 if (directives) 5108 instance.directives = directives; 5109 } 5110 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 5111 if (isArray(injectOptions)) { 5112 injectOptions = normalizeInject(injectOptions); 5113 } 5114 for (const key in injectOptions) { 5115 const opt = injectOptions[key]; 5116 let injected; 5117 if (isObject(opt)) { 5118 if ("default" in opt) { 5119 injected = inject( 5120 opt.from || key, 5121 opt.default, 5122 true 5123 ); 5124 } else { 5125 injected = inject(opt.from || key); 5126 } 5127 } else { 5128 injected = inject(opt); 5129 } 5130 if (isRef(injected)) { 5131 Object.defineProperty(ctx, key, { 5132 enumerable: true, 5133 configurable: true, 5134 get: () => injected.value, 5135 set: (v) => injected.value = v 5136 }); 5137 } else { 5138 ctx[key] = injected; 5139 } 5140 { 5141 checkDuplicateProperties("Inject" /* INJECT */, key); 5142 } 5143 } 5144 } 5145 function callHook$1(hook, instance, type) { 5146 callWithAsyncErrorHandling( 5147 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 5148 instance, 5149 type 5150 ); 5151 } 5152 function createWatcher(raw, ctx, publicThis, key) { 5153 const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 5154 if (isString(raw)) { 5155 const handler = ctx[raw]; 5156 if (isFunction(handler)) { 5157 watch(getter, handler); 5158 } else { 5159 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 5160 } 5161 } else if (isFunction(raw)) { 5162 watch(getter, raw.bind(publicThis));
vendor: 4,235 bytes, lines 5162-5309
5162 5163 } else if (isObject(raw)) { 5164 if (isArray(raw)) { 5165 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 5166 } else { 5167 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 5168 if (isFunction(handler)) { 5169 watch(getter, handler, raw); 5170 } else { 5171 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 5172 } 5173 } 5174 } else { 5175 warn$1(`Invalid watch option: "${key}"`, raw); 5176 } 5177 } 5178 function resolveMergedOptions(instance) { 5179 const base = instance.type; 5180 const { mixins, extends: extendsOptions } = base; 5181 const { 5182 mixins: globalMixins, 5183 optionsCache: cache, 5184 config: { optionMergeStrategies } 5185 } = instance.appContext; 5186 const cached = cache.get(base); 5187 let resolved; 5188 if (cached) { 5189 resolved = cached; 5190 } else if (!globalMixins.length && !mixins && !extendsOptions) { 5191 { 5192 resolved = base; 5193 } 5194 } else { 5195 resolved = {}; 5196 if (globalMixins.length) { 5197 globalMixins.forEach( 5198 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 5199 ); 5200 } 5201 mergeOptions(resolved, base, optionMergeStrategies); 5202 } 5203 if (isObject(base)) { 5204 cache.set(base, resolved); 5205 } 5206 return resolved; 5207 } 5208 function mergeOptions(to, from, strats, asMixin = false) { 5209 const { mixins, extends: extendsOptions } = from; 5210 if (extendsOptions) { 5211 mergeOptions(to, extendsOptions, strats, true); 5212 } 5213 if (mixins) { 5214 mixins.forEach( 5215 (m) => mergeOptions(to, m, strats, true) 5216 ); 5217 } 5218 for (const key in from) { 5219 if (asMixin && key === "expose") { 5220 warn$1( 5221 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 5222 ); 5223 } else { 5224 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 5225 to[key] = strat ? strat(to[key], from[key]) : from[key]; 5226 } 5227 } 5228 return to; 5229 } 5230 const internalOptionMergeStrats = { 5231 data: mergeDataFn, 5232 props: mergeEmitsOrPropsOptions, 5233 emits: mergeEmitsOrPropsOptions, 5234 // objects 5235 methods: mergeObjectOptions, 5236 computed: mergeObjectOptions, 5237 // lifecycle 5238 beforeCreate: mergeAsArray$1, 5239 created: mergeAsArray$1, 5240 beforeMount: mergeAsArray$1, 5241 mounted: mergeAsArray$1, 5242 beforeUpdate: mergeAsArray$1, 5243 updated: mergeAsArray$1, 5244 beforeDestroy: mergeAsArray$1, 5245 beforeUnmount: mergeAsArray$1, 5246 destroyed: mergeAsArray$1, 5247 unmounted: mergeAsArray$1, 5248 activated: mergeAsArray$1, 5249 deactivated: mergeAsArray$1, 5250 errorCaptured: mergeAsArray$1, 5251 serverPrefetch: mergeAsArray$1, 5252 // assets 5253 components: mergeObjectOptions, 5254 directives: mergeObjectOptions, 5255 // watch 5256 watch: mergeWatchOptions, 5257 // provide / inject 5258 provide: mergeDataFn, 5259 inject: mergeInject 5260 }; 5261 function mergeDataFn(to, from) { 5262 if (!from) { 5263 return to; 5264 } 5265 if (!to) { 5266 return from; 5267 } 5268 return function mergedDataFn() { 5269 return (extend)( 5270 isFunction(to) ? to.call(this, this) : to, 5271 isFunction(from) ? from.call(this, this) : from 5272 ); 5273 }; 5274 } 5275 function mergeInject(to, from) { 5276 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 5277 } 5278 function normalizeInject(raw) { 5279 if (isArray(raw)) { 5280 const res = {}; 5281 for (let i = 0; i < raw.length; i++) { 5282 res[raw[i]] = raw[i]; 5283 } 5284 return res; 5285 } 5286 return raw; 5287 } 5288 function mergeAsArray$1(to, from) { 5289 return to ? [...new Set([].concat(to, from))] : from; 5290 } 5291 function mergeObjectOptions(to, from) { 5292 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 5293 } 5294 function mergeEmitsOrPropsOptions(to, from) { 5295 if (to) { 5296 if (isArray(to) && isArray(from)) { 5297 return [.../* @__PURE__ */ new Set([...to, ...from])]; 5298 } 5299 return extend( 5300 /* @__PURE__ */ Object.create(null), 5301 normalizePropsOrEmits(to), 5302 normalizePropsOrEmits(from != null ? from : {}) 5303 ); 5304 } else { 5305 return from; 5306 } 5307 } 5308 function mergeWatchOptions(to, from) { 5309 if (!to)
vendor: 22,813 bytes, lines 5309-6018
5309 5310 return from; 5311 if (!from) 5312 return to; 5313 const merged = extend(/* @__PURE__ */ Object.create(null), to); 5314 for (const key in from) { 5315 merged[key] = mergeAsArray$1(to[key], from[key]); 5316 } 5317 return merged; 5318 } 5319 5320 function createAppContext() { 5321 return { 5322 app: null, 5323 config: { 5324 isNativeTag: NO, 5325 performance: false, 5326 globalProperties: {}, 5327 optionMergeStrategies: {}, 5328 errorHandler: void 0, 5329 warnHandler: void 0, 5330 compilerOptions: {} 5331 }, 5332 mixins: [], 5333 components: {}, 5334 directives: {}, 5335 provides: /* @__PURE__ */ Object.create(null), 5336 optionsCache: /* @__PURE__ */ new WeakMap(), 5337 propsCache: /* @__PURE__ */ new WeakMap(), 5338 emitsCache: /* @__PURE__ */ new WeakMap() 5339 }; 5340 } 5341 let uid$1 = 0; 5342 function createAppAPI(render, hydrate) { 5343 return function createApp(rootComponent, rootProps = null) { 5344 if (!isFunction(rootComponent)) { 5345 rootComponent = extend({}, rootComponent); 5346 } 5347 if (rootProps != null && !isObject(rootProps)) { 5348 warn$1(`root props passed to app.mount() must be an object.`); 5349 rootProps = null; 5350 } 5351 const context = createAppContext(); 5352 const installedPlugins = /* @__PURE__ */ new WeakSet(); 5353 let isMounted = false; 5354 const app = context.app = { 5355 _uid: uid$1++, 5356 _component: rootComponent, 5357 _props: rootProps, 5358 _container: null, 5359 _context: context, 5360 _instance: null, 5361 version, 5362 get config() { 5363 return context.config; 5364 }, 5365 set config(v) { 5366 { 5367 warn$1( 5368 `app.config cannot be replaced. Modify individual options instead.` 5369 ); 5370 } 5371 }, 5372 use(plugin, ...options) { 5373 if (installedPlugins.has(plugin)) { 5374 warn$1(`Plugin has already been applied to target app.`); 5375 } else if (plugin && isFunction(plugin.install)) { 5376 installedPlugins.add(plugin); 5377 plugin.install(app, ...options); 5378 } else if (isFunction(plugin)) { 5379 installedPlugins.add(plugin); 5380 plugin(app, ...options); 5381 } else { 5382 warn$1( 5383 `A plugin must either be a function or an object with an "install" function.` 5384 ); 5385 } 5386 return app; 5387 }, 5388 mixin(mixin) { 5389 { 5390 if (!context.mixins.includes(mixin)) { 5391 context.mixins.push(mixin); 5392 } else { 5393 warn$1( 5394 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 5395 ); 5396 } 5397 } 5398 return app; 5399 }, 5400 component(name, component) { 5401 { 5402 validateComponentName(name, context.config); 5403 } 5404 if (!component) { 5405 return context.components[name]; 5406 } 5407 if (context.components[name]) { 5408 warn$1(`Component "${name}" has already been registered in target app.`); 5409 } 5410 context.components[name] = component; 5411 return app; 5412 }, 5413 directive(name, directive) { 5414 { 5415 validateDirectiveName(name); 5416 } 5417 if (!directive) { 5418 return context.directives[name]; 5419 } 5420 if (context.directives[name]) { 5421 warn$1(`Directive "${name}" has already been registered in target app.`); 5422 } 5423 context.directives[name] = directive; 5424 return app; 5425 }, 5426 mount(rootContainer, isHydrate, namespace) { 5427 if (!isMounted) { 5428 if (rootContainer.__vue_app__) { 5429 warn$1( 5430 `There is already an app instance mounted on the host container. 5431 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 5432 ); 5433 } 5434 const vnode = createVNode(rootComponent, rootProps); 5435 vnode.appContext = context; 5436 if (namespace === true) { 5437 namespace = "svg"; 5438 } else if (namespace === false) { 5439 namespace = void 0; 5440 } 5441 { 5442 context.reload = () => { 5443 render( 5444 cloneVNode(vnode), 5445 rootContainer, 5446 namespace 5447 ); 5448 }; 5449 } 5450 if (isHydrate && hydrate) { 5451 hydrate(vnode, rootContainer); 5452 } else { 5453 render(vnode, rootContainer, namespace); 5454 } 5455 isMounted = true; 5456 app._container = rootContainer; 5457 rootContainer.__vue_app__ = app; 5458 { 5459 app._instance = vnode.component; 5460 devtoolsInitApp(app, version); 5461 } 5462 return getExposeProxy(vnode.component) || vnode.component.proxy; 5463 } else { 5464 warn$1( 5465 `App has already been mounted. 5466If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\`` 5467 ); 5468 } 5469 }, 5470 unmount() { 5471 if (isMounted) { 5472 render(null, app._container); 5473 { 5474 app._instance = null; 5475 devtoolsUnmountApp(app); 5476 } 5477 delete app._container.__vue_app__; 5478 } else { 5479 warn$1(`Cannot unmount an app that is not mounted.`); 5480 } 5481 }, 5482 provide(key, value) { 5483 if (key in context.provides) { 5484 warn$1( 5485 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 5486 ); 5487 } 5488 context.provides[key] = value; 5489 return app; 5490 }, 5491 runWithContext(fn) { 5492 const lastApp = currentApp; 5493 currentApp = app; 5494 try { 5495 return fn(); 5496 } finally { 5497 currentApp = lastApp; 5498 } 5499 } 5500 }; 5501 return app; 5502 }; 5503 } 5504 let currentApp = null; 5505 5506 function provide(key, value) { 5507 if (!currentInstance) { 5508 { 5509 warn$1(`provide() can only be used inside setup().`); 5510 } 5511 } else { 5512 let provides = currentInstance.provides; 5513 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 5514 if (parentProvides === provides) { 5515 provides = currentInstance.provides = Object.create(parentProvides); 5516 } 5517 provides[key] = value; 5518 } 5519 } 5520 function inject(key, defaultValue, treatDefaultAsFactory = false) { 5521 const instance = currentInstance || currentRenderingInstance; 5522 if (instance || currentApp) { 5523 const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides; 5524 if (provides && key in provides) { 5525 return provides[key]; 5526 } else if (arguments.length > 1) { 5527 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 5528 } else { 5529 warn$1(`injection "${String(key)}" not found.`); 5530 } 5531 } else { 5532 warn$1(`inject() can only be used inside setup() or functional components.`); 5533 } 5534 } 5535 function hasInjectionContext() { 5536 return !!(currentInstance || currentRenderingInstance || currentApp); 5537 } 5538 5539 function initProps(instance, rawProps, isStateful, isSSR = false) { 5540 const props = {}; 5541 const attrs = {}; 5542 def(attrs, InternalObjectKey, 1); 5543 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 5544 setFullProps(instance, rawProps, props, attrs); 5545 for (const key in instance.propsOptions[0]) { 5546 if (!(key in props)) { 5547 props[key] = void 0; 5548 } 5549 } 5550 { 5551 validateProps(rawProps || {}, props, instance); 5552 } 5553 if (isStateful) { 5554 instance.props = isSSR ? props : shallowReactive(props); 5555 } else { 5556 if (!instance.type.props) { 5557 instance.props = attrs; 5558 } else { 5559 instance.props = props; 5560 } 5561 } 5562 instance.attrs = attrs; 5563 } 5564 function isInHmrContext(instance) { 5565 while (instance) { 5566 if (instance.type.__hmrId) 5567 return true; 5568 instance = instance.parent; 5569 } 5570 } 5571 function updateProps(instance, rawProps, rawPrevProps, optimized) { 5572 const { 5573 props, 5574 attrs, 5575 vnode: { patchFlag } 5576 } = instance; 5577 const rawCurrentProps = toRaw(props); 5578 const [options] = instance.propsOptions; 5579 let hasAttrsChanged = false; 5580 if ( 5581 // always force full diff in dev 5582 // - #1942 if hmr is enabled with sfc component 5583 // - vite#872 non-sfc component used by sfc component 5584 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 5585 ) { 5586 if (patchFlag & 8) { 5587 const propsToUpdate = instance.vnode.dynamicProps; 5588 for (let i = 0; i < propsToUpdate.length; i++) { 5589 let key = propsToUpdate[i]; 5590 if (isEmitListener(instance.emitsOptions, key)) { 5591 continue; 5592 } 5593 const value = rawProps[key]; 5594 if (options) { 5595 if (hasOwn(attrs, key)) { 5596 if (value !== attrs[key]) { 5597 attrs[key] = value; 5598 hasAttrsChanged = true; 5599 } 5600 } else { 5601 const camelizedKey = camelize(key); 5602 props[camelizedKey] = resolvePropValue( 5603 options, 5604 rawCurrentProps, 5605 camelizedKey, 5606 value, 5607 instance, 5608 false 5609 ); 5610 } 5611 } else { 5612 if (value !== attrs[key]) { 5613 attrs[key] = value; 5614 hasAttrsChanged = true; 5615 } 5616 } 5617 } 5618 } 5619 } else { 5620 if (setFullProps(instance, rawProps, props, attrs)) { 5621 hasAttrsChanged = true; 5622 } 5623 let kebabKey; 5624 for (const key in rawCurrentProps) { 5625 if (!rawProps || // for camelCase 5626 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 5627 // and converted to camelCase (#955) 5628 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 5629 if (options) { 5630 if (rawPrevProps && // for camelCase 5631 (rawPrevProps[key] !== void 0 || // for kebab-case 5632 rawPrevProps[kebabKey] !== void 0)) { 5633 props[key] = resolvePropValue( 5634 options, 5635 rawCurrentProps, 5636 key, 5637 void 0, 5638 instance, 5639 true 5640 ); 5641 } 5642 } else { 5643 delete props[key]; 5644 } 5645 } 5646 } 5647 if (attrs !== rawCurrentProps) { 5648 for (const key in attrs) { 5649 if (!rawProps || !hasOwn(rawProps, key) && true) { 5650 delete attrs[key]; 5651 hasAttrsChanged = true; 5652 } 5653 } 5654 } 5655 } 5656 if (hasAttrsChanged) { 5657 trigger(instance, "set", "$attrs"); 5658 } 5659 { 5660 validateProps(rawProps || {}, props, instance); 5661 } 5662 } 5663 function setFullProps(instance, rawProps, props, attrs) { 5664 const [options, needCastKeys] = instance.propsOptions; 5665 let hasAttrsChanged = false; 5666 let rawCastValues; 5667 if (rawProps) { 5668 for (let key in rawProps) { 5669 if (isReservedProp(key)) { 5670 continue; 5671 } 5672 const value = rawProps[key]; 5673 let camelKey; 5674 if (options && hasOwn(options, camelKey = camelize(key))) { 5675 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 5676 props[camelKey] = value; 5677 } else { 5678 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 5679 } 5680 } else if (!isEmitListener(instance.emitsOptions, key)) { 5681 if (!(key in attrs) || value !== attrs[key]) { 5682 attrs[key] = value; 5683 hasAttrsChanged = true; 5684 } 5685 } 5686 } 5687 } 5688 if (needCastKeys) { 5689 const rawCurrentProps = toRaw(props); 5690 const castValues = rawCastValues || EMPTY_OBJ; 5691 for (let i = 0; i < needCastKeys.length; i++) { 5692 const key = needCastKeys[i]; 5693 props[key] = resolvePropValue( 5694 options, 5695 rawCurrentProps, 5696 key, 5697 castValues[key], 5698 instance, 5699 !hasOwn(castValues, key) 5700 ); 5701 } 5702 } 5703 return hasAttrsChanged; 5704 } 5705 function resolvePropValue(options, props, key, value, instance, isAbsent) { 5706 const opt = options[key]; 5707 if (opt != null) { 5708 const hasDefault = hasOwn(opt, "default"); 5709 if (hasDefault && value === void 0) { 5710 const defaultValue = opt.default; 5711 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 5712 const { propsDefaults } = instance; 5713 if (key in propsDefaults) { 5714 value = propsDefaults[key]; 5715 } else { 5716 const reset = setCurrentInstance(instance); 5717 value = propsDefaults[key] = defaultValue.call( 5718 null, 5719 props 5720 ); 5721 reset(); 5722 } 5723 } else { 5724 value = defaultValue; 5725 } 5726 } 5727 if (opt[0 /* shouldCast */]) { 5728 if (isAbsent && !hasDefault) { 5729 value = false; 5730 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 5731 value = true; 5732 } 5733 } 5734 } 5735 return value; 5736 } 5737 function normalizePropsOptions(comp, appContext, asMixin = false) { 5738 const cache = appContext.propsCache; 5739 const cached = cache.get(comp); 5740 if (cached) { 5741 return cached; 5742 } 5743 const raw = comp.props; 5744 const normalized = {}; 5745 const needCastKeys = []; 5746 let hasExtends = false; 5747 if (!isFunction(comp)) { 5748 const extendProps = (raw2) => { 5749 hasExtends = true; 5750 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 5751 extend(normalized, props); 5752 if (keys) 5753 needCastKeys.push(...keys); 5754 }; 5755 if (!asMixin && appContext.mixins.length) { 5756 appContext.mixins.forEach(extendProps); 5757 } 5758 if (comp.extends) { 5759 extendProps(comp.extends); 5760 } 5761 if (comp.mixins) { 5762 comp.mixins.forEach(extendProps); 5763 } 5764 } 5765 if (!raw && !hasExtends) { 5766 if (isObject(comp)) { 5767 cache.set(comp, EMPTY_ARR); 5768 } 5769 return EMPTY_ARR; 5770 } 5771 if (isArray(raw)) { 5772 for (let i = 0; i < raw.length; i++) { 5773 if (!isString(raw[i])) { 5774 warn$1(`props must be strings when using array syntax.`, raw[i]); 5775 } 5776 const normalizedKey = camelize(raw[i]); 5777 if (validatePropName(normalizedKey)) { 5778 normalized[normalizedKey] = EMPTY_OBJ; 5779 } 5780 } 5781 } else if (raw) { 5782 if (!isObject(raw)) { 5783 warn$1(`invalid props options`, raw); 5784 } 5785 for (const key in raw) { 5786 const normalizedKey = camelize(key); 5787 if (validatePropName(normalizedKey)) { 5788 const opt = raw[key]; 5789 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 5790 if (prop) { 5791 const booleanIndex = getTypeIndex(Boolean, prop.type); 5792 const stringIndex = getTypeIndex(String, prop.type); 5793 prop[0 /* shouldCast */] = booleanIndex > -1; 5794 prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex; 5795 if (booleanIndex > -1 || hasOwn(prop, "default")) { 5796 needCastKeys.push(normalizedKey); 5797 } 5798 } 5799 } 5800 } 5801 } 5802 const res = [normalized, needCastKeys]; 5803 if (isObject(comp)) { 5804 cache.set(comp, res); 5805 } 5806 return res; 5807 } 5808 function validatePropName(key) { 5809 if (key[0] !== "$" && !isReservedProp(key)) { 5810 return true; 5811 } else { 5812 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 5813 } 5814 return false; 5815 } 5816 function getType(ctor) { 5817 if (ctor === null) { 5818 return "null"; 5819 } 5820 if (typeof ctor === "function") { 5821 return ctor.name || ""; 5822 } else if (typeof ctor === "object") { 5823 const name = ctor.constructor && ctor.constructor.name; 5824 return name || ""; 5825 } 5826 return ""; 5827 } 5828 function isSameType(a, b) { 5829 return getType(a) === getType(b); 5830 } 5831 function getTypeIndex(type, expectedTypes) { 5832 if (isArray(expectedTypes)) { 5833 return expectedTypes.findIndex((t) => isSameType(t, type)); 5834 } else if (isFunction(expectedTypes)) { 5835 return isSameType(expectedTypes, type) ? 0 : -1; 5836 } 5837 return -1; 5838 } 5839 function validateProps(rawProps, props, instance) { 5840 const resolvedValues = toRaw(props); 5841 const options = instance.propsOptions[0]; 5842 for (const key in options) { 5843 let opt = options[key]; 5844 if (opt == null) 5845 continue; 5846 validateProp( 5847 key, 5848 resolvedValues[key], 5849 opt, 5850 shallowReadonly(resolvedValues) , 5851 !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)) 5852 ); 5853 } 5854 } 5855 function validateProp(name, value, prop, props, isAbsent) { 5856 const { type, required, validator, skipCheck } = prop; 5857 if (required && isAbsent) { 5858 warn$1('Missing required prop: "' + name + '"'); 5859 return; 5860 } 5861 if (value == null && !required) { 5862 return; 5863 } 5864 if (type != null && type !== true && !skipCheck) { 5865 let isValid = false; 5866 const types = isArray(type) ? type : [type]; 5867 const expectedTypes = []; 5868 for (let i = 0; i < types.length && !isValid; i++) { 5869 const { valid, expectedType } = assertType(value, types[i]); 5870 expectedTypes.push(expectedType || ""); 5871 isValid = valid; 5872 } 5873 if (!isValid) { 5874 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 5875 return; 5876 } 5877 } 5878 if (validator && !validator(value, props)) { 5879 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 5880 } 5881 } 5882 const isSimpleType = /* @__PURE__ */ makeMap( 5883 "String,Number,Boolean,Function,Symbol,BigInt" 5884 ); 5885 function assertType(value, type) { 5886 let valid; 5887 const expectedType = getType(type); 5888 if (isSimpleType(expectedType)) { 5889 const t = typeof value; 5890 valid = t === expectedType.toLowerCase(); 5891 if (!valid && t === "object") { 5892 valid = value instanceof type; 5893 } 5894 } else if (expectedType === "Object") { 5895 valid = isObject(value); 5896 } else if (expectedType === "Array") { 5897 valid = isArray(value); 5898 } else if (expectedType === "null") { 5899 valid = value === null; 5900 } else { 5901 valid = value instanceof type; 5902 } 5903 return { 5904 valid, 5905 expectedType 5906 }; 5907 } 5908 function getInvalidTypeMessage(name, value, expectedTypes) { 5909 if (expectedTypes.length === 0) { 5910 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 5911 } 5912 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 5913 const expectedType = expectedTypes[0]; 5914 const receivedType = toRawType(value); 5915 const expectedValue = styleValue(value, expectedType); 5916 const receivedValue = styleValue(value, receivedType); 5917 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 5918 message += ` with value ${expectedValue}`; 5919 } 5920 message += `, got ${receivedType} `; 5921 if (isExplicable(receivedType)) { 5922 message += `with value ${receivedValue}.`; 5923 } 5924 return message; 5925 } 5926 function styleValue(value, type) { 5927 if (type === "String") { 5928 return `"${value}"`; 5929 } else if (type === "Number") { 5930 return `${Number(value)}`; 5931 } else { 5932 return `${value}`; 5933 } 5934 } 5935 function isExplicable(type) { 5936 const explicitTypes = ["string", "number", "boolean"]; 5937 return explicitTypes.some((elem) => type.toLowerCase() === elem); 5938 } 5939 function isBoolean(...args) { 5940 return args.some((elem) => elem.toLowerCase() === "boolean"); 5941 } 5942 5943 const isInternalKey = (key) => key[0] === "_" || key === "$stable"; 5944 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 5945 const normalizeSlot = (key, rawSlot, ctx) => { 5946 if (rawSlot._n) { 5947 return rawSlot; 5948 } 5949 const normalized = withCtx((...args) => { 5950 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { 5951 warn$1( 5952 `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` 5953 ); 5954 } 5955 return normalizeSlotValue(rawSlot(...args)); 5956 }, ctx); 5957 normalized._c = false; 5958 return normalized; 5959 }; 5960 const normalizeObjectSlots = (rawSlots, slots, instance) => { 5961 const ctx = rawSlots._ctx; 5962 for (const key in rawSlots) { 5963 if (isInternalKey(key)) 5964 continue; 5965 const value = rawSlots[key]; 5966 if (isFunction(value)) { 5967 slots[key] = normalizeSlot(key, value, ctx); 5968 } else if (value != null) { 5969 { 5970 warn$1( 5971 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 5972 ); 5973 } 5974 const normalized = normalizeSlotValue(value); 5975 slots[key] = () => normalized; 5976 } 5977 } 5978 }; 5979 const normalizeVNodeSlots = (instance, children) => { 5980 if (!isKeepAlive(instance.vnode) && true) { 5981 warn$1( 5982 `Non-function value encountered for default slot. Prefer function slots for better performance.` 5983 ); 5984 } 5985 const normalized = normalizeSlotValue(children); 5986 instance.slots.default = () => normalized; 5987 }; 5988 const initSlots = (instance, children) => { 5989 if (instance.vnode.shapeFlag & 32) { 5990 const type = children._; 5991 if (type) { 5992 instance.slots = toRaw(children); 5993 def(children, "_", type); 5994 } else { 5995 normalizeObjectSlots( 5996 children, 5997 instance.slots = {}); 5998 } 5999 } else { 6000 instance.slots = {}; 6001 if (children) { 6002 normalizeVNodeSlots(instance, children); 6003 } 6004 } 6005 def(instance.slots, InternalObjectKey, 1); 6006 }; 6007 const updateSlots = (instance, children, optimized) => { 6008 const { vnode, slots } = instance; 6009 let needDeletionCheck = true; 6010 let deletionComparisonTarget = EMPTY_OBJ; 6011 if (vnode.shapeFlag & 32) { 6012 const type = children._; 6013 if (type) { 6014 if (isHmrUpdating) { 6015 extend(slots, children); 6016 trigger(instance, "set", "$slots"); 6017 } else if (optimized && type === 1) { 6018 needDeletionCheck = false;
6019 } else { 6020 extend(slots, children); 6021 if (!optimized && type === 1) { 6022 delete slots._; 6023 } 6024 } 6025 } else { 6026 needDeletionCheck = !children.$stable; 6027 normalizeObjectSlots(children, slots); 6028 } 6029 deletionComparisonTarget = children; 6030 } else if (children) { 6031 normalizeVNodeSlots(instance, children); 6032 deletionComparisonTarget = { default: 1 }; 6033 } 6034 if (needDeletionCheck) { 6035 for (const key in slots) { 6036 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 6037 delete slots[key]; 6038 } 6039 } 6040 } 6041 }; 6042 6043 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 6044 if (isArray(rawRef)) { 6045 rawRef.forEach( 6046 (r, i) => setRef( 6047 r, 6048 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 6049 parentSuspense, 6050 vnode, 6051 isUnmount 6052 ) 6053 ); 6054 return; 6055 } 6056 if (isAsyncWrapper(vnode) && !isUnmount) { 6057 return; 6058 } 6059 const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el; 6060 const value = isUnmount ? null : refValue; 6061 const { i: owner, r: ref } = rawRef; 6062 if (!owner) { 6063 warn$1( 6064 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 6065 ); 6066 return; 6067 } 6068 const oldRef = oldRawRef && oldRawRef.r; 6069 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 6070 const setupState = owner.setupState; 6071 if (oldRef != null && oldRef !== ref) { 6072 if (isString(oldRef)) { 6073 refs[oldRef] = null; 6074 if (hasOwn(setupState, oldRef)) { 6075 setupState[oldRef] = null; 6076 } 6077 } else if (isRef(oldRef)) { 6078 oldRef.value = null; 6079 } 6080 } 6081 if (isFunction(ref)) { 6082 callWithErrorHandling(ref, owner, 12, [value, refs]); 6083 } else { 6084 const _isString = isString(ref); 6085 const _isRef = isRef(ref); 6086 if (_isString || _isRef) { 6087 const doSet = () => { 6088 if (rawRef.f) { 6089 const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value; 6090 if (isUnmount) { 6091 isArray(existing) && remove(existing, refValue); 6092 } else { 6093 if (!isArray(existing)) { 6094 if (_isString) { 6095 refs[ref] = [refValue]; 6096 if (hasOwn(setupState, ref)) { 6097 setupState[ref] = refs[ref]; 6098 } 6099 } else { 6100 ref.value = [refValue]; 6101 if (rawRef.k) 6102 refs[rawRef.k] = ref.value; 6103 } 6104 } else if (!existing.includes(refValue)) { 6105 existing.push(refValue); 6106 } 6107 } 6108 } else if (_isString) { 6109 refs[ref] = value; 6110 if (hasOwn(setupState, ref)) { 6111 setupState[ref] = value; 6112 } 6113 } else if (_isRef) { 6114 ref.value = value; 6115 if (rawRef.k) 6116 refs[rawRef.k] = value; 6117 } else { 6118 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 6119 } 6120 }; 6121 if (value) { 6122 doSet.id = -1; 6123 queuePostRenderEffect(doSet, parentSuspense); 6124 } else { 6125 doSet(); 6126 } 6127 } else { 6128 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 6129 } 6130 } 6131 } 6132 6133 let hasMismatch = false; 6134 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 6135 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 6136 const getContainerType = (container) => { 6137 if (isSVGContainer(container)) 6138 return "svg"; 6139 if (isMathMLContainer(container)) 6140 return "mathml"; 6141 return void 0; 6142 }; 6143 const isComment = (node) => node.nodeType === 8 /* COMMENT */; 6144 function createHydrationFunctions(rendererInternals) { 6145 const { 6146 mt: mountComponent, 6147 p: patch, 6148 o: { 6149 patchProp, 6150 createText, 6151 nextSibling, 6152 parentNode, 6153 remove, 6154 insert, 6155 createComment 6156 } 6157 } = rendererInternals; 6158 const hydrate = (vnode, container) => { 6159 if (!container.hasChildNodes()) { 6160 warn$1( 6161 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 6162 ); 6163 patch(null, vnode, container); 6164 flushPostFlushCbs(); 6165 container._vnode = vnode; 6166 return; 6167 } 6168 hasMismatch = false;
vendor: 6,796 bytes, lines 6169-6371
6169 hydrateNode(container.firstChild, vnode, null, null, null); 6170 flushPostFlushCbs(); 6171 container._vnode = vnode; 6172 if (hasMismatch && true) { 6173 console.error(`Hydration completed but contains mismatches.`); 6174 } 6175 }; 6176 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 6177 const isFragmentStart = isComment(node) && node.data === "["; 6178 const onMismatch = () => handleMismatch( 6179 node, 6180 vnode, 6181 parentComponent, 6182 parentSuspense, 6183 slotScopeIds, 6184 isFragmentStart 6185 ); 6186 const { type, ref, shapeFlag, patchFlag } = vnode; 6187 let domType = node.nodeType; 6188 vnode.el = node; 6189 { 6190 if (!("__vnode" in node)) { 6191 Object.defineProperty(node, "__vnode", { 6192 value: vnode, 6193 enumerable: false 6194 }); 6195 } 6196 if (!("__vueParentComponent" in node)) { 6197 Object.defineProperty(node, "__vueParentComponent", { 6198 value: parentComponent, 6199 enumerable: false 6200 }); 6201 } 6202 } 6203 if (patchFlag === -2) { 6204 optimized = false; 6205 vnode.dynamicChildren = null; 6206 } 6207 let nextNode = null; 6208 switch (type) { 6209 case Text: 6210 if (domType !== 3 /* TEXT */) { 6211 if (vnode.children === "") { 6212 insert(vnode.el = createText(""), parentNode(node), node); 6213 nextNode = node; 6214 } else { 6215 nextNode = onMismatch(); 6216 } 6217 } else { 6218 if (node.data !== vnode.children) { 6219 hasMismatch = true; 6220 warn$1( 6221 `Hydration text mismatch in`, 6222 node.parentNode, 6223 ` 6224 - rendered on server: ${JSON.stringify( 6225 node.data 6226 )} 6227 - expected on client: ${JSON.stringify(vnode.children)}` 6228 ); 6229 node.data = vnode.children; 6230 } 6231 nextNode = nextSibling(node); 6232 } 6233 break; 6234 case Comment: 6235 if (isTemplateNode(node)) { 6236 nextNode = nextSibling(node); 6237 replaceNode( 6238 vnode.el = node.content.firstChild, 6239 node, 6240 parentComponent 6241 ); 6242 } else if (domType !== 8 /* COMMENT */ || isFragmentStart) { 6243 nextNode = onMismatch(); 6244 } else { 6245 nextNode = nextSibling(node); 6246 } 6247 break; 6248 case Static: 6249 if (isFragmentStart) { 6250 node = nextSibling(node); 6251 domType = node.nodeType; 6252 } 6253 if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) { 6254 nextNode = node; 6255 const needToAdoptContent = !vnode.children.length; 6256 for (let i = 0; i < vnode.staticCount; i++) { 6257 if (needToAdoptContent) 6258 vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data; 6259 if (i === vnode.staticCount - 1) { 6260 vnode.anchor = nextNode; 6261 } 6262 nextNode = nextSibling(nextNode); 6263 } 6264 return isFragmentStart ? nextSibling(nextNode) : nextNode; 6265 } else { 6266 onMismatch(); 6267 } 6268 break; 6269 case Fragment: 6270 if (!isFragmentStart) { 6271 nextNode = onMismatch(); 6272 } else { 6273 nextNode = hydrateFragment( 6274 node, 6275 vnode, 6276 parentComponent, 6277 parentSuspense, 6278 slotScopeIds, 6279 optimized 6280 ); 6281 } 6282 break; 6283 default: 6284 if (shapeFlag & 1) { 6285 if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 6286 nextNode = onMismatch(); 6287 } else { 6288 nextNode = hydrateElement( 6289 node, 6290 vnode, 6291 parentComponent, 6292 parentSuspense, 6293 slotScopeIds, 6294 optimized 6295 ); 6296 } 6297 } else if (shapeFlag & 6) { 6298 vnode.slotScopeIds = slotScopeIds; 6299 const container = parentNode(node); 6300 if (isFragmentStart) { 6301 nextNode = locateClosingAnchor(node); 6302 } else if (isComment(node) && node.data === "teleport start") { 6303 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 6304 } else { 6305 nextNode = nextSibling(node); 6306 } 6307 mountComponent( 6308 vnode, 6309 container, 6310 null, 6311 parentComponent, 6312 parentSuspense, 6313 getContainerType(container), 6314 optimized 6315 ); 6316 if (isAsyncWrapper(vnode)) { 6317 let subTree; 6318 if (isFragmentStart) { 6319 subTree = createVNode(Fragment); 6320 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 6321 } else { 6322 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 6323 } 6324 subTree.el = node; 6325 vnode.component.subTree = subTree; 6326 } 6327 } else if (shapeFlag & 64) { 6328 if (domType !== 8 /* COMMENT */) { 6329 nextNode = onMismatch(); 6330 } else { 6331 nextNode = vnode.type.hydrate( 6332 node, 6333 vnode, 6334 parentComponent, 6335 parentSuspense, 6336 slotScopeIds, 6337 optimized, 6338 rendererInternals, 6339 hydrateChildren 6340 ); 6341 } 6342 } else if (shapeFlag & 128) { 6343 nextNode = vnode.type.hydrate( 6344 node, 6345 vnode, 6346 parentComponent, 6347 parentSuspense, 6348 getContainerType(parentNode(node)), 6349 slotScopeIds, 6350 optimized, 6351 rendererInternals, 6352 hydrateNode 6353 ); 6354 } else { 6355 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 6356 } 6357 } 6358 if (ref != null) { 6359 setRef(ref, null, parentSuspense, vnode); 6360 } 6361 return nextNode; 6362 }; 6363 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 6364 optimized = optimized || !!vnode.dynamicChildren; 6365 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 6366 const forcePatch = type === "input" || type === "option"; 6367 { 6368 if (dirs) { 6369 invokeDirectiveHook(vnode, null, parentComponent, "created"); 6370 } 6371 let needCallTransitionHooks = false;
6372 if (isTemplateNode(el)) { 6373 needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 6374 const content = el.content.firstChild; 6375 if (needCallTransitionHooks) { 6376 transition.beforeEnter(content); 6377 } 6378 replaceNode(content, el, parentComponent); 6379 vnode.el = el = content; 6380 } 6381 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 6382 !(props && (props.innerHTML || props.textContent))) { 6383 let next = hydrateChildren( 6384 el.firstChild, 6385 vnode, 6386 el, 6387 parentComponent, 6388 parentSuspense, 6389 slotScopeIds, 6390 optimized 6391 ); 6392 let hasWarned = false; 6393 while (next) { 6394 hasMismatch = true; 6395 if (!hasWarned) { 6396 warn$1( 6397 `Hydration children mismatch on`, 6398 el, 6399 ` 6400Server rendered element contains more child nodes than client vdom.` 6401 ); 6402 hasWarned = true; 6403 } 6404 const cur = next; 6405 next = next.nextSibling; 6406 remove(cur); 6407 } 6408 } else if (shapeFlag & 8) { 6409 if (el.textContent !== vnode.children) { 6410 hasMismatch = true; 6411 warn$1( 6412 `Hydration text content mismatch on`, 6413 el, 6414 ` 6415 - rendered on server: ${el.textContent} 6416 - expected on client: ${vnode.children}` 6417 ); 6418 el.textContent = vnode.children; 6419 } 6420 } 6421 if (props) { 6422 { 6423 for (const key in props) { 6424 if (propHasMismatch(el, key, props[key], vnode, parentComponent)) { 6425 hasMismatch = true; 6426 } 6427 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 6428 key[0] === ".") { 6429 patchProp( 6430 el, 6431 key, 6432 null, 6433 props[key], 6434 void 0, 6435 void 0, 6436 parentComponent 6437 ); 6438 } 6439 } 6440 } 6441 } 6442 let vnodeHooks; 6443 if (vnodeHooks = props && props.onVnodeBeforeMount) { 6444 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 6445 } 6446 if (dirs) { 6447 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 6448 } 6449 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 6450 queueEffectWithSuspense(() => { 6451 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 6452 needCallTransitionHooks && transition.enter(el); 6453 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 6454 }, parentSuspense); 6455 } 6456 } 6457 return el.nextSibling; 6458 }; 6459 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 6460 optimized = optimized || !!parentVNode.dynamicChildren; 6461 const children = parentVNode.children; 6462 const l = children.length; 6463 let hasWarned = false; 6464 for (let i = 0; i < l; i++) { 6465 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 6466 if (node) { 6467 node = hydrateNode( 6468 node, 6469 vnode, 6470 parentComponent, 6471 parentSuspense, 6472 slotScopeIds, 6473 optimized 6474 ); 6475 } else if (vnode.type === Text && !vnode.children) { 6476 continue; 6477 } else { 6478 hasMismatch = true; 6479 if (!hasWarned) { 6480 warn$1( 6481 `Hydration children mismatch on`, 6482 container, 6483 ` 6484Server rendered element contains fewer child nodes than client vdom.` 6485 ); 6486 hasWarned = true; 6487 } 6488 patch( 6489 null, 6490 vnode, 6491 container, 6492 null, 6493 parentComponent, 6494 parentSuspense, 6495 getContainerType(container), 6496 slotScopeIds 6497 ); 6498 } 6499 } 6500 return node; 6501 }; 6502 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 6503 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 6504 if (fragmentSlotScopeIds) { 6505 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 6506 } 6507 const container = parentNode(node); 6508 const next = hydrateChildren( 6509 nextSibling(node), 6510 vnode, 6511 container, 6512 parentComponent, 6513 parentSuspense, 6514 slotScopeIds, 6515 optimized 6516 ); 6517 if (next && isComment(next) && next.data === "]") { 6518 return nextSibling(vnode.anchor = next); 6519 } else { 6520 hasMismatch = true; 6521 insert(vnode.anchor = createComment(`]`), container, next); 6522 return next; 6523 } 6524 }; 6525 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 6526 hasMismatch = true; 6527 warn$1( 6528 `Hydration node mismatch: 6529- rendered on server:`, 6530 node, 6531 node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 6532 ` 6533- expected on client:`, 6534 vnode.type 6535 ); 6536 vnode.el = null; 6537 if (isFragment) { 6538 const end = locateClosingAnchor(node); 6539 while (true) { 6540 const next2 = nextSibling(node); 6541 if (next2 && next2 !== end) { 6542 remove(next2); 6543 } else { 6544 break; 6545 } 6546 } 6547 } 6548 const next = nextSibling(node); 6549 const container = parentNode(node); 6550 remove(node); 6551 patch( 6552 null, 6553 vnode, 6554 container, 6555 next, 6556 parentComponent, 6557 parentSuspense, 6558 getContainerType(container), 6559 slotScopeIds 6560 ); 6561 return next; 6562 }; 6563 const locateClosingAnchor = (node, open = "[", close = "]") => { 6564 let match = 0; 6565 while (node) { 6566 node = nextSibling(node); 6567 if (node && isComment(node)) { 6568 if (node.data === open) 6569 match++; 6570 if (node.data === close) { 6571 if (match === 0) { 6572 return nextSibling(node); 6573 } else { 6574 match--; 6575 } 6576 } 6577 } 6578 } 6579 return node; 6580 }; 6581 const replaceNode = (newNode, oldNode, parentComponent) => { 6582 const parentNode2 = oldNode.parentNode; 6583 if (parentNode2) { 6584 parentNode2.replaceChild(newNode, oldNode); 6585 } 6586 let parent = parentComponent; 6587 while (parent) { 6588 if (parent.vnode.el === oldNode) { 6589 parent.vnode.el = parent.subTree.el = newNode; 6590 } 6591 parent = parent.parent; 6592 } 6593 }; 6594 const isTemplateNode = (node) => { 6595 return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template"; 6596 }; 6597 return [hydrate, hydrateNode]; 6598 } 6599 function propHasMismatch(el, key, clientValue, vnode, instance) { 6600 var _a; 6601 let mismatchType; 6602 let mismatchKey; 6603 let actual; 6604 let expected; 6605 if (key === "class") { 6606 actual = el.getAttribute("class"); 6607 expected = normalizeClass(clientValue); 6608 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 6609 mismatchType = mismatchKey = `class`; 6610 } 6611 } else if (key === "style") { 6612 actual = el.getAttribute("style"); 6613 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 6614 const actualMap = toStyleMap(actual); 6615 const expectedMap = toStyleMap(expected); 6616 if (vnode.dirs) { 6617 for (const { dir, value } of vnode.dirs) { 6618 if (dir.name === "show" && !value) { 6619 expectedMap.set("display", "none"); 6620 } 6621 } 6622 } 6623 const root = instance == null ? void 0 : instance.subTree; 6624 if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(v
vendor: 4,462 bytes, lines 6624-6771
6624node)) { 6625 const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance); 6626 for (const key2 in cssVars) { 6627 expectedMap.set(`--${key2}`, String(cssVars[key2])); 6628 } 6629 } 6630 if (!isMapEqual(actualMap, expectedMap)) { 6631 mismatchType = mismatchKey = "style"; 6632 } 6633 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 6634 if (isBooleanAttr(key)) { 6635 actual = el.hasAttribute(key); 6636 expected = includeBooleanAttr(clientValue); 6637 } else if (clientValue == null) { 6638 actual = el.hasAttribute(key); 6639 expected = false; 6640 } else { 6641 if (el.hasAttribute(key)) { 6642 actual = el.getAttribute(key); 6643 } else if (key === "value" && el.tagName === "TEXTAREA") { 6644 actual = el.value; 6645 } else { 6646 actual = false; 6647 } 6648 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 6649 } 6650 if (actual !== expected) { 6651 mismatchType = `attribute`; 6652 mismatchKey = key; 6653 } 6654 } 6655 if (mismatchType) { 6656 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 6657 const preSegment = `Hydration ${mismatchType} mismatch on`; 6658 const postSegment = ` 6659 - rendered on server: ${format(actual)} 6660 - expected on client: ${format(expected)} 6661 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 6662 You should fix the source of the mismatch.`; 6663 { 6664 warn$1(preSegment, el, postSegment); 6665 } 6666 return true; 6667 } 6668 return false; 6669 } 6670 function toClassSet(str) { 6671 return new Set(str.trim().split(/\s+/)); 6672 } 6673 function isSetEqual(a, b) { 6674 if (a.size !== b.size) { 6675 return false; 6676 } 6677 for (const s of a) { 6678 if (!b.has(s)) { 6679 return false; 6680 } 6681 } 6682 return true; 6683 } 6684 function toStyleMap(str) { 6685 const styleMap = /* @__PURE__ */ new Map(); 6686 for (const item of str.split(";")) { 6687 let [key, value] = item.split(":"); 6688 key = key == null ? void 0 : key.trim(); 6689 value = value == null ? void 0 : value.trim(); 6690 if (key && value) { 6691 styleMap.set(key, value); 6692 } 6693 } 6694 return styleMap; 6695 } 6696 function isMapEqual(a, b) { 6697 if (a.size !== b.size) { 6698 return false; 6699 } 6700 for (const [key, value] of a) { 6701 if (value !== b.get(key)) { 6702 return false; 6703 } 6704 } 6705 return true; 6706 } 6707 6708 let supported; 6709 let perf; 6710 function startMeasure(instance, type) { 6711 if (instance.appContext.config.performance && isSupported()) { 6712 perf.mark(`vue-${type}-${instance.uid}`); 6713 } 6714 { 6715 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 6716 } 6717 } 6718 function endMeasure(instance, type) { 6719 if (instance.appContext.config.performance && isSupported()) { 6720 const startTag = `vue-${type}-${instance.uid}`; 6721 const endTag = startTag + `:end`; 6722 perf.mark(endTag); 6723 perf.measure( 6724 `<${formatComponentName(instance, instance.type)}> ${type}`, 6725 startTag, 6726 endTag 6727 ); 6728 perf.clearMarks(startTag); 6729 perf.clearMarks(endTag); 6730 } 6731 { 6732 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 6733 } 6734 } 6735 function isSupported() { 6736 if (supported !== void 0) { 6737 return supported; 6738 } 6739 if (typeof window !== "undefined" && window.performance) { 6740 supported = true; 6741 perf = window.performance; 6742 } else { 6743 supported = false; 6744 } 6745 return supported; 6746 } 6747 6748 const queuePostRenderEffect = queueEffectWithSuspense ; 6749 function createRenderer(options) { 6750 return baseCreateRenderer(options); 6751 } 6752 function createHydrationRenderer(options) { 6753 return baseCreateRenderer(options, createHydrationFunctions); 6754 } 6755 function baseCreateRenderer(options, createHydrationFns) { 6756 const target = getGlobalThis(); 6757 target.__VUE__ = true; 6758 { 6759 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 6760 } 6761 const { 6762 insert: hostInsert, 6763 remove: hostRemove, 6764 patchProp: hostPatchProp, 6765 createElement: hostCreateElement, 6766 createText: hostCreateText, 6767 createComment: hostCreateComment, 6768 setText: hostSetText, 6769 setElementText: hostSetElementText, 6770 parentNode: hostParentNode, 6771 nextSibling: hostNextSibling,
vendor: 9,964 bytes, lines 6772-7108
6772 setScopeId: hostSetScopeId = NOOP, 6773 insertStaticContent: hostInsertStaticContent 6774 } = options; 6775 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 6776 if (n1 === n2) { 6777 return; 6778 } 6779 if (n1 && !isSameVNodeType(n1, n2)) { 6780 anchor = getNextHostNode(n1); 6781 unmount(n1, parentComponent, parentSuspense, true); 6782 n1 = null; 6783 } 6784 if (n2.patchFlag === -2) { 6785 optimized = false; 6786 n2.dynamicChildren = null; 6787 } 6788 const { type, ref, shapeFlag } = n2; 6789 switch (type) { 6790 case Text: 6791 processText(n1, n2, container, anchor); 6792 break; 6793 case Comment: 6794 processCommentNode(n1, n2, container, anchor); 6795 break; 6796 case Static: 6797 if (n1 == null) { 6798 mountStaticNode(n2, container, anchor, namespace); 6799 } else { 6800 patchStaticNode(n1, n2, container, namespace); 6801 } 6802 break; 6803 case Fragment: 6804 processFragment( 6805 n1, 6806 n2, 6807 container, 6808 anchor, 6809 parentComponent, 6810 parentSuspense, 6811 namespace, 6812 slotScopeIds, 6813 optimized 6814 ); 6815 break; 6816 default: 6817 if (shapeFlag & 1) { 6818 processElement( 6819 n1, 6820 n2, 6821 container, 6822 anchor, 6823 parentComponent, 6824 parentSuspense, 6825 namespace, 6826 slotScopeIds, 6827 optimized 6828 ); 6829 } else if (shapeFlag & 6) { 6830 processComponent( 6831 n1, 6832 n2, 6833 container, 6834 anchor, 6835 parentComponent, 6836 parentSuspense, 6837 namespace, 6838 slotScopeIds, 6839 optimized 6840 ); 6841 } else if (shapeFlag & 64) { 6842 type.process( 6843 n1, 6844 n2, 6845 container, 6846 anchor, 6847 parentComponent, 6848 parentSuspense, 6849 namespace, 6850 slotScopeIds, 6851 optimized, 6852 internals 6853 ); 6854 } else if (shapeFlag & 128) { 6855 type.process( 6856 n1, 6857 n2, 6858 container, 6859 anchor, 6860 parentComponent, 6861 parentSuspense, 6862 namespace, 6863 slotScopeIds, 6864 optimized, 6865 internals 6866 ); 6867 } else { 6868 warn$1("Invalid VNode type:", type, `(${typeof type})`); 6869 } 6870 } 6871 if (ref != null && parentComponent) { 6872 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 6873 } 6874 }; 6875 const processText = (n1, n2, container, anchor) => { 6876 if (n1 == null) { 6877 hostInsert( 6878 n2.el = hostCreateText(n2.children), 6879 container, 6880 anchor 6881 ); 6882 } else { 6883 const el = n2.el = n1.el; 6884 if (n2.children !== n1.children) { 6885 hostSetText(el, n2.children); 6886 } 6887 } 6888 }; 6889 const processCommentNode = (n1, n2, container, anchor) => { 6890 if (n1 == null) { 6891 hostInsert( 6892 n2.el = hostCreateComment(n2.children || ""), 6893 container, 6894 anchor 6895 ); 6896 } else { 6897 n2.el = n1.el; 6898 } 6899 }; 6900 const mountStaticNode = (n2, container, anchor, namespace) => { 6901 [n2.el, n2.anchor] = hostInsertStaticContent( 6902 n2.children, 6903 container, 6904 anchor, 6905 namespace, 6906 n2.el, 6907 n2.anchor 6908 ); 6909 }; 6910 const patchStaticNode = (n1, n2, container, namespace) => { 6911 if (n2.children !== n1.children) { 6912 const anchor = hostNextSibling(n1.anchor); 6913 removeStaticNode(n1); 6914 [n2.el, n2.anchor] = hostInsertStaticContent( 6915 n2.children, 6916 container, 6917 anchor, 6918 namespace 6919 ); 6920 } else { 6921 n2.el = n1.el; 6922 n2.anchor = n1.anchor; 6923 } 6924 }; 6925 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 6926 let next; 6927 while (el && el !== anchor) { 6928 next = hostNextSibling(el); 6929 hostInsert(el, container, nextSibling); 6930 el = next; 6931 } 6932 hostInsert(anchor, container, nextSibling); 6933 }; 6934 const removeStaticNode = ({ el, anchor }) => { 6935 let next; 6936 while (el && el !== anchor) { 6937 next = hostNextSibling(el); 6938 hostRemove(el); 6939 el = next; 6940 } 6941 hostRemove(anchor); 6942 }; 6943 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 6944 if (n2.type === "svg") { 6945 namespace = "svg"; 6946 } else if (n2.type === "math") { 6947 namespace = "mathml"; 6948 } 6949 if (n1 == null) { 6950 mountElement( 6951 n2, 6952 container, 6953 anchor, 6954 parentComponent, 6955 parentSuspense, 6956 namespace, 6957 slotScopeIds, 6958 optimized 6959 ); 6960 } else { 6961 patchElement( 6962 n1, 6963 n2, 6964 parentComponent, 6965 parentSuspense, 6966 namespace, 6967 slotScopeIds, 6968 optimized 6969 ); 6970 } 6971 }; 6972 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 6973 let el; 6974 let vnodeHook; 6975 const { props, shapeFlag, transition, dirs } = vnode; 6976 el = vnode.el = hostCreateElement( 6977 vnode.type, 6978 namespace, 6979 props && props.is, 6980 props 6981 ); 6982 if (shapeFlag & 8) { 6983 hostSetElementText(el, vnode.children); 6984 } else if (shapeFlag & 16) { 6985 mountChildren( 6986 vnode.children, 6987 el, 6988 null, 6989 parentComponent, 6990 parentSuspense, 6991 resolveChildrenNamespace(vnode, namespace), 6992 slotScopeIds, 6993 optimized 6994 ); 6995 } 6996 if (dirs) { 6997 invokeDirectiveHook(vnode, null, parentComponent, "created"); 6998 } 6999 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7000 if (props) { 7001 for (const key in props) { 7002 if (key !== "value" && !isReservedProp(key)) { 7003 hostPatchProp( 7004 el, 7005 key, 7006 null, 7007 props[key], 7008 namespace, 7009 vnode.children, 7010 parentComponent, 7011 parentSuspense, 7012 unmountChildren 7013 ); 7014 } 7015 } 7016 if ("value" in props) { 7017 hostPatchProp(el, "value", null, props.value, namespace); 7018 } 7019 if (vnodeHook = props.onVnodeBeforeMount) { 7020 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7021 } 7022 } 7023 { 7024 Object.defineProperty(el, "__vnode", { 7025 value: vnode, 7026 enumerable: false 7027 }); 7028 Object.defineProperty(el, "__vueParentComponent", { 7029 value: parentComponent, 7030 enumerable: false 7031 }); 7032 } 7033 if (dirs) { 7034 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7035 } 7036 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7037 if (needCallTransitionHooks) { 7038 transition.beforeEnter(el); 7039 } 7040 hostInsert(el, container, anchor); 7041 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7042 queuePostRenderEffect(() => { 7043 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7044 needCallTransitionHooks && transition.enter(el); 7045 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7046 }, parentSuspense); 7047 } 7048 }; 7049 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7050 if (scopeId) { 7051 hostSetScopeId(el, scopeId); 7052 } 7053 if (slotScopeIds) { 7054 for (let i = 0; i < slotScopeIds.length; i++) { 7055 hostSetScopeId(el, slotScopeIds[i]); 7056 } 7057 } 7058 if (parentComponent) { 7059 let subTree = parentComponent.subTree; 7060 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7061 subTree = filterSingleRoot(subTree.children) || subTree; 7062 } 7063 if (vnode === subTree) { 7064 const parentVNode = parentComponent.vnode; 7065 setScopeId( 7066 el, 7067 parentVNode, 7068 parentVNode.scopeId, 7069 parentVNode.slotScopeIds, 7070 parentComponent.parent 7071 ); 7072 } 7073 } 7074 }; 7075 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7076 for (let i = start; i < children.length; i++) { 7077 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7078 patch( 7079 null, 7080 child, 7081 container, 7082 anchor, 7083 parentComponent, 7084 parentSuspense, 7085 namespace, 7086 slotScopeIds, 7087 optimized 7088 ); 7089 } 7090 }; 7091 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7092 const el = n2.el = n1.el; 7093 let { patchFlag, dynamicChildren, dirs } = n2; 7094 patchFlag |= n1.patchFlag & 16; 7095 const oldProps = n1.props || EMPTY_OBJ; 7096 const newProps = n2.props || EMPTY_OBJ; 7097 let vnodeHook; 7098 parentComponent && toggleRecurse(parentComponent, false); 7099 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7100 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7101 } 7102 if (dirs) { 7103 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7104 } 7105 parentComponent && toggleRecurse(parentComponent, true); 7106 if (isHmrUpdating) { 7107 patchFlag = 0; 7108 optimized = false;
vendor: 5,771 bytes, lines 7109-7285
7109 dynamicChildren = null; 7110 } 7111 if (dynamicChildren) { 7112 patchBlockChildren( 7113 n1.dynamicChildren, 7114 dynamicChildren, 7115 el, 7116 parentComponent, 7117 parentSuspense, 7118 resolveChildrenNamespace(n2, namespace), 7119 slotScopeIds 7120 ); 7121 { 7122 traverseStaticChildren(n1, n2); 7123 } 7124 } else if (!optimized) { 7125 patchChildren( 7126 n1, 7127 n2, 7128 el, 7129 null, 7130 parentComponent, 7131 parentSuspense, 7132 resolveChildrenNamespace(n2, namespace), 7133 slotScopeIds, 7134 false 7135 ); 7136 } 7137 if (patchFlag > 0) { 7138 if (patchFlag & 16) { 7139 patchProps( 7140 el, 7141 n2, 7142 oldProps, 7143 newProps, 7144 parentComponent, 7145 parentSuspense, 7146 namespace 7147 ); 7148 } else { 7149 if (patchFlag & 2) { 7150 if (oldProps.class !== newProps.class) { 7151 hostPatchProp(el, "class", null, newProps.class, namespace); 7152 } 7153 } 7154 if (patchFlag & 4) { 7155 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7156 } 7157 if (patchFlag & 8) { 7158 const propsToUpdate = n2.dynamicProps; 7159 for (let i = 0; i < propsToUpdate.length; i++) { 7160 const key = propsToUpdate[i]; 7161 const prev = oldProps[key]; 7162 const next = newProps[key]; 7163 if (next !== prev || key === "value") { 7164 hostPatchProp( 7165 el, 7166 key, 7167 prev, 7168 next, 7169 namespace, 7170 n1.children, 7171 parentComponent, 7172 parentSuspense, 7173 unmountChildren 7174 ); 7175 } 7176 } 7177 } 7178 } 7179 if (patchFlag & 1) { 7180 if (n1.children !== n2.children) { 7181 hostSetElementText(el, n2.children); 7182 } 7183 } 7184 } else if (!optimized && dynamicChildren == null) { 7185 patchProps( 7186 el, 7187 n2, 7188 oldProps, 7189 newProps, 7190 parentComponent, 7191 parentSuspense, 7192 namespace 7193 ); 7194 } 7195 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7196 queuePostRenderEffect(() => { 7197 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7198 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7199 }, parentSuspense); 7200 } 7201 }; 7202 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7203 for (let i = 0; i < newChildren.length; i++) { 7204 const oldVNode = oldChildren[i]; 7205 const newVNode = newChildren[i]; 7206 const container = ( 7207 // oldVNode may be an errored async setup() component inside Suspense 7208 // which will not have a mounted element 7209 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7210 // of the Fragment itself so it can move its children. 7211 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7212 // which also requires the correct parent container 7213 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7214 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( 7215 // In other cases, the parent container is not actually used so we 7216 // just pass the block element here to avoid a DOM parentNode call. 7217 fallbackContainer 7218 ) 7219 ); 7220 patch( 7221 oldVNode, 7222 newVNode, 7223 container, 7224 null, 7225 parentComponent, 7226 parentSuspense, 7227 namespace, 7228 slotScopeIds, 7229 true 7230 ); 7231 } 7232 }; 7233 const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => { 7234 if (oldProps !== newProps) { 7235 if (oldProps !== EMPTY_OBJ) { 7236 for (const key in oldProps) { 7237 if (!isReservedProp(key) && !(key in newProps)) { 7238 hostPatchProp( 7239 el, 7240 key, 7241 oldProps[key], 7242 null, 7243 namespace, 7244 vnode.children, 7245 parentComponent, 7246 parentSuspense, 7247 unmountChildren 7248 ); 7249 } 7250 } 7251 } 7252 for (const key in newProps) { 7253 if (isReservedProp(key)) 7254 continue; 7255 const next = newProps[key]; 7256 const prev = oldProps[key]; 7257 if (next !== prev && key !== "value") { 7258 hostPatchProp( 7259 el, 7260 key, 7261 prev, 7262 next, 7263 namespace, 7264 vnode.children, 7265 parentComponent, 7266 parentSuspense, 7267 unmountChildren 7268 ); 7269 } 7270 } 7271 if ("value" in newProps) { 7272 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 7273 } 7274 } 7275 }; 7276 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7277 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 7278 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 7279 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 7280 if ( 7281 // #5523 dev root fragment may inherit directives 7282 isHmrUpdating || patchFlag & 2048 7283 ) { 7284 patchFlag = 0; 7285 optimized = false;
vendor: 16,299 bytes, lines 7286-7835
7286 dynamicChildren = null; 7287 } 7288 if (fragmentSlotScopeIds) { 7289 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 7290 } 7291 if (n1 == null) { 7292 hostInsert(fragmentStartAnchor, container, anchor); 7293 hostInsert(fragmentEndAnchor, container, anchor); 7294 mountChildren( 7295 // #10007 7296 // such fragment like `<></>` will be compiled into 7297 // a fragment which doesn't have a children. 7298 // In this case fallback to an empty array 7299 n2.children || [], 7300 container, 7301 fragmentEndAnchor, 7302 parentComponent, 7303 parentSuspense, 7304 namespace, 7305 slotScopeIds, 7306 optimized 7307 ); 7308 } else { 7309 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 7310 // of renderSlot() with no valid children 7311 n1.dynamicChildren) { 7312 patchBlockChildren( 7313 n1.dynamicChildren, 7314 dynamicChildren, 7315 container, 7316 parentComponent, 7317 parentSuspense, 7318 namespace, 7319 slotScopeIds 7320 ); 7321 { 7322 traverseStaticChildren(n1, n2); 7323 } 7324 } else { 7325 patchChildren( 7326 n1, 7327 n2, 7328 container, 7329 fragmentEndAnchor, 7330 parentComponent, 7331 parentSuspense, 7332 namespace, 7333 slotScopeIds, 7334 optimized 7335 ); 7336 } 7337 } 7338 }; 7339 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7340 n2.slotScopeIds = slotScopeIds; 7341 if (n1 == null) { 7342 if (n2.shapeFlag & 512) { 7343 parentComponent.ctx.activate( 7344 n2, 7345 container, 7346 anchor, 7347 namespace, 7348 optimized 7349 ); 7350 } else { 7351 mountComponent( 7352 n2, 7353 container, 7354 anchor, 7355 parentComponent, 7356 parentSuspense, 7357 namespace, 7358 optimized 7359 ); 7360 } 7361 } else { 7362 updateComponent(n1, n2, optimized); 7363 } 7364 }; 7365 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 7366 const instance = (initialVNode.component = createComponentInstance( 7367 initialVNode, 7368 parentComponent, 7369 parentSuspense 7370 )); 7371 if (instance.type.__hmrId) { 7372 registerHMR(instance); 7373 } 7374 { 7375 pushWarningContext(initialVNode); 7376 startMeasure(instance, `mount`); 7377 } 7378 if (isKeepAlive(initialVNode)) { 7379 instance.ctx.renderer = internals; 7380 } 7381 { 7382 { 7383 startMeasure(instance, `init`); 7384 } 7385 setupComponent(instance); 7386 { 7387 endMeasure(instance, `init`); 7388 } 7389 } 7390 if (instance.asyncDep) { 7391 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect); 7392 if (!initialVNode.el) { 7393 const placeholder = instance.subTree = createVNode(Comment); 7394 processCommentNode(null, placeholder, container, anchor); 7395 } 7396 } else { 7397 setupRenderEffect( 7398 instance, 7399 initialVNode, 7400 container, 7401 anchor, 7402 parentSuspense, 7403 namespace, 7404 optimized 7405 ); 7406 } 7407 { 7408 popWarningContext(); 7409 endMeasure(instance, `mount`); 7410 } 7411 }; 7412 const updateComponent = (n1, n2, optimized) => { 7413 const instance = n2.component = n1.component; 7414 if (shouldUpdateComponent(n1, n2, optimized)) { 7415 if (instance.asyncDep && !instance.asyncResolved) { 7416 { 7417 pushWarningContext(n2); 7418 } 7419 updateComponentPreRender(instance, n2, optimized); 7420 { 7421 popWarningContext(); 7422 } 7423 return; 7424 } else { 7425 instance.next = n2; 7426 invalidateJob(instance.update); 7427 instance.effect.dirty = true; 7428 instance.update(); 7429 } 7430 } else { 7431 n2.el = n1.el; 7432 instance.vnode = n2; 7433 } 7434 }; 7435 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 7436 const componentUpdateFn = () => { 7437 if (!instance.isMounted) { 7438 let vnodeHook; 7439 const { el, props } = initialVNode; 7440 const { bm, m, parent } = instance; 7441 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 7442 toggleRecurse(instance, false); 7443 if (bm) { 7444 invokeArrayFns(bm); 7445 } 7446 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 7447 invokeVNodeHook(vnodeHook, parent, initialVNode); 7448 } 7449 toggleRecurse(instance, true); 7450 if (el && hydrateNode) { 7451 const hydrateSubTree = () => { 7452 { 7453 startMeasure(instance, `render`); 7454 } 7455 instance.subTree = renderComponentRoot(instance); 7456 { 7457 endMeasure(instance, `render`); 7458 } 7459 { 7460 startMeasure(instance, `hydrate`); 7461 } 7462 hydrateNode( 7463 el, 7464 instance.subTree, 7465 instance, 7466 parentSuspense, 7467 null 7468 ); 7469 { 7470 endMeasure(instance, `hydrate`); 7471 } 7472 }; 7473 if (isAsyncWrapperVNode) { 7474 initialVNode.type.__asyncLoader().then( 7475 // note: we are moving the render call into an async callback, 7476 // which means it won't track dependencies - but it's ok because 7477 // a server-rendered async wrapper is already in resolved state 7478 // and it will never need to change. 7479 () => !instance.isUnmounted && hydrateSubTree() 7480 ); 7481 } else { 7482 hydrateSubTree(); 7483 } 7484 } else { 7485 { 7486 startMeasure(instance, `render`); 7487 } 7488 const subTree = instance.subTree = renderComponentRoot(instance); 7489 { 7490 endMeasure(instance, `render`); 7491 } 7492 { 7493 startMeasure(instance, `patch`); 7494 } 7495 patch( 7496 null, 7497 subTree, 7498 container, 7499 anchor, 7500 instance, 7501 parentSuspense, 7502 namespace 7503 ); 7504 { 7505 endMeasure(instance, `patch`); 7506 } 7507 initialVNode.el = subTree.el; 7508 } 7509 if (m) { 7510 queuePostRenderEffect(m, parentSuspense); 7511 } 7512 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 7513 const scopedInitialVNode = initialVNode; 7514 queuePostRenderEffect( 7515 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 7516 parentSuspense 7517 ); 7518 } 7519 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 7520 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 7521 } 7522 instance.isMounted = true; 7523 { 7524 devtoolsComponentAdded(instance); 7525 } 7526 initialVNode = container = anchor = null; 7527 } else { 7528 let { next, bu, u, parent, vnode } = instance; 7529 { 7530 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 7531 if (nonHydratedAsyncRoot) { 7532 if (next) { 7533 next.el = vnode.el; 7534 updateComponentPreRender(instance, next, optimized); 7535 } 7536 nonHydratedAsyncRoot.asyncDep.then(() => { 7537 if (!instance.isUnmounted) { 7538 componentUpdateFn(); 7539 } 7540 }); 7541 return; 7542 } 7543 } 7544 let originNext = next; 7545 let vnodeHook; 7546 { 7547 pushWarningContext(next || instance.vnode); 7548 } 7549 toggleRecurse(instance, false); 7550 if (next) { 7551 next.el = vnode.el; 7552 updateComponentPreRender(instance, next, optimized); 7553 } else { 7554 next = vnode; 7555 } 7556 if (bu) { 7557 invokeArrayFns(bu); 7558 } 7559 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 7560 invokeVNodeHook(vnodeHook, parent, next, vnode); 7561 } 7562 toggleRecurse(instance, true); 7563 { 7564 startMeasure(instance, `render`); 7565 } 7566 const nextTree = renderComponentRoot(instance); 7567 { 7568 endMeasure(instance, `render`); 7569 } 7570 const prevTree = instance.subTree; 7571 instance.subTree = nextTree; 7572 { 7573 startMeasure(instance, `patch`); 7574 } 7575 patch( 7576 prevTree, 7577 nextTree, 7578 // parent may have changed if it's in a teleport 7579 hostParentNode(prevTree.el), 7580 // anchor may have changed if it's in a fragment 7581 getNextHostNode(prevTree), 7582 instance, 7583 parentSuspense, 7584 namespace 7585 ); 7586 { 7587 endMeasure(instance, `patch`); 7588 } 7589 next.el = nextTree.el; 7590 if (originNext === null) { 7591 updateHOCHostEl(instance, nextTree.el); 7592 } 7593 if (u) { 7594 queuePostRenderEffect(u, parentSuspense); 7595 } 7596 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 7597 queuePostRenderEffect( 7598 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 7599 parentSuspense 7600 ); 7601 } 7602 { 7603 devtoolsComponentUpdated(instance); 7604 } 7605 { 7606 popWarningContext(); 7607 } 7608 } 7609 }; 7610 const effect = instance.effect = new ReactiveEffect( 7611 componentUpdateFn, 7612 NOOP, 7613 () => queueJob(update), 7614 instance.scope 7615 // track it in component's effect scope 7616 ); 7617 const update = instance.update = () => { 7618 if (effect.dirty) { 7619 effect.run(); 7620 } 7621 }; 7622 update.id = instance.uid; 7623 toggleRecurse(instance, true); 7624 { 7625 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 7626 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 7627 update.ownerInstance = instance; 7628 } 7629 update(); 7630 }; 7631 const updateComponentPreRender = (instance, nextVNode, optimized) => { 7632 nextVNode.component = instance; 7633 const prevProps = instance.vnode.props; 7634 instance.vnode = nextVNode; 7635 instance.next = null; 7636 updateProps(instance, nextVNode.props, prevProps, optimized); 7637 updateSlots(instance, nextVNode.children, optimized); 7638 pauseTracking(); 7639 flushPreFlushCbs(instance); 7640 resetTracking(); 7641 }; 7642 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 7643 const c1 = n1 && n1.children; 7644 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 7645 const c2 = n2.children; 7646 const { patchFlag, shapeFlag } = n2; 7647 if (patchFlag > 0) { 7648 if (patchFlag & 128) { 7649 patchKeyedChildren( 7650 c1, 7651 c2, 7652 container, 7653 anchor, 7654 parentComponent, 7655 parentSuspense, 7656 namespace, 7657 slotScopeIds, 7658 optimized 7659 ); 7660 return; 7661 } else if (patchFlag & 256) { 7662 patchUnkeyedChildren( 7663 c1, 7664 c2, 7665 container, 7666 anchor, 7667 parentComponent, 7668 parentSuspense, 7669 namespace, 7670 slotScopeIds, 7671 optimized 7672 ); 7673 return; 7674 } 7675 } 7676 if (shapeFlag & 8) { 7677 if (prevShapeFlag & 16) { 7678 unmountChildren(c1, parentComponent, parentSuspense); 7679 } 7680 if (c2 !== c1) { 7681 hostSetElementText(container, c2); 7682 } 7683 } else { 7684 if (prevShapeFlag & 16) { 7685 if (shapeFlag & 16) { 7686 patchKeyedChildren( 7687 c1, 7688 c2, 7689 container, 7690 anchor, 7691 parentComponent, 7692 parentSuspense, 7693 namespace, 7694 slotScopeIds, 7695 optimized 7696 ); 7697 } else { 7698 unmountChildren(c1, parentComponent, parentSuspense, true); 7699 } 7700 } else { 7701 if (prevShapeFlag & 8) { 7702 hostSetElementText(container, ""); 7703 } 7704 if (shapeFlag & 16) { 7705 mountChildren( 7706 c2, 7707 container, 7708 anchor, 7709 parentComponent, 7710 parentSuspense, 7711 namespace, 7712 slotScopeIds, 7713 optimized 7714 ); 7715 } 7716 } 7717 } 7718 }; 7719 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7720 c1 = c1 || EMPTY_ARR; 7721 c2 = c2 || EMPTY_ARR; 7722 const oldLength = c1.length; 7723 const newLength = c2.length; 7724 const commonLength = Math.min(oldLength, newLength); 7725 let i; 7726 for (i = 0; i < commonLength; i++) { 7727 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7728 patch( 7729 c1[i], 7730 nextChild, 7731 container, 7732 null, 7733 parentComponent, 7734 parentSuspense, 7735 namespace, 7736 slotScopeIds, 7737 optimized 7738 ); 7739 } 7740 if (oldLength > newLength) { 7741 unmountChildren( 7742 c1, 7743 parentComponent, 7744 parentSuspense, 7745 true, 7746 false, 7747 commonLength 7748 ); 7749 } else { 7750 mountChildren( 7751 c2, 7752 container, 7753 anchor, 7754 parentComponent, 7755 parentSuspense, 7756 namespace, 7757 slotScopeIds, 7758 optimized, 7759 commonLength 7760 ); 7761 } 7762 }; 7763 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7764 let i = 0; 7765 const l2 = c2.length; 7766 let e1 = c1.length - 1; 7767 let e2 = l2 - 1; 7768 while (i <= e1 && i <= e2) { 7769 const n1 = c1[i]; 7770 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7771 if (isSameVNodeType(n1, n2)) { 7772 patch( 7773 n1, 7774 n2, 7775 container, 7776 null, 7777 parentComponent, 7778 parentSuspense, 7779 namespace, 7780 slotScopeIds, 7781 optimized 7782 ); 7783 } else { 7784 break; 7785 } 7786 i++; 7787 } 7788 while (i <= e1 && i <= e2) { 7789 const n1 = c1[e1]; 7790 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 7791 if (isSameVNodeType(n1, n2)) { 7792 patch( 7793 n1, 7794 n2, 7795 container, 7796 null, 7797 parentComponent, 7798 parentSuspense, 7799 namespace, 7800 slotScopeIds, 7801 optimized 7802 ); 7803 } else { 7804 break; 7805 } 7806 e1--; 7807 e2--; 7808 } 7809 if (i > e1) { 7810 if (i <= e2) { 7811 const nextPos = e2 + 1; 7812 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 7813 while (i <= e2) { 7814 patch( 7815 null, 7816 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 7817 container, 7818 anchor, 7819 parentComponent, 7820 parentSuspense, 7821 namespace, 7822 slotScopeIds, 7823 optimized 7824 ); 7825 i++; 7826 } 7827 } 7828 } else if (i > e2) { 7829 while (i <= e1) { 7830 unmount(c1[i], parentComponent, parentSuspense, true); 7831 i++; 7832 } 7833 } else { 7834 const s1 = i; 7835 const s2 = i;
vendor: 13,832 bytes, lines 7836-8272
7836 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 7837 for (i = s2; i <= e2; i++) { 7838 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7839 if (nextChild.key != null) { 7840 if (keyToNewIndexMap.has(nextChild.key)) { 7841 warn$1( 7842 `Duplicate keys found during update:`, 7843 JSON.stringify(nextChild.key), 7844 `Make sure keys are unique.` 7845 ); 7846 } 7847 keyToNewIndexMap.set(nextChild.key, i); 7848 } 7849 } 7850 let j; 7851 let patched = 0; 7852 const toBePatched = e2 - s2 + 1; 7853 let moved = false; 7854 let maxNewIndexSoFar = 0; 7855 const newIndexToOldIndexMap = new Array(toBePatched); 7856 for (i = 0; i < toBePatched; i++) 7857 newIndexToOldIndexMap[i] = 0; 7858 for (i = s1; i <= e1; i++) { 7859 const prevChild = c1[i]; 7860 if (patched >= toBePatched) { 7861 unmount(prevChild, parentComponent, parentSuspense, true); 7862 continue; 7863 } 7864 let newIndex; 7865 if (prevChild.key != null) { 7866 newIndex = keyToNewIndexMap.get(prevChild.key); 7867 } else { 7868 for (j = s2; j <= e2; j++) { 7869 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 7870 newIndex = j; 7871 break; 7872 } 7873 } 7874 } 7875 if (newIndex === void 0) { 7876 unmount(prevChild, parentComponent, parentSuspense, true); 7877 } else { 7878 newIndexToOldIndexMap[newIndex - s2] = i + 1; 7879 if (newIndex >= maxNewIndexSoFar) { 7880 maxNewIndexSoFar = newIndex; 7881 } else { 7882 moved = true; 7883 } 7884 patch( 7885 prevChild, 7886 c2[newIndex], 7887 container, 7888 null, 7889 parentComponent, 7890 parentSuspense, 7891 namespace, 7892 slotScopeIds, 7893 optimized 7894 ); 7895 patched++; 7896 } 7897 } 7898 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 7899 j = increasingNewIndexSequence.length - 1; 7900 for (i = toBePatched - 1; i >= 0; i--) { 7901 const nextIndex = s2 + i; 7902 const nextChild = c2[nextIndex]; 7903 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor; 7904 if (newIndexToOldIndexMap[i] === 0) { 7905 patch( 7906 null, 7907 nextChild, 7908 container, 7909 anchor, 7910 parentComponent, 7911 parentSuspense, 7912 namespace, 7913 slotScopeIds, 7914 optimized 7915 ); 7916 } else if (moved) { 7917 if (j < 0 || i !== increasingNewIndexSequence[j]) { 7918 move(nextChild, container, anchor, 2); 7919 } else { 7920 j--; 7921 } 7922 } 7923 } 7924 } 7925 }; 7926 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 7927 const { el, type, transition, children, shapeFlag } = vnode; 7928 if (shapeFlag & 6) { 7929 move(vnode.component.subTree, container, anchor, moveType); 7930 return; 7931 } 7932 if (shapeFlag & 128) { 7933 vnode.suspense.move(container, anchor, moveType); 7934 return; 7935 } 7936 if (shapeFlag & 64) { 7937 type.move(vnode, container, anchor, internals); 7938 return; 7939 } 7940 if (type === Fragment) { 7941 hostInsert(el, container, anchor); 7942 for (let i = 0; i < children.length; i++) { 7943 move(children[i], container, anchor, moveType); 7944 } 7945 hostInsert(vnode.anchor, container, anchor); 7946 return; 7947 } 7948 if (type === Static) { 7949 moveStaticNode(vnode, container, anchor); 7950 return; 7951 } 7952 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 7953 if (needTransition2) { 7954 if (moveType === 0) { 7955 transition.beforeEnter(el); 7956 hostInsert(el, container, anchor); 7957 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 7958 } else { 7959 const { leave, delayLeave, afterLeave } = transition; 7960 const remove2 = () => hostInsert(el, container, anchor); 7961 const performLeave = () => { 7962 leave(el, () => { 7963 remove2(); 7964 afterLeave && afterLeave(); 7965 }); 7966 }; 7967 if (delayLeave) { 7968 delayLeave(el, remove2, performLeave); 7969 } else { 7970 performLeave(); 7971 } 7972 } 7973 } else { 7974 hostInsert(el, container, anchor); 7975 } 7976 }; 7977 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 7978 const { 7979 type, 7980 props, 7981 ref, 7982 children, 7983 dynamicChildren, 7984 shapeFlag, 7985 patchFlag, 7986 dirs 7987 } = vnode; 7988 if (ref != null) { 7989 setRef(ref, null, parentSuspense, vnode, true); 7990 } 7991 if (shapeFlag & 256) { 7992 parentComponent.ctx.deactivate(vnode); 7993 return; 7994 } 7995 const shouldInvokeDirs = shapeFlag & 1 && dirs; 7996 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 7997 let vnodeHook; 7998 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 7999 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8000 } 8001 if (shapeFlag & 6) { 8002 unmountComponent(vnode.component, parentSuspense, doRemove); 8003 } else { 8004 if (shapeFlag & 128) { 8005 vnode.suspense.unmount(parentSuspense, doRemove); 8006 return; 8007 } 8008 if (shouldInvokeDirs) { 8009 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8010 } 8011 if (shapeFlag & 64) { 8012 vnode.type.remove( 8013 vnode, 8014 parentComponent, 8015 parentSuspense, 8016 optimized, 8017 internals, 8018 doRemove 8019 ); 8020 } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments 8021 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8022 unmountChildren( 8023 dynamicChildren, 8024 parentComponent, 8025 parentSuspense, 8026 false, 8027 true 8028 ); 8029 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8030 unmountChildren(children, parentComponent, parentSuspense); 8031 } 8032 if (doRemove) { 8033 remove(vnode); 8034 } 8035 } 8036 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8037 queuePostRenderEffect(() => { 8038 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8039 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8040 }, parentSuspense); 8041 } 8042 }; 8043 const remove = (vnode) => { 8044 const { type, el, anchor, transition } = vnode; 8045 if (type === Fragment) { 8046 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) { 8047 vnode.children.forEach((child) => { 8048 if (child.type === Comment) { 8049 hostRemove(child.el); 8050 } else { 8051 remove(child); 8052 } 8053 }); 8054 } else { 8055 removeFragment(el, anchor); 8056 } 8057 return; 8058 } 8059 if (type === Static) { 8060 removeStaticNode(vnode); 8061 return; 8062 } 8063 const performRemove = () => { 8064 hostRemove(el); 8065 if (transition && !transition.persisted && transition.afterLeave) { 8066 transition.afterLeave(); 8067 } 8068 }; 8069 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8070 const { leave, delayLeave } = transition; 8071 const performLeave = () => leave(el, performRemove); 8072 if (delayLeave) { 8073 delayLeave(vnode.el, performRemove, performLeave); 8074 } else { 8075 performLeave(); 8076 } 8077 } else { 8078 performRemove(); 8079 } 8080 }; 8081 const removeFragment = (cur, end) => { 8082 let next; 8083 while (cur !== end) { 8084 next = hostNextSibling(cur); 8085 hostRemove(cur); 8086 cur = next; 8087 } 8088 hostRemove(end); 8089 }; 8090 const unmountComponent = (instance, parentSuspense, doRemove) => { 8091 if (instance.type.__hmrId) { 8092 unregisterHMR(instance); 8093 } 8094 const { bum, scope, update, subTree, um } = instance; 8095 if (bum) { 8096 invokeArrayFns(bum); 8097 } 8098 scope.stop(); 8099 if (update) { 8100 update.active = false; 8101 unmount(subTree, instance, parentSuspense, doRemove); 8102 } 8103 if (um) { 8104 queuePostRenderEffect(um, parentSuspense); 8105 } 8106 queuePostRenderEffect(() => { 8107 instance.isUnmounted = true; 8108 }, parentSuspense); 8109 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) { 8110 parentSuspense.deps--; 8111 if (parentSuspense.deps === 0) { 8112 parentSuspense.resolve(); 8113 } 8114 } 8115 { 8116 devtoolsComponentRemoved(instance); 8117 } 8118 }; 8119 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8120 for (let i = start; i < children.length; i++) { 8121 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8122 } 8123 }; 8124 const getNextHostNode = (vnode) => { 8125 if (vnode.shapeFlag & 6) { 8126 return getNextHostNode(vnode.component.subTree); 8127 } 8128 if (vnode.shapeFlag & 128) { 8129 return vnode.suspense.next(); 8130 } 8131 return hostNextSibling(vnode.anchor || vnode.el); 8132 }; 8133 let isFlushing = false; 8134 const render = (vnode, container, namespace) => { 8135 if (vnode == null) { 8136 if (container._vnode) { 8137 unmount(container._vnode, null, null, true); 8138 } 8139 } else { 8140 patch( 8141 container._vnode || null, 8142 vnode, 8143 container, 8144 null, 8145 null, 8146 null, 8147 namespace 8148 ); 8149 } 8150 if (!isFlushing) { 8151 isFlushing = true; 8152 flushPreFlushCbs(); 8153 flushPostFlushCbs(); 8154 isFlushing = false; 8155 } 8156 container._vnode = vnode; 8157 }; 8158 const internals = { 8159 p: patch, 8160 um: unmount, 8161 m: move, 8162 r: remove, 8163 mt: mountComponent, 8164 mc: mountChildren, 8165 pc: patchChildren, 8166 pbc: patchBlockChildren, 8167 n: getNextHostNode, 8168 o: options 8169 }; 8170 let hydrate; 8171 let hydrateNode; 8172 if (createHydrationFns) { 8173 [hydrate, hydrateNode] = createHydrationFns( 8174 internals 8175 ); 8176 } 8177 return { 8178 render, 8179 hydrate, 8180 createApp: createAppAPI(render, hydrate) 8181 }; 8182 } 8183 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8184 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8185 } 8186 function toggleRecurse({ effect, update }, allowed) { 8187 effect.allowRecurse = update.allowRecurse = allowed; 8188 } 8189 function needTransition(parentSuspense, transition) { 8190 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8191 } 8192 function traverseStaticChildren(n1, n2, shallow = false) { 8193 const ch1 = n1.children; 8194 const ch2 = n2.children; 8195 if (isArray(ch1) && isArray(ch2)) { 8196 for (let i = 0; i < ch1.length; i++) { 8197 const c1 = ch1[i]; 8198 let c2 = ch2[i]; 8199 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8200 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8201 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8202 c2.el = c1.el; 8203 } 8204 if (!shallow) 8205 traverseStaticChildren(c1, c2); 8206 } 8207 if (c2.type === Text) { 8208 c2.el = c1.el; 8209 } 8210 if (c2.type === Comment && !c2.el) { 8211 c2.el = c1.el; 8212 } 8213 } 8214 } 8215 } 8216 function getSequence(arr) { 8217 const p = arr.slice(); 8218 const result = [0]; 8219 let i, j, u, v, c; 8220 const len = arr.length; 8221 for (i = 0; i < len; i++) { 8222 const arrI = arr[i]; 8223 if (arrI !== 0) { 8224 j = result[result.length - 1]; 8225 if (arr[j] < arrI) { 8226 p[i] = j; 8227 result.push(i); 8228 continue; 8229 } 8230 u = 0; 8231 v = result.length - 1; 8232 while (u < v) { 8233 c = u + v >> 1; 8234 if (arr[result[c]] < arrI) { 8235 u = c + 1; 8236 } else { 8237 v = c; 8238 } 8239 } 8240 if (arrI < arr[result[u]]) { 8241 if (u > 0) { 8242 p[i] = result[u - 1]; 8243 } 8244 result[u] = i; 8245 } 8246 } 8247 } 8248 u = result.length; 8249 v = result[u - 1]; 8250 while (u-- > 0) { 8251 result[u] = v; 8252 v = p[v]; 8253 } 8254 return result; 8255 } 8256 function locateNonHydratedAsyncRoot(instance) { 8257 const subComponent = instance.subTree.component; 8258 if (subComponent) { 8259 if (subComponent.asyncDep && !subComponent.asyncResolved) { 8260 return subComponent; 8261 } else { 8262 return locateNonHydratedAsyncRoot(subComponent); 8263 } 8264 } 8265 } 8266 8267 const isTeleport = (type) => type.__isTeleport; 8268 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 8269 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 8270 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 8271 const resolveTarget = (props, select) => { 8272 const targetSelector = props && props.to;
vendor: 16,258 bytes, lines 8273-8772
8273 if (isString(targetSelector)) { 8274 if (!select) { 8275 warn$1( 8276 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 8277 ); 8278 return null; 8279 } else { 8280 const target = select(targetSelector); 8281 if (!target) { 8282 warn$1( 8283 `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.` 8284 ); 8285 } 8286 return target; 8287 } 8288 } else { 8289 if (!targetSelector && !isTeleportDisabled(props)) { 8290 warn$1(`Invalid Teleport target: ${targetSelector}`); 8291 } 8292 return targetSelector; 8293 } 8294 }; 8295 const TeleportImpl = { 8296 name: "Teleport", 8297 __isTeleport: true, 8298 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 8299 const { 8300 mc: mountChildren, 8301 pc: patchChildren, 8302 pbc: patchBlockChildren, 8303 o: { insert, querySelector, createText, createComment } 8304 } = internals; 8305 const disabled = isTeleportDisabled(n2.props); 8306 let { shapeFlag, children, dynamicChildren } = n2; 8307 if (isHmrUpdating) { 8308 optimized = false; 8309 dynamicChildren = null; 8310 } 8311 if (n1 == null) { 8312 const placeholder = n2.el = createComment("teleport start") ; 8313 const mainAnchor = n2.anchor = createComment("teleport end") ; 8314 insert(placeholder, container, anchor); 8315 insert(mainAnchor, container, anchor); 8316 const target = n2.target = resolveTarget(n2.props, querySelector); 8317 const targetAnchor = n2.targetAnchor = createText(""); 8318 if (target) { 8319 insert(targetAnchor, target); 8320 if (namespace === "svg" || isTargetSVG(target)) { 8321 namespace = "svg"; 8322 } else if (namespace === "mathml" || isTargetMathML(target)) { 8323 namespace = "mathml"; 8324 } 8325 } else if (!disabled) { 8326 warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`); 8327 } 8328 const mount = (container2, anchor2) => { 8329 if (shapeFlag & 16) { 8330 mountChildren( 8331 children, 8332 container2, 8333 anchor2, 8334 parentComponent, 8335 parentSuspense, 8336 namespace, 8337 slotScopeIds, 8338 optimized 8339 ); 8340 } 8341 }; 8342 if (disabled) { 8343 mount(container, mainAnchor); 8344 } else if (target) { 8345 mount(target, targetAnchor); 8346 } 8347 } else { 8348 n2.el = n1.el; 8349 const mainAnchor = n2.anchor = n1.anchor; 8350 const target = n2.target = n1.target; 8351 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 8352 const wasDisabled = isTeleportDisabled(n1.props); 8353 const currentContainer = wasDisabled ? container : target; 8354 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 8355 if (namespace === "svg" || isTargetSVG(target)) { 8356 namespace = "svg"; 8357 } else if (namespace === "mathml" || isTargetMathML(target)) { 8358 namespace = "mathml"; 8359 } 8360 if (dynamicChildren) { 8361 patchBlockChildren( 8362 n1.dynamicChildren, 8363 dynamicChildren, 8364 currentContainer, 8365 parentComponent, 8366 parentSuspense, 8367 namespace, 8368 slotScopeIds 8369 ); 8370 traverseStaticChildren(n1, n2, true); 8371 } else if (!optimized) { 8372 patchChildren( 8373 n1, 8374 n2, 8375 currentContainer, 8376 currentAnchor, 8377 parentComponent, 8378 parentSuspense, 8379 namespace, 8380 slotScopeIds, 8381 false 8382 ); 8383 } 8384 if (disabled) { 8385 if (!wasDisabled) { 8386 moveTeleport( 8387 n2, 8388 container, 8389 mainAnchor, 8390 internals, 8391 1 8392 ); 8393 } else { 8394 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 8395 n2.props.to = n1.props.to; 8396 } 8397 } 8398 } else { 8399 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 8400 const nextTarget = n2.target = resolveTarget( 8401 n2.props, 8402 querySelector 8403 ); 8404 if (nextTarget) { 8405 moveTeleport( 8406 n2, 8407 nextTarget, 8408 null, 8409 internals, 8410 0 8411 ); 8412 } else { 8413 warn$1( 8414 "Invalid Teleport target on update:", 8415 target, 8416 `(${typeof target})` 8417 ); 8418 } 8419 } else if (wasDisabled) { 8420 moveTeleport( 8421 n2, 8422 target, 8423 targetAnchor, 8424 internals, 8425 1 8426 ); 8427 } 8428 } 8429 } 8430 updateCssVars(n2); 8431 }, 8432 remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) { 8433 const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode; 8434 if (target) { 8435 hostRemove(targetAnchor); 8436 } 8437 doRemove && hostRemove(anchor); 8438 if (shapeFlag & 16) { 8439 const shouldRemove = doRemove || !isTeleportDisabled(props); 8440 for (let i = 0; i < children.length; i++) { 8441 const child = children[i]; 8442 unmount( 8443 child, 8444 parentComponent, 8445 parentSuspense, 8446 shouldRemove, 8447 !!child.dynamicChildren 8448 ); 8449 } 8450 } 8451 }, 8452 move: moveTeleport, 8453 hydrate: hydrateTeleport 8454 }; 8455 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 8456 if (moveType === 0) { 8457 insert(vnode.targetAnchor, container, parentAnchor); 8458 } 8459 const { el, anchor, shapeFlag, children, props } = vnode; 8460 const isReorder = moveType === 2; 8461 if (isReorder) { 8462 insert(el, container, parentAnchor); 8463 } 8464 if (!isReorder || isTeleportDisabled(props)) { 8465 if (shapeFlag & 16) { 8466 for (let i = 0; i < children.length; i++) { 8467 move( 8468 children[i], 8469 container, 8470 parentAnchor, 8471 2 8472 ); 8473 } 8474 } 8475 } 8476 if (isReorder) { 8477 insert(anchor, container, parentAnchor); 8478 } 8479 } 8480 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 8481 o: { nextSibling, parentNode, querySelector } 8482 }, hydrateChildren) { 8483 const target = vnode.target = resolveTarget( 8484 vnode.props, 8485 querySelector 8486 ); 8487 if (target) { 8488 const targetNode = target._lpa || target.firstChild; 8489 if (vnode.shapeFlag & 16) { 8490 if (isTeleportDisabled(vnode.props)) { 8491 vnode.anchor = hydrateChildren( 8492 nextSibling(node), 8493 vnode, 8494 parentNode(node), 8495 parentComponent, 8496 parentSuspense, 8497 slotScopeIds, 8498 optimized 8499 ); 8500 vnode.targetAnchor = targetNode; 8501 } else { 8502 vnode.anchor = nextSibling(node); 8503 let targetAnchor = targetNode; 8504 while (targetAnchor) { 8505 targetAnchor = nextSibling(targetAnchor); 8506 if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") { 8507 vnode.targetAnchor = targetAnchor; 8508 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 8509 break; 8510 } 8511 } 8512 hydrateChildren( 8513 targetNode, 8514 vnode, 8515 target, 8516 parentComponent, 8517 parentSuspense, 8518 slotScopeIds, 8519 optimized 8520 ); 8521 } 8522 } 8523 updateCssVars(vnode); 8524 } 8525 return vnode.anchor && nextSibling(vnode.anchor); 8526 } 8527 const Teleport = TeleportImpl; 8528 function updateCssVars(vnode) { 8529 const ctx = vnode.ctx; 8530 if (ctx && ctx.ut) { 8531 let node = vnode.children[0].el; 8532 while (node && node !== vnode.targetAnchor) { 8533 if (node.nodeType === 1) 8534 node.setAttribute("data-v-owner", ctx.uid); 8535 node = node.nextSibling; 8536 } 8537 ctx.ut(); 8538 } 8539 } 8540 8541 const Fragment = Symbol.for("v-fgt"); 8542 const Text = Symbol.for("v-txt"); 8543 const Comment = Symbol.for("v-cmt"); 8544 const Static = Symbol.for("v-stc"); 8545 const blockStack = []; 8546 let currentBlock = null; 8547 function openBlock(disableTracking = false) { 8548 blockStack.push(currentBlock = disableTracking ? null : []); 8549 } 8550 function closeBlock() { 8551 blockStack.pop(); 8552 currentBlock = blockStack[blockStack.length - 1] || null; 8553 } 8554 let isBlockTreeEnabled = 1; 8555 function setBlockTracking(value) { 8556 isBlockTreeEnabled += value; 8557 } 8558 function setupBlock(vnode) { 8559 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 8560 closeBlock(); 8561 if (isBlockTreeEnabled > 0 && currentBlock) { 8562 currentBlock.push(vnode); 8563 } 8564 return vnode; 8565 } 8566 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 8567 return setupBlock( 8568 createBaseVNode( 8569 type, 8570 props, 8571 children, 8572 patchFlag, 8573 dynamicProps, 8574 shapeFlag, 8575 true 8576 ) 8577 ); 8578 } 8579 function createBlock(type, props, children, patchFlag, dynamicProps) { 8580 return setupBlock( 8581 createVNode( 8582 type, 8583 props, 8584 children, 8585 patchFlag, 8586 dynamicProps, 8587 true 8588 ) 8589 ); 8590 } 8591 function isVNode(value) { 8592 return value ? value.__v_isVNode === true : false; 8593 } 8594 function isSameVNodeType(n1, n2) { 8595 if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) { 8596 n1.shapeFlag &= ~256; 8597 n2.shapeFlag &= ~512; 8598 return false; 8599 } 8600 return n1.type === n2.type && n1.key === n2.key; 8601 } 8602 let vnodeArgsTransformer; 8603 function transformVNodeArgs(transformer) { 8604 vnodeArgsTransformer = transformer; 8605 } 8606 const createVNodeWithArgsTransform = (...args) => { 8607 return _createVNode( 8608 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 8609 ); 8610 }; 8611 const InternalObjectKey = `__vInternal`; 8612 const normalizeKey = ({ key }) => key != null ? key : null; 8613 const normalizeRef = ({ 8614 ref, 8615 ref_key, 8616 ref_for 8617 }) => { 8618 if (typeof ref === "number") { 8619 ref = "" + ref; 8620 } 8621 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 8622 }; 8623 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 8624 const vnode = { 8625 __v_isVNode: true, 8626 __v_skip: true, 8627 type, 8628 props, 8629 key: props && normalizeKey(props), 8630 ref: props && normalizeRef(props), 8631 scopeId: currentScopeId, 8632 slotScopeIds: null, 8633 children, 8634 component: null, 8635 suspense: null, 8636 ssContent: null, 8637 ssFallback: null, 8638 dirs: null, 8639 transition: null, 8640 el: null, 8641 anchor: null, 8642 target: null, 8643 targetAnchor: null, 8644 staticCount: 0, 8645 shapeFlag, 8646 patchFlag, 8647 dynamicProps, 8648 dynamicChildren: null, 8649 appContext: null, 8650 ctx: currentRenderingInstance 8651 }; 8652 if (needFullChildrenNormalization) { 8653 normalizeChildren(vnode, children); 8654 if (shapeFlag & 128) { 8655 type.normalize(vnode); 8656 } 8657 } else if (children) { 8658 vnode.shapeFlag |= isString(children) ? 8 : 16; 8659 } 8660 if (vnode.key !== vnode.key) { 8661 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 8662 } 8663 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 8664 !isBlockNode && // has current parent block 8665 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 8666 // component nodes also should always be patched, because even if the 8667 // component doesn't need to update, it needs to persist the instance on to 8668 // the next vnode so that it can be properly unmounted later. 8669 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 8670 // vnode should not be considered dynamic due to handler caching. 8671 vnode.patchFlag !== 32) { 8672 currentBlock.push(vnode); 8673 } 8674 return vnode; 8675 } 8676 const createVNode = createVNodeWithArgsTransform ; 8677 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 8678 if (!type || type === NULL_DYNAMIC_COMPONENT) { 8679 if (!type) { 8680 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 8681 } 8682 type = Comment; 8683 } 8684 if (isVNode(type)) { 8685 const cloned = cloneVNode( 8686 type, 8687 props, 8688 true 8689 /* mergeRef: true */ 8690 ); 8691 if (children) { 8692 normalizeChildren(cloned, children); 8693 } 8694 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 8695 if (cloned.shapeFlag & 6) { 8696 currentBlock[currentBlock.indexOf(type)] = cloned; 8697 } else { 8698 currentBlock.push(cloned); 8699 } 8700 } 8701 cloned.patchFlag |= -2; 8702 return cloned; 8703 } 8704 if (isClassComponent(type)) { 8705 type = type.__vccOpts; 8706 } 8707 if (props) { 8708 props = guardReactiveProps(props); 8709 let { class: klass, style } = props; 8710 if (klass && !isString(klass)) { 8711 props.class = normalizeClass(klass); 8712 } 8713 if (isObject(style)) { 8714 if (isProxy(style) && !isArray(style)) { 8715 style = extend({}, style); 8716 } 8717 props.style = normalizeStyle(style); 8718 } 8719 } 8720 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 8721 if (shapeFlag & 4 && isProxy(type)) { 8722 type = toRaw(type); 8723 warn$1( 8724 `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`, 8725 ` 8726Component that was made reactive: `, 8727 type 8728 ); 8729 } 8730 return createBaseVNode( 8731 type, 8732 props, 8733 children, 8734 patchFlag, 8735 dynamicProps, 8736 shapeFlag, 8737 isBlockNode, 8738 true 8739 ); 8740 } 8741 function guardReactiveProps(props) { 8742 if (!props) 8743 return null; 8744 return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props; 8745 } 8746 function cloneVNode(vnode, extraProps, mergeRef = false) { 8747 const { props, ref, patchFlag, children } = vnode; 8748 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 8749 const cloned = { 8750 __v_isVNode: true, 8751 __v_skip: true, 8752 type: vnode.type, 8753 props: mergedProps, 8754 key: mergedProps && normalizeKey(mergedProps), 8755 ref: extraProps && extraProps.ref ? ( 8756 // #2078 in the case of <component :is="vnode" ref="extra"/> 8757 // if the vnode itself already has a ref, cloneVNode will need to merge 8758 // the refs so the single vnode can be set on multiple refs 8759 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 8760 ) : ref, 8761 scopeId: vnode.scopeId, 8762 slotScopeIds: vnode.slotScopeIds, 8763 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 8764 target: vnode.target, 8765 targetAnchor: vnode.targetAnchor, 8766 staticCount: vnode.staticCount, 8767 shapeFlag: vnode.shapeFlag, 8768 // if the vnode is cloned with extra props, we can no longer assume its 8769 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 8770 // note: preserve flag for fragments since they use the flag for children 8771 // fast paths only. 8772 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16
vendor: 4,136 bytes, lines 8772-8892
8772: patchFlag | 16 : patchFlag, 8773 dynamicProps: vnode.dynamicProps, 8774 dynamicChildren: vnode.dynamicChildren, 8775 appContext: vnode.appContext, 8776 dirs: vnode.dirs, 8777 transition: vnode.transition, 8778 // These should technically only be non-null on mounted VNodes. However, 8779 // they *should* be copied for kept-alive vnodes. So we just always copy 8780 // them since them being non-null during a mount doesn't affect the logic as 8781 // they will simply be overwritten. 8782 component: vnode.component, 8783 suspense: vnode.suspense, 8784 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 8785 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 8786 el: vnode.el, 8787 anchor: vnode.anchor, 8788 ctx: vnode.ctx, 8789 ce: vnode.ce 8790 }; 8791 return cloned; 8792 } 8793 function deepCloneVNode(vnode) { 8794 const cloned = cloneVNode(vnode); 8795 if (isArray(vnode.children)) { 8796 cloned.children = vnode.children.map(deepCloneVNode); 8797 } 8798 return cloned; 8799 } 8800 function createTextVNode(text = " ", flag = 0) { 8801 return createVNode(Text, null, text, flag); 8802 } 8803 function createStaticVNode(content, numberOfNodes) { 8804 const vnode = createVNode(Static, null, content); 8805 vnode.staticCount = numberOfNodes; 8806 return vnode; 8807 } 8808 function createCommentVNode(text = "", asBlock = false) { 8809 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 8810 } 8811 function normalizeVNode(child) { 8812 if (child == null || typeof child === "boolean") { 8813 return createVNode(Comment); 8814 } else if (isArray(child)) { 8815 return createVNode( 8816 Fragment, 8817 null, 8818 // #3666, avoid reference pollution when reusing vnode 8819 child.slice() 8820 ); 8821 } else if (typeof child === "object") { 8822 return cloneIfMounted(child); 8823 } else { 8824 return createVNode(Text, null, String(child)); 8825 } 8826 } 8827 function cloneIfMounted(child) { 8828 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 8829 } 8830 function normalizeChildren(vnode, children) { 8831 let type = 0; 8832 const { shapeFlag } = vnode; 8833 if (children == null) { 8834 children = null; 8835 } else if (isArray(children)) { 8836 type = 16; 8837 } else if (typeof children === "object") { 8838 if (shapeFlag & (1 | 64)) { 8839 const slot = children.default; 8840 if (slot) { 8841 slot._c && (slot._d = false); 8842 normalizeChildren(vnode, slot()); 8843 slot._c && (slot._d = true); 8844 } 8845 return; 8846 } else { 8847 type = 32; 8848 const slotFlag = children._; 8849 if (!slotFlag && !(InternalObjectKey in children)) { 8850 children._ctx = currentRenderingInstance; 8851 } else if (slotFlag === 3 && currentRenderingInstance) { 8852 if (currentRenderingInstance.slots._ === 1) { 8853 children._ = 1; 8854 } else { 8855 children._ = 2; 8856 vnode.patchFlag |= 1024; 8857 } 8858 } 8859 } 8860 } else if (isFunction(children)) { 8861 children = { default: children, _ctx: currentRenderingInstance }; 8862 type = 32; 8863 } else { 8864 children = String(children); 8865 if (shapeFlag & 64) { 8866 type = 16; 8867 children = [createTextVNode(children)]; 8868 } else { 8869 type = 8; 8870 } 8871 } 8872 vnode.children = children; 8873 vnode.shapeFlag |= type; 8874 } 8875 function mergeProps(...args) { 8876 const ret = {}; 8877 for (let i = 0; i < args.length; i++) { 8878 const toMerge = args[i]; 8879 for (const key in toMerge) { 8880 if (key === "class") { 8881 if (ret.class !== toMerge.class) { 8882 ret.class = normalizeClass([ret.class, toMerge.class]); 8883 } 8884 } else if (key === "style") { 8885 ret.style = normalizeStyle([ret.style, toMerge.style]); 8886 } else if (isOn(key)) { 8887 const existing = ret[key]; 8888 const incoming = toMerge[key]; 8889 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 8890 ret[key] = existing ? [].concat(existing, incoming) : incoming; 8891 } 8892 } else if (key !== "") {
vendor: 9,981 bytes, lines 8893-9217
8893 ret[key] = toMerge[key]; 8894 } 8895 } 8896 } 8897 return ret; 8898 } 8899 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 8900 callWithAsyncErrorHandling(hook, instance, 7, [ 8901 vnode, 8902 prevVNode 8903 ]); 8904 } 8905 8906 const emptyAppContext = createAppContext(); 8907 let uid = 0; 8908 function createComponentInstance(vnode, parent, suspense) { 8909 const type = vnode.type; 8910 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 8911 const instance = { 8912 uid: uid++, 8913 vnode, 8914 type, 8915 parent, 8916 appContext, 8917 root: null, 8918 // to be immediately set 8919 next: null, 8920 subTree: null, 8921 // will be set synchronously right after creation 8922 effect: null, 8923 update: null, 8924 // will be set synchronously right after creation 8925 scope: new EffectScope( 8926 true 8927 /* detached */ 8928 ), 8929 render: null, 8930 proxy: null, 8931 exposed: null, 8932 exposeProxy: null, 8933 withProxy: null, 8934 provides: parent ? parent.provides : Object.create(appContext.provides), 8935 accessCache: null, 8936 renderCache: [], 8937 // local resolved assets 8938 components: null, 8939 directives: null, 8940 // resolved props and emits options 8941 propsOptions: normalizePropsOptions(type, appContext), 8942 emitsOptions: normalizeEmitsOptions(type, appContext), 8943 // emit 8944 emit: null, 8945 // to be set immediately 8946 emitted: null, 8947 // props default value 8948 propsDefaults: EMPTY_OBJ, 8949 // inheritAttrs 8950 inheritAttrs: type.inheritAttrs, 8951 // state 8952 ctx: EMPTY_OBJ, 8953 data: EMPTY_OBJ, 8954 props: EMPTY_OBJ, 8955 attrs: EMPTY_OBJ, 8956 slots: EMPTY_OBJ, 8957 refs: EMPTY_OBJ, 8958 setupState: EMPTY_OBJ, 8959 setupContext: null, 8960 attrsProxy: null, 8961 slotsProxy: null, 8962 // suspense related 8963 suspense, 8964 suspenseId: suspense ? suspense.pendingId : 0, 8965 asyncDep: null, 8966 asyncResolved: false, 8967 // lifecycle hooks 8968 // not using enums here because it results in computed properties 8969 isMounted: false, 8970 isUnmounted: false, 8971 isDeactivated: false, 8972 bc: null, 8973 c: null, 8974 bm: null, 8975 m: null, 8976 bu: null, 8977 u: null, 8978 um: null, 8979 bum: null, 8980 da: null, 8981 a: null, 8982 rtg: null, 8983 rtc: null, 8984 ec: null, 8985 sp: null 8986 }; 8987 { 8988 instance.ctx = createDevRenderContext(instance); 8989 } 8990 instance.root = parent ? parent.root : instance; 8991 instance.emit = emit.bind(null, instance); 8992 if (vnode.ce) { 8993 vnode.ce(instance); 8994 } 8995 return instance; 8996 } 8997 let currentInstance = null; 8998 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 8999 let internalSetCurrentInstance; 9000 let setInSSRSetupState; 9001 { 9002 internalSetCurrentInstance = (i) => { 9003 currentInstance = i; 9004 }; 9005 setInSSRSetupState = (v) => { 9006 isInSSRComponentSetup = v; 9007 }; 9008 } 9009 const setCurrentInstance = (instance) => { 9010 const prev = currentInstance; 9011 internalSetCurrentInstance(instance); 9012 instance.scope.on(); 9013 return () => { 9014 instance.scope.off(); 9015 internalSetCurrentInstance(prev); 9016 }; 9017 }; 9018 const unsetCurrentInstance = () => { 9019 currentInstance && currentInstance.scope.off(); 9020 internalSetCurrentInstance(null); 9021 }; 9022 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 9023 function validateComponentName(name, { isNativeTag }) { 9024 if (isBuiltInTag(name) || isNativeTag(name)) { 9025 warn$1( 9026 "Do not use built-in or reserved HTML elements as component id: " + name 9027 ); 9028 } 9029 } 9030 function isStatefulComponent(instance) { 9031 return instance.vnode.shapeFlag & 4; 9032 } 9033 let isInSSRComponentSetup = false; 9034 function setupComponent(instance, isSSR = false) { 9035 isSSR && setInSSRSetupState(isSSR); 9036 const { props, children } = instance.vnode; 9037 const isStateful = isStatefulComponent(instance); 9038 initProps(instance, props, isStateful, isSSR); 9039 initSlots(instance, children); 9040 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 9041 isSSR && setInSSRSetupState(false); 9042 return setupResult; 9043 } 9044 function setupStatefulComponent(instance, isSSR) { 9045 var _a; 9046 const Component = instance.type; 9047 { 9048 if (Component.name) { 9049 validateComponentName(Component.name, instance.appContext.config); 9050 } 9051 if (Component.components) { 9052 const names = Object.keys(Component.components); 9053 for (let i = 0; i < names.length; i++) { 9054 validateComponentName(names[i], instance.appContext.config); 9055 } 9056 } 9057 if (Component.directives) { 9058 const names = Object.keys(Component.directives); 9059 for (let i = 0; i < names.length; i++) { 9060 validateDirectiveName(names[i]); 9061 } 9062 } 9063 if (Component.compilerOptions && isRuntimeOnly()) { 9064 warn$1( 9065 `"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.` 9066 ); 9067 } 9068 } 9069 instance.accessCache = /* @__PURE__ */ Object.create(null); 9070 instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers)); 9071 { 9072 exposePropsOnRenderContext(instance); 9073 } 9074 const { setup } = Component; 9075 if (setup) { 9076 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 9077 const reset = setCurrentInstance(instance); 9078 pauseTracking(); 9079 const setupResult = callWithErrorHandling( 9080 setup, 9081 instance, 9082 0, 9083 [ 9084 shallowReadonly(instance.props) , 9085 setupContext 9086 ] 9087 ); 9088 resetTracking(); 9089 reset(); 9090 if (isPromise(setupResult)) { 9091 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 9092 if (isSSR) { 9093 return setupResult.then((resolvedResult) => { 9094 handleSetupResult(instance, resolvedResult, isSSR); 9095 }).catch((e) => { 9096 handleError(e, instance, 0); 9097 }); 9098 } else { 9099 instance.asyncDep = setupResult; 9100 if (!instance.suspense) { 9101 const name = (_a = Component.name) != null ? _a : "Anonymous"; 9102 warn$1( 9103 `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.` 9104 ); 9105 } 9106 } 9107 } else { 9108 handleSetupResult(instance, setupResult, isSSR); 9109 } 9110 } else { 9111 finishComponentSetup(instance, isSSR); 9112 } 9113 } 9114 function handleSetupResult(instance, setupResult, isSSR) { 9115 if (isFunction(setupResult)) { 9116 { 9117 instance.render = setupResult; 9118 } 9119 } else if (isObject(setupResult)) { 9120 if (isVNode(setupResult)) { 9121 warn$1( 9122 `setup() should not return VNodes directly - return a render function instead.` 9123 ); 9124 } 9125 { 9126 instance.devtoolsRawSetupState = setupResult; 9127 } 9128 instance.setupState = proxyRefs(setupResult); 9129 { 9130 exposeSetupStateOnRenderContext(instance); 9131 } 9132 } else if (setupResult !== void 0) { 9133 warn$1( 9134 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 9135 ); 9136 } 9137 finishComponentSetup(instance, isSSR); 9138 } 9139 let compile$1; 9140 let installWithProxy; 9141 function registerRuntimeCompiler(_compile) { 9142 compile$1 = _compile; 9143 installWithProxy = (i) => { 9144 if (i.render._rc) { 9145 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 9146 } 9147 }; 9148 } 9149 const isRuntimeOnly = () => !compile$1; 9150 function finishComponentSetup(instance, isSSR, skipOptions) { 9151 const Component = instance.type; 9152 if (!instance.render) { 9153 if (!isSSR && compile$1 && !Component.render) { 9154 const template = Component.template || resolveMergedOptions(instance).template; 9155 if (template) { 9156 { 9157 startMeasure(instance, `compile`); 9158 } 9159 const { isCustomElement, compilerOptions } = instance.appContext.config; 9160 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 9161 const finalCompilerOptions = extend( 9162 extend( 9163 { 9164 isCustomElement, 9165 delimiters 9166 }, 9167 compilerOptions 9168 ), 9169 componentCompilerOptions 9170 ); 9171 Component.render = compile$1(template, finalCompilerOptions); 9172 { 9173 endMeasure(instance, `compile`); 9174 } 9175 } 9176 } 9177 instance.render = Component.render || NOOP; 9178 if (installWithProxy) { 9179 installWithProxy(instance); 9180 } 9181 } 9182 { 9183 const reset = setCurrentInstance(instance); 9184 pauseTracking(); 9185 try { 9186 applyOptions(instance); 9187 } finally { 9188 resetTracking(); 9189 reset(); 9190 } 9191 } 9192 if (!Component.render && instance.render === NOOP && !isSSR) { 9193 if (!compile$1 && Component.template) { 9194 warn$1( 9195 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` ) 9196 ); 9197 } else { 9198 warn$1(`Component is missing template or render function.`); 9199 } 9200 } 9201 } 9202 function getAttrsProxy(instance) { 9203 return instance.attrsProxy || (instance.attrsProxy = new Proxy( 9204 instance.attrs, 9205 { 9206 get(target, key) { 9207 markAttrsAccessed(); 9208 track(instance, "get", "$attrs"); 9209 return target[key]; 9210 }, 9211 set() { 9212 warn$1(`setupContext.attrs is readonly.`); 9213 return false; 9214 }, 9215 deleteProperty() { 9216 warn$1(`setupContext.attrs is readonly.`); 9217 return false;
9218 } 9219 } 9220 )); 9221 } 9222 function getSlotsProxy(instance) { 9223 return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, { 9224 get(target, key) { 9225 track(instance, "get", "$slots"); 9226 return target[key]; 9227 } 9228 })); 9229 } 9230 function createSetupContext(instance) { 9231 const expose = (exposed) => { 9232 { 9233 if (instance.exposed) { 9234 warn$1(`expose() should be called only once per setup().`); 9235 } 9236 if (exposed != null) { 9237 let exposedType = typeof exposed; 9238 if (exposedType === "object") { 9239 if (isArray(exposed)) { 9240 exposedType = "array"; 9241 } else if (isRef(exposed)) { 9242 exposedType = "ref"; 9243 } 9244 } 9245 if (exposedType !== "object") { 9246 warn$1( 9247 `expose() should be passed a plain object, received ${exposedType}.` 9248 ); 9249 } 9250 } 9251 } 9252 instance.exposed = exposed || {}; 9253 }; 9254 { 9255 return Object.freeze({ 9256 get attrs() { 9257 return getAttrsProxy(instance); 9258 }, 9259 get slots() { 9260 return getSlotsProxy(instance); 9261 },
vendor: 9,398 bytes, lines 9262-9577
9262 get emit() { 9263 return (event, ...args) => instance.emit(event, ...args); 9264 }, 9265 expose 9266 }); 9267 } 9268 } 9269 function getExposeProxy(instance) { 9270 if (instance.exposed) { 9271 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 9272 get(target, key) { 9273 if (key in target) { 9274 return target[key]; 9275 } else if (key in publicPropertiesMap) { 9276 return publicPropertiesMap[key](instance); 9277 } 9278 }, 9279 has(target, key) { 9280 return key in target || key in publicPropertiesMap; 9281 } 9282 })); 9283 } 9284 } 9285 const classifyRE = /(?:^|[-_])(\w)/g; 9286 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 9287 function getComponentName(Component, includeInferred = true) { 9288 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 9289 } 9290 function formatComponentName(instance, Component, isRoot = false) { 9291 let name = getComponentName(Component); 9292 if (!name && Component.__file) { 9293 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 9294 if (match) { 9295 name = match[1]; 9296 } 9297 } 9298 if (!name && instance && instance.parent) { 9299 const inferFromRegistry = (registry) => { 9300 for (const key in registry) { 9301 if (registry[key] === Component) { 9302 return key; 9303 } 9304 } 9305 }; 9306 name = inferFromRegistry( 9307 instance.components || instance.parent.type.components 9308 ) || inferFromRegistry(instance.appContext.components); 9309 } 9310 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 9311 } 9312 function isClassComponent(value) { 9313 return isFunction(value) && "__vccOpts" in value; 9314 } 9315 9316 const computed = (getterOrOptions, debugOptions) => { 9317 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 9318 { 9319 const i = getCurrentInstance(); 9320 if (i && i.appContext.config.warnRecursiveComputed) { 9321 c._warnRecursive = true; 9322 } 9323 } 9324 return c; 9325 }; 9326 9327 function useModel(props, name, options = EMPTY_OBJ) { 9328 const i = getCurrentInstance(); 9329 if (!i) { 9330 warn$1(`useModel() called without active instance.`); 9331 return ref(); 9332 } 9333 if (!i.propsOptions[0][name]) { 9334 warn$1(`useModel() called with prop "${name}" which is not declared.`); 9335 return ref(); 9336 } 9337 const camelizedName = camelize(name); 9338 const hyphenatedName = hyphenate(name); 9339 const res = customRef((track, trigger) => { 9340 let localValue; 9341 watchSyncEffect(() => { 9342 const propValue = props[name]; 9343 if (hasChanged(localValue, propValue)) { 9344 localValue = propValue; 9345 trigger(); 9346 } 9347 }); 9348 return { 9349 get() { 9350 track(); 9351 return options.get ? options.get(localValue) : localValue; 9352 }, 9353 set(value) { 9354 const rawProps = i.vnode.props; 9355 if (!(rawProps && // check if parent has passed v-model 9356 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) { 9357 localValue = value; 9358 trigger(); 9359 } 9360 i.emit(`update:${name}`, options.set ? options.set(value) : value); 9361 } 9362 }; 9363 }); 9364 const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`; 9365 res[Symbol.iterator] = () => { 9366 let i2 = 0; 9367 return { 9368 next() { 9369 if (i2 < 2) { 9370 return { value: i2++ ? props[modifierKey] || {} : res, done: false }; 9371 } else { 9372 return { done: true }; 9373 } 9374 } 9375 }; 9376 }; 9377 return res; 9378 } 9379 9380 function h(type, propsOrChildren, children) { 9381 const l = arguments.length; 9382 if (l === 2) { 9383 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 9384 if (isVNode(propsOrChildren)) { 9385 return createVNode(type, null, [propsOrChildren]); 9386 } 9387 return createVNode(type, propsOrChildren); 9388 } else { 9389 return createVNode(type, null, propsOrChildren); 9390 } 9391 } else { 9392 if (l > 3) { 9393 children = Array.prototype.slice.call(arguments, 2); 9394 } else if (l === 3 && isVNode(children)) { 9395 children = [children]; 9396 } 9397 return createVNode(type, propsOrChildren, children); 9398 } 9399 } 9400 9401 function initCustomFormatter() { 9402 if (typeof window === "undefined") { 9403 return; 9404 } 9405 const vueStyle = { style: "color:#3ba776" }; 9406 const numberStyle = { style: "color:#1677ff" }; 9407 const stringStyle = { style: "color:#f5222d" }; 9408 const keywordStyle = { style: "color:#eb2f96" }; 9409 const formatter = { 9410 header(obj) { 9411 if (!isObject(obj)) { 9412 return null; 9413 } 9414 if (obj.__isVue) { 9415 return ["div", vueStyle, `VueInstance`]; 9416 } else if (isRef(obj)) { 9417 return [ 9418 "div", 9419 {}, 9420 ["span", vueStyle, genRefFlag(obj)], 9421 "<", 9422 formatValue(obj.value), 9423 `>` 9424 ]; 9425 } else if (isReactive(obj)) { 9426 return [ 9427 "div", 9428 {}, 9429 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 9430 "<", 9431 formatValue(obj), 9432 `>${isReadonly(obj) ? ` (readonly)` : ``}` 9433 ]; 9434 } else if (isReadonly(obj)) { 9435 return [ 9436 "div", 9437 {}, 9438 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 9439 "<", 9440 formatValue(obj), 9441 ">" 9442 ]; 9443 } 9444 return null; 9445 }, 9446 hasBody(obj) { 9447 return obj && obj.__isVue; 9448 }, 9449 body(obj) { 9450 if (obj && obj.__isVue) { 9451 return [ 9452 "div", 9453 {}, 9454 ...formatInstance(obj.$) 9455 ]; 9456 } 9457 } 9458 }; 9459 function formatInstance(instance) { 9460 const blocks = []; 9461 if (instance.type.props && instance.props) { 9462 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 9463 } 9464 if (instance.setupState !== EMPTY_OBJ) { 9465 blocks.push(createInstanceBlock("setup", instance.setupState)); 9466 } 9467 if (instance.data !== EMPTY_OBJ) { 9468 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 9469 } 9470 const computed = extractKeys(instance, "computed"); 9471 if (computed) { 9472 blocks.push(createInstanceBlock("computed", computed)); 9473 } 9474 const injected = extractKeys(instance, "inject"); 9475 if (injected) { 9476 blocks.push(createInstanceBlock("injected", injected)); 9477 } 9478 blocks.push([ 9479 "div", 9480 {}, 9481 [ 9482 "span", 9483 { 9484 style: keywordStyle.style + ";opacity:0.66" 9485 }, 9486 "$ (internal): " 9487 ], 9488 ["object", { object: instance }] 9489 ]); 9490 return blocks; 9491 } 9492 function createInstanceBlock(type, target) { 9493 target = extend({}, target); 9494 if (!Object.keys(target).length) { 9495 return ["span", {}]; 9496 } 9497 return [ 9498 "div", 9499 { style: "line-height:1.25em;margin-bottom:0.6em" }, 9500 [ 9501 "div", 9502 { 9503 style: "color:#476582" 9504 }, 9505 type 9506 ], 9507 [ 9508 "div", 9509 { 9510 style: "padding-left:1.25em" 9511 }, 9512 ...Object.keys(target).map((key) => { 9513 return [ 9514 "div", 9515 {}, 9516 ["span", keywordStyle, key + ": "], 9517 formatValue(target[key], false) 9518 ]; 9519 }) 9520 ] 9521 ]; 9522 } 9523 function formatValue(v, asRaw = true) { 9524 if (typeof v === "number") { 9525 return ["span", numberStyle, v]; 9526 } else if (typeof v === "string") { 9527 return ["span", stringStyle, JSON.stringify(v)]; 9528 } else if (typeof v === "boolean") { 9529 return ["span", keywordStyle, v]; 9530 } else if (isObject(v)) { 9531 return ["object", { object: asRaw ? toRaw(v) : v }]; 9532 } else { 9533 return ["span", stringStyle, String(v)]; 9534 } 9535 } 9536 function extractKeys(instance, type) { 9537 const Comp = instance.type; 9538 if (isFunction(Comp)) { 9539 return; 9540 } 9541 const extracted = {}; 9542 for (const key in instance.ctx) { 9543 if (isKeyOfType(Comp, key, type)) { 9544 extracted[key] = instance.ctx[key]; 9545 } 9546 } 9547 return extracted; 9548 } 9549 function isKeyOfType(Comp, key, type) { 9550 const opts = Comp[type]; 9551 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 9552 return true; 9553 } 9554 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 9555 return true; 9556 } 9557 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 9558 return true; 9559 } 9560 } 9561 function genRefFlag(v) { 9562 if (isShallow(v)) { 9563 return `ShallowRef`; 9564 } 9565 if (v.effect) { 9566 return `ComputedRef`; 9567 } 9568 return `Ref`; 9569 } 9570 if (window.devtoolsFormatters) { 9571 window.devtoolsFormatters.push(formatter); 9572 } else { 9573 window.devtoolsFormatters = [formatter]; 9574 } 9575 } 9576 9577 function withMemo(memo, render, cache, index) {
vendor: 1,066 bytes, lines 9578-9615
9578 const cached = cache[index]; 9579 if (cached && isMemoSame(cached, memo)) { 9580 return cached; 9581 } 9582 const ret = render(); 9583 ret.memo = memo.slice(); 9584 return cache[index] = ret; 9585 } 9586 function isMemoSame(cached, memo) { 9587 const prev = cached.memo; 9588 if (prev.length != memo.length) { 9589 return false; 9590 } 9591 for (let i = 0; i < prev.length; i++) { 9592 if (hasChanged(prev[i], memo[i])) { 9593 return false; 9594 } 9595 } 9596 if (isBlockTreeEnabled > 0 && currentBlock) { 9597 currentBlock.push(cached); 9598 } 9599 return true; 9600 } 9601 9602 const version = "3.4.21"; 9603 const warn = warn$1 ; 9604 const ErrorTypeStrings = ErrorTypeStrings$1 ; 9605 const devtools = devtools$1 ; 9606 const setDevtoolsHook = setDevtoolsHook$1 ; 9607 const ssrUtils = null; 9608 const resolveFilter = null; 9609 const compatUtils = null; 9610 const DeprecationTypes = null; 9611 9612 const svgNS = "http://www.w3.org/2000/svg"; 9613 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 9614 const doc = typeof document !== "undefined" ? document : null; 9615 const templateContainer = doc && /* @__P
vendor: 4,995 bytes, lines 9615-9761
9615URE__ */ doc.createElement("template"); 9616 const nodeOps = { 9617 insert: (child, parent, anchor) => { 9618 parent.insertBefore(child, anchor || null); 9619 }, 9620 remove: (child) => { 9621 const parent = child.parentNode; 9622 if (parent) { 9623 parent.removeChild(child); 9624 } 9625 }, 9626 createElement: (tag, namespace, is, props) => { 9627 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0); 9628 if (tag === "select" && props && props.multiple != null) { 9629 el.setAttribute("multiple", props.multiple); 9630 } 9631 return el; 9632 }, 9633 createText: (text) => doc.createTextNode(text), 9634 createComment: (text) => doc.createComment(text), 9635 setText: (node, text) => { 9636 node.nodeValue = text; 9637 }, 9638 setElementText: (el, text) => { 9639 el.textContent = text; 9640 }, 9641 parentNode: (node) => node.parentNode, 9642 nextSibling: (node) => node.nextSibling, 9643 querySelector: (selector) => doc.querySelector(selector), 9644 setScopeId(el, id) { 9645 el.setAttribute(id, ""); 9646 }, 9647 // __UNSAFE__ 9648 // Reason: innerHTML. 9649 // Static content here can only come from compiled templates. 9650 // As long as the user only uses trusted templates, this is safe. 9651 insertStaticContent(content, parent, anchor, namespace, start, end) { 9652 const before = anchor ? anchor.previousSibling : parent.lastChild; 9653 if (start && (start === end || start.nextSibling)) { 9654 while (true) { 9655 parent.insertBefore(start.cloneNode(true), anchor); 9656 if (start === end || !(start = start.nextSibling)) 9657 break; 9658 } 9659 } else { 9660 templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content; 9661 const template = templateContainer.content; 9662 if (namespace === "svg" || namespace === "mathml") { 9663 const wrapper = template.firstChild; 9664 while (wrapper.firstChild) { 9665 template.appendChild(wrapper.firstChild); 9666 } 9667 template.removeChild(wrapper); 9668 } 9669 parent.insertBefore(template, anchor); 9670 } 9671 return [ 9672 // first 9673 before ? before.nextSibling : parent.firstChild, 9674 // last 9675 anchor ? anchor.previousSibling : parent.lastChild 9676 ]; 9677 } 9678 }; 9679 9680 const TRANSITION$1 = "transition"; 9681 const ANIMATION = "animation"; 9682 const vtcKey = Symbol("_vtc"); 9683 const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots); 9684 Transition.displayName = "Transition"; 9685 const DOMTransitionPropsValidators = { 9686 name: String, 9687 type: String, 9688 css: { 9689 type: Boolean, 9690 default: true 9691 }, 9692 duration: [String, Number, Object], 9693 enterFromClass: String, 9694 enterActiveClass: String, 9695 enterToClass: String, 9696 appearFromClass: String, 9697 appearActiveClass: String, 9698 appearToClass: String, 9699 leaveFromClass: String, 9700 leaveActiveClass: String, 9701 leaveToClass: String 9702 }; 9703 const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend( 9704 {}, 9705 BaseTransitionPropsValidators, 9706 DOMTransitionPropsValidators 9707 ); 9708 const callHook = (hook, args = []) => { 9709 if (isArray(hook)) { 9710 hook.forEach((h2) => h2(...args)); 9711 } else if (hook) { 9712 hook(...args); 9713 } 9714 }; 9715 const hasExplicitCallback = (hook) => { 9716 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 9717 }; 9718 function resolveTransitionProps(rawProps) { 9719 const baseProps = {}; 9720 for (const key in rawProps) { 9721 if (!(key in DOMTransitionPropsValidators)) { 9722 baseProps[key] = rawProps[key]; 9723 } 9724 } 9725 if (rawProps.css === false) { 9726 return baseProps; 9727 } 9728 const { 9729 name = "v", 9730 type, 9731 duration, 9732 enterFromClass = `${name}-enter-from`, 9733 enterActiveClass = `${name}-enter-active`, 9734 enterToClass = `${name}-enter-to`, 9735 appearFromClass = enterFromClass, 9736 appearActiveClass = enterActiveClass, 9737 appearToClass = enterToClass, 9738 leaveFromClass = `${name}-leave-from`, 9739 leaveActiveClass = `${name}-leave-active`, 9740 leaveToClass = `${name}-leave-to` 9741 } = rawProps; 9742 const durations = normalizeDuration(duration); 9743 const enterDuration = durations && durations[0]; 9744 const leaveDuration = durations && durations[1]; 9745 const { 9746 onBeforeEnter, 9747 onEnter, 9748 onEnterCancelled, 9749 onLeave, 9750 onLeaveCancelled, 9751 onBeforeAppear = onBeforeEnter, 9752 onAppear = onEnter, 9753 onAppearCancelled = onEnterCancelled 9754 } = baseProps; 9755 const finishEnter = (el, isAppear, done) => { 9756 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 9757 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 9758 done && done(); 9759 }; 9760 const finishLeave = (el, done) => { 9761 el._isLeaving = false;
vendor: 8,966 bytes, lines 9762-10050
9762 removeTransitionClass(el, leaveFromClass); 9763 removeTransitionClass(el, leaveToClass); 9764 removeTransitionClass(el, leaveActiveClass); 9765 done && done(); 9766 }; 9767 const makeEnterHook = (isAppear) => { 9768 return (el, done) => { 9769 const hook = isAppear ? onAppear : onEnter; 9770 const resolve = () => finishEnter(el, isAppear, done); 9771 callHook(hook, [el, resolve]); 9772 nextFrame(() => { 9773 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 9774 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 9775 if (!hasExplicitCallback(hook)) { 9776 whenTransitionEnds(el, type, enterDuration, resolve); 9777 } 9778 }); 9779 }; 9780 }; 9781 return extend(baseProps, { 9782 onBeforeEnter(el) { 9783 callHook(onBeforeEnter, [el]); 9784 addTransitionClass(el, enterFromClass); 9785 addTransitionClass(el, enterActiveClass); 9786 }, 9787 onBeforeAppear(el) { 9788 callHook(onBeforeAppear, [el]); 9789 addTransitionClass(el, appearFromClass); 9790 addTransitionClass(el, appearActiveClass); 9791 }, 9792 onEnter: makeEnterHook(false), 9793 onAppear: makeEnterHook(true), 9794 onLeave(el, done) { 9795 el._isLeaving = true; 9796 const resolve = () => finishLeave(el, done); 9797 addTransitionClass(el, leaveFromClass); 9798 forceReflow(); 9799 addTransitionClass(el, leaveActiveClass); 9800 nextFrame(() => { 9801 if (!el._isLeaving) { 9802 return; 9803 } 9804 removeTransitionClass(el, leaveFromClass); 9805 addTransitionClass(el, leaveToClass); 9806 if (!hasExplicitCallback(onLeave)) { 9807 whenTransitionEnds(el, type, leaveDuration, resolve); 9808 } 9809 }); 9810 callHook(onLeave, [el, resolve]); 9811 }, 9812 onEnterCancelled(el) { 9813 finishEnter(el, false); 9814 callHook(onEnterCancelled, [el]); 9815 }, 9816 onAppearCancelled(el) { 9817 finishEnter(el, true); 9818 callHook(onAppearCancelled, [el]); 9819 }, 9820 onLeaveCancelled(el) { 9821 finishLeave(el); 9822 callHook(onLeaveCancelled, [el]); 9823 } 9824 }); 9825 } 9826 function normalizeDuration(duration) { 9827 if (duration == null) { 9828 return null; 9829 } else if (isObject(duration)) { 9830 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 9831 } else { 9832 const n = NumberOf(duration); 9833 return [n, n]; 9834 } 9835 } 9836 function NumberOf(val) { 9837 const res = toNumber(val); 9838 { 9839 assertNumber(res, "<transition> explicit duration"); 9840 } 9841 return res; 9842 } 9843 function addTransitionClass(el, cls) { 9844 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 9845 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 9846 } 9847 function removeTransitionClass(el, cls) { 9848 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 9849 const _vtc = el[vtcKey]; 9850 if (_vtc) { 9851 _vtc.delete(cls); 9852 if (!_vtc.size) { 9853 el[vtcKey] = void 0; 9854 } 9855 } 9856 } 9857 function nextFrame(cb) { 9858 requestAnimationFrame(() => { 9859 requestAnimationFrame(cb); 9860 }); 9861 } 9862 let endId = 0; 9863 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 9864 const id = el._endId = ++endId; 9865 const resolveIfNotStale = () => { 9866 if (id === el._endId) { 9867 resolve(); 9868 } 9869 }; 9870 if (explicitTimeout) { 9871 return setTimeout(resolveIfNotStale, explicitTimeout); 9872 } 9873 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 9874 if (!type) { 9875 return resolve(); 9876 } 9877 const endEvent = type + "end"; 9878 let ended = 0; 9879 const end = () => { 9880 el.removeEventListener(endEvent, onEnd); 9881 resolveIfNotStale(); 9882 }; 9883 const onEnd = (e) => { 9884 if (e.target === el && ++ended >= propCount) { 9885 end(); 9886 } 9887 }; 9888 setTimeout(() => { 9889 if (ended < propCount) { 9890 end(); 9891 } 9892 }, timeout + 1); 9893 el.addEventListener(endEvent, onEnd); 9894 } 9895 function getTransitionInfo(el, expectedType) { 9896 const styles = window.getComputedStyle(el); 9897 const getStyleProperties = (key) => (styles[key] || "").split(", "); 9898 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 9899 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 9900 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 9901 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 9902 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 9903 const animationTimeout = getTimeout(animationDelays, animationDurations); 9904 let type = null; 9905 let timeout = 0; 9906 let propCount = 0; 9907 if (expectedType === TRANSITION$1) { 9908 if (transitionTimeout > 0) { 9909 type = TRANSITION$1; 9910 timeout = transitionTimeout; 9911 propCount = transitionDurations.length; 9912 } 9913 } else if (expectedType === ANIMATION) { 9914 if (animationTimeout > 0) { 9915 type = ANIMATION; 9916 timeout = animationTimeout; 9917 propCount = animationDurations.length; 9918 } 9919 } else { 9920 timeout = Math.max(transitionTimeout, animationTimeout); 9921 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 9922 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 9923 } 9924 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test( 9925 getStyleProperties(`${TRANSITION$1}Property`).toString() 9926 ); 9927 return { 9928 type, 9929 timeout, 9930 propCount, 9931 hasTransform 9932 }; 9933 } 9934 function getTimeout(delays, durations) { 9935 while (delays.length < durations.length) { 9936 delays = delays.concat(delays); 9937 } 9938 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 9939 } 9940 function toMs(s) { 9941 if (s === "auto") 9942 return 0; 9943 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 9944 } 9945 function forceReflow() { 9946 return document.body.offsetHeight; 9947 } 9948 9949 function patchClass(el, value, isSVG) { 9950 const transitionClasses = el[vtcKey]; 9951 if (transitionClasses) { 9952 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 9953 } 9954 if (value == null) { 9955 el.removeAttribute("class"); 9956 } else if (isSVG) { 9957 el.setAttribute("class", value); 9958 } else { 9959 el.className = value; 9960 } 9961 } 9962 9963 const vShowOriginalDisplay = Symbol("_vod"); 9964 const vShowHidden = Symbol("_vsh"); 9965 const vShow = { 9966 beforeMount(el, { value }, { transition }) { 9967 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 9968 if (transition && value) { 9969 transition.beforeEnter(el); 9970 } else { 9971 setDisplay(el, value); 9972 } 9973 }, 9974 mounted(el, { value }, { transition }) { 9975 if (transition && value) { 9976 transition.enter(el); 9977 } 9978 }, 9979 updated(el, { value, oldValue }, { transition }) { 9980 if (!value === !oldValue) 9981 return; 9982 if (transition) { 9983 if (value) { 9984 transition.beforeEnter(el); 9985 setDisplay(el, true); 9986 transition.enter(el); 9987 } else { 9988 transition.leave(el, () => { 9989 setDisplay(el, false); 9990 }); 9991 } 9992 } else { 9993 setDisplay(el, value); 9994 } 9995 }, 9996 beforeUnmount(el, { value }) { 9997 setDisplay(el, value); 9998 } 9999 }; 10000 { 10001 vShow.name = "show"; 10002 } 10003 function setDisplay(el, value) { 10004 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 10005 el[vShowHidden] = !value; 10006 } 10007 10008 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" ); 10009 function useCssVars(getter) { 10010 const instance = getCurrentInstance(); 10011 if (!instance) { 10012 warn(`useCssVars is called without current active component instance.`); 10013 return; 10014 } 10015 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 10016 Array.from( 10017 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 10018 ).forEach((node) => setVarsOnNode(node, vars)); 10019 }; 10020 { 10021 instance.getCssVars = () => getter(instance.proxy); 10022 } 10023 const setVars = () => { 10024 const vars = getter(instance.proxy); 10025 setVarsOnVNode(instance.subTree, vars); 10026 updateTeleports(vars); 10027 }; 10028 watchPostEffect(setVars); 10029 onMounted(() => { 10030 const ob = new MutationObserver(setVars); 10031 ob.observe(instance.subTree.el.parentNode, { childList: true }); 10032 onUnmounted(() => ob.disconnect()); 10033 }); 10034 } 10035 function setVarsOnVNode(vnode, vars) { 10036 if (vnode.shapeFlag & 128) { 10037 const suspense = vnode.suspense; 10038 vnode = suspense.activeBranch; 10039 if (suspense.pendingBranch && !suspense.isHydrating) { 10040 suspense.effects.push(() => { 10041 setVarsOnVNode(suspense.activeBranch, vars); 10042 }); 10043 } 10044 } 10045 while (vnode.component) { 10046 vnode = vnode.component.subTree; 10047 } 10048 if (vnode.shapeFlag & 1 && vnode.el) { 10049 setVarsOnNode(vnode.el, vars); 10050 } else if (vnode.type === Fragment) {
vendor: 4,776 bytes, lines 10051-10215
10051 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 10052 } else if (vnode.type === Static) { 10053 let { el, anchor } = vnode; 10054 while (el) { 10055 setVarsOnNode(el, vars); 10056 if (el === anchor) 10057 break; 10058 el = el.nextSibling; 10059 } 10060 } 10061 } 10062 function setVarsOnNode(el, vars) { 10063 if (el.nodeType === 1) { 10064 const style = el.style; 10065 let cssText = ""; 10066 for (const key in vars) { 10067 style.setProperty(`--${key}`, vars[key]); 10068 cssText += `--${key}: ${vars[key]};`; 10069 } 10070 style[CSS_VAR_TEXT] = cssText; 10071 } 10072 } 10073 10074 const displayRE = /(^|;)\s*display\s*:/; 10075 function patchStyle(el, prev, next) { 10076 const style = el.style; 10077 const isCssString = isString(next); 10078 let hasControlledDisplay = false; 10079 if (next && !isCssString) { 10080 if (prev) { 10081 if (!isString(prev)) { 10082 for (const key in prev) { 10083 if (next[key] == null) { 10084 setStyle(style, key, ""); 10085 } 10086 } 10087 } else { 10088 for (const prevStyle of prev.split(";")) { 10089 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 10090 if (next[key] == null) { 10091 setStyle(style, key, ""); 10092 } 10093 } 10094 } 10095 } 10096 for (const key in next) { 10097 if (key === "display") { 10098 hasControlledDisplay = true; 10099 } 10100 setStyle(style, key, next[key]); 10101 } 10102 } else { 10103 if (isCssString) { 10104 if (prev !== next) { 10105 const cssVarText = style[CSS_VAR_TEXT]; 10106 if (cssVarText) { 10107 next += ";" + cssVarText; 10108 } 10109 style.cssText = next; 10110 hasControlledDisplay = displayRE.test(next); 10111 } 10112 } else if (prev) { 10113 el.removeAttribute("style"); 10114 } 10115 } 10116 if (vShowOriginalDisplay in el) { 10117 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 10118 if (el[vShowHidden]) { 10119 style.display = "none"; 10120 } 10121 } 10122 } 10123 const semicolonRE = /[^\\];\s*$/; 10124 const importantRE = /\s*!important$/; 10125 function setStyle(style, name, val) { 10126 if (isArray(val)) { 10127 val.forEach((v) => setStyle(style, name, v)); 10128 } else { 10129 if (val == null) 10130 val = ""; 10131 { 10132 if (semicolonRE.test(val)) { 10133 warn( 10134 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 10135 ); 10136 } 10137 } 10138 if (name.startsWith("--")) { 10139 style.setProperty(name, val); 10140 } else { 10141 const prefixed = autoPrefix(style, name); 10142 if (importantRE.test(val)) { 10143 style.setProperty( 10144 hyphenate(prefixed), 10145 val.replace(importantRE, ""), 10146 "important" 10147 ); 10148 } else { 10149 style[prefixed] = val; 10150 } 10151 } 10152 } 10153 } 10154 const prefixes = ["Webkit", "Moz", "ms"]; 10155 const prefixCache = {}; 10156 function autoPrefix(style, rawName) { 10157 const cached = prefixCache[rawName]; 10158 if (cached) { 10159 return cached; 10160 } 10161 let name = camelize(rawName); 10162 if (name !== "filter" && name in style) { 10163 return prefixCache[rawName] = name; 10164 } 10165 name = capitalize(name); 10166 for (let i = 0; i < prefixes.length; i++) { 10167 const prefixed = prefixes[i] + name; 10168 if (prefixed in style) { 10169 return prefixCache[rawName] = prefixed; 10170 } 10171 } 10172 return rawName; 10173 } 10174 10175 const xlinkNS = "http://www.w3.org/1999/xlink"; 10176 function patchAttr(el, key, value, isSVG, instance) { 10177 if (isSVG && key.startsWith("xlink:")) { 10178 if (value == null) { 10179 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 10180 } else { 10181 el.setAttributeNS(xlinkNS, key, value); 10182 } 10183 } else { 10184 const isBoolean = isSpecialBooleanAttr(key); 10185 if (value == null || isBoolean && !includeBooleanAttr(value)) { 10186 el.removeAttribute(key); 10187 } else { 10188 el.setAttribute(key, isBoolean ? "" : value); 10189 } 10190 } 10191 } 10192 10193 function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) { 10194 if (key === "innerHTML" || key === "textContent") { 10195 if (prevChildren) { 10196 unmountChildren(prevChildren, parentComponent, parentSuspense); 10197 } 10198 el[key] = value == null ? "" : value; 10199 return; 10200 } 10201 const tag = el.tagName; 10202 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 10203 !tag.includes("-")) { 10204 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 10205 const newValue = value == null ? "" : value; 10206 if (oldValue !== newValue || !("_value" in el)) { 10207 el.value = newValue; 10208 } 10209 if (value == null) { 10210 el.removeAttribute(key); 10211 } 10212 el._value = value; 10213 return; 10214 } 10215 let needRemove = false;
vendor: 1,064 bytes, lines 10216-10250
10216 if (value === "" || value == null) { 10217 const type = typeof el[key]; 10218 if (type === "boolean") { 10219 value = includeBooleanAttr(value); 10220 } else if (value == null && type === "string") { 10221 value = ""; 10222 needRemove = true; 10223 } else if (type === "number") { 10224 value = 0; 10225 needRemove = true; 10226 } 10227 } 10228 try { 10229 el[key] = value; 10230 } catch (e) { 10231 if (!needRemove) { 10232 warn( 10233 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, 10234 e 10235 ); 10236 } 10237 } 10238 needRemove && el.removeAttribute(key); 10239 } 10240 10241 function addEventListener(el, event, handler, options) { 10242 el.addEventListener(event, handler, options); 10243 } 10244 function removeEventListener(el, event, handler, options) { 10245 el.removeEventListener(event, handler, options); 10246 } 10247 const veiKey = Symbol("_vei"); 10248 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 10249 const invokers = el[veiKey] || (el[veiKey] = {}); 10250 const existingInvoker = invokers[rawName];
vendor: 1,893 bytes, lines 10251-10312
10251 if (nextValue && existingInvoker) { 10252 existingInvoker.value = nextValue; 10253 } else { 10254 const [name, options] = parseName(rawName); 10255 if (nextValue) { 10256 const invoker = invokers[rawName] = createInvoker(nextValue, instance); 10257 addEventListener(el, name, invoker, options); 10258 } else if (existingInvoker) { 10259 removeEventListener(el, name, existingInvoker, options); 10260 invokers[rawName] = void 0; 10261 } 10262 } 10263 } 10264 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 10265 function parseName(name) { 10266 let options; 10267 if (optionsModifierRE.test(name)) { 10268 options = {}; 10269 let m; 10270 while (m = name.match(optionsModifierRE)) { 10271 name = name.slice(0, name.length - m[0].length); 10272 options[m[0].toLowerCase()] = true; 10273 } 10274 } 10275 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 10276 return [event, options]; 10277 } 10278 let cachedNow = 0; 10279 const p = /* @__PURE__ */ Promise.resolve(); 10280 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 10281 function createInvoker(initialValue, instance) { 10282 const invoker = (e) => { 10283 if (!e._vts) { 10284 e._vts = Date.now(); 10285 } else if (e._vts <= invoker.attached) { 10286 return; 10287 } 10288 callWithAsyncErrorHandling( 10289 patchStopImmediatePropagation(e, invoker.value), 10290 instance, 10291 5, 10292 [e] 10293 ); 10294 }; 10295 invoker.value = initialValue; 10296 invoker.attached = getNow(); 10297 return invoker; 10298 } 10299 function patchStopImmediatePropagation(e, value) { 10300 if (isArray(value)) { 10301 const originalStop = e.stopImmediatePropagation; 10302 e.stopImmediatePropagation = () => { 10303 originalStop.call(e); 10304 e._stopped = true; 10305 }; 10306 return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2)); 10307 } else { 10308 return value; 10309 } 10310 } 10311 10312 const isNativeOn = (key) =>
10312 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 10313 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 10314 const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => { 10315 const isSVG = namespace === "svg"; 10316 if (key === "class") { 10317 patchClass(el, nextValue, isSVG); 10318 } else if (key === "style") { 10319 patchStyle(el, prevValue, nextValue); 10320 } else if (isOn(key)) { 10321 if (!isModelListener(key)) { 10322 patchEvent(el, key, prevValue, nextValue, parentComponent); 10323 } 10324 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 10325 patchDOMProp( 10326 el, 10327 key, 10328 nextValue, 10329 prevChildren, 10330 parentComponent, 10331 parentSuspense, 10332 unmountChildren 10333 ); 10334 } else { 10335 if (key === "true-value") { 10336 el._trueValue = nextValue; 10337 } else if (key === "false-value") { 10338 el._falseValue = nextValue; 10339 } 10340 patchAttr(el, key, nextValue, isSVG); 10341 } 10342 }; 10343 function shouldSetAsProp(el, key, value, isSVG) { 10344 if (isSVG) { 10345 if (key === "innerHTML" || key === "textContent") { 10346 return true; 10347 } 10348 if (key in el && isNativeOn(key) && isFunction(value)) { 10349 return true; 10350 } 10351 return false; 10352 } 10353 if (key === "spellcheck" || key === "draggable" || key === "translate") { 10354 return false; 10355 } 10356 if (key === "form") { 10357 return false; 10358 } 10359 if (key === "list" && el.tagName === "INPUT") { 10360 return false; 10361 } 10362 if (key === "type" && el.tagName === "TEXTAREA") { 10363 return false; 10364 } 10365 if (key === "width" || key === "height") { 10366 const tag = el.tagName; 10367 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 10368 return false; 10369 } 10370 } 10371 if (isNativeOn(key) && isString(value)) { 10372 return false; 10373 } 10374 return key in el; 10375 } 10376 10377 /*! #__NO_SIDE_EFFECTS__ */ 10378 // @__NO_SIDE_EFFECTS__ 10379 function defineCustomElement(options, hydrate2) { 10380 const Comp = defineComponent(options); 10381 class VueCustomElement extends VueElement { 10382 constructor(initialProps) { 10383 super(Comp, initialProps, hydrate2); 10384 } 10385 } 10386 VueCustomElement.def = Comp; 10387 return VueCustomElement; 10388 } 10389 /*! #__NO_SIDE_EFFECTS__ */ 10390 const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => { 10391 return /* @__PURE__ */ defineCustomElement(options, hydrate); 10392 }; 10393 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 10394 }; 10395 class VueElement extends BaseClass { 10396 constructor(_def, _props = {}, hydrate2) { 10397 super(); 10398 this._def = _def; 10399 this._props = _props; 10400 /** 10401 * @internal 10402 */ 10403 this._instance = null; 10404 this._connected = false; 10405 this._resolved = false; 10406 this._numberProps = null; 10407 this._ob = null; 10408 if (this.shadowRoot && hydrate2) { 10409 hydrate2(this._createVNode(), this.shadowRoot); 10410 } else { 10411 if (this.shadowRoot) { 10412 warn( 10413 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 10414 ); 10415 } 10416 this.attachShadow({ mode: "open" }); 10417 if (!this._def.__asyncLoader) { 10418 this._resolveProps(this._def); 10419 } 10420 } 10421 } 10422 connectedCallback() { 10423 this._connected = true; 10424 if (!this._instance) { 10425 if (this._resolved) { 10426 this._update(); 10427 } else { 10428 this._resolveDef(); 10429 } 10430 } 10431 } 10432 disconnectedCallback() { 10433 this._connected = false; 10434 if (this._ob) { 10435 this._ob.disconnect(); 10436 this._ob = null; 10437 } 10438 nextTick(() => { 10439 if (!this._connected) { 10440 render(null, this.shadowRoot); 10441 this._instance = null; 10442 } 10443 }); 10444 } 10445 /** 10446 * resolve inner component definition (handle possible async component) 10447 */ 10448 _resolveDef() { 10449 this._resolved = true; 10450 for (let i = 0; i < this.attributes.length; i++) { 10451 this._setAttr(this.attributes[i].name); 10452 } 10453 this._ob = new MutationObserver((mutations) => { 10454 for (const m of mutations) { 10455 this._setAttr(m.attributeName); 10456 } 10457 }); 10458 this._ob.observe(this, { attributes: true }); 10459 const resolve = (def, isAsync = false) => { 10460 const { props, styles } = def; 10461 let numberProps; 10462 if (props && !isArray(props)) { 10463 for (const key in props) { 10464 const opt = props[key]; 10465 if (opt === Number || opt && opt.type === Number) { 10466 if (key in this._props) { 10467 this._props[key] = toNumber(this._props[key]); 10468 } 10469 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[
10469camelize(key)] = true; 10470 } 10471 } 10472 } 10473 this._numberProps = numberProps; 10474 if (isAsync) { 10475 this._resolveProps(def); 10476 } 10477 this._applyStyles(styles); 10478 this._update(); 10479 }; 10480 const asyncDef = this._def.__asyncLoader; 10481 if (asyncDef) { 10482 asyncDef().then((def) => resolve(def, true)); 10483 } else { 10484 resolve(this._def); 10485 } 10486 } 10487 _resolveProps(def) { 10488 const { props } = def; 10489 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 10490 for (const key of Object.keys(this)) { 10491 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 10492 this._setProp(key, this[key], true, false); 10493 } 10494 } 10495 for (const key of declaredPropKeys.map(camelize)) { 10496 Object.defineProperty(this, key, { 10497 get() { 10498 return this._getProp(key); 10499 }, 10500 set(val) { 10501 this._setProp(key, val); 10502 } 10503 }); 10504 } 10505 } 10506 _setAttr(key) { 10507 let value = this.getAttribute(key); 10508 const camelKey = camelize(key); 10509 if (this._numberProps && this._numberProps[camelKey]) { 10510 value = toNumber(value); 10511 } 10512 this._setProp(camelKey, value, false); 10513 } 10514 /** 10515 * @internal 10516 */ 10517 _getProp(key) { 10518 return this._props[key]; 10519 } 10520 /** 10521 * @internal 10522 */ 10523 _setProp(key, val, shouldReflect = true, shouldUpdate = true) { 10524 if (val !== this._props[key]) { 10525 this._props[key] = val; 10526 if (shouldUpdate && this._instance) { 10527 this._update(); 10528 } 10529 if (shouldReflect) { 10530 if (val === true) { 10531 this.setAttribute(hyphenate(key), ""); 10532 } else if (typeof val === "string" || typeof val === "number") { 10533 this.setAttribute(hyphenate(key), val + ""); 10534 } else if (!val) { 10535 this.removeAttribute(hyphenate(key)); 10536 } 10537 } 10538 } 10539 } 10540 _update() { 10541 render(this._createVNode(), this.shadowRoot); 10542 } 10543 _createVNode() { 10544 const vnode = createVNode(this._def, extend({}, this._props)); 10545 if (!this._instance) { 10546 vnode.ce = (instance) => { 10547 this._instance = instance; 10548 instance.isCE = true; 10549 { 10550 instance.ceReload = (newStyles) => { 10551 if (this._styles) { 10552 this._styles.forEach((s) => this.shadowRoot.removeChild(s)); 10553 this._styles.length = 0; 10554 } 10555 this._applyStyles(newStyles); 10556 this._instance = null; 10557 this._update(); 10558 }; 10559 } 10560 const dispatch = (event, args) => { 10561 this.dispatchEvent( 10562 new CustomEvent(event, { 10563 detail: args 10564 }) 10565 ); 10566 }; 10567 instance.emit = (event, ...args) => { 10568 dispatch(event, args); 10569 if (hyphenate(event) !== event) { 10570 dispatch(hyphenate(event), args); 10571 } 10572 }; 10573 let parent = this; 10574 while (parent = parent && (parent.parentNode || parent.host)) { 10575 if (parent instanceof VueElement) { 10576 instance.parent = parent._instance; 10577 instance.provides = parent._instance.provides; 10578 break; 10579 } 10580 } 10581 }; 10582 } 10583 return vnode; 10584 } 10585 _applyStyles(styles) { 10586 if (styles) { 10587 styles.forEach((css) => { 10588 const s = document.createElement("style"); 10589 s.textContent = css; 10590 this.shadowRoot.appendChild(s); 10591 { 10592 (this._styles || (this._styles = [])).push(s); 10593 } 10594 }); 10595 } 10596 } 10597 } 10598 10599 function useCssModule(name = "$style") { 10600 { 10601 { 10602 warn(`useCssModule() is not supported in the global build.`); 10603 } 10604 return EMPTY_OBJ; 10605 } 10606 } 10607 10608 const positionMap = /* @__PURE__ */ new WeakMap(); 10609 const newPositionMap = /* @__PURE__ */ new WeakMap(); 10610 const moveCbKey = Symbol("_moveCb"); 10611 const enterCbKey = Symbol("_enterCb"); 10612 const TransitionGroupImpl = { 10613 name: "TransitionGroup", 10614 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 10615 tag: String, 10616 moveClass: String 10617 }), 10618 setup(props, { slots }) { 10619 const instance = getCurrentInstance(); 10620 const state = useTransitionState(); 10621 let prevChildren; 10622 let children; 10623 onUpdated(() => { 10624 if (!prevChildren.length) { 10625 return; 10626 } 10627 const moveClass = props.moveClass || `${props.name || "v"}-move`; 10628 if (!hasCSSTransform( 10629 prevChildren[0].el, 10630 instance.vnode.el, 10631 moveClass 10632 )) { 10633 return; 10634 }
10635 prevChildren.forEach(callPendingCbs); 10636 prevChildren.forEach(recordPosition); 10637 const movedChildren = prevChildren.filter(applyTranslation); 10638 forceReflow(); 10639 movedChildren.forEach((c) => { 10640 const el = c.el; 10641 const style = el.style; 10642 addTransitionClass(el, moveClass); 10643 style.transform = style.webkitTransform = style.transitionDuration = ""; 10644 const cb = el[moveCbKey] = (e) => { 10645 if (e && e.target !== el) { 10646 return; 10647 } 10648 if (!e || /transform$/.test(e.propertyName)) { 10649 el.removeEventListener("transitionend", cb); 10650 el[moveCbKey] = null; 10651 removeTransitionClass(el, moveClass); 10652 } 10653 }; 10654 el.addEventListener("transitionend", cb); 10655 }); 10656 }); 10657 return () => { 10658 const rawProps = toRaw(props); 10659 const cssTransitionProps = resolveTransitionProps(rawProps); 10660 let tag = rawProps.tag || Fragment; 10661 prevChildren = children; 10662 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 10663 for (let i = 0; i < children.length; i++) { 10664 const child = children[i]; 10665 if (child.key != null) { 10666 setTransitionHooks( 10667 child, 10668 resolveTransitionHooks(child, cssTransitionProps, state, instance) 10669 ); 10670 } else { 10671 warn(`<TransitionGroup> children must be keyed.`); 10672 } 10673 } 10674 if (prevChildren) { 10675 for (let i = 0; i < prevChildren.length; i++) { 10676 const child = prevChildren[i]; 10677 setTransitionHooks( 10678 child, 10679 resolveTransitionHooks(child, cssTransitionProps, state, instance) 10680 ); 10681 positionMap.set(child, child.el.getBoundingClientRect()); 10682 } 10683 } 10684 return createVNode(tag, null, children); 10685 }; 10686 } 10687 }; 10688 const removeMode = (props) => delete props.mode; 10689 /* @__PURE__ */ removeMode(TransitionGroupImpl.props); 10690 const TransitionGroup = TransitionGroupImpl; 10691 function callPendingCbs(c) { 10692 const el = c.el; 10693 if (el[moveCbKey]) { 10694 el[moveCbKey](); 10695 } 10696 if (el[enterCbKey]) { 10697 el[enterCbKey](); 10698 } 10699 } 10700 function recordPosition(c) { 10701 newPositionMap.set(c, c.el.getBoundingClientRect()); 10702 } 10703 function applyTranslation(c) { 10704 const oldPos = positionMap.get(c); 10705 const newPos = newPositionMap.get(c); 10706 const dx = oldPos.left - newPos.left; 10707 const dy = oldPos.top - newPos.top; 10708 if (dx || dy) { 10709 const s = c.el.style; 10710 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 10711 s.transitionDuration = "0s"; 10712 return c; 10713 } 10714 } 10715 function hasCSSTransform(el, root, moveClass) { 10716 const clone = el.cloneNode(); 10717 const _vtc = el[vtcKey]; 10718 if (_vtc) { 10719 _vtc.forEach((cls) => { 10720 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 10721 }); 10722 } 10723 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 10724 clone.style.display = "none"; 10725 const container = root.nodeType === 1 ? root : root.parentNode; 10726 container.appendChild(clone); 10727 const { hasTransform } = getTransitionInfo(clone); 10728 container.removeChild(clone); 10729 return hasTransform; 10730 } 10731 10732 const getModelAssigner = (vnode) => { 10733 const fn = vnode.props["onUpdate:modelValue"] || false; 10734 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 10735 }; 10736 function onCompositionStart(e) { 10737 e.target.composing = true; 10738 } 10739 function onCompositionEnd(e) { 10740 const target = e.target; 10741 if (target.composing) { 10742 target.composing = false; 10743 target.dispatchEvent(new Event("input")); 10744 } 10745 } 10746 const assignKey = Symbol("_assign"); 10747 const vModelText = { 10748 created(el, { modifiers: { lazy, trim, number } }, vnode) { 10749 el[assignKey] = getModelAssigner(vnode); 10750 const castToNumber = number || vnode.props && vnode.props.type === "number"; 10751 addEventListener(el, lazy ? "change" : "input", (e) => { 10752 if (e.target.composing) 10753 return; 10754 let domValue = el.value; 10755 if (trim) { 10756 domValue = domValue.trim(); 10757 } 10758 if (castToNumber) { 10759 domValue = looseToNumber(domValue); 10760 } 10761 el[assignKey](domValue); 10762 }); 10763 if (trim) { 10764 addEventListener(el, "change", () => { 10765 el.value = el.value.trim(); 10766 }); 10767 } 10768 if (!lazy) { 10769 addEventListener(el, "compositionstart", onCompositionStart); 10770 addEventListener(el, "compositionend", onCompositionEnd); 10771 addEventListener(el, "change", onCompositionEnd); 10772 } 10773 }, 10774 // set value on mounted so it's after min/max for type="range" 10775 mounted(el, { value }) { 10776 el.value = value == null ? "" : value; 10777 }, 10778 beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) { 10779 el[assignKey] = getModelAssigner(vnode); 10780 if (el.composing) 10781 return; 10782 const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value; 10783 const newValue = value == null ? "" : value; 10784 if (elValue === newValue) { 10785 return; 10786 } 10787 if (document.activeElement === el && el.type !== "range") { 10788 if (lazy) { 10789 return; 10790 } 10791 if (trim && el.value.trim() === newValue) { 10792 return; 10793 } 10794 } 10795 el.value = newValue; 10796 } 10797 }; 10798 const vModelCheckbox = { 10799 // #4096 array checkboxes need to be deep traversed 10800 deep: true, 10801 created(el, _, vnode) { 10802 el[assignKey] = getModelAssigner(vnode); 10803 addEventListener(el, "change", () => { 10804 const modelValue = el._modelValue; 10805 const elementValue = getValue(el); 10806 const checked = el.checked; 10807 const assign = el[assignKey]; 10808 if (isArray(modelValue)) { 10809 const index = looseIndexOf(modelValue, elementValue); 10810 const found = index !== -1; 10811 if (checked && !found) { 10812 assign(modelValue.concat(elementValue)); 10813 } else if (!checked && found) { 10814 const filtered = [...modelValue]; 10815 filtered.splice(index, 1); 10816 assign(filtered); 10817 } 10818 } else if (isSet(modelValue)) { 10819 const cloned = new Set(modelValue); 10820 if (checked) { 10821 cloned.add(elementValue); 10822 } else { 10823 cloned.delete(elementValue); 10824 } 10825 assign(cloned); 10826 } else { 10827 assign(getCheckboxValue(el, checked)); 10828 } 10829 }); 10830 }, 10831 // set initial checked on mount to wait for true-value/false-value 10832 mounted: setChecked, 10833 beforeUpdate(el, binding, vnode) { 10834 el[assignKey] = getModelAssigner(vnode); 10835 setChecked(el, binding, vnode); 10836 } 10837 }; 10838 function setChecked(el, { value, oldValue }, vnode) { 10839 el._modelValue = value; 10840 if (isArray(value)) { 10841 el.checked = looseIndexOf(value, vnode.props.value) > -1; 10842 } else if (isSet(value)) { 10843 el.checked = value.has(vnode.props.value); 10844 } else if (value !== oldValue) { 10845 el.checked = looseEqual(value, getCheckboxValue(el, true)); 10846 } 10847 } 10848 const vModelRadio = { 10849 created(el, { value }, vnode) { 10850 el.checked = looseEqual(value, vnode.props.value); 10851 el[assignKey] = getModelAssigner(vnode); 10852 addEventListener(el, "change", () => { 10853 el[assignKey](getValue(el)); 10854 }); 10855 }, 10856 beforeUpdate(el, { value, oldValue }, vnode) { 10857 el[assignKey] = getModelAssigner(vnode); 10858 if (value !== oldValue) { 10859 el.checked = looseEqual(value, vnode.props.value); 10860 } 10861 } 10862 }; 10863 const vModelSelect = { 10864 // <select multiple> value need to be deep traversed 10865 deep: true, 10866 created(el, { value, modifiers: { number } }, vnode) { 10867 const isSetModel = isSet(value); 10868 addEventListener(el, "change", () => { 10869 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 10870 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 10871 ); 10872 el[assignKey]( 10873 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 10874 ); 10875 el._assigning = true; 10876 nextTick(() => { 10877 el._assigning = false;
vendor: 9,765 bytes, lines 10878-11170
10878 }); 10879 }); 10880 el[assignKey] = getModelAssigner(vnode); 10881 }, 10882 // set value in mounted & updated because <select> relies on its children 10883 // <option>s. 10884 mounted(el, { value, modifiers: { number } }) { 10885 setSelected(el, value, number); 10886 }, 10887 beforeUpdate(el, _binding, vnode) { 10888 el[assignKey] = getModelAssigner(vnode); 10889 }, 10890 updated(el, { value, modifiers: { number } }) { 10891 if (!el._assigning) { 10892 setSelected(el, value, number); 10893 } 10894 } 10895 }; 10896 function setSelected(el, value, number) { 10897 const isMultiple = el.multiple; 10898 const isArrayValue = isArray(value); 10899 if (isMultiple && !isArrayValue && !isSet(value)) { 10900 warn( 10901 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 10902 ); 10903 return; 10904 } 10905 for (let i = 0, l = el.options.length; i < l; i++) { 10906 const option = el.options[i]; 10907 const optionValue = getValue(option); 10908 if (isMultiple) { 10909 if (isArrayValue) { 10910 const optionType = typeof optionValue; 10911 if (optionType === "string" || optionType === "number") { 10912 option.selected = value.includes( 10913 number ? looseToNumber(optionValue) : optionValue 10914 ); 10915 } else { 10916 option.selected = looseIndexOf(value, optionValue) > -1; 10917 } 10918 } else { 10919 option.selected = value.has(optionValue); 10920 } 10921 } else if (looseEqual(getValue(option), value)) { 10922 if (el.selectedIndex !== i) 10923 el.selectedIndex = i; 10924 return; 10925 } 10926 } 10927 if (!isMultiple && el.selectedIndex !== -1) { 10928 el.selectedIndex = -1; 10929 } 10930 } 10931 function getValue(el) { 10932 return "_value" in el ? el._value : el.value; 10933 } 10934 function getCheckboxValue(el, checked) { 10935 const key = checked ? "_trueValue" : "_falseValue"; 10936 return key in el ? el[key] : checked; 10937 } 10938 const vModelDynamic = { 10939 created(el, binding, vnode) { 10940 callModelHook(el, binding, vnode, null, "created"); 10941 }, 10942 mounted(el, binding, vnode) { 10943 callModelHook(el, binding, vnode, null, "mounted"); 10944 }, 10945 beforeUpdate(el, binding, vnode, prevVNode) { 10946 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 10947 }, 10948 updated(el, binding, vnode, prevVNode) { 10949 callModelHook(el, binding, vnode, prevVNode, "updated"); 10950 } 10951 }; 10952 function resolveDynamicModel(tagName, type) { 10953 switch (tagName) { 10954 case "SELECT": 10955 return vModelSelect; 10956 case "TEXTAREA": 10957 return vModelText; 10958 default: 10959 switch (type) { 10960 case "checkbox": 10961 return vModelCheckbox; 10962 case "radio": 10963 return vModelRadio; 10964 default: 10965 return vModelText; 10966 } 10967 } 10968 } 10969 function callModelHook(el, binding, vnode, prevVNode, hook) { 10970 const modelToUse = resolveDynamicModel( 10971 el.tagName, 10972 vnode.props && vnode.props.type 10973 ); 10974 const fn = modelToUse[hook]; 10975 fn && fn(el, binding, vnode, prevVNode); 10976 } 10977 10978 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 10979 const modifierGuards = { 10980 stop: (e) => e.stopPropagation(), 10981 prevent: (e) => e.preventDefault(), 10982 self: (e) => e.target !== e.currentTarget, 10983 ctrl: (e) => !e.ctrlKey, 10984 shift: (e) => !e.shiftKey, 10985 alt: (e) => !e.altKey, 10986 meta: (e) => !e.metaKey, 10987 left: (e) => "button" in e && e.button !== 0, 10988 middle: (e) => "button" in e && e.button !== 1, 10989 right: (e) => "button" in e && e.button !== 2, 10990 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 10991 }; 10992 const withModifiers = (fn, modifiers) => { 10993 const cache = fn._withMods || (fn._withMods = {}); 10994 const cacheKey = modifiers.join("."); 10995 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => { 10996 for (let i = 0; i < modifiers.length; i++) { 10997 const guard = modifierGuards[modifiers[i]]; 10998 if (guard && guard(event, modifiers)) 10999 return; 11000 } 11001 return fn(event, ...args); 11002 }); 11003 }; 11004 const keyNames = { 11005 esc: "escape", 11006 space: " ", 11007 up: "arrow-up", 11008 left: "arrow-left", 11009 right: "arrow-right", 11010 down: "arrow-down", 11011 delete: "backspace" 11012 }; 11013 const withKeys = (fn, modifiers) => { 11014 const cache = fn._withKeys || (fn._withKeys = {}); 11015 const cacheKey = modifiers.join("."); 11016 return cache[cacheKey] || (cache[cacheKey] = (event) => { 11017 if (!("key" in event)) { 11018 return; 11019 } 11020 const eventKey = hyphenate(event.key); 11021 if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) { 11022 return fn(event); 11023 } 11024 }); 11025 }; 11026 11027 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 11028 let renderer; 11029 let enabledHydration = false; 11030 function ensureRenderer() { 11031 return renderer || (renderer = createRenderer(rendererOptions)); 11032 } 11033 function ensureHydrationRenderer() { 11034 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 11035 enabledHydration = true; 11036 return renderer; 11037 } 11038 const render = (...args) => { 11039 ensureRenderer().render(...args); 11040 }; 11041 const hydrate = (...args) => { 11042 ensureHydrationRenderer().hydrate(...args); 11043 }; 11044 const createApp = (...args) => { 11045 const app = ensureRenderer().createApp(...args); 11046 { 11047 injectNativeTagCheck(app); 11048 injectCompilerOptionsCheck(app); 11049 } 11050 const { mount } = app; 11051 app.mount = (containerOrSelector) => { 11052 const container = normalizeContainer(containerOrSelector); 11053 if (!container) 11054 return; 11055 const component = app._component; 11056 if (!isFunction(component) && !component.render && !component.template) { 11057 component.template = container.innerHTML; 11058 } 11059 container.innerHTML = ""; 11060 const proxy = mount(container, false, resolveRootNamespace(container)); 11061 if (container instanceof Element) { 11062 container.removeAttribute("v-cloak"); 11063 container.setAttribute("data-v-app", ""); 11064 } 11065 return proxy; 11066 }; 11067 return app; 11068 }; 11069 const createSSRApp = (...args) => { 11070 const app = ensureHydrationRenderer().createApp(...args); 11071 { 11072 injectNativeTagCheck(app); 11073 injectCompilerOptionsCheck(app); 11074 } 11075 const { mount } = app; 11076 app.mount = (containerOrSelector) => { 11077 const container = normalizeContainer(containerOrSelector); 11078 if (container) { 11079 return mount(container, true, resolveRootNamespace(container)); 11080 } 11081 }; 11082 return app; 11083 }; 11084 function resolveRootNamespace(container) { 11085 if (container instanceof SVGElement) { 11086 return "svg"; 11087 } 11088 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 11089 return "mathml"; 11090 } 11091 } 11092 function injectNativeTagCheck(app) { 11093 Object.defineProperty(app.config, "isNativeTag", { 11094 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 11095 writable: false 11096 }); 11097 } 11098 function injectCompilerOptionsCheck(app) { 11099 if (isRuntimeOnly()) { 11100 const isCustomElement = app.config.isCustomElement; 11101 Object.defineProperty(app.config, "isCustomElement", { 11102 get() { 11103 return isCustomElement; 11104 }, 11105 set() { 11106 warn( 11107 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 11108 ); 11109 } 11110 }); 11111 const compilerOptions = app.config.compilerOptions; 11112 const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead. 11113- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 11114- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 11115- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`; 11116 Object.defineProperty(app.config, "compilerOptions", { 11117 get() { 11118 warn(msg); 11119 return compilerOptions; 11120 }, 11121 set() { 11122 warn(msg); 11123 } 11124 }); 11125 } 11126 } 11127 function normalizeContainer(container) { 11128 if (isString(container)) { 11129 const res = document.querySelector(container); 11130 if (!res) { 11131 warn( 11132 `Failed to mount app: mount target selector "${container}" returned null.` 11133 ); 11134 } 11135 return res; 11136 } 11137 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 11138 warn( 11139 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 11140 ); 11141 } 11142 return container; 11143 } 11144 const initDirectivesForSSR = NOOP; 11145 11146 function initDev() { 11147 { 11148 { 11149 console.info( 11150 `You are running a development build of Vue. 11151Make sure to use the production build (*.prod.js) when deploying for production.` 11152 ); 11153 } 11154 initCustomFormatter(); 11155 } 11156 } 11157 11158 const FRAGMENT = Symbol(`Fragment` ); 11159 const TELEPORT = Symbol(`Teleport` ); 11160 const SUSPENSE = Symbol(`Suspense` ); 11161 const KEEP_ALIVE = Symbol(`KeepAlive` ); 11162 const BASE_TRANSITION = Symbol(`BaseTransition` ); 11163 const OPEN_BLOCK = Symbol(`openBlock` ); 11164 const CREATE_BLOCK = Symbol(`createBlock` ); 11165 const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` ); 11166 const CREATE_VNODE = Symbol(`createVNode` ); 11167 const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` ); 11168 const CREATE_COMMENT = Symbol(`createCommentVNode` ); 11169 const CREATE_TEXT = Symbol(`createTextVNode` ); 11170 const CREATE_STATIC = Symbol(`createStaticVNode` );
vendor: 38,901 bytes, lines 11171-12420
11171 const RESOLVE_COMPONENT = Symbol(`resolveComponent` ); 11172 const RESOLVE_DYNAMIC_COMPONENT = Symbol( 11173 `resolveDynamicComponent` 11174 ); 11175 const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` ); 11176 const RESOLVE_FILTER = Symbol(`resolveFilter` ); 11177 const WITH_DIRECTIVES = Symbol(`withDirectives` ); 11178 const RENDER_LIST = Symbol(`renderList` ); 11179 const RENDER_SLOT = Symbol(`renderSlot` ); 11180 const CREATE_SLOTS = Symbol(`createSlots` ); 11181 const TO_DISPLAY_STRING = Symbol(`toDisplayString` ); 11182 const MERGE_PROPS = Symbol(`mergeProps` ); 11183 const NORMALIZE_CLASS = Symbol(`normalizeClass` ); 11184 const NORMALIZE_STYLE = Symbol(`normalizeStyle` ); 11185 const NORMALIZE_PROPS = Symbol(`normalizeProps` ); 11186 const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` ); 11187 const TO_HANDLERS = Symbol(`toHandlers` ); 11188 const CAMELIZE = Symbol(`camelize` ); 11189 const CAPITALIZE = Symbol(`capitalize` ); 11190 const TO_HANDLER_KEY = Symbol(`toHandlerKey` ); 11191 const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` ); 11192 const PUSH_SCOPE_ID = Symbol(`pushScopeId` ); 11193 const POP_SCOPE_ID = Symbol(`popScopeId` ); 11194 const WITH_CTX = Symbol(`withCtx` ); 11195 const UNREF = Symbol(`unref` ); 11196 const IS_REF = Symbol(`isRef` ); 11197 const WITH_MEMO = Symbol(`withMemo` ); 11198 const IS_MEMO_SAME = Symbol(`isMemoSame` ); 11199 const helperNameMap = { 11200 [FRAGMENT]: `Fragment`, 11201 [TELEPORT]: `Teleport`, 11202 [SUSPENSE]: `Suspense`, 11203 [KEEP_ALIVE]: `KeepAlive`, 11204 [BASE_TRANSITION]: `BaseTransition`, 11205 [OPEN_BLOCK]: `openBlock`, 11206 [CREATE_BLOCK]: `createBlock`, 11207 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 11208 [CREATE_VNODE]: `createVNode`, 11209 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 11210 [CREATE_COMMENT]: `createCommentVNode`, 11211 [CREATE_TEXT]: `createTextVNode`, 11212 [CREATE_STATIC]: `createStaticVNode`, 11213 [RESOLVE_COMPONENT]: `resolveComponent`, 11214 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 11215 [RESOLVE_DIRECTIVE]: `resolveDirective`, 11216 [RESOLVE_FILTER]: `resolveFilter`, 11217 [WITH_DIRECTIVES]: `withDirectives`, 11218 [RENDER_LIST]: `renderList`, 11219 [RENDER_SLOT]: `renderSlot`, 11220 [CREATE_SLOTS]: `createSlots`, 11221 [TO_DISPLAY_STRING]: `toDisplayString`, 11222 [MERGE_PROPS]: `mergeProps`, 11223 [NORMALIZE_CLASS]: `normalizeClass`, 11224 [NORMALIZE_STYLE]: `normalizeStyle`, 11225 [NORMALIZE_PROPS]: `normalizeProps`, 11226 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 11227 [TO_HANDLERS]: `toHandlers`, 11228 [CAMELIZE]: `camelize`, 11229 [CAPITALIZE]: `capitalize`, 11230 [TO_HANDLER_KEY]: `toHandlerKey`, 11231 [SET_BLOCK_TRACKING]: `setBlockTracking`, 11232 [PUSH_SCOPE_ID]: `pushScopeId`, 11233 [POP_SCOPE_ID]: `popScopeId`, 11234 [WITH_CTX]: `withCtx`, 11235 [UNREF]: `unref`, 11236 [IS_REF]: `isRef`, 11237 [WITH_MEMO]: `withMemo`, 11238 [IS_MEMO_SAME]: `isMemoSame` 11239 }; 11240 function registerRuntimeHelpers(helpers) { 11241 Object.getOwnPropertySymbols(helpers).forEach((s) => { 11242 helperNameMap[s] = helpers[s]; 11243 }); 11244 } 11245 11246 const locStub = { 11247 start: { line: 1, column: 1, offset: 0 }, 11248 end: { line: 1, column: 1, offset: 0 }, 11249 source: "" 11250 }; 11251 function createRoot(children, source = "") { 11252 return { 11253 type: 0, 11254 source, 11255 children, 11256 helpers: /* @__PURE__ */ new Set(), 11257 components: [], 11258 directives: [], 11259 hoists: [], 11260 imports: [], 11261 cached: 0, 11262 temps: 0, 11263 codegenNode: void 0, 11264 loc: locStub 11265 }; 11266 } 11267 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 11268 if (context) { 11269 if (isBlock) { 11270 context.helper(OPEN_BLOCK); 11271 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 11272 } else { 11273 context.helper(getVNodeHelper(context.inSSR, isComponent)); 11274 } 11275 if (directives) { 11276 context.helper(WITH_DIRECTIVES); 11277 } 11278 } 11279 return { 11280 type: 13, 11281 tag, 11282 props, 11283 children, 11284 patchFlag, 11285 dynamicProps, 11286 directives, 11287 isBlock, 11288 disableTracking, 11289 isComponent, 11290 loc 11291 }; 11292 } 11293 function createArrayExpression(elements, loc = locStub) { 11294 return { 11295 type: 17, 11296 loc, 11297 elements 11298 }; 11299 } 11300 function createObjectExpression(properties, loc = locStub) { 11301 return { 11302 type: 15, 11303 loc, 11304 properties 11305 }; 11306 } 11307 function createObjectProperty(key, value) { 11308 return { 11309 type: 16, 11310 loc: locStub, 11311 key: isString(key) ? createSimpleExpression(key, true) : key, 11312 value 11313 }; 11314 } 11315 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 11316 return { 11317 type: 4, 11318 loc, 11319 content, 11320 isStatic, 11321 constType: isStatic ? 3 : constType 11322 }; 11323 } 11324 function createCompoundExpression(children, loc = locStub) { 11325 return { 11326 type: 8, 11327 loc, 11328 children 11329 }; 11330 } 11331 function createCallExpression(callee, args = [], loc = locStub) { 11332 return { 11333 type: 14, 11334 loc, 11335 callee, 11336 arguments: args 11337 }; 11338 } 11339 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 11340 return { 11341 type: 18, 11342 params, 11343 returns, 11344 newline, 11345 isSlot, 11346 loc 11347 }; 11348 } 11349 function createConditionalExpression(test, consequent, alternate, newline = true) { 11350 return { 11351 type: 19, 11352 test, 11353 consequent, 11354 alternate, 11355 newline, 11356 loc: locStub 11357 }; 11358 } 11359 function createCacheExpression(index, value, isVNode = false) { 11360 return { 11361 type: 20, 11362 index, 11363 value, 11364 isVNode, 11365 loc: locStub 11366 }; 11367 } 11368 function createBlockStatement(body) { 11369 return { 11370 type: 21, 11371 body, 11372 loc: locStub 11373 }; 11374 } 11375 function getVNodeHelper(ssr, isComponent) { 11376 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 11377 } 11378 function getVNodeBlockHelper(ssr, isComponent) { 11379 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 11380 } 11381 function convertToBlock(node, { helper, removeHelper, inSSR }) { 11382 if (!node.isBlock) { 11383 node.isBlock = true; 11384 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 11385 helper(OPEN_BLOCK); 11386 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 11387 } 11388 } 11389 11390 const defaultDelimitersOpen = new Uint8Array([123, 123]); 11391 const defaultDelimitersClose = new Uint8Array([125, 125]); 11392 function isTagStartChar(c) { 11393 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 11394 } 11395 function isWhitespace(c) { 11396 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 11397 } 11398 function isEndOfTagSection(c) { 11399 return c === 47 || c === 62 || isWhitespace(c); 11400 } 11401 function toCharCodes(str) { 11402 const ret = new Uint8Array(str.length); 11403 for (let i = 0; i < str.length; i++) { 11404 ret[i] = str.charCodeAt(i); 11405 } 11406 return ret; 11407 } 11408 const Sequences = { 11409 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 11410 // CDATA[ 11411 CdataEnd: new Uint8Array([93, 93, 62]), 11412 // ]]> 11413 CommentEnd: new Uint8Array([45, 45, 62]), 11414 // `-->` 11415 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 11416 // `<\/script` 11417 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 11418 // `</style` 11419 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 11420 // `</title` 11421 TextareaEnd: new Uint8Array([ 11422 60, 11423 47, 11424 116, 11425 101, 11426 120, 11427 116, 11428 97, 11429 114, 11430 101, 11431 97 11432 ]) 11433 // `</textarea 11434 }; 11435 class Tokenizer { 11436 constructor(stack, cbs) { 11437 this.stack = stack; 11438 this.cbs = cbs; 11439 /** The current state the tokenizer is in. */ 11440 this.state = 1; 11441 /** The read buffer. */ 11442 this.buffer = ""; 11443 /** The beginning of the section that is currently being read. */ 11444 this.sectionStart = 0; 11445 /** The index within the buffer that we are currently looking at. */ 11446 this.index = 0; 11447 /** The start of the last entity. */ 11448 this.entityStart = 0; 11449 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 11450 this.baseState = 1; 11451 /** For special parsing behavior inside of script and style tags. */ 11452 this.inRCDATA = false; 11453 /** For disabling RCDATA tags handling */ 11454 this.inXML = false; 11455 /** For disabling interpolation parsing in v-pre */ 11456 this.inVPre = false; 11457 /** Record newline positions for fast line / column calculation */ 11458 this.newlines = []; 11459 this.mode = 0; 11460 this.delimiterOpen = defaultDelimitersOpen; 11461 this.delimiterClose = defaultDelimitersClose; 11462 this.delimiterIndex = -1; 11463 this.currentSequence = void 0; 11464 this.sequenceIndex = 0; 11465 } 11466 get inSFCRoot() { 11467 return this.mode === 2 && this.stack.length === 0; 11468 } 11469 reset() { 11470 this.state = 1; 11471 this.mode = 0; 11472 this.buffer = ""; 11473 this.sectionStart = 0; 11474 this.index = 0; 11475 this.baseState = 1; 11476 this.inRCDATA = false; 11477 this.currentSequence = void 0; 11478 this.newlines.length = 0; 11479 this.delimiterOpen = defaultDelimitersOpen; 11480 this.delimiterClose = defaultDelimitersClose; 11481 } 11482 /** 11483 * Generate Position object with line / column information using recorded 11484 * newline positions. We know the index is always going to be an already 11485 * processed index, so all the newlines up to this index should have been 11486 * recorded. 11487 */ 11488 getPos(index) { 11489 let line = 1; 11490 let column = index + 1; 11491 for (let i = this.newlines.length - 1; i >= 0; i--) { 11492 const newlineIndex = this.newlines[i]; 11493 if (index > newlineIndex) { 11494 line = i + 2; 11495 column = index - newlineIndex; 11496 break; 11497 } 11498 } 11499 return { 11500 column, 11501 line, 11502 offset: index 11503 }; 11504 } 11505 peek() { 11506 return this.buffer.charCodeAt(this.index + 1); 11507 } 11508 stateText(c) { 11509 if (c === 60) { 11510 if (this.index > this.sectionStart) { 11511 this.cbs.ontext(this.sectionStart, this.index); 11512 } 11513 this.state = 5; 11514 this.sectionStart = this.index; 11515 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 11516 this.state = 2; 11517 this.delimiterIndex = 0; 11518 this.stateInterpolationOpen(c); 11519 } 11520 } 11521 stateInterpolationOpen(c) { 11522 if (c === this.delimiterOpen[this.delimiterIndex]) { 11523 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 11524 const start = this.index + 1 - this.delimiterOpen.length; 11525 if (start > this.sectionStart) { 11526 this.cbs.ontext(this.sectionStart, start); 11527 } 11528 this.state = 3; 11529 this.sectionStart = start; 11530 } else { 11531 this.delimiterIndex++; 11532 } 11533 } else if (this.inRCDATA) { 11534 this.state = 32; 11535 this.stateInRCDATA(c); 11536 } else { 11537 this.state = 1; 11538 this.stateText(c); 11539 } 11540 } 11541 stateInterpolation(c) { 11542 if (c === this.delimiterClose[0]) { 11543 this.state = 4; 11544 this.delimiterIndex = 0; 11545 this.stateInterpolationClose(c); 11546 } 11547 } 11548 stateInterpolationClose(c) { 11549 if (c === this.delimiterClose[this.delimiterIndex]) { 11550 if (this.delimiterIndex === this.delimiterClose.length - 1) { 11551 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 11552 if (this.inRCDATA) { 11553 this.state = 32; 11554 } else { 11555 this.state = 1; 11556 } 11557 this.sectionStart = this.index + 1; 11558 } else { 11559 this.delimiterIndex++; 11560 } 11561 } else { 11562 this.state = 3; 11563 this.stateInterpolation(c); 11564 } 11565 } 11566 stateSpecialStartSequence(c) { 11567 const isEnd = this.sequenceIndex === this.currentSequence.length; 11568 const isMatch = isEnd ? ( 11569 // If we are at the end of the sequence, make sure the tag name has ended 11570 isEndOfTagSection(c) 11571 ) : ( 11572 // Otherwise, do a case-insensitive comparison 11573 (c | 32) === this.currentSequence[this.sequenceIndex] 11574 ); 11575 if (!isMatch) { 11576 this.inRCDATA = false; 11577 } else if (!isEnd) { 11578 this.sequenceIndex++; 11579 return; 11580 } 11581 this.sequenceIndex = 0; 11582 this.state = 6; 11583 this.stateInTagName(c); 11584 } 11585 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 11586 stateInRCDATA(c) { 11587 if (this.sequenceIndex === this.currentSequence.length) { 11588 if (c === 62 || isWhitespace(c)) { 11589 const endOfText = this.index - this.currentSequence.length; 11590 if (this.sectionStart < endOfText) { 11591 const actualIndex = this.index; 11592 this.index = endOfText; 11593 this.cbs.ontext(this.sectionStart, endOfText); 11594 this.index = actualIndex; 11595 } 11596 this.sectionStart = endOfText + 2; 11597 this.stateInClosingTagName(c); 11598 this.inRCDATA = false; 11599 return; 11600 } 11601 this.sequenceIndex = 0; 11602 } 11603 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 11604 this.sequenceIndex += 1; 11605 } else if (this.sequenceIndex === 0) { 11606 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 11607 if (c === this.delimiterOpen[0]) { 11608 this.state = 2; 11609 this.delimiterIndex = 0; 11610 this.stateInterpolationOpen(c); 11611 } 11612 } else if (this.fastForwardTo(60)) { 11613 this.sequenceIndex = 1; 11614 } 11615 } else { 11616 this.sequenceIndex = Number(c === 60); 11617 } 11618 } 11619 stateCDATASequence(c) { 11620 if (c === Sequences.Cdata[this.sequenceIndex]) { 11621 if (++this.sequenceIndex === Sequences.Cdata.length) { 11622 this.state = 28; 11623 this.currentSequence = Sequences.CdataEnd; 11624 this.sequenceIndex = 0; 11625 this.sectionStart = this.index + 1; 11626 } 11627 } else { 11628 this.sequenceIndex = 0; 11629 this.state = 23; 11630 this.stateInDeclaration(c); 11631 } 11632 } 11633 /** 11634 * When we wait for one specific character, we can speed things up 11635 * by skipping through the buffer until we find it. 11636 * 11637 * @returns Whether the character was found. 11638 */ 11639 fastForwardTo(c) { 11640 while (++this.index < this.buffer.length) { 11641 const cc = this.buffer.charCodeAt(this.index); 11642 if (cc === 10) { 11643 this.newlines.push(this.index); 11644 } 11645 if (cc === c) { 11646 return true; 11647 } 11648 } 11649 this.index = this.buffer.length - 1; 11650 return false; 11651 } 11652 /** 11653 * Comments and CDATA end with `-->` and `]]>`. 11654 * 11655 * Their common qualities are: 11656 * - Their end sequences have a distinct character they start with. 11657 * - That character is then repeated, so we have to check multiple repeats. 11658 * - All characters but the start character of the sequence can be skipped. 11659 */ 11660 stateInCommentLike(c) { 11661 if (c === this.currentSequence[this.sequenceIndex]) { 11662 if (++this.sequenceIndex === this.currentSequence.length) { 11663 if (this.currentSequence === Sequences.CdataEnd) { 11664 this.cbs.oncdata(this.sectionStart, this.index - 2); 11665 } else { 11666 this.cbs.oncomment(this.sectionStart, this.index - 2); 11667 } 11668 this.sequenceIndex = 0; 11669 this.sectionStart = this.index + 1; 11670 this.state = 1; 11671 } 11672 } else if (this.sequenceIndex === 0) { 11673 if (this.fastForwardTo(this.currentSequence[0])) { 11674 this.sequenceIndex = 1; 11675 } 11676 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 11677 this.sequenceIndex = 0; 11678 } 11679 } 11680 startSpecial(sequence, offset) { 11681 this.enterRCDATA(sequence, offset); 11682 this.state = 31; 11683 } 11684 enterRCDATA(sequence, offset) { 11685 this.inRCDATA = true; 11686 this.currentSequence = sequence; 11687 this.sequenceIndex = offset; 11688 } 11689 stateBeforeTagName(c) { 11690 if (c === 33) { 11691 this.state = 22; 11692 this.sectionStart = this.index + 1; 11693 } else if (c === 63) { 11694 this.state = 24; 11695 this.sectionStart = this.index + 1; 11696 } else if (isTagStartChar(c)) { 11697 this.sectionStart = this.index; 11698 if (this.mode === 0) { 11699 this.state = 6; 11700 } else if (this.inSFCRoot) { 11701 this.state = 34; 11702 } else if (!this.inXML) { 11703 if (c === 116) { 11704 this.state = 30; 11705 } else { 11706 this.state = c === 115 ? 29 : 6; 11707 } 11708 } else { 11709 this.state = 6; 11710 } 11711 } else if (c === 47) { 11712 this.state = 8; 11713 } else { 11714 this.state = 1; 11715 this.stateText(c); 11716 } 11717 } 11718 stateInTagName(c) { 11719 if (isEndOfTagSection(c)) { 11720 this.handleTagName(c); 11721 } 11722 } 11723 stateInSFCRootTagName(c) { 11724 if (isEndOfTagSection(c)) { 11725 const tag = this.buffer.slice(this.sectionStart, this.index); 11726 if (tag !== "template") { 11727 this.enterRCDATA(toCharCodes(`</` + tag), 0); 11728 } 11729 this.handleTagName(c); 11730 } 11731 } 11732 handleTagName(c) { 11733 this.cbs.onopentagname(this.sectionStart, this.index); 11734 this.sectionStart = -1; 11735 this.state = 11; 11736 this.stateBeforeAttrName(c); 11737 } 11738 stateBeforeClosingTagName(c) { 11739 if (isWhitespace(c)) ; else if (c === 62) { 11740 { 11741 this.cbs.onerr(14, this.index); 11742 } 11743 this.state = 1; 11744 this.sectionStart = this.index + 1; 11745 } else { 11746 this.state = isTagStartChar(c) ? 9 : 27; 11747 this.sectionStart = this.index; 11748 } 11749 } 11750 stateInClosingTagName(c) { 11751 if (c === 62 || isWhitespace(c)) { 11752 this.cbs.onclosetag(this.sectionStart, this.index); 11753 this.sectionStart = -1; 11754 this.state = 10; 11755 this.stateAfterClosingTagName(c); 11756 } 11757 } 11758 stateAfterClosingTagName(c) { 11759 if (c === 62) { 11760 this.state = 1; 11761 this.sectionStart = this.index + 1; 11762 } 11763 } 11764 stateBeforeAttrName(c) { 11765 if (c === 62) { 11766 this.cbs.onopentagend(this.index); 11767 if (this.inRCDATA) { 11768 this.state = 32; 11769 } else { 11770 this.state = 1; 11771 } 11772 this.sectionStart = this.index + 1; 11773 } else if (c === 47) { 11774 this.state = 7; 11775 if (this.peek() !== 62) { 11776 this.cbs.onerr(22, this.index); 11777 } 11778 } else if (c === 60 && this.peek() === 47) { 11779 this.cbs.onopentagend(this.index); 11780 this.state = 5; 11781 this.sectionStart = this.index; 11782 } else if (!isWhitespace(c)) { 11783 if (c === 61) { 11784 this.cbs.onerr( 11785 19, 11786 this.index 11787 ); 11788 } 11789 this.handleAttrStart(c); 11790 } 11791 } 11792 handleAttrStart(c) { 11793 if (c === 118 && this.peek() === 45) { 11794 this.state = 13; 11795 this.sectionStart = this.index; 11796 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 11797 this.cbs.ondirname(this.index, this.index + 1); 11798 this.state = 14; 11799 this.sectionStart = this.index + 1; 11800 } else { 11801 this.state = 12; 11802 this.sectionStart = this.index; 11803 } 11804 } 11805 stateInSelfClosingTag(c) { 11806 if (c === 62) { 11807 this.cbs.onselfclosingtag(this.index); 11808 this.state = 1; 11809 this.sectionStart = this.index + 1; 11810 this.inRCDATA = false; 11811 } else if (!isWhitespace(c)) { 11812 this.state = 11; 11813 this.stateBeforeAttrName(c); 11814 } 11815 } 11816 stateInAttrName(c) { 11817 if (c === 61 || isEndOfTagSection(c)) { 11818 this.cbs.onattribname(this.sectionStart, this.index); 11819 this.handleAttrNameEnd(c); 11820 } else if (c === 34 || c === 39 || c === 60) { 11821 this.cbs.onerr( 11822 17, 11823 this.index 11824 ); 11825 } 11826 } 11827 stateInDirName(c) { 11828 if (c === 61 || isEndOfTagSection(c)) { 11829 this.cbs.ondirname(this.sectionStart, this.index); 11830 this.handleAttrNameEnd(c); 11831 } else if (c === 58) { 11832 this.cbs.ondirname(this.sectionStart, this.index); 11833 this.state = 14; 11834 this.sectionStart = this.index + 1; 11835 } else if (c === 46) { 11836 this.cbs.ondirname(this.sectionStart, this.index); 11837 this.state = 16; 11838 this.sectionStart = this.index + 1; 11839 } 11840 } 11841 stateInDirArg(c) { 11842 if (c === 61 || isEndOfTagSection(c)) { 11843 this.cbs.ondirarg(this.sectionStart, this.index); 11844 this.handleAttrNameEnd(c); 11845 } else if (c === 91) { 11846 this.state = 15; 11847 } else if (c === 46) { 11848 this.cbs.ondirarg(this.sectionStart, this.index); 11849 this.state = 16; 11850 this.sectionStart = this.index + 1; 11851 } 11852 } 11853 stateInDynamicDirArg(c) { 11854 if (c === 93) { 11855 this.state = 14; 11856 } else if (c === 61 || isEndOfTagSection(c)) { 11857 this.cbs.ondirarg(this.sectionStart, this.index + 1); 11858 this.handleAttrNameEnd(c); 11859 { 11860 this.cbs.onerr( 11861 27, 11862 this.index 11863 ); 11864 } 11865 } 11866 } 11867 stateInDirModifier(c) { 11868 if (c === 61 || isEndOfTagSection(c)) { 11869 this.cbs.ondirmodifier(this.sectionStart, this.index); 11870 this.handleAttrNameEnd(c); 11871 } else if (c === 46) { 11872 this.cbs.ondirmodifier(this.sectionStart, this.index); 11873 this.sectionStart = this.index + 1; 11874 } 11875 } 11876 handleAttrNameEnd(c) { 11877 this.sectionStart = this.index; 11878 this.state = 17; 11879 this.cbs.onattribnameend(this.index); 11880 this.stateAfterAttrName(c); 11881 } 11882 stateAfterAttrName(c) { 11883 if (c === 61) { 11884 this.state = 18; 11885 } else if (c === 47 || c === 62) { 11886 this.cbs.onattribend(0, this.sectionStart); 11887 this.sectionStart = -1; 11888 this.state = 11; 11889 this.stateBeforeAttrName(c); 11890 } else if (!isWhitespace(c)) { 11891 this.cbs.onattribend(0, this.sectionStart); 11892 this.handleAttrStart(c); 11893 } 11894 } 11895 stateBeforeAttrValue(c) { 11896 if (c === 34) { 11897 this.state = 19; 11898 this.sectionStart = this.index + 1; 11899 } else if (c === 39) { 11900 this.state = 20; 11901 this.sectionStart = this.index + 1; 11902 } else if (!isWhitespace(c)) { 11903 this.sectionStart = this.index; 11904 this.state = 21; 11905 this.stateInAttrValueNoQuotes(c); 11906 } 11907 } 11908 handleInAttrValue(c, quote) { 11909 if (c === quote || this.fastForwardTo(quote)) { 11910 this.cbs.onattribdata(this.sectionStart, this.index); 11911 this.sectionStart = -1; 11912 this.cbs.onattribend( 11913 quote === 34 ? 3 : 2, 11914 this.index + 1 11915 ); 11916 this.state = 11; 11917 } 11918 } 11919 stateInAttrValueDoubleQuotes(c) { 11920 this.handleInAttrValue(c, 34); 11921 } 11922 stateInAttrValueSingleQuotes(c) { 11923 this.handleInAttrValue(c, 39); 11924 } 11925 stateInAttrValueNoQuotes(c) { 11926 if (isWhitespace(c) || c === 62) { 11927 this.cbs.onattribdata(this.sectionStart, this.index); 11928 this.sectionStart = -1; 11929 this.cbs.onattribend(1, this.index); 11930 this.state = 11; 11931 this.stateBeforeAttrName(c); 11932 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 11933 this.cbs.onerr( 11934 18, 11935 this.index 11936 ); 11937 } else ; 11938 } 11939 stateBeforeDeclaration(c) { 11940 if (c === 91) { 11941 this.state = 26; 11942 this.sequenceIndex = 0; 11943 } else { 11944 this.state = c === 45 ? 25 : 23; 11945 } 11946 } 11947 stateInDeclaration(c) { 11948 if (c === 62 || this.fastForwardTo(62)) { 11949 this.state = 1; 11950 this.sectionStart = this.index + 1; 11951 } 11952 } 11953 stateInProcessingInstruction(c) { 11954 if (c === 62 || this.fastForwardTo(62)) { 11955 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 11956 this.state = 1; 11957 this.sectionStart = this.index + 1; 11958 } 11959 } 11960 stateBeforeComment(c) { 11961 if (c === 45) { 11962 this.state = 28; 11963 this.currentSequence = Sequences.CommentEnd; 11964 this.sequenceIndex = 2; 11965 this.sectionStart = this.index + 1; 11966 } else { 11967 this.state = 23; 11968 } 11969 } 11970 stateInSpecialComment(c) { 11971 if (c === 62 || this.fastForwardTo(62)) { 11972 this.cbs.oncomment(this.sectionStart, this.index); 11973 this.state = 1; 11974 this.sectionStart = this.index + 1; 11975 } 11976 } 11977 stateBeforeSpecialS(c) { 11978 if (c === Sequences.ScriptEnd[3]) { 11979 this.startSpecial(Sequences.ScriptEnd, 4); 11980 } else if (c === Sequences.StyleEnd[3]) { 11981 this.startSpecial(Sequences.StyleEnd, 4); 11982 } else { 11983 this.state = 6; 11984 this.stateInTagName(c); 11985 } 11986 } 11987 stateBeforeSpecialT(c) { 11988 if (c === Sequences.TitleEnd[3]) { 11989 this.startSpecial(Sequences.TitleEnd, 4); 11990 } else if (c === Sequences.TextareaEnd[3]) { 11991 this.startSpecial(Sequences.TextareaEnd, 4); 11992 } else { 11993 this.state = 6; 11994 this.stateInTagName(c); 11995 } 11996 } 11997 startEntity() { 11998 } 11999 stateInEntity() { 12000 } 12001 /** 12002 * Iterates through the buffer, calling the function corresponding to the current state. 12003 * 12004 * States that are more likely to be hit are higher up, as a performance improvement. 12005 */ 12006 parse(input) { 12007 this.buffer = input; 12008 while (this.index < this.buffer.length) { 12009 const c = this.buffer.charCodeAt(this.index); 12010 if (c === 10) { 12011 this.newlines.push(this.index); 12012 } 12013 switch (this.state) { 12014 case 1: { 12015 this.stateText(c); 12016 break; 12017 } 12018 case 2: { 12019 this.stateInterpolationOpen(c); 12020 break; 12021 } 12022 case 3: { 12023 this.stateInterpolation(c); 12024 break; 12025 } 12026 case 4: { 12027 this.stateInterpolationClose(c); 12028 break; 12029 } 12030 case 31: { 12031 this.stateSpecialStartSequence(c); 12032 break; 12033 } 12034 case 32: { 12035 this.stateInRCDATA(c); 12036 break; 12037 } 12038 case 26: { 12039 this.stateCDATASequence(c); 12040 break; 12041 } 12042 case 19: { 12043 this.stateInAttrValueDoubleQuotes(c); 12044 break; 12045 } 12046 case 12: { 12047 this.stateInAttrName(c); 12048 break; 12049 } 12050 case 13: { 12051 this.stateInDirName(c); 12052 break; 12053 } 12054 case 14: { 12055 this.stateInDirArg(c); 12056 break; 12057 } 12058 case 15: { 12059 this.stateInDynamicDirArg(c); 12060 break; 12061 } 12062 case 16: { 12063 this.stateInDirModifier(c); 12064 break; 12065 } 12066 case 28: { 12067 this.stateInCommentLike(c); 12068 break; 12069 } 12070 case 27: { 12071 this.stateInSpecialComment(c); 12072 break; 12073 } 12074 case 11: { 12075 this.stateBeforeAttrName(c); 12076 break; 12077 } 12078 case 6: { 12079 this.stateInTagName(c); 12080 break; 12081 } 12082 case 34: { 12083 this.stateInSFCRootTagName(c); 12084 break; 12085 } 12086 case 9: { 12087 this.stateInClosingTagName(c); 12088 break; 12089 } 12090 case 5: { 12091 this.stateBeforeTagName(c); 12092 break; 12093 } 12094 case 17: { 12095 this.stateAfterAttrName(c); 12096 break; 12097 } 12098 case 20: { 12099 this.stateInAttrValueSingleQuotes(c); 12100 break; 12101 } 12102 case 18: { 12103 this.stateBeforeAttrValue(c); 12104 break; 12105 } 12106 case 8: { 12107 this.stateBeforeClosingTagName(c); 12108 break; 12109 } 12110 case 10: { 12111 this.stateAfterClosingTagName(c); 12112 break; 12113 } 12114 case 29: { 12115 this.stateBeforeSpecialS(c); 12116 break; 12117 } 12118 case 30: { 12119 this.stateBeforeSpecialT(c); 12120 break; 12121 } 12122 case 21: { 12123 this.stateInAttrValueNoQuotes(c); 12124 break; 12125 } 12126 case 7: { 12127 this.stateInSelfClosingTag(c); 12128 break; 12129 } 12130 case 23: { 12131 this.stateInDeclaration(c); 12132 break; 12133 } 12134 case 22: { 12135 this.stateBeforeDeclaration(c); 12136 break; 12137 } 12138 case 25: { 12139 this.stateBeforeComment(c); 12140 break; 12141 } 12142 case 24: { 12143 this.stateInProcessingInstruction(c); 12144 break; 12145 } 12146 case 33: { 12147 this.stateInEntity(); 12148 break; 12149 } 12150 } 12151 this.index++; 12152 } 12153 this.cleanup(); 12154 this.finish(); 12155 } 12156 /** 12157 * Remove data that has already been consumed from the buffer. 12158 */ 12159 cleanup() { 12160 if (this.sectionStart !== this.index) { 12161 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 12162 this.cbs.ontext(this.sectionStart, this.index); 12163 this.sectionStart = this.index; 12164 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 12165 this.cbs.onattribdata(this.sectionStart, this.index); 12166 this.sectionStart = this.index; 12167 } 12168 } 12169 } 12170 finish() { 12171 this.handleTrailingData(); 12172 this.cbs.onend(); 12173 } 12174 /** Handle any trailing data. */ 12175 handleTrailingData() { 12176 const endIndex = this.buffer.length; 12177 if (this.sectionStart >= endIndex) { 12178 return; 12179 } 12180 if (this.state === 28) { 12181 if (this.currentSequence === Sequences.CdataEnd) { 12182 this.cbs.oncdata(this.sectionStart, endIndex); 12183 } else { 12184 this.cbs.oncomment(this.sectionStart, endIndex); 12185 } 12186 } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else { 12187 this.cbs.ontext(this.sectionStart, endIndex); 12188 } 12189 } 12190 emitCodePoint(cp, consumed) { 12191 } 12192 } 12193 12194 function defaultOnError(error) { 12195 throw error; 12196 } 12197 function defaultOnWarn(msg) { 12198 console.warn(`[Vue warn] ${msg.message}`); 12199 } 12200 function createCompilerError(code, loc, messages, additionalMessage) { 12201 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ; 12202 const error = new SyntaxError(String(msg)); 12203 error.code = code; 12204 error.loc = loc; 12205 return error; 12206 } 12207 const errorMessages = { 12208 // parse errors 12209 [0]: "Illegal comment.", 12210 [1]: "CDATA section is allowed only in XML context.", 12211 [2]: "Duplicate attribute.", 12212 [3]: "End tag cannot have attributes.", 12213 [4]: "Illegal '/' in tags.", 12214 [5]: "Unexpected EOF in tag.", 12215 [6]: "Unexpected EOF in CDATA section.", 12216 [7]: "Unexpected EOF in comment.", 12217 [8]: "Unexpected EOF in script.", 12218 [9]: "Unexpected EOF in tag.", 12219 [10]: "Incorrectly closed comment.", 12220 [11]: "Incorrectly opened comment.", 12221 [12]: "Illegal tag name. Use '<' to print '<'.", 12222 [13]: "Attribute value was expected.", 12223 [14]: "End tag name was expected.", 12224 [15]: "Whitespace was expected.", 12225 [16]: "Unexpected '<!--' in comment.", 12226 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 12227 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 12228 [19]: "Attribute name cannot start with '='.", 12229 [21]: "'<?' is allowed only in XML context.", 12230 [20]: `Unexpected null character.`, 12231 [22]: "Illegal '/' in tags.", 12232 // Vue-specific parse errors 12233 [23]: "Invalid end tag.", 12234 [24]: "Element is missing end tag.", 12235 [25]: "Interpolation end sign was not found.", 12236 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 12237 [26]: "Legal directive name was expected.", 12238 // transform errors 12239 [28]: `v-if/v-else-if is missing expression.`, 12240 [29]: `v-if/else branches must use unique keys.`, 12241 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 12242 [31]: `v-for is missing expression.`, 12243 [32]: `v-for has invalid expression.`, 12244 [33]: `<template v-for> key should be placed on the <template> tag.`, 12245 [34]: `v-bind is missing expression.`, 12246 [52]: `v-bind with same-name shorthand only allows static argument.`, 12247 [35]: `v-on is missing expression.`, 12248 [36]: `Unexpected custom directive on <slot> outlet.`, 12249 [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`, 12250 [38]: `Duplicate slot names found. `, 12251 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 12252 [40]: `v-slot can only be used on components or <template> tags.`, 12253 [41]: `v-model is missing expression.`, 12254 [42]: `v-model value must be a valid JavaScript member expression.`, 12255 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 12256 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 12257Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 12258 [45]: `Error parsing JavaScript expression: `, 12259 [46]: `<KeepAlive> expects exactly one child component.`, 12260 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`, 12261 // generic errors 12262 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 12263 [48]: `ES module mode is not supported in this build of compiler.`, 12264 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 12265 [50]: `"scopeId" option is only supported in module mode.`, 12266 // just to fulfill types 12267 [53]: `` 12268 }; 12269 12270 const isStaticExp = (p) => p.type === 4 && p.isStatic; 12271 function isCoreComponent(tag) { 12272 switch (tag) { 12273 case "Teleport": 12274 case "teleport": 12275 return TELEPORT; 12276 case "Suspense": 12277 case "suspense": 12278 return SUSPENSE; 12279 case "KeepAlive": 12280 case "keep-alive": 12281 return KEEP_ALIVE; 12282 case "BaseTransition": 12283 case "base-transition": 12284 return BASE_TRANSITION; 12285 } 12286 } 12287 const nonIdentifierRE = /^\d|[^\$\w]/; 12288 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 12289 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 12290 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 12291 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 12292 const isMemberExpressionBrowser = (path) => { 12293 path = path.trim().replace(whitespaceRE, (s) => s.trim()); 12294 let state = 0 /* inMemberExp */; 12295 let stateStack = []; 12296 let currentOpenBracketCount = 0; 12297 let currentOpenParensCount = 0; 12298 let currentStringType = null; 12299 for (let i = 0; i < path.length; i++) { 12300 const char = path.charAt(i); 12301 switch (state) { 12302 case 0 /* inMemberExp */: 12303 if (char === "[") { 12304 stateStack.push(state); 12305 state = 1 /* inBrackets */; 12306 currentOpenBracketCount++; 12307 } else if (char === "(") { 12308 stateStack.push(state); 12309 state = 2 /* inParens */; 12310 currentOpenParensCount++; 12311 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 12312 return false; 12313 } 12314 break; 12315 case 1 /* inBrackets */: 12316 if (char === `'` || char === `"` || char === "`") { 12317 stateStack.push(state); 12318 state = 3 /* inString */; 12319 currentStringType = char; 12320 } else if (char === `[`) { 12321 currentOpenBracketCount++; 12322 } else if (char === `]`) { 12323 if (!--currentOpenBracketCount) { 12324 state = stateStack.pop(); 12325 } 12326 } 12327 break; 12328 case 2 /* inParens */: 12329 if (char === `'` || char === `"` || char === "`") { 12330 stateStack.push(state); 12331 state = 3 /* inString */; 12332 currentStringType = char; 12333 } else if (char === `(`) { 12334 currentOpenParensCount++; 12335 } else if (char === `)`) { 12336 if (i === path.length - 1) { 12337 return false; 12338 } 12339 if (!--currentOpenParensCount) { 12340 state = stateStack.pop(); 12341 } 12342 } 12343 break; 12344 case 3 /* inString */: 12345 if (char === currentStringType) { 12346 state = stateStack.pop(); 12347 currentStringType = null; 12348 } 12349 break; 12350 } 12351 } 12352 return !currentOpenBracketCount && !currentOpenParensCount; 12353 }; 12354 const isMemberExpression = isMemberExpressionBrowser ; 12355 function assert(condition, msg) { 12356 if (!condition) { 12357 throw new Error(msg || `unexpected compiler condition`); 12358 } 12359 } 12360 function findDir(node, name, allowEmpty = false) { 12361 for (let i = 0; i < node.props.length; i++) { 12362 const p = node.props[i]; 12363 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 12364 return p; 12365 } 12366 } 12367 } 12368 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 12369 for (let i = 0; i < node.props.length; i++) { 12370 const p = node.props[i]; 12371 if (p.type === 6) { 12372 if (dynamicOnly) 12373 continue; 12374 if (p.name === name && (p.value || allowEmpty)) { 12375 return p; 12376 } 12377 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 12378 return p; 12379 } 12380 } 12381 } 12382 function isStaticArgOf(arg, name) { 12383 return !!(arg && isStaticExp(arg) && arg.content === name); 12384 } 12385 function hasDynamicKeyVBind(node) { 12386 return node.props.some( 12387 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 12388 p.arg.type !== 4 || // v-bind:[_ctx.foo] 12389 !p.arg.isStatic) 12390 // v-bind:[foo] 12391 ); 12392 } 12393 function isText$1(node) { 12394 return node.type === 5 || node.type === 2; 12395 } 12396 function isVSlot(p) { 12397 return p.type === 7 && p.name === "slot"; 12398 } 12399 function isTemplateNode(node) { 12400 return node.type === 1 && node.tagType === 3; 12401 } 12402 function isSlotOutlet(node) { 12403 return node.type === 1 && node.tagType === 2; 12404 } 12405 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]); 12406 function getUnnormalizedProps(props, callPath = []) { 12407 if (props && !isString(props) && props.type === 14) { 12408 const callee = props.callee; 12409 if (!isString(callee) && propsHelperSet.has(callee)) { 12410 return getUnnormalizedProps( 12411 props.arguments[0], 12412 callPath.concat(props) 12413 ); 12414 } 12415 } 12416 return [props, callPath]; 12417 } 12418 function injectProp(node, prop, context) { 12419 let propsWithInjection; 12420 let props = node.type === 13 ? node.props : node.arguments[2];
vendor: 1,794 bytes, lines 12421-12477
12421 let callPath = []; 12422 let parentCall; 12423 if (props && !isString(props) && props.type === 14) { 12424 const ret = getUnnormalizedProps(props); 12425 props = ret[0]; 12426 callPath = ret[1]; 12427 parentCall = callPath[callPath.length - 1]; 12428 } 12429 if (props == null || isString(props)) { 12430 propsWithInjection = createObjectExpression([prop]); 12431 } else if (props.type === 14) { 12432 const first = props.arguments[0]; 12433 if (!isString(first) && first.type === 15) { 12434 if (!hasProp(prop, first)) { 12435 first.properties.unshift(prop); 12436 } 12437 } else { 12438 if (props.callee === TO_HANDLERS) { 12439 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 12440 createObjectExpression([prop]), 12441 props 12442 ]); 12443 } else { 12444 props.arguments.unshift(createObjectExpression([prop])); 12445 } 12446 } 12447 !propsWithInjection && (propsWithInjection = props); 12448 } else if (props.type === 15) { 12449 if (!hasProp(prop, props)) { 12450 props.properties.unshift(prop); 12451 } 12452 propsWithInjection = props; 12453 } else { 12454 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 12455 createObjectExpression([prop]), 12456 props 12457 ]); 12458 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 12459 parentCall = callPath[callPath.length - 2]; 12460 } 12461 } 12462 if (node.type === 13) { 12463 if (parentCall) { 12464 parentCall.arguments[0] = propsWithInjection; 12465 } else { 12466 node.props = propsWithInjection; 12467 } 12468 } else { 12469 if (parentCall) { 12470 parentCall.arguments[0] = propsWithInjection; 12471 } else { 12472 node.arguments[2] = propsWithInjection; 12473 } 12474 } 12475 } 12476 function hasProp(prop, props) { 12477 let result = false;
vendor: 15,390 bytes, lines 12478-12999
12478 if (prop.key.type === 4) { 12479 const propKeyName = prop.key.content; 12480 result = props.properties.some( 12481 (p) => p.key.type === 4 && p.key.content === propKeyName 12482 ); 12483 } 12484 return result; 12485 } 12486 function toValidAssetId(name, type) { 12487 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 12488 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 12489 })}`; 12490 } 12491 function getMemoedVNodeCall(node) { 12492 if (node.type === 14 && node.callee === WITH_MEMO) { 12493 return node.arguments[1].returns; 12494 } else { 12495 return node; 12496 } 12497 } 12498 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 12499 12500 const defaultParserOptions = { 12501 parseMode: "base", 12502 ns: 0, 12503 delimiters: [`{{`, `}}`], 12504 getNamespace: () => 0, 12505 isVoidTag: NO, 12506 isPreTag: NO, 12507 isCustomElement: NO, 12508 onError: defaultOnError, 12509 onWarn: defaultOnWarn, 12510 comments: true, 12511 prefixIdentifiers: false 12512 }; 12513 let currentOptions = defaultParserOptions; 12514 let currentRoot = null; 12515 let currentInput = ""; 12516 let currentOpenTag = null; 12517 let currentProp = null; 12518 let currentAttrValue = ""; 12519 let currentAttrStartIndex = -1; 12520 let currentAttrEndIndex = -1; 12521 let inPre = 0; 12522 let inVPre = false; 12523 let currentVPreBoundary = null; 12524 const stack = []; 12525 const tokenizer = new Tokenizer(stack, { 12526 onerr: emitError, 12527 ontext(start, end) { 12528 onText(getSlice(start, end), start, end); 12529 }, 12530 ontextentity(char, start, end) { 12531 onText(char, start, end); 12532 }, 12533 oninterpolation(start, end) { 12534 if (inVPre) { 12535 return onText(getSlice(start, end), start, end); 12536 } 12537 let innerStart = start + tokenizer.delimiterOpen.length; 12538 let innerEnd = end - tokenizer.delimiterClose.length; 12539 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 12540 innerStart++; 12541 } 12542 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 12543 innerEnd--; 12544 } 12545 let exp = getSlice(innerStart, innerEnd); 12546 if (exp.includes("&")) { 12547 { 12548 exp = currentOptions.decodeEntities(exp, false); 12549 } 12550 } 12551 addNode({ 12552 type: 5, 12553 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 12554 loc: getLoc(start, end) 12555 }); 12556 }, 12557 onopentagname(start, end) { 12558 const name = getSlice(start, end); 12559 currentOpenTag = { 12560 type: 1, 12561 tag: name, 12562 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 12563 tagType: 0, 12564 // will be refined on tag close 12565 props: [], 12566 children: [], 12567 loc: getLoc(start - 1, end), 12568 codegenNode: void 0 12569 }; 12570 }, 12571 onopentagend(end) { 12572 endOpenTag(end); 12573 }, 12574 onclosetag(start, end) { 12575 const name = getSlice(start, end); 12576 if (!currentOptions.isVoidTag(name)) { 12577 let found = false; 12578 for (let i = 0; i < stack.length; i++) { 12579 const e = stack[i]; 12580 if (e.tag.toLowerCase() === name.toLowerCase()) { 12581 found = true; 12582 if (i > 0) { 12583 emitError(24, stack[0].loc.start.offset); 12584 } 12585 for (let j = 0; j <= i; j++) { 12586 const el = stack.shift(); 12587 onCloseTag(el, end, j < i); 12588 } 12589 break; 12590 } 12591 } 12592 if (!found) { 12593 emitError(23, backTrack(start, 60)); 12594 } 12595 } 12596 }, 12597 onselfclosingtag(end) { 12598 var _a; 12599 const name = currentOpenTag.tag; 12600 currentOpenTag.isSelfClosing = true; 12601 endOpenTag(end); 12602 if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) { 12603 onCloseTag(stack.shift(), end); 12604 } 12605 }, 12606 onattribname(start, end) { 12607 currentProp = { 12608 type: 6, 12609 name: getSlice(start, end), 12610 nameLoc: getLoc(start, end), 12611 value: void 0, 12612 loc: getLoc(start) 12613 }; 12614 }, 12615 ondirname(start, end) { 12616 const raw = getSlice(start, end); 12617 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 12618 if (!inVPre && name === "") { 12619 emitError(26, start); 12620 } 12621 if (inVPre || name === "") { 12622 currentProp = { 12623 type: 6, 12624 name: raw, 12625 nameLoc: getLoc(start, end), 12626 value: void 0, 12627 loc: getLoc(start) 12628 }; 12629 } else { 12630 currentProp = { 12631 type: 7, 12632 name, 12633 rawName: raw, 12634 exp: void 0, 12635 arg: void 0, 12636 modifiers: raw === "." ? ["prop"] : [], 12637 loc: getLoc(start) 12638 }; 12639 if (name === "pre") { 12640 inVPre = tokenizer.inVPre = true; 12641 currentVPreBoundary = currentOpenTag; 12642 const props = currentOpenTag.props; 12643 for (let i = 0; i < props.length; i++) { 12644 if (props[i].type === 7) { 12645 props[i] = dirToAttr(props[i]); 12646 } 12647 } 12648 } 12649 } 12650 }, 12651 ondirarg(start, end) { 12652 if (start === end) 12653 return; 12654 const arg = getSlice(start, end); 12655 if (inVPre) { 12656 currentProp.name += arg; 12657 setLocEnd(currentProp.nameLoc, end); 12658 } else { 12659 const isStatic = arg[0] !== `[`; 12660 currentProp.arg = createExp( 12661 isStatic ? arg : arg.slice(1, -1), 12662 isStatic, 12663 getLoc(start, end), 12664 isStatic ? 3 : 0 12665 ); 12666 } 12667 }, 12668 ondirmodifier(start, end) { 12669 const mod = getSlice(start, end); 12670 if (inVPre) { 12671 currentProp.name += "." + mod; 12672 setLocEnd(currentProp.nameLoc, end); 12673 } else if (currentProp.name === "slot") { 12674 const arg = currentProp.arg; 12675 if (arg) { 12676 arg.content += "." + mod; 12677 setLocEnd(arg.loc, end); 12678 } 12679 } else { 12680 currentProp.modifiers.push(mod); 12681 } 12682 }, 12683 onattribdata(start, end) { 12684 currentAttrValue += getSlice(start, end); 12685 if (currentAttrStartIndex < 0) 12686 currentAttrStartIndex = start; 12687 currentAttrEndIndex = end; 12688 }, 12689 onattribentity(char, start, end) { 12690 currentAttrValue += char; 12691 if (currentAttrStartIndex < 0) 12692 currentAttrStartIndex = start; 12693 currentAttrEndIndex = end; 12694 }, 12695 onattribnameend(end) { 12696 const start = currentProp.loc.start.offset; 12697 const name = getSlice(start, end); 12698 if (currentProp.type === 7) { 12699 currentProp.rawName = name; 12700 } 12701 if (currentOpenTag.props.some( 12702 (p) => (p.type === 7 ? p.rawName : p.name) === name 12703 )) { 12704 emitError(2, start); 12705 } 12706 }, 12707 onattribend(quote, end) { 12708 if (currentOpenTag && currentProp) { 12709 setLocEnd(currentProp.loc, end); 12710 if (quote !== 0) { 12711 if (currentAttrValue.includes("&")) { 12712 currentAttrValue = currentOptions.decodeEntities( 12713 currentAttrValue, 12714 true 12715 ); 12716 } 12717 if (currentProp.type === 6) { 12718 if (currentProp.name === "class") { 12719 currentAttrValue = condense(currentAttrValue).trim(); 12720 } 12721 if (quote === 1 && !currentAttrValue) { 12722 emitError(13, end); 12723 } 12724 currentProp.value = { 12725 type: 2, 12726 content: currentAttrValue, 12727 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 12728 }; 12729 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 12730 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 12731 } 12732 } else { 12733 let expParseMode = 0 /* Normal */; 12734 currentProp.exp = createExp( 12735 currentAttrValue, 12736 false, 12737 getLoc(currentAttrStartIndex, currentAttrEndIndex), 12738 0, 12739 expParseMode 12740 ); 12741 if (currentProp.name === "for") { 12742 currentProp.forParseResult = parseForExpression(currentProp.exp); 12743 } 12744 } 12745 } 12746 if (currentProp.type !== 7 || currentProp.name !== "pre") { 12747 currentOpenTag.props.push(currentProp); 12748 } 12749 } 12750 currentAttrValue = ""; 12751 currentAttrStartIndex = currentAttrEndIndex = -1; 12752 }, 12753 oncomment(start, end) { 12754 if (currentOptions.comments) { 12755 addNode({ 12756 type: 3, 12757 content: getSlice(start, end), 12758 loc: getLoc(start - 4, end + 3) 12759 }); 12760 } 12761 }, 12762 onend() { 12763 const end = currentInput.length; 12764 if (tokenizer.state !== 1) { 12765 switch (tokenizer.state) { 12766 case 5: 12767 case 8: 12768 emitError(5, end); 12769 break; 12770 case 3: 12771 case 4: 12772 emitError( 12773 25, 12774 tokenizer.sectionStart 12775 ); 12776 break; 12777 case 28: 12778 if (tokenizer.currentSequence === Sequences.CdataEnd) { 12779 emitError(6, end); 12780 } else { 12781 emitError(7, end); 12782 } 12783 break; 12784 case 6: 12785 case 7: 12786 case 9: 12787 case 11: 12788 case 12: 12789 case 13: 12790 case 14: 12791 case 15: 12792 case 16: 12793 case 17: 12794 case 18: 12795 case 19: 12796 case 20: 12797 case 21: 12798 emitError(9, end); 12799 break; 12800 } 12801 } 12802 for (let index = 0; index < stack.length; index++) { 12803 onCloseTag(stack[index], end - 1); 12804 emitError(24, stack[index].loc.start.offset); 12805 } 12806 }, 12807 oncdata(start, end) { 12808 if (stack[0].ns !== 0) { 12809 onText(getSlice(start, end), start, end); 12810 } else { 12811 emitError(1, start - 9); 12812 } 12813 }, 12814 onprocessinginstruction(start) { 12815 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 12816 emitError( 12817 21, 12818 start - 1 12819 ); 12820 } 12821 } 12822 }); 12823 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 12824 const stripParensRE = /^\(|\)$/g; 12825 function parseForExpression(input) { 12826 const loc = input.loc; 12827 const exp = input.content; 12828 const inMatch = exp.match(forAliasRE); 12829 if (!inMatch) 12830 return; 12831 const [, LHS, RHS] = inMatch; 12832 const createAliasExpression = (content, offset, asParam = false) => { 12833 const start = loc.start.offset + offset; 12834 const end = start + content.length; 12835 return createExp( 12836 content, 12837 false, 12838 getLoc(start, end), 12839 0, 12840 asParam ? 1 /* Params */ : 0 /* Normal */ 12841 ); 12842 }; 12843 const result = { 12844 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 12845 value: void 0, 12846 key: void 0, 12847 index: void 0, 12848 finalized: false 12849 }; 12850 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 12851 const trimmedOffset = LHS.indexOf(valueContent); 12852 const iteratorMatch = valueContent.match(forIteratorRE); 12853 if (iteratorMatch) { 12854 valueContent = valueContent.replace(forIteratorRE, "").trim(); 12855 const keyContent = iteratorMatch[1].trim(); 12856 let keyOffset; 12857 if (keyContent) { 12858 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 12859 result.key = createAliasExpression(keyContent, keyOffset, true); 12860 } 12861 if (iteratorMatch[2]) { 12862 const indexContent = iteratorMatch[2].trim(); 12863 if (indexContent) { 12864 result.index = createAliasExpression( 12865 indexContent, 12866 exp.indexOf( 12867 indexContent, 12868 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 12869 ), 12870 true 12871 ); 12872 } 12873 } 12874 } 12875 if (valueContent) { 12876 result.value = createAliasExpression(valueContent, trimmedOffset, true); 12877 } 12878 return result; 12879 } 12880 function getSlice(start, end) { 12881 return currentInput.slice(start, end); 12882 } 12883 function endOpenTag(end) { 12884 if (tokenizer.inSFCRoot) { 12885 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 12886 } 12887 addNode(currentOpenTag); 12888 const { tag, ns } = currentOpenTag; 12889 if (ns === 0 && currentOptions.isPreTag(tag)) { 12890 inPre++; 12891 } 12892 if (currentOptions.isVoidTag(tag)) { 12893 onCloseTag(currentOpenTag, end); 12894 } else { 12895 stack.unshift(currentOpenTag); 12896 if (ns === 1 || ns === 2) { 12897 tokenizer.inXML = true; 12898 } 12899 } 12900 currentOpenTag = null; 12901 } 12902 function onText(content, start, end) { 12903 var _a; 12904 { 12905 const tag = (_a = stack[0]) == null ? void 0 : _a.tag; 12906 if (tag !== "script" && tag !== "style" && content.includes("&")) { 12907 content = currentOptions.decodeEntities(content, false); 12908 } 12909 } 12910 const parent = stack[0] || currentRoot; 12911 const lastNode = parent.children[parent.children.length - 1]; 12912 if ((lastNode == null ? void 0 : lastNode.type) === 2) { 12913 lastNode.content += content; 12914 setLocEnd(lastNode.loc, end); 12915 } else { 12916 parent.children.push({ 12917 type: 2, 12918 content, 12919 loc: getLoc(start, end) 12920 }); 12921 } 12922 } 12923 function onCloseTag(el, end, isImplied = false) { 12924 if (isImplied) { 12925 setLocEnd(el.loc, backTrack(end, 60)); 12926 } else { 12927 setLocEnd(el.loc, end + 1); 12928 } 12929 if (tokenizer.inSFCRoot) { 12930 if (el.children.length) { 12931 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 12932 } else { 12933 el.innerLoc.end = extend({}, el.innerLoc.start); 12934 } 12935 el.innerLoc.source = getSlice( 12936 el.innerLoc.start.offset, 12937 el.innerLoc.end.offset 12938 ); 12939 } 12940 const { tag, ns } = el; 12941 if (!inVPre) { 12942 if (tag === "slot") { 12943 el.tagType = 2; 12944 } else if (isFragmentTemplate(el)) { 12945 el.tagType = 3; 12946 } else if (isComponent(el)) { 12947 el.tagType = 1; 12948 } 12949 } 12950 if (!tokenizer.inRCDATA) { 12951 el.children = condenseWhitespace(el.children, el.tag); 12952 } 12953 if (ns === 0 && currentOptions.isPreTag(tag)) { 12954 inPre--; 12955 } 12956 if (currentVPreBoundary === el) { 12957 inVPre = tokenizer.inVPre = false; 12958 currentVPreBoundary = null; 12959 } 12960 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 12961 tokenizer.inXML = false; 12962 } 12963 } 12964 function backTrack(index, c) { 12965 let i = index; 12966 while (currentInput.charCodeAt(i) !== c && i >= 0) 12967 i--; 12968 return i; 12969 } 12970 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 12971 function isFragmentTemplate({ tag, props }) { 12972 if (tag === "template") { 12973 for (let i = 0; i < props.length; i++) { 12974 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 12975 return true; 12976 } 12977 } 12978 } 12979 return false; 12980 } 12981 function isComponent({ tag, props }) { 12982 var _a; 12983 if (currentOptions.isCustomElement(tag)) { 12984 return false; 12985 } 12986 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 12987 return true; 12988 } 12989 for (let i = 0; i < props.length; i++) { 12990 const p = props[i]; 12991 if (p.type === 6) { 12992 if (p.name === "is" && p.value) { 12993 if (p.value.content.startsWith("vue:")) { 12994 return true; 12995 } 12996 } 12997 } 12998 } 12999 return false;
vendor: 5,679 bytes, lines 13000-13186
13000 } 13001 function isUpperCase(c) { 13002 return c > 64 && c < 91; 13003 } 13004 const windowsNewlineRE = /\r\n/g; 13005 function condenseWhitespace(nodes, tag) { 13006 var _a, _b; 13007 const shouldCondense = currentOptions.whitespace !== "preserve"; 13008 let removedWhitespace = false; 13009 for (let i = 0; i < nodes.length; i++) { 13010 const node = nodes[i]; 13011 if (node.type === 2) { 13012 if (!inPre) { 13013 if (isAllWhitespace(node.content)) { 13014 const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type; 13015 const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type; 13016 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 13017 removedWhitespace = true; 13018 nodes[i] = null; 13019 } else { 13020 node.content = " "; 13021 } 13022 } else if (shouldCondense) { 13023 node.content = condense(node.content); 13024 } 13025 } else { 13026 node.content = node.content.replace(windowsNewlineRE, "\n"); 13027 } 13028 } 13029 } 13030 if (inPre && tag && currentOptions.isPreTag(tag)) { 13031 const first = nodes[0]; 13032 if (first && first.type === 2) { 13033 first.content = first.content.replace(/^\r?\n/, ""); 13034 } 13035 } 13036 return removedWhitespace ? nodes.filter(Boolean) : nodes; 13037 } 13038 function isAllWhitespace(str) { 13039 for (let i = 0; i < str.length; i++) { 13040 if (!isWhitespace(str.charCodeAt(i))) { 13041 return false; 13042 } 13043 } 13044 return true; 13045 } 13046 function hasNewlineChar(str) { 13047 for (let i = 0; i < str.length; i++) { 13048 const c = str.charCodeAt(i); 13049 if (c === 10 || c === 13) { 13050 return true; 13051 } 13052 } 13053 return false; 13054 } 13055 function condense(str) { 13056 let ret = ""; 13057 let prevCharIsWhitespace = false; 13058 for (let i = 0; i < str.length; i++) { 13059 if (isWhitespace(str.charCodeAt(i))) { 13060 if (!prevCharIsWhitespace) { 13061 ret += " "; 13062 prevCharIsWhitespace = true; 13063 } 13064 } else { 13065 ret += str[i]; 13066 prevCharIsWhitespace = false; 13067 } 13068 } 13069 return ret; 13070 } 13071 function addNode(node) { 13072 (stack[0] || currentRoot).children.push(node); 13073 } 13074 function getLoc(start, end) { 13075 return { 13076 start: tokenizer.getPos(start), 13077 // @ts-expect-error allow late attachment 13078 end: end == null ? end : tokenizer.getPos(end), 13079 // @ts-expect-error allow late attachment 13080 source: end == null ? end : getSlice(start, end) 13081 }; 13082 } 13083 function setLocEnd(loc, end) { 13084 loc.end = tokenizer.getPos(end); 13085 loc.source = getSlice(loc.start.offset, end); 13086 } 13087 function dirToAttr(dir) { 13088 const attr = { 13089 type: 6, 13090 name: dir.rawName, 13091 nameLoc: getLoc( 13092 dir.loc.start.offset, 13093 dir.loc.start.offset + dir.rawName.length 13094 ), 13095 value: void 0, 13096 loc: dir.loc 13097 }; 13098 if (dir.exp) { 13099 const loc = dir.exp.loc; 13100 if (loc.end.offset < dir.loc.end.offset) { 13101 loc.start.offset--; 13102 loc.start.column--; 13103 loc.end.offset++; 13104 loc.end.column++; 13105 } 13106 attr.value = { 13107 type: 2, 13108 content: dir.exp.content, 13109 loc 13110 }; 13111 } 13112 return attr; 13113 } 13114 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 13115 const exp = createSimpleExpression(content, isStatic, loc, constType); 13116 return exp; 13117 } 13118 function emitError(code, index, message) { 13119 currentOptions.onError( 13120 createCompilerError(code, getLoc(index, index), void 0, message) 13121 ); 13122 } 13123 function reset() { 13124 tokenizer.reset(); 13125 currentOpenTag = null; 13126 currentProp = null; 13127 currentAttrValue = ""; 13128 currentAttrStartIndex = -1; 13129 currentAttrEndIndex = -1; 13130 stack.length = 0; 13131 } 13132 function baseParse(input, options) { 13133 reset(); 13134 currentInput = input; 13135 currentOptions = extend({}, defaultParserOptions); 13136 if (options) { 13137 let key; 13138 for (key in options) { 13139 if (options[key] != null) { 13140 currentOptions[key] = options[key]; 13141 } 13142 } 13143 } 13144 { 13145 if (!currentOptions.decodeEntities) { 13146 throw new Error( 13147 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 13148 ); 13149 } 13150 } 13151 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 13152 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 13153 const delimiters = options == null ? void 0 : options.delimiters; 13154 if (delimiters) { 13155 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 13156 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 13157 } 13158 const root = currentRoot = createRoot([], input); 13159 tokenizer.parse(currentInput); 13160 root.loc = getLoc(0, input.length); 13161 root.children = condenseWhitespace(root.children); 13162 currentRoot = null; 13163 return root; 13164 } 13165 13166 function hoistStatic(root, context) { 13167 walk( 13168 root, 13169 context, 13170 // Root node is unfortunately non-hoistable due to potential parent 13171 // fallthrough attributes. 13172 isSingleElementRoot(root, root.children[0]) 13173 ); 13174 } 13175 function isSingleElementRoot(root, child) { 13176 const { children } = root; 13177 return children.length === 1 && child.type === 1 && !isSlotOutlet(child); 13178 } 13179 function walk(node, context, doNotHoistNode = false) { 13180 const { children } = node; 13181 const originalCount = children.length; 13182 let hoistedCount = 0; 13183 for (let i = 0; i < children.length; i++) { 13184 const child = children[i]; 13185 if (child.type === 1 && child.tagType === 0) { 13186 const constantType = doNotHoistNode ? 0 : getConstantType(child, c
13186ontext); 13187 if (constantType > 0) { 13188 if (constantType >= 2) { 13189 child.codegenNode.patchFlag = -1 + (` /* HOISTED */` ); 13190 child.codegenNode = context.hoist(child.codegenNode); 13191 hoistedCount++; 13192 continue; 13193 } 13194 } else { 13195 const codegenNode = child.codegenNode; 13196 if (codegenNode.type === 13) { 13197 const flag = getPatchFlag(codegenNode); 13198 if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 13199 const props = getNodeProps(child); 13200 if (props) { 13201 codegenNode.props = context.hoist(props); 13202 } 13203 } 13204 if (codegenNode.dynamicProps) { 13205 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 13206 } 13207 } 13208 } 13209 } 13210 if (child.type === 1) { 13211 const isComponent = child.tagType === 1; 13212 if (isComponent) { 13213 context.scopes.vSlot++; 13214 } 13215 walk(child, context); 13216 if (isComponent) { 13217 context.scopes.vSlot--; 13218 } 13219 } else if (child.type === 11) { 13220 walk(child, context, child.children.length === 1); 13221 } else if (child.type === 9) { 13222 for (let i2 = 0; i2 < child.branches.length; i2++) { 13223 walk( 13224 child.branches[i2], 13225 context, 13226 child.branches[i2].children.length === 1 13227 ); 13228 } 13229 } 13230 } 13231 if (hoistedCount && context.transformHoist) { 13232 context.transformHoist(children, context, node); 13233 } 13234 if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 13235 const hoisted = context.hoist( 13236 createArrayExpression(node.codegenNode.children) 13237 ); 13238 if (context.hmr) { 13239 hoisted.content = `[...${hoisted.content}]`; 13240 } 13241 node.codegenNode.children = hoisted; 13242 } 13243 } 13244 function getConstantType(node, context) { 13245 const { constantCache } = context; 13246 switch (node.type) { 13247 case 1: 13248 if (node.tagType !== 0) { 13249 return 0; 13250 } 13251 const cached = constantCache.get(node); 13252 if (cached !== void 0) { 13253 return cached; 13254 } 13255 const codegenNode = node.codegenNode; 13256 if (codegenNode.type !== 13) { 13257 return 0; 13258 } 13259 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") { 13260 return 0; 13261 } 13262 const flag = getPatchFlag(codegenNode); 13263 if (!flag) { 13264 let returnType2 = 3; 13265 const generatedPropsType = getGeneratedPropsConstantType(node, context); 13266 if (generatedPropsType === 0) { 13267 constantCache.set(node, 0); 13268 return 0; 13269 } 13270 if (generatedPropsType < returnType2) { 13271 returnType2 = generatedPropsType; 13272 } 13273 for (let i = 0; i < node.children.length; i++) { 13274 const childType = getConstantType(node.children[i], context); 13275 if (childType === 0) { 13276 constantCache.set(node, 0); 13277 return 0; 13278 } 13279 if (childType < returnType2) { 13280 returnType2 = childType; 13281 } 13282 } 13283 if (returnType2 > 1) { 13284 for (let i = 0; i < node.props.length; i++) { 13285 const p = node.props[i]; 13286 if (p.type === 7 && p.name === "bind" && p.exp) { 13287 const expType = getConstantType(p.exp, context); 13288 if (expType === 0) { 13289 constantCache.set(node, 0); 13290 return 0; 13291 } 13292 if (expType < returnType2) { 13293 returnType2 = expType; 13294 } 13295 } 13296 } 13297 } 13298 if (codegenNode.isBlock) { 13299 for (let i = 0; i < node.props.length; i++) { 13300 const p = node.props[i]; 13301 if (p.type === 7) { 13302 constantCache.set(node, 0); 13303 return 0; 13304 } 13305 } 13306 context.removeHelper(OPEN_BLOCK); 13307 context.removeHelper( 13308 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 13309 ); 13310 codegenNode.isBlock = false;
vendor: 34,345 bytes, lines 13311-14544
13311 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 13312 } 13313 constantCache.set(node, returnType2); 13314 return returnType2; 13315 } else { 13316 constantCache.set(node, 0); 13317 return 0; 13318 } 13319 case 2: 13320 case 3: 13321 return 3; 13322 case 9: 13323 case 11: 13324 case 10: 13325 return 0; 13326 case 5: 13327 case 12: 13328 return getConstantType(node.content, context); 13329 case 4: 13330 return node.constType; 13331 case 8: 13332 let returnType = 3; 13333 for (let i = 0; i < node.children.length; i++) { 13334 const child = node.children[i]; 13335 if (isString(child) || isSymbol(child)) { 13336 continue; 13337 } 13338 const childType = getConstantType(child, context); 13339 if (childType === 0) { 13340 return 0; 13341 } else if (childType < returnType) { 13342 returnType = childType; 13343 } 13344 } 13345 return returnType; 13346 default: 13347 return 0; 13348 } 13349 } 13350 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 13351 NORMALIZE_CLASS, 13352 NORMALIZE_STYLE, 13353 NORMALIZE_PROPS, 13354 GUARD_REACTIVE_PROPS 13355 ]); 13356 function getConstantTypeOfHelperCall(value, context) { 13357 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 13358 const arg = value.arguments[0]; 13359 if (arg.type === 4) { 13360 return getConstantType(arg, context); 13361 } else if (arg.type === 14) { 13362 return getConstantTypeOfHelperCall(arg, context); 13363 } 13364 } 13365 return 0; 13366 } 13367 function getGeneratedPropsConstantType(node, context) { 13368 let returnType = 3; 13369 const props = getNodeProps(node); 13370 if (props && props.type === 15) { 13371 const { properties } = props; 13372 for (let i = 0; i < properties.length; i++) { 13373 const { key, value } = properties[i]; 13374 const keyType = getConstantType(key, context); 13375 if (keyType === 0) { 13376 return keyType; 13377 } 13378 if (keyType < returnType) { 13379 returnType = keyType; 13380 } 13381 let valueType; 13382 if (value.type === 4) { 13383 valueType = getConstantType(value, context); 13384 } else if (value.type === 14) { 13385 valueType = getConstantTypeOfHelperCall(value, context); 13386 } else { 13387 valueType = 0; 13388 } 13389 if (valueType === 0) { 13390 return valueType; 13391 } 13392 if (valueType < returnType) { 13393 returnType = valueType; 13394 } 13395 } 13396 } 13397 return returnType; 13398 } 13399 function getNodeProps(node) { 13400 const codegenNode = node.codegenNode; 13401 if (codegenNode.type === 13) { 13402 return codegenNode.props; 13403 } 13404 } 13405 function getPatchFlag(node) { 13406 const flag = node.patchFlag; 13407 return flag ? parseInt(flag, 10) : void 0; 13408 } 13409 13410 function createTransformContext(root, { 13411 filename = "", 13412 prefixIdentifiers = false, 13413 hoistStatic: hoistStatic2 = false, 13414 hmr = false, 13415 cacheHandlers = false, 13416 nodeTransforms = [], 13417 directiveTransforms = {}, 13418 transformHoist = null, 13419 isBuiltInComponent = NOOP, 13420 isCustomElement = NOOP, 13421 expressionPlugins = [], 13422 scopeId = null, 13423 slotted = true, 13424 ssr = false, 13425 inSSR = false, 13426 ssrCssVars = ``, 13427 bindingMetadata = EMPTY_OBJ, 13428 inline = false, 13429 isTS = false, 13430 onError = defaultOnError, 13431 onWarn = defaultOnWarn, 13432 compatConfig 13433 }) { 13434 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 13435 const context = { 13436 // options 13437 filename, 13438 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 13439 prefixIdentifiers, 13440 hoistStatic: hoistStatic2, 13441 hmr, 13442 cacheHandlers, 13443 nodeTransforms, 13444 directiveTransforms, 13445 transformHoist, 13446 isBuiltInComponent, 13447 isCustomElement, 13448 expressionPlugins, 13449 scopeId, 13450 slotted, 13451 ssr, 13452 inSSR, 13453 ssrCssVars, 13454 bindingMetadata, 13455 inline, 13456 isTS, 13457 onError, 13458 onWarn, 13459 compatConfig, 13460 // state 13461 root, 13462 helpers: /* @__PURE__ */ new Map(), 13463 components: /* @__PURE__ */ new Set(), 13464 directives: /* @__PURE__ */ new Set(), 13465 hoists: [], 13466 imports: [], 13467 constantCache: /* @__PURE__ */ new WeakMap(), 13468 temps: 0, 13469 cached: 0, 13470 identifiers: /* @__PURE__ */ Object.create(null), 13471 scopes: { 13472 vFor: 0, 13473 vSlot: 0, 13474 vPre: 0, 13475 vOnce: 0 13476 }, 13477 parent: null, 13478 currentNode: root, 13479 childIndex: 0, 13480 inVOnce: false, 13481 // methods 13482 helper(name) { 13483 const count = context.helpers.get(name) || 0; 13484 context.helpers.set(name, count + 1); 13485 return name; 13486 }, 13487 removeHelper(name) { 13488 const count = context.helpers.get(name); 13489 if (count) { 13490 const currentCount = count - 1; 13491 if (!currentCount) { 13492 context.helpers.delete(name); 13493 } else { 13494 context.helpers.set(name, currentCount); 13495 } 13496 } 13497 }, 13498 helperString(name) { 13499 return `_${helperNameMap[context.helper(name)]}`; 13500 }, 13501 replaceNode(node) { 13502 { 13503 if (!context.currentNode) { 13504 throw new Error(`Node being replaced is already removed.`); 13505 } 13506 if (!context.parent) { 13507 throw new Error(`Cannot replace root node.`); 13508 } 13509 } 13510 context.parent.children[context.childIndex] = context.currentNode = node; 13511 }, 13512 removeNode(node) { 13513 if (!context.parent) { 13514 throw new Error(`Cannot remove root node.`); 13515 } 13516 const list = context.parent.children; 13517 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 13518 if (removalIndex < 0) { 13519 throw new Error(`node being removed is not a child of current parent`); 13520 } 13521 if (!node || node === context.currentNode) { 13522 context.currentNode = null; 13523 context.onNodeRemoved(); 13524 } else { 13525 if (context.childIndex > removalIndex) { 13526 context.childIndex--; 13527 context.onNodeRemoved(); 13528 } 13529 } 13530 context.parent.children.splice(removalIndex, 1); 13531 }, 13532 onNodeRemoved: NOOP, 13533 addIdentifiers(exp) { 13534 }, 13535 removeIdentifiers(exp) { 13536 }, 13537 hoist(exp) { 13538 if (isString(exp)) 13539 exp = createSimpleExpression(exp); 13540 context.hoists.push(exp); 13541 const identifier = createSimpleExpression( 13542 `_hoisted_${context.hoists.length}`, 13543 false, 13544 exp.loc, 13545 2 13546 ); 13547 identifier.hoisted = exp; 13548 return identifier; 13549 }, 13550 cache(exp, isVNode = false) { 13551 return createCacheExpression(context.cached++, exp, isVNode); 13552 } 13553 }; 13554 return context; 13555 } 13556 function transform(root, options) { 13557 const context = createTransformContext(root, options); 13558 traverseNode(root, context); 13559 if (options.hoistStatic) { 13560 hoistStatic(root, context); 13561 } 13562 if (!options.ssr) { 13563 createRootCodegen(root, context); 13564 } 13565 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 13566 root.components = [...context.components]; 13567 root.directives = [...context.directives]; 13568 root.imports = context.imports; 13569 root.hoists = context.hoists; 13570 root.temps = context.temps; 13571 root.cached = context.cached; 13572 root.transformed = true; 13573 } 13574 function createRootCodegen(root, context) { 13575 const { helper } = context; 13576 const { children } = root; 13577 if (children.length === 1) { 13578 const child = children[0]; 13579 if (isSingleElementRoot(root, child) && child.codegenNode) { 13580 const codegenNode = child.codegenNode; 13581 if (codegenNode.type === 13) { 13582 convertToBlock(codegenNode, context); 13583 } 13584 root.codegenNode = codegenNode; 13585 } else { 13586 root.codegenNode = child; 13587 } 13588 } else if (children.length > 1) { 13589 let patchFlag = 64; 13590 let patchFlagText = PatchFlagNames[64]; 13591 if (children.filter((c) => c.type !== 3).length === 1) { 13592 patchFlag |= 2048; 13593 patchFlagText += `, ${PatchFlagNames[2048]}`; 13594 } 13595 root.codegenNode = createVNodeCall( 13596 context, 13597 helper(FRAGMENT), 13598 void 0, 13599 root.children, 13600 patchFlag + (` /* ${patchFlagText} */` ), 13601 void 0, 13602 void 0, 13603 true, 13604 void 0, 13605 false 13606 ); 13607 } else ; 13608 } 13609 function traverseChildren(parent, context) { 13610 let i = 0; 13611 const nodeRemoved = () => { 13612 i--; 13613 }; 13614 for (; i < parent.children.length; i++) { 13615 const child = parent.children[i]; 13616 if (isString(child)) 13617 continue; 13618 context.parent = parent; 13619 context.childIndex = i; 13620 context.onNodeRemoved = nodeRemoved; 13621 traverseNode(child, context); 13622 } 13623 } 13624 function traverseNode(node, context) { 13625 context.currentNode = node; 13626 const { nodeTransforms } = context; 13627 const exitFns = []; 13628 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 13629 const onExit = nodeTransforms[i2](node, context); 13630 if (onExit) { 13631 if (isArray(onExit)) { 13632 exitFns.push(...onExit); 13633 } else { 13634 exitFns.push(onExit); 13635 } 13636 } 13637 if (!context.currentNode) { 13638 return; 13639 } else { 13640 node = context.currentNode; 13641 } 13642 } 13643 switch (node.type) { 13644 case 3: 13645 if (!context.ssr) { 13646 context.helper(CREATE_COMMENT); 13647 } 13648 break; 13649 case 5: 13650 if (!context.ssr) { 13651 context.helper(TO_DISPLAY_STRING); 13652 } 13653 break; 13654 case 9: 13655 for (let i2 = 0; i2 < node.branches.length; i2++) { 13656 traverseNode(node.branches[i2], context); 13657 } 13658 break; 13659 case 10: 13660 case 11: 13661 case 1: 13662 case 0: 13663 traverseChildren(node, context); 13664 break; 13665 } 13666 context.currentNode = node; 13667 let i = exitFns.length; 13668 while (i--) { 13669 exitFns[i](); 13670 } 13671 } 13672 function createStructuralDirectiveTransform(name, fn) { 13673 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 13674 return (node, context) => { 13675 if (node.type === 1) { 13676 const { props } = node; 13677 if (node.tagType === 3 && props.some(isVSlot)) { 13678 return; 13679 } 13680 const exitFns = []; 13681 for (let i = 0; i < props.length; i++) { 13682 const prop = props[i]; 13683 if (prop.type === 7 && matches(prop.name)) { 13684 props.splice(i, 1); 13685 i--; 13686 const onExit = fn(node, prop, context); 13687 if (onExit) 13688 exitFns.push(onExit); 13689 } 13690 } 13691 return exitFns; 13692 } 13693 }; 13694 } 13695 13696 const PURE_ANNOTATION = `/*#__PURE__*/`; 13697 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 13698 function createCodegenContext(ast, { 13699 mode = "function", 13700 prefixIdentifiers = mode === "module", 13701 sourceMap = false, 13702 filename = `template.vue.html`, 13703 scopeId = null, 13704 optimizeImports = false, 13705 runtimeGlobalName = `Vue`, 13706 runtimeModuleName = `vue`, 13707 ssrRuntimeModuleName = "vue/server-renderer", 13708 ssr = false, 13709 isTS = false, 13710 inSSR = false 13711 }) { 13712 const context = { 13713 mode, 13714 prefixIdentifiers, 13715 sourceMap, 13716 filename, 13717 scopeId, 13718 optimizeImports, 13719 runtimeGlobalName, 13720 runtimeModuleName, 13721 ssrRuntimeModuleName, 13722 ssr, 13723 isTS, 13724 inSSR, 13725 source: ast.source, 13726 code: ``, 13727 column: 1, 13728 line: 1, 13729 offset: 0, 13730 indentLevel: 0, 13731 pure: false, 13732 map: void 0, 13733 helper(key) { 13734 return `_${helperNameMap[key]}`; 13735 }, 13736 push(code, newlineIndex = -2 /* None */, node) { 13737 context.code += code; 13738 }, 13739 indent() { 13740 newline(++context.indentLevel); 13741 }, 13742 deindent(withoutNewLine = false) { 13743 if (withoutNewLine) { 13744 --context.indentLevel; 13745 } else { 13746 newline(--context.indentLevel); 13747 } 13748 }, 13749 newline() { 13750 newline(context.indentLevel); 13751 } 13752 }; 13753 function newline(n) { 13754 context.push("\n" + ` `.repeat(n), 0 /* Start */); 13755 } 13756 return context; 13757 } 13758 function generate(ast, options = {}) { 13759 const context = createCodegenContext(ast, options); 13760 if (options.onContextCreated) 13761 options.onContextCreated(context); 13762 const { 13763 mode, 13764 push, 13765 prefixIdentifiers, 13766 indent, 13767 deindent, 13768 newline, 13769 scopeId, 13770 ssr 13771 } = context; 13772 const helpers = Array.from(ast.helpers); 13773 const hasHelpers = helpers.length > 0; 13774 const useWithBlock = !prefixIdentifiers && mode !== "module"; 13775 const preambleContext = context; 13776 { 13777 genFunctionPreamble(ast, preambleContext); 13778 } 13779 const functionName = ssr ? `ssrRender` : `render`; 13780 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 13781 const signature = args.join(", "); 13782 { 13783 push(`function ${functionName}(${signature}) {`); 13784 } 13785 indent(); 13786 if (useWithBlock) { 13787 push(`with (_ctx) {`); 13788 indent(); 13789 if (hasHelpers) { 13790 push( 13791 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 13792`, 13793 -1 /* End */ 13794 ); 13795 newline(); 13796 } 13797 } 13798 if (ast.components.length) { 13799 genAssets(ast.components, "component", context); 13800 if (ast.directives.length || ast.temps > 0) { 13801 newline(); 13802 } 13803 } 13804 if (ast.directives.length) { 13805 genAssets(ast.directives, "directive", context); 13806 if (ast.temps > 0) { 13807 newline(); 13808 } 13809 } 13810 if (ast.temps > 0) { 13811 push(`let `); 13812 for (let i = 0; i < ast.temps; i++) { 13813 push(`${i > 0 ? `, ` : ``}_temp${i}`); 13814 } 13815 } 13816 if (ast.components.length || ast.directives.length || ast.temps) { 13817 push(` 13818`, 0 /* Start */); 13819 newline(); 13820 } 13821 if (!ssr) { 13822 push(`return `); 13823 } 13824 if (ast.codegenNode) { 13825 genNode(ast.codegenNode, context); 13826 } else { 13827 push(`null`); 13828 } 13829 if (useWithBlock) { 13830 deindent(); 13831 push(`}`); 13832 } 13833 deindent(); 13834 push(`}`); 13835 return { 13836 ast, 13837 code: context.code, 13838 preamble: ``, 13839 map: context.map ? context.map.toJSON() : void 0 13840 }; 13841 } 13842 function genFunctionPreamble(ast, context) { 13843 const { 13844 ssr, 13845 prefixIdentifiers, 13846 push, 13847 newline, 13848 runtimeModuleName, 13849 runtimeGlobalName, 13850 ssrRuntimeModuleName 13851 } = context; 13852 const VueBinding = runtimeGlobalName; 13853 const helpers = Array.from(ast.helpers); 13854 if (helpers.length > 0) { 13855 { 13856 push(`const _Vue = ${VueBinding} 13857`, -1 /* End */); 13858 if (ast.hoists.length) { 13859 const staticHelpers = [ 13860 CREATE_VNODE, 13861 CREATE_ELEMENT_VNODE, 13862 CREATE_COMMENT, 13863 CREATE_TEXT, 13864 CREATE_STATIC 13865 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 13866 push(`const { ${staticHelpers} } = _Vue 13867`, -1 /* End */); 13868 } 13869 } 13870 } 13871 genHoists(ast.hoists, context); 13872 newline(); 13873 push(`return `); 13874 } 13875 function genAssets(assets, type, { helper, push, newline, isTS }) { 13876 const resolver = helper( 13877 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 13878 ); 13879 for (let i = 0; i < assets.length; i++) { 13880 let id = assets[i]; 13881 const maybeSelfReference = id.endsWith("__self"); 13882 if (maybeSelfReference) { 13883 id = id.slice(0, -6); 13884 } 13885 push( 13886 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 13887 ); 13888 if (i < assets.length - 1) { 13889 newline(); 13890 } 13891 } 13892 } 13893 function genHoists(hoists, context) { 13894 if (!hoists.length) { 13895 return; 13896 } 13897 context.pure = true; 13898 const { push, newline, helper, scopeId, mode } = context; 13899 newline(); 13900 for (let i = 0; i < hoists.length; i++) { 13901 const exp = hoists[i]; 13902 if (exp) { 13903 push( 13904 `const _hoisted_${i + 1} = ${``}` 13905 ); 13906 genNode(exp, context); 13907 newline(); 13908 } 13909 } 13910 context.pure = false; 13911 } 13912 function isText(n) { 13913 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 13914 } 13915 function genNodeListAsArray(nodes, context) { 13916 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 13917 context.push(`[`); 13918 multilines && context.indent(); 13919 genNodeList(nodes, context, multilines); 13920 multilines && context.deindent(); 13921 context.push(`]`); 13922 } 13923 function genNodeList(nodes, context, multilines = false, comma = true) { 13924 const { push, newline } = context; 13925 for (let i = 0; i < nodes.length; i++) { 13926 const node = nodes[i]; 13927 if (isString(node)) { 13928 push(node, -3 /* Unknown */); 13929 } else if (isArray(node)) { 13930 genNodeListAsArray(node, context); 13931 } else { 13932 genNode(node, context); 13933 } 13934 if (i < nodes.length - 1) { 13935 if (multilines) { 13936 comma && push(","); 13937 newline(); 13938 } else { 13939 comma && push(", "); 13940 } 13941 } 13942 } 13943 } 13944 function genNode(node, context) { 13945 if (isString(node)) { 13946 context.push(node, -3 /* Unknown */); 13947 return; 13948 } 13949 if (isSymbol(node)) { 13950 context.push(context.helper(node)); 13951 return; 13952 } 13953 switch (node.type) { 13954 case 1: 13955 case 9: 13956 case 11: 13957 assert( 13958 node.codegenNode != null, 13959 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 13960 ); 13961 genNode(node.codegenNode, context); 13962 break; 13963 case 2: 13964 genText(node, context); 13965 break; 13966 case 4: 13967 genExpression(node, context); 13968 break; 13969 case 5: 13970 genInterpolation(node, context); 13971 break; 13972 case 12: 13973 genNode(node.codegenNode, context); 13974 break; 13975 case 8: 13976 genCompoundExpression(node, context); 13977 break; 13978 case 3: 13979 genComment(node, context); 13980 break; 13981 case 13: 13982 genVNodeCall(node, context); 13983 break; 13984 case 14: 13985 genCallExpression(node, context); 13986 break; 13987 case 15: 13988 genObjectExpression(node, context); 13989 break; 13990 case 17: 13991 genArrayExpression(node, context); 13992 break; 13993 case 18: 13994 genFunctionExpression(node, context); 13995 break; 13996 case 19: 13997 genConditionalExpression(node, context); 13998 break; 13999 case 20: 14000 genCacheExpression(node, context); 14001 break; 14002 case 21: 14003 genNodeList(node.body, context, true, false); 14004 break; 14005 case 22: 14006 break; 14007 case 23: 14008 break; 14009 case 24: 14010 break; 14011 case 25: 14012 break; 14013 case 26: 14014 break; 14015 case 10: 14016 break; 14017 default: 14018 { 14019 assert(false, `unhandled codegen node type: ${node.type}`); 14020 const exhaustiveCheck = node; 14021 return exhaustiveCheck; 14022 } 14023 } 14024 } 14025 function genText(node, context) { 14026 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 14027 } 14028 function genExpression(node, context) { 14029 const { content, isStatic } = node; 14030 context.push( 14031 isStatic ? JSON.stringify(content) : content, 14032 -3 /* Unknown */, 14033 node 14034 ); 14035 } 14036 function genInterpolation(node, context) { 14037 const { push, helper, pure } = context; 14038 if (pure) 14039 push(PURE_ANNOTATION); 14040 push(`${helper(TO_DISPLAY_STRING)}(`); 14041 genNode(node.content, context); 14042 push(`)`); 14043 } 14044 function genCompoundExpression(node, context) { 14045 for (let i = 0; i < node.children.length; i++) { 14046 const child = node.children[i]; 14047 if (isString(child)) { 14048 context.push(child, -3 /* Unknown */); 14049 } else { 14050 genNode(child, context); 14051 } 14052 } 14053 } 14054 function genExpressionAsPropertyKey(node, context) { 14055 const { push } = context; 14056 if (node.type === 8) { 14057 push(`[`); 14058 genCompoundExpression(node, context); 14059 push(`]`); 14060 } else if (node.isStatic) { 14061 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 14062 push(text, -2 /* None */, node); 14063 } else { 14064 push(`[${node.content}]`, -3 /* Unknown */, node); 14065 } 14066 } 14067 function genComment(node, context) { 14068 const { push, helper, pure } = context; 14069 if (pure) { 14070 push(PURE_ANNOTATION); 14071 } 14072 push( 14073 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 14074 -3 /* Unknown */, 14075 node 14076 ); 14077 } 14078 function genVNodeCall(node, context) { 14079 const { push, helper, pure } = context; 14080 const { 14081 tag, 14082 props, 14083 children, 14084 patchFlag, 14085 dynamicProps, 14086 directives, 14087 isBlock, 14088 disableTracking, 14089 isComponent 14090 } = node; 14091 if (directives) { 14092 push(helper(WITH_DIRECTIVES) + `(`); 14093 } 14094 if (isBlock) { 14095 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 14096 } 14097 if (pure) { 14098 push(PURE_ANNOTATION); 14099 } 14100 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 14101 push(helper(callHelper) + `(`, -2 /* None */, node); 14102 genNodeList( 14103 genNullableArgs([tag, props, children, patchFlag, dynamicProps]), 14104 context 14105 ); 14106 push(`)`); 14107 if (isBlock) { 14108 push(`)`); 14109 } 14110 if (directives) { 14111 push(`, `); 14112 genNode(directives, context); 14113 push(`)`); 14114 } 14115 } 14116 function genNullableArgs(args) { 14117 let i = args.length; 14118 while (i--) { 14119 if (args[i] != null) 14120 break; 14121 } 14122 return args.slice(0, i + 1).map((arg) => arg || `null`); 14123 } 14124 function genCallExpression(node, context) { 14125 const { push, helper, pure } = context; 14126 const callee = isString(node.callee) ? node.callee : helper(node.callee); 14127 if (pure) { 14128 push(PURE_ANNOTATION); 14129 } 14130 push(callee + `(`, -2 /* None */, node); 14131 genNodeList(node.arguments, context); 14132 push(`)`); 14133 } 14134 function genObjectExpression(node, context) { 14135 const { push, indent, deindent, newline } = context; 14136 const { properties } = node; 14137 if (!properties.length) { 14138 push(`{}`, -2 /* None */, node); 14139 return; 14140 } 14141 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 14142 push(multilines ? `{` : `{ `); 14143 multilines && indent(); 14144 for (let i = 0; i < properties.length; i++) { 14145 const { key, value } = properties[i]; 14146 genExpressionAsPropertyKey(key, context); 14147 push(`: `); 14148 genNode(value, context); 14149 if (i < properties.length - 1) { 14150 push(`,`); 14151 newline(); 14152 } 14153 } 14154 multilines && deindent(); 14155 push(multilines ? `}` : ` }`); 14156 } 14157 function genArrayExpression(node, context) { 14158 genNodeListAsArray(node.elements, context); 14159 } 14160 function genFunctionExpression(node, context) { 14161 const { push, indent, deindent } = context; 14162 const { params, returns, body, newline, isSlot } = node; 14163 if (isSlot) { 14164 push(`_${helperNameMap[WITH_CTX]}(`); 14165 } 14166 push(`(`, -2 /* None */, node); 14167 if (isArray(params)) { 14168 genNodeList(params, context); 14169 } else if (params) { 14170 genNode(params, context); 14171 } 14172 push(`) => `); 14173 if (newline || body) { 14174 push(`{`); 14175 indent(); 14176 } 14177 if (returns) { 14178 if (newline) { 14179 push(`return `); 14180 } 14181 if (isArray(returns)) { 14182 genNodeListAsArray(returns, context); 14183 } else { 14184 genNode(returns, context); 14185 } 14186 } else if (body) { 14187 genNode(body, context); 14188 } 14189 if (newline || body) { 14190 deindent(); 14191 push(`}`); 14192 } 14193 if (isSlot) { 14194 push(`)`); 14195 } 14196 } 14197 function genConditionalExpression(node, context) { 14198 const { test, consequent, alternate, newline: needNewline } = node; 14199 const { push, indent, deindent, newline } = context; 14200 if (test.type === 4) { 14201 const needsParens = !isSimpleIdentifier(test.content); 14202 needsParens && push(`(`); 14203 genExpression(test, context); 14204 needsParens && push(`)`); 14205 } else { 14206 push(`(`); 14207 genNode(test, context); 14208 push(`)`); 14209 } 14210 needNewline && indent(); 14211 context.indentLevel++; 14212 needNewline || push(` `); 14213 push(`? `); 14214 genNode(consequent, context); 14215 context.indentLevel--; 14216 needNewline && newline(); 14217 needNewline || push(` `); 14218 push(`: `); 14219 const isNested = alternate.type === 19; 14220 if (!isNested) { 14221 context.indentLevel++; 14222 } 14223 genNode(alternate, context); 14224 if (!isNested) { 14225 context.indentLevel--; 14226 } 14227 needNewline && deindent( 14228 true 14229 /* without newline */ 14230 ); 14231 } 14232 function genCacheExpression(node, context) { 14233 const { push, helper, indent, deindent, newline } = context; 14234 push(`_cache[${node.index}] || (`); 14235 if (node.isVNode) { 14236 indent(); 14237 push(`${helper(SET_BLOCK_TRACKING)}(-1),`); 14238 newline(); 14239 } 14240 push(`_cache[${node.index}] = `); 14241 genNode(node.value, context); 14242 if (node.isVNode) { 14243 push(`,`); 14244 newline(); 14245 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 14246 newline(); 14247 push(`_cache[${node.index}]`); 14248 deindent(); 14249 } 14250 push(`)`); 14251 } 14252 14253 const prohibitedKeywordRE = new RegExp( 14254 "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b" 14255 ); 14256 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 14257 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 14258 const exp = node.content; 14259 if (!exp.trim()) { 14260 return; 14261 } 14262 try { 14263 new Function( 14264 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 14265 ); 14266 } catch (e) { 14267 let message = e.message; 14268 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 14269 if (keywordMatch) { 14270 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 14271 } 14272 context.onError( 14273 createCompilerError( 14274 45, 14275 node.loc, 14276 void 0, 14277 message 14278 ) 14279 ); 14280 } 14281 } 14282 14283 const transformExpression = (node, context) => { 14284 if (node.type === 5) { 14285 node.content = processExpression( 14286 node.content, 14287 context 14288 ); 14289 } else if (node.type === 1) { 14290 for (let i = 0; i < node.props.length; i++) { 14291 const dir = node.props[i]; 14292 if (dir.type === 7 && dir.name !== "for") { 14293 const exp = dir.exp; 14294 const arg = dir.arg; 14295 if (exp && exp.type === 4 && !(dir.name === "on" && arg)) { 14296 dir.exp = processExpression( 14297 exp, 14298 context, 14299 // slot args must be processed as function params 14300 dir.name === "slot" 14301 ); 14302 } 14303 if (arg && arg.type === 4 && !arg.isStatic) { 14304 dir.arg = processExpression(arg, context); 14305 } 14306 } 14307 } 14308 } 14309 }; 14310 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 14311 { 14312 { 14313 validateBrowserExpression(node, context, asParams, asRawStatements); 14314 } 14315 return node; 14316 } 14317 } 14318 14319 const transformIf = createStructuralDirectiveTransform( 14320 /^(if|else|else-if)$/, 14321 (node, dir, context) => { 14322 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 14323 const siblings = context.parent.children; 14324 let i = siblings.indexOf(ifNode); 14325 let key = 0; 14326 while (i-- >= 0) { 14327 const sibling = siblings[i]; 14328 if (sibling && sibling.type === 9) { 14329 key += sibling.branches.length; 14330 } 14331 } 14332 return () => { 14333 if (isRoot) { 14334 ifNode.codegenNode = createCodegenNodeForBranch( 14335 branch, 14336 key, 14337 context 14338 ); 14339 } else { 14340 const parentCondition = getParentCondition(ifNode.codegenNode); 14341 parentCondition.alternate = createCodegenNodeForBranch( 14342 branch, 14343 key + ifNode.branches.length - 1, 14344 context 14345 ); 14346 } 14347 }; 14348 }); 14349 } 14350 ); 14351 function processIf(node, dir, context, processCodegen) { 14352 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 14353 const loc = dir.exp ? dir.exp.loc : node.loc; 14354 context.onError( 14355 createCompilerError(28, dir.loc) 14356 ); 14357 dir.exp = createSimpleExpression(`true`, false, loc); 14358 } 14359 if (dir.exp) { 14360 validateBrowserExpression(dir.exp, context); 14361 } 14362 if (dir.name === "if") { 14363 const branch = createIfBranch(node, dir); 14364 const ifNode = { 14365 type: 9, 14366 loc: node.loc, 14367 branches: [branch] 14368 }; 14369 context.replaceNode(ifNode); 14370 if (processCodegen) { 14371 return processCodegen(ifNode, branch, true); 14372 } 14373 } else { 14374 const siblings = context.parent.children; 14375 const comments = []; 14376 let i = siblings.indexOf(node); 14377 while (i-- >= -1) { 14378 const sibling = siblings[i]; 14379 if (sibling && sibling.type === 3) { 14380 context.removeNode(sibling); 14381 comments.unshift(sibling); 14382 continue; 14383 } 14384 if (sibling && sibling.type === 2 && !sibling.content.trim().length) { 14385 context.removeNode(sibling); 14386 continue; 14387 } 14388 if (sibling && sibling.type === 9) { 14389 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) { 14390 context.onError( 14391 createCompilerError(30, node.loc) 14392 ); 14393 } 14394 context.removeNode(); 14395 const branch = createIfBranch(node, dir); 14396 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 14397 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 14398 branch.children = [...comments, ...branch.children]; 14399 } 14400 { 14401 const key = branch.userKey; 14402 if (key) { 14403 sibling.branches.forEach(({ userKey }) => { 14404 if (isSameKey(userKey, key)) { 14405 context.onError( 14406 createCompilerError( 14407 29, 14408 branch.userKey.loc 14409 ) 14410 ); 14411 } 14412 }); 14413 } 14414 } 14415 sibling.branches.push(branch); 14416 const onExit = processCodegen && processCodegen(sibling, branch, false); 14417 traverseNode(branch, context); 14418 if (onExit) 14419 onExit(); 14420 context.currentNode = null; 14421 } else { 14422 context.onError( 14423 createCompilerError(30, node.loc) 14424 ); 14425 } 14426 break; 14427 } 14428 } 14429 } 14430 function createIfBranch(node, dir) { 14431 const isTemplateIf = node.tagType === 3; 14432 return { 14433 type: 10, 14434 loc: node.loc, 14435 condition: dir.name === "else" ? void 0 : dir.exp, 14436 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 14437 userKey: findProp(node, `key`), 14438 isTemplateIf 14439 }; 14440 } 14441 function createCodegenNodeForBranch(branch, keyIndex, context) { 14442 if (branch.condition) { 14443 return createConditionalExpression( 14444 branch.condition, 14445 createChildrenCodegenNode(branch, keyIndex, context), 14446 // make sure to pass in asBlock: true so that the comment node call 14447 // closes the current block. 14448 createCallExpression(context.helper(CREATE_COMMENT), [ 14449 '"v-if"' , 14450 "true" 14451 ]) 14452 ); 14453 } else { 14454 return createChildrenCodegenNode(branch, keyIndex, context); 14455 } 14456 } 14457 function createChildrenCodegenNode(branch, keyIndex, context) { 14458 const { helper } = context; 14459 const keyProperty = createObjectProperty( 14460 `key`, 14461 createSimpleExpression( 14462 `${keyIndex}`, 14463 false, 14464 locStub, 14465 2 14466 ) 14467 ); 14468 const { children } = branch; 14469 const firstChild = children[0]; 14470 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 14471 if (needFragmentWrapper) { 14472 if (children.length === 1 && firstChild.type === 11) { 14473 const vnodeCall = firstChild.codegenNode; 14474 injectProp(vnodeCall, keyProperty, context); 14475 return vnodeCall; 14476 } else { 14477 let patchFlag = 64; 14478 let patchFlagText = PatchFlagNames[64]; 14479 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 14480 patchFlag |= 2048; 14481 patchFlagText += `, ${PatchFlagNames[2048]}`; 14482 } 14483 return createVNodeCall( 14484 context, 14485 helper(FRAGMENT), 14486 createObjectExpression([keyProperty]), 14487 children, 14488 patchFlag + (` /* ${patchFlagText} */` ), 14489 void 0, 14490 void 0, 14491 true, 14492 false, 14493 false, 14494 branch.loc 14495 ); 14496 } 14497 } else { 14498 const ret = firstChild.codegenNode; 14499 const vnodeCall = getMemoedVNodeCall(ret); 14500 if (vnodeCall.type === 13) { 14501 convertToBlock(vnodeCall, context); 14502 } 14503 injectProp(vnodeCall, keyProperty, context); 14504 return ret; 14505 } 14506 } 14507 function isSameKey(a, b) { 14508 if (!a || a.type !== b.type) { 14509 return false; 14510 } 14511 if (a.type === 6) { 14512 if (a.value.content !== b.value.content) { 14513 return false; 14514 } 14515 } else { 14516 const exp = a.exp; 14517 const branchExp = b.exp; 14518 if (exp.type !== branchExp.type) { 14519 return false; 14520 } 14521 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 14522 return false; 14523 } 14524 } 14525 return true; 14526 } 14527 function getParentCondition(node) { 14528 while (true) { 14529 if (node.type === 19) { 14530 if (node.alternate.type === 19) { 14531 node = node.alternate; 14532 } else { 14533 return node; 14534 } 14535 } else if (node.type === 20) { 14536 node = node.value; 14537 } 14538 } 14539 } 14540 14541 const transformFor = createStructuralDirectiveTransform( 14542 "for", 14543 (node, dir, context) => { 14544 const { helper, removeHelper } = context;
vendor: 4,646 bytes, lines 14545-14669
14545 return processFor(node, dir, context, (forNode) => { 14546 const renderExp = createCallExpression(helper(RENDER_LIST), [ 14547 forNode.source 14548 ]); 14549 const isTemplate = isTemplateNode(node); 14550 const memo = findDir(node, "memo"); 14551 const keyProp = findProp(node, `key`); 14552 const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp); 14553 const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null; 14554 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 14555 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 14556 forNode.codegenNode = createVNodeCall( 14557 context, 14558 helper(FRAGMENT), 14559 void 0, 14560 renderExp, 14561 fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ), 14562 void 0, 14563 void 0, 14564 true, 14565 !isStableFragment, 14566 false, 14567 node.loc 14568 ); 14569 return () => { 14570 let childBlock; 14571 const { children } = forNode; 14572 if (isTemplate) { 14573 node.children.some((c) => { 14574 if (c.type === 1) { 14575 const key = findProp(c, "key"); 14576 if (key) { 14577 context.onError( 14578 createCompilerError( 14579 33, 14580 key.loc 14581 ) 14582 ); 14583 return true; 14584 } 14585 } 14586 }); 14587 } 14588 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 14589 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 14590 if (slotOutlet) { 14591 childBlock = slotOutlet.codegenNode; 14592 if (isTemplate && keyProperty) { 14593 injectProp(childBlock, keyProperty, context); 14594 } 14595 } else if (needFragmentWrapper) { 14596 childBlock = createVNodeCall( 14597 context, 14598 helper(FRAGMENT), 14599 keyProperty ? createObjectExpression([keyProperty]) : void 0, 14600 node.children, 14601 64 + (` /* ${PatchFlagNames[64]} */` ), 14602 void 0, 14603 void 0, 14604 true, 14605 void 0, 14606 false 14607 ); 14608 } else { 14609 childBlock = children[0].codegenNode; 14610 if (isTemplate && keyProperty) { 14611 injectProp(childBlock, keyProperty, context); 14612 } 14613 if (childBlock.isBlock !== !isStableFragment) { 14614 if (childBlock.isBlock) { 14615 removeHelper(OPEN_BLOCK); 14616 removeHelper( 14617 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 14618 ); 14619 } else { 14620 removeHelper( 14621 getVNodeHelper(context.inSSR, childBlock.isComponent) 14622 ); 14623 } 14624 } 14625 childBlock.isBlock = !isStableFragment; 14626 if (childBlock.isBlock) { 14627 helper(OPEN_BLOCK); 14628 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 14629 } else { 14630 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 14631 } 14632 } 14633 if (memo) { 14634 const loop = createFunctionExpression( 14635 createForLoopParams(forNode.parseResult, [ 14636 createSimpleExpression(`_cached`) 14637 ]) 14638 ); 14639 loop.body = createBlockStatement([ 14640 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 14641 createCompoundExpression([ 14642 `if (_cached`, 14643 ...keyExp ? [` && _cached.key === `, keyExp] : [], 14644 ` && ${context.helperString( 14645 IS_MEMO_SAME 14646 )}(_cached, _memo)) return _cached` 14647 ]), 14648 createCompoundExpression([`const _item = `, childBlock]), 14649 createSimpleExpression(`_item.memo = _memo`), 14650 createSimpleExpression(`return _item`) 14651 ]); 14652 renderExp.arguments.push( 14653 loop, 14654 createSimpleExpression(`_cache`), 14655 createSimpleExpression(String(context.cached++)) 14656 ); 14657 } else { 14658 renderExp.arguments.push( 14659 createFunctionExpression( 14660 createForLoopParams(forNode.parseResult), 14661 childBlock, 14662 true 14663 ) 14664 ); 14665 } 14666 }; 14667 }); 14668 } 14669 );
vendor: 12,797 bytes, lines 14670-15071
14670 function processFor(node, dir, context, processCodegen) { 14671 if (!dir.exp) { 14672 context.onError( 14673 createCompilerError(31, dir.loc) 14674 ); 14675 return; 14676 } 14677 const parseResult = dir.forParseResult; 14678 if (!parseResult) { 14679 context.onError( 14680 createCompilerError(32, dir.loc) 14681 ); 14682 return; 14683 } 14684 finalizeForParseResult(parseResult, context); 14685 const { addIdentifiers, removeIdentifiers, scopes } = context; 14686 const { source, value, key, index } = parseResult; 14687 const forNode = { 14688 type: 11, 14689 loc: dir.loc, 14690 source, 14691 valueAlias: value, 14692 keyAlias: key, 14693 objectIndexAlias: index, 14694 parseResult, 14695 children: isTemplateNode(node) ? node.children : [node] 14696 }; 14697 context.replaceNode(forNode); 14698 scopes.vFor++; 14699 const onExit = processCodegen && processCodegen(forNode); 14700 return () => { 14701 scopes.vFor--; 14702 if (onExit) 14703 onExit(); 14704 }; 14705 } 14706 function finalizeForParseResult(result, context) { 14707 if (result.finalized) 14708 return; 14709 { 14710 validateBrowserExpression(result.source, context); 14711 if (result.key) { 14712 validateBrowserExpression( 14713 result.key, 14714 context, 14715 true 14716 ); 14717 } 14718 if (result.index) { 14719 validateBrowserExpression( 14720 result.index, 14721 context, 14722 true 14723 ); 14724 } 14725 if (result.value) { 14726 validateBrowserExpression( 14727 result.value, 14728 context, 14729 true 14730 ); 14731 } 14732 } 14733 result.finalized = true; 14734 } 14735 function createForLoopParams({ value, key, index }, memoArgs = []) { 14736 return createParamsList([value, key, index, ...memoArgs]); 14737 } 14738 function createParamsList(args) { 14739 let i = args.length; 14740 while (i--) { 14741 if (args[i]) 14742 break; 14743 } 14744 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 14745 } 14746 14747 const defaultFallback = createSimpleExpression(`undefined`, false); 14748 const trackSlotScopes = (node, context) => { 14749 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 14750 const vSlot = findDir(node, "slot"); 14751 if (vSlot) { 14752 vSlot.exp; 14753 context.scopes.vSlot++; 14754 return () => { 14755 context.scopes.vSlot--; 14756 }; 14757 } 14758 } 14759 }; 14760 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 14761 props, 14762 children, 14763 false, 14764 true, 14765 children.length ? children[0].loc : loc 14766 ); 14767 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 14768 context.helper(WITH_CTX); 14769 const { children, loc } = node; 14770 const slotsProperties = []; 14771 const dynamicSlots = []; 14772 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 14773 const onComponentSlot = findDir(node, "slot", true); 14774 if (onComponentSlot) { 14775 const { arg, exp } = onComponentSlot; 14776 if (arg && !isStaticExp(arg)) { 14777 hasDynamicSlots = true; 14778 } 14779 slotsProperties.push( 14780 createObjectProperty( 14781 arg || createSimpleExpression("default", true), 14782 buildSlotFn(exp, void 0, children, loc) 14783 ) 14784 ); 14785 } 14786 let hasTemplateSlots = false; 14787 let hasNamedDefaultSlot = false; 14788 const implicitDefaultChildren = []; 14789 const seenSlotNames = /* @__PURE__ */ new Set(); 14790 let conditionalBranchIndex = 0; 14791 for (let i = 0; i < children.length; i++) { 14792 const slotElement = children[i]; 14793 let slotDir; 14794 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 14795 if (slotElement.type !== 3) { 14796 implicitDefaultChildren.push(slotElement); 14797 } 14798 continue; 14799 } 14800 if (onComponentSlot) { 14801 context.onError( 14802 createCompilerError(37, slotDir.loc) 14803 ); 14804 break; 14805 } 14806 hasTemplateSlots = true; 14807 const { children: slotChildren, loc: slotLoc } = slotElement; 14808 const { 14809 arg: slotName = createSimpleExpression(`default`, true), 14810 exp: slotProps, 14811 loc: dirLoc 14812 } = slotDir; 14813 let staticSlotName; 14814 if (isStaticExp(slotName)) { 14815 staticSlotName = slotName ? slotName.content : `default`; 14816 } else { 14817 hasDynamicSlots = true; 14818 } 14819 const vFor = findDir(slotElement, "for"); 14820 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 14821 let vIf; 14822 let vElse; 14823 if (vIf = findDir(slotElement, "if")) { 14824 hasDynamicSlots = true; 14825 dynamicSlots.push( 14826 createConditionalExpression( 14827 vIf.exp, 14828 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 14829 defaultFallback 14830 ) 14831 ); 14832 } else if (vElse = findDir( 14833 slotElement, 14834 /^else(-if)?$/, 14835 true 14836 /* allowEmpty */ 14837 )) { 14838 let j = i; 14839 let prev; 14840 while (j--) { 14841 prev = children[j]; 14842 if (prev.type !== 3) { 14843 break; 14844 } 14845 } 14846 if (prev && isTemplateNode(prev) && findDir(prev, "if")) { 14847 children.splice(i, 1); 14848 i--; 14849 let conditional = dynamicSlots[dynamicSlots.length - 1]; 14850 while (conditional.alternate.type === 19) { 14851 conditional = conditional.alternate; 14852 } 14853 conditional.alternate = vElse.exp ? createConditionalExpression( 14854 vElse.exp, 14855 buildDynamicSlot( 14856 slotName, 14857 slotFunction, 14858 conditionalBranchIndex++ 14859 ), 14860 defaultFallback 14861 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 14862 } else { 14863 context.onError( 14864 createCompilerError(30, vElse.loc) 14865 ); 14866 } 14867 } else if (vFor) { 14868 hasDynamicSlots = true; 14869 const parseResult = vFor.forParseResult; 14870 if (parseResult) { 14871 finalizeForParseResult(parseResult, context); 14872 dynamicSlots.push( 14873 createCallExpression(context.helper(RENDER_LIST), [ 14874 parseResult.source, 14875 createFunctionExpression( 14876 createForLoopParams(parseResult), 14877 buildDynamicSlot(slotName, slotFunction), 14878 true 14879 ) 14880 ]) 14881 ); 14882 } else { 14883 context.onError( 14884 createCompilerError( 14885 32, 14886 vFor.loc 14887 ) 14888 ); 14889 } 14890 } else { 14891 if (staticSlotName) { 14892 if (seenSlotNames.has(staticSlotName)) { 14893 context.onError( 14894 createCompilerError( 14895 38, 14896 dirLoc 14897 ) 14898 ); 14899 continue; 14900 } 14901 seenSlotNames.add(staticSlotName); 14902 if (staticSlotName === "default") { 14903 hasNamedDefaultSlot = true; 14904 } 14905 } 14906 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 14907 } 14908 } 14909 if (!onComponentSlot) { 14910 const buildDefaultSlotProperty = (props, children2) => { 14911 const fn = buildSlotFn(props, void 0, children2, loc); 14912 return createObjectProperty(`default`, fn); 14913 }; 14914 if (!hasTemplateSlots) { 14915 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 14916 } else if (implicitDefaultChildren.length && // #3766 14917 // with whitespace: 'preserve', whitespaces between slots will end up in 14918 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 14919 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) { 14920 if (hasNamedDefaultSlot) { 14921 context.onError( 14922 createCompilerError( 14923 39, 14924 implicitDefaultChildren[0].loc 14925 ) 14926 ); 14927 } else { 14928 slotsProperties.push( 14929 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 14930 ); 14931 } 14932 } 14933 } 14934 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 14935 let slots = createObjectExpression( 14936 slotsProperties.concat( 14937 createObjectProperty( 14938 `_`, 14939 // 2 = compiled but dynamic = can skip normalization, but must run diff 14940 // 1 = compiled and static = can skip normalization AND diff as optimized 14941 createSimpleExpression( 14942 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ), 14943 false 14944 ) 14945 ) 14946 ), 14947 loc 14948 ); 14949 if (dynamicSlots.length) { 14950 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 14951 slots, 14952 createArrayExpression(dynamicSlots) 14953 ]); 14954 } 14955 return { 14956 slots, 14957 hasDynamicSlots 14958 }; 14959 } 14960 function buildDynamicSlot(name, fn, index) { 14961 const props = [ 14962 createObjectProperty(`name`, name), 14963 createObjectProperty(`fn`, fn) 14964 ]; 14965 if (index != null) { 14966 props.push( 14967 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 14968 ); 14969 } 14970 return createObjectExpression(props); 14971 } 14972 function hasForwardedSlots(children) { 14973 for (let i = 0; i < children.length; i++) { 14974 const child = children[i]; 14975 switch (child.type) { 14976 case 1: 14977 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 14978 return true; 14979 } 14980 break; 14981 case 9: 14982 if (hasForwardedSlots(child.branches)) 14983 return true; 14984 break; 14985 case 10: 14986 case 11: 14987 if (hasForwardedSlots(child.children)) 14988 return true; 14989 break; 14990 } 14991 } 14992 return false; 14993 } 14994 function isNonWhitespaceContent(node) { 14995 if (node.type !== 2 && node.type !== 12) 14996 return true; 14997 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content); 14998 } 14999 15000 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 15001 const transformElement = (node, context) => { 15002 return function postTransformElement() { 15003 node = context.currentNode; 15004 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 15005 return; 15006 } 15007 const { tag, props } = node; 15008 const isComponent = node.tagType === 1; 15009 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 15010 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 15011 let vnodeProps; 15012 let vnodeChildren; 15013 let vnodePatchFlag; 15014 let patchFlag = 0; 15015 let vnodeDynamicProps; 15016 let dynamicPropNames; 15017 let vnodeDirectives; 15018 let shouldUseBlock = ( 15019 // dynamic component may resolve to plain elements 15020 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 15021 // updates inside get proper isSVG flag at runtime. (#639, #643) 15022 // This is technically web-specific, but splitting the logic out of core 15023 // leads to too much unnecessary complexity. 15024 (tag === "svg" || tag === "foreignObject") 15025 ); 15026 if (props.length > 0) { 15027 const propsBuildResult = buildProps( 15028 node, 15029 context, 15030 void 0, 15031 isComponent, 15032 isDynamicComponent 15033 ); 15034 vnodeProps = propsBuildResult.props; 15035 patchFlag = propsBuildResult.patchFlag; 15036 dynamicPropNames = propsBuildResult.dynamicPropNames; 15037 const directives = propsBuildResult.directives; 15038 vnodeDirectives = directives && directives.length ? createArrayExpression( 15039 directives.map((dir) => buildDirectiveArgs(dir, context)) 15040 ) : void 0; 15041 if (propsBuildResult.shouldUseBlock) { 15042 shouldUseBlock = true; 15043 } 15044 } 15045 if (node.children.length > 0) { 15046 if (vnodeTag === KEEP_ALIVE) { 15047 shouldUseBlock = true; 15048 patchFlag |= 1024; 15049 if (node.children.length > 1) { 15050 context.onError( 15051 createCompilerError(46, { 15052 start: node.children[0].loc.start, 15053 end: node.children[node.children.length - 1].loc.end, 15054 source: "" 15055 }) 15056 ); 15057 } 15058 } 15059 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 15060 vnodeTag !== TELEPORT && // explained above. 15061 vnodeTag !== KEEP_ALIVE; 15062 if (shouldBuildAsSlots) { 15063 const { slots, hasDynamicSlots } = buildSlots(node, context); 15064 vnodeChildren = slots; 15065 if (hasDynamicSlots) { 15066 patchFlag |= 1024; 15067 } 15068 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 15069 const child = node.children[0]; 15070 const type = child.type; 15071 const hasDynamicTextChild = type === 5 || type === 8;
vendor: 6,917 bytes, lines 15072-15275
15072 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 15073 patchFlag |= 1; 15074 } 15075 if (hasDynamicTextChild || type === 2) { 15076 vnodeChildren = child; 15077 } else { 15078 vnodeChildren = node.children; 15079 } 15080 } else { 15081 vnodeChildren = node.children; 15082 } 15083 } 15084 if (patchFlag !== 0) { 15085 { 15086 if (patchFlag < 0) { 15087 vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15088 } else { 15089 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15090 vnodePatchFlag = patchFlag + ` /* ${flagNames} */`; 15091 } 15092 } 15093 if (dynamicPropNames && dynamicPropNames.length) { 15094 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 15095 } 15096 } 15097 node.codegenNode = createVNodeCall( 15098 context, 15099 vnodeTag, 15100 vnodeProps, 15101 vnodeChildren, 15102 vnodePatchFlag, 15103 vnodeDynamicProps, 15104 vnodeDirectives, 15105 !!shouldUseBlock, 15106 false, 15107 isComponent, 15108 node.loc 15109 ); 15110 }; 15111 }; 15112 function resolveComponentType(node, context, ssr = false) { 15113 let { tag } = node; 15114 const isExplicitDynamic = isComponentTag(tag); 15115 const isProp = findProp(node, "is"); 15116 if (isProp) { 15117 if (isExplicitDynamic || false) { 15118 const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp; 15119 if (exp) { 15120 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 15121 exp 15122 ]); 15123 } 15124 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 15125 tag = isProp.value.content.slice(4); 15126 } 15127 } 15128 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 15129 if (builtIn) { 15130 if (!ssr) 15131 context.helper(builtIn); 15132 return builtIn; 15133 } 15134 context.helper(RESOLVE_COMPONENT); 15135 context.components.add(tag); 15136 return toValidAssetId(tag, `component`); 15137 } 15138 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 15139 const { tag, loc: elementLoc, children } = node; 15140 let properties = []; 15141 const mergeArgs = []; 15142 const runtimeDirectives = []; 15143 const hasChildren = children.length > 0; 15144 let shouldUseBlock = false; 15145 let patchFlag = 0; 15146 let hasRef = false; 15147 let hasClassBinding = false; 15148 let hasStyleBinding = false; 15149 let hasHydrationEventBinding = false; 15150 let hasDynamicKeys = false; 15151 let hasVnodeHook = false; 15152 const dynamicPropNames = []; 15153 const pushMergeArg = (arg) => { 15154 if (properties.length) { 15155 mergeArgs.push( 15156 createObjectExpression(dedupeProperties(properties), elementLoc) 15157 ); 15158 properties = []; 15159 } 15160 if (arg) 15161 mergeArgs.push(arg); 15162 }; 15163 const analyzePatchFlag = ({ key, value }) => { 15164 if (isStaticExp(key)) { 15165 const name = key.content; 15166 const isEventHandler = isOn(name); 15167 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 15168 // dedicated fast path. 15169 name.toLowerCase() !== "onclick" && // omit v-model handlers 15170 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 15171 !isReservedProp(name)) { 15172 hasHydrationEventBinding = true; 15173 } 15174 if (isEventHandler && isReservedProp(name)) { 15175 hasVnodeHook = true; 15176 } 15177 if (isEventHandler && value.type === 14) { 15178 value = value.arguments[0]; 15179 } 15180 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 15181 return; 15182 } 15183 if (name === "ref") { 15184 hasRef = true; 15185 } else if (name === "class") { 15186 hasClassBinding = true; 15187 } else if (name === "style") { 15188 hasStyleBinding = true; 15189 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 15190 dynamicPropNames.push(name); 15191 } 15192 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 15193 dynamicPropNames.push(name); 15194 } 15195 } else { 15196 hasDynamicKeys = true; 15197 } 15198 }; 15199 for (let i = 0; i < props.length; i++) { 15200 const prop = props[i]; 15201 if (prop.type === 6) { 15202 const { loc, name, nameLoc, value } = prop; 15203 let isStatic = true; 15204 if (name === "ref") { 15205 hasRef = true; 15206 if (context.scopes.vFor > 0) { 15207 properties.push( 15208 createObjectProperty( 15209 createSimpleExpression("ref_for", true), 15210 createSimpleExpression("true") 15211 ) 15212 ); 15213 } 15214 } 15215 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 15216 continue; 15217 } 15218 properties.push( 15219 createObjectProperty( 15220 createSimpleExpression(name, true, nameLoc), 15221 createSimpleExpression( 15222 value ? value.content : "", 15223 isStatic, 15224 value ? value.loc : loc 15225 ) 15226 ) 15227 ); 15228 } else { 15229 const { name, arg, exp, loc, modifiers } = prop; 15230 const isVBind = name === "bind"; 15231 const isVOn = name === "on"; 15232 if (name === "slot") { 15233 if (!isComponent) { 15234 context.onError( 15235 createCompilerError(40, loc) 15236 ); 15237 } 15238 continue; 15239 } 15240 if (name === "once" || name === "memo") { 15241 continue; 15242 } 15243 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 15244 continue; 15245 } 15246 if (isVOn && ssr) { 15247 continue; 15248 } 15249 if ( 15250 // #938: elements with dynamic keys should be forced into blocks 15251 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 15252 // before children 15253 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 15254 ) { 15255 shouldUseBlock = true; 15256 } 15257 if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) { 15258 properties.push( 15259 createObjectProperty( 15260 createSimpleExpression("ref_for", true), 15261 createSimpleExpression("true") 15262 ) 15263 ); 15264 } 15265 if (!arg && (isVBind || isVOn)) { 15266 hasDynamicKeys = true; 15267 if (exp) { 15268 if (isVBind) { 15269 pushMergeArg(); 15270 mergeArgs.push(exp); 15271 } else { 15272 pushMergeArg({ 15273 type: 14, 15274 loc, 15275 callee: context.helper(TO_HANDLERS),
vendor: 9,311 bytes, lines 15276-15589
15276 arguments: isComponent ? [exp] : [exp, `true`] 15277 }); 15278 } 15279 } else { 15280 context.onError( 15281 createCompilerError( 15282 isVBind ? 34 : 35, 15283 loc 15284 ) 15285 ); 15286 } 15287 continue; 15288 } 15289 if (isVBind && modifiers.includes("prop")) { 15290 patchFlag |= 32; 15291 } 15292 const directiveTransform = context.directiveTransforms[name]; 15293 if (directiveTransform) { 15294 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 15295 !ssr && props2.forEach(analyzePatchFlag); 15296 if (isVOn && arg && !isStaticExp(arg)) { 15297 pushMergeArg(createObjectExpression(props2, elementLoc)); 15298 } else { 15299 properties.push(...props2); 15300 } 15301 if (needRuntime) { 15302 runtimeDirectives.push(prop); 15303 if (isSymbol(needRuntime)) { 15304 directiveImportMap.set(prop, needRuntime); 15305 } 15306 } 15307 } else if (!isBuiltInDirective(name)) { 15308 runtimeDirectives.push(prop); 15309 if (hasChildren) { 15310 shouldUseBlock = true; 15311 } 15312 } 15313 } 15314 } 15315 let propsExpression = void 0; 15316 if (mergeArgs.length) { 15317 pushMergeArg(); 15318 if (mergeArgs.length > 1) { 15319 propsExpression = createCallExpression( 15320 context.helper(MERGE_PROPS), 15321 mergeArgs, 15322 elementLoc 15323 ); 15324 } else { 15325 propsExpression = mergeArgs[0]; 15326 } 15327 } else if (properties.length) { 15328 propsExpression = createObjectExpression( 15329 dedupeProperties(properties), 15330 elementLoc 15331 ); 15332 } 15333 if (hasDynamicKeys) { 15334 patchFlag |= 16; 15335 } else { 15336 if (hasClassBinding && !isComponent) { 15337 patchFlag |= 2; 15338 } 15339 if (hasStyleBinding && !isComponent) { 15340 patchFlag |= 4; 15341 } 15342 if (dynamicPropNames.length) { 15343 patchFlag |= 8; 15344 } 15345 if (hasHydrationEventBinding) { 15346 patchFlag |= 32; 15347 } 15348 } 15349 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 15350 patchFlag |= 512; 15351 } 15352 if (!context.inSSR && propsExpression) { 15353 switch (propsExpression.type) { 15354 case 15: 15355 let classKeyIndex = -1; 15356 let styleKeyIndex = -1; 15357 let hasDynamicKey = false; 15358 for (let i = 0; i < propsExpression.properties.length; i++) { 15359 const key = propsExpression.properties[i].key; 15360 if (isStaticExp(key)) { 15361 if (key.content === "class") { 15362 classKeyIndex = i; 15363 } else if (key.content === "style") { 15364 styleKeyIndex = i; 15365 } 15366 } else if (!key.isHandlerKey) { 15367 hasDynamicKey = true; 15368 } 15369 } 15370 const classProp = propsExpression.properties[classKeyIndex]; 15371 const styleProp = propsExpression.properties[styleKeyIndex]; 15372 if (!hasDynamicKey) { 15373 if (classProp && !isStaticExp(classProp.value)) { 15374 classProp.value = createCallExpression( 15375 context.helper(NORMALIZE_CLASS), 15376 [classProp.value] 15377 ); 15378 } 15379 if (styleProp && // the static style is compiled into an object, 15380 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 15381 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 15382 // v-bind:style with static literal object 15383 styleProp.value.type === 17)) { 15384 styleProp.value = createCallExpression( 15385 context.helper(NORMALIZE_STYLE), 15386 [styleProp.value] 15387 ); 15388 } 15389 } else { 15390 propsExpression = createCallExpression( 15391 context.helper(NORMALIZE_PROPS), 15392 [propsExpression] 15393 ); 15394 } 15395 break; 15396 case 14: 15397 break; 15398 default: 15399 propsExpression = createCallExpression( 15400 context.helper(NORMALIZE_PROPS), 15401 [ 15402 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 15403 propsExpression 15404 ]) 15405 ] 15406 ); 15407 break; 15408 } 15409 } 15410 return { 15411 props: propsExpression, 15412 directives: runtimeDirectives, 15413 patchFlag, 15414 dynamicPropNames, 15415 shouldUseBlock 15416 }; 15417 } 15418 function dedupeProperties(properties) { 15419 const knownProps = /* @__PURE__ */ new Map(); 15420 const deduped = []; 15421 for (let i = 0; i < properties.length; i++) { 15422 const prop = properties[i]; 15423 if (prop.key.type === 8 || !prop.key.isStatic) { 15424 deduped.push(prop); 15425 continue; 15426 } 15427 const name = prop.key.content; 15428 const existing = knownProps.get(name); 15429 if (existing) { 15430 if (name === "style" || name === "class" || isOn(name)) { 15431 mergeAsArray(existing, prop); 15432 } 15433 } else { 15434 knownProps.set(name, prop); 15435 deduped.push(prop); 15436 } 15437 } 15438 return deduped; 15439 } 15440 function mergeAsArray(existing, incoming) { 15441 if (existing.value.type === 17) { 15442 existing.value.elements.push(incoming.value); 15443 } else { 15444 existing.value = createArrayExpression( 15445 [existing.value, incoming.value], 15446 existing.loc 15447 ); 15448 } 15449 } 15450 function buildDirectiveArgs(dir, context) { 15451 const dirArgs = []; 15452 const runtime = directiveImportMap.get(dir); 15453 if (runtime) { 15454 dirArgs.push(context.helperString(runtime)); 15455 } else { 15456 { 15457 context.helper(RESOLVE_DIRECTIVE); 15458 context.directives.add(dir.name); 15459 dirArgs.push(toValidAssetId(dir.name, `directive`)); 15460 } 15461 } 15462 const { loc } = dir; 15463 if (dir.exp) 15464 dirArgs.push(dir.exp); 15465 if (dir.arg) { 15466 if (!dir.exp) { 15467 dirArgs.push(`void 0`); 15468 } 15469 dirArgs.push(dir.arg); 15470 } 15471 if (Object.keys(dir.modifiers).length) { 15472 if (!dir.arg) { 15473 if (!dir.exp) { 15474 dirArgs.push(`void 0`); 15475 } 15476 dirArgs.push(`void 0`); 15477 } 15478 const trueExpression = createSimpleExpression(`true`, false, loc); 15479 dirArgs.push( 15480 createObjectExpression( 15481 dir.modifiers.map( 15482 (modifier) => createObjectProperty(modifier, trueExpression) 15483 ), 15484 loc 15485 ) 15486 ); 15487 } 15488 return createArrayExpression(dirArgs, dir.loc); 15489 } 15490 function stringifyDynamicPropNames(props) { 15491 let propsNamesString = `[`; 15492 for (let i = 0, l = props.length; i < l; i++) { 15493 propsNamesString += JSON.stringify(props[i]); 15494 if (i < l - 1) 15495 propsNamesString += ", "; 15496 } 15497 return propsNamesString + `]`; 15498 } 15499 function isComponentTag(tag) { 15500 return tag === "component" || tag === "Component"; 15501 } 15502 15503 const transformSlotOutlet = (node, context) => { 15504 if (isSlotOutlet(node)) { 15505 const { children, loc } = node; 15506 const { slotName, slotProps } = processSlotOutlet(node, context); 15507 const slotArgs = [ 15508 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 15509 slotName, 15510 "{}", 15511 "undefined", 15512 "true" 15513 ]; 15514 let expectedLen = 2; 15515 if (slotProps) { 15516 slotArgs[2] = slotProps; 15517 expectedLen = 3; 15518 } 15519 if (children.length) { 15520 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 15521 expectedLen = 4; 15522 } 15523 if (context.scopeId && !context.slotted) { 15524 expectedLen = 5; 15525 } 15526 slotArgs.splice(expectedLen); 15527 node.codegenNode = createCallExpression( 15528 context.helper(RENDER_SLOT), 15529 slotArgs, 15530 loc 15531 ); 15532 } 15533 }; 15534 function processSlotOutlet(node, context) { 15535 let slotName = `"default"`; 15536 let slotProps = void 0; 15537 const nonNameProps = []; 15538 for (let i = 0; i < node.props.length; i++) { 15539 const p = node.props[i]; 15540 if (p.type === 6) { 15541 if (p.value) { 15542 if (p.name === "name") { 15543 slotName = JSON.stringify(p.value.content); 15544 } else { 15545 p.name = camelize(p.name); 15546 nonNameProps.push(p); 15547 } 15548 } 15549 } else { 15550 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 15551 if (p.exp) { 15552 slotName = p.exp; 15553 } else if (p.arg && p.arg.type === 4) { 15554 const name = camelize(p.arg.content); 15555 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 15556 } 15557 } else { 15558 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 15559 p.arg.content = camelize(p.arg.content); 15560 } 15561 nonNameProps.push(p); 15562 } 15563 } 15564 } 15565 if (nonNameProps.length > 0) { 15566 const { props, directives } = buildProps( 15567 node, 15568 context, 15569 nonNameProps, 15570 false, 15571 false 15572 ); 15573 slotProps = props; 15574 if (directives.length) { 15575 context.onError( 15576 createCompilerError( 15577 36, 15578 directives[0].loc 15579 ) 15580 ); 15581 } 15582 } 15583 return { 15584 slotName, 15585 slotProps 15586 }; 15587 } 15588 15589 const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
vendor: 4,666 bytes, lines 15590-15744
15590 const transformOn$1 = (dir, node, context, augmentor) => { 15591 const { loc, modifiers, arg } = dir; 15592 if (!dir.exp && !modifiers.length) { 15593 context.onError(createCompilerError(35, loc)); 15594 } 15595 let eventName; 15596 if (arg.type === 4) { 15597 if (arg.isStatic) { 15598 let rawName = arg.content; 15599 if (rawName.startsWith("vnode")) { 15600 context.onError(createCompilerError(51, arg.loc)); 15601 } 15602 if (rawName.startsWith("vue:")) { 15603 rawName = `vnode-${rawName.slice(4)}`; 15604 } 15605 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 15606 // for non-element and vnode lifecycle event listeners, auto convert 15607 // it to camelCase. See issue #2249 15608 toHandlerKey(camelize(rawName)) 15609 ) : ( 15610 // preserve case for plain element listeners that have uppercase 15611 // letters, as these may be custom elements' custom events 15612 `on:${rawName}` 15613 ); 15614 eventName = createSimpleExpression(eventString, true, arg.loc); 15615 } else { 15616 eventName = createCompoundExpression([ 15617 `${context.helperString(TO_HANDLER_KEY)}(`, 15618 arg, 15619 `)` 15620 ]); 15621 } 15622 } else { 15623 eventName = arg; 15624 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 15625 eventName.children.push(`)`); 15626 } 15627 let exp = dir.exp; 15628 if (exp && !exp.content.trim()) { 15629 exp = void 0; 15630 } 15631 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 15632 if (exp) { 15633 const isMemberExp = isMemberExpression(exp.content); 15634 const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content)); 15635 const hasMultipleStatements = exp.content.includes(`;`); 15636 { 15637 validateBrowserExpression( 15638 exp, 15639 context, 15640 false, 15641 hasMultipleStatements 15642 ); 15643 } 15644 if (isInlineStatement || shouldCache && isMemberExp) { 15645 exp = createCompoundExpression([ 15646 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 15647 exp, 15648 hasMultipleStatements ? `}` : `)` 15649 ]); 15650 } 15651 } 15652 let ret = { 15653 props: [ 15654 createObjectProperty( 15655 eventName, 15656 exp || createSimpleExpression(`() => {}`, false, loc) 15657 ) 15658 ] 15659 }; 15660 if (augmentor) { 15661 ret = augmentor(ret); 15662 } 15663 if (shouldCache) { 15664 ret.props[0].value = context.cache(ret.props[0].value); 15665 } 15666 ret.props.forEach((p) => p.key.isHandlerKey = true); 15667 return ret; 15668 }; 15669 15670 const transformBind = (dir, _node, context) => { 15671 const { modifiers, loc } = dir; 15672 const arg = dir.arg; 15673 let { exp } = dir; 15674 if (exp && exp.type === 4 && !exp.content.trim()) { 15675 { 15676 exp = void 0; 15677 } 15678 } 15679 if (!exp) { 15680 if (arg.type !== 4 || !arg.isStatic) { 15681 context.onError( 15682 createCompilerError( 15683 52, 15684 arg.loc 15685 ) 15686 ); 15687 return { 15688 props: [ 15689 createObjectProperty(arg, createSimpleExpression("", true, loc)) 15690 ] 15691 }; 15692 } 15693 const propName = camelize(arg.content); 15694 exp = dir.exp = createSimpleExpression(propName, false, arg.loc); 15695 } 15696 if (arg.type !== 4) { 15697 arg.children.unshift(`(`); 15698 arg.children.push(`) || ""`); 15699 } else if (!arg.isStatic) { 15700 arg.content = `${arg.content} || ""`; 15701 } 15702 if (modifiers.includes("camel")) { 15703 if (arg.type === 4) { 15704 if (arg.isStatic) { 15705 arg.content = camelize(arg.content); 15706 } else { 15707 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 15708 } 15709 } else { 15710 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 15711 arg.children.push(`)`); 15712 } 15713 } 15714 if (!context.inSSR) { 15715 if (modifiers.includes("prop")) { 15716 injectPrefix(arg, "."); 15717 } 15718 if (modifiers.includes("attr")) { 15719 injectPrefix(arg, "^"); 15720 } 15721 } 15722 return { 15723 props: [createObjectProperty(arg, exp)] 15724 }; 15725 }; 15726 const injectPrefix = (arg, prefix) => { 15727 if (arg.type === 4) { 15728 if (arg.isStatic) { 15729 arg.content = prefix + arg.content; 15730 } else { 15731 arg.content = `\`${prefix}\${${arg.content}}\``; 15732 } 15733 } else { 15734 arg.children.unshift(`'${prefix}' + (`); 15735 arg.children.push(`)`); 15736 } 15737 }; 15738 15739 const transformText = (node, context) => { 15740 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 15741 return () => { 15742 const children = node.children; 15743 let currentContainer = void 0; 15744 let hasText = false;
vendor: 4,144 bytes, lines 15745-15859
15745 for (let i = 0; i < children.length; i++) { 15746 const child = children[i]; 15747 if (isText$1(child)) { 15748 hasText = true; 15749 for (let j = i + 1; j < children.length; j++) { 15750 const next = children[j]; 15751 if (isText$1(next)) { 15752 if (!currentContainer) { 15753 currentContainer = children[i] = createCompoundExpression( 15754 [child], 15755 child.loc 15756 ); 15757 } 15758 currentContainer.children.push(` + `, next); 15759 children.splice(j, 1); 15760 j--; 15761 } else { 15762 currentContainer = void 0; 15763 break; 15764 } 15765 } 15766 } 15767 } 15768 if (!hasText || // if this is a plain element with a single text child, leave it 15769 // as-is since the runtime has dedicated fast path for this by directly 15770 // setting textContent of the element. 15771 // for component root it's always normalized anyway. 15772 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 15773 // custom directives can potentially add DOM elements arbitrarily, 15774 // we need to avoid setting textContent of the element at runtime 15775 // to avoid accidentally overwriting the DOM elements added 15776 // by the user through custom directives. 15777 !node.props.find( 15778 (p) => p.type === 7 && !context.directiveTransforms[p.name] 15779 ) && // in compat mode, <template> tags with no special directives 15780 // will be rendered as a fragment so its children must be 15781 // converted into vnodes. 15782 true)) { 15783 return; 15784 } 15785 for (let i = 0; i < children.length; i++) { 15786 const child = children[i]; 15787 if (isText$1(child) || child.type === 8) { 15788 const callArgs = []; 15789 if (child.type !== 2 || child.content !== " ") { 15790 callArgs.push(child); 15791 } 15792 if (!context.ssr && getConstantType(child, context) === 0) { 15793 callArgs.push( 15794 1 + (` /* ${PatchFlagNames[1]} */` ) 15795 ); 15796 } 15797 children[i] = { 15798 type: 12, 15799 content: child, 15800 loc: child.loc, 15801 codegenNode: createCallExpression( 15802 context.helper(CREATE_TEXT), 15803 callArgs 15804 ) 15805 }; 15806 } 15807 } 15808 }; 15809 } 15810 }; 15811 15812 const seen$1 = /* @__PURE__ */ new WeakSet(); 15813 const transformOnce = (node, context) => { 15814 if (node.type === 1 && findDir(node, "once", true)) { 15815 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 15816 return; 15817 } 15818 seen$1.add(node); 15819 context.inVOnce = true; 15820 context.helper(SET_BLOCK_TRACKING); 15821 return () => { 15822 context.inVOnce = false; 15823 const cur = context.currentNode; 15824 if (cur.codegenNode) { 15825 cur.codegenNode = context.cache( 15826 cur.codegenNode, 15827 true 15828 /* isVNode */ 15829 ); 15830 } 15831 }; 15832 } 15833 }; 15834 15835 const transformModel$1 = (dir, node, context) => { 15836 const { exp, arg } = dir; 15837 if (!exp) { 15838 context.onError( 15839 createCompilerError(41, dir.loc) 15840 ); 15841 return createTransformProps(); 15842 } 15843 const rawExp = exp.loc.source; 15844 const expString = exp.type === 4 ? exp.content : rawExp; 15845 const bindingType = context.bindingMetadata[rawExp]; 15846 if (bindingType === "props" || bindingType === "props-aliased") { 15847 context.onError(createCompilerError(44, exp.loc)); 15848 return createTransformProps(); 15849 } 15850 const maybeRef = false; 15851 if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) { 15852 context.onError( 15853 createCompilerError(42, exp.loc) 15854 ); 15855 return createTransformProps(); 15856 } 15857 const propName = arg ? arg : createSimpleExpression("modelValue", true); 15858 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 15859 let assignmentExp;
vendor: 9,761 bytes, lines 15860-16188
15860 const eventArg = context.isTS ? `($event: any)` : `$event`; 15861 { 15862 assignmentExp = createCompoundExpression([ 15863 `${eventArg} => ((`, 15864 exp, 15865 `) = $event)` 15866 ]); 15867 } 15868 const props = [ 15869 // modelValue: foo 15870 createObjectProperty(propName, dir.exp), 15871 // "onUpdate:modelValue": $event => (foo = $event) 15872 createObjectProperty(eventName, assignmentExp) 15873 ]; 15874 if (dir.modifiers.length && node.tagType === 1) { 15875 const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 15876 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 15877 props.push( 15878 createObjectProperty( 15879 modifiersKey, 15880 createSimpleExpression( 15881 `{ ${modifiers} }`, 15882 false, 15883 dir.loc, 15884 2 15885 ) 15886 ) 15887 ); 15888 } 15889 return createTransformProps(props); 15890 }; 15891 function createTransformProps(props = []) { 15892 return { props }; 15893 } 15894 15895 const seen = /* @__PURE__ */ new WeakSet(); 15896 const transformMemo = (node, context) => { 15897 if (node.type === 1) { 15898 const dir = findDir(node, "memo"); 15899 if (!dir || seen.has(node)) { 15900 return; 15901 } 15902 seen.add(node); 15903 return () => { 15904 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 15905 if (codegenNode && codegenNode.type === 13) { 15906 if (node.tagType !== 1) { 15907 convertToBlock(codegenNode, context); 15908 } 15909 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 15910 dir.exp, 15911 createFunctionExpression(void 0, codegenNode), 15912 `_cache`, 15913 String(context.cached++) 15914 ]); 15915 } 15916 }; 15917 } 15918 }; 15919 15920 function getBaseTransformPreset(prefixIdentifiers) { 15921 return [ 15922 [ 15923 transformOnce, 15924 transformIf, 15925 transformMemo, 15926 transformFor, 15927 ...[], 15928 ...[transformExpression] , 15929 transformSlotOutlet, 15930 transformElement, 15931 trackSlotScopes, 15932 transformText 15933 ], 15934 { 15935 on: transformOn$1, 15936 bind: transformBind, 15937 model: transformModel$1 15938 } 15939 ]; 15940 } 15941 function baseCompile(source, options = {}) { 15942 const onError = options.onError || defaultOnError; 15943 const isModuleMode = options.mode === "module"; 15944 { 15945 if (options.prefixIdentifiers === true) { 15946 onError(createCompilerError(47)); 15947 } else if (isModuleMode) { 15948 onError(createCompilerError(48)); 15949 } 15950 } 15951 const prefixIdentifiers = false; 15952 if (options.cacheHandlers) { 15953 onError(createCompilerError(49)); 15954 } 15955 if (options.scopeId && !isModuleMode) { 15956 onError(createCompilerError(50)); 15957 } 15958 const resolvedOptions = extend({}, options, { 15959 prefixIdentifiers 15960 }); 15961 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 15962 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 15963 transform( 15964 ast, 15965 extend({}, resolvedOptions, { 15966 nodeTransforms: [ 15967 ...nodeTransforms, 15968 ...options.nodeTransforms || [] 15969 // user transforms 15970 ], 15971 directiveTransforms: extend( 15972 {}, 15973 directiveTransforms, 15974 options.directiveTransforms || {} 15975 // user transforms 15976 ) 15977 }) 15978 ); 15979 return generate(ast, resolvedOptions); 15980 } 15981 15982 const noopDirectiveTransform = () => ({ props: [] }); 15983 15984 const V_MODEL_RADIO = Symbol(`vModelRadio` ); 15985 const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` ); 15986 const V_MODEL_TEXT = Symbol(`vModelText` ); 15987 const V_MODEL_SELECT = Symbol(`vModelSelect` ); 15988 const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` ); 15989 const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` ); 15990 const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` ); 15991 const V_SHOW = Symbol(`vShow` ); 15992 const TRANSITION = Symbol(`Transition` ); 15993 const TRANSITION_GROUP = Symbol(`TransitionGroup` ); 15994 registerRuntimeHelpers({ 15995 [V_MODEL_RADIO]: `vModelRadio`, 15996 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 15997 [V_MODEL_TEXT]: `vModelText`, 15998 [V_MODEL_SELECT]: `vModelSelect`, 15999 [V_MODEL_DYNAMIC]: `vModelDynamic`, 16000 [V_ON_WITH_MODIFIERS]: `withModifiers`, 16001 [V_ON_WITH_KEYS]: `withKeys`, 16002 [V_SHOW]: `vShow`, 16003 [TRANSITION]: `Transition`, 16004 [TRANSITION_GROUP]: `TransitionGroup` 16005 }); 16006 16007 let decoder; 16008 function decodeHtmlBrowser(raw, asAttr = false) { 16009 if (!decoder) { 16010 decoder = document.createElement("div"); 16011 } 16012 if (asAttr) { 16013 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 16014 return decoder.children[0].getAttribute("foo"); 16015 } else { 16016 decoder.innerHTML = raw; 16017 return decoder.textContent; 16018 } 16019 } 16020 16021 const parserOptions = { 16022 parseMode: "html", 16023 isVoidTag, 16024 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 16025 isPreTag: (tag) => tag === "pre", 16026 decodeEntities: decodeHtmlBrowser , 16027 isBuiltInComponent: (tag) => { 16028 if (tag === "Transition" || tag === "transition") { 16029 return TRANSITION; 16030 } else if (tag === "TransitionGroup" || tag === "transition-group") { 16031 return TRANSITION_GROUP; 16032 } 16033 }, 16034 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 16035 getNamespace(tag, parent, rootNamespace) { 16036 let ns = parent ? parent.ns : rootNamespace; 16037 if (parent && ns === 2) { 16038 if (parent.tag === "annotation-xml") { 16039 if (tag === "svg") { 16040 return 1; 16041 } 16042 if (parent.props.some( 16043 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 16044 )) { 16045 ns = 0; 16046 } 16047 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 16048 ns = 0; 16049 } 16050 } else if (parent && ns === 1) { 16051 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 16052 ns = 0; 16053 } 16054 } 16055 if (ns === 0) { 16056 if (tag === "svg") { 16057 return 1; 16058 } 16059 if (tag === "math") { 16060 return 2; 16061 } 16062 } 16063 return ns; 16064 } 16065 }; 16066 16067 const transformStyle = (node) => { 16068 if (node.type === 1) { 16069 node.props.forEach((p, i) => { 16070 if (p.type === 6 && p.name === "style" && p.value) { 16071 node.props[i] = { 16072 type: 7, 16073 name: `bind`, 16074 arg: createSimpleExpression(`style`, true, p.loc), 16075 exp: parseInlineCSS(p.value.content, p.loc), 16076 modifiers: [], 16077 loc: p.loc 16078 }; 16079 } 16080 }); 16081 } 16082 }; 16083 const parseInlineCSS = (cssText, loc) => { 16084 const normalized = parseStringStyle(cssText); 16085 return createSimpleExpression( 16086 JSON.stringify(normalized), 16087 false, 16088 loc, 16089 3 16090 ); 16091 }; 16092 16093 function createDOMCompilerError(code, loc) { 16094 return createCompilerError( 16095 code, 16096 loc, 16097 DOMErrorMessages 16098 ); 16099 } 16100 const DOMErrorMessages = { 16101 [53]: `v-html is missing expression.`, 16102 [54]: `v-html will override element children.`, 16103 [55]: `v-text is missing expression.`, 16104 [56]: `v-text will override element children.`, 16105 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 16106 [58]: `v-model argument is not supported on plain elements.`, 16107 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 16108 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 16109 [61]: `v-show is missing expression.`, 16110 [62]: `<Transition> expects exactly one child element or component.`, 16111 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 16112 }; 16113 16114 const transformVHtml = (dir, node, context) => { 16115 const { exp, loc } = dir; 16116 if (!exp) { 16117 context.onError( 16118 createDOMCompilerError(53, loc) 16119 ); 16120 } 16121 if (node.children.length) { 16122 context.onError( 16123 createDOMCompilerError(54, loc) 16124 ); 16125 node.children.length = 0; 16126 } 16127 return { 16128 props: [ 16129 createObjectProperty( 16130 createSimpleExpression(`innerHTML`, true, loc), 16131 exp || createSimpleExpression("", true) 16132 ) 16133 ] 16134 }; 16135 }; 16136 16137 const transformVText = (dir, node, context) => { 16138 const { exp, loc } = dir; 16139 if (!exp) { 16140 context.onError( 16141 createDOMCompilerError(55, loc) 16142 ); 16143 } 16144 if (node.children.length) { 16145 context.onError( 16146 createDOMCompilerError(56, loc) 16147 ); 16148 node.children.length = 0; 16149 } 16150 return { 16151 props: [ 16152 createObjectProperty( 16153 createSimpleExpression(`textContent`, true), 16154 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 16155 context.helperString(TO_DISPLAY_STRING), 16156 [exp], 16157 loc 16158 ) : createSimpleExpression("", true) 16159 ) 16160 ] 16161 }; 16162 }; 16163 16164 const transformModel = (dir, node, context) => { 16165 const baseResult = transformModel$1(dir, node, context); 16166 if (!baseResult.props.length || node.tagType === 1) { 16167 return baseResult; 16168 } 16169 if (dir.arg) { 16170 context.onError( 16171 createDOMCompilerError( 16172 58, 16173 dir.arg.loc 16174 ) 16175 ); 16176 } 16177 function checkDuplicatedValue() { 16178 const value = findDir(node, "bind"); 16179 if (value && isStaticArgOf(value.arg, "value")) { 16180 context.onError( 16181 createDOMCompilerError( 16182 60, 16183 value.loc 16184 ) 16185 ); 16186 } 16187 } 16188 const { tag } = node;
vendor: 8,058 bytes, lines 16189-16449
16189 const isCustomElement = context.isCustomElement(tag); 16190 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 16191 let directiveToUse = V_MODEL_TEXT; 16192 let isInvalidType = false; 16193 if (tag === "input" || isCustomElement) { 16194 const type = findProp(node, `type`); 16195 if (type) { 16196 if (type.type === 7) { 16197 directiveToUse = V_MODEL_DYNAMIC; 16198 } else if (type.value) { 16199 switch (type.value.content) { 16200 case "radio": 16201 directiveToUse = V_MODEL_RADIO; 16202 break; 16203 case "checkbox": 16204 directiveToUse = V_MODEL_CHECKBOX; 16205 break; 16206 case "file": 16207 isInvalidType = true; 16208 context.onError( 16209 createDOMCompilerError( 16210 59, 16211 dir.loc 16212 ) 16213 ); 16214 break; 16215 default: 16216 checkDuplicatedValue(); 16217 break; 16218 } 16219 } 16220 } else if (hasDynamicKeyVBind(node)) { 16221 directiveToUse = V_MODEL_DYNAMIC; 16222 } else { 16223 checkDuplicatedValue(); 16224 } 16225 } else if (tag === "select") { 16226 directiveToUse = V_MODEL_SELECT; 16227 } else { 16228 checkDuplicatedValue(); 16229 } 16230 if (!isInvalidType) { 16231 baseResult.needRuntime = context.helper(directiveToUse); 16232 } 16233 } else { 16234 context.onError( 16235 createDOMCompilerError( 16236 57, 16237 dir.loc 16238 ) 16239 ); 16240 } 16241 baseResult.props = baseResult.props.filter( 16242 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 16243 ); 16244 return baseResult; 16245 }; 16246 16247 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 16248 const isNonKeyModifier = /* @__PURE__ */ makeMap( 16249 // event propagation management 16250 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 16251 ); 16252 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 16253 const isKeyboardEvent = /* @__PURE__ */ makeMap( 16254 `onkeyup,onkeydown,onkeypress`, 16255 true 16256 ); 16257 const resolveModifiers = (key, modifiers, context, loc) => { 16258 const keyModifiers = []; 16259 const nonKeyModifiers = []; 16260 const eventOptionModifiers = []; 16261 for (let i = 0; i < modifiers.length; i++) { 16262 const modifier = modifiers[i]; 16263 if (isEventOptionModifier(modifier)) { 16264 eventOptionModifiers.push(modifier); 16265 } else { 16266 if (maybeKeyModifier(modifier)) { 16267 if (isStaticExp(key)) { 16268 if (isKeyboardEvent(key.content)) { 16269 keyModifiers.push(modifier); 16270 } else { 16271 nonKeyModifiers.push(modifier); 16272 } 16273 } else { 16274 keyModifiers.push(modifier); 16275 nonKeyModifiers.push(modifier); 16276 } 16277 } else { 16278 if (isNonKeyModifier(modifier)) { 16279 nonKeyModifiers.push(modifier); 16280 } else { 16281 keyModifiers.push(modifier); 16282 } 16283 } 16284 } 16285 } 16286 return { 16287 keyModifiers, 16288 nonKeyModifiers, 16289 eventOptionModifiers 16290 }; 16291 }; 16292 const transformClick = (key, event) => { 16293 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 16294 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 16295 `(`, 16296 key, 16297 `) === "onClick" ? "${event}" : (`, 16298 key, 16299 `)` 16300 ]) : key; 16301 }; 16302 const transformOn = (dir, node, context) => { 16303 return transformOn$1(dir, node, context, (baseResult) => { 16304 const { modifiers } = dir; 16305 if (!modifiers.length) 16306 return baseResult; 16307 let { key, value: handlerExp } = baseResult.props[0]; 16308 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 16309 if (nonKeyModifiers.includes("right")) { 16310 key = transformClick(key, `onContextmenu`); 16311 } 16312 if (nonKeyModifiers.includes("middle")) { 16313 key = transformClick(key, `onMouseup`); 16314 } 16315 if (nonKeyModifiers.length) { 16316 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 16317 handlerExp, 16318 JSON.stringify(nonKeyModifiers) 16319 ]); 16320 } 16321 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 16322 (!isStaticExp(key) || isKeyboardEvent(key.content))) { 16323 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 16324 handlerExp, 16325 JSON.stringify(keyModifiers) 16326 ]); 16327 } 16328 if (eventOptionModifiers.length) { 16329 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 16330 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 16331 } 16332 return { 16333 props: [createObjectProperty(key, handlerExp)] 16334 }; 16335 }); 16336 }; 16337 16338 const transformShow = (dir, node, context) => { 16339 const { exp, loc } = dir; 16340 if (!exp) { 16341 context.onError( 16342 createDOMCompilerError(61, loc) 16343 ); 16344 } 16345 return { 16346 props: [], 16347 needRuntime: context.helper(V_SHOW) 16348 }; 16349 }; 16350 16351 const transformTransition = (node, context) => { 16352 if (node.type === 1 && node.tagType === 1) { 16353 const component = context.isBuiltInComponent(node.tag); 16354 if (component === TRANSITION) { 16355 return () => { 16356 if (!node.children.length) { 16357 return; 16358 } 16359 if (hasMultipleChildren(node)) { 16360 context.onError( 16361 createDOMCompilerError( 16362 62, 16363 { 16364 start: node.children[0].loc.start, 16365 end: node.children[node.children.length - 1].loc.end, 16366 source: "" 16367 } 16368 ) 16369 ); 16370 } 16371 const child = node.children[0]; 16372 if (child.type === 1) { 16373 for (const p of child.props) { 16374 if (p.type === 7 && p.name === "show") { 16375 node.props.push({ 16376 type: 6, 16377 name: "persisted", 16378 nameLoc: node.loc, 16379 value: void 0, 16380 loc: node.loc 16381 }); 16382 } 16383 } 16384 } 16385 }; 16386 } 16387 } 16388 }; 16389 function hasMultipleChildren(node) { 16390 const children = node.children = node.children.filter( 16391 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim()) 16392 ); 16393 const child = children[0]; 16394 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 16395 } 16396 16397 const ignoreSideEffectTags = (node, context) => { 16398 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 16399 context.onError( 16400 createDOMCompilerError( 16401 63, 16402 node.loc 16403 ) 16404 ); 16405 context.removeNode(); 16406 } 16407 }; 16408 16409 const DOMNodeTransforms = [ 16410 transformStyle, 16411 ...[transformTransition] 16412 ]; 16413 const DOMDirectiveTransforms = { 16414 cloak: noopDirectiveTransform, 16415 html: transformVHtml, 16416 text: transformVText, 16417 model: transformModel, 16418 // override compiler-core 16419 on: transformOn, 16420 // override compiler-core 16421 show: transformShow 16422 }; 16423 function compile(src, options = {}) { 16424 return baseCompile( 16425 src, 16426 extend({}, parserOptions, options, { 16427 nodeTransforms: [ 16428 // ignore <script> and <tag> 16429 // this is not put inside DOMNodeTransforms because that list is used 16430 // by compiler-ssr to generate vnode fallback branches 16431 ignoreSideEffectTags, 16432 ...DOMNodeTransforms, 16433 ...options.nodeTransforms || [] 16434 ], 16435 directiveTransforms: extend( 16436 {}, 16437 DOMDirectiveTransforms, 16438 options.directiveTransforms || {} 16439 ), 16440 transformHoist: null 16441 }) 16442 ); 16443 } 16444 16445 { 16446 initDev(); 16447 } 16448 const compileCache = /* @__PURE__ */ new WeakMap(); 16449 function getCache(options) {
16450 let c = compileCache.get(options != null ? options : EMPTY_OBJ); 16451 if (!c) { 16452 c = /* @__PURE__ */ Object.create(null); 16453 compileCache.set(options != null ? options : EMPTY_OBJ, c); 16454 } 16455 return c; 16456 } 16457 function compileToFunction(template, options) { 16458 if (!isString(template)) { 16459 if (template.nodeType) { 16460 template = template.innerHTML; 16461 } else { 16462 warn(`invalid template option: `, template); 16463 return NOOP; 16464 } 16465 } 16466 const key = template; 16467 const cache = getCache(options); 16468 const cached = cache[key]; 16469 if (cached) { 16470 return cached; 16471 } 16472 if (template[0] === "#") { 16473 const el = document.querySelector(template); 16474 if (!el) { 16475 warn(`Template element not found or is empty: ${template}`); 16476 } 16477 template = el ? el.innerHTML : ``; 16478 } 16479 const opts = extend( 16480 { 16481 hoistStatic: true, 16482 onError: onError , 16483 onWarn: (e) => onError(e, true) 16484 }, 16485 options 16486 ); 16487 if (!opts.isCustomElement && typeof customElements !== "undefined") { 16488 opts.isCustomElement = (tag) => !!customElements.get(tag); 16489 } 16490 const { code } = compile(template, opts); 16491 function onError(err, asWarning = false) { 16492 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 16493 const codeFrame = err.loc && generateCodeFrame( 16494 template, 16495 err.loc.start.offset, 16496 err.loc.end.offset 16497 ); 16498 warn(codeFrame ? `${message} 16499${codeFrame}` : message); 16500 } 16501 const render = new Function(code)() ; 16502 render._rc = true; 16503 return cache[key] = render; 16504 } 16505 registerRuntimeCompiler(compileToFunction); 16506 16507 exports.BaseTransition = BaseTransition; 16508 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 16509 exports.Comment = Comment; 16510 exports.DeprecationTypes = DeprecationTypes; 16511 exports.EffectScope = EffectScope; 16512 exports.ErrorCodes = ErrorCodes; 16513 exports.ErrorTypeStrings = ErrorTypeStrings; 16514 exports.Fragment = Fragment; 16515 exports.KeepAlive = KeepAlive; 16516 exports.ReactiveEffect = ReactiveEffect; 16517 exports.Static = Static; 16518 exports.Suspense = Suspense; 16519 exports.Teleport = Teleport; 16520 exports.Text = Text; 16521 exports.TrackOpTypes = TrackOpTypes; 16522 exports.Transition = Transition; 16523 exports.TransitionGroup = TransitionGroup; 16524 exports.TriggerOpTypes = TriggerOpTypes; 16525 exports.VueElement = VueElement; 16526 exports.assertNumber = assertNumber; 16527 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 16528 exports.callWithErrorHandling = callWithErrorHandling; 16529 exports.camelize = camelize; 16530 exports.capitalize = capitalize; 16531 exports.cloneVNode = cloneVNode; 16532 exports.compatUtils = compatUtils; 16533 exports.compile = compileToFunction; 16534 exports.computed = computed; 16535 exports.createApp = createApp; 16536 exports.createBlock = createBlock; 16537 exports.createCommentVNode = createCommentVNode; 16538 exports.createElementBlock = createElementBlock; 16539 exports.createElementVNode = createBaseVNode; 16540 exports.createHydrationRenderer = createHydrationRenderer; 16541 exports.createPropsRestProxy = createPropsRestProxy; 16542 exports.createRenderer = createRenderer; 16543 exports.createSSRApp = createSSRApp; 16544 exports.createSlots = createSlots; 16545 exports.createStaticVNode = createStaticVNode; 16546 exports.createTextVNode = createTextVNode; 16547 exports.createVNode = createVNode; 16548 exports.customRef = customRef; 16549 exports.defineAsyncComponent = defineAsyncComponent; 16550 exports.defineComponent = defineComponent; 16551 exports.defineCustomElement = defineCustomElement; 16552 exports.defineEmits = defineEmits; 16553 exports.defineExpose = defineExpose; 16554 exports.defineModel = defineModel; 16555 exports.defineOptions = defineOptions; 16556 exports.defineProps = defineProps; 16557 exports.defineSSRCustomElement = defineSSRCustomElement; 16558 exports.defineSlots = defineSlots; 16559 exports.devtools = devtools; 16560 exports.effect = effect; 16561 exports.effectScope = effectScope; 16562 exports.getCurrentInstance = getCurrentInstance; 16563 exports.getCurrentScope = getCurrentScope; 16564 exports.getTransitionRawChildren = getTransitionRawChildren; 16565 exports.guardReactiveProps = guardReactiveProps; 16566 exports.h = h; 16567 exports.handleError = handleError; 16568 exports.hasInjectionContext = hasInjectionContext; 16569 exports.hydrate = hydrate;
16570 exports.initCustomFormatter = initCustomFormatter; 16571 exports.initDirectivesForSSR = initDirectivesForSSR; 16572 exports.inject = inject; 16573 exports.isMemoSame = isMemoSame; 16574 exports.isProxy = isProxy; 16575 exports.isReactive = isReactive; 16576 exports.isReadonly = isReadonly; 16577 exports.isRef = isRef; 16578 exports.isRuntimeOnly = isRuntimeOnly; 16579 exports.isShallow = isShallow; 16580 exports.isVNode = isVNode; 16581 exports.markRaw = markRaw; 16582 exports.mergeDefaults = mergeDefaults; 16583 exports.mergeModels = mergeModels; 16584 exports.mergeProps = mergeProps; 16585 exports.nextTick = nextTick; 16586 exports.normalizeClass = normalizeClass; 16587 exports.normalizeProps = normalizeProps; 16588 exports.normalizeStyle = normalizeStyle; 16589 exports.onActivated = onActivated; 16590 exports.onBeforeMount = onBeforeMount; 16591 exports.onBeforeUnmount = onBeforeUnmount; 16592 exports.onBeforeUpdate = onBeforeUpdate; 16593 exports.onDeactivated = onDeactivated; 16594 exports.onErrorCaptured = onErrorCaptured; 16595 exports.onMounted = onMounted; 16596 exports.onRenderTracked = onRenderTracked; 16597 exports.onRenderTriggered = onRenderTriggered; 16598 exports.onScopeDispose = onScopeDispose; 16599 exports.onServerPrefetch = onServerPrefetch; 16600 exports.onUnmounted = onUnmounted; 16601 exports.onUpdated = onUpdated; 16602 exports.openBlock = openBlock; 16603 exports.popScopeId = popScopeId; 16604 exports.provide = provide; 16605 exports.proxyRefs = proxyRefs; 16606 exports.pushScopeId = pushScopeId; 16607 exports.queuePostFlushCb = queuePostFlushCb; 16608 exports.reactive = reactive; 16609 exports.readonly = readonly; 16610 exports.ref = ref; 16611 exports.registerRuntimeCompiler = registerRuntimeCompiler; 16612 exports.render = render; 16613 exports.renderList = renderList; 16614 exports.renderSlot = renderSlot; 16615 exports.resolveComponent = resolveComponent; 16616 exports.resolveDirective = resolveDirective; 16617 exports.resolveDynamicComponent = resolveDynamicComponent; 16618 exports.resolveFilter = resolveFilter; 16619 exports.resolveTransitionHooks = resolveTransitionHooks; 16620 exports.setBlockTracking = setBlockTracking; 16621 exports.setDevtoolsHook = setDevtoolsHook; 16622 exports.setTransitionHooks = setTransitionHooks; 16623 exports.shallowReactive = shallowReactive; 16624 exports.shallowReadonly = shallowReadonly; 16625 exports.shallowRef = shallowRef; 16626 exports.ssrContextKey = ssrContextKey; 16627 exports.ssrUtils = ssrUtils; 16628 exports.stop = stop; 16629 exports.toDisplayString = toDisplayString; 16630 exports.toHandlerKey = toHandlerKey; 16631 exports.toHandlers = toHandlers; 16632 exports.toRaw = toRaw; 16633 exports.toRef = toRef; 16634 exports.toRefs = toRefs; 16635 exports.toValue = toValue; 16636 exports.transformVNodeArgs = transformVNodeArgs; 16637 exports.triggerRef = triggerRef; 16638 exports.unref = unref; 16639 exports.useAttrs = useAttrs; 16640 exports.useCssModule = useCssModule; 16641 exports.useCssVars = useCssVars; 16642 exports.useModel = useModel; 16643 exports.useSSRContext = useSSRContext; 16644 exports.useSlots = useSlots; 16645 exports.useTransitionState = useTransitionState; 16646 exports.vModelCheckbox = vModelCheckbox; 16647 exports.vModelDynamic = vModelDynamic; 16648 exports.vModelRadio = vModelRadio; 16649 exports.vModelSelect = vModelSelect; 16650 exports.vModelText = vModelText; 16651 exports.vShow = vShow; 16652 exports.version = version; 16653 exports.warn = warn; 16654 exports.watch = watch; 16655 exports.watchEffect = watchEffect; 16656 exports.watchPostEffect = watchPostEffect; 16657 exports.watchSyncEffect = watchSyncEffect; 16658 exports.withAsyncContext = withAsyncContext; 16659 exports.withCtx = withCtx; 16660 exports.withDefaults = withDefaults; 16661 exports.withDirectives = withDirectives; 16662 exports.withKeys = withKeys; 16663 exports.withMemo = withMemo; 16664 exports.withModifiers = withModifiers; 16665 exports.withScopeId = withScopeId; 16666 16667 return exports; 16668 16669})({});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.