UNPKG

275 kBJavaScriptView Raw
1'use strict';
2
3var build = require('./dep-cc49d7be.js');
4
5var compilerDom_cjs$2 = {};
6
7/**
8 * Make a map and return a function for checking if a key
9 * is in that map.
10 * IMPORTANT: all calls of this function must be prefixed with
11 * \/\*#\_\_PURE\_\_\*\/
12 * So that rollup can tree-shake them if necessary.
13 */
14function makeMap(str, expectsLowerCase) {
15 const map = Object.create(null);
16 const list = str.split(',');
17 for (let i = 0; i < list.length; i++) {
18 map[list[i]] = true;
19 }
20 return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
21}
22
23/**
24 * dev only flag -> name mapping
25 */
26const PatchFlagNames = {
27 [1 /* TEXT */]: `TEXT`,
28 [2 /* CLASS */]: `CLASS`,
29 [4 /* STYLE */]: `STYLE`,
30 [8 /* PROPS */]: `PROPS`,
31 [16 /* FULL_PROPS */]: `FULL_PROPS`,
32 [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
33 [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
34 [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
35 [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
36 [512 /* NEED_PATCH */]: `NEED_PATCH`,
37 [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
38 [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
39 [-1 /* HOISTED */]: `HOISTED`,
40 [-2 /* BAIL */]: `BAIL`
41};
42
43/**
44 * Dev only
45 */
46const slotFlagsText = {
47 [1 /* STABLE */]: 'STABLE',
48 [2 /* DYNAMIC */]: 'DYNAMIC',
49 [3 /* FORWARDED */]: 'FORWARDED'
50};
51
52const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
53 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
54 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
55const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
56
57const range = 2;
58function generateCodeFrame(source, start = 0, end = source.length) {
59 const lines = source.split(/\r?\n/);
60 let count = 0;
61 const res = [];
62 for (let i = 0; i < lines.length; i++) {
63 count += lines[i].length + 1;
64 if (count >= start) {
65 for (let j = i - range; j <= i + range || end > count; j++) {
66 if (j < 0 || j >= lines.length)
67 continue;
68 const line = j + 1;
69 res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
70 const lineLength = lines[j].length;
71 if (j === i) {
72 // push underline
73 const pad = start - (count - lineLength) + 1;
74 const length = Math.max(1, end > count ? lineLength - pad : end - start);
75 res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
76 }
77 else if (j > i) {
78 if (end > count) {
79 const length = Math.max(Math.min(end - count, lineLength), 1);
80 res.push(` | ` + '^'.repeat(length));
81 }
82 count += lineLength + 1;
83 }
84 }
85 break;
86 }
87 }
88 return res.join('\n');
89}
90
91/**
92 * On the client we only need to offer special cases for boolean attributes that
93 * have different names from their corresponding dom properties:
94 * - itemscope -> N/A
95 * - allowfullscreen -> allowFullscreen
96 * - formnovalidate -> formNoValidate
97 * - ismap -> isMap
98 * - nomodule -> noModule
99 * - novalidate -> noValidate
100 * - readonly -> readOnly
101 */
102const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
103const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
104/**
105 * The full list is needed during SSR to produce the correct initial markup.
106 */
107const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
108 `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
109 `loop,open,required,reversed,scoped,seamless,` +
110 `checked,muted,multiple,selected`);
111const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
112const attrValidationCache = {};
113function isSSRSafeAttrName(name) {
114 if (attrValidationCache.hasOwnProperty(name)) {
115 return attrValidationCache[name];
116 }
117 const isUnsafe = unsafeAttrCharRE.test(name);
118 if (isUnsafe) {
119 console.error(`unsafe attribute name: ${name}`);
120 }
121 return (attrValidationCache[name] = !isUnsafe);
122}
123const propsToAttrMap = {
124 acceptCharset: 'accept-charset',
125 className: 'class',
126 htmlFor: 'for',
127 httpEquiv: 'http-equiv'
128};
129/**
130 * CSS properties that accept plain numbers
131 */
132const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
133 `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
134 `columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
135 `grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
136 `grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
137 `line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
138 // SVG
139 `fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
140 `stroke-miterlimit,stroke-opacity,stroke-width`);
141/**
142 * Known attributes, this is used for stringification of runtime static nodes
143 * so that we don't stringify bindings that cannot be set from HTML.
144 * Don't also forget to allow `data-*` and `aria-*`!
145 * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
146 */
147const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
148 `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
149 `border,buffered,capture,challenge,charset,checked,cite,class,code,` +
150 `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
151 `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
152 `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
153 `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
154 `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
155 `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
156 `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
157 `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
158 `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
159 `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
160 `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
161 `value,width,wrap`);
162
163function normalizeStyle(value) {
164 if (isArray(value)) {
165 const res = {};
166 for (let i = 0; i < value.length; i++) {
167 const item = value[i];
168 const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
169 if (normalized) {
170 for (const key in normalized) {
171 res[key] = normalized[key];
172 }
173 }
174 }
175 return res;
176 }
177 else if (isObject(value)) {
178 return value;
179 }
180}
181const listDelimiterRE = /;(?![^(]*\))/g;
182const propertyDelimiterRE = /:(.+)/;
183function parseStringStyle(cssText) {
184 const ret = {};
185 cssText.split(listDelimiterRE).forEach(item => {
186 if (item) {
187 const tmp = item.split(propertyDelimiterRE);
188 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
189 }
190 });
191 return ret;
192}
193function stringifyStyle(styles) {
194 let ret = '';
195 if (!styles) {
196 return ret;
197 }
198 for (const key in styles) {
199 const value = styles[key];
200 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
201 if (isString(value) ||
202 (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
203 // only render valid values
204 ret += `${normalizedKey}:${value};`;
205 }
206 }
207 return ret;
208}
209function normalizeClass(value) {
210 let res = '';
211 if (isString(value)) {
212 res = value;
213 }
214 else if (isArray(value)) {
215 for (let i = 0; i < value.length; i++) {
216 const normalized = normalizeClass(value[i]);
217 if (normalized) {
218 res += normalized + ' ';
219 }
220 }
221 }
222 else if (isObject(value)) {
223 for (const name in value) {
224 if (value[name]) {
225 res += name + ' ';
226 }
227 }
228 }
229 return res.trim();
230}
231
232// These tag configs are shared between compiler-dom and runtime-dom, so they
233// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
234const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
235 'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
236 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
237 'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
238 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
239 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
240 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
241 'option,output,progress,select,textarea,details,dialog,menu,' +
242 'summary,template,blockquote,iframe,tfoot';
243// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
244const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
245 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
246 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
247 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
248 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
249 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
250 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
251 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
252 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
253 'text,textPath,title,tspan,unknown,use,view';
254const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
255const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
256const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
257const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
258
259const escapeRE = /["'&<>]/;
260function escapeHtml(string) {
261 const str = '' + string;
262 const match = escapeRE.exec(str);
263 if (!match) {
264 return str;
265 }
266 let html = '';
267 let escaped;
268 let index;
269 let lastIndex = 0;
270 for (index = match.index; index < str.length; index++) {
271 switch (str.charCodeAt(index)) {
272 case 34: // "
273 escaped = '&quot;';
274 break;
275 case 38: // &
276 escaped = '&amp;';
277 break;
278 case 39: // '
279 escaped = '&#39;';
280 break;
281 case 60: // <
282 escaped = '&lt;';
283 break;
284 case 62: // >
285 escaped = '&gt;';
286 break;
287 default:
288 continue;
289 }
290 if (lastIndex !== index) {
291 html += str.substring(lastIndex, index);
292 }
293 lastIndex = index + 1;
294 html += escaped;
295 }
296 return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
297}
298// https://www.w3.org/TR/html52/syntax.html#comments
299const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
300function escapeHtmlComment(src) {
301 return src.replace(commentStripRE, '');
302}
303
304function looseCompareArrays(a, b) {
305 if (a.length !== b.length)
306 return false;
307 let equal = true;
308 for (let i = 0; equal && i < a.length; i++) {
309 equal = looseEqual(a[i], b[i]);
310 }
311 return equal;
312}
313function looseEqual(a, b) {
314 if (a === b)
315 return true;
316 let aValidType = isDate(a);
317 let bValidType = isDate(b);
318 if (aValidType || bValidType) {
319 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
320 }
321 aValidType = isArray(a);
322 bValidType = isArray(b);
323 if (aValidType || bValidType) {
324 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
325 }
326 aValidType = isObject(a);
327 bValidType = isObject(b);
328 if (aValidType || bValidType) {
329 /* istanbul ignore if: this if will probably never be called */
330 if (!aValidType || !bValidType) {
331 return false;
332 }
333 const aKeysCount = Object.keys(a).length;
334 const bKeysCount = Object.keys(b).length;
335 if (aKeysCount !== bKeysCount) {
336 return false;
337 }
338 for (const key in a) {
339 const aHasKey = a.hasOwnProperty(key);
340 const bHasKey = b.hasOwnProperty(key);
341 if ((aHasKey && !bHasKey) ||
342 (!aHasKey && bHasKey) ||
343 !looseEqual(a[key], b[key])) {
344 return false;
345 }
346 }
347 }
348 return String(a) === String(b);
349}
350function looseIndexOf(arr, val) {
351 return arr.findIndex(item => looseEqual(item, val));
352}
353
354/**
355 * For converting {{ interpolation }} values to displayed strings.
356 * @private
357 */
358const toDisplayString = (val) => {
359 return val == null
360 ? ''
361 : isObject(val)
362 ? JSON.stringify(val, replacer, 2)
363 : String(val);
364};
365const replacer = (_key, val) => {
366 if (isMap(val)) {
367 return {
368 [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
369 entries[`${key} =>`] = val;
370 return entries;
371 }, {})
372 };
373 }
374 else if (isSet(val)) {
375 return {
376 [`Set(${val.size})`]: [...val.values()]
377 };
378 }
379 else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
380 return String(val);
381 }
382 return val;
383};
384
385/**
386 * List of @babel/parser plugins that are used for template expression
387 * transforms and SFC script transforms. By default we enable proposals slated
388 * for ES2020. This will need to be updated as the spec moves forward.
389 * Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
390 */
391const babelParserDefaultPlugins = [
392 'bigInt',
393 'optionalChaining',
394 'nullishCoalescingOperator'
395];
396const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
397 ? Object.freeze({})
398 : {};
399const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
400const NOOP = () => { };
401/**
402 * Always return false.
403 */
404const NO = () => false;
405const onRE = /^on[^a-z]/;
406const isOn = (key) => onRE.test(key);
407const isModelListener = (key) => key.startsWith('onUpdate:');
408const extend = Object.assign;
409const remove = (arr, el) => {
410 const i = arr.indexOf(el);
411 if (i > -1) {
412 arr.splice(i, 1);
413 }
414};
415const hasOwnProperty = Object.prototype.hasOwnProperty;
416const hasOwn = (val, key) => hasOwnProperty.call(val, key);
417const isArray = Array.isArray;
418const isMap = (val) => toTypeString(val) === '[object Map]';
419const isSet = (val) => toTypeString(val) === '[object Set]';
420const isDate = (val) => val instanceof Date;
421const isFunction = (val) => typeof val === 'function';
422const isString = (val) => typeof val === 'string';
423const isSymbol = (val) => typeof val === 'symbol';
424const isObject = (val) => val !== null && typeof val === 'object';
425const isPromise = (val) => {
426 return isObject(val) && isFunction(val.then) && isFunction(val.catch);
427};
428const objectToString = Object.prototype.toString;
429const toTypeString = (value) => objectToString.call(value);
430const toRawType = (value) => {
431 // extract "RawType" from strings like "[object RawType]"
432 return toTypeString(value).slice(8, -1);
433};
434const isPlainObject = (val) => toTypeString(val) === '[object Object]';
435const isIntegerKey = (key) => isString(key) &&
436 key !== 'NaN' &&
437 key[0] !== '-' &&
438 '' + parseInt(key, 10) === key;
439const isReservedProp = /*#__PURE__*/ makeMap(
440// the leading comma is intentional so empty string "" is also included
441',key,ref,' +
442 'onVnodeBeforeMount,onVnodeMounted,' +
443 'onVnodeBeforeUpdate,onVnodeUpdated,' +
444 'onVnodeBeforeUnmount,onVnodeUnmounted');
445const cacheStringFunction$1 = (fn) => {
446 const cache = Object.create(null);
447 return ((str) => {
448 const hit = cache[str];
449 return hit || (cache[str] = fn(str));
450 });
451};
452const camelizeRE$1 = /-(\w)/g;
453/**
454 * @private
455 */
456const camelize$1 = cacheStringFunction$1((str) => {
457 return str.replace(camelizeRE$1, (_, c) => (c ? c.toUpperCase() : ''));
458});
459const hyphenateRE = /\B([A-Z])/g;
460/**
461 * @private
462 */
463const hyphenate = cacheStringFunction$1((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
464/**
465 * @private
466 */
467const capitalize = cacheStringFunction$1((str) => str.charAt(0).toUpperCase() + str.slice(1));
468/**
469 * @private
470 */
471const toHandlerKey = cacheStringFunction$1((str) => (str ? `on${capitalize(str)}` : ``));
472// compare whether a value has changed, accounting for NaN.
473const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
474const invokeArrayFns = (fns, arg) => {
475 for (let i = 0; i < fns.length; i++) {
476 fns[i](arg);
477 }
478};
479const def = (obj, key, value) => {
480 Object.defineProperty(obj, key, {
481 configurable: true,
482 enumerable: false,
483 value
484 });
485};
486const toNumber = (val) => {
487 const n = parseFloat(val);
488 return isNaN(n) ? val : n;
489};
490let _globalThis;
491const getGlobalThis = () => {
492 return (_globalThis ||
493 (_globalThis =
494 typeof globalThis !== 'undefined'
495 ? globalThis
496 : typeof self !== 'undefined'
497 ? self
498 : typeof window !== 'undefined'
499 ? window
500 : typeof global !== 'undefined'
501 ? global
502 : {}));
503};
504
505var shared_esmBundler = {
506 __proto__: null,
507 EMPTY_ARR: EMPTY_ARR,
508 EMPTY_OBJ: EMPTY_OBJ,
509 NO: NO,
510 NOOP: NOOP,
511 PatchFlagNames: PatchFlagNames,
512 babelParserDefaultPlugins: babelParserDefaultPlugins,
513 camelize: camelize$1,
514 capitalize: capitalize,
515 def: def,
516 escapeHtml: escapeHtml,
517 escapeHtmlComment: escapeHtmlComment,
518 extend: extend,
519 generateCodeFrame: generateCodeFrame,
520 getGlobalThis: getGlobalThis,
521 hasChanged: hasChanged,
522 hasOwn: hasOwn,
523 hyphenate: hyphenate,
524 invokeArrayFns: invokeArrayFns,
525 isArray: isArray,
526 isBooleanAttr: isBooleanAttr,
527 isDate: isDate,
528 isFunction: isFunction,
529 isGloballyWhitelisted: isGloballyWhitelisted,
530 isHTMLTag: isHTMLTag,
531 isIntegerKey: isIntegerKey,
532 isKnownAttr: isKnownAttr,
533 isMap: isMap,
534 isModelListener: isModelListener,
535 isNoUnitNumericStyleProp: isNoUnitNumericStyleProp,
536 isObject: isObject,
537 isOn: isOn,
538 isPlainObject: isPlainObject,
539 isPromise: isPromise,
540 isReservedProp: isReservedProp,
541 isSSRSafeAttrName: isSSRSafeAttrName,
542 isSVGTag: isSVGTag,
543 isSet: isSet,
544 isSpecialBooleanAttr: isSpecialBooleanAttr,
545 isString: isString,
546 isSymbol: isSymbol,
547 isVoidTag: isVoidTag,
548 looseEqual: looseEqual,
549 looseIndexOf: looseIndexOf,
550 makeMap: makeMap,
551 normalizeClass: normalizeClass,
552 normalizeStyle: normalizeStyle,
553 objectToString: objectToString,
554 parseStringStyle: parseStringStyle,
555 propsToAttrMap: propsToAttrMap,
556 remove: remove,
557 slotFlagsText: slotFlagsText,
558 stringifyStyle: stringifyStyle,
559 toDisplayString: toDisplayString,
560 toHandlerKey: toHandlerKey,
561 toNumber: toNumber,
562 toRawType: toRawType,
563 toTypeString: toTypeString
564};
565
566function defaultOnError(error) {
567 throw error;
568}
569function defaultOnWarn(msg) {
570 (process.env.NODE_ENV !== 'production') && console.warn(`[Vue warn] ${msg.message}`);
571}
572function createCompilerError(code, loc, messages, additionalMessage) {
573 const msg = (process.env.NODE_ENV !== 'production') || !true
574 ? (messages || errorMessages)[code] + (additionalMessage || ``)
575 : code;
576 const error = new SyntaxError(String(msg));
577 error.code = code;
578 error.loc = loc;
579 return error;
580}
581const errorMessages = {
582 // parse errors
583 [0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
584 [1 /* CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
585 [2 /* DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
586 [3 /* END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
587 [4 /* END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
588 [5 /* EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
589 [6 /* EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
590 [7 /* EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
591 [8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
592 [9 /* EOF_IN_TAG */]: 'Unexpected EOF in tag.',
593 [10 /* INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
594 [11 /* INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
595 [12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
596 [13 /* MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
597 [14 /* MISSING_END_TAG_NAME */]: 'End tag name was expected.',
598 [15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
599 [16 /* NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
600 [17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
601 [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
602 [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
603 [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
604 [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null cahracter.`,
605 [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
606 // Vue-specific parse errors
607 [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
608 [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
609 [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
610 [26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
611 'Note that dynamic directive argument cannot contain spaces.',
612 // transform errors
613 [27 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
614 [28 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
615 [29 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
616 [30 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
617 [31 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
618 [32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
619 [33 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
620 [34 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
621 [35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
622 [36 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
623 `When there are multiple named slots, all slots should use <template> ` +
624 `syntax to avoid scope ambiguity.`,
625 [37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
626 [38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
627 `default slot. These children will be ignored.`,
628 [39 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
629 [40 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
630 [41 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
631 [42 /* X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
632 [43 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
633 [44 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
634 // generic errors
635 [45 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
636 [46 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
637 [47 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
638 [48 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
639 // just to fullfill types
640 [49 /* __EXTEND_POINT__ */]: ``
641};
642
643const FRAGMENT = Symbol((process.env.NODE_ENV !== 'production') ? `Fragment` : ``);
644const TELEPORT = Symbol((process.env.NODE_ENV !== 'production') ? `Teleport` : ``);
645const SUSPENSE = Symbol((process.env.NODE_ENV !== 'production') ? `Suspense` : ``);
646const KEEP_ALIVE = Symbol((process.env.NODE_ENV !== 'production') ? `KeepAlive` : ``);
647const BASE_TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `BaseTransition` : ``);
648const OPEN_BLOCK = Symbol((process.env.NODE_ENV !== 'production') ? `openBlock` : ``);
649const CREATE_BLOCK = Symbol((process.env.NODE_ENV !== 'production') ? `createBlock` : ``);
650const CREATE_VNODE = Symbol((process.env.NODE_ENV !== 'production') ? `createVNode` : ``);
651const CREATE_COMMENT = Symbol((process.env.NODE_ENV !== 'production') ? `createCommentVNode` : ``);
652const CREATE_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `createTextVNode` : ``);
653const CREATE_STATIC = Symbol((process.env.NODE_ENV !== 'production') ? `createStaticVNode` : ``);
654const RESOLVE_COMPONENT = Symbol((process.env.NODE_ENV !== 'production') ? `resolveComponent` : ``);
655const RESOLVE_DYNAMIC_COMPONENT = Symbol((process.env.NODE_ENV !== 'production') ? `resolveDynamicComponent` : ``);
656const RESOLVE_DIRECTIVE = Symbol((process.env.NODE_ENV !== 'production') ? `resolveDirective` : ``);
657const RESOLVE_FILTER = Symbol((process.env.NODE_ENV !== 'production') ? `resolveFilter` : ``);
658const WITH_DIRECTIVES = Symbol((process.env.NODE_ENV !== 'production') ? `withDirectives` : ``);
659const RENDER_LIST = Symbol((process.env.NODE_ENV !== 'production') ? `renderList` : ``);
660const RENDER_SLOT = Symbol((process.env.NODE_ENV !== 'production') ? `renderSlot` : ``);
661const CREATE_SLOTS = Symbol((process.env.NODE_ENV !== 'production') ? `createSlots` : ``);
662const TO_DISPLAY_STRING = Symbol((process.env.NODE_ENV !== 'production') ? `toDisplayString` : ``);
663const MERGE_PROPS = Symbol((process.env.NODE_ENV !== 'production') ? `mergeProps` : ``);
664const TO_HANDLERS = Symbol((process.env.NODE_ENV !== 'production') ? `toHandlers` : ``);
665const CAMELIZE = Symbol((process.env.NODE_ENV !== 'production') ? `camelize` : ``);
666const CAPITALIZE = Symbol((process.env.NODE_ENV !== 'production') ? `capitalize` : ``);
667const TO_HANDLER_KEY = Symbol((process.env.NODE_ENV !== 'production') ? `toHandlerKey` : ``);
668const SET_BLOCK_TRACKING = Symbol((process.env.NODE_ENV !== 'production') ? `setBlockTracking` : ``);
669const PUSH_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `pushScopeId` : ``);
670const POP_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `popScopeId` : ``);
671const WITH_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `withScopeId` : ``);
672const WITH_CTX = Symbol((process.env.NODE_ENV !== 'production') ? `withCtx` : ``);
673const UNREF = Symbol((process.env.NODE_ENV !== 'production') ? `unref` : ``);
674const IS_REF = Symbol((process.env.NODE_ENV !== 'production') ? `isRef` : ``);
675// Name mapping for runtime helpers that need to be imported from 'vue' in
676// generated code. Make sure these are correctly exported in the runtime!
677// Using `any` here because TS doesn't allow symbols as index type.
678const helperNameMap = {
679 [FRAGMENT]: `Fragment`,
680 [TELEPORT]: `Teleport`,
681 [SUSPENSE]: `Suspense`,
682 [KEEP_ALIVE]: `KeepAlive`,
683 [BASE_TRANSITION]: `BaseTransition`,
684 [OPEN_BLOCK]: `openBlock`,
685 [CREATE_BLOCK]: `createBlock`,
686 [CREATE_VNODE]: `createVNode`,
687 [CREATE_COMMENT]: `createCommentVNode`,
688 [CREATE_TEXT]: `createTextVNode`,
689 [CREATE_STATIC]: `createStaticVNode`,
690 [RESOLVE_COMPONENT]: `resolveComponent`,
691 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
692 [RESOLVE_DIRECTIVE]: `resolveDirective`,
693 [RESOLVE_FILTER]: `resolveFilter`,
694 [WITH_DIRECTIVES]: `withDirectives`,
695 [RENDER_LIST]: `renderList`,
696 [RENDER_SLOT]: `renderSlot`,
697 [CREATE_SLOTS]: `createSlots`,
698 [TO_DISPLAY_STRING]: `toDisplayString`,
699 [MERGE_PROPS]: `mergeProps`,
700 [TO_HANDLERS]: `toHandlers`,
701 [CAMELIZE]: `camelize`,
702 [CAPITALIZE]: `capitalize`,
703 [TO_HANDLER_KEY]: `toHandlerKey`,
704 [SET_BLOCK_TRACKING]: `setBlockTracking`,
705 [PUSH_SCOPE_ID]: `pushScopeId`,
706 [POP_SCOPE_ID]: `popScopeId`,
707 [WITH_SCOPE_ID]: `withScopeId`,
708 [WITH_CTX]: `withCtx`,
709 [UNREF]: `unref`,
710 [IS_REF]: `isRef`
711};
712function registerRuntimeHelpers(helpers) {
713 Object.getOwnPropertySymbols(helpers).forEach(s => {
714 helperNameMap[s] = helpers[s];
715 });
716}
717
718// AST Utilities ---------------------------------------------------------------
719// Some expressions, e.g. sequence and conditional expressions, are never
720// associated with template nodes, so their source locations are just a stub.
721// Container types like CompoundExpression also don't need a real location.
722const locStub = {
723 source: '',
724 start: { line: 1, column: 1, offset: 0 },
725 end: { line: 1, column: 1, offset: 0 }
726};
727function createRoot(children, loc = locStub) {
728 return {
729 type: 0 /* ROOT */,
730 children,
731 helpers: [],
732 components: [],
733 directives: [],
734 hoists: [],
735 imports: [],
736 cached: 0,
737 temps: 0,
738 codegenNode: undefined,
739 loc
740 };
741}
742function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, loc = locStub) {
743 if (context) {
744 if (isBlock) {
745 context.helper(OPEN_BLOCK);
746 context.helper(CREATE_BLOCK);
747 }
748 else {
749 context.helper(CREATE_VNODE);
750 }
751 if (directives) {
752 context.helper(WITH_DIRECTIVES);
753 }
754 }
755 return {
756 type: 13 /* VNODE_CALL */,
757 tag,
758 props,
759 children,
760 patchFlag,
761 dynamicProps,
762 directives,
763 isBlock,
764 disableTracking,
765 loc
766 };
767}
768function createArrayExpression(elements, loc = locStub) {
769 return {
770 type: 17 /* JS_ARRAY_EXPRESSION */,
771 loc,
772 elements
773 };
774}
775function createObjectExpression(properties, loc = locStub) {
776 return {
777 type: 15 /* JS_OBJECT_EXPRESSION */,
778 loc,
779 properties
780 };
781}
782function createObjectProperty(key, value) {
783 return {
784 type: 16 /* JS_PROPERTY */,
785 loc: locStub,
786 key: isString(key) ? createSimpleExpression(key, true) : key,
787 value
788 };
789}
790function createSimpleExpression(content, isStatic, loc = locStub, constType = 0 /* NOT_CONSTANT */) {
791 return {
792 type: 4 /* SIMPLE_EXPRESSION */,
793 loc,
794 content,
795 isStatic,
796 constType: isStatic ? 3 /* CAN_STRINGIFY */ : constType
797 };
798}
799function createInterpolation(content, loc) {
800 return {
801 type: 5 /* INTERPOLATION */,
802 loc,
803 content: isString(content)
804 ? createSimpleExpression(content, false, loc)
805 : content
806 };
807}
808function createCompoundExpression(children, loc = locStub) {
809 return {
810 type: 8 /* COMPOUND_EXPRESSION */,
811 loc,
812 children
813 };
814}
815function createCallExpression(callee, args = [], loc = locStub) {
816 return {
817 type: 14 /* JS_CALL_EXPRESSION */,
818 loc,
819 callee,
820 arguments: args
821 };
822}
823function createFunctionExpression(params, returns = undefined, newline = false, isSlot = false, loc = locStub) {
824 return {
825 type: 18 /* JS_FUNCTION_EXPRESSION */,
826 params,
827 returns,
828 newline,
829 isSlot,
830 loc
831 };
832}
833function createConditionalExpression(test, consequent, alternate, newline = true) {
834 return {
835 type: 19 /* JS_CONDITIONAL_EXPRESSION */,
836 test,
837 consequent,
838 alternate,
839 newline,
840 loc: locStub
841 };
842}
843function createCacheExpression(index, value, isVNode = false) {
844 return {
845 type: 20 /* JS_CACHE_EXPRESSION */,
846 index,
847 value,
848 isVNode,
849 loc: locStub
850 };
851}
852function createBlockStatement(body) {
853 return {
854 type: 21 /* JS_BLOCK_STATEMENT */,
855 body,
856 loc: locStub
857 };
858}
859function createTemplateLiteral(elements) {
860 return {
861 type: 22 /* JS_TEMPLATE_LITERAL */,
862 elements,
863 loc: locStub
864 };
865}
866function createIfStatement(test, consequent, alternate) {
867 return {
868 type: 23 /* JS_IF_STATEMENT */,
869 test,
870 consequent,
871 alternate,
872 loc: locStub
873 };
874}
875function createAssignmentExpression(left, right) {
876 return {
877 type: 24 /* JS_ASSIGNMENT_EXPRESSION */,
878 left,
879 right,
880 loc: locStub
881 };
882}
883function createSequenceExpression(expressions) {
884 return {
885 type: 25 /* JS_SEQUENCE_EXPRESSION */,
886 expressions,
887 loc: locStub
888 };
889}
890function createReturnStatement(returns) {
891 return {
892 type: 26 /* JS_RETURN_STATEMENT */,
893 returns,
894 loc: locStub
895 };
896}
897
898const isStaticExp = (p) => p.type === 4 /* SIMPLE_EXPRESSION */ && p.isStatic;
899const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
900function isCoreComponent(tag) {
901 if (isBuiltInType(tag, 'Teleport')) {
902 return TELEPORT;
903 }
904 else if (isBuiltInType(tag, 'Suspense')) {
905 return SUSPENSE;
906 }
907 else if (isBuiltInType(tag, 'KeepAlive')) {
908 return KEEP_ALIVE;
909 }
910 else if (isBuiltInType(tag, 'BaseTransition')) {
911 return BASE_TRANSITION;
912 }
913}
914const nonIdentifierRE = /^\d|[^\$\w]/;
915const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
916const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
917const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/;
918const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
919/**
920 * Simple lexer to check if an expression is a member expression. This is
921 * lax and only checks validity at the root level (i.e. does not validate exps
922 * inside square brackets), but it's ok since these are only used on template
923 * expressions and false positives are invalid expressions in the first place.
924 */
925const isMemberExpression = (path) => {
926 // remove whitespaces around . or [ first
927 path = path.trim().replace(whitespaceRE, s => s.trim());
928 let state = 0 /* inMemberExp */;
929 let prevState = 0 /* inMemberExp */;
930 let currentOpenBracketCount = 0;
931 let currentStringType = null;
932 for (let i = 0; i < path.length; i++) {
933 const char = path.charAt(i);
934 switch (state) {
935 case 0 /* inMemberExp */:
936 if (char === '[') {
937 prevState = state;
938 state = 1 /* inBrackets */;
939 currentOpenBracketCount++;
940 }
941 else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
942 return false;
943 }
944 break;
945 case 1 /* inBrackets */:
946 if (char === `'` || char === `"` || char === '`') {
947 prevState = state;
948 state = 2 /* inString */;
949 currentStringType = char;
950 }
951 else if (char === `[`) {
952 currentOpenBracketCount++;
953 }
954 else if (char === `]`) {
955 if (!--currentOpenBracketCount) {
956 state = prevState;
957 }
958 }
959 break;
960 case 2 /* inString */:
961 if (char === currentStringType) {
962 state = prevState;
963 currentStringType = null;
964 }
965 break;
966 }
967 }
968 return !currentOpenBracketCount;
969};
970function getInnerRange(loc, offset, length) {
971 const source = loc.source.substr(offset, length);
972 const newLoc = {
973 source,
974 start: advancePositionWithClone(loc.start, loc.source, offset),
975 end: loc.end
976 };
977 if (length != null) {
978 newLoc.end = advancePositionWithClone(loc.start, loc.source, offset + length);
979 }
980 return newLoc;
981}
982function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
983 return advancePositionWithMutation(extend({}, pos), source, numberOfCharacters);
984}
985// advance by mutation without cloning (for performance reasons), since this
986// gets called a lot in the parser
987function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
988 let linesCount = 0;
989 let lastNewLinePos = -1;
990 for (let i = 0; i < numberOfCharacters; i++) {
991 if (source.charCodeAt(i) === 10 /* newline char code */) {
992 linesCount++;
993 lastNewLinePos = i;
994 }
995 }
996 pos.offset += numberOfCharacters;
997 pos.line += linesCount;
998 pos.column =
999 lastNewLinePos === -1
1000 ? pos.column + numberOfCharacters
1001 : numberOfCharacters - lastNewLinePos;
1002 return pos;
1003}
1004function assert(condition, msg) {
1005 /* istanbul ignore if */
1006 if (!condition) {
1007 throw new Error(msg || `unexpected compiler condition`);
1008 }
1009}
1010function findDir(node, name, allowEmpty = false) {
1011 for (let i = 0; i < node.props.length; i++) {
1012 const p = node.props[i];
1013 if (p.type === 7 /* DIRECTIVE */ &&
1014 (allowEmpty || p.exp) &&
1015 (isString(name) ? p.name === name : name.test(p.name))) {
1016 return p;
1017 }
1018 }
1019}
1020function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
1021 for (let i = 0; i < node.props.length; i++) {
1022 const p = node.props[i];
1023 if (p.type === 6 /* ATTRIBUTE */) {
1024 if (dynamicOnly)
1025 continue;
1026 if (p.name === name && (p.value || allowEmpty)) {
1027 return p;
1028 }
1029 }
1030 else if (p.name === 'bind' &&
1031 (p.exp || allowEmpty) &&
1032 isBindKey(p.arg, name)) {
1033 return p;
1034 }
1035 }
1036}
1037function isBindKey(arg, name) {
1038 return !!(arg && isStaticExp(arg) && arg.content === name);
1039}
1040function hasDynamicKeyVBind(node) {
1041 return node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
1042 p.name === 'bind' &&
1043 (!p.arg || // v-bind="obj"
1044 p.arg.type !== 4 /* SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
1045 !p.arg.isStatic) // v-bind:[foo]
1046 );
1047}
1048function isText(node) {
1049 return node.type === 5 /* INTERPOLATION */ || node.type === 2 /* TEXT */;
1050}
1051function isVSlot(p) {
1052 return p.type === 7 /* DIRECTIVE */ && p.name === 'slot';
1053}
1054function isTemplateNode(node) {
1055 return (node.type === 1 /* ELEMENT */ && node.tagType === 3 /* TEMPLATE */);
1056}
1057function isSlotOutlet(node) {
1058 return node.type === 1 /* ELEMENT */ && node.tagType === 2 /* SLOT */;
1059}
1060function injectProp(node, prop, context) {
1061 let propsWithInjection;
1062 const props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
1063 if (props == null || isString(props)) {
1064 propsWithInjection = createObjectExpression([prop]);
1065 }
1066 else if (props.type === 14 /* JS_CALL_EXPRESSION */) {
1067 // merged props... add ours
1068 // only inject key to object literal if it's the first argument so that
1069 // if doesn't override user provided keys
1070 const first = props.arguments[0];
1071 if (!isString(first) && first.type === 15 /* JS_OBJECT_EXPRESSION */) {
1072 first.properties.unshift(prop);
1073 }
1074 else {
1075 if (props.callee === TO_HANDLERS) {
1076 // #2366
1077 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
1078 createObjectExpression([prop]),
1079 props
1080 ]);
1081 }
1082 else {
1083 props.arguments.unshift(createObjectExpression([prop]));
1084 }
1085 }
1086 !propsWithInjection && (propsWithInjection = props);
1087 }
1088 else if (props.type === 15 /* JS_OBJECT_EXPRESSION */) {
1089 let alreadyExists = false;
1090 // check existing key to avoid overriding user provided keys
1091 if (prop.key.type === 4 /* SIMPLE_EXPRESSION */) {
1092 const propKeyName = prop.key.content;
1093 alreadyExists = props.properties.some(p => p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
1094 p.key.content === propKeyName);
1095 }
1096 if (!alreadyExists) {
1097 props.properties.unshift(prop);
1098 }
1099 propsWithInjection = props;
1100 }
1101 else {
1102 // single v-bind with expression, return a merged replacement
1103 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
1104 createObjectExpression([prop]),
1105 props
1106 ]);
1107 }
1108 if (node.type === 13 /* VNODE_CALL */) {
1109 node.props = propsWithInjection;
1110 }
1111 else {
1112 node.arguments[2] = propsWithInjection;
1113 }
1114}
1115function toValidAssetId(name, type) {
1116 return `_${type}_${name.replace(/[^\w]/g, '_')}`;
1117}
1118// Check if a node contains expressions that reference current context scope ids
1119function hasScopeRef(node, ids) {
1120 if (!node || Object.keys(ids).length === 0) {
1121 return false;
1122 }
1123 switch (node.type) {
1124 case 1 /* ELEMENT */:
1125 for (let i = 0; i < node.props.length; i++) {
1126 const p = node.props[i];
1127 if (p.type === 7 /* DIRECTIVE */ &&
1128 (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
1129 return true;
1130 }
1131 }
1132 return node.children.some(c => hasScopeRef(c, ids));
1133 case 11 /* FOR */:
1134 if (hasScopeRef(node.source, ids)) {
1135 return true;
1136 }
1137 return node.children.some(c => hasScopeRef(c, ids));
1138 case 9 /* IF */:
1139 return node.branches.some(b => hasScopeRef(b, ids));
1140 case 10 /* IF_BRANCH */:
1141 if (hasScopeRef(node.condition, ids)) {
1142 return true;
1143 }
1144 return node.children.some(c => hasScopeRef(c, ids));
1145 case 4 /* SIMPLE_EXPRESSION */:
1146 return (!node.isStatic &&
1147 isSimpleIdentifier(node.content) &&
1148 !!ids[node.content]);
1149 case 8 /* COMPOUND_EXPRESSION */:
1150 return node.children.some(c => isObject(c) && hasScopeRef(c, ids));
1151 case 5 /* INTERPOLATION */:
1152 case 12 /* TEXT_CALL */:
1153 return hasScopeRef(node.content, ids);
1154 case 2 /* TEXT */:
1155 case 3 /* COMMENT */:
1156 return false;
1157 default:
1158 if ((process.env.NODE_ENV !== 'production')) ;
1159 return false;
1160 }
1161}
1162
1163const deprecationData = {
1164 ["COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */]: {
1165 message: `Platform-native elements with "is" prop will no longer be ` +
1166 `treated as components in Vue 3 unless the "is" value is explicitly ` +
1167 `prefixed with "vue:".`,
1168 link: `https://v3.vuejs.org/guide/migration/custom-elements-interop.html`
1169 },
1170 ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
1171 message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
1172 `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
1173 `\`v-model:${key}\`.`,
1174 link: `https://v3.vuejs.org/guide/migration/v-model.html`
1175 },
1176 ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
1177 message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
1178 `Vue 3 will automatically set a binding as DOM property when appropriate.`
1179 },
1180 ["COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */]: {
1181 message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript ` +
1182 `object spread: it will now overwrite an existing non-mergeable attribute ` +
1183 `that appears before v-bind in the case of conflict. ` +
1184 `To retain 2.x behavior, move v-bind to make it the first attribute. ` +
1185 `You can also suppress this warning if the usage is intended.`,
1186 link: `https://v3.vuejs.org/guide/migration/v-bind.html`
1187 },
1188 ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
1189 message: `.native modifier for v-on has been removed as is no longer necessary.`,
1190 link: `https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.html`
1191 },
1192 ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
1193 message: `v-if / v-for precedence when used on the same element has changed ` +
1194 `in Vue 3: v-if now takes higher precedence and will no longer have ` +
1195 `access to v-for scope variables. It is best to avoid the ambiguity ` +
1196 `with <template> tags or use a computed property that filters v-for ` +
1197 `data source.`,
1198 link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
1199 },
1200 ["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
1201 message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1202 `Consider using function refs or refactor to avoid ref usage altogether.`,
1203 link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1204 },
1205 ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
1206 message: `<template> with no special directives will render as a native template ` +
1207 `element instead of its inner content in Vue 3.`
1208 },
1209 ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
1210 message: `"inline-template" has been removed in Vue 3.`,
1211 link: `https://v3.vuejs.org/guide/migration/inline-template-attribute.html`
1212 },
1213 ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
1214 message: `filters have been removed in Vue 3. ` +
1215 `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
1216 `Use method calls or computed properties instead.`,
1217 link: `https://v3.vuejs.org/guide/migration/filters.html`
1218 }
1219};
1220function getCompatValue(key, context) {
1221 const config = context.options
1222 ? context.options.compatConfig
1223 : context.compatConfig;
1224 const value = config && config[key];
1225 if (key === 'MODE') {
1226 return value || 3; // compiler defaults to v3 behavior
1227 }
1228 else {
1229 return value;
1230 }
1231}
1232function isCompatEnabled(key, context) {
1233 const mode = getCompatValue('MODE', context);
1234 const value = getCompatValue(key, context);
1235 // in v3 mode, only enable if explicitly set to true
1236 // otherwise enable for any non-false value
1237 return mode === 3 ? value === true : value !== false;
1238}
1239function checkCompatEnabled(key, context, loc, ...args) {
1240 const enabled = isCompatEnabled(key, context);
1241 if ((process.env.NODE_ENV !== 'production') && enabled) {
1242 warnDeprecation(key, context, loc, ...args);
1243 }
1244 return enabled;
1245}
1246function warnDeprecation(key, context, loc, ...args) {
1247 const val = getCompatValue(key, context);
1248 if (val === 'suppress-warning') {
1249 return;
1250 }
1251 const { message, link } = deprecationData[key];
1252 const msg = `(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`;
1253 const err = new SyntaxError(msg);
1254 err.code = key;
1255 if (loc)
1256 err.loc = loc;
1257 context.onWarn(err);
1258}
1259
1260// The default decoder only provides escapes for characters reserved as part of
1261// the template syntax, and is only used if the custom renderer did not provide
1262// a platform-specific decoder.
1263const decodeRE = /&(gt|lt|amp|apos|quot);/g;
1264const decodeMap = {
1265 gt: '>',
1266 lt: '<',
1267 amp: '&',
1268 apos: "'",
1269 quot: '"'
1270};
1271const defaultParserOptions = {
1272 delimiters: [`{{`, `}}`],
1273 getNamespace: () => 0 /* HTML */,
1274 getTextMode: () => 0 /* DATA */,
1275 isVoidTag: NO,
1276 isPreTag: NO,
1277 isCustomElement: NO,
1278 decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
1279 onError: defaultOnError,
1280 onWarn: defaultOnWarn,
1281 comments: false
1282};
1283function baseParse(content, options = {}) {
1284 const context = createParserContext(content, options);
1285 const start = getCursor(context);
1286 return createRoot(parseChildren(context, 0 /* DATA */, []), getSelection(context, start));
1287}
1288function createParserContext(content, rawOptions) {
1289 const options = extend({}, defaultParserOptions);
1290 for (const key in rawOptions) {
1291 // @ts-ignore
1292 options[key] = rawOptions[key] || defaultParserOptions[key];
1293 }
1294 return {
1295 options,
1296 column: 1,
1297 line: 1,
1298 offset: 0,
1299 originalSource: content,
1300 source: content,
1301 inPre: false,
1302 inVPre: false,
1303 onWarn: options.onWarn
1304 };
1305}
1306function parseChildren(context, mode, ancestors) {
1307 const parent = last(ancestors);
1308 const ns = parent ? parent.ns : 0 /* HTML */;
1309 const nodes = [];
1310 while (!isEnd(context, mode, ancestors)) {
1311 const s = context.source;
1312 let node = undefined;
1313 if (mode === 0 /* DATA */ || mode === 1 /* RCDATA */) {
1314 if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
1315 // '{{'
1316 node = parseInterpolation(context, mode);
1317 }
1318 else if (mode === 0 /* DATA */ && s[0] === '<') {
1319 // https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
1320 if (s.length === 1) {
1321 emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 1);
1322 }
1323 else if (s[1] === '!') {
1324 // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
1325 if (startsWith(s, '<!--')) {
1326 node = parseComment(context);
1327 }
1328 else if (startsWith(s, '<!DOCTYPE')) {
1329 // Ignore DOCTYPE by a limitation.
1330 node = parseBogusComment(context);
1331 }
1332 else if (startsWith(s, '<![CDATA[')) {
1333 if (ns !== 0 /* HTML */) {
1334 node = parseCDATA(context, ancestors);
1335 }
1336 else {
1337 emitError(context, 1 /* CDATA_IN_HTML_CONTENT */);
1338 node = parseBogusComment(context);
1339 }
1340 }
1341 else {
1342 emitError(context, 11 /* INCORRECTLY_OPENED_COMMENT */);
1343 node = parseBogusComment(context);
1344 }
1345 }
1346 else if (s[1] === '/') {
1347 // https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
1348 if (s.length === 2) {
1349 emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 2);
1350 }
1351 else if (s[2] === '>') {
1352 emitError(context, 14 /* MISSING_END_TAG_NAME */, 2);
1353 advanceBy(context, 3);
1354 continue;
1355 }
1356 else if (/[a-z]/i.test(s[2])) {
1357 emitError(context, 23 /* X_INVALID_END_TAG */);
1358 parseTag(context, 1 /* End */, parent);
1359 continue;
1360 }
1361 else {
1362 emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
1363 node = parseBogusComment(context);
1364 }
1365 }
1366 else if (/[a-z]/i.test(s[1])) {
1367 node = parseElement(context, ancestors);
1368 // 2.x <template> with no directive compat
1369 if (isCompatEnabled("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context) &&
1370 node &&
1371 node.tag === 'template' &&
1372 !node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
1373 isSpecialTemplateDirective(p.name))) {
1374 (process.env.NODE_ENV !== 'production') &&
1375 warnDeprecation("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context, node.loc);
1376 node = node.children;
1377 }
1378 }
1379 else if (s[1] === '?') {
1380 emitError(context, 21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
1381 node = parseBogusComment(context);
1382 }
1383 else {
1384 emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
1385 }
1386 }
1387 }
1388 if (!node) {
1389 node = parseText(context, mode);
1390 }
1391 if (isArray(node)) {
1392 for (let i = 0; i < node.length; i++) {
1393 pushNode(nodes, node[i]);
1394 }
1395 }
1396 else {
1397 pushNode(nodes, node);
1398 }
1399 }
1400 // Whitespace handling strategy like v2
1401 let removedWhitespace = false;
1402 if (mode !== 2 /* RAWTEXT */ && mode !== 1 /* RCDATA */) {
1403 const preserve = context.options.whitespace === 'preserve';
1404 for (let i = 0; i < nodes.length; i++) {
1405 const node = nodes[i];
1406 if (!context.inPre && node.type === 2 /* TEXT */) {
1407 if (!/[^\t\r\n\f ]/.test(node.content)) {
1408 const prev = nodes[i - 1];
1409 const next = nodes[i + 1];
1410 // Remove if:
1411 // - the whitespace is the first or last node, or:
1412 // - (condense mode) the whitespace is adjacent to a comment, or:
1413 // - (condense mode) the whitespace is between two elements AND contains newline
1414 if (!prev ||
1415 !next ||
1416 (!preserve &&
1417 (prev.type === 3 /* COMMENT */ ||
1418 next.type === 3 /* COMMENT */ ||
1419 (prev.type === 1 /* ELEMENT */ &&
1420 next.type === 1 /* ELEMENT */ &&
1421 /[\r\n]/.test(node.content))))) {
1422 removedWhitespace = true;
1423 nodes[i] = null;
1424 }
1425 else {
1426 // Otherwise, the whitespace is condensed into a single space
1427 node.content = ' ';
1428 }
1429 }
1430 else if (!preserve) {
1431 // in condense mode, consecutive whitespaces in text are condensed
1432 // down to a single space.
1433 node.content = node.content.replace(/[\t\r\n\f ]+/g, ' ');
1434 }
1435 }
1436 // also remove comment nodes in prod by default
1437 if (!(process.env.NODE_ENV !== 'production') &&
1438 node.type === 3 /* COMMENT */ &&
1439 !context.options.comments) {
1440 removedWhitespace = true;
1441 nodes[i] = null;
1442 }
1443 }
1444 if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
1445 // remove leading newline per html spec
1446 // https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
1447 const first = nodes[0];
1448 if (first && first.type === 2 /* TEXT */) {
1449 first.content = first.content.replace(/^\r?\n/, '');
1450 }
1451 }
1452 }
1453 return removedWhitespace ? nodes.filter(Boolean) : nodes;
1454}
1455function pushNode(nodes, node) {
1456 if (node.type === 2 /* TEXT */) {
1457 const prev = last(nodes);
1458 // Merge if both this and the previous node are text and those are
1459 // consecutive. This happens for cases like "a < b".
1460 if (prev &&
1461 prev.type === 2 /* TEXT */ &&
1462 prev.loc.end.offset === node.loc.start.offset) {
1463 prev.content += node.content;
1464 prev.loc.end = node.loc.end;
1465 prev.loc.source += node.loc.source;
1466 return;
1467 }
1468 }
1469 nodes.push(node);
1470}
1471function parseCDATA(context, ancestors) {
1472 advanceBy(context, 9);
1473 const nodes = parseChildren(context, 3 /* CDATA */, ancestors);
1474 if (context.source.length === 0) {
1475 emitError(context, 6 /* EOF_IN_CDATA */);
1476 }
1477 else {
1478 advanceBy(context, 3);
1479 }
1480 return nodes;
1481}
1482function parseComment(context) {
1483 const start = getCursor(context);
1484 let content;
1485 // Regular comment.
1486 const match = /--(\!)?>/.exec(context.source);
1487 if (!match) {
1488 content = context.source.slice(4);
1489 advanceBy(context, context.source.length);
1490 emitError(context, 7 /* EOF_IN_COMMENT */);
1491 }
1492 else {
1493 if (match.index <= 3) {
1494 emitError(context, 0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
1495 }
1496 if (match[1]) {
1497 emitError(context, 10 /* INCORRECTLY_CLOSED_COMMENT */);
1498 }
1499 content = context.source.slice(4, match.index);
1500 // Advancing with reporting nested comments.
1501 const s = context.source.slice(0, match.index);
1502 let prevIndex = 1, nestedIndex = 0;
1503 while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
1504 advanceBy(context, nestedIndex - prevIndex + 1);
1505 if (nestedIndex + 4 < s.length) {
1506 emitError(context, 16 /* NESTED_COMMENT */);
1507 }
1508 prevIndex = nestedIndex + 1;
1509 }
1510 advanceBy(context, match.index + match[0].length - prevIndex + 1);
1511 }
1512 return {
1513 type: 3 /* COMMENT */,
1514 content,
1515 loc: getSelection(context, start)
1516 };
1517}
1518function parseBogusComment(context) {
1519 const start = getCursor(context);
1520 const contentStart = context.source[1] === '?' ? 1 : 2;
1521 let content;
1522 const closeIndex = context.source.indexOf('>');
1523 if (closeIndex === -1) {
1524 content = context.source.slice(contentStart);
1525 advanceBy(context, context.source.length);
1526 }
1527 else {
1528 content = context.source.slice(contentStart, closeIndex);
1529 advanceBy(context, closeIndex + 1);
1530 }
1531 return {
1532 type: 3 /* COMMENT */,
1533 content,
1534 loc: getSelection(context, start)
1535 };
1536}
1537function parseElement(context, ancestors) {
1538 // Start tag.
1539 const wasInPre = context.inPre;
1540 const wasInVPre = context.inVPre;
1541 const parent = last(ancestors);
1542 const element = parseTag(context, 0 /* Start */, parent);
1543 const isPreBoundary = context.inPre && !wasInPre;
1544 const isVPreBoundary = context.inVPre && !wasInVPre;
1545 if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
1546 // #4030 self-closing <pre> tag
1547 if (context.options.isPreTag(element.tag)) {
1548 context.inPre = false;
1549 }
1550 return element;
1551 }
1552 // Children.
1553 ancestors.push(element);
1554 const mode = context.options.getTextMode(element, parent);
1555 const children = parseChildren(context, mode, ancestors);
1556 ancestors.pop();
1557 // 2.x inline-template compat
1558 {
1559 const inlineTemplateProp = element.props.find(p => p.type === 6 /* ATTRIBUTE */ && p.name === 'inline-template');
1560 if (inlineTemplateProp &&
1561 checkCompatEnabled("COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */, context, inlineTemplateProp.loc)) {
1562 const loc = getSelection(context, element.loc.end);
1563 inlineTemplateProp.value = {
1564 type: 2 /* TEXT */,
1565 content: loc.source,
1566 loc
1567 };
1568 }
1569 }
1570 element.children = children;
1571 // End tag.
1572 if (startsWithEndTagOpen(context.source, element.tag)) {
1573 parseTag(context, 1 /* End */, parent);
1574 }
1575 else {
1576 emitError(context, 24 /* X_MISSING_END_TAG */, 0, element.loc.start);
1577 if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
1578 const first = children[0];
1579 if (first && startsWith(first.loc.source, '<!--')) {
1580 emitError(context, 8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
1581 }
1582 }
1583 }
1584 element.loc = getSelection(context, element.loc.start);
1585 if (isPreBoundary) {
1586 context.inPre = false;
1587 }
1588 if (isVPreBoundary) {
1589 context.inVPre = false;
1590 }
1591 return element;
1592}
1593const isSpecialTemplateDirective = /*#__PURE__*/ makeMap(`if,else,else-if,for,slot`);
1594function parseTag(context, type, parent) {
1595 // Tag open.
1596 const start = getCursor(context);
1597 const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
1598 const tag = match[1];
1599 const ns = context.options.getNamespace(tag, parent);
1600 advanceBy(context, match[0].length);
1601 advanceSpaces(context);
1602 // save current state in case we need to re-parse attributes with v-pre
1603 const cursor = getCursor(context);
1604 const currentSource = context.source;
1605 // check <pre> tag
1606 const isPreTag = context.options.isPreTag(tag);
1607 if (isPreTag) {
1608 context.inPre = true;
1609 }
1610 // Attributes.
1611 let props = parseAttributes(context, type);
1612 // check v-pre
1613 if (type === 0 /* Start */ &&
1614 !context.inVPre &&
1615 props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
1616 context.inVPre = true;
1617 // reset context
1618 extend(context, cursor);
1619 context.source = currentSource;
1620 // re-parse attrs and filter out v-pre itself
1621 props = parseAttributes(context, type).filter(p => p.name !== 'v-pre');
1622 }
1623 // Tag close.
1624 let isSelfClosing = false;
1625 if (context.source.length === 0) {
1626 emitError(context, 9 /* EOF_IN_TAG */);
1627 }
1628 else {
1629 isSelfClosing = startsWith(context.source, '/>');
1630 if (type === 1 /* End */ && isSelfClosing) {
1631 emitError(context, 4 /* END_TAG_WITH_TRAILING_SOLIDUS */);
1632 }
1633 advanceBy(context, isSelfClosing ? 2 : 1);
1634 }
1635 if (type === 1 /* End */) {
1636 return;
1637 }
1638 // 2.x deprecation checks
1639 if ((process.env.NODE_ENV !== 'production') &&
1640 isCompatEnabled("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context)) {
1641 let hasIf = false;
1642 let hasFor = false;
1643 for (let i = 0; i < props.length; i++) {
1644 const p = props[i];
1645 if (p.type === 7 /* DIRECTIVE */) {
1646 if (p.name === 'if') {
1647 hasIf = true;
1648 }
1649 else if (p.name === 'for') {
1650 hasFor = true;
1651 }
1652 }
1653 if (hasIf && hasFor) {
1654 warnDeprecation("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
1655 }
1656 }
1657 }
1658 let tagType = 0 /* ELEMENT */;
1659 if (!context.inVPre) {
1660 if (tag === 'slot') {
1661 tagType = 2 /* SLOT */;
1662 }
1663 else if (tag === 'template') {
1664 if (props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
1665 tagType = 3 /* TEMPLATE */;
1666 }
1667 }
1668 else if (isComponent(tag, props, context)) {
1669 tagType = 1 /* COMPONENT */;
1670 }
1671 }
1672 return {
1673 type: 1 /* ELEMENT */,
1674 ns,
1675 tag,
1676 tagType,
1677 props,
1678 isSelfClosing,
1679 children: [],
1680 loc: getSelection(context, start),
1681 codegenNode: undefined // to be created during transform phase
1682 };
1683}
1684function isComponent(tag, props, context) {
1685 const options = context.options;
1686 if (options.isCustomElement(tag)) {
1687 return false;
1688 }
1689 if (tag === 'component' ||
1690 /^[A-Z]/.test(tag) ||
1691 isCoreComponent(tag) ||
1692 (options.isBuiltInComponent && options.isBuiltInComponent(tag)) ||
1693 (options.isNativeTag && !options.isNativeTag(tag))) {
1694 return true;
1695 }
1696 // at this point the tag should be a native tag, but check for potential "is"
1697 // casting
1698 for (let i = 0; i < props.length; i++) {
1699 const p = props[i];
1700 if (p.type === 6 /* ATTRIBUTE */) {
1701 if (p.name === 'is' && p.value) {
1702 if (p.value.content.startsWith('vue:')) {
1703 return true;
1704 }
1705 else if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1706 return true;
1707 }
1708 }
1709 }
1710 else {
1711 // directive
1712 // v-is (TODO Deprecate)
1713 if (p.name === 'is') {
1714 return true;
1715 }
1716 else if (
1717 // :is on plain element - only treat as component in compat mode
1718 p.name === 'bind' &&
1719 isBindKey(p.arg, 'is') &&
1720 true &&
1721 checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1722 return true;
1723 }
1724 }
1725 }
1726}
1727function parseAttributes(context, type) {
1728 const props = [];
1729 const attributeNames = new Set();
1730 while (context.source.length > 0 &&
1731 !startsWith(context.source, '>') &&
1732 !startsWith(context.source, '/>')) {
1733 if (startsWith(context.source, '/')) {
1734 emitError(context, 22 /* UNEXPECTED_SOLIDUS_IN_TAG */);
1735 advanceBy(context, 1);
1736 advanceSpaces(context);
1737 continue;
1738 }
1739 if (type === 1 /* End */) {
1740 emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
1741 }
1742 const attr = parseAttribute(context, attributeNames);
1743 if (type === 0 /* Start */) {
1744 props.push(attr);
1745 }
1746 if (/^[^\t\r\n\f />]/.test(context.source)) {
1747 emitError(context, 15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
1748 }
1749 advanceSpaces(context);
1750 }
1751 return props;
1752}
1753function parseAttribute(context, nameSet) {
1754 // Name.
1755 const start = getCursor(context);
1756 const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
1757 const name = match[0];
1758 if (nameSet.has(name)) {
1759 emitError(context, 2 /* DUPLICATE_ATTRIBUTE */);
1760 }
1761 nameSet.add(name);
1762 if (name[0] === '=') {
1763 emitError(context, 19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
1764 }
1765 {
1766 const pattern = /["'<]/g;
1767 let m;
1768 while ((m = pattern.exec(name))) {
1769 emitError(context, 17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
1770 }
1771 }
1772 advanceBy(context, name.length);
1773 // Value
1774 let value = undefined;
1775 if (/^[\t\r\n\f ]*=/.test(context.source)) {
1776 advanceSpaces(context);
1777 advanceBy(context, 1);
1778 advanceSpaces(context);
1779 value = parseAttributeValue(context);
1780 if (!value) {
1781 emitError(context, 13 /* MISSING_ATTRIBUTE_VALUE */);
1782 }
1783 }
1784 const loc = getSelection(context, start);
1785 if (!context.inVPre && /^(v-|:|@|#)/.test(name)) {
1786 const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
1787 let dirName = match[1] ||
1788 (startsWith(name, ':') ? 'bind' : startsWith(name, '@') ? 'on' : 'slot');
1789 let arg;
1790 if (match[2]) {
1791 const isSlot = dirName === 'slot';
1792 const startOffset = name.lastIndexOf(match[2]);
1793 const loc = getSelection(context, getNewPosition(context, start, startOffset), getNewPosition(context, start, startOffset + match[2].length + ((isSlot && match[3]) || '').length));
1794 let content = match[2];
1795 let isStatic = true;
1796 if (content.startsWith('[')) {
1797 isStatic = false;
1798 if (!content.endsWith(']')) {
1799 emitError(context, 26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1800 }
1801 content = content.substr(1, content.length - 2);
1802 }
1803 else if (isSlot) {
1804 // #1241 special case for v-slot: vuetify relies extensively on slot
1805 // names containing dots. v-slot doesn't have any modifiers and Vue 2.x
1806 // supports such usage so we are keeping it consistent with 2.x.
1807 content += match[3] || '';
1808 }
1809 arg = {
1810 type: 4 /* SIMPLE_EXPRESSION */,
1811 content,
1812 isStatic,
1813 constType: isStatic
1814 ? 3 /* CAN_STRINGIFY */
1815 : 0 /* NOT_CONSTANT */,
1816 loc
1817 };
1818 }
1819 if (value && value.isQuoted) {
1820 const valueLoc = value.loc;
1821 valueLoc.start.offset++;
1822 valueLoc.start.column++;
1823 valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
1824 valueLoc.source = valueLoc.source.slice(1, -1);
1825 }
1826 const modifiers = match[3] ? match[3].substr(1).split('.') : [];
1827 // 2.x compat v-bind:foo.sync -> v-model:foo
1828 if (dirName === 'bind' && arg) {
1829 if (modifiers.includes('sync') &&
1830 checkCompatEnabled("COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */, context, loc, arg.loc.source)) {
1831 dirName = 'model';
1832 modifiers.splice(modifiers.indexOf('sync'), 1);
1833 }
1834 if ((process.env.NODE_ENV !== 'production') && modifiers.includes('prop')) {
1835 checkCompatEnabled("COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */, context, loc);
1836 }
1837 }
1838 return {
1839 type: 7 /* DIRECTIVE */,
1840 name: dirName,
1841 exp: value && {
1842 type: 4 /* SIMPLE_EXPRESSION */,
1843 content: value.content,
1844 isStatic: false,
1845 // Treat as non-constant by default. This can be potentially set to
1846 // other values by `transformExpression` to make it eligible for hoisting.
1847 constType: 0 /* NOT_CONSTANT */,
1848 loc: value.loc
1849 },
1850 arg,
1851 modifiers,
1852 loc
1853 };
1854 }
1855 return {
1856 type: 6 /* ATTRIBUTE */,
1857 name,
1858 value: value && {
1859 type: 2 /* TEXT */,
1860 content: value.content,
1861 loc: value.loc
1862 },
1863 loc
1864 };
1865}
1866function parseAttributeValue(context) {
1867 const start = getCursor(context);
1868 let content;
1869 const quote = context.source[0];
1870 const isQuoted = quote === `"` || quote === `'`;
1871 if (isQuoted) {
1872 // Quoted value.
1873 advanceBy(context, 1);
1874 const endIndex = context.source.indexOf(quote);
1875 if (endIndex === -1) {
1876 content = parseTextData(context, context.source.length, 4 /* ATTRIBUTE_VALUE */);
1877 }
1878 else {
1879 content = parseTextData(context, endIndex, 4 /* ATTRIBUTE_VALUE */);
1880 advanceBy(context, 1);
1881 }
1882 }
1883 else {
1884 // Unquoted
1885 const match = /^[^\t\r\n\f >]+/.exec(context.source);
1886 if (!match) {
1887 return undefined;
1888 }
1889 const unexpectedChars = /["'<=`]/g;
1890 let m;
1891 while ((m = unexpectedChars.exec(match[0]))) {
1892 emitError(context, 18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
1893 }
1894 content = parseTextData(context, match[0].length, 4 /* ATTRIBUTE_VALUE */);
1895 }
1896 return { content, isQuoted, loc: getSelection(context, start) };
1897}
1898function parseInterpolation(context, mode) {
1899 const [open, close] = context.options.delimiters;
1900 const closeIndex = context.source.indexOf(close, open.length);
1901 if (closeIndex === -1) {
1902 emitError(context, 25 /* X_MISSING_INTERPOLATION_END */);
1903 return undefined;
1904 }
1905 const start = getCursor(context);
1906 advanceBy(context, open.length);
1907 const innerStart = getCursor(context);
1908 const innerEnd = getCursor(context);
1909 const rawContentLength = closeIndex - open.length;
1910 const rawContent = context.source.slice(0, rawContentLength);
1911 const preTrimContent = parseTextData(context, rawContentLength, mode);
1912 const content = preTrimContent.trim();
1913 const startOffset = preTrimContent.indexOf(content);
1914 if (startOffset > 0) {
1915 advancePositionWithMutation(innerStart, rawContent, startOffset);
1916 }
1917 const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
1918 advancePositionWithMutation(innerEnd, rawContent, endOffset);
1919 advanceBy(context, close.length);
1920 return {
1921 type: 5 /* INTERPOLATION */,
1922 content: {
1923 type: 4 /* SIMPLE_EXPRESSION */,
1924 isStatic: false,
1925 // Set `isConstant` to false by default and will decide in transformExpression
1926 constType: 0 /* NOT_CONSTANT */,
1927 content,
1928 loc: getSelection(context, innerStart, innerEnd)
1929 },
1930 loc: getSelection(context, start)
1931 };
1932}
1933function parseText(context, mode) {
1934 const endTokens = ['<', context.options.delimiters[0]];
1935 if (mode === 3 /* CDATA */) {
1936 endTokens.push(']]>');
1937 }
1938 let endIndex = context.source.length;
1939 for (let i = 0; i < endTokens.length; i++) {
1940 const index = context.source.indexOf(endTokens[i], 1);
1941 if (index !== -1 && endIndex > index) {
1942 endIndex = index;
1943 }
1944 }
1945 const start = getCursor(context);
1946 const content = parseTextData(context, endIndex, mode);
1947 return {
1948 type: 2 /* TEXT */,
1949 content,
1950 loc: getSelection(context, start)
1951 };
1952}
1953/**
1954 * Get text data with a given length from the current location.
1955 * This translates HTML entities in the text data.
1956 */
1957function parseTextData(context, length, mode) {
1958 const rawText = context.source.slice(0, length);
1959 advanceBy(context, length);
1960 if (mode === 2 /* RAWTEXT */ ||
1961 mode === 3 /* CDATA */ ||
1962 rawText.indexOf('&') === -1) {
1963 return rawText;
1964 }
1965 else {
1966 // DATA or RCDATA containing "&"". Entity decoding required.
1967 return context.options.decodeEntities(rawText, mode === 4 /* ATTRIBUTE_VALUE */);
1968 }
1969}
1970function getCursor(context) {
1971 const { column, line, offset } = context;
1972 return { column, line, offset };
1973}
1974function getSelection(context, start, end) {
1975 end = end || getCursor(context);
1976 return {
1977 start,
1978 end,
1979 source: context.originalSource.slice(start.offset, end.offset)
1980 };
1981}
1982function last(xs) {
1983 return xs[xs.length - 1];
1984}
1985function startsWith(source, searchString) {
1986 return source.startsWith(searchString);
1987}
1988function advanceBy(context, numberOfCharacters) {
1989 const { source } = context;
1990 advancePositionWithMutation(context, source, numberOfCharacters);
1991 context.source = source.slice(numberOfCharacters);
1992}
1993function advanceSpaces(context) {
1994 const match = /^[\t\r\n\f ]+/.exec(context.source);
1995 if (match) {
1996 advanceBy(context, match[0].length);
1997 }
1998}
1999function getNewPosition(context, start, numberOfCharacters) {
2000 return advancePositionWithClone(start, context.originalSource.slice(start.offset, numberOfCharacters), numberOfCharacters);
2001}
2002function emitError(context, code, offset, loc = getCursor(context)) {
2003 if (offset) {
2004 loc.offset += offset;
2005 loc.column += offset;
2006 }
2007 context.options.onError(createCompilerError(code, {
2008 start: loc,
2009 end: loc,
2010 source: ''
2011 }));
2012}
2013function isEnd(context, mode, ancestors) {
2014 const s = context.source;
2015 switch (mode) {
2016 case 0 /* DATA */:
2017 if (startsWith(s, '</')) {
2018 // TODO: probably bad performance
2019 for (let i = ancestors.length - 1; i >= 0; --i) {
2020 if (startsWithEndTagOpen(s, ancestors[i].tag)) {
2021 return true;
2022 }
2023 }
2024 }
2025 break;
2026 case 1 /* RCDATA */:
2027 case 2 /* RAWTEXT */: {
2028 const parent = last(ancestors);
2029 if (parent && startsWithEndTagOpen(s, parent.tag)) {
2030 return true;
2031 }
2032 break;
2033 }
2034 case 3 /* CDATA */:
2035 if (startsWith(s, ']]>')) {
2036 return true;
2037 }
2038 break;
2039 }
2040 return !s;
2041}
2042function startsWithEndTagOpen(source, tag) {
2043 return (startsWith(source, '</') &&
2044 source.substr(2, tag.length).toLowerCase() === tag.toLowerCase() &&
2045 /[\t\r\n\f />]/.test(source[2 + tag.length] || '>'));
2046}
2047
2048function hoistStatic(root, context) {
2049 walk(root, context,
2050 // Root node is unfortunately non-hoistable due to potential parent
2051 // fallthrough attributes.
2052 isSingleElementRoot(root, root.children[0]));
2053}
2054function isSingleElementRoot(root, child) {
2055 const { children } = root;
2056 return (children.length === 1 &&
2057 child.type === 1 /* ELEMENT */ &&
2058 !isSlotOutlet(child));
2059}
2060function walk(node, context, doNotHoistNode = false) {
2061 let hasHoistedNode = false;
2062 // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
2063 // static bindings with expressions. These expressions are guaranteed to be
2064 // constant so they are still eligible for hoisting, but they are only
2065 // available at runtime and therefore cannot be evaluated ahead of time.
2066 // This is only a concern for pre-stringification (via transformHoist by
2067 // @vue/compiler-dom), but doing it here allows us to perform only one full
2068 // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
2069 // stringficiation threshold is met.
2070 let canStringify = true;
2071 const { children } = node;
2072 for (let i = 0; i < children.length; i++) {
2073 const child = children[i];
2074 // only plain elements & text calls are eligible for hoisting.
2075 if (child.type === 1 /* ELEMENT */ &&
2076 child.tagType === 0 /* ELEMENT */) {
2077 const constantType = doNotHoistNode
2078 ? 0 /* NOT_CONSTANT */
2079 : getConstantType(child, context);
2080 if (constantType > 0 /* NOT_CONSTANT */) {
2081 if (constantType < 3 /* CAN_STRINGIFY */) {
2082 canStringify = false;
2083 }
2084 if (constantType >= 2 /* CAN_HOIST */) {
2085 child.codegenNode.patchFlag =
2086 -1 /* HOISTED */ + ((process.env.NODE_ENV !== 'production') ? ` /* HOISTED */` : ``);
2087 child.codegenNode = context.hoist(child.codegenNode);
2088 hasHoistedNode = true;
2089 continue;
2090 }
2091 }
2092 else {
2093 // node may contain dynamic children, but its props may be eligible for
2094 // hoisting.
2095 const codegenNode = child.codegenNode;
2096 if (codegenNode.type === 13 /* VNODE_CALL */) {
2097 const flag = getPatchFlag(codegenNode);
2098 if ((!flag ||
2099 flag === 512 /* NEED_PATCH */ ||
2100 flag === 1 /* TEXT */) &&
2101 getGeneratedPropsConstantType(child, context) >=
2102 2 /* CAN_HOIST */) {
2103 const props = getNodeProps(child);
2104 if (props) {
2105 codegenNode.props = context.hoist(props);
2106 }
2107 }
2108 }
2109 }
2110 }
2111 else if (child.type === 12 /* TEXT_CALL */) {
2112 const contentType = getConstantType(child.content, context);
2113 if (contentType > 0) {
2114 if (contentType < 3 /* CAN_STRINGIFY */) {
2115 canStringify = false;
2116 }
2117 if (contentType >= 2 /* CAN_HOIST */) {
2118 child.codegenNode = context.hoist(child.codegenNode);
2119 hasHoistedNode = true;
2120 }
2121 }
2122 }
2123 // walk further
2124 if (child.type === 1 /* ELEMENT */) {
2125 const isComponent = child.tagType === 1 /* COMPONENT */;
2126 if (isComponent) {
2127 context.scopes.vSlot++;
2128 }
2129 walk(child, context);
2130 if (isComponent) {
2131 context.scopes.vSlot--;
2132 }
2133 }
2134 else if (child.type === 11 /* FOR */) {
2135 // Do not hoist v-for single child because it has to be a block
2136 walk(child, context, child.children.length === 1);
2137 }
2138 else if (child.type === 9 /* IF */) {
2139 for (let i = 0; i < child.branches.length; i++) {
2140 // Do not hoist v-if single child because it has to be a block
2141 walk(child.branches[i], context, child.branches[i].children.length === 1);
2142 }
2143 }
2144 }
2145 if (canStringify && hasHoistedNode && context.transformHoist) {
2146 context.transformHoist(children, context, node);
2147 }
2148}
2149function getConstantType(node, context) {
2150 const { constantCache } = context;
2151 switch (node.type) {
2152 case 1 /* ELEMENT */:
2153 if (node.tagType !== 0 /* ELEMENT */) {
2154 return 0 /* NOT_CONSTANT */;
2155 }
2156 const cached = constantCache.get(node);
2157 if (cached !== undefined) {
2158 return cached;
2159 }
2160 const codegenNode = node.codegenNode;
2161 if (codegenNode.type !== 13 /* VNODE_CALL */) {
2162 return 0 /* NOT_CONSTANT */;
2163 }
2164 const flag = getPatchFlag(codegenNode);
2165 if (!flag) {
2166 let returnType = 3 /* CAN_STRINGIFY */;
2167 // Element itself has no patch flag. However we still need to check:
2168 // 1. Even for a node with no patch flag, it is possible for it to contain
2169 // non-hoistable expressions that refers to scope variables, e.g. compiler
2170 // injected keys or cached event handlers. Therefore we need to always
2171 // check the codegenNode's props to be sure.
2172 const generatedPropsType = getGeneratedPropsConstantType(node, context);
2173 if (generatedPropsType === 0 /* NOT_CONSTANT */) {
2174 constantCache.set(node, 0 /* NOT_CONSTANT */);
2175 return 0 /* NOT_CONSTANT */;
2176 }
2177 if (generatedPropsType < returnType) {
2178 returnType = generatedPropsType;
2179 }
2180 // 2. its children.
2181 for (let i = 0; i < node.children.length; i++) {
2182 const childType = getConstantType(node.children[i], context);
2183 if (childType === 0 /* NOT_CONSTANT */) {
2184 constantCache.set(node, 0 /* NOT_CONSTANT */);
2185 return 0 /* NOT_CONSTANT */;
2186 }
2187 if (childType < returnType) {
2188 returnType = childType;
2189 }
2190 }
2191 // 3. if the type is not already CAN_SKIP_PATCH which is the lowest non-0
2192 // type, check if any of the props can cause the type to be lowered
2193 // we can skip can_patch because it's guaranteed by the absence of a
2194 // patchFlag.
2195 if (returnType > 1 /* CAN_SKIP_PATCH */) {
2196 for (let i = 0; i < node.props.length; i++) {
2197 const p = node.props[i];
2198 if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind' && p.exp) {
2199 const expType = getConstantType(p.exp, context);
2200 if (expType === 0 /* NOT_CONSTANT */) {
2201 constantCache.set(node, 0 /* NOT_CONSTANT */);
2202 return 0 /* NOT_CONSTANT */;
2203 }
2204 if (expType < returnType) {
2205 returnType = expType;
2206 }
2207 }
2208 }
2209 }
2210 // only svg/foreignObject could be block here, however if they are
2211 // static then they don't need to be blocks since there will be no
2212 // nested updates.
2213 if (codegenNode.isBlock) {
2214 context.removeHelper(OPEN_BLOCK);
2215 context.removeHelper(CREATE_BLOCK);
2216 codegenNode.isBlock = false;
2217 context.helper(CREATE_VNODE);
2218 }
2219 constantCache.set(node, returnType);
2220 return returnType;
2221 }
2222 else {
2223 constantCache.set(node, 0 /* NOT_CONSTANT */);
2224 return 0 /* NOT_CONSTANT */;
2225 }
2226 case 2 /* TEXT */:
2227 case 3 /* COMMENT */:
2228 return 3 /* CAN_STRINGIFY */;
2229 case 9 /* IF */:
2230 case 11 /* FOR */:
2231 case 10 /* IF_BRANCH */:
2232 return 0 /* NOT_CONSTANT */;
2233 case 5 /* INTERPOLATION */:
2234 case 12 /* TEXT_CALL */:
2235 return getConstantType(node.content, context);
2236 case 4 /* SIMPLE_EXPRESSION */:
2237 return node.constType;
2238 case 8 /* COMPOUND_EXPRESSION */:
2239 let returnType = 3 /* CAN_STRINGIFY */;
2240 for (let i = 0; i < node.children.length; i++) {
2241 const child = node.children[i];
2242 if (isString(child) || isSymbol(child)) {
2243 continue;
2244 }
2245 const childType = getConstantType(child, context);
2246 if (childType === 0 /* NOT_CONSTANT */) {
2247 return 0 /* NOT_CONSTANT */;
2248 }
2249 else if (childType < returnType) {
2250 returnType = childType;
2251 }
2252 }
2253 return returnType;
2254 default:
2255 if ((process.env.NODE_ENV !== 'production')) ;
2256 return 0 /* NOT_CONSTANT */;
2257 }
2258}
2259function getGeneratedPropsConstantType(node, context) {
2260 let returnType = 3 /* CAN_STRINGIFY */;
2261 const props = getNodeProps(node);
2262 if (props && props.type === 15 /* JS_OBJECT_EXPRESSION */) {
2263 const { properties } = props;
2264 for (let i = 0; i < properties.length; i++) {
2265 const { key, value } = properties[i];
2266 const keyType = getConstantType(key, context);
2267 if (keyType === 0 /* NOT_CONSTANT */) {
2268 return keyType;
2269 }
2270 if (keyType < returnType) {
2271 returnType = keyType;
2272 }
2273 if (value.type !== 4 /* SIMPLE_EXPRESSION */) {
2274 return 0 /* NOT_CONSTANT */;
2275 }
2276 const valueType = getConstantType(value, context);
2277 if (valueType === 0 /* NOT_CONSTANT */) {
2278 return valueType;
2279 }
2280 if (valueType < returnType) {
2281 returnType = valueType;
2282 }
2283 }
2284 }
2285 return returnType;
2286}
2287function getNodeProps(node) {
2288 const codegenNode = node.codegenNode;
2289 if (codegenNode.type === 13 /* VNODE_CALL */) {
2290 return codegenNode.props;
2291 }
2292}
2293function getPatchFlag(node) {
2294 const flag = node.patchFlag;
2295 return flag ? parseInt(flag, 10) : undefined;
2296}
2297
2298function createTransformContext(root, { filename = '', prefixIdentifiers = false, hoistStatic = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
2299 const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/);
2300 const context = {
2301 // options
2302 selfName: nameMatch && capitalize(camelize$1(nameMatch[1])),
2303 prefixIdentifiers,
2304 hoistStatic,
2305 cacheHandlers,
2306 nodeTransforms,
2307 directiveTransforms,
2308 transformHoist,
2309 isBuiltInComponent,
2310 isCustomElement,
2311 expressionPlugins,
2312 scopeId,
2313 slotted,
2314 ssr,
2315 ssrCssVars,
2316 bindingMetadata,
2317 inline,
2318 isTS,
2319 onError,
2320 onWarn,
2321 compatConfig,
2322 // state
2323 root,
2324 helpers: new Map(),
2325 components: new Set(),
2326 directives: new Set(),
2327 hoists: [],
2328 imports: [],
2329 constantCache: new Map(),
2330 temps: 0,
2331 cached: 0,
2332 identifiers: Object.create(null),
2333 scopes: {
2334 vFor: 0,
2335 vSlot: 0,
2336 vPre: 0,
2337 vOnce: 0
2338 },
2339 parent: null,
2340 currentNode: root,
2341 childIndex: 0,
2342 // methods
2343 helper(name) {
2344 const count = context.helpers.get(name) || 0;
2345 context.helpers.set(name, count + 1);
2346 return name;
2347 },
2348 removeHelper(name) {
2349 const count = context.helpers.get(name);
2350 if (count) {
2351 const currentCount = count - 1;
2352 if (!currentCount) {
2353 context.helpers.delete(name);
2354 }
2355 else {
2356 context.helpers.set(name, currentCount);
2357 }
2358 }
2359 },
2360 helperString(name) {
2361 return `_${helperNameMap[context.helper(name)]}`;
2362 },
2363 replaceNode(node) {
2364 /* istanbul ignore if */
2365 if ((process.env.NODE_ENV !== 'production')) {
2366 if (!context.currentNode) {
2367 throw new Error(`Node being replaced is already removed.`);
2368 }
2369 if (!context.parent) {
2370 throw new Error(`Cannot replace root node.`);
2371 }
2372 }
2373 context.parent.children[context.childIndex] = context.currentNode = node;
2374 },
2375 removeNode(node) {
2376 if ((process.env.NODE_ENV !== 'production') && !context.parent) {
2377 throw new Error(`Cannot remove root node.`);
2378 }
2379 const list = context.parent.children;
2380 const removalIndex = node
2381 ? list.indexOf(node)
2382 : context.currentNode
2383 ? context.childIndex
2384 : -1;
2385 /* istanbul ignore if */
2386 if ((process.env.NODE_ENV !== 'production') && removalIndex < 0) {
2387 throw new Error(`node being removed is not a child of current parent`);
2388 }
2389 if (!node || node === context.currentNode) {
2390 // current node removed
2391 context.currentNode = null;
2392 context.onNodeRemoved();
2393 }
2394 else {
2395 // sibling node removed
2396 if (context.childIndex > removalIndex) {
2397 context.childIndex--;
2398 context.onNodeRemoved();
2399 }
2400 }
2401 context.parent.children.splice(removalIndex, 1);
2402 },
2403 onNodeRemoved: () => { },
2404 addIdentifiers(exp) {
2405 },
2406 removeIdentifiers(exp) {
2407 },
2408 hoist(exp) {
2409 context.hoists.push(exp);
2410 const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* CAN_HOIST */);
2411 identifier.hoisted = exp;
2412 return identifier;
2413 },
2414 cache(exp, isVNode = false) {
2415 return createCacheExpression(++context.cached, exp, isVNode);
2416 }
2417 };
2418 {
2419 context.filters = new Set();
2420 }
2421 return context;
2422}
2423function transform(root, options) {
2424 const context = createTransformContext(root, options);
2425 traverseNode(root, context);
2426 if (options.hoistStatic) {
2427 hoistStatic(root, context);
2428 }
2429 if (!options.ssr) {
2430 createRootCodegen(root, context);
2431 }
2432 // finalize meta information
2433 root.helpers = [...context.helpers.keys()];
2434 root.components = [...context.components];
2435 root.directives = [...context.directives];
2436 root.imports = context.imports;
2437 root.hoists = context.hoists;
2438 root.temps = context.temps;
2439 root.cached = context.cached;
2440 {
2441 root.filters = [...context.filters];
2442 }
2443}
2444function createRootCodegen(root, context) {
2445 const { helper, removeHelper } = context;
2446 const { children } = root;
2447 if (children.length === 1) {
2448 const child = children[0];
2449 // if the single child is an element, turn it into a block.
2450 if (isSingleElementRoot(root, child) && child.codegenNode) {
2451 // single element root is never hoisted so codegenNode will never be
2452 // SimpleExpressionNode
2453 const codegenNode = child.codegenNode;
2454 if (codegenNode.type === 13 /* VNODE_CALL */) {
2455 if (!codegenNode.isBlock) {
2456 removeHelper(CREATE_VNODE);
2457 codegenNode.isBlock = true;
2458 helper(OPEN_BLOCK);
2459 helper(CREATE_BLOCK);
2460 }
2461 }
2462 root.codegenNode = codegenNode;
2463 }
2464 else {
2465 // - single <slot/>, IfNode, ForNode: already blocks.
2466 // - single text node: always patched.
2467 // root codegen falls through via genNode()
2468 root.codegenNode = child;
2469 }
2470 }
2471 else if (children.length > 1) {
2472 // root has multiple nodes - return a fragment block.
2473 let patchFlag = 64 /* STABLE_FRAGMENT */;
2474 let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
2475 // check if the fragment actually contains a single valid child with
2476 // the rest being comments
2477 if ((process.env.NODE_ENV !== 'production') &&
2478 children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
2479 patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
2480 patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
2481 }
2482 root.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root.children, patchFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${patchFlagText} */` : ``), undefined, undefined, true);
2483 }
2484 else ;
2485}
2486function traverseChildren(parent, context) {
2487 let i = 0;
2488 const nodeRemoved = () => {
2489 i--;
2490 };
2491 for (; i < parent.children.length; i++) {
2492 const child = parent.children[i];
2493 if (isString(child))
2494 continue;
2495 context.parent = parent;
2496 context.childIndex = i;
2497 context.onNodeRemoved = nodeRemoved;
2498 traverseNode(child, context);
2499 }
2500}
2501function traverseNode(node, context) {
2502 context.currentNode = node;
2503 // apply transform plugins
2504 const { nodeTransforms } = context;
2505 const exitFns = [];
2506 for (let i = 0; i < nodeTransforms.length; i++) {
2507 const onExit = nodeTransforms[i](node, context);
2508 if (onExit) {
2509 if (isArray(onExit)) {
2510 exitFns.push(...onExit);
2511 }
2512 else {
2513 exitFns.push(onExit);
2514 }
2515 }
2516 if (!context.currentNode) {
2517 // node was removed
2518 return;
2519 }
2520 else {
2521 // node may have been replaced
2522 node = context.currentNode;
2523 }
2524 }
2525 switch (node.type) {
2526 case 3 /* COMMENT */:
2527 if (!context.ssr) {
2528 // inject import for the Comment symbol, which is needed for creating
2529 // comment nodes with `createVNode`
2530 context.helper(CREATE_COMMENT);
2531 }
2532 break;
2533 case 5 /* INTERPOLATION */:
2534 // no need to traverse, but we need to inject toString helper
2535 if (!context.ssr) {
2536 context.helper(TO_DISPLAY_STRING);
2537 }
2538 break;
2539 // for container types, further traverse downwards
2540 case 9 /* IF */:
2541 for (let i = 0; i < node.branches.length; i++) {
2542 traverseNode(node.branches[i], context);
2543 }
2544 break;
2545 case 10 /* IF_BRANCH */:
2546 case 11 /* FOR */:
2547 case 1 /* ELEMENT */:
2548 case 0 /* ROOT */:
2549 traverseChildren(node, context);
2550 break;
2551 }
2552 // exit transforms
2553 context.currentNode = node;
2554 let i = exitFns.length;
2555 while (i--) {
2556 exitFns[i]();
2557 }
2558}
2559function createStructuralDirectiveTransform(name, fn) {
2560 const matches = isString(name)
2561 ? (n) => n === name
2562 : (n) => name.test(n);
2563 return (node, context) => {
2564 if (node.type === 1 /* ELEMENT */) {
2565 const { props } = node;
2566 // structural directive transforms are not concerned with slots
2567 // as they are handled separately in vSlot.ts
2568 if (node.tagType === 3 /* TEMPLATE */ && props.some(isVSlot)) {
2569 return;
2570 }
2571 const exitFns = [];
2572 for (let i = 0; i < props.length; i++) {
2573 const prop = props[i];
2574 if (prop.type === 7 /* DIRECTIVE */ && matches(prop.name)) {
2575 // structural directives are removed to avoid infinite recursion
2576 // also we remove them *before* applying so that it can further
2577 // traverse itself in case it moves the node around
2578 props.splice(i, 1);
2579 i--;
2580 const onExit = fn(node, prop, context);
2581 if (onExit)
2582 exitFns.push(onExit);
2583 }
2584 }
2585 return exitFns;
2586 }
2587 };
2588}
2589
2590const PURE_ANNOTATION = `/*#__PURE__*/`;
2591function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false, isTS = false }) {
2592 const context = {
2593 mode,
2594 prefixIdentifiers,
2595 sourceMap,
2596 filename,
2597 scopeId,
2598 optimizeImports,
2599 runtimeGlobalName,
2600 runtimeModuleName,
2601 ssr,
2602 isTS,
2603 source: ast.loc.source,
2604 code: ``,
2605 column: 1,
2606 line: 1,
2607 offset: 0,
2608 indentLevel: 0,
2609 pure: false,
2610 map: undefined,
2611 helper(key) {
2612 return `_${helperNameMap[key]}`;
2613 },
2614 push(code, node) {
2615 context.code += code;
2616 },
2617 indent() {
2618 newline(++context.indentLevel);
2619 },
2620 deindent(withoutNewLine = false) {
2621 if (withoutNewLine) {
2622 --context.indentLevel;
2623 }
2624 else {
2625 newline(--context.indentLevel);
2626 }
2627 },
2628 newline() {
2629 newline(context.indentLevel);
2630 }
2631 };
2632 function newline(n) {
2633 context.push('\n' + ` `.repeat(n));
2634 }
2635 return context;
2636}
2637function generate(ast, options = {}) {
2638 const context = createCodegenContext(ast, options);
2639 if (options.onContextCreated)
2640 options.onContextCreated(context);
2641 const { mode, push, prefixIdentifiers, indent, deindent, newline, scopeId, ssr } = context;
2642 const hasHelpers = ast.helpers.length > 0;
2643 const useWithBlock = !prefixIdentifiers && mode !== 'module';
2644 // preambles
2645 // in setup() inline mode, the preamble is generated in a sub context
2646 // and returned separately.
2647 const preambleContext = context;
2648 {
2649 genFunctionPreamble(ast, preambleContext);
2650 }
2651 // enter render function
2652 const functionName = ssr ? `ssrRender` : `render`;
2653 const args = ssr ? ['_ctx', '_push', '_parent', '_attrs'] : ['_ctx', '_cache'];
2654 const signature = args.join(', ');
2655 {
2656 push(`function ${functionName}(${signature}) {`);
2657 }
2658 indent();
2659 if (useWithBlock) {
2660 push(`with (_ctx) {`);
2661 indent();
2662 // function mode const declarations should be inside with block
2663 // also they should be renamed to avoid collision with user properties
2664 if (hasHelpers) {
2665 push(`const { ${ast.helpers
2666 .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
2667 .join(', ')} } = _Vue`);
2668 push(`\n`);
2669 newline();
2670 }
2671 }
2672 // generate asset resolution statements
2673 if (ast.components.length) {
2674 genAssets(ast.components, 'component', context);
2675 if (ast.directives.length || ast.temps > 0) {
2676 newline();
2677 }
2678 }
2679 if (ast.directives.length) {
2680 genAssets(ast.directives, 'directive', context);
2681 if (ast.temps > 0) {
2682 newline();
2683 }
2684 }
2685 if (ast.filters && ast.filters.length) {
2686 newline();
2687 genAssets(ast.filters, 'filter', context);
2688 newline();
2689 }
2690 if (ast.temps > 0) {
2691 push(`let `);
2692 for (let i = 0; i < ast.temps; i++) {
2693 push(`${i > 0 ? `, ` : ``}_temp${i}`);
2694 }
2695 }
2696 if (ast.components.length || ast.directives.length || ast.temps) {
2697 push(`\n`);
2698 newline();
2699 }
2700 // generate the VNode tree expression
2701 if (!ssr) {
2702 push(`return `);
2703 }
2704 if (ast.codegenNode) {
2705 genNode(ast.codegenNode, context);
2706 }
2707 else {
2708 push(`null`);
2709 }
2710 if (useWithBlock) {
2711 deindent();
2712 push(`}`);
2713 }
2714 deindent();
2715 push(`}`);
2716 return {
2717 ast,
2718 code: context.code,
2719 preamble: ``,
2720 // SourceMapGenerator does have toJSON() method but it's not in the types
2721 map: context.map ? context.map.toJSON() : undefined
2722 };
2723}
2724function genFunctionPreamble(ast, context) {
2725 const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
2726 const VueBinding = runtimeGlobalName;
2727 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
2728 // Generate const declaration for helpers
2729 // In prefix mode, we place the const declaration at top so it's done
2730 // only once; But if we not prefixing, we place the declaration inside the
2731 // with block so it doesn't incur the `in` check cost for every helper access.
2732 if (ast.helpers.length > 0) {
2733 {
2734 // "with" mode.
2735 // save Vue in a separate variable to avoid collision
2736 push(`const _Vue = ${VueBinding}\n`);
2737 // in "with" mode, helpers are declared inside the with block to avoid
2738 // has check cost, but hoists are lifted out of the function - we need
2739 // to provide the helper here.
2740 if (ast.hoists.length) {
2741 const staticHelpers = [
2742 CREATE_VNODE,
2743 CREATE_COMMENT,
2744 CREATE_TEXT,
2745 CREATE_STATIC
2746 ]
2747 .filter(helper => ast.helpers.includes(helper))
2748 .map(aliasHelper)
2749 .join(', ');
2750 push(`const { ${staticHelpers} } = _Vue\n`);
2751 }
2752 }
2753 }
2754 genHoists(ast.hoists, context);
2755 newline();
2756 push(`return `);
2757}
2758function genAssets(assets, type, { helper, push, newline, isTS }) {
2759 const resolver = helper(type === 'filter'
2760 ? RESOLVE_FILTER
2761 : type === 'component'
2762 ? RESOLVE_COMPONENT
2763 : RESOLVE_DIRECTIVE);
2764 for (let i = 0; i < assets.length; i++) {
2765 let id = assets[i];
2766 // potential component implicit self-reference inferred from SFC filename
2767 const maybeSelfReference = id.endsWith('__self');
2768 if (maybeSelfReference) {
2769 id = id.slice(0, -6);
2770 }
2771 push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`);
2772 if (i < assets.length - 1) {
2773 newline();
2774 }
2775 }
2776}
2777function genHoists(hoists, context) {
2778 if (!hoists.length) {
2779 return;
2780 }
2781 context.pure = true;
2782 const { push, newline, helper, scopeId, mode } = context;
2783 newline();
2784 hoists.forEach((exp, i) => {
2785 if (exp) {
2786 push(`const _hoisted_${i + 1} = `);
2787 genNode(exp, context);
2788 newline();
2789 }
2790 });
2791 context.pure = false;
2792}
2793function isText$1(n) {
2794 return (isString(n) ||
2795 n.type === 4 /* SIMPLE_EXPRESSION */ ||
2796 n.type === 2 /* TEXT */ ||
2797 n.type === 5 /* INTERPOLATION */ ||
2798 n.type === 8 /* COMPOUND_EXPRESSION */);
2799}
2800function genNodeListAsArray(nodes, context) {
2801 const multilines = nodes.length > 3 ||
2802 (((process.env.NODE_ENV !== 'production')) && nodes.some(n => isArray(n) || !isText$1(n)));
2803 context.push(`[`);
2804 multilines && context.indent();
2805 genNodeList(nodes, context, multilines);
2806 multilines && context.deindent();
2807 context.push(`]`);
2808}
2809function genNodeList(nodes, context, multilines = false, comma = true) {
2810 const { push, newline } = context;
2811 for (let i = 0; i < nodes.length; i++) {
2812 const node = nodes[i];
2813 if (isString(node)) {
2814 push(node);
2815 }
2816 else if (isArray(node)) {
2817 genNodeListAsArray(node, context);
2818 }
2819 else {
2820 genNode(node, context);
2821 }
2822 if (i < nodes.length - 1) {
2823 if (multilines) {
2824 comma && push(',');
2825 newline();
2826 }
2827 else {
2828 comma && push(', ');
2829 }
2830 }
2831 }
2832}
2833function genNode(node, context) {
2834 if (isString(node)) {
2835 context.push(node);
2836 return;
2837 }
2838 if (isSymbol(node)) {
2839 context.push(context.helper(node));
2840 return;
2841 }
2842 switch (node.type) {
2843 case 1 /* ELEMENT */:
2844 case 9 /* IF */:
2845 case 11 /* FOR */:
2846 (process.env.NODE_ENV !== 'production') &&
2847 assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
2848 `Apply appropriate transforms first.`);
2849 genNode(node.codegenNode, context);
2850 break;
2851 case 2 /* TEXT */:
2852 genText(node, context);
2853 break;
2854 case 4 /* SIMPLE_EXPRESSION */:
2855 genExpression(node, context);
2856 break;
2857 case 5 /* INTERPOLATION */:
2858 genInterpolation(node, context);
2859 break;
2860 case 12 /* TEXT_CALL */:
2861 genNode(node.codegenNode, context);
2862 break;
2863 case 8 /* COMPOUND_EXPRESSION */:
2864 genCompoundExpression(node, context);
2865 break;
2866 case 3 /* COMMENT */:
2867 genComment(node, context);
2868 break;
2869 case 13 /* VNODE_CALL */:
2870 genVNodeCall(node, context);
2871 break;
2872 case 14 /* JS_CALL_EXPRESSION */:
2873 genCallExpression(node, context);
2874 break;
2875 case 15 /* JS_OBJECT_EXPRESSION */:
2876 genObjectExpression(node, context);
2877 break;
2878 case 17 /* JS_ARRAY_EXPRESSION */:
2879 genArrayExpression(node, context);
2880 break;
2881 case 18 /* JS_FUNCTION_EXPRESSION */:
2882 genFunctionExpression(node, context);
2883 break;
2884 case 19 /* JS_CONDITIONAL_EXPRESSION */:
2885 genConditionalExpression(node, context);
2886 break;
2887 case 20 /* JS_CACHE_EXPRESSION */:
2888 genCacheExpression(node, context);
2889 break;
2890 // SSR only types
2891 case 21 /* JS_BLOCK_STATEMENT */:
2892 break;
2893 case 22 /* JS_TEMPLATE_LITERAL */:
2894 break;
2895 case 23 /* JS_IF_STATEMENT */:
2896 break;
2897 case 24 /* JS_ASSIGNMENT_EXPRESSION */:
2898 break;
2899 case 25 /* JS_SEQUENCE_EXPRESSION */:
2900 break;
2901 case 26 /* JS_RETURN_STATEMENT */:
2902 break;
2903 /* istanbul ignore next */
2904 case 10 /* IF_BRANCH */:
2905 // noop
2906 break;
2907 default:
2908 if ((process.env.NODE_ENV !== 'production')) {
2909 assert(false, `unhandled codegen node type: ${node.type}`);
2910 // make sure we exhaust all possible types
2911 const exhaustiveCheck = node;
2912 return exhaustiveCheck;
2913 }
2914 }
2915}
2916function genText(node, context) {
2917 context.push(JSON.stringify(node.content), node);
2918}
2919function genExpression(node, context) {
2920 const { content, isStatic } = node;
2921 context.push(isStatic ? JSON.stringify(content) : content, node);
2922}
2923function genInterpolation(node, context) {
2924 const { push, helper, pure } = context;
2925 if (pure)
2926 push(PURE_ANNOTATION);
2927 push(`${helper(TO_DISPLAY_STRING)}(`);
2928 genNode(node.content, context);
2929 push(`)`);
2930}
2931function genCompoundExpression(node, context) {
2932 for (let i = 0; i < node.children.length; i++) {
2933 const child = node.children[i];
2934 if (isString(child)) {
2935 context.push(child);
2936 }
2937 else {
2938 genNode(child, context);
2939 }
2940 }
2941}
2942function genExpressionAsPropertyKey(node, context) {
2943 const { push } = context;
2944 if (node.type === 8 /* COMPOUND_EXPRESSION */) {
2945 push(`[`);
2946 genCompoundExpression(node, context);
2947 push(`]`);
2948 }
2949 else if (node.isStatic) {
2950 // only quote keys if necessary
2951 const text = isSimpleIdentifier(node.content)
2952 ? node.content
2953 : JSON.stringify(node.content);
2954 push(text, node);
2955 }
2956 else {
2957 push(`[${node.content}]`, node);
2958 }
2959}
2960function genComment(node, context) {
2961 const { push, helper, pure } = context;
2962 if (pure) {
2963 push(PURE_ANNOTATION);
2964 }
2965 push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
2966}
2967function genVNodeCall(node, context) {
2968 const { push, helper, pure } = context;
2969 const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking } = node;
2970 if (directives) {
2971 push(helper(WITH_DIRECTIVES) + `(`);
2972 }
2973 if (isBlock) {
2974 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
2975 }
2976 if (pure) {
2977 push(PURE_ANNOTATION);
2978 }
2979 push(helper(isBlock ? CREATE_BLOCK : CREATE_VNODE) + `(`, node);
2980 genNodeList(genNullableArgs([tag, props, children, patchFlag, dynamicProps]), context);
2981 push(`)`);
2982 if (isBlock) {
2983 push(`)`);
2984 }
2985 if (directives) {
2986 push(`, `);
2987 genNode(directives, context);
2988 push(`)`);
2989 }
2990}
2991function genNullableArgs(args) {
2992 let i = args.length;
2993 while (i--) {
2994 if (args[i] != null)
2995 break;
2996 }
2997 return args.slice(0, i + 1).map(arg => arg || `null`);
2998}
2999// JavaScript
3000function genCallExpression(node, context) {
3001 const { push, helper, pure } = context;
3002 const callee = isString(node.callee) ? node.callee : helper(node.callee);
3003 if (pure) {
3004 push(PURE_ANNOTATION);
3005 }
3006 push(callee + `(`, node);
3007 genNodeList(node.arguments, context);
3008 push(`)`);
3009}
3010function genObjectExpression(node, context) {
3011 const { push, indent, deindent, newline } = context;
3012 const { properties } = node;
3013 if (!properties.length) {
3014 push(`{}`, node);
3015 return;
3016 }
3017 const multilines = properties.length > 1 ||
3018 (((process.env.NODE_ENV !== 'production')) &&
3019 properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
3020 push(multilines ? `{` : `{ `);
3021 multilines && indent();
3022 for (let i = 0; i < properties.length; i++) {
3023 const { key, value } = properties[i];
3024 // key
3025 genExpressionAsPropertyKey(key, context);
3026 push(`: `);
3027 // value
3028 genNode(value, context);
3029 if (i < properties.length - 1) {
3030 // will only reach this if it's multilines
3031 push(`,`);
3032 newline();
3033 }
3034 }
3035 multilines && deindent();
3036 push(multilines ? `}` : ` }`);
3037}
3038function genArrayExpression(node, context) {
3039 genNodeListAsArray(node.elements, context);
3040}
3041function genFunctionExpression(node, context) {
3042 const { push, indent, deindent, scopeId, mode } = context;
3043 const { params, returns, body, newline, isSlot } = node;
3044 if (isSlot) {
3045 // wrap slot functions with owner context
3046 push(`_${helperNameMap[WITH_CTX]}(`);
3047 }
3048 push(`(`, node);
3049 if (isArray(params)) {
3050 genNodeList(params, context);
3051 }
3052 else if (params) {
3053 genNode(params, context);
3054 }
3055 push(`) => `);
3056 if (newline || body) {
3057 push(`{`);
3058 indent();
3059 }
3060 if (returns) {
3061 if (newline) {
3062 push(`return `);
3063 }
3064 if (isArray(returns)) {
3065 genNodeListAsArray(returns, context);
3066 }
3067 else {
3068 genNode(returns, context);
3069 }
3070 }
3071 else if (body) {
3072 genNode(body, context);
3073 }
3074 if (newline || body) {
3075 deindent();
3076 push(`}`);
3077 }
3078 if (isSlot) {
3079 if (node.isNonScopedSlot) {
3080 push(`, undefined, true`);
3081 }
3082 push(`)`);
3083 }
3084}
3085function genConditionalExpression(node, context) {
3086 const { test, consequent, alternate, newline: needNewline } = node;
3087 const { push, indent, deindent, newline } = context;
3088 if (test.type === 4 /* SIMPLE_EXPRESSION */) {
3089 const needsParens = !isSimpleIdentifier(test.content);
3090 needsParens && push(`(`);
3091 genExpression(test, context);
3092 needsParens && push(`)`);
3093 }
3094 else {
3095 push(`(`);
3096 genNode(test, context);
3097 push(`)`);
3098 }
3099 needNewline && indent();
3100 context.indentLevel++;
3101 needNewline || push(` `);
3102 push(`? `);
3103 genNode(consequent, context);
3104 context.indentLevel--;
3105 needNewline && newline();
3106 needNewline || push(` `);
3107 push(`: `);
3108 const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
3109 if (!isNested) {
3110 context.indentLevel++;
3111 }
3112 genNode(alternate, context);
3113 if (!isNested) {
3114 context.indentLevel--;
3115 }
3116 needNewline && deindent(true /* without newline */);
3117}
3118function genCacheExpression(node, context) {
3119 const { push, helper, indent, deindent, newline } = context;
3120 push(`_cache[${node.index}] || (`);
3121 if (node.isVNode) {
3122 indent();
3123 push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
3124 newline();
3125 }
3126 push(`_cache[${node.index}] = `);
3127 genNode(node.value, context);
3128 if (node.isVNode) {
3129 push(`,`);
3130 newline();
3131 push(`${helper(SET_BLOCK_TRACKING)}(1),`);
3132 newline();
3133 push(`_cache[${node.index}]`);
3134 deindent();
3135 }
3136 push(`)`);
3137}
3138
3139// these keywords should not appear inside expressions, but operators like
3140// typeof, instanceof and in are allowed
3141const prohibitedKeywordRE = new RegExp('\\b' +
3142 ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
3143 'super,throw,while,yield,delete,export,import,return,switch,default,' +
3144 'extends,finally,continue,debugger,function,arguments,typeof,void')
3145 .split(',')
3146 .join('\\b|\\b') +
3147 '\\b');
3148// strip strings in expressions
3149const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
3150/**
3151 * Validate a non-prefixed expression.
3152 * This is only called when using the in-browser runtime compiler since it
3153 * doesn't prefix expressions.
3154 */
3155function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
3156 const exp = node.content;
3157 // empty expressions are validated per-directive since some directives
3158 // do allow empty expressions.
3159 if (!exp.trim()) {
3160 return;
3161 }
3162 try {
3163 new Function(asRawStatements
3164 ? ` ${exp} `
3165 : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`);
3166 }
3167 catch (e) {
3168 let message = e.message;
3169 const keywordMatch = exp
3170 .replace(stripStringRE, '')
3171 .match(prohibitedKeywordRE);
3172 if (keywordMatch) {
3173 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
3174 }
3175 context.onError(createCompilerError(43 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3176 }
3177}
3178
3179const transformExpression = (node, context) => {
3180 if (node.type === 5 /* INTERPOLATION */) {
3181 node.content = processExpression(node.content, context);
3182 }
3183 else if (node.type === 1 /* ELEMENT */) {
3184 // handle directives on element
3185 for (let i = 0; i < node.props.length; i++) {
3186 const dir = node.props[i];
3187 // do not process for v-on & v-for since they are special handled
3188 if (dir.type === 7 /* DIRECTIVE */ && dir.name !== 'for') {
3189 const exp = dir.exp;
3190 const arg = dir.arg;
3191 // do not process exp if this is v-on:arg - we need special handling
3192 // for wrapping inline statements.
3193 if (exp &&
3194 exp.type === 4 /* SIMPLE_EXPRESSION */ &&
3195 !(dir.name === 'on' && arg)) {
3196 dir.exp = processExpression(exp, context,
3197 // slot args must be processed as function params
3198 dir.name === 'slot');
3199 }
3200 if (arg && arg.type === 4 /* SIMPLE_EXPRESSION */ && !arg.isStatic) {
3201 dir.arg = processExpression(arg, context);
3202 }
3203 }
3204 }
3205 }
3206};
3207// Important: since this function uses Node.js only dependencies, it should
3208// always be used with a leading !true check so that it can be
3209// tree-shaken from the browser build.
3210function processExpression(node, context,
3211// some expressions like v-slot props & v-for aliases should be parsed as
3212// function params
3213asParams = false,
3214// v-on handler values may contain multiple statements
3215asRawStatements = false) {
3216 {
3217 if ((process.env.NODE_ENV !== 'production')) {
3218 // simple in-browser validation (same logic in 2.x)
3219 validateBrowserExpression(node, context, asParams, asRawStatements);
3220 }
3221 return node;
3222 }
3223}
3224
3225const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (node, dir, context) => {
3226 return processIf(node, dir, context, (ifNode, branch, isRoot) => {
3227 // #1587: We need to dynamically increment the key based on the current
3228 // node's sibling nodes, since chained v-if/else branches are
3229 // rendered at the same depth
3230 const siblings = context.parent.children;
3231 let i = siblings.indexOf(ifNode);
3232 let key = 0;
3233 while (i-- >= 0) {
3234 const sibling = siblings[i];
3235 if (sibling && sibling.type === 9 /* IF */) {
3236 key += sibling.branches.length;
3237 }
3238 }
3239 // Exit callback. Complete the codegenNode when all children have been
3240 // transformed.
3241 return () => {
3242 if (isRoot) {
3243 ifNode.codegenNode = createCodegenNodeForBranch(branch, key, context);
3244 }
3245 else {
3246 // attach this branch's codegen node to the v-if root.
3247 const parentCondition = getParentCondition(ifNode.codegenNode);
3248 parentCondition.alternate = createCodegenNodeForBranch(branch, key + ifNode.branches.length - 1, context);
3249 }
3250 };
3251 });
3252});
3253// target-agnostic transform used for both Client and SSR
3254function processIf(node, dir, context, processCodegen) {
3255 if (dir.name !== 'else' &&
3256 (!dir.exp || !dir.exp.content.trim())) {
3257 const loc = dir.exp ? dir.exp.loc : node.loc;
3258 context.onError(createCompilerError(27 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3259 dir.exp = createSimpleExpression(`true`, false, loc);
3260 }
3261 if ((process.env.NODE_ENV !== 'production') && true && dir.exp) {
3262 validateBrowserExpression(dir.exp, context);
3263 }
3264 if (dir.name === 'if') {
3265 const branch = createIfBranch(node, dir);
3266 const ifNode = {
3267 type: 9 /* IF */,
3268 loc: node.loc,
3269 branches: [branch]
3270 };
3271 context.replaceNode(ifNode);
3272 if (processCodegen) {
3273 return processCodegen(ifNode, branch, true);
3274 }
3275 }
3276 else {
3277 // locate the adjacent v-if
3278 const siblings = context.parent.children;
3279 const comments = [];
3280 let i = siblings.indexOf(node);
3281 while (i-- >= -1) {
3282 const sibling = siblings[i];
3283 if ((process.env.NODE_ENV !== 'production') && sibling && sibling.type === 3 /* COMMENT */) {
3284 context.removeNode(sibling);
3285 comments.unshift(sibling);
3286 continue;
3287 }
3288 if (sibling &&
3289 sibling.type === 2 /* TEXT */ &&
3290 !sibling.content.trim().length) {
3291 context.removeNode(sibling);
3292 continue;
3293 }
3294 if (sibling && sibling.type === 9 /* IF */) {
3295 // move the node to the if node's branches
3296 context.removeNode();
3297 const branch = createIfBranch(node, dir);
3298 if ((process.env.NODE_ENV !== 'production') &&
3299 comments.length &&
3300 // #3619 ignore comments if the v-if is direct child of <transition>
3301 !(context.parent &&
3302 context.parent.type === 1 /* ELEMENT */ &&
3303 isBuiltInType(context.parent.tag, 'transition'))) {
3304 branch.children = [...comments, ...branch.children];
3305 }
3306 // check if user is forcing same key on different branches
3307 if ((process.env.NODE_ENV !== 'production') || !true) {
3308 const key = branch.userKey;
3309 if (key) {
3310 sibling.branches.forEach(({ userKey }) => {
3311 if (isSameKey(userKey, key)) {
3312 context.onError(createCompilerError(28 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3313 }
3314 });
3315 }
3316 }
3317 sibling.branches.push(branch);
3318 const onExit = processCodegen && processCodegen(sibling, branch, false);
3319 // since the branch was removed, it will not be traversed.
3320 // make sure to traverse here.
3321 traverseNode(branch, context);
3322 // call on exit
3323 if (onExit)
3324 onExit();
3325 // make sure to reset currentNode after traversal to indicate this
3326 // node has been removed.
3327 context.currentNode = null;
3328 }
3329 else {
3330 context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3331 }
3332 break;
3333 }
3334 }
3335}
3336function createIfBranch(node, dir) {
3337 return {
3338 type: 10 /* IF_BRANCH */,
3339 loc: node.loc,
3340 condition: dir.name === 'else' ? undefined : dir.exp,
3341 children: node.tagType === 3 /* TEMPLATE */ && !findDir(node, 'for')
3342 ? node.children
3343 : [node],
3344 userKey: findProp(node, `key`)
3345 };
3346}
3347function createCodegenNodeForBranch(branch, keyIndex, context) {
3348 if (branch.condition) {
3349 return createConditionalExpression(branch.condition, createChildrenCodegenNode(branch, keyIndex, context),
3350 // make sure to pass in asBlock: true so that the comment node call
3351 // closes the current block.
3352 createCallExpression(context.helper(CREATE_COMMENT), [
3353 (process.env.NODE_ENV !== 'production') ? '"v-if"' : '""',
3354 'true'
3355 ]));
3356 }
3357 else {
3358 return createChildrenCodegenNode(branch, keyIndex, context);
3359 }
3360}
3361function createChildrenCodegenNode(branch, keyIndex, context) {
3362 const { helper, removeHelper } = context;
3363 const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* CAN_HOIST */));
3364 const { children } = branch;
3365 const firstChild = children[0];
3366 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* ELEMENT */;
3367 if (needFragmentWrapper) {
3368 if (children.length === 1 && firstChild.type === 11 /* FOR */) {
3369 // optimize away nested fragments when child is a ForNode
3370 const vnodeCall = firstChild.codegenNode;
3371 injectProp(vnodeCall, keyProperty, context);
3372 return vnodeCall;
3373 }
3374 else {
3375 let patchFlag = 64 /* STABLE_FRAGMENT */;
3376 let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
3377 // check if the fragment actually contains a single valid child with
3378 // the rest being comments
3379 if ((process.env.NODE_ENV !== 'production') &&
3380 children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
3381 patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
3382 patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
3383 }
3384 return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${patchFlagText} */` : ``), undefined, undefined, true, false, branch.loc);
3385 }
3386 }
3387 else {
3388 const vnodeCall = firstChild
3389 .codegenNode;
3390 // Change createVNode to createBlock.
3391 if (vnodeCall.type === 13 /* VNODE_CALL */ && !vnodeCall.isBlock) {
3392 removeHelper(CREATE_VNODE);
3393 vnodeCall.isBlock = true;
3394 helper(OPEN_BLOCK);
3395 helper(CREATE_BLOCK);
3396 }
3397 // inject branch key
3398 injectProp(vnodeCall, keyProperty, context);
3399 return vnodeCall;
3400 }
3401}
3402function isSameKey(a, b) {
3403 if (!a || a.type !== b.type) {
3404 return false;
3405 }
3406 if (a.type === 6 /* ATTRIBUTE */) {
3407 if (a.value.content !== b.value.content) {
3408 return false;
3409 }
3410 }
3411 else {
3412 // directive
3413 const exp = a.exp;
3414 const branchExp = b.exp;
3415 if (exp.type !== branchExp.type) {
3416 return false;
3417 }
3418 if (exp.type !== 4 /* SIMPLE_EXPRESSION */ ||
3419 (exp.isStatic !== branchExp.isStatic ||
3420 exp.content !== branchExp.content)) {
3421 return false;
3422 }
3423 }
3424 return true;
3425}
3426function getParentCondition(node) {
3427 while (true) {
3428 if (node.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3429 if (node.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3430 node = node.alternate;
3431 }
3432 else {
3433 return node;
3434 }
3435 }
3436 else if (node.type === 20 /* JS_CACHE_EXPRESSION */) {
3437 node = node.value;
3438 }
3439 }
3440}
3441
3442const transformFor = createStructuralDirectiveTransform('for', (node, dir, context) => {
3443 const { helper, removeHelper } = context;
3444 return processFor(node, dir, context, forNode => {
3445 // create the loop render function expression now, and add the
3446 // iterator on exit after all children have been traversed
3447 const renderExp = createCallExpression(helper(RENDER_LIST), [
3448 forNode.source
3449 ]);
3450 const keyProp = findProp(node, `key`);
3451 const keyProperty = keyProp
3452 ? createObjectProperty(`key`, keyProp.type === 6 /* ATTRIBUTE */
3453 ? createSimpleExpression(keyProp.value.content, true)
3454 : keyProp.exp)
3455 : null;
3456 const isStableFragment = forNode.source.type === 4 /* SIMPLE_EXPRESSION */ &&
3457 forNode.source.constType > 0 /* NOT_CONSTANT */;
3458 const fragmentFlag = isStableFragment
3459 ? 64 /* STABLE_FRAGMENT */
3460 : keyProp
3461 ? 128 /* KEYED_FRAGMENT */
3462 : 256 /* UNKEYED_FRAGMENT */;
3463 forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, renderExp, fragmentFlag +
3464 ((process.env.NODE_ENV !== 'production') ? ` /* ${PatchFlagNames[fragmentFlag]} */` : ``), undefined, undefined, true /* isBlock */, !isStableFragment /* disableTracking */, node.loc);
3465 return () => {
3466 // finish the codegen now that all children have been traversed
3467 let childBlock;
3468 const isTemplate = isTemplateNode(node);
3469 const { children } = forNode;
3470 // check <template v-for> key placement
3471 if (((process.env.NODE_ENV !== 'production') || !true) && isTemplate) {
3472 node.children.some(c => {
3473 if (c.type === 1 /* ELEMENT */) {
3474 const key = findProp(c, 'key');
3475 if (key) {
3476 context.onError(createCompilerError(32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3477 return true;
3478 }
3479 }
3480 });
3481 }
3482 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* ELEMENT */;
3483 const slotOutlet = isSlotOutlet(node)
3484 ? node
3485 : isTemplate &&
3486 node.children.length === 1 &&
3487 isSlotOutlet(node.children[0])
3488 ? node.children[0] // api-extractor somehow fails to infer this
3489 : null;
3490 if (slotOutlet) {
3491 // <slot v-for="..."> or <template v-for="..."><slot/></template>
3492 childBlock = slotOutlet.codegenNode;
3493 if (isTemplate && keyProperty) {
3494 // <template v-for="..." :key="..."><slot/></template>
3495 // we need to inject the key to the renderSlot() call.
3496 // the props for renderSlot is passed as the 3rd argument.
3497 injectProp(childBlock, keyProperty, context);
3498 }
3499 }
3500 else if (needFragmentWrapper) {
3501 // <template v-for="..."> with text or multi-elements
3502 // should generate a fragment block for each loop
3503 childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* STABLE_FRAGMENT */ +
3504 ((process.env.NODE_ENV !== 'production')
3505 ? ` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
3506 : ``), undefined, undefined, true);
3507 }
3508 else {
3509 // Normal element v-for. Directly use the child's codegenNode
3510 // but mark it as a block.
3511 childBlock = children[0]
3512 .codegenNode;
3513 if (isTemplate && keyProperty) {
3514 injectProp(childBlock, keyProperty, context);
3515 }
3516 if (childBlock.isBlock !== !isStableFragment) {
3517 if (childBlock.isBlock) {
3518 // switch from block to vnode
3519 removeHelper(OPEN_BLOCK);
3520 removeHelper(CREATE_BLOCK);
3521 }
3522 else {
3523 // switch from vnode to block
3524 removeHelper(CREATE_VNODE);
3525 }
3526 }
3527 childBlock.isBlock = !isStableFragment;
3528 if (childBlock.isBlock) {
3529 helper(OPEN_BLOCK);
3530 helper(CREATE_BLOCK);
3531 }
3532 else {
3533 helper(CREATE_VNODE);
3534 }
3535 }
3536 renderExp.arguments.push(createFunctionExpression(createForLoopParams(forNode.parseResult), childBlock, true /* force newline */));
3537 };
3538 });
3539});
3540// target-agnostic transform used for both Client and SSR
3541function processFor(node, dir, context, processCodegen) {
3542 if (!dir.exp) {
3543 context.onError(createCompilerError(30 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3544 return;
3545 }
3546 const parseResult = parseForExpression(
3547 // can only be simple expression because vFor transform is applied
3548 // before expression transform.
3549 dir.exp, context);
3550 if (!parseResult) {
3551 context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3552 return;
3553 }
3554 const { addIdentifiers, removeIdentifiers, scopes } = context;
3555 const { source, value, key, index } = parseResult;
3556 const forNode = {
3557 type: 11 /* FOR */,
3558 loc: dir.loc,
3559 source,
3560 valueAlias: value,
3561 keyAlias: key,
3562 objectIndexAlias: index,
3563 parseResult,
3564 children: isTemplateNode(node) ? node.children : [node]
3565 };
3566 context.replaceNode(forNode);
3567 // bookkeeping
3568 scopes.vFor++;
3569 const onExit = processCodegen && processCodegen(forNode);
3570 return () => {
3571 scopes.vFor--;
3572 if (onExit)
3573 onExit();
3574 };
3575}
3576const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
3577// This regex doesn't cover the case if key or index aliases have destructuring,
3578// but those do not make sense in the first place, so this works in practice.
3579const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
3580const stripParensRE = /^\(|\)$/g;
3581function parseForExpression(input, context) {
3582 const loc = input.loc;
3583 const exp = input.content;
3584 const inMatch = exp.match(forAliasRE);
3585 if (!inMatch)
3586 return;
3587 const [, LHS, RHS] = inMatch;
3588 const result = {
3589 source: createAliasExpression(loc, RHS.trim(), exp.indexOf(RHS, LHS.length)),
3590 value: undefined,
3591 key: undefined,
3592 index: undefined
3593 };
3594 if ((process.env.NODE_ENV !== 'production') && true) {
3595 validateBrowserExpression(result.source, context);
3596 }
3597 let valueContent = LHS.trim()
3598 .replace(stripParensRE, '')
3599 .trim();
3600 const trimmedOffset = LHS.indexOf(valueContent);
3601 const iteratorMatch = valueContent.match(forIteratorRE);
3602 if (iteratorMatch) {
3603 valueContent = valueContent.replace(forIteratorRE, '').trim();
3604 const keyContent = iteratorMatch[1].trim();
3605 let keyOffset;
3606 if (keyContent) {
3607 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
3608 result.key = createAliasExpression(loc, keyContent, keyOffset);
3609 if ((process.env.NODE_ENV !== 'production') && true) {
3610 validateBrowserExpression(result.key, context, true);
3611 }
3612 }
3613 if (iteratorMatch[2]) {
3614 const indexContent = iteratorMatch[2].trim();
3615 if (indexContent) {
3616 result.index = createAliasExpression(loc, indexContent, exp.indexOf(indexContent, result.key
3617 ? keyOffset + keyContent.length
3618 : trimmedOffset + valueContent.length));
3619 if ((process.env.NODE_ENV !== 'production') && true) {
3620 validateBrowserExpression(result.index, context, true);
3621 }
3622 }
3623 }
3624 }
3625 if (valueContent) {
3626 result.value = createAliasExpression(loc, valueContent, trimmedOffset);
3627 if ((process.env.NODE_ENV !== 'production') && true) {
3628 validateBrowserExpression(result.value, context, true);
3629 }
3630 }
3631 return result;
3632}
3633function createAliasExpression(range, content, offset) {
3634 return createSimpleExpression(content, false, getInnerRange(range, offset, content.length));
3635}
3636function createForLoopParams({ value, key, index }) {
3637 const params = [];
3638 if (value) {
3639 params.push(value);
3640 }
3641 if (key) {
3642 if (!value) {
3643 params.push(createSimpleExpression(`_`, false));
3644 }
3645 params.push(key);
3646 }
3647 if (index) {
3648 if (!key) {
3649 if (!value) {
3650 params.push(createSimpleExpression(`_`, false));
3651 }
3652 params.push(createSimpleExpression(`__`, false));
3653 }
3654 params.push(index);
3655 }
3656 return params;
3657}
3658
3659const defaultFallback = createSimpleExpression(`undefined`, false);
3660// A NodeTransform that:
3661// 1. Tracks scope identifiers for scoped slots so that they don't get prefixed
3662// by transformExpression. This is only applied in non-browser builds with
3663// { prefixIdentifiers: true }.
3664// 2. Track v-slot depths so that we know a slot is inside another slot.
3665// Note the exit callback is executed before buildSlots() on the same node,
3666// so only nested slots see positive numbers.
3667const trackSlotScopes = (node, context) => {
3668 if (node.type === 1 /* ELEMENT */ &&
3669 (node.tagType === 1 /* COMPONENT */ ||
3670 node.tagType === 3 /* TEMPLATE */)) {
3671 // We are only checking non-empty v-slot here
3672 // since we only care about slots that introduce scope variables.
3673 const vSlot = findDir(node, 'slot');
3674 if (vSlot) {
3675 context.scopes.vSlot++;
3676 return () => {
3677 context.scopes.vSlot--;
3678 };
3679 }
3680 }
3681};
3682// A NodeTransform that tracks scope identifiers for scoped slots with v-for.
3683// This transform is only applied in non-browser builds with { prefixIdentifiers: true }
3684const trackVForSlotScopes = (node, context) => {
3685 let vFor;
3686 if (isTemplateNode(node) &&
3687 node.props.some(isVSlot) &&
3688 (vFor = findDir(node, 'for'))) {
3689 const result = (vFor.parseResult = parseForExpression(vFor.exp, context));
3690 if (result) {
3691 const { value, key, index } = result;
3692 const { addIdentifiers, removeIdentifiers } = context;
3693 value && addIdentifiers(value);
3694 key && addIdentifiers(key);
3695 index && addIdentifiers(index);
3696 return () => {
3697 value && removeIdentifiers(value);
3698 key && removeIdentifiers(key);
3699 index && removeIdentifiers(index);
3700 };
3701 }
3702 }
3703};
3704const buildClientSlotFn = (props, children, loc) => createFunctionExpression(props, children, false /* newline */, true /* isSlot */, children.length ? children[0].loc : loc);
3705// Instead of being a DirectiveTransform, v-slot processing is called during
3706// transformElement to build the slots object for a component.
3707function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3708 context.helper(WITH_CTX);
3709 const { children, loc } = node;
3710 const slotsProperties = [];
3711 const dynamicSlots = [];
3712 // If the slot is inside a v-for or another v-slot, force it to be dynamic
3713 // since it likely uses a scope variable.
3714 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
3715 // 1. Check for slot with slotProps on component itself.
3716 // <Comp v-slot="{ prop }"/>
3717 const onComponentSlot = findDir(node, 'slot', true);
3718 if (onComponentSlot) {
3719 const { arg, exp } = onComponentSlot;
3720 if (arg && !isStaticExp(arg)) {
3721 hasDynamicSlots = true;
3722 }
3723 slotsProperties.push(createObjectProperty(arg || createSimpleExpression('default', true), buildSlotFn(exp, children, loc)));
3724 }
3725 // 2. Iterate through children and check for template slots
3726 // <template v-slot:foo="{ prop }">
3727 let hasTemplateSlots = false;
3728 let hasNamedDefaultSlot = false;
3729 const implicitDefaultChildren = [];
3730 const seenSlotNames = new Set();
3731 for (let i = 0; i < children.length; i++) {
3732 const slotElement = children[i];
3733 let slotDir;
3734 if (!isTemplateNode(slotElement) ||
3735 !(slotDir = findDir(slotElement, 'slot', true))) {
3736 // not a <template v-slot>, skip.
3737 if (slotElement.type !== 3 /* COMMENT */) {
3738 implicitDefaultChildren.push(slotElement);
3739 }
3740 continue;
3741 }
3742 if (onComponentSlot) {
3743 // already has on-component slot - this is incorrect usage.
3744 context.onError(createCompilerError(36 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3745 break;
3746 }
3747 hasTemplateSlots = true;
3748 const { children: slotChildren, loc: slotLoc } = slotElement;
3749 const { arg: slotName = createSimpleExpression(`default`, true), exp: slotProps, loc: dirLoc } = slotDir;
3750 // check if name is dynamic.
3751 let staticSlotName;
3752 if (isStaticExp(slotName)) {
3753 staticSlotName = slotName ? slotName.content : `default`;
3754 }
3755 else {
3756 hasDynamicSlots = true;
3757 }
3758 const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
3759 // check if this slot is conditional (v-if/v-for)
3760 let vIf;
3761 let vElse;
3762 let vFor;
3763 if ((vIf = findDir(slotElement, 'if'))) {
3764 hasDynamicSlots = true;
3765 dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback));
3766 }
3767 else if ((vElse = findDir(slotElement, /^else(-if)?$/, true /* allowEmpty */))) {
3768 // find adjacent v-if
3769 let j = i;
3770 let prev;
3771 while (j--) {
3772 prev = children[j];
3773 if (prev.type !== 3 /* COMMENT */) {
3774 break;
3775 }
3776 }
3777 if (prev && isTemplateNode(prev) && findDir(prev, 'if')) {
3778 // remove node
3779 children.splice(i, 1);
3780 i--;
3781 // attach this slot to previous conditional
3782 let conditional = dynamicSlots[dynamicSlots.length - 1];
3783 while (conditional.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3784 conditional = conditional.alternate;
3785 }
3786 conditional.alternate = vElse.exp
3787 ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback)
3788 : buildDynamicSlot(slotName, slotFunction);
3789 }
3790 else {
3791 context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3792 }
3793 }
3794 else if ((vFor = findDir(slotElement, 'for'))) {
3795 hasDynamicSlots = true;
3796 const parseResult = vFor.parseResult ||
3797 parseForExpression(vFor.exp, context);
3798 if (parseResult) {
3799 // Render the dynamic slots as an array and add it to the createSlot()
3800 // args. The runtime knows how to handle it appropriately.
3801 dynamicSlots.push(createCallExpression(context.helper(RENDER_LIST), [
3802 parseResult.source,
3803 createFunctionExpression(createForLoopParams(parseResult), buildDynamicSlot(slotName, slotFunction), true /* force newline */)
3804 ]));
3805 }
3806 else {
3807 context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3808 }
3809 }
3810 else {
3811 // check duplicate static names
3812 if (staticSlotName) {
3813 if (seenSlotNames.has(staticSlotName)) {
3814 context.onError(createCompilerError(37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3815 continue;
3816 }
3817 seenSlotNames.add(staticSlotName);
3818 if (staticSlotName === 'default') {
3819 hasNamedDefaultSlot = true;
3820 }
3821 }
3822 slotsProperties.push(createObjectProperty(slotName, slotFunction));
3823 }
3824 }
3825 if (!onComponentSlot) {
3826 const buildDefaultSlotProperty = (props, children) => {
3827 const fn = buildSlotFn(props, children, loc);
3828 if (context.compatConfig) {
3829 fn.isNonScopedSlot = true;
3830 }
3831 return createObjectProperty(`default`, fn);
3832 };
3833 if (!hasTemplateSlots) {
3834 // implicit default slot (on component)
3835 slotsProperties.push(buildDefaultSlotProperty(undefined, children));
3836 }
3837 else if (implicitDefaultChildren.length &&
3838 // #3766
3839 // with whitespace: 'preserve', whitespaces between slots will end up in
3840 // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
3841 implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
3842 // implicit default slot (mixed with named slots)
3843 if (hasNamedDefaultSlot) {
3844 context.onError(createCompilerError(38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3845 }
3846 else {
3847 slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
3848 }
3849 }
3850 }
3851 const slotFlag = hasDynamicSlots
3852 ? 2 /* DYNAMIC */
3853 : hasForwardedSlots(node.children)
3854 ? 3 /* FORWARDED */
3855 : 1 /* STABLE */;
3856 let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`,
3857 // 2 = compiled but dynamic = can skip normalization, but must run diff
3858 // 1 = compiled and static = can skip normalization AND diff as optimized
3859 createSimpleExpression(slotFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${slotFlagsText[slotFlag]} */` : ``), false))), loc);
3860 if (dynamicSlots.length) {
3861 slots = createCallExpression(context.helper(CREATE_SLOTS), [
3862 slots,
3863 createArrayExpression(dynamicSlots)
3864 ]);
3865 }
3866 return {
3867 slots,
3868 hasDynamicSlots
3869 };
3870}
3871function buildDynamicSlot(name, fn) {
3872 return createObjectExpression([
3873 createObjectProperty(`name`, name),
3874 createObjectProperty(`fn`, fn)
3875 ]);
3876}
3877function hasForwardedSlots(children) {
3878 for (let i = 0; i < children.length; i++) {
3879 const child = children[i];
3880 switch (child.type) {
3881 case 1 /* ELEMENT */:
3882 if (child.tagType === 2 /* SLOT */ ||
3883 (child.tagType === 0 /* ELEMENT */ &&
3884 hasForwardedSlots(child.children))) {
3885 return true;
3886 }
3887 break;
3888 case 9 /* IF */:
3889 if (hasForwardedSlots(child.branches))
3890 return true;
3891 break;
3892 case 10 /* IF_BRANCH */:
3893 case 11 /* FOR */:
3894 if (hasForwardedSlots(child.children))
3895 return true;
3896 break;
3897 }
3898 }
3899 return false;
3900}
3901function isNonWhitespaceContent(node) {
3902 if (node.type !== 2 /* TEXT */ && node.type !== 12 /* TEXT_CALL */)
3903 return true;
3904 return node.type === 2 /* TEXT */
3905 ? !!node.content.trim()
3906 : isNonWhitespaceContent(node.content);
3907}
3908
3909// some directive transforms (e.g. v-model) may return a symbol for runtime
3910// import, which should be used instead of a resolveDirective call.
3911const directiveImportMap = new WeakMap();
3912// generate a JavaScript AST for this element's codegen
3913const transformElement = (node, context) => {
3914 // perform the work on exit, after all child expressions have been
3915 // processed and merged.
3916 return function postTransformElement() {
3917 node = context.currentNode;
3918 if (!(node.type === 1 /* ELEMENT */ &&
3919 (node.tagType === 0 /* ELEMENT */ ||
3920 node.tagType === 1 /* COMPONENT */))) {
3921 return;
3922 }
3923 const { tag, props } = node;
3924 const isComponent = node.tagType === 1 /* COMPONENT */;
3925 // The goal of the transform is to create a codegenNode implementing the
3926 // VNodeCall interface.
3927 let vnodeTag = isComponent
3928 ? resolveComponentType(node, context)
3929 : `"${tag}"`;
3930 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
3931 let vnodeProps;
3932 let vnodeChildren;
3933 let vnodePatchFlag;
3934 let patchFlag = 0;
3935 let vnodeDynamicProps;
3936 let dynamicPropNames;
3937 let vnodeDirectives;
3938 let shouldUseBlock =
3939 // dynamic component may resolve to plain elements
3940 isDynamicComponent ||
3941 vnodeTag === TELEPORT ||
3942 vnodeTag === SUSPENSE ||
3943 (!isComponent &&
3944 // <svg> and <foreignObject> must be forced into blocks so that block
3945 // updates inside get proper isSVG flag at runtime. (#639, #643)
3946 // This is technically web-specific, but splitting the logic out of core
3947 // leads to too much unnecessary complexity.
3948 (tag === 'svg' ||
3949 tag === 'foreignObject' ||
3950 // #938: elements with dynamic keys should be forced into blocks
3951 findProp(node, 'key', true)));
3952 // props
3953 if (props.length > 0) {
3954 const propsBuildResult = buildProps(node, context);
3955 vnodeProps = propsBuildResult.props;
3956 patchFlag = propsBuildResult.patchFlag;
3957 dynamicPropNames = propsBuildResult.dynamicPropNames;
3958 const directives = propsBuildResult.directives;
3959 vnodeDirectives =
3960 directives && directives.length
3961 ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
3962 : undefined;
3963 }
3964 // children
3965 if (node.children.length > 0) {
3966 if (vnodeTag === KEEP_ALIVE) {
3967 // Although a built-in component, we compile KeepAlive with raw children
3968 // instead of slot functions so that it can be used inside Transition
3969 // or other Transition-wrapping HOCs.
3970 // To ensure correct updates with block optimizations, we need to:
3971 // 1. Force keep-alive into a block. This avoids its children being
3972 // collected by a parent block.
3973 shouldUseBlock = true;
3974 // 2. Force keep-alive to always be updated, since it uses raw children.
3975 patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3976 if ((process.env.NODE_ENV !== 'production') && node.children.length > 1) {
3977 context.onError(createCompilerError(44 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3978 start: node.children[0].loc.start,
3979 end: node.children[node.children.length - 1].loc.end,
3980 source: ''
3981 }));
3982 }
3983 }
3984 const shouldBuildAsSlots = isComponent &&
3985 // Teleport is not a real component and has dedicated runtime handling
3986 vnodeTag !== TELEPORT &&
3987 // explained above.
3988 vnodeTag !== KEEP_ALIVE;
3989 if (shouldBuildAsSlots) {
3990 const { slots, hasDynamicSlots } = buildSlots(node, context);
3991 vnodeChildren = slots;
3992 if (hasDynamicSlots) {
3993 patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3994 }
3995 }
3996 else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
3997 const child = node.children[0];
3998 const type = child.type;
3999 // check for dynamic text children
4000 const hasDynamicTextChild = type === 5 /* INTERPOLATION */ ||
4001 type === 8 /* COMPOUND_EXPRESSION */;
4002 if (hasDynamicTextChild &&
4003 getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
4004 patchFlag |= 1 /* TEXT */;
4005 }
4006 // pass directly if the only child is a text node
4007 // (plain / interpolation / expression)
4008 if (hasDynamicTextChild || type === 2 /* TEXT */) {
4009 vnodeChildren = child;
4010 }
4011 else {
4012 vnodeChildren = node.children;
4013 }
4014 }
4015 else {
4016 vnodeChildren = node.children;
4017 }
4018 }
4019 // patchFlag & dynamicPropNames
4020 if (patchFlag !== 0) {
4021 if ((process.env.NODE_ENV !== 'production')) {
4022 if (patchFlag < 0) {
4023 // special flags (negative and mutually exclusive)
4024 vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
4025 }
4026 else {
4027 // bitwise flags
4028 const flagNames = Object.keys(PatchFlagNames)
4029 .map(Number)
4030 .filter(n => n > 0 && patchFlag & n)
4031 .map(n => PatchFlagNames[n])
4032 .join(`, `);
4033 vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
4034 }
4035 }
4036 else {
4037 vnodePatchFlag = String(patchFlag);
4038 }
4039 if (dynamicPropNames && dynamicPropNames.length) {
4040 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4041 }
4042 }
4043 node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, vnodePatchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false /* disableTracking */, node.loc);
4044 };
4045};
4046function resolveComponentType(node, context, ssr = false) {
4047 let { tag } = node;
4048 // 1. dynamic component
4049 const isExplicitDynamic = isComponentTag(tag);
4050 const isProp = findProp(node, 'is');
4051 if (isProp) {
4052 if (isExplicitDynamic ||
4053 (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))) {
4054 const exp = isProp.type === 6 /* ATTRIBUTE */
4055 ? isProp.value && createSimpleExpression(isProp.value.content, true)
4056 : isProp.exp;
4057 if (exp) {
4058 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
4059 exp
4060 ]);
4061 }
4062 }
4063 else if (isProp.type === 6 /* ATTRIBUTE */ &&
4064 isProp.value.content.startsWith('vue:')) {
4065 // <button is="vue:xxx">
4066 // if not <component>, only is value that starts with "vue:" will be
4067 // treated as component by the parse phase and reach here, unless it's
4068 // compat mode where all is values are considered components
4069 tag = isProp.value.content.slice(4);
4070 }
4071 }
4072 // 1.5 v-is (TODO: Deprecate)
4073 const isDir = !isExplicitDynamic && findDir(node, 'is');
4074 if (isDir && isDir.exp) {
4075 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
4076 isDir.exp
4077 ]);
4078 }
4079 // 2. built-in components (Teleport, Transition, KeepAlive, Suspense...)
4080 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
4081 if (builtIn) {
4082 // built-ins are simply fallthroughs / have special handling during ssr
4083 // so we don't need to import their runtime equivalents
4084 if (!ssr)
4085 context.helper(builtIn);
4086 return builtIn;
4087 }
4088 // 5. user component (resolve)
4089 context.helper(RESOLVE_COMPONENT);
4090 context.components.add(tag);
4091 return toValidAssetId(tag, `component`);
4092}
4093function buildProps(node, context, props = node.props, ssr = false) {
4094 const { tag, loc: elementLoc } = node;
4095 const isComponent = node.tagType === 1 /* COMPONENT */;
4096 let properties = [];
4097 const mergeArgs = [];
4098 const runtimeDirectives = [];
4099 // patchFlag analysis
4100 let patchFlag = 0;
4101 let hasRef = false;
4102 let hasClassBinding = false;
4103 let hasStyleBinding = false;
4104 let hasHydrationEventBinding = false;
4105 let hasDynamicKeys = false;
4106 let hasVnodeHook = false;
4107 const dynamicPropNames = [];
4108 const analyzePatchFlag = ({ key, value }) => {
4109 if (isStaticExp(key)) {
4110 const name = key.content;
4111 const isEventHandler = isOn(name);
4112 if (!isComponent &&
4113 isEventHandler &&
4114 // omit the flag for click handlers because hydration gives click
4115 // dedicated fast path.
4116 name.toLowerCase() !== 'onclick' &&
4117 // omit v-model handlers
4118 name !== 'onUpdate:modelValue' &&
4119 // omit onVnodeXXX hooks
4120 !isReservedProp(name)) {
4121 hasHydrationEventBinding = true;
4122 }
4123 if (isEventHandler && isReservedProp(name)) {
4124 hasVnodeHook = true;
4125 }
4126 if (value.type === 20 /* JS_CACHE_EXPRESSION */ ||
4127 ((value.type === 4 /* SIMPLE_EXPRESSION */ ||
4128 value.type === 8 /* COMPOUND_EXPRESSION */) &&
4129 getConstantType(value, context) > 0)) {
4130 // skip if the prop is a cached handler or has constant value
4131 return;
4132 }
4133 if (name === 'ref') {
4134 hasRef = true;
4135 }
4136 else if (name === 'class' && !isComponent) {
4137 hasClassBinding = true;
4138 }
4139 else if (name === 'style' && !isComponent) {
4140 hasStyleBinding = true;
4141 }
4142 else if (name !== 'key' && !dynamicPropNames.includes(name)) {
4143 dynamicPropNames.push(name);
4144 }
4145 }
4146 else {
4147 hasDynamicKeys = true;
4148 }
4149 };
4150 for (let i = 0; i < props.length; i++) {
4151 // static attribute
4152 const prop = props[i];
4153 if (prop.type === 6 /* ATTRIBUTE */) {
4154 const { loc, name, value } = prop;
4155 let isStatic = true;
4156 if (name === 'ref') {
4157 hasRef = true;
4158 }
4159 // skip is on <component>, or is="vue:xxx"
4160 if (name === 'is' &&
4161 (isComponentTag(tag) ||
4162 (value && value.content.startsWith('vue:')) ||
4163 (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
4164 continue;
4165 }
4166 properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
4167 }
4168 else {
4169 // directives
4170 const { name, arg, exp, loc } = prop;
4171 const isVBind = name === 'bind';
4172 const isVOn = name === 'on';
4173 // skip v-slot - it is handled by its dedicated transform.
4174 if (name === 'slot') {
4175 if (!isComponent) {
4176 context.onError(createCompilerError(39 /* X_V_SLOT_MISPLACED */, loc));
4177 }
4178 continue;
4179 }
4180 // skip v-once - it is handled by its dedicated transform.
4181 if (name === 'once') {
4182 continue;
4183 }
4184 // skip v-is and :is on <component>
4185 if (name === 'is' ||
4186 (isVBind &&
4187 isBindKey(arg, 'is') &&
4188 (isComponentTag(tag) ||
4189 (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
4190 continue;
4191 }
4192 // skip v-on in SSR compilation
4193 if (isVOn && ssr) {
4194 continue;
4195 }
4196 // special case for v-bind and v-on with no argument
4197 if (!arg && (isVBind || isVOn)) {
4198 hasDynamicKeys = true;
4199 if (exp) {
4200 if (properties.length) {
4201 mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
4202 properties = [];
4203 }
4204 if (isVBind) {
4205 {
4206 // 2.x v-bind object order compat
4207 if ((process.env.NODE_ENV !== 'production')) {
4208 const hasOverridableKeys = mergeArgs.some(arg => {
4209 if (arg.type === 15 /* JS_OBJECT_EXPRESSION */) {
4210 return arg.properties.some(({ key }) => {
4211 if (key.type !== 4 /* SIMPLE_EXPRESSION */ ||
4212 !key.isStatic) {
4213 return true;
4214 }
4215 return (key.content !== 'class' &&
4216 key.content !== 'style' &&
4217 !isOn(key.content));
4218 });
4219 }
4220 else {
4221 // dynamic expression
4222 return true;
4223 }
4224 });
4225 if (hasOverridableKeys) {
4226 checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context, loc);
4227 }
4228 }
4229 if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context)) {
4230 mergeArgs.unshift(exp);
4231 continue;
4232 }
4233 }
4234 mergeArgs.push(exp);
4235 }
4236 else {
4237 // v-on="obj" -> toHandlers(obj)
4238 mergeArgs.push({
4239 type: 14 /* JS_CALL_EXPRESSION */,
4240 loc,
4241 callee: context.helper(TO_HANDLERS),
4242 arguments: [exp]
4243 });
4244 }
4245 }
4246 else {
4247 context.onError(createCompilerError(isVBind
4248 ? 33 /* X_V_BIND_NO_EXPRESSION */
4249 : 34 /* X_V_ON_NO_EXPRESSION */, loc));
4250 }
4251 continue;
4252 }
4253 const directiveTransform = context.directiveTransforms[name];
4254 if (directiveTransform) {
4255 // has built-in directive transform.
4256 const { props, needRuntime } = directiveTransform(prop, node, context);
4257 !ssr && props.forEach(analyzePatchFlag);
4258 properties.push(...props);
4259 if (needRuntime) {
4260 runtimeDirectives.push(prop);
4261 if (isSymbol(needRuntime)) {
4262 directiveImportMap.set(prop, needRuntime);
4263 }
4264 }
4265 }
4266 else {
4267 // no built-in transform, this is a user custom directive.
4268 runtimeDirectives.push(prop);
4269 }
4270 }
4271 if (prop.type === 6 /* ATTRIBUTE */ &&
4272 prop.name === 'ref' &&
4273 context.scopes.vFor > 0 &&
4274 checkCompatEnabled("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
4275 properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
4276 }
4277 }
4278 let propsExpression = undefined;
4279 // has v-bind="object" or v-on="object", wrap with mergeProps
4280 if (mergeArgs.length) {
4281 if (properties.length) {
4282 mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
4283 }
4284 if (mergeArgs.length > 1) {
4285 propsExpression = createCallExpression(context.helper(MERGE_PROPS), mergeArgs, elementLoc);
4286 }
4287 else {
4288 // single v-bind with nothing else - no need for a mergeProps call
4289 propsExpression = mergeArgs[0];
4290 }
4291 }
4292 else if (properties.length) {
4293 propsExpression = createObjectExpression(dedupeProperties(properties), elementLoc);
4294 }
4295 // patchFlag analysis
4296 if (hasDynamicKeys) {
4297 patchFlag |= 16 /* FULL_PROPS */;
4298 }
4299 else {
4300 if (hasClassBinding) {
4301 patchFlag |= 2 /* CLASS */;
4302 }
4303 if (hasStyleBinding) {
4304 patchFlag |= 4 /* STYLE */;
4305 }
4306 if (dynamicPropNames.length) {
4307 patchFlag |= 8 /* PROPS */;
4308 }
4309 if (hasHydrationEventBinding) {
4310 patchFlag |= 32 /* HYDRATE_EVENTS */;
4311 }
4312 }
4313 if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
4314 (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
4315 patchFlag |= 512 /* NEED_PATCH */;
4316 }
4317 return {
4318 props: propsExpression,
4319 directives: runtimeDirectives,
4320 patchFlag,
4321 dynamicPropNames
4322 };
4323}
4324// Dedupe props in an object literal.
4325// Literal duplicated attributes would have been warned during the parse phase,
4326// however, it's possible to encounter duplicated `onXXX` handlers with different
4327// modifiers. We also need to merge static and dynamic class / style attributes.
4328// - onXXX handlers / style: merge into array
4329// - class: merge into single expression with concatenation
4330function dedupeProperties(properties) {
4331 const knownProps = new Map();
4332 const deduped = [];
4333 for (let i = 0; i < properties.length; i++) {
4334 const prop = properties[i];
4335 // dynamic keys are always allowed
4336 if (prop.key.type === 8 /* COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
4337 deduped.push(prop);
4338 continue;
4339 }
4340 const name = prop.key.content;
4341 const existing = knownProps.get(name);
4342 if (existing) {
4343 if (name === 'style' || name === 'class' || name.startsWith('on')) {
4344 mergeAsArray(existing, prop);
4345 }
4346 // unexpected duplicate, should have emitted error during parse
4347 }
4348 else {
4349 knownProps.set(name, prop);
4350 deduped.push(prop);
4351 }
4352 }
4353 return deduped;
4354}
4355function mergeAsArray(existing, incoming) {
4356 if (existing.value.type === 17 /* JS_ARRAY_EXPRESSION */) {
4357 existing.value.elements.push(incoming.value);
4358 }
4359 else {
4360 existing.value = createArrayExpression([existing.value, incoming.value], existing.loc);
4361 }
4362}
4363function buildDirectiveArgs(dir, context) {
4364 const dirArgs = [];
4365 const runtime = directiveImportMap.get(dir);
4366 if (runtime) {
4367 // built-in directive with runtime
4368 dirArgs.push(context.helperString(runtime));
4369 }
4370 else {
4371 {
4372 // inject statement for resolving directive
4373 context.helper(RESOLVE_DIRECTIVE);
4374 context.directives.add(dir.name);
4375 dirArgs.push(toValidAssetId(dir.name, `directive`));
4376 }
4377 }
4378 const { loc } = dir;
4379 if (dir.exp)
4380 dirArgs.push(dir.exp);
4381 if (dir.arg) {
4382 if (!dir.exp) {
4383 dirArgs.push(`void 0`);
4384 }
4385 dirArgs.push(dir.arg);
4386 }
4387 if (Object.keys(dir.modifiers).length) {
4388 if (!dir.arg) {
4389 if (!dir.exp) {
4390 dirArgs.push(`void 0`);
4391 }
4392 dirArgs.push(`void 0`);
4393 }
4394 const trueExpression = createSimpleExpression(`true`, false, loc);
4395 dirArgs.push(createObjectExpression(dir.modifiers.map(modifier => createObjectProperty(modifier, trueExpression)), loc));
4396 }
4397 return createArrayExpression(dirArgs, dir.loc);
4398}
4399function stringifyDynamicPropNames(props) {
4400 let propsNamesString = `[`;
4401 for (let i = 0, l = props.length; i < l; i++) {
4402 propsNamesString += JSON.stringify(props[i]);
4403 if (i < l - 1)
4404 propsNamesString += ', ';
4405 }
4406 return propsNamesString + `]`;
4407}
4408function isComponentTag(tag) {
4409 return tag[0].toLowerCase() + tag.slice(1) === 'component';
4410}
4411
4412(process.env.NODE_ENV !== 'production')
4413 ? Object.freeze({})
4414 : {};
4415(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
4416const cacheStringFunction = (fn) => {
4417 const cache = Object.create(null);
4418 return ((str) => {
4419 const hit = cache[str];
4420 return hit || (cache[str] = fn(str));
4421 });
4422};
4423const camelizeRE = /-(\w)/g;
4424/**
4425 * @private
4426 */
4427const camelize = cacheStringFunction((str) => {
4428 return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
4429});
4430
4431const transformSlotOutlet = (node, context) => {
4432 if (isSlotOutlet(node)) {
4433 const { children, loc } = node;
4434 const { slotName, slotProps } = processSlotOutlet(node, context);
4435 const slotArgs = [
4436 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
4437 slotName
4438 ];
4439 if (slotProps) {
4440 slotArgs.push(slotProps);
4441 }
4442 if (children.length) {
4443 if (!slotProps) {
4444 slotArgs.push(`{}`);
4445 }
4446 slotArgs.push(createFunctionExpression([], children, false, false, loc));
4447 }
4448 if (context.scopeId && !context.slotted) {
4449 if (!slotProps) {
4450 slotArgs.push(`{}`);
4451 }
4452 if (!children.length) {
4453 slotArgs.push(`undefined`);
4454 }
4455 slotArgs.push(`true`);
4456 }
4457 node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
4458 }
4459};
4460function processSlotOutlet(node, context) {
4461 let slotName = `"default"`;
4462 let slotProps = undefined;
4463 const nonNameProps = [];
4464 for (let i = 0; i < node.props.length; i++) {
4465 const p = node.props[i];
4466 if (p.type === 6 /* ATTRIBUTE */) {
4467 if (p.value) {
4468 if (p.name === 'name') {
4469 slotName = JSON.stringify(p.value.content);
4470 }
4471 else {
4472 p.name = camelize(p.name);
4473 nonNameProps.push(p);
4474 }
4475 }
4476 }
4477 else {
4478 if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
4479 if (p.exp)
4480 slotName = p.exp;
4481 }
4482 else {
4483 if (p.name === 'bind' && p.arg && isStaticExp(p.arg)) {
4484 p.arg.content = camelize(p.arg.content);
4485 }
4486 nonNameProps.push(p);
4487 }
4488 }
4489 }
4490 if (nonNameProps.length > 0) {
4491 const { props, directives } = buildProps(node, context, nonNameProps);
4492 slotProps = props;
4493 if (directives.length) {
4494 context.onError(createCompilerError(35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4495 }
4496 }
4497 return {
4498 slotName,
4499 slotProps
4500 };
4501}
4502
4503const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
4504const transformOn = (dir, node, context, augmentor) => {
4505 const { loc, modifiers, arg } = dir;
4506 if (!dir.exp && !modifiers.length) {
4507 context.onError(createCompilerError(34 /* X_V_ON_NO_EXPRESSION */, loc));
4508 }
4509 let eventName;
4510 if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
4511 if (arg.isStatic) {
4512 const rawName = arg.content;
4513 // for all event listeners, auto convert it to camelCase. See issue #2249
4514 eventName = createSimpleExpression(toHandlerKey(camelize$1(rawName)), true, arg.loc);
4515 }
4516 else {
4517 // #2388
4518 eventName = createCompoundExpression([
4519 `${context.helperString(TO_HANDLER_KEY)}(`,
4520 arg,
4521 `)`
4522 ]);
4523 }
4524 }
4525 else {
4526 // already a compound expression.
4527 eventName = arg;
4528 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
4529 eventName.children.push(`)`);
4530 }
4531 // handler processing
4532 let exp = dir.exp;
4533 if (exp && !exp.content.trim()) {
4534 exp = undefined;
4535 }
4536 let shouldCache = context.cacheHandlers && !exp;
4537 if (exp) {
4538 const isMemberExp = isMemberExpression(exp.content);
4539 const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
4540 const hasMultipleStatements = exp.content.includes(`;`);
4541 if ((process.env.NODE_ENV !== 'production') && true) {
4542 validateBrowserExpression(exp, context, false, hasMultipleStatements);
4543 }
4544 if (isInlineStatement || (shouldCache && isMemberExp)) {
4545 // wrap inline statement in a function expression
4546 exp = createCompoundExpression([
4547 `${isInlineStatement
4548 ? `$event`
4549 : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
4550 exp,
4551 hasMultipleStatements ? `}` : `)`
4552 ]);
4553 }
4554 }
4555 let ret = {
4556 props: [
4557 createObjectProperty(eventName, exp || createSimpleExpression(`() => {}`, false, loc))
4558 ]
4559 };
4560 // apply extended compiler augmentor
4561 if (augmentor) {
4562 ret = augmentor(ret);
4563 }
4564 if (shouldCache) {
4565 // cache handlers so that it's always the same handler being passed down.
4566 // this avoids unnecessary re-renders when users use inline handlers on
4567 // components.
4568 ret.props[0].value = context.cache(ret.props[0].value);
4569 }
4570 return ret;
4571};
4572
4573// v-bind without arg is handled directly in ./transformElements.ts due to it affecting
4574// codegen for the entire props object. This transform here is only for v-bind
4575// *with* args.
4576const transformBind = (dir, _node, context) => {
4577 const { exp, modifiers, loc } = dir;
4578 const arg = dir.arg;
4579 if (arg.type !== 4 /* SIMPLE_EXPRESSION */) {
4580 arg.children.unshift(`(`);
4581 arg.children.push(`) || ""`);
4582 }
4583 else if (!arg.isStatic) {
4584 arg.content = `${arg.content} || ""`;
4585 }
4586 // .prop is no longer necessary due to new patch behavior
4587 // .sync is replaced by v-model:arg
4588 if (modifiers.includes('camel')) {
4589 if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
4590 if (arg.isStatic) {
4591 arg.content = camelize$1(arg.content);
4592 }
4593 else {
4594 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4595 }
4596 }
4597 else {
4598 arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4599 arg.children.push(`)`);
4600 }
4601 }
4602 if (!exp ||
4603 (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4604 context.onError(createCompilerError(33 /* X_V_BIND_NO_EXPRESSION */, loc));
4605 return {
4606 props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
4607 };
4608 }
4609 return {
4610 props: [createObjectProperty(arg, exp)]
4611 };
4612};
4613
4614// Merge adjacent text nodes and expressions into a single expression
4615// e.g. <div>abc {{ d }} {{ e }}</div> should have a single expression node as child.
4616const transformText = (node, context) => {
4617 if (node.type === 0 /* ROOT */ ||
4618 node.type === 1 /* ELEMENT */ ||
4619 node.type === 11 /* FOR */ ||
4620 node.type === 10 /* IF_BRANCH */) {
4621 // perform the transform on node exit so that all expressions have already
4622 // been processed.
4623 return () => {
4624 const children = node.children;
4625 let currentContainer = undefined;
4626 let hasText = false;
4627 for (let i = 0; i < children.length; i++) {
4628 const child = children[i];
4629 if (isText(child)) {
4630 hasText = true;
4631 for (let j = i + 1; j < children.length; j++) {
4632 const next = children[j];
4633 if (isText(next)) {
4634 if (!currentContainer) {
4635 currentContainer = children[i] = {
4636 type: 8 /* COMPOUND_EXPRESSION */,
4637 loc: child.loc,
4638 children: [child]
4639 };
4640 }
4641 // merge adjacent text node into current
4642 currentContainer.children.push(` + `, next);
4643 children.splice(j, 1);
4644 j--;
4645 }
4646 else {
4647 currentContainer = undefined;
4648 break;
4649 }
4650 }
4651 }
4652 }
4653 if (!hasText ||
4654 // if this is a plain element with a single text child, leave it
4655 // as-is since the runtime has dedicated fast path for this by directly
4656 // setting textContent of the element.
4657 // for component root it's always normalized anyway.
4658 (children.length === 1 &&
4659 (node.type === 0 /* ROOT */ ||
4660 (node.type === 1 /* ELEMENT */ &&
4661 node.tagType === 0 /* ELEMENT */ &&
4662 // #3756
4663 // custom directives can potentially add DOM elements arbitrarily,
4664 // we need to avoid setting textContent of the element at runtime
4665 // to avoid accidentally overwriting the DOM elements added
4666 // by the user through custom directives.
4667 !node.props.find(p => p.type === 7 /* DIRECTIVE */ &&
4668 !context.directiveTransforms[p.name]) &&
4669 // in compat mode, <template> tags with no special directives
4670 // will be rendered as a fragment so its children must be
4671 // converted into vnodes.
4672 !(node.tag === 'template'))))) {
4673 return;
4674 }
4675 // pre-convert text nodes into createTextVNode(text) calls to avoid
4676 // runtime normalization.
4677 for (let i = 0; i < children.length; i++) {
4678 const child = children[i];
4679 if (isText(child) || child.type === 8 /* COMPOUND_EXPRESSION */) {
4680 const callArgs = [];
4681 // createTextVNode defaults to single whitespace, so if it is a
4682 // single space the code could be an empty call to save bytes.
4683 if (child.type !== 2 /* TEXT */ || child.content !== ' ') {
4684 callArgs.push(child);
4685 }
4686 // mark dynamic text with flag so it gets patched inside a block
4687 if (!context.ssr &&
4688 getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
4689 callArgs.push(1 /* TEXT */ +
4690 ((process.env.NODE_ENV !== 'production') ? ` /* ${PatchFlagNames[1 /* TEXT */]} */` : ``));
4691 }
4692 children[i] = {
4693 type: 12 /* TEXT_CALL */,
4694 content: child,
4695 loc: child.loc,
4696 codegenNode: createCallExpression(context.helper(CREATE_TEXT), callArgs)
4697 };
4698 }
4699 }
4700 };
4701 }
4702};
4703
4704const seen = new WeakSet();
4705const transformOnce = (node, context) => {
4706 if (node.type === 1 /* ELEMENT */ && findDir(node, 'once', true)) {
4707 if (seen.has(node)) {
4708 return;
4709 }
4710 seen.add(node);
4711 context.helper(SET_BLOCK_TRACKING);
4712 return () => {
4713 const cur = context.currentNode;
4714 if (cur.codegenNode) {
4715 cur.codegenNode = context.cache(cur.codegenNode, true /* isVNode */);
4716 }
4717 };
4718 }
4719};
4720
4721const transformModel = (dir, node, context) => {
4722 const { exp, arg } = dir;
4723 if (!exp) {
4724 context.onError(createCompilerError(40 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4725 return createTransformProps();
4726 }
4727 const rawExp = exp.loc.source;
4728 const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
4729 const maybeRef = !true /* SETUP_CONST */;
4730 if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
4731 context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4732 return createTransformProps();
4733 }
4734 const propName = arg ? arg : createSimpleExpression('modelValue', true);
4735 const eventName = arg
4736 ? isStaticExp(arg)
4737 ? `onUpdate:${arg.content}`
4738 : createCompoundExpression(['"onUpdate:" + ', arg])
4739 : `onUpdate:modelValue`;
4740 let assignmentExp;
4741 const eventArg = context.isTS ? `($event: any)` : `$event`;
4742 {
4743 assignmentExp = createCompoundExpression([
4744 `${eventArg} => (`,
4745 exp,
4746 ` = $event)`
4747 ]);
4748 }
4749 const props = [
4750 // modelValue: foo
4751 createObjectProperty(propName, dir.exp),
4752 // "onUpdate:modelValue": $event => (foo = $event)
4753 createObjectProperty(eventName, assignmentExp)
4754 ];
4755 // modelModifiers: { foo: true, "bar-baz": true }
4756 if (dir.modifiers.length && node.tagType === 1 /* COMPONENT */) {
4757 const modifiers = dir.modifiers
4758 .map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
4759 .join(`, `);
4760 const modifiersKey = arg
4761 ? isStaticExp(arg)
4762 ? `${arg.content}Modifiers`
4763 : createCompoundExpression([arg, ' + "Modifiers"'])
4764 : `modelModifiers`;
4765 props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* CAN_HOIST */)));
4766 }
4767 return createTransformProps(props);
4768};
4769function createTransformProps(props = []) {
4770 return { props };
4771}
4772
4773const validDivisionCharRE = /[\w).+\-_$\]]/;
4774const transformFilter = (node, context) => {
4775 if (!isCompatEnabled("COMPILER_FILTER" /* COMPILER_FILTERS */, context)) {
4776 return;
4777 }
4778 if (node.type === 5 /* INTERPOLATION */) {
4779 // filter rewrite is applied before expression transform so only
4780 // simple expressions are possible at this stage
4781 rewriteFilter(node.content, context);
4782 }
4783 if (node.type === 1 /* ELEMENT */) {
4784 node.props.forEach((prop) => {
4785 if (prop.type === 7 /* DIRECTIVE */ &&
4786 prop.name !== 'for' &&
4787 prop.exp) {
4788 rewriteFilter(prop.exp, context);
4789 }
4790 });
4791 }
4792};
4793function rewriteFilter(node, context) {
4794 if (node.type === 4 /* SIMPLE_EXPRESSION */) {
4795 parseFilter(node, context);
4796 }
4797 else {
4798 for (let i = 0; i < node.children.length; i++) {
4799 const child = node.children[i];
4800 if (typeof child !== 'object')
4801 continue;
4802 if (child.type === 4 /* SIMPLE_EXPRESSION */) {
4803 parseFilter(child, context);
4804 }
4805 else if (child.type === 8 /* COMPOUND_EXPRESSION */) {
4806 rewriteFilter(node, context);
4807 }
4808 else if (child.type === 5 /* INTERPOLATION */) {
4809 rewriteFilter(child.content, context);
4810 }
4811 }
4812 }
4813}
4814function parseFilter(node, context) {
4815 const exp = node.content;
4816 let inSingle = false;
4817 let inDouble = false;
4818 let inTemplateString = false;
4819 let inRegex = false;
4820 let curly = 0;
4821 let square = 0;
4822 let paren = 0;
4823 let lastFilterIndex = 0;
4824 let c, prev, i, expression, filters = [];
4825 for (i = 0; i < exp.length; i++) {
4826 prev = c;
4827 c = exp.charCodeAt(i);
4828 if (inSingle) {
4829 if (c === 0x27 && prev !== 0x5c)
4830 inSingle = false;
4831 }
4832 else if (inDouble) {
4833 if (c === 0x22 && prev !== 0x5c)
4834 inDouble = false;
4835 }
4836 else if (inTemplateString) {
4837 if (c === 0x60 && prev !== 0x5c)
4838 inTemplateString = false;
4839 }
4840 else if (inRegex) {
4841 if (c === 0x2f && prev !== 0x5c)
4842 inRegex = false;
4843 }
4844 else if (c === 0x7c && // pipe
4845 exp.charCodeAt(i + 1) !== 0x7c &&
4846 exp.charCodeAt(i - 1) !== 0x7c &&
4847 !curly &&
4848 !square &&
4849 !paren) {
4850 if (expression === undefined) {
4851 // first filter, end of expression
4852 lastFilterIndex = i + 1;
4853 expression = exp.slice(0, i).trim();
4854 }
4855 else {
4856 pushFilter();
4857 }
4858 }
4859 else {
4860 switch (c) {
4861 case 0x22:
4862 inDouble = true;
4863 break; // "
4864 case 0x27:
4865 inSingle = true;
4866 break; // '
4867 case 0x60:
4868 inTemplateString = true;
4869 break; // `
4870 case 0x28:
4871 paren++;
4872 break; // (
4873 case 0x29:
4874 paren--;
4875 break; // )
4876 case 0x5b:
4877 square++;
4878 break; // [
4879 case 0x5d:
4880 square--;
4881 break; // ]
4882 case 0x7b:
4883 curly++;
4884 break; // {
4885 case 0x7d:
4886 curly--;
4887 break; // }
4888 }
4889 if (c === 0x2f) {
4890 // /
4891 let j = i - 1;
4892 let p;
4893 // find first non-whitespace prev char
4894 for (; j >= 0; j--) {
4895 p = exp.charAt(j);
4896 if (p !== ' ')
4897 break;
4898 }
4899 if (!p || !validDivisionCharRE.test(p)) {
4900 inRegex = true;
4901 }
4902 }
4903 }
4904 }
4905 if (expression === undefined) {
4906 expression = exp.slice(0, i).trim();
4907 }
4908 else if (lastFilterIndex !== 0) {
4909 pushFilter();
4910 }
4911 function pushFilter() {
4912 filters.push(exp.slice(lastFilterIndex, i).trim());
4913 lastFilterIndex = i + 1;
4914 }
4915 if (filters.length) {
4916 (process.env.NODE_ENV !== 'production') &&
4917 warnDeprecation("COMPILER_FILTER" /* COMPILER_FILTERS */, context, node.loc);
4918 for (i = 0; i < filters.length; i++) {
4919 expression = wrapFilter(expression, filters[i], context);
4920 }
4921 node.content = expression;
4922 }
4923}
4924function wrapFilter(exp, filter, context) {
4925 context.helper(RESOLVE_FILTER);
4926 const i = filter.indexOf('(');
4927 if (i < 0) {
4928 context.filters.add(filter);
4929 return `${toValidAssetId(filter, 'filter')}(${exp})`;
4930 }
4931 else {
4932 const name = filter.slice(0, i);
4933 const args = filter.slice(i + 1);
4934 context.filters.add(name);
4935 return `${toValidAssetId(name, 'filter')}(${exp}${args !== ')' ? ',' + args : args}`;
4936 }
4937}
4938
4939function getBaseTransformPreset(prefixIdentifiers) {
4940 return [
4941 [
4942 transformOnce,
4943 transformIf,
4944 transformFor,
4945 ...([transformFilter] ),
4946 ...((process.env.NODE_ENV !== 'production')
4947 ? [transformExpression]
4948 : []),
4949 transformSlotOutlet,
4950 transformElement,
4951 trackSlotScopes,
4952 transformText
4953 ],
4954 {
4955 on: transformOn,
4956 bind: transformBind,
4957 model: transformModel
4958 }
4959 ];
4960}
4961// we name it `baseCompile` so that higher order compilers like
4962// @vue/compiler-dom can export `compile` while re-exporting everything else.
4963function baseCompile(template, options = {}) {
4964 const onError = options.onError || defaultOnError;
4965 const isModuleMode = options.mode === 'module';
4966 /* istanbul ignore if */
4967 {
4968 if (options.prefixIdentifiers === true) {
4969 onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
4970 }
4971 else if (isModuleMode) {
4972 onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
4973 }
4974 }
4975 const prefixIdentifiers = !true ;
4976 if (options.cacheHandlers) {
4977 onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
4978 }
4979 if (options.scopeId && !isModuleMode) {
4980 onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
4981 }
4982 const ast = isString(template) ? baseParse(template, options) : template;
4983 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
4984 transform(ast, extend({}, options, {
4985 prefixIdentifiers,
4986 nodeTransforms: [
4987 ...nodeTransforms,
4988 ...(options.nodeTransforms || []) // user transforms
4989 ],
4990 directiveTransforms: extend({}, directiveTransforms, options.directiveTransforms || {} // user transforms
4991 )
4992 }));
4993 return generate(ast, extend({}, options, {
4994 prefixIdentifiers
4995 }));
4996}
4997
4998const noopDirectiveTransform = () => ({ props: [] });
4999
5000var compilerCore_esmBundler = {
5001 __proto__: null,
5002 BASE_TRANSITION: BASE_TRANSITION,
5003 CAMELIZE: CAMELIZE,
5004 CAPITALIZE: CAPITALIZE,
5005 CREATE_BLOCK: CREATE_BLOCK,
5006 CREATE_COMMENT: CREATE_COMMENT,
5007 CREATE_SLOTS: CREATE_SLOTS,
5008 CREATE_STATIC: CREATE_STATIC,
5009 CREATE_TEXT: CREATE_TEXT,
5010 CREATE_VNODE: CREATE_VNODE,
5011 FRAGMENT: FRAGMENT,
5012 IS_REF: IS_REF,
5013 KEEP_ALIVE: KEEP_ALIVE,
5014 MERGE_PROPS: MERGE_PROPS,
5015 OPEN_BLOCK: OPEN_BLOCK,
5016 POP_SCOPE_ID: POP_SCOPE_ID,
5017 PUSH_SCOPE_ID: PUSH_SCOPE_ID,
5018 RENDER_LIST: RENDER_LIST,
5019 RENDER_SLOT: RENDER_SLOT,
5020 RESOLVE_COMPONENT: RESOLVE_COMPONENT,
5021 RESOLVE_DIRECTIVE: RESOLVE_DIRECTIVE,
5022 RESOLVE_DYNAMIC_COMPONENT: RESOLVE_DYNAMIC_COMPONENT,
5023 RESOLVE_FILTER: RESOLVE_FILTER,
5024 SET_BLOCK_TRACKING: SET_BLOCK_TRACKING,
5025 SUSPENSE: SUSPENSE,
5026 TELEPORT: TELEPORT,
5027 TO_DISPLAY_STRING: TO_DISPLAY_STRING,
5028 TO_HANDLERS: TO_HANDLERS,
5029 TO_HANDLER_KEY: TO_HANDLER_KEY,
5030 UNREF: UNREF,
5031 WITH_CTX: WITH_CTX,
5032 WITH_DIRECTIVES: WITH_DIRECTIVES,
5033 WITH_SCOPE_ID: WITH_SCOPE_ID,
5034 advancePositionWithClone: advancePositionWithClone,
5035 advancePositionWithMutation: advancePositionWithMutation,
5036 assert: assert,
5037 baseCompile: baseCompile,
5038 baseParse: baseParse,
5039 buildProps: buildProps,
5040 buildSlots: buildSlots,
5041 checkCompatEnabled: checkCompatEnabled,
5042 createArrayExpression: createArrayExpression,
5043 createAssignmentExpression: createAssignmentExpression,
5044 createBlockStatement: createBlockStatement,
5045 createCacheExpression: createCacheExpression,
5046 createCallExpression: createCallExpression,
5047 createCompilerError: createCompilerError,
5048 createCompoundExpression: createCompoundExpression,
5049 createConditionalExpression: createConditionalExpression,
5050 createForLoopParams: createForLoopParams,
5051 createFunctionExpression: createFunctionExpression,
5052 createIfStatement: createIfStatement,
5053 createInterpolation: createInterpolation,
5054 createObjectExpression: createObjectExpression,
5055 createObjectProperty: createObjectProperty,
5056 createReturnStatement: createReturnStatement,
5057 createRoot: createRoot,
5058 createSequenceExpression: createSequenceExpression,
5059 createSimpleExpression: createSimpleExpression,
5060 createStructuralDirectiveTransform: createStructuralDirectiveTransform,
5061 createTemplateLiteral: createTemplateLiteral,
5062 createTransformContext: createTransformContext,
5063 createVNodeCall: createVNodeCall,
5064 findDir: findDir,
5065 findProp: findProp,
5066 generate: generate,
5067 getBaseTransformPreset: getBaseTransformPreset,
5068 getInnerRange: getInnerRange,
5069 hasDynamicKeyVBind: hasDynamicKeyVBind,
5070 hasScopeRef: hasScopeRef,
5071 helperNameMap: helperNameMap,
5072 injectProp: injectProp,
5073 isBindKey: isBindKey,
5074 isBuiltInType: isBuiltInType,
5075 isCoreComponent: isCoreComponent,
5076 isMemberExpression: isMemberExpression,
5077 isSimpleIdentifier: isSimpleIdentifier,
5078 isSlotOutlet: isSlotOutlet,
5079 isStaticExp: isStaticExp,
5080 isTemplateNode: isTemplateNode,
5081 isText: isText,
5082 isVSlot: isVSlot,
5083 locStub: locStub,
5084 noopDirectiveTransform: noopDirectiveTransform,
5085 processExpression: processExpression,
5086 processFor: processFor,
5087 processIf: processIf,
5088 processSlotOutlet: processSlotOutlet,
5089 registerRuntimeHelpers: registerRuntimeHelpers,
5090 resolveComponentType: resolveComponentType,
5091 toValidAssetId: toValidAssetId,
5092 trackSlotScopes: trackSlotScopes,
5093 trackVForSlotScopes: trackVForSlotScopes,
5094 transform: transform,
5095 transformBind: transformBind,
5096 transformElement: transformElement,
5097 transformExpression: transformExpression,
5098 transformModel: transformModel,
5099 transformOn: transformOn,
5100 traverseNode: traverseNode,
5101 warnDeprecation: warnDeprecation,
5102 generateCodeFrame: generateCodeFrame
5103};
5104
5105var require$$0 = /*@__PURE__*/build.getAugmentedNamespace(compilerCore_esmBundler);
5106
5107var require$$1 = /*@__PURE__*/build.getAugmentedNamespace(shared_esmBundler);
5108
5109(function (exports) {
5110
5111Object.defineProperty(exports, '__esModule', { value: true });
5112
5113var compilerCore = require$$0;
5114var shared = require$$1;
5115
5116const V_MODEL_RADIO = Symbol(`vModelRadio` );
5117const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
5118const V_MODEL_TEXT = Symbol(`vModelText` );
5119const V_MODEL_SELECT = Symbol(`vModelSelect` );
5120const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
5121const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
5122const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
5123const V_SHOW = Symbol(`vShow` );
5124const TRANSITION = Symbol(`Transition` );
5125const TRANSITION_GROUP = Symbol(`TransitionGroup` );
5126compilerCore.registerRuntimeHelpers({
5127 [V_MODEL_RADIO]: `vModelRadio`,
5128 [V_MODEL_CHECKBOX]: `vModelCheckbox`,
5129 [V_MODEL_TEXT]: `vModelText`,
5130 [V_MODEL_SELECT]: `vModelSelect`,
5131 [V_MODEL_DYNAMIC]: `vModelDynamic`,
5132 [V_ON_WITH_MODIFIERS]: `withModifiers`,
5133 [V_ON_WITH_KEYS]: `withKeys`,
5134 [V_SHOW]: `vShow`,
5135 [TRANSITION]: `Transition`,
5136 [TRANSITION_GROUP]: `TransitionGroup`
5137});
5138
5139var namedCharacterReferences = {
5140 GT: ">",
5141 gt: ">",
5142 LT: "<",
5143 lt: "<",
5144 "ac;": "∾",
5145 "af;": "⁡",
5146 AMP: "&",
5147 amp: "&",
5148 "ap;": "≈",
5149 "DD;": "ⅅ",
5150 "dd;": "ⅆ",
5151 deg: "°",
5152 "ee;": "ⅇ",
5153 "eg;": "⪚",
5154 "el;": "⪙",
5155 ETH: "Ð",
5156 eth: "ð",
5157 "gE;": "≧",
5158 "ge;": "≥",
5159 "Gg;": "⋙",
5160 "gg;": "≫",
5161 "gl;": "≷",
5162 "GT;": ">",
5163 "Gt;": "≫",
5164 "gt;": ">",
5165 "ic;": "⁣",
5166 "ii;": "ⅈ",
5167 "Im;": "ℑ",
5168 "in;": "∈",
5169 "it;": "⁢",
5170 "lE;": "≦",
5171 "le;": "≤",
5172 "lg;": "≶",
5173 "Ll;": "⋘",
5174 "ll;": "≪",
5175 "LT;": "<",
5176 "Lt;": "≪",
5177 "lt;": "<",
5178 "mp;": "∓",
5179 "Mu;": "Μ",
5180 "mu;": "μ",
5181 "ne;": "≠",
5182 "ni;": "∋",
5183 not: "¬",
5184 "Nu;": "Ν",
5185 "nu;": "ν",
5186 "Or;": "⩔",
5187 "or;": "∨",
5188 "oS;": "Ⓢ",
5189 "Pi;": "Π",
5190 "pi;": "π",
5191 "pm;": "±",
5192 "Pr;": "⪻",
5193 "pr;": "≺",
5194 "Re;": "ℜ",
5195 REG: "®",
5196 reg: "®",
5197 "rx;": "℞",
5198 "Sc;": "⪼",
5199 "sc;": "≻",
5200 shy: "­",
5201 uml: "¨",
5202 "wp;": "℘",
5203 "wr;": "≀",
5204 "Xi;": "Ξ",
5205 "xi;": "ξ",
5206 yen: "¥",
5207 "acd;": "∿",
5208 "acE;": "∾̳",
5209 "Acy;": "А",
5210 "acy;": "а",
5211 "Afr;": "𝔄",
5212 "afr;": "𝔞",
5213 "AMP;": "&",
5214 "amp;": "&",
5215 "And;": "⩓",
5216 "and;": "∧",
5217 "ang;": "∠",
5218 "apE;": "⩰",
5219 "ape;": "≊",
5220 "ast;": "*",
5221 Auml: "Ä",
5222 auml: "ä",
5223 "Bcy;": "Б",
5224 "bcy;": "б",
5225 "Bfr;": "𝔅",
5226 "bfr;": "𝔟",
5227 "bne;": "=⃥",
5228 "bot;": "⊥",
5229 "Cap;": "⋒",
5230 "cap;": "∩",
5231 cent: "¢",
5232 "Cfr;": "ℭ",
5233 "cfr;": "𝔠",
5234 "Chi;": "Χ",
5235 "chi;": "χ",
5236 "cir;": "○",
5237 COPY: "©",
5238 copy: "©",
5239 "Cup;": "⋓",
5240 "cup;": "∪",
5241 "Dcy;": "Д",
5242 "dcy;": "д",
5243 "deg;": "°",
5244 "Del;": "∇",
5245 "Dfr;": "𝔇",
5246 "dfr;": "𝔡",
5247 "die;": "¨",
5248 "div;": "÷",
5249 "Dot;": "¨",
5250 "dot;": "˙",
5251 "Ecy;": "Э",
5252 "ecy;": "э",
5253 "Efr;": "𝔈",
5254 "efr;": "𝔢",
5255 "egs;": "⪖",
5256 "ell;": "ℓ",
5257 "els;": "⪕",
5258 "ENG;": "Ŋ",
5259 "eng;": "ŋ",
5260 "Eta;": "Η",
5261 "eta;": "η",
5262 "ETH;": "Ð",
5263 "eth;": "ð",
5264 Euml: "Ë",
5265 euml: "ë",
5266 "Fcy;": "Ф",
5267 "fcy;": "ф",
5268 "Ffr;": "𝔉",
5269 "ffr;": "𝔣",
5270 "gap;": "⪆",
5271 "Gcy;": "Г",
5272 "gcy;": "г",
5273 "gEl;": "⪌",
5274 "gel;": "⋛",
5275 "geq;": "≥",
5276 "ges;": "⩾",
5277 "Gfr;": "𝔊",
5278 "gfr;": "𝔤",
5279 "ggg;": "⋙",
5280 "gla;": "⪥",
5281 "glE;": "⪒",
5282 "glj;": "⪤",
5283 "gnE;": "≩",
5284 "gne;": "⪈",
5285 "Hat;": "^",
5286 "Hfr;": "ℌ",
5287 "hfr;": "𝔥",
5288 "Icy;": "И",
5289 "icy;": "и",
5290 "iff;": "⇔",
5291 "Ifr;": "ℑ",
5292 "ifr;": "𝔦",
5293 "Int;": "∬",
5294 "int;": "∫",
5295 Iuml: "Ï",
5296 iuml: "ï",
5297 "Jcy;": "Й",
5298 "jcy;": "й",
5299 "Jfr;": "𝔍",
5300 "jfr;": "𝔧",
5301 "Kcy;": "К",
5302 "kcy;": "к",
5303 "Kfr;": "𝔎",
5304 "kfr;": "𝔨",
5305 "lap;": "⪅",
5306 "lat;": "⪫",
5307 "Lcy;": "Л",
5308 "lcy;": "л",
5309 "lEg;": "⪋",
5310 "leg;": "⋚",
5311 "leq;": "≤",
5312 "les;": "⩽",
5313 "Lfr;": "𝔏",
5314 "lfr;": "𝔩",
5315 "lgE;": "⪑",
5316 "lnE;": "≨",
5317 "lne;": "⪇",
5318 "loz;": "◊",
5319 "lrm;": "‎",
5320 "Lsh;": "↰",
5321 "lsh;": "↰",
5322 macr: "¯",
5323 "Map;": "⤅",
5324 "map;": "↦",
5325 "Mcy;": "М",
5326 "mcy;": "м",
5327 "Mfr;": "𝔐",
5328 "mfr;": "𝔪",
5329 "mho;": "℧",
5330 "mid;": "∣",
5331 "nap;": "≉",
5332 nbsp: " ",
5333 "Ncy;": "Н",
5334 "ncy;": "н",
5335 "Nfr;": "𝔑",
5336 "nfr;": "𝔫",
5337 "ngE;": "≧̸",
5338 "nge;": "≱",
5339 "nGg;": "⋙̸",
5340 "nGt;": "≫⃒",
5341 "ngt;": "≯",
5342 "nis;": "⋼",
5343 "niv;": "∋",
5344 "nlE;": "≦̸",
5345 "nle;": "≰",
5346 "nLl;": "⋘̸",
5347 "nLt;": "≪⃒",
5348 "nlt;": "≮",
5349 "Not;": "⫬",
5350 "not;": "¬",
5351 "npr;": "⊀",
5352 "nsc;": "⊁",
5353 "num;": "#",
5354 "Ocy;": "О",
5355 "ocy;": "о",
5356 "Ofr;": "𝔒",
5357 "ofr;": "𝔬",
5358 "ogt;": "⧁",
5359 "ohm;": "Ω",
5360 "olt;": "⧀",
5361 "ord;": "⩝",
5362 ordf: "ª",
5363 ordm: "º",
5364 "orv;": "⩛",
5365 Ouml: "Ö",
5366 ouml: "ö",
5367 "par;": "∥",
5368 para: "¶",
5369 "Pcy;": "П",
5370 "pcy;": "п",
5371 "Pfr;": "𝔓",
5372 "pfr;": "𝔭",
5373 "Phi;": "Φ",
5374 "phi;": "φ",
5375 "piv;": "ϖ",
5376 "prE;": "⪳",
5377 "pre;": "⪯",
5378 "Psi;": "Ψ",
5379 "psi;": "ψ",
5380 "Qfr;": "𝔔",
5381 "qfr;": "𝔮",
5382 QUOT: "\"",
5383 quot: "\"",
5384 "Rcy;": "Р",
5385 "rcy;": "р",
5386 "REG;": "®",
5387 "reg;": "®",
5388 "Rfr;": "ℜ",
5389 "rfr;": "𝔯",
5390 "Rho;": "Ρ",
5391 "rho;": "ρ",
5392 "rlm;": "‏",
5393 "Rsh;": "↱",
5394 "rsh;": "↱",
5395 "scE;": "⪴",
5396 "sce;": "⪰",
5397 "Scy;": "С",
5398 "scy;": "с",
5399 sect: "§",
5400 "Sfr;": "𝔖",
5401 "sfr;": "𝔰",
5402 "shy;": "­",
5403 "sim;": "∼",
5404 "smt;": "⪪",
5405 "sol;": "/",
5406 "squ;": "□",
5407 "Sub;": "⋐",
5408 "sub;": "⊂",
5409 "Sum;": "∑",
5410 "sum;": "∑",
5411 "Sup;": "⋑",
5412 "sup;": "⊃",
5413 sup1: "¹",
5414 sup2: "²",
5415 sup3: "³",
5416 "Tab;": "\t",
5417 "Tau;": "Τ",
5418 "tau;": "τ",
5419 "Tcy;": "Т",
5420 "tcy;": "т",
5421 "Tfr;": "𝔗",
5422 "tfr;": "𝔱",
5423 "top;": "⊤",
5424 "Ucy;": "У",
5425 "ucy;": "у",
5426 "Ufr;": "𝔘",
5427 "ufr;": "𝔲",
5428 "uml;": "¨",
5429 Uuml: "Ü",
5430 uuml: "ü",
5431 "Vcy;": "В",
5432 "vcy;": "в",
5433 "Vee;": "⋁",
5434 "vee;": "∨",
5435 "Vfr;": "𝔙",
5436 "vfr;": "𝔳",
5437 "Wfr;": "𝔚",
5438 "wfr;": "𝔴",
5439 "Xfr;": "𝔛",
5440 "xfr;": "𝔵",
5441 "Ycy;": "Ы",
5442 "ycy;": "ы",
5443 "yen;": "¥",
5444 "Yfr;": "𝔜",
5445 "yfr;": "𝔶",
5446 yuml: "ÿ",
5447 "Zcy;": "З",
5448 "zcy;": "з",
5449 "Zfr;": "ℨ",
5450 "zfr;": "𝔷",
5451 "zwj;": "‍",
5452 Acirc: "Â",
5453 acirc: "â",
5454 acute: "´",
5455 AElig: "Æ",
5456 aelig: "æ",
5457 "andd;": "⩜",
5458 "andv;": "⩚",
5459 "ange;": "⦤",
5460 "Aopf;": "𝔸",
5461 "aopf;": "𝕒",
5462 "apid;": "≋",
5463 "apos;": "'",
5464 Aring: "Å",
5465 aring: "å",
5466 "Ascr;": "𝒜",
5467 "ascr;": "𝒶",
5468 "Auml;": "Ä",
5469 "auml;": "ä",
5470 "Barv;": "⫧",
5471 "bbrk;": "⎵",
5472 "Beta;": "Β",
5473 "beta;": "β",
5474 "beth;": "ℶ",
5475 "bNot;": "⫭",
5476 "bnot;": "⌐",
5477 "Bopf;": "𝔹",
5478 "bopf;": "𝕓",
5479 "boxH;": "═",
5480 "boxh;": "─",
5481 "boxV;": "║",
5482 "boxv;": "│",
5483 "Bscr;": "ℬ",
5484 "bscr;": "𝒷",
5485 "bsim;": "∽",
5486 "bsol;": "\\",
5487 "bull;": "•",
5488 "bump;": "≎",
5489 "caps;": "∩︀",
5490 "Cdot;": "Ċ",
5491 "cdot;": "ċ",
5492 cedil: "¸",
5493 "cent;": "¢",
5494 "CHcy;": "Ч",
5495 "chcy;": "ч",
5496 "circ;": "ˆ",
5497 "cirE;": "⧃",
5498 "cire;": "≗",
5499 "comp;": "∁",
5500 "cong;": "≅",
5501 "Copf;": "ℂ",
5502 "copf;": "𝕔",
5503 "COPY;": "©",
5504 "copy;": "©",
5505 "Cscr;": "𝒞",
5506 "cscr;": "𝒸",
5507 "csub;": "⫏",
5508 "csup;": "⫐",
5509 "cups;": "∪︀",
5510 "Darr;": "↡",
5511 "dArr;": "⇓",
5512 "darr;": "↓",
5513 "dash;": "‐",
5514 "dHar;": "⥥",
5515 "diam;": "⋄",
5516 "DJcy;": "Ђ",
5517 "djcy;": "ђ",
5518 "Dopf;": "𝔻",
5519 "dopf;": "𝕕",
5520 "Dscr;": "𝒟",
5521 "dscr;": "𝒹",
5522 "DScy;": "Ѕ",
5523 "dscy;": "ѕ",
5524 "dsol;": "⧶",
5525 "dtri;": "▿",
5526 "DZcy;": "Џ",
5527 "dzcy;": "џ",
5528 "ecir;": "≖",
5529 Ecirc: "Ê",
5530 ecirc: "ê",
5531 "Edot;": "Ė",
5532 "eDot;": "≑",
5533 "edot;": "ė",
5534 "emsp;": " ",
5535 "ensp;": " ",
5536 "Eopf;": "𝔼",
5537 "eopf;": "𝕖",
5538 "epar;": "⋕",
5539 "epsi;": "ε",
5540 "Escr;": "ℰ",
5541 "escr;": "ℯ",
5542 "Esim;": "⩳",
5543 "esim;": "≂",
5544 "Euml;": "Ë",
5545 "euml;": "ë",
5546 "euro;": "€",
5547 "excl;": "!",
5548 "flat;": "♭",
5549 "fnof;": "ƒ",
5550 "Fopf;": "𝔽",
5551 "fopf;": "𝕗",
5552 "fork;": "⋔",
5553 "Fscr;": "ℱ",
5554 "fscr;": "𝒻",
5555 "Gdot;": "Ġ",
5556 "gdot;": "ġ",
5557 "geqq;": "≧",
5558 "gesl;": "⋛︀",
5559 "GJcy;": "Ѓ",
5560 "gjcy;": "ѓ",
5561 "gnap;": "⪊",
5562 "gneq;": "⪈",
5563 "Gopf;": "𝔾",
5564 "gopf;": "𝕘",
5565 "Gscr;": "𝒢",
5566 "gscr;": "ℊ",
5567 "gsim;": "≳",
5568 "gtcc;": "⪧",
5569 "gvnE;": "≩︀",
5570 "half;": "½",
5571 "hArr;": "⇔",
5572 "harr;": "↔",
5573 "hbar;": "ℏ",
5574 "Hopf;": "ℍ",
5575 "hopf;": "𝕙",
5576 "Hscr;": "ℋ",
5577 "hscr;": "𝒽",
5578 Icirc: "Î",
5579 icirc: "î",
5580 "Idot;": "İ",
5581 "IEcy;": "Е",
5582 "iecy;": "е",
5583 iexcl: "¡",
5584 "imof;": "⊷",
5585 "IOcy;": "Ё",
5586 "iocy;": "ё",
5587 "Iopf;": "𝕀",
5588 "iopf;": "𝕚",
5589 "Iota;": "Ι",
5590 "iota;": "ι",
5591 "Iscr;": "ℐ",
5592 "iscr;": "𝒾",
5593 "isin;": "∈",
5594 "Iuml;": "Ï",
5595 "iuml;": "ï",
5596 "Jopf;": "𝕁",
5597 "jopf;": "𝕛",
5598 "Jscr;": "𝒥",
5599 "jscr;": "𝒿",
5600 "KHcy;": "Х",
5601 "khcy;": "х",
5602 "KJcy;": "Ќ",
5603 "kjcy;": "ќ",
5604 "Kopf;": "𝕂",
5605 "kopf;": "𝕜",
5606 "Kscr;": "𝒦",
5607 "kscr;": "𝓀",
5608 "Lang;": "⟪",
5609 "lang;": "⟨",
5610 laquo: "«",
5611 "Larr;": "↞",
5612 "lArr;": "⇐",
5613 "larr;": "←",
5614 "late;": "⪭",
5615 "lcub;": "{",
5616 "ldca;": "⤶",
5617 "ldsh;": "↲",
5618 "leqq;": "≦",
5619 "lesg;": "⋚︀",
5620 "lHar;": "⥢",
5621 "LJcy;": "Љ",
5622 "ljcy;": "љ",
5623 "lnap;": "⪉",
5624 "lneq;": "⪇",
5625 "Lopf;": "𝕃",
5626 "lopf;": "𝕝",
5627 "lozf;": "⧫",
5628 "lpar;": "(",
5629 "Lscr;": "ℒ",
5630 "lscr;": "𝓁",
5631 "lsim;": "≲",
5632 "lsqb;": "[",
5633 "ltcc;": "⪦",
5634 "ltri;": "◃",
5635 "lvnE;": "≨︀",
5636 "macr;": "¯",
5637 "male;": "♂",
5638 "malt;": "✠",
5639 micro: "µ",
5640 "mlcp;": "⫛",
5641 "mldr;": "…",
5642 "Mopf;": "𝕄",
5643 "mopf;": "𝕞",
5644 "Mscr;": "ℳ",
5645 "mscr;": "𝓂",
5646 "nang;": "∠⃒",
5647 "napE;": "⩰̸",
5648 "nbsp;": " ",
5649 "ncap;": "⩃",
5650 "ncup;": "⩂",
5651 "ngeq;": "≱",
5652 "nges;": "⩾̸",
5653 "ngtr;": "≯",
5654 "nGtv;": "≫̸",
5655 "nisd;": "⋺",
5656 "NJcy;": "Њ",
5657 "njcy;": "њ",
5658 "nldr;": "‥",
5659 "nleq;": "≰",
5660 "nles;": "⩽̸",
5661 "nLtv;": "≪̸",
5662 "nmid;": "∤",
5663 "Nopf;": "ℕ",
5664 "nopf;": "𝕟",
5665 "npar;": "∦",
5666 "npre;": "⪯̸",
5667 "nsce;": "⪰̸",
5668 "Nscr;": "𝒩",
5669 "nscr;": "𝓃",
5670 "nsim;": "≁",
5671 "nsub;": "⊄",
5672 "nsup;": "⊅",
5673 "ntgl;": "≹",
5674 "ntlg;": "≸",
5675 "nvap;": "≍⃒",
5676 "nvge;": "≥⃒",
5677 "nvgt;": ">⃒",
5678 "nvle;": "≤⃒",
5679 "nvlt;": "<⃒",
5680 "oast;": "⊛",
5681 "ocir;": "⊚",
5682 Ocirc: "Ô",
5683 ocirc: "ô",
5684 "odiv;": "⨸",
5685 "odot;": "⊙",
5686 "ogon;": "˛",
5687 "oint;": "∮",
5688 "omid;": "⦶",
5689 "Oopf;": "𝕆",
5690 "oopf;": "𝕠",
5691 "opar;": "⦷",
5692 "ordf;": "ª",
5693 "ordm;": "º",
5694 "oror;": "⩖",
5695 "Oscr;": "𝒪",
5696 "oscr;": "ℴ",
5697 "osol;": "⊘",
5698 "Ouml;": "Ö",
5699 "ouml;": "ö",
5700 "para;": "¶",
5701 "part;": "∂",
5702 "perp;": "⊥",
5703 "phiv;": "ϕ",
5704 "plus;": "+",
5705 "Popf;": "ℙ",
5706 "popf;": "𝕡",
5707 pound: "£",
5708 "prap;": "⪷",
5709 "prec;": "≺",
5710 "prnE;": "⪵",
5711 "prod;": "∏",
5712 "prop;": "∝",
5713 "Pscr;": "𝒫",
5714 "pscr;": "𝓅",
5715 "qint;": "⨌",
5716 "Qopf;": "ℚ",
5717 "qopf;": "𝕢",
5718 "Qscr;": "𝒬",
5719 "qscr;": "𝓆",
5720 "QUOT;": "\"",
5721 "quot;": "\"",
5722 "race;": "∽̱",
5723 "Rang;": "⟫",
5724 "rang;": "⟩",
5725 raquo: "»",
5726 "Rarr;": "↠",
5727 "rArr;": "⇒",
5728 "rarr;": "→",
5729 "rcub;": "}",
5730 "rdca;": "⤷",
5731 "rdsh;": "↳",
5732 "real;": "ℜ",
5733 "rect;": "▭",
5734 "rHar;": "⥤",
5735 "rhov;": "ϱ",
5736 "ring;": "˚",
5737 "Ropf;": "ℝ",
5738 "ropf;": "𝕣",
5739 "rpar;": ")",
5740 "Rscr;": "ℛ",
5741 "rscr;": "𝓇",
5742 "rsqb;": "]",
5743 "rtri;": "▹",
5744 "scap;": "⪸",
5745 "scnE;": "⪶",
5746 "sdot;": "⋅",
5747 "sect;": "§",
5748 "semi;": ";",
5749 "sext;": "✶",
5750 "SHcy;": "Ш",
5751 "shcy;": "ш",
5752 "sime;": "≃",
5753 "simg;": "⪞",
5754 "siml;": "⪝",
5755 "smid;": "∣",
5756 "smte;": "⪬",
5757 "solb;": "⧄",
5758 "Sopf;": "𝕊",
5759 "sopf;": "𝕤",
5760 "spar;": "∥",
5761 "Sqrt;": "√",
5762 "squf;": "▪",
5763 "Sscr;": "𝒮",
5764 "sscr;": "𝓈",
5765 "Star;": "⋆",
5766 "star;": "☆",
5767 "subE;": "⫅",
5768 "sube;": "⊆",
5769 "succ;": "≻",
5770 "sung;": "♪",
5771 "sup1;": "¹",
5772 "sup2;": "²",
5773 "sup3;": "³",
5774 "supE;": "⫆",
5775 "supe;": "⊇",
5776 szlig: "ß",
5777 "tbrk;": "⎴",
5778 "tdot;": "⃛",
5779 THORN: "Þ",
5780 thorn: "þ",
5781 times: "×",
5782 "tint;": "∭",
5783 "toea;": "⤨",
5784 "Topf;": "𝕋",
5785 "topf;": "𝕥",
5786 "tosa;": "⤩",
5787 "trie;": "≜",
5788 "Tscr;": "𝒯",
5789 "tscr;": "𝓉",
5790 "TScy;": "Ц",
5791 "tscy;": "ц",
5792 "Uarr;": "↟",
5793 "uArr;": "⇑",
5794 "uarr;": "↑",
5795 Ucirc: "Û",
5796 ucirc: "û",
5797 "uHar;": "⥣",
5798 "Uopf;": "𝕌",
5799 "uopf;": "𝕦",
5800 "Upsi;": "ϒ",
5801 "upsi;": "υ",
5802 "Uscr;": "𝒰",
5803 "uscr;": "𝓊",
5804 "utri;": "▵",
5805 "Uuml;": "Ü",
5806 "uuml;": "ü",
5807 "vArr;": "⇕",
5808 "varr;": "↕",
5809 "Vbar;": "⫫",
5810 "vBar;": "⫨",
5811 "Vert;": "‖",
5812 "vert;": "|",
5813 "Vopf;": "𝕍",
5814 "vopf;": "𝕧",
5815 "Vscr;": "𝒱",
5816 "vscr;": "𝓋",
5817 "Wopf;": "𝕎",
5818 "wopf;": "𝕨",
5819 "Wscr;": "𝒲",
5820 "wscr;": "𝓌",
5821 "xcap;": "⋂",
5822 "xcup;": "⋃",
5823 "xmap;": "⟼",
5824 "xnis;": "⋻",
5825 "Xopf;": "𝕏",
5826 "xopf;": "𝕩",
5827 "Xscr;": "𝒳",
5828 "xscr;": "𝓍",
5829 "xvee;": "⋁",
5830 "YAcy;": "Я",
5831 "yacy;": "я",
5832 "YIcy;": "Ї",
5833 "yicy;": "ї",
5834 "Yopf;": "𝕐",
5835 "yopf;": "𝕪",
5836 "Yscr;": "𝒴",
5837 "yscr;": "𝓎",
5838 "YUcy;": "Ю",
5839 "yucy;": "ю",
5840 "Yuml;": "Ÿ",
5841 "yuml;": "ÿ",
5842 "Zdot;": "Ż",
5843 "zdot;": "ż",
5844 "Zeta;": "Ζ",
5845 "zeta;": "ζ",
5846 "ZHcy;": "Ж",
5847 "zhcy;": "ж",
5848 "Zopf;": "ℤ",
5849 "zopf;": "𝕫",
5850 "Zscr;": "𝒵",
5851 "zscr;": "𝓏",
5852 "zwnj;": "‌",
5853 Aacute: "Á",
5854 aacute: "á",
5855 "Acirc;": "Â",
5856 "acirc;": "â",
5857 "acute;": "´",
5858 "AElig;": "Æ",
5859 "aelig;": "æ",
5860 Agrave: "À",
5861 agrave: "à",
5862 "aleph;": "ℵ",
5863 "Alpha;": "Α",
5864 "alpha;": "α",
5865 "Amacr;": "Ā",
5866 "amacr;": "ā",
5867 "amalg;": "⨿",
5868 "angle;": "∠",
5869 "angrt;": "∟",
5870 "angst;": "Å",
5871 "Aogon;": "Ą",
5872 "aogon;": "ą",
5873 "Aring;": "Å",
5874 "aring;": "å",
5875 "asymp;": "≈",
5876 Atilde: "Ã",
5877 atilde: "ã",
5878 "awint;": "⨑",
5879 "bcong;": "≌",
5880 "bdquo;": "„",
5881 "bepsi;": "϶",
5882 "blank;": "␣",
5883 "blk12;": "▒",
5884 "blk14;": "░",
5885 "blk34;": "▓",
5886 "block;": "█",
5887 "boxDL;": "╗",
5888 "boxDl;": "╖",
5889 "boxdL;": "╕",
5890 "boxdl;": "┐",
5891 "boxDR;": "╔",
5892 "boxDr;": "╓",
5893 "boxdR;": "╒",
5894 "boxdr;": "┌",
5895 "boxHD;": "╦",
5896 "boxHd;": "╤",
5897 "boxhD;": "╥",
5898 "boxhd;": "┬",
5899 "boxHU;": "╩",
5900 "boxHu;": "╧",
5901 "boxhU;": "╨",
5902 "boxhu;": "┴",
5903 "boxUL;": "╝",
5904 "boxUl;": "╜",
5905 "boxuL;": "╛",
5906 "boxul;": "┘",
5907 "boxUR;": "╚",
5908 "boxUr;": "╙",
5909 "boxuR;": "╘",
5910 "boxur;": "└",
5911 "boxVH;": "╬",
5912 "boxVh;": "╫",
5913 "boxvH;": "╪",
5914 "boxvh;": "┼",
5915 "boxVL;": "╣",
5916 "boxVl;": "╢",
5917 "boxvL;": "╡",
5918 "boxvl;": "┤",
5919 "boxVR;": "╠",
5920 "boxVr;": "╟",
5921 "boxvR;": "╞",
5922 "boxvr;": "├",
5923 "Breve;": "˘",
5924 "breve;": "˘",
5925 brvbar: "¦",
5926 "bsemi;": "⁏",
5927 "bsime;": "⋍",
5928 "bsolb;": "⧅",
5929 "bumpE;": "⪮",
5930 "bumpe;": "≏",
5931 "caret;": "⁁",
5932 "caron;": "ˇ",
5933 "ccaps;": "⩍",
5934 Ccedil: "Ç",
5935 ccedil: "ç",
5936 "Ccirc;": "Ĉ",
5937 "ccirc;": "ĉ",
5938 "ccups;": "⩌",
5939 "cedil;": "¸",
5940 "check;": "✓",
5941 "clubs;": "♣",
5942 "Colon;": "∷",
5943 "colon;": ":",
5944 "comma;": ",",
5945 "crarr;": "↵",
5946 "Cross;": "⨯",
5947 "cross;": "✗",
5948 "csube;": "⫑",
5949 "csupe;": "⫒",
5950 "ctdot;": "⋯",
5951 "cuepr;": "⋞",
5952 "cuesc;": "⋟",
5953 "cupor;": "⩅",
5954 curren: "¤",
5955 "cuvee;": "⋎",
5956 "cuwed;": "⋏",
5957 "cwint;": "∱",
5958 "Dashv;": "⫤",
5959 "dashv;": "⊣",
5960 "dblac;": "˝",
5961 "ddarr;": "⇊",
5962 "Delta;": "Δ",
5963 "delta;": "δ",
5964 "dharl;": "⇃",
5965 "dharr;": "⇂",
5966 "diams;": "♦",
5967 "disin;": "⋲",
5968 divide: "÷",
5969 "doteq;": "≐",
5970 "dtdot;": "⋱",
5971 "dtrif;": "▾",
5972 "duarr;": "⇵",
5973 "duhar;": "⥯",
5974 Eacute: "É",
5975 eacute: "é",
5976 "Ecirc;": "Ê",
5977 "ecirc;": "ê",
5978 "eDDot;": "⩷",
5979 "efDot;": "≒",
5980 Egrave: "È",
5981 egrave: "è",
5982 "Emacr;": "Ē",
5983 "emacr;": "ē",
5984 "empty;": "∅",
5985 "Eogon;": "Ę",
5986 "eogon;": "ę",
5987 "eplus;": "⩱",
5988 "epsiv;": "ϵ",
5989 "eqsim;": "≂",
5990 "Equal;": "⩵",
5991 "equiv;": "≡",
5992 "erarr;": "⥱",
5993 "erDot;": "≓",
5994 "esdot;": "≐",
5995 "exist;": "∃",
5996 "fflig;": "ff",
5997 "filig;": "fi",
5998 "fjlig;": "fj",
5999 "fllig;": "fl",
6000 "fltns;": "▱",
6001 "forkv;": "⫙",
6002 frac12: "½",
6003 frac14: "¼",
6004 frac34: "¾",
6005 "frasl;": "⁄",
6006 "frown;": "⌢",
6007 "Gamma;": "Γ",
6008 "gamma;": "γ",
6009 "Gcirc;": "Ĝ",
6010 "gcirc;": "ĝ",
6011 "gescc;": "⪩",
6012 "gimel;": "ℷ",
6013 "gneqq;": "≩",
6014 "gnsim;": "⋧",
6015 "grave;": "`",
6016 "gsime;": "⪎",
6017 "gsiml;": "⪐",
6018 "gtcir;": "⩺",
6019 "gtdot;": "⋗",
6020 "Hacek;": "ˇ",
6021 "harrw;": "↭",
6022 "Hcirc;": "Ĥ",
6023 "hcirc;": "ĥ",
6024 "hoarr;": "⇿",
6025 Iacute: "Í",
6026 iacute: "í",
6027 "Icirc;": "Î",
6028 "icirc;": "î",
6029 "iexcl;": "¡",
6030 Igrave: "Ì",
6031 igrave: "ì",
6032 "iiint;": "∭",
6033 "iiota;": "℩",
6034 "IJlig;": "IJ",
6035 "ijlig;": "ij",
6036 "Imacr;": "Ī",
6037 "imacr;": "ī",
6038 "image;": "ℑ",
6039 "imath;": "ı",
6040 "imped;": "Ƶ",
6041 "infin;": "∞",
6042 "Iogon;": "Į",
6043 "iogon;": "į",
6044 "iprod;": "⨼",
6045 iquest: "¿",
6046 "isinE;": "⋹",
6047 "isins;": "⋴",
6048 "isinv;": "∈",
6049 "Iukcy;": "І",
6050 "iukcy;": "і",
6051 "Jcirc;": "Ĵ",
6052 "jcirc;": "ĵ",
6053 "jmath;": "ȷ",
6054 "Jukcy;": "Є",
6055 "jukcy;": "є",
6056 "Kappa;": "Κ",
6057 "kappa;": "κ",
6058 "lAarr;": "⇚",
6059 "langd;": "⦑",
6060 "laquo;": "«",
6061 "larrb;": "⇤",
6062 "lates;": "⪭︀",
6063 "lBarr;": "⤎",
6064 "lbarr;": "⤌",
6065 "lbbrk;": "❲",
6066 "lbrke;": "⦋",
6067 "lceil;": "⌈",
6068 "ldquo;": "“",
6069 "lescc;": "⪨",
6070 "lhard;": "↽",
6071 "lharu;": "↼",
6072 "lhblk;": "▄",
6073 "llarr;": "⇇",
6074 "lltri;": "◺",
6075 "lneqq;": "≨",
6076 "lnsim;": "⋦",
6077 "loang;": "⟬",
6078 "loarr;": "⇽",
6079 "lobrk;": "⟦",
6080 "lopar;": "⦅",
6081 "lrarr;": "⇆",
6082 "lrhar;": "⇋",
6083 "lrtri;": "⊿",
6084 "lsime;": "⪍",
6085 "lsimg;": "⪏",
6086 "lsquo;": "‘",
6087 "ltcir;": "⩹",
6088 "ltdot;": "⋖",
6089 "ltrie;": "⊴",
6090 "ltrif;": "◂",
6091 "mdash;": "—",
6092 "mDDot;": "∺",
6093 "micro;": "µ",
6094 middot: "·",
6095 "minus;": "−",
6096 "mumap;": "⊸",
6097 "nabla;": "∇",
6098 "napid;": "≋̸",
6099 "napos;": "ʼn",
6100 "natur;": "♮",
6101 "nbump;": "≎̸",
6102 "ncong;": "≇",
6103 "ndash;": "–",
6104 "neArr;": "⇗",
6105 "nearr;": "↗",
6106 "nedot;": "≐̸",
6107 "nesim;": "≂̸",
6108 "ngeqq;": "≧̸",
6109 "ngsim;": "≵",
6110 "nhArr;": "⇎",
6111 "nharr;": "↮",
6112 "nhpar;": "⫲",
6113 "nlArr;": "⇍",
6114 "nlarr;": "↚",
6115 "nleqq;": "≦̸",
6116 "nless;": "≮",
6117 "nlsim;": "≴",
6118 "nltri;": "⋪",
6119 "notin;": "∉",
6120 "notni;": "∌",
6121 "npart;": "∂̸",
6122 "nprec;": "⊀",
6123 "nrArr;": "⇏",
6124 "nrarr;": "↛",
6125 "nrtri;": "⋫",
6126 "nsime;": "≄",
6127 "nsmid;": "∤",
6128 "nspar;": "∦",
6129 "nsubE;": "⫅̸",
6130 "nsube;": "⊈",
6131 "nsucc;": "⊁",
6132 "nsupE;": "⫆̸",
6133 "nsupe;": "⊉",
6134 Ntilde: "Ñ",
6135 ntilde: "ñ",
6136 "numsp;": " ",
6137 "nvsim;": "∼⃒",
6138 "nwArr;": "⇖",
6139 "nwarr;": "↖",
6140 Oacute: "Ó",
6141 oacute: "ó",
6142 "Ocirc;": "Ô",
6143 "ocirc;": "ô",
6144 "odash;": "⊝",
6145 "OElig;": "Œ",
6146 "oelig;": "œ",
6147 "ofcir;": "⦿",
6148 Ograve: "Ò",
6149 ograve: "ò",
6150 "ohbar;": "⦵",
6151 "olarr;": "↺",
6152 "olcir;": "⦾",
6153 "oline;": "‾",
6154 "Omacr;": "Ō",
6155 "omacr;": "ō",
6156 "Omega;": "Ω",
6157 "omega;": "ω",
6158 "operp;": "⦹",
6159 "oplus;": "⊕",
6160 "orarr;": "↻",
6161 "order;": "ℴ",
6162 Oslash: "Ø",
6163 oslash: "ø",
6164 Otilde: "Õ",
6165 otilde: "õ",
6166 "ovbar;": "⌽",
6167 "parsl;": "⫽",
6168 "phone;": "☎",
6169 "plusb;": "⊞",
6170 "pluse;": "⩲",
6171 plusmn: "±",
6172 "pound;": "£",
6173 "prcue;": "≼",
6174 "Prime;": "″",
6175 "prime;": "′",
6176 "prnap;": "⪹",
6177 "prsim;": "≾",
6178 "quest;": "?",
6179 "rAarr;": "⇛",
6180 "radic;": "√",
6181 "rangd;": "⦒",
6182 "range;": "⦥",
6183 "raquo;": "»",
6184 "rarrb;": "⇥",
6185 "rarrc;": "⤳",
6186 "rarrw;": "↝",
6187 "ratio;": "∶",
6188 "RBarr;": "⤐",
6189 "rBarr;": "⤏",
6190 "rbarr;": "⤍",
6191 "rbbrk;": "❳",
6192 "rbrke;": "⦌",
6193 "rceil;": "⌉",
6194 "rdquo;": "”",
6195 "reals;": "ℝ",
6196 "rhard;": "⇁",
6197 "rharu;": "⇀",
6198 "rlarr;": "⇄",
6199 "rlhar;": "⇌",
6200 "rnmid;": "⫮",
6201 "roang;": "⟭",
6202 "roarr;": "⇾",
6203 "robrk;": "⟧",
6204 "ropar;": "⦆",
6205 "rrarr;": "⇉",
6206 "rsquo;": "’",
6207 "rtrie;": "⊵",
6208 "rtrif;": "▸",
6209 "sbquo;": "‚",
6210 "sccue;": "≽",
6211 "Scirc;": "Ŝ",
6212 "scirc;": "ŝ",
6213 "scnap;": "⪺",
6214 "scsim;": "≿",
6215 "sdotb;": "⊡",
6216 "sdote;": "⩦",
6217 "seArr;": "⇘",
6218 "searr;": "↘",
6219 "setmn;": "∖",
6220 "sharp;": "♯",
6221 "Sigma;": "Σ",
6222 "sigma;": "σ",
6223 "simeq;": "≃",
6224 "simgE;": "⪠",
6225 "simlE;": "⪟",
6226 "simne;": "≆",
6227 "slarr;": "←",
6228 "smile;": "⌣",
6229 "smtes;": "⪬︀",
6230 "sqcap;": "⊓",
6231 "sqcup;": "⊔",
6232 "sqsub;": "⊏",
6233 "sqsup;": "⊐",
6234 "srarr;": "→",
6235 "starf;": "★",
6236 "strns;": "¯",
6237 "subnE;": "⫋",
6238 "subne;": "⊊",
6239 "supnE;": "⫌",
6240 "supne;": "⊋",
6241 "swArr;": "⇙",
6242 "swarr;": "↙",
6243 "szlig;": "ß",
6244 "Theta;": "Θ",
6245 "theta;": "θ",
6246 "thkap;": "≈",
6247 "THORN;": "Þ",
6248 "thorn;": "þ",
6249 "Tilde;": "∼",
6250 "tilde;": "˜",
6251 "times;": "×",
6252 "TRADE;": "™",
6253 "trade;": "™",
6254 "trisb;": "⧍",
6255 "TSHcy;": "Ћ",
6256 "tshcy;": "ћ",
6257 "twixt;": "≬",
6258 Uacute: "Ú",
6259 uacute: "ú",
6260 "Ubrcy;": "Ў",
6261 "ubrcy;": "ў",
6262 "Ucirc;": "Û",
6263 "ucirc;": "û",
6264 "udarr;": "⇅",
6265 "udhar;": "⥮",
6266 Ugrave: "Ù",
6267 ugrave: "ù",
6268 "uharl;": "↿",
6269 "uharr;": "↾",
6270 "uhblk;": "▀",
6271 "ultri;": "◸",
6272 "Umacr;": "Ū",
6273 "umacr;": "ū",
6274 "Union;": "⋃",
6275 "Uogon;": "Ų",
6276 "uogon;": "ų",
6277 "uplus;": "⊎",
6278 "upsih;": "ϒ",
6279 "UpTee;": "⊥",
6280 "Uring;": "Ů",
6281 "uring;": "ů",
6282 "urtri;": "◹",
6283 "utdot;": "⋰",
6284 "utrif;": "▴",
6285 "uuarr;": "⇈",
6286 "varpi;": "ϖ",
6287 "vBarv;": "⫩",
6288 "VDash;": "⊫",
6289 "Vdash;": "⊩",
6290 "vDash;": "⊨",
6291 "vdash;": "⊢",
6292 "veeeq;": "≚",
6293 "vltri;": "⊲",
6294 "vnsub;": "⊂⃒",
6295 "vnsup;": "⊃⃒",
6296 "vprop;": "∝",
6297 "vrtri;": "⊳",
6298 "Wcirc;": "Ŵ",
6299 "wcirc;": "ŵ",
6300 "Wedge;": "⋀",
6301 "wedge;": "∧",
6302 "xcirc;": "◯",
6303 "xdtri;": "▽",
6304 "xhArr;": "⟺",
6305 "xharr;": "⟷",
6306 "xlArr;": "⟸",
6307 "xlarr;": "⟵",
6308 "xodot;": "⨀",
6309 "xrArr;": "⟹",
6310 "xrarr;": "⟶",
6311 "xutri;": "△",
6312 Yacute: "Ý",
6313 yacute: "ý",
6314 "Ycirc;": "Ŷ",
6315 "ycirc;": "ŷ",
6316 "Aacute;": "Á",
6317 "aacute;": "á",
6318 "Abreve;": "Ă",
6319 "abreve;": "ă",
6320 "Agrave;": "À",
6321 "agrave;": "à",
6322 "andand;": "⩕",
6323 "angmsd;": "∡",
6324 "angsph;": "∢",
6325 "apacir;": "⩯",
6326 "approx;": "≈",
6327 "Assign;": "≔",
6328 "Atilde;": "Ã",
6329 "atilde;": "ã",
6330 "barvee;": "⊽",
6331 "Barwed;": "⌆",
6332 "barwed;": "⌅",
6333 "becaus;": "∵",
6334 "bernou;": "ℬ",
6335 "bigcap;": "⋂",
6336 "bigcup;": "⋃",
6337 "bigvee;": "⋁",
6338 "bkarow;": "⤍",
6339 "bottom;": "⊥",
6340 "bowtie;": "⋈",
6341 "boxbox;": "⧉",
6342 "bprime;": "‵",
6343 "brvbar;": "¦",
6344 "bullet;": "•",
6345 "Bumpeq;": "≎",
6346 "bumpeq;": "≏",
6347 "Cacute;": "Ć",
6348 "cacute;": "ć",
6349 "capand;": "⩄",
6350 "capcap;": "⩋",
6351 "capcup;": "⩇",
6352 "capdot;": "⩀",
6353 "Ccaron;": "Č",
6354 "ccaron;": "č",
6355 "Ccedil;": "Ç",
6356 "ccedil;": "ç",
6357 "circeq;": "≗",
6358 "cirmid;": "⫯",
6359 "Colone;": "⩴",
6360 "colone;": "≔",
6361 "commat;": "@",
6362 "compfn;": "∘",
6363 "Conint;": "∯",
6364 "conint;": "∮",
6365 "coprod;": "∐",
6366 "copysr;": "℗",
6367 "cularr;": "↶",
6368 "CupCap;": "≍",
6369 "cupcap;": "⩆",
6370 "cupcup;": "⩊",
6371 "cupdot;": "⊍",
6372 "curarr;": "↷",
6373 "curren;": "¤",
6374 "cylcty;": "⌭",
6375 "Dagger;": "‡",
6376 "dagger;": "†",
6377 "daleth;": "ℸ",
6378 "Dcaron;": "Ď",
6379 "dcaron;": "ď",
6380 "dfisht;": "⥿",
6381 "divide;": "÷",
6382 "divonx;": "⋇",
6383 "dlcorn;": "⌞",
6384 "dlcrop;": "⌍",
6385 "dollar;": "$",
6386 "DotDot;": "⃜",
6387 "drcorn;": "⌟",
6388 "drcrop;": "⌌",
6389 "Dstrok;": "Đ",
6390 "dstrok;": "đ",
6391 "Eacute;": "É",
6392 "eacute;": "é",
6393 "easter;": "⩮",
6394 "Ecaron;": "Ě",
6395 "ecaron;": "ě",
6396 "ecolon;": "≕",
6397 "Egrave;": "È",
6398 "egrave;": "è",
6399 "egsdot;": "⪘",
6400 "elsdot;": "⪗",
6401 "emptyv;": "∅",
6402 "emsp13;": " ",
6403 "emsp14;": " ",
6404 "eparsl;": "⧣",
6405 "eqcirc;": "≖",
6406 "equals;": "=",
6407 "equest;": "≟",
6408 "Exists;": "∃",
6409 "female;": "♀",
6410 "ffilig;": "ffi",
6411 "ffllig;": "ffl",
6412 "ForAll;": "∀",
6413 "forall;": "∀",
6414 "frac12;": "½",
6415 "frac13;": "⅓",
6416 "frac14;": "¼",
6417 "frac15;": "⅕",
6418 "frac16;": "⅙",
6419 "frac18;": "⅛",
6420 "frac23;": "⅔",
6421 "frac25;": "⅖",
6422 "frac34;": "¾",
6423 "frac35;": "⅗",
6424 "frac38;": "⅜",
6425 "frac45;": "⅘",
6426 "frac56;": "⅚",
6427 "frac58;": "⅝",
6428 "frac78;": "⅞",
6429 "gacute;": "ǵ",
6430 "Gammad;": "Ϝ",
6431 "gammad;": "ϝ",
6432 "Gbreve;": "Ğ",
6433 "gbreve;": "ğ",
6434 "Gcedil;": "Ģ",
6435 "gesdot;": "⪀",
6436 "gesles;": "⪔",
6437 "gtlPar;": "⦕",
6438 "gtrarr;": "⥸",
6439 "gtrdot;": "⋗",
6440 "gtrsim;": "≳",
6441 "hairsp;": " ",
6442 "hamilt;": "ℋ",
6443 "HARDcy;": "Ъ",
6444 "hardcy;": "ъ",
6445 "hearts;": "♥",
6446 "hellip;": "…",
6447 "hercon;": "⊹",
6448 "homtht;": "∻",
6449 "horbar;": "―",
6450 "hslash;": "ℏ",
6451 "Hstrok;": "Ħ",
6452 "hstrok;": "ħ",
6453 "hybull;": "⁃",
6454 "hyphen;": "‐",
6455 "Iacute;": "Í",
6456 "iacute;": "í",
6457 "Igrave;": "Ì",
6458 "igrave;": "ì",
6459 "iiiint;": "⨌",
6460 "iinfin;": "⧜",
6461 "incare;": "℅",
6462 "inodot;": "ı",
6463 "intcal;": "⊺",
6464 "iquest;": "¿",
6465 "isinsv;": "⋳",
6466 "Itilde;": "Ĩ",
6467 "itilde;": "ĩ",
6468 "Jsercy;": "Ј",
6469 "jsercy;": "ј",
6470 "kappav;": "ϰ",
6471 "Kcedil;": "Ķ",
6472 "kcedil;": "ķ",
6473 "kgreen;": "ĸ",
6474 "Lacute;": "Ĺ",
6475 "lacute;": "ĺ",
6476 "lagran;": "ℒ",
6477 "Lambda;": "Λ",
6478 "lambda;": "λ",
6479 "langle;": "⟨",
6480 "larrfs;": "⤝",
6481 "larrhk;": "↩",
6482 "larrlp;": "↫",
6483 "larrpl;": "⤹",
6484 "larrtl;": "↢",
6485 "lAtail;": "⤛",
6486 "latail;": "⤙",
6487 "lbrace;": "{",
6488 "lbrack;": "[",
6489 "Lcaron;": "Ľ",
6490 "lcaron;": "ľ",
6491 "Lcedil;": "Ļ",
6492 "lcedil;": "ļ",
6493 "ldquor;": "„",
6494 "lesdot;": "⩿",
6495 "lesges;": "⪓",
6496 "lfisht;": "⥼",
6497 "lfloor;": "⌊",
6498 "lharul;": "⥪",
6499 "llhard;": "⥫",
6500 "Lmidot;": "Ŀ",
6501 "lmidot;": "ŀ",
6502 "lmoust;": "⎰",
6503 "loplus;": "⨭",
6504 "lowast;": "∗",
6505 "lowbar;": "_",
6506 "lparlt;": "⦓",
6507 "lrhard;": "⥭",
6508 "lsaquo;": "‹",
6509 "lsquor;": "‚",
6510 "Lstrok;": "Ł",
6511 "lstrok;": "ł",
6512 "lthree;": "⋋",
6513 "ltimes;": "⋉",
6514 "ltlarr;": "⥶",
6515 "ltrPar;": "⦖",
6516 "mapsto;": "↦",
6517 "marker;": "▮",
6518 "mcomma;": "⨩",
6519 "midast;": "*",
6520 "midcir;": "⫰",
6521 "middot;": "·",
6522 "minusb;": "⊟",
6523 "minusd;": "∸",
6524 "mnplus;": "∓",
6525 "models;": "⊧",
6526 "mstpos;": "∾",
6527 "Nacute;": "Ń",
6528 "nacute;": "ń",
6529 "nbumpe;": "≏̸",
6530 "Ncaron;": "Ň",
6531 "ncaron;": "ň",
6532 "Ncedil;": "Ņ",
6533 "ncedil;": "ņ",
6534 "nearhk;": "⤤",
6535 "nequiv;": "≢",
6536 "nesear;": "⤨",
6537 "nexist;": "∄",
6538 "nltrie;": "⋬",
6539 "notinE;": "⋹̸",
6540 "nparsl;": "⫽⃥",
6541 "nprcue;": "⋠",
6542 "nrarrc;": "⤳̸",
6543 "nrarrw;": "↝̸",
6544 "nrtrie;": "⋭",
6545 "nsccue;": "⋡",
6546 "nsimeq;": "≄",
6547 "Ntilde;": "Ñ",
6548 "ntilde;": "ñ",
6549 "numero;": "№",
6550 "nVDash;": "⊯",
6551 "nVdash;": "⊮",
6552 "nvDash;": "⊭",
6553 "nvdash;": "⊬",
6554 "nvHarr;": "⤄",
6555 "nvlArr;": "⤂",
6556 "nvrArr;": "⤃",
6557 "nwarhk;": "⤣",
6558 "nwnear;": "⤧",
6559 "Oacute;": "Ó",
6560 "oacute;": "ó",
6561 "Odblac;": "Ő",
6562 "odblac;": "ő",
6563 "odsold;": "⦼",
6564 "Ograve;": "Ò",
6565 "ograve;": "ò",
6566 "ominus;": "⊖",
6567 "origof;": "⊶",
6568 "Oslash;": "Ø",
6569 "oslash;": "ø",
6570 "Otilde;": "Õ",
6571 "otilde;": "õ",
6572 "Otimes;": "⨷",
6573 "otimes;": "⊗",
6574 "parsim;": "⫳",
6575 "percnt;": "%",
6576 "period;": ".",
6577 "permil;": "‰",
6578 "phmmat;": "ℳ",
6579 "planck;": "ℏ",
6580 "plankv;": "ℏ",
6581 "plusdo;": "∔",
6582 "plusdu;": "⨥",
6583 "plusmn;": "±",
6584 "preceq;": "⪯",
6585 "primes;": "ℙ",
6586 "prnsim;": "⋨",
6587 "propto;": "∝",
6588 "prurel;": "⊰",
6589 "puncsp;": " ",
6590 "qprime;": "⁗",
6591 "Racute;": "Ŕ",
6592 "racute;": "ŕ",
6593 "rangle;": "⟩",
6594 "rarrap;": "⥵",
6595 "rarrfs;": "⤞",
6596 "rarrhk;": "↪",
6597 "rarrlp;": "↬",
6598 "rarrpl;": "⥅",
6599 "Rarrtl;": "⤖",
6600 "rarrtl;": "↣",
6601 "rAtail;": "⤜",
6602 "ratail;": "⤚",
6603 "rbrace;": "}",
6604 "rbrack;": "]",
6605 "Rcaron;": "Ř",
6606 "rcaron;": "ř",
6607 "Rcedil;": "Ŗ",
6608 "rcedil;": "ŗ",
6609 "rdquor;": "”",
6610 "rfisht;": "⥽",
6611 "rfloor;": "⌋",
6612 "rharul;": "⥬",
6613 "rmoust;": "⎱",
6614 "roplus;": "⨮",
6615 "rpargt;": "⦔",
6616 "rsaquo;": "›",
6617 "rsquor;": "’",
6618 "rthree;": "⋌",
6619 "rtimes;": "⋊",
6620 "Sacute;": "Ś",
6621 "sacute;": "ś",
6622 "Scaron;": "Š",
6623 "scaron;": "š",
6624 "Scedil;": "Ş",
6625 "scedil;": "ş",
6626 "scnsim;": "⋩",
6627 "searhk;": "⤥",
6628 "seswar;": "⤩",
6629 "sfrown;": "⌢",
6630 "SHCHcy;": "Щ",
6631 "shchcy;": "щ",
6632 "sigmaf;": "ς",
6633 "sigmav;": "ς",
6634 "simdot;": "⩪",
6635 "smashp;": "⨳",
6636 "SOFTcy;": "Ь",
6637 "softcy;": "ь",
6638 "solbar;": "⌿",
6639 "spades;": "♠",
6640 "sqcaps;": "⊓︀",
6641 "sqcups;": "⊔︀",
6642 "sqsube;": "⊑",
6643 "sqsupe;": "⊒",
6644 "Square;": "□",
6645 "square;": "□",
6646 "squarf;": "▪",
6647 "ssetmn;": "∖",
6648 "ssmile;": "⌣",
6649 "sstarf;": "⋆",
6650 "subdot;": "⪽",
6651 "Subset;": "⋐",
6652 "subset;": "⊂",
6653 "subsim;": "⫇",
6654 "subsub;": "⫕",
6655 "subsup;": "⫓",
6656 "succeq;": "⪰",
6657 "supdot;": "⪾",
6658 "Supset;": "⋑",
6659 "supset;": "⊃",
6660 "supsim;": "⫈",
6661 "supsub;": "⫔",
6662 "supsup;": "⫖",
6663 "swarhk;": "⤦",
6664 "swnwar;": "⤪",
6665 "target;": "⌖",
6666 "Tcaron;": "Ť",
6667 "tcaron;": "ť",
6668 "Tcedil;": "Ţ",
6669 "tcedil;": "ţ",
6670 "telrec;": "⌕",
6671 "there4;": "∴",
6672 "thetav;": "ϑ",
6673 "thinsp;": " ",
6674 "thksim;": "∼",
6675 "timesb;": "⊠",
6676 "timesd;": "⨰",
6677 "topbot;": "⌶",
6678 "topcir;": "⫱",
6679 "tprime;": "‴",
6680 "tridot;": "◬",
6681 "Tstrok;": "Ŧ",
6682 "tstrok;": "ŧ",
6683 "Uacute;": "Ú",
6684 "uacute;": "ú",
6685 "Ubreve;": "Ŭ",
6686 "ubreve;": "ŭ",
6687 "Udblac;": "Ű",
6688 "udblac;": "ű",
6689 "ufisht;": "⥾",
6690 "Ugrave;": "Ù",
6691 "ugrave;": "ù",
6692 "ulcorn;": "⌜",
6693 "ulcrop;": "⌏",
6694 "urcorn;": "⌝",
6695 "urcrop;": "⌎",
6696 "Utilde;": "Ũ",
6697 "utilde;": "ũ",
6698 "vangrt;": "⦜",
6699 "varphi;": "ϕ",
6700 "varrho;": "ϱ",
6701 "Vdashl;": "⫦",
6702 "veebar;": "⊻",
6703 "vellip;": "⋮",
6704 "Verbar;": "‖",
6705 "verbar;": "|",
6706 "vsubnE;": "⫋︀",
6707 "vsubne;": "⊊︀",
6708 "vsupnE;": "⫌︀",
6709 "vsupne;": "⊋︀",
6710 "Vvdash;": "⊪",
6711 "wedbar;": "⩟",
6712 "wedgeq;": "≙",
6713 "weierp;": "℘",
6714 "wreath;": "≀",
6715 "xoplus;": "⨁",
6716 "xotime;": "⨂",
6717 "xsqcup;": "⨆",
6718 "xuplus;": "⨄",
6719 "xwedge;": "⋀",
6720 "Yacute;": "Ý",
6721 "yacute;": "ý",
6722 "Zacute;": "Ź",
6723 "zacute;": "ź",
6724 "Zcaron;": "Ž",
6725 "zcaron;": "ž",
6726 "zeetrf;": "ℨ",
6727 "alefsym;": "ℵ",
6728 "angrtvb;": "⊾",
6729 "angzarr;": "⍼",
6730 "asympeq;": "≍",
6731 "backsim;": "∽",
6732 "Because;": "∵",
6733 "because;": "∵",
6734 "bemptyv;": "⦰",
6735 "between;": "≬",
6736 "bigcirc;": "◯",
6737 "bigodot;": "⨀",
6738 "bigstar;": "★",
6739 "bnequiv;": "≡⃥",
6740 "boxplus;": "⊞",
6741 "Cayleys;": "ℭ",
6742 "Cconint;": "∰",
6743 "ccupssm;": "⩐",
6744 "Cedilla;": "¸",
6745 "cemptyv;": "⦲",
6746 "cirscir;": "⧂",
6747 "coloneq;": "≔",
6748 "congdot;": "⩭",
6749 "cudarrl;": "⤸",
6750 "cudarrr;": "⤵",
6751 "cularrp;": "⤽",
6752 "curarrm;": "⤼",
6753 "dbkarow;": "⤏",
6754 "ddagger;": "‡",
6755 "ddotseq;": "⩷",
6756 "demptyv;": "⦱",
6757 "Diamond;": "⋄",
6758 "diamond;": "⋄",
6759 "digamma;": "ϝ",
6760 "dotplus;": "∔",
6761 "DownTee;": "⊤",
6762 "dwangle;": "⦦",
6763 "Element;": "∈",
6764 "Epsilon;": "Ε",
6765 "epsilon;": "ε",
6766 "eqcolon;": "≕",
6767 "equivDD;": "⩸",
6768 "gesdoto;": "⪂",
6769 "gtquest;": "⩼",
6770 "gtrless;": "≷",
6771 "harrcir;": "⥈",
6772 "Implies;": "⇒",
6773 "intprod;": "⨼",
6774 "isindot;": "⋵",
6775 "larrbfs;": "⤟",
6776 "larrsim;": "⥳",
6777 "lbrksld;": "⦏",
6778 "lbrkslu;": "⦍",
6779 "ldrdhar;": "⥧",
6780 "LeftTee;": "⊣",
6781 "lesdoto;": "⪁",
6782 "lessdot;": "⋖",
6783 "lessgtr;": "≶",
6784 "lesssim;": "≲",
6785 "lotimes;": "⨴",
6786 "lozenge;": "◊",
6787 "ltquest;": "⩻",
6788 "luruhar;": "⥦",
6789 "maltese;": "✠",
6790 "minusdu;": "⨪",
6791 "napprox;": "≉",
6792 "natural;": "♮",
6793 "nearrow;": "↗",
6794 "NewLine;": "\n",
6795 "nexists;": "∄",
6796 "NoBreak;": "⁠",
6797 "notinva;": "∉",
6798 "notinvb;": "⋷",
6799 "notinvc;": "⋶",
6800 "NotLess;": "≮",
6801 "notniva;": "∌",
6802 "notnivb;": "⋾",
6803 "notnivc;": "⋽",
6804 "npolint;": "⨔",
6805 "npreceq;": "⪯̸",
6806 "nsqsube;": "⋢",
6807 "nsqsupe;": "⋣",
6808 "nsubset;": "⊂⃒",
6809 "nsucceq;": "⪰̸",
6810 "nsupset;": "⊃⃒",
6811 "nvinfin;": "⧞",
6812 "nvltrie;": "⊴⃒",
6813 "nvrtrie;": "⊵⃒",
6814 "nwarrow;": "↖",
6815 "olcross;": "⦻",
6816 "Omicron;": "Ο",
6817 "omicron;": "ο",
6818 "orderof;": "ℴ",
6819 "orslope;": "⩗",
6820 "OverBar;": "‾",
6821 "pertenk;": "‱",
6822 "planckh;": "ℎ",
6823 "pluscir;": "⨢",
6824 "plussim;": "⨦",
6825 "plustwo;": "⨧",
6826 "precsim;": "≾",
6827 "Product;": "∏",
6828 "quatint;": "⨖",
6829 "questeq;": "≟",
6830 "rarrbfs;": "⤠",
6831 "rarrsim;": "⥴",
6832 "rbrksld;": "⦎",
6833 "rbrkslu;": "⦐",
6834 "rdldhar;": "⥩",
6835 "realine;": "ℛ",
6836 "rotimes;": "⨵",
6837 "ruluhar;": "⥨",
6838 "searrow;": "↘",
6839 "simplus;": "⨤",
6840 "simrarr;": "⥲",
6841 "subedot;": "⫃",
6842 "submult;": "⫁",
6843 "subplus;": "⪿",
6844 "subrarr;": "⥹",
6845 "succsim;": "≿",
6846 "supdsub;": "⫘",
6847 "supedot;": "⫄",
6848 "suphsol;": "⟉",
6849 "suphsub;": "⫗",
6850 "suplarr;": "⥻",
6851 "supmult;": "⫂",
6852 "supplus;": "⫀",
6853 "swarrow;": "↙",
6854 "topfork;": "⫚",
6855 "triplus;": "⨹",
6856 "tritime;": "⨻",
6857 "UpArrow;": "↑",
6858 "Uparrow;": "⇑",
6859 "uparrow;": "↑",
6860 "Upsilon;": "Υ",
6861 "upsilon;": "υ",
6862 "uwangle;": "⦧",
6863 "vzigzag;": "⦚",
6864 "zigrarr;": "⇝",
6865 "andslope;": "⩘",
6866 "angmsdaa;": "⦨",
6867 "angmsdab;": "⦩",
6868 "angmsdac;": "⦪",
6869 "angmsdad;": "⦫",
6870 "angmsdae;": "⦬",
6871 "angmsdaf;": "⦭",
6872 "angmsdag;": "⦮",
6873 "angmsdah;": "⦯",
6874 "angrtvbd;": "⦝",
6875 "approxeq;": "≊",
6876 "awconint;": "∳",
6877 "backcong;": "≌",
6878 "barwedge;": "⌅",
6879 "bbrktbrk;": "⎶",
6880 "bigoplus;": "⨁",
6881 "bigsqcup;": "⨆",
6882 "biguplus;": "⨄",
6883 "bigwedge;": "⋀",
6884 "boxminus;": "⊟",
6885 "boxtimes;": "⊠",
6886 "bsolhsub;": "⟈",
6887 "capbrcup;": "⩉",
6888 "circledR;": "®",
6889 "circledS;": "Ⓢ",
6890 "cirfnint;": "⨐",
6891 "clubsuit;": "♣",
6892 "cupbrcap;": "⩈",
6893 "curlyvee;": "⋎",
6894 "cwconint;": "∲",
6895 "DDotrahd;": "⤑",
6896 "doteqdot;": "≑",
6897 "DotEqual;": "≐",
6898 "dotminus;": "∸",
6899 "drbkarow;": "⤐",
6900 "dzigrarr;": "⟿",
6901 "elinters;": "⏧",
6902 "emptyset;": "∅",
6903 "eqvparsl;": "⧥",
6904 "fpartint;": "⨍",
6905 "geqslant;": "⩾",
6906 "gesdotol;": "⪄",
6907 "gnapprox;": "⪊",
6908 "hksearow;": "⤥",
6909 "hkswarow;": "⤦",
6910 "imagline;": "ℐ",
6911 "imagpart;": "ℑ",
6912 "infintie;": "⧝",
6913 "integers;": "ℤ",
6914 "Integral;": "∫",
6915 "intercal;": "⊺",
6916 "intlarhk;": "⨗",
6917 "laemptyv;": "⦴",
6918 "ldrushar;": "⥋",
6919 "leqslant;": "⩽",
6920 "lesdotor;": "⪃",
6921 "LessLess;": "⪡",
6922 "llcorner;": "⌞",
6923 "lnapprox;": "⪉",
6924 "lrcorner;": "⌟",
6925 "lurdshar;": "⥊",
6926 "mapstoup;": "↥",
6927 "multimap;": "⊸",
6928 "naturals;": "ℕ",
6929 "ncongdot;": "⩭̸",
6930 "NotEqual;": "≠",
6931 "notindot;": "⋵̸",
6932 "NotTilde;": "≁",
6933 "otimesas;": "⨶",
6934 "parallel;": "∥",
6935 "PartialD;": "∂",
6936 "plusacir;": "⨣",
6937 "pointint;": "⨕",
6938 "Precedes;": "≺",
6939 "precneqq;": "⪵",
6940 "precnsim;": "⋨",
6941 "profalar;": "⌮",
6942 "profline;": "⌒",
6943 "profsurf;": "⌓",
6944 "raemptyv;": "⦳",
6945 "realpart;": "ℜ",
6946 "RightTee;": "⊢",
6947 "rppolint;": "⨒",
6948 "rtriltri;": "⧎",
6949 "scpolint;": "⨓",
6950 "setminus;": "∖",
6951 "shortmid;": "∣",
6952 "smeparsl;": "⧤",
6953 "sqsubset;": "⊏",
6954 "sqsupset;": "⊐",
6955 "subseteq;": "⊆",
6956 "Succeeds;": "≻",
6957 "succneqq;": "⪶",
6958 "succnsim;": "⋩",
6959 "SuchThat;": "∋",
6960 "Superset;": "⊃",
6961 "supseteq;": "⊇",
6962 "thetasym;": "ϑ",
6963 "thicksim;": "∼",
6964 "timesbar;": "⨱",
6965 "triangle;": "▵",
6966 "triminus;": "⨺",
6967 "trpezium;": "⏢",
6968 "Uarrocir;": "⥉",
6969 "ulcorner;": "⌜",
6970 "UnderBar;": "_",
6971 "urcorner;": "⌝",
6972 "varkappa;": "ϰ",
6973 "varsigma;": "ς",
6974 "vartheta;": "ϑ",
6975 "backprime;": "‵",
6976 "backsimeq;": "⋍",
6977 "Backslash;": "∖",
6978 "bigotimes;": "⨂",
6979 "CenterDot;": "·",
6980 "centerdot;": "·",
6981 "checkmark;": "✓",
6982 "CircleDot;": "⊙",
6983 "complexes;": "ℂ",
6984 "Congruent;": "≡",
6985 "Coproduct;": "∐",
6986 "dotsquare;": "⊡",
6987 "DoubleDot;": "¨",
6988 "DownArrow;": "↓",
6989 "Downarrow;": "⇓",
6990 "downarrow;": "↓",
6991 "DownBreve;": "̑",
6992 "gtrapprox;": "⪆",
6993 "gtreqless;": "⋛",
6994 "gvertneqq;": "≩︀",
6995 "heartsuit;": "♥",
6996 "HumpEqual;": "≏",
6997 "LeftArrow;": "←",
6998 "Leftarrow;": "⇐",
6999 "leftarrow;": "←",
7000 "LeftFloor;": "⌊",
7001 "lesseqgtr;": "⋚",
7002 "LessTilde;": "≲",
7003 "lvertneqq;": "≨︀",
7004 "Mellintrf;": "ℳ",
7005 "MinusPlus;": "∓",
7006 "ngeqslant;": "⩾̸",
7007 "nleqslant;": "⩽̸",
7008 "NotCupCap;": "≭",
7009 "NotExists;": "∄",
7010 "NotSubset;": "⊂⃒",
7011 "nparallel;": "∦",
7012 "nshortmid;": "∤",
7013 "nsubseteq;": "⊈",
7014 "nsupseteq;": "⊉",
7015 "OverBrace;": "⏞",
7016 "pitchfork;": "⋔",
7017 "PlusMinus;": "±",
7018 "rationals;": "ℚ",
7019 "spadesuit;": "♠",
7020 "subseteqq;": "⫅",
7021 "subsetneq;": "⊊",
7022 "supseteqq;": "⫆",
7023 "supsetneq;": "⊋",
7024 "Therefore;": "∴",
7025 "therefore;": "∴",
7026 "ThinSpace;": " ",
7027 "triangleq;": "≜",
7028 "TripleDot;": "⃛",
7029 "UnionPlus;": "⊎",
7030 "varpropto;": "∝",
7031 "Bernoullis;": "ℬ",
7032 "circledast;": "⊛",
7033 "CirclePlus;": "⊕",
7034 "complement;": "∁",
7035 "curlywedge;": "⋏",
7036 "eqslantgtr;": "⪖",
7037 "EqualTilde;": "≂",
7038 "Fouriertrf;": "ℱ",
7039 "gtreqqless;": "⪌",
7040 "ImaginaryI;": "ⅈ",
7041 "Laplacetrf;": "ℒ",
7042 "LeftVector;": "↼",
7043 "lessapprox;": "⪅",
7044 "lesseqqgtr;": "⪋",
7045 "Lleftarrow;": "⇚",
7046 "lmoustache;": "⎰",
7047 "longmapsto;": "⟼",
7048 "mapstodown;": "↧",
7049 "mapstoleft;": "↤",
7050 "nLeftarrow;": "⇍",
7051 "nleftarrow;": "↚",
7052 "NotElement;": "∉",
7053 "NotGreater;": "≯",
7054 "nsubseteqq;": "⫅̸",
7055 "nsupseteqq;": "⫆̸",
7056 "precapprox;": "⪷",
7057 "Proportion;": "∷",
7058 "RightArrow;": "→",
7059 "Rightarrow;": "⇒",
7060 "rightarrow;": "→",
7061 "RightFloor;": "⌋",
7062 "rmoustache;": "⎱",
7063 "sqsubseteq;": "⊑",
7064 "sqsupseteq;": "⊒",
7065 "subsetneqq;": "⫋",
7066 "succapprox;": "⪸",
7067 "supsetneqq;": "⫌",
7068 "ThickSpace;": "  ",
7069 "TildeEqual;": "≃",
7070 "TildeTilde;": "≈",
7071 "UnderBrace;": "⏟",
7072 "UpArrowBar;": "⤒",
7073 "UpTeeArrow;": "↥",
7074 "upuparrows;": "⇈",
7075 "varepsilon;": "ϵ",
7076 "varnothing;": "∅",
7077 "backepsilon;": "϶",
7078 "blacksquare;": "▪",
7079 "circledcirc;": "⊚",
7080 "circleddash;": "⊝",
7081 "CircleMinus;": "⊖",
7082 "CircleTimes;": "⊗",
7083 "curlyeqprec;": "⋞",
7084 "curlyeqsucc;": "⋟",
7085 "diamondsuit;": "♦",
7086 "eqslantless;": "⪕",
7087 "Equilibrium;": "⇌",
7088 "expectation;": "ℰ",
7089 "GreaterLess;": "≷",
7090 "LeftCeiling;": "⌈",
7091 "LessGreater;": "≶",
7092 "MediumSpace;": " ",
7093 "NotLessLess;": "≪̸",
7094 "NotPrecedes;": "⊀",
7095 "NotSucceeds;": "⊁",
7096 "NotSuperset;": "⊃⃒",
7097 "nRightarrow;": "⇏",
7098 "nrightarrow;": "↛",
7099 "OverBracket;": "⎴",
7100 "preccurlyeq;": "≼",
7101 "precnapprox;": "⪹",
7102 "quaternions;": "ℍ",
7103 "RightVector;": "⇀",
7104 "Rrightarrow;": "⇛",
7105 "RuleDelayed;": "⧴",
7106 "SmallCircle;": "∘",
7107 "SquareUnion;": "⊔",
7108 "straightphi;": "ϕ",
7109 "SubsetEqual;": "⊆",
7110 "succcurlyeq;": "≽",
7111 "succnapprox;": "⪺",
7112 "thickapprox;": "≈",
7113 "UpDownArrow;": "↕",
7114 "Updownarrow;": "⇕",
7115 "updownarrow;": "↕",
7116 "VerticalBar;": "∣",
7117 "blacklozenge;": "⧫",
7118 "DownArrowBar;": "⤓",
7119 "DownTeeArrow;": "↧",
7120 "ExponentialE;": "ⅇ",
7121 "exponentiale;": "ⅇ",
7122 "GreaterEqual;": "≥",
7123 "GreaterTilde;": "≳",
7124 "HilbertSpace;": "ℋ",
7125 "HumpDownHump;": "≎",
7126 "Intersection;": "⋂",
7127 "LeftArrowBar;": "⇤",
7128 "LeftTeeArrow;": "↤",
7129 "LeftTriangle;": "⊲",
7130 "LeftUpVector;": "↿",
7131 "NotCongruent;": "≢",
7132 "NotHumpEqual;": "≏̸",
7133 "NotLessEqual;": "≰",
7134 "NotLessTilde;": "≴",
7135 "Proportional;": "∝",
7136 "RightCeiling;": "⌉",
7137 "risingdotseq;": "≓",
7138 "RoundImplies;": "⥰",
7139 "ShortUpArrow;": "↑",
7140 "SquareSubset;": "⊏",
7141 "triangledown;": "▿",
7142 "triangleleft;": "◃",
7143 "UnderBracket;": "⎵",
7144 "varsubsetneq;": "⊊︀",
7145 "varsupsetneq;": "⊋︀",
7146 "VerticalLine;": "|",
7147 "ApplyFunction;": "⁡",
7148 "bigtriangleup;": "△",
7149 "blacktriangle;": "▴",
7150 "DifferentialD;": "ⅆ",
7151 "divideontimes;": "⋇",
7152 "DoubleLeftTee;": "⫤",
7153 "DoubleUpArrow;": "⇑",
7154 "fallingdotseq;": "≒",
7155 "hookleftarrow;": "↩",
7156 "leftarrowtail;": "↢",
7157 "leftharpoonup;": "↼",
7158 "LeftTeeVector;": "⥚",
7159 "LeftVectorBar;": "⥒",
7160 "LessFullEqual;": "≦",
7161 "LongLeftArrow;": "⟵",
7162 "Longleftarrow;": "⟸",
7163 "longleftarrow;": "⟵",
7164 "looparrowleft;": "↫",
7165 "measuredangle;": "∡",
7166 "NotEqualTilde;": "≂̸",
7167 "NotTildeEqual;": "≄",
7168 "NotTildeTilde;": "≉",
7169 "ntriangleleft;": "⋪",
7170 "Poincareplane;": "ℌ",
7171 "PrecedesEqual;": "⪯",
7172 "PrecedesTilde;": "≾",
7173 "RightArrowBar;": "⇥",
7174 "RightTeeArrow;": "↦",
7175 "RightTriangle;": "⊳",
7176 "RightUpVector;": "↾",
7177 "shortparallel;": "∥",
7178 "smallsetminus;": "∖",
7179 "SucceedsEqual;": "⪰",
7180 "SucceedsTilde;": "≿",
7181 "SupersetEqual;": "⊇",
7182 "triangleright;": "▹",
7183 "UpEquilibrium;": "⥮",
7184 "upharpoonleft;": "↿",
7185 "varsubsetneqq;": "⫋︀",
7186 "varsupsetneqq;": "⫌︀",
7187 "VerticalTilde;": "≀",
7188 "VeryThinSpace;": " ",
7189 "curvearrowleft;": "↶",
7190 "DiacriticalDot;": "˙",
7191 "doublebarwedge;": "⌆",
7192 "DoubleRightTee;": "⊨",
7193 "downdownarrows;": "⇊",
7194 "DownLeftVector;": "↽",
7195 "GreaterGreater;": "⪢",
7196 "hookrightarrow;": "↪",
7197 "HorizontalLine;": "─",
7198 "InvisibleComma;": "⁣",
7199 "InvisibleTimes;": "⁢",
7200 "LeftDownVector;": "⇃",
7201 "leftleftarrows;": "⇇",
7202 "LeftRightArrow;": "↔",
7203 "Leftrightarrow;": "⇔",
7204 "leftrightarrow;": "↔",
7205 "leftthreetimes;": "⋋",
7206 "LessSlantEqual;": "⩽",
7207 "LongRightArrow;": "⟶",
7208 "Longrightarrow;": "⟹",
7209 "longrightarrow;": "⟶",
7210 "looparrowright;": "↬",
7211 "LowerLeftArrow;": "↙",
7212 "NestedLessLess;": "≪",
7213 "NotGreaterLess;": "≹",
7214 "NotLessGreater;": "≸",
7215 "NotSubsetEqual;": "⊈",
7216 "NotVerticalBar;": "∤",
7217 "nshortparallel;": "∦",
7218 "ntriangleright;": "⋫",
7219 "OpenCurlyQuote;": "‘",
7220 "ReverseElement;": "∋",
7221 "rightarrowtail;": "↣",
7222 "rightharpoonup;": "⇀",
7223 "RightTeeVector;": "⥛",
7224 "RightVectorBar;": "⥓",
7225 "ShortDownArrow;": "↓",
7226 "ShortLeftArrow;": "←",
7227 "SquareSuperset;": "⊐",
7228 "TildeFullEqual;": "≅",
7229 "trianglelefteq;": "⊴",
7230 "upharpoonright;": "↾",
7231 "UpperLeftArrow;": "↖",
7232 "ZeroWidthSpace;": "​",
7233 "bigtriangledown;": "▽",
7234 "circlearrowleft;": "↺",
7235 "CloseCurlyQuote;": "’",
7236 "ContourIntegral;": "∮",
7237 "curvearrowright;": "↷",
7238 "DoubleDownArrow;": "⇓",
7239 "DoubleLeftArrow;": "⇐",
7240 "downharpoonleft;": "⇃",
7241 "DownRightVector;": "⇁",
7242 "leftharpoondown;": "↽",
7243 "leftrightarrows;": "⇆",
7244 "LeftRightVector;": "⥎",
7245 "LeftTriangleBar;": "⧏",
7246 "LeftUpTeeVector;": "⥠",
7247 "LeftUpVectorBar;": "⥘",
7248 "LowerRightArrow;": "↘",
7249 "nLeftrightarrow;": "⇎",
7250 "nleftrightarrow;": "↮",
7251 "NotGreaterEqual;": "≱",
7252 "NotGreaterTilde;": "≵",
7253 "NotHumpDownHump;": "≎̸",
7254 "NotLeftTriangle;": "⋪",
7255 "NotSquareSubset;": "⊏̸",
7256 "ntrianglelefteq;": "⋬",
7257 "OverParenthesis;": "⏜",
7258 "RightDownVector;": "⇂",
7259 "rightleftarrows;": "⇄",
7260 "rightsquigarrow;": "↝",
7261 "rightthreetimes;": "⋌",
7262 "ShortRightArrow;": "→",
7263 "straightepsilon;": "ϵ",
7264 "trianglerighteq;": "⊵",
7265 "UpperRightArrow;": "↗",
7266 "vartriangleleft;": "⊲",
7267 "circlearrowright;": "↻",
7268 "DiacriticalAcute;": "´",
7269 "DiacriticalGrave;": "`",
7270 "DiacriticalTilde;": "˜",
7271 "DoubleRightArrow;": "⇒",
7272 "DownArrowUpArrow;": "⇵",
7273 "downharpoonright;": "⇂",
7274 "EmptySmallSquare;": "◻",
7275 "GreaterEqualLess;": "⋛",
7276 "GreaterFullEqual;": "≧",
7277 "LeftAngleBracket;": "⟨",
7278 "LeftUpDownVector;": "⥑",
7279 "LessEqualGreater;": "⋚",
7280 "NonBreakingSpace;": " ",
7281 "NotPrecedesEqual;": "⪯̸",
7282 "NotRightTriangle;": "⋫",
7283 "NotSucceedsEqual;": "⪰̸",
7284 "NotSucceedsTilde;": "≿̸",
7285 "NotSupersetEqual;": "⊉",
7286 "ntrianglerighteq;": "⋭",
7287 "rightharpoondown;": "⇁",
7288 "rightrightarrows;": "⇉",
7289 "RightTriangleBar;": "⧐",
7290 "RightUpTeeVector;": "⥜",
7291 "RightUpVectorBar;": "⥔",
7292 "twoheadleftarrow;": "↞",
7293 "UnderParenthesis;": "⏝",
7294 "UpArrowDownArrow;": "⇅",
7295 "vartriangleright;": "⊳",
7296 "blacktriangledown;": "▾",
7297 "blacktriangleleft;": "◂",
7298 "DoubleUpDownArrow;": "⇕",
7299 "DoubleVerticalBar;": "∥",
7300 "DownLeftTeeVector;": "⥞",
7301 "DownLeftVectorBar;": "⥖",
7302 "FilledSmallSquare;": "◼",
7303 "GreaterSlantEqual;": "⩾",
7304 "LeftDoubleBracket;": "⟦",
7305 "LeftDownTeeVector;": "⥡",
7306 "LeftDownVectorBar;": "⥙",
7307 "leftrightharpoons;": "⇋",
7308 "LeftTriangleEqual;": "⊴",
7309 "NegativeThinSpace;": "​",
7310 "NotGreaterGreater;": "≫̸",
7311 "NotLessSlantEqual;": "⩽̸",
7312 "NotNestedLessLess;": "⪡̸",
7313 "NotReverseElement;": "∌",
7314 "NotSquareSuperset;": "⊐̸",
7315 "NotTildeFullEqual;": "≇",
7316 "RightAngleBracket;": "⟩",
7317 "rightleftharpoons;": "⇌",
7318 "RightUpDownVector;": "⥏",
7319 "SquareSubsetEqual;": "⊑",
7320 "twoheadrightarrow;": "↠",
7321 "VerticalSeparator;": "❘",
7322 "blacktriangleright;": "▸",
7323 "DownRightTeeVector;": "⥟",
7324 "DownRightVectorBar;": "⥗",
7325 "LongLeftRightArrow;": "⟷",
7326 "Longleftrightarrow;": "⟺",
7327 "longleftrightarrow;": "⟷",
7328 "NegativeThickSpace;": "​",
7329 "NotLeftTriangleBar;": "⧏̸",
7330 "PrecedesSlantEqual;": "≼",
7331 "ReverseEquilibrium;": "⇋",
7332 "RightDoubleBracket;": "⟧",
7333 "RightDownTeeVector;": "⥝",
7334 "RightDownVectorBar;": "⥕",
7335 "RightTriangleEqual;": "⊵",
7336 "SquareIntersection;": "⊓",
7337 "SucceedsSlantEqual;": "≽",
7338 "DoubleLongLeftArrow;": "⟸",
7339 "DownLeftRightVector;": "⥐",
7340 "LeftArrowRightArrow;": "⇆",
7341 "leftrightsquigarrow;": "↭",
7342 "NegativeMediumSpace;": "​",
7343 "NotGreaterFullEqual;": "≧̸",
7344 "NotRightTriangleBar;": "⧐̸",
7345 "RightArrowLeftArrow;": "⇄",
7346 "SquareSupersetEqual;": "⊒",
7347 "CapitalDifferentialD;": "ⅅ",
7348 "DoubleLeftRightArrow;": "⇔",
7349 "DoubleLongRightArrow;": "⟹",
7350 "EmptyVerySmallSquare;": "▫",
7351 "NestedGreaterGreater;": "≫",
7352 "NotDoubleVerticalBar;": "∦",
7353 "NotGreaterSlantEqual;": "⩾̸",
7354 "NotLeftTriangleEqual;": "⋬",
7355 "NotSquareSubsetEqual;": "⋢",
7356 "OpenCurlyDoubleQuote;": "“",
7357 "ReverseUpEquilibrium;": "⥯",
7358 "CloseCurlyDoubleQuote;": "”",
7359 "DoubleContourIntegral;": "∯",
7360 "FilledVerySmallSquare;": "▪",
7361 "NegativeVeryThinSpace;": "​",
7362 "NotPrecedesSlantEqual;": "⋠",
7363 "NotRightTriangleEqual;": "⋭",
7364 "NotSucceedsSlantEqual;": "⋡",
7365 "DiacriticalDoubleAcute;": "˝",
7366 "NotSquareSupersetEqual;": "⋣",
7367 "NotNestedGreaterGreater;": "⪢̸",
7368 "ClockwiseContourIntegral;": "∲",
7369 "DoubleLongLeftRightArrow;": "⟺",
7370 "CounterClockwiseContourIntegral;": "∳"
7371};
7372
7373// lazy compute this to make this file tree-shakable for browser
7374let maxCRNameLength;
7375const decodeHtml = (rawText, asAttr) => {
7376 let offset = 0;
7377 const end = rawText.length;
7378 let decodedText = '';
7379 function advance(length) {
7380 offset += length;
7381 rawText = rawText.slice(length);
7382 }
7383 while (offset < end) {
7384 const head = /&(?:#x?)?/i.exec(rawText);
7385 if (!head || offset + head.index >= end) {
7386 const remaining = end - offset;
7387 decodedText += rawText.slice(0, remaining);
7388 advance(remaining);
7389 break;
7390 }
7391 // Advance to the "&".
7392 decodedText += rawText.slice(0, head.index);
7393 advance(head.index);
7394 if (head[0] === '&') {
7395 // Named character reference.
7396 let name = '';
7397 let value = undefined;
7398 if (/[0-9a-z]/i.test(rawText[1])) {
7399 if (!maxCRNameLength) {
7400 maxCRNameLength = Object.keys(namedCharacterReferences).reduce((max, name) => Math.max(max, name.length), 0);
7401 }
7402 for (let length = maxCRNameLength; !value && length > 0; --length) {
7403 name = rawText.substr(1, length);
7404 value = namedCharacterReferences[name];
7405 }
7406 if (value) {
7407 const semi = name.endsWith(';');
7408 if (asAttr &&
7409 !semi &&
7410 /[=a-z0-9]/i.test(rawText[name.length + 1] || '')) {
7411 decodedText += '&' + name;
7412 advance(1 + name.length);
7413 }
7414 else {
7415 decodedText += value;
7416 advance(1 + name.length);
7417 }
7418 }
7419 else {
7420 decodedText += '&' + name;
7421 advance(1 + name.length);
7422 }
7423 }
7424 else {
7425 decodedText += '&';
7426 advance(1);
7427 }
7428 }
7429 else {
7430 // Numeric character reference.
7431 const hex = head[0] === '&#x';
7432 const pattern = hex ? /^&#x([0-9a-f]+);?/i : /^&#([0-9]+);?/;
7433 const body = pattern.exec(rawText);
7434 if (!body) {
7435 decodedText += head[0];
7436 advance(head[0].length);
7437 }
7438 else {
7439 // https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
7440 let cp = Number.parseInt(body[1], hex ? 16 : 10);
7441 if (cp === 0) {
7442 cp = 0xfffd;
7443 }
7444 else if (cp > 0x10ffff) {
7445 cp = 0xfffd;
7446 }
7447 else if (cp >= 0xd800 && cp <= 0xdfff) {
7448 cp = 0xfffd;
7449 }
7450 else if ((cp >= 0xfdd0 && cp <= 0xfdef) || (cp & 0xfffe) === 0xfffe) ;
7451 else if ((cp >= 0x01 && cp <= 0x08) ||
7452 cp === 0x0b ||
7453 (cp >= 0x0d && cp <= 0x1f) ||
7454 (cp >= 0x7f && cp <= 0x9f)) {
7455 cp = CCR_REPLACEMENTS[cp] || cp;
7456 }
7457 decodedText += String.fromCodePoint(cp);
7458 advance(body[0].length);
7459 }
7460 }
7461 }
7462 return decodedText;
7463};
7464// https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
7465const CCR_REPLACEMENTS = {
7466 0x80: 0x20ac,
7467 0x82: 0x201a,
7468 0x83: 0x0192,
7469 0x84: 0x201e,
7470 0x85: 0x2026,
7471 0x86: 0x2020,
7472 0x87: 0x2021,
7473 0x88: 0x02c6,
7474 0x89: 0x2030,
7475 0x8a: 0x0160,
7476 0x8b: 0x2039,
7477 0x8c: 0x0152,
7478 0x8e: 0x017d,
7479 0x91: 0x2018,
7480 0x92: 0x2019,
7481 0x93: 0x201c,
7482 0x94: 0x201d,
7483 0x95: 0x2022,
7484 0x96: 0x2013,
7485 0x97: 0x2014,
7486 0x98: 0x02dc,
7487 0x99: 0x2122,
7488 0x9a: 0x0161,
7489 0x9b: 0x203a,
7490 0x9c: 0x0153,
7491 0x9e: 0x017e,
7492 0x9f: 0x0178
7493};
7494
7495const isRawTextContainer = /*#__PURE__*/ shared.makeMap('style,iframe,script,noscript', true);
7496const parserOptions = {
7497 isVoidTag: shared.isVoidTag,
7498 isNativeTag: tag => shared.isHTMLTag(tag) || shared.isSVGTag(tag),
7499 isPreTag: tag => tag === 'pre',
7500 decodeEntities: decodeHtml,
7501 isBuiltInComponent: (tag) => {
7502 if (compilerCore.isBuiltInType(tag, `Transition`)) {
7503 return TRANSITION;
7504 }
7505 else if (compilerCore.isBuiltInType(tag, `TransitionGroup`)) {
7506 return TRANSITION_GROUP;
7507 }
7508 },
7509 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
7510 getNamespace(tag, parent) {
7511 let ns = parent ? parent.ns : 0 /* HTML */;
7512 if (parent && ns === 2 /* MATH_ML */) {
7513 if (parent.tag === 'annotation-xml') {
7514 if (tag === 'svg') {
7515 return 1 /* SVG */;
7516 }
7517 if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
7518 a.name === 'encoding' &&
7519 a.value != null &&
7520 (a.value.content === 'text/html' ||
7521 a.value.content === 'application/xhtml+xml'))) {
7522 ns = 0 /* HTML */;
7523 }
7524 }
7525 else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
7526 tag !== 'mglyph' &&
7527 tag !== 'malignmark') {
7528 ns = 0 /* HTML */;
7529 }
7530 }
7531 else if (parent && ns === 1 /* SVG */) {
7532 if (parent.tag === 'foreignObject' ||
7533 parent.tag === 'desc' ||
7534 parent.tag === 'title') {
7535 ns = 0 /* HTML */;
7536 }
7537 }
7538 if (ns === 0 /* HTML */) {
7539 if (tag === 'svg') {
7540 return 1 /* SVG */;
7541 }
7542 if (tag === 'math') {
7543 return 2 /* MATH_ML */;
7544 }
7545 }
7546 return ns;
7547 },
7548 // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
7549 getTextMode({ tag, ns }) {
7550 if (ns === 0 /* HTML */) {
7551 if (tag === 'textarea' || tag === 'title') {
7552 return 1 /* RCDATA */;
7553 }
7554 if (isRawTextContainer(tag)) {
7555 return 2 /* RAWTEXT */;
7556 }
7557 }
7558 return 0 /* DATA */;
7559 }
7560};
7561
7562// Parse inline CSS strings for static style attributes into an object.
7563// This is a NodeTransform since it works on the static `style` attribute and
7564// converts it into a dynamic equivalent:
7565// style="color: red" -> :style='{ "color": "red" }'
7566// It is then processed by `transformElement` and included in the generated
7567// props.
7568const transformStyle = node => {
7569 if (node.type === 1 /* ELEMENT */) {
7570 node.props.forEach((p, i) => {
7571 if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
7572 // replace p with an expression node
7573 node.props[i] = {
7574 type: 7 /* DIRECTIVE */,
7575 name: `bind`,
7576 arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
7577 exp: parseInlineCSS(p.value.content, p.loc),
7578 modifiers: [],
7579 loc: p.loc
7580 };
7581 }
7582 });
7583 }
7584};
7585const parseInlineCSS = (cssText, loc) => {
7586 const normalized = shared.parseStringStyle(cssText);
7587 return compilerCore.createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
7588};
7589
7590function createDOMCompilerError(code, loc) {
7591 return compilerCore.createCompilerError(code, loc, DOMErrorMessages );
7592}
7593const DOMErrorMessages = {
7594 [49 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
7595 [50 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
7596 [51 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
7597 [52 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
7598 [53 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
7599 [54 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
7600 [55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
7601 [56 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
7602 [57 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
7603 [58 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
7604 [59 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
7605};
7606
7607const transformVHtml = (dir, node, context) => {
7608 const { exp, loc } = dir;
7609 if (!exp) {
7610 context.onError(createDOMCompilerError(49 /* X_V_HTML_NO_EXPRESSION */, loc));
7611 }
7612 if (node.children.length) {
7613 context.onError(createDOMCompilerError(50 /* X_V_HTML_WITH_CHILDREN */, loc));
7614 node.children.length = 0;
7615 }
7616 return {
7617 props: [
7618 compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`innerHTML`, true, loc), exp || compilerCore.createSimpleExpression('', true))
7619 ]
7620 };
7621};
7622
7623const transformVText = (dir, node, context) => {
7624 const { exp, loc } = dir;
7625 if (!exp) {
7626 context.onError(createDOMCompilerError(51 /* X_V_TEXT_NO_EXPRESSION */, loc));
7627 }
7628 if (node.children.length) {
7629 context.onError(createDOMCompilerError(52 /* X_V_TEXT_WITH_CHILDREN */, loc));
7630 node.children.length = 0;
7631 }
7632 return {
7633 props: [
7634 compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`textContent`, true), exp
7635 ? compilerCore.createCallExpression(context.helperString(compilerCore.TO_DISPLAY_STRING), [exp], loc)
7636 : compilerCore.createSimpleExpression('', true))
7637 ]
7638 };
7639};
7640
7641const transformModel = (dir, node, context) => {
7642 const baseResult = compilerCore.transformModel(dir, node, context);
7643 // base transform has errors OR component v-model (only need props)
7644 if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
7645 return baseResult;
7646 }
7647 if (dir.arg) {
7648 context.onError(createDOMCompilerError(54 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
7649 }
7650 function checkDuplicatedValue() {
7651 const value = compilerCore.findProp(node, 'value');
7652 if (value) {
7653 context.onError(createDOMCompilerError(56 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
7654 }
7655 }
7656 const { tag } = node;
7657 const isCustomElement = context.isCustomElement(tag);
7658 if (tag === 'input' ||
7659 tag === 'textarea' ||
7660 tag === 'select' ||
7661 isCustomElement) {
7662 let directiveToUse = V_MODEL_TEXT;
7663 let isInvalidType = false;
7664 if (tag === 'input' || isCustomElement) {
7665 const type = compilerCore.findProp(node, `type`);
7666 if (type) {
7667 if (type.type === 7 /* DIRECTIVE */) {
7668 // :type="foo"
7669 directiveToUse = V_MODEL_DYNAMIC;
7670 }
7671 else if (type.value) {
7672 switch (type.value.content) {
7673 case 'radio':
7674 directiveToUse = V_MODEL_RADIO;
7675 break;
7676 case 'checkbox':
7677 directiveToUse = V_MODEL_CHECKBOX;
7678 break;
7679 case 'file':
7680 isInvalidType = true;
7681 context.onError(createDOMCompilerError(55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
7682 break;
7683 default:
7684 // text type
7685 checkDuplicatedValue();
7686 break;
7687 }
7688 }
7689 }
7690 else if (compilerCore.hasDynamicKeyVBind(node)) {
7691 // element has bindings with dynamic keys, which can possibly contain
7692 // "type".
7693 directiveToUse = V_MODEL_DYNAMIC;
7694 }
7695 else {
7696 // text type
7697 checkDuplicatedValue();
7698 }
7699 }
7700 else if (tag === 'select') {
7701 directiveToUse = V_MODEL_SELECT;
7702 }
7703 else {
7704 // textarea
7705 checkDuplicatedValue();
7706 }
7707 // inject runtime directive
7708 // by returning the helper symbol via needRuntime
7709 // the import will replaced a resolveDirective call.
7710 if (!isInvalidType) {
7711 baseResult.needRuntime = context.helper(directiveToUse);
7712 }
7713 }
7714 else {
7715 context.onError(createDOMCompilerError(53 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
7716 }
7717 // native vmodel doesn't need the `modelValue` props since they are also
7718 // passed to the runtime as `binding.value`. removing it reduces code size.
7719 baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
7720 p.key.content === 'modelValue'));
7721 return baseResult;
7722};
7723
7724const isEventOptionModifier = /*#__PURE__*/ shared.makeMap(`passive,once,capture`);
7725const isNonKeyModifier = /*#__PURE__*/ shared.makeMap(
7726// event propagation management
7727`stop,prevent,self,` +
7728 // system modifiers + exact
7729 `ctrl,shift,alt,meta,exact,` +
7730 // mouse
7731 `middle`);
7732// left & right could be mouse or key modifiers based on event type
7733const maybeKeyModifier = /*#__PURE__*/ shared.makeMap('left,right');
7734const isKeyboardEvent = /*#__PURE__*/ shared.makeMap(`onkeyup,onkeydown,onkeypress`, true);
7735const resolveModifiers = (key, modifiers, context, loc) => {
7736 const keyModifiers = [];
7737 const nonKeyModifiers = [];
7738 const eventOptionModifiers = [];
7739 for (let i = 0; i < modifiers.length; i++) {
7740 const modifier = modifiers[i];
7741 if (modifier === 'native' &&
7742 compilerCore.checkCompatEnabled("COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */, context, loc)) {
7743 eventOptionModifiers.push(modifier);
7744 }
7745 else if (isEventOptionModifier(modifier)) {
7746 // eventOptionModifiers: modifiers for addEventListener() options,
7747 // e.g. .passive & .capture
7748 eventOptionModifiers.push(modifier);
7749 }
7750 else {
7751 // runtimeModifiers: modifiers that needs runtime guards
7752 if (maybeKeyModifier(modifier)) {
7753 if (compilerCore.isStaticExp(key)) {
7754 if (isKeyboardEvent(key.content)) {
7755 keyModifiers.push(modifier);
7756 }
7757 else {
7758 nonKeyModifiers.push(modifier);
7759 }
7760 }
7761 else {
7762 keyModifiers.push(modifier);
7763 nonKeyModifiers.push(modifier);
7764 }
7765 }
7766 else {
7767 if (isNonKeyModifier(modifier)) {
7768 nonKeyModifiers.push(modifier);
7769 }
7770 else {
7771 keyModifiers.push(modifier);
7772 }
7773 }
7774 }
7775 }
7776 return {
7777 keyModifiers,
7778 nonKeyModifiers,
7779 eventOptionModifiers
7780 };
7781};
7782const transformClick = (key, event) => {
7783 const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === 'onclick';
7784 return isStaticClick
7785 ? compilerCore.createSimpleExpression(event, true)
7786 : key.type !== 4 /* SIMPLE_EXPRESSION */
7787 ? compilerCore.createCompoundExpression([
7788 `(`,
7789 key,
7790 `) === "onClick" ? "${event}" : (`,
7791 key,
7792 `)`
7793 ])
7794 : key;
7795};
7796const transformOn = (dir, node, context) => {
7797 return compilerCore.transformOn(dir, node, context, baseResult => {
7798 const { modifiers } = dir;
7799 if (!modifiers.length)
7800 return baseResult;
7801 let { key, value: handlerExp } = baseResult.props[0];
7802 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
7803 // normalize click.right and click.middle since they don't actually fire
7804 if (nonKeyModifiers.includes('right')) {
7805 key = transformClick(key, `onContextmenu`);
7806 }
7807 if (nonKeyModifiers.includes('middle')) {
7808 key = transformClick(key, `onMouseup`);
7809 }
7810 if (nonKeyModifiers.length) {
7811 handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
7812 handlerExp,
7813 JSON.stringify(nonKeyModifiers)
7814 ]);
7815 }
7816 if (keyModifiers.length &&
7817 // if event name is dynamic, always wrap with keys guard
7818 (!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
7819 handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
7820 handlerExp,
7821 JSON.stringify(keyModifiers)
7822 ]);
7823 }
7824 if (eventOptionModifiers.length) {
7825 const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join('');
7826 key = compilerCore.isStaticExp(key)
7827 ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true)
7828 : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
7829 }
7830 return {
7831 props: [compilerCore.createObjectProperty(key, handlerExp)]
7832 };
7833 });
7834};
7835
7836const transformShow = (dir, node, context) => {
7837 const { exp, loc } = dir;
7838 if (!exp) {
7839 context.onError(createDOMCompilerError(57 /* X_V_SHOW_NO_EXPRESSION */, loc));
7840 }
7841 return {
7842 props: [],
7843 needRuntime: context.helper(V_SHOW)
7844 };
7845};
7846
7847const warnTransitionChildren = (node, context) => {
7848 if (node.type === 1 /* ELEMENT */ &&
7849 node.tagType === 1 /* COMPONENT */) {
7850 const component = context.isBuiltInComponent(node.tag);
7851 if (component === TRANSITION) {
7852 return () => {
7853 if (node.children.length && hasMultipleChildren(node)) {
7854 context.onError(createDOMCompilerError(58 /* X_TRANSITION_INVALID_CHILDREN */, {
7855 start: node.children[0].loc.start,
7856 end: node.children[node.children.length - 1].loc.end,
7857 source: ''
7858 }));
7859 }
7860 };
7861 }
7862 }
7863};
7864function hasMultipleChildren(node) {
7865 // #1352 filter out potential comment nodes.
7866 const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */));
7867 const child = children[0];
7868 return (children.length !== 1 ||
7869 child.type === 11 /* FOR */ ||
7870 (child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
7871}
7872
7873/**
7874 * This module is Node-only.
7875 */
7876/**
7877 * Turn eligible hoisted static trees into stringified static nodes, e.g.
7878 *
7879 * ```js
7880 * const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
7881 * ```
7882 *
7883 * A single static vnode can contain stringified content for **multiple**
7884 * consecutive nodes (element and plain text), called a "chunk".
7885 * `@vue/runtime-dom` will create the content via innerHTML in a hidden
7886 * container element and insert all the nodes in place. The call must also
7887 * provide the number of nodes contained in the chunk so that during hydration
7888 * we can know how many nodes the static vnode should adopt.
7889 *
7890 * The optimization scans a children list that contains hoisted nodes, and
7891 * tries to find the largest chunk of consecutive hoisted nodes before running
7892 * into a non-hoisted node or the end of the list. A chunk is then converted
7893 * into a single static vnode and replaces the hoisted expression of the first
7894 * node in the chunk. Other nodes in the chunk are considered "merged" and
7895 * therefore removed from both the hoist list and the children array.
7896 *
7897 * This optimization is only performed in Node.js.
7898 */
7899const stringifyStatic = (children, context, parent) => {
7900 // bail stringification for slot content
7901 if (context.scopes.vSlot > 0) {
7902 return;
7903 }
7904 let nc = 0; // current node count
7905 let ec = 0; // current element with binding count
7906 const currentChunk = [];
7907 const stringifyCurrentChunk = (currentIndex) => {
7908 if (nc >= 20 /* NODE_COUNT */ ||
7909 ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
7910 // combine all currently eligible nodes into a single static vnode call
7911 const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
7912 JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')),
7913 // the 2nd argument indicates the number of DOM nodes this static vnode
7914 // will insert / hydrate
7915 String(currentChunk.length)
7916 ]);
7917 // replace the first node's hoisted expression with the static vnode call
7918 replaceHoist(currentChunk[0], staticCall, context);
7919 if (currentChunk.length > 1) {
7920 for (let i = 1; i < currentChunk.length; i++) {
7921 // for the merged nodes, set their hoisted expression to null
7922 replaceHoist(currentChunk[i], null, context);
7923 }
7924 // also remove merged nodes from children
7925 const deleteCount = currentChunk.length - 1;
7926 children.splice(currentIndex - currentChunk.length + 1, deleteCount);
7927 return deleteCount;
7928 }
7929 }
7930 return 0;
7931 };
7932 let i = 0;
7933 for (; i < children.length; i++) {
7934 const child = children[i];
7935 const hoisted = getHoistedNode(child);
7936 if (hoisted) {
7937 // presence of hoisted means child must be a stringifiable node
7938 const node = child;
7939 const result = analyzeNode(node);
7940 if (result) {
7941 // node is stringifiable, record state
7942 nc += result[0];
7943 ec += result[1];
7944 currentChunk.push(node);
7945 continue;
7946 }
7947 }
7948 // we only reach here if we ran into a node that is not stringifiable
7949 // check if currently analyzed nodes meet criteria for stringification.
7950 // adjust iteration index
7951 i -= stringifyCurrentChunk(i);
7952 // reset state
7953 nc = 0;
7954 ec = 0;
7955 currentChunk.length = 0;
7956 }
7957 // in case the last node was also stringifiable
7958 stringifyCurrentChunk(i);
7959};
7960const getHoistedNode = (node) => ((node.type === 1 /* ELEMENT */ && node.tagType === 0 /* ELEMENT */) ||
7961 node.type == 12 /* TEXT_CALL */) &&
7962 node.codegenNode &&
7963 node.codegenNode.type === 4 /* SIMPLE_EXPRESSION */ &&
7964 node.codegenNode.hoisted;
7965const dataAriaRE = /^(data|aria)-/;
7966const isStringifiableAttr = (name) => {
7967 return shared.isKnownAttr(name) || dataAriaRE.test(name);
7968};
7969const replaceHoist = (node, replacement, context) => {
7970 const hoistToReplace = node.codegenNode.hoisted;
7971 context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
7972};
7973const isNonStringifiable = /*#__PURE__*/ shared.makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
7974/**
7975 * for a hoisted node, analyze it and return:
7976 * - false: bailed (contains runtime constant)
7977 * - [nc, ec] where
7978 * - nc is the number of nodes inside
7979 * - ec is the number of element with bindings inside
7980 */
7981function analyzeNode(node) {
7982 if (node.type === 1 /* ELEMENT */ && isNonStringifiable(node.tag)) {
7983 return false;
7984 }
7985 if (node.type === 12 /* TEXT_CALL */) {
7986 return [1, 0];
7987 }
7988 let nc = 1; // node count
7989 let ec = node.props.length > 0 ? 1 : 0; // element w/ binding count
7990 let bailed = false;
7991 const bail = () => {
7992 bailed = true;
7993 return false;
7994 };
7995 // TODO: check for cases where using innerHTML will result in different
7996 // output compared to imperative node insertions.
7997 // probably only need to check for most common case
7998 // i.e. non-phrasing-content tags inside `<p>`
7999 function walk(node) {
8000 for (let i = 0; i < node.props.length; i++) {
8001 const p = node.props[i];
8002 // bail on non-attr bindings
8003 if (p.type === 6 /* ATTRIBUTE */ && !isStringifiableAttr(p.name)) {
8004 return bail();
8005 }
8006 if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
8007 // bail on non-attr bindings
8008 if (p.arg &&
8009 (p.arg.type === 8 /* COMPOUND_EXPRESSION */ ||
8010 (p.arg.isStatic && !isStringifiableAttr(p.arg.content)))) {
8011 return bail();
8012 }
8013 }
8014 }
8015 for (let i = 0; i < node.children.length; i++) {
8016 nc++;
8017 const child = node.children[i];
8018 if (child.type === 1 /* ELEMENT */) {
8019 if (child.props.length > 0) {
8020 ec++;
8021 }
8022 walk(child);
8023 if (bailed) {
8024 return false;
8025 }
8026 }
8027 }
8028 return true;
8029 }
8030 return walk(node) ? [nc, ec] : false;
8031}
8032function stringifyNode(node, context) {
8033 if (shared.isString(node)) {
8034 return node;
8035 }
8036 if (shared.isSymbol(node)) {
8037 return ``;
8038 }
8039 switch (node.type) {
8040 case 1 /* ELEMENT */:
8041 return stringifyElement(node, context);
8042 case 2 /* TEXT */:
8043 return shared.escapeHtml(node.content);
8044 case 3 /* COMMENT */:
8045 return `<!--${shared.escapeHtml(node.content)}-->`;
8046 case 5 /* INTERPOLATION */:
8047 return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
8048 case 8 /* COMPOUND_EXPRESSION */:
8049 return shared.escapeHtml(evaluateConstant(node));
8050 case 12 /* TEXT_CALL */:
8051 return stringifyNode(node.content, context);
8052 default:
8053 // static trees will not contain if/for nodes
8054 return '';
8055 }
8056}
8057function stringifyElement(node, context) {
8058 let res = `<${node.tag}`;
8059 for (let i = 0; i < node.props.length; i++) {
8060 const p = node.props[i];
8061 if (p.type === 6 /* ATTRIBUTE */) {
8062 res += ` ${p.name}`;
8063 if (p.value) {
8064 res += `="${shared.escapeHtml(p.value.content)}"`;
8065 }
8066 }
8067 else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
8068 // constant v-bind, e.g. :foo="1"
8069 let evaluated = evaluateConstant(p.exp);
8070 if (evaluated != null) {
8071 const arg = p.arg && p.arg.content;
8072 if (arg === 'class') {
8073 evaluated = shared.normalizeClass(evaluated);
8074 }
8075 else if (arg === 'style') {
8076 evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
8077 }
8078 res += ` ${p.arg.content}="${shared.escapeHtml(evaluated)}"`;
8079 }
8080 }
8081 }
8082 if (context.scopeId) {
8083 res += ` ${context.scopeId}`;
8084 }
8085 res += `>`;
8086 for (let i = 0; i < node.children.length; i++) {
8087 res += stringifyNode(node.children[i], context);
8088 }
8089 if (!shared.isVoidTag(node.tag)) {
8090 res += `</${node.tag}>`;
8091 }
8092 return res;
8093}
8094// __UNSAFE__
8095// Reason: eval.
8096// It's technically safe to eval because only constant expressions are possible
8097// here, e.g. `{{ 1 }}` or `{{ 'foo' }}`
8098// in addition, constant exps bail on presence of parens so you can't even
8099// run JSFuck in here. But we mark it unsafe for security review purposes.
8100// (see compiler-core/src/transformExpressions)
8101function evaluateConstant(exp) {
8102 if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
8103 return new Function(`return ${exp.content}`)();
8104 }
8105 else {
8106 // compound
8107 let res = ``;
8108 exp.children.forEach(c => {
8109 if (shared.isString(c) || shared.isSymbol(c)) {
8110 return;
8111 }
8112 if (c.type === 2 /* TEXT */) {
8113 res += c.content;
8114 }
8115 else if (c.type === 5 /* INTERPOLATION */) {
8116 res += shared.toDisplayString(evaluateConstant(c.content));
8117 }
8118 else {
8119 res += evaluateConstant(c);
8120 }
8121 });
8122 return res;
8123 }
8124}
8125
8126const ignoreSideEffectTags = (node, context) => {
8127 if (node.type === 1 /* ELEMENT */ &&
8128 node.tagType === 0 /* ELEMENT */ &&
8129 (node.tag === 'script' || node.tag === 'style')) {
8130 context.onError(createDOMCompilerError(59 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
8131 context.removeNode();
8132 }
8133};
8134
8135const DOMNodeTransforms = [
8136 transformStyle,
8137 ...([warnTransitionChildren] )
8138];
8139const DOMDirectiveTransforms = {
8140 cloak: compilerCore.noopDirectiveTransform,
8141 html: transformVHtml,
8142 text: transformVText,
8143 model: transformModel,
8144 on: transformOn,
8145 show: transformShow
8146};
8147function compile(template, options = {}) {
8148 return compilerCore.baseCompile(template, shared.extend({}, parserOptions, options, {
8149 nodeTransforms: [
8150 // ignore <script> and <tag>
8151 // this is not put inside DOMNodeTransforms because that list is used
8152 // by compiler-ssr to generate vnode fallback branches
8153 ignoreSideEffectTags,
8154 ...DOMNodeTransforms,
8155 ...(options.nodeTransforms || [])
8156 ],
8157 directiveTransforms: shared.extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
8158 transformHoist: stringifyStatic
8159 }));
8160}
8161function parse(template, options = {}) {
8162 return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
8163}
8164
8165Object.keys(compilerCore).forEach(function (k) {
8166 if (k !== 'default') exports[k] = compilerCore[k];
8167});
8168exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
8169exports.DOMNodeTransforms = DOMNodeTransforms;
8170exports.TRANSITION = TRANSITION;
8171exports.TRANSITION_GROUP = TRANSITION_GROUP;
8172exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
8173exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
8174exports.V_MODEL_RADIO = V_MODEL_RADIO;
8175exports.V_MODEL_SELECT = V_MODEL_SELECT;
8176exports.V_MODEL_TEXT = V_MODEL_TEXT;
8177exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
8178exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
8179exports.V_SHOW = V_SHOW;
8180exports.compile = compile;
8181exports.createDOMCompilerError = createDOMCompilerError;
8182exports.parse = parse;
8183exports.parserOptions = parserOptions;
8184exports.transformStyle = transformStyle;
8185}(compilerDom_cjs$2));
8186
8187var compilerDom_cjs = /*@__PURE__*/build.getDefaultExportFromCjs(compilerDom_cjs$2);
8188
8189var compilerDom_cjs$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(null), compilerDom_cjs$2, {
8190 'default': compilerDom_cjs
8191});
8192
8193exports.compilerDom_cjs = compilerDom_cjs$1;
8194//# sourceMappingURL=dep-7db2a04d.js.map