vendor: 4,764 bytes, lines 1-141
1/** 2* vue v3.5.22 3* (c) 2018-present Yuxi (Evan) You and Vue contributors 4* @license MIT 5**/ 6var Vue = (function (exports) { 7 'use strict'; 8 9 // @__NO_SIDE_EFFECTS__ 10 function makeMap(str) { 11 const map = /* @__PURE__ */ Object.create(null); 12 for (const key of str.split(",")) map[key] = 1; 13 return (val) => val in map; 14 } 15 16 const EMPTY_OBJ = Object.freeze({}) ; 17 const EMPTY_ARR = Object.freeze([]) ; 18 const NOOP = () => { 19 }; 20 const NO = () => false; 21 const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter 22 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); 23 const isModelListener = (key) => key.startsWith("onUpdate:"); 24 const extend = Object.assign; 25 const remove = (arr, el) => { 26 const i = arr.indexOf(el); 27 if (i > -1) { 28 arr.splice(i, 1); 29 } 30 }; 31 const hasOwnProperty$1 = Object.prototype.hasOwnProperty; 32 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); 33 const isArray = Array.isArray; 34 const isMap = (val) => toTypeString(val) === "[object Map]"; 35 const isSet = (val) => toTypeString(val) === "[object Set]"; 36 const isDate = (val) => toTypeString(val) === "[object Date]"; 37 const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 38 const isFunction = (val) => typeof val === "function"; 39 const isString = (val) => typeof val === "string"; 40 const isSymbol = (val) => typeof val === "symbol"; 41 const isObject = (val) => val !== null && typeof val === "object"; 42 const isPromise = (val) => { 43 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); 44 }; 45 const objectToString = Object.prototype.toString; 46 const toTypeString = (value) => objectToString.call(value); 47 const toRawType = (value) => { 48 return toTypeString(value).slice(8, -1); 49 }; 50 const isPlainObject = (val) => toTypeString(val) === "[object Object]"; 51 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 52 const isReservedProp = /* @__PURE__ */ makeMap( 53 // the leading comma is intentional so empty string "" is also included 54 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 55 ); 56 const isBuiltInDirective = /* @__PURE__ */ makeMap( 57 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" 58 ); 59 const cacheStringFunction = (fn) => { 60 const cache = /* @__PURE__ */ Object.create(null); 61 return ((str) => { 62 const hit = cache[str]; 63 return hit || (cache[str] = fn(str)); 64 }); 65 }; 66 const camelizeRE = /-\w/g; 67 const camelize = cacheStringFunction( 68 (str) => { 69 return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase()); 70 } 71 ); 72 const hyphenateRE = /\B([A-Z])/g; 73 const hyphenate = cacheStringFunction( 74 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 75 ); 76 const capitalize = cacheStringFunction((str) => { 77 return str.charAt(0).toUpperCase() + str.slice(1); 78 }); 79 const toHandlerKey = cacheStringFunction( 80 (str) => { 81 const s = str ? `on${capitalize(str)}` : ``; 82 return s; 83 } 84 ); 85 const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 86 const invokeArrayFns = (fns, ...arg) => { 87 for (let i = 0; i < fns.length; i++) { 88 fns[i](...arg); 89 } 90 }; 91 const def = (obj, key, value, writable = false) => { 92 Object.defineProperty(obj, key, { 93 configurable: true, 94 enumerable: false, 95 writable, 96 value 97 }); 98 }; 99 const looseToNumber = (val) => { 100 const n = parseFloat(val); 101 return isNaN(n) ? val : n; 102 }; 103 const toNumber = (val) => { 104 const n = isString(val) ? Number(val) : NaN; 105 return isNaN(n) ? val : n; 106 }; 107 let _globalThis; 108 const getGlobalThis = () => { 109 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 110 }; 111 function genCacheKey(source, options) { 112 return source + JSON.stringify( 113 options, 114 (_, val) => typeof val === "function" ? val.toString() : val 115 ); 116 } 117 118 const PatchFlagNames = { 119 [1]: `TEXT`, 120 [2]: `CLASS`, 121 [4]: `STYLE`, 122 [8]: `PROPS`, 123 [16]: `FULL_PROPS`, 124 [32]: `NEED_HYDRATION`, 125 [64]: `STABLE_FRAGMENT`, 126 [128]: `KEYED_FRAGMENT`, 127 [256]: `UNKEYED_FRAGMENT`, 128 [512]: `NEED_PATCH`, 129 [1024]: `DYNAMIC_SLOTS`, 130 [2048]: `DEV_ROOT_FRAGMENT`, 131 [-1]: `CACHED`, 132 [-2]: `BAIL` 133 }; 134 135 const slotFlagsText = { 136 [1]: "STABLE", 137 [2]: "DYNAMIC", 138 [3]: "FORWARDED" 139 }; 140 141 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decode
vendor: 5,717 bytes, lines 141-264
141URI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; 142 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); 143 144 const range = 2; 145 function generateCodeFrame(source, start = 0, end = source.length) { 146 start = Math.max(0, Math.min(start, source.length)); 147 end = Math.max(0, Math.min(end, source.length)); 148 if (start > end) return ""; 149 let lines = source.split(/(\r?\n)/); 150 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); 151 lines = lines.filter((_, idx) => idx % 2 === 0); 152 let count = 0; 153 const res = []; 154 for (let i = 0; i < lines.length; i++) { 155 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); 156 if (count >= start) { 157 for (let j = i - range; j <= i + range || end > count; j++) { 158 if (j < 0 || j >= lines.length) continue; 159 const line = j + 1; 160 res.push( 161 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` 162 ); 163 const lineLength = lines[j].length; 164 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; 165 if (j === i) { 166 const pad = start - (count - (lineLength + newLineSeqLength)); 167 const length = Math.max( 168 1, 169 end > count ? lineLength - pad : end - start 170 ); 171 res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); 172 } else if (j > i) { 173 if (end > count) { 174 const length = Math.max(Math.min(end - count, lineLength), 1); 175 res.push(` | ` + "^".repeat(length)); 176 } 177 count += lineLength + newLineSeqLength; 178 } 179 } 180 break; 181 } 182 } 183 return res.join("\n"); 184 } 185 186 function normalizeStyle(value) { 187 if (isArray(value)) { 188 const res = {}; 189 for (let i = 0; i < value.length; i++) { 190 const item = value[i]; 191 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); 192 if (normalized) { 193 for (const key in normalized) { 194 res[key] = normalized[key]; 195 } 196 } 197 } 198 return res; 199 } else if (isString(value) || isObject(value)) { 200 return value; 201 } 202 } 203 const listDelimiterRE = /;(?![^(]*\))/g; 204 const propertyDelimiterRE = /:([^]+)/; 205 const styleCommentRE = /\/\*[^]*?\*\//g; 206 function parseStringStyle(cssText) { 207 const ret = {}; 208 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { 209 if (item) { 210 const tmp = item.split(propertyDelimiterRE); 211 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 212 } 213 }); 214 return ret; 215 } 216 function stringifyStyle(styles) { 217 if (!styles) return ""; 218 if (isString(styles)) return styles; 219 let ret = ""; 220 for (const key in styles) { 221 const value = styles[key]; 222 if (isString(value) || typeof value === "number") { 223 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); 224 ret += `${normalizedKey}:${value};`; 225 } 226 } 227 return ret; 228 } 229 function normalizeClass(value) { 230 let res = ""; 231 if (isString(value)) { 232 res = value; 233 } else if (isArray(value)) { 234 for (let i = 0; i < value.length; i++) { 235 const normalized = normalizeClass(value[i]); 236 if (normalized) { 237 res += normalized + " "; 238 } 239 } 240 } else if (isObject(value)) { 241 for (const name in value) { 242 if (value[name]) { 243 res += name + " "; 244 } 245 } 246 } 247 return res.trim(); 248 } 249 function normalizeProps(props) { 250 if (!props) return null; 251 let { class: klass, style } = props; 252 if (klass && !isString(klass)) { 253 props.class = normalizeClass(klass); 254 } 255 if (style) { 256 props.style = normalizeStyle(style); 257 } 258 return props; 259 } 260 261 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"; 262 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"; 263 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"; 264 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
265 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); 266 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); 267 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); 268 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); 269 270 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 271 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 272 const isBooleanAttr = /* @__PURE__ */ makeMap( 273 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` 274 ); 275 function includeBooleanAttr(value) { 276 return !!value || value === ""; 277 } 278 const isKnownHtmlAttr = /* @__PURE__ */ makeMap( 279 `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` 280 ); 281 const isKnownSvgAttr = /* @__PURE__ */ makeMap( 282 `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
vendor: 52,979 bytes, lines 282-2166
282-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` 283 ); 284 function isRenderableAttrValue(value) { 285 if (value == null) { 286 return false; 287 } 288 const type = typeof value; 289 return type === "string" || type === "number" || type === "boolean"; 290 } 291 292 const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; 293 function getEscapedCssVarName(key, doubleEscape) { 294 return key.replace( 295 cssVarNameEscapeSymbolsRE, 296 (s) => `\\${s}` 297 ); 298 } 299 300 function looseCompareArrays(a, b) { 301 if (a.length !== b.length) return false; 302 let equal = true; 303 for (let i = 0; equal && i < a.length; i++) { 304 equal = looseEqual(a[i], b[i]); 305 } 306 return equal; 307 } 308 function looseEqual(a, b) { 309 if (a === b) return true; 310 let aValidType = isDate(a); 311 let bValidType = isDate(b); 312 if (aValidType || bValidType) { 313 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 314 } 315 aValidType = isSymbol(a); 316 bValidType = isSymbol(b); 317 if (aValidType || bValidType) { 318 return a === b; 319 } 320 aValidType = isArray(a); 321 bValidType = isArray(b); 322 if (aValidType || bValidType) { 323 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 324 } 325 aValidType = isObject(a); 326 bValidType = isObject(b); 327 if (aValidType || bValidType) { 328 if (!aValidType || !bValidType) { 329 return false; 330 } 331 const aKeysCount = Object.keys(a).length; 332 const bKeysCount = Object.keys(b).length; 333 if (aKeysCount !== bKeysCount) { 334 return false; 335 } 336 for (const key in a) { 337 const aHasKey = a.hasOwnProperty(key); 338 const bHasKey = b.hasOwnProperty(key); 339 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 340 return false; 341 } 342 } 343 } 344 return String(a) === String(b); 345 } 346 function looseIndexOf(arr, val) { 347 return arr.findIndex((item) => looseEqual(item, val)); 348 } 349 350 const isRef$1 = (val) => { 351 return !!(val && val["__v_isRef"] === true); 352 }; 353 const toDisplayString = (val) => { 354 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); 355 }; 356 const replacer = (_key, val) => { 357 if (isRef$1(val)) { 358 return replacer(_key, val.value); 359 } else if (isMap(val)) { 360 return { 361 [`Map(${val.size})`]: [...val.entries()].reduce( 362 (entries, [key, val2], i) => { 363 entries[stringifySymbol(key, i) + " =>"] = val2; 364 return entries; 365 }, 366 {} 367 ) 368 }; 369 } else if (isSet(val)) { 370 return { 371 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) 372 }; 373 } else if (isSymbol(val)) { 374 return stringifySymbol(val); 375 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { 376 return String(val); 377 } 378 return val; 379 }; 380 const stringifySymbol = (v, i = "") => { 381 var _a; 382 return ( 383 // Symbol.description in es2019+ so we need to cast here to pass 384 // the lib: es2016 check 385 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v 386 ); 387 }; 388 389 function normalizeCssVarValue(value) { 390 if (value == null) { 391 return "initial"; 392 } 393 if (typeof value === "string") { 394 return value === "" ? " " : value; 395 } 396 if (typeof value !== "number" || !Number.isFinite(value)) { 397 { 398 console.warn( 399 "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", 400 value 401 ); 402 } 403 } 404 return String(value); 405 } 406 407 function warn$2(msg, ...args) { 408 console.warn(`[Vue warn] ${msg}`, ...args); 409 } 410 411 let activeEffectScope; 412 class EffectScope { 413 constructor(detached = false) { 414 this.detached = detached; 415 /** 416 * @internal 417 */ 418 this._active = true; 419 /** 420 * @internal track `on` calls, allow `on` call multiple times 421 */ 422 this._on = 0; 423 /** 424 * @internal 425 */ 426 this.effects = []; 427 /** 428 * @internal 429 */ 430 this.cleanups = []; 431 this._isPaused = false; 432 this.parent = activeEffectScope; 433 if (!detached && activeEffectScope) { 434 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 435 this 436 ) - 1; 437 } 438 } 439 get active() { 440 return this._active; 441 } 442 pause() { 443 if (this._active) { 444 this._isPaused = true; 445 let i, l; 446 if (this.scopes) { 447 for (i = 0, l = this.scopes.length; i < l; i++) { 448 this.scopes[i].pause(); 449 } 450 } 451 for (i = 0, l = this.effects.length; i < l; i++) { 452 this.effects[i].pause(); 453 } 454 } 455 } 456 /** 457 * Resumes the effect scope, including all child scopes and effects. 458 */ 459 resume() { 460 if (this._active) { 461 if (this._isPaused) { 462 this._isPaused = false; 463 let i, l; 464 if (this.scopes) { 465 for (i = 0, l = this.scopes.length; i < l; i++) { 466 this.scopes[i].resume(); 467 } 468 } 469 for (i = 0, l = this.effects.length; i < l; i++) { 470 this.effects[i].resume(); 471 } 472 } 473 } 474 } 475 run(fn) { 476 if (this._active) { 477 const currentEffectScope = activeEffectScope; 478 try { 479 activeEffectScope = this; 480 return fn(); 481 } finally { 482 activeEffectScope = currentEffectScope; 483 } 484 } else { 485 warn$2(`cannot run an inactive effect scope.`); 486 } 487 } 488 /** 489 * This should only be called on non-detached scopes 490 * @internal 491 */ 492 on() { 493 if (++this._on === 1) { 494 this.prevScope = activeEffectScope; 495 activeEffectScope = this; 496 } 497 } 498 /** 499 * This should only be called on non-detached scopes 500 * @internal 501 */ 502 off() { 503 if (this._on > 0 && --this._on === 0) { 504 activeEffectScope = this.prevScope; 505 this.prevScope = void 0; 506 } 507 } 508 stop(fromParent) { 509 if (this._active) { 510 this._active = false; 511 let i, l; 512 for (i = 0, l = this.effects.length; i < l; i++) { 513 this.effects[i].stop(); 514 } 515 this.effects.length = 0; 516 for (i = 0, l = this.cleanups.length; i < l; i++) { 517 this.cleanups[i](); 518 } 519 this.cleanups.length = 0; 520 if (this.scopes) { 521 for (i = 0, l = this.scopes.length; i < l; i++) { 522 this.scopes[i].stop(true); 523 } 524 this.scopes.length = 0; 525 } 526 if (!this.detached && this.parent && !fromParent) { 527 const last = this.parent.scopes.pop(); 528 if (last && last !== this) { 529 this.parent.scopes[this.index] = last; 530 last.index = this.index; 531 } 532 } 533 this.parent = void 0; 534 } 535 } 536 } 537 function effectScope(detached) { 538 return new EffectScope(detached); 539 } 540 function getCurrentScope() { 541 return activeEffectScope; 542 } 543 function onScopeDispose(fn, failSilently = false) { 544 if (activeEffectScope) { 545 activeEffectScope.cleanups.push(fn); 546 } else if (!failSilently) { 547 warn$2( 548 `onScopeDispose() is called when there is no active effect scope to be associated with.` 549 ); 550 } 551 } 552 553 let activeSub; 554 const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); 555 class ReactiveEffect { 556 constructor(fn) { 557 this.fn = fn; 558 /** 559 * @internal 560 */ 561 this.deps = void 0; 562 /** 563 * @internal 564 */ 565 this.depsTail = void 0; 566 /** 567 * @internal 568 */ 569 this.flags = 1 | 4; 570 /** 571 * @internal 572 */ 573 this.next = void 0; 574 /** 575 * @internal 576 */ 577 this.cleanup = void 0; 578 this.scheduler = void 0; 579 if (activeEffectScope && activeEffectScope.active) { 580 activeEffectScope.effects.push(this); 581 } 582 } 583 pause() { 584 this.flags |= 64; 585 } 586 resume() { 587 if (this.flags & 64) { 588 this.flags &= -65; 589 if (pausedQueueEffects.has(this)) { 590 pausedQueueEffects.delete(this); 591 this.trigger(); 592 } 593 } 594 } 595 /** 596 * @internal 597 */ 598 notify() { 599 if (this.flags & 2 && !(this.flags & 32)) { 600 return; 601 } 602 if (!(this.flags & 8)) { 603 batch(this); 604 } 605 } 606 run() { 607 if (!(this.flags & 1)) { 608 return this.fn(); 609 } 610 this.flags |= 2; 611 cleanupEffect(this); 612 prepareDeps(this); 613 const prevEffect = activeSub; 614 const prevShouldTrack = shouldTrack; 615 activeSub = this; 616 shouldTrack = true; 617 try { 618 return this.fn(); 619 } finally { 620 if (activeSub !== this) { 621 warn$2( 622 "Active effect was not restored correctly - this is likely a Vue internal bug." 623 ); 624 } 625 cleanupDeps(this); 626 activeSub = prevEffect; 627 shouldTrack = prevShouldTrack; 628 this.flags &= -3; 629 } 630 } 631 stop() { 632 if (this.flags & 1) { 633 for (let link = this.deps; link; link = link.nextDep) { 634 removeSub(link); 635 } 636 this.deps = this.depsTail = void 0; 637 cleanupEffect(this); 638 this.onStop && this.onStop(); 639 this.flags &= -2; 640 } 641 } 642 trigger() { 643 if (this.flags & 64) { 644 pausedQueueEffects.add(this); 645 } else if (this.scheduler) { 646 this.scheduler(); 647 } else { 648 this.runIfDirty(); 649 } 650 } 651 /** 652 * @internal 653 */ 654 runIfDirty() { 655 if (isDirty(this)) { 656 this.run(); 657 } 658 } 659 get dirty() { 660 return isDirty(this); 661 } 662 } 663 let batchDepth = 0; 664 let batchedSub; 665 let batchedComputed; 666 function batch(sub, isComputed = false) { 667 sub.flags |= 8; 668 if (isComputed) { 669 sub.next = batchedComputed; 670 batchedComputed = sub; 671 return; 672 } 673 sub.next = batchedSub; 674 batchedSub = sub; 675 } 676 function startBatch() { 677 batchDepth++; 678 } 679 function endBatch() { 680 if (--batchDepth > 0) { 681 return; 682 } 683 if (batchedComputed) { 684 let e = batchedComputed; 685 batchedComputed = void 0; 686 while (e) { 687 const next = e.next; 688 e.next = void 0; 689 e.flags &= -9; 690 e = next; 691 } 692 } 693 let error; 694 while (batchedSub) { 695 let e = batchedSub; 696 batchedSub = void 0; 697 while (e) { 698 const next = e.next; 699 e.next = void 0; 700 e.flags &= -9; 701 if (e.flags & 1) { 702 try { 703 ; 704 e.trigger(); 705 } catch (err) { 706 if (!error) error = err; 707 } 708 } 709 e = next; 710 } 711 } 712 if (error) throw error; 713 } 714 function prepareDeps(sub) { 715 for (let link = sub.deps; link; link = link.nextDep) { 716 link.version = -1; 717 link.prevActiveLink = link.dep.activeLink; 718 link.dep.activeLink = link; 719 } 720 } 721 function cleanupDeps(sub) { 722 let head; 723 let tail = sub.depsTail; 724 let link = tail; 725 while (link) { 726 const prev = link.prevDep; 727 if (link.version === -1) { 728 if (link === tail) tail = prev; 729 removeSub(link); 730 removeDep(link); 731 } else { 732 head = link; 733 } 734 link.dep.activeLink = link.prevActiveLink; 735 link.prevActiveLink = void 0; 736 link = prev; 737 } 738 sub.deps = head; 739 sub.depsTail = tail; 740 } 741 function isDirty(sub) { 742 for (let link = sub.deps; link; link = link.nextDep) { 743 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) { 744 return true; 745 } 746 } 747 if (sub._dirty) { 748 return true; 749 } 750 return false; 751 } 752 function refreshComputed(computed) { 753 if (computed.flags & 4 && !(computed.flags & 16)) { 754 return; 755 } 756 computed.flags &= -17; 757 if (computed.globalVersion === globalVersion) { 758 return; 759 } 760 computed.globalVersion = globalVersion; 761 if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) { 762 return; 763 } 764 computed.flags |= 2; 765 const dep = computed.dep; 766 const prevSub = activeSub; 767 const prevShouldTrack = shouldTrack; 768 activeSub = computed; 769 shouldTrack = true; 770 try { 771 prepareDeps(computed); 772 const value = computed.fn(computed._value); 773 if (dep.version === 0 || hasChanged(value, computed._value)) { 774 computed.flags |= 128; 775 computed._value = value; 776 dep.version++; 777 } 778 } catch (err) { 779 dep.version++; 780 throw err; 781 } finally { 782 activeSub = prevSub; 783 shouldTrack = prevShouldTrack; 784 cleanupDeps(computed); 785 computed.flags &= -3; 786 } 787 } 788 function removeSub(link, soft = false) { 789 const { dep, prevSub, nextSub } = link; 790 if (prevSub) { 791 prevSub.nextSub = nextSub; 792 link.prevSub = void 0; 793 } 794 if (nextSub) { 795 nextSub.prevSub = prevSub; 796 link.nextSub = void 0; 797 } 798 if (dep.subsHead === link) { 799 dep.subsHead = nextSub; 800 } 801 if (dep.subs === link) { 802 dep.subs = prevSub; 803 if (!prevSub && dep.computed) { 804 dep.computed.flags &= -5; 805 for (let l = dep.computed.deps; l; l = l.nextDep) { 806 removeSub(l, true); 807 } 808 } 809 } 810 if (!soft && !--dep.sc && dep.map) { 811 dep.map.delete(dep.key); 812 } 813 } 814 function removeDep(link) { 815 const { prevDep, nextDep } = link; 816 if (prevDep) { 817 prevDep.nextDep = nextDep; 818 link.prevDep = void 0; 819 } 820 if (nextDep) { 821 nextDep.prevDep = prevDep; 822 link.nextDep = void 0; 823 } 824 } 825 function effect(fn, options) { 826 if (fn.effect instanceof ReactiveEffect) { 827 fn = fn.effect.fn; 828 } 829 const e = new ReactiveEffect(fn); 830 if (options) { 831 extend(e, options); 832 } 833 try { 834 e.run(); 835 } catch (err) { 836 e.stop(); 837 throw err; 838 } 839 const runner = e.run.bind(e); 840 runner.effect = e; 841 return runner; 842 } 843 function stop(runner) { 844 runner.effect.stop(); 845 } 846 let shouldTrack = true; 847 const trackStack = []; 848 function pauseTracking() { 849 trackStack.push(shouldTrack); 850 shouldTrack = false; 851 } 852 function resetTracking() { 853 const last = trackStack.pop(); 854 shouldTrack = last === void 0 ? true : last; 855 } 856 function cleanupEffect(e) { 857 const { cleanup } = e; 858 e.cleanup = void 0; 859 if (cleanup) { 860 const prevSub = activeSub; 861 activeSub = void 0; 862 try { 863 cleanup(); 864 } finally { 865 activeSub = prevSub; 866 } 867 } 868 } 869 870 let globalVersion = 0; 871 class Link { 872 constructor(sub, dep) { 873 this.sub = sub; 874 this.dep = dep; 875 this.version = dep.version; 876 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; 877 } 878 } 879 class Dep { 880 // TODO isolatedDeclarations "__v_skip" 881 constructor(computed) { 882 this.computed = computed; 883 this.version = 0; 884 /** 885 * Link between this dep and the current active effect 886 */ 887 this.activeLink = void 0; 888 /** 889 * Doubly linked list representing the subscribing effects (tail) 890 */ 891 this.subs = void 0; 892 /** 893 * For object property deps cleanup 894 */ 895 this.map = void 0; 896 this.key = void 0; 897 /** 898 * Subscriber counter 899 */ 900 this.sc = 0; 901 /** 902 * @internal 903 */ 904 this.__v_skip = true; 905 { 906 this.subsHead = void 0; 907 } 908 } 909 track(debugInfo) { 910 if (!activeSub || !shouldTrack || activeSub === this.computed) { 911 return; 912 } 913 let link = this.activeLink; 914 if (link === void 0 || link.sub !== activeSub) { 915 link = this.activeLink = new Link(activeSub, this); 916 if (!activeSub.deps) { 917 activeSub.deps = activeSub.depsTail = link; 918 } else { 919 link.prevDep = activeSub.depsTail; 920 activeSub.depsTail.nextDep = link; 921 activeSub.depsTail = link; 922 } 923 addSub(link); 924 } else if (link.version === -1) { 925 link.version = this.version; 926 if (link.nextDep) { 927 const next = link.nextDep; 928 next.prevDep = link.prevDep; 929 if (link.prevDep) { 930 link.prevDep.nextDep = next; 931 } 932 link.prevDep = activeSub.depsTail; 933 link.nextDep = void 0; 934 activeSub.depsTail.nextDep = link; 935 activeSub.depsTail = link; 936 if (activeSub.deps === link) { 937 activeSub.deps = next; 938 } 939 } 940 } 941 if (activeSub.onTrack) { 942 activeSub.onTrack( 943 extend( 944 { 945 effect: activeSub 946 }, 947 debugInfo 948 ) 949 ); 950 } 951 return link; 952 } 953 trigger(debugInfo) { 954 this.version++; 955 globalVersion++; 956 this.notify(debugInfo); 957 } 958 notify(debugInfo) { 959 startBatch(); 960 try { 961 if (true) { 962 for (let head = this.subsHead; head; head = head.nextSub) { 963 if (head.sub.onTrigger && !(head.sub.flags & 8)) { 964 head.sub.onTrigger( 965 extend( 966 { 967 effect: head.sub 968 }, 969 debugInfo 970 ) 971 ); 972 } 973 } 974 } 975 for (let link = this.subs; link; link = link.prevSub) { 976 if (link.sub.notify()) { 977 ; 978 link.sub.dep.notify(); 979 } 980 } 981 } finally { 982 endBatch(); 983 } 984 } 985 } 986 function addSub(link) { 987 link.dep.sc++; 988 if (link.sub.flags & 4) { 989 const computed = link.dep.computed; 990 if (computed && !link.dep.subs) { 991 computed.flags |= 4 | 16; 992 for (let l = computed.deps; l; l = l.nextDep) { 993 addSub(l); 994 } 995 } 996 const currentTail = link.dep.subs; 997 if (currentTail !== link) { 998 link.prevSub = currentTail; 999 if (currentTail) currentTail.nextSub = link; 1000 } 1001 if (link.dep.subsHead === void 0) { 1002 link.dep.subsHead = link; 1003 } 1004 link.dep.subs = link; 1005 } 1006 } 1007 const targetMap = /* @__PURE__ */ new WeakMap(); 1008 const ITERATE_KEY = Symbol( 1009 "Object iterate" 1010 ); 1011 const MAP_KEY_ITERATE_KEY = Symbol( 1012 "Map keys iterate" 1013 ); 1014 const ARRAY_ITERATE_KEY = Symbol( 1015 "Array iterate" 1016 ); 1017 function track(target, type, key) { 1018 if (shouldTrack && activeSub) { 1019 let depsMap = targetMap.get(target); 1020 if (!depsMap) { 1021 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 1022 } 1023 let dep = depsMap.get(key); 1024 if (!dep) { 1025 depsMap.set(key, dep = new Dep()); 1026 dep.map = depsMap; 1027 dep.key = key; 1028 } 1029 { 1030 dep.track({ 1031 target, 1032 type, 1033 key 1034 }); 1035 } 1036 } 1037 } 1038 function trigger(target, type, key, newValue, oldValue, oldTarget) { 1039 const depsMap = targetMap.get(target); 1040 if (!depsMap) { 1041 globalVersion++; 1042 return; 1043 } 1044 const run = (dep) => { 1045 if (dep) { 1046 { 1047 dep.trigger({ 1048 target, 1049 type, 1050 key, 1051 newValue, 1052 oldValue, 1053 oldTarget 1054 }); 1055 } 1056 } 1057 }; 1058 startBatch(); 1059 if (type === "clear") { 1060 depsMap.forEach(run); 1061 } else { 1062 const targetIsArray = isArray(target); 1063 const isArrayIndex = targetIsArray && isIntegerKey(key); 1064 if (targetIsArray && key === "length") { 1065 const newLength = Number(newValue); 1066 depsMap.forEach((dep, key2) => { 1067 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) { 1068 run(dep); 1069 } 1070 }); 1071 } else { 1072 if (key !== void 0 || depsMap.has(void 0)) { 1073 run(depsMap.get(key)); 1074 } 1075 if (isArrayIndex) { 1076 run(depsMap.get(ARRAY_ITERATE_KEY)); 1077 } 1078 switch (type) { 1079 case "add": 1080 if (!targetIsArray) { 1081 run(depsMap.get(ITERATE_KEY)); 1082 if (isMap(target)) { 1083 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1084 } 1085 } else if (isArrayIndex) { 1086 run(depsMap.get("length")); 1087 } 1088 break; 1089 case "delete": 1090 if (!targetIsArray) { 1091 run(depsMap.get(ITERATE_KEY)); 1092 if (isMap(target)) { 1093 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1094 } 1095 } 1096 break; 1097 case "set": 1098 if (isMap(target)) { 1099 run(depsMap.get(ITERATE_KEY)); 1100 } 1101 break; 1102 } 1103 } 1104 } 1105 endBatch(); 1106 } 1107 function getDepFromReactive(object, key) { 1108 const depMap = targetMap.get(object); 1109 return depMap && depMap.get(key); 1110 } 1111 1112 function reactiveReadArray(array) { 1113 const raw = toRaw(array); 1114 if (raw === array) return raw; 1115 track(raw, "iterate", ARRAY_ITERATE_KEY); 1116 return isShallow(array) ? raw : raw.map(toReactive); 1117 } 1118 function shallowReadArray(arr) { 1119 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); 1120 return arr; 1121 } 1122 const arrayInstrumentations = { 1123 __proto__: null, 1124 [Symbol.iterator]() { 1125 return iterator(this, Symbol.iterator, toReactive); 1126 }, 1127 concat(...args) { 1128 return reactiveReadArray(this).concat( 1129 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x) 1130 ); 1131 }, 1132 entries() { 1133 return iterator(this, "entries", (value) => { 1134 value[1] = toReactive(value[1]); 1135 return value; 1136 }); 1137 }, 1138 every(fn, thisArg) { 1139 return apply(this, "every", fn, thisArg, void 0, arguments); 1140 }, 1141 filter(fn, thisArg) { 1142 return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments); 1143 }, 1144 find(fn, thisArg) { 1145 return apply(this, "find", fn, thisArg, toReactive, arguments); 1146 }, 1147 findIndex(fn, thisArg) { 1148 return apply(this, "findIndex", fn, thisArg, void 0, arguments); 1149 }, 1150 findLast(fn, thisArg) { 1151 return apply(this, "findLast", fn, thisArg, toReactive, arguments); 1152 }, 1153 findLastIndex(fn, thisArg) { 1154 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments); 1155 }, 1156 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement 1157 forEach(fn, thisArg) { 1158 return apply(this, "forEach", fn, thisArg, void 0, arguments); 1159 }, 1160 includes(...args) { 1161 return searchProxy(this, "includes", args); 1162 }, 1163 indexOf(...args) { 1164 return searchProxy(this, "indexOf", args); 1165 }, 1166 join(separator) { 1167 return reactiveReadArray(this).join(separator); 1168 }, 1169 // keys() iterator only reads `length`, no optimization required 1170 lastIndexOf(...args) { 1171 return searchProxy(this, "lastIndexOf", args); 1172 }, 1173 map(fn, thisArg) { 1174 return apply(this, "map", fn, thisArg, void 0, arguments); 1175 }, 1176 pop() { 1177 return noTracking(this, "pop"); 1178 }, 1179 push(...args) { 1180 return noTracking(this, "push", args); 1181 }, 1182 reduce(fn, ...args) { 1183 return reduce(this, "reduce", fn, args); 1184 }, 1185 reduceRight(fn, ...args) { 1186 return reduce(this, "reduceRight", fn, args); 1187 }, 1188 shift() { 1189 return noTracking(this, "shift"); 1190 }, 1191 // slice could use ARRAY_ITERATE but also seems to beg for range tracking 1192 some(fn, thisArg) { 1193 return apply(this, "some", fn, thisArg, void 0, arguments); 1194 }, 1195 splice(...args) { 1196 return noTracking(this, "splice", args); 1197 }, 1198 toReversed() { 1199 return reactiveReadArray(this).toReversed(); 1200 }, 1201 toSorted(comparer) { 1202 return reactiveReadArray(this).toSorted(comparer); 1203 }, 1204 toSpliced(...args) { 1205 return reactiveReadArray(this).toSpliced(...args); 1206 }, 1207 unshift(...args) { 1208 return noTracking(this, "unshift", args); 1209 }, 1210 values() { 1211 return iterator(this, "values", toReactive); 1212 } 1213 }; 1214 function iterator(self, method, wrapValue) { 1215 const arr = shallowReadArray(self); 1216 const iter = arr[method](); 1217 if (arr !== self && !isShallow(self)) { 1218 iter._next = iter.next; 1219 iter.next = () => { 1220 const result = iter._next(); 1221 if (!result.done) { 1222 result.value = wrapValue(result.value); 1223 } 1224 return result; 1225 }; 1226 } 1227 return iter; 1228 } 1229 const arrayProto = Array.prototype; 1230 function apply(self, method, fn, thisArg, wrappedRetFn, args) { 1231 const arr = shallowReadArray(self); 1232 const needsWrap = arr !== self && !isShallow(self); 1233 const methodFn = arr[method]; 1234 if (methodFn !== arrayProto[method]) { 1235 const result2 = methodFn.apply(self, args); 1236 return needsWrap ? toReactive(result2) : result2; 1237 } 1238 let wrappedFn = fn; 1239 if (arr !== self) { 1240 if (needsWrap) { 1241 wrappedFn = function(item, index) { 1242 return fn.call(this, toReactive(item), index, self); 1243 }; 1244 } else if (fn.length > 2) { 1245 wrappedFn = function(item, index) { 1246 return fn.call(this, item, index, self); 1247 }; 1248 } 1249 } 1250 const result = methodFn.call(arr, wrappedFn, thisArg); 1251 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; 1252 } 1253 function reduce(self, method, fn, args) { 1254 const arr = shallowReadArray(self); 1255 let wrappedFn = fn; 1256 if (arr !== self) { 1257 if (!isShallow(self)) { 1258 wrappedFn = function(acc, item, index) { 1259 return fn.call(this, acc, toReactive(item), index, self); 1260 }; 1261 } else if (fn.length > 3) { 1262 wrappedFn = function(acc, item, index) { 1263 return fn.call(this, acc, item, index, self); 1264 }; 1265 } 1266 } 1267 return arr[method](wrappedFn, ...args); 1268 } 1269 function searchProxy(self, method, args) { 1270 const arr = toRaw(self); 1271 track(arr, "iterate", ARRAY_ITERATE_KEY); 1272 const res = arr[method](...args); 1273 if ((res === -1 || res === false) && isProxy(args[0])) { 1274 args[0] = toRaw(args[0]); 1275 return arr[method](...args); 1276 } 1277 return res; 1278 } 1279 function noTracking(self, method, args = []) { 1280 pauseTracking(); 1281 startBatch(); 1282 const res = toRaw(self)[method].apply(self, args); 1283 endBatch(); 1284 resetTracking(); 1285 return res; 1286 } 1287 1288 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 1289 const builtInSymbols = new Set( 1290 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 1291 ); 1292 function hasOwnProperty(key) { 1293 if (!isSymbol(key)) key = String(key); 1294 const obj = toRaw(this); 1295 track(obj, "has", key); 1296 return obj.hasOwnProperty(key); 1297 } 1298 class BaseReactiveHandler { 1299 constructor(_isReadonly = false, _isShallow = false) { 1300 this._isReadonly = _isReadonly; 1301 this._isShallow = _isShallow; 1302 } 1303 get(target, key, receiver) { 1304 if (key === "__v_skip") return target["__v_skip"]; 1305 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 1306 if (key === "__v_isReactive") { 1307 return !isReadonly2; 1308 } else if (key === "__v_isReadonly") { 1309 return isReadonly2; 1310 } else if (key === "__v_isShallow") { 1311 return isShallow2; 1312 } else if (key === "__v_raw") { 1313 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 1314 // this means the receiver is a user proxy of the reactive proxy 1315 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 1316 return target; 1317 } 1318 return; 1319 } 1320 const targetIsArray = isArray(target); 1321 if (!isReadonly2) { 1322 let fn; 1323 if (targetIsArray && (fn = arrayInstrumentations[key])) { 1324 return fn; 1325 } 1326 if (key === "hasOwnProperty") { 1327 return hasOwnProperty; 1328 } 1329 } 1330 const res = Reflect.get( 1331 target, 1332 key, 1333 // if this is a proxy wrapping a ref, return methods using the raw ref 1334 // as receiver so that we don't have to call `toRaw` on the ref in all 1335 // its class methods 1336 isRef(target) ? target : receiver 1337 ); 1338 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 1339 return res; 1340 } 1341 if (!isReadonly2) { 1342 track(target, "get", key); 1343 } 1344 if (isShallow2) { 1345 return res; 1346 } 1347 if (isRef(res)) { 1348 const value = targetIsArray && isIntegerKey(key) ? res : res.value; 1349 return isReadonly2 && isObject(value) ? readonly(value) : value; 1350 } 1351 if (isObject(res)) { 1352 return isReadonly2 ? readonly(res) : reactive(res); 1353 } 1354 return res; 1355 } 1356 } 1357 class MutableReactiveHandler extends BaseReactiveHandler { 1358 constructor(isShallow2 = false) { 1359 super(false, isShallow2); 1360 } 1361 set(target, key, value, receiver) { 1362 let oldValue = target[key]; 1363 if (!this._isShallow) { 1364 const isOldValueReadonly = isReadonly(oldValue); 1365 if (!isShallow(value) && !isReadonly(value)) { 1366 oldValue = toRaw(oldValue); 1367 value = toRaw(value); 1368 } 1369 if (!isArray(target) && isRef(oldValue) && !isRef(value)) { 1370 if (isOldValueReadonly) { 1371 { 1372 warn$2( 1373 `Set operation on key "${String(key)}" failed: target is readonly.`, 1374 target[key] 1375 ); 1376 } 1377 return true; 1378 } else { 1379 oldValue.value = value; 1380 return true; 1381 } 1382 } 1383 } 1384 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 1385 const result = Reflect.set( 1386 target, 1387 key, 1388 value, 1389 isRef(target) ? target : receiver 1390 ); 1391 if (target === toRaw(receiver)) { 1392 if (!hadKey) { 1393 trigger(target, "add", key, value); 1394 } else if (hasChanged(value, oldValue)) { 1395 trigger(target, "set", key, value, oldValue); 1396 } 1397 } 1398 return result; 1399 } 1400 deleteProperty(target, key) { 1401 const hadKey = hasOwn(target, key); 1402 const oldValue = target[key]; 1403 const result = Reflect.deleteProperty(target, key); 1404 if (result && hadKey) { 1405 trigger(target, "delete", key, void 0, oldValue); 1406 } 1407 return result; 1408 } 1409 has(target, key) { 1410 const result = Reflect.has(target, key); 1411 if (!isSymbol(key) || !builtInSymbols.has(key)) { 1412 track(target, "has", key); 1413 } 1414 return result; 1415 } 1416 ownKeys(target) { 1417 track( 1418 target, 1419 "iterate", 1420 isArray(target) ? "length" : ITERATE_KEY 1421 ); 1422 return Reflect.ownKeys(target); 1423 } 1424 } 1425 class ReadonlyReactiveHandler extends BaseReactiveHandler { 1426 constructor(isShallow2 = false) { 1427 super(true, isShallow2); 1428 } 1429 set(target, key) { 1430 { 1431 warn$2( 1432 `Set operation on key "${String(key)}" failed: target is readonly.`, 1433 target 1434 ); 1435 } 1436 return true; 1437 } 1438 deleteProperty(target, key) { 1439 { 1440 warn$2( 1441 `Delete operation on key "${String(key)}" failed: target is readonly.`, 1442 target 1443 ); 1444 } 1445 return true; 1446 } 1447 } 1448 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 1449 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 1450 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); 1451 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 1452 1453 const toShallow = (value) => value; 1454 const getProto = (v) => Reflect.getPrototypeOf(v); 1455 function createIterableMethod(method, isReadonly2, isShallow2) { 1456 return function(...args) { 1457 const target = this["__v_raw"]; 1458 const rawTarget = toRaw(target); 1459 const targetIsMap = isMap(rawTarget); 1460 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1461 const isKeyOnly = method === "keys" && targetIsMap; 1462 const innerIterator = target[method](...args); 1463 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1464 !isReadonly2 && track( 1465 rawTarget, 1466 "iterate", 1467 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1468 ); 1469 return { 1470 // iterator protocol 1471 next() { 1472 const { value, done } = innerIterator.next(); 1473 return done ? { value, done } : { 1474 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1475 done 1476 }; 1477 }, 1478 // iterable protocol 1479 [Symbol.iterator]() { 1480 return this; 1481 } 1482 }; 1483 }; 1484 } 1485 function createReadonlyMethod(type) { 1486 return function(...args) { 1487 { 1488 const key = args[0] ? `on key "${args[0]}" ` : ``; 1489 warn$2( 1490 `${capitalize(type)} operation ${key}failed: target is readonly.`, 1491 toRaw(this) 1492 ); 1493 } 1494 return type === "delete" ? false : type === "clear" ? void 0 : this; 1495 }; 1496 } 1497 function createInstrumentations(readonly, shallow) { 1498 const instrumentations = { 1499 get(key) { 1500 const target = this["__v_raw"]; 1501 const rawTarget = toRaw(target); 1502 const rawKey = toRaw(key); 1503 if (!readonly) { 1504 if (hasChanged(key, rawKey)) { 1505 track(rawTarget, "get", key); 1506 } 1507 track(rawTarget, "get", rawKey); 1508 } 1509 const { has } = getProto(rawTarget); 1510 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1511 if (has.call(rawTarget, key)) { 1512 return wrap(target.get(key)); 1513 } else if (has.call(rawTarget, rawKey)) { 1514 return wrap(target.get(rawKey)); 1515 } else if (target !== rawTarget) { 1516 target.get(key); 1517 } 1518 }, 1519 get size() { 1520 const target = this["__v_raw"]; 1521 !readonly && track(toRaw(target), "iterate", ITERATE_KEY); 1522 return target.size; 1523 }, 1524 has(key) { 1525 const target = this["__v_raw"]; 1526 const rawTarget = toRaw(target); 1527 const rawKey = toRaw(key); 1528 if (!readonly) { 1529 if (hasChanged(key, rawKey)) { 1530 track(rawTarget, "has", key); 1531 } 1532 track(rawTarget, "has", rawKey); 1533 } 1534 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 1535 }, 1536 forEach(callback, thisArg) { 1537 const observed = this; 1538 const target = observed["__v_raw"]; 1539 const rawTarget = toRaw(target); 1540 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1541 !readonly && track(rawTarget, "iterate", ITERATE_KEY); 1542 return target.forEach((value, key) => { 1543 return callback.call(thisArg, wrap(value), wrap(key), observed); 1544 }); 1545 } 1546 }; 1547 extend( 1548 instrumentations, 1549 readonly ? { 1550 add: createReadonlyMethod("add"), 1551 set: createReadonlyMethod("set"), 1552 delete: createReadonlyMethod("delete"), 1553 clear: createReadonlyMethod("clear") 1554 } : { 1555 add(value) { 1556 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1557 value = toRaw(value); 1558 } 1559 const target = toRaw(this); 1560 const proto = getProto(target); 1561 const hadKey = proto.has.call(target, value); 1562 if (!hadKey) { 1563 target.add(value); 1564 trigger(target, "add", value, value); 1565 } 1566 return this; 1567 }, 1568 set(key, value) { 1569 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1570 value = toRaw(value); 1571 } 1572 const target = toRaw(this); 1573 const { has, get } = getProto(target); 1574 let hadKey = has.call(target, key); 1575 if (!hadKey) { 1576 key = toRaw(key); 1577 hadKey = has.call(target, key); 1578 } else { 1579 checkIdentityKeys(target, has, key); 1580 } 1581 const oldValue = get.call(target, key); 1582 target.set(key, value); 1583 if (!hadKey) { 1584 trigger(target, "add", key, value); 1585 } else if (hasChanged(value, oldValue)) { 1586 trigger(target, "set", key, value, oldValue); 1587 } 1588 return this; 1589 }, 1590 delete(key) { 1591 const target = toRaw(this); 1592 const { has, get } = getProto(target); 1593 let hadKey = has.call(target, key); 1594 if (!hadKey) { 1595 key = toRaw(key); 1596 hadKey = has.call(target, key); 1597 } else { 1598 checkIdentityKeys(target, has, key); 1599 } 1600 const oldValue = get ? get.call(target, key) : void 0; 1601 const result = target.delete(key); 1602 if (hadKey) { 1603 trigger(target, "delete", key, void 0, oldValue); 1604 } 1605 return result; 1606 }, 1607 clear() { 1608 const target = toRaw(this); 1609 const hadItems = target.size !== 0; 1610 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; 1611 const result = target.clear(); 1612 if (hadItems) { 1613 trigger( 1614 target, 1615 "clear", 1616 void 0, 1617 void 0, 1618 oldTarget 1619 ); 1620 } 1621 return result; 1622 } 1623 } 1624 ); 1625 const iteratorMethods = [ 1626 "keys", 1627 "values", 1628 "entries", 1629 Symbol.iterator 1630 ]; 1631 iteratorMethods.forEach((method) => { 1632 instrumentations[method] = createIterableMethod(method, readonly, shallow); 1633 }); 1634 return instrumentations; 1635 } 1636 function createInstrumentationGetter(isReadonly2, shallow) { 1637 const instrumentations = createInstrumentations(isReadonly2, shallow); 1638 return (target, key, receiver) => { 1639 if (key === "__v_isReactive") { 1640 return !isReadonly2; 1641 } else if (key === "__v_isReadonly") { 1642 return isReadonly2; 1643 } else if (key === "__v_raw") { 1644 return target; 1645 } 1646 return Reflect.get( 1647 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1648 key, 1649 receiver 1650 ); 1651 }; 1652 } 1653 const mutableCollectionHandlers = { 1654 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1655 }; 1656 const shallowCollectionHandlers = { 1657 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1658 }; 1659 const readonlyCollectionHandlers = { 1660 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1661 }; 1662 const shallowReadonlyCollectionHandlers = { 1663 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1664 }; 1665 function checkIdentityKeys(target, has, key) { 1666 const rawKey = toRaw(key); 1667 if (rawKey !== key && has.call(target, rawKey)) { 1668 const type = toRawType(target); 1669 warn$2( 1670 `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.` 1671 ); 1672 } 1673 } 1674 1675 const reactiveMap = /* @__PURE__ */ new WeakMap(); 1676 const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1677 const readonlyMap = /* @__PURE__ */ new WeakMap(); 1678 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1679 function targetTypeMap(rawType) { 1680 switch (rawType) { 1681 case "Object": 1682 case "Array": 1683 return 1 /* COMMON */; 1684 case "Map": 1685 case "Set": 1686 case "WeakMap": 1687 case "WeakSet": 1688 return 2 /* COLLECTION */; 1689 default: 1690 return 0 /* INVALID */; 1691 } 1692 } 1693 function getTargetType(value) { 1694 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); 1695 } 1696 function reactive(target) { 1697 if (isReadonly(target)) { 1698 return target; 1699 } 1700 return createReactiveObject( 1701 target, 1702 false, 1703 mutableHandlers, 1704 mutableCollectionHandlers, 1705 reactiveMap 1706 ); 1707 } 1708 function shallowReactive(target) { 1709 return createReactiveObject( 1710 target, 1711 false, 1712 shallowReactiveHandlers, 1713 shallowCollectionHandlers, 1714 shallowReactiveMap 1715 ); 1716 } 1717 function readonly(target) { 1718 return createReactiveObject( 1719 target, 1720 true, 1721 readonlyHandlers, 1722 readonlyCollectionHandlers, 1723 readonlyMap 1724 ); 1725 } 1726 function shallowReadonly(target) { 1727 return createReactiveObject( 1728 target, 1729 true, 1730 shallowReadonlyHandlers, 1731 shallowReadonlyCollectionHandlers, 1732 shallowReadonlyMap 1733 ); 1734 } 1735 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1736 if (!isObject(target)) { 1737 { 1738 warn$2( 1739 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( 1740 target 1741 )}` 1742 ); 1743 } 1744 return target; 1745 } 1746 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1747 return target; 1748 } 1749 const targetType = getTargetType(target); 1750 if (targetType === 0 /* INVALID */) { 1751 return target; 1752 } 1753 const existingProxy = proxyMap.get(target); 1754 if (existingProxy) { 1755 return existingProxy; 1756 } 1757 const proxy = new Proxy( 1758 target, 1759 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers 1760 ); 1761 proxyMap.set(target, proxy); 1762 return proxy; 1763 } 1764 function isReactive(value) { 1765 if (isReadonly(value)) { 1766 return isReactive(value["__v_raw"]); 1767 } 1768 return !!(value && value["__v_isReactive"]); 1769 } 1770 function isReadonly(value) { 1771 return !!(value && value["__v_isReadonly"]); 1772 } 1773 function isShallow(value) { 1774 return !!(value && value["__v_isShallow"]); 1775 } 1776 function isProxy(value) { 1777 return value ? !!value["__v_raw"] : false; 1778 } 1779 function toRaw(observed) { 1780 const raw = observed && observed["__v_raw"]; 1781 return raw ? toRaw(raw) : observed; 1782 } 1783 function markRaw(value) { 1784 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) { 1785 def(value, "__v_skip", true); 1786 } 1787 return value; 1788 } 1789 const toReactive = (value) => isObject(value) ? reactive(value) : value; 1790 const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1791 1792 function isRef(r) { 1793 return r ? r["__v_isRef"] === true : false; 1794 } 1795 function ref(value) { 1796 return createRef(value, false); 1797 } 1798 function shallowRef(value) { 1799 return createRef(value, true); 1800 } 1801 function createRef(rawValue, shallow) { 1802 if (isRef(rawValue)) { 1803 return rawValue; 1804 } 1805 return new RefImpl(rawValue, shallow); 1806 } 1807 class RefImpl { 1808 constructor(value, isShallow2) { 1809 this.dep = new Dep(); 1810 this["__v_isRef"] = true; 1811 this["__v_isShallow"] = false; 1812 this._rawValue = isShallow2 ? value : toRaw(value); 1813 this._value = isShallow2 ? value : toReactive(value); 1814 this["__v_isShallow"] = isShallow2; 1815 } 1816 get value() { 1817 { 1818 this.dep.track({ 1819 target: this, 1820 type: "get", 1821 key: "value" 1822 }); 1823 } 1824 return this._value; 1825 } 1826 set value(newValue) { 1827 const oldValue = this._rawValue; 1828 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue); 1829 newValue = useDirectValue ? newValue : toRaw(newValue); 1830 if (hasChanged(newValue, oldValue)) { 1831 this._rawValue = newValue; 1832 this._value = useDirectValue ? newValue : toReactive(newValue); 1833 { 1834 this.dep.trigger({ 1835 target: this, 1836 type: "set", 1837 key: "value", 1838 newValue, 1839 oldValue 1840 }); 1841 } 1842 } 1843 } 1844 } 1845 function triggerRef(ref2) { 1846 if (ref2.dep) { 1847 { 1848 ref2.dep.trigger({ 1849 target: ref2, 1850 type: "set", 1851 key: "value", 1852 newValue: ref2._value 1853 }); 1854 } 1855 } 1856 } 1857 function unref(ref2) { 1858 return isRef(ref2) ? ref2.value : ref2; 1859 } 1860 function toValue(source) { 1861 return isFunction(source) ? source() : unref(source); 1862 } 1863 const shallowUnwrapHandlers = { 1864 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), 1865 set: (target, key, value, receiver) => { 1866 const oldValue = target[key]; 1867 if (isRef(oldValue) && !isRef(value)) { 1868 oldValue.value = value; 1869 return true; 1870 } else { 1871 return Reflect.set(target, key, value, receiver); 1872 } 1873 } 1874 }; 1875 function proxyRefs(objectWithRefs) { 1876 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1877 } 1878 class CustomRefImpl { 1879 constructor(factory) { 1880 this["__v_isRef"] = true; 1881 this._value = void 0; 1882 const dep = this.dep = new Dep(); 1883 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); 1884 this._get = get; 1885 this._set = set; 1886 } 1887 get value() { 1888 return this._value = this._get(); 1889 } 1890 set value(newVal) { 1891 this._set(newVal); 1892 } 1893 } 1894 function customRef(factory) { 1895 return new CustomRefImpl(factory); 1896 } 1897 function toRefs(object) { 1898 if (!isProxy(object)) { 1899 warn$2(`toRefs() expects a reactive object but received a plain one.`); 1900 } 1901 const ret = isArray(object) ? new Array(object.length) : {}; 1902 for (const key in object) { 1903 ret[key] = propertyToRef(object, key); 1904 } 1905 return ret; 1906 } 1907 class ObjectRefImpl { 1908 constructor(_object, _key, _defaultValue) { 1909 this._object = _object; 1910 this._key = _key; 1911 this._defaultValue = _defaultValue; 1912 this["__v_isRef"] = true; 1913 this._value = void 0; 1914 } 1915 get value() { 1916 const val = this._object[this._key]; 1917 return this._value = val === void 0 ? this._defaultValue : val; 1918 } 1919 set value(newVal) { 1920 this._object[this._key] = newVal; 1921 } 1922 get dep() { 1923 return getDepFromReactive(toRaw(this._object), this._key); 1924 } 1925 } 1926 class GetterRefImpl { 1927 constructor(_getter) { 1928 this._getter = _getter; 1929 this["__v_isRef"] = true; 1930 this["__v_isReadonly"] = true; 1931 this._value = void 0; 1932 } 1933 get value() { 1934 return this._value = this._getter(); 1935 } 1936 } 1937 function toRef(source, key, defaultValue) { 1938 if (isRef(source)) { 1939 return source; 1940 } else if (isFunction(source)) { 1941 return new GetterRefImpl(source); 1942 } else if (isObject(source) && arguments.length > 1) { 1943 return propertyToRef(source, key, defaultValue); 1944 } else { 1945 return ref(source); 1946 } 1947 } 1948 function propertyToRef(source, key, defaultValue) { 1949 const val = source[key]; 1950 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); 1951 } 1952 1953 class ComputedRefImpl { 1954 constructor(fn, setter, isSSR) { 1955 this.fn = fn; 1956 this.setter = setter; 1957 /** 1958 * @internal 1959 */ 1960 this._value = void 0; 1961 /** 1962 * @internal 1963 */ 1964 this.dep = new Dep(this); 1965 /** 1966 * @internal 1967 */ 1968 this.__v_isRef = true; 1969 // TODO isolatedDeclarations "__v_isReadonly" 1970 // A computed is also a subscriber that tracks other deps 1971 /** 1972 * @internal 1973 */ 1974 this.deps = void 0; 1975 /** 1976 * @internal 1977 */ 1978 this.depsTail = void 0; 1979 /** 1980 * @internal 1981 */ 1982 this.flags = 16; 1983 /** 1984 * @internal 1985 */ 1986 this.globalVersion = globalVersion - 1; 1987 /** 1988 * @internal 1989 */ 1990 this.next = void 0; 1991 // for backwards compat 1992 this.effect = this; 1993 this["__v_isReadonly"] = !setter; 1994 this.isSSR = isSSR; 1995 } 1996 /** 1997 * @internal 1998 */ 1999 notify() { 2000 this.flags |= 16; 2001 if (!(this.flags & 8) && // avoid infinite self recursion 2002 activeSub !== this) { 2003 batch(this, true); 2004 return true; 2005 } 2006 } 2007 get value() { 2008 const link = this.dep.track({ 2009 target: this, 2010 type: "get", 2011 key: "value" 2012 }) ; 2013 refreshComputed(this); 2014 if (link) { 2015 link.version = this.dep.version; 2016 } 2017 return this._value; 2018 } 2019 set value(newValue) { 2020 if (this.setter) { 2021 this.setter(newValue); 2022 } else { 2023 warn$2("Write operation failed: computed value is readonly"); 2024 } 2025 } 2026 } 2027 function computed$1(getterOrOptions, debugOptions, isSSR = false) { 2028 let getter; 2029 let setter; 2030 if (isFunction(getterOrOptions)) { 2031 getter = getterOrOptions; 2032 } else { 2033 getter = getterOrOptions.get; 2034 setter = getterOrOptions.set; 2035 } 2036 const cRef = new ComputedRefImpl(getter, setter, isSSR); 2037 if (debugOptions && !isSSR) { 2038 cRef.onTrack = debugOptions.onTrack; 2039 cRef.onTrigger = debugOptions.onTrigger; 2040 } 2041 return cRef; 2042 } 2043 2044 const TrackOpTypes = { 2045 "GET": "get", 2046 "HAS": "has", 2047 "ITERATE": "iterate" 2048 }; 2049 const TriggerOpTypes = { 2050 "SET": "set", 2051 "ADD": "add", 2052 "DELETE": "delete", 2053 "CLEAR": "clear" 2054 }; 2055 2056 const INITIAL_WATCHER_VALUE = {}; 2057 const cleanupMap = /* @__PURE__ */ new WeakMap(); 2058 let activeWatcher = void 0; 2059 function getCurrentWatcher() { 2060 return activeWatcher; 2061 } 2062 function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { 2063 if (owner) { 2064 let cleanups = cleanupMap.get(owner); 2065 if (!cleanups) cleanupMap.set(owner, cleanups = []); 2066 cleanups.push(cleanupFn); 2067 } else if (!failSilently) { 2068 warn$2( 2069 `onWatcherCleanup() was called when there was no active watcher to associate with.` 2070 ); 2071 } 2072 } 2073 function watch$1(source, cb, options = EMPTY_OBJ) { 2074 const { immediate, deep, once, scheduler, augmentJob, call } = options; 2075 const warnInvalidSource = (s) => { 2076 (options.onWarn || warn$2)( 2077 `Invalid watch source: `, 2078 s, 2079 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` 2080 ); 2081 }; 2082 const reactiveGetter = (source2) => { 2083 if (deep) return source2; 2084 if (isShallow(source2) || deep === false || deep === 0) 2085 return traverse(source2, 1); 2086 return traverse(source2); 2087 }; 2088 let effect; 2089 let getter; 2090 let cleanup; 2091 let boundCleanup; 2092 let forceTrigger = false; 2093 let isMultiSource = false; 2094 if (isRef(source)) { 2095 getter = () => source.value; 2096 forceTrigger = isShallow(source); 2097 } else if (isReactive(source)) { 2098 getter = () => reactiveGetter(source); 2099 forceTrigger = true; 2100 } else if (isArray(source)) { 2101 isMultiSource = true; 2102 forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); 2103 getter = () => source.map((s) => { 2104 if (isRef(s)) { 2105 return s.value; 2106 } else if (isReactive(s)) { 2107 return reactiveGetter(s); 2108 } else if (isFunction(s)) { 2109 return call ? call(s, 2) : s(); 2110 } else { 2111 warnInvalidSource(s); 2112 } 2113 }); 2114 } else if (isFunction(source)) { 2115 if (cb) { 2116 getter = call ? () => call(source, 2) : source; 2117 } else { 2118 getter = () => { 2119 if (cleanup) { 2120 pauseTracking(); 2121 try { 2122 cleanup(); 2123 } finally { 2124 resetTracking(); 2125 } 2126 } 2127 const currentEffect = activeWatcher; 2128 activeWatcher = effect; 2129 try { 2130 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); 2131 } finally { 2132 activeWatcher = currentEffect; 2133 } 2134 }; 2135 } 2136 } else { 2137 getter = NOOP; 2138 warnInvalidSource(source); 2139 } 2140 if (cb && deep) { 2141 const baseGetter = getter; 2142 const depth = deep === true ? Infinity : deep; 2143 getter = () => traverse(baseGetter(), depth); 2144 } 2145 const scope = getCurrentScope(); 2146 const watchHandle = () => { 2147 effect.stop(); 2148 if (scope && scope.active) { 2149 remove(scope.effects, effect); 2150 } 2151 }; 2152 if (once && cb) { 2153 const _cb = cb; 2154 cb = (...args) => { 2155 _cb(...args); 2156 watchHandle(); 2157 }; 2158 } 2159 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 2160 const job = (immediateFirstRun) => { 2161 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) { 2162 return; 2163 } 2164 if (cb) { 2165 const newValue = effect.run(); 2166 if (
vendor: 12,447 bytes, lines 2166-2580
2166deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) { 2167 if (cleanup) { 2168 cleanup(); 2169 } 2170 const currentWatcher = activeWatcher; 2171 activeWatcher = effect; 2172 try { 2173 const args = [ 2174 newValue, 2175 // pass undefined as the old value when it's changed for the first time 2176 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 2177 boundCleanup 2178 ]; 2179 oldValue = newValue; 2180 call ? call(cb, 3, args) : ( 2181 // @ts-expect-error 2182 cb(...args) 2183 ); 2184 } finally { 2185 activeWatcher = currentWatcher; 2186 } 2187 } 2188 } else { 2189 effect.run(); 2190 } 2191 }; 2192 if (augmentJob) { 2193 augmentJob(job); 2194 } 2195 effect = new ReactiveEffect(getter); 2196 effect.scheduler = scheduler ? () => scheduler(job, false) : job; 2197 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect); 2198 cleanup = effect.onStop = () => { 2199 const cleanups = cleanupMap.get(effect); 2200 if (cleanups) { 2201 if (call) { 2202 call(cleanups, 4); 2203 } else { 2204 for (const cleanup2 of cleanups) cleanup2(); 2205 } 2206 cleanupMap.delete(effect); 2207 } 2208 }; 2209 { 2210 effect.onTrack = options.onTrack; 2211 effect.onTrigger = options.onTrigger; 2212 } 2213 if (cb) { 2214 if (immediate) { 2215 job(true); 2216 } else { 2217 oldValue = effect.run(); 2218 } 2219 } else if (scheduler) { 2220 scheduler(job.bind(null, true), true); 2221 } else { 2222 effect.run(); 2223 } 2224 watchHandle.pause = effect.pause.bind(effect); 2225 watchHandle.resume = effect.resume.bind(effect); 2226 watchHandle.stop = watchHandle; 2227 return watchHandle; 2228 } 2229 function traverse(value, depth = Infinity, seen) { 2230 if (depth <= 0 || !isObject(value) || value["__v_skip"]) { 2231 return value; 2232 } 2233 seen = seen || /* @__PURE__ */ new Map(); 2234 if ((seen.get(value) || 0) >= depth) { 2235 return value; 2236 } 2237 seen.set(value, depth); 2238 depth--; 2239 if (isRef(value)) { 2240 traverse(value.value, depth, seen); 2241 } else if (isArray(value)) { 2242 for (let i = 0; i < value.length; i++) { 2243 traverse(value[i], depth, seen); 2244 } 2245 } else if (isSet(value) || isMap(value)) { 2246 value.forEach((v) => { 2247 traverse(v, depth, seen); 2248 }); 2249 } else if (isPlainObject(value)) { 2250 for (const key in value) { 2251 traverse(value[key], depth, seen); 2252 } 2253 for (const key of Object.getOwnPropertySymbols(value)) { 2254 if (Object.prototype.propertyIsEnumerable.call(value, key)) { 2255 traverse(value[key], depth, seen); 2256 } 2257 } 2258 } 2259 return value; 2260 } 2261 2262 const stack$1 = []; 2263 function pushWarningContext(vnode) { 2264 stack$1.push(vnode); 2265 } 2266 function popWarningContext() { 2267 stack$1.pop(); 2268 } 2269 let isWarning = false; 2270 function warn$1(msg, ...args) { 2271 if (isWarning) return; 2272 isWarning = true; 2273 pauseTracking(); 2274 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null; 2275 const appWarnHandler = instance && instance.appContext.config.warnHandler; 2276 const trace = getComponentTrace(); 2277 if (appWarnHandler) { 2278 callWithErrorHandling( 2279 appWarnHandler, 2280 instance, 2281 11, 2282 [ 2283 // eslint-disable-next-line no-restricted-syntax 2284 msg + args.map((a) => { 2285 var _a, _b; 2286 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); 2287 }).join(""), 2288 instance && instance.proxy, 2289 trace.map( 2290 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 2291 ).join("\n"), 2292 trace 2293 ] 2294 ); 2295 } else { 2296 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 2297 if (trace.length && // avoid spamming console during tests 2298 true) { 2299 warnArgs.push(` 2300`, ...formatTrace(trace)); 2301 } 2302 console.warn(...warnArgs); 2303 } 2304 resetTracking(); 2305 isWarning = false; 2306 } 2307 function getComponentTrace() { 2308 let currentVNode = stack$1[stack$1.length - 1]; 2309 if (!currentVNode) { 2310 return []; 2311 } 2312 const normalizedStack = []; 2313 while (currentVNode) { 2314 const last = normalizedStack[0]; 2315 if (last && last.vnode === currentVNode) { 2316 last.recurseCount++; 2317 } else { 2318 normalizedStack.push({ 2319 vnode: currentVNode, 2320 recurseCount: 0 2321 }); 2322 } 2323 const parentInstance = currentVNode.component && currentVNode.component.parent; 2324 currentVNode = parentInstance && parentInstance.vnode; 2325 } 2326 return normalizedStack; 2327 } 2328 function formatTrace(trace) { 2329 const logs = []; 2330 trace.forEach((entry, i) => { 2331 logs.push(...i === 0 ? [] : [` 2332`], ...formatTraceEntry(entry)); 2333 }); 2334 return logs; 2335 } 2336 function formatTraceEntry({ vnode, recurseCount }) { 2337 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 2338 const isRoot = vnode.component ? vnode.component.parent == null : false; 2339 const open = ` at <${formatComponentName( 2340 vnode.component, 2341 vnode.type, 2342 isRoot 2343 )}`; 2344 const close = `>` + postfix; 2345 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; 2346 } 2347 function formatProps(props) { 2348 const res = []; 2349 const keys = Object.keys(props); 2350 keys.slice(0, 3).forEach((key) => { 2351 res.push(...formatProp(key, props[key])); 2352 }); 2353 if (keys.length > 3) { 2354 res.push(` ...`); 2355 } 2356 return res; 2357 } 2358 function formatProp(key, value, raw) { 2359 if (isString(value)) { 2360 value = JSON.stringify(value); 2361 return raw ? value : [`${key}=${value}`]; 2362 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 2363 return raw ? value : [`${key}=${value}`]; 2364 } else if (isRef(value)) { 2365 value = formatProp(key, toRaw(value.value), true); 2366 return raw ? value : [`${key}=Ref<`, value, `>`]; 2367 } else if (isFunction(value)) { 2368 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 2369 } else { 2370 value = toRaw(value); 2371 return raw ? value : [`${key}=`, value]; 2372 } 2373 } 2374 function assertNumber(val, type) { 2375 if (val === void 0) { 2376 return; 2377 } else if (typeof val !== "number") { 2378 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); 2379 } else if (isNaN(val)) { 2380 warn$1(`${type} is NaN - the duration expression might be incorrect.`); 2381 } 2382 } 2383 2384 const ErrorCodes = { 2385 "SETUP_FUNCTION": 0, 2386 "0": "SETUP_FUNCTION", 2387 "RENDER_FUNCTION": 1, 2388 "1": "RENDER_FUNCTION", 2389 "NATIVE_EVENT_HANDLER": 5, 2390 "5": "NATIVE_EVENT_HANDLER", 2391 "COMPONENT_EVENT_HANDLER": 6, 2392 "6": "COMPONENT_EVENT_HANDLER", 2393 "VNODE_HOOK": 7, 2394 "7": "VNODE_HOOK", 2395 "DIRECTIVE_HOOK": 8, 2396 "8": "DIRECTIVE_HOOK", 2397 "TRANSITION_HOOK": 9, 2398 "9": "TRANSITION_HOOK", 2399 "APP_ERROR_HANDLER": 10, 2400 "10": "APP_ERROR_HANDLER", 2401 "APP_WARN_HANDLER": 11, 2402 "11": "APP_WARN_HANDLER", 2403 "FUNCTION_REF": 12, 2404 "12": "FUNCTION_REF", 2405 "ASYNC_COMPONENT_LOADER": 13, 2406 "13": "ASYNC_COMPONENT_LOADER", 2407 "SCHEDULER": 14, 2408 "14": "SCHEDULER", 2409 "COMPONENT_UPDATE": 15, 2410 "15": "COMPONENT_UPDATE", 2411 "APP_UNMOUNT_CLEANUP": 16, 2412 "16": "APP_UNMOUNT_CLEANUP" 2413 }; 2414 const ErrorTypeStrings$1 = { 2415 ["sp"]: "serverPrefetch hook", 2416 ["bc"]: "beforeCreate hook", 2417 ["c"]: "created hook", 2418 ["bm"]: "beforeMount hook", 2419 ["m"]: "mounted hook", 2420 ["bu"]: "beforeUpdate hook", 2421 ["u"]: "updated", 2422 ["bum"]: "beforeUnmount hook", 2423 ["um"]: "unmounted hook", 2424 ["a"]: "activated hook", 2425 ["da"]: "deactivated hook", 2426 ["ec"]: "errorCaptured hook", 2427 ["rtc"]: "renderTracked hook", 2428 ["rtg"]: "renderTriggered hook", 2429 [0]: "setup function", 2430 [1]: "render function", 2431 [2]: "watcher getter", 2432 [3]: "watcher callback", 2433 [4]: "watcher cleanup function", 2434 [5]: "native event handler", 2435 [6]: "component event handler", 2436 [7]: "vnode hook", 2437 [8]: "directive hook", 2438 [9]: "transition hook", 2439 [10]: "app errorHandler", 2440 [11]: "app warnHandler", 2441 [12]: "ref function", 2442 [13]: "async component loader", 2443 [14]: "scheduler flush", 2444 [15]: "component update", 2445 [16]: "app unmount cleanup function" 2446 }; 2447 function callWithErrorHandling(fn, instance, type, args) { 2448 try { 2449 return args ? fn(...args) : fn(); 2450 } catch (err) { 2451 handleError(err, instance, type); 2452 } 2453 } 2454 function callWithAsyncErrorHandling(fn, instance, type, args) { 2455 if (isFunction(fn)) { 2456 const res = callWithErrorHandling(fn, instance, type, args); 2457 if (res && isPromise(res)) { 2458 res.catch((err) => { 2459 handleError(err, instance, type); 2460 }); 2461 } 2462 return res; 2463 } 2464 if (isArray(fn)) { 2465 const values = []; 2466 for (let i = 0; i < fn.length; i++) { 2467 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); 2468 } 2469 return values; 2470 } else { 2471 warn$1( 2472 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}` 2473 ); 2474 } 2475 } 2476 function handleError(err, instance, type, throwInDev = true) { 2477 const contextVNode = instance ? instance.vnode : null; 2478 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; 2479 if (instance) { 2480 let cur = instance.parent; 2481 const exposedInstance = instance.proxy; 2482 const errorInfo = ErrorTypeStrings$1[type] ; 2483 while (cur) { 2484 const errorCapturedHooks = cur.ec; 2485 if (errorCapturedHooks) { 2486 for (let i = 0; i < errorCapturedHooks.length; i++) { 2487 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 2488 return; 2489 } 2490 } 2491 } 2492 cur = cur.parent; 2493 } 2494 if (errorHandler) { 2495 pauseTracking(); 2496 callWithErrorHandling(errorHandler, null, 10, [ 2497 err, 2498 exposedInstance, 2499 errorInfo 2500 ]); 2501 resetTracking(); 2502 return; 2503 } 2504 } 2505 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); 2506 } 2507 function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { 2508 { 2509 const info = ErrorTypeStrings$1[type]; 2510 if (contextVNode) { 2511 pushWarningContext(contextVNode); 2512 } 2513 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); 2514 if (contextVNode) { 2515 popWarningContext(); 2516 } 2517 if (throwInDev) { 2518 throw err; 2519 } else { 2520 console.error(err); 2521 } 2522 } 2523 } 2524 2525 const queue = []; 2526 let flushIndex = -1; 2527 const pendingPostFlushCbs = []; 2528 let activePostFlushCbs = null; 2529 let postFlushIndex = 0; 2530 const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 2531 let currentFlushPromise = null; 2532 const RECURSION_LIMIT = 100; 2533 function nextTick(fn) { 2534 const p = currentFlushPromise || resolvedPromise; 2535 return fn ? p.then(this ? fn.bind(this) : fn) : p; 2536 } 2537 function findInsertionIndex(id) { 2538 let start = flushIndex + 1; 2539 let end = queue.length; 2540 while (start < end) { 2541 const middle = start + end >>> 1; 2542 const middleJob = queue[middle]; 2543 const middleJobId = getId(middleJob); 2544 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) { 2545 start = middle + 1; 2546 } else { 2547 end = middle; 2548 } 2549 } 2550 return start; 2551 } 2552 function queueJob(job) { 2553 if (!(job.flags & 1)) { 2554 const jobId = getId(job); 2555 const lastJob = queue[queue.length - 1]; 2556 if (!lastJob || // fast path when the job id is larger than the tail 2557 !(job.flags & 2) && jobId >= getId(lastJob)) { 2558 queue.push(job); 2559 } else { 2560 queue.splice(findInsertionIndex(jobId), 0, job); 2561 } 2562 job.flags |= 1; 2563 queueFlush(); 2564 } 2565 } 2566 function queueFlush() { 2567 if (!currentFlushPromise) { 2568 currentFlushPromise = resolvedPromise.then(flushJobs); 2569 } 2570 } 2571 function queuePostFlushCb(cb) { 2572 if (!isArray(cb)) { 2573 if (activePostFlushCbs && cb.id === -1) { 2574 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); 2575 } else if (!(cb.flags & 1)) { 2576 pendingPostFlushCbs.push(cb); 2577 cb.flags |= 1; 2578 } 2579 } else { 2580
vendor: 11,131 bytes, lines 2580-2939
2580pendingPostFlushCbs.push(...cb); 2581 } 2582 queueFlush(); 2583 } 2584 function flushPreFlushCbs(instance, seen, i = flushIndex + 1) { 2585 { 2586 seen = seen || /* @__PURE__ */ new Map(); 2587 } 2588 for (; i < queue.length; i++) { 2589 const cb = queue[i]; 2590 if (cb && cb.flags & 2) { 2591 if (instance && cb.id !== instance.uid) { 2592 continue; 2593 } 2594 if (checkRecursiveUpdates(seen, cb)) { 2595 continue; 2596 } 2597 queue.splice(i, 1); 2598 i--; 2599 if (cb.flags & 4) { 2600 cb.flags &= -2; 2601 } 2602 cb(); 2603 if (!(cb.flags & 4)) { 2604 cb.flags &= -2; 2605 } 2606 } 2607 } 2608 } 2609 function flushPostFlushCbs(seen) { 2610 if (pendingPostFlushCbs.length) { 2611 const deduped = [...new Set(pendingPostFlushCbs)].sort( 2612 (a, b) => getId(a) - getId(b) 2613 ); 2614 pendingPostFlushCbs.length = 0; 2615 if (activePostFlushCbs) { 2616 activePostFlushCbs.push(...deduped); 2617 return; 2618 } 2619 activePostFlushCbs = deduped; 2620 { 2621 seen = seen || /* @__PURE__ */ new Map(); 2622 } 2623 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 2624 const cb = activePostFlushCbs[postFlushIndex]; 2625 if (checkRecursiveUpdates(seen, cb)) { 2626 continue; 2627 } 2628 if (cb.flags & 4) { 2629 cb.flags &= -2; 2630 } 2631 if (!(cb.flags & 8)) cb(); 2632 cb.flags &= -2; 2633 } 2634 activePostFlushCbs = null; 2635 postFlushIndex = 0; 2636 } 2637 } 2638 const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id; 2639 function flushJobs(seen) { 2640 { 2641 seen = seen || /* @__PURE__ */ new Map(); 2642 } 2643 const check = (job) => checkRecursiveUpdates(seen, job) ; 2644 try { 2645 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 2646 const job = queue[flushIndex]; 2647 if (job && !(job.flags & 8)) { 2648 if (check(job)) { 2649 continue; 2650 } 2651 if (job.flags & 4) { 2652 job.flags &= ~1; 2653 } 2654 callWithErrorHandling( 2655 job, 2656 job.i, 2657 job.i ? 15 : 14 2658 ); 2659 if (!(job.flags & 4)) { 2660 job.flags &= ~1; 2661 } 2662 } 2663 } 2664 } finally { 2665 for (; flushIndex < queue.length; flushIndex++) { 2666 const job = queue[flushIndex]; 2667 if (job) { 2668 job.flags &= -2; 2669 } 2670 } 2671 flushIndex = -1; 2672 queue.length = 0; 2673 flushPostFlushCbs(seen); 2674 currentFlushPromise = null; 2675 if (queue.length || pendingPostFlushCbs.length) { 2676 flushJobs(seen); 2677 } 2678 } 2679 } 2680 function checkRecursiveUpdates(seen, fn) { 2681 const count = seen.get(fn) || 0; 2682 if (count > RECURSION_LIMIT) { 2683 const instance = fn.i; 2684 const componentName = instance && getComponentName(instance.type); 2685 handleError( 2686 `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.`, 2687 null, 2688 10 2689 ); 2690 return true; 2691 } 2692 seen.set(fn, count + 1); 2693 return false; 2694 } 2695 2696 let isHmrUpdating = false; 2697 const hmrDirtyComponents = /* @__PURE__ */ new Map(); 2698 { 2699 getGlobalThis().__VUE_HMR_RUNTIME__ = { 2700 createRecord: tryWrap(createRecord), 2701 rerender: tryWrap(rerender), 2702 reload: tryWrap(reload) 2703 }; 2704 } 2705 const map = /* @__PURE__ */ new Map(); 2706 function registerHMR(instance) { 2707 const id = instance.type.__hmrId; 2708 let record = map.get(id); 2709 if (!record) { 2710 createRecord(id, instance.type); 2711 record = map.get(id); 2712 } 2713 record.instances.add(instance); 2714 } 2715 function unregisterHMR(instance) { 2716 map.get(instance.type.__hmrId).instances.delete(instance); 2717 } 2718 function createRecord(id, initialDef) { 2719 if (map.has(id)) { 2720 return false; 2721 } 2722 map.set(id, { 2723 initialDef: normalizeClassComponent(initialDef), 2724 instances: /* @__PURE__ */ new Set() 2725 }); 2726 return true; 2727 } 2728 function normalizeClassComponent(component) { 2729 return isClassComponent(component) ? component.__vccOpts : component; 2730 } 2731 function rerender(id, newRender) { 2732 const record = map.get(id); 2733 if (!record) { 2734 return; 2735 } 2736 record.initialDef.render = newRender; 2737 [...record.instances].forEach((instance) => { 2738 if (newRender) { 2739 instance.render = newRender; 2740 normalizeClassComponent(instance.type).render = newRender; 2741 } 2742 instance.renderCache = []; 2743 isHmrUpdating = true; 2744 if (!(instance.job.flags & 8)) { 2745 instance.update(); 2746 } 2747 isHmrUpdating = false; 2748 }); 2749 } 2750 function reload(id, newComp) { 2751 const record = map.get(id); 2752 if (!record) return; 2753 newComp = normalizeClassComponent(newComp); 2754 updateComponentDef(record.initialDef, newComp); 2755 const instances = [...record.instances]; 2756 for (let i = 0; i < instances.length; i++) { 2757 const instance = instances[i]; 2758 const oldComp = normalizeClassComponent(instance.type); 2759 let dirtyInstances = hmrDirtyComponents.get(oldComp); 2760 if (!dirtyInstances) { 2761 if (oldComp !== record.initialDef) { 2762 updateComponentDef(oldComp, newComp); 2763 } 2764 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); 2765 } 2766 dirtyInstances.add(instance); 2767 instance.appContext.propsCache.delete(instance.type); 2768 instance.appContext.emitsCache.delete(instance.type); 2769 instance.appContext.optionsCache.delete(instance.type); 2770 if (instance.ceReload) { 2771 dirtyInstances.add(instance); 2772 instance.ceReload(newComp.styles); 2773 dirtyInstances.delete(instance); 2774 } else if (instance.parent) { 2775 queueJob(() => { 2776 if (!(instance.job.flags & 8)) { 2777 isHmrUpdating = true; 2778 instance.parent.update(); 2779 isHmrUpdating = false; 2780 dirtyInstances.delete(instance); 2781 } 2782 }); 2783 } else if (instance.appContext.reload) { 2784 instance.appContext.reload(); 2785 } else if (typeof window !== "undefined") { 2786 window.location.reload(); 2787 } else { 2788 console.warn( 2789 "[HMR] Root or manually mounted instance modified. Full reload required." 2790 ); 2791 } 2792 if (instance.root.ce && instance !== instance.root) { 2793 instance.root.ce._removeChildStyle(oldComp); 2794 } 2795 } 2796 queuePostFlushCb(() => { 2797 hmrDirtyComponents.clear(); 2798 }); 2799 } 2800 function updateComponentDef(oldComp, newComp) { 2801 extend(oldComp, newComp); 2802 for (const key in oldComp) { 2803 if (key !== "__file" && !(key in newComp)) { 2804 delete oldComp[key]; 2805 } 2806 } 2807 } 2808 function tryWrap(fn) { 2809 return (id, arg) => { 2810 try { 2811 return fn(id, arg); 2812 } catch (e) { 2813 console.error(e); 2814 console.warn( 2815 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` 2816 ); 2817 } 2818 }; 2819 } 2820 2821 let devtools$1; 2822 let buffer = []; 2823 let devtoolsNotInstalled = false; 2824 function emit$1(event, ...args) { 2825 if (devtools$1) { 2826 devtools$1.emit(event, ...args); 2827 } else if (!devtoolsNotInstalled) { 2828 buffer.push({ event, args }); 2829 } 2830 } 2831 function setDevtoolsHook$1(hook, target) { 2832 var _a, _b; 2833 devtools$1 = hook; 2834 if (devtools$1) { 2835 devtools$1.enabled = true; 2836 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); 2837 buffer = []; 2838 } else if ( 2839 // handle late devtools injection - only do this if we are in an actual 2840 // browser environment to avoid the timer handle stalling test runner exit 2841 // (#4815) 2842 typeof window !== "undefined" && // some envs mock window but not fully 2843 window.HTMLElement && // also exclude jsdom 2844 // eslint-disable-next-line no-restricted-syntax 2845 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) 2846 ) { 2847 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 2848 replay.push((newHook) => { 2849 setDevtoolsHook$1(newHook, target); 2850 }); 2851 setTimeout(() => { 2852 if (!devtools$1) { 2853 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 2854 devtoolsNotInstalled = true; 2855 buffer = []; 2856 } 2857 }, 3e3); 2858 } else { 2859 devtoolsNotInstalled = true; 2860 buffer = []; 2861 } 2862 } 2863 function devtoolsInitApp(app, version) { 2864 emit$1("app:init" /* APP_INIT */, app, version, { 2865 Fragment, 2866 Text, 2867 Comment, 2868 Static 2869 }); 2870 } 2871 function devtoolsUnmountApp(app) { 2872 emit$1("app:unmount" /* APP_UNMOUNT */, app); 2873 } 2874 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */); 2875 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */); 2876 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( 2877 "component:removed" /* COMPONENT_REMOVED */ 2878 ); 2879 const devtoolsComponentRemoved = (component) => { 2880 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered 2881 !devtools$1.cleanupBuffer(component)) { 2882 _devtoolsComponentRemoved(component); 2883 } 2884 }; 2885 // @__NO_SIDE_EFFECTS__ 2886 function createDevtoolsComponentHook(hook) { 2887 return (component) => { 2888 emit$1( 2889 hook, 2890 component.appContext.app, 2891 component.uid, 2892 component.parent ? component.parent.uid : void 0, 2893 component 2894 ); 2895 }; 2896 } 2897 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); 2898 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); 2899 function createDevtoolsPerformanceHook(hook) { 2900 return (component, type, time) => { 2901 emit$1(hook, component.appContext.app, component.uid, component, type, time); 2902 }; 2903 } 2904 function devtoolsComponentEmit(component, event, params) { 2905 emit$1( 2906 "component:emit" /* COMPONENT_EMIT */, 2907 component.appContext.app, 2908 component, 2909 event, 2910 params 2911 ); 2912 } 2913 2914 let currentRenderingInstance = null; 2915 let currentScopeId = null; 2916 function setCurrentRenderingInstance(instance) { 2917 const prev = currentRenderingInstance; 2918 currentRenderingInstance = instance; 2919 currentScopeId = instance && instance.type.__scopeId || null; 2920 return prev; 2921 } 2922 function pushScopeId(id) { 2923 currentScopeId = id; 2924 } 2925 function popScopeId() { 2926 currentScopeId = null; 2927 } 2928 const withScopeId = (_id) => withCtx; 2929 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 2930 if (!ctx) return fn; 2931 if (fn._n) { 2932 return fn; 2933 } 2934 const renderFnWithContext = (...args) => { 2935 if (renderFnWithContext._d) { 2936 setBlockTracking(-1); 2937 } 2938 const prevInstance = setCurrentRenderingInstance(ctx); 2939 let res;
vendor: 11,578 bytes, lines 2940-3312
2940 try { 2941 res = fn(...args); 2942 } finally { 2943 setCurrentRenderingInstance(prevInstance); 2944 if (renderFnWithContext._d) { 2945 setBlockTracking(1); 2946 } 2947 } 2948 { 2949 devtoolsComponentUpdated(ctx); 2950 } 2951 return res; 2952 }; 2953 renderFnWithContext._n = true; 2954 renderFnWithContext._c = true; 2955 renderFnWithContext._d = true; 2956 return renderFnWithContext; 2957 } 2958 2959 function validateDirectiveName(name) { 2960 if (isBuiltInDirective(name)) { 2961 warn$1("Do not use built-in directive ids as custom directive id: " + name); 2962 } 2963 } 2964 function withDirectives(vnode, directives) { 2965 if (currentRenderingInstance === null) { 2966 warn$1(`withDirectives can only be used inside render functions.`); 2967 return vnode; 2968 } 2969 const instance = getComponentPublicInstance(currentRenderingInstance); 2970 const bindings = vnode.dirs || (vnode.dirs = []); 2971 for (let i = 0; i < directives.length; i++) { 2972 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 2973 if (dir) { 2974 if (isFunction(dir)) { 2975 dir = { 2976 mounted: dir, 2977 updated: dir 2978 }; 2979 } 2980 if (dir.deep) { 2981 traverse(value); 2982 } 2983 bindings.push({ 2984 dir, 2985 instance, 2986 value, 2987 oldValue: void 0, 2988 arg, 2989 modifiers 2990 }); 2991 } 2992 } 2993 return vnode; 2994 } 2995 function invokeDirectiveHook(vnode, prevVNode, instance, name) { 2996 const bindings = vnode.dirs; 2997 const oldBindings = prevVNode && prevVNode.dirs; 2998 for (let i = 0; i < bindings.length; i++) { 2999 const binding = bindings[i]; 3000 if (oldBindings) { 3001 binding.oldValue = oldBindings[i].value; 3002 } 3003 let hook = binding.dir[name]; 3004 if (hook) { 3005 pauseTracking(); 3006 callWithAsyncErrorHandling(hook, instance, 8, [ 3007 vnode.el, 3008 binding, 3009 vnode, 3010 prevVNode 3011 ]); 3012 resetTracking(); 3013 } 3014 } 3015 } 3016 3017 const TeleportEndKey = Symbol("_vte"); 3018 const isTeleport = (type) => type.__isTeleport; 3019 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 3020 const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 3021 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 3022 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 3023 const resolveTarget = (props, select) => { 3024 const targetSelector = props && props.to; 3025 if (isString(targetSelector)) { 3026 if (!select) { 3027 warn$1( 3028 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 3029 ); 3030 return null; 3031 } else { 3032 const target = select(targetSelector); 3033 if (!target && !isTeleportDisabled(props)) { 3034 warn$1( 3035 `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.` 3036 ); 3037 } 3038 return target; 3039 } 3040 } else { 3041 if (!targetSelector && !isTeleportDisabled(props)) { 3042 warn$1(`Invalid Teleport target: ${targetSelector}`); 3043 } 3044 return targetSelector; 3045 } 3046 }; 3047 const TeleportImpl = { 3048 name: "Teleport", 3049 __isTeleport: true, 3050 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 3051 const { 3052 mc: mountChildren, 3053 pc: patchChildren, 3054 pbc: patchBlockChildren, 3055 o: { insert, querySelector, createText, createComment } 3056 } = internals; 3057 const disabled = isTeleportDisabled(n2.props); 3058 let { shapeFlag, children, dynamicChildren } = n2; 3059 if (isHmrUpdating) { 3060 optimized = false; 3061 dynamicChildren = null; 3062 } 3063 if (n1 == null) { 3064 const placeholder = n2.el = createComment("teleport start") ; 3065 const mainAnchor = n2.anchor = createComment("teleport end") ; 3066 insert(placeholder, container, anchor); 3067 insert(mainAnchor, container, anchor); 3068 const mount = (container2, anchor2) => { 3069 if (shapeFlag & 16) { 3070 mountChildren( 3071 children, 3072 container2, 3073 anchor2, 3074 parentComponent, 3075 parentSuspense, 3076 namespace, 3077 slotScopeIds, 3078 optimized 3079 ); 3080 } 3081 }; 3082 const mountToTarget = () => { 3083 const target = n2.target = resolveTarget(n2.props, querySelector); 3084 const targetAnchor = prepareAnchor(target, n2, createText, insert); 3085 if (target) { 3086 if (namespace !== "svg" && isTargetSVG(target)) { 3087 namespace = "svg"; 3088 } else if (namespace !== "mathml" && isTargetMathML(target)) { 3089 namespace = "mathml"; 3090 } 3091 if (parentComponent && parentComponent.isCE) { 3092 (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target); 3093 } 3094 if (!disabled) { 3095 mount(target, targetAnchor); 3096 updateCssVars(n2, false); 3097 } 3098 } else if (!disabled) { 3099 warn$1( 3100 "Invalid Teleport target on mount:", 3101 target, 3102 `(${typeof target})` 3103 ); 3104 } 3105 }; 3106 if (disabled) { 3107 mount(container, mainAnchor); 3108 updateCssVars(n2, true); 3109 } 3110 if (isTeleportDeferred(n2.props)) { 3111 n2.el.__isMounted = false; 3112 queuePostRenderEffect(() => { 3113 mountToTarget(); 3114 delete n2.el.__isMounted; 3115 }, parentSuspense); 3116 } else { 3117 mountToTarget(); 3118 } 3119 } else { 3120 if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) { 3121 queuePostRenderEffect(() => { 3122 TeleportImpl.process( 3123 n1, 3124 n2, 3125 container, 3126 anchor, 3127 parentComponent, 3128 parentSuspense, 3129 namespace, 3130 slotScopeIds, 3131 optimized, 3132 internals 3133 ); 3134 }, parentSuspense); 3135 return; 3136 } 3137 n2.el = n1.el; 3138 n2.targetStart = n1.targetStart; 3139 const mainAnchor = n2.anchor = n1.anchor; 3140 const target = n2.target = n1.target; 3141 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 3142 const wasDisabled = isTeleportDisabled(n1.props); 3143 const currentContainer = wasDisabled ? container : target; 3144 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 3145 if (namespace === "svg" || isTargetSVG(target)) { 3146 namespace = "svg"; 3147 } else if (namespace === "mathml" || isTargetMathML(target)) { 3148 namespace = "mathml"; 3149 } 3150 if (dynamicChildren) { 3151 patchBlockChildren( 3152 n1.dynamicChildren, 3153 dynamicChildren, 3154 currentContainer, 3155 parentComponent, 3156 parentSuspense, 3157 namespace, 3158 slotScopeIds 3159 ); 3160 traverseStaticChildren(n1, n2, false); 3161 } else if (!optimized) { 3162 patchChildren( 3163 n1, 3164 n2, 3165 currentContainer, 3166 currentAnchor, 3167 parentComponent, 3168 parentSuspense, 3169 namespace, 3170 slotScopeIds, 3171 false 3172 ); 3173 } 3174 if (disabled) { 3175 if (!wasDisabled) { 3176 moveTeleport( 3177 n2, 3178 container, 3179 mainAnchor, 3180 internals, 3181 1 3182 ); 3183 } else { 3184 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 3185 n2.props.to = n1.props.to; 3186 } 3187 } 3188 } else { 3189 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 3190 const nextTarget = n2.target = resolveTarget( 3191 n2.props, 3192 querySelector 3193 ); 3194 if (nextTarget) { 3195 moveTeleport( 3196 n2, 3197 nextTarget, 3198 null, 3199 internals, 3200 0 3201 ); 3202 } else { 3203 warn$1( 3204 "Invalid Teleport target on update:", 3205 target, 3206 `(${typeof target})` 3207 ); 3208 } 3209 } else if (wasDisabled) { 3210 moveTeleport( 3211 n2, 3212 target, 3213 targetAnchor, 3214 internals, 3215 1 3216 ); 3217 } 3218 } 3219 updateCssVars(n2, disabled); 3220 } 3221 }, 3222 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 3223 const { 3224 shapeFlag, 3225 children, 3226 anchor, 3227 targetStart, 3228 targetAnchor, 3229 target, 3230 props 3231 } = vnode; 3232 if (target) { 3233 hostRemove(targetStart); 3234 hostRemove(targetAnchor); 3235 } 3236 doRemove && hostRemove(anchor); 3237 if (shapeFlag & 16) { 3238 const shouldRemove = doRemove || !isTeleportDisabled(props); 3239 for (let i = 0; i < children.length; i++) { 3240 const child = children[i]; 3241 unmount( 3242 child, 3243 parentComponent, 3244 parentSuspense, 3245 shouldRemove, 3246 !!child.dynamicChildren 3247 ); 3248 } 3249 } 3250 }, 3251 move: moveTeleport, 3252 hydrate: hydrateTeleport 3253 }; 3254 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 3255 if (moveType === 0) { 3256 insert(vnode.targetAnchor, container, parentAnchor); 3257 } 3258 const { el, anchor, shapeFlag, children, props } = vnode; 3259 const isReorder = moveType === 2; 3260 if (isReorder) { 3261 insert(el, container, parentAnchor); 3262 } 3263 if (!isReorder || isTeleportDisabled(props)) { 3264 if (shapeFlag & 16) { 3265 for (let i = 0; i < children.length; i++) { 3266 move( 3267 children[i], 3268 container, 3269 parentAnchor, 3270 2 3271 ); 3272 } 3273 } 3274 } 3275 if (isReorder) { 3276 insert(anchor, container, parentAnchor); 3277 } 3278 } 3279 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 3280 o: { nextSibling, parentNode, querySelector, insert, createText } 3281 }, hydrateChildren) { 3282 function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) { 3283 vnode2.anchor = hydrateChildren( 3284 nextSibling(node2), 3285 vnode2, 3286 parentNode(node2), 3287 parentComponent, 3288 parentSuspense, 3289 slotScopeIds, 3290 optimized 3291 ); 3292 vnode2.targetStart = targetStart; 3293 vnode2.targetAnchor = targetAnchor; 3294 } 3295 const target = vnode.target = resolveTarget( 3296 vnode.props, 3297 querySelector 3298 ); 3299 const disabled = isTeleportDisabled(vnode.props); 3300 if (target) { 3301 const targetNode = target._lpa || target.firstChild; 3302 if (vnode.shapeFlag & 16) { 3303 if (disabled) { 3304 hydrateDisabledTeleport( 3305 node, 3306 vnode, 3307 targetNode, 3308 targetNode && nextSibling(targetNode) 3309 ); 3310 } else { 3311 vnode.anchor = nextSibling(node); 3312 let targetAnchor = targetNode;
vendor: 41,106 bytes, lines 3313-4577
3313 while (targetAnchor) { 3314 if (targetAnchor && targetAnchor.nodeType === 8) { 3315 if (targetAnchor.data === "teleport start anchor") { 3316 vnode.targetStart = targetAnchor; 3317 } else if (targetAnchor.data === "teleport anchor") { 3318 vnode.targetAnchor = targetAnchor; 3319 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 3320 break; 3321 } 3322 } 3323 targetAnchor = nextSibling(targetAnchor); 3324 } 3325 if (!vnode.targetAnchor) { 3326 prepareAnchor(target, vnode, createText, insert); 3327 } 3328 hydrateChildren( 3329 targetNode && nextSibling(targetNode), 3330 vnode, 3331 target, 3332 parentComponent, 3333 parentSuspense, 3334 slotScopeIds, 3335 optimized 3336 ); 3337 } 3338 } 3339 updateCssVars(vnode, disabled); 3340 } else if (disabled) { 3341 if (vnode.shapeFlag & 16) { 3342 hydrateDisabledTeleport(node, vnode, node, nextSibling(node)); 3343 } 3344 } 3345 return vnode.anchor && nextSibling(vnode.anchor); 3346 } 3347 const Teleport = TeleportImpl; 3348 function updateCssVars(vnode, isDisabled) { 3349 const ctx = vnode.ctx; 3350 if (ctx && ctx.ut) { 3351 let node, anchor; 3352 if (isDisabled) { 3353 node = vnode.el; 3354 anchor = vnode.anchor; 3355 } else { 3356 node = vnode.targetStart; 3357 anchor = vnode.targetAnchor; 3358 } 3359 while (node && node !== anchor) { 3360 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 3361 node = node.nextSibling; 3362 } 3363 ctx.ut(); 3364 } 3365 } 3366 function prepareAnchor(target, vnode, createText, insert) { 3367 const targetStart = vnode.targetStart = createText(""); 3368 const targetAnchor = vnode.targetAnchor = createText(""); 3369 targetStart[TeleportEndKey] = targetAnchor; 3370 if (target) { 3371 insert(targetStart, target); 3372 insert(targetAnchor, target); 3373 } 3374 return targetAnchor; 3375 } 3376 3377 const leaveCbKey = Symbol("_leaveCb"); 3378 const enterCbKey$1 = Symbol("_enterCb"); 3379 function useTransitionState() { 3380 const state = { 3381 isMounted: false, 3382 isLeaving: false, 3383 isUnmounting: false, 3384 leavingVNodes: /* @__PURE__ */ new Map() 3385 }; 3386 onMounted(() => { 3387 state.isMounted = true; 3388 }); 3389 onBeforeUnmount(() => { 3390 state.isUnmounting = true; 3391 }); 3392 return state; 3393 } 3394 const TransitionHookValidator = [Function, Array]; 3395 const BaseTransitionPropsValidators = { 3396 mode: String, 3397 appear: Boolean, 3398 persisted: Boolean, 3399 // enter 3400 onBeforeEnter: TransitionHookValidator, 3401 onEnter: TransitionHookValidator, 3402 onAfterEnter: TransitionHookValidator, 3403 onEnterCancelled: TransitionHookValidator, 3404 // leave 3405 onBeforeLeave: TransitionHookValidator, 3406 onLeave: TransitionHookValidator, 3407 onAfterLeave: TransitionHookValidator, 3408 onLeaveCancelled: TransitionHookValidator, 3409 // appear 3410 onBeforeAppear: TransitionHookValidator, 3411 onAppear: TransitionHookValidator, 3412 onAfterAppear: TransitionHookValidator, 3413 onAppearCancelled: TransitionHookValidator 3414 }; 3415 const recursiveGetSubtree = (instance) => { 3416 const subTree = instance.subTree; 3417 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 3418 }; 3419 const BaseTransitionImpl = { 3420 name: `BaseTransition`, 3421 props: BaseTransitionPropsValidators, 3422 setup(props, { slots }) { 3423 const instance = getCurrentInstance(); 3424 const state = useTransitionState(); 3425 return () => { 3426 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3427 if (!children || !children.length) { 3428 return; 3429 } 3430 const child = findNonCommentChild(children); 3431 const rawProps = toRaw(props); 3432 const { mode } = rawProps; 3433 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") { 3434 warn$1(`invalid <transition> mode: ${mode}`); 3435 } 3436 if (state.isLeaving) { 3437 return emptyPlaceholder(child); 3438 } 3439 const innerChild = getInnerChild$1(child); 3440 if (!innerChild) { 3441 return emptyPlaceholder(child); 3442 } 3443 let enterHooks = resolveTransitionHooks( 3444 innerChild, 3445 rawProps, 3446 state, 3447 instance, 3448 // #11061, ensure enterHooks is fresh after clone 3449 (hooks) => enterHooks = hooks 3450 ); 3451 if (innerChild.type !== Comment) { 3452 setTransitionHooks(innerChild, enterHooks); 3453 } 3454 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); 3455 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) { 3456 let leavingHooks = resolveTransitionHooks( 3457 oldInnerChild, 3458 rawProps, 3459 state, 3460 instance 3461 ); 3462 setTransitionHooks(oldInnerChild, leavingHooks); 3463 if (mode === "out-in" && innerChild.type !== Comment) { 3464 state.isLeaving = true; 3465 leavingHooks.afterLeave = () => { 3466 state.isLeaving = false; 3467 if (!(instance.job.flags & 8)) { 3468 instance.update(); 3469 } 3470 delete leavingHooks.afterLeave; 3471 oldInnerChild = void 0; 3472 }; 3473 return emptyPlaceholder(child); 3474 } else if (mode === "in-out" && innerChild.type !== Comment) { 3475 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3476 const leavingVNodesCache = getLeavingNodesForType( 3477 state, 3478 oldInnerChild 3479 ); 3480 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3481 el[leaveCbKey] = () => { 3482 earlyRemove(); 3483 el[leaveCbKey] = void 0; 3484 delete enterHooks.delayedLeave; 3485 oldInnerChild = void 0; 3486 }; 3487 enterHooks.delayedLeave = () => { 3488 delayedLeave(); 3489 delete enterHooks.delayedLeave; 3490 oldInnerChild = void 0; 3491 }; 3492 }; 3493 } else { 3494 oldInnerChild = void 0; 3495 } 3496 } else if (oldInnerChild) { 3497 oldInnerChild = void 0; 3498 } 3499 return child; 3500 }; 3501 } 3502 }; 3503 function findNonCommentChild(children) { 3504 let child = children[0]; 3505 if (children.length > 1) { 3506 let hasFound = false; 3507 for (const c of children) { 3508 if (c.type !== Comment) { 3509 if (hasFound) { 3510 warn$1( 3511 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3512 ); 3513 break; 3514 } 3515 child = c; 3516 hasFound = true; 3517 } 3518 } 3519 } 3520 return child; 3521 } 3522 const BaseTransition = BaseTransitionImpl; 3523 function getLeavingNodesForType(state, vnode) { 3524 const { leavingVNodes } = state; 3525 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3526 if (!leavingVNodesCache) { 3527 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3528 leavingVNodes.set(vnode.type, leavingVNodesCache); 3529 } 3530 return leavingVNodesCache; 3531 } 3532 function resolveTransitionHooks(vnode, props, state, instance, postClone) { 3533 const { 3534 appear, 3535 mode, 3536 persisted = false, 3537 onBeforeEnter, 3538 onEnter, 3539 onAfterEnter, 3540 onEnterCancelled, 3541 onBeforeLeave, 3542 onLeave, 3543 onAfterLeave, 3544 onLeaveCancelled, 3545 onBeforeAppear, 3546 onAppear, 3547 onAfterAppear, 3548 onAppearCancelled 3549 } = props; 3550 const key = String(vnode.key); 3551 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3552 const callHook = (hook, args) => { 3553 hook && callWithAsyncErrorHandling( 3554 hook, 3555 instance, 3556 9, 3557 args 3558 ); 3559 }; 3560 const callAsyncHook = (hook, args) => { 3561 const done = args[1]; 3562 callHook(hook, args); 3563 if (isArray(hook)) { 3564 if (hook.every((hook2) => hook2.length <= 1)) done(); 3565 } else if (hook.length <= 1) { 3566 done(); 3567 } 3568 }; 3569 const hooks = { 3570 mode, 3571 persisted, 3572 beforeEnter(el) { 3573 let hook = onBeforeEnter; 3574 if (!state.isMounted) { 3575 if (appear) { 3576 hook = onBeforeAppear || onBeforeEnter; 3577 } else { 3578 return; 3579 } 3580 } 3581 if (el[leaveCbKey]) { 3582 el[leaveCbKey]( 3583 true 3584 /* cancelled */ 3585 ); 3586 } 3587 const leavingVNode = leavingVNodesCache[key]; 3588 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3589 leavingVNode.el[leaveCbKey](); 3590 } 3591 callHook(hook, [el]); 3592 }, 3593 enter(el) { 3594 let hook = onEnter; 3595 let afterHook = onAfterEnter; 3596 let cancelHook = onEnterCancelled; 3597 if (!state.isMounted) { 3598 if (appear) { 3599 hook = onAppear || onEnter; 3600 afterHook = onAfterAppear || onAfterEnter; 3601 cancelHook = onAppearCancelled || onEnterCancelled; 3602 } else { 3603 return; 3604 } 3605 } 3606 let called = false; 3607 const done = el[enterCbKey$1] = (cancelled) => { 3608 if (called) return; 3609 called = true; 3610 if (cancelled) { 3611 callHook(cancelHook, [el]); 3612 } else { 3613 callHook(afterHook, [el]); 3614 } 3615 if (hooks.delayedLeave) { 3616 hooks.delayedLeave(); 3617 } 3618 el[enterCbKey$1] = void 0; 3619 }; 3620 if (hook) { 3621 callAsyncHook(hook, [el, done]); 3622 } else { 3623 done(); 3624 } 3625 }, 3626 leave(el, remove) { 3627 const key2 = String(vnode.key); 3628 if (el[enterCbKey$1]) { 3629 el[enterCbKey$1]( 3630 true 3631 /* cancelled */ 3632 ); 3633 } 3634 if (state.isUnmounting) { 3635 return remove(); 3636 } 3637 callHook(onBeforeLeave, [el]); 3638 let called = false; 3639 const done = el[leaveCbKey] = (cancelled) => { 3640 if (called) return; 3641 called = true; 3642 remove(); 3643 if (cancelled) { 3644 callHook(onLeaveCancelled, [el]); 3645 } else { 3646 callHook(onAfterLeave, [el]); 3647 } 3648 el[leaveCbKey] = void 0; 3649 if (leavingVNodesCache[key2] === vnode) { 3650 delete leavingVNodesCache[key2]; 3651 } 3652 }; 3653 leavingVNodesCache[key2] = vnode; 3654 if (onLeave) { 3655 callAsyncHook(onLeave, [el, done]); 3656 } else { 3657 done(); 3658 } 3659 }, 3660 clone(vnode2) { 3661 const hooks2 = resolveTransitionHooks( 3662 vnode2, 3663 props, 3664 state, 3665 instance, 3666 postClone 3667 ); 3668 if (postClone) postClone(hooks2); 3669 return hooks2; 3670 } 3671 }; 3672 return hooks; 3673 } 3674 function emptyPlaceholder(vnode) { 3675 if (isKeepAlive(vnode)) { 3676 vnode = cloneVNode(vnode); 3677 vnode.children = null; 3678 return vnode; 3679 } 3680 } 3681 function getInnerChild$1(vnode) { 3682 if (!isKeepAlive(vnode)) { 3683 if (isTeleport(vnode.type) && vnode.children) { 3684 return findNonCommentChild(vnode.children); 3685 } 3686 return vnode; 3687 } 3688 if (vnode.component) { 3689 return vnode.component.subTree; 3690 } 3691 const { shapeFlag, children } = vnode; 3692 if (children) { 3693 if (shapeFlag & 16) { 3694 return children[0]; 3695 } 3696 if (shapeFlag & 32 && isFunction(children.default)) { 3697 return children.default(); 3698 } 3699 } 3700 } 3701 function setTransitionHooks(vnode, hooks) { 3702 if (vnode.shapeFlag & 6 && vnode.component) { 3703 vnode.transition = hooks; 3704 setTransitionHooks(vnode.component.subTree, hooks); 3705 } else if (vnode.shapeFlag & 128) { 3706 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3707 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3708 } else { 3709 vnode.transition = hooks; 3710 } 3711 } 3712 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3713 let ret = []; 3714 let keyedFragmentCount = 0; 3715 for (let i = 0; i < children.length; i++) { 3716 let child = children[i]; 3717 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3718 if (child.type === Fragment) { 3719 if (child.patchFlag & 128) keyedFragmentCount++; 3720 ret = ret.concat( 3721 getTransitionRawChildren(child.children, keepComment, key) 3722 ); 3723 } else if (keepComment || child.type !== Comment) { 3724 ret.push(key != null ? cloneVNode(child, { key }) : child); 3725 } 3726 } 3727 if (keyedFragmentCount > 1) { 3728 for (let i = 0; i < ret.length; i++) { 3729 ret[i].patchFlag = -2; 3730 } 3731 } 3732 return ret; 3733 } 3734 3735 // @__NO_SIDE_EFFECTS__ 3736 function defineComponent(options, extraOptions) { 3737 return isFunction(options) ? ( 3738 // #8236: extend call and options.name access are considered side-effects 3739 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 3740 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3741 ) : options; 3742 } 3743 3744 function useId() { 3745 const i = getCurrentInstance(); 3746 if (i) { 3747 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++; 3748 } else { 3749 warn$1( 3750 `useId() is called when there is no active component instance to be associated with.` 3751 ); 3752 } 3753 return ""; 3754 } 3755 function markAsyncBoundary(instance) { 3756 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 3757 } 3758 3759 const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); 3760 function useTemplateRef(key) { 3761 const i = getCurrentInstance(); 3762 const r = shallowRef(null); 3763 if (i) { 3764 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs; 3765 let desc; 3766 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) { 3767 warn$1(`useTemplateRef('${key}') already exists.`); 3768 } else { 3769 Object.defineProperty(refs, key, { 3770 enumerable: true, 3771 get: () => r.value, 3772 set: (val) => r.value = val 3773 }); 3774 } 3775 } else { 3776 warn$1( 3777 `useTemplateRef() is called when there is no active component instance to be associated with.` 3778 ); 3779 } 3780 const ret = readonly(r) ; 3781 { 3782 knownTemplateRefs.add(ret); 3783 } 3784 return ret; 3785 } 3786 3787 const pendingSetRefMap = /* @__PURE__ */ new WeakMap(); 3788 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 3789 if (isArray(rawRef)) { 3790 rawRef.forEach( 3791 (r, i) => setRef( 3792 r, 3793 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 3794 parentSuspense, 3795 vnode, 3796 isUnmount 3797 ) 3798 ); 3799 return; 3800 } 3801 if (isAsyncWrapper(vnode) && !isUnmount) { 3802 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { 3803 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); 3804 } 3805 return; 3806 } 3807 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 3808 const value = isUnmount ? null : refValue; 3809 const { i: owner, r: ref } = rawRef; 3810 if (!owner) { 3811 warn$1( 3812 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 3813 ); 3814 return; 3815 } 3816 const oldRef = oldRawRef && oldRawRef.r; 3817 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 3818 const setupState = owner.setupState; 3819 const rawSetupState = toRaw(setupState); 3820 const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => { 3821 { 3822 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) { 3823 warn$1( 3824 `Template ref "${key}" used on a non-ref value. It will not work in the production build.` 3825 ); 3826 } 3827 if (knownTemplateRefs.has(rawSetupState[key])) { 3828 return false; 3829 } 3830 } 3831 return hasOwn(rawSetupState, key); 3832 }; 3833 const canSetRef = (ref2) => { 3834 return !knownTemplateRefs.has(ref2); 3835 }; 3836 if (oldRef != null && oldRef !== ref) { 3837 invalidatePendingSetRef(oldRawRef); 3838 if (isString(oldRef)) { 3839 refs[oldRef] = null; 3840 if (canSetSetupRef(oldRef)) { 3841 setupState[oldRef] = null; 3842 } 3843 } else if (isRef(oldRef)) { 3844 if (canSetRef(oldRef)) { 3845 oldRef.value = null; 3846 } 3847 const oldRawRefAtom = oldRawRef; 3848 if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null; 3849 } 3850 } 3851 if (isFunction(ref)) { 3852 callWithErrorHandling(ref, owner, 12, [value, refs]); 3853 } else { 3854 const _isString = isString(ref); 3855 const _isRef = isRef(ref); 3856 if (_isString || _isRef) { 3857 const doSet = () => { 3858 if (rawRef.f) { 3859 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k]; 3860 if (isUnmount) { 3861 isArray(existing) && remove(existing, refValue); 3862 } else { 3863 if (!isArray(existing)) { 3864 if (_isString) { 3865 refs[ref] = [refValue]; 3866 if (canSetSetupRef(ref)) { 3867 setupState[ref] = refs[ref]; 3868 } 3869 } else { 3870 const newVal = [refValue]; 3871 if (canSetRef(ref)) { 3872 ref.value = newVal; 3873 } 3874 if (rawRef.k) refs[rawRef.k] = newVal; 3875 } 3876 } else if (!existing.includes(refValue)) { 3877 existing.push(refValue); 3878 } 3879 } 3880 } else if (_isString) { 3881 refs[ref] = value; 3882 if (canSetSetupRef(ref)) { 3883 setupState[ref] = value; 3884 } 3885 } else if (_isRef) { 3886 if (canSetRef(ref)) { 3887 ref.value = value; 3888 } 3889 if (rawRef.k) refs[rawRef.k] = value; 3890 } else { 3891 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3892 } 3893 }; 3894 if (value) { 3895 const job = () => { 3896 doSet(); 3897 pendingSetRefMap.delete(rawRef); 3898 }; 3899 job.id = -1; 3900 pendingSetRefMap.set(rawRef, job); 3901 queuePostRenderEffect(job, parentSuspense); 3902 } else { 3903 invalidatePendingSetRef(rawRef); 3904 doSet(); 3905 } 3906 } else { 3907 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3908 } 3909 } 3910 } 3911 function invalidatePendingSetRef(rawRef) { 3912 const pendingSetRef = pendingSetRefMap.get(rawRef); 3913 if (pendingSetRef) { 3914 pendingSetRef.flags |= 8; 3915 pendingSetRefMap.delete(rawRef); 3916 } 3917 } 3918 3919 let hasLoggedMismatchError = false; 3920 const logMismatchError = () => { 3921 if (hasLoggedMismatchError) { 3922 return; 3923 } 3924 console.error("Hydration completed but contains mismatches."); 3925 hasLoggedMismatchError = true; 3926 }; 3927 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 3928 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 3929 const getContainerType = (container) => { 3930 if (container.nodeType !== 1) return void 0; 3931 if (isSVGContainer(container)) return "svg"; 3932 if (isMathMLContainer(container)) return "mathml"; 3933 return void 0; 3934 }; 3935 const isComment = (node) => node.nodeType === 8; 3936 function createHydrationFunctions(rendererInternals) { 3937 const { 3938 mt: mountComponent, 3939 p: patch, 3940 o: { 3941 patchProp, 3942 createText, 3943 nextSibling, 3944 parentNode, 3945 remove, 3946 insert, 3947 createComment 3948 } 3949 } = rendererInternals; 3950 const hydrate = (vnode, container) => { 3951 if (!container.hasChildNodes()) { 3952 warn$1( 3953 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 3954 ); 3955 patch(null, vnode, container); 3956 flushPostFlushCbs(); 3957 container._vnode = vnode; 3958 return; 3959 } 3960 hydrateNode(container.firstChild, vnode, null, null, null); 3961 flushPostFlushCbs(); 3962 container._vnode = vnode; 3963 }; 3964 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 3965 optimized = optimized || !!vnode.dynamicChildren; 3966 const isFragmentStart = isComment(node) && node.data === "["; 3967 const onMismatch = () => handleMismatch( 3968 node, 3969 vnode, 3970 parentComponent, 3971 parentSuspense, 3972 slotScopeIds, 3973 isFragmentStart 3974 ); 3975 const { type, ref, shapeFlag, patchFlag } = vnode; 3976 let domType = node.nodeType; 3977 vnode.el = node; 3978 { 3979 def(node, "__vnode", vnode, true); 3980 def(node, "__vueParentComponent", parentComponent, true); 3981 } 3982 if (patchFlag === -2) { 3983 optimized = false; 3984 vnode.dynamicChildren = null; 3985 } 3986 let nextNode = null; 3987 switch (type) { 3988 case Text: 3989 if (domType !== 3) { 3990 if (vnode.children === "") { 3991 insert(vnode.el = createText(""), parentNode(node), node); 3992 nextNode = node; 3993 } else { 3994 nextNode = onMismatch(); 3995 } 3996 } else { 3997 if (node.data !== vnode.children) { 3998 warn$1( 3999 `Hydration text mismatch in`, 4000 node.parentNode, 4001 ` 4002 - rendered on server: ${JSON.stringify( 4003 node.data 4004 )} 4005 - expected on client: ${JSON.stringify(vnode.children)}` 4006 ); 4007 logMismatchError(); 4008 node.data = vnode.children; 4009 } 4010 nextNode = nextSibling(node); 4011 } 4012 break; 4013 case Comment: 4014 if (isTemplateNode(node)) { 4015 nextNode = nextSibling(node); 4016 replaceNode( 4017 vnode.el = node.content.firstChild, 4018 node, 4019 parentComponent 4020 ); 4021 } else if (domType !== 8 || isFragmentStart) { 4022 nextNode = onMismatch(); 4023 } else { 4024 nextNode = nextSibling(node); 4025 } 4026 break; 4027 case Static: 4028 if (isFragmentStart) { 4029 node = nextSibling(node); 4030 domType = node.nodeType; 4031 } 4032 if (domType === 1 || domType === 3) { 4033 nextNode = node; 4034 const needToAdoptContent = !vnode.children.length; 4035 for (let i = 0; i < vnode.staticCount; i++) { 4036 if (needToAdoptContent) 4037 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4038 if (i === vnode.staticCount - 1) { 4039 vnode.anchor = nextNode; 4040 } 4041 nextNode = nextSibling(nextNode); 4042 } 4043 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4044 } else { 4045 onMismatch(); 4046 } 4047 break; 4048 case Fragment: 4049 if (!isFragmentStart) { 4050 nextNode = onMismatch(); 4051 } else { 4052 nextNode = hydrateFragment( 4053 node, 4054 vnode, 4055 parentComponent, 4056 parentSuspense, 4057 slotScopeIds, 4058 optimized 4059 ); 4060 } 4061 break; 4062 default: 4063 if (shapeFlag & 1) { 4064 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 4065 nextNode = onMismatch(); 4066 } else { 4067 nextNode = hydrateElement( 4068 node, 4069 vnode, 4070 parentComponent, 4071 parentSuspense, 4072 slotScopeIds, 4073 optimized 4074 ); 4075 } 4076 } else if (shapeFlag & 6) { 4077 vnode.slotScopeIds = slotScopeIds; 4078 const container = parentNode(node); 4079 if (isFragmentStart) { 4080 nextNode = locateClosingAnchor(node); 4081 } else if (isComment(node) && node.data === "teleport start") { 4082 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 4083 } else { 4084 nextNode = nextSibling(node); 4085 } 4086 mountComponent( 4087 vnode, 4088 container, 4089 null, 4090 parentComponent, 4091 parentSuspense, 4092 getContainerType(container), 4093 optimized 4094 ); 4095 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { 4096 let subTree; 4097 if (isFragmentStart) { 4098 subTree = createVNode(Fragment); 4099 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4100 } else { 4101 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4102 } 4103 subTree.el = node; 4104 vnode.component.subTree = subTree; 4105 } 4106 } else if (shapeFlag & 64) { 4107 if (domType !== 8) { 4108 nextNode = onMismatch(); 4109 } else { 4110 nextNode = vnode.type.hydrate( 4111 node, 4112 vnode, 4113 parentComponent, 4114 parentSuspense, 4115 slotScopeIds, 4116 optimized, 4117 rendererInternals, 4118 hydrateChildren 4119 ); 4120 } 4121 } else if (shapeFlag & 128) { 4122 nextNode = vnode.type.hydrate( 4123 node, 4124 vnode, 4125 parentComponent, 4126 parentSuspense, 4127 getContainerType(parentNode(node)), 4128 slotScopeIds, 4129 optimized, 4130 rendererInternals, 4131 hydrateNode 4132 ); 4133 } else { 4134 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 4135 } 4136 } 4137 if (ref != null) { 4138 setRef(ref, null, parentSuspense, vnode); 4139 } 4140 return nextNode; 4141 }; 4142 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4143 optimized = optimized || !!vnode.dynamicChildren; 4144 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 4145 const forcePatch = type === "input" || type === "option"; 4146 { 4147 if (dirs) { 4148 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4149 } 4150 let needCallTransitionHooks = false; 4151 if (isTemplateNode(el)) { 4152 needCallTransitionHooks = needTransition( 4153 null, 4154 // no need check parentSuspense in hydration 4155 transition 4156 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 4157 const content = el.content.firstChild; 4158 if (needCallTransitionHooks) { 4159 const cls = content.getAttribute("class"); 4160 if (cls) content.$cls = cls; 4161 transition.beforeEnter(content); 4162 } 4163 replaceNode(content, el, parentComponent); 4164 vnode.el = el = content; 4165 } 4166 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4167 !(props && (props.innerHTML || props.textContent))) { 4168 let next = hydrateChildren( 4169 el.firstChild, 4170 vnode, 4171 el, 4172 parentComponent, 4173 parentSuspense, 4174 slotScopeIds, 4175 optimized 4176 ); 4177 let hasWarned = false; 4178 while (next) { 4179 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) { 4180 if (!hasWarned) { 4181 warn$1( 4182 `Hydration children mismatch on`, 4183 el, 4184 ` 4185Server rendered element contains more child nodes than client vdom.` 4186 ); 4187 hasWarned = true; 4188 } 4189 logMismatchError(); 4190 } 4191 const cur = next; 4192 next = next.nextSibling; 4193 remove(cur); 4194 } 4195 } else if (shapeFlag & 8) { 4196 let clientText = vnode.children; 4197 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { 4198 clientText = clientText.slice(1); 4199 } 4200 if (el.textContent !== clientText) { 4201 if (!isMismatchAllowed(el, 0 /* TEXT */)) { 4202 warn$1( 4203 `Hydration text content mismatch on`, 4204 el, 4205 ` 4206 - rendered on server: ${el.textContent} 4207 - expected on client: ${vnode.children}` 4208 ); 4209 logMismatchError(); 4210 } 4211 el.textContent = vnode.children; 4212 } 4213 } 4214 if (props) { 4215 { 4216 const isCustomElement = el.tagName.includes("-"); 4217 for (const key in props) { 4218 if (// #11189 skip if this node has directives that have created hooks 4219 // as it could have mutated the DOM in any possible way 4220 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) { 4221 logMismatchError(); 4222 } 4223 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 4224 key[0] === "." || isCustomElement) { 4225 patchProp(el, key, null, props[key], void 0, parentComponent); 4226 } 4227 } 4228 } 4229 } 4230 let vnodeHooks; 4231 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4232 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4233 } 4234 if (dirs) { 4235 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4236 } 4237 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 4238 queueEffectWithSuspense(() => { 4239 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4240 needCallTransitionHooks && transition.enter(el); 4241 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4242 }, parentSuspense); 4243 } 4244 } 4245 return el.nextSibling; 4246 }; 4247 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4248 optimized = optimized || !!parentVNode.dynamicChildren; 4249 const children = parentVNode.children; 4250 const l = children.length; 4251 let hasWarned = false; 4252 for (let i = 0; i < l; i++) { 4253 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4254 const isText = vnode.type === Text; 4255 if (node) { 4256 if (isText && !optimized) { 4257 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) { 4258 insert( 4259 createText( 4260 node.data.slice(vnode.children.length) 4261 ), 4262 container, 4263 nextSibling(node) 4264 ); 4265 node.data = vnode.children; 4266 } 4267 } 4268 node = hydrateNode( 4269 node, 4270 vnode, 4271 parentComponent, 4272 parentSuspense, 4273 slotScopeIds, 4274 optimized 4275 ); 4276 } else if (isText && !vnode.children) { 4277 insert(vnode.el = createText(""), container); 4278 } else { 4279 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) { 4280 if (!hasWarned) { 4281 warn$1( 4282 `Hydration children mismatch on`, 4283 container, 4284 ` 4285Server rendered element contains fewer child nodes than client vdom.` 4286 ); 4287 hasWarned = true; 4288 } 4289 logMismatchError(); 4290 } 4291 patch( 4292 null, 4293 vnode, 4294 container, 4295 null, 4296 parentComponent, 4297 parentSuspense, 4298 getContainerType(container), 4299 slotScopeIds 4300 ); 4301 } 4302 } 4303 return node; 4304 }; 4305 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4306 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 4307 if (fragmentSlotScopeIds) { 4308 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 4309 } 4310 const container = parentNode(node); 4311 const next = hydrateChildren( 4312 nextSibling(node), 4313 vnode, 4314 container, 4315 parentComponent, 4316 parentSuspense, 4317 slotScopeIds, 4318 optimized 4319 ); 4320 if (next && isComment(next) && next.data === "]") { 4321 return nextSibling(vnode.anchor = next); 4322 } else { 4323 logMismatchError(); 4324 insert(vnode.anchor = createComment(`]`), container, next); 4325 return next; 4326 } 4327 }; 4328 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 4329 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) { 4330 warn$1( 4331 `Hydration node mismatch: 4332- rendered on server:`, 4333 node, 4334 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 4335 ` 4336- expected on client:`, 4337 vnode.type 4338 ); 4339 logMismatchError(); 4340 } 4341 vnode.el = null; 4342 if (isFragment) { 4343 const end = locateClosingAnchor(node); 4344 while (true) { 4345 const next2 = nextSibling(node); 4346 if (next2 && next2 !== end) { 4347 remove(next2); 4348 } else { 4349 break; 4350 } 4351 } 4352 } 4353 const next = nextSibling(node); 4354 const container = parentNode(node); 4355 remove(node); 4356 patch( 4357 null, 4358 vnode, 4359 container, 4360 next, 4361 parentComponent, 4362 parentSuspense, 4363 getContainerType(container), 4364 slotScopeIds 4365 ); 4366 if (parentComponent) { 4367 parentComponent.vnode.el = vnode.el; 4368 updateHOCHostEl(parentComponent, vnode.el); 4369 } 4370 return next; 4371 }; 4372 const locateClosingAnchor = (node, open = "[", close = "]") => { 4373 let match = 0; 4374 while (node) { 4375 node = nextSibling(node); 4376 if (node && isComment(node)) { 4377 if (node.data === open) match++; 4378 if (node.data === close) { 4379 if (match === 0) { 4380 return nextSibling(node); 4381 } else { 4382 match--; 4383 } 4384 } 4385 } 4386 } 4387 return node; 4388 }; 4389 const replaceNode = (newNode, oldNode, parentComponent) => { 4390 const parentNode2 = oldNode.parentNode; 4391 if (parentNode2) { 4392 parentNode2.replaceChild(newNode, oldNode); 4393 } 4394 let parent = parentComponent; 4395 while (parent) { 4396 if (parent.vnode.el === oldNode) { 4397 parent.vnode.el = parent.subTree.el = newNode; 4398 } 4399 parent = parent.parent; 4400 } 4401 }; 4402 const isTemplateNode = (node) => { 4403 return node.nodeType === 1 && node.tagName === "TEMPLATE"; 4404 }; 4405 return [hydrate, hydrateNode]; 4406 } 4407 function propHasMismatch(el, key, clientValue, vnode, instance) { 4408 let mismatchType; 4409 let mismatchKey; 4410 let actual; 4411 let expected; 4412 if (key === "class") { 4413 if (el.$cls) { 4414 actual = el.$cls; 4415 delete el.$cls; 4416 } else { 4417 actual = el.getAttribute("class"); 4418 } 4419 expected = normalizeClass(clientValue); 4420 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 4421 mismatchType = 2 /* CLASS */; 4422 mismatchKey = `class`; 4423 } 4424 } else if (key === "style") { 4425 actual = el.getAttribute("style") || ""; 4426 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 4427 const actualMap = toStyleMap(actual); 4428 const expectedMap = toStyleMap(expected); 4429 if (vnode.dirs) { 4430 for (const { dir, value } of vnode.dirs) { 4431 if (dir.name === "show" && !value) { 4432 expectedMap.set("display", "none"); 4433 } 4434 } 4435 } 4436 if (instance) { 4437 resolveCssVars(instance, vnode, expectedMap); 4438 } 4439 if (!isMapEqual(actualMap, expectedMap)) { 4440 mismatchType = 3 /* STYLE */; 4441 mismatchKey = "style"; 4442 } 4443 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 4444 if (isBooleanAttr(key)) { 4445 actual = el.hasAttribute(key); 4446 expected = includeBooleanAttr(clientValue); 4447 } else if (clientValue == null) { 4448 actual = el.hasAttribute(key); 4449 expected = false; 4450 } else { 4451 if (el.hasAttribute(key)) { 4452 actual = el.getAttribute(key); 4453 } else if (key === "value" && el.tagName === "TEXTAREA") { 4454 actual = el.value; 4455 } else { 4456 actual = false; 4457 } 4458 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 4459 } 4460 if (actual !== expected) { 4461 mismatchType = 4 /* ATTRIBUTE */; 4462 mismatchKey = key; 4463 } 4464 } 4465 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { 4466 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 4467 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; 4468 const postSegment = ` 4469 - rendered on server: ${format(actual)} 4470 - expected on client: ${format(expected)} 4471 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 4472 You should fix the source of the mismatch.`; 4473 { 4474 warn$1(preSegment, el, postSegment); 4475 } 4476 return true; 4477 } 4478 return false; 4479 } 4480 function toClassSet(str) { 4481 return new Set(str.trim().split(/\s+/)); 4482 } 4483 function isSetEqual(a, b) { 4484 if (a.size !== b.size) { 4485 return false; 4486 } 4487 for (const s of a) { 4488 if (!b.has(s)) { 4489 return false; 4490 } 4491 } 4492 return true; 4493 } 4494 function toStyleMap(str) { 4495 const styleMap = /* @__PURE__ */ new Map(); 4496 for (const item of str.split(";")) { 4497 let [key, value] = item.split(":"); 4498 key = key.trim(); 4499 value = value && value.trim(); 4500 if (key && value) { 4501 styleMap.set(key, value); 4502 } 4503 } 4504 return styleMap; 4505 } 4506 function isMapEqual(a, b) { 4507 if (a.size !== b.size) { 4508 return false; 4509 } 4510 for (const [key, value] of a) { 4511 if (value !== b.get(key)) { 4512 return false; 4513 } 4514 } 4515 return true; 4516 } 4517 function resolveCssVars(instance, vnode, expectedMap) { 4518 const root = instance.subTree; 4519 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) { 4520 const cssVars = instance.getCssVars(); 4521 for (const key in cssVars) { 4522 const value = normalizeCssVarValue(cssVars[key]); 4523 expectedMap.set(`--${getEscapedCssVarName(key)}`, value); 4524 } 4525 } 4526 if (vnode === root && instance.parent) { 4527 resolveCssVars(instance.parent, instance.vnode, expectedMap); 4528 } 4529 } 4530 const allowMismatchAttr = "data-allow-mismatch"; 4531 const MismatchTypeString = { 4532 [0 /* TEXT */]: "text", 4533 [1 /* CHILDREN */]: "children", 4534 [2 /* CLASS */]: "class", 4535 [3 /* STYLE */]: "style", 4536 [4 /* ATTRIBUTE */]: "attribute" 4537 }; 4538 function isMismatchAllowed(el, allowedType) { 4539 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) { 4540 while (el && !el.hasAttribute(allowMismatchAttr)) { 4541 el = el.parentElement; 4542 } 4543 } 4544 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 4545 if (allowedAttr == null) { 4546 return false; 4547 } else if (allowedAttr === "") { 4548 return true; 4549 } else { 4550 const list = allowedAttr.split(","); 4551 if (allowedType === 0 /* TEXT */ && list.includes("children")) { 4552 return true; 4553 } 4554 return list.includes(MismatchTypeString[allowedType]); 4555 } 4556 } 4557 4558 const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1)); 4559 const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id)); 4560 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => { 4561 const id = requestIdleCallback(hydrate, { timeout }); 4562 return () => cancelIdleCallback(id); 4563 }; 4564 function elementIsVisibleInViewport(el) { 4565 const { top, left, bottom, right } = el.getBoundingClientRect(); 4566 const { innerHeight, innerWidth } = window; 4567 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth); 4568 } 4569 const hydrateOnVisible = (opts) => (hydrate, forEach) => { 4570 const ob = new IntersectionObserver((entries) => { 4571 for (const e of entries) { 4572 if (!e.isIntersecting) continue; 4573 ob.disconnect(); 4574 hydrate(); 4575 break; 4576 } 4577 }, opts);
vendor: 5,696 bytes, lines 4578-4771
4578 forEach((el) => { 4579 if (!(el instanceof Element)) return; 4580 if (elementIsVisibleInViewport(el)) { 4581 hydrate(); 4582 ob.disconnect(); 4583 return false; 4584 } 4585 ob.observe(el); 4586 }); 4587 return () => ob.disconnect(); 4588 }; 4589 const hydrateOnMediaQuery = (query) => (hydrate) => { 4590 if (query) { 4591 const mql = matchMedia(query); 4592 if (mql.matches) { 4593 hydrate(); 4594 } else { 4595 mql.addEventListener("change", hydrate, { once: true }); 4596 return () => mql.removeEventListener("change", hydrate); 4597 } 4598 } 4599 }; 4600 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => { 4601 if (isString(interactions)) interactions = [interactions]; 4602 let hasHydrated = false; 4603 const doHydrate = (e) => { 4604 if (!hasHydrated) { 4605 hasHydrated = true; 4606 teardown(); 4607 hydrate(); 4608 e.target.dispatchEvent(new e.constructor(e.type, e)); 4609 } 4610 }; 4611 const teardown = () => { 4612 forEach((el) => { 4613 for (const i of interactions) { 4614 el.removeEventListener(i, doHydrate); 4615 } 4616 }); 4617 }; 4618 forEach((el) => { 4619 for (const i of interactions) { 4620 el.addEventListener(i, doHydrate, { once: true }); 4621 } 4622 }); 4623 return teardown; 4624 }; 4625 function forEachElement(node, cb) { 4626 if (isComment(node) && node.data === "[") { 4627 let depth = 1; 4628 let next = node.nextSibling; 4629 while (next) { 4630 if (next.nodeType === 1) { 4631 const result = cb(next); 4632 if (result === false) { 4633 break; 4634 } 4635 } else if (isComment(next)) { 4636 if (next.data === "]") { 4637 if (--depth === 0) break; 4638 } else if (next.data === "[") { 4639 depth++; 4640 } 4641 } 4642 next = next.nextSibling; 4643 } 4644 } else { 4645 cb(node); 4646 } 4647 } 4648 4649 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 4650 // @__NO_SIDE_EFFECTS__ 4651 function defineAsyncComponent(source) { 4652 if (isFunction(source)) { 4653 source = { loader: source }; 4654 } 4655 const { 4656 loader, 4657 loadingComponent, 4658 errorComponent, 4659 delay = 200, 4660 hydrate: hydrateStrategy, 4661 timeout, 4662 // undefined = never times out 4663 suspensible = true, 4664 onError: userOnError 4665 } = source; 4666 let pendingRequest = null; 4667 let resolvedComp; 4668 let retries = 0; 4669 const retry = () => { 4670 retries++; 4671 pendingRequest = null; 4672 return load(); 4673 }; 4674 const load = () => { 4675 let thisRequest; 4676 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4677 err = err instanceof Error ? err : new Error(String(err)); 4678 if (userOnError) { 4679 return new Promise((resolve, reject) => { 4680 const userRetry = () => resolve(retry()); 4681 const userFail = () => reject(err); 4682 userOnError(err, userRetry, userFail, retries + 1); 4683 }); 4684 } else { 4685 throw err; 4686 } 4687 }).then((comp) => { 4688 if (thisRequest !== pendingRequest && pendingRequest) { 4689 return pendingRequest; 4690 } 4691 if (!comp) { 4692 warn$1( 4693 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4694 ); 4695 } 4696 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4697 comp = comp.default; 4698 } 4699 if (comp && !isObject(comp) && !isFunction(comp)) { 4700 throw new Error(`Invalid async component load result: ${comp}`); 4701 } 4702 resolvedComp = comp; 4703 return comp; 4704 })); 4705 }; 4706 return defineComponent({ 4707 name: "AsyncComponentWrapper", 4708 __asyncLoader: load, 4709 __asyncHydrate(el, instance, hydrate) { 4710 let patched = false; 4711 (instance.bu || (instance.bu = [])).push(() => patched = true); 4712 const performHydrate = () => { 4713 if (patched) { 4714 { 4715 warn$1( 4716 `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.` 4717 ); 4718 } 4719 return; 4720 } 4721 hydrate(); 4722 }; 4723 const doHydrate = hydrateStrategy ? () => { 4724 const teardown = hydrateStrategy( 4725 performHydrate, 4726 (cb) => forEachElement(el, cb) 4727 ); 4728 if (teardown) { 4729 (instance.bum || (instance.bum = [])).push(teardown); 4730 } 4731 } : performHydrate; 4732 if (resolvedComp) { 4733 doHydrate(); 4734 } else { 4735 load().then(() => !instance.isUnmounted && doHydrate()); 4736 } 4737 }, 4738 get __asyncResolved() { 4739 return resolvedComp; 4740 }, 4741 setup() { 4742 const instance = currentInstance; 4743 markAsyncBoundary(instance); 4744 if (resolvedComp) { 4745 return () => createInnerComp(resolvedComp, instance); 4746 } 4747 const onError = (err) => { 4748 pendingRequest = null; 4749 handleError( 4750 err, 4751 instance, 4752 13, 4753 !errorComponent 4754 ); 4755 }; 4756 if (suspensible && instance.suspense || false) { 4757 return load().then((comp) => { 4758 return () => createInnerComp(comp, instance); 4759 }).catch((err) => { 4760 onError(err); 4761 return () => errorComponent ? createVNode(errorComponent, { 4762 error: err 4763 }) : null; 4764 }); 4765 } 4766 const loaded = ref(false); 4767 const error = ref(); 4768 const delayed = ref(!!delay); 4769 if (delay) { 4770 setTimeout(() => { 4771 delayed.value = false;
vendor: 29,486 bytes, lines 4772-5665
4772 }, delay); 4773 } 4774 if (timeout != null) { 4775 setTimeout(() => { 4776 if (!loaded.value && !error.value) { 4777 const err = new Error( 4778 `Async component timed out after ${timeout}ms.` 4779 ); 4780 onError(err); 4781 error.value = err; 4782 } 4783 }, timeout); 4784 } 4785 load().then(() => { 4786 loaded.value = true; 4787 if (instance.parent && isKeepAlive(instance.parent.vnode)) { 4788 instance.parent.update(); 4789 } 4790 }).catch((err) => { 4791 onError(err); 4792 error.value = err; 4793 }); 4794 return () => { 4795 if (loaded.value && resolvedComp) { 4796 return createInnerComp(resolvedComp, instance); 4797 } else if (error.value && errorComponent) { 4798 return createVNode(errorComponent, { 4799 error: error.value 4800 }); 4801 } else if (loadingComponent && !delayed.value) { 4802 return createVNode(loadingComponent); 4803 } 4804 }; 4805 } 4806 }); 4807 } 4808 function createInnerComp(comp, parent) { 4809 const { ref: ref2, props, children, ce } = parent.vnode; 4810 const vnode = createVNode(comp, props, children); 4811 vnode.ref = ref2; 4812 vnode.ce = ce; 4813 delete parent.vnode.ce; 4814 return vnode; 4815 } 4816 4817 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 4818 const KeepAliveImpl = { 4819 name: `KeepAlive`, 4820 // Marker for special handling inside the renderer. We are not using a === 4821 // check directly on KeepAlive in the renderer, because importing it directly 4822 // would prevent it from being tree-shaken. 4823 __isKeepAlive: true, 4824 props: { 4825 include: [String, RegExp, Array], 4826 exclude: [String, RegExp, Array], 4827 max: [String, Number] 4828 }, 4829 setup(props, { slots }) { 4830 const instance = getCurrentInstance(); 4831 const sharedContext = instance.ctx; 4832 const cache = /* @__PURE__ */ new Map(); 4833 const keys = /* @__PURE__ */ new Set(); 4834 let current = null; 4835 { 4836 instance.__v_cache = cache; 4837 } 4838 const parentSuspense = instance.suspense; 4839 const { 4840 renderer: { 4841 p: patch, 4842 m: move, 4843 um: _unmount, 4844 o: { createElement } 4845 } 4846 } = sharedContext; 4847 const storageContainer = createElement("div"); 4848 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 4849 const instance2 = vnode.component; 4850 move(vnode, container, anchor, 0, parentSuspense); 4851 patch( 4852 instance2.vnode, 4853 vnode, 4854 container, 4855 anchor, 4856 instance2, 4857 parentSuspense, 4858 namespace, 4859 vnode.slotScopeIds, 4860 optimized 4861 ); 4862 queuePostRenderEffect(() => { 4863 instance2.isDeactivated = false; 4864 if (instance2.a) { 4865 invokeArrayFns(instance2.a); 4866 } 4867 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 4868 if (vnodeHook) { 4869 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4870 } 4871 }, parentSuspense); 4872 { 4873 devtoolsComponentAdded(instance2); 4874 } 4875 }; 4876 sharedContext.deactivate = (vnode) => { 4877 const instance2 = vnode.component; 4878 invalidateMount(instance2.m); 4879 invalidateMount(instance2.a); 4880 move(vnode, storageContainer, null, 1, parentSuspense); 4881 queuePostRenderEffect(() => { 4882 if (instance2.da) { 4883 invokeArrayFns(instance2.da); 4884 } 4885 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 4886 if (vnodeHook) { 4887 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4888 } 4889 instance2.isDeactivated = true; 4890 }, parentSuspense); 4891 { 4892 devtoolsComponentAdded(instance2); 4893 } 4894 { 4895 instance2.__keepAliveStorageContainer = storageContainer; 4896 } 4897 }; 4898 function unmount(vnode) { 4899 resetShapeFlag(vnode); 4900 _unmount(vnode, instance, parentSuspense, true); 4901 } 4902 function pruneCache(filter) { 4903 cache.forEach((vnode, key) => { 4904 const name = getComponentName(vnode.type); 4905 if (name && !filter(name)) { 4906 pruneCacheEntry(key); 4907 } 4908 }); 4909 } 4910 function pruneCacheEntry(key) { 4911 const cached = cache.get(key); 4912 if (cached && (!current || !isSameVNodeType(cached, current))) { 4913 unmount(cached); 4914 } else if (current) { 4915 resetShapeFlag(current); 4916 } 4917 cache.delete(key); 4918 keys.delete(key); 4919 } 4920 watch( 4921 () => [props.include, props.exclude], 4922 ([include, exclude]) => { 4923 include && pruneCache((name) => matches(include, name)); 4924 exclude && pruneCache((name) => !matches(exclude, name)); 4925 }, 4926 // prune post-render after `current` has been updated 4927 { flush: "post", deep: true } 4928 ); 4929 let pendingCacheKey = null; 4930 const cacheSubtree = () => { 4931 if (pendingCacheKey != null) { 4932 if (isSuspense(instance.subTree.type)) { 4933 queuePostRenderEffect(() => { 4934 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4935 }, instance.subTree.suspense); 4936 } else { 4937 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4938 } 4939 } 4940 }; 4941 onMounted(cacheSubtree); 4942 onUpdated(cacheSubtree); 4943 onBeforeUnmount(() => { 4944 cache.forEach((cached) => { 4945 const { subTree, suspense } = instance; 4946 const vnode = getInnerChild(subTree); 4947 if (cached.type === vnode.type && cached.key === vnode.key) { 4948 resetShapeFlag(vnode); 4949 const da = vnode.component.da; 4950 da && queuePostRenderEffect(da, suspense); 4951 return; 4952 } 4953 unmount(cached); 4954 }); 4955 }); 4956 return () => { 4957 pendingCacheKey = null; 4958 if (!slots.default) { 4959 return current = null; 4960 } 4961 const children = slots.default(); 4962 const rawVNode = children[0]; 4963 if (children.length > 1) { 4964 { 4965 warn$1(`KeepAlive should contain exactly one component child.`); 4966 } 4967 current = null; 4968 return children; 4969 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 4970 current = null; 4971 return rawVNode; 4972 } 4973 let vnode = getInnerChild(rawVNode); 4974 if (vnode.type === Comment) { 4975 current = null; 4976 return vnode; 4977 } 4978 const comp = vnode.type; 4979 const name = getComponentName( 4980 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 4981 ); 4982 const { include, exclude, max } = props; 4983 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 4984 vnode.shapeFlag &= -257; 4985 current = vnode; 4986 return rawVNode; 4987 } 4988 const key = vnode.key == null ? comp : vnode.key; 4989 const cachedVNode = cache.get(key); 4990 if (vnode.el) { 4991 vnode = cloneVNode(vnode); 4992 if (rawVNode.shapeFlag & 128) { 4993 rawVNode.ssContent = vnode; 4994 } 4995 } 4996 pendingCacheKey = key; 4997 if (cachedVNode) { 4998 vnode.el = cachedVNode.el; 4999 vnode.component = cachedVNode.component; 5000 if (vnode.transition) { 5001 setTransitionHooks(vnode, vnode.transition); 5002 } 5003 vnode.shapeFlag |= 512; 5004 keys.delete(key); 5005 keys.add(key); 5006 } else { 5007 keys.add(key); 5008 if (max && keys.size > parseInt(max, 10)) { 5009 pruneCacheEntry(keys.values().next().value); 5010 } 5011 } 5012 vnode.shapeFlag |= 256; 5013 current = vnode; 5014 return isSuspense(rawVNode.type) ? rawVNode : vnode; 5015 }; 5016 } 5017 }; 5018 const KeepAlive = KeepAliveImpl; 5019 function matches(pattern, name) { 5020 if (isArray(pattern)) { 5021 return pattern.some((p) => matches(p, name)); 5022 } else if (isString(pattern)) { 5023 return pattern.split(",").includes(name); 5024 } else if (isRegExp(pattern)) { 5025 pattern.lastIndex = 0; 5026 return pattern.test(name); 5027 } 5028 return false; 5029 } 5030 function onActivated(hook, target) { 5031 registerKeepAliveHook(hook, "a", target); 5032 } 5033 function onDeactivated(hook, target) { 5034 registerKeepAliveHook(hook, "da", target); 5035 } 5036 function registerKeepAliveHook(hook, type, target = currentInstance) { 5037 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 5038 let current = target; 5039 while (current) { 5040 if (current.isDeactivated) { 5041 return; 5042 } 5043 current = current.parent; 5044 } 5045 return hook(); 5046 }); 5047 injectHook(type, wrappedHook, target); 5048 if (target) { 5049 let current = target.parent; 5050 while (current && current.parent) { 5051 if (isKeepAlive(current.parent.vnode)) { 5052 injectToKeepAliveRoot(wrappedHook, type, target, current); 5053 } 5054 current = current.parent; 5055 } 5056 } 5057 } 5058 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 5059 const injected = injectHook( 5060 type, 5061 hook, 5062 keepAliveRoot, 5063 true 5064 /* prepend */ 5065 ); 5066 onUnmounted(() => { 5067 remove(keepAliveRoot[type], injected); 5068 }, target); 5069 } 5070 function resetShapeFlag(vnode) { 5071 vnode.shapeFlag &= -257; 5072 vnode.shapeFlag &= -513; 5073 } 5074 function getInnerChild(vnode) { 5075 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 5076 } 5077 5078 function injectHook(type, hook, target = currentInstance, prepend = false) { 5079 if (target) { 5080 const hooks = target[type] || (target[type] = []); 5081 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 5082 pauseTracking(); 5083 const reset = setCurrentInstance(target); 5084 const res = callWithAsyncErrorHandling(hook, target, type, args); 5085 reset(); 5086 resetTracking(); 5087 return res; 5088 }); 5089 if (prepend) { 5090 hooks.unshift(wrappedHook); 5091 } else { 5092 hooks.push(wrappedHook); 5093 } 5094 return wrappedHook; 5095 } else { 5096 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 5097 warn$1( 5098 `${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.` ) 5099 ); 5100 } 5101 } 5102 const createHook = (lifecycle) => (hook, target = currentInstance) => { 5103 if (!isInSSRComponentSetup || lifecycle === "sp") { 5104 injectHook(lifecycle, (...args) => hook(...args), target); 5105 } 5106 }; 5107 const onBeforeMount = createHook("bm"); 5108 const onMounted = createHook("m"); 5109 const onBeforeUpdate = createHook( 5110 "bu" 5111 ); 5112 const onUpdated = createHook("u"); 5113 const onBeforeUnmount = createHook( 5114 "bum" 5115 ); 5116 const onUnmounted = createHook("um"); 5117 const onServerPrefetch = createHook( 5118 "sp" 5119 ); 5120 const onRenderTriggered = createHook("rtg"); 5121 const onRenderTracked = createHook("rtc"); 5122 function onErrorCaptured(hook, target = currentInstance) { 5123 injectHook("ec", hook, target); 5124 } 5125 5126 const COMPONENTS = "components"; 5127 const DIRECTIVES = "directives"; 5128 function resolveComponent(name, maybeSelfReference) { 5129 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 5130 } 5131 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 5132 function resolveDynamicComponent(component) { 5133 if (isString(component)) { 5134 return resolveAsset(COMPONENTS, component, false) || component; 5135 } else { 5136 return component || NULL_DYNAMIC_COMPONENT; 5137 } 5138 } 5139 function resolveDirective(name) { 5140 return resolveAsset(DIRECTIVES, name); 5141 } 5142 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 5143 const instance = currentRenderingInstance || currentInstance; 5144 if (instance) { 5145 const Component = instance.type; 5146 if (type === COMPONENTS) { 5147 const selfName = getComponentName( 5148 Component, 5149 false 5150 ); 5151 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 5152 return Component; 5153 } 5154 } 5155 const res = ( 5156 // local registration 5157 // check instance[type] first which is resolved for options API 5158 resolve(instance[type] || Component[type], name) || // global registration 5159 resolve(instance.appContext[type], name) 5160 ); 5161 if (!res && maybeSelfReference) { 5162 return Component; 5163 } 5164 if (warnMissing && !res) { 5165 const extra = type === COMPONENTS ? ` 5166If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 5167 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 5168 } 5169 return res; 5170 } else { 5171 warn$1( 5172 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 5173 ); 5174 } 5175 } 5176 function resolve(registry, name) { 5177 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 5178 } 5179 5180 function renderList(source, renderItem, cache, index) { 5181 let ret; 5182 const cached = cache && cache[index]; 5183 const sourceIsArray = isArray(source); 5184 if (sourceIsArray || isString(source)) { 5185 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 5186 let needsWrap = false; 5187 let isReadonlySource = false; 5188 if (sourceIsReactiveArray) { 5189 needsWrap = !isShallow(source); 5190 isReadonlySource = isReadonly(source); 5191 source = shallowReadArray(source); 5192 } 5193 ret = new Array(source.length); 5194 for (let i = 0, l = source.length; i < l; i++) { 5195 ret[i] = renderItem( 5196 needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i], 5197 i, 5198 void 0, 5199 cached && cached[i] 5200 ); 5201 } 5202 } else if (typeof source === "number") { 5203 if (!Number.isInteger(source)) { 5204 warn$1(`The v-for range expect an integer value but got ${source}.`); 5205 } 5206 ret = new Array(source); 5207 for (let i = 0; i < source; i++) { 5208 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 5209 } 5210 } else if (isObject(source)) { 5211 if (source[Symbol.iterator]) { 5212 ret = Array.from( 5213 source, 5214 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 5215 ); 5216 } else { 5217 const keys = Object.keys(source); 5218 ret = new Array(keys.length); 5219 for (let i = 0, l = keys.length; i < l; i++) { 5220 const key = keys[i]; 5221 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 5222 } 5223 } 5224 } else { 5225 ret = []; 5226 } 5227 if (cache) { 5228 cache[index] = ret; 5229 } 5230 return ret; 5231 } 5232 5233 function createSlots(slots, dynamicSlots) { 5234 for (let i = 0; i < dynamicSlots.length; i++) { 5235 const slot = dynamicSlots[i]; 5236 if (isArray(slot)) { 5237 for (let j = 0; j < slot.length; j++) { 5238 slots[slot[j].name] = slot[j].fn; 5239 } 5240 } else if (slot) { 5241 slots[slot.name] = slot.key ? (...args) => { 5242 const res = slot.fn(...args); 5243 if (res) res.key = slot.key; 5244 return res; 5245 } : slot.fn; 5246 } 5247 } 5248 return slots; 5249 } 5250 5251 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 5252 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 5253 const hasProps = Object.keys(props).length > 0; 5254 if (name !== "default") props.name = name; 5255 return openBlock(), createBlock( 5256 Fragment, 5257 null, 5258 [createVNode("slot", props, fallback && fallback())], 5259 hasProps ? -2 : 64 5260 ); 5261 } 5262 let slot = slots[name]; 5263 if (slot && slot.length > 1) { 5264 warn$1( 5265 `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.` 5266 ); 5267 slot = () => []; 5268 } 5269 if (slot && slot._c) { 5270 slot._d = false; 5271 } 5272 openBlock(); 5273 const validSlotContent = slot && ensureValidVNode(slot(props)); 5274 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch 5275 // key attached in the `createSlots` helper, respect that 5276 validSlotContent && validSlotContent.key; 5277 const rendered = createBlock( 5278 Fragment, 5279 { 5280 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content 5281 (!validSlotContent && fallback ? "_fb" : "") 5282 }, 5283 validSlotContent || (fallback ? fallback() : []), 5284 validSlotContent && slots._ === 1 ? 64 : -2 5285 ); 5286 if (!noSlotted && rendered.scopeId) { 5287 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 5288 } 5289 if (slot && slot._c) { 5290 slot._d = true; 5291 } 5292 return rendered; 5293 } 5294 function ensureValidVNode(vnodes) { 5295 return vnodes.some((child) => { 5296 if (!isVNode(child)) return true; 5297 if (child.type === Comment) return false; 5298 if (child.type === Fragment && !ensureValidVNode(child.children)) 5299 return false; 5300 return true; 5301 }) ? vnodes : null; 5302 } 5303 5304 function toHandlers(obj, preserveCaseIfNecessary) { 5305 const ret = {}; 5306 if (!isObject(obj)) { 5307 warn$1(`v-on with no argument expects an object value.`); 5308 return ret; 5309 } 5310 for (const key in obj) { 5311 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 5312 } 5313 return ret; 5314 } 5315 5316 const getPublicInstance = (i) => { 5317 if (!i) return null; 5318 if (isStatefulComponent(i)) return getComponentPublicInstance(i); 5319 return getPublicInstance(i.parent); 5320 }; 5321 const publicPropertiesMap = ( 5322 // Move PURE marker to new line to workaround compiler discarding it 5323 // due to type annotation 5324 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 5325 $: (i) => i, 5326 $el: (i) => i.vnode.el, 5327 $data: (i) => i.data, 5328 $props: (i) => shallowReadonly(i.props) , 5329 $attrs: (i) => shallowReadonly(i.attrs) , 5330 $slots: (i) => shallowReadonly(i.slots) , 5331 $refs: (i) => shallowReadonly(i.refs) , 5332 $parent: (i) => getPublicInstance(i.parent), 5333 $root: (i) => getPublicInstance(i.root), 5334 $host: (i) => i.ce, 5335 $emit: (i) => i.emit, 5336 $options: (i) => resolveMergedOptions(i) , 5337 $forceUpdate: (i) => i.f || (i.f = () => { 5338 queueJob(i.update); 5339 }), 5340 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 5341 $watch: (i) => instanceWatch.bind(i) 5342 }) 5343 ); 5344 const isReservedPrefix = (key) => key === "_" || key === "$"; 5345 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 5346 const PublicInstanceProxyHandlers = { 5347 get({ _: instance }, key) { 5348 if (key === "__v_skip") { 5349 return true; 5350 } 5351 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 5352 if (key === "__isVue") { 5353 return true; 5354 } 5355 let normalizedProps; 5356 if (key[0] !== "$") { 5357 const n = accessCache[key]; 5358 if (n !== void 0) { 5359 switch (n) { 5360 case 1 /* SETUP */: 5361 return setupState[key]; 5362 case 2 /* DATA */: 5363 return data[key]; 5364 case 4 /* CONTEXT */: 5365 return ctx[key]; 5366 case 3 /* PROPS */: 5367 return props[key]; 5368 } 5369 } else if (hasSetupBinding(setupState, key)) { 5370 accessCache[key] = 1 /* SETUP */; 5371 return setupState[key]; 5372 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5373 accessCache[key] = 2 /* DATA */; 5374 return data[key]; 5375 } else if ( 5376 // only cache other properties when instance has declared (thus stable) 5377 // props 5378 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 5379 ) { 5380 accessCache[key] = 3 /* PROPS */; 5381 return props[key]; 5382 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5383 accessCache[key] = 4 /* CONTEXT */; 5384 return ctx[key]; 5385 } else if (shouldCacheAccess) { 5386 accessCache[key] = 0 /* OTHER */; 5387 } 5388 } 5389 const publicGetter = publicPropertiesMap[key]; 5390 let cssModule, globalProperties; 5391 if (publicGetter) { 5392 if (key === "$attrs") { 5393 track(instance.attrs, "get", ""); 5394 markAttrsAccessed(); 5395 } else if (key === "$slots") { 5396 track(instance, "get", key); 5397 } 5398 return publicGetter(instance); 5399 } else if ( 5400 // css module (injected by vue-loader) 5401 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 5402 ) { 5403 return cssModule; 5404 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5405 accessCache[key] = 4 /* CONTEXT */; 5406 return ctx[key]; 5407 } else if ( 5408 // global properties 5409 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 5410 ) { 5411 { 5412 return globalProperties[key]; 5413 } 5414 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 5415 // to infinite warning loop 5416 key.indexOf("__v") !== 0)) { 5417 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 5418 warn$1( 5419 `Property ${JSON.stringify( 5420 key 5421 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 5422 ); 5423 } else if (instance === currentRenderingInstance) { 5424 warn$1( 5425 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 5426 ); 5427 } 5428 } 5429 }, 5430 set({ _: instance }, key, value) { 5431 const { data, setupState, ctx } = instance; 5432 if (hasSetupBinding(setupState, key)) { 5433 setupState[key] = value; 5434 return true; 5435 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 5436 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 5437 return false; 5438 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5439 data[key] = value; 5440 return true; 5441 } else if (hasOwn(instance.props, key)) { 5442 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 5443 return false; 5444 } 5445 if (key[0] === "$" && key.slice(1) in instance) { 5446 warn$1( 5447 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 5448 ); 5449 return false; 5450 } else { 5451 if (key in instance.appContext.config.globalProperties) { 5452 Object.defineProperty(ctx, key, { 5453 enumerable: true, 5454 configurable: true, 5455 value 5456 }); 5457 } else { 5458 ctx[key] = value; 5459 } 5460 } 5461 return true; 5462 }, 5463 has({ 5464 _: { data, setupState, accessCache, ctx, appContext, propsOptions, type } 5465 }, key) { 5466 let normalizedProps, cssModules; 5467 return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]); 5468 }, 5469 defineProperty(target, key, descriptor) { 5470 if (descriptor.get != null) { 5471 target._.accessCache[key] = 0; 5472 } else if (hasOwn(descriptor, "value")) { 5473 this.set(target, key, descriptor.value, null); 5474 } 5475 return Reflect.defineProperty(target, key, descriptor); 5476 } 5477 }; 5478 { 5479 PublicInstanceProxyHandlers.ownKeys = (target) => { 5480 warn$1( 5481 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 5482 ); 5483 return Reflect.ownKeys(target); 5484 }; 5485 } 5486 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, { 5487 get(target, key) { 5488 if (key === Symbol.unscopables) { 5489 return; 5490 } 5491 return PublicInstanceProxyHandlers.get(target, key, target); 5492 }, 5493 has(_, key) { 5494 const has = key[0] !== "_" && !isGloballyAllowed(key); 5495 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 5496 warn$1( 5497 `Property ${JSON.stringify( 5498 key 5499 )} should not start with _ which is a reserved prefix for Vue internals.` 5500 ); 5501 } 5502 return has; 5503 } 5504 }); 5505 function createDevRenderContext(instance) { 5506 const target = {}; 5507 Object.defineProperty(target, `_`, { 5508 configurable: true, 5509 enumerable: false, 5510 get: () => instance 5511 }); 5512 Object.keys(publicPropertiesMap).forEach((key) => { 5513 Object.defineProperty(target, key, { 5514 configurable: true, 5515 enumerable: false, 5516 get: () => publicPropertiesMap[key](instance), 5517 // intercepted by the proxy so no need for implementation, 5518 // but needed to prevent set errors 5519 set: NOOP 5520 }); 5521 }); 5522 return target; 5523 } 5524 function exposePropsOnRenderContext(instance) { 5525 const { 5526 ctx, 5527 propsOptions: [propsOptions] 5528 } = instance; 5529 if (propsOptions) { 5530 Object.keys(propsOptions).forEach((key) => { 5531 Object.defineProperty(ctx, key, { 5532 enumerable: true, 5533 configurable: true, 5534 get: () => instance.props[key], 5535 set: NOOP 5536 }); 5537 }); 5538 } 5539 } 5540 function exposeSetupStateOnRenderContext(instance) { 5541 const { ctx, setupState } = instance; 5542 Object.keys(toRaw(setupState)).forEach((key) => { 5543 if (!setupState.__isScriptSetup) { 5544 if (isReservedPrefix(key[0])) { 5545 warn$1( 5546 `setup() return property ${JSON.stringify( 5547 key 5548 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 5549 ); 5550 return; 5551 } 5552 Object.defineProperty(ctx, key, { 5553 enumerable: true, 5554 configurable: true, 5555 get: () => setupState[key], 5556 set: NOOP 5557 }); 5558 } 5559 }); 5560 } 5561 5562 const warnRuntimeUsage = (method) => warn$1( 5563 `${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.` 5564 ); 5565 function defineProps() { 5566 { 5567 warnRuntimeUsage(`defineProps`); 5568 } 5569 return null; 5570 } 5571 function defineEmits() { 5572 { 5573 warnRuntimeUsage(`defineEmits`); 5574 } 5575 return null; 5576 } 5577 function defineExpose(exposed) { 5578 { 5579 warnRuntimeUsage(`defineExpose`); 5580 } 5581 } 5582 function defineOptions(options) { 5583 { 5584 warnRuntimeUsage(`defineOptions`); 5585 } 5586 } 5587 function defineSlots() { 5588 { 5589 warnRuntimeUsage(`defineSlots`); 5590 } 5591 return null; 5592 } 5593 function defineModel() { 5594 { 5595 warnRuntimeUsage("defineModel"); 5596 } 5597 } 5598 function withDefaults(props, defaults) { 5599 { 5600 warnRuntimeUsage(`withDefaults`); 5601 } 5602 return null; 5603 } 5604 function useSlots() { 5605 return getContext("useSlots").slots; 5606 } 5607 function useAttrs() { 5608 return getContext("useAttrs").attrs; 5609 } 5610 function getContext(calledFunctionName) { 5611 const i = getCurrentInstance(); 5612 if (!i) { 5613 warn$1(`${calledFunctionName}() called without active instance.`); 5614 } 5615 return i.setupContext || (i.setupContext = createSetupContext(i)); 5616 } 5617 function normalizePropsOrEmits(props) { 5618 return isArray(props) ? props.reduce( 5619 (normalized, p) => (normalized[p] = null, normalized), 5620 {} 5621 ) : props; 5622 } 5623 function mergeDefaults(raw, defaults) { 5624 const props = normalizePropsOrEmits(raw); 5625 for (const key in defaults) { 5626 if (key.startsWith("__skip")) continue; 5627 let opt = props[key]; 5628 if (opt) { 5629 if (isArray(opt) || isFunction(opt)) { 5630 opt = props[key] = { type: opt, default: defaults[key] }; 5631 } else { 5632 opt.default = defaults[key]; 5633 } 5634 } else if (opt === null) { 5635 opt = props[key] = { default: defaults[key] }; 5636 } else { 5637 warn$1(`props default key "${key}" has no corresponding declaration.`); 5638 } 5639 if (opt && defaults[`__skip_${key}`]) { 5640 opt.skipFactory = true; 5641 } 5642 } 5643 return props; 5644 } 5645 function mergeModels(a, b) { 5646 if (!a || !b) return a || b; 5647 if (isArray(a) && isArray(b)) return a.concat(b); 5648 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 5649 } 5650 function createPropsRestProxy(props, excludedKeys) { 5651 const ret = {}; 5652 for (const key in props) { 5653 if (!excludedKeys.includes(key)) { 5654 Object.defineProperty(ret, key, { 5655 enumerable: true, 5656 get: () => props[key] 5657 }); 5658 } 5659 } 5660 return ret; 5661 } 5662 function withAsyncContext(getAwaitable) { 5663 const ctx = getCurrentInstance(); 5664 if (!ctx) { 5665 warn$1(
5666 `withAsyncContext called without active current instance. This is likely a bug.` 5667 ); 5668 } 5669 let awaitable = getAwaitable(); 5670 unsetCurrentInstance(); 5671 if (isPromise(awaitable)) { 5672 awaitable = awaitable.catch((e) => { 5673 setCurrentInstance(ctx); 5674 throw e; 5675 }); 5676 } 5677 return [awaitable, () => setCurrentInstance(ctx)
vendor: 8,714 bytes, lines 5677-5960
5677]; 5678 } 5679 5680 function createDuplicateChecker() { 5681 const cache = /* @__PURE__ */ Object.create(null); 5682 return (type, key) => { 5683 if (cache[key]) { 5684 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 5685 } else { 5686 cache[key] = type; 5687 } 5688 }; 5689 } 5690 let shouldCacheAccess = true; 5691 function applyOptions(instance) { 5692 const options = resolveMergedOptions(instance); 5693 const publicThis = instance.proxy; 5694 const ctx = instance.ctx; 5695 shouldCacheAccess = false; 5696 if (options.beforeCreate) { 5697 callHook$1(options.beforeCreate, instance, "bc"); 5698 } 5699 const { 5700 // state 5701 data: dataOptions, 5702 computed: computedOptions, 5703 methods, 5704 watch: watchOptions, 5705 provide: provideOptions, 5706 inject: injectOptions, 5707 // lifecycle 5708 created, 5709 beforeMount, 5710 mounted, 5711 beforeUpdate, 5712 updated, 5713 activated, 5714 deactivated, 5715 beforeDestroy, 5716 beforeUnmount, 5717 destroyed, 5718 unmounted, 5719 render, 5720 renderTracked, 5721 renderTriggered, 5722 errorCaptured, 5723 serverPrefetch, 5724 // public API 5725 expose, 5726 inheritAttrs, 5727 // assets 5728 components, 5729 directives, 5730 filters 5731 } = options; 5732 const checkDuplicateProperties = createDuplicateChecker() ; 5733 { 5734 const [propsOptions] = instance.propsOptions; 5735 if (propsOptions) { 5736 for (const key in propsOptions) { 5737 checkDuplicateProperties("Props" /* PROPS */, key); 5738 } 5739 } 5740 } 5741 if (injectOptions) { 5742 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 5743 } 5744 if (methods) { 5745 for (const key in methods) { 5746 const methodHandler = methods[key]; 5747 if (isFunction(methodHandler)) { 5748 { 5749 Object.defineProperty(ctx, key, { 5750 value: methodHandler.bind(publicThis), 5751 configurable: true, 5752 enumerable: true, 5753 writable: true 5754 }); 5755 } 5756 { 5757 checkDuplicateProperties("Methods" /* METHODS */, key); 5758 } 5759 } else { 5760 warn$1( 5761 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 5762 ); 5763 } 5764 } 5765 } 5766 if (dataOptions) { 5767 if (!isFunction(dataOptions)) { 5768 warn$1( 5769 `The data option must be a function. Plain object usage is no longer supported.` 5770 ); 5771 } 5772 const data = dataOptions.call(publicThis, publicThis); 5773 if (isPromise(data)) { 5774 warn$1( 5775 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5776 ); 5777 } 5778 if (!isObject(data)) { 5779 warn$1(`data() should return an object.`); 5780 } else { 5781 instance.data = reactive(data); 5782 { 5783 for (const key in data) { 5784 checkDuplicateProperties("Data" /* DATA */, key); 5785 if (!isReservedPrefix(key[0])) { 5786 Object.defineProperty(ctx, key, { 5787 configurable: true, 5788 enumerable: true, 5789 get: () => data[key], 5790 set: NOOP 5791 }); 5792 } 5793 } 5794 } 5795 } 5796 } 5797 shouldCacheAccess = true; 5798 if (computedOptions) { 5799 for (const key in computedOptions) { 5800 const opt = computedOptions[key]; 5801 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5802 if (get === NOOP) { 5803 warn$1(`Computed property "${key}" has no getter.`); 5804 } 5805 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5806 warn$1( 5807 `Write operation failed: computed property "${key}" is readonly.` 5808 ); 5809 } ; 5810 const c = computed({ 5811 get, 5812 set 5813 }); 5814 Object.defineProperty(ctx, key, { 5815 enumerable: true, 5816 configurable: true, 5817 get: () => c.value, 5818 set: (v) => c.value = v 5819 }); 5820 { 5821 checkDuplicateProperties("Computed" /* COMPUTED */, key); 5822 } 5823 } 5824 } 5825 if (watchOptions) { 5826 for (const key in watchOptions) { 5827 createWatcher(watchOptions[key], ctx, publicThis, key); 5828 } 5829 } 5830 if (provideOptions) { 5831 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions; 5832 Reflect.ownKeys(provides).forEach((key) => { 5833 provide(key, provides[key]); 5834 }); 5835 } 5836 if (created) { 5837 callHook$1(created, instance, "c"); 5838 } 5839 function registerLifecycleHook(register, hook) { 5840 if (isArray(hook)) { 5841 hook.forEach((_hook) => register(_hook.bind(publicThis))); 5842 } else if (hook) { 5843 register(hook.bind(publicThis)); 5844 } 5845 } 5846 registerLifecycleHook(onBeforeMount, beforeMount); 5847 registerLifecycleHook(onMounted, mounted); 5848 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 5849 registerLifecycleHook(onUpdated, updated); 5850 registerLifecycleHook(onActivated, activated); 5851 registerLifecycleHook(onDeactivated, deactivated); 5852 registerLifecycleHook(onErrorCaptured, errorCaptured); 5853 registerLifecycleHook(onRenderTracked, renderTracked); 5854 registerLifecycleHook(onRenderTriggered, renderTriggered); 5855 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 5856 registerLifecycleHook(onUnmounted, unmounted); 5857 registerLifecycleHook(onServerPrefetch, serverPrefetch); 5858 if (isArray(expose)) { 5859 if (expose.length) { 5860 const exposed = instance.exposed || (instance.exposed = {}); 5861 expose.forEach((key) => { 5862 Object.defineProperty(exposed, key, { 5863 get: () => publicThis[key], 5864 set: (val) => publicThis[key] = val, 5865 enumerable: true 5866 }); 5867 }); 5868 } else if (!instance.exposed) { 5869 instance.exposed = {}; 5870 } 5871 } 5872 if (render && instance.render === NOOP) { 5873 instance.render = render; 5874 } 5875 if (inheritAttrs != null) { 5876 instance.inheritAttrs = inheritAttrs; 5877 } 5878 if (components) instance.components = components; 5879 if (directives) instance.directives = directives; 5880 } 5881 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 5882 if (isArray(injectOptions)) { 5883 injectOptions = normalizeInject(injectOptions); 5884 } 5885 for (const key in injectOptions) { 5886 const opt = injectOptions[key]; 5887 let injected; 5888 if (isObject(opt)) { 5889 if ("default" in opt) { 5890 injected = inject( 5891 opt.from || key, 5892 opt.default, 5893 true 5894 ); 5895 } else { 5896 injected = inject(opt.from || key); 5897 } 5898 } else { 5899 injected = inject(opt); 5900 } 5901 if (isRef(injected)) { 5902 Object.defineProperty(ctx, key, { 5903 enumerable: true, 5904 configurable: true, 5905 get: () => injected.value, 5906 set: (v) => injected.value = v 5907 }); 5908 } else { 5909 ctx[key] = injected; 5910 } 5911 { 5912 checkDuplicateProperties("Inject" /* INJECT */, key); 5913 } 5914 } 5915 } 5916 function callHook$1(hook, instance, type) { 5917 callWithAsyncErrorHandling( 5918 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 5919 instance, 5920 type 5921 ); 5922 } 5923 function createWatcher(raw, ctx, publicThis, key) { 5924 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 5925 if (isString(raw)) { 5926 const handler = ctx[raw]; 5927 if (isFunction(handler)) { 5928 { 5929 watch(getter, handler); 5930 } 5931 } else { 5932 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 5933 } 5934 } else if (isFunction(raw)) { 5935 { 5936 watch(getter, raw.bind(publicThis)); 5937 } 5938 } else if (isObject(raw)) { 5939 if (isArray(raw)) { 5940 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 5941 } else { 5942 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 5943 if (isFunction(handler)) { 5944 watch(getter, handler, raw); 5945 } else { 5946 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 5947 } 5948 } 5949 } else { 5950 warn$1(`Invalid watch option: "${key}"`, raw); 5951 } 5952 } 5953 function resolveMergedOptions(instance) { 5954 const base = instance.type; 5955 const { mixins, extends: extendsOptions } = base; 5956 const { 5957 mixins: globalMixins, 5958 optionsCache: cache, 5959 config: { optionMergeStrategies } 5960 } = instance.appContext;
vendor: 10,386 bytes, lines 5961-6297
5961 const cached = cache.get(base); 5962 let resolved; 5963 if (cached) { 5964 resolved = cached; 5965 } else if (!globalMixins.length && !mixins && !extendsOptions) { 5966 { 5967 resolved = base; 5968 } 5969 } else { 5970 resolved = {}; 5971 if (globalMixins.length) { 5972 globalMixins.forEach( 5973 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 5974 ); 5975 } 5976 mergeOptions(resolved, base, optionMergeStrategies); 5977 } 5978 if (isObject(base)) { 5979 cache.set(base, resolved); 5980 } 5981 return resolved; 5982 } 5983 function mergeOptions(to, from, strats, asMixin = false) { 5984 const { mixins, extends: extendsOptions } = from; 5985 if (extendsOptions) { 5986 mergeOptions(to, extendsOptions, strats, true); 5987 } 5988 if (mixins) { 5989 mixins.forEach( 5990 (m) => mergeOptions(to, m, strats, true) 5991 ); 5992 } 5993 for (const key in from) { 5994 if (asMixin && key === "expose") { 5995 warn$1( 5996 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 5997 ); 5998 } else { 5999 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 6000 to[key] = strat ? strat(to[key], from[key]) : from[key]; 6001 } 6002 } 6003 return to; 6004 } 6005 const internalOptionMergeStrats = { 6006 data: mergeDataFn, 6007 props: mergeEmitsOrPropsOptions, 6008 emits: mergeEmitsOrPropsOptions, 6009 // objects 6010 methods: mergeObjectOptions, 6011 computed: mergeObjectOptions, 6012 // lifecycle 6013 beforeCreate: mergeAsArray$1, 6014 created: mergeAsArray$1, 6015 beforeMount: mergeAsArray$1, 6016 mounted: mergeAsArray$1, 6017 beforeUpdate: mergeAsArray$1, 6018 updated: mergeAsArray$1, 6019 beforeDestroy: mergeAsArray$1, 6020 beforeUnmount: mergeAsArray$1, 6021 destroyed: mergeAsArray$1, 6022 unmounted: mergeAsArray$1, 6023 activated: mergeAsArray$1, 6024 deactivated: mergeAsArray$1, 6025 errorCaptured: mergeAsArray$1, 6026 serverPrefetch: mergeAsArray$1, 6027 // assets 6028 components: mergeObjectOptions, 6029 directives: mergeObjectOptions, 6030 // watch 6031 watch: mergeWatchOptions, 6032 // provide / inject 6033 provide: mergeDataFn, 6034 inject: mergeInject 6035 }; 6036 function mergeDataFn(to, from) { 6037 if (!from) { 6038 return to; 6039 } 6040 if (!to) { 6041 return from; 6042 } 6043 return function mergedDataFn() { 6044 return (extend)( 6045 isFunction(to) ? to.call(this, this) : to, 6046 isFunction(from) ? from.call(this, this) : from 6047 ); 6048 }; 6049 } 6050 function mergeInject(to, from) { 6051 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 6052 } 6053 function normalizeInject(raw) { 6054 if (isArray(raw)) { 6055 const res = {}; 6056 for (let i = 0; i < raw.length; i++) { 6057 res[raw[i]] = raw[i]; 6058 } 6059 return res; 6060 } 6061 return raw; 6062 } 6063 function mergeAsArray$1(to, from) { 6064 return to ? [...new Set([].concat(to, from))] : from; 6065 } 6066 function mergeObjectOptions(to, from) { 6067 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 6068 } 6069 function mergeEmitsOrPropsOptions(to, from) { 6070 if (to) { 6071 if (isArray(to) && isArray(from)) { 6072 return [.../* @__PURE__ */ new Set([...to, ...from])]; 6073 } 6074 return extend( 6075 /* @__PURE__ */ Object.create(null), 6076 normalizePropsOrEmits(to), 6077 normalizePropsOrEmits(from != null ? from : {}) 6078 ); 6079 } else { 6080 return from; 6081 } 6082 } 6083 function mergeWatchOptions(to, from) { 6084 if (!to) return from; 6085 if (!from) return to; 6086 const merged = extend(/* @__PURE__ */ Object.create(null), to); 6087 for (const key in from) { 6088 merged[key] = mergeAsArray$1(to[key], from[key]); 6089 } 6090 return merged; 6091 } 6092 6093 function createAppContext() { 6094 return { 6095 app: null, 6096 config: { 6097 isNativeTag: NO, 6098 performance: false, 6099 globalProperties: {}, 6100 optionMergeStrategies: {}, 6101 errorHandler: void 0, 6102 warnHandler: void 0, 6103 compilerOptions: {} 6104 }, 6105 mixins: [], 6106 components: {}, 6107 directives: {}, 6108 provides: /* @__PURE__ */ Object.create(null), 6109 optionsCache: /* @__PURE__ */ new WeakMap(), 6110 propsCache: /* @__PURE__ */ new WeakMap(), 6111 emitsCache: /* @__PURE__ */ new WeakMap() 6112 }; 6113 } 6114 let uid$1 = 0; 6115 function createAppAPI(render, hydrate) { 6116 return function createApp(rootComponent, rootProps = null) { 6117 if (!isFunction(rootComponent)) { 6118 rootComponent = extend({}, rootComponent); 6119 } 6120 if (rootProps != null && !isObject(rootProps)) { 6121 warn$1(`root props passed to app.mount() must be an object.`); 6122 rootProps = null; 6123 } 6124 const context = createAppContext(); 6125 const installedPlugins = /* @__PURE__ */ new WeakSet(); 6126 const pluginCleanupFns = []; 6127 let isMounted = false; 6128 const app = context.app = { 6129 _uid: uid$1++, 6130 _component: rootComponent, 6131 _props: rootProps, 6132 _container: null, 6133 _context: context, 6134 _instance: null, 6135 version, 6136 get config() { 6137 return context.config; 6138 }, 6139 set config(v) { 6140 { 6141 warn$1( 6142 `app.config cannot be replaced. Modify individual options instead.` 6143 ); 6144 } 6145 }, 6146 use(plugin, ...options) { 6147 if (installedPlugins.has(plugin)) { 6148 warn$1(`Plugin has already been applied to target app.`); 6149 } else if (plugin && isFunction(plugin.install)) { 6150 installedPlugins.add(plugin); 6151 plugin.install(app, ...options); 6152 } else if (isFunction(plugin)) { 6153 installedPlugins.add(plugin); 6154 plugin(app, ...options); 6155 } else { 6156 warn$1( 6157 `A plugin must either be a function or an object with an "install" function.` 6158 ); 6159 } 6160 return app; 6161 }, 6162 mixin(mixin) { 6163 { 6164 if (!context.mixins.includes(mixin)) { 6165 context.mixins.push(mixin); 6166 } else { 6167 warn$1( 6168 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 6169 ); 6170 } 6171 } 6172 return app; 6173 }, 6174 component(name, component) { 6175 { 6176 validateComponentName(name, context.config); 6177 } 6178 if (!component) { 6179 return context.components[name]; 6180 } 6181 if (context.components[name]) { 6182 warn$1(`Component "${name}" has already been registered in target app.`); 6183 } 6184 context.components[name] = component; 6185 return app; 6186 }, 6187 directive(name, directive) { 6188 { 6189 validateDirectiveName(name); 6190 } 6191 if (!directive) { 6192 return context.directives[name]; 6193 } 6194 if (context.directives[name]) { 6195 warn$1(`Directive "${name}" has already been registered in target app.`); 6196 } 6197 context.directives[name] = directive; 6198 return app; 6199 }, 6200 mount(rootContainer, isHydrate, namespace) { 6201 if (!isMounted) { 6202 if (rootContainer.__vue_app__) { 6203 warn$1( 6204 `There is already an app instance mounted on the host container. 6205 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 6206 ); 6207 } 6208 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 6209 vnode.appContext = context; 6210 if (namespace === true) { 6211 namespace = "svg"; 6212 } else if (namespace === false) { 6213 namespace = void 0; 6214 } 6215 { 6216 context.reload = () => { 6217 const cloned = cloneVNode(vnode); 6218 cloned.el = null; 6219 render(cloned, rootContainer, namespace); 6220 }; 6221 } 6222 if (isHydrate && hydrate) { 6223 hydrate(vnode, rootContainer); 6224 } else { 6225 render(vnode, rootContainer, namespace); 6226 } 6227 isMounted = true; 6228 app._container = rootContainer; 6229 rootContainer.__vue_app__ = app; 6230 { 6231 app._instance = vnode.component; 6232 devtoolsInitApp(app, version); 6233 } 6234 return getComponentPublicInstance(vnode.component); 6235 } else { 6236 warn$1( 6237 `App has already been mounted. 6238If 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)\`` 6239 ); 6240 } 6241 }, 6242 onUnmount(cleanupFn) { 6243 if (typeof cleanupFn !== "function") { 6244 warn$1( 6245 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}` 6246 ); 6247 } 6248 pluginCleanupFns.push(cleanupFn); 6249 }, 6250 unmount() { 6251 if (isMounted) { 6252 callWithAsyncErrorHandling( 6253 pluginCleanupFns, 6254 app._instance, 6255 16 6256 ); 6257 render(null, app._container); 6258 { 6259 app._instance = null; 6260 devtoolsUnmountApp(app); 6261 } 6262 delete app._container.__vue_app__; 6263 } else { 6264 warn$1(`Cannot unmount an app that is not mounted.`); 6265 } 6266 }, 6267 provide(key, value) { 6268 if (key in context.provides) { 6269 if (hasOwn(context.provides, key)) { 6270 warn$1( 6271 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 6272 ); 6273 } else { 6274 warn$1( 6275 `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.` 6276 ); 6277 } 6278 } 6279 context.provides[key] = value; 6280 return app; 6281 }, 6282 runWithContext(fn) { 6283 const lastApp = currentApp; 6284 currentApp = app; 6285 try { 6286 return fn(); 6287 } finally { 6288 currentApp = lastApp; 6289 } 6290 } 6291 }; 6292 return app; 6293 }; 6294 } 6295 let currentApp = null; 6296 6297 function
vendor: 65,530 bytes, lines 6297-8380
6297provide(key, value) { 6298 if (!currentInstance) { 6299 { 6300 warn$1(`provide() can only be used inside setup().`); 6301 } 6302 } else { 6303 let provides = currentInstance.provides; 6304 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 6305 if (parentProvides === provides) { 6306 provides = currentInstance.provides = Object.create(parentProvides); 6307 } 6308 provides[key] = value; 6309 } 6310 } 6311 function inject(key, defaultValue, treatDefaultAsFactory = false) { 6312 const instance = getCurrentInstance(); 6313 if (instance || currentApp) { 6314 let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 6315 if (provides && key in provides) { 6316 return provides[key]; 6317 } else if (arguments.length > 1) { 6318 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 6319 } else { 6320 warn$1(`injection "${String(key)}" not found.`); 6321 } 6322 } else { 6323 warn$1(`inject() can only be used inside setup() or functional components.`); 6324 } 6325 } 6326 function hasInjectionContext() { 6327 return !!(getCurrentInstance() || currentApp); 6328 } 6329 6330 const internalObjectProto = {}; 6331 const createInternalObject = () => Object.create(internalObjectProto); 6332 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 6333 6334 function initProps(instance, rawProps, isStateful, isSSR = false) { 6335 const props = {}; 6336 const attrs = createInternalObject(); 6337 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 6338 setFullProps(instance, rawProps, props, attrs); 6339 for (const key in instance.propsOptions[0]) { 6340 if (!(key in props)) { 6341 props[key] = void 0; 6342 } 6343 } 6344 { 6345 validateProps(rawProps || {}, props, instance); 6346 } 6347 if (isStateful) { 6348 instance.props = isSSR ? props : shallowReactive(props); 6349 } else { 6350 if (!instance.type.props) { 6351 instance.props = attrs; 6352 } else { 6353 instance.props = props; 6354 } 6355 } 6356 instance.attrs = attrs; 6357 } 6358 function isInHmrContext(instance) { 6359 while (instance) { 6360 if (instance.type.__hmrId) return true; 6361 instance = instance.parent; 6362 } 6363 } 6364 function updateProps(instance, rawProps, rawPrevProps, optimized) { 6365 const { 6366 props, 6367 attrs, 6368 vnode: { patchFlag } 6369 } = instance; 6370 const rawCurrentProps = toRaw(props); 6371 const [options] = instance.propsOptions; 6372 let hasAttrsChanged = false; 6373 if ( 6374 // always force full diff in dev 6375 // - #1942 if hmr is enabled with sfc component 6376 // - vite#872 non-sfc component used by sfc component 6377 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 6378 ) { 6379 if (patchFlag & 8) { 6380 const propsToUpdate = instance.vnode.dynamicProps; 6381 for (let i = 0; i < propsToUpdate.length; i++) { 6382 let key = propsToUpdate[i]; 6383 if (isEmitListener(instance.emitsOptions, key)) { 6384 continue; 6385 } 6386 const value = rawProps[key]; 6387 if (options) { 6388 if (hasOwn(attrs, key)) { 6389 if (value !== attrs[key]) { 6390 attrs[key] = value; 6391 hasAttrsChanged = true; 6392 } 6393 } else { 6394 const camelizedKey = camelize(key); 6395 props[camelizedKey] = resolvePropValue( 6396 options, 6397 rawCurrentProps, 6398 camelizedKey, 6399 value, 6400 instance, 6401 false 6402 ); 6403 } 6404 } else { 6405 if (value !== attrs[key]) { 6406 attrs[key] = value; 6407 hasAttrsChanged = true; 6408 } 6409 } 6410 } 6411 } 6412 } else { 6413 if (setFullProps(instance, rawProps, props, attrs)) { 6414 hasAttrsChanged = true; 6415 } 6416 let kebabKey; 6417 for (const key in rawCurrentProps) { 6418 if (!rawProps || // for camelCase 6419 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 6420 // and converted to camelCase (#955) 6421 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 6422 if (options) { 6423 if (rawPrevProps && // for camelCase 6424 (rawPrevProps[key] !== void 0 || // for kebab-case 6425 rawPrevProps[kebabKey] !== void 0)) { 6426 props[key] = resolvePropValue( 6427 options, 6428 rawCurrentProps, 6429 key, 6430 void 0, 6431 instance, 6432 true 6433 ); 6434 } 6435 } else { 6436 delete props[key]; 6437 } 6438 } 6439 } 6440 if (attrs !== rawCurrentProps) { 6441 for (const key in attrs) { 6442 if (!rawProps || !hasOwn(rawProps, key) && true) { 6443 delete attrs[key]; 6444 hasAttrsChanged = true; 6445 } 6446 } 6447 } 6448 } 6449 if (hasAttrsChanged) { 6450 trigger(instance.attrs, "set", ""); 6451 } 6452 { 6453 validateProps(rawProps || {}, props, instance); 6454 } 6455 } 6456 function setFullProps(instance, rawProps, props, attrs) { 6457 const [options, needCastKeys] = instance.propsOptions; 6458 let hasAttrsChanged = false; 6459 let rawCastValues; 6460 if (rawProps) { 6461 for (let key in rawProps) { 6462 if (isReservedProp(key)) { 6463 continue; 6464 } 6465 const value = rawProps[key]; 6466 let camelKey; 6467 if (options && hasOwn(options, camelKey = camelize(key))) { 6468 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 6469 props[camelKey] = value; 6470 } else { 6471 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 6472 } 6473 } else if (!isEmitListener(instance.emitsOptions, key)) { 6474 if (!(key in attrs) || value !== attrs[key]) { 6475 attrs[key] = value; 6476 hasAttrsChanged = true; 6477 } 6478 } 6479 } 6480 } 6481 if (needCastKeys) { 6482 const rawCurrentProps = toRaw(props); 6483 const castValues = rawCastValues || EMPTY_OBJ; 6484 for (let i = 0; i < needCastKeys.length; i++) { 6485 const key = needCastKeys[i]; 6486 props[key] = resolvePropValue( 6487 options, 6488 rawCurrentProps, 6489 key, 6490 castValues[key], 6491 instance, 6492 !hasOwn(castValues, key) 6493 ); 6494 } 6495 } 6496 return hasAttrsChanged; 6497 } 6498 function resolvePropValue(options, props, key, value, instance, isAbsent) { 6499 const opt = options[key]; 6500 if (opt != null) { 6501 const hasDefault = hasOwn(opt, "default"); 6502 if (hasDefault && value === void 0) { 6503 const defaultValue = opt.default; 6504 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 6505 const { propsDefaults } = instance; 6506 if (key in propsDefaults) { 6507 value = propsDefaults[key]; 6508 } else { 6509 const reset = setCurrentInstance(instance); 6510 value = propsDefaults[key] = defaultValue.call( 6511 null, 6512 props 6513 ); 6514 reset(); 6515 } 6516 } else { 6517 value = defaultValue; 6518 } 6519 if (instance.ce) { 6520 instance.ce._setProp(key, value); 6521 } 6522 } 6523 if (opt[0 /* shouldCast */]) { 6524 if (isAbsent && !hasDefault) { 6525 value = false; 6526 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 6527 value = true; 6528 } 6529 } 6530 } 6531 return value; 6532 } 6533 const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 6534 function normalizePropsOptions(comp, appContext, asMixin = false) { 6535 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 6536 const cached = cache.get(comp); 6537 if (cached) { 6538 return cached; 6539 } 6540 const raw = comp.props; 6541 const normalized = {}; 6542 const needCastKeys = []; 6543 let hasExtends = false; 6544 if (!isFunction(comp)) { 6545 const extendProps = (raw2) => { 6546 hasExtends = true; 6547 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 6548 extend(normalized, props); 6549 if (keys) needCastKeys.push(...keys); 6550 }; 6551 if (!asMixin && appContext.mixins.length) { 6552 appContext.mixins.forEach(extendProps); 6553 } 6554 if (comp.extends) { 6555 extendProps(comp.extends); 6556 } 6557 if (comp.mixins) { 6558 comp.mixins.forEach(extendProps); 6559 } 6560 } 6561 if (!raw && !hasExtends) { 6562 if (isObject(comp)) { 6563 cache.set(comp, EMPTY_ARR); 6564 } 6565 return EMPTY_ARR; 6566 } 6567 if (isArray(raw)) { 6568 for (let i = 0; i < raw.length; i++) { 6569 if (!isString(raw[i])) { 6570 warn$1(`props must be strings when using array syntax.`, raw[i]); 6571 } 6572 const normalizedKey = camelize(raw[i]); 6573 if (validatePropName(normalizedKey)) { 6574 normalized[normalizedKey] = EMPTY_OBJ; 6575 } 6576 } 6577 } else if (raw) { 6578 if (!isObject(raw)) { 6579 warn$1(`invalid props options`, raw); 6580 } 6581 for (const key in raw) { 6582 const normalizedKey = camelize(key); 6583 if (validatePropName(normalizedKey)) { 6584 const opt = raw[key]; 6585 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 6586 const propType = prop.type; 6587 let shouldCast = false; 6588 let shouldCastTrue = true; 6589 if (isArray(propType)) { 6590 for (let index = 0; index < propType.length; ++index) { 6591 const type = propType[index]; 6592 const typeName = isFunction(type) && type.name; 6593 if (typeName === "Boolean") { 6594 shouldCast = true; 6595 break; 6596 } else if (typeName === "String") { 6597 shouldCastTrue = false; 6598 } 6599 } 6600 } else { 6601 shouldCast = isFunction(propType) && propType.name === "Boolean"; 6602 } 6603 prop[0 /* shouldCast */] = shouldCast; 6604 prop[1 /* shouldCastTrue */] = shouldCastTrue; 6605 if (shouldCast || hasOwn(prop, "default")) { 6606 needCastKeys.push(normalizedKey); 6607 } 6608 } 6609 } 6610 } 6611 const res = [normalized, needCastKeys]; 6612 if (isObject(comp)) { 6613 cache.set(comp, res); 6614 } 6615 return res; 6616 } 6617 function validatePropName(key) { 6618 if (key[0] !== "$" && !isReservedProp(key)) { 6619 return true; 6620 } else { 6621 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 6622 } 6623 return false; 6624 } 6625 function getType(ctor) { 6626 if (ctor === null) { 6627 return "null"; 6628 } 6629 if (typeof ctor === "function") { 6630 return ctor.name || ""; 6631 } else if (typeof ctor === "object") { 6632 const name = ctor.constructor && ctor.constructor.name; 6633 return name || ""; 6634 } 6635 return ""; 6636 } 6637 function validateProps(rawProps, props, instance) { 6638 const resolvedValues = toRaw(props); 6639 const options = instance.propsOptions[0]; 6640 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key)); 6641 for (const key in options) { 6642 let opt = options[key]; 6643 if (opt == null) continue; 6644 validateProp( 6645 key, 6646 resolvedValues[key], 6647 opt, 6648 shallowReadonly(resolvedValues) , 6649 !camelizePropsKey.includes(key) 6650 ); 6651 } 6652 } 6653 function validateProp(name, value, prop, props, isAbsent) { 6654 const { type, required, validator, skipCheck } = prop; 6655 if (required && isAbsent) { 6656 warn$1('Missing required prop: "' + name + '"'); 6657 return; 6658 } 6659 if (value == null && !required) { 6660 return; 6661 } 6662 if (type != null && type !== true && !skipCheck) { 6663 let isValid = false; 6664 const types = isArray(type) ? type : [type]; 6665 const expectedTypes = []; 6666 for (let i = 0; i < types.length && !isValid; i++) { 6667 const { valid, expectedType } = assertType(value, types[i]); 6668 expectedTypes.push(expectedType || ""); 6669 isValid = valid; 6670 } 6671 if (!isValid) { 6672 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 6673 return; 6674 } 6675 } 6676 if (validator && !validator(value, props)) { 6677 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 6678 } 6679 } 6680 const isSimpleType = /* @__PURE__ */ makeMap( 6681 "String,Number,Boolean,Function,Symbol,BigInt" 6682 ); 6683 function assertType(value, type) { 6684 let valid; 6685 const expectedType = getType(type); 6686 if (expectedType === "null") { 6687 valid = value === null; 6688 } else if (isSimpleType(expectedType)) { 6689 const t = typeof value; 6690 valid = t === expectedType.toLowerCase(); 6691 if (!valid && t === "object") { 6692 valid = value instanceof type; 6693 } 6694 } else if (expectedType === "Object") { 6695 valid = isObject(value); 6696 } else if (expectedType === "Array") { 6697 valid = isArray(value); 6698 } else { 6699 valid = value instanceof type; 6700 } 6701 return { 6702 valid, 6703 expectedType 6704 }; 6705 } 6706 function getInvalidTypeMessage(name, value, expectedTypes) { 6707 if (expectedTypes.length === 0) { 6708 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 6709 } 6710 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 6711 const expectedType = expectedTypes[0]; 6712 const receivedType = toRawType(value); 6713 const expectedValue = styleValue(value, expectedType); 6714 const receivedValue = styleValue(value, receivedType); 6715 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 6716 message += ` with value ${expectedValue}`; 6717 } 6718 message += `, got ${receivedType} `; 6719 if (isExplicable(receivedType)) { 6720 message += `with value ${receivedValue}.`; 6721 } 6722 return message; 6723 } 6724 function styleValue(value, type) { 6725 if (type === "String") { 6726 return `"${value}"`; 6727 } else if (type === "Number") { 6728 return `${Number(value)}`; 6729 } else { 6730 return `${value}`; 6731 } 6732 } 6733 function isExplicable(type) { 6734 const explicitTypes = ["string", "number", "boolean"]; 6735 return explicitTypes.some((elem) => type.toLowerCase() === elem); 6736 } 6737 function isBoolean(...args) { 6738 return args.some((elem) => elem.toLowerCase() === "boolean"); 6739 } 6740 6741 const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable"; 6742 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 6743 const normalizeSlot = (key, rawSlot, ctx) => { 6744 if (rawSlot._n) { 6745 return rawSlot; 6746 } 6747 const normalized = withCtx((...args) => { 6748 if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) { 6749 warn$1( 6750 `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.` 6751 ); 6752 } 6753 return normalizeSlotValue(rawSlot(...args)); 6754 }, ctx); 6755 normalized._c = false; 6756 return normalized; 6757 }; 6758 const normalizeObjectSlots = (rawSlots, slots, instance) => { 6759 const ctx = rawSlots._ctx; 6760 for (const key in rawSlots) { 6761 if (isInternalKey(key)) continue; 6762 const value = rawSlots[key]; 6763 if (isFunction(value)) { 6764 slots[key] = normalizeSlot(key, value, ctx); 6765 } else if (value != null) { 6766 { 6767 warn$1( 6768 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 6769 ); 6770 } 6771 const normalized = normalizeSlotValue(value); 6772 slots[key] = () => normalized; 6773 } 6774 } 6775 }; 6776 const normalizeVNodeSlots = (instance, children) => { 6777 if (!isKeepAlive(instance.vnode) && true) { 6778 warn$1( 6779 `Non-function value encountered for default slot. Prefer function slots for better performance.` 6780 ); 6781 } 6782 const normalized = normalizeSlotValue(children); 6783 instance.slots.default = () => normalized; 6784 }; 6785 const assignSlots = (slots, children, optimized) => { 6786 for (const key in children) { 6787 if (optimized || !isInternalKey(key)) { 6788 slots[key] = children[key]; 6789 } 6790 } 6791 }; 6792 const initSlots = (instance, children, optimized) => { 6793 const slots = instance.slots = createInternalObject(); 6794 if (instance.vnode.shapeFlag & 32) { 6795 const type = children._; 6796 if (type) { 6797 assignSlots(slots, children, optimized); 6798 if (optimized) { 6799 def(slots, "_", type, true); 6800 } 6801 } else { 6802 normalizeObjectSlots(children, slots); 6803 } 6804 } else if (children) { 6805 normalizeVNodeSlots(instance, children); 6806 } 6807 }; 6808 const updateSlots = (instance, children, optimized) => { 6809 const { vnode, slots } = instance; 6810 let needDeletionCheck = true; 6811 let deletionComparisonTarget = EMPTY_OBJ; 6812 if (vnode.shapeFlag & 32) { 6813 const type = children._; 6814 if (type) { 6815 if (isHmrUpdating) { 6816 assignSlots(slots, children, optimized); 6817 trigger(instance, "set", "$slots"); 6818 } else if (optimized && type === 1) { 6819 needDeletionCheck = false; 6820 } else { 6821 assignSlots(slots, children, optimized); 6822 } 6823 } else { 6824 needDeletionCheck = !children.$stable; 6825 normalizeObjectSlots(children, slots); 6826 } 6827 deletionComparisonTarget = children; 6828 } else if (children) { 6829 normalizeVNodeSlots(instance, children); 6830 deletionComparisonTarget = { default: 1 }; 6831 } 6832 if (needDeletionCheck) { 6833 for (const key in slots) { 6834 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 6835 delete slots[key]; 6836 } 6837 } 6838 } 6839 }; 6840 6841 let supported; 6842 let perf; 6843 function startMeasure(instance, type) { 6844 if (instance.appContext.config.performance && isSupported()) { 6845 perf.mark(`vue-${type}-${instance.uid}`); 6846 } 6847 { 6848 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 6849 } 6850 } 6851 function endMeasure(instance, type) { 6852 if (instance.appContext.config.performance && isSupported()) { 6853 const startTag = `vue-${type}-${instance.uid}`; 6854 const endTag = startTag + `:end`; 6855 const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`; 6856 perf.mark(endTag); 6857 perf.measure(measureName, startTag, endTag); 6858 perf.clearMeasures(measureName); 6859 perf.clearMarks(startTag); 6860 perf.clearMarks(endTag); 6861 } 6862 { 6863 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 6864 } 6865 } 6866 function isSupported() { 6867 if (supported !== void 0) { 6868 return supported; 6869 } 6870 if (typeof window !== "undefined" && window.performance) { 6871 supported = true; 6872 perf = window.performance; 6873 } else { 6874 supported = false; 6875 } 6876 return supported; 6877 } 6878 6879 const queuePostRenderEffect = queueEffectWithSuspense ; 6880 function createRenderer(options) { 6881 return baseCreateRenderer(options); 6882 } 6883 function createHydrationRenderer(options) { 6884 return baseCreateRenderer(options, createHydrationFunctions); 6885 } 6886 function baseCreateRenderer(options, createHydrationFns) { 6887 const target = getGlobalThis(); 6888 target.__VUE__ = true; 6889 { 6890 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 6891 } 6892 const { 6893 insert: hostInsert, 6894 remove: hostRemove, 6895 patchProp: hostPatchProp, 6896 createElement: hostCreateElement, 6897 createText: hostCreateText, 6898 createComment: hostCreateComment, 6899 setText: hostSetText, 6900 setElementText: hostSetElementText, 6901 parentNode: hostParentNode, 6902 nextSibling: hostNextSibling, 6903 setScopeId: hostSetScopeId = NOOP, 6904 insertStaticContent: hostInsertStaticContent 6905 } = options; 6906 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 6907 if (n1 === n2) { 6908 return; 6909 } 6910 if (n1 && !isSameVNodeType(n1, n2)) { 6911 anchor = getNextHostNode(n1); 6912 unmount(n1, parentComponent, parentSuspense, true); 6913 n1 = null; 6914 } 6915 if (n2.patchFlag === -2) { 6916 optimized = false; 6917 n2.dynamicChildren = null; 6918 } 6919 const { type, ref, shapeFlag } = n2; 6920 switch (type) { 6921 case Text: 6922 processText(n1, n2, container, anchor); 6923 break; 6924 case Comment: 6925 processCommentNode(n1, n2, container, anchor); 6926 break; 6927 case Static: 6928 if (n1 == null) { 6929 mountStaticNode(n2, container, anchor, namespace); 6930 } else { 6931 patchStaticNode(n1, n2, container, namespace); 6932 } 6933 break; 6934 case Fragment: 6935 processFragment( 6936 n1, 6937 n2, 6938 container, 6939 anchor, 6940 parentComponent, 6941 parentSuspense, 6942 namespace, 6943 slotScopeIds, 6944 optimized 6945 ); 6946 break; 6947 default: 6948 if (shapeFlag & 1) { 6949 processElement( 6950 n1, 6951 n2, 6952 container, 6953 anchor, 6954 parentComponent, 6955 parentSuspense, 6956 namespace, 6957 slotScopeIds, 6958 optimized 6959 ); 6960 } else if (shapeFlag & 6) { 6961 processComponent( 6962 n1, 6963 n2, 6964 container, 6965 anchor, 6966 parentComponent, 6967 parentSuspense, 6968 namespace, 6969 slotScopeIds, 6970 optimized 6971 ); 6972 } else if (shapeFlag & 64) { 6973 type.process( 6974 n1, 6975 n2, 6976 container, 6977 anchor, 6978 parentComponent, 6979 parentSuspense, 6980 namespace, 6981 slotScopeIds, 6982 optimized, 6983 internals 6984 ); 6985 } else if (shapeFlag & 128) { 6986 type.process( 6987 n1, 6988 n2, 6989 container, 6990 anchor, 6991 parentComponent, 6992 parentSuspense, 6993 namespace, 6994 slotScopeIds, 6995 optimized, 6996 internals 6997 ); 6998 } else { 6999 warn$1("Invalid VNode type:", type, `(${typeof type})`); 7000 } 7001 } 7002 if (ref != null && parentComponent) { 7003 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 7004 } else if (ref == null && n1 && n1.ref != null) { 7005 setRef(n1.ref, null, parentSuspense, n1, true); 7006 } 7007 }; 7008 const processText = (n1, n2, container, anchor) => { 7009 if (n1 == null) { 7010 hostInsert( 7011 n2.el = hostCreateText(n2.children), 7012 container, 7013 anchor 7014 ); 7015 } else { 7016 const el = n2.el = n1.el; 7017 if (n2.children !== n1.children) { 7018 hostSetText(el, n2.children); 7019 } 7020 } 7021 }; 7022 const processCommentNode = (n1, n2, container, anchor) => { 7023 if (n1 == null) { 7024 hostInsert( 7025 n2.el = hostCreateComment(n2.children || ""), 7026 container, 7027 anchor 7028 ); 7029 } else { 7030 n2.el = n1.el; 7031 } 7032 }; 7033 const mountStaticNode = (n2, container, anchor, namespace) => { 7034 [n2.el, n2.anchor] = hostInsertStaticContent( 7035 n2.children, 7036 container, 7037 anchor, 7038 namespace, 7039 n2.el, 7040 n2.anchor 7041 ); 7042 }; 7043 const patchStaticNode = (n1, n2, container, namespace) => { 7044 if (n2.children !== n1.children) { 7045 const anchor = hostNextSibling(n1.anchor); 7046 removeStaticNode(n1); 7047 [n2.el, n2.anchor] = hostInsertStaticContent( 7048 n2.children, 7049 container, 7050 anchor, 7051 namespace 7052 ); 7053 } else { 7054 n2.el = n1.el; 7055 n2.anchor = n1.anchor; 7056 } 7057 }; 7058 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 7059 let next; 7060 while (el && el !== anchor) { 7061 next = hostNextSibling(el); 7062 hostInsert(el, container, nextSibling); 7063 el = next; 7064 } 7065 hostInsert(anchor, container, nextSibling); 7066 }; 7067 const removeStaticNode = ({ el, anchor }) => { 7068 let next; 7069 while (el && el !== anchor) { 7070 next = hostNextSibling(el); 7071 hostRemove(el); 7072 el = next; 7073 } 7074 hostRemove(anchor); 7075 }; 7076 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7077 if (n2.type === "svg") { 7078 namespace = "svg"; 7079 } else if (n2.type === "math") { 7080 namespace = "mathml"; 7081 } 7082 if (n1 == null) { 7083 mountElement( 7084 n2, 7085 container, 7086 anchor, 7087 parentComponent, 7088 parentSuspense, 7089 namespace, 7090 slotScopeIds, 7091 optimized 7092 ); 7093 } else { 7094 patchElement( 7095 n1, 7096 n2, 7097 parentComponent, 7098 parentSuspense, 7099 namespace, 7100 slotScopeIds, 7101 optimized 7102 ); 7103 } 7104 }; 7105 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7106 let el; 7107 let vnodeHook; 7108 const { props, shapeFlag, transition, dirs } = vnode; 7109 el = vnode.el = hostCreateElement( 7110 vnode.type, 7111 namespace, 7112 props && props.is, 7113 props 7114 ); 7115 if (shapeFlag & 8) { 7116 hostSetElementText(el, vnode.children); 7117 } else if (shapeFlag & 16) { 7118 mountChildren( 7119 vnode.children, 7120 el, 7121 null, 7122 parentComponent, 7123 parentSuspense, 7124 resolveChildrenNamespace(vnode, namespace), 7125 slotScopeIds, 7126 optimized 7127 ); 7128 } 7129 if (dirs) { 7130 invokeDirectiveHook(vnode, null, parentComponent, "created"); 7131 } 7132 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7133 if (props) { 7134 for (const key in props) { 7135 if (key !== "value" && !isReservedProp(key)) { 7136 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 7137 } 7138 } 7139 if ("value" in props) { 7140 hostPatchProp(el, "value", null, props.value, namespace); 7141 } 7142 if (vnodeHook = props.onVnodeBeforeMount) { 7143 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7144 } 7145 } 7146 { 7147 def(el, "__vnode", vnode, true); 7148 def(el, "__vueParentComponent", parentComponent, true); 7149 } 7150 if (dirs) { 7151 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7152 } 7153 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7154 if (needCallTransitionHooks) { 7155 transition.beforeEnter(el); 7156 } 7157 hostInsert(el, container, anchor); 7158 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7159 queuePostRenderEffect(() => { 7160 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7161 needCallTransitionHooks && transition.enter(el); 7162 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7163 }, parentSuspense); 7164 } 7165 }; 7166 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7167 if (scopeId) { 7168 hostSetScopeId(el, scopeId); 7169 } 7170 if (slotScopeIds) { 7171 for (let i = 0; i < slotScopeIds.length; i++) { 7172 hostSetScopeId(el, slotScopeIds[i]); 7173 } 7174 } 7175 if (parentComponent) { 7176 let subTree = parentComponent.subTree; 7177 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7178 subTree = filterSingleRoot(subTree.children) || subTree; 7179 } 7180 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 7181 const parentVNode = parentComponent.vnode; 7182 setScopeId( 7183 el, 7184 parentVNode, 7185 parentVNode.scopeId, 7186 parentVNode.slotScopeIds, 7187 parentComponent.parent 7188 ); 7189 } 7190 } 7191 }; 7192 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7193 for (let i = start; i < children.length; i++) { 7194 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7195 patch( 7196 null, 7197 child, 7198 container, 7199 anchor, 7200 parentComponent, 7201 parentSuspense, 7202 namespace, 7203 slotScopeIds, 7204 optimized 7205 ); 7206 } 7207 }; 7208 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7209 const el = n2.el = n1.el; 7210 { 7211 el.__vnode = n2; 7212 } 7213 let { patchFlag, dynamicChildren, dirs } = n2; 7214 patchFlag |= n1.patchFlag & 16; 7215 const oldProps = n1.props || EMPTY_OBJ; 7216 const newProps = n2.props || EMPTY_OBJ; 7217 let vnodeHook; 7218 parentComponent && toggleRecurse(parentComponent, false); 7219 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7220 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7221 } 7222 if (dirs) { 7223 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7224 } 7225 parentComponent && toggleRecurse(parentComponent, true); 7226 if (isHmrUpdating) { 7227 patchFlag = 0; 7228 optimized = false; 7229 dynamicChildren = null; 7230 } 7231 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 7232 hostSetElementText(el, ""); 7233 } 7234 if (dynamicChildren) { 7235 patchBlockChildren( 7236 n1.dynamicChildren, 7237 dynamicChildren, 7238 el, 7239 parentComponent, 7240 parentSuspense, 7241 resolveChildrenNamespace(n2, namespace), 7242 slotScopeIds 7243 ); 7244 { 7245 traverseStaticChildren(n1, n2); 7246 } 7247 } else if (!optimized) { 7248 patchChildren( 7249 n1, 7250 n2, 7251 el, 7252 null, 7253 parentComponent, 7254 parentSuspense, 7255 resolveChildrenNamespace(n2, namespace), 7256 slotScopeIds, 7257 false 7258 ); 7259 } 7260 if (patchFlag > 0) { 7261 if (patchFlag & 16) { 7262 patchProps(el, oldProps, newProps, parentComponent, namespace); 7263 } else { 7264 if (patchFlag & 2) { 7265 if (oldProps.class !== newProps.class) { 7266 hostPatchProp(el, "class", null, newProps.class, namespace); 7267 } 7268 } 7269 if (patchFlag & 4) { 7270 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7271 } 7272 if (patchFlag & 8) { 7273 const propsToUpdate = n2.dynamicProps; 7274 for (let i = 0; i < propsToUpdate.length; i++) { 7275 const key = propsToUpdate[i]; 7276 const prev = oldProps[key]; 7277 const next = newProps[key]; 7278 if (next !== prev || key === "value") { 7279 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7280 } 7281 } 7282 } 7283 } 7284 if (patchFlag & 1) { 7285 if (n1.children !== n2.children) { 7286 hostSetElementText(el, n2.children); 7287 } 7288 } 7289 } else if (!optimized && dynamicChildren == null) { 7290 patchProps(el, oldProps, newProps, parentComponent, namespace); 7291 } 7292 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7293 queuePostRenderEffect(() => { 7294 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7295 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7296 }, parentSuspense); 7297 } 7298 }; 7299 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7300 for (let i = 0; i < newChildren.length; i++) { 7301 const oldVNode = oldChildren[i]; 7302 const newVNode = newChildren[i]; 7303 const container = ( 7304 // oldVNode may be an errored async setup() component inside Suspense 7305 // which will not have a mounted element 7306 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7307 // of the Fragment itself so it can move its children. 7308 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7309 // which also requires the correct parent container 7310 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7311 oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : ( 7312 // In other cases, the parent container is not actually used so we 7313 // just pass the block element here to avoid a DOM parentNode call. 7314 fallbackContainer 7315 ) 7316 ); 7317 patch( 7318 oldVNode, 7319 newVNode, 7320 container, 7321 null, 7322 parentComponent, 7323 parentSuspense, 7324 namespace, 7325 slotScopeIds, 7326 true 7327 ); 7328 } 7329 }; 7330 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 7331 if (oldProps !== newProps) { 7332 if (oldProps !== EMPTY_OBJ) { 7333 for (const key in oldProps) { 7334 if (!isReservedProp(key) && !(key in newProps)) { 7335 hostPatchProp( 7336 el, 7337 key, 7338 oldProps[key], 7339 null, 7340 namespace, 7341 parentComponent 7342 ); 7343 } 7344 } 7345 } 7346 for (const key in newProps) { 7347 if (isReservedProp(key)) continue; 7348 const next = newProps[key]; 7349 const prev = oldProps[key]; 7350 if (next !== prev && key !== "value") { 7351 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7352 } 7353 } 7354 if ("value" in newProps) { 7355 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 7356 } 7357 } 7358 }; 7359 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7360 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 7361 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 7362 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 7363 if ( 7364 // #5523 dev root fragment may inherit directives 7365 isHmrUpdating || patchFlag & 2048 7366 ) { 7367 patchFlag = 0; 7368 optimized = false; 7369 dynamicChildren = null; 7370 } 7371 if (fragmentSlotScopeIds) { 7372 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 7373 } 7374 if (n1 == null) { 7375 hostInsert(fragmentStartAnchor, container, anchor); 7376 hostInsert(fragmentEndAnchor, container, anchor); 7377 mountChildren( 7378 // #10007 7379 // such fragment like `<></>` will be compiled into 7380 // a fragment which doesn't have a children. 7381 // In this case fallback to an empty array 7382 n2.children || [], 7383 container, 7384 fragmentEndAnchor, 7385 parentComponent, 7386 parentSuspense, 7387 namespace, 7388 slotScopeIds, 7389 optimized 7390 ); 7391 } else { 7392 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 7393 // of renderSlot() with no valid children 7394 n1.dynamicChildren) { 7395 patchBlockChildren( 7396 n1.dynamicChildren, 7397 dynamicChildren, 7398 container, 7399 parentComponent, 7400 parentSuspense, 7401 namespace, 7402 slotScopeIds 7403 ); 7404 { 7405 traverseStaticChildren(n1, n2); 7406 } 7407 } else { 7408 patchChildren( 7409 n1, 7410 n2, 7411 container, 7412 fragmentEndAnchor, 7413 parentComponent, 7414 parentSuspense, 7415 namespace, 7416 slotScopeIds, 7417 optimized 7418 ); 7419 } 7420 } 7421 }; 7422 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7423 n2.slotScopeIds = slotScopeIds; 7424 if (n1 == null) { 7425 if (n2.shapeFlag & 512) { 7426 parentComponent.ctx.activate( 7427 n2, 7428 container, 7429 anchor, 7430 namespace, 7431 optimized 7432 ); 7433 } else { 7434 mountComponent( 7435 n2, 7436 container, 7437 anchor, 7438 parentComponent, 7439 parentSuspense, 7440 namespace, 7441 optimized 7442 ); 7443 } 7444 } else { 7445 updateComponent(n1, n2, optimized); 7446 } 7447 }; 7448 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 7449 const instance = (initialVNode.component = createComponentInstance( 7450 initialVNode, 7451 parentComponent, 7452 parentSuspense 7453 )); 7454 if (instance.type.__hmrId) { 7455 registerHMR(instance); 7456 } 7457 { 7458 pushWarningContext(initialVNode); 7459 startMeasure(instance, `mount`); 7460 } 7461 if (isKeepAlive(initialVNode)) { 7462 instance.ctx.renderer = internals; 7463 } 7464 { 7465 { 7466 startMeasure(instance, `init`); 7467 } 7468 setupComponent(instance, false, optimized); 7469 { 7470 endMeasure(instance, `init`); 7471 } 7472 } 7473 if (isHmrUpdating) initialVNode.el = null; 7474 if (instance.asyncDep) { 7475 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 7476 if (!initialVNode.el) { 7477 const placeholder = instance.subTree = createVNode(Comment); 7478 processCommentNode(null, placeholder, container, anchor); 7479 initialVNode.placeholder = placeholder.el; 7480 } 7481 } else { 7482 setupRenderEffect( 7483 instance, 7484 initialVNode, 7485 container, 7486 anchor, 7487 parentSuspense, 7488 namespace, 7489 optimized 7490 ); 7491 } 7492 { 7493 popWarningContext(); 7494 endMeasure(instance, `mount`); 7495 } 7496 }; 7497 const updateComponent = (n1, n2, optimized) => { 7498 const instance = n2.component = n1.component; 7499 if (shouldUpdateComponent(n1, n2, optimized)) { 7500 if (instance.asyncDep && !instance.asyncResolved) { 7501 { 7502 pushWarningContext(n2); 7503 } 7504 updateComponentPreRender(instance, n2, optimized); 7505 { 7506 popWarningContext(); 7507 } 7508 return; 7509 } else { 7510 instance.next = n2; 7511 instance.update(); 7512 } 7513 } else { 7514 n2.el = n1.el; 7515 instance.vnode = n2; 7516 } 7517 }; 7518 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 7519 const componentUpdateFn = () => { 7520 if (!instance.isMounted) { 7521 let vnodeHook; 7522 const { el, props } = initialVNode; 7523 const { bm, m, parent, root, type } = instance; 7524 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 7525 toggleRecurse(instance, false); 7526 if (bm) { 7527 invokeArrayFns(bm); 7528 } 7529 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 7530 invokeVNodeHook(vnodeHook, parent, initialVNode); 7531 } 7532 toggleRecurse(instance, true); 7533 if (el && hydrateNode) { 7534 const hydrateSubTree = () => { 7535 { 7536 startMeasure(instance, `render`); 7537 } 7538 instance.subTree = renderComponentRoot(instance); 7539 { 7540 endMeasure(instance, `render`); 7541 } 7542 { 7543 startMeasure(instance, `hydrate`); 7544 } 7545 hydrateNode( 7546 el, 7547 instance.subTree, 7548 instance, 7549 parentSuspense, 7550 null 7551 ); 7552 { 7553 endMeasure(instance, `hydrate`); 7554 } 7555 }; 7556 if (isAsyncWrapperVNode && type.__asyncHydrate) { 7557 type.__asyncHydrate( 7558 el, 7559 instance, 7560 hydrateSubTree 7561 ); 7562 } else { 7563 hydrateSubTree(); 7564 } 7565 } else { 7566 if (root.ce && // @ts-expect-error _def is private 7567 root.ce._def.shadowRoot !== false) { 7568 root.ce._injectChildStyle(type); 7569 } 7570 { 7571 startMeasure(instance, `render`); 7572 } 7573 const subTree = instance.subTree = renderComponentRoot(instance); 7574 { 7575 endMeasure(instance, `render`); 7576 } 7577 { 7578 startMeasure(instance, `patch`); 7579 } 7580 patch( 7581 null, 7582 subTree, 7583 container, 7584 anchor, 7585 instance, 7586 parentSuspense, 7587 namespace 7588 ); 7589 { 7590 endMeasure(instance, `patch`); 7591 } 7592 initialVNode.el = subTree.el; 7593 } 7594 if (m) { 7595 queuePostRenderEffect(m, parentSuspense); 7596 } 7597 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 7598 const scopedInitialVNode = initialVNode; 7599 queuePostRenderEffect( 7600 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 7601 parentSuspense 7602 ); 7603 } 7604 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 7605 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 7606 } 7607 instance.isMounted = true; 7608 { 7609 devtoolsComponentAdded(instance); 7610 } 7611 initialVNode = container = anchor = null; 7612 } else { 7613 let { next, bu, u, parent, vnode } = instance; 7614 { 7615 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 7616 if (nonHydratedAsyncRoot) { 7617 if (next) { 7618 next.el = vnode.el; 7619 updateComponentPreRender(instance, next, optimized); 7620 } 7621 nonHydratedAsyncRoot.asyncDep.then(() => { 7622 if (!instance.isUnmounted) { 7623 componentUpdateFn(); 7624 } 7625 }); 7626 return; 7627 } 7628 } 7629 let originNext = next; 7630 let vnodeHook; 7631 { 7632 pushWarningContext(next || instance.vnode); 7633 } 7634 toggleRecurse(instance, false); 7635 if (next) { 7636 next.el = vnode.el; 7637 updateComponentPreRender(instance, next, optimized); 7638 } else { 7639 next = vnode; 7640 } 7641 if (bu) { 7642 invokeArrayFns(bu); 7643 } 7644 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 7645 invokeVNodeHook(vnodeHook, parent, next, vnode); 7646 } 7647 toggleRecurse(instance, true); 7648 { 7649 startMeasure(instance, `render`); 7650 } 7651 const nextTree = renderComponentRoot(instance); 7652 { 7653 endMeasure(instance, `render`); 7654 } 7655 const prevTree = instance.subTree; 7656 instance.subTree = nextTree; 7657 { 7658 startMeasure(instance, `patch`); 7659 } 7660 patch( 7661 prevTree, 7662 nextTree, 7663 // parent may have changed if it's in a teleport 7664 hostParentNode(prevTree.el), 7665 // anchor may have changed if it's in a fragment 7666 getNextHostNode(prevTree), 7667 instance, 7668 parentSuspense, 7669 namespace 7670 ); 7671 { 7672 endMeasure(instance, `patch`); 7673 } 7674 next.el = nextTree.el; 7675 if (originNext === null) { 7676 updateHOCHostEl(instance, nextTree.el); 7677 } 7678 if (u) { 7679 queuePostRenderEffect(u, parentSuspense); 7680 } 7681 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 7682 queuePostRenderEffect( 7683 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 7684 parentSuspense 7685 ); 7686 } 7687 { 7688 devtoolsComponentUpdated(instance); 7689 } 7690 { 7691 popWarningContext(); 7692 } 7693 } 7694 }; 7695 instance.scope.on(); 7696 const effect = instance.effect = new ReactiveEffect(componentUpdateFn); 7697 instance.scope.off(); 7698 const update = instance.update = effect.run.bind(effect); 7699 const job = instance.job = effect.runIfDirty.bind(effect); 7700 job.i = instance; 7701 job.id = instance.uid; 7702 effect.scheduler = () => queueJob(job); 7703 toggleRecurse(instance, true); 7704 { 7705 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 7706 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 7707 } 7708 update(); 7709 }; 7710 const updateComponentPreRender = (instance, nextVNode, optimized) => { 7711 nextVNode.component = instance; 7712 const prevProps = instance.vnode.props; 7713 instance.vnode = nextVNode; 7714 instance.next = null; 7715 updateProps(instance, nextVNode.props, prevProps, optimized); 7716 updateSlots(instance, nextVNode.children, optimized); 7717 pauseTracking(); 7718 flushPreFlushCbs(instance); 7719 resetTracking(); 7720 }; 7721 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 7722 const c1 = n1 && n1.children; 7723 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 7724 const c2 = n2.children; 7725 const { patchFlag, shapeFlag } = n2; 7726 if (patchFlag > 0) { 7727 if (patchFlag & 128) { 7728 patchKeyedChildren( 7729 c1, 7730 c2, 7731 container, 7732 anchor, 7733 parentComponent, 7734 parentSuspense, 7735 namespace, 7736 slotScopeIds, 7737 optimized 7738 ); 7739 return; 7740 } else if (patchFlag & 256) { 7741 patchUnkeyedChildren( 7742 c1, 7743 c2, 7744 container, 7745 anchor, 7746 parentComponent, 7747 parentSuspense, 7748 namespace, 7749 slotScopeIds, 7750 optimized 7751 ); 7752 return; 7753 } 7754 } 7755 if (shapeFlag & 8) { 7756 if (prevShapeFlag & 16) { 7757 unmountChildren(c1, parentComponent, parentSuspense); 7758 } 7759 if (c2 !== c1) { 7760 hostSetElementText(container, c2); 7761 } 7762 } else { 7763 if (prevShapeFlag & 16) { 7764 if (shapeFlag & 16) { 7765 patchKeyedChildren( 7766 c1, 7767 c2, 7768 container, 7769 anchor, 7770 parentComponent, 7771 parentSuspense, 7772 namespace, 7773 slotScopeIds, 7774 optimized 7775 ); 7776 } else { 7777 unmountChildren(c1, parentComponent, parentSuspense, true); 7778 } 7779 } else { 7780 if (prevShapeFlag & 8) { 7781 hostSetElementText(container, ""); 7782 } 7783 if (shapeFlag & 16) { 7784 mountChildren( 7785 c2, 7786 container, 7787 anchor, 7788 parentComponent, 7789 parentSuspense, 7790 namespace, 7791 slotScopeIds, 7792 optimized 7793 ); 7794 } 7795 } 7796 } 7797 }; 7798 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7799 c1 = c1 || EMPTY_ARR; 7800 c2 = c2 || EMPTY_ARR; 7801 const oldLength = c1.length; 7802 const newLength = c2.length; 7803 const commonLength = Math.min(oldLength, newLength); 7804 let i; 7805 for (i = 0; i < commonLength; i++) { 7806 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7807 patch( 7808 c1[i], 7809 nextChild, 7810 container, 7811 null, 7812 parentComponent, 7813 parentSuspense, 7814 namespace, 7815 slotScopeIds, 7816 optimized 7817 ); 7818 } 7819 if (oldLength > newLength) { 7820 unmountChildren( 7821 c1, 7822 parentComponent, 7823 parentSuspense, 7824 true, 7825 false, 7826 commonLength 7827 ); 7828 } else { 7829 mountChildren( 7830 c2, 7831 container, 7832 anchor, 7833 parentComponent, 7834 parentSuspense, 7835 namespace, 7836 slotScopeIds, 7837 optimized, 7838 commonLength 7839 ); 7840 } 7841 }; 7842 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7843 let i = 0; 7844 const l2 = c2.length; 7845 let e1 = c1.length - 1; 7846 let e2 = l2 - 1; 7847 while (i <= e1 && i <= e2) { 7848 const n1 = c1[i]; 7849 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7850 if (isSameVNodeType(n1, n2)) { 7851 patch( 7852 n1, 7853 n2, 7854 container, 7855 null, 7856 parentComponent, 7857 parentSuspense, 7858 namespace, 7859 slotScopeIds, 7860 optimized 7861 ); 7862 } else { 7863 break; 7864 } 7865 i++; 7866 } 7867 while (i <= e1 && i <= e2) { 7868 const n1 = c1[e1]; 7869 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 7870 if (isSameVNodeType(n1, n2)) { 7871 patch( 7872 n1, 7873 n2, 7874 container, 7875 null, 7876 parentComponent, 7877 parentSuspense, 7878 namespace, 7879 slotScopeIds, 7880 optimized 7881 ); 7882 } else { 7883 break; 7884 } 7885 e1--; 7886 e2--; 7887 } 7888 if (i > e1) { 7889 if (i <= e2) { 7890 const nextPos = e2 + 1; 7891 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 7892 while (i <= e2) { 7893 patch( 7894 null, 7895 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 7896 container, 7897 anchor, 7898 parentComponent, 7899 parentSuspense, 7900 namespace, 7901 slotScopeIds, 7902 optimized 7903 ); 7904 i++; 7905 } 7906 } 7907 } else if (i > e2) { 7908 while (i <= e1) { 7909 unmount(c1[i], parentComponent, parentSuspense, true); 7910 i++; 7911 } 7912 } else { 7913 const s1 = i; 7914 const s2 = i; 7915 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 7916 for (i = s2; i <= e2; i++) { 7917 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 7918 if (nextChild.key != null) { 7919 if (keyToNewIndexMap.has(nextChild.key)) { 7920 warn$1( 7921 `Duplicate keys found during update:`, 7922 JSON.stringify(nextChild.key), 7923 `Make sure keys are unique.` 7924 ); 7925 } 7926 keyToNewIndexMap.set(nextChild.key, i); 7927 } 7928 } 7929 let j; 7930 let patched = 0; 7931 const toBePatched = e2 - s2 + 1; 7932 let moved = false; 7933 let maxNewIndexSoFar = 0; 7934 const newIndexToOldIndexMap = new Array(toBePatched); 7935 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0; 7936 for (i = s1; i <= e1; i++) { 7937 const prevChild = c1[i]; 7938 if (patched >= toBePatched) { 7939 unmount(prevChild, parentComponent, parentSuspense, true); 7940 continue; 7941 } 7942 let newIndex; 7943 if (prevChild.key != null) { 7944 newIndex = keyToNewIndexMap.get(prevChild.key); 7945 } else { 7946 for (j = s2; j <= e2; j++) { 7947 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 7948 newIndex = j; 7949 break; 7950 } 7951 } 7952 } 7953 if (newIndex === void 0) { 7954 unmount(prevChild, parentComponent, parentSuspense, true); 7955 } else { 7956 newIndexToOldIndexMap[newIndex - s2] = i + 1; 7957 if (newIndex >= maxNewIndexSoFar) { 7958 maxNewIndexSoFar = newIndex; 7959 } else { 7960 moved = true; 7961 } 7962 patch( 7963 prevChild, 7964 c2[newIndex], 7965 container, 7966 null, 7967 parentComponent, 7968 parentSuspense, 7969 namespace, 7970 slotScopeIds, 7971 optimized 7972 ); 7973 patched++; 7974 } 7975 } 7976 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 7977 j = increasingNewIndexSequence.length - 1; 7978 for (i = toBePatched - 1; i >= 0; i--) { 7979 const nextIndex = s2 + i; 7980 const nextChild = c2[nextIndex]; 7981 const anchorVNode = c2[nextIndex + 1]; 7982 const anchor = nextIndex + 1 < l2 ? ( 7983 // #13559, fallback to el placeholder for unresolved async component 7984 anchorVNode.el || anchorVNode.placeholder 7985 ) : parentAnchor; 7986 if (newIndexToOldIndexMap[i] === 0) { 7987 patch( 7988 null, 7989 nextChild, 7990 container, 7991 anchor, 7992 parentComponent, 7993 parentSuspense, 7994 namespace, 7995 slotScopeIds, 7996 optimized 7997 ); 7998 } else if (moved) { 7999 if (j < 0 || i !== increasingNewIndexSequence[j]) { 8000 move(nextChild, container, anchor, 2); 8001 } else { 8002 j--; 8003 } 8004 } 8005 } 8006 } 8007 }; 8008 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 8009 const { el, type, transition, children, shapeFlag } = vnode; 8010 if (shapeFlag & 6) { 8011 move(vnode.component.subTree, container, anchor, moveType); 8012 return; 8013 } 8014 if (shapeFlag & 128) { 8015 vnode.suspense.move(container, anchor, moveType); 8016 return; 8017 } 8018 if (shapeFlag & 64) { 8019 type.move(vnode, container, anchor, internals); 8020 return; 8021 } 8022 if (type === Fragment) { 8023 hostInsert(el, container, anchor); 8024 for (let i = 0; i < children.length; i++) { 8025 move(children[i], container, anchor, moveType); 8026 } 8027 hostInsert(vnode.anchor, container, anchor); 8028 return; 8029 } 8030 if (type === Static) { 8031 moveStaticNode(vnode, container, anchor); 8032 return; 8033 } 8034 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 8035 if (needTransition2) { 8036 if (moveType === 0) { 8037 transition.beforeEnter(el); 8038 hostInsert(el, container, anchor); 8039 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 8040 } else { 8041 const { leave, delayLeave, afterLeave } = transition; 8042 const remove2 = () => { 8043 if (vnode.ctx.isUnmounted) { 8044 hostRemove(el); 8045 } else { 8046 hostInsert(el, container, anchor); 8047 } 8048 }; 8049 const performLeave = () => { 8050 if (el._isLeaving) { 8051 el[leaveCbKey]( 8052 true 8053 /* cancelled */ 8054 ); 8055 } 8056 leave(el, () => { 8057 remove2(); 8058 afterLeave && afterLeave(); 8059 }); 8060 }; 8061 if (delayLeave) { 8062 delayLeave(el, remove2, performLeave); 8063 } else { 8064 performLeave(); 8065 } 8066 } 8067 } else { 8068 hostInsert(el, container, anchor); 8069 } 8070 }; 8071 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 8072 const { 8073 type, 8074 props, 8075 ref, 8076 children, 8077 dynamicChildren, 8078 shapeFlag, 8079 patchFlag, 8080 dirs, 8081 cacheIndex 8082 } = vnode; 8083 if (patchFlag === -2) { 8084 optimized = false; 8085 } 8086 if (ref != null) { 8087 pauseTracking(); 8088 setRef(ref, null, parentSuspense, vnode, true); 8089 resetTracking(); 8090 } 8091 if (cacheIndex != null) { 8092 parentComponent.renderCache[cacheIndex] = void 0; 8093 } 8094 if (shapeFlag & 256) { 8095 parentComponent.ctx.deactivate(vnode); 8096 return; 8097 } 8098 const shouldInvokeDirs = shapeFlag & 1 && dirs; 8099 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 8100 let vnodeHook; 8101 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 8102 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8103 } 8104 if (shapeFlag & 6) { 8105 unmountComponent(vnode.component, parentSuspense, doRemove); 8106 } else { 8107 if (shapeFlag & 128) { 8108 vnode.suspense.unmount(parentSuspense, doRemove); 8109 return; 8110 } 8111 if (shouldInvokeDirs) { 8112 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8113 } 8114 if (shapeFlag & 64) { 8115 vnode.type.remove( 8116 vnode, 8117 parentComponent, 8118 parentSuspense, 8119 internals, 8120 doRemove 8121 ); 8122 } else if (dynamicChildren && // #5154 8123 // when v-once is used inside a block, setBlockTracking(-1) marks the 8124 // parent block with hasOnce: true 8125 // so that it doesn't take the fast path during unmount - otherwise 8126 // components nested in v-once are never unmounted. 8127 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 8128 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8129 unmountChildren( 8130 dynamicChildren, 8131 parentComponent, 8132 parentSuspense, 8133 false, 8134 true 8135 ); 8136 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8137 unmountChildren(children, parentComponent, parentSuspense); 8138 } 8139 if (doRemove) { 8140 remove(vnode); 8141 } 8142 } 8143 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8144 queuePostRenderEffect(() => { 8145 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8146 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8147 }, parentSuspense); 8148 } 8149 }; 8150 const remove = (vnode) => { 8151 const { type, el, anchor, transition } = vnode; 8152 if (type === Fragment) { 8153 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) { 8154 vnode.children.forEach((child) => { 8155 if (child.type === Comment) { 8156 hostRemove(child.el); 8157 } else { 8158 remove(child); 8159 } 8160 }); 8161 } else { 8162 removeFragment(el, anchor); 8163 } 8164 return; 8165 } 8166 if (type === Static) { 8167 removeStaticNode(vnode); 8168 return; 8169 } 8170 const performRemove = () => { 8171 hostRemove(el); 8172 if (transition && !transition.persisted && transition.afterLeave) { 8173 transition.afterLeave(); 8174 } 8175 }; 8176 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8177 const { leave, delayLeave } = transition; 8178 const performLeave = () => leave(el, performRemove); 8179 if (delayLeave) { 8180 delayLeave(vnode.el, performRemove, performLeave); 8181 } else { 8182 performLeave(); 8183 } 8184 } else { 8185 performRemove(); 8186 } 8187 }; 8188 const removeFragment = (cur, end) => { 8189 let next; 8190 while (cur !== end) { 8191 next = hostNextSibling(cur); 8192 hostRemove(cur); 8193 cur = next; 8194 } 8195 hostRemove(end); 8196 }; 8197 const unmountComponent = (instance, parentSuspense, doRemove) => { 8198 if (instance.type.__hmrId) { 8199 unregisterHMR(instance); 8200 } 8201 const { bum, scope, job, subTree, um, m, a } = instance; 8202 invalidateMount(m); 8203 invalidateMount(a); 8204 if (bum) { 8205 invokeArrayFns(bum); 8206 } 8207 scope.stop(); 8208 if (job) { 8209 job.flags |= 8; 8210 unmount(subTree, instance, parentSuspense, doRemove); 8211 } 8212 if (um) { 8213 queuePostRenderEffect(um, parentSuspense); 8214 } 8215 queuePostRenderEffect(() => { 8216 instance.isUnmounted = true; 8217 }, parentSuspense); 8218 { 8219 devtoolsComponentRemoved(instance); 8220 } 8221 }; 8222 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8223 for (let i = start; i < children.length; i++) { 8224 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8225 } 8226 }; 8227 const getNextHostNode = (vnode) => { 8228 if (vnode.shapeFlag & 6) { 8229 return getNextHostNode(vnode.component.subTree); 8230 } 8231 if (vnode.shapeFlag & 128) { 8232 return vnode.suspense.next(); 8233 } 8234 const el = hostNextSibling(vnode.anchor || vnode.el); 8235 const teleportEnd = el && el[TeleportEndKey]; 8236 return teleportEnd ? hostNextSibling(teleportEnd) : el; 8237 }; 8238 let isFlushing = false; 8239 const render = (vnode, container, namespace) => { 8240 if (vnode == null) { 8241 if (container._vnode) { 8242 unmount(container._vnode, null, null, true); 8243 } 8244 } else { 8245 patch( 8246 container._vnode || null, 8247 vnode, 8248 container, 8249 null, 8250 null, 8251 null, 8252 namespace 8253 ); 8254 } 8255 container._vnode = vnode; 8256 if (!isFlushing) { 8257 isFlushing = true; 8258 flushPreFlushCbs(); 8259 flushPostFlushCbs(); 8260 isFlushing = false; 8261 } 8262 }; 8263 const internals = { 8264 p: patch, 8265 um: unmount, 8266 m: move, 8267 r: remove, 8268 mt: mountComponent, 8269 mc: mountChildren, 8270 pc: patchChildren, 8271 pbc: patchBlockChildren, 8272 n: getNextHostNode, 8273 o: options 8274 }; 8275 let hydrate; 8276 let hydrateNode; 8277 if (createHydrationFns) { 8278 [hydrate, hydrateNode] = createHydrationFns( 8279 internals 8280 ); 8281 } 8282 return { 8283 render, 8284 hydrate, 8285 createApp: createAppAPI(render, hydrate) 8286 }; 8287 } 8288 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8289 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8290 } 8291 function toggleRecurse({ effect, job }, allowed) { 8292 if (allowed) { 8293 effect.flags |= 32; 8294 job.flags |= 4; 8295 } else { 8296 effect.flags &= -33; 8297 job.flags &= -5; 8298 } 8299 } 8300 function needTransition(parentSuspense, transition) { 8301 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8302 } 8303 function traverseStaticChildren(n1, n2, shallow = false) { 8304 const ch1 = n1.children; 8305 const ch2 = n2.children; 8306 if (isArray(ch1) && isArray(ch2)) { 8307 for (let i = 0; i < ch1.length; i++) { 8308 const c1 = ch1[i]; 8309 let c2 = ch2[i]; 8310 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8311 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8312 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8313 c2.el = c1.el; 8314 } 8315 if (!shallow && c2.patchFlag !== -2) 8316 traverseStaticChildren(c1, c2); 8317 } 8318 if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes 8319 c2.patchFlag !== -1) { 8320 c2.el = c1.el; 8321 } 8322 if (c2.type === Comment && !c2.el) { 8323 c2.el = c1.el; 8324 } 8325 { 8326 c2.el && (c2.el.__vnode = c2); 8327 } 8328 } 8329 } 8330 } 8331 function getSequence(arr) { 8332 const p = arr.slice(); 8333 const result = [0]; 8334 let i, j, u, v, c; 8335 const len = arr.length; 8336 for (i = 0; i < len; i++) { 8337 const arrI = arr[i]; 8338 if (arrI !== 0) { 8339 j = result[result.length - 1]; 8340 if (arr[j] < arrI) { 8341 p[i] = j; 8342 result.push(i); 8343 continue; 8344 } 8345 u = 0; 8346 v = result.length - 1; 8347 while (u < v) { 8348 c = u + v >> 1; 8349 if (arr[result[c]] < arrI) { 8350 u = c + 1; 8351 } else { 8352 v = c; 8353 } 8354 } 8355 if (arrI < arr[result[u]]) { 8356 if (u > 0) { 8357 p[i] = result[u - 1]; 8358 } 8359 result[u] = i; 8360 } 8361 } 8362 } 8363 u = result.length; 8364 v = result[u - 1]; 8365 while (u-- > 0) { 8366 result[u] = v; 8367 v = p[v]; 8368 } 8369 return result; 8370 } 8371 function locateNonHydratedAsyncRoot(instance) { 8372 const subComponent = instance.subTree.component; 8373 if (subComponent) { 8374 if (subComponent.asyncDep && !subComponent.asyncResolved) { 8375 return subComponent; 8376 } else { 8377 return locateNonHydratedAsyncRoot(subComponent); 8378 } 8379 } 8380 }
vendor: 6,556 bytes, lines 8381-8582
8381 function invalidateMount(hooks) { 8382 if (hooks) { 8383 for (let i = 0; i < hooks.length; i++) 8384 hooks[i].flags |= 8; 8385 } 8386 } 8387 8388 const ssrContextKey = Symbol.for("v-scx"); 8389 const useSSRContext = () => { 8390 { 8391 warn$1(`useSSRContext() is not supported in the global build.`); 8392 } 8393 }; 8394 8395 function watchEffect(effect, options) { 8396 return doWatch(effect, null, options); 8397 } 8398 function watchPostEffect(effect, options) { 8399 return doWatch( 8400 effect, 8401 null, 8402 extend({}, options, { flush: "post" }) 8403 ); 8404 } 8405 function watchSyncEffect(effect, options) { 8406 return doWatch( 8407 effect, 8408 null, 8409 extend({}, options, { flush: "sync" }) 8410 ); 8411 } 8412 function watch(source, cb, options) { 8413 if (!isFunction(cb)) { 8414 warn$1( 8415 `\`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.` 8416 ); 8417 } 8418 return doWatch(source, cb, options); 8419 } 8420 function doWatch(source, cb, options = EMPTY_OBJ) { 8421 const { immediate, deep, flush, once } = options; 8422 if (!cb) { 8423 if (immediate !== void 0) { 8424 warn$1( 8425 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 8426 ); 8427 } 8428 if (deep !== void 0) { 8429 warn$1( 8430 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 8431 ); 8432 } 8433 if (once !== void 0) { 8434 warn$1( 8435 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 8436 ); 8437 } 8438 } 8439 const baseWatchOptions = extend({}, options); 8440 baseWatchOptions.onWarn = warn$1; 8441 const instance = currentInstance; 8442 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 8443 let isPre = false; 8444 if (flush === "post") { 8445 baseWatchOptions.scheduler = (job) => { 8446 queuePostRenderEffect(job, instance && instance.suspense); 8447 }; 8448 } else if (flush !== "sync") { 8449 isPre = true; 8450 baseWatchOptions.scheduler = (job, isFirstRun) => { 8451 if (isFirstRun) { 8452 job(); 8453 } else { 8454 queueJob(job); 8455 } 8456 }; 8457 } 8458 baseWatchOptions.augmentJob = (job) => { 8459 if (cb) { 8460 job.flags |= 4; 8461 } 8462 if (isPre) { 8463 job.flags |= 2; 8464 if (instance) { 8465 job.id = instance.uid; 8466 job.i = instance; 8467 } 8468 } 8469 }; 8470 const watchHandle = watch$1(source, cb, baseWatchOptions); 8471 return watchHandle; 8472 } 8473 function instanceWatch(source, value, options) { 8474 const publicThis = this.proxy; 8475 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 8476 let cb; 8477 if (isFunction(value)) { 8478 cb = value; 8479 } else { 8480 cb = value.handler; 8481 options = value; 8482 } 8483 const reset = setCurrentInstance(this); 8484 const res = doWatch(getter, cb.bind(publicThis), options); 8485 reset(); 8486 return res; 8487 } 8488 function createPathGetter(ctx, path) { 8489 const segments = path.split("."); 8490 return () => { 8491 let cur = ctx; 8492 for (let i = 0; i < segments.length && cur; i++) { 8493 cur = cur[segments[i]]; 8494 } 8495 return cur; 8496 }; 8497 } 8498 8499 function useModel(props, name, options = EMPTY_OBJ) { 8500 const i = getCurrentInstance(); 8501 if (!i) { 8502 warn$1(`useModel() called without active instance.`); 8503 return ref(); 8504 } 8505 const camelizedName = camelize(name); 8506 if (!i.propsOptions[0][camelizedName]) { 8507 warn$1(`useModel() called with prop "${name}" which is not declared.`); 8508 return ref(); 8509 } 8510 const hyphenatedName = hyphenate(name); 8511 const modifiers = getModelModifiers(props, camelizedName); 8512 const res = customRef((track, trigger) => { 8513 let localValue; 8514 let prevSetValue = EMPTY_OBJ; 8515 let prevEmittedValue; 8516 watchSyncEffect(() => { 8517 const propValue = props[camelizedName]; 8518 if (hasChanged(localValue, propValue)) { 8519 localValue = propValue; 8520 trigger(); 8521 } 8522 }); 8523 return { 8524 get() { 8525 track(); 8526 return options.get ? options.get(localValue) : localValue; 8527 }, 8528 set(value) { 8529 const emittedValue = options.set ? options.set(value) : value; 8530 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) { 8531 return; 8532 } 8533 const rawProps = i.vnode.props; 8534 if (!(rawProps && // check if parent has passed v-model 8535 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) { 8536 localValue = value; 8537 trigger(); 8538 } 8539 i.emit(`update:${name}`, emittedValue); 8540 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) { 8541 trigger(); 8542 } 8543 prevSetValue = value; 8544 prevEmittedValue = emittedValue; 8545 } 8546 }; 8547 }); 8548 res[Symbol.iterator] = () => { 8549 let i2 = 0; 8550 return { 8551 next() { 8552 if (i2 < 2) { 8553 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false }; 8554 } else { 8555 return { done: true }; 8556 } 8557 } 8558 }; 8559 }; 8560 return res; 8561 } 8562 const getModelModifiers = (props, modelName) => { 8563 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 8564 }; 8565 8566 function emit(instance, event, ...rawArgs) { 8567 if (instance.isUnmounted) return; 8568 const props = instance.vnode.props || EMPTY_OBJ; 8569 { 8570 const { 8571 emitsOptions, 8572 propsOptions: [propsOptions] 8573 } = instance; 8574 if (emitsOptions) { 8575 if (!(event in emitsOptions) && true) { 8576 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) { 8577 warn$1( 8578 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.` 8579 ); 8580 } 8581 } else { 8582 const validator = emitsOptions[event];
vendor: 21,797 bytes, lines 8583-9318
8583 if (isFunction(validator)) { 8584 const isValid = validator(...rawArgs); 8585 if (!isValid) { 8586 warn$1( 8587 `Invalid event arguments: event validation failed for event "${event}".` 8588 ); 8589 } 8590 } 8591 } 8592 } 8593 } 8594 let args = rawArgs; 8595 const isModelListener = event.startsWith("update:"); 8596 const modifiers = isModelListener && getModelModifiers(props, event.slice(7)); 8597 if (modifiers) { 8598 if (modifiers.trim) { 8599 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 8600 } 8601 if (modifiers.number) { 8602 args = rawArgs.map(looseToNumber); 8603 } 8604 } 8605 { 8606 devtoolsComponentEmit(instance, event, args); 8607 } 8608 { 8609 const lowerCaseEvent = event.toLowerCase(); 8610 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 8611 warn$1( 8612 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 8613 instance, 8614 instance.type 8615 )} 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( 8616 event 8617 )}" instead of "${event}".` 8618 ); 8619 } 8620 } 8621 let handlerName; 8622 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 8623 props[handlerName = toHandlerKey(camelize(event))]; 8624 if (!handler && isModelListener) { 8625 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 8626 } 8627 if (handler) { 8628 callWithAsyncErrorHandling( 8629 handler, 8630 instance, 8631 6, 8632 args 8633 ); 8634 } 8635 const onceHandler = props[handlerName + `Once`]; 8636 if (onceHandler) { 8637 if (!instance.emitted) { 8638 instance.emitted = {}; 8639 } else if (instance.emitted[handlerName]) { 8640 return; 8641 } 8642 instance.emitted[handlerName] = true; 8643 callWithAsyncErrorHandling( 8644 onceHandler, 8645 instance, 8646 6, 8647 args 8648 ); 8649 } 8650 } 8651 const mixinEmitsCache = /* @__PURE__ */ new WeakMap(); 8652 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 8653 const cache = asMixin ? mixinEmitsCache : appContext.emitsCache; 8654 const cached = cache.get(comp); 8655 if (cached !== void 0) { 8656 return cached; 8657 } 8658 const raw = comp.emits; 8659 let normalized = {}; 8660 let hasExtends = false; 8661 if (!isFunction(comp)) { 8662 const extendEmits = (raw2) => { 8663 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 8664 if (normalizedFromExtend) { 8665 hasExtends = true; 8666 extend(normalized, normalizedFromExtend); 8667 } 8668 }; 8669 if (!asMixin && appContext.mixins.length) { 8670 appContext.mixins.forEach(extendEmits); 8671 } 8672 if (comp.extends) { 8673 extendEmits(comp.extends); 8674 } 8675 if (comp.mixins) { 8676 comp.mixins.forEach(extendEmits); 8677 } 8678 } 8679 if (!raw && !hasExtends) { 8680 if (isObject(comp)) { 8681 cache.set(comp, null); 8682 } 8683 return null; 8684 } 8685 if (isArray(raw)) { 8686 raw.forEach((key) => normalized[key] = null); 8687 } else { 8688 extend(normalized, raw); 8689 } 8690 if (isObject(comp)) { 8691 cache.set(comp, normalized); 8692 } 8693 return normalized; 8694 } 8695 function isEmitListener(options, key) { 8696 if (!options || !isOn(key)) { 8697 return false; 8698 } 8699 key = key.slice(2).replace(/Once$/, ""); 8700 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 8701 } 8702 8703 let accessedAttrs = false; 8704 function markAttrsAccessed() { 8705 accessedAttrs = true; 8706 } 8707 function renderComponentRoot(instance) { 8708 const { 8709 type: Component, 8710 vnode, 8711 proxy, 8712 withProxy, 8713 propsOptions: [propsOptions], 8714 slots, 8715 attrs, 8716 emit, 8717 render, 8718 renderCache, 8719 props, 8720 data, 8721 setupState, 8722 ctx, 8723 inheritAttrs 8724 } = instance; 8725 const prev = setCurrentRenderingInstance(instance); 8726 let result; 8727 let fallthroughAttrs; 8728 { 8729 accessedAttrs = false; 8730 } 8731 try { 8732 if (vnode.shapeFlag & 4) { 8733 const proxyToUse = withProxy || proxy; 8734 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 8735 get(target, key, receiver) { 8736 warn$1( 8737 `Property '${String( 8738 key 8739 )}' was accessed via 'this'. Avoid using 'this' in templates.` 8740 ); 8741 return Reflect.get(target, key, receiver); 8742 } 8743 }) : proxyToUse; 8744 result = normalizeVNode( 8745 render.call( 8746 thisProxy, 8747 proxyToUse, 8748 renderCache, 8749 true ? shallowReadonly(props) : props, 8750 setupState, 8751 data, 8752 ctx 8753 ) 8754 ); 8755 fallthroughAttrs = attrs; 8756 } else { 8757 const render2 = Component; 8758 if (attrs === props) { 8759 markAttrsAccessed(); 8760 } 8761 result = normalizeVNode( 8762 render2.length > 1 ? render2( 8763 true ? shallowReadonly(props) : props, 8764 true ? { 8765 get attrs() { 8766 markAttrsAccessed(); 8767 return shallowReadonly(attrs); 8768 }, 8769 slots, 8770 emit 8771 } : { attrs, slots, emit } 8772 ) : render2( 8773 true ? shallowReadonly(props) : props, 8774 null 8775 ) 8776 ); 8777 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 8778 } 8779 } catch (err) { 8780 blockStack.length = 0; 8781 handleError(err, instance, 1); 8782 result = createVNode(Comment); 8783 } 8784 let root = result; 8785 let setRoot = void 0; 8786 if (result.patchFlag > 0 && result.patchFlag & 2048) { 8787 [root, setRoot] = getChildRoot(result); 8788 } 8789 if (fallthroughAttrs && inheritAttrs !== false) { 8790 const keys = Object.keys(fallthroughAttrs); 8791 const { shapeFlag } = root; 8792 if (keys.length) { 8793 if (shapeFlag & (1 | 6)) { 8794 if (propsOptions && keys.some(isModelListener)) { 8795 fallthroughAttrs = filterModelListeners( 8796 fallthroughAttrs, 8797 propsOptions 8798 ); 8799 } 8800 root = cloneVNode(root, fallthroughAttrs, false, true); 8801 } else if (!accessedAttrs && root.type !== Comment) { 8802 const allAttrs = Object.keys(attrs); 8803 const eventAttrs = []; 8804 const extraAttrs = []; 8805 for (let i = 0, l = allAttrs.length; i < l; i++) { 8806 const key = allAttrs[i]; 8807 if (isOn(key)) { 8808 if (!isModelListener(key)) { 8809 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 8810 } 8811 } else { 8812 extraAttrs.push(key); 8813 } 8814 } 8815 if (extraAttrs.length) { 8816 warn$1( 8817 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.` 8818 ); 8819 } 8820 if (eventAttrs.length) { 8821 warn$1( 8822 `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.` 8823 ); 8824 } 8825 } 8826 } 8827 } 8828 if (vnode.dirs) { 8829 if (!isElementRoot(root)) { 8830 warn$1( 8831 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 8832 ); 8833 } 8834 root = cloneVNode(root, null, false, true); 8835 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 8836 } 8837 if (vnode.transition) { 8838 if (!isElementRoot(root)) { 8839 warn$1( 8840 `Component inside <Transition> renders non-element root node that cannot be animated.` 8841 ); 8842 } 8843 setTransitionHooks(root, vnode.transition); 8844 } 8845 if (setRoot) { 8846 setRoot(root); 8847 } else { 8848 result = root; 8849 } 8850 setCurrentRenderingInstance(prev); 8851 return result; 8852 } 8853 const getChildRoot = (vnode) => { 8854 const rawChildren = vnode.children; 8855 const dynamicChildren = vnode.dynamicChildren; 8856 const childRoot = filterSingleRoot(rawChildren, false); 8857 if (!childRoot) { 8858 return [vnode, void 0]; 8859 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 8860 return getChildRoot(childRoot); 8861 } 8862 const index = rawChildren.indexOf(childRoot); 8863 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 8864 const setRoot = (updatedRoot) => { 8865 rawChildren[index] = updatedRoot; 8866 if (dynamicChildren) { 8867 if (dynamicIndex > -1) { 8868 dynamicChildren[dynamicIndex] = updatedRoot; 8869 } else if (updatedRoot.patchFlag > 0) { 8870 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 8871 } 8872 } 8873 }; 8874 return [normalizeVNode(childRoot), setRoot]; 8875 }; 8876 function filterSingleRoot(children, recurse = true) { 8877 let singleRoot; 8878 for (let i = 0; i < children.length; i++) { 8879 const child = children[i]; 8880 if (isVNode(child)) { 8881 if (child.type !== Comment || child.children === "v-if") { 8882 if (singleRoot) { 8883 return; 8884 } else { 8885 singleRoot = child; 8886 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 8887 return filterSingleRoot(singleRoot.children); 8888 } 8889 } 8890 } 8891 } else { 8892 return; 8893 } 8894 } 8895 return singleRoot; 8896 } 8897 const getFunctionalFallthrough = (attrs) => { 8898 let res; 8899 for (const key in attrs) { 8900 if (key === "class" || key === "style" || isOn(key)) { 8901 (res || (res = {}))[key] = attrs[key]; 8902 } 8903 } 8904 return res; 8905 }; 8906 const filterModelListeners = (attrs, props) => { 8907 const res = {}; 8908 for (const key in attrs) { 8909 if (!isModelListener(key) || !(key.slice(9) in props)) { 8910 res[key] = attrs[key]; 8911 } 8912 } 8913 return res; 8914 }; 8915 const isElementRoot = (vnode) => { 8916 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 8917 }; 8918 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 8919 const { props: prevProps, children: prevChildren, component } = prevVNode; 8920 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 8921 const emits = component.emitsOptions; 8922 if ((prevChildren || nextChildren) && isHmrUpdating) { 8923 return true; 8924 } 8925 if (nextVNode.dirs || nextVNode.transition) { 8926 return true; 8927 } 8928 if (optimized && patchFlag >= 0) { 8929 if (patchFlag & 1024) { 8930 return true; 8931 } 8932 if (patchFlag & 16) { 8933 if (!prevProps) { 8934 return !!nextProps; 8935 } 8936 return hasPropsChanged(prevProps, nextProps, emits); 8937 } else if (patchFlag & 8) { 8938 const dynamicProps = nextVNode.dynamicProps; 8939 for (let i = 0; i < dynamicProps.length; i++) { 8940 const key = dynamicProps[i]; 8941 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 8942 return true; 8943 } 8944 } 8945 } 8946 } else { 8947 if (prevChildren || nextChildren) { 8948 if (!nextChildren || !nextChildren.$stable) { 8949 return true; 8950 } 8951 } 8952 if (prevProps === nextProps) { 8953 return false; 8954 } 8955 if (!prevProps) { 8956 return !!nextProps; 8957 } 8958 if (!nextProps) { 8959 return true; 8960 } 8961 return hasPropsChanged(prevProps, nextProps, emits); 8962 } 8963 return false; 8964 } 8965 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 8966 const nextKeys = Object.keys(nextProps); 8967 if (nextKeys.length !== Object.keys(prevProps).length) { 8968 return true; 8969 } 8970 for (let i = 0; i < nextKeys.length; i++) { 8971 const key = nextKeys[i]; 8972 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 8973 return true; 8974 } 8975 } 8976 return false; 8977 } 8978 function updateHOCHostEl({ vnode, parent }, el) { 8979 while (parent) { 8980 const root = parent.subTree; 8981 if (root.suspense && root.suspense.activeBranch === vnode) { 8982 root.el = vnode.el; 8983 } 8984 if (root === vnode) { 8985 (vnode = parent.vnode).el = el; 8986 parent = parent.parent; 8987 } else { 8988 break; 8989 } 8990 } 8991 } 8992 8993 const isSuspense = (type) => type.__isSuspense; 8994 let suspenseId = 0; 8995 const SuspenseImpl = { 8996 name: "Suspense", 8997 // In order to make Suspense tree-shakable, we need to avoid importing it 8998 // directly in the renderer. The renderer checks for the __isSuspense flag 8999 // on a vnode's type and calls the `process` method, passing in renderer 9000 // internals. 9001 __isSuspense: true, 9002 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9003 if (n1 == null) { 9004 mountSuspense( 9005 n2, 9006 container, 9007 anchor, 9008 parentComponent, 9009 parentSuspense, 9010 namespace, 9011 slotScopeIds, 9012 optimized, 9013 rendererInternals 9014 ); 9015 } else { 9016 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 9017 n2.suspense = n1.suspense; 9018 n2.suspense.vnode = n2; 9019 n2.el = n1.el; 9020 return; 9021 } 9022 patchSuspense( 9023 n1, 9024 n2, 9025 container, 9026 anchor, 9027 parentComponent, 9028 namespace, 9029 slotScopeIds, 9030 optimized, 9031 rendererInternals 9032 ); 9033 } 9034 }, 9035 hydrate: hydrateSuspense, 9036 normalize: normalizeSuspenseChildren 9037 }; 9038 const Suspense = SuspenseImpl ; 9039 function triggerEvent(vnode, name) { 9040 const eventListener = vnode.props && vnode.props[name]; 9041 if (isFunction(eventListener)) { 9042 eventListener(); 9043 } 9044 } 9045 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9046 const { 9047 p: patch, 9048 o: { createElement } 9049 } = rendererInternals; 9050 const hiddenContainer = createElement("div"); 9051 const suspense = vnode.suspense = createSuspenseBoundary( 9052 vnode, 9053 parentSuspense, 9054 parentComponent, 9055 container, 9056 hiddenContainer, 9057 anchor, 9058 namespace, 9059 slotScopeIds, 9060 optimized, 9061 rendererInternals 9062 ); 9063 patch( 9064 null, 9065 suspense.pendingBranch = vnode.ssContent, 9066 hiddenContainer, 9067 null, 9068 parentComponent, 9069 suspense, 9070 namespace, 9071 slotScopeIds 9072 ); 9073 if (suspense.deps > 0) { 9074 triggerEvent(vnode, "onPending"); 9075 triggerEvent(vnode, "onFallback"); 9076 patch( 9077 null, 9078 vnode.ssFallback, 9079 container, 9080 anchor, 9081 parentComponent, 9082 null, 9083 // fallback tree will not have suspense context 9084 namespace, 9085 slotScopeIds 9086 ); 9087 setActiveBranch(suspense, vnode.ssFallback); 9088 } else { 9089 suspense.resolve(false, true); 9090 } 9091 } 9092 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 9093 const suspense = n2.suspense = n1.suspense; 9094 suspense.vnode = n2; 9095 n2.el = n1.el; 9096 const newBranch = n2.ssContent; 9097 const newFallback = n2.ssFallback; 9098 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 9099 if (pendingBranch) { 9100 suspense.pendingBranch = newBranch; 9101 if (isSameVNodeType(pendingBranch, newBranch)) { 9102 patch( 9103 pendingBranch, 9104 newBranch, 9105 suspense.hiddenContainer, 9106 null, 9107 parentComponent, 9108 suspense, 9109 namespace, 9110 slotScopeIds, 9111 optimized 9112 ); 9113 if (suspense.deps <= 0) { 9114 suspense.resolve(); 9115 } else if (isInFallback) { 9116 if (!isHydrating) { 9117 patch( 9118 activeBranch, 9119 newFallback, 9120 container, 9121 anchor, 9122 parentComponent, 9123 null, 9124 // fallback tree will not have suspense context 9125 namespace, 9126 slotScopeIds, 9127 optimized 9128 ); 9129 setActiveBranch(suspense, newFallback); 9130 } 9131 } 9132 } else { 9133 suspense.pendingId = suspenseId++; 9134 if (isHydrating) { 9135 suspense.isHydrating = false; 9136 suspense.activeBranch = pendingBranch; 9137 } else { 9138 unmount(pendingBranch, parentComponent, suspense); 9139 } 9140 suspense.deps = 0; 9141 suspense.effects.length = 0; 9142 suspense.hiddenContainer = createElement("div"); 9143 if (isInFallback) { 9144 patch( 9145 null, 9146 newBranch, 9147 suspense.hiddenContainer, 9148 null, 9149 parentComponent, 9150 suspense, 9151 namespace, 9152 slotScopeIds, 9153 optimized 9154 ); 9155 if (suspense.deps <= 0) { 9156 suspense.resolve(); 9157 } else { 9158 patch( 9159 activeBranch, 9160 newFallback, 9161 container, 9162 anchor, 9163 parentComponent, 9164 null, 9165 // fallback tree will not have suspense context 9166 namespace, 9167 slotScopeIds, 9168 optimized 9169 ); 9170 setActiveBranch(suspense, newFallback); 9171 } 9172 } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9173 patch( 9174 activeBranch, 9175 newBranch, 9176 container, 9177 anchor, 9178 parentComponent, 9179 suspense, 9180 namespace, 9181 slotScopeIds, 9182 optimized 9183 ); 9184 suspense.resolve(true); 9185 } else { 9186 patch( 9187 null, 9188 newBranch, 9189 suspense.hiddenContainer, 9190 null, 9191 parentComponent, 9192 suspense, 9193 namespace, 9194 slotScopeIds, 9195 optimized 9196 ); 9197 if (suspense.deps <= 0) { 9198 suspense.resolve(); 9199 } 9200 } 9201 } 9202 } else { 9203 if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9204 patch( 9205 activeBranch, 9206 newBranch, 9207 container, 9208 anchor, 9209 parentComponent, 9210 suspense, 9211 namespace, 9212 slotScopeIds, 9213 optimized 9214 ); 9215 setActiveBranch(suspense, newBranch); 9216 } else { 9217 triggerEvent(n2, "onPending"); 9218 suspense.pendingBranch = newBranch; 9219 if (newBranch.shapeFlag & 512) { 9220 suspense.pendingId = newBranch.component.suspenseId; 9221 } else { 9222 suspense.pendingId = suspenseId++; 9223 } 9224 patch( 9225 null, 9226 newBranch, 9227 suspense.hiddenContainer, 9228 null, 9229 parentComponent, 9230 suspense, 9231 namespace, 9232 slotScopeIds, 9233 optimized 9234 ); 9235 if (suspense.deps <= 0) { 9236 suspense.resolve(); 9237 } else { 9238 const { timeout, pendingId } = suspense; 9239 if (timeout > 0) { 9240 setTimeout(() => { 9241 if (suspense.pendingId === pendingId) { 9242 suspense.fallback(newFallback); 9243 } 9244 }, timeout); 9245 } else if (timeout === 0) { 9246 suspense.fallback(newFallback); 9247 } 9248 } 9249 } 9250 } 9251 } 9252 let hasWarned = false; 9253 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 9254 if (!hasWarned) { 9255 hasWarned = true; 9256 console[console.info ? "info" : "log"]( 9257 `<Suspense> is an experimental feature and its API will likely change.` 9258 ); 9259 } 9260 const { 9261 p: patch, 9262 m: move, 9263 um: unmount, 9264 n: next, 9265 o: { parentNode, remove } 9266 } = rendererInternals; 9267 let parentSuspenseId; 9268 const isSuspensible = isVNodeSuspensible(vnode); 9269 if (isSuspensible) { 9270 if (parentSuspense && parentSuspense.pendingBranch) { 9271 parentSuspenseId = parentSuspense.pendingId; 9272 parentSuspense.deps++; 9273 } 9274 } 9275 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 9276 { 9277 assertNumber(timeout, `Suspense timeout`); 9278 } 9279 const initialAnchor = anchor; 9280 const suspense = { 9281 vnode, 9282 parent: parentSuspense, 9283 parentComponent, 9284 namespace, 9285 container, 9286 hiddenContainer, 9287 deps: 0, 9288 pendingId: suspenseId++, 9289 timeout: typeof timeout === "number" ? timeout : -1, 9290 activeBranch: null, 9291 pendingBranch: null, 9292 isInFallback: !isHydrating, 9293 isHydrating, 9294 isUnmounted: false, 9295 effects: [], 9296 resolve(resume = false, sync = false) { 9297 { 9298 if (!resume && !suspense.pendingBranch) { 9299 throw new Error( 9300 `suspense.resolve() is called without a pending branch.` 9301 ); 9302 } 9303 if (suspense.isUnmounted) { 9304 throw new Error( 9305 `suspense.resolve() is called on an already unmounted suspense boundary.` 9306 ); 9307 } 9308 } 9309 const { 9310 vnode: vnode2, 9311 activeBranch, 9312 pendingBranch, 9313 pendingId, 9314 effects, 9315 parentComponent: parentComponent2, 9316 container: container2 9317 } = suspense; 9318 let delayEnter = false;
9319 if (suspense.isHydrating) { 9320 suspense.isHydrating = false; 9321 } else if (!resume) { 9322 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 9323 if (delayEnter) { 9324 activeBranch.transition.afterLeave = () => { 9325 if (pendingId === suspense.pendingId) { 9326 move( 9327 pendingBranch, 9328 container2, 9329 anchor === initialAnchor ? next(activeBranch) : anchor, 9330 0 9331 ); 9332 queuePostFlushCb(effects); 9333 } 9334 }; 9335 } 9336 if (activeBranch) { 9337 if (parentNode(activeBranch.el) === container2) { 9338 anchor = next(activeBranch); 9339 } 9340 unmount(activeBranch, parentComponent2, suspense, true); 9341 } 9342 if (!delayEnter) { 9343 move(pendingBranch, container2, anchor, 0); 9344 } 9345 } 9346 setActiveBranch(suspense, pendingBranch); 9347 suspense.pendingBranch = null; 9348 suspense.isInFallback = false; 9349 let parent = suspense.parent; 9350 let hasUnresolvedAncestor = false; 9351 while (parent) { 9352 if (parent.pendingBranch) { 9353 parent.effects.push(...effects); 9354 hasUnresolvedAncestor = true; 9355 break; 9356 } 9357 parent = parent.parent; 9358 } 9359 if (!hasUnresolvedAncestor && !delayEnter) { 9360 queuePostFlushCb(effects); 9361 } 9362 suspense.effects = []; 9363 if (isSuspensible) { 9364 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 9365 parentSuspense.deps--; 9366 if (parentSuspense.deps === 0 && !sync) { 9367 parentSuspense.resolve(); 9368 } 9369 } 9370 } 9371 triggerEvent(vnode2, "onResolve"); 9372 }, 9373 fallback(fallbackVNode) { 9374 if (!suspense.pendingBranch) { 9375 return; 9376 } 9377 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 9378 triggerEvent(vnode2, "onFallback"); 9379 const anchor2 = next(activeBranch); 9380 const mountFallback = () => { 9381 if (!suspense.isInFallback) { 9382 return; 9383 } 9384 patch( 9385 null, 9386 fallbackVNode, 9387 container2, 9388 anchor2, 9389 parentComponent2, 9390 null, 9391 // fallback tree will not have suspense context 9392 namespace2, 9393 slotScopeIds, 9394 optimized 9395 );
vendor: 18,153 bytes, lines 9396-9950
9396 setActiveBranch(suspense, fallbackVNode); 9397 }; 9398 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 9399 if (delayEnter) { 9400 activeBranch.transition.afterLeave = mountFallback; 9401 } 9402 suspense.isInFallback = true; 9403 unmount( 9404 activeBranch, 9405 parentComponent2, 9406 null, 9407 // no suspense so unmount hooks fire now 9408 true 9409 // shouldRemove 9410 ); 9411 if (!delayEnter) { 9412 mountFallback(); 9413 } 9414 }, 9415 move(container2, anchor2, type) { 9416 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 9417 suspense.container = container2; 9418 }, 9419 next() { 9420 return suspense.activeBranch && next(suspense.activeBranch); 9421 }, 9422 registerDep(instance, setupRenderEffect, optimized2) { 9423 const isInPendingSuspense = !!suspense.pendingBranch; 9424 if (isInPendingSuspense) { 9425 suspense.deps++; 9426 } 9427 const hydratedEl = instance.vnode.el; 9428 instance.asyncDep.catch((err) => { 9429 handleError(err, instance, 0); 9430 }).then((asyncSetupResult) => { 9431 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 9432 return; 9433 } 9434 instance.asyncResolved = true; 9435 const { vnode: vnode2 } = instance; 9436 { 9437 pushWarningContext(vnode2); 9438 } 9439 handleSetupResult(instance, asyncSetupResult, false); 9440 if (hydratedEl) { 9441 vnode2.el = hydratedEl; 9442 } 9443 const placeholder = !hydratedEl && instance.subTree.el; 9444 setupRenderEffect( 9445 instance, 9446 vnode2, 9447 // component may have been moved before resolve. 9448 // if this is not a hydration, instance.subTree will be the comment 9449 // placeholder. 9450 parentNode(hydratedEl || instance.subTree.el), 9451 // anchor will not be used if this is hydration, so only need to 9452 // consider the comment placeholder case. 9453 hydratedEl ? null : next(instance.subTree), 9454 suspense, 9455 namespace, 9456 optimized2 9457 ); 9458 if (placeholder) { 9459 remove(placeholder); 9460 } 9461 updateHOCHostEl(instance, vnode2.el); 9462 { 9463 popWarningContext(); 9464 } 9465 if (isInPendingSuspense && --suspense.deps === 0) { 9466 suspense.resolve(); 9467 } 9468 }); 9469 }, 9470 unmount(parentSuspense2, doRemove) { 9471 suspense.isUnmounted = true; 9472 if (suspense.activeBranch) { 9473 unmount( 9474 suspense.activeBranch, 9475 parentComponent, 9476 parentSuspense2, 9477 doRemove 9478 ); 9479 } 9480 if (suspense.pendingBranch) { 9481 unmount( 9482 suspense.pendingBranch, 9483 parentComponent, 9484 parentSuspense2, 9485 doRemove 9486 ); 9487 } 9488 } 9489 }; 9490 return suspense; 9491 } 9492 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 9493 const suspense = vnode.suspense = createSuspenseBoundary( 9494 vnode, 9495 parentSuspense, 9496 parentComponent, 9497 node.parentNode, 9498 // eslint-disable-next-line no-restricted-globals 9499 document.createElement("div"), 9500 null, 9501 namespace, 9502 slotScopeIds, 9503 optimized, 9504 rendererInternals, 9505 true 9506 ); 9507 const result = hydrateNode( 9508 node, 9509 suspense.pendingBranch = vnode.ssContent, 9510 parentComponent, 9511 suspense, 9512 slotScopeIds, 9513 optimized 9514 ); 9515 if (suspense.deps === 0) { 9516 suspense.resolve(false, true); 9517 } 9518 return result; 9519 } 9520 function normalizeSuspenseChildren(vnode) { 9521 const { shapeFlag, children } = vnode; 9522 const isSlotChildren = shapeFlag & 32; 9523 vnode.ssContent = normalizeSuspenseSlot( 9524 isSlotChildren ? children.default : children 9525 ); 9526 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 9527 } 9528 function normalizeSuspenseSlot(s) { 9529 let block; 9530 if (isFunction(s)) { 9531 const trackBlock = isBlockTreeEnabled && s._c; 9532 if (trackBlock) { 9533 s._d = false; 9534 openBlock(); 9535 } 9536 s = s(); 9537 if (trackBlock) { 9538 s._d = true; 9539 block = currentBlock; 9540 closeBlock(); 9541 } 9542 } 9543 if (isArray(s)) { 9544 const singleChild = filterSingleRoot(s); 9545 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 9546 warn$1(`<Suspense> slots expect a single root node.`); 9547 } 9548 s = singleChild; 9549 } 9550 s = normalizeVNode(s); 9551 if (block && !s.dynamicChildren) { 9552 s.dynamicChildren = block.filter((c) => c !== s); 9553 } 9554 return s; 9555 } 9556 function queueEffectWithSuspense(fn, suspense) { 9557 if (suspense && suspense.pendingBranch) { 9558 if (isArray(fn)) { 9559 suspense.effects.push(...fn); 9560 } else { 9561 suspense.effects.push(fn); 9562 } 9563 } else { 9564 queuePostFlushCb(fn); 9565 } 9566 } 9567 function setActiveBranch(suspense, branch) { 9568 suspense.activeBranch = branch; 9569 const { vnode, parentComponent } = suspense; 9570 let el = branch.el; 9571 while (!el && branch.component) { 9572 branch = branch.component.subTree; 9573 el = branch.el; 9574 } 9575 vnode.el = el; 9576 if (parentComponent && parentComponent.subTree === vnode) { 9577 parentComponent.vnode.el = el; 9578 updateHOCHostEl(parentComponent, el); 9579 } 9580 } 9581 function isVNodeSuspensible(vnode) { 9582 const suspensible = vnode.props && vnode.props.suspensible; 9583 return suspensible != null && suspensible !== false; 9584 } 9585 9586 const Fragment = Symbol.for("v-fgt"); 9587 const Text = Symbol.for("v-txt"); 9588 const Comment = Symbol.for("v-cmt"); 9589 const Static = Symbol.for("v-stc"); 9590 const blockStack = []; 9591 let currentBlock = null; 9592 function openBlock(disableTracking = false) { 9593 blockStack.push(currentBlock = disableTracking ? null : []); 9594 } 9595 function closeBlock() { 9596 blockStack.pop(); 9597 currentBlock = blockStack[blockStack.length - 1] || null; 9598 } 9599 let isBlockTreeEnabled = 1; 9600 function setBlockTracking(value, inVOnce = false) { 9601 isBlockTreeEnabled += value; 9602 if (value < 0 && currentBlock && inVOnce) { 9603 currentBlock.hasOnce = true; 9604 } 9605 } 9606 function setupBlock(vnode) { 9607 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 9608 closeBlock(); 9609 if (isBlockTreeEnabled > 0 && currentBlock) { 9610 currentBlock.push(vnode); 9611 } 9612 return vnode; 9613 } 9614 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 9615 return setupBlock( 9616 createBaseVNode( 9617 type, 9618 props, 9619 children, 9620 patchFlag, 9621 dynamicProps, 9622 shapeFlag, 9623 true 9624 ) 9625 ); 9626 } 9627 function createBlock(type, props, children, patchFlag, dynamicProps) { 9628 return setupBlock( 9629 createVNode( 9630 type, 9631 props, 9632 children, 9633 patchFlag, 9634 dynamicProps, 9635 true 9636 ) 9637 ); 9638 } 9639 function isVNode(value) { 9640 return value ? value.__v_isVNode === true : false; 9641 } 9642 function isSameVNodeType(n1, n2) { 9643 if (n2.shapeFlag & 6 && n1.component) { 9644 const dirtyInstances = hmrDirtyComponents.get(n2.type); 9645 if (dirtyInstances && dirtyInstances.has(n1.component)) { 9646 n1.shapeFlag &= -257; 9647 n2.shapeFlag &= -513; 9648 return false; 9649 } 9650 } 9651 return n1.type === n2.type && n1.key === n2.key; 9652 } 9653 let vnodeArgsTransformer; 9654 function transformVNodeArgs(transformer) { 9655 vnodeArgsTransformer = transformer; 9656 } 9657 const createVNodeWithArgsTransform = (...args) => { 9658 return _createVNode( 9659 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 9660 ); 9661 }; 9662 const normalizeKey = ({ key }) => key != null ? key : null; 9663 const normalizeRef = ({ 9664 ref, 9665 ref_key, 9666 ref_for 9667 }) => { 9668 if (typeof ref === "number") { 9669 ref = "" + ref; 9670 } 9671 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 9672 }; 9673 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 9674 const vnode = { 9675 __v_isVNode: true, 9676 __v_skip: true, 9677 type, 9678 props, 9679 key: props && normalizeKey(props), 9680 ref: props && normalizeRef(props), 9681 scopeId: currentScopeId, 9682 slotScopeIds: null, 9683 children, 9684 component: null, 9685 suspense: null, 9686 ssContent: null, 9687 ssFallback: null, 9688 dirs: null, 9689 transition: null, 9690 el: null, 9691 anchor: null, 9692 target: null, 9693 targetStart: null, 9694 targetAnchor: null, 9695 staticCount: 0, 9696 shapeFlag, 9697 patchFlag, 9698 dynamicProps, 9699 dynamicChildren: null, 9700 appContext: null, 9701 ctx: currentRenderingInstance 9702 }; 9703 if (needFullChildrenNormalization) { 9704 normalizeChildren(vnode, children); 9705 if (shapeFlag & 128) { 9706 type.normalize(vnode); 9707 } 9708 } else if (children) { 9709 vnode.shapeFlag |= isString(children) ? 8 : 16; 9710 } 9711 if (vnode.key !== vnode.key) { 9712 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 9713 } 9714 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 9715 !isBlockNode && // has current parent block 9716 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 9717 // component nodes also should always be patched, because even if the 9718 // component doesn't need to update, it needs to persist the instance on to 9719 // the next vnode so that it can be properly unmounted later. 9720 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 9721 // vnode should not be considered dynamic due to handler caching. 9722 vnode.patchFlag !== 32) { 9723 currentBlock.push(vnode); 9724 } 9725 return vnode; 9726 } 9727 const createVNode = createVNodeWithArgsTransform ; 9728 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 9729 if (!type || type === NULL_DYNAMIC_COMPONENT) { 9730 if (!type) { 9731 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 9732 } 9733 type = Comment; 9734 } 9735 if (isVNode(type)) { 9736 const cloned = cloneVNode( 9737 type, 9738 props, 9739 true 9740 /* mergeRef: true */ 9741 ); 9742 if (children) { 9743 normalizeChildren(cloned, children); 9744 } 9745 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 9746 if (cloned.shapeFlag & 6) { 9747 currentBlock[currentBlock.indexOf(type)] = cloned; 9748 } else { 9749 currentBlock.push(cloned); 9750 } 9751 } 9752 cloned.patchFlag = -2; 9753 return cloned; 9754 } 9755 if (isClassComponent(type)) { 9756 type = type.__vccOpts; 9757 } 9758 if (props) { 9759 props = guardReactiveProps(props); 9760 let { class: klass, style } = props; 9761 if (klass && !isString(klass)) { 9762 props.class = normalizeClass(klass); 9763 } 9764 if (isObject(style)) { 9765 if (isProxy(style) && !isArray(style)) { 9766 style = extend({}, style); 9767 } 9768 props.style = normalizeStyle(style); 9769 } 9770 } 9771 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 9772 if (shapeFlag & 4 && isProxy(type)) { 9773 type = toRaw(type); 9774 warn$1( 9775 `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\`.`, 9776 ` 9777Component that was made reactive: `, 9778 type 9779 ); 9780 } 9781 return createBaseVNode( 9782 type, 9783 props, 9784 children, 9785 patchFlag, 9786 dynamicProps, 9787 shapeFlag, 9788 isBlockNode, 9789 true 9790 ); 9791 } 9792 function guardReactiveProps(props) { 9793 if (!props) return null; 9794 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 9795 } 9796 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 9797 const { props, ref, patchFlag, children, transition } = vnode; 9798 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 9799 const cloned = { 9800 __v_isVNode: true, 9801 __v_skip: true, 9802 type: vnode.type, 9803 props: mergedProps, 9804 key: mergedProps && normalizeKey(mergedProps), 9805 ref: extraProps && extraProps.ref ? ( 9806 // #2078 in the case of <component :is="vnode" ref="extra"/> 9807 // if the vnode itself already has a ref, cloneVNode will need to merge 9808 // the refs so the single vnode can be set on multiple refs 9809 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 9810 ) : ref, 9811 scopeId: vnode.scopeId, 9812 slotScopeIds: vnode.slotScopeIds, 9813 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 9814 target: vnode.target, 9815 targetStart: vnode.targetStart, 9816 targetAnchor: vnode.targetAnchor, 9817 staticCount: vnode.staticCount, 9818 shapeFlag: vnode.shapeFlag, 9819 // if the vnode is cloned with extra props, we can no longer assume its 9820 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 9821 // note: preserve flag for fragments since they use the flag for children 9822 // fast paths only. 9823 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 9824 dynamicProps: vnode.dynamicProps, 9825 dynamicChildren: vnode.dynamicChildren, 9826 appContext: vnode.appContext, 9827 dirs: vnode.dirs, 9828 transition, 9829 // These should technically only be non-null on mounted VNodes. However, 9830 // they *should* be copied for kept-alive vnodes. So we just always copy 9831 // them since them being non-null during a mount doesn't affect the logic as 9832 // they will simply be overwritten. 9833 component: vnode.component, 9834 suspense: vnode.suspense, 9835 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 9836 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 9837 placeholder: vnode.placeholder, 9838 el: vnode.el, 9839 anchor: vnode.anchor, 9840 ctx: vnode.ctx, 9841 ce: vnode.ce 9842 }; 9843 if (transition && cloneTransition) { 9844 setTransitionHooks( 9845 cloned, 9846 transition.clone(cloned) 9847 ); 9848 } 9849 return cloned; 9850 } 9851 function deepCloneVNode(vnode) { 9852 const cloned = cloneVNode(vnode); 9853 if (isArray(vnode.children)) { 9854 cloned.children = vnode.children.map(deepCloneVNode); 9855 } 9856 return cloned; 9857 } 9858 function createTextVNode(text = " ", flag = 0) { 9859 return createVNode(Text, null, text, flag); 9860 } 9861 function createStaticVNode(content, numberOfNodes) { 9862 const vnode = createVNode(Static, null, content); 9863 vnode.staticCount = numberOfNodes; 9864 return vnode; 9865 } 9866 function createCommentVNode(text = "", asBlock = false) { 9867 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 9868 } 9869 function normalizeVNode(child) { 9870 if (child == null || typeof child === "boolean") { 9871 return createVNode(Comment); 9872 } else if (isArray(child)) { 9873 return createVNode( 9874 Fragment, 9875 null, 9876 // #3666, avoid reference pollution when reusing vnode 9877 child.slice() 9878 ); 9879 } else if (isVNode(child)) { 9880 return cloneIfMounted(child); 9881 } else { 9882 return createVNode(Text, null, String(child)); 9883 } 9884 } 9885 function cloneIfMounted(child) { 9886 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 9887 } 9888 function normalizeChildren(vnode, children) { 9889 let type = 0; 9890 const { shapeFlag } = vnode; 9891 if (children == null) { 9892 children = null; 9893 } else if (isArray(children)) { 9894 type = 16; 9895 } else if (typeof children === "object") { 9896 if (shapeFlag & (1 | 64)) { 9897 const slot = children.default; 9898 if (slot) { 9899 slot._c && (slot._d = false); 9900 normalizeChildren(vnode, slot()); 9901 slot._c && (slot._d = true); 9902 } 9903 return; 9904 } else { 9905 type = 32; 9906 const slotFlag = children._; 9907 if (!slotFlag && !isInternalObject(children)) { 9908 children._ctx = currentRenderingInstance; 9909 } else if (slotFlag === 3 && currentRenderingInstance) { 9910 if (currentRenderingInstance.slots._ === 1) { 9911 children._ = 1; 9912 } else { 9913 children._ = 2; 9914 vnode.patchFlag |= 1024; 9915 } 9916 } 9917 } 9918 } else if (isFunction(children)) { 9919 children = { default: children, _ctx: currentRenderingInstance }; 9920 type = 32; 9921 } else { 9922 children = String(children); 9923 if (shapeFlag & 64) { 9924 type = 16; 9925 children = [createTextVNode(children)]; 9926 } else { 9927 type = 8; 9928 } 9929 } 9930 vnode.children = children; 9931 vnode.shapeFlag |= type; 9932 } 9933 function mergeProps(...args) { 9934 const ret = {}; 9935 for (let i = 0; i < args.length; i++) { 9936 const toMerge = args[i]; 9937 for (const key in toMerge) { 9938 if (key === "class") { 9939 if (ret.class !== toMerge.class) { 9940 ret.class = normalizeClass([ret.class, toMerge.class]); 9941 } 9942 } else if (key === "style") { 9943 ret.style = normalizeStyle([ret.style, toMerge.style]); 9944 } else if (isOn(key)) { 9945 const existing = ret[key]; 9946 const incoming = toMerge[key]; 9947 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 9948 ret[key] = existing ? [].concat(existing, incoming) : incoming; 9949 } 9950 } else if (key !== "") {
vendor: 9,114 bytes, lines 9951-10244
9951 ret[key] = toMerge[key]; 9952 } 9953 } 9954 } 9955 return ret; 9956 } 9957 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 9958 callWithAsyncErrorHandling(hook, instance, 7, [ 9959 vnode, 9960 prevVNode 9961 ]); 9962 } 9963 9964 const emptyAppContext = createAppContext(); 9965 let uid = 0; 9966 function createComponentInstance(vnode, parent, suspense) { 9967 const type = vnode.type; 9968 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 9969 const instance = { 9970 uid: uid++, 9971 vnode, 9972 type, 9973 parent, 9974 appContext, 9975 root: null, 9976 // to be immediately set 9977 next: null, 9978 subTree: null, 9979 // will be set synchronously right after creation 9980 effect: null, 9981 update: null, 9982 // will be set synchronously right after creation 9983 job: null, 9984 scope: new EffectScope( 9985 true 9986 /* detached */ 9987 ), 9988 render: null, 9989 proxy: null, 9990 exposed: null, 9991 exposeProxy: null, 9992 withProxy: null, 9993 provides: parent ? parent.provides : Object.create(appContext.provides), 9994 ids: parent ? parent.ids : ["", 0, 0], 9995 accessCache: null, 9996 renderCache: [], 9997 // local resolved assets 9998 components: null, 9999 directives: null, 10000 // resolved props and emits options 10001 propsOptions: normalizePropsOptions(type, appContext), 10002 emitsOptions: normalizeEmitsOptions(type, appContext), 10003 // emit 10004 emit: null, 10005 // to be set immediately 10006 emitted: null, 10007 // props default value 10008 propsDefaults: EMPTY_OBJ, 10009 // inheritAttrs 10010 inheritAttrs: type.inheritAttrs, 10011 // state 10012 ctx: EMPTY_OBJ, 10013 data: EMPTY_OBJ, 10014 props: EMPTY_OBJ, 10015 attrs: EMPTY_OBJ, 10016 slots: EMPTY_OBJ, 10017 refs: EMPTY_OBJ, 10018 setupState: EMPTY_OBJ, 10019 setupContext: null, 10020 // suspense related 10021 suspense, 10022 suspenseId: suspense ? suspense.pendingId : 0, 10023 asyncDep: null, 10024 asyncResolved: false, 10025 // lifecycle hooks 10026 // not using enums here because it results in computed properties 10027 isMounted: false, 10028 isUnmounted: false, 10029 isDeactivated: false, 10030 bc: null, 10031 c: null, 10032 bm: null, 10033 m: null, 10034 bu: null, 10035 u: null, 10036 um: null, 10037 bum: null, 10038 da: null, 10039 a: null, 10040 rtg: null, 10041 rtc: null, 10042 ec: null, 10043 sp: null 10044 }; 10045 { 10046 instance.ctx = createDevRenderContext(instance); 10047 } 10048 instance.root = parent ? parent.root : instance; 10049 instance.emit = emit.bind(null, instance); 10050 if (vnode.ce) { 10051 vnode.ce(instance); 10052 } 10053 return instance; 10054 } 10055 let currentInstance = null; 10056 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 10057 let internalSetCurrentInstance; 10058 let setInSSRSetupState; 10059 { 10060 internalSetCurrentInstance = (i) => { 10061 currentInstance = i; 10062 }; 10063 setInSSRSetupState = (v) => { 10064 isInSSRComponentSetup = v; 10065 }; 10066 } 10067 const setCurrentInstance = (instance) => { 10068 const prev = currentInstance; 10069 internalSetCurrentInstance(instance); 10070 instance.scope.on(); 10071 return () => { 10072 instance.scope.off(); 10073 internalSetCurrentInstance(prev); 10074 }; 10075 }; 10076 const unsetCurrentInstance = () => { 10077 currentInstance && currentInstance.scope.off(); 10078 internalSetCurrentInstance(null); 10079 }; 10080 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 10081 function validateComponentName(name, { isNativeTag }) { 10082 if (isBuiltInTag(name) || isNativeTag(name)) { 10083 warn$1( 10084 "Do not use built-in or reserved HTML elements as component id: " + name 10085 ); 10086 } 10087 } 10088 function isStatefulComponent(instance) { 10089 return instance.vnode.shapeFlag & 4; 10090 } 10091 let isInSSRComponentSetup = false; 10092 function setupComponent(instance, isSSR = false, optimized = false) { 10093 isSSR && setInSSRSetupState(isSSR); 10094 const { props, children } = instance.vnode; 10095 const isStateful = isStatefulComponent(instance); 10096 initProps(instance, props, isStateful, isSSR); 10097 initSlots(instance, children, optimized || isSSR); 10098 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 10099 isSSR && setInSSRSetupState(false); 10100 return setupResult; 10101 } 10102 function setupStatefulComponent(instance, isSSR) { 10103 var _a; 10104 const Component = instance.type; 10105 { 10106 if (Component.name) { 10107 validateComponentName(Component.name, instance.appContext.config); 10108 } 10109 if (Component.components) { 10110 const names = Object.keys(Component.components); 10111 for (let i = 0; i < names.length; i++) { 10112 validateComponentName(names[i], instance.appContext.config); 10113 } 10114 } 10115 if (Component.directives) { 10116 const names = Object.keys(Component.directives); 10117 for (let i = 0; i < names.length; i++) { 10118 validateDirectiveName(names[i]); 10119 } 10120 } 10121 if (Component.compilerOptions && isRuntimeOnly()) { 10122 warn$1( 10123 `"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.` 10124 ); 10125 } 10126 } 10127 instance.accessCache = /* @__PURE__ */ Object.create(null); 10128 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 10129 { 10130 exposePropsOnRenderContext(instance); 10131 } 10132 const { setup } = Component; 10133 if (setup) { 10134 pauseTracking(); 10135 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 10136 const reset = setCurrentInstance(instance); 10137 const setupResult = callWithErrorHandling( 10138 setup, 10139 instance, 10140 0, 10141 [ 10142 shallowReadonly(instance.props) , 10143 setupContext 10144 ] 10145 ); 10146 const isAsyncSetup = isPromise(setupResult); 10147 resetTracking(); 10148 reset(); 10149 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) { 10150 markAsyncBoundary(instance); 10151 } 10152 if (isAsyncSetup) { 10153 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 10154 if (isSSR) { 10155 return setupResult.then((resolvedResult) => { 10156 handleSetupResult(instance, resolvedResult, isSSR); 10157 }).catch((e) => { 10158 handleError(e, instance, 0); 10159 }); 10160 } else { 10161 instance.asyncDep = setupResult; 10162 if (!instance.suspense) { 10163 const name = (_a = Component.name) != null ? _a : "Anonymous"; 10164 warn$1( 10165 `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.` 10166 ); 10167 } 10168 } 10169 } else { 10170 handleSetupResult(instance, setupResult, isSSR); 10171 } 10172 } else { 10173 finishComponentSetup(instance, isSSR); 10174 } 10175 } 10176 function handleSetupResult(instance, setupResult, isSSR) { 10177 if (isFunction(setupResult)) { 10178 { 10179 instance.render = setupResult; 10180 } 10181 } else if (isObject(setupResult)) { 10182 if (isVNode(setupResult)) { 10183 warn$1( 10184 `setup() should not return VNodes directly - return a render function instead.` 10185 ); 10186 } 10187 { 10188 instance.devtoolsRawSetupState = setupResult; 10189 } 10190 instance.setupState = proxyRefs(setupResult); 10191 { 10192 exposeSetupStateOnRenderContext(instance); 10193 } 10194 } else if (setupResult !== void 0) { 10195 warn$1( 10196 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 10197 ); 10198 } 10199 finishComponentSetup(instance, isSSR); 10200 } 10201 let compile$1; 10202 let installWithProxy; 10203 function registerRuntimeCompiler(_compile) { 10204 compile$1 = _compile; 10205 installWithProxy = (i) => { 10206 if (i.render._rc) { 10207 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 10208 } 10209 }; 10210 } 10211 const isRuntimeOnly = () => !compile$1; 10212 function finishComponentSetup(instance, isSSR, skipOptions) { 10213 const Component = instance.type; 10214 if (!instance.render) { 10215 if (!isSSR && compile$1 && !Component.render) { 10216 const template = Component.template || resolveMergedOptions(instance).template; 10217 if (template) { 10218 { 10219 startMeasure(instance, `compile`); 10220 } 10221 const { isCustomElement, compilerOptions } = instance.appContext.config; 10222 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 10223 const finalCompilerOptions = extend( 10224 extend( 10225 { 10226 isCustomElement, 10227 delimiters 10228 }, 10229 compilerOptions 10230 ), 10231 componentCompilerOptions 10232 ); 10233 Component.render = compile$1(template, finalCompilerOptions); 10234 { 10235 endMeasure(instance, `compile`); 10236 } 10237 } 10238 } 10239 instance.render = Component.render || NOOP; 10240 if (installWithProxy) { 10241 installWithProxy(instance); 10242 } 10243 } 10244
vendor: 3,497 bytes, lines 10244-10359
10244 { 10245 const reset = setCurrentInstance(instance); 10246 pauseTracking(); 10247 try { 10248 applyOptions(instance); 10249 } finally { 10250 resetTracking(); 10251 reset(); 10252 } 10253 } 10254 if (!Component.render && instance.render === NOOP && !isSSR) { 10255 if (!compile$1 && Component.template) { 10256 warn$1( 10257 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` ) 10258 ); 10259 } else { 10260 warn$1(`Component is missing template or render function: `, Component); 10261 } 10262 } 10263 } 10264 const attrsProxyHandlers = { 10265 get(target, key) { 10266 markAttrsAccessed(); 10267 track(target, "get", ""); 10268 return target[key]; 10269 }, 10270 set() { 10271 warn$1(`setupContext.attrs is readonly.`); 10272 return false; 10273 }, 10274 deleteProperty() { 10275 warn$1(`setupContext.attrs is readonly.`); 10276 return false; 10277 } 10278 } ; 10279 function getSlotsProxy(instance) { 10280 return new Proxy(instance.slots, { 10281 get(target, key) { 10282 track(instance, "get", "$slots"); 10283 return target[key]; 10284 } 10285 }); 10286 } 10287 function createSetupContext(instance) { 10288 const expose = (exposed) => { 10289 { 10290 if (instance.exposed) { 10291 warn$1(`expose() should be called only once per setup().`); 10292 } 10293 if (exposed != null) { 10294 let exposedType = typeof exposed; 10295 if (exposedType === "object") { 10296 if (isArray(exposed)) { 10297 exposedType = "array"; 10298 } else if (isRef(exposed)) { 10299 exposedType = "ref"; 10300 } 10301 } 10302 if (exposedType !== "object") { 10303 warn$1( 10304 `expose() should be passed a plain object, received ${exposedType}.` 10305 ); 10306 } 10307 } 10308 } 10309 instance.exposed = exposed || {}; 10310 }; 10311 { 10312 let attrsProxy; 10313 let slotsProxy; 10314 return Object.freeze({ 10315 get attrs() { 10316 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers)); 10317 }, 10318 get slots() { 10319 return slotsProxy || (slotsProxy = getSlotsProxy(instance)); 10320 }, 10321 get emit() { 10322 return (event, ...args) => instance.emit(event, ...args); 10323 }, 10324 expose 10325 }); 10326 } 10327 } 10328 function getComponentPublicInstance(instance) { 10329 if (instance.exposed) { 10330 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 10331 get(target, key) { 10332 if (key in target) { 10333 return target[key]; 10334 } else if (key in publicPropertiesMap) { 10335 return publicPropertiesMap[key](instance); 10336 } 10337 }, 10338 has(target, key) { 10339 return key in target || key in publicPropertiesMap; 10340 } 10341 })); 10342 } else { 10343 return instance.proxy; 10344 } 10345 } 10346 const classifyRE = /(?:^|[-_])\w/g; 10347 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 10348 function getComponentName(Component, includeInferred = true) { 10349 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 10350 } 10351 function formatComponentName(instance, Component, isRoot = false) { 10352 let name = getComponentName(Component); 10353 if (!name && Component.__file) { 10354 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 10355 if (match) { 10356 name = match[1]; 10357 } 10358 } 10359 if (!name && instance
vendor: 6,604 bytes, lines 10359-10594
10359 && instance.parent) { 10360 const inferFromRegistry = (registry) => { 10361 for (const key in registry) { 10362 if (registry[key] === Component) { 10363 return key; 10364 } 10365 } 10366 }; 10367 name = inferFromRegistry( 10368 instance.components || instance.parent.type.components 10369 ) || inferFromRegistry(instance.appContext.components); 10370 } 10371 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 10372 } 10373 function isClassComponent(value) { 10374 return isFunction(value) && "__vccOpts" in value; 10375 } 10376 10377 const computed = (getterOrOptions, debugOptions) => { 10378 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 10379 { 10380 const i = getCurrentInstance(); 10381 if (i && i.appContext.config.warnRecursiveComputed) { 10382 c._warnRecursive = true; 10383 } 10384 } 10385 return c; 10386 }; 10387 10388 function h(type, propsOrChildren, children) { 10389 try { 10390 setBlockTracking(-1); 10391 const l = arguments.length; 10392 if (l === 2) { 10393 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 10394 if (isVNode(propsOrChildren)) { 10395 return createVNode(type, null, [propsOrChildren]); 10396 } 10397 return createVNode(type, propsOrChildren); 10398 } else { 10399 return createVNode(type, null, propsOrChildren); 10400 } 10401 } else { 10402 if (l > 3) { 10403 children = Array.prototype.slice.call(arguments, 2); 10404 } else if (l === 3 && isVNode(children)) { 10405 children = [children]; 10406 } 10407 return createVNode(type, propsOrChildren, children); 10408 } 10409 } finally { 10410 setBlockTracking(1); 10411 } 10412 } 10413 10414 function initCustomFormatter() { 10415 if (typeof window === "undefined") { 10416 return; 10417 } 10418 const vueStyle = { style: "color:#3ba776" }; 10419 const numberStyle = { style: "color:#1677ff" }; 10420 const stringStyle = { style: "color:#f5222d" }; 10421 const keywordStyle = { style: "color:#eb2f96" }; 10422 const formatter = { 10423 __vue_custom_formatter: true, 10424 header(obj) { 10425 if (!isObject(obj)) { 10426 return null; 10427 } 10428 if (obj.__isVue) { 10429 return ["div", vueStyle, `VueInstance`]; 10430 } else if (isRef(obj)) { 10431 pauseTracking(); 10432 const value = obj.value; 10433 resetTracking(); 10434 return [ 10435 "div", 10436 {}, 10437 ["span", vueStyle, genRefFlag(obj)], 10438 "<", 10439 formatValue(value), 10440 `>` 10441 ]; 10442 } else if (isReactive(obj)) { 10443 return [ 10444 "div", 10445 {}, 10446 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 10447 "<", 10448 formatValue(obj), 10449 `>${isReadonly(obj) ? ` (readonly)` : ``}` 10450 ]; 10451 } else if (isReadonly(obj)) { 10452 return [ 10453 "div", 10454 {}, 10455 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 10456 "<", 10457 formatValue(obj), 10458 ">" 10459 ]; 10460 } 10461 return null; 10462 }, 10463 hasBody(obj) { 10464 return obj && obj.__isVue; 10465 }, 10466 body(obj) { 10467 if (obj && obj.__isVue) { 10468 return [ 10469 "div", 10470 {}, 10471 ...formatInstance(obj.$) 10472 ]; 10473 } 10474 } 10475 }; 10476 function formatInstance(instance) { 10477 const blocks = []; 10478 if (instance.type.props && instance.props) { 10479 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 10480 } 10481 if (instance.setupState !== EMPTY_OBJ) { 10482 blocks.push(createInstanceBlock("setup", instance.setupState)); 10483 } 10484 if (instance.data !== EMPTY_OBJ) { 10485 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 10486 } 10487 const computed = extractKeys(instance, "computed"); 10488 if (computed) { 10489 blocks.push(createInstanceBlock("computed", computed)); 10490 } 10491 const injected = extractKeys(instance, "inject"); 10492 if (injected) { 10493 blocks.push(createInstanceBlock("injected", injected)); 10494 } 10495 blocks.push([ 10496 "div", 10497 {}, 10498 [ 10499 "span", 10500 { 10501 style: keywordStyle.style + ";opacity:0.66" 10502 }, 10503 "$ (internal): " 10504 ], 10505 ["object", { object: instance }] 10506 ]); 10507 return blocks; 10508 } 10509 function createInstanceBlock(type, target) { 10510 target = extend({}, target); 10511 if (!Object.keys(target).length) { 10512 return ["span", {}]; 10513 } 10514 return [ 10515 "div", 10516 { style: "line-height:1.25em;margin-bottom:0.6em" }, 10517 [ 10518 "div", 10519 { 10520 style: "color:#476582" 10521 }, 10522 type 10523 ], 10524 [ 10525 "div", 10526 { 10527 style: "padding-left:1.25em" 10528 }, 10529 ...Object.keys(target).map((key) => { 10530 return [ 10531 "div", 10532 {}, 10533 ["span", keywordStyle, key + ": "], 10534 formatValue(target[key], false) 10535 ]; 10536 }) 10537 ] 10538 ]; 10539 } 10540 function formatValue(v, asRaw = true) { 10541 if (typeof v === "number") { 10542 return ["span", numberStyle, v]; 10543 } else if (typeof v === "string") { 10544 return ["span", stringStyle, JSON.stringify(v)]; 10545 } else if (typeof v === "boolean") { 10546 return ["span", keywordStyle, v]; 10547 } else if (isObject(v)) { 10548 return ["object", { object: asRaw ? toRaw(v) : v }]; 10549 } else { 10550 return ["span", stringStyle, String(v)]; 10551 } 10552 } 10553 function extractKeys(instance, type) { 10554 const Comp = instance.type; 10555 if (isFunction(Comp)) { 10556 return; 10557 } 10558 const extracted = {}; 10559 for (const key in instance.ctx) { 10560 if (isKeyOfType(Comp, key, type)) { 10561 extracted[key] = instance.ctx[key]; 10562 } 10563 } 10564 return extracted; 10565 } 10566 function isKeyOfType(Comp, key, type) { 10567 const opts = Comp[type]; 10568 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 10569 return true; 10570 } 10571 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 10572 return true; 10573 } 10574 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 10575 return true; 10576 } 10577 } 10578 function genRefFlag(v) { 10579 if (isShallow(v)) { 10580 return `ShallowRef`; 10581 } 10582 if (v.effect) { 10583 return `ComputedRef`; 10584 } 10585 return `Ref`; 10586 } 10587 if (window.devtoolsFormatters) { 10588 window.devtoolsFormatters.push(formatter); 10589 } else { 10590 window.devtoolsFormatters = [formatter]; 10591 } 10592 } 10593 10594 function withMemo(memo, render, cache, index) {
vendor: 1,435 bytes, lines 10595-10644
10595 const cached = cache[index]; 10596 if (cached && isMemoSame(cached, memo)) { 10597 return cached; 10598 } 10599 const ret = render(); 10600 ret.memo = memo.slice(); 10601 ret.cacheIndex = index; 10602 return cache[index] = ret; 10603 } 10604 function isMemoSame(cached, memo) { 10605 const prev = cached.memo; 10606 if (prev.length != memo.length) { 10607 return false; 10608 } 10609 for (let i = 0; i < prev.length; i++) { 10610 if (hasChanged(prev[i], memo[i])) { 10611 return false; 10612 } 10613 } 10614 if (isBlockTreeEnabled > 0 && currentBlock) { 10615 currentBlock.push(cached); 10616 } 10617 return true; 10618 } 10619 10620 const version = "3.5.22"; 10621 const warn = warn$1 ; 10622 const ErrorTypeStrings = ErrorTypeStrings$1 ; 10623 const devtools = devtools$1 ; 10624 const setDevtoolsHook = setDevtoolsHook$1 ; 10625 const ssrUtils = null; 10626 const resolveFilter = null; 10627 const compatUtils = null; 10628 const DeprecationTypes = null; 10629 10630 let policy = void 0; 10631 const tt = typeof window !== "undefined" && window.trustedTypes; 10632 if (tt) { 10633 try { 10634 policy = /* @__PURE__ */ tt.createPolicy("vue", { 10635 createHTML: (val) => val 10636 }); 10637 } catch (e) { 10638 warn(`Error creating trusted types policy: ${e}`); 10639 } 10640 } 10641 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 10642 const svgNS = "http://www.w3.org/2000/svg"; 10643 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 10644 const doc = typeof document !== "undefined" ? document : null;
vendor: 5,235 bytes, lines 10645-10799
10645 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 10646 const nodeOps = { 10647 insert: (child, parent, anchor) => { 10648 parent.insertBefore(child, anchor || null); 10649 }, 10650 remove: (child) => { 10651 const parent = child.parentNode; 10652 if (parent) { 10653 parent.removeChild(child); 10654 } 10655 }, 10656 createElement: (tag, namespace, is, props) => { 10657 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 10658 if (tag === "select" && props && props.multiple != null) { 10659 el.setAttribute("multiple", props.multiple); 10660 } 10661 return el; 10662 }, 10663 createText: (text) => doc.createTextNode(text), 10664 createComment: (text) => doc.createComment(text), 10665 setText: (node, text) => { 10666 node.nodeValue = text; 10667 }, 10668 setElementText: (el, text) => { 10669 el.textContent = text; 10670 }, 10671 parentNode: (node) => node.parentNode, 10672 nextSibling: (node) => node.nextSibling, 10673 querySelector: (selector) => doc.querySelector(selector), 10674 setScopeId(el, id) { 10675 el.setAttribute(id, ""); 10676 }, 10677 // __UNSAFE__ 10678 // Reason: innerHTML. 10679 // Static content here can only come from compiled templates. 10680 // As long as the user only uses trusted templates, this is safe. 10681 insertStaticContent(content, parent, anchor, namespace, start, end) { 10682 const before = anchor ? anchor.previousSibling : parent.lastChild; 10683 if (start && (start === end || start.nextSibling)) { 10684 while (true) { 10685 parent.insertBefore(start.cloneNode(true), anchor); 10686 if (start === end || !(start = start.nextSibling)) break; 10687 } 10688 } else { 10689 templateContainer.innerHTML = unsafeToTrustedHTML( 10690 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 10691 ); 10692 const template = templateContainer.content; 10693 if (namespace === "svg" || namespace === "mathml") { 10694 const wrapper = template.firstChild; 10695 while (wrapper.firstChild) { 10696 template.appendChild(wrapper.firstChild); 10697 } 10698 template.removeChild(wrapper); 10699 } 10700 parent.insertBefore(template, anchor); 10701 } 10702 return [ 10703 // first 10704 before ? before.nextSibling : parent.firstChild, 10705 // last 10706 anchor ? anchor.previousSibling : parent.lastChild 10707 ]; 10708 } 10709 }; 10710 10711 const TRANSITION$1 = "transition"; 10712 const ANIMATION = "animation"; 10713 const vtcKey = Symbol("_vtc"); 10714 const DOMTransitionPropsValidators = { 10715 name: String, 10716 type: String, 10717 css: { 10718 type: Boolean, 10719 default: true 10720 }, 10721 duration: [String, Number, Object], 10722 enterFromClass: String, 10723 enterActiveClass: String, 10724 enterToClass: String, 10725 appearFromClass: String, 10726 appearActiveClass: String, 10727 appearToClass: String, 10728 leaveFromClass: String, 10729 leaveActiveClass: String, 10730 leaveToClass: String 10731 }; 10732 const TransitionPropsValidators = /* @__PURE__ */ extend( 10733 {}, 10734 BaseTransitionPropsValidators, 10735 DOMTransitionPropsValidators 10736 ); 10737 const decorate$1 = (t) => { 10738 t.displayName = "Transition"; 10739 t.props = TransitionPropsValidators; 10740 return t; 10741 }; 10742 const Transition = /* @__PURE__ */ decorate$1( 10743 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots) 10744 ); 10745 const callHook = (hook, args = []) => { 10746 if (isArray(hook)) { 10747 hook.forEach((h2) => h2(...args)); 10748 } else if (hook) { 10749 hook(...args); 10750 } 10751 }; 10752 const hasExplicitCallback = (hook) => { 10753 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 10754 }; 10755 function resolveTransitionProps(rawProps) { 10756 const baseProps = {}; 10757 for (const key in rawProps) { 10758 if (!(key in DOMTransitionPropsValidators)) { 10759 baseProps[key] = rawProps[key]; 10760 } 10761 } 10762 if (rawProps.css === false) { 10763 return baseProps; 10764 } 10765 const { 10766 name = "v", 10767 type, 10768 duration, 10769 enterFromClass = `${name}-enter-from`, 10770 enterActiveClass = `${name}-enter-active`, 10771 enterToClass = `${name}-enter-to`, 10772 appearFromClass = enterFromClass, 10773 appearActiveClass = enterActiveClass, 10774 appearToClass = enterToClass, 10775 leaveFromClass = `${name}-leave-from`, 10776 leaveActiveClass = `${name}-leave-active`, 10777 leaveToClass = `${name}-leave-to` 10778 } = rawProps; 10779 const durations = normalizeDuration(duration); 10780 const enterDuration = durations && durations[0]; 10781 const leaveDuration = durations && durations[1]; 10782 const { 10783 onBeforeEnter, 10784 onEnter, 10785 onEnterCancelled, 10786 onLeave, 10787 onLeaveCancelled, 10788 onBeforeAppear = onBeforeEnter, 10789 onAppear = onEnter, 10790 onAppearCancelled = onEnterCancelled 10791 } = baseProps; 10792 const finishEnter = (el, isAppear, done, isCancelled) => { 10793 el._enterCancelled = isCancelled; 10794 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 10795 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 10796 done && done(); 10797 }; 10798 const finishLeave = (el, done) => { 10799 el._isLeaving = false;
vendor: 9,423 bytes, lines 10800-11098
10800 removeTransitionClass(el, leaveFromClass); 10801 removeTransitionClass(el, leaveToClass); 10802 removeTransitionClass(el, leaveActiveClass); 10803 done && done(); 10804 }; 10805 const makeEnterHook = (isAppear) => { 10806 return (el, done) => { 10807 const hook = isAppear ? onAppear : onEnter; 10808 const resolve = () => finishEnter(el, isAppear, done); 10809 callHook(hook, [el, resolve]); 10810 nextFrame(() => { 10811 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 10812 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 10813 if (!hasExplicitCallback(hook)) { 10814 whenTransitionEnds(el, type, enterDuration, resolve); 10815 } 10816 }); 10817 }; 10818 }; 10819 return extend(baseProps, { 10820 onBeforeEnter(el) { 10821 callHook(onBeforeEnter, [el]); 10822 addTransitionClass(el, enterFromClass); 10823 addTransitionClass(el, enterActiveClass); 10824 }, 10825 onBeforeAppear(el) { 10826 callHook(onBeforeAppear, [el]); 10827 addTransitionClass(el, appearFromClass); 10828 addTransitionClass(el, appearActiveClass); 10829 }, 10830 onEnter: makeEnterHook(false), 10831 onAppear: makeEnterHook(true), 10832 onLeave(el, done) { 10833 el._isLeaving = true; 10834 const resolve = () => finishLeave(el, done); 10835 addTransitionClass(el, leaveFromClass); 10836 if (!el._enterCancelled) { 10837 forceReflow(el); 10838 addTransitionClass(el, leaveActiveClass); 10839 } else { 10840 addTransitionClass(el, leaveActiveClass); 10841 forceReflow(el); 10842 } 10843 nextFrame(() => { 10844 if (!el._isLeaving) { 10845 return; 10846 } 10847 removeTransitionClass(el, leaveFromClass); 10848 addTransitionClass(el, leaveToClass); 10849 if (!hasExplicitCallback(onLeave)) { 10850 whenTransitionEnds(el, type, leaveDuration, resolve); 10851 } 10852 }); 10853 callHook(onLeave, [el, resolve]); 10854 }, 10855 onEnterCancelled(el) { 10856 finishEnter(el, false, void 0, true); 10857 callHook(onEnterCancelled, [el]); 10858 }, 10859 onAppearCancelled(el) { 10860 finishEnter(el, true, void 0, true); 10861 callHook(onAppearCancelled, [el]); 10862 }, 10863 onLeaveCancelled(el) { 10864 finishLeave(el); 10865 callHook(onLeaveCancelled, [el]); 10866 } 10867 }); 10868 } 10869 function normalizeDuration(duration) { 10870 if (duration == null) { 10871 return null; 10872 } else if (isObject(duration)) { 10873 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 10874 } else { 10875 const n = NumberOf(duration); 10876 return [n, n]; 10877 } 10878 } 10879 function NumberOf(val) { 10880 const res = toNumber(val); 10881 { 10882 assertNumber(res, "<transition> explicit duration"); 10883 } 10884 return res; 10885 } 10886 function addTransitionClass(el, cls) { 10887 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 10888 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 10889 } 10890 function removeTransitionClass(el, cls) { 10891 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 10892 const _vtc = el[vtcKey]; 10893 if (_vtc) { 10894 _vtc.delete(cls); 10895 if (!_vtc.size) { 10896 el[vtcKey] = void 0; 10897 } 10898 } 10899 } 10900 function nextFrame(cb) { 10901 requestAnimationFrame(() => { 10902 requestAnimationFrame(cb); 10903 }); 10904 } 10905 let endId = 0; 10906 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 10907 const id = el._endId = ++endId; 10908 const resolveIfNotStale = () => { 10909 if (id === el._endId) { 10910 resolve(); 10911 } 10912 }; 10913 if (explicitTimeout != null) { 10914 return setTimeout(resolveIfNotStale, explicitTimeout); 10915 } 10916 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 10917 if (!type) { 10918 return resolve(); 10919 } 10920 const endEvent = type + "end"; 10921 let ended = 0; 10922 const end = () => { 10923 el.removeEventListener(endEvent, onEnd); 10924 resolveIfNotStale(); 10925 }; 10926 const onEnd = (e) => { 10927 if (e.target === el && ++ended >= propCount) { 10928 end(); 10929 } 10930 }; 10931 setTimeout(() => { 10932 if (ended < propCount) { 10933 end(); 10934 } 10935 }, timeout + 1); 10936 el.addEventListener(endEvent, onEnd); 10937 } 10938 function getTransitionInfo(el, expectedType) { 10939 const styles = window.getComputedStyle(el); 10940 const getStyleProperties = (key) => (styles[key] || "").split(", "); 10941 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 10942 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 10943 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 10944 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 10945 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 10946 const animationTimeout = getTimeout(animationDelays, animationDurations); 10947 let type = null; 10948 let timeout = 0; 10949 let propCount = 0; 10950 if (expectedType === TRANSITION$1) { 10951 if (transitionTimeout > 0) { 10952 type = TRANSITION$1; 10953 timeout = transitionTimeout; 10954 propCount = transitionDurations.length; 10955 } 10956 } else if (expectedType === ANIMATION) { 10957 if (animationTimeout > 0) { 10958 type = ANIMATION; 10959 timeout = animationTimeout; 10960 propCount = animationDurations.length; 10961 } 10962 } else { 10963 timeout = Math.max(transitionTimeout, animationTimeout); 10964 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 10965 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 10966 } 10967 const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test( 10968 getStyleProperties(`${TRANSITION$1}Property`).toString() 10969 ); 10970 return { 10971 type, 10972 timeout, 10973 propCount, 10974 hasTransform 10975 }; 10976 } 10977 function getTimeout(delays, durations) { 10978 while (delays.length < durations.length) { 10979 delays = delays.concat(delays); 10980 } 10981 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 10982 } 10983 function toMs(s) { 10984 if (s === "auto") return 0; 10985 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 10986 } 10987 function forceReflow(el) { 10988 const targetDocument = el ? el.ownerDocument : document; 10989 return targetDocument.body.offsetHeight; 10990 } 10991 10992 function patchClass(el, value, isSVG) { 10993 const transitionClasses = el[vtcKey]; 10994 if (transitionClasses) { 10995 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 10996 } 10997 if (value == null) { 10998 el.removeAttribute("class"); 10999 } else if (isSVG) { 11000 el.setAttribute("class", value); 11001 } else { 11002 el.className = value; 11003 } 11004 } 11005 11006 const vShowOriginalDisplay = Symbol("_vod"); 11007 const vShowHidden = Symbol("_vsh"); 11008 const vShow = { 11009 // used for prop mismatch check during hydration 11010 name: "show", 11011 beforeMount(el, { value }, { transition }) { 11012 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 11013 if (transition && value) { 11014 transition.beforeEnter(el); 11015 } else { 11016 setDisplay(el, value); 11017 } 11018 }, 11019 mounted(el, { value }, { transition }) { 11020 if (transition && value) { 11021 transition.enter(el); 11022 } 11023 }, 11024 updated(el, { value, oldValue }, { transition }) { 11025 if (!value === !oldValue) return; 11026 if (transition) { 11027 if (value) { 11028 transition.beforeEnter(el); 11029 setDisplay(el, true); 11030 transition.enter(el); 11031 } else { 11032 transition.leave(el, () => { 11033 setDisplay(el, false); 11034 }); 11035 } 11036 } else { 11037 setDisplay(el, value); 11038 } 11039 }, 11040 beforeUnmount(el, { value }) { 11041 setDisplay(el, value); 11042 } 11043 }; 11044 function setDisplay(el, value) { 11045 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 11046 el[vShowHidden] = !value; 11047 } 11048 11049 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" ); 11050 function useCssVars(getter) { 11051 const instance = getCurrentInstance(); 11052 if (!instance) { 11053 warn(`useCssVars is called without current active component instance.`); 11054 return; 11055 } 11056 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 11057 Array.from( 11058 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 11059 ).forEach((node) => setVarsOnNode(node, vars)); 11060 }; 11061 { 11062 instance.getCssVars = () => getter(instance.proxy); 11063 } 11064 const setVars = () => { 11065 const vars = getter(instance.proxy); 11066 if (instance.ce) { 11067 setVarsOnNode(instance.ce, vars); 11068 } else { 11069 setVarsOnVNode(instance.subTree, vars); 11070 } 11071 updateTeleports(vars); 11072 }; 11073 onBeforeUpdate(() => { 11074 queuePostFlushCb(setVars); 11075 }); 11076 onMounted(() => { 11077 watch(setVars, NOOP, { flush: "post" }); 11078 const ob = new MutationObserver(setVars); 11079 ob.observe(instance.subTree.el.parentNode, { childList: true }); 11080 onUnmounted(() => ob.disconnect()); 11081 }); 11082 } 11083 function setVarsOnVNode(vnode, vars) { 11084 if (vnode.shapeFlag & 128) { 11085 const suspense = vnode.suspense; 11086 vnode = suspense.activeBranch; 11087 if (suspense.pendingBranch && !suspense.isHydrating) { 11088 suspense.effects.push(() => { 11089 setVarsOnVNode(suspense.activeBranch, vars); 11090 }); 11091 } 11092 } 11093 while (vnode.component) { 11094 vnode = vnode.component.subTree; 11095 } 11096 if (vnode.shapeFlag & 1 && vnode.el) { 11097 setVarsOnNode(vnode.el, vars); 11098 } else if (vnode.type === Fragment) {
vendor: 6,058 bytes, lines 11099-11302
11099 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 11100 } else if (vnode.type === Static) { 11101 let { el, anchor } = vnode; 11102 while (el) { 11103 setVarsOnNode(el, vars); 11104 if (el === anchor) break; 11105 el = el.nextSibling; 11106 } 11107 } 11108 } 11109 function setVarsOnNode(el, vars) { 11110 if (el.nodeType === 1) { 11111 const style = el.style; 11112 let cssText = ""; 11113 for (const key in vars) { 11114 const value = normalizeCssVarValue(vars[key]); 11115 style.setProperty(`--${key}`, value); 11116 cssText += `--${key}: ${value};`; 11117 } 11118 style[CSS_VAR_TEXT] = cssText; 11119 } 11120 } 11121 11122 const displayRE = /(?:^|;)\s*display\s*:/; 11123 function patchStyle(el, prev, next) { 11124 const style = el.style; 11125 const isCssString = isString(next); 11126 let hasControlledDisplay = false; 11127 if (next && !isCssString) { 11128 if (prev) { 11129 if (!isString(prev)) { 11130 for (const key in prev) { 11131 if (next[key] == null) { 11132 setStyle(style, key, ""); 11133 } 11134 } 11135 } else { 11136 for (const prevStyle of prev.split(";")) { 11137 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 11138 if (next[key] == null) { 11139 setStyle(style, key, ""); 11140 } 11141 } 11142 } 11143 } 11144 for (const key in next) { 11145 if (key === "display") { 11146 hasControlledDisplay = true; 11147 } 11148 setStyle(style, key, next[key]); 11149 } 11150 } else { 11151 if (isCssString) { 11152 if (prev !== next) { 11153 const cssVarText = style[CSS_VAR_TEXT]; 11154 if (cssVarText) { 11155 next += ";" + cssVarText; 11156 } 11157 style.cssText = next; 11158 hasControlledDisplay = displayRE.test(next); 11159 } 11160 } else if (prev) { 11161 el.removeAttribute("style"); 11162 } 11163 } 11164 if (vShowOriginalDisplay in el) { 11165 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 11166 if (el[vShowHidden]) { 11167 style.display = "none"; 11168 } 11169 } 11170 } 11171 const semicolonRE = /[^\\];\s*$/; 11172 const importantRE = /\s*!important$/; 11173 function setStyle(style, name, val) { 11174 if (isArray(val)) { 11175 val.forEach((v) => setStyle(style, name, v)); 11176 } else { 11177 if (val == null) val = ""; 11178 { 11179 if (semicolonRE.test(val)) { 11180 warn( 11181 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 11182 ); 11183 } 11184 } 11185 if (name.startsWith("--")) { 11186 style.setProperty(name, val); 11187 } else { 11188 const prefixed = autoPrefix(style, name); 11189 if (importantRE.test(val)) { 11190 style.setProperty( 11191 hyphenate(prefixed), 11192 val.replace(importantRE, ""), 11193 "important" 11194 ); 11195 } else { 11196 style[prefixed] = val; 11197 } 11198 } 11199 } 11200 } 11201 const prefixes = ["Webkit", "Moz", "ms"]; 11202 const prefixCache = {}; 11203 function autoPrefix(style, rawName) { 11204 const cached = prefixCache[rawName]; 11205 if (cached) { 11206 return cached; 11207 } 11208 let name = camelize(rawName); 11209 if (name !== "filter" && name in style) { 11210 return prefixCache[rawName] = name; 11211 } 11212 name = capitalize(name); 11213 for (let i = 0; i < prefixes.length; i++) { 11214 const prefixed = prefixes[i] + name; 11215 if (prefixed in style) { 11216 return prefixCache[rawName] = prefixed; 11217 } 11218 } 11219 return rawName; 11220 } 11221 11222 const xlinkNS = "http://www.w3.org/1999/xlink"; 11223 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 11224 if (isSVG && key.startsWith("xlink:")) { 11225 if (value == null) { 11226 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 11227 } else { 11228 el.setAttributeNS(xlinkNS, key, value); 11229 } 11230 } else { 11231 if (value == null || isBoolean && !includeBooleanAttr(value)) { 11232 el.removeAttribute(key); 11233 } else { 11234 el.setAttribute( 11235 key, 11236 isBoolean ? "" : isSymbol(value) ? String(value) : value 11237 ); 11238 } 11239 } 11240 } 11241 11242 function patchDOMProp(el, key, value, parentComponent, attrName) { 11243 if (key === "innerHTML" || key === "textContent") { 11244 if (value != null) { 11245 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 11246 } 11247 return; 11248 } 11249 const tag = el.tagName; 11250 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 11251 !tag.includes("-")) { 11252 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 11253 const newValue = value == null ? ( 11254 // #11647: value should be set as empty string for null and undefined, 11255 // but <input type="checkbox"> should be set as 'on'. 11256 el.type === "checkbox" ? "on" : "" 11257 ) : String(value); 11258 if (oldValue !== newValue || !("_value" in el)) { 11259 el.value = newValue; 11260 } 11261 if (value == null) { 11262 el.removeAttribute(key); 11263 } 11264 el._value = value; 11265 return; 11266 } 11267 let needRemove = false; 11268 if (value === "" || value == null) { 11269 const type = typeof el[key]; 11270 if (type === "boolean") { 11271 value = includeBooleanAttr(value); 11272 } else if (value == null && type === "string") { 11273 value = ""; 11274 needRemove = true; 11275 } else if (type === "number") { 11276 value = 0; 11277 needRemove = true; 11278 } 11279 } 11280 try { 11281 el[key] = value; 11282 } catch (e) { 11283 if (!needRemove) { 11284 warn( 11285 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`, 11286 e 11287 ); 11288 } 11289 } 11290 needRemove && el.removeAttribute(attrName || key); 11291 } 11292 11293 function addEventListener(el, event, handler, options) { 11294 el.addEventListener(event, handler, options); 11295 } 11296 function removeEventListener(el, event, handler, options) { 11297 el.removeEventListener(event, handler, options); 11298 } 11299 const veiKey = Symbol("_vei"); 11300 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 11301 const invokers = el[veiKey] || (el[veiKey] = {}); 11302 const existingInvoker = invokers[rawName];
vendor: 2,336 bytes, lines 11303-11379
11303 if (nextValue && existingInvoker) { 11304 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ; 11305 } else { 11306 const [name, options] = parseName(rawName); 11307 if (nextValue) { 11308 const invoker = invokers[rawName] = createInvoker( 11309 sanitizeEventValue(nextValue, rawName) , 11310 instance 11311 ); 11312 addEventListener(el, name, invoker, options); 11313 } else if (existingInvoker) { 11314 removeEventListener(el, name, existingInvoker, options); 11315 invokers[rawName] = void 0; 11316 } 11317 } 11318 } 11319 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 11320 function parseName(name) { 11321 let options; 11322 if (optionsModifierRE.test(name)) { 11323 options = {}; 11324 let m; 11325 while (m = name.match(optionsModifierRE)) { 11326 name = name.slice(0, name.length - m[0].length); 11327 options[m[0].toLowerCase()] = true; 11328 } 11329 } 11330 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 11331 return [event, options]; 11332 } 11333 let cachedNow = 0; 11334 const p = /* @__PURE__ */ Promise.resolve(); 11335 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 11336 function createInvoker(initialValue, instance) { 11337 const invoker = (e) => { 11338 if (!e._vts) { 11339 e._vts = Date.now(); 11340 } else if (e._vts <= invoker.attached) { 11341 return; 11342 } 11343 callWithAsyncErrorHandling( 11344 patchStopImmediatePropagation(e, invoker.value), 11345 instance, 11346 5, 11347 [e] 11348 ); 11349 }; 11350 invoker.value = initialValue; 11351 invoker.attached = getNow(); 11352 return invoker; 11353 } 11354 function sanitizeEventValue(value, propName) { 11355 if (isFunction(value) || isArray(value)) { 11356 return value; 11357 } 11358 warn( 11359 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop? 11360Expected function or array of functions, received type ${typeof value}.` 11361 ); 11362 return NOOP; 11363 } 11364 function patchStopImmediatePropagation(e, value) { 11365 if (isArray(value)) { 11366 const originalStop = e.stopImmediatePropagation; 11367 e.stopImmediatePropagation = () => { 11368 originalStop.call(e); 11369 e._stopped = true; 11370 }; 11371 return value.map( 11372 (fn) => (e2) => !e2._stopped && fn && fn(e2) 11373 ); 11374 } else { 11375 return value; 11376 } 11377 } 11378 11379 const isNativeOn = (key) =>
vendor: 12,458 bytes, lines 11379-11770
11379 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 11380 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 11381 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 11382 const isSVG = namespace === "svg"; 11383 if (key === "class") { 11384 patchClass(el, nextValue, isSVG); 11385 } else if (key === "style") { 11386 patchStyle(el, prevValue, nextValue); 11387 } else if (isOn(key)) { 11388 if (!isModelListener(key)) { 11389 patchEvent(el, key, prevValue, nextValue, parentComponent); 11390 } 11391 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 11392 patchDOMProp(el, key, nextValue); 11393 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 11394 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 11395 } 11396 } else if ( 11397 // #11081 force set props for possible async custom element 11398 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) 11399 ) { 11400 patchDOMProp(el, camelize(key), nextValue, parentComponent, key); 11401 } else { 11402 if (key === "true-value") { 11403 el._trueValue = nextValue; 11404 } else if (key === "false-value") { 11405 el._falseValue = nextValue; 11406 } 11407 patchAttr(el, key, nextValue, isSVG); 11408 } 11409 }; 11410 function shouldSetAsProp(el, key, value, isSVG) { 11411 if (isSVG) { 11412 if (key === "innerHTML" || key === "textContent") { 11413 return true; 11414 } 11415 if (key in el && isNativeOn(key) && isFunction(value)) { 11416 return true; 11417 } 11418 return false; 11419 } 11420 if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { 11421 return false; 11422 } 11423 if (key === "form") { 11424 return false; 11425 } 11426 if (key === "list" && el.tagName === "INPUT") { 11427 return false; 11428 } 11429 if (key === "type" && el.tagName === "TEXTAREA") { 11430 return false; 11431 } 11432 if (key === "width" || key === "height") { 11433 const tag = el.tagName; 11434 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 11435 return false; 11436 } 11437 } 11438 if (isNativeOn(key) && isString(value)) { 11439 return false; 11440 } 11441 return key in el; 11442 } 11443 11444 const REMOVAL = {}; 11445 // @__NO_SIDE_EFFECTS__ 11446 function defineCustomElement(options, extraOptions, _createApp) { 11447 let Comp = defineComponent(options, extraOptions); 11448 if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions); 11449 class VueCustomElement extends VueElement { 11450 constructor(initialProps) { 11451 super(Comp, initialProps, _createApp); 11452 } 11453 } 11454 VueCustomElement.def = Comp; 11455 return VueCustomElement; 11456 } 11457 const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => { 11458 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp); 11459 }); 11460 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 11461 }; 11462 class VueElement extends BaseClass { 11463 constructor(_def, _props = {}, _createApp = createApp) { 11464 super(); 11465 this._def = _def; 11466 this._props = _props; 11467 this._createApp = _createApp; 11468 this._isVueCE = true; 11469 /** 11470 * @internal 11471 */ 11472 this._instance = null; 11473 /** 11474 * @internal 11475 */ 11476 this._app = null; 11477 /** 11478 * @internal 11479 */ 11480 this._nonce = this._def.nonce; 11481 this._connected = false; 11482 this._resolved = false; 11483 this._numberProps = null; 11484 this._styleChildren = /* @__PURE__ */ new WeakSet(); 11485 this._ob = null; 11486 if (this.shadowRoot && _createApp !== createApp) { 11487 this._root = this.shadowRoot; 11488 } else { 11489 if (this.shadowRoot) { 11490 warn( 11491 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 11492 ); 11493 } 11494 if (_def.shadowRoot !== false) { 11495 this.attachShadow( 11496 extend({}, _def.shadowRootOptions, { 11497 mode: "open" 11498 }) 11499 ); 11500 this._root = this.shadowRoot; 11501 } else { 11502 this._root = this; 11503 } 11504 } 11505 } 11506 connectedCallback() { 11507 if (!this.isConnected) return; 11508 if (!this.shadowRoot && !this._resolved) { 11509 this._parseSlots(); 11510 } 11511 this._connected = true; 11512 let parent = this; 11513 while (parent = parent && (parent.parentNode || parent.host)) { 11514 if (parent instanceof VueElement) { 11515 this._parent = parent; 11516 break; 11517 } 11518 } 11519 if (!this._instance) { 11520 if (this._resolved) { 11521 this._mount(this._def); 11522 } else { 11523 if (parent && parent._pendingResolve) { 11524 this._pendingResolve = parent._pendingResolve.then(() => { 11525 this._pendingResolve = void 0; 11526 this._resolveDef(); 11527 }); 11528 } else { 11529 this._resolveDef(); 11530 } 11531 } 11532 } 11533 } 11534 _setParent(parent = this._parent) { 11535 if (parent) { 11536 this._instance.parent = parent._instance; 11537 this._inheritParentContext(parent); 11538 } 11539 } 11540 _inheritParentContext(parent = this._parent) { 11541 if (parent && this._app) { 11542 Object.setPrototypeOf( 11543 this._app._context.provides, 11544 parent._instance.provides 11545 ); 11546 } 11547 } 11548 disconnectedCallback() { 11549 this._connected = false; 11550 nextTick(() => { 11551 if (!this._connected) { 11552 if (this._ob) { 11553 this._ob.disconnect(); 11554 this._ob = null; 11555 } 11556 this._app && this._app.unmount(); 11557 if (this._instance) this._instance.ce = void 0; 11558 this._app = this._instance = null; 11559 if (this._teleportTargets) { 11560 this._teleportTargets.clear(); 11561 this._teleportTargets = void 0; 11562 } 11563 } 11564 }); 11565 } 11566 _processMutations(mutations) { 11567 for (const m of mutations) { 11568 this._setAttr(m.attributeName); 11569 } 11570 } 11571 /** 11572 * resolve inner component definition (handle possible async component) 11573 */ 11574 _resolveDef() { 11575 if (this._pendingResolve) { 11576 return; 11577 } 11578 for (let i = 0; i < this.attributes.length; i++) { 11579 this._setAttr(this.attributes[i].name); 11580 } 11581 this._ob = new MutationObserver(this._processMutations.bind(this)); 11582 this._ob.observe(this, { attributes: true }); 11583 const resolve = (def, isAsync = false) => { 11584 this._resolved = true; 11585 this._pendingResolve = void 0; 11586 const { props, styles } = def; 11587 let numberProps; 11588 if (props && !isArray(props)) { 11589 for (const key in props) { 11590 const opt = props[key]; 11591 if (opt === Number || opt && opt.type === Number) { 11592 if (key in this._props) { 11593 this._props[key] = toNumber(this._props[key]); 11594 } 11595 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 11596 } 11597 } 11598 } 11599 this._numberProps = numberProps; 11600 this._resolveProps(def); 11601 if (this.shadowRoot) { 11602 this._applyStyles(styles); 11603 } else if (styles) { 11604 warn( 11605 "Custom element style injection is not supported when using shadowRoot: false" 11606 ); 11607 } 11608 this._mount(def); 11609 }; 11610 const asyncDef = this._def.__asyncLoader; 11611 if (asyncDef) { 11612 this._pendingResolve = asyncDef().then((def) => { 11613 def.configureApp = this._def.configureApp; 11614 resolve(this._def = def, true); 11615 }); 11616 } else { 11617 resolve(this._def); 11618 } 11619 } 11620 _mount(def) { 11621 if (!def.name) { 11622 def.name = "VueElement"; 11623 } 11624 this._app = this._createApp(def); 11625 this._inheritParentContext(); 11626 if (def.configureApp) { 11627 def.configureApp(this._app); 11628 } 11629 this._app._ceVNode = this._createVNode(); 11630 this._app.mount(this._root); 11631 const exposed = this._instance && this._instance.exposed; 11632 if (!exposed) return; 11633 for (const key in exposed) { 11634 if (!hasOwn(this, key)) { 11635 Object.defineProperty(this, key, { 11636 // unwrap ref to be consistent with public instance behavior 11637 get: () => unref(exposed[key]) 11638 }); 11639 } else { 11640 warn(`Exposed property "${key}" already exists on custom element.`); 11641 } 11642 } 11643 } 11644 _resolveProps(def) { 11645 const { props } = def; 11646 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 11647 for (const key of Object.keys(this)) { 11648 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 11649 this._setProp(key, this[key]); 11650 } 11651 } 11652 for (const key of declaredPropKeys.map(camelize)) { 11653 Object.defineProperty(this, key, { 11654 get() { 11655 return this._getProp(key); 11656 }, 11657 set(val) { 11658 this._setProp(key, val, true, true); 11659 } 11660 }); 11661 } 11662 } 11663 _setAttr(key) { 11664 if (key.startsWith("data-v-")) return; 11665 const has = this.hasAttribute(key); 11666 let value = has ? this.getAttribute(key) : REMOVAL; 11667 const camelKey = camelize(key); 11668 if (has && this._numberProps && this._numberProps[camelKey]) { 11669 value = toNumber(value); 11670 } 11671 this._setProp(camelKey, value, false, true); 11672 } 11673 /** 11674 * @internal 11675 */ 11676 _getProp(key) { 11677 return this._props[key]; 11678 } 11679 /** 11680 * @internal 11681 */ 11682 _setProp(key, val, shouldReflect = true, shouldUpdate = false) { 11683 if (val !== this._props[key]) { 11684 if (val === REMOVAL) { 11685 delete this._props[key]; 11686 } else { 11687 this._props[key] = val; 11688 if (key === "key" && this._app) { 11689 this._app._ceVNode.key = val; 11690 } 11691 } 11692 if (shouldUpdate && this._instance) { 11693 this._update(); 11694 } 11695 if (shouldReflect) { 11696 const ob = this._ob; 11697 if (ob) { 11698 this._processMutations(ob.takeRecords()); 11699 ob.disconnect(); 11700 } 11701 if (val === true) { 11702 this.setAttribute(hyphenate(key), ""); 11703 } else if (typeof val === "string" || typeof val === "number") { 11704 this.setAttribute(hyphenate(key), val + ""); 11705 } else if (!val) { 11706 this.removeAttribute(hyphenate(key)); 11707 } 11708 ob && ob.observe(this, { attributes: true }); 11709 } 11710 } 11711 } 11712 _update() { 11713 const vnode = this._createVNode(); 11714 if (this._app) vnode.appContext = this._app._context; 11715 render(vnode, this._root); 11716 } 11717 _createVNode() { 11718 const baseProps = {}; 11719 if (!this.shadowRoot) { 11720 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this); 11721 } 11722 const vnode = createVNode(this._def, extend(baseProps, this._props)); 11723 if (!this._instance) { 11724 vnode.ce = (instance) => { 11725 this._instance = instance; 11726 instance.ce = this; 11727 instance.isCE = true; 11728 { 11729 instance.ceReload = (newStyles) => { 11730 if (this._styles) { 11731 this._styles.forEach((s) => this._root.removeChild(s)); 11732 this._styles.length = 0; 11733 } 11734 this._applyStyles(newStyles); 11735 this._instance = null; 11736 this._update(); 11737 }; 11738 } 11739 const dispatch = (event, args) => { 11740 this.dispatchEvent( 11741 new CustomEvent( 11742 event, 11743 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args } 11744 ) 11745 ); 11746 }; 11747 instance.emit = (event, ...args) => { 11748 dispatch(event, args); 11749 if (hyphenate(event) !== event) { 11750 dispatch(hyphenate(event), args); 11751 } 11752 }; 11753 this._setParent(); 11754 }; 11755 } 11756 return vnode; 11757 } 11758 _applyStyles(styles, owner) { 11759 if (!styles) return; 11760 if (owner) { 11761 if (owner === this._def || this._styleChildren.has(owner)) { 11762 return; 11763 } 11764 this._styleChildren.add(owner); 11765 } 11766 const nonce = this._nonce; 11767 for (let i = styles.length - 1; i >= 0; i--) { 11768 const s = document.createElement("style"); 11769 if (nonce) s.setAttribute("nonce", nonce); 11770 s.textContent = styles[i];
vendor: 4,377 bytes, lines 11771-11928
11771 this.shadowRoot.prepend(s); 11772 { 11773 if (owner) { 11774 if (owner.__hmrId) { 11775 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map(); 11776 let entry = this._childStyles.get(owner.__hmrId); 11777 if (!entry) { 11778 this._childStyles.set(owner.__hmrId, entry = []); 11779 } 11780 entry.push(s); 11781 } 11782 } else { 11783 (this._styles || (this._styles = [])).push(s); 11784 } 11785 } 11786 } 11787 } 11788 /** 11789 * Only called when shadowRoot is false 11790 */ 11791 _parseSlots() { 11792 const slots = this._slots = {}; 11793 let n; 11794 while (n = this.firstChild) { 11795 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default"; 11796 (slots[slotName] || (slots[slotName] = [])).push(n); 11797 this.removeChild(n); 11798 } 11799 } 11800 /** 11801 * Only called when shadowRoot is false 11802 */ 11803 _renderSlots() { 11804 const outlets = this._getSlots(); 11805 const scopeId = this._instance.type.__scopeId; 11806 for (let i = 0; i < outlets.length; i++) { 11807 const o = outlets[i]; 11808 const slotName = o.getAttribute("name") || "default"; 11809 const content = this._slots[slotName]; 11810 const parent = o.parentNode; 11811 if (content) { 11812 for (const n of content) { 11813 if (scopeId && n.nodeType === 1) { 11814 const id = scopeId + "-s"; 11815 const walker = document.createTreeWalker(n, 1); 11816 n.setAttribute(id, ""); 11817 let child; 11818 while (child = walker.nextNode()) { 11819 child.setAttribute(id, ""); 11820 } 11821 } 11822 parent.insertBefore(n, o); 11823 } 11824 } else { 11825 while (o.firstChild) parent.insertBefore(o.firstChild, o); 11826 } 11827 parent.removeChild(o); 11828 } 11829 } 11830 /** 11831 * @internal 11832 */ 11833 _getSlots() { 11834 const roots = [this]; 11835 if (this._teleportTargets) { 11836 roots.push(...this._teleportTargets); 11837 } 11838 return roots.reduce((res, i) => { 11839 res.push(...Array.from(i.querySelectorAll("slot"))); 11840 return res; 11841 }, []); 11842 } 11843 /** 11844 * @internal 11845 */ 11846 _injectChildStyle(comp) { 11847 this._applyStyles(comp.styles, comp); 11848 } 11849 /** 11850 * @internal 11851 */ 11852 _removeChildStyle(comp) { 11853 { 11854 this._styleChildren.delete(comp); 11855 if (this._childStyles && comp.__hmrId) { 11856 const oldStyles = this._childStyles.get(comp.__hmrId); 11857 if (oldStyles) { 11858 oldStyles.forEach((s) => this._root.removeChild(s)); 11859 oldStyles.length = 0; 11860 } 11861 } 11862 } 11863 } 11864 } 11865 function useHost(caller) { 11866 const instance = getCurrentInstance(); 11867 const el = instance && instance.ce; 11868 if (el) { 11869 return el; 11870 } else { 11871 if (!instance) { 11872 warn( 11873 `${caller || "useHost"} called without an active component instance.` 11874 ); 11875 } else { 11876 warn( 11877 `${caller || "useHost"} can only be used in components defined via defineCustomElement.` 11878 ); 11879 } 11880 } 11881 return null; 11882 } 11883 function useShadowRoot() { 11884 const el = useHost("useShadowRoot") ; 11885 return el && el.shadowRoot; 11886 } 11887 11888 function useCssModule(name = "$style") { 11889 { 11890 { 11891 warn(`useCssModule() is not supported in the global build.`); 11892 } 11893 return EMPTY_OBJ; 11894 } 11895 } 11896 11897 const positionMap = /* @__PURE__ */ new WeakMap(); 11898 const newPositionMap = /* @__PURE__ */ new WeakMap(); 11899 const moveCbKey = Symbol("_moveCb"); 11900 const enterCbKey = Symbol("_enterCb"); 11901 const decorate = (t) => { 11902 delete t.props.mode; 11903 return t; 11904 }; 11905 const TransitionGroupImpl = /* @__PURE__ */ decorate({ 11906 name: "TransitionGroup", 11907 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 11908 tag: String, 11909 moveClass: String 11910 }), 11911 setup(props, { slots }) { 11912 const instance = getCurrentInstance(); 11913 const state = useTransitionState(); 11914 let prevChildren; 11915 let children; 11916 onUpdated(() => { 11917 if (!prevChildren.length) { 11918 return; 11919 } 11920 const moveClass = props.moveClass || `${props.name || "v"}-move`; 11921 if (!hasCSSTransform( 11922 prevChildren[0].el, 11923 instance.vnode.el, 11924 moveClass 11925 )) { 11926 prevChildren = []; 11927 return; 11928 }
vendor: 7,109 bytes, lines 11929-12141
11929 prevChildren.forEach(callPendingCbs); 11930 prevChildren.forEach(recordPosition); 11931 const movedChildren = prevChildren.filter(applyTranslation); 11932 forceReflow(instance.vnode.el); 11933 movedChildren.forEach((c) => { 11934 const el = c.el; 11935 const style = el.style; 11936 addTransitionClass(el, moveClass); 11937 style.transform = style.webkitTransform = style.transitionDuration = ""; 11938 const cb = el[moveCbKey] = (e) => { 11939 if (e && e.target !== el) { 11940 return; 11941 } 11942 if (!e || e.propertyName.endsWith("transform")) { 11943 el.removeEventListener("transitionend", cb); 11944 el[moveCbKey] = null; 11945 removeTransitionClass(el, moveClass); 11946 } 11947 }; 11948 el.addEventListener("transitionend", cb); 11949 }); 11950 prevChildren = []; 11951 }); 11952 return () => { 11953 const rawProps = toRaw(props); 11954 const cssTransitionProps = resolveTransitionProps(rawProps); 11955 let tag = rawProps.tag || Fragment; 11956 prevChildren = []; 11957 if (children) { 11958 for (let i = 0; i < children.length; i++) { 11959 const child = children[i]; 11960 if (child.el && child.el instanceof Element) { 11961 prevChildren.push(child); 11962 setTransitionHooks( 11963 child, 11964 resolveTransitionHooks( 11965 child, 11966 cssTransitionProps, 11967 state, 11968 instance 11969 ) 11970 ); 11971 positionMap.set( 11972 child, 11973 child.el.getBoundingClientRect() 11974 ); 11975 } 11976 } 11977 } 11978 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 11979 for (let i = 0; i < children.length; i++) { 11980 const child = children[i]; 11981 if (child.key != null) { 11982 setTransitionHooks( 11983 child, 11984 resolveTransitionHooks(child, cssTransitionProps, state, instance) 11985 ); 11986 } else if (child.type !== Text) { 11987 warn(`<TransitionGroup> children must be keyed.`); 11988 } 11989 } 11990 return createVNode(tag, null, children); 11991 }; 11992 } 11993 }); 11994 const TransitionGroup = TransitionGroupImpl; 11995 function callPendingCbs(c) { 11996 const el = c.el; 11997 if (el[moveCbKey]) { 11998 el[moveCbKey](); 11999 } 12000 if (el[enterCbKey]) { 12001 el[enterCbKey](); 12002 } 12003 } 12004 function recordPosition(c) { 12005 newPositionMap.set(c, c.el.getBoundingClientRect()); 12006 } 12007 function applyTranslation(c) { 12008 const oldPos = positionMap.get(c); 12009 const newPos = newPositionMap.get(c); 12010 const dx = oldPos.left - newPos.left; 12011 const dy = oldPos.top - newPos.top; 12012 if (dx || dy) { 12013 const s = c.el.style; 12014 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 12015 s.transitionDuration = "0s"; 12016 return c; 12017 } 12018 } 12019 function hasCSSTransform(el, root, moveClass) { 12020 const clone = el.cloneNode(); 12021 const _vtc = el[vtcKey]; 12022 if (_vtc) { 12023 _vtc.forEach((cls) => { 12024 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 12025 }); 12026 } 12027 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 12028 clone.style.display = "none"; 12029 const container = root.nodeType === 1 ? root : root.parentNode; 12030 container.appendChild(clone); 12031 const { hasTransform } = getTransitionInfo(clone); 12032 container.removeChild(clone); 12033 return hasTransform; 12034 } 12035 12036 const getModelAssigner = (vnode) => { 12037 const fn = vnode.props["onUpdate:modelValue"] || false; 12038 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 12039 }; 12040 function onCompositionStart(e) { 12041 e.target.composing = true; 12042 } 12043 function onCompositionEnd(e) { 12044 const target = e.target; 12045 if (target.composing) { 12046 target.composing = false; 12047 target.dispatchEvent(new Event("input")); 12048 } 12049 } 12050 const assignKey = Symbol("_assign"); 12051 const vModelText = { 12052 created(el, { modifiers: { lazy, trim, number } }, vnode) { 12053 el[assignKey] = getModelAssigner(vnode); 12054 const castToNumber = number || vnode.props && vnode.props.type === "number"; 12055 addEventListener(el, lazy ? "change" : "input", (e) => { 12056 if (e.target.composing) return; 12057 let domValue = el.value; 12058 if (trim) { 12059 domValue = domValue.trim(); 12060 } 12061 if (castToNumber) { 12062 domValue = looseToNumber(domValue); 12063 } 12064 el[assignKey](domValue); 12065 }); 12066 if (trim) { 12067 addEventListener(el, "change", () => { 12068 el.value = el.value.trim(); 12069 }); 12070 } 12071 if (!lazy) { 12072 addEventListener(el, "compositionstart", onCompositionStart); 12073 addEventListener(el, "compositionend", onCompositionEnd); 12074 addEventListener(el, "change", onCompositionEnd); 12075 } 12076 }, 12077 // set value on mounted so it's after min/max for type="range" 12078 mounted(el, { value }) { 12079 el.value = value == null ? "" : value; 12080 }, 12081 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) { 12082 el[assignKey] = getModelAssigner(vnode); 12083 if (el.composing) return; 12084 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; 12085 const newValue = value == null ? "" : value; 12086 if (elValue === newValue) { 12087 return; 12088 } 12089 if (document.activeElement === el && el.type !== "range") { 12090 if (lazy && value === oldValue) { 12091 return; 12092 } 12093 if (trim && el.value.trim() === newValue) { 12094 return; 12095 } 12096 } 12097 el.value = newValue; 12098 } 12099 }; 12100 const vModelCheckbox = { 12101 // #4096 array checkboxes need to be deep traversed 12102 deep: true, 12103 created(el, _, vnode) { 12104 el[assignKey] = getModelAssigner(vnode); 12105 addEventListener(el, "change", () => { 12106 const modelValue = el._modelValue; 12107 const elementValue = getValue(el); 12108 const checked = el.checked; 12109 const assign = el[assignKey]; 12110 if (isArray(modelValue)) { 12111 const index = looseIndexOf(modelValue, elementValue); 12112 const found = index !== -1; 12113 if (checked && !found) { 12114 assign(modelValue.concat(elementValue)); 12115 } else if (!checked && found) { 12116 const filtered = [...modelValue]; 12117 filtered.splice(index, 1); 12118 assign(filtered); 12119 } 12120 } else if (isSet(modelValue)) { 12121 const cloned = new Set(modelValue); 12122 if (checked) { 12123 cloned.add(elementValue); 12124 } else { 12125 cloned.delete(elementValue); 12126 } 12127 assign(cloned); 12128 } else { 12129 assign(getCheckboxValue(el, checked)); 12130 } 12131 }); 12132 }, 12133 // set initial checked on mount to wait for true-value/false-value 12134 mounted: setChecked, 12135 beforeUpdate(el, binding, vnode) { 12136 el[assignKey] = getModelAssigner(vnode); 12137 setChecked(el, binding, vnode); 12138 } 12139 }; 12140 function setChecked(el, { value, oldValue }, vnode) { 12141 el._modelValue = value;
vendor: 11,977 bytes, lines 12142-12519
12142 let checked; 12143 if (isArray(value)) { 12144 checked = looseIndexOf(value, vnode.props.value) > -1; 12145 } else if (isSet(value)) { 12146 checked = value.has(vnode.props.value); 12147 } else { 12148 if (value === oldValue) return; 12149 checked = looseEqual(value, getCheckboxValue(el, true)); 12150 } 12151 if (el.checked !== checked) { 12152 el.checked = checked; 12153 } 12154 } 12155 const vModelRadio = { 12156 created(el, { value }, vnode) { 12157 el.checked = looseEqual(value, vnode.props.value); 12158 el[assignKey] = getModelAssigner(vnode); 12159 addEventListener(el, "change", () => { 12160 el[assignKey](getValue(el)); 12161 }); 12162 }, 12163 beforeUpdate(el, { value, oldValue }, vnode) { 12164 el[assignKey] = getModelAssigner(vnode); 12165 if (value !== oldValue) { 12166 el.checked = looseEqual(value, vnode.props.value); 12167 } 12168 } 12169 }; 12170 const vModelSelect = { 12171 // <select multiple> value need to be deep traversed 12172 deep: true, 12173 created(el, { value, modifiers: { number } }, vnode) { 12174 const isSetModel = isSet(value); 12175 addEventListener(el, "change", () => { 12176 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 12177 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 12178 ); 12179 el[assignKey]( 12180 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 12181 ); 12182 el._assigning = true; 12183 nextTick(() => { 12184 el._assigning = false; 12185 }); 12186 }); 12187 el[assignKey] = getModelAssigner(vnode); 12188 }, 12189 // set value in mounted & updated because <select> relies on its children 12190 // <option>s. 12191 mounted(el, { value }) { 12192 setSelected(el, value); 12193 }, 12194 beforeUpdate(el, _binding, vnode) { 12195 el[assignKey] = getModelAssigner(vnode); 12196 }, 12197 updated(el, { value }) { 12198 if (!el._assigning) { 12199 setSelected(el, value); 12200 } 12201 } 12202 }; 12203 function setSelected(el, value) { 12204 const isMultiple = el.multiple; 12205 const isArrayValue = isArray(value); 12206 if (isMultiple && !isArrayValue && !isSet(value)) { 12207 warn( 12208 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 12209 ); 12210 return; 12211 } 12212 for (let i = 0, l = el.options.length; i < l; i++) { 12213 const option = el.options[i]; 12214 const optionValue = getValue(option); 12215 if (isMultiple) { 12216 if (isArrayValue) { 12217 const optionType = typeof optionValue; 12218 if (optionType === "string" || optionType === "number") { 12219 option.selected = value.some((v) => String(v) === String(optionValue)); 12220 } else { 12221 option.selected = looseIndexOf(value, optionValue) > -1; 12222 } 12223 } else { 12224 option.selected = value.has(optionValue); 12225 } 12226 } else if (looseEqual(getValue(option), value)) { 12227 if (el.selectedIndex !== i) el.selectedIndex = i; 12228 return; 12229 } 12230 } 12231 if (!isMultiple && el.selectedIndex !== -1) { 12232 el.selectedIndex = -1; 12233 } 12234 } 12235 function getValue(el) { 12236 return "_value" in el ? el._value : el.value; 12237 } 12238 function getCheckboxValue(el, checked) { 12239 const key = checked ? "_trueValue" : "_falseValue"; 12240 return key in el ? el[key] : checked; 12241 } 12242 const vModelDynamic = { 12243 created(el, binding, vnode) { 12244 callModelHook(el, binding, vnode, null, "created"); 12245 }, 12246 mounted(el, binding, vnode) { 12247 callModelHook(el, binding, vnode, null, "mounted"); 12248 }, 12249 beforeUpdate(el, binding, vnode, prevVNode) { 12250 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 12251 }, 12252 updated(el, binding, vnode, prevVNode) { 12253 callModelHook(el, binding, vnode, prevVNode, "updated"); 12254 } 12255 }; 12256 function resolveDynamicModel(tagName, type) { 12257 switch (tagName) { 12258 case "SELECT": 12259 return vModelSelect; 12260 case "TEXTAREA": 12261 return vModelText; 12262 default: 12263 switch (type) { 12264 case "checkbox": 12265 return vModelCheckbox; 12266 case "radio": 12267 return vModelRadio; 12268 default: 12269 return vModelText; 12270 } 12271 } 12272 } 12273 function callModelHook(el, binding, vnode, prevVNode, hook) { 12274 const modelToUse = resolveDynamicModel( 12275 el.tagName, 12276 vnode.props && vnode.props.type 12277 ); 12278 const fn = modelToUse[hook]; 12279 fn && fn(el, binding, vnode, prevVNode); 12280 } 12281 12282 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 12283 const modifierGuards = { 12284 stop: (e) => e.stopPropagation(), 12285 prevent: (e) => e.preventDefault(), 12286 self: (e) => e.target !== e.currentTarget, 12287 ctrl: (e) => !e.ctrlKey, 12288 shift: (e) => !e.shiftKey, 12289 alt: (e) => !e.altKey, 12290 meta: (e) => !e.metaKey, 12291 left: (e) => "button" in e && e.button !== 0, 12292 middle: (e) => "button" in e && e.button !== 1, 12293 right: (e) => "button" in e && e.button !== 2, 12294 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 12295 }; 12296 const withModifiers = (fn, modifiers) => { 12297 const cache = fn._withMods || (fn._withMods = {}); 12298 const cacheKey = modifiers.join("."); 12299 return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => { 12300 for (let i = 0; i < modifiers.length; i++) { 12301 const guard = modifierGuards[modifiers[i]]; 12302 if (guard && guard(event, modifiers)) return; 12303 } 12304 return fn(event, ...args); 12305 })); 12306 }; 12307 const keyNames = { 12308 esc: "escape", 12309 space: " ", 12310 up: "arrow-up", 12311 left: "arrow-left", 12312 right: "arrow-right", 12313 down: "arrow-down", 12314 delete: "backspace" 12315 }; 12316 const withKeys = (fn, modifiers) => { 12317 const cache = fn._withKeys || (fn._withKeys = {}); 12318 const cacheKey = modifiers.join("."); 12319 return cache[cacheKey] || (cache[cacheKey] = ((event) => { 12320 if (!("key" in event)) { 12321 return; 12322 } 12323 const eventKey = hyphenate(event.key); 12324 if (modifiers.some( 12325 (k) => k === eventKey || keyNames[k] === eventKey 12326 )) { 12327 return fn(event); 12328 } 12329 })); 12330 }; 12331 12332 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 12333 let renderer; 12334 let enabledHydration = false; 12335 function ensureRenderer() { 12336 return renderer || (renderer = createRenderer(rendererOptions)); 12337 } 12338 function ensureHydrationRenderer() { 12339 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 12340 enabledHydration = true; 12341 return renderer; 12342 } 12343 const render = ((...args) => { 12344 ensureRenderer().render(...args); 12345 }); 12346 const hydrate = ((...args) => { 12347 ensureHydrationRenderer().hydrate(...args); 12348 }); 12349 const createApp = ((...args) => { 12350 const app = ensureRenderer().createApp(...args); 12351 { 12352 injectNativeTagCheck(app); 12353 injectCompilerOptionsCheck(app); 12354 } 12355 const { mount } = app; 12356 app.mount = (containerOrSelector) => { 12357 const container = normalizeContainer(containerOrSelector); 12358 if (!container) return; 12359 const component = app._component; 12360 if (!isFunction(component) && !component.render && !component.template) { 12361 component.template = container.innerHTML; 12362 } 12363 if (container.nodeType === 1) { 12364 container.textContent = ""; 12365 } 12366 const proxy = mount(container, false, resolveRootNamespace(container)); 12367 if (container instanceof Element) { 12368 container.removeAttribute("v-cloak"); 12369 container.setAttribute("data-v-app", ""); 12370 } 12371 return proxy; 12372 }; 12373 return app; 12374 }); 12375 const createSSRApp = ((...args) => { 12376 const app = ensureHydrationRenderer().createApp(...args); 12377 { 12378 injectNativeTagCheck(app); 12379 injectCompilerOptionsCheck(app); 12380 } 12381 const { mount } = app; 12382 app.mount = (containerOrSelector) => { 12383 const container = normalizeContainer(containerOrSelector); 12384 if (container) { 12385 return mount(container, true, resolveRootNamespace(container)); 12386 } 12387 }; 12388 return app; 12389 }); 12390 function resolveRootNamespace(container) { 12391 if (container instanceof SVGElement) { 12392 return "svg"; 12393 } 12394 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 12395 return "mathml"; 12396 } 12397 } 12398 function injectNativeTagCheck(app) { 12399 Object.defineProperty(app.config, "isNativeTag", { 12400 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 12401 writable: false 12402 }); 12403 } 12404 function injectCompilerOptionsCheck(app) { 12405 if (isRuntimeOnly()) { 12406 const isCustomElement = app.config.isCustomElement; 12407 Object.defineProperty(app.config, "isCustomElement", { 12408 get() { 12409 return isCustomElement; 12410 }, 12411 set() { 12412 warn( 12413 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 12414 ); 12415 } 12416 }); 12417 const compilerOptions = app.config.compilerOptions; 12418 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. 12419- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 12420- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 12421- 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`; 12422 Object.defineProperty(app.config, "compilerOptions", { 12423 get() { 12424 warn(msg); 12425 return compilerOptions; 12426 }, 12427 set() { 12428 warn(msg); 12429 } 12430 }); 12431 } 12432 } 12433 function normalizeContainer(container) { 12434 if (isString(container)) { 12435 const res = document.querySelector(container); 12436 if (!res) { 12437 warn( 12438 `Failed to mount app: mount target selector "${container}" returned null.` 12439 ); 12440 } 12441 return res; 12442 } 12443 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 12444 warn( 12445 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 12446 ); 12447 } 12448 return container; 12449 } 12450 const initDirectivesForSSR = NOOP; 12451 12452 function initDev() { 12453 { 12454 { 12455 console.info( 12456 `You are running a development build of Vue. 12457Make sure to use the production build (*.prod.js) when deploying for production.` 12458 ); 12459 } 12460 initCustomFormatter(); 12461 } 12462 } 12463 12464 const FRAGMENT = Symbol(`Fragment` ); 12465 const TELEPORT = Symbol(`Teleport` ); 12466 const SUSPENSE = Symbol(`Suspense` ); 12467 const KEEP_ALIVE = Symbol(`KeepAlive` ); 12468 const BASE_TRANSITION = Symbol( 12469 `BaseTransition` 12470 ); 12471 const OPEN_BLOCK = Symbol(`openBlock` ); 12472 const CREATE_BLOCK = Symbol(`createBlock` ); 12473 const CREATE_ELEMENT_BLOCK = Symbol( 12474 `createElementBlock` 12475 ); 12476 const CREATE_VNODE = Symbol(`createVNode` ); 12477 const CREATE_ELEMENT_VNODE = Symbol( 12478 `createElementVNode` 12479 ); 12480 const CREATE_COMMENT = Symbol( 12481 `createCommentVNode` 12482 ); 12483 const CREATE_TEXT = Symbol( 12484 `createTextVNode` 12485 ); 12486 const CREATE_STATIC = Symbol( 12487 `createStaticVNode` 12488 ); 12489 const RESOLVE_COMPONENT = Symbol( 12490 `resolveComponent` 12491 ); 12492 const RESOLVE_DYNAMIC_COMPONENT = Symbol( 12493 `resolveDynamicComponent` 12494 ); 12495 const RESOLVE_DIRECTIVE = Symbol( 12496 `resolveDirective` 12497 ); 12498 const RESOLVE_FILTER = Symbol( 12499 `resolveFilter` 12500 ); 12501 const WITH_DIRECTIVES = Symbol( 12502 `withDirectives` 12503 ); 12504 const RENDER_LIST = Symbol(`renderList` ); 12505 const RENDER_SLOT = Symbol(`renderSlot` ); 12506 const CREATE_SLOTS = Symbol(`createSlots` ); 12507 const TO_DISPLAY_STRING = Symbol( 12508 `toDisplayString` 12509 ); 12510 const MERGE_PROPS = Symbol(`mergeProps` ); 12511 const NORMALIZE_CLASS = Symbol( 12512 `normalizeClass` 12513 ); 12514 const NORMALIZE_STYLE = Symbol( 12515 `normalizeStyle` 12516 ); 12517 const NORMALIZE_PROPS = Symbol( 12518 `normalizeProps` 12519 );
vendor: 9,104 bytes, lines 12520-12839
12520 const GUARD_REACTIVE_PROPS = Symbol( 12521 `guardReactiveProps` 12522 ); 12523 const TO_HANDLERS = Symbol(`toHandlers` ); 12524 const CAMELIZE = Symbol(`camelize` ); 12525 const CAPITALIZE = Symbol(`capitalize` ); 12526 const TO_HANDLER_KEY = Symbol( 12527 `toHandlerKey` 12528 ); 12529 const SET_BLOCK_TRACKING = Symbol( 12530 `setBlockTracking` 12531 ); 12532 const PUSH_SCOPE_ID = Symbol(`pushScopeId` ); 12533 const POP_SCOPE_ID = Symbol(`popScopeId` ); 12534 const WITH_CTX = Symbol(`withCtx` ); 12535 const UNREF = Symbol(`unref` ); 12536 const IS_REF = Symbol(`isRef` ); 12537 const WITH_MEMO = Symbol(`withMemo` ); 12538 const IS_MEMO_SAME = Symbol(`isMemoSame` ); 12539 const helperNameMap = { 12540 [FRAGMENT]: `Fragment`, 12541 [TELEPORT]: `Teleport`, 12542 [SUSPENSE]: `Suspense`, 12543 [KEEP_ALIVE]: `KeepAlive`, 12544 [BASE_TRANSITION]: `BaseTransition`, 12545 [OPEN_BLOCK]: `openBlock`, 12546 [CREATE_BLOCK]: `createBlock`, 12547 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 12548 [CREATE_VNODE]: `createVNode`, 12549 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 12550 [CREATE_COMMENT]: `createCommentVNode`, 12551 [CREATE_TEXT]: `createTextVNode`, 12552 [CREATE_STATIC]: `createStaticVNode`, 12553 [RESOLVE_COMPONENT]: `resolveComponent`, 12554 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 12555 [RESOLVE_DIRECTIVE]: `resolveDirective`, 12556 [RESOLVE_FILTER]: `resolveFilter`, 12557 [WITH_DIRECTIVES]: `withDirectives`, 12558 [RENDER_LIST]: `renderList`, 12559 [RENDER_SLOT]: `renderSlot`, 12560 [CREATE_SLOTS]: `createSlots`, 12561 [TO_DISPLAY_STRING]: `toDisplayString`, 12562 [MERGE_PROPS]: `mergeProps`, 12563 [NORMALIZE_CLASS]: `normalizeClass`, 12564 [NORMALIZE_STYLE]: `normalizeStyle`, 12565 [NORMALIZE_PROPS]: `normalizeProps`, 12566 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 12567 [TO_HANDLERS]: `toHandlers`, 12568 [CAMELIZE]: `camelize`, 12569 [CAPITALIZE]: `capitalize`, 12570 [TO_HANDLER_KEY]: `toHandlerKey`, 12571 [SET_BLOCK_TRACKING]: `setBlockTracking`, 12572 [PUSH_SCOPE_ID]: `pushScopeId`, 12573 [POP_SCOPE_ID]: `popScopeId`, 12574 [WITH_CTX]: `withCtx`, 12575 [UNREF]: `unref`, 12576 [IS_REF]: `isRef`, 12577 [WITH_MEMO]: `withMemo`, 12578 [IS_MEMO_SAME]: `isMemoSame` 12579 }; 12580 function registerRuntimeHelpers(helpers) { 12581 Object.getOwnPropertySymbols(helpers).forEach((s) => { 12582 helperNameMap[s] = helpers[s]; 12583 }); 12584 } 12585 12586 const locStub = { 12587 start: { line: 1, column: 1, offset: 0 }, 12588 end: { line: 1, column: 1, offset: 0 }, 12589 source: "" 12590 }; 12591 function createRoot(children, source = "") { 12592 return { 12593 type: 0, 12594 source, 12595 children, 12596 helpers: /* @__PURE__ */ new Set(), 12597 components: [], 12598 directives: [], 12599 hoists: [], 12600 imports: [], 12601 cached: [], 12602 temps: 0, 12603 codegenNode: void 0, 12604 loc: locStub 12605 }; 12606 } 12607 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 12608 if (context) { 12609 if (isBlock) { 12610 context.helper(OPEN_BLOCK); 12611 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 12612 } else { 12613 context.helper(getVNodeHelper(context.inSSR, isComponent)); 12614 } 12615 if (directives) { 12616 context.helper(WITH_DIRECTIVES); 12617 } 12618 } 12619 return { 12620 type: 13, 12621 tag, 12622 props, 12623 children, 12624 patchFlag, 12625 dynamicProps, 12626 directives, 12627 isBlock, 12628 disableTracking, 12629 isComponent, 12630 loc 12631 }; 12632 } 12633 function createArrayExpression(elements, loc = locStub) { 12634 return { 12635 type: 17, 12636 loc, 12637 elements 12638 }; 12639 } 12640 function createObjectExpression(properties, loc = locStub) { 12641 return { 12642 type: 15, 12643 loc, 12644 properties 12645 }; 12646 } 12647 function createObjectProperty(key, value) { 12648 return { 12649 type: 16, 12650 loc: locStub, 12651 key: isString(key) ? createSimpleExpression(key, true) : key, 12652 value 12653 }; 12654 } 12655 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 12656 return { 12657 type: 4, 12658 loc, 12659 content, 12660 isStatic, 12661 constType: isStatic ? 3 : constType 12662 }; 12663 } 12664 function createCompoundExpression(children, loc = locStub) { 12665 return { 12666 type: 8, 12667 loc, 12668 children 12669 }; 12670 } 12671 function createCallExpression(callee, args = [], loc = locStub) { 12672 return { 12673 type: 14, 12674 loc, 12675 callee, 12676 arguments: args 12677 }; 12678 } 12679 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 12680 return { 12681 type: 18, 12682 params, 12683 returns, 12684 newline, 12685 isSlot, 12686 loc 12687 }; 12688 } 12689 function createConditionalExpression(test, consequent, alternate, newline = true) { 12690 return { 12691 type: 19, 12692 test, 12693 consequent, 12694 alternate, 12695 newline, 12696 loc: locStub 12697 }; 12698 } 12699 function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { 12700 return { 12701 type: 20, 12702 index, 12703 value, 12704 needPauseTracking, 12705 inVOnce, 12706 needArraySpread: false, 12707 loc: locStub 12708 }; 12709 } 12710 function createBlockStatement(body) { 12711 return { 12712 type: 21, 12713 body, 12714 loc: locStub 12715 }; 12716 } 12717 function getVNodeHelper(ssr, isComponent) { 12718 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 12719 } 12720 function getVNodeBlockHelper(ssr, isComponent) { 12721 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 12722 } 12723 function convertToBlock(node, { helper, removeHelper, inSSR }) { 12724 if (!node.isBlock) { 12725 node.isBlock = true; 12726 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 12727 helper(OPEN_BLOCK); 12728 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 12729 } 12730 } 12731 12732 const defaultDelimitersOpen = new Uint8Array([123, 123]); 12733 const defaultDelimitersClose = new Uint8Array([125, 125]); 12734 function isTagStartChar(c) { 12735 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 12736 } 12737 function isWhitespace(c) { 12738 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 12739 } 12740 function isEndOfTagSection(c) { 12741 return c === 47 || c === 62 || isWhitespace(c); 12742 } 12743 function toCharCodes(str) { 12744 const ret = new Uint8Array(str.length); 12745 for (let i = 0; i < str.length; i++) { 12746 ret[i] = str.charCodeAt(i); 12747 } 12748 return ret; 12749 } 12750 const Sequences = { 12751 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 12752 // CDATA[ 12753 CdataEnd: new Uint8Array([93, 93, 62]), 12754 // ]]> 12755 CommentEnd: new Uint8Array([45, 45, 62]), 12756 // `-->` 12757 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 12758 // `<\/script` 12759 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 12760 // `</style` 12761 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 12762 // `</title` 12763 TextareaEnd: new Uint8Array([ 12764 60, 12765 47, 12766 116, 12767 101, 12768 120, 12769 116, 12770 97, 12771 114, 12772 101, 12773 97 12774 ]) 12775 // `</textarea 12776 }; 12777 class Tokenizer { 12778 constructor(stack, cbs) { 12779 this.stack = stack; 12780 this.cbs = cbs; 12781 /** The current state the tokenizer is in. */ 12782 this.state = 1; 12783 /** The read buffer. */ 12784 this.buffer = ""; 12785 /** The beginning of the section that is currently being read. */ 12786 this.sectionStart = 0; 12787 /** The index within the buffer that we are currently looking at. */ 12788 this.index = 0; 12789 /** The start of the last entity. */ 12790 this.entityStart = 0; 12791 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 12792 this.baseState = 1; 12793 /** For special parsing behavior inside of script and style tags. */ 12794 this.inRCDATA = false; 12795 /** For disabling RCDATA tags handling */ 12796 this.inXML = false; 12797 /** For disabling interpolation parsing in v-pre */ 12798 this.inVPre = false; 12799 /** Record newline positions for fast line / column calculation */ 12800 this.newlines = []; 12801 this.mode = 0; 12802 this.delimiterOpen = defaultDelimitersOpen; 12803 this.delimiterClose = defaultDelimitersClose; 12804 this.delimiterIndex = -1; 12805 this.currentSequence = void 0; 12806 this.sequenceIndex = 0; 12807 } 12808 get inSFCRoot() { 12809 return this.mode === 2 && this.stack.length === 0; 12810 } 12811 reset() { 12812 this.state = 1; 12813 this.mode = 0; 12814 this.buffer = ""; 12815 this.sectionStart = 0; 12816 this.index = 0; 12817 this.baseState = 1; 12818 this.inRCDATA = false; 12819 this.currentSequence = void 0; 12820 this.newlines.length = 0; 12821 this.delimiterOpen = defaultDelimitersOpen; 12822 this.delimiterClose = defaultDelimitersClose; 12823 } 12824 /** 12825 * Generate Position object with line / column information using recorded 12826 * newline positions. We know the index is always going to be an already 12827 * processed index, so all the newlines up to this index should have been 12828 * recorded. 12829 */ 12830 getPos(index) { 12831 let line = 1; 12832 let column = index + 1; 12833 for (let i = this.newlines.length - 1; i >= 0; i--) { 12834 const newlineIndex = this.newlines[i]; 12835 if (index > newlineIndex) { 12836 line = i + 2; 12837 column = index - newlineIndex; 12838 break; 12839 }
vendor: 20,316 bytes, lines 12839-13536
12839 12840 } 12841 return { 12842 column, 12843 line, 12844 offset: index 12845 }; 12846 } 12847 peek() { 12848 return this.buffer.charCodeAt(this.index + 1); 12849 } 12850 stateText(c) { 12851 if (c === 60) { 12852 if (this.index > this.sectionStart) { 12853 this.cbs.ontext(this.sectionStart, this.index); 12854 } 12855 this.state = 5; 12856 this.sectionStart = this.index; 12857 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 12858 this.state = 2; 12859 this.delimiterIndex = 0; 12860 this.stateInterpolationOpen(c); 12861 } 12862 } 12863 stateInterpolationOpen(c) { 12864 if (c === this.delimiterOpen[this.delimiterIndex]) { 12865 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 12866 const start = this.index + 1 - this.delimiterOpen.length; 12867 if (start > this.sectionStart) { 12868 this.cbs.ontext(this.sectionStart, start); 12869 } 12870 this.state = 3; 12871 this.sectionStart = start; 12872 } else { 12873 this.delimiterIndex++; 12874 } 12875 } else if (this.inRCDATA) { 12876 this.state = 32; 12877 this.stateInRCDATA(c); 12878 } else { 12879 this.state = 1; 12880 this.stateText(c); 12881 } 12882 } 12883 stateInterpolation(c) { 12884 if (c === this.delimiterClose[0]) { 12885 this.state = 4; 12886 this.delimiterIndex = 0; 12887 this.stateInterpolationClose(c); 12888 } 12889 } 12890 stateInterpolationClose(c) { 12891 if (c === this.delimiterClose[this.delimiterIndex]) { 12892 if (this.delimiterIndex === this.delimiterClose.length - 1) { 12893 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 12894 if (this.inRCDATA) { 12895 this.state = 32; 12896 } else { 12897 this.state = 1; 12898 } 12899 this.sectionStart = this.index + 1; 12900 } else { 12901 this.delimiterIndex++; 12902 } 12903 } else { 12904 this.state = 3; 12905 this.stateInterpolation(c); 12906 } 12907 } 12908 stateSpecialStartSequence(c) { 12909 const isEnd = this.sequenceIndex === this.currentSequence.length; 12910 const isMatch = isEnd ? ( 12911 // If we are at the end of the sequence, make sure the tag name has ended 12912 isEndOfTagSection(c) 12913 ) : ( 12914 // Otherwise, do a case-insensitive comparison 12915 (c | 32) === this.currentSequence[this.sequenceIndex] 12916 ); 12917 if (!isMatch) { 12918 this.inRCDATA = false; 12919 } else if (!isEnd) { 12920 this.sequenceIndex++; 12921 return; 12922 } 12923 this.sequenceIndex = 0; 12924 this.state = 6; 12925 this.stateInTagName(c); 12926 } 12927 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 12928 stateInRCDATA(c) { 12929 if (this.sequenceIndex === this.currentSequence.length) { 12930 if (c === 62 || isWhitespace(c)) { 12931 const endOfText = this.index - this.currentSequence.length; 12932 if (this.sectionStart < endOfText) { 12933 const actualIndex = this.index; 12934 this.index = endOfText; 12935 this.cbs.ontext(this.sectionStart, endOfText); 12936 this.index = actualIndex; 12937 } 12938 this.sectionStart = endOfText + 2; 12939 this.stateInClosingTagName(c); 12940 this.inRCDATA = false; 12941 return; 12942 } 12943 this.sequenceIndex = 0; 12944 } 12945 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 12946 this.sequenceIndex += 1; 12947 } else if (this.sequenceIndex === 0) { 12948 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 12949 if (!this.inVPre && c === this.delimiterOpen[0]) { 12950 this.state = 2; 12951 this.delimiterIndex = 0; 12952 this.stateInterpolationOpen(c); 12953 } 12954 } else if (this.fastForwardTo(60)) { 12955 this.sequenceIndex = 1; 12956 } 12957 } else { 12958 this.sequenceIndex = Number(c === 60); 12959 } 12960 } 12961 stateCDATASequence(c) { 12962 if (c === Sequences.Cdata[this.sequenceIndex]) { 12963 if (++this.sequenceIndex === Sequences.Cdata.length) { 12964 this.state = 28; 12965 this.currentSequence = Sequences.CdataEnd; 12966 this.sequenceIndex = 0; 12967 this.sectionStart = this.index + 1; 12968 } 12969 } else { 12970 this.sequenceIndex = 0; 12971 this.state = 23; 12972 this.stateInDeclaration(c); 12973 } 12974 } 12975 /** 12976 * When we wait for one specific character, we can speed things up 12977 * by skipping through the buffer until we find it. 12978 * 12979 * @returns Whether the character was found. 12980 */ 12981 fastForwardTo(c) { 12982 while (++this.index < this.buffer.length) { 12983 const cc = this.buffer.charCodeAt(this.index); 12984 if (cc === 10) { 12985 this.newlines.push(this.index); 12986 } 12987 if (cc === c) { 12988 return true; 12989 } 12990 } 12991 this.index = this.buffer.length - 1; 12992 return false; 12993 } 12994 /** 12995 * Comments and CDATA end with `-->` and `]]>`. 12996 * 12997 * Their common qualities are: 12998 * - Their end sequences have a distinct character they start with. 12999 * - That character is then repeated, so we have to check multiple repeats. 13000 * - All characters but the start character of the sequence can be skipped. 13001 */ 13002 stateInCommentLike(c) { 13003 if (c === this.currentSequence[this.sequenceIndex]) { 13004 if (++this.sequenceIndex === this.currentSequence.length) { 13005 if (this.currentSequence === Sequences.CdataEnd) { 13006 this.cbs.oncdata(this.sectionStart, this.index - 2); 13007 } else { 13008 this.cbs.oncomment(this.sectionStart, this.index - 2); 13009 } 13010 this.sequenceIndex = 0; 13011 this.sectionStart = this.index + 1; 13012 this.state = 1; 13013 } 13014 } else if (this.sequenceIndex === 0) { 13015 if (this.fastForwardTo(this.currentSequence[0])) { 13016 this.sequenceIndex = 1; 13017 } 13018 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 13019 this.sequenceIndex = 0; 13020 } 13021 } 13022 startSpecial(sequence, offset) { 13023 this.enterRCDATA(sequence, offset); 13024 this.state = 31; 13025 } 13026 enterRCDATA(sequence, offset) { 13027 this.inRCDATA = true; 13028 this.currentSequence = sequence; 13029 this.sequenceIndex = offset; 13030 } 13031 stateBeforeTagName(c) { 13032 if (c === 33) { 13033 this.state = 22; 13034 this.sectionStart = this.index + 1; 13035 } else if (c === 63) { 13036 this.state = 24; 13037 this.sectionStart = this.index + 1; 13038 } else if (isTagStartChar(c)) { 13039 this.sectionStart = this.index; 13040 if (this.mode === 0) { 13041 this.state = 6; 13042 } else if (this.inSFCRoot) { 13043 this.state = 34; 13044 } else if (!this.inXML) { 13045 if (c === 116) { 13046 this.state = 30; 13047 } else { 13048 this.state = c === 115 ? 29 : 6; 13049 } 13050 } else { 13051 this.state = 6; 13052 } 13053 } else if (c === 47) { 13054 this.state = 8; 13055 } else { 13056 this.state = 1; 13057 this.stateText(c); 13058 } 13059 } 13060 stateInTagName(c) { 13061 if (isEndOfTagSection(c)) { 13062 this.handleTagName(c); 13063 } 13064 } 13065 stateInSFCRootTagName(c) { 13066 if (isEndOfTagSection(c)) { 13067 const tag = this.buffer.slice(this.sectionStart, this.index); 13068 if (tag !== "template") { 13069 this.enterRCDATA(toCharCodes(`</` + tag), 0); 13070 } 13071 this.handleTagName(c); 13072 } 13073 } 13074 handleTagName(c) { 13075 this.cbs.onopentagname(this.sectionStart, this.index); 13076 this.sectionStart = -1; 13077 this.state = 11; 13078 this.stateBeforeAttrName(c); 13079 } 13080 stateBeforeClosingTagName(c) { 13081 if (isWhitespace(c)) ; else if (c === 62) { 13082 { 13083 this.cbs.onerr(14, this.index); 13084 } 13085 this.state = 1; 13086 this.sectionStart = this.index + 1; 13087 } else { 13088 this.state = isTagStartChar(c) ? 9 : 27; 13089 this.sectionStart = this.index; 13090 } 13091 } 13092 stateInClosingTagName(c) { 13093 if (c === 62 || isWhitespace(c)) { 13094 this.cbs.onclosetag(this.sectionStart, this.index); 13095 this.sectionStart = -1; 13096 this.state = 10; 13097 this.stateAfterClosingTagName(c); 13098 } 13099 } 13100 stateAfterClosingTagName(c) { 13101 if (c === 62) { 13102 this.state = 1; 13103 this.sectionStart = this.index + 1; 13104 } 13105 } 13106 stateBeforeAttrName(c) { 13107 if (c === 62) { 13108 this.cbs.onopentagend(this.index); 13109 if (this.inRCDATA) { 13110 this.state = 32; 13111 } else { 13112 this.state = 1; 13113 } 13114 this.sectionStart = this.index + 1; 13115 } else if (c === 47) { 13116 this.state = 7; 13117 if (this.peek() !== 62) { 13118 this.cbs.onerr(22, this.index); 13119 } 13120 } else if (c === 60 && this.peek() === 47) { 13121 this.cbs.onopentagend(this.index); 13122 this.state = 5; 13123 this.sectionStart = this.index; 13124 } else if (!isWhitespace(c)) { 13125 if (c === 61) { 13126 this.cbs.onerr( 13127 19, 13128 this.index 13129 ); 13130 } 13131 this.handleAttrStart(c); 13132 } 13133 } 13134 handleAttrStart(c) { 13135 if (c === 118 && this.peek() === 45) { 13136 this.state = 13; 13137 this.sectionStart = this.index; 13138 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 13139 this.cbs.ondirname(this.index, this.index + 1); 13140 this.state = 14; 13141 this.sectionStart = this.index + 1; 13142 } else { 13143 this.state = 12; 13144 this.sectionStart = this.index; 13145 } 13146 } 13147 stateInSelfClosingTag(c) { 13148 if (c === 62) { 13149 this.cbs.onselfclosingtag(this.index); 13150 this.state = 1; 13151 this.sectionStart = this.index + 1; 13152 this.inRCDATA = false; 13153 } else if (!isWhitespace(c)) { 13154 this.state = 11; 13155 this.stateBeforeAttrName(c); 13156 } 13157 } 13158 stateInAttrName(c) { 13159 if (c === 61 || isEndOfTagSection(c)) { 13160 this.cbs.onattribname(this.sectionStart, this.index); 13161 this.handleAttrNameEnd(c); 13162 } else if (c === 34 || c === 39 || c === 60) { 13163 this.cbs.onerr( 13164 17, 13165 this.index 13166 ); 13167 } 13168 } 13169 stateInDirName(c) { 13170 if (c === 61 || isEndOfTagSection(c)) { 13171 this.cbs.ondirname(this.sectionStart, this.index); 13172 this.handleAttrNameEnd(c); 13173 } else if (c === 58) { 13174 this.cbs.ondirname(this.sectionStart, this.index); 13175 this.state = 14; 13176 this.sectionStart = this.index + 1; 13177 } else if (c === 46) { 13178 this.cbs.ondirname(this.sectionStart, this.index); 13179 this.state = 16; 13180 this.sectionStart = this.index + 1; 13181 } 13182 } 13183 stateInDirArg(c) { 13184 if (c === 61 || isEndOfTagSection(c)) { 13185 this.cbs.ondirarg(this.sectionStart, this.index); 13186 this.handleAttrNameEnd(c); 13187 } else if (c === 91) { 13188 this.state = 15; 13189 } else if (c === 46) { 13190 this.cbs.ondirarg(this.sectionStart, this.index); 13191 this.state = 16; 13192 this.sectionStart = this.index + 1; 13193 } 13194 } 13195 stateInDynamicDirArg(c) { 13196 if (c === 93) { 13197 this.state = 14; 13198 } else if (c === 61 || isEndOfTagSection(c)) { 13199 this.cbs.ondirarg(this.sectionStart, this.index + 1); 13200 this.handleAttrNameEnd(c); 13201 { 13202 this.cbs.onerr( 13203 27, 13204 this.index 13205 ); 13206 } 13207 } 13208 } 13209 stateInDirModifier(c) { 13210 if (c === 61 || isEndOfTagSection(c)) { 13211 this.cbs.ondirmodifier(this.sectionStart, this.index); 13212 this.handleAttrNameEnd(c); 13213 } else if (c === 46) { 13214 this.cbs.ondirmodifier(this.sectionStart, this.index); 13215 this.sectionStart = this.index + 1; 13216 } 13217 } 13218 handleAttrNameEnd(c) { 13219 this.sectionStart = this.index; 13220 this.state = 17; 13221 this.cbs.onattribnameend(this.index); 13222 this.stateAfterAttrName(c); 13223 } 13224 stateAfterAttrName(c) { 13225 if (c === 61) { 13226 this.state = 18; 13227 } else if (c === 47 || c === 62) { 13228 this.cbs.onattribend(0, this.sectionStart); 13229 this.sectionStart = -1; 13230 this.state = 11; 13231 this.stateBeforeAttrName(c); 13232 } else if (!isWhitespace(c)) { 13233 this.cbs.onattribend(0, this.sectionStart); 13234 this.handleAttrStart(c); 13235 } 13236 } 13237 stateBeforeAttrValue(c) { 13238 if (c === 34) { 13239 this.state = 19; 13240 this.sectionStart = this.index + 1; 13241 } else if (c === 39) { 13242 this.state = 20; 13243 this.sectionStart = this.index + 1; 13244 } else if (!isWhitespace(c)) { 13245 this.sectionStart = this.index; 13246 this.state = 21; 13247 this.stateInAttrValueNoQuotes(c); 13248 } 13249 } 13250 handleInAttrValue(c, quote) { 13251 if (c === quote || this.fastForwardTo(quote)) { 13252 this.cbs.onattribdata(this.sectionStart, this.index); 13253 this.sectionStart = -1; 13254 this.cbs.onattribend( 13255 quote === 34 ? 3 : 2, 13256 this.index + 1 13257 ); 13258 this.state = 11; 13259 } 13260 } 13261 stateInAttrValueDoubleQuotes(c) { 13262 this.handleInAttrValue(c, 34); 13263 } 13264 stateInAttrValueSingleQuotes(c) { 13265 this.handleInAttrValue(c, 39); 13266 } 13267 stateInAttrValueNoQuotes(c) { 13268 if (isWhitespace(c) || c === 62) { 13269 this.cbs.onattribdata(this.sectionStart, this.index); 13270 this.sectionStart = -1; 13271 this.cbs.onattribend(1, this.index); 13272 this.state = 11; 13273 this.stateBeforeAttrName(c); 13274 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 13275 this.cbs.onerr( 13276 18, 13277 this.index 13278 ); 13279 } else ; 13280 } 13281 stateBeforeDeclaration(c) { 13282 if (c === 91) { 13283 this.state = 26; 13284 this.sequenceIndex = 0; 13285 } else { 13286 this.state = c === 45 ? 25 : 23; 13287 } 13288 } 13289 stateInDeclaration(c) { 13290 if (c === 62 || this.fastForwardTo(62)) { 13291 this.state = 1; 13292 this.sectionStart = this.index + 1; 13293 } 13294 } 13295 stateInProcessingInstruction(c) { 13296 if (c === 62 || this.fastForwardTo(62)) { 13297 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 13298 this.state = 1; 13299 this.sectionStart = this.index + 1; 13300 } 13301 } 13302 stateBeforeComment(c) { 13303 if (c === 45) { 13304 this.state = 28; 13305 this.currentSequence = Sequences.CommentEnd; 13306 this.sequenceIndex = 2; 13307 this.sectionStart = this.index + 1; 13308 } else { 13309 this.state = 23; 13310 } 13311 } 13312 stateInSpecialComment(c) { 13313 if (c === 62 || this.fastForwardTo(62)) { 13314 this.cbs.oncomment(this.sectionStart, this.index); 13315 this.state = 1; 13316 this.sectionStart = this.index + 1; 13317 } 13318 } 13319 stateBeforeSpecialS(c) { 13320 if (c === Sequences.ScriptEnd[3]) { 13321 this.startSpecial(Sequences.ScriptEnd, 4); 13322 } else if (c === Sequences.StyleEnd[3]) { 13323 this.startSpecial(Sequences.StyleEnd, 4); 13324 } else { 13325 this.state = 6; 13326 this.stateInTagName(c); 13327 } 13328 } 13329 stateBeforeSpecialT(c) { 13330 if (c === Sequences.TitleEnd[3]) { 13331 this.startSpecial(Sequences.TitleEnd, 4); 13332 } else if (c === Sequences.TextareaEnd[3]) { 13333 this.startSpecial(Sequences.TextareaEnd, 4); 13334 } else { 13335 this.state = 6; 13336 this.stateInTagName(c); 13337 } 13338 } 13339 startEntity() { 13340 } 13341 stateInEntity() { 13342 } 13343 /** 13344 * Iterates through the buffer, calling the function corresponding to the current state. 13345 * 13346 * States that are more likely to be hit are higher up, as a performance improvement. 13347 */ 13348 parse(input) { 13349 this.buffer = input; 13350 while (this.index < this.buffer.length) { 13351 const c = this.buffer.charCodeAt(this.index); 13352 if (c === 10 && this.state !== 33) { 13353 this.newlines.push(this.index); 13354 } 13355 switch (this.state) { 13356 case 1: { 13357 this.stateText(c); 13358 break; 13359 } 13360 case 2: { 13361 this.stateInterpolationOpen(c); 13362 break; 13363 } 13364 case 3: { 13365 this.stateInterpolation(c); 13366 break; 13367 } 13368 case 4: { 13369 this.stateInterpolationClose(c); 13370 break; 13371 } 13372 case 31: { 13373 this.stateSpecialStartSequence(c); 13374 break; 13375 } 13376 case 32: { 13377 this.stateInRCDATA(c); 13378 break; 13379 } 13380 case 26: { 13381 this.stateCDATASequence(c); 13382 break; 13383 } 13384 case 19: { 13385 this.stateInAttrValueDoubleQuotes(c); 13386 break; 13387 } 13388 case 12: { 13389 this.stateInAttrName(c); 13390 break; 13391 } 13392 case 13: { 13393 this.stateInDirName(c); 13394 break; 13395 } 13396 case 14: { 13397 this.stateInDirArg(c); 13398 break; 13399 } 13400 case 15: { 13401 this.stateInDynamicDirArg(c); 13402 break; 13403 } 13404 case 16: { 13405 this.stateInDirModifier(c); 13406 break; 13407 } 13408 case 28: { 13409 this.stateInCommentLike(c); 13410 break; 13411 } 13412 case 27: { 13413 this.stateInSpecialComment(c); 13414 break; 13415 } 13416 case 11: { 13417 this.stateBeforeAttrName(c); 13418 break; 13419 } 13420 case 6: { 13421 this.stateInTagName(c); 13422 break; 13423 } 13424 case 34: { 13425 this.stateInSFCRootTagName(c); 13426 break; 13427 } 13428 case 9: { 13429 this.stateInClosingTagName(c); 13430 break; 13431 } 13432 case 5: { 13433 this.stateBeforeTagName(c); 13434 break; 13435 } 13436 case 17: { 13437 this.stateAfterAttrName(c); 13438 break; 13439 } 13440 case 20: { 13441 this.stateInAttrValueSingleQuotes(c); 13442 break; 13443 } 13444 case 18: { 13445 this.stateBeforeAttrValue(c); 13446 break; 13447 } 13448 case 8: { 13449 this.stateBeforeClosingTagName(c); 13450 break; 13451 } 13452 case 10: { 13453 this.stateAfterClosingTagName(c); 13454 break; 13455 } 13456 case 29: { 13457 this.stateBeforeSpecialS(c); 13458 break; 13459 } 13460 case 30: { 13461 this.stateBeforeSpecialT(c); 13462 break; 13463 } 13464 case 21: { 13465 this.stateInAttrValueNoQuotes(c); 13466 break; 13467 } 13468 case 7: { 13469 this.stateInSelfClosingTag(c); 13470 break; 13471 } 13472 case 23: { 13473 this.stateInDeclaration(c); 13474 break; 13475 } 13476 case 22: { 13477 this.stateBeforeDeclaration(c); 13478 break; 13479 } 13480 case 25: { 13481 this.stateBeforeComment(c); 13482 break; 13483 } 13484 case 24: { 13485 this.stateInProcessingInstruction(c); 13486 break; 13487 } 13488 case 33: { 13489 this.stateInEntity(); 13490 break; 13491 } 13492 } 13493 this.index++; 13494 } 13495 this.cleanup(); 13496 this.finish(); 13497 } 13498 /** 13499 * Remove data that has already been consumed from the buffer. 13500 */ 13501 cleanup() { 13502 if (this.sectionStart !== this.index) { 13503 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 13504 this.cbs.ontext(this.sectionStart, this.index); 13505 this.sectionStart = this.index; 13506 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 13507 this.cbs.onattribdata(this.sectionStart, this.index); 13508 this.sectionStart = this.index; 13509 } 13510 } 13511 } 13512 finish() { 13513 this.handleTrailingData(); 13514 this.cbs.onend(); 13515 } 13516 /** Handle any trailing data. */ 13517 handleTrailingData() { 13518 const endIndex = this.buffer.length; 13519 if (this.sectionStart >= endIndex) { 13520 return; 13521 } 13522 if (this.state === 28) { 13523 if (this.currentSequence === Sequences.CdataEnd) { 13524 this.cbs.oncdata(this.sectionStart, endIndex); 13525 } else { 13526 this.cbs.oncomment(this.sectionStart, endIndex); 13527 } 13528 } 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 { 13529 this.cbs.ontext(this.sectionStart, endIndex); 13530 } 13531 } 13532 emitCodePoint(cp, consumed) { 13533 } 13534 } 13535 13536
vendor: 9,348 bytes, lines 13536-13768
13536function defaultOnError(error) { 13537 throw error; 13538 } 13539 function defaultOnWarn(msg) { 13540 console.warn(`[Vue warn] ${msg.message}`); 13541 } 13542 function createCompilerError(code, loc, messages, additionalMessage) { 13543 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ; 13544 const error = new SyntaxError(String(msg)); 13545 error.code = code; 13546 error.loc = loc; 13547 return error; 13548 } 13549 const errorMessages = { 13550 // parse errors 13551 [0]: "Illegal comment.", 13552 [1]: "CDATA section is allowed only in XML context.", 13553 [2]: "Duplicate attribute.", 13554 [3]: "End tag cannot have attributes.", 13555 [4]: "Illegal '/' in tags.", 13556 [5]: "Unexpected EOF in tag.", 13557 [6]: "Unexpected EOF in CDATA section.", 13558 [7]: "Unexpected EOF in comment.", 13559 [8]: "Unexpected EOF in script.", 13560 [9]: "Unexpected EOF in tag.", 13561 [10]: "Incorrectly closed comment.", 13562 [11]: "Incorrectly opened comment.", 13563 [12]: "Illegal tag name. Use '<' to print '<'.", 13564 [13]: "Attribute value was expected.", 13565 [14]: "End tag name was expected.", 13566 [15]: "Whitespace was expected.", 13567 [16]: "Unexpected '<!--' in comment.", 13568 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 13569 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 13570 [19]: "Attribute name cannot start with '='.", 13571 [21]: "'<?' is allowed only in XML context.", 13572 [20]: `Unexpected null character.`, 13573 [22]: "Illegal '/' in tags.", 13574 // Vue-specific parse errors 13575 [23]: "Invalid end tag.", 13576 [24]: "Element is missing end tag.", 13577 [25]: "Interpolation end sign was not found.", 13578 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 13579 [26]: "Legal directive name was expected.", 13580 // transform errors 13581 [28]: `v-if/v-else-if is missing expression.`, 13582 [29]: `v-if/else branches must use unique keys.`, 13583 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 13584 [31]: `v-for is missing expression.`, 13585 [32]: `v-for has invalid expression.`, 13586 [33]: `<template v-for> key should be placed on the <template> tag.`, 13587 [34]: `v-bind is missing expression.`, 13588 [52]: `v-bind with same-name shorthand only allows static argument.`, 13589 [35]: `v-on is missing expression.`, 13590 [36]: `Unexpected custom directive on <slot> outlet.`, 13591 [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.`, 13592 [38]: `Duplicate slot names found. `, 13593 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 13594 [40]: `v-slot can only be used on components or <template> tags.`, 13595 [41]: `v-model is missing expression.`, 13596 [42]: `v-model value must be a valid JavaScript member expression.`, 13597 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 13598 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 13599Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 13600 [45]: `Error parsing JavaScript expression: `, 13601 [46]: `<KeepAlive> expects exactly one child component.`, 13602 [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.`, 13603 // generic errors 13604 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 13605 [48]: `ES module mode is not supported in this build of compiler.`, 13606 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 13607 [50]: `"scopeId" option is only supported in module mode.`, 13608 // just to fulfill types 13609 [53]: `` 13610 }; 13611 13612 const isStaticExp = (p) => p.type === 4 && p.isStatic; 13613 function isCoreComponent(tag) { 13614 switch (tag) { 13615 case "Teleport": 13616 case "teleport": 13617 return TELEPORT; 13618 case "Suspense": 13619 case "suspense": 13620 return SUSPENSE; 13621 case "KeepAlive": 13622 case "keep-alive": 13623 return KEEP_ALIVE; 13624 case "BaseTransition": 13625 case "base-transition": 13626 return BASE_TRANSITION; 13627 } 13628 } 13629 const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/; 13630 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 13631 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 13632 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 13633 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 13634 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 13635 const isMemberExpressionBrowser = (exp) => { 13636 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim()); 13637 let state = 0 /* inMemberExp */; 13638 let stateStack = []; 13639 let currentOpenBracketCount = 0; 13640 let currentOpenParensCount = 0; 13641 let currentStringType = null; 13642 for (let i = 0; i < path.length; i++) { 13643 const char = path.charAt(i); 13644 switch (state) { 13645 case 0 /* inMemberExp */: 13646 if (char === "[") { 13647 stateStack.push(state); 13648 state = 1 /* inBrackets */; 13649 currentOpenBracketCount++; 13650 } else if (char === "(") { 13651 stateStack.push(state); 13652 state = 2 /* inParens */; 13653 currentOpenParensCount++; 13654 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 13655 return false; 13656 } 13657 break; 13658 case 1 /* inBrackets */: 13659 if (char === `'` || char === `"` || char === "`") { 13660 stateStack.push(state); 13661 state = 3 /* inString */; 13662 currentStringType = char; 13663 } else if (char === `[`) { 13664 currentOpenBracketCount++; 13665 } else if (char === `]`) { 13666 if (!--currentOpenBracketCount) { 13667 state = stateStack.pop(); 13668 } 13669 } 13670 break; 13671 case 2 /* inParens */: 13672 if (char === `'` || char === `"` || char === "`") { 13673 stateStack.push(state); 13674 state = 3 /* inString */; 13675 currentStringType = char; 13676 } else if (char === `(`) { 13677 currentOpenParensCount++; 13678 } else if (char === `)`) { 13679 if (i === path.length - 1) { 13680 return false; 13681 } 13682 if (!--currentOpenParensCount) { 13683 state = stateStack.pop(); 13684 } 13685 } 13686 break; 13687 case 3 /* inString */: 13688 if (char === currentStringType) { 13689 state = stateStack.pop(); 13690 currentStringType = null; 13691 } 13692 break; 13693 } 13694 } 13695 return !currentOpenBracketCount && !currentOpenParensCount; 13696 }; 13697 const isMemberExpression = isMemberExpressionBrowser ; 13698 const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/; 13699 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 13700 const isFnExpression = isFnExpressionBrowser ; 13701 function assert(condition, msg) { 13702 if (!condition) { 13703 throw new Error(msg || `unexpected compiler condition`); 13704 } 13705 } 13706 function findDir(node, name, allowEmpty = false) { 13707 for (let i = 0; i < node.props.length; i++) { 13708 const p = node.props[i]; 13709 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 13710 return p; 13711 } 13712 } 13713 } 13714 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 13715 for (let i = 0; i < node.props.length; i++) { 13716 const p = node.props[i]; 13717 if (p.type === 6) { 13718 if (dynamicOnly) continue; 13719 if (p.name === name && (p.value || allowEmpty)) { 13720 return p; 13721 } 13722 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 13723 return p; 13724 } 13725 } 13726 } 13727 function isStaticArgOf(arg, name) { 13728 return !!(arg && isStaticExp(arg) && arg.content === name); 13729 } 13730 function hasDynamicKeyVBind(node) { 13731 return node.props.some( 13732 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 13733 p.arg.type !== 4 || // v-bind:[_ctx.foo] 13734 !p.arg.isStatic) 13735 // v-bind:[foo] 13736 ); 13737 } 13738 function isText$1(node) { 13739 return node.type === 5 || node.type === 2; 13740 } 13741 function isVPre(p) { 13742 return p.type === 7 && p.name === "pre"; 13743 } 13744 function isVSlot(p) { 13745 return p.type === 7 && p.name === "slot"; 13746 } 13747 function isTemplateNode(node) { 13748 return node.type === 1 && node.tagType === 3; 13749 } 13750 function isSlotOutlet(node) { 13751 return node.type === 1 && node.tagType === 2; 13752 } 13753 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]); 13754 function getUnnormalizedProps(props, callPath = []) { 13755 if (props && !isString(props) && props.type === 14) { 13756 const callee = props.callee; 13757 if (!isString(callee) && propsHelperSet.has(callee)) { 13758 return getUnnormalizedProps( 13759 props.arguments[0], 13760 callPath.concat(props) 13761 ); 13762 } 13763 } 13764 return [props, callPath]; 13765 } 13766 function injectProp(node, prop, context) { 13767 let propsWithInjection; 13768 let props = node.type === 13 ? node.props : node.arguments[2];
vendor: 1,794 bytes, lines 13769-13825
13769 let callPath = []; 13770 let parentCall; 13771 if (props && !isString(props) && props.type === 14) { 13772 const ret = getUnnormalizedProps(props); 13773 props = ret[0]; 13774 callPath = ret[1]; 13775 parentCall = callPath[callPath.length - 1]; 13776 } 13777 if (props == null || isString(props)) { 13778 propsWithInjection = createObjectExpression([prop]); 13779 } else if (props.type === 14) { 13780 const first = props.arguments[0]; 13781 if (!isString(first) && first.type === 15) { 13782 if (!hasProp(prop, first)) { 13783 first.properties.unshift(prop); 13784 } 13785 } else { 13786 if (props.callee === TO_HANDLERS) { 13787 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13788 createObjectExpression([prop]), 13789 props 13790 ]); 13791 } else { 13792 props.arguments.unshift(createObjectExpression([prop])); 13793 } 13794 } 13795 !propsWithInjection && (propsWithInjection = props); 13796 } else if (props.type === 15) { 13797 if (!hasProp(prop, props)) { 13798 props.properties.unshift(prop); 13799 } 13800 propsWithInjection = props; 13801 } else { 13802 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13803 createObjectExpression([prop]), 13804 props 13805 ]); 13806 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 13807 parentCall = callPath[callPath.length - 2]; 13808 } 13809 } 13810 if (node.type === 13) { 13811 if (parentCall) { 13812 parentCall.arguments[0] = propsWithInjection; 13813 } else { 13814 node.props = propsWithInjection; 13815 } 13816 } else { 13817 if (parentCall) { 13818 parentCall.arguments[0] = propsWithInjection; 13819 } else { 13820 node.arguments[2] = propsWithInjection; 13821 } 13822 } 13823 } 13824 function hasProp(prop, props) { 13825 let result = false;
vendor: 9,778 bytes, lines 13826-14156
13826 if (prop.key.type === 4) { 13827 const propKeyName = prop.key.content; 13828 result = props.properties.some( 13829 (p) => p.key.type === 4 && p.key.content === propKeyName 13830 ); 13831 } 13832 return result; 13833 } 13834 function toValidAssetId(name, type) { 13835 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 13836 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 13837 })}`; 13838 } 13839 function getMemoedVNodeCall(node) { 13840 if (node.type === 14 && node.callee === WITH_MEMO) { 13841 return node.arguments[1].returns; 13842 } else { 13843 return node; 13844 } 13845 } 13846 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 13847 13848 const defaultParserOptions = { 13849 parseMode: "base", 13850 ns: 0, 13851 delimiters: [`{{`, `}}`], 13852 getNamespace: () => 0, 13853 isVoidTag: NO, 13854 isPreTag: NO, 13855 isIgnoreNewlineTag: NO, 13856 isCustomElement: NO, 13857 onError: defaultOnError, 13858 onWarn: defaultOnWarn, 13859 comments: true, 13860 prefixIdentifiers: false 13861 }; 13862 let currentOptions = defaultParserOptions; 13863 let currentRoot = null; 13864 let currentInput = ""; 13865 let currentOpenTag = null; 13866 let currentProp = null; 13867 let currentAttrValue = ""; 13868 let currentAttrStartIndex = -1; 13869 let currentAttrEndIndex = -1; 13870 let inPre = 0; 13871 let inVPre = false; 13872 let currentVPreBoundary = null; 13873 const stack = []; 13874 const tokenizer = new Tokenizer(stack, { 13875 onerr: emitError, 13876 ontext(start, end) { 13877 onText(getSlice(start, end), start, end); 13878 }, 13879 ontextentity(char, start, end) { 13880 onText(char, start, end); 13881 }, 13882 oninterpolation(start, end) { 13883 if (inVPre) { 13884 return onText(getSlice(start, end), start, end); 13885 } 13886 let innerStart = start + tokenizer.delimiterOpen.length; 13887 let innerEnd = end - tokenizer.delimiterClose.length; 13888 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 13889 innerStart++; 13890 } 13891 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 13892 innerEnd--; 13893 } 13894 let exp = getSlice(innerStart, innerEnd); 13895 if (exp.includes("&")) { 13896 { 13897 exp = currentOptions.decodeEntities(exp, false); 13898 } 13899 } 13900 addNode({ 13901 type: 5, 13902 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 13903 loc: getLoc(start, end) 13904 }); 13905 }, 13906 onopentagname(start, end) { 13907 const name = getSlice(start, end); 13908 currentOpenTag = { 13909 type: 1, 13910 tag: name, 13911 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 13912 tagType: 0, 13913 // will be refined on tag close 13914 props: [], 13915 children: [], 13916 loc: getLoc(start - 1, end), 13917 codegenNode: void 0 13918 }; 13919 }, 13920 onopentagend(end) { 13921 endOpenTag(end); 13922 }, 13923 onclosetag(start, end) { 13924 const name = getSlice(start, end); 13925 if (!currentOptions.isVoidTag(name)) { 13926 let found = false; 13927 for (let i = 0; i < stack.length; i++) { 13928 const e = stack[i]; 13929 if (e.tag.toLowerCase() === name.toLowerCase()) { 13930 found = true; 13931 if (i > 0) { 13932 emitError(24, stack[0].loc.start.offset); 13933 } 13934 for (let j = 0; j <= i; j++) { 13935 const el = stack.shift(); 13936 onCloseTag(el, end, j < i); 13937 } 13938 break; 13939 } 13940 } 13941 if (!found) { 13942 emitError(23, backTrack(start, 60)); 13943 } 13944 } 13945 }, 13946 onselfclosingtag(end) { 13947 const name = currentOpenTag.tag; 13948 currentOpenTag.isSelfClosing = true; 13949 endOpenTag(end); 13950 if (stack[0] && stack[0].tag === name) { 13951 onCloseTag(stack.shift(), end); 13952 } 13953 }, 13954 onattribname(start, end) { 13955 currentProp = { 13956 type: 6, 13957 name: getSlice(start, end), 13958 nameLoc: getLoc(start, end), 13959 value: void 0, 13960 loc: getLoc(start) 13961 }; 13962 }, 13963 ondirname(start, end) { 13964 const raw = getSlice(start, end); 13965 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 13966 if (!inVPre && name === "") { 13967 emitError(26, start); 13968 } 13969 if (inVPre || name === "") { 13970 currentProp = { 13971 type: 6, 13972 name: raw, 13973 nameLoc: getLoc(start, end), 13974 value: void 0, 13975 loc: getLoc(start) 13976 }; 13977 } else { 13978 currentProp = { 13979 type: 7, 13980 name, 13981 rawName: raw, 13982 exp: void 0, 13983 arg: void 0, 13984 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 13985 loc: getLoc(start) 13986 }; 13987 if (name === "pre") { 13988 inVPre = tokenizer.inVPre = true; 13989 currentVPreBoundary = currentOpenTag; 13990 const props = currentOpenTag.props; 13991 for (let i = 0; i < props.length; i++) { 13992 if (props[i].type === 7) { 13993 props[i] = dirToAttr(props[i]); 13994 } 13995 } 13996 } 13997 } 13998 }, 13999 ondirarg(start, end) { 14000 if (start === end) return; 14001 const arg = getSlice(start, end); 14002 if (inVPre && !isVPre(currentProp)) { 14003 currentProp.name += arg; 14004 setLocEnd(currentProp.nameLoc, end); 14005 } else { 14006 const isStatic = arg[0] !== `[`; 14007 currentProp.arg = createExp( 14008 isStatic ? arg : arg.slice(1, -1), 14009 isStatic, 14010 getLoc(start, end), 14011 isStatic ? 3 : 0 14012 ); 14013 } 14014 }, 14015 ondirmodifier(start, end) { 14016 const mod = getSlice(start, end); 14017 if (inVPre && !isVPre(currentProp)) { 14018 currentProp.name += "." + mod; 14019 setLocEnd(currentProp.nameLoc, end); 14020 } else if (currentProp.name === "slot") { 14021 const arg = currentProp.arg; 14022 if (arg) { 14023 arg.content += "." + mod; 14024 setLocEnd(arg.loc, end); 14025 } 14026 } else { 14027 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 14028 currentProp.modifiers.push(exp); 14029 } 14030 }, 14031 onattribdata(start, end) { 14032 currentAttrValue += getSlice(start, end); 14033 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14034 currentAttrEndIndex = end; 14035 }, 14036 onattribentity(char, start, end) { 14037 currentAttrValue += char; 14038 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14039 currentAttrEndIndex = end; 14040 }, 14041 onattribnameend(end) { 14042 const start = currentProp.loc.start.offset; 14043 const name = getSlice(start, end); 14044 if (currentProp.type === 7) { 14045 currentProp.rawName = name; 14046 } 14047 if (currentOpenTag.props.some( 14048 (p) => (p.type === 7 ? p.rawName : p.name) === name 14049 )) { 14050 emitError(2, start); 14051 } 14052 }, 14053 onattribend(quote, end) { 14054 if (currentOpenTag && currentProp) { 14055 setLocEnd(currentProp.loc, end); 14056 if (quote !== 0) { 14057 if (currentAttrValue.includes("&")) { 14058 currentAttrValue = currentOptions.decodeEntities( 14059 currentAttrValue, 14060 true 14061 ); 14062 } 14063 if (currentProp.type === 6) { 14064 if (currentProp.name === "class") { 14065 currentAttrValue = condense(currentAttrValue).trim(); 14066 } 14067 if (quote === 1 && !currentAttrValue) { 14068 emitError(13, end); 14069 } 14070 currentProp.value = { 14071 type: 2, 14072 content: currentAttrValue, 14073 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 14074 }; 14075 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 14076 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 14077 } 14078 } else { 14079 let expParseMode = 0 /* Normal */; 14080 currentProp.exp = createExp( 14081 currentAttrValue, 14082 false, 14083 getLoc(currentAttrStartIndex, currentAttrEndIndex), 14084 0, 14085 expParseMode 14086 ); 14087 if (currentProp.name === "for") { 14088 currentProp.forParseResult = parseForExpression(currentProp.exp); 14089 } 14090 } 14091 } 14092 if (currentProp.type !== 7 || currentProp.name !== "pre") { 14093 currentOpenTag.props.push(currentProp); 14094 } 14095 } 14096 currentAttrValue = ""; 14097 currentAttrStartIndex = currentAttrEndIndex = -1; 14098 }, 14099 oncomment(start, end) { 14100 if (currentOptions.comments) { 14101 addNode({ 14102 type: 3, 14103 content: getSlice(start, end), 14104 loc: getLoc(start - 4, end + 3) 14105 }); 14106 } 14107 }, 14108 onend() { 14109 const end = currentInput.length; 14110 if (tokenizer.state !== 1) { 14111 switch (tokenizer.state) { 14112 case 5: 14113 case 8: 14114 emitError(5, end); 14115 break; 14116 case 3: 14117 case 4: 14118 emitError( 14119 25, 14120 tokenizer.sectionStart 14121 ); 14122 break; 14123 case 28: 14124 if (tokenizer.currentSequence === Sequences.CdataEnd) { 14125 emitError(6, end); 14126 } else { 14127 emitError(7, end); 14128 } 14129 break; 14130 case 6: 14131 case 7: 14132 case 9: 14133 case 11: 14134 case 12: 14135 case 13: 14136 case 14: 14137 case 15: 14138 case 16: 14139 case 17: 14140 case 18: 14141 case 19: 14142 // " 14143 case 20: 14144 // ' 14145 case 21: 14146 emitError(9, end); 14147 break; 14148 } 14149 } 14150 for (let index = 0; index < stack.length; index++) { 14151 onCloseTag(stack[index], end - 1); 14152 emitError(24, stack[index].loc.start.offset); 14153 } 14154 }, 14155 oncdata(start, end) { 14156 if (stack[0].ns
vendor: 7,191 bytes, lines 14156-14386
14156 !== 0) { 14157 onText(getSlice(start, end), start, end); 14158 } else { 14159 emitError(1, start - 9); 14160 } 14161 }, 14162 onprocessinginstruction(start) { 14163 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14164 emitError( 14165 21, 14166 start - 1 14167 ); 14168 } 14169 } 14170 }); 14171 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 14172 const stripParensRE = /^\(|\)$/g; 14173 function parseForExpression(input) { 14174 const loc = input.loc; 14175 const exp = input.content; 14176 const inMatch = exp.match(forAliasRE); 14177 if (!inMatch) return; 14178 const [, LHS, RHS] = inMatch; 14179 const createAliasExpression = (content, offset, asParam = false) => { 14180 const start = loc.start.offset + offset; 14181 const end = start + content.length; 14182 return createExp( 14183 content, 14184 false, 14185 getLoc(start, end), 14186 0, 14187 asParam ? 1 /* Params */ : 0 /* Normal */ 14188 ); 14189 }; 14190 const result = { 14191 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 14192 value: void 0, 14193 key: void 0, 14194 index: void 0, 14195 finalized: false 14196 }; 14197 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 14198 const trimmedOffset = LHS.indexOf(valueContent); 14199 const iteratorMatch = valueContent.match(forIteratorRE); 14200 if (iteratorMatch) { 14201 valueContent = valueContent.replace(forIteratorRE, "").trim(); 14202 const keyContent = iteratorMatch[1].trim(); 14203 let keyOffset; 14204 if (keyContent) { 14205 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 14206 result.key = createAliasExpression(keyContent, keyOffset, true); 14207 } 14208 if (iteratorMatch[2]) { 14209 const indexContent = iteratorMatch[2].trim(); 14210 if (indexContent) { 14211 result.index = createAliasExpression( 14212 indexContent, 14213 exp.indexOf( 14214 indexContent, 14215 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 14216 ), 14217 true 14218 ); 14219 } 14220 } 14221 } 14222 if (valueContent) { 14223 result.value = createAliasExpression(valueContent, trimmedOffset, true); 14224 } 14225 return result; 14226 } 14227 function getSlice(start, end) { 14228 return currentInput.slice(start, end); 14229 } 14230 function endOpenTag(end) { 14231 if (tokenizer.inSFCRoot) { 14232 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 14233 } 14234 addNode(currentOpenTag); 14235 const { tag, ns } = currentOpenTag; 14236 if (ns === 0 && currentOptions.isPreTag(tag)) { 14237 inPre++; 14238 } 14239 if (currentOptions.isVoidTag(tag)) { 14240 onCloseTag(currentOpenTag, end); 14241 } else { 14242 stack.unshift(currentOpenTag); 14243 if (ns === 1 || ns === 2) { 14244 tokenizer.inXML = true; 14245 } 14246 } 14247 currentOpenTag = null; 14248 } 14249 function onText(content, start, end) { 14250 { 14251 const tag = stack[0] && stack[0].tag; 14252 if (tag !== "script" && tag !== "style" && content.includes("&")) { 14253 content = currentOptions.decodeEntities(content, false); 14254 } 14255 } 14256 const parent = stack[0] || currentRoot; 14257 const lastNode = parent.children[parent.children.length - 1]; 14258 if (lastNode && lastNode.type === 2) { 14259 lastNode.content += content; 14260 setLocEnd(lastNode.loc, end); 14261 } else { 14262 parent.children.push({ 14263 type: 2, 14264 content, 14265 loc: getLoc(start, end) 14266 }); 14267 } 14268 } 14269 function onCloseTag(el, end, isImplied = false) { 14270 if (isImplied) { 14271 setLocEnd(el.loc, backTrack(end, 60)); 14272 } else { 14273 setLocEnd(el.loc, lookAhead(end, 62) + 1); 14274 } 14275 if (tokenizer.inSFCRoot) { 14276 if (el.children.length) { 14277 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 14278 } else { 14279 el.innerLoc.end = extend({}, el.innerLoc.start); 14280 } 14281 el.innerLoc.source = getSlice( 14282 el.innerLoc.start.offset, 14283 el.innerLoc.end.offset 14284 ); 14285 } 14286 const { tag, ns, children } = el; 14287 if (!inVPre) { 14288 if (tag === "slot") { 14289 el.tagType = 2; 14290 } else if (isFragmentTemplate(el)) { 14291 el.tagType = 3; 14292 } else if (isComponent(el)) { 14293 el.tagType = 1; 14294 } 14295 } 14296 if (!tokenizer.inRCDATA) { 14297 el.children = condenseWhitespace(children); 14298 } 14299 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) { 14300 const first = children[0]; 14301 if (first && first.type === 2) { 14302 first.content = first.content.replace(/^\r?\n/, ""); 14303 } 14304 } 14305 if (ns === 0 && currentOptions.isPreTag(tag)) { 14306 inPre--; 14307 } 14308 if (currentVPreBoundary === el) { 14309 inVPre = tokenizer.inVPre = false; 14310 currentVPreBoundary = null; 14311 } 14312 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14313 tokenizer.inXML = false; 14314 } 14315 } 14316 function lookAhead(index, c) { 14317 let i = index; 14318 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++; 14319 return i; 14320 } 14321 function backTrack(index, c) { 14322 let i = index; 14323 while (currentInput.charCodeAt(i) !== c && i >= 0) i--; 14324 return i; 14325 } 14326 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 14327 function isFragmentTemplate({ tag, props }) { 14328 if (tag === "template") { 14329 for (let i = 0; i < props.length; i++) { 14330 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 14331 return true; 14332 } 14333 } 14334 } 14335 return false; 14336 } 14337 function isComponent({ tag, props }) { 14338 if (currentOptions.isCustomElement(tag)) { 14339 return false; 14340 } 14341 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 14342 return true; 14343 } 14344 for (let i = 0; i < props.length; i++) { 14345 const p = props[i]; 14346 if (p.type === 6) { 14347 if (p.name === "is" && p.value) { 14348 if (p.value.content.startsWith("vue:")) { 14349 return true; 14350 } 14351 } 14352 } 14353 } 14354 return false; 14355 } 14356 function isUpperCase(c) { 14357 return c > 64 && c < 91; 14358 } 14359 const windowsNewlineRE = /\r\n/g; 14360 function condenseWhitespace(nodes) { 14361 const shouldCondense = currentOptions.whitespace !== "preserve"; 14362 let removedWhitespace = false; 14363 for (let i = 0; i < nodes.length; i++) { 14364 const node = nodes[i]; 14365 if (node.type === 2) { 14366 if (!inPre) { 14367 if (isAllWhitespace(node.content)) { 14368 const prev = nodes[i - 1] && nodes[i - 1].type; 14369 const next = nodes[i + 1] && nodes[i + 1].type; 14370 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 14371 removedWhitespace = true; 14372 nodes[i] = null; 14373 } else { 14374 node.content = " "; 14375 } 14376 } else if (shouldCondense) { 14377 node.content = condense(node.content); 14378 } 14379 } else { 14380 node.content = node.content.replace(windowsNewlineRE, "\n"); 14381 } 14382 } 14383 } 14384 return removedWhitespace ? nodes.filter(Boolean) : nodes; 14385 } 14386 function
14386isAllWhitespace(str) { 14387 for (let i = 0; i < str.length; i++) { 14388 if (!isWhitespace(str.charCodeAt(i))) { 14389 return false; 14390 } 14391 } 14392 return true
vendor: 14,680 bytes, lines 14392-14864
14392; 14393 } 14394 function hasNewlineChar(str) { 14395 for (let i = 0; i < str.length; i++) { 14396 const c = str.charCodeAt(i); 14397 if (c === 10 || c === 13) { 14398 return true; 14399 } 14400 } 14401 return false; 14402 } 14403 function condense(str) { 14404 let ret = ""; 14405 let prevCharIsWhitespace = false; 14406 for (let i = 0; i < str.length; i++) { 14407 if (isWhitespace(str.charCodeAt(i))) { 14408 if (!prevCharIsWhitespace) { 14409 ret += " "; 14410 prevCharIsWhitespace = true; 14411 } 14412 } else { 14413 ret += str[i]; 14414 prevCharIsWhitespace = false; 14415 } 14416 } 14417 return ret; 14418 } 14419 function addNode(node) { 14420 (stack[0] || currentRoot).children.push(node); 14421 } 14422 function getLoc(start, end) { 14423 return { 14424 start: tokenizer.getPos(start), 14425 // @ts-expect-error allow late attachment 14426 end: end == null ? end : tokenizer.getPos(end), 14427 // @ts-expect-error allow late attachment 14428 source: end == null ? end : getSlice(start, end) 14429 }; 14430 } 14431 function cloneLoc(loc) { 14432 return getLoc(loc.start.offset, loc.end.offset); 14433 } 14434 function setLocEnd(loc, end) { 14435 loc.end = tokenizer.getPos(end); 14436 loc.source = getSlice(loc.start.offset, end); 14437 } 14438 function dirToAttr(dir) { 14439 const attr = { 14440 type: 6, 14441 name: dir.rawName, 14442 nameLoc: getLoc( 14443 dir.loc.start.offset, 14444 dir.loc.start.offset + dir.rawName.length 14445 ), 14446 value: void 0, 14447 loc: dir.loc 14448 }; 14449 if (dir.exp) { 14450 const loc = dir.exp.loc; 14451 if (loc.end.offset < dir.loc.end.offset) { 14452 loc.start.offset--; 14453 loc.start.column--; 14454 loc.end.offset++; 14455 loc.end.column++; 14456 } 14457 attr.value = { 14458 type: 2, 14459 content: dir.exp.content, 14460 loc 14461 }; 14462 } 14463 return attr; 14464 } 14465 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 14466 const exp = createSimpleExpression(content, isStatic, loc, constType); 14467 return exp; 14468 } 14469 function emitError(code, index, message) { 14470 currentOptions.onError( 14471 createCompilerError(code, getLoc(index, index), void 0, message) 14472 ); 14473 } 14474 function reset() { 14475 tokenizer.reset(); 14476 currentOpenTag = null; 14477 currentProp = null; 14478 currentAttrValue = ""; 14479 currentAttrStartIndex = -1; 14480 currentAttrEndIndex = -1; 14481 stack.length = 0; 14482 } 14483 function baseParse(input, options) { 14484 reset(); 14485 currentInput = input; 14486 currentOptions = extend({}, defaultParserOptions); 14487 if (options) { 14488 let key; 14489 for (key in options) { 14490 if (options[key] != null) { 14491 currentOptions[key] = options[key]; 14492 } 14493 } 14494 } 14495 { 14496 if (!currentOptions.decodeEntities) { 14497 throw new Error( 14498 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 14499 ); 14500 } 14501 } 14502 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 14503 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 14504 const delimiters = options && options.delimiters; 14505 if (delimiters) { 14506 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 14507 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 14508 } 14509 const root = currentRoot = createRoot([], input); 14510 tokenizer.parse(currentInput); 14511 root.loc = getLoc(0, input.length); 14512 root.children = condenseWhitespace(root.children); 14513 currentRoot = null; 14514 return root; 14515 } 14516 14517 function cacheStatic(root, context) { 14518 walk( 14519 root, 14520 void 0, 14521 context, 14522 // Root node is unfortunately non-hoistable due to potential parent 14523 // fallthrough attributes. 14524 !!getSingleElementRoot(root) 14525 ); 14526 } 14527 function getSingleElementRoot(root) { 14528 const children = root.children.filter((x) => x.type !== 3); 14529 return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null; 14530 } 14531 function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 14532 const { children } = node; 14533 const toCache = []; 14534 for (let i = 0; i < children.length; i++) { 14535 const child = children[i]; 14536 if (child.type === 1 && child.tagType === 0) { 14537 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14538 if (constantType > 0) { 14539 if (constantType >= 2) { 14540 child.codegenNode.patchFlag = -1; 14541 toCache.push(child); 14542 continue; 14543 } 14544 } else { 14545 const codegenNode = child.codegenNode; 14546 if (codegenNode.type === 13) { 14547 const flag = codegenNode.patchFlag; 14548 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 14549 const props = getNodeProps(child); 14550 if (props) { 14551 codegenNode.props = context.hoist(props); 14552 } 14553 } 14554 if (codegenNode.dynamicProps) { 14555 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 14556 } 14557 } 14558 } 14559 } else if (child.type === 12) { 14560 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14561 if (constantType >= 2) { 14562 if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) { 14563 child.codegenNode.arguments.push( 14564 -1 + (` /* ${PatchFlagNames[-1]} */` ) 14565 ); 14566 } 14567 toCache.push(child); 14568 continue; 14569 } 14570 } 14571 if (child.type === 1) { 14572 const isComponent = child.tagType === 1; 14573 if (isComponent) { 14574 context.scopes.vSlot++; 14575 } 14576 walk(child, node, context, false, inFor); 14577 if (isComponent) { 14578 context.scopes.vSlot--; 14579 } 14580 } else if (child.type === 11) { 14581 walk(child, node, context, child.children.length === 1, true); 14582 } else if (child.type === 9) { 14583 for (let i2 = 0; i2 < child.branches.length; i2++) { 14584 walk( 14585 child.branches[i2], 14586 node, 14587 context, 14588 child.branches[i2].children.length === 1, 14589 inFor 14590 ); 14591 } 14592 } 14593 } 14594 let cachedAsArray = false; 14595 if (toCache.length === children.length && node.type === 1) { 14596 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 14597 node.codegenNode.children = getCacheExpression( 14598 createArrayExpression(node.codegenNode.children) 14599 ); 14600 cachedAsArray = true; 14601 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { 14602 const slot = getSlotNode(node.codegenNode, "default"); 14603 if (slot) { 14604 slot.returns = getCacheExpression( 14605 createArrayExpression(slot.returns) 14606 ); 14607 cachedAsArray = true; 14608 } 14609 } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) { 14610 const slotName = findDir(node, "slot", true); 14611 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 14612 if (slot) { 14613 slot.returns = getCacheExpression( 14614 createArrayExpression(slot.returns) 14615 ); 14616 cachedAsArray = true; 14617 } 14618 } 14619 } 14620 if (!cachedAsArray) { 14621 for (const child of toCache) { 14622 child.codegenNode = context.cache(child.codegenNode); 14623 } 14624 } 14625 function getCacheExpression(value) { 14626 const exp = context.cache(value); 14627 exp.needArraySpread = true; 14628 return exp; 14629 } 14630 function getSlotNode(node2, name) { 14631 if (node2.children && !isArray(node2.children) && node2.children.type === 15) { 14632 const slot = node2.children.properties.find( 14633 (p) => p.key === name || p.key.content === name 14634 ); 14635 return slot && slot.value; 14636 } 14637 } 14638 if (toCache.length && context.transformHoist) { 14639 context.transformHoist(children, context, node); 14640 } 14641 } 14642 function getConstantType(node, context) { 14643 const { constantCache } = context; 14644 switch (node.type) { 14645 case 1: 14646 if (node.tagType !== 0) { 14647 return 0; 14648 } 14649 const cached = constantCache.get(node); 14650 if (cached !== void 0) { 14651 return cached; 14652 } 14653 const codegenNode = node.codegenNode; 14654 if (codegenNode.type !== 13) { 14655 return 0; 14656 } 14657 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 14658 return 0; 14659 } 14660 if (codegenNode.patchFlag === void 0) { 14661 let returnType2 = 3; 14662 const generatedPropsType = getGeneratedPropsConstantType(node, context); 14663 if (generatedPropsType === 0) { 14664 constantCache.set(node, 0); 14665 return 0; 14666 } 14667 if (generatedPropsType < returnType2) { 14668 returnType2 = generatedPropsType; 14669 } 14670 for (let i = 0; i < node.children.length; i++) { 14671 const childType = getConstantType(node.children[i], context); 14672 if (childType === 0) { 14673 constantCache.set(node, 0); 14674 return 0; 14675 } 14676 if (childType < returnType2) { 14677 returnType2 = childType; 14678 } 14679 } 14680 if (returnType2 > 1) { 14681 for (let i = 0; i < node.props.length; i++) { 14682 const p = node.props[i]; 14683 if (p.type === 7 && p.name === "bind" && p.exp) { 14684 const expType = getConstantType(p.exp, context); 14685 if (expType === 0) { 14686 constantCache.set(node, 0); 14687 return 0; 14688 } 14689 if (expType < returnType2) { 14690 returnType2 = expType; 14691 } 14692 } 14693 } 14694 } 14695 if (codegenNode.isBlock) { 14696 for (let i = 0; i < node.props.length; i++) { 14697 const p = node.props[i]; 14698 if (p.type === 7) { 14699 constantCache.set(node, 0); 14700 return 0; 14701 } 14702 } 14703 context.removeHelper(OPEN_BLOCK); 14704 context.removeHelper( 14705 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 14706 ); 14707 codegenNode.isBlock = false; 14708 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 14709 } 14710 constantCache.set(node, returnType2); 14711 return returnType2; 14712 } else { 14713 constantCache.set(node, 0); 14714 return 0; 14715 } 14716 case 2: 14717 case 3: 14718 return 3; 14719 case 9: 14720 case 11: 14721 case 10: 14722 return 0; 14723 case 5: 14724 case 12: 14725 return getConstantType(node.content, context); 14726 case 4: 14727 return node.constType; 14728 case 8: 14729 let returnType = 3; 14730 for (let i = 0; i < node.children.length; i++) { 14731 const child = node.children[i]; 14732 if (isString(child) || isSymbol(child)) { 14733 continue; 14734 } 14735 const childType = getConstantType(child, context); 14736 if (childType === 0) { 14737 return 0; 14738 } else if (childType < returnType) { 14739 returnType = childType; 14740 } 14741 } 14742 return returnType; 14743 case 20: 14744 return 2; 14745 default: 14746 return 0; 14747 } 14748 } 14749 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 14750 NORMALIZE_CLASS, 14751 NORMALIZE_STYLE, 14752 NORMALIZE_PROPS, 14753 GUARD_REACTIVE_PROPS 14754 ]); 14755 function getConstantTypeOfHelperCall(value, context) { 14756 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 14757 const arg = value.arguments[0]; 14758 if (arg.type === 4) { 14759 return getConstantType(arg, context); 14760 } else if (arg.type === 14) { 14761 return getConstantTypeOfHelperCall(arg, context); 14762 } 14763 } 14764 return 0; 14765 } 14766 function getGeneratedPropsConstantType(node, context) { 14767 let returnType = 3; 14768 const props = getNodeProps(node); 14769 if (props && props.type === 15) { 14770 const { properties } = props; 14771 for (let i = 0; i < properties.length; i++) { 14772 const { key, value } = properties[i]; 14773 const keyType = getConstantType(key, context); 14774 if (keyType === 0) { 14775 return keyType; 14776 } 14777 if (keyType < returnType) { 14778 returnType = keyType; 14779 } 14780 let valueType; 14781 if (value.type === 4) { 14782 valueType = getConstantType(value, context); 14783 } else if (value.type === 14) { 14784 valueType = getConstantTypeOfHelperCall(value, context); 14785 } else { 14786 valueType = 0; 14787 } 14788 if (valueType === 0) { 14789 return valueType; 14790 } 14791 if (valueType < returnType) { 14792 returnType = valueType; 14793 } 14794 } 14795 } 14796 return returnType; 14797 } 14798 function getNodeProps(node) { 14799 const codegenNode = node.codegenNode; 14800 if (codegenNode.type === 13) { 14801 return codegenNode.props; 14802 } 14803 } 14804 14805 function createTransformContext(root, { 14806 filename = "", 14807 prefixIdentifiers = false, 14808 hoistStatic = false, 14809 hmr = false, 14810 cacheHandlers = false, 14811 nodeTransforms = [], 14812 directiveTransforms = {}, 14813 transformHoist = null, 14814 isBuiltInComponent = NOOP, 14815 isCustomElement = NOOP, 14816 expressionPlugins = [], 14817 scopeId = null, 14818 slotted = true, 14819 ssr = false, 14820 inSSR = false, 14821 ssrCssVars = ``, 14822 bindingMetadata = EMPTY_OBJ, 14823 inline = false, 14824 isTS = false, 14825 onError = defaultOnError, 14826 onWarn = defaultOnWarn, 14827 compatConfig 14828 }) { 14829 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 14830 const context = { 14831 // options 14832 filename, 14833 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 14834 prefixIdentifiers, 14835 hoistStatic, 14836 hmr, 14837 cacheHandlers, 14838 nodeTransforms, 14839 directiveTransforms, 14840 transformHoist, 14841 isBuiltInComponent, 14842 isCustomElement, 14843 expressionPlugins, 14844 scopeId, 14845 slotted, 14846 ssr, 14847 inSSR, 14848 ssrCssVars, 14849 bindingMetadata, 14850 inline, 14851 isTS, 14852 onError, 14853 onWarn, 14854 compatConfig, 14855 // state 14856 root, 14857 helpers: /* @__PURE__ */ new Map(), 14858 components: /* @__PURE__ */ new Set(), 14859 directives: /* @__PURE__ */ new Set(), 14860 hoists: [], 14861 imports: [], 14862 cached: [], 14863 constantCache: /* @__PURE__ */ new WeakMap(), 14864
vendor: 11,982 bytes, lines 14864-15307
14864temps: 0, 14865 identifiers: /* @__PURE__ */ Object.create(null), 14866 scopes: { 14867 vFor: 0, 14868 vSlot: 0, 14869 vPre: 0, 14870 vOnce: 0 14871 }, 14872 parent: null, 14873 grandParent: null, 14874 currentNode: root, 14875 childIndex: 0, 14876 inVOnce: false, 14877 // methods 14878 helper(name) { 14879 const count = context.helpers.get(name) || 0; 14880 context.helpers.set(name, count + 1); 14881 return name; 14882 }, 14883 removeHelper(name) { 14884 const count = context.helpers.get(name); 14885 if (count) { 14886 const currentCount = count - 1; 14887 if (!currentCount) { 14888 context.helpers.delete(name); 14889 } else { 14890 context.helpers.set(name, currentCount); 14891 } 14892 } 14893 }, 14894 helperString(name) { 14895 return `_${helperNameMap[context.helper(name)]}`; 14896 }, 14897 replaceNode(node) { 14898 { 14899 if (!context.currentNode) { 14900 throw new Error(`Node being replaced is already removed.`); 14901 } 14902 if (!context.parent) { 14903 throw new Error(`Cannot replace root node.`); 14904 } 14905 } 14906 context.parent.children[context.childIndex] = context.currentNode = node; 14907 }, 14908 removeNode(node) { 14909 if (!context.parent) { 14910 throw new Error(`Cannot remove root node.`); 14911 } 14912 const list = context.parent.children; 14913 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 14914 if (removalIndex < 0) { 14915 throw new Error(`node being removed is not a child of current parent`); 14916 } 14917 if (!node || node === context.currentNode) { 14918 context.currentNode = null; 14919 context.onNodeRemoved(); 14920 } else { 14921 if (context.childIndex > removalIndex) { 14922 context.childIndex--; 14923 context.onNodeRemoved(); 14924 } 14925 } 14926 context.parent.children.splice(removalIndex, 1); 14927 }, 14928 onNodeRemoved: NOOP, 14929 addIdentifiers(exp) { 14930 }, 14931 removeIdentifiers(exp) { 14932 }, 14933 hoist(exp) { 14934 if (isString(exp)) exp = createSimpleExpression(exp); 14935 context.hoists.push(exp); 14936 const identifier = createSimpleExpression( 14937 `_hoisted_${context.hoists.length}`, 14938 false, 14939 exp.loc, 14940 2 14941 ); 14942 identifier.hoisted = exp; 14943 return identifier; 14944 }, 14945 cache(exp, isVNode = false, inVOnce = false) { 14946 const cacheExp = createCacheExpression( 14947 context.cached.length, 14948 exp, 14949 isVNode, 14950 inVOnce 14951 ); 14952 context.cached.push(cacheExp); 14953 return cacheExp; 14954 } 14955 }; 14956 return context; 14957 } 14958 function transform(root, options) { 14959 const context = createTransformContext(root, options); 14960 traverseNode(root, context); 14961 if (options.hoistStatic) { 14962 cacheStatic(root, context); 14963 } 14964 if (!options.ssr) { 14965 createRootCodegen(root, context); 14966 } 14967 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 14968 root.components = [...context.components]; 14969 root.directives = [...context.directives]; 14970 root.imports = context.imports; 14971 root.hoists = context.hoists; 14972 root.temps = context.temps; 14973 root.cached = context.cached; 14974 root.transformed = true; 14975 } 14976 function createRootCodegen(root, context) { 14977 const { helper } = context; 14978 const { children } = root; 14979 if (children.length === 1) { 14980 const singleElementRootChild = getSingleElementRoot(root); 14981 if (singleElementRootChild && singleElementRootChild.codegenNode) { 14982 const codegenNode = singleElementRootChild.codegenNode; 14983 if (codegenNode.type === 13) { 14984 convertToBlock(codegenNode, context); 14985 } 14986 root.codegenNode = codegenNode; 14987 } else { 14988 root.codegenNode = children[0]; 14989 } 14990 } else if (children.length > 1) { 14991 let patchFlag = 64; 14992 if (children.filter((c) => c.type !== 3).length === 1) { 14993 patchFlag |= 2048; 14994 } 14995 root.codegenNode = createVNodeCall( 14996 context, 14997 helper(FRAGMENT), 14998 void 0, 14999 root.children, 15000 patchFlag, 15001 void 0, 15002 void 0, 15003 true, 15004 void 0, 15005 false 15006 ); 15007 } else ; 15008 } 15009 function traverseChildren(parent, context) { 15010 let i = 0; 15011 const nodeRemoved = () => { 15012 i--; 15013 }; 15014 for (; i < parent.children.length; i++) { 15015 const child = parent.children[i]; 15016 if (isString(child)) continue; 15017 context.grandParent = context.parent; 15018 context.parent = parent; 15019 context.childIndex = i; 15020 context.onNodeRemoved = nodeRemoved; 15021 traverseNode(child, context); 15022 } 15023 } 15024 function traverseNode(node, context) { 15025 context.currentNode = node; 15026 const { nodeTransforms } = context; 15027 const exitFns = []; 15028 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 15029 const onExit = nodeTransforms[i2](node, context); 15030 if (onExit) { 15031 if (isArray(onExit)) { 15032 exitFns.push(...onExit); 15033 } else { 15034 exitFns.push(onExit); 15035 } 15036 } 15037 if (!context.currentNode) { 15038 return; 15039 } else { 15040 node = context.currentNode; 15041 } 15042 } 15043 switch (node.type) { 15044 case 3: 15045 if (!context.ssr) { 15046 context.helper(CREATE_COMMENT); 15047 } 15048 break; 15049 case 5: 15050 if (!context.ssr) { 15051 context.helper(TO_DISPLAY_STRING); 15052 } 15053 break; 15054 // for container types, further traverse downwards 15055 case 9: 15056 for (let i2 = 0; i2 < node.branches.length; i2++) { 15057 traverseNode(node.branches[i2], context); 15058 } 15059 break; 15060 case 10: 15061 case 11: 15062 case 1: 15063 case 0: 15064 traverseChildren(node, context); 15065 break; 15066 } 15067 context.currentNode = node; 15068 let i = exitFns.length; 15069 while (i--) { 15070 exitFns[i](); 15071 } 15072 } 15073 function createStructuralDirectiveTransform(name, fn) { 15074 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 15075 return (node, context) => { 15076 if (node.type === 1) { 15077 const { props } = node; 15078 if (node.tagType === 3 && props.some(isVSlot)) { 15079 return; 15080 } 15081 const exitFns = []; 15082 for (let i = 0; i < props.length; i++) { 15083 const prop = props[i]; 15084 if (prop.type === 7 && matches(prop.name)) { 15085 props.splice(i, 1); 15086 i--; 15087 const onExit = fn(node, prop, context); 15088 if (onExit) exitFns.push(onExit); 15089 } 15090 } 15091 return exitFns; 15092 } 15093 }; 15094 } 15095 15096 const PURE_ANNOTATION = `/*@__PURE__*/`; 15097 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 15098 function createCodegenContext(ast, { 15099 mode = "function", 15100 prefixIdentifiers = mode === "module", 15101 sourceMap = false, 15102 filename = `template.vue.html`, 15103 scopeId = null, 15104 optimizeImports = false, 15105 runtimeGlobalName = `Vue`, 15106 runtimeModuleName = `vue`, 15107 ssrRuntimeModuleName = "vue/server-renderer", 15108 ssr = false, 15109 isTS = false, 15110 inSSR = false 15111 }) { 15112 const context = { 15113 mode, 15114 prefixIdentifiers, 15115 sourceMap, 15116 filename, 15117 scopeId, 15118 optimizeImports, 15119 runtimeGlobalName, 15120 runtimeModuleName, 15121 ssrRuntimeModuleName, 15122 ssr, 15123 isTS, 15124 inSSR, 15125 source: ast.source, 15126 code: ``, 15127 column: 1, 15128 line: 1, 15129 offset: 0, 15130 indentLevel: 0, 15131 pure: false, 15132 map: void 0, 15133 helper(key) { 15134 return `_${helperNameMap[key]}`; 15135 }, 15136 push(code, newlineIndex = -2 /* None */, node) { 15137 context.code += code; 15138 }, 15139 indent() { 15140 newline(++context.indentLevel); 15141 }, 15142 deindent(withoutNewLine = false) { 15143 if (withoutNewLine) { 15144 --context.indentLevel; 15145 } else { 15146 newline(--context.indentLevel); 15147 } 15148 }, 15149 newline() { 15150 newline(context.indentLevel); 15151 } 15152 }; 15153 function newline(n) { 15154 context.push("\n" + ` `.repeat(n), 0 /* Start */); 15155 } 15156 return context; 15157 } 15158 function generate(ast, options = {}) { 15159 const context = createCodegenContext(ast, options); 15160 if (options.onContextCreated) options.onContextCreated(context); 15161 const { 15162 mode, 15163 push, 15164 prefixIdentifiers, 15165 indent, 15166 deindent, 15167 newline, 15168 scopeId, 15169 ssr 15170 } = context; 15171 const helpers = Array.from(ast.helpers); 15172 const hasHelpers = helpers.length > 0; 15173 const useWithBlock = !prefixIdentifiers && mode !== "module"; 15174 const preambleContext = context; 15175 { 15176 genFunctionPreamble(ast, preambleContext); 15177 } 15178 const functionName = ssr ? `ssrRender` : `render`; 15179 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 15180 const signature = args.join(", "); 15181 { 15182 push(`function ${functionName}(${signature}) {`); 15183 } 15184 indent(); 15185 if (useWithBlock) { 15186 push(`with (_ctx) {`); 15187 indent(); 15188 if (hasHelpers) { 15189 push( 15190 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 15191`, 15192 -1 /* End */ 15193 ); 15194 newline(); 15195 } 15196 } 15197 if (ast.components.length) { 15198 genAssets(ast.components, "component", context); 15199 if (ast.directives.length || ast.temps > 0) { 15200 newline(); 15201 } 15202 } 15203 if (ast.directives.length) { 15204 genAssets(ast.directives, "directive", context); 15205 if (ast.temps > 0) { 15206 newline(); 15207 } 15208 } 15209 if (ast.temps > 0) { 15210 push(`let `); 15211 for (let i = 0; i < ast.temps; i++) { 15212 push(`${i > 0 ? `, ` : ``}_temp${i}`); 15213 } 15214 } 15215 if (ast.components.length || ast.directives.length || ast.temps) { 15216 push(` 15217`, 0 /* Start */); 15218 newline(); 15219 } 15220 if (!ssr) { 15221 push(`return `); 15222 } 15223 if (ast.codegenNode) { 15224 genNode(ast.codegenNode, context); 15225 } else { 15226 push(`null`); 15227 } 15228 if (useWithBlock) { 15229 deindent(); 15230 push(`}`); 15231 } 15232 deindent(); 15233 push(`}`); 15234 return { 15235 ast, 15236 code: context.code, 15237 preamble: ``, 15238 map: context.map ? context.map.toJSON() : void 0 15239 }; 15240 } 15241 function genFunctionPreamble(ast, context) { 15242 const { 15243 ssr, 15244 prefixIdentifiers, 15245 push, 15246 newline, 15247 runtimeModuleName, 15248 runtimeGlobalName, 15249 ssrRuntimeModuleName 15250 } = context; 15251 const VueBinding = runtimeGlobalName; 15252 const helpers = Array.from(ast.helpers); 15253 if (helpers.length > 0) { 15254 { 15255 push(`const _Vue = ${VueBinding} 15256`, -1 /* End */); 15257 if (ast.hoists.length) { 15258 const staticHelpers = [ 15259 CREATE_VNODE, 15260 CREATE_ELEMENT_VNODE, 15261 CREATE_COMMENT, 15262 CREATE_TEXT, 15263 CREATE_STATIC 15264 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 15265 push(`const { ${staticHelpers} } = _Vue 15266`, -1 /* End */); 15267 } 15268 } 15269 } 15270 genHoists(ast.hoists, context); 15271 newline(); 15272 push(`return `); 15273 } 15274 function genAssets(assets, type, { helper, push, newline, isTS }) { 15275 const resolver = helper( 15276 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 15277 ); 15278 for (let i = 0; i < assets.length; i++) { 15279 let id = assets[i]; 15280 const maybeSelfReference = id.endsWith("__self"); 15281 if (maybeSelfReference) { 15282 id = id.slice(0, -6); 15283 } 15284 push( 15285 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 15286 ); 15287 if (i < assets.length - 1) { 15288 newline(); 15289 } 15290 } 15291 } 15292 function genHoists(hoists, context) { 15293 if (!hoists.length) { 15294 return; 15295 } 15296 context.pure = true; 15297 const { push, newline } = context; 15298 newline(); 15299 for (let i = 0; i < hoists.length; i++) { 15300 const exp = hoists[i]; 15301 if (exp) { 15302 push(`const _hoisted_${i + 1} = `); 15303 genNode(exp, context); 15304 newline(); 15305 } 15306 } 15307 context.pure = false;
vendor: 4,650 bytes, lines 15308-15485
15308 } 15309 function isText(n) { 15310 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 15311 } 15312 function genNodeListAsArray(nodes, context) { 15313 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 15314 context.push(`[`); 15315 multilines && context.indent(); 15316 genNodeList(nodes, context, multilines); 15317 multilines && context.deindent(); 15318 context.push(`]`); 15319 } 15320 function genNodeList(nodes, context, multilines = false, comma = true) { 15321 const { push, newline } = context; 15322 for (let i = 0; i < nodes.length; i++) { 15323 const node = nodes[i]; 15324 if (isString(node)) { 15325 push(node, -3 /* Unknown */); 15326 } else if (isArray(node)) { 15327 genNodeListAsArray(node, context); 15328 } else { 15329 genNode(node, context); 15330 } 15331 if (i < nodes.length - 1) { 15332 if (multilines) { 15333 comma && push(","); 15334 newline(); 15335 } else { 15336 comma && push(", "); 15337 } 15338 } 15339 } 15340 } 15341 function genNode(node, context) { 15342 if (isString(node)) { 15343 context.push(node, -3 /* Unknown */); 15344 return; 15345 } 15346 if (isSymbol(node)) { 15347 context.push(context.helper(node)); 15348 return; 15349 } 15350 switch (node.type) { 15351 case 1: 15352 case 9: 15353 case 11: 15354 assert( 15355 node.codegenNode != null, 15356 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 15357 ); 15358 genNode(node.codegenNode, context); 15359 break; 15360 case 2: 15361 genText(node, context); 15362 break; 15363 case 4: 15364 genExpression(node, context); 15365 break; 15366 case 5: 15367 genInterpolation(node, context); 15368 break; 15369 case 12: 15370 genNode(node.codegenNode, context); 15371 break; 15372 case 8: 15373 genCompoundExpression(node, context); 15374 break; 15375 case 3: 15376 genComment(node, context); 15377 break; 15378 case 13: 15379 genVNodeCall(node, context); 15380 break; 15381 case 14: 15382 genCallExpression(node, context); 15383 break; 15384 case 15: 15385 genObjectExpression(node, context); 15386 break; 15387 case 17: 15388 genArrayExpression(node, context); 15389 break; 15390 case 18: 15391 genFunctionExpression(node, context); 15392 break; 15393 case 19: 15394 genConditionalExpression(node, context); 15395 break; 15396 case 20: 15397 genCacheExpression(node, context); 15398 break; 15399 case 21: 15400 genNodeList(node.body, context, true, false); 15401 break; 15402 // SSR only types 15403 case 22: 15404 break; 15405 case 23: 15406 break; 15407 case 24: 15408 break; 15409 case 25: 15410 break; 15411 case 26: 15412 break; 15413 /* v8 ignore start */ 15414 case 10: 15415 break; 15416 default: 15417 { 15418 assert(false, `unhandled codegen node type: ${node.type}`); 15419 const exhaustiveCheck = node; 15420 return exhaustiveCheck; 15421 } 15422 } 15423 } 15424 function genText(node, context) { 15425 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 15426 } 15427 function genExpression(node, context) { 15428 const { content, isStatic } = node; 15429 context.push( 15430 isStatic ? JSON.stringify(content) : content, 15431 -3 /* Unknown */, 15432 node 15433 ); 15434 } 15435 function genInterpolation(node, context) { 15436 const { push, helper, pure } = context; 15437 if (pure) push(PURE_ANNOTATION); 15438 push(`${helper(TO_DISPLAY_STRING)}(`); 15439 genNode(node.content, context); 15440 push(`)`); 15441 } 15442 function genCompoundExpression(node, context) { 15443 for (let i = 0; i < node.children.length; i++) { 15444 const child = node.children[i]; 15445 if (isString(child)) { 15446 context.push(child, -3 /* Unknown */); 15447 } else { 15448 genNode(child, context); 15449 } 15450 } 15451 } 15452 function genExpressionAsPropertyKey(node, context) { 15453 const { push } = context; 15454 if (node.type === 8) { 15455 push(`[`); 15456 genCompoundExpression(node, context); 15457 push(`]`); 15458 } else if (node.isStatic) { 15459 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 15460 push(text, -2 /* None */, node); 15461 } else { 15462 push(`[${node.content}]`, -3 /* Unknown */, node); 15463 } 15464 } 15465 function genComment(node, context) { 15466 const { push, helper, pure } = context; 15467 if (pure) { 15468 push(PURE_ANNOTATION); 15469 } 15470 push( 15471 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 15472 -3 /* Unknown */, 15473 node 15474 ); 15475 } 15476 function genVNodeCall(node, context) { 15477 const { push, helper, pure } = context; 15478 const { 15479 tag, 15480 props, 15481 children, 15482 patchFlag, 15483 dynamicProps, 15484 directives, 15485 isBlock,
vendor: 6,156 bytes, lines 15486-15692
15486 disableTracking, 15487 isComponent 15488 } = node; 15489 let patchFlagString; 15490 if (patchFlag) { 15491 { 15492 if (patchFlag < 0) { 15493 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15494 } else { 15495 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15496 patchFlagString = patchFlag + ` /* ${flagNames} */`; 15497 } 15498 } 15499 } 15500 if (directives) { 15501 push(helper(WITH_DIRECTIVES) + `(`); 15502 } 15503 if (isBlock) { 15504 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 15505 } 15506 if (pure) { 15507 push(PURE_ANNOTATION); 15508 } 15509 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 15510 push(helper(callHelper) + `(`, -2 /* None */, node); 15511 genNodeList( 15512 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 15513 context 15514 ); 15515 push(`)`); 15516 if (isBlock) { 15517 push(`)`); 15518 } 15519 if (directives) { 15520 push(`, `); 15521 genNode(directives, context); 15522 push(`)`); 15523 } 15524 } 15525 function genNullableArgs(args) { 15526 let i = args.length; 15527 while (i--) { 15528 if (args[i] != null) break; 15529 } 15530 return args.slice(0, i + 1).map((arg) => arg || `null`); 15531 } 15532 function genCallExpression(node, context) { 15533 const { push, helper, pure } = context; 15534 const callee = isString(node.callee) ? node.callee : helper(node.callee); 15535 if (pure) { 15536 push(PURE_ANNOTATION); 15537 } 15538 push(callee + `(`, -2 /* None */, node); 15539 genNodeList(node.arguments, context); 15540 push(`)`); 15541 } 15542 function genObjectExpression(node, context) { 15543 const { push, indent, deindent, newline } = context; 15544 const { properties } = node; 15545 if (!properties.length) { 15546 push(`{}`, -2 /* None */, node); 15547 return; 15548 } 15549 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 15550 push(multilines ? `{` : `{ `); 15551 multilines && indent(); 15552 for (let i = 0; i < properties.length; i++) { 15553 const { key, value } = properties[i]; 15554 genExpressionAsPropertyKey(key, context); 15555 push(`: `); 15556 genNode(value, context); 15557 if (i < properties.length - 1) { 15558 push(`,`); 15559 newline(); 15560 } 15561 } 15562 multilines && deindent(); 15563 push(multilines ? `}` : ` }`); 15564 } 15565 function genArrayExpression(node, context) { 15566 genNodeListAsArray(node.elements, context); 15567 } 15568 function genFunctionExpression(node, context) { 15569 const { push, indent, deindent } = context; 15570 const { params, returns, body, newline, isSlot } = node; 15571 if (isSlot) { 15572 push(`_${helperNameMap[WITH_CTX]}(`); 15573 } 15574 push(`(`, -2 /* None */, node); 15575 if (isArray(params)) { 15576 genNodeList(params, context); 15577 } else if (params) { 15578 genNode(params, context); 15579 } 15580 push(`) => `); 15581 if (newline || body) { 15582 push(`{`); 15583 indent(); 15584 } 15585 if (returns) { 15586 if (newline) { 15587 push(`return `); 15588 } 15589 if (isArray(returns)) { 15590 genNodeListAsArray(returns, context); 15591 } else { 15592 genNode(returns, context); 15593 } 15594 } else if (body) { 15595 genNode(body, context); 15596 } 15597 if (newline || body) { 15598 deindent(); 15599 push(`}`); 15600 } 15601 if (isSlot) { 15602 push(`)`); 15603 } 15604 } 15605 function genConditionalExpression(node, context) { 15606 const { test, consequent, alternate, newline: needNewline } = node; 15607 const { push, indent, deindent, newline } = context; 15608 if (test.type === 4) { 15609 const needsParens = !isSimpleIdentifier(test.content); 15610 needsParens && push(`(`); 15611 genExpression(test, context); 15612 needsParens && push(`)`); 15613 } else { 15614 push(`(`); 15615 genNode(test, context); 15616 push(`)`); 15617 } 15618 needNewline && indent(); 15619 context.indentLevel++; 15620 needNewline || push(` `); 15621 push(`? `); 15622 genNode(consequent, context); 15623 context.indentLevel--; 15624 needNewline && newline(); 15625 needNewline || push(` `); 15626 push(`: `); 15627 const isNested = alternate.type === 19; 15628 if (!isNested) { 15629 context.indentLevel++; 15630 } 15631 genNode(alternate, context); 15632 if (!isNested) { 15633 context.indentLevel--; 15634 } 15635 needNewline && deindent( 15636 true 15637 /* without newline */ 15638 ); 15639 } 15640 function genCacheExpression(node, context) { 15641 const { push, helper, indent, deindent, newline } = context; 15642 const { needPauseTracking, needArraySpread } = node; 15643 if (needArraySpread) { 15644 push(`[...(`); 15645 } 15646 push(`_cache[${node.index}] || (`); 15647 if (needPauseTracking) { 15648 indent(); 15649 push(`${helper(SET_BLOCK_TRACKING)}(-1`); 15650 if (node.inVOnce) push(`, true`); 15651 push(`),`); 15652 newline(); 15653 push(`(`); 15654 } 15655 push(`_cache[${node.index}] = `); 15656 genNode(node.value, context); 15657 if (needPauseTracking) { 15658 push(`).cacheIndex = ${node.index},`); 15659 newline(); 15660 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 15661 newline(); 15662 push(`_cache[${node.index}]`); 15663 deindent(); 15664 } 15665 push(`)`); 15666 if (needArraySpread) { 15667 push(`)]`); 15668 } 15669 } 15670 15671 const prohibitedKeywordRE = new RegExp( 15672 "\\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" 15673 ); 15674 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 15675 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 15676 const exp = node.content; 15677 if (!exp.trim()) { 15678 return; 15679 } 15680 try { 15681 new Function( 15682 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 15683 ); 15684 } catch (e) { 15685 let message = e.message; 15686 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 15687 if (keywordMatch) { 15688 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 15689 } 15690 context.onError( 15691 createCompilerError( 15692 4
vendor: 3,501 bytes, lines 15692-15805
156925, 15693 node.loc, 15694 void 0, 15695 message 15696 ) 15697 ); 15698 } 15699 } 15700 15701 const transformExpression = (node, context) => { 15702 if (node.type === 5) { 15703 node.content = processExpression( 15704 node.content, 15705 context 15706 ); 15707 } else if (node.type === 1) { 15708 const memo = findDir(node, "memo"); 15709 for (let i = 0; i < node.props.length; i++) { 15710 const dir = node.props[i]; 15711 if (dir.type === 7 && dir.name !== "for") { 15712 const exp = dir.exp; 15713 const arg = dir.arg; 15714 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor) 15715 !(memo && arg && arg.type === 4 && arg.content === "key")) { 15716 dir.exp = processExpression( 15717 exp, 15718 context, 15719 // slot args must be processed as function params 15720 dir.name === "slot" 15721 ); 15722 } 15723 if (arg && arg.type === 4 && !arg.isStatic) { 15724 dir.arg = processExpression(arg, context); 15725 } 15726 } 15727 } 15728 } 15729 }; 15730 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 15731 { 15732 { 15733 validateBrowserExpression(node, context, asParams, asRawStatements); 15734 } 15735 return node; 15736 } 15737 } 15738 15739 const transformIf = createStructuralDirectiveTransform( 15740 /^(?:if|else|else-if)$/, 15741 (node, dir, context) => { 15742 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 15743 const siblings = context.parent.children; 15744 let i = siblings.indexOf(ifNode); 15745 let key = 0; 15746 while (i-- >= 0) { 15747 const sibling = siblings[i]; 15748 if (sibling && sibling.type === 9) { 15749 key += sibling.branches.length; 15750 } 15751 } 15752 return () => { 15753 if (isRoot) { 15754 ifNode.codegenNode = createCodegenNodeForBranch( 15755 branch, 15756 key, 15757 context 15758 ); 15759 } else { 15760 const parentCondition = getParentCondition(ifNode.codegenNode); 15761 parentCondition.alternate = createCodegenNodeForBranch( 15762 branch, 15763 key + ifNode.branches.length - 1, 15764 context 15765 ); 15766 } 15767 }; 15768 }); 15769 } 15770 ); 15771 function processIf(node, dir, context, processCodegen) { 15772 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 15773 const loc = dir.exp ? dir.exp.loc : node.loc; 15774 context.onError( 15775 createCompilerError(28, dir.loc) 15776 ); 15777 dir.exp = createSimpleExpression(`true`, false, loc); 15778 } 15779 if (dir.exp) { 15780 validateBrowserExpression(dir.exp, context); 15781 } 15782 if (dir.name === "if") { 15783 const branch = createIfBranch(node, dir); 15784 const ifNode = { 15785 type: 9, 15786 loc: cloneLoc(node.loc), 15787 branches: [branch] 15788 }; 15789 context.replaceNode(ifNode); 15790 if (processCodegen) { 15791 return processCodegen(ifNode, branch, true); 15792 } 15793 } else { 15794 const siblings = context.parent.children; 15795 const comments = []; 15796 let i = siblings.indexOf(node); 15797 while (i-- >= -1) { 15798 const sibling = siblings[i]; 15799 if (sibling && sibling.type === 3) { 15800 context.removeNode(sibling); 15801 comments.unshift(sibling); 15802 continue; 15803 } 15804 if (sibling && sibling.type === 2 && !sibling.content.trim().length) { 15805 context.removeNode(sibling);
vendor: 5,261 bytes, lines 15805-15971
15805 15806 continue; 15807 } 15808 if (sibling && sibling.type === 9) { 15809 if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) { 15810 context.onError( 15811 createCompilerError(30, node.loc) 15812 ); 15813 } 15814 context.removeNode(); 15815 const branch = createIfBranch(node, dir); 15816 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 15817 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 15818 branch.children = [...comments, ...branch.children]; 15819 } 15820 { 15821 const key = branch.userKey; 15822 if (key) { 15823 sibling.branches.forEach(({ userKey }) => { 15824 if (isSameKey(userKey, key)) { 15825 context.onError( 15826 createCompilerError( 15827 29, 15828 branch.userKey.loc 15829 ) 15830 ); 15831 } 15832 }); 15833 } 15834 } 15835 sibling.branches.push(branch); 15836 const onExit = processCodegen && processCodegen(sibling, branch, false); 15837 traverseNode(branch, context); 15838 if (onExit) onExit(); 15839 context.currentNode = null; 15840 } else { 15841 context.onError( 15842 createCompilerError(30, node.loc) 15843 ); 15844 } 15845 break; 15846 } 15847 } 15848 } 15849 function createIfBranch(node, dir) { 15850 const isTemplateIf = node.tagType === 3; 15851 return { 15852 type: 10, 15853 loc: node.loc, 15854 condition: dir.name === "else" ? void 0 : dir.exp, 15855 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 15856 userKey: findProp(node, `key`), 15857 isTemplateIf 15858 }; 15859 } 15860 function createCodegenNodeForBranch(branch, keyIndex, context) { 15861 if (branch.condition) { 15862 return createConditionalExpression( 15863 branch.condition, 15864 createChildrenCodegenNode(branch, keyIndex, context), 15865 // make sure to pass in asBlock: true so that the comment node call 15866 // closes the current block. 15867 createCallExpression(context.helper(CREATE_COMMENT), [ 15868 '"v-if"' , 15869 "true" 15870 ]) 15871 ); 15872 } else { 15873 return createChildrenCodegenNode(branch, keyIndex, context); 15874 } 15875 } 15876 function createChildrenCodegenNode(branch, keyIndex, context) { 15877 const { helper } = context; 15878 const keyProperty = createObjectProperty( 15879 `key`, 15880 createSimpleExpression( 15881 `${keyIndex}`, 15882 false, 15883 locStub, 15884 2 15885 ) 15886 ); 15887 const { children } = branch; 15888 const firstChild = children[0]; 15889 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 15890 if (needFragmentWrapper) { 15891 if (children.length === 1 && firstChild.type === 11) { 15892 const vnodeCall = firstChild.codegenNode; 15893 injectProp(vnodeCall, keyProperty, context); 15894 return vnodeCall; 15895 } else { 15896 let patchFlag = 64; 15897 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 15898 patchFlag |= 2048; 15899 } 15900 return createVNodeCall( 15901 context, 15902 helper(FRAGMENT), 15903 createObjectExpression([keyProperty]), 15904 children, 15905 patchFlag, 15906 void 0, 15907 void 0, 15908 true, 15909 false, 15910 false, 15911 branch.loc 15912 ); 15913 } 15914 } else { 15915 const ret = firstChild.codegenNode; 15916 const vnodeCall = getMemoedVNodeCall(ret); 15917 if (vnodeCall.type === 13) { 15918 convertToBlock(vnodeCall, context); 15919 } 15920 injectProp(vnodeCall, keyProperty, context); 15921 return ret; 15922 } 15923 } 15924 function isSameKey(a, b) { 15925 if (!a || a.type !== b.type) { 15926 return false; 15927 } 15928 if (a.type === 6) { 15929 if (a.value.content !== b.value.content) { 15930 return false; 15931 } 15932 } else { 15933 const exp = a.exp; 15934 const branchExp = b.exp; 15935 if (exp.type !== branchExp.type) { 15936 return false; 15937 } 15938 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 15939 return false; 15940 } 15941 } 15942 return true; 15943 } 15944 function getParentCondition(node) { 15945 while (true) { 15946 if (node.type === 19) { 15947 if (node.alternate.type === 19) { 15948 node = node.alternate; 15949 } else { 15950 return node; 15951 } 15952 } else if (node.type === 20) { 15953 node = node.value; 15954 } 15955 } 15956 } 15957 15958 const transformFor = createStructuralDirectiveTransform( 15959 "for", 15960 (node, dir, context) => { 15961 const { helper, removeHelper } = context; 15962 return processFor(node, dir, context, (forNode) => { 15963 const renderExp = createCallExpression(helper(RENDER_LIST), [ 15964 forNode.source 15965 ]); 15966 const isTemplate = isTemplateNode(node); 15967 const memo = findDir(node, "memo"); 15968 const keyProp = findProp(node, `key`, false, true); 15969 keyProp && keyProp.type === 7; 15970 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 15971 const keyProperty = key
vendor: 51,982 bytes, lines 15971-17619
15971Prop && keyExp ? createObjectProperty(`key`, keyExp) : null; 15972 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 15973 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 15974 forNode.codegenNode = createVNodeCall( 15975 context, 15976 helper(FRAGMENT), 15977 void 0, 15978 renderExp, 15979 fragmentFlag, 15980 void 0, 15981 void 0, 15982 true, 15983 !isStableFragment, 15984 false, 15985 node.loc 15986 ); 15987 return () => { 15988 let childBlock; 15989 const { children } = forNode; 15990 if (isTemplate) { 15991 node.children.some((c) => { 15992 if (c.type === 1) { 15993 const key = findProp(c, "key"); 15994 if (key) { 15995 context.onError( 15996 createCompilerError( 15997 33, 15998 key.loc 15999 ) 16000 ); 16001 return true; 16002 } 16003 } 16004 }); 16005 } 16006 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 16007 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 16008 if (slotOutlet) { 16009 childBlock = slotOutlet.codegenNode; 16010 if (isTemplate && keyProperty) { 16011 injectProp(childBlock, keyProperty, context); 16012 } 16013 } else if (needFragmentWrapper) { 16014 childBlock = createVNodeCall( 16015 context, 16016 helper(FRAGMENT), 16017 keyProperty ? createObjectExpression([keyProperty]) : void 0, 16018 node.children, 16019 64, 16020 void 0, 16021 void 0, 16022 true, 16023 void 0, 16024 false 16025 ); 16026 } else { 16027 childBlock = children[0].codegenNode; 16028 if (isTemplate && keyProperty) { 16029 injectProp(childBlock, keyProperty, context); 16030 } 16031 if (childBlock.isBlock !== !isStableFragment) { 16032 if (childBlock.isBlock) { 16033 removeHelper(OPEN_BLOCK); 16034 removeHelper( 16035 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 16036 ); 16037 } else { 16038 removeHelper( 16039 getVNodeHelper(context.inSSR, childBlock.isComponent) 16040 ); 16041 } 16042 } 16043 childBlock.isBlock = !isStableFragment; 16044 if (childBlock.isBlock) { 16045 helper(OPEN_BLOCK); 16046 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 16047 } else { 16048 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 16049 } 16050 } 16051 if (memo) { 16052 const loop = createFunctionExpression( 16053 createForLoopParams(forNode.parseResult, [ 16054 createSimpleExpression(`_cached`) 16055 ]) 16056 ); 16057 loop.body = createBlockStatement([ 16058 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 16059 createCompoundExpression([ 16060 `if (_cached`, 16061 ...keyExp ? [` && _cached.key === `, keyExp] : [], 16062 ` && ${context.helperString( 16063 IS_MEMO_SAME 16064 )}(_cached, _memo)) return _cached` 16065 ]), 16066 createCompoundExpression([`const _item = `, childBlock]), 16067 createSimpleExpression(`_item.memo = _memo`), 16068 createSimpleExpression(`return _item`) 16069 ]); 16070 renderExp.arguments.push( 16071 loop, 16072 createSimpleExpression(`_cache`), 16073 createSimpleExpression(String(context.cached.length)) 16074 ); 16075 context.cached.push(null); 16076 } else { 16077 renderExp.arguments.push( 16078 createFunctionExpression( 16079 createForLoopParams(forNode.parseResult), 16080 childBlock, 16081 true 16082 ) 16083 ); 16084 } 16085 }; 16086 }); 16087 } 16088 ); 16089 function processFor(node, dir, context, processCodegen) { 16090 if (!dir.exp) { 16091 context.onError( 16092 createCompilerError(31, dir.loc) 16093 ); 16094 return; 16095 } 16096 const parseResult = dir.forParseResult; 16097 if (!parseResult) { 16098 context.onError( 16099 createCompilerError(32, dir.loc) 16100 ); 16101 return; 16102 } 16103 finalizeForParseResult(parseResult, context); 16104 const { addIdentifiers, removeIdentifiers, scopes } = context; 16105 const { source, value, key, index } = parseResult; 16106 const forNode = { 16107 type: 11, 16108 loc: dir.loc, 16109 source, 16110 valueAlias: value, 16111 keyAlias: key, 16112 objectIndexAlias: index, 16113 parseResult, 16114 children: isTemplateNode(node) ? node.children : [node] 16115 }; 16116 context.replaceNode(forNode); 16117 scopes.vFor++; 16118 const onExit = processCodegen && processCodegen(forNode); 16119 return () => { 16120 scopes.vFor--; 16121 if (onExit) onExit(); 16122 }; 16123 } 16124 function finalizeForParseResult(result, context) { 16125 if (result.finalized) return; 16126 { 16127 validateBrowserExpression(result.source, context); 16128 if (result.key) { 16129 validateBrowserExpression( 16130 result.key, 16131 context, 16132 true 16133 ); 16134 } 16135 if (result.index) { 16136 validateBrowserExpression( 16137 result.index, 16138 context, 16139 true 16140 ); 16141 } 16142 if (result.value) { 16143 validateBrowserExpression( 16144 result.value, 16145 context, 16146 true 16147 ); 16148 } 16149 } 16150 result.finalized = true; 16151 } 16152 function createForLoopParams({ value, key, index }, memoArgs = []) { 16153 return createParamsList([value, key, index, ...memoArgs]); 16154 } 16155 function createParamsList(args) { 16156 let i = args.length; 16157 while (i--) { 16158 if (args[i]) break; 16159 } 16160 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 16161 } 16162 16163 const defaultFallback = createSimpleExpression(`undefined`, false); 16164 const trackSlotScopes = (node, context) => { 16165 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 16166 const vSlot = findDir(node, "slot"); 16167 if (vSlot) { 16168 vSlot.exp; 16169 context.scopes.vSlot++; 16170 return () => { 16171 context.scopes.vSlot--; 16172 }; 16173 } 16174 } 16175 }; 16176 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 16177 props, 16178 children, 16179 false, 16180 true, 16181 children.length ? children[0].loc : loc 16182 ); 16183 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 16184 context.helper(WITH_CTX); 16185 const { children, loc } = node; 16186 const slotsProperties = []; 16187 const dynamicSlots = []; 16188 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 16189 const onComponentSlot = findDir(node, "slot", true); 16190 if (onComponentSlot) { 16191 const { arg, exp } = onComponentSlot; 16192 if (arg && !isStaticExp(arg)) { 16193 hasDynamicSlots = true; 16194 } 16195 slotsProperties.push( 16196 createObjectProperty( 16197 arg || createSimpleExpression("default", true), 16198 buildSlotFn(exp, void 0, children, loc) 16199 ) 16200 ); 16201 } 16202 let hasTemplateSlots = false; 16203 let hasNamedDefaultSlot = false; 16204 const implicitDefaultChildren = []; 16205 const seenSlotNames = /* @__PURE__ */ new Set(); 16206 let conditionalBranchIndex = 0; 16207 for (let i = 0; i < children.length; i++) { 16208 const slotElement = children[i]; 16209 let slotDir; 16210 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 16211 if (slotElement.type !== 3) { 16212 implicitDefaultChildren.push(slotElement); 16213 } 16214 continue; 16215 } 16216 if (onComponentSlot) { 16217 context.onError( 16218 createCompilerError(37, slotDir.loc) 16219 ); 16220 break; 16221 } 16222 hasTemplateSlots = true; 16223 const { children: slotChildren, loc: slotLoc } = slotElement; 16224 const { 16225 arg: slotName = createSimpleExpression(`default`, true), 16226 exp: slotProps, 16227 loc: dirLoc 16228 } = slotDir; 16229 let staticSlotName; 16230 if (isStaticExp(slotName)) { 16231 staticSlotName = slotName ? slotName.content : `default`; 16232 } else { 16233 hasDynamicSlots = true; 16234 } 16235 const vFor = findDir(slotElement, "for"); 16236 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 16237 let vIf; 16238 let vElse; 16239 if (vIf = findDir(slotElement, "if")) { 16240 hasDynamicSlots = true; 16241 dynamicSlots.push( 16242 createConditionalExpression( 16243 vIf.exp, 16244 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 16245 defaultFallback 16246 ) 16247 ); 16248 } else if (vElse = findDir( 16249 slotElement, 16250 /^else(?:-if)?$/, 16251 true 16252 /* allowEmpty */ 16253 )) { 16254 let j = i; 16255 let prev; 16256 while (j--) { 16257 prev = children[j]; 16258 if (prev.type !== 3 && isNonWhitespaceContent(prev)) { 16259 break; 16260 } 16261 } 16262 if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) { 16263 let conditional = dynamicSlots[dynamicSlots.length - 1]; 16264 while (conditional.alternate.type === 19) { 16265 conditional = conditional.alternate; 16266 } 16267 conditional.alternate = vElse.exp ? createConditionalExpression( 16268 vElse.exp, 16269 buildDynamicSlot( 16270 slotName, 16271 slotFunction, 16272 conditionalBranchIndex++ 16273 ), 16274 defaultFallback 16275 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 16276 } else { 16277 context.onError( 16278 createCompilerError(30, vElse.loc) 16279 ); 16280 } 16281 } else if (vFor) { 16282 hasDynamicSlots = true; 16283 const parseResult = vFor.forParseResult; 16284 if (parseResult) { 16285 finalizeForParseResult(parseResult, context); 16286 dynamicSlots.push( 16287 createCallExpression(context.helper(RENDER_LIST), [ 16288 parseResult.source, 16289 createFunctionExpression( 16290 createForLoopParams(parseResult), 16291 buildDynamicSlot(slotName, slotFunction), 16292 true 16293 ) 16294 ]) 16295 ); 16296 } else { 16297 context.onError( 16298 createCompilerError( 16299 32, 16300 vFor.loc 16301 ) 16302 ); 16303 } 16304 } else { 16305 if (staticSlotName) { 16306 if (seenSlotNames.has(staticSlotName)) { 16307 context.onError( 16308 createCompilerError( 16309 38, 16310 dirLoc 16311 ) 16312 ); 16313 continue; 16314 } 16315 seenSlotNames.add(staticSlotName); 16316 if (staticSlotName === "default") { 16317 hasNamedDefaultSlot = true; 16318 } 16319 } 16320 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 16321 } 16322 } 16323 if (!onComponentSlot) { 16324 const buildDefaultSlotProperty = (props, children2) => { 16325 const fn = buildSlotFn(props, void 0, children2, loc); 16326 return createObjectProperty(`default`, fn); 16327 }; 16328 if (!hasTemplateSlots) { 16329 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 16330 } else if (implicitDefaultChildren.length && // #3766 16331 // with whitespace: 'preserve', whitespaces between slots will end up in 16332 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 16333 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) { 16334 if (hasNamedDefaultSlot) { 16335 context.onError( 16336 createCompilerError( 16337 39, 16338 implicitDefaultChildren[0].loc 16339 ) 16340 ); 16341 } else { 16342 slotsProperties.push( 16343 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 16344 ); 16345 } 16346 } 16347 } 16348 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 16349 let slots = createObjectExpression( 16350 slotsProperties.concat( 16351 createObjectProperty( 16352 `_`, 16353 // 2 = compiled but dynamic = can skip normalization, but must run diff 16354 // 1 = compiled and static = can skip normalization AND diff as optimized 16355 createSimpleExpression( 16356 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ), 16357 false 16358 ) 16359 ) 16360 ), 16361 loc 16362 ); 16363 if (dynamicSlots.length) { 16364 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 16365 slots, 16366 createArrayExpression(dynamicSlots) 16367 ]); 16368 } 16369 return { 16370 slots, 16371 hasDynamicSlots 16372 }; 16373 } 16374 function buildDynamicSlot(name, fn, index) { 16375 const props = [ 16376 createObjectProperty(`name`, name), 16377 createObjectProperty(`fn`, fn) 16378 ]; 16379 if (index != null) { 16380 props.push( 16381 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 16382 ); 16383 } 16384 return createObjectExpression(props); 16385 } 16386 function hasForwardedSlots(children) { 16387 for (let i = 0; i < children.length; i++) { 16388 const child = children[i]; 16389 switch (child.type) { 16390 case 1: 16391 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 16392 return true; 16393 } 16394 break; 16395 case 9: 16396 if (hasForwardedSlots(child.branches)) return true; 16397 break; 16398 case 10: 16399 case 11: 16400 if (hasForwardedSlots(child.children)) return true; 16401 break; 16402 } 16403 } 16404 return false; 16405 } 16406 function isNonWhitespaceContent(node) { 16407 if (node.type !== 2 && node.type !== 12) 16408 return true; 16409 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content); 16410 } 16411 16412 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 16413 const transformElement = (node, context) => { 16414 return function postTransformElement() { 16415 node = context.currentNode; 16416 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 16417 return; 16418 } 16419 const { tag, props } = node; 16420 const isComponent = node.tagType === 1; 16421 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 16422 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 16423 let vnodeProps; 16424 let vnodeChildren; 16425 let patchFlag = 0; 16426 let vnodeDynamicProps; 16427 let dynamicPropNames; 16428 let vnodeDirectives; 16429 let shouldUseBlock = ( 16430 // dynamic component may resolve to plain elements 16431 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 16432 // updates inside get proper isSVG flag at runtime. (#639, #643) 16433 // This is technically web-specific, but splitting the logic out of core 16434 // leads to too much unnecessary complexity. 16435 (tag === "svg" || tag === "foreignObject" || tag === "math") 16436 ); 16437 if (props.length > 0) { 16438 const propsBuildResult = buildProps( 16439 node, 16440 context, 16441 void 0, 16442 isComponent, 16443 isDynamicComponent 16444 ); 16445 vnodeProps = propsBuildResult.props; 16446 patchFlag = propsBuildResult.patchFlag; 16447 dynamicPropNames = propsBuildResult.dynamicPropNames; 16448 const directives = propsBuildResult.directives; 16449 vnodeDirectives = directives && directives.length ? createArrayExpression( 16450 directives.map((dir) => buildDirectiveArgs(dir, context)) 16451 ) : void 0; 16452 if (propsBuildResult.shouldUseBlock) { 16453 shouldUseBlock = true; 16454 } 16455 } 16456 if (node.children.length > 0) { 16457 if (vnodeTag === KEEP_ALIVE) { 16458 shouldUseBlock = true; 16459 patchFlag |= 1024; 16460 if (node.children.length > 1) { 16461 context.onError( 16462 createCompilerError(46, { 16463 start: node.children[0].loc.start, 16464 end: node.children[node.children.length - 1].loc.end, 16465 source: "" 16466 }) 16467 ); 16468 } 16469 } 16470 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 16471 vnodeTag !== TELEPORT && // explained above. 16472 vnodeTag !== KEEP_ALIVE; 16473 if (shouldBuildAsSlots) { 16474 const { slots, hasDynamicSlots } = buildSlots(node, context); 16475 vnodeChildren = slots; 16476 if (hasDynamicSlots) { 16477 patchFlag |= 1024; 16478 } 16479 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 16480 const child = node.children[0]; 16481 const type = child.type; 16482 const hasDynamicTextChild = type === 5 || type === 8; 16483 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 16484 patchFlag |= 1; 16485 } 16486 if (hasDynamicTextChild || type === 2) { 16487 vnodeChildren = child; 16488 } else { 16489 vnodeChildren = node.children; 16490 } 16491 } else { 16492 vnodeChildren = node.children; 16493 } 16494 } 16495 if (dynamicPropNames && dynamicPropNames.length) { 16496 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 16497 } 16498 node.codegenNode = createVNodeCall( 16499 context, 16500 vnodeTag, 16501 vnodeProps, 16502 vnodeChildren, 16503 patchFlag === 0 ? void 0 : patchFlag, 16504 vnodeDynamicProps, 16505 vnodeDirectives, 16506 !!shouldUseBlock, 16507 false, 16508 isComponent, 16509 node.loc 16510 ); 16511 }; 16512 }; 16513 function resolveComponentType(node, context, ssr = false) { 16514 let { tag } = node; 16515 const isExplicitDynamic = isComponentTag(tag); 16516 const isProp = findProp( 16517 node, 16518 "is", 16519 false, 16520 true 16521 /* allow empty */ 16522 ); 16523 if (isProp) { 16524 if (isExplicitDynamic || false) { 16525 let exp; 16526 if (isProp.type === 6) { 16527 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 16528 } else { 16529 exp = isProp.exp; 16530 if (!exp) { 16531 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 16532 } 16533 } 16534 if (exp) { 16535 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 16536 exp 16537 ]); 16538 } 16539 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 16540 tag = isProp.value.content.slice(4); 16541 } 16542 } 16543 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 16544 if (builtIn) { 16545 if (!ssr) context.helper(builtIn); 16546 return builtIn; 16547 } 16548 context.helper(RESOLVE_COMPONENT); 16549 context.components.add(tag); 16550 return toValidAssetId(tag, `component`); 16551 } 16552 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 16553 const { tag, loc: elementLoc, children } = node; 16554 let properties = []; 16555 const mergeArgs = []; 16556 const runtimeDirectives = []; 16557 const hasChildren = children.length > 0; 16558 let shouldUseBlock = false; 16559 let patchFlag = 0; 16560 let hasRef = false; 16561 let hasClassBinding = false; 16562 let hasStyleBinding = false; 16563 let hasHydrationEventBinding = false; 16564 let hasDynamicKeys = false; 16565 let hasVnodeHook = false; 16566 const dynamicPropNames = []; 16567 const pushMergeArg = (arg) => { 16568 if (properties.length) { 16569 mergeArgs.push( 16570 createObjectExpression(dedupeProperties(properties), elementLoc) 16571 ); 16572 properties = []; 16573 } 16574 if (arg) mergeArgs.push(arg); 16575 }; 16576 const pushRefVForMarker = () => { 16577 if (context.scopes.vFor > 0) { 16578 properties.push( 16579 createObjectProperty( 16580 createSimpleExpression("ref_for", true), 16581 createSimpleExpression("true") 16582 ) 16583 ); 16584 } 16585 }; 16586 const analyzePatchFlag = ({ key, value }) => { 16587 if (isStaticExp(key)) { 16588 const name = key.content; 16589 const isEventHandler = isOn(name); 16590 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 16591 // dedicated fast path. 16592 name.toLowerCase() !== "onclick" && // omit v-model handlers 16593 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 16594 !isReservedProp(name)) { 16595 hasHydrationEventBinding = true; 16596 } 16597 if (isEventHandler && isReservedProp(name)) { 16598 hasVnodeHook = true; 16599 } 16600 if (isEventHandler && value.type === 14) { 16601 value = value.arguments[0]; 16602 } 16603 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 16604 return; 16605 } 16606 if (name === "ref") { 16607 hasRef = true; 16608 } else if (name === "class") { 16609 hasClassBinding = true; 16610 } else if (name === "style") { 16611 hasStyleBinding = true; 16612 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 16613 dynamicPropNames.push(name); 16614 } 16615 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 16616 dynamicPropNames.push(name); 16617 } 16618 } else { 16619 hasDynamicKeys = true; 16620 } 16621 }; 16622 for (let i = 0; i < props.length; i++) { 16623 const prop = props[i]; 16624 if (prop.type === 6) { 16625 const { loc, name, nameLoc, value } = prop; 16626 let isStatic = true; 16627 if (name === "ref") { 16628 hasRef = true; 16629 pushRefVForMarker(); 16630 } 16631 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 16632 continue; 16633 } 16634 properties.push( 16635 createObjectProperty( 16636 createSimpleExpression(name, true, nameLoc), 16637 createSimpleExpression( 16638 value ? value.content : "", 16639 isStatic, 16640 value ? value.loc : loc 16641 ) 16642 ) 16643 ); 16644 } else { 16645 const { name, arg, exp, loc, modifiers } = prop; 16646 const isVBind = name === "bind"; 16647 const isVOn = name === "on"; 16648 if (name === "slot") { 16649 if (!isComponent) { 16650 context.onError( 16651 createCompilerError(40, loc) 16652 ); 16653 } 16654 continue; 16655 } 16656 if (name === "once" || name === "memo") { 16657 continue; 16658 } 16659 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 16660 continue; 16661 } 16662 if (isVOn && ssr) { 16663 continue; 16664 } 16665 if ( 16666 // #938: elements with dynamic keys should be forced into blocks 16667 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 16668 // before children 16669 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 16670 ) { 16671 shouldUseBlock = true; 16672 } 16673 if (isVBind && isStaticArgOf(arg, "ref")) { 16674 pushRefVForMarker(); 16675 } 16676 if (!arg && (isVBind || isVOn)) { 16677 hasDynamicKeys = true; 16678 if (exp) { 16679 if (isVBind) { 16680 pushRefVForMarker(); 16681 pushMergeArg(); 16682 mergeArgs.push(exp); 16683 } else { 16684 pushMergeArg({ 16685 type: 14, 16686 loc, 16687 callee: context.helper(TO_HANDLERS), 16688 arguments: isComponent ? [exp] : [exp, `true`] 16689 }); 16690 } 16691 } else { 16692 context.onError( 16693 createCompilerError( 16694 isVBind ? 34 : 35, 16695 loc 16696 ) 16697 ); 16698 } 16699 continue; 16700 } 16701 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 16702 patchFlag |= 32; 16703 } 16704 const directiveTransform = context.directiveTransforms[name]; 16705 if (directiveTransform) { 16706 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 16707 !ssr && props2.forEach(analyzePatchFlag); 16708 if (isVOn && arg && !isStaticExp(arg)) { 16709 pushMergeArg(createObjectExpression(props2, elementLoc)); 16710 } else { 16711 properties.push(...props2); 16712 } 16713 if (needRuntime) { 16714 runtimeDirectives.push(prop); 16715 if (isSymbol(needRuntime)) { 16716 directiveImportMap.set(prop, needRuntime); 16717 } 16718 } 16719 } else if (!isBuiltInDirective(name)) { 16720 runtimeDirectives.push(prop); 16721 if (hasChildren) { 16722 shouldUseBlock = true; 16723 } 16724 } 16725 } 16726 } 16727 let propsExpression = void 0; 16728 if (mergeArgs.length) { 16729 pushMergeArg(); 16730 if (mergeArgs.length > 1) { 16731 propsExpression = createCallExpression( 16732 context.helper(MERGE_PROPS), 16733 mergeArgs, 16734 elementLoc 16735 ); 16736 } else { 16737 propsExpression = mergeArgs[0]; 16738 } 16739 } else if (properties.length) { 16740 propsExpression = createObjectExpression( 16741 dedupeProperties(properties), 16742 elementLoc 16743 ); 16744 } 16745 if (hasDynamicKeys) { 16746 patchFlag |= 16; 16747 } else { 16748 if (hasClassBinding && !isComponent) { 16749 patchFlag |= 2; 16750 } 16751 if (hasStyleBinding && !isComponent) { 16752 patchFlag |= 4; 16753 } 16754 if (dynamicPropNames.length) { 16755 patchFlag |= 8; 16756 } 16757 if (hasHydrationEventBinding) { 16758 patchFlag |= 32; 16759 } 16760 } 16761 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 16762 patchFlag |= 512; 16763 } 16764 if (!context.inSSR && propsExpression) { 16765 switch (propsExpression.type) { 16766 case 15: 16767 let classKeyIndex = -1; 16768 let styleKeyIndex = -1; 16769 let hasDynamicKey = false; 16770 for (let i = 0; i < propsExpression.properties.length; i++) { 16771 const key = propsExpression.properties[i].key; 16772 if (isStaticExp(key)) { 16773 if (key.content === "class") { 16774 classKeyIndex = i; 16775 } else if (key.content === "style") { 16776 styleKeyIndex = i; 16777 } 16778 } else if (!key.isHandlerKey) { 16779 hasDynamicKey = true; 16780 } 16781 } 16782 const classProp = propsExpression.properties[classKeyIndex]; 16783 const styleProp = propsExpression.properties[styleKeyIndex]; 16784 if (!hasDynamicKey) { 16785 if (classProp && !isStaticExp(classProp.value)) { 16786 classProp.value = createCallExpression( 16787 context.helper(NORMALIZE_CLASS), 16788 [classProp.value] 16789 ); 16790 } 16791 if (styleProp && // the static style is compiled into an object, 16792 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 16793 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 16794 // v-bind:style with static literal object 16795 styleProp.value.type === 17)) { 16796 styleProp.value = createCallExpression( 16797 context.helper(NORMALIZE_STYLE), 16798 [styleProp.value] 16799 ); 16800 } 16801 } else { 16802 propsExpression = createCallExpression( 16803 context.helper(NORMALIZE_PROPS), 16804 [propsExpression] 16805 ); 16806 } 16807 break; 16808 case 14: 16809 break; 16810 default: 16811 propsExpression = createCallExpression( 16812 context.helper(NORMALIZE_PROPS), 16813 [ 16814 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 16815 propsExpression 16816 ]) 16817 ] 16818 ); 16819 break; 16820 } 16821 } 16822 return { 16823 props: propsExpression, 16824 directives: runtimeDirectives, 16825 patchFlag, 16826 dynamicPropNames, 16827 shouldUseBlock 16828 }; 16829 } 16830 function dedupeProperties(properties) { 16831 const knownProps = /* @__PURE__ */ new Map(); 16832 const deduped = []; 16833 for (let i = 0; i < properties.length; i++) { 16834 const prop = properties[i]; 16835 if (prop.key.type === 8 || !prop.key.isStatic) { 16836 deduped.push(prop); 16837 continue; 16838 } 16839 const name = prop.key.content; 16840 const existing = knownProps.get(name); 16841 if (existing) { 16842 if (name === "style" || name === "class" || isOn(name)) { 16843 mergeAsArray(existing, prop); 16844 } 16845 } else { 16846 knownProps.set(name, prop); 16847 deduped.push(prop); 16848 } 16849 } 16850 return deduped; 16851 } 16852 function mergeAsArray(existing, incoming) { 16853 if (existing.value.type === 17) { 16854 existing.value.elements.push(incoming.value); 16855 } else { 16856 existing.value = createArrayExpression( 16857 [existing.value, incoming.value], 16858 existing.loc 16859 ); 16860 } 16861 } 16862 function buildDirectiveArgs(dir, context) { 16863 const dirArgs = []; 16864 const runtime = directiveImportMap.get(dir); 16865 if (runtime) { 16866 dirArgs.push(context.helperString(runtime)); 16867 } else { 16868 { 16869 context.helper(RESOLVE_DIRECTIVE); 16870 context.directives.add(dir.name); 16871 dirArgs.push(toValidAssetId(dir.name, `directive`)); 16872 } 16873 } 16874 const { loc } = dir; 16875 if (dir.exp) dirArgs.push(dir.exp); 16876 if (dir.arg) { 16877 if (!dir.exp) { 16878 dirArgs.push(`void 0`); 16879 } 16880 dirArgs.push(dir.arg); 16881 } 16882 if (Object.keys(dir.modifiers).length) { 16883 if (!dir.arg) { 16884 if (!dir.exp) { 16885 dirArgs.push(`void 0`); 16886 } 16887 dirArgs.push(`void 0`); 16888 } 16889 const trueExpression = createSimpleExpression(`true`, false, loc); 16890 dirArgs.push( 16891 createObjectExpression( 16892 dir.modifiers.map( 16893 (modifier) => createObjectProperty(modifier, trueExpression) 16894 ), 16895 loc 16896 ) 16897 ); 16898 } 16899 return createArrayExpression(dirArgs, dir.loc); 16900 } 16901 function stringifyDynamicPropNames(props) { 16902 let propsNamesString = `[`; 16903 for (let i = 0, l = props.length; i < l; i++) { 16904 propsNamesString += JSON.stringify(props[i]); 16905 if (i < l - 1) propsNamesString += ", "; 16906 } 16907 return propsNamesString + `]`; 16908 } 16909 function isComponentTag(tag) { 16910 return tag === "component" || tag === "Component"; 16911 } 16912 16913 const transformSlotOutlet = (node, context) => { 16914 if (isSlotOutlet(node)) { 16915 const { children, loc } = node; 16916 const { slotName, slotProps } = processSlotOutlet(node, context); 16917 const slotArgs = [ 16918 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 16919 slotName, 16920 "{}", 16921 "undefined", 16922 "true" 16923 ]; 16924 let expectedLen = 2; 16925 if (slotProps) { 16926 slotArgs[2] = slotProps; 16927 expectedLen = 3; 16928 } 16929 if (children.length) { 16930 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 16931 expectedLen = 4; 16932 } 16933 if (context.scopeId && !context.slotted) { 16934 expectedLen = 5; 16935 } 16936 slotArgs.splice(expectedLen); 16937 node.codegenNode = createCallExpression( 16938 context.helper(RENDER_SLOT), 16939 slotArgs, 16940 loc 16941 ); 16942 } 16943 }; 16944 function processSlotOutlet(node, context) { 16945 let slotName = `"default"`; 16946 let slotProps = void 0; 16947 const nonNameProps = []; 16948 for (let i = 0; i < node.props.length; i++) { 16949 const p = node.props[i]; 16950 if (p.type === 6) { 16951 if (p.value) { 16952 if (p.name === "name") { 16953 slotName = JSON.stringify(p.value.content); 16954 } else { 16955 p.name = camelize(p.name); 16956 nonNameProps.push(p); 16957 } 16958 } 16959 } else { 16960 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 16961 if (p.exp) { 16962 slotName = p.exp; 16963 } else if (p.arg && p.arg.type === 4) { 16964 const name = camelize(p.arg.content); 16965 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 16966 } 16967 } else { 16968 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 16969 p.arg.content = camelize(p.arg.content); 16970 } 16971 nonNameProps.push(p); 16972 } 16973 } 16974 } 16975 if (nonNameProps.length > 0) { 16976 const { props, directives } = buildProps( 16977 node, 16978 context, 16979 nonNameProps, 16980 false, 16981 false 16982 ); 16983 slotProps = props; 16984 if (directives.length) { 16985 context.onError( 16986 createCompilerError( 16987 36, 16988 directives[0].loc 16989 ) 16990 ); 16991 } 16992 } 16993 return { 16994 slotName, 16995 slotProps 16996 }; 16997 } 16998 16999 const transformOn$1 = (dir, node, context, augmentor) => { 17000 const { loc, modifiers, arg } = dir; 17001 if (!dir.exp && !modifiers.length) { 17002 context.onError(createCompilerError(35, loc)); 17003 } 17004 let eventName; 17005 if (arg.type === 4) { 17006 if (arg.isStatic) { 17007 let rawName = arg.content; 17008 if (rawName.startsWith("vnode")) { 17009 context.onError(createCompilerError(51, arg.loc)); 17010 } 17011 if (rawName.startsWith("vue:")) { 17012 rawName = `vnode-${rawName.slice(4)}`; 17013 } 17014 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 17015 // for non-element and vnode lifecycle event listeners, auto convert 17016 // it to camelCase. See issue #2249 17017 toHandlerKey(camelize(rawName)) 17018 ) : ( 17019 // preserve case for plain element listeners that have uppercase 17020 // letters, as these may be custom elements' custom events 17021 `on:${rawName}` 17022 ); 17023 eventName = createSimpleExpression(eventString, true, arg.loc); 17024 } else { 17025 eventName = createCompoundExpression([ 17026 `${context.helperString(TO_HANDLER_KEY)}(`, 17027 arg, 17028 `)` 17029 ]); 17030 } 17031 } else { 17032 eventName = arg; 17033 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 17034 eventName.children.push(`)`); 17035 } 17036 let exp = dir.exp; 17037 if (exp && !exp.content.trim()) { 17038 exp = void 0; 17039 } 17040 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 17041 if (exp) { 17042 const isMemberExp = isMemberExpression(exp); 17043 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 17044 const hasMultipleStatements = exp.content.includes(`;`); 17045 { 17046 validateBrowserExpression( 17047 exp, 17048 context, 17049 false, 17050 hasMultipleStatements 17051 ); 17052 } 17053 if (isInlineStatement || shouldCache && isMemberExp) { 17054 exp = createCompoundExpression([ 17055 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 17056 exp, 17057 hasMultipleStatements ? `}` : `)` 17058 ]); 17059 } 17060 } 17061 let ret = { 17062 props: [ 17063 createObjectProperty( 17064 eventName, 17065 exp || createSimpleExpression(`() => {}`, false, loc) 17066 ) 17067 ] 17068 }; 17069 if (augmentor) { 17070 ret = augmentor(ret); 17071 } 17072 if (shouldCache) { 17073 ret.props[0].value = context.cache(ret.props[0].value); 17074 } 17075 ret.props.forEach((p) => p.key.isHandlerKey = true); 17076 return ret; 17077 }; 17078 17079 const transformBind = (dir, _node, context) => { 17080 const { modifiers, loc } = dir; 17081 const arg = dir.arg; 17082 let { exp } = dir; 17083 if (exp && exp.type === 4 && !exp.content.trim()) { 17084 { 17085 exp = void 0; 17086 } 17087 } 17088 if (arg.type !== 4) { 17089 arg.children.unshift(`(`); 17090 arg.children.push(`) || ""`); 17091 } else if (!arg.isStatic) { 17092 arg.content = arg.content ? `${arg.content} || ""` : `""`; 17093 } 17094 if (modifiers.some((mod) => mod.content === "camel")) { 17095 if (arg.type === 4) { 17096 if (arg.isStatic) { 17097 arg.content = camelize(arg.content); 17098 } else { 17099 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 17100 } 17101 } else { 17102 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 17103 arg.children.push(`)`); 17104 } 17105 } 17106 if (!context.inSSR) { 17107 if (modifiers.some((mod) => mod.content === "prop")) { 17108 injectPrefix(arg, "."); 17109 } 17110 if (modifiers.some((mod) => mod.content === "attr")) { 17111 injectPrefix(arg, "^"); 17112 } 17113 } 17114 return { 17115 props: [createObjectProperty(arg, exp)] 17116 }; 17117 }; 17118 const injectPrefix = (arg, prefix) => { 17119 if (arg.type === 4) { 17120 if (arg.isStatic) { 17121 arg.content = prefix + arg.content; 17122 } else { 17123 arg.content = `\`${prefix}\${${arg.content}}\``; 17124 } 17125 } else { 17126 arg.children.unshift(`'${prefix}' + (`); 17127 arg.children.push(`)`); 17128 } 17129 }; 17130 17131 const transformText = (node, context) => { 17132 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 17133 return () => { 17134 const children = node.children; 17135 let currentContainer = void 0; 17136 let hasText = false; 17137 for (let i = 0; i < children.length; i++) { 17138 const child = children[i]; 17139 if (isText$1(child)) { 17140 hasText = true; 17141 for (let j = i + 1; j < children.length; j++) { 17142 const next = children[j]; 17143 if (isText$1(next)) { 17144 if (!currentContainer) { 17145 currentContainer = children[i] = createCompoundExpression( 17146 [child], 17147 child.loc 17148 ); 17149 } 17150 currentContainer.children.push(` + `, next); 17151 children.splice(j, 1); 17152 j--; 17153 } else { 17154 currentContainer = void 0; 17155 break; 17156 } 17157 } 17158 } 17159 } 17160 if (!hasText || // if this is a plain element with a single text child, leave it 17161 // as-is since the runtime has dedicated fast path for this by directly 17162 // setting textContent of the element. 17163 // for component root it's always normalized anyway. 17164 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 17165 // custom directives can potentially add DOM elements arbitrarily, 17166 // we need to avoid setting textContent of the element at runtime 17167 // to avoid accidentally overwriting the DOM elements added 17168 // by the user through custom directives. 17169 !node.props.find( 17170 (p) => p.type === 7 && !context.directiveTransforms[p.name] 17171 ) && // in compat mode, <template> tags with no special directives 17172 // will be rendered as a fragment so its children must be 17173 // converted into vnodes. 17174 true)) { 17175 return; 17176 } 17177 for (let i = 0; i < children.length; i++) { 17178 const child = children[i]; 17179 if (isText$1(child) || child.type === 8) { 17180 const callArgs = []; 17181 if (child.type !== 2 || child.content !== " ") { 17182 callArgs.push(child); 17183 } 17184 if (!context.ssr && getConstantType(child, context) === 0) { 17185 callArgs.push( 17186 1 + (` /* ${PatchFlagNames[1]} */` ) 17187 ); 17188 } 17189 children[i] = { 17190 type: 12, 17191 content: child, 17192 loc: child.loc, 17193 codegenNode: createCallExpression( 17194 context.helper(CREATE_TEXT), 17195 callArgs 17196 ) 17197 }; 17198 } 17199 } 17200 }; 17201 } 17202 }; 17203 17204 const seen$1 = /* @__PURE__ */ new WeakSet(); 17205 const transformOnce = (node, context) => { 17206 if (node.type === 1 && findDir(node, "once", true)) { 17207 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 17208 return; 17209 } 17210 seen$1.add(node); 17211 context.inVOnce = true; 17212 context.helper(SET_BLOCK_TRACKING); 17213 return () => { 17214 context.inVOnce = false; 17215 const cur = context.currentNode; 17216 if (cur.codegenNode) { 17217 cur.codegenNode = context.cache( 17218 cur.codegenNode, 17219 true, 17220 true 17221 ); 17222 } 17223 }; 17224 } 17225 }; 17226 17227 const transformModel$1 = (dir, node, context) => { 17228 const { exp, arg } = dir; 17229 if (!exp) { 17230 context.onError( 17231 createCompilerError(41, dir.loc) 17232 ); 17233 return createTransformProps(); 17234 } 17235 const rawExp = exp.loc.source.trim(); 17236 const expString = exp.type === 4 ? exp.content : rawExp; 17237 const bindingType = context.bindingMetadata[rawExp]; 17238 if (bindingType === "props" || bindingType === "props-aliased") { 17239 context.onError(createCompilerError(44, exp.loc)); 17240 return createTransformProps(); 17241 } 17242 if (!expString.trim() || !isMemberExpression(exp) && true) { 17243 context.onError( 17244 createCompilerError(42, exp.loc) 17245 ); 17246 return createTransformProps(); 17247 } 17248 const propName = arg ? arg : createSimpleExpression("modelValue", true); 17249 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 17250 let assignmentExp; 17251 const eventArg = context.isTS ? `($event: any)` : `$event`; 17252 { 17253 assignmentExp = createCompoundExpression([ 17254 `${eventArg} => ((`, 17255 exp, 17256 `) = $event)` 17257 ]); 17258 } 17259 const props = [ 17260 // modelValue: foo 17261 createObjectProperty(propName, dir.exp), 17262 // "onUpdate:modelValue": $event => (foo = $event) 17263 createObjectProperty(eventName, assignmentExp) 17264 ]; 17265 if (dir.modifiers.length && node.tagType === 1) { 17266 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 17267 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 17268 props.push( 17269 createObjectProperty( 17270 modifiersKey, 17271 createSimpleExpression( 17272 `{ ${modifiers} }`, 17273 false, 17274 dir.loc, 17275 2 17276 ) 17277 ) 17278 ); 17279 } 17280 return createTransformProps(props); 17281 }; 17282 function createTransformProps(props = []) { 17283 return { props }; 17284 } 17285 17286 const seen = /* @__PURE__ */ new WeakSet(); 17287 const transformMemo = (node, context) => { 17288 if (node.type === 1) { 17289 const dir = findDir(node, "memo"); 17290 if (!dir || seen.has(node) || context.inSSR) { 17291 return; 17292 } 17293 seen.add(node); 17294 return () => { 17295 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 17296 if (codegenNode && codegenNode.type === 13) { 17297 if (node.tagType !== 1) { 17298 convertToBlock(codegenNode, context); 17299 } 17300 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 17301 dir.exp, 17302 createFunctionExpression(void 0, codegenNode), 17303 `_cache`, 17304 String(context.cached.length) 17305 ]); 17306 context.cached.push(null); 17307 } 17308 }; 17309 } 17310 }; 17311 17312 const transformVBindShorthand = (node, context) => { 17313 if (node.type === 1) { 17314 for (const prop of node.props) { 17315 if (prop.type === 7 && prop.name === "bind" && !prop.exp) { 17316 const arg = prop.arg; 17317 if (arg.type !== 4 || !arg.isStatic) { 17318 context.onError( 17319 createCompilerError( 17320 52, 17321 arg.loc 17322 ) 17323 ); 17324 prop.exp = createSimpleExpression("", true, arg.loc); 17325 } else { 17326 const propName = camelize(arg.content); 17327 if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424 17328 propName[0] === "-") { 17329 prop.exp = createSimpleExpression(propName, false, arg.loc); 17330 } 17331 } 17332 } 17333 } 17334 } 17335 }; 17336 17337 function getBaseTransformPreset(prefixIdentifiers) { 17338 return [ 17339 [ 17340 transformVBindShorthand, 17341 transformOnce, 17342 transformIf, 17343 transformMemo, 17344 transformFor, 17345 ...[], 17346 ...[transformExpression] , 17347 transformSlotOutlet, 17348 transformElement, 17349 trackSlotScopes, 17350 transformText 17351 ], 17352 { 17353 on: transformOn$1, 17354 bind: transformBind, 17355 model: transformModel$1 17356 } 17357 ]; 17358 } 17359 function baseCompile(source, options = {}) { 17360 const onError = options.onError || defaultOnError; 17361 const isModuleMode = options.mode === "module"; 17362 { 17363 if (options.prefixIdentifiers === true) { 17364 onError(createCompilerError(47)); 17365 } else if (isModuleMode) { 17366 onError(createCompilerError(48)); 17367 } 17368 } 17369 const prefixIdentifiers = false; 17370 if (options.cacheHandlers) { 17371 onError(createCompilerError(49)); 17372 } 17373 if (options.scopeId && !isModuleMode) { 17374 onError(createCompilerError(50)); 17375 } 17376 const resolvedOptions = extend({}, options, { 17377 prefixIdentifiers 17378 }); 17379 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 17380 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 17381 transform( 17382 ast, 17383 extend({}, resolvedOptions, { 17384 nodeTransforms: [ 17385 ...nodeTransforms, 17386 ...options.nodeTransforms || [] 17387 // user transforms 17388 ], 17389 directiveTransforms: extend( 17390 {}, 17391 directiveTransforms, 17392 options.directiveTransforms || {} 17393 // user transforms 17394 ) 17395 }) 17396 ); 17397 return generate(ast, resolvedOptions); 17398 } 17399 17400 const noopDirectiveTransform = () => ({ props: [] }); 17401 17402 const V_MODEL_RADIO = Symbol(`vModelRadio` ); 17403 const V_MODEL_CHECKBOX = Symbol( 17404 `vModelCheckbox` 17405 ); 17406 const V_MODEL_TEXT = Symbol(`vModelText` ); 17407 const V_MODEL_SELECT = Symbol( 17408 `vModelSelect` 17409 ); 17410 const V_MODEL_DYNAMIC = Symbol( 17411 `vModelDynamic` 17412 ); 17413 const V_ON_WITH_MODIFIERS = Symbol( 17414 `vOnModifiersGuard` 17415 ); 17416 const V_ON_WITH_KEYS = Symbol( 17417 `vOnKeysGuard` 17418 ); 17419 const V_SHOW = Symbol(`vShow` ); 17420 const TRANSITION = Symbol(`Transition` ); 17421 const TRANSITION_GROUP = Symbol( 17422 `TransitionGroup` 17423 ); 17424 registerRuntimeHelpers({ 17425 [V_MODEL_RADIO]: `vModelRadio`, 17426 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 17427 [V_MODEL_TEXT]: `vModelText`, 17428 [V_MODEL_SELECT]: `vModelSelect`, 17429 [V_MODEL_DYNAMIC]: `vModelDynamic`, 17430 [V_ON_WITH_MODIFIERS]: `withModifiers`, 17431 [V_ON_WITH_KEYS]: `withKeys`, 17432 [V_SHOW]: `vShow`, 17433 [TRANSITION]: `Transition`, 17434 [TRANSITION_GROUP]: `TransitionGroup` 17435 }); 17436 17437 let decoder; 17438 function decodeHtmlBrowser(raw, asAttr = false) { 17439 if (!decoder) { 17440 decoder = document.createElement("div"); 17441 } 17442 if (asAttr) { 17443 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 17444 return decoder.children[0].getAttribute("foo"); 17445 } else { 17446 decoder.innerHTML = raw; 17447 return decoder.textContent; 17448 } 17449 } 17450 17451 const parserOptions = { 17452 parseMode: "html", 17453 isVoidTag, 17454 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 17455 isPreTag: (tag) => tag === "pre", 17456 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", 17457 decodeEntities: decodeHtmlBrowser , 17458 isBuiltInComponent: (tag) => { 17459 if (tag === "Transition" || tag === "transition") { 17460 return TRANSITION; 17461 } else if (tag === "TransitionGroup" || tag === "transition-group") { 17462 return TRANSITION_GROUP; 17463 } 17464 }, 17465 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 17466 getNamespace(tag, parent, rootNamespace) { 17467 let ns = parent ? parent.ns : rootNamespace; 17468 if (parent && ns === 2) { 17469 if (parent.tag === "annotation-xml") { 17470 if (tag === "svg") { 17471 return 1; 17472 } 17473 if (parent.props.some( 17474 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 17475 )) { 17476 ns = 0; 17477 } 17478 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 17479 ns = 0; 17480 } 17481 } else if (parent && ns === 1) { 17482 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 17483 ns = 0; 17484 } 17485 } 17486 if (ns === 0) { 17487 if (tag === "svg") { 17488 return 1; 17489 } 17490 if (tag === "math") { 17491 return 2; 17492 } 17493 } 17494 return ns; 17495 } 17496 }; 17497 17498 const transformStyle = (node) => { 17499 if (node.type === 1) { 17500 node.props.forEach((p, i) => { 17501 if (p.type === 6 && p.name === "style" && p.value) { 17502 node.props[i] = { 17503 type: 7, 17504 name: `bind`, 17505 arg: createSimpleExpression(`style`, true, p.loc), 17506 exp: parseInlineCSS(p.value.content, p.loc), 17507 modifiers: [], 17508 loc: p.loc 17509 }; 17510 } 17511 }); 17512 } 17513 }; 17514 const parseInlineCSS = (cssText, loc) => { 17515 const normalized = parseStringStyle(cssText); 17516 return createSimpleExpression( 17517 JSON.stringify(normalized), 17518 false, 17519 loc, 17520 3 17521 ); 17522 }; 17523 17524 function createDOMCompilerError(code, loc) { 17525 return createCompilerError( 17526 code, 17527 loc, 17528 DOMErrorMessages 17529 ); 17530 } 17531 const DOMErrorMessages = { 17532 [53]: `v-html is missing expression.`, 17533 [54]: `v-html will override element children.`, 17534 [55]: `v-text is missing expression.`, 17535 [56]: `v-text will override element children.`, 17536 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 17537 [58]: `v-model argument is not supported on plain elements.`, 17538 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 17539 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 17540 [61]: `v-show is missing expression.`, 17541 [62]: `<Transition> expects exactly one child element or component.`, 17542 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 17543 }; 17544 17545 const transformVHtml = (dir, node, context) => { 17546 const { exp, loc } = dir; 17547 if (!exp) { 17548 context.onError( 17549 createDOMCompilerError(53, loc) 17550 ); 17551 } 17552 if (node.children.length) { 17553 context.onError( 17554 createDOMCompilerError(54, loc) 17555 ); 17556 node.children.length = 0; 17557 } 17558 return { 17559 props: [ 17560 createObjectProperty( 17561 createSimpleExpression(`innerHTML`, true, loc), 17562 exp || createSimpleExpression("", true) 17563 ) 17564 ] 17565 }; 17566 }; 17567 17568 const transformVText = (dir, node, context) => { 17569 const { exp, loc } = dir; 17570 if (!exp) { 17571 context.onError( 17572 createDOMCompilerError(55, loc) 17573 ); 17574 } 17575 if (node.children.length) { 17576 context.onError( 17577 createDOMCompilerError(56, loc) 17578 ); 17579 node.children.length = 0; 17580 } 17581 return { 17582 props: [ 17583 createObjectProperty( 17584 createSimpleExpression(`textContent`, true), 17585 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 17586 context.helperString(TO_DISPLAY_STRING), 17587 [exp], 17588 loc 17589 ) : createSimpleExpression("", true) 17590 ) 17591 ] 17592 }; 17593 }; 17594 17595 const transformModel = (dir, node, context) => { 17596 const baseResult = transformModel$1(dir, node, context); 17597 if (!baseResult.props.length || node.tagType === 1) { 17598 return baseResult; 17599 } 17600 if (dir.arg) { 17601 context.onError( 17602 createDOMCompilerError( 17603 58, 17604 dir.arg.loc 17605 ) 17606 ); 17607 } 17608 function checkDuplicatedValue() { 17609 const value = findDir(node, "bind"); 17610 if (value && isStaticArgOf(value.arg, "value")) { 17611 context.onError( 17612 createDOMCompilerError( 17613 60, 17614 value.loc 17615 ) 17616 ); 17617 } 17618 } 17619 const { tag } = node;
vendor: 5,332 bytes, lines 17620-17779
17620 const isCustomElement = context.isCustomElement(tag); 17621 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 17622 let directiveToUse = V_MODEL_TEXT; 17623 let isInvalidType = false; 17624 if (tag === "input" || isCustomElement) { 17625 const type = findProp(node, `type`); 17626 if (type) { 17627 if (type.type === 7) { 17628 directiveToUse = V_MODEL_DYNAMIC; 17629 } else if (type.value) { 17630 switch (type.value.content) { 17631 case "radio": 17632 directiveToUse = V_MODEL_RADIO; 17633 break; 17634 case "checkbox": 17635 directiveToUse = V_MODEL_CHECKBOX; 17636 break; 17637 case "file": 17638 isInvalidType = true; 17639 context.onError( 17640 createDOMCompilerError( 17641 59, 17642 dir.loc 17643 ) 17644 ); 17645 break; 17646 default: 17647 checkDuplicatedValue(); 17648 break; 17649 } 17650 } 17651 } else if (hasDynamicKeyVBind(node)) { 17652 directiveToUse = V_MODEL_DYNAMIC; 17653 } else { 17654 checkDuplicatedValue(); 17655 } 17656 } else if (tag === "select") { 17657 directiveToUse = V_MODEL_SELECT; 17658 } else { 17659 checkDuplicatedValue(); 17660 } 17661 if (!isInvalidType) { 17662 baseResult.needRuntime = context.helper(directiveToUse); 17663 } 17664 } else { 17665 context.onError( 17666 createDOMCompilerError( 17667 57, 17668 dir.loc 17669 ) 17670 ); 17671 } 17672 baseResult.props = baseResult.props.filter( 17673 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 17674 ); 17675 return baseResult; 17676 }; 17677 17678 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 17679 const isNonKeyModifier = /* @__PURE__ */ makeMap( 17680 // event propagation management 17681 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 17682 ); 17683 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 17684 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 17685 const resolveModifiers = (key, modifiers, context, loc) => { 17686 const keyModifiers = []; 17687 const nonKeyModifiers = []; 17688 const eventOptionModifiers = []; 17689 for (let i = 0; i < modifiers.length; i++) { 17690 const modifier = modifiers[i].content; 17691 if (isEventOptionModifier(modifier)) { 17692 eventOptionModifiers.push(modifier); 17693 } else { 17694 if (maybeKeyModifier(modifier)) { 17695 if (isStaticExp(key)) { 17696 if (isKeyboardEvent(key.content.toLowerCase())) { 17697 keyModifiers.push(modifier); 17698 } else { 17699 nonKeyModifiers.push(modifier); 17700 } 17701 } else { 17702 keyModifiers.push(modifier); 17703 nonKeyModifiers.push(modifier); 17704 } 17705 } else { 17706 if (isNonKeyModifier(modifier)) { 17707 nonKeyModifiers.push(modifier); 17708 } else { 17709 keyModifiers.push(modifier); 17710 } 17711 } 17712 } 17713 } 17714 return { 17715 keyModifiers, 17716 nonKeyModifiers, 17717 eventOptionModifiers 17718 }; 17719 }; 17720 const transformClick = (key, event) => { 17721 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 17722 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 17723 `(`, 17724 key, 17725 `) === "onClick" ? "${event}" : (`, 17726 key, 17727 `)` 17728 ]) : key; 17729 }; 17730 const transformOn = (dir, node, context) => { 17731 return transformOn$1(dir, node, context, (baseResult) => { 17732 const { modifiers } = dir; 17733 if (!modifiers.length) return baseResult; 17734 let { key, value: handlerExp } = baseResult.props[0]; 17735 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 17736 if (nonKeyModifiers.includes("right")) { 17737 key = transformClick(key, `onContextmenu`); 17738 } 17739 if (nonKeyModifiers.includes("middle")) { 17740 key = transformClick(key, `onMouseup`); 17741 } 17742 if (nonKeyModifiers.length) { 17743 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 17744 handlerExp, 17745 JSON.stringify(nonKeyModifiers) 17746 ]); 17747 } 17748 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 17749 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 17750 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 17751 handlerExp, 17752 JSON.stringify(keyModifiers) 17753 ]); 17754 } 17755 if (eventOptionModifiers.length) { 17756 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 17757 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 17758 } 17759 return { 17760 props: [createObjectProperty(key, handlerExp)] 17761 }; 17762 }); 17763 }; 17764 17765 const transformShow = (dir, node, context) => { 17766 const { exp, loc } = dir; 17767 if (!exp) { 17768 context.onError( 17769 createDOMCompilerError(61, loc) 17770 ); 17771 } 17772 return { 17773 props: [], 17774 needRuntime: context.helper(V_SHOW) 17775 }; 17776 }; 17777 17778 const transformTransition = (node, context) => { 17779 if (node.type === 1 && node.tagType === 1) {
vendor: 1,568 bytes, lines 17780-17828
17780 const component = context.isBuiltInComponent(node.tag); 17781 if (component === TRANSITION) { 17782 return () => { 17783 if (!node.children.length) { 17784 return; 17785 } 17786 if (hasMultipleChildren(node)) { 17787 context.onError( 17788 createDOMCompilerError( 17789 62, 17790 { 17791 start: node.children[0].loc.start, 17792 end: node.children[node.children.length - 1].loc.end, 17793 source: "" 17794 } 17795 ) 17796 ); 17797 } 17798 const child = node.children[0]; 17799 if (child.type === 1) { 17800 for (const p of child.props) { 17801 if (p.type === 7 && p.name === "show") { 17802 node.props.push({ 17803 type: 6, 17804 name: "persisted", 17805 nameLoc: node.loc, 17806 value: void 0, 17807 loc: node.loc 17808 }); 17809 } 17810 } 17811 } 17812 }; 17813 } 17814 } 17815 }; 17816 function hasMultipleChildren(node) { 17817 const children = node.children = node.children.filter( 17818 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim()) 17819 ); 17820 const child = children[0]; 17821 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 17822 } 17823 17824 const ignoreSideEffectTags = (node, context) => { 17825 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 17826 context.onError( 17827 createDOMCompilerError( 17828 63
vendor: 10,508 bytes, lines 17828-18184
17828, 17829 node.loc 17830 ) 17831 ); 17832 context.removeNode(); 17833 } 17834 }; 17835 17836 function isValidHTMLNesting(parent, child) { 17837 if (parent === "template") { 17838 return true; 17839 } 17840 if (parent in onlyValidChildren) { 17841 return onlyValidChildren[parent].has(child); 17842 } 17843 if (child in onlyValidParents) { 17844 return onlyValidParents[child].has(parent); 17845 } 17846 if (parent in knownInvalidChildren) { 17847 if (knownInvalidChildren[parent].has(child)) return false; 17848 } 17849 if (child in knownInvalidParents) { 17850 if (knownInvalidParents[child].has(parent)) return false; 17851 } 17852 return true; 17853 } 17854 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); 17855 const emptySet = /* @__PURE__ */ new Set([]); 17856 const onlyValidChildren = { 17857 head: /* @__PURE__ */ new Set([ 17858 "base", 17859 "basefront", 17860 "bgsound", 17861 "link", 17862 "meta", 17863 "title", 17864 "noscript", 17865 "noframes", 17866 "style", 17867 "script", 17868 "template" 17869 ]), 17870 optgroup: /* @__PURE__ */ new Set(["option"]), 17871 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), 17872 // table 17873 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), 17874 tr: /* @__PURE__ */ new Set(["td", "th"]), 17875 colgroup: /* @__PURE__ */ new Set(["col"]), 17876 tbody: /* @__PURE__ */ new Set(["tr"]), 17877 thead: /* @__PURE__ */ new Set(["tr"]), 17878 tfoot: /* @__PURE__ */ new Set(["tr"]), 17879 // these elements can not have any children elements 17880 script: emptySet, 17881 iframe: emptySet, 17882 option: emptySet, 17883 textarea: emptySet, 17884 style: emptySet, 17885 title: emptySet 17886 }; 17887 const onlyValidParents = { 17888 // sections 17889 html: emptySet, 17890 body: /* @__PURE__ */ new Set(["html"]), 17891 head: /* @__PURE__ */ new Set(["html"]), 17892 // table 17893 td: /* @__PURE__ */ new Set(["tr"]), 17894 colgroup: /* @__PURE__ */ new Set(["table"]), 17895 caption: /* @__PURE__ */ new Set(["table"]), 17896 tbody: /* @__PURE__ */ new Set(["table"]), 17897 tfoot: /* @__PURE__ */ new Set(["table"]), 17898 col: /* @__PURE__ */ new Set(["colgroup"]), 17899 th: /* @__PURE__ */ new Set(["tr"]), 17900 thead: /* @__PURE__ */ new Set(["table"]), 17901 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), 17902 // data list 17903 dd: /* @__PURE__ */ new Set(["dl", "div"]), 17904 dt: /* @__PURE__ */ new Set(["dl", "div"]), 17905 // other 17906 figcaption: /* @__PURE__ */ new Set(["figure"]), 17907 // li: new Set(["ul", "ol"]), 17908 summary: /* @__PURE__ */ new Set(["details"]), 17909 area: /* @__PURE__ */ new Set(["map"]) 17910 }; 17911 const knownInvalidChildren = { 17912 p: /* @__PURE__ */ new Set([ 17913 "address", 17914 "article", 17915 "aside", 17916 "blockquote", 17917 "center", 17918 "details", 17919 "dialog", 17920 "dir", 17921 "div", 17922 "dl", 17923 "fieldset", 17924 "figure", 17925 "footer", 17926 "form", 17927 "h1", 17928 "h2", 17929 "h3", 17930 "h4", 17931 "h5", 17932 "h6", 17933 "header", 17934 "hgroup", 17935 "hr", 17936 "li", 17937 "main", 17938 "nav", 17939 "menu", 17940 "ol", 17941 "p", 17942 "pre", 17943 "section", 17944 "table", 17945 "ul" 17946 ]), 17947 svg: /* @__PURE__ */ new Set([ 17948 "b", 17949 "blockquote", 17950 "br", 17951 "code", 17952 "dd", 17953 "div", 17954 "dl", 17955 "dt", 17956 "em", 17957 "embed", 17958 "h1", 17959 "h2", 17960 "h3", 17961 "h4", 17962 "h5", 17963 "h6", 17964 "hr", 17965 "i", 17966 "img", 17967 "li", 17968 "menu", 17969 "meta", 17970 "ol", 17971 "p", 17972 "pre", 17973 "ruby", 17974 "s", 17975 "small", 17976 "span", 17977 "strong", 17978 "sub", 17979 "sup", 17980 "table", 17981 "u", 17982 "ul", 17983 "var" 17984 ]) 17985 }; 17986 const knownInvalidParents = { 17987 a: /* @__PURE__ */ new Set(["a"]), 17988 button: /* @__PURE__ */ new Set(["button"]), 17989 dd: /* @__PURE__ */ new Set(["dd", "dt"]), 17990 dt: /* @__PURE__ */ new Set(["dd", "dt"]), 17991 form: /* @__PURE__ */ new Set(["form"]), 17992 li: /* @__PURE__ */ new Set(["li"]), 17993 h1: headings, 17994 h2: headings, 17995 h3: headings, 17996 h4: headings, 17997 h5: headings, 17998 h6: headings 17999 }; 18000 18001 const validateHtmlNesting = (node, context) => { 18002 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { 18003 const error = new SyntaxError( 18004 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` 18005 ); 18006 error.loc = node.loc; 18007 context.onWarn(error); 18008 } 18009 }; 18010 18011 const DOMNodeTransforms = [ 18012 transformStyle, 18013 ...[transformTransition, validateHtmlNesting] 18014 ]; 18015 const DOMDirectiveTransforms = { 18016 cloak: noopDirectiveTransform, 18017 html: transformVHtml, 18018 text: transformVText, 18019 model: transformModel, 18020 // override compiler-core 18021 on: transformOn, 18022 // override compiler-core 18023 show: transformShow 18024 }; 18025 function compile(src, options = {}) { 18026 return baseCompile( 18027 src, 18028 extend({}, parserOptions, options, { 18029 nodeTransforms: [ 18030 // ignore <script> and <tag> 18031 // this is not put inside DOMNodeTransforms because that list is used 18032 // by compiler-ssr to generate vnode fallback branches 18033 ignoreSideEffectTags, 18034 ...DOMNodeTransforms, 18035 ...options.nodeTransforms || [] 18036 ], 18037 directiveTransforms: extend( 18038 {}, 18039 DOMDirectiveTransforms, 18040 options.directiveTransforms || {} 18041 ), 18042 transformHoist: null 18043 }) 18044 ); 18045 } 18046 18047 { 18048 initDev(); 18049 } 18050 const compileCache = /* @__PURE__ */ Object.create(null); 18051 function compileToFunction(template, options) { 18052 if (!isString(template)) { 18053 if (template.nodeType) { 18054 template = template.innerHTML; 18055 } else { 18056 warn(`invalid template option: `, template); 18057 return NOOP; 18058 } 18059 } 18060 const key = genCacheKey(template, options); 18061 const cached = compileCache[key]; 18062 if (cached) { 18063 return cached; 18064 } 18065 if (template[0] === "#") { 18066 const el = document.querySelector(template); 18067 if (!el) { 18068 warn(`Template element not found or is empty: ${template}`); 18069 } 18070 template = el ? el.innerHTML : ``; 18071 } 18072 const opts = extend( 18073 { 18074 hoistStatic: true, 18075 onError: onError , 18076 onWarn: (e) => onError(e, true) 18077 }, 18078 options 18079 ); 18080 if (!opts.isCustomElement && typeof customElements !== "undefined") { 18081 opts.isCustomElement = (tag) => !!customElements.get(tag); 18082 } 18083 const { code } = compile(template, opts); 18084 function onError(err, asWarning = false) { 18085 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 18086 const codeFrame = err.loc && generateCodeFrame( 18087 template, 18088 err.loc.start.offset, 18089 err.loc.end.offset 18090 ); 18091 warn(codeFrame ? `${message} 18092${codeFrame}` : message); 18093 } 18094 const render = new Function(code)() ; 18095 render._rc = true; 18096 return compileCache[key] = render; 18097 } 18098 registerRuntimeCompiler(compileToFunction); 18099 18100 exports.BaseTransition = BaseTransition; 18101 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 18102 exports.Comment = Comment; 18103 exports.DeprecationTypes = DeprecationTypes; 18104 exports.EffectScope = EffectScope; 18105 exports.ErrorCodes = ErrorCodes; 18106 exports.ErrorTypeStrings = ErrorTypeStrings; 18107 exports.Fragment = Fragment; 18108 exports.KeepAlive = KeepAlive; 18109 exports.ReactiveEffect = ReactiveEffect; 18110 exports.Static = Static; 18111 exports.Suspense = Suspense; 18112 exports.Teleport = Teleport; 18113 exports.Text = Text; 18114 exports.TrackOpTypes = TrackOpTypes; 18115 exports.Transition = Transition; 18116 exports.TransitionGroup = TransitionGroup; 18117 exports.TriggerOpTypes = TriggerOpTypes; 18118 exports.VueElement = VueElement; 18119 exports.assertNumber = assertNumber; 18120 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 18121 exports.callWithErrorHandling = callWithErrorHandling; 18122 exports.camelize = camelize; 18123 exports.capitalize = capitalize; 18124 exports.cloneVNode = cloneVNode; 18125 exports.compatUtils = compatUtils; 18126 exports.compile = compileToFunction; 18127 exports.computed = computed; 18128 exports.createApp = createApp; 18129 exports.createBlock = createBlock; 18130 exports.createCommentVNode = createCommentVNode; 18131 exports.createElementBlock = createElementBlock; 18132 exports.createElementVNode = createBaseVNode; 18133 exports.createHydrationRenderer = createHydrationRenderer; 18134 exports.createPropsRestProxy = createPropsRestProxy; 18135 exports.createRenderer = createRenderer; 18136 exports.createSSRApp = createSSRApp; 18137 exports.createSlots = createSlots; 18138 exports.createStaticVNode = createStaticVNode; 18139 exports.createTextVNode = createTextVNode; 18140 exports.createVNode = createVNode; 18141 exports.customRef = customRef; 18142 exports.defineAsyncComponent = defineAsyncComponent; 18143 exports.defineComponent = defineComponent; 18144 exports.defineCustomElement = defineCustomElement; 18145 exports.defineEmits = defineEmits; 18146 exports.defineExpose = defineExpose; 18147 exports.defineModel = defineModel; 18148 exports.defineOptions = defineOptions; 18149 exports.defineProps = defineProps; 18150 exports.defineSSRCustomElement = defineSSRCustomElement; 18151 exports.defineSlots = defineSlots; 18152 exports.devtools = devtools; 18153 exports.effect = effect; 18154 exports.effectScope = effectScope; 18155 exports.getCurrentInstance = getCurrentInstance; 18156 exports.getCurrentScope = getCurrentScope; 18157 exports.getCurrentWatcher = getCurrentWatcher; 18158 exports.getTransitionRawChildren = getTransitionRawChildren; 18159 exports.guardReactiveProps = guardReactiveProps; 18160 exports.h = h; 18161 exports.handleError = handleError; 18162 exports.hasInjectionContext = hasInjectionContext; 18163 exports.hydrate = hydrate; 18164 exports.hydrateOnIdle = hydrateOnIdle; 18165 exports.hydrateOnInteraction = hydrateOnInteraction; 18166 exports.hydrateOnMediaQuery = hydrateOnMediaQuery; 18167 exports.hydrateOnVisible = hydrateOnVisible; 18168 exports.initCustomFormatter = initCustomFormatter; 18169 exports.initDirectivesForSSR = initDirectivesForSSR; 18170 exports.inject = inject; 18171 exports.isMemoSame = isMemoSame; 18172 exports.isProxy = isProxy; 18173 exports.isReactive = isReactive; 18174 exports.isReadonly = isReadonly; 18175 exports.isRef = isRef; 18176 exports.isRuntimeOnly = isRuntimeOnly; 18177 exports.isShallow = isShallow; 18178 exports.isVNode = isVNode; 18179 exports.markRaw = markRaw; 18180 exports.mergeDefaults = mergeDefaults; 18181 exports.mergeModels = mergeModels; 18182 exports.mergeProps = mergeProps; 18183 exports.nextTick = nextTick; 18184 exports.no
18184rmalizeClass = normalizeClass; 18185 exports.normalizeProps = normalizeProps; 18186 exports.normalizeStyle = normalizeStyle; 18187 exports.onActivated = onActivated; 18188 exports.onBeforeMount = onBeforeMount; 18189 exports.onBeforeUnmount = onBeforeUnmount; 18190 exports.onBeforeUpdate = onBeforeUpdate; 18191 exports.onDeactivated = onDeactivated; 18192 exports.onErrorCaptured = onErrorCaptured; 18193 exports.onMounted = onMounted; 18194 exports.onRenderTracked = onRenderTracked; 18195 exports.onRenderTriggered = onRenderTriggered; 18196 exports.onScopeDispose = onScopeDispose; 18197 exports.onServerPrefetch = onServerPrefetch; 18198 exports.onUnmounted = onUnmounted; 18199 exports.onUpdated = onUpdated; 18200 exports.onWatcherCleanup = onWatcherCleanup; 18201 exports.openBlock = openBlock; 18202 exports.popScopeId = popScopeId; 18203 exports.provide = provide; 18204 exports.proxyRefs = proxyRefs; 18205 exports.pushScopeId = pushScopeId; 18206 exports.queuePostFlushCb = queuePostFlushCb; 18207 exports.reactive = reactive; 18208 exports.readonly = readonly; 18209 exports.ref = ref; 18210 exports.registerRuntimeCompiler = registerRuntimeCompiler; 18211 exports.render = render; 18212 exports.renderList = renderList; 18213 exports.renderSlot = renderSlot; 18214 exports.resolveComponent = resolveComponent; 18215 exports.resolveDirective = resolveDirective; 18216 exports.resolveDynamicComponent = resolveDynamicComponent; 18217 exports.resolveFilter = resolveFilter; 18218 exports.resolveTransitionHooks = resolveTransitionHooks; 18219 exports.setBlockTracking = setBlockTracking; 18220 exports.setDevtoolsHook = setDevtoolsHook; 18221 exports.setTransitionHooks = setTransitionHooks; 18222 exports.shallowReactive = shallowReactive; 18223 exports.shallowReadonly = shallowReadonly; 18224 exports.shallowRef = shallowRef; 18225 exports.ssrContextKey = ssrContextKey; 18226 exports.ssrUtils = ssrUtils; 18227 exports.stop = stop; 18228 exports.toDisplayString = toDisplayString; 18229 exports.toHandlerKey = toHandlerKey; 18230 exports.toHandlers = toHandlers; 18231 exports.toRaw = toRaw; 18232 exports.toRef = toRef; 18233 exports.toRefs = toRefs; 18234 exports.toValue = toValue; 18235 exports.transformVNodeArgs = transformVNodeArgs; 18236 exports.triggerRef = triggerRef; 18237 exports.unref = unref; 18238 exports.useAttrs = useAttrs; 18239 exports.useCssModule = useCssModule; 18240 exports.useCssVars = useCssVars; 18241 exports.useHost = useHost; 18242 exports.useId = useId; 18243 exports.useModel = useModel; 18244 exports.useSSRContext = useSSRContext; 18245 exports.useShadowRoot = useShadowRoot; 18246 exports.useSlots = useSlots; 18247 exports.useTemplateRef = useTemplateRef; 18248 exports.useTransitionState = useTransitionState; 18249 exports.vModelCheckbox = vModelCheckbox; 18250 exports.vModelDynamic = vModelDynamic; 18251 exports.vModelRadio = vModelRadio; 18252 exports.vModelSelect = vModelSelect; 18253 exports.vModelText = vModelText; 18254 exports.vShow = vShow; 18255 exports.version = version; 18256 exports.warn = warn; 18257 exports.watch = watch; 18258 exports.watchEffect = watchEffect; 18259 exports.watchPostEffect = watchPostEffect; 18260 exports.watchSyncEffect = watchSyncEffect; 18261 exports.withAsyncContext = withAsyncContext; 18262 exports.withCtx = withCtx; 18263 exports.withDefaults = withDefaults; 18264 exports.withDirectives = withDirectives; 18265 exports.withKeys = withKeys; 18266 exports.withMemo = withMemo; 18267 exports.withModifiers = withModifiers; 18268 exports.withScopeId = withScopeId; 18269 18270 return exports; 18271 18272})({});
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.