/** * @vue/compiler-dom v3.6.0-rc.10 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ var VueCompilerDOM = (function(exports) { Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); //#region packages/shared/src/makeMap.ts /** * Make a map and return a function for checking if a key * is in that map. * IMPORTANT: all calls of this function must be prefixed with * \/\*#\_\_PURE\_\_\*\/ * So that they can be tree-shaken if necessary. */ /*@__NO_SIDE_EFFECTS__*/ function makeMap(str) { const map = Object.create(null); for (const key of str.split(",")) map[key] = 1; return (val) => val in map; } //#endregion //#region packages/shared/src/general.ts const EMPTY_OBJ = Object.freeze({}); Object.freeze([]); const NOOP = () => {}; /** * Always return false. */ const NO = () => false; const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); const extend = Object.assign; const isArray = Array.isArray; const isString = (val) => typeof val === "string"; const isSymbol = (val) => typeof val === "symbol"; const isObject = (val) => val !== null && typeof val === "object"; const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"); const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"); const cacheStringFunction = (fn) => { const cache = Object.create(null); return ((str) => { return cache[str] || (cache[str] = fn(str)); }); }; const camelizeRE = /-(\w)/g; const camelizeReplacer = (_, c) => c ? c.toUpperCase() : ""; /** * @private */ const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer)); /** * @private */ const capitalize = cacheStringFunction((str) => { return str.charAt(0).toUpperCase() + str.slice(1); }); /** * @private */ const toHandlerKey = cacheStringFunction((str) => { return str ? `on${capitalize(str)}` : ``; }); /** * #13070 When v-model and v-model:model directives are used together, * they will generate the same modelModifiers prop, * so a `$` suffix is added to avoid conflicts. * @private */ const getModifierPropName = (name) => { return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`; }; //#endregion //#region packages/shared/src/patchFlags.ts /** * dev only flag -> name mapping */ const PatchFlagNames = { [1]: `TEXT`, [2]: `CLASS`, [4]: `STYLE`, [8]: `PROPS`, [16]: `FULL_PROPS`, [32]: `NEED_HYDRATION`, [64]: `STABLE_FRAGMENT`, [128]: `KEYED_FRAGMENT`, [256]: `UNKEYED_FRAGMENT`, [512]: `NEED_PATCH`, [1024]: `DYNAMIC_SLOTS`, [2048]: `DEV_ROOT_FRAGMENT`, [-1]: `CACHED`, [-2]: `BAIL` }; //#endregion //#region packages/shared/src/slotFlags.ts /** * Dev only */ const slotFlagsText = { [1]: "STABLE", [2]: "DYNAMIC", [3]: "FORWARDED" }; //#endregion //#region packages/shared/src/codeframe.ts const range = 2; function generateCodeFrame(source, start = 0, end = source.length) { start = Math.max(0, Math.min(start, source.length)); end = Math.max(0, Math.min(end, source.length)); if (start > end) return ""; let lines = source.split(/(\r?\n)/); const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); lines = lines.filter((_, idx) => idx % 2 === 0); let count = 0; const res = []; for (let i = 0; i < lines.length; i++) { count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); if (count >= start) { for (let j = i - range; j <= i + range || end > count; j++) { if (j < 0 || j >= lines.length) continue; const line = j + 1; res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`); const lineLength = lines[j].length; const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; if (j === i) { const pad = start - (count - (lineLength + newLineSeqLength)); const length = Math.max(1, end > count ? lineLength - pad : end - start); res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); } else if (j > i) { if (end > count) { const length = Math.max(Math.min(end - count, lineLength), 1); res.push(` | ` + "^".repeat(length)); } count += lineLength + newLineSeqLength; } } break; } } return res.join("\n"); } //#endregion //#region packages/shared/src/normalizeProp.ts const listDelimiterRE = /;(?![^(]*\))/g; const propertyDelimiterRE = /:([^]+)/; const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g; function parseStringStyle(cssText) { const ret = {}; cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => { if (item) { const tmp = item.split(propertyDelimiterRE); tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); } }); return ret; } //#endregion //#region packages/shared/src/domTagConfig.ts 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"; 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"; 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"; const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; /** * Compiler only. * Do NOT use in runtime code paths unless behind `__DEV__` flag. */ const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS); /** * Compiler only. * Do NOT use in runtime code paths unless behind `__DEV__` flag. */ const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS); /** * Compiler only. * Do NOT use in runtime code paths unless behind `__DEV__` flag. */ const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS); /** * Compiler only. * Do NOT use in runtime code paths unless behind `__DEV__` flag. */ const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS); //#endregion //#region packages/compiler-core/src/runtimeHelpers.ts const FRAGMENT = Symbol(`Fragment`); const TELEPORT = Symbol(`Teleport`); const SUSPENSE = Symbol(`Suspense`); const KEEP_ALIVE = Symbol(`KeepAlive`); const BASE_TRANSITION = Symbol(`BaseTransition`); const OPEN_BLOCK = Symbol(`openBlock`); const CREATE_BLOCK = Symbol(`createBlock`); const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock`); const CREATE_VNODE = Symbol(`createVNode`); const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode`); const CREATE_COMMENT = Symbol(`createCommentVNode`); const CREATE_TEXT = Symbol(`createTextVNode`); const CREATE_STATIC = Symbol(`createStaticVNode`); const RESOLVE_COMPONENT = Symbol(`resolveComponent`); const RESOLVE_DYNAMIC_COMPONENT = Symbol(`resolveDynamicComponent`); const RESOLVE_DIRECTIVE = Symbol(`resolveDirective`); const RESOLVE_FILTER = Symbol(`resolveFilter`); const WITH_DIRECTIVES = Symbol(`withDirectives`); const RENDER_LIST = Symbol(`renderList`); const RENDER_SLOT = Symbol(`renderSlot`); const CREATE_SLOTS = Symbol(`createSlots`); const TO_DISPLAY_STRING = Symbol(`toDisplayString`); const MERGE_PROPS = Symbol(`mergeProps`); const NORMALIZE_CLASS = Symbol(`normalizeClass`); const NORMALIZE_STYLE = Symbol(`normalizeStyle`); const NORMALIZE_PROPS = Symbol(`normalizeProps`); const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps`); const TO_HANDLERS = Symbol(`toHandlers`); const CAMELIZE = Symbol(`camelize`); const CAPITALIZE = Symbol(`capitalize`); const TO_HANDLER_KEY = Symbol(`toHandlerKey`); const SET_BLOCK_TRACKING = Symbol(`setBlockTracking`); /** * @deprecated no longer needed in 3.5+ because we no longer hoist element nodes * but kept for backwards compat */ const PUSH_SCOPE_ID = Symbol(`pushScopeId`); /** * @deprecated kept for backwards compat */ const POP_SCOPE_ID = Symbol(`popScopeId`); const WITH_CTX = Symbol(`withCtx`); const UNREF = Symbol(`unref`); const IS_REF = Symbol(`isRef`); const WITH_MEMO = Symbol(`withMemo`); const IS_MEMO_SAME = Symbol(`isMemoSame`); const helperNameMap = { [FRAGMENT]: `Fragment`, [TELEPORT]: `Teleport`, [SUSPENSE]: `Suspense`, [KEEP_ALIVE]: `KeepAlive`, [BASE_TRANSITION]: `BaseTransition`, [OPEN_BLOCK]: `openBlock`, [CREATE_BLOCK]: `createBlock`, [CREATE_ELEMENT_BLOCK]: `createElementBlock`, [CREATE_VNODE]: `createVNode`, [CREATE_ELEMENT_VNODE]: `createElementVNode`, [CREATE_COMMENT]: `createCommentVNode`, [CREATE_TEXT]: `createTextVNode`, [CREATE_STATIC]: `createStaticVNode`, [RESOLVE_COMPONENT]: `resolveComponent`, [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, [RESOLVE_DIRECTIVE]: `resolveDirective`, [RESOLVE_FILTER]: `resolveFilter`, [WITH_DIRECTIVES]: `withDirectives`, [RENDER_LIST]: `renderList`, [RENDER_SLOT]: `renderSlot`, [CREATE_SLOTS]: `createSlots`, [TO_DISPLAY_STRING]: `toDisplayString`, [MERGE_PROPS]: `mergeProps`, [NORMALIZE_CLASS]: `normalizeClass`, [NORMALIZE_STYLE]: `normalizeStyle`, [NORMALIZE_PROPS]: `normalizeProps`, [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, [TO_HANDLERS]: `toHandlers`, [CAMELIZE]: `camelize`, [CAPITALIZE]: `capitalize`, [TO_HANDLER_KEY]: `toHandlerKey`, [SET_BLOCK_TRACKING]: `setBlockTracking`, [PUSH_SCOPE_ID]: `pushScopeId`, [POP_SCOPE_ID]: `popScopeId`, [WITH_CTX]: `withCtx`, [UNREF]: `unref`, [IS_REF]: `isRef`, [WITH_MEMO]: `withMemo`, [IS_MEMO_SAME]: `isMemoSame` }; function registerRuntimeHelpers(helpers) { Object.getOwnPropertySymbols(helpers).forEach((s) => { helperNameMap[s] = helpers[s]; }); } //#endregion //#region packages/compiler-core/src/ast.ts const NodeTypes = { "ROOT": 0, "0": "ROOT", "ELEMENT": 1, "1": "ELEMENT", "TEXT": 2, "2": "TEXT", "COMMENT": 3, "3": "COMMENT", "SIMPLE_EXPRESSION": 4, "4": "SIMPLE_EXPRESSION", "INTERPOLATION": 5, "5": "INTERPOLATION", "ATTRIBUTE": 6, "6": "ATTRIBUTE", "DIRECTIVE": 7, "7": "DIRECTIVE", "COMPOUND_EXPRESSION": 8, "8": "COMPOUND_EXPRESSION", "IF": 9, "9": "IF", "IF_BRANCH": 10, "10": "IF_BRANCH", "FOR": 11, "11": "FOR", "TEXT_CALL": 12, "12": "TEXT_CALL", "VNODE_CALL": 13, "13": "VNODE_CALL", "JS_CALL_EXPRESSION": 14, "14": "JS_CALL_EXPRESSION", "JS_OBJECT_EXPRESSION": 15, "15": "JS_OBJECT_EXPRESSION", "JS_PROPERTY": 16, "16": "JS_PROPERTY", "JS_ARRAY_EXPRESSION": 17, "17": "JS_ARRAY_EXPRESSION", "JS_FUNCTION_EXPRESSION": 18, "18": "JS_FUNCTION_EXPRESSION", "JS_CONDITIONAL_EXPRESSION": 19, "19": "JS_CONDITIONAL_EXPRESSION", "JS_CACHE_EXPRESSION": 20, "20": "JS_CACHE_EXPRESSION", "JS_BLOCK_STATEMENT": 21, "21": "JS_BLOCK_STATEMENT", "JS_TEMPLATE_LITERAL": 22, "22": "JS_TEMPLATE_LITERAL", "JS_IF_STATEMENT": 23, "23": "JS_IF_STATEMENT", "JS_ASSIGNMENT_EXPRESSION": 24, "24": "JS_ASSIGNMENT_EXPRESSION", "JS_SEQUENCE_EXPRESSION": 25, "25": "JS_SEQUENCE_EXPRESSION", "JS_RETURN_STATEMENT": 26, "26": "JS_RETURN_STATEMENT" }; const ElementTypes = { "ELEMENT": 0, "0": "ELEMENT", "COMPONENT": 1, "1": "COMPONENT", "SLOT": 2, "2": "SLOT", "TEMPLATE": 3, "3": "TEMPLATE" }; /** * Static types have several levels. * Higher levels implies lower levels. e.g. a node that can be stringified * can always be hoisted and skipped for patch. */ const ConstantTypes = { "NOT_CONSTANT": 0, "0": "NOT_CONSTANT", "CAN_SKIP_PATCH": 1, "1": "CAN_SKIP_PATCH", "CAN_CACHE": 2, "2": "CAN_CACHE", "CAN_STRINGIFY": 3, "3": "CAN_STRINGIFY" }; const locStub = { start: { line: 1, column: 1, offset: 0 }, end: { line: 1, column: 1, offset: 0 }, source: "" }; function createRoot(children, source = "") { return { type: 0, source, children, helpers: /* @__PURE__ */ new Set(), components: [], directives: [], hoists: [], imports: [], cached: [], temps: 0, codegenNode: void 0, loc: locStub }; } function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { if (context) { if (isBlock) { context.helper(OPEN_BLOCK); context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); } else context.helper(getVNodeHelper(context.inSSR, isComponent)); if (directives) context.helper(WITH_DIRECTIVES); } return { type: 13, tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent, loc }; } function createArrayExpression(elements, loc = locStub) { return { type: 17, loc, elements }; } function createObjectExpression(properties, loc = locStub) { return { type: 15, loc, properties }; } function createObjectProperty(key, value) { return { type: 16, loc: locStub, key: isString(key) ? createSimpleExpression(key, true) : key, value }; } function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { return { type: 4, loc, content, isStatic, constType: isStatic ? 3 : constType }; } function createInterpolation(content, loc) { return { type: 5, loc, content: isString(content) ? createSimpleExpression(content, false, loc) : content }; } function createCompoundExpression(children, loc = locStub) { return { type: 8, loc, children }; } function createCallExpression(callee, args = [], loc = locStub) { return { type: 14, loc, callee, arguments: args }; } function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { return { type: 18, params, returns, newline, isSlot, loc }; } function createConditionalExpression(test, consequent, alternate, newline = true) { return { type: 19, test, consequent, alternate, newline, loc: locStub }; } function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { return { type: 20, index, value, needPauseTracking, inVOnce, needArraySpread: false, loc: locStub }; } function createBlockStatement(body) { return { type: 21, body, loc: locStub }; } function createTemplateLiteral(elements) { return { type: 22, elements, loc: locStub }; } function createIfStatement(test, consequent, alternate) { return { type: 23, test, consequent, alternate, loc: locStub }; } function createAssignmentExpression(left, right) { return { type: 24, left, right, loc: locStub }; } function createSequenceExpression(expressions) { return { type: 25, expressions, loc: locStub }; } function createReturnStatement(returns) { return { type: 26, returns, loc: locStub }; } function getVNodeHelper(ssr, isComponent) { return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; } function getVNodeBlockHelper(ssr, isComponent) { return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; } function convertToBlock(node, { helper, removeHelper, inSSR }) { if (!node.isBlock) { node.isBlock = true; removeHelper(getVNodeHelper(inSSR, node.isComponent)); helper(OPEN_BLOCK); helper(getVNodeBlockHelper(inSSR, node.isComponent)); } } //#endregion //#region packages/compiler-core/src/tokenizer.ts const defaultDelimitersOpen = new Uint8Array([123, 123]); const defaultDelimitersClose = new Uint8Array([125, 125]); /** * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a * tag name. */ function isTagStartChar(c) { return c >= 97 && c <= 122 || c >= 65 && c <= 90; } function isWhitespace(c) { return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; } function isEndOfTagSection(c) { return c === 47 || c === 62 || isWhitespace(c); } function toCharCodes(str) { const ret = new Uint8Array(str.length); for (let i = 0; i < str.length; i++) ret[i] = str.charCodeAt(i); return ret; } /** * Sequences used to match longer strings. * * We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End * sequences with an increased offset. */ const Sequences = { Cdata: new Uint8Array([ 67, 68, 65, 84, 65, 91 ]), CdataEnd: new Uint8Array([ 93, 93, 62 ]), CommentEnd: new Uint8Array([ 45, 45, 62 ]), ScriptEnd: new Uint8Array([ 60, 47, 115, 99, 114, 105, 112, 116 ]), StyleEnd: new Uint8Array([ 60, 47, 115, 116, 121, 108, 101 ]), TitleEnd: new Uint8Array([ 60, 47, 116, 105, 116, 108, 101 ]), TextareaEnd: new Uint8Array([ 60, 47, 116, 101, 120, 116, 97, 114, 101, 97 ]) }; var Tokenizer = class { get inSFCRoot() { return this.mode === 2 && this.stack.length === 0; } constructor(stack, cbs) { this.stack = stack; this.cbs = cbs; this.state = 1; this.buffer = ""; this.sectionStart = 0; this.index = 0; this.entityStart = 0; this.baseState = 1; this.inRCDATA = false; this.inXML = false; this.inVPre = false; this.newlines = []; this.mode = 0; this.delimiterOpen = defaultDelimitersOpen; this.delimiterClose = defaultDelimitersClose; this.delimiterIndex = -1; this.currentSequence = void 0; this.sequenceIndex = 0; } reset() { this.state = 1; this.mode = 0; this.buffer = ""; this.sectionStart = 0; this.index = 0; this.baseState = 1; this.inRCDATA = false; this.currentSequence = void 0; this.newlines.length = 0; this.delimiterOpen = defaultDelimitersOpen; this.delimiterClose = defaultDelimitersClose; } /** * Generate Position object with line / column information using recorded * newline positions. We know the index is always going to be an already * processed index, so all the newlines up to this index should have been * recorded. */ getPos(index) { let line = 1; let column = index + 1; const length = this.newlines.length; let j = -1; if (length > 100) { let l = -1; let r = length; while (l + 1 < r) { const m = l + r >>> 1; this.newlines[m] < index ? l = m : r = m; } j = l; } else for (let i = length - 1; i >= 0; i--) if (index > this.newlines[i]) { j = i; break; } if (j >= 0) { line = j + 2; column = index - this.newlines[j]; } return { column, line, offset: index }; } peek() { return this.buffer.charCodeAt(this.index + 1); } stateText(c) { if (c === 60) { if (this.index > this.sectionStart) this.cbs.ontext(this.sectionStart, this.index); this.state = 5; this.sectionStart = this.index; } else if (!this.inVPre && c === this.delimiterOpen[0]) { this.state = 2; this.delimiterIndex = 0; this.stateInterpolationOpen(c); } } stateInterpolationOpen(c) { if (c === this.delimiterOpen[this.delimiterIndex]) { if (this.delimiterIndex === this.delimiterOpen.length - 1) { const start = this.index + 1 - this.delimiterOpen.length; if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start); this.state = 3; this.sectionStart = start; } else this.delimiterIndex++; } else if (this.inRCDATA) { this.state = 32; this.stateInRCDATA(c); } else { this.state = 1; this.stateText(c); } } stateInterpolation(c) { if (c === this.delimiterClose[0]) { this.state = 4; this.delimiterIndex = 0; this.stateInterpolationClose(c); } } stateInterpolationClose(c) { if (c === this.delimiterClose[this.delimiterIndex]) { if (this.delimiterIndex === this.delimiterClose.length - 1) { this.cbs.oninterpolation(this.sectionStart, this.index + 1); if (this.inRCDATA) this.state = 32; else this.state = 1; this.sectionStart = this.index + 1; } else this.delimiterIndex++; } else { this.state = 3; this.stateInterpolation(c); } } stateSpecialStartSequence(c) { const isEnd = this.sequenceIndex === this.currentSequence.length; if (!(isEnd ? isEndOfTagSection(c) : (c | 32) === this.currentSequence[this.sequenceIndex])) this.inRCDATA = false; else if (!isEnd) { this.sequenceIndex++; return; } this.sequenceIndex = 0; this.state = 6; this.stateInTagName(c); } /** Look for an end tag. For