shared.cjs.prod.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /**
  2. * @vue/shared v3.5.22
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. 'use strict';
  7. Object.defineProperty(exports, '__esModule', { value: true });
  8. // @__NO_SIDE_EFFECTS__
  9. function makeMap(str) {
  10. const map = /* @__PURE__ */ Object.create(null);
  11. for (const key of str.split(",")) map[key] = 1;
  12. return (val) => val in map;
  13. }
  14. const EMPTY_OBJ = {};
  15. const EMPTY_ARR = [];
  16. const NOOP = () => {
  17. };
  18. const NO = () => false;
  19. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  20. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  21. const isModelListener = (key) => key.startsWith("onUpdate:");
  22. const extend = Object.assign;
  23. const remove = (arr, el) => {
  24. const i = arr.indexOf(el);
  25. if (i > -1) {
  26. arr.splice(i, 1);
  27. }
  28. };
  29. const hasOwnProperty = Object.prototype.hasOwnProperty;
  30. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  31. const isArray = Array.isArray;
  32. const isMap = (val) => toTypeString(val) === "[object Map]";
  33. const isSet = (val) => toTypeString(val) === "[object Set]";
  34. const isDate = (val) => toTypeString(val) === "[object Date]";
  35. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  36. const isFunction = (val) => typeof val === "function";
  37. const isString = (val) => typeof val === "string";
  38. const isSymbol = (val) => typeof val === "symbol";
  39. const isObject = (val) => val !== null && typeof val === "object";
  40. const isPromise = (val) => {
  41. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  42. };
  43. const objectToString = Object.prototype.toString;
  44. const toTypeString = (value) => objectToString.call(value);
  45. const toRawType = (value) => {
  46. return toTypeString(value).slice(8, -1);
  47. };
  48. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  49. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  50. const isReservedProp = /* @__PURE__ */ makeMap(
  51. // the leading comma is intentional so empty string "" is also included
  52. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  53. );
  54. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  55. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  56. );
  57. const cacheStringFunction = (fn) => {
  58. const cache = /* @__PURE__ */ Object.create(null);
  59. return ((str) => {
  60. const hit = cache[str];
  61. return hit || (cache[str] = fn(str));
  62. });
  63. };
  64. const camelizeRE = /-\w/g;
  65. const camelize = cacheStringFunction(
  66. (str) => {
  67. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  68. }
  69. );
  70. const hyphenateRE = /\B([A-Z])/g;
  71. const hyphenate = cacheStringFunction(
  72. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  73. );
  74. const capitalize = cacheStringFunction((str) => {
  75. return str.charAt(0).toUpperCase() + str.slice(1);
  76. });
  77. const toHandlerKey = cacheStringFunction(
  78. (str) => {
  79. const s = str ? `on${capitalize(str)}` : ``;
  80. return s;
  81. }
  82. );
  83. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  84. const invokeArrayFns = (fns, ...arg) => {
  85. for (let i = 0; i < fns.length; i++) {
  86. fns[i](...arg);
  87. }
  88. };
  89. const def = (obj, key, value, writable = false) => {
  90. Object.defineProperty(obj, key, {
  91. configurable: true,
  92. enumerable: false,
  93. writable,
  94. value
  95. });
  96. };
  97. const looseToNumber = (val) => {
  98. const n = parseFloat(val);
  99. return isNaN(n) ? val : n;
  100. };
  101. const toNumber = (val) => {
  102. const n = isString(val) ? Number(val) : NaN;
  103. return isNaN(n) ? val : n;
  104. };
  105. let _globalThis;
  106. const getGlobalThis = () => {
  107. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  108. };
  109. const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
  110. function genPropsAccessExp(name) {
  111. return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
  112. }
  113. function genCacheKey(source, options) {
  114. return source + JSON.stringify(
  115. options,
  116. (_, val) => typeof val === "function" ? val.toString() : val
  117. );
  118. }
  119. const PatchFlags = {
  120. "TEXT": 1,
  121. "1": "TEXT",
  122. "CLASS": 2,
  123. "2": "CLASS",
  124. "STYLE": 4,
  125. "4": "STYLE",
  126. "PROPS": 8,
  127. "8": "PROPS",
  128. "FULL_PROPS": 16,
  129. "16": "FULL_PROPS",
  130. "NEED_HYDRATION": 32,
  131. "32": "NEED_HYDRATION",
  132. "STABLE_FRAGMENT": 64,
  133. "64": "STABLE_FRAGMENT",
  134. "KEYED_FRAGMENT": 128,
  135. "128": "KEYED_FRAGMENT",
  136. "UNKEYED_FRAGMENT": 256,
  137. "256": "UNKEYED_FRAGMENT",
  138. "NEED_PATCH": 512,
  139. "512": "NEED_PATCH",
  140. "DYNAMIC_SLOTS": 1024,
  141. "1024": "DYNAMIC_SLOTS",
  142. "DEV_ROOT_FRAGMENT": 2048,
  143. "2048": "DEV_ROOT_FRAGMENT",
  144. "CACHED": -1,
  145. "-1": "CACHED",
  146. "BAIL": -2,
  147. "-2": "BAIL"
  148. };
  149. const PatchFlagNames = {
  150. [1]: `TEXT`,
  151. [2]: `CLASS`,
  152. [4]: `STYLE`,
  153. [8]: `PROPS`,
  154. [16]: `FULL_PROPS`,
  155. [32]: `NEED_HYDRATION`,
  156. [64]: `STABLE_FRAGMENT`,
  157. [128]: `KEYED_FRAGMENT`,
  158. [256]: `UNKEYED_FRAGMENT`,
  159. [512]: `NEED_PATCH`,
  160. [1024]: `DYNAMIC_SLOTS`,
  161. [2048]: `DEV_ROOT_FRAGMENT`,
  162. [-1]: `CACHED`,
  163. [-2]: `BAIL`
  164. };
  165. const ShapeFlags = {
  166. "ELEMENT": 1,
  167. "1": "ELEMENT",
  168. "FUNCTIONAL_COMPONENT": 2,
  169. "2": "FUNCTIONAL_COMPONENT",
  170. "STATEFUL_COMPONENT": 4,
  171. "4": "STATEFUL_COMPONENT",
  172. "TEXT_CHILDREN": 8,
  173. "8": "TEXT_CHILDREN",
  174. "ARRAY_CHILDREN": 16,
  175. "16": "ARRAY_CHILDREN",
  176. "SLOTS_CHILDREN": 32,
  177. "32": "SLOTS_CHILDREN",
  178. "TELEPORT": 64,
  179. "64": "TELEPORT",
  180. "SUSPENSE": 128,
  181. "128": "SUSPENSE",
  182. "COMPONENT_SHOULD_KEEP_ALIVE": 256,
  183. "256": "COMPONENT_SHOULD_KEEP_ALIVE",
  184. "COMPONENT_KEPT_ALIVE": 512,
  185. "512": "COMPONENT_KEPT_ALIVE",
  186. "COMPONENT": 6,
  187. "6": "COMPONENT"
  188. };
  189. const SlotFlags = {
  190. "STABLE": 1,
  191. "1": "STABLE",
  192. "DYNAMIC": 2,
  193. "2": "DYNAMIC",
  194. "FORWARDED": 3,
  195. "3": "FORWARDED"
  196. };
  197. const slotFlagsText = {
  198. [1]: "STABLE",
  199. [2]: "DYNAMIC",
  200. [3]: "FORWARDED"
  201. };
  202. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
  203. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  204. const isGloballyWhitelisted = isGloballyAllowed;
  205. const range = 2;
  206. function generateCodeFrame(source, start = 0, end = source.length) {
  207. start = Math.max(0, Math.min(start, source.length));
  208. end = Math.max(0, Math.min(end, source.length));
  209. if (start > end) return "";
  210. let lines = source.split(/(\r?\n)/);
  211. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  212. lines = lines.filter((_, idx) => idx % 2 === 0);
  213. let count = 0;
  214. const res = [];
  215. for (let i = 0; i < lines.length; i++) {
  216. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  217. if (count >= start) {
  218. for (let j = i - range; j <= i + range || end > count; j++) {
  219. if (j < 0 || j >= lines.length) continue;
  220. const line = j + 1;
  221. res.push(
  222. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  223. );
  224. const lineLength = lines[j].length;
  225. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  226. if (j === i) {
  227. const pad = start - (count - (lineLength + newLineSeqLength));
  228. const length = Math.max(
  229. 1,
  230. end > count ? lineLength - pad : end - start
  231. );
  232. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  233. } else if (j > i) {
  234. if (end > count) {
  235. const length = Math.max(Math.min(end - count, lineLength), 1);
  236. res.push(` | ` + "^".repeat(length));
  237. }
  238. count += lineLength + newLineSeqLength;
  239. }
  240. }
  241. break;
  242. }
  243. }
  244. return res.join("\n");
  245. }
  246. function normalizeStyle(value) {
  247. if (isArray(value)) {
  248. const res = {};
  249. for (let i = 0; i < value.length; i++) {
  250. const item = value[i];
  251. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  252. if (normalized) {
  253. for (const key in normalized) {
  254. res[key] = normalized[key];
  255. }
  256. }
  257. }
  258. return res;
  259. } else if (isString(value) || isObject(value)) {
  260. return value;
  261. }
  262. }
  263. const listDelimiterRE = /;(?![^(]*\))/g;
  264. const propertyDelimiterRE = /:([^]+)/;
  265. const styleCommentRE = /\/\*[^]*?\*\//g;
  266. function parseStringStyle(cssText) {
  267. const ret = {};
  268. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  269. if (item) {
  270. const tmp = item.split(propertyDelimiterRE);
  271. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  272. }
  273. });
  274. return ret;
  275. }
  276. function stringifyStyle(styles) {
  277. if (!styles) return "";
  278. if (isString(styles)) return styles;
  279. let ret = "";
  280. for (const key in styles) {
  281. const value = styles[key];
  282. if (isString(value) || typeof value === "number") {
  283. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  284. ret += `${normalizedKey}:${value};`;
  285. }
  286. }
  287. return ret;
  288. }
  289. function normalizeClass(value) {
  290. let res = "";
  291. if (isString(value)) {
  292. res = value;
  293. } else if (isArray(value)) {
  294. for (let i = 0; i < value.length; i++) {
  295. const normalized = normalizeClass(value[i]);
  296. if (normalized) {
  297. res += normalized + " ";
  298. }
  299. }
  300. } else if (isObject(value)) {
  301. for (const name in value) {
  302. if (value[name]) {
  303. res += name + " ";
  304. }
  305. }
  306. }
  307. return res.trim();
  308. }
  309. function normalizeProps(props) {
  310. if (!props) return null;
  311. let { class: klass, style } = props;
  312. if (klass && !isString(klass)) {
  313. props.class = normalizeClass(klass);
  314. }
  315. if (style) {
  316. props.style = normalizeStyle(style);
  317. }
  318. return props;
  319. }
  320. const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  321. const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  322. const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
  323. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  324. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  325. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  326. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  327. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  328. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  329. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  330. const isBooleanAttr = /* @__PURE__ */ makeMap(
  331. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  332. );
  333. function includeBooleanAttr(value) {
  334. return !!value || value === "";
  335. }
  336. const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
  337. const attrValidationCache = {};
  338. function isSSRSafeAttrName(name) {
  339. if (attrValidationCache.hasOwnProperty(name)) {
  340. return attrValidationCache[name];
  341. }
  342. const isUnsafe = unsafeAttrCharRE.test(name);
  343. if (isUnsafe) {
  344. console.error(`unsafe attribute name: ${name}`);
  345. }
  346. return attrValidationCache[name] = !isUnsafe;
  347. }
  348. const propsToAttrMap = {
  349. acceptCharset: "accept-charset",
  350. className: "class",
  351. htmlFor: "for",
  352. httpEquiv: "http-equiv"
  353. };
  354. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  355. `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
  356. );
  357. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  358. `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
  359. );
  360. const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
  361. `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
  362. );
  363. function isRenderableAttrValue(value) {
  364. if (value == null) {
  365. return false;
  366. }
  367. const type = typeof value;
  368. return type === "string" || type === "number" || type === "boolean";
  369. }
  370. const escapeRE = /["'&<>]/;
  371. function escapeHtml(string) {
  372. const str = "" + string;
  373. const match = escapeRE.exec(str);
  374. if (!match) {
  375. return str;
  376. }
  377. let html = "";
  378. let escaped;
  379. let index;
  380. let lastIndex = 0;
  381. for (index = match.index; index < str.length; index++) {
  382. switch (str.charCodeAt(index)) {
  383. case 34:
  384. escaped = "&quot;";
  385. break;
  386. case 38:
  387. escaped = "&amp;";
  388. break;
  389. case 39:
  390. escaped = "&#39;";
  391. break;
  392. case 60:
  393. escaped = "&lt;";
  394. break;
  395. case 62:
  396. escaped = "&gt;";
  397. break;
  398. default:
  399. continue;
  400. }
  401. if (lastIndex !== index) {
  402. html += str.slice(lastIndex, index);
  403. }
  404. lastIndex = index + 1;
  405. html += escaped;
  406. }
  407. return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
  408. }
  409. const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
  410. function escapeHtmlComment(src) {
  411. return src.replace(commentStripRE, "");
  412. }
  413. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  414. function getEscapedCssVarName(key, doubleEscape) {
  415. return key.replace(
  416. cssVarNameEscapeSymbolsRE,
  417. (s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
  418. );
  419. }
  420. function looseCompareArrays(a, b) {
  421. if (a.length !== b.length) return false;
  422. let equal = true;
  423. for (let i = 0; equal && i < a.length; i++) {
  424. equal = looseEqual(a[i], b[i]);
  425. }
  426. return equal;
  427. }
  428. function looseEqual(a, b) {
  429. if (a === b) return true;
  430. let aValidType = isDate(a);
  431. let bValidType = isDate(b);
  432. if (aValidType || bValidType) {
  433. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  434. }
  435. aValidType = isSymbol(a);
  436. bValidType = isSymbol(b);
  437. if (aValidType || bValidType) {
  438. return a === b;
  439. }
  440. aValidType = isArray(a);
  441. bValidType = isArray(b);
  442. if (aValidType || bValidType) {
  443. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  444. }
  445. aValidType = isObject(a);
  446. bValidType = isObject(b);
  447. if (aValidType || bValidType) {
  448. if (!aValidType || !bValidType) {
  449. return false;
  450. }
  451. const aKeysCount = Object.keys(a).length;
  452. const bKeysCount = Object.keys(b).length;
  453. if (aKeysCount !== bKeysCount) {
  454. return false;
  455. }
  456. for (const key in a) {
  457. const aHasKey = a.hasOwnProperty(key);
  458. const bHasKey = b.hasOwnProperty(key);
  459. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  460. return false;
  461. }
  462. }
  463. }
  464. return String(a) === String(b);
  465. }
  466. function looseIndexOf(arr, val) {
  467. return arr.findIndex((item) => looseEqual(item, val));
  468. }
  469. const isRef = (val) => {
  470. return !!(val && val["__v_isRef"] === true);
  471. };
  472. const toDisplayString = (val) => {
  473. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  474. };
  475. const replacer = (_key, val) => {
  476. if (isRef(val)) {
  477. return replacer(_key, val.value);
  478. } else if (isMap(val)) {
  479. return {
  480. [`Map(${val.size})`]: [...val.entries()].reduce(
  481. (entries, [key, val2], i) => {
  482. entries[stringifySymbol(key, i) + " =>"] = val2;
  483. return entries;
  484. },
  485. {}
  486. )
  487. };
  488. } else if (isSet(val)) {
  489. return {
  490. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  491. };
  492. } else if (isSymbol(val)) {
  493. return stringifySymbol(val);
  494. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  495. return String(val);
  496. }
  497. return val;
  498. };
  499. const stringifySymbol = (v, i = "") => {
  500. var _a;
  501. return (
  502. // Symbol.description in es2019+ so we need to cast here to pass
  503. // the lib: es2016 check
  504. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  505. );
  506. };
  507. function normalizeCssVarValue(value) {
  508. if (value == null) {
  509. return "initial";
  510. }
  511. if (typeof value === "string") {
  512. return value === "" ? " " : value;
  513. }
  514. return String(value);
  515. }
  516. exports.EMPTY_ARR = EMPTY_ARR;
  517. exports.EMPTY_OBJ = EMPTY_OBJ;
  518. exports.NO = NO;
  519. exports.NOOP = NOOP;
  520. exports.PatchFlagNames = PatchFlagNames;
  521. exports.PatchFlags = PatchFlags;
  522. exports.ShapeFlags = ShapeFlags;
  523. exports.SlotFlags = SlotFlags;
  524. exports.camelize = camelize;
  525. exports.capitalize = capitalize;
  526. exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
  527. exports.def = def;
  528. exports.escapeHtml = escapeHtml;
  529. exports.escapeHtmlComment = escapeHtmlComment;
  530. exports.extend = extend;
  531. exports.genCacheKey = genCacheKey;
  532. exports.genPropsAccessExp = genPropsAccessExp;
  533. exports.generateCodeFrame = generateCodeFrame;
  534. exports.getEscapedCssVarName = getEscapedCssVarName;
  535. exports.getGlobalThis = getGlobalThis;
  536. exports.hasChanged = hasChanged;
  537. exports.hasOwn = hasOwn;
  538. exports.hyphenate = hyphenate;
  539. exports.includeBooleanAttr = includeBooleanAttr;
  540. exports.invokeArrayFns = invokeArrayFns;
  541. exports.isArray = isArray;
  542. exports.isBooleanAttr = isBooleanAttr;
  543. exports.isBuiltInDirective = isBuiltInDirective;
  544. exports.isDate = isDate;
  545. exports.isFunction = isFunction;
  546. exports.isGloballyAllowed = isGloballyAllowed;
  547. exports.isGloballyWhitelisted = isGloballyWhitelisted;
  548. exports.isHTMLTag = isHTMLTag;
  549. exports.isIntegerKey = isIntegerKey;
  550. exports.isKnownHtmlAttr = isKnownHtmlAttr;
  551. exports.isKnownMathMLAttr = isKnownMathMLAttr;
  552. exports.isKnownSvgAttr = isKnownSvgAttr;
  553. exports.isMap = isMap;
  554. exports.isMathMLTag = isMathMLTag;
  555. exports.isModelListener = isModelListener;
  556. exports.isObject = isObject;
  557. exports.isOn = isOn;
  558. exports.isPlainObject = isPlainObject;
  559. exports.isPromise = isPromise;
  560. exports.isRegExp = isRegExp;
  561. exports.isRenderableAttrValue = isRenderableAttrValue;
  562. exports.isReservedProp = isReservedProp;
  563. exports.isSSRSafeAttrName = isSSRSafeAttrName;
  564. exports.isSVGTag = isSVGTag;
  565. exports.isSet = isSet;
  566. exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
  567. exports.isString = isString;
  568. exports.isSymbol = isSymbol;
  569. exports.isVoidTag = isVoidTag;
  570. exports.looseEqual = looseEqual;
  571. exports.looseIndexOf = looseIndexOf;
  572. exports.looseToNumber = looseToNumber;
  573. exports.makeMap = makeMap;
  574. exports.normalizeClass = normalizeClass;
  575. exports.normalizeCssVarValue = normalizeCssVarValue;
  576. exports.normalizeProps = normalizeProps;
  577. exports.normalizeStyle = normalizeStyle;
  578. exports.objectToString = objectToString;
  579. exports.parseStringStyle = parseStringStyle;
  580. exports.propsToAttrMap = propsToAttrMap;
  581. exports.remove = remove;
  582. exports.slotFlagsText = slotFlagsText;
  583. exports.stringifyStyle = stringifyStyle;
  584. exports.toDisplayString = toDisplayString;
  585. exports.toHandlerKey = toHandlerKey;
  586. exports.toNumber = toNumber;
  587. exports.toRawType = toRawType;
  588. exports.toTypeString = toTypeString;