runtime-dom.cjs.js 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946
  1. /**
  2. * @vue/runtime-dom v3.5.32
  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. var runtimeCore = require('@vue/runtime-core');
  9. var shared = require('@vue/shared');
  10. let policy = void 0;
  11. const tt = typeof window !== "undefined" && window.trustedTypes;
  12. if (tt) {
  13. try {
  14. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  15. createHTML: (val) => val
  16. });
  17. } catch (e) {
  18. runtimeCore.warn(`Error creating trusted types policy: ${e}`);
  19. }
  20. }
  21. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  22. const svgNS = "http://www.w3.org/2000/svg";
  23. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  24. const doc = typeof document !== "undefined" ? document : null;
  25. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  26. const nodeOps = {
  27. insert: (child, parent, anchor) => {
  28. parent.insertBefore(child, anchor || null);
  29. },
  30. remove: (child) => {
  31. const parent = child.parentNode;
  32. if (parent) {
  33. parent.removeChild(child);
  34. }
  35. },
  36. createElement: (tag, namespace, is, props) => {
  37. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  38. if (tag === "select" && props && props.multiple != null) {
  39. el.setAttribute("multiple", props.multiple);
  40. }
  41. return el;
  42. },
  43. createText: (text) => doc.createTextNode(text),
  44. createComment: (text) => doc.createComment(text),
  45. setText: (node, text) => {
  46. node.nodeValue = text;
  47. },
  48. setElementText: (el, text) => {
  49. el.textContent = text;
  50. },
  51. parentNode: (node) => node.parentNode,
  52. nextSibling: (node) => node.nextSibling,
  53. querySelector: (selector) => doc.querySelector(selector),
  54. setScopeId(el, id) {
  55. el.setAttribute(id, "");
  56. },
  57. // __UNSAFE__
  58. // Reason: innerHTML.
  59. // Static content here can only come from compiled templates.
  60. // As long as the user only uses trusted templates, this is safe.
  61. insertStaticContent(content, parent, anchor, namespace, start, end) {
  62. const before = anchor ? anchor.previousSibling : parent.lastChild;
  63. if (start && (start === end || start.nextSibling)) {
  64. while (true) {
  65. parent.insertBefore(start.cloneNode(true), anchor);
  66. if (start === end || !(start = start.nextSibling)) break;
  67. }
  68. } else {
  69. templateContainer.innerHTML = unsafeToTrustedHTML(
  70. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  71. );
  72. const template = templateContainer.content;
  73. if (namespace === "svg" || namespace === "mathml") {
  74. const wrapper = template.firstChild;
  75. while (wrapper.firstChild) {
  76. template.appendChild(wrapper.firstChild);
  77. }
  78. template.removeChild(wrapper);
  79. }
  80. parent.insertBefore(template, anchor);
  81. }
  82. return [
  83. // first
  84. before ? before.nextSibling : parent.firstChild,
  85. // last
  86. anchor ? anchor.previousSibling : parent.lastChild
  87. ];
  88. }
  89. };
  90. const TRANSITION = "transition";
  91. const ANIMATION = "animation";
  92. const vtcKey = /* @__PURE__ */ Symbol("_vtc");
  93. const DOMTransitionPropsValidators = {
  94. name: String,
  95. type: String,
  96. css: {
  97. type: Boolean,
  98. default: true
  99. },
  100. duration: [String, Number, Object],
  101. enterFromClass: String,
  102. enterActiveClass: String,
  103. enterToClass: String,
  104. appearFromClass: String,
  105. appearActiveClass: String,
  106. appearToClass: String,
  107. leaveFromClass: String,
  108. leaveActiveClass: String,
  109. leaveToClass: String
  110. };
  111. const TransitionPropsValidators = /* @__PURE__ */ shared.extend(
  112. {},
  113. runtimeCore.BaseTransitionPropsValidators,
  114. DOMTransitionPropsValidators
  115. );
  116. const decorate$1 = (t) => {
  117. t.displayName = "Transition";
  118. t.props = TransitionPropsValidators;
  119. return t;
  120. };
  121. const Transition = /* @__PURE__ */ decorate$1(
  122. (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots)
  123. );
  124. const callHook = (hook, args = []) => {
  125. if (shared.isArray(hook)) {
  126. hook.forEach((h2) => h2(...args));
  127. } else if (hook) {
  128. hook(...args);
  129. }
  130. };
  131. const hasExplicitCallback = (hook) => {
  132. return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  133. };
  134. function resolveTransitionProps(rawProps) {
  135. const baseProps = {};
  136. for (const key in rawProps) {
  137. if (!(key in DOMTransitionPropsValidators)) {
  138. baseProps[key] = rawProps[key];
  139. }
  140. }
  141. if (rawProps.css === false) {
  142. return baseProps;
  143. }
  144. const {
  145. name = "v",
  146. type,
  147. duration,
  148. enterFromClass = `${name}-enter-from`,
  149. enterActiveClass = `${name}-enter-active`,
  150. enterToClass = `${name}-enter-to`,
  151. appearFromClass = enterFromClass,
  152. appearActiveClass = enterActiveClass,
  153. appearToClass = enterToClass,
  154. leaveFromClass = `${name}-leave-from`,
  155. leaveActiveClass = `${name}-leave-active`,
  156. leaveToClass = `${name}-leave-to`
  157. } = rawProps;
  158. const durations = normalizeDuration(duration);
  159. const enterDuration = durations && durations[0];
  160. const leaveDuration = durations && durations[1];
  161. const {
  162. onBeforeEnter,
  163. onEnter,
  164. onEnterCancelled,
  165. onLeave,
  166. onLeaveCancelled,
  167. onBeforeAppear = onBeforeEnter,
  168. onAppear = onEnter,
  169. onAppearCancelled = onEnterCancelled
  170. } = baseProps;
  171. const finishEnter = (el, isAppear, done, isCancelled) => {
  172. el._enterCancelled = isCancelled;
  173. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  174. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  175. done && done();
  176. };
  177. const finishLeave = (el, done) => {
  178. el._isLeaving = false;
  179. removeTransitionClass(el, leaveFromClass);
  180. removeTransitionClass(el, leaveToClass);
  181. removeTransitionClass(el, leaveActiveClass);
  182. done && done();
  183. };
  184. const makeEnterHook = (isAppear) => {
  185. return (el, done) => {
  186. const hook = isAppear ? onAppear : onEnter;
  187. const resolve = () => finishEnter(el, isAppear, done);
  188. callHook(hook, [el, resolve]);
  189. nextFrame(() => {
  190. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  191. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  192. if (!hasExplicitCallback(hook)) {
  193. whenTransitionEnds(el, type, enterDuration, resolve);
  194. }
  195. });
  196. };
  197. };
  198. return shared.extend(baseProps, {
  199. onBeforeEnter(el) {
  200. callHook(onBeforeEnter, [el]);
  201. addTransitionClass(el, enterFromClass);
  202. addTransitionClass(el, enterActiveClass);
  203. },
  204. onBeforeAppear(el) {
  205. callHook(onBeforeAppear, [el]);
  206. addTransitionClass(el, appearFromClass);
  207. addTransitionClass(el, appearActiveClass);
  208. },
  209. onEnter: makeEnterHook(false),
  210. onAppear: makeEnterHook(true),
  211. onLeave(el, done) {
  212. el._isLeaving = true;
  213. const resolve = () => finishLeave(el, done);
  214. addTransitionClass(el, leaveFromClass);
  215. if (!el._enterCancelled) {
  216. forceReflow(el);
  217. addTransitionClass(el, leaveActiveClass);
  218. } else {
  219. addTransitionClass(el, leaveActiveClass);
  220. forceReflow(el);
  221. }
  222. nextFrame(() => {
  223. if (!el._isLeaving) {
  224. return;
  225. }
  226. removeTransitionClass(el, leaveFromClass);
  227. addTransitionClass(el, leaveToClass);
  228. if (!hasExplicitCallback(onLeave)) {
  229. whenTransitionEnds(el, type, leaveDuration, resolve);
  230. }
  231. });
  232. callHook(onLeave, [el, resolve]);
  233. },
  234. onEnterCancelled(el) {
  235. finishEnter(el, false, void 0, true);
  236. callHook(onEnterCancelled, [el]);
  237. },
  238. onAppearCancelled(el) {
  239. finishEnter(el, true, void 0, true);
  240. callHook(onAppearCancelled, [el]);
  241. },
  242. onLeaveCancelled(el) {
  243. finishLeave(el);
  244. callHook(onLeaveCancelled, [el]);
  245. }
  246. });
  247. }
  248. function normalizeDuration(duration) {
  249. if (duration == null) {
  250. return null;
  251. } else if (shared.isObject(duration)) {
  252. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  253. } else {
  254. const n = NumberOf(duration);
  255. return [n, n];
  256. }
  257. }
  258. function NumberOf(val) {
  259. const res = shared.toNumber(val);
  260. {
  261. runtimeCore.assertNumber(res, "<transition> explicit duration");
  262. }
  263. return res;
  264. }
  265. function addTransitionClass(el, cls) {
  266. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  267. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  268. }
  269. function removeTransitionClass(el, cls) {
  270. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  271. const _vtc = el[vtcKey];
  272. if (_vtc) {
  273. _vtc.delete(cls);
  274. if (!_vtc.size) {
  275. el[vtcKey] = void 0;
  276. }
  277. }
  278. }
  279. function nextFrame(cb) {
  280. requestAnimationFrame(() => {
  281. requestAnimationFrame(cb);
  282. });
  283. }
  284. let endId = 0;
  285. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  286. const id = el._endId = ++endId;
  287. const resolveIfNotStale = () => {
  288. if (id === el._endId) {
  289. resolve();
  290. }
  291. };
  292. if (explicitTimeout != null) {
  293. return setTimeout(resolveIfNotStale, explicitTimeout);
  294. }
  295. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  296. if (!type) {
  297. return resolve();
  298. }
  299. const endEvent = type + "end";
  300. let ended = 0;
  301. const end = () => {
  302. el.removeEventListener(endEvent, onEnd);
  303. resolveIfNotStale();
  304. };
  305. const onEnd = (e) => {
  306. if (e.target === el && ++ended >= propCount) {
  307. end();
  308. }
  309. };
  310. setTimeout(() => {
  311. if (ended < propCount) {
  312. end();
  313. }
  314. }, timeout + 1);
  315. el.addEventListener(endEvent, onEnd);
  316. }
  317. function getTransitionInfo(el, expectedType) {
  318. const styles = window.getComputedStyle(el);
  319. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  320. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  321. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  322. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  323. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  324. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  325. const animationTimeout = getTimeout(animationDelays, animationDurations);
  326. let type = null;
  327. let timeout = 0;
  328. let propCount = 0;
  329. if (expectedType === TRANSITION) {
  330. if (transitionTimeout > 0) {
  331. type = TRANSITION;
  332. timeout = transitionTimeout;
  333. propCount = transitionDurations.length;
  334. }
  335. } else if (expectedType === ANIMATION) {
  336. if (animationTimeout > 0) {
  337. type = ANIMATION;
  338. timeout = animationTimeout;
  339. propCount = animationDurations.length;
  340. }
  341. } else {
  342. timeout = Math.max(transitionTimeout, animationTimeout);
  343. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  344. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  345. }
  346. const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
  347. getStyleProperties(`${TRANSITION}Property`).toString()
  348. );
  349. return {
  350. type,
  351. timeout,
  352. propCount,
  353. hasTransform
  354. };
  355. }
  356. function getTimeout(delays, durations) {
  357. while (delays.length < durations.length) {
  358. delays = delays.concat(delays);
  359. }
  360. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  361. }
  362. function toMs(s) {
  363. if (s === "auto") return 0;
  364. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  365. }
  366. function forceReflow(el) {
  367. const targetDocument = el ? el.ownerDocument : document;
  368. return targetDocument.body.offsetHeight;
  369. }
  370. function patchClass(el, value, isSVG) {
  371. const transitionClasses = el[vtcKey];
  372. if (transitionClasses) {
  373. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  374. }
  375. if (value == null) {
  376. el.removeAttribute("class");
  377. } else if (isSVG) {
  378. el.setAttribute("class", value);
  379. } else {
  380. el.className = value;
  381. }
  382. }
  383. const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod");
  384. const vShowHidden = /* @__PURE__ */ Symbol("_vsh");
  385. const vShow = {
  386. // used for prop mismatch check during hydration
  387. name: "show",
  388. beforeMount(el, { value }, { transition }) {
  389. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  390. if (transition && value) {
  391. transition.beforeEnter(el);
  392. } else {
  393. setDisplay(el, value);
  394. }
  395. },
  396. mounted(el, { value }, { transition }) {
  397. if (transition && value) {
  398. transition.enter(el);
  399. }
  400. },
  401. updated(el, { value, oldValue }, { transition }) {
  402. if (!value === !oldValue) return;
  403. if (transition) {
  404. if (value) {
  405. transition.beforeEnter(el);
  406. setDisplay(el, true);
  407. transition.enter(el);
  408. } else {
  409. transition.leave(el, () => {
  410. setDisplay(el, false);
  411. });
  412. }
  413. } else {
  414. setDisplay(el, value);
  415. }
  416. },
  417. beforeUnmount(el, { value }) {
  418. setDisplay(el, value);
  419. }
  420. };
  421. function setDisplay(el, value) {
  422. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  423. el[vShowHidden] = !value;
  424. }
  425. function initVShowForSSR() {
  426. vShow.getSSRProps = ({ value }) => {
  427. if (!value) {
  428. return { style: { display: "none" } };
  429. }
  430. };
  431. }
  432. const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("CSS_VAR_TEXT" );
  433. function useCssVars(getter) {
  434. return;
  435. }
  436. const displayRE = /(?:^|;)\s*display\s*:/;
  437. function patchStyle(el, prev, next) {
  438. const style = el.style;
  439. const isCssString = shared.isString(next);
  440. let hasControlledDisplay = false;
  441. if (next && !isCssString) {
  442. if (prev) {
  443. if (!shared.isString(prev)) {
  444. for (const key in prev) {
  445. if (next[key] == null) {
  446. setStyle(style, key, "");
  447. }
  448. }
  449. } else {
  450. for (const prevStyle of prev.split(";")) {
  451. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  452. if (next[key] == null) {
  453. setStyle(style, key, "");
  454. }
  455. }
  456. }
  457. }
  458. for (const key in next) {
  459. if (key === "display") {
  460. hasControlledDisplay = true;
  461. }
  462. setStyle(style, key, next[key]);
  463. }
  464. } else {
  465. if (isCssString) {
  466. if (prev !== next) {
  467. const cssVarText = style[CSS_VAR_TEXT];
  468. if (cssVarText) {
  469. next += ";" + cssVarText;
  470. }
  471. style.cssText = next;
  472. hasControlledDisplay = displayRE.test(next);
  473. }
  474. } else if (prev) {
  475. el.removeAttribute("style");
  476. }
  477. }
  478. if (vShowOriginalDisplay in el) {
  479. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  480. if (el[vShowHidden]) {
  481. style.display = "none";
  482. }
  483. }
  484. }
  485. const semicolonRE = /[^\\];\s*$/;
  486. const importantRE = /\s*!important$/;
  487. function setStyle(style, name, val) {
  488. if (shared.isArray(val)) {
  489. val.forEach((v) => setStyle(style, name, v));
  490. } else {
  491. if (val == null) val = "";
  492. {
  493. if (semicolonRE.test(val)) {
  494. runtimeCore.warn(
  495. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  496. );
  497. }
  498. }
  499. if (name.startsWith("--")) {
  500. style.setProperty(name, val);
  501. } else {
  502. const prefixed = autoPrefix(style, name);
  503. if (importantRE.test(val)) {
  504. style.setProperty(
  505. shared.hyphenate(prefixed),
  506. val.replace(importantRE, ""),
  507. "important"
  508. );
  509. } else {
  510. style[prefixed] = val;
  511. }
  512. }
  513. }
  514. }
  515. const prefixes = ["Webkit", "Moz", "ms"];
  516. const prefixCache = {};
  517. function autoPrefix(style, rawName) {
  518. const cached = prefixCache[rawName];
  519. if (cached) {
  520. return cached;
  521. }
  522. let name = runtimeCore.camelize(rawName);
  523. if (name !== "filter" && name in style) {
  524. return prefixCache[rawName] = name;
  525. }
  526. name = shared.capitalize(name);
  527. for (let i = 0; i < prefixes.length; i++) {
  528. const prefixed = prefixes[i] + name;
  529. if (prefixed in style) {
  530. return prefixCache[rawName] = prefixed;
  531. }
  532. }
  533. return rawName;
  534. }
  535. const xlinkNS = "http://www.w3.org/1999/xlink";
  536. function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
  537. if (isSVG && key.startsWith("xlink:")) {
  538. if (value == null) {
  539. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  540. } else {
  541. el.setAttributeNS(xlinkNS, key, value);
  542. }
  543. } else {
  544. if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
  545. el.removeAttribute(key);
  546. } else {
  547. el.setAttribute(
  548. key,
  549. isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
  550. );
  551. }
  552. }
  553. }
  554. function patchDOMProp(el, key, value, parentComponent, attrName) {
  555. if (key === "innerHTML" || key === "textContent") {
  556. if (value != null) {
  557. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  558. }
  559. return;
  560. }
  561. const tag = el.tagName;
  562. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  563. !tag.includes("-")) {
  564. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  565. const newValue = value == null ? (
  566. // #11647: value should be set as empty string for null and undefined,
  567. // but <input type="checkbox"> should be set as 'on'.
  568. el.type === "checkbox" ? "on" : ""
  569. ) : String(value);
  570. if (oldValue !== newValue || !("_value" in el)) {
  571. el.value = newValue;
  572. }
  573. if (value == null) {
  574. el.removeAttribute(key);
  575. }
  576. el._value = value;
  577. return;
  578. }
  579. let needRemove = false;
  580. if (value === "" || value == null) {
  581. const type = typeof el[key];
  582. if (type === "boolean") {
  583. value = shared.includeBooleanAttr(value);
  584. } else if (value == null && type === "string") {
  585. value = "";
  586. needRemove = true;
  587. } else if (type === "number") {
  588. value = 0;
  589. needRemove = true;
  590. }
  591. }
  592. try {
  593. el[key] = value;
  594. } catch (e) {
  595. if (!needRemove) {
  596. runtimeCore.warn(
  597. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  598. e
  599. );
  600. }
  601. }
  602. needRemove && el.removeAttribute(attrName || key);
  603. }
  604. function addEventListener(el, event, handler, options) {
  605. el.addEventListener(event, handler, options);
  606. }
  607. function removeEventListener(el, event, handler, options) {
  608. el.removeEventListener(event, handler, options);
  609. }
  610. const veiKey = /* @__PURE__ */ Symbol("_vei");
  611. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  612. const invokers = el[veiKey] || (el[veiKey] = {});
  613. const existingInvoker = invokers[rawName];
  614. if (nextValue && existingInvoker) {
  615. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  616. } else {
  617. const [name, options] = parseName(rawName);
  618. if (nextValue) {
  619. const invoker = invokers[rawName] = createInvoker(
  620. sanitizeEventValue(nextValue, rawName) ,
  621. instance
  622. );
  623. addEventListener(el, name, invoker, options);
  624. } else if (existingInvoker) {
  625. removeEventListener(el, name, existingInvoker, options);
  626. invokers[rawName] = void 0;
  627. }
  628. }
  629. }
  630. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  631. function parseName(name) {
  632. let options;
  633. if (optionsModifierRE.test(name)) {
  634. options = {};
  635. let m;
  636. while (m = name.match(optionsModifierRE)) {
  637. name = name.slice(0, name.length - m[0].length);
  638. options[m[0].toLowerCase()] = true;
  639. }
  640. }
  641. const event = name[2] === ":" ? name.slice(3) : shared.hyphenate(name.slice(2));
  642. return [event, options];
  643. }
  644. let cachedNow = 0;
  645. const p = /* @__PURE__ */ Promise.resolve();
  646. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  647. function createInvoker(initialValue, instance) {
  648. const invoker = (e) => {
  649. if (!e._vts) {
  650. e._vts = Date.now();
  651. } else if (e._vts <= invoker.attached) {
  652. return;
  653. }
  654. runtimeCore.callWithAsyncErrorHandling(
  655. patchStopImmediatePropagation(e, invoker.value),
  656. instance,
  657. 5,
  658. [e]
  659. );
  660. };
  661. invoker.value = initialValue;
  662. invoker.attached = getNow();
  663. return invoker;
  664. }
  665. function sanitizeEventValue(value, propName) {
  666. if (shared.isFunction(value) || shared.isArray(value)) {
  667. return value;
  668. }
  669. runtimeCore.warn(
  670. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  671. Expected function or array of functions, received type ${typeof value}.`
  672. );
  673. return shared.NOOP;
  674. }
  675. function patchStopImmediatePropagation(e, value) {
  676. if (shared.isArray(value)) {
  677. const originalStop = e.stopImmediatePropagation;
  678. e.stopImmediatePropagation = () => {
  679. originalStop.call(e);
  680. e._stopped = true;
  681. };
  682. return value.map(
  683. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  684. );
  685. } else {
  686. return value;
  687. }
  688. }
  689. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  690. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  691. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  692. const isSVG = namespace === "svg";
  693. if (key === "class") {
  694. patchClass(el, nextValue, isSVG);
  695. } else if (key === "style") {
  696. patchStyle(el, prevValue, nextValue);
  697. } else if (shared.isOn(key)) {
  698. if (!shared.isModelListener(key)) {
  699. patchEvent(el, key, prevValue, nextValue, parentComponent);
  700. }
  701. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  702. patchDOMProp(el, key, nextValue);
  703. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  704. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  705. }
  706. } else if (
  707. // #11081 force set props for possible async custom element
  708. el._isVueCE && // #12408 check if it's declared prop or it's async custom element
  709. (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
  710. el._def.__asyncLoader && (/[A-Z]/.test(key) || !shared.isString(nextValue)))
  711. ) {
  712. patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
  713. } else {
  714. if (key === "true-value") {
  715. el._trueValue = nextValue;
  716. } else if (key === "false-value") {
  717. el._falseValue = nextValue;
  718. }
  719. patchAttr(el, key, nextValue, isSVG);
  720. }
  721. };
  722. function shouldSetAsProp(el, key, value, isSVG) {
  723. if (isSVG) {
  724. if (key === "innerHTML" || key === "textContent") {
  725. return true;
  726. }
  727. if (key in el && isNativeOn(key) && shared.isFunction(value)) {
  728. return true;
  729. }
  730. return false;
  731. }
  732. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  733. return false;
  734. }
  735. if (key === "sandbox" && el.tagName === "IFRAME") {
  736. return false;
  737. }
  738. if (key === "form") {
  739. return false;
  740. }
  741. if (key === "list" && el.tagName === "INPUT") {
  742. return false;
  743. }
  744. if (key === "type" && el.tagName === "TEXTAREA") {
  745. return false;
  746. }
  747. if (key === "width" || key === "height") {
  748. const tag = el.tagName;
  749. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  750. return false;
  751. }
  752. }
  753. if (isNativeOn(key) && shared.isString(value)) {
  754. return false;
  755. }
  756. return key in el;
  757. }
  758. function shouldSetAsPropForVueCE(el, key) {
  759. const props = (
  760. // @ts-expect-error _def is private
  761. el._def.props
  762. );
  763. if (!props) {
  764. return false;
  765. }
  766. const camelKey = shared.camelize(key);
  767. return Array.isArray(props) ? props.some((prop) => shared.camelize(prop) === camelKey) : Object.keys(props).some((prop) => shared.camelize(prop) === camelKey);
  768. }
  769. const REMOVAL = {};
  770. // @__NO_SIDE_EFFECTS__
  771. function defineCustomElement(options, extraOptions, _createApp) {
  772. let Comp = runtimeCore.defineComponent(options, extraOptions);
  773. if (shared.isPlainObject(Comp)) Comp = shared.extend({}, Comp, extraOptions);
  774. class VueCustomElement extends VueElement {
  775. constructor(initialProps) {
  776. super(Comp, initialProps, _createApp);
  777. }
  778. }
  779. VueCustomElement.def = Comp;
  780. return VueCustomElement;
  781. }
  782. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  783. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  784. });
  785. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  786. };
  787. class VueElement extends BaseClass {
  788. constructor(_def, _props = {}, _createApp = createApp) {
  789. super();
  790. this._def = _def;
  791. this._props = _props;
  792. this._createApp = _createApp;
  793. this._isVueCE = true;
  794. /**
  795. * @internal
  796. */
  797. this._instance = null;
  798. /**
  799. * @internal
  800. */
  801. this._app = null;
  802. /**
  803. * @internal
  804. */
  805. this._nonce = this._def.nonce;
  806. this._connected = false;
  807. this._resolved = false;
  808. this._patching = false;
  809. this._dirty = false;
  810. this._numberProps = null;
  811. this._styleChildren = /* @__PURE__ */ new WeakSet();
  812. this._styleAnchors = /* @__PURE__ */ new WeakMap();
  813. this._ob = null;
  814. if (this.shadowRoot && _createApp !== createApp) {
  815. this._root = this.shadowRoot;
  816. } else {
  817. if (this.shadowRoot) {
  818. runtimeCore.warn(
  819. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  820. );
  821. }
  822. if (_def.shadowRoot !== false) {
  823. this.attachShadow(
  824. shared.extend({}, _def.shadowRootOptions, {
  825. mode: "open"
  826. })
  827. );
  828. this._root = this.shadowRoot;
  829. } else {
  830. this._root = this;
  831. }
  832. }
  833. }
  834. connectedCallback() {
  835. if (!this.isConnected) return;
  836. if (!this.shadowRoot && !this._resolved) {
  837. this._parseSlots();
  838. }
  839. this._connected = true;
  840. let parent = this;
  841. while (parent = parent && // #12479 should check assignedSlot first to get correct parent
  842. (parent.assignedSlot || parent.parentNode || parent.host)) {
  843. if (parent instanceof VueElement) {
  844. this._parent = parent;
  845. break;
  846. }
  847. }
  848. if (!this._instance) {
  849. if (this._resolved) {
  850. this._mount(this._def);
  851. } else {
  852. if (parent && parent._pendingResolve) {
  853. this._pendingResolve = parent._pendingResolve.then(() => {
  854. this._pendingResolve = void 0;
  855. this._resolveDef();
  856. });
  857. } else {
  858. this._resolveDef();
  859. }
  860. }
  861. }
  862. }
  863. _setParent(parent = this._parent) {
  864. if (parent) {
  865. this._instance.parent = parent._instance;
  866. this._inheritParentContext(parent);
  867. }
  868. }
  869. _inheritParentContext(parent = this._parent) {
  870. if (parent && this._app) {
  871. Object.setPrototypeOf(
  872. this._app._context.provides,
  873. parent._instance.provides
  874. );
  875. }
  876. }
  877. disconnectedCallback() {
  878. this._connected = false;
  879. runtimeCore.nextTick(() => {
  880. if (!this._connected) {
  881. if (this._ob) {
  882. this._ob.disconnect();
  883. this._ob = null;
  884. }
  885. this._app && this._app.unmount();
  886. if (this._instance) this._instance.ce = void 0;
  887. this._app = this._instance = null;
  888. if (this._teleportTargets) {
  889. this._teleportTargets.clear();
  890. this._teleportTargets = void 0;
  891. }
  892. }
  893. });
  894. }
  895. _processMutations(mutations) {
  896. for (const m of mutations) {
  897. this._setAttr(m.attributeName);
  898. }
  899. }
  900. /**
  901. * resolve inner component definition (handle possible async component)
  902. */
  903. _resolveDef() {
  904. if (this._pendingResolve) {
  905. return;
  906. }
  907. for (let i = 0; i < this.attributes.length; i++) {
  908. this._setAttr(this.attributes[i].name);
  909. }
  910. this._ob = new MutationObserver(this._processMutations.bind(this));
  911. this._ob.observe(this, { attributes: true });
  912. const resolve = (def, isAsync = false) => {
  913. this._resolved = true;
  914. this._pendingResolve = void 0;
  915. const { props, styles } = def;
  916. let numberProps;
  917. if (props && !shared.isArray(props)) {
  918. for (const key in props) {
  919. const opt = props[key];
  920. if (opt === Number || opt && opt.type === Number) {
  921. if (key in this._props) {
  922. this._props[key] = shared.toNumber(this._props[key]);
  923. }
  924. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[shared.camelize(key)] = true;
  925. }
  926. }
  927. }
  928. this._numberProps = numberProps;
  929. this._resolveProps(def);
  930. if (this.shadowRoot) {
  931. this._applyStyles(styles);
  932. } else if (styles) {
  933. runtimeCore.warn(
  934. "Custom element style injection is not supported when using shadowRoot: false"
  935. );
  936. }
  937. this._mount(def);
  938. };
  939. const asyncDef = this._def.__asyncLoader;
  940. if (asyncDef) {
  941. this._pendingResolve = asyncDef().then((def) => {
  942. def.configureApp = this._def.configureApp;
  943. resolve(this._def = def, true);
  944. });
  945. } else {
  946. resolve(this._def);
  947. }
  948. }
  949. _mount(def) {
  950. if (!def.name) {
  951. def.name = "VueElement";
  952. }
  953. this._app = this._createApp(def);
  954. this._inheritParentContext();
  955. if (def.configureApp) {
  956. def.configureApp(this._app);
  957. }
  958. this._app._ceVNode = this._createVNode();
  959. this._app.mount(this._root);
  960. const exposed = this._instance && this._instance.exposed;
  961. if (!exposed) return;
  962. for (const key in exposed) {
  963. if (!shared.hasOwn(this, key)) {
  964. Object.defineProperty(this, key, {
  965. // unwrap ref to be consistent with public instance behavior
  966. get: () => runtimeCore.unref(exposed[key])
  967. });
  968. } else {
  969. runtimeCore.warn(`Exposed property "${key}" already exists on custom element.`);
  970. }
  971. }
  972. }
  973. _resolveProps(def) {
  974. const { props } = def;
  975. const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
  976. for (const key of Object.keys(this)) {
  977. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  978. this._setProp(key, this[key]);
  979. }
  980. }
  981. for (const key of declaredPropKeys.map(shared.camelize)) {
  982. Object.defineProperty(this, key, {
  983. get() {
  984. return this._getProp(key);
  985. },
  986. set(val) {
  987. this._setProp(key, val, true, !this._patching);
  988. }
  989. });
  990. }
  991. }
  992. _setAttr(key) {
  993. if (key.startsWith("data-v-")) return;
  994. const has = this.hasAttribute(key);
  995. let value = has ? this.getAttribute(key) : REMOVAL;
  996. const camelKey = shared.camelize(key);
  997. if (has && this._numberProps && this._numberProps[camelKey]) {
  998. value = shared.toNumber(value);
  999. }
  1000. this._setProp(camelKey, value, false, true);
  1001. }
  1002. /**
  1003. * @internal
  1004. */
  1005. _getProp(key) {
  1006. return this._props[key];
  1007. }
  1008. /**
  1009. * @internal
  1010. */
  1011. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  1012. if (val !== this._props[key]) {
  1013. this._dirty = true;
  1014. if (val === REMOVAL) {
  1015. delete this._props[key];
  1016. } else {
  1017. this._props[key] = val;
  1018. if (key === "key" && this._app) {
  1019. this._app._ceVNode.key = val;
  1020. }
  1021. }
  1022. if (shouldUpdate && this._instance) {
  1023. this._update();
  1024. }
  1025. if (shouldReflect) {
  1026. const ob = this._ob;
  1027. if (ob) {
  1028. this._processMutations(ob.takeRecords());
  1029. ob.disconnect();
  1030. }
  1031. if (val === true) {
  1032. this.setAttribute(shared.hyphenate(key), "");
  1033. } else if (typeof val === "string" || typeof val === "number") {
  1034. this.setAttribute(shared.hyphenate(key), val + "");
  1035. } else if (!val) {
  1036. this.removeAttribute(shared.hyphenate(key));
  1037. }
  1038. ob && ob.observe(this, { attributes: true });
  1039. }
  1040. }
  1041. }
  1042. _update() {
  1043. const vnode = this._createVNode();
  1044. if (this._app) vnode.appContext = this._app._context;
  1045. render(vnode, this._root);
  1046. }
  1047. _createVNode() {
  1048. const baseProps = {};
  1049. if (!this.shadowRoot) {
  1050. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  1051. }
  1052. const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
  1053. if (!this._instance) {
  1054. vnode.ce = (instance) => {
  1055. this._instance = instance;
  1056. instance.ce = this;
  1057. instance.isCE = true;
  1058. {
  1059. instance.ceReload = (newStyles) => {
  1060. if (this._styles) {
  1061. this._styles.forEach((s) => this._root.removeChild(s));
  1062. this._styles.length = 0;
  1063. }
  1064. this._styleAnchors.delete(this._def);
  1065. this._applyStyles(newStyles);
  1066. this._instance = null;
  1067. this._update();
  1068. };
  1069. }
  1070. const dispatch = (event, args) => {
  1071. this.dispatchEvent(
  1072. new CustomEvent(
  1073. event,
  1074. shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
  1075. )
  1076. );
  1077. };
  1078. instance.emit = (event, ...args) => {
  1079. dispatch(event, args);
  1080. if (shared.hyphenate(event) !== event) {
  1081. dispatch(shared.hyphenate(event), args);
  1082. }
  1083. };
  1084. this._setParent();
  1085. };
  1086. }
  1087. return vnode;
  1088. }
  1089. _applyStyles(styles, owner, parentComp) {
  1090. if (!styles) return;
  1091. if (owner) {
  1092. if (owner === this._def || this._styleChildren.has(owner)) {
  1093. return;
  1094. }
  1095. this._styleChildren.add(owner);
  1096. }
  1097. const nonce = this._nonce;
  1098. const root = this.shadowRoot;
  1099. const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
  1100. let last = null;
  1101. for (let i = styles.length - 1; i >= 0; i--) {
  1102. const s = document.createElement("style");
  1103. if (nonce) s.setAttribute("nonce", nonce);
  1104. s.textContent = styles[i];
  1105. root.insertBefore(s, last || insertionAnchor);
  1106. last = s;
  1107. if (i === 0) {
  1108. if (!parentComp) this._styleAnchors.set(this._def, s);
  1109. if (owner) this._styleAnchors.set(owner, s);
  1110. }
  1111. {
  1112. if (owner) {
  1113. if (owner.__hmrId) {
  1114. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  1115. let entry = this._childStyles.get(owner.__hmrId);
  1116. if (!entry) {
  1117. this._childStyles.set(owner.__hmrId, entry = []);
  1118. }
  1119. entry.push(s);
  1120. }
  1121. } else {
  1122. (this._styles || (this._styles = [])).push(s);
  1123. }
  1124. }
  1125. }
  1126. }
  1127. _getStyleAnchor(comp) {
  1128. if (!comp) {
  1129. return null;
  1130. }
  1131. const anchor = this._styleAnchors.get(comp);
  1132. if (anchor && anchor.parentNode === this.shadowRoot) {
  1133. return anchor;
  1134. }
  1135. if (anchor) {
  1136. this._styleAnchors.delete(comp);
  1137. }
  1138. return null;
  1139. }
  1140. _getRootStyleInsertionAnchor(root) {
  1141. for (let i = 0; i < root.childNodes.length; i++) {
  1142. const node = root.childNodes[i];
  1143. if (!(node instanceof HTMLStyleElement)) {
  1144. return node;
  1145. }
  1146. }
  1147. return null;
  1148. }
  1149. /**
  1150. * Only called when shadowRoot is false
  1151. */
  1152. _parseSlots() {
  1153. const slots = this._slots = {};
  1154. let n;
  1155. while (n = this.firstChild) {
  1156. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  1157. (slots[slotName] || (slots[slotName] = [])).push(n);
  1158. this.removeChild(n);
  1159. }
  1160. }
  1161. /**
  1162. * Only called when shadowRoot is false
  1163. */
  1164. _renderSlots() {
  1165. const outlets = this._getSlots();
  1166. const scopeId = this._instance.type.__scopeId;
  1167. for (let i = 0; i < outlets.length; i++) {
  1168. const o = outlets[i];
  1169. const slotName = o.getAttribute("name") || "default";
  1170. const content = this._slots[slotName];
  1171. const parent = o.parentNode;
  1172. if (content) {
  1173. for (const n of content) {
  1174. if (scopeId && n.nodeType === 1) {
  1175. const id = scopeId + "-s";
  1176. const walker = document.createTreeWalker(n, 1);
  1177. n.setAttribute(id, "");
  1178. let child;
  1179. while (child = walker.nextNode()) {
  1180. child.setAttribute(id, "");
  1181. }
  1182. }
  1183. parent.insertBefore(n, o);
  1184. }
  1185. } else {
  1186. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  1187. }
  1188. parent.removeChild(o);
  1189. }
  1190. }
  1191. /**
  1192. * @internal
  1193. */
  1194. _getSlots() {
  1195. const roots = [this];
  1196. if (this._teleportTargets) {
  1197. roots.push(...this._teleportTargets);
  1198. }
  1199. const slots = /* @__PURE__ */ new Set();
  1200. for (const root of roots) {
  1201. const found = root.querySelectorAll("slot");
  1202. for (let i = 0; i < found.length; i++) {
  1203. slots.add(found[i]);
  1204. }
  1205. }
  1206. return Array.from(slots);
  1207. }
  1208. /**
  1209. * @internal
  1210. */
  1211. _injectChildStyle(comp, parentComp) {
  1212. this._applyStyles(comp.styles, comp, parentComp);
  1213. }
  1214. /**
  1215. * @internal
  1216. */
  1217. _beginPatch() {
  1218. this._patching = true;
  1219. this._dirty = false;
  1220. }
  1221. /**
  1222. * @internal
  1223. */
  1224. _endPatch() {
  1225. this._patching = false;
  1226. if (this._dirty && this._instance) {
  1227. this._update();
  1228. }
  1229. }
  1230. /**
  1231. * @internal
  1232. */
  1233. _hasShadowRoot() {
  1234. return this._def.shadowRoot !== false;
  1235. }
  1236. /**
  1237. * @internal
  1238. */
  1239. _removeChildStyle(comp) {
  1240. {
  1241. this._styleChildren.delete(comp);
  1242. this._styleAnchors.delete(comp);
  1243. if (this._childStyles && comp.__hmrId) {
  1244. const oldStyles = this._childStyles.get(comp.__hmrId);
  1245. if (oldStyles) {
  1246. oldStyles.forEach((s) => this._root.removeChild(s));
  1247. oldStyles.length = 0;
  1248. }
  1249. }
  1250. }
  1251. }
  1252. }
  1253. function useHost(caller) {
  1254. const instance = runtimeCore.getCurrentInstance();
  1255. const el = instance && instance.ce;
  1256. if (el) {
  1257. return el;
  1258. } else {
  1259. if (!instance) {
  1260. runtimeCore.warn(
  1261. `${caller || "useHost"} called without an active component instance.`
  1262. );
  1263. } else {
  1264. runtimeCore.warn(
  1265. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  1266. );
  1267. }
  1268. }
  1269. return null;
  1270. }
  1271. function useShadowRoot() {
  1272. const el = useHost("useShadowRoot") ;
  1273. return el && el.shadowRoot;
  1274. }
  1275. function useCssModule(name = "$style") {
  1276. {
  1277. const instance = runtimeCore.getCurrentInstance();
  1278. if (!instance) {
  1279. runtimeCore.warn(`useCssModule must be called inside setup()`);
  1280. return shared.EMPTY_OBJ;
  1281. }
  1282. const modules = instance.type.__cssModules;
  1283. if (!modules) {
  1284. runtimeCore.warn(`Current instance does not have CSS modules injected.`);
  1285. return shared.EMPTY_OBJ;
  1286. }
  1287. const mod = modules[name];
  1288. if (!mod) {
  1289. runtimeCore.warn(`Current instance does not have CSS module named "${name}".`);
  1290. return shared.EMPTY_OBJ;
  1291. }
  1292. return mod;
  1293. }
  1294. }
  1295. const positionMap = /* @__PURE__ */ new WeakMap();
  1296. const newPositionMap = /* @__PURE__ */ new WeakMap();
  1297. const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
  1298. const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
  1299. const decorate = (t) => {
  1300. delete t.props.mode;
  1301. return t;
  1302. };
  1303. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  1304. name: "TransitionGroup",
  1305. props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
  1306. tag: String,
  1307. moveClass: String
  1308. }),
  1309. setup(props, { slots }) {
  1310. const instance = runtimeCore.getCurrentInstance();
  1311. const state = runtimeCore.useTransitionState();
  1312. let prevChildren;
  1313. let children;
  1314. runtimeCore.onUpdated(() => {
  1315. if (!prevChildren.length) {
  1316. return;
  1317. }
  1318. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  1319. if (!hasCSSTransform(
  1320. prevChildren[0].el,
  1321. instance.vnode.el,
  1322. moveClass
  1323. )) {
  1324. prevChildren = [];
  1325. return;
  1326. }
  1327. prevChildren.forEach(callPendingCbs);
  1328. prevChildren.forEach(recordPosition);
  1329. const movedChildren = prevChildren.filter(applyTranslation);
  1330. forceReflow(instance.vnode.el);
  1331. movedChildren.forEach((c) => {
  1332. const el = c.el;
  1333. const style = el.style;
  1334. addTransitionClass(el, moveClass);
  1335. style.transform = style.webkitTransform = style.transitionDuration = "";
  1336. const cb = el[moveCbKey] = (e) => {
  1337. if (e && e.target !== el) {
  1338. return;
  1339. }
  1340. if (!e || e.propertyName.endsWith("transform")) {
  1341. el.removeEventListener("transitionend", cb);
  1342. el[moveCbKey] = null;
  1343. removeTransitionClass(el, moveClass);
  1344. }
  1345. };
  1346. el.addEventListener("transitionend", cb);
  1347. });
  1348. prevChildren = [];
  1349. });
  1350. return () => {
  1351. const rawProps = runtimeCore.toRaw(props);
  1352. const cssTransitionProps = resolveTransitionProps(rawProps);
  1353. let tag = rawProps.tag || runtimeCore.Fragment;
  1354. prevChildren = [];
  1355. if (children) {
  1356. for (let i = 0; i < children.length; i++) {
  1357. const child = children[i];
  1358. if (child.el && child.el instanceof Element) {
  1359. prevChildren.push(child);
  1360. runtimeCore.setTransitionHooks(
  1361. child,
  1362. runtimeCore.resolveTransitionHooks(
  1363. child,
  1364. cssTransitionProps,
  1365. state,
  1366. instance
  1367. )
  1368. );
  1369. positionMap.set(child, getPosition(child.el));
  1370. }
  1371. }
  1372. }
  1373. children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
  1374. for (let i = 0; i < children.length; i++) {
  1375. const child = children[i];
  1376. if (child.key != null) {
  1377. runtimeCore.setTransitionHooks(
  1378. child,
  1379. runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
  1380. );
  1381. } else if (child.type !== runtimeCore.Text) {
  1382. runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
  1383. }
  1384. }
  1385. return runtimeCore.createVNode(tag, null, children);
  1386. };
  1387. }
  1388. });
  1389. const TransitionGroup = TransitionGroupImpl;
  1390. function callPendingCbs(c) {
  1391. const el = c.el;
  1392. if (el[moveCbKey]) {
  1393. el[moveCbKey]();
  1394. }
  1395. if (el[enterCbKey]) {
  1396. el[enterCbKey]();
  1397. }
  1398. }
  1399. function recordPosition(c) {
  1400. newPositionMap.set(c, getPosition(c.el));
  1401. }
  1402. function applyTranslation(c) {
  1403. const oldPos = positionMap.get(c);
  1404. const newPos = newPositionMap.get(c);
  1405. const dx = oldPos.left - newPos.left;
  1406. const dy = oldPos.top - newPos.top;
  1407. if (dx || dy) {
  1408. const el = c.el;
  1409. const s = el.style;
  1410. const rect = el.getBoundingClientRect();
  1411. let scaleX = 1;
  1412. let scaleY = 1;
  1413. if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
  1414. if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
  1415. if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
  1416. if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
  1417. if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
  1418. if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
  1419. s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
  1420. s.transitionDuration = "0s";
  1421. return c;
  1422. }
  1423. }
  1424. function getPosition(el) {
  1425. const rect = el.getBoundingClientRect();
  1426. return {
  1427. left: rect.left,
  1428. top: rect.top
  1429. };
  1430. }
  1431. function hasCSSTransform(el, root, moveClass) {
  1432. const clone = el.cloneNode();
  1433. const _vtc = el[vtcKey];
  1434. if (_vtc) {
  1435. _vtc.forEach((cls) => {
  1436. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  1437. });
  1438. }
  1439. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  1440. clone.style.display = "none";
  1441. const container = root.nodeType === 1 ? root : root.parentNode;
  1442. container.appendChild(clone);
  1443. const { hasTransform } = getTransitionInfo(clone);
  1444. container.removeChild(clone);
  1445. return hasTransform;
  1446. }
  1447. const getModelAssigner = (vnode) => {
  1448. const fn = vnode.props["onUpdate:modelValue"] || false;
  1449. return shared.isArray(fn) ? (value) => shared.invokeArrayFns(fn, value) : fn;
  1450. };
  1451. function onCompositionStart(e) {
  1452. e.target.composing = true;
  1453. }
  1454. function onCompositionEnd(e) {
  1455. const target = e.target;
  1456. if (target.composing) {
  1457. target.composing = false;
  1458. target.dispatchEvent(new Event("input"));
  1459. }
  1460. }
  1461. const assignKey = /* @__PURE__ */ Symbol("_assign");
  1462. function castValue(value, trim, number) {
  1463. if (trim) value = value.trim();
  1464. if (number) value = shared.looseToNumber(value);
  1465. return value;
  1466. }
  1467. const vModelText = {
  1468. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  1469. el[assignKey] = getModelAssigner(vnode);
  1470. const castToNumber = number || vnode.props && vnode.props.type === "number";
  1471. addEventListener(el, lazy ? "change" : "input", (e) => {
  1472. if (e.target.composing) return;
  1473. el[assignKey](castValue(el.value, trim, castToNumber));
  1474. });
  1475. if (trim || castToNumber) {
  1476. addEventListener(el, "change", () => {
  1477. el.value = castValue(el.value, trim, castToNumber);
  1478. });
  1479. }
  1480. if (!lazy) {
  1481. addEventListener(el, "compositionstart", onCompositionStart);
  1482. addEventListener(el, "compositionend", onCompositionEnd);
  1483. addEventListener(el, "change", onCompositionEnd);
  1484. }
  1485. },
  1486. // set value on mounted so it's after min/max for type="range"
  1487. mounted(el, { value }) {
  1488. el.value = value == null ? "" : value;
  1489. },
  1490. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  1491. el[assignKey] = getModelAssigner(vnode);
  1492. if (el.composing) return;
  1493. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
  1494. const newValue = value == null ? "" : value;
  1495. if (elValue === newValue) {
  1496. return;
  1497. }
  1498. const rootNode = el.getRootNode();
  1499. if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
  1500. if (lazy && value === oldValue) {
  1501. return;
  1502. }
  1503. if (trim && el.value.trim() === newValue) {
  1504. return;
  1505. }
  1506. }
  1507. el.value = newValue;
  1508. }
  1509. };
  1510. const vModelCheckbox = {
  1511. // #4096 array checkboxes need to be deep traversed
  1512. deep: true,
  1513. created(el, _, vnode) {
  1514. el[assignKey] = getModelAssigner(vnode);
  1515. addEventListener(el, "change", () => {
  1516. const modelValue = el._modelValue;
  1517. const elementValue = getValue(el);
  1518. const checked = el.checked;
  1519. const assign = el[assignKey];
  1520. if (shared.isArray(modelValue)) {
  1521. const index = shared.looseIndexOf(modelValue, elementValue);
  1522. const found = index !== -1;
  1523. if (checked && !found) {
  1524. assign(modelValue.concat(elementValue));
  1525. } else if (!checked && found) {
  1526. const filtered = [...modelValue];
  1527. filtered.splice(index, 1);
  1528. assign(filtered);
  1529. }
  1530. } else if (shared.isSet(modelValue)) {
  1531. const cloned = new Set(modelValue);
  1532. if (checked) {
  1533. cloned.add(elementValue);
  1534. } else {
  1535. cloned.delete(elementValue);
  1536. }
  1537. assign(cloned);
  1538. } else {
  1539. assign(getCheckboxValue(el, checked));
  1540. }
  1541. });
  1542. },
  1543. // set initial checked on mount to wait for true-value/false-value
  1544. mounted: setChecked,
  1545. beforeUpdate(el, binding, vnode) {
  1546. el[assignKey] = getModelAssigner(vnode);
  1547. setChecked(el, binding, vnode);
  1548. }
  1549. };
  1550. function setChecked(el, { value, oldValue }, vnode) {
  1551. el._modelValue = value;
  1552. let checked;
  1553. if (shared.isArray(value)) {
  1554. checked = shared.looseIndexOf(value, vnode.props.value) > -1;
  1555. } else if (shared.isSet(value)) {
  1556. checked = value.has(vnode.props.value);
  1557. } else {
  1558. if (value === oldValue) return;
  1559. checked = shared.looseEqual(value, getCheckboxValue(el, true));
  1560. }
  1561. if (el.checked !== checked) {
  1562. el.checked = checked;
  1563. }
  1564. }
  1565. const vModelRadio = {
  1566. created(el, { value }, vnode) {
  1567. el.checked = shared.looseEqual(value, vnode.props.value);
  1568. el[assignKey] = getModelAssigner(vnode);
  1569. addEventListener(el, "change", () => {
  1570. el[assignKey](getValue(el));
  1571. });
  1572. },
  1573. beforeUpdate(el, { value, oldValue }, vnode) {
  1574. el[assignKey] = getModelAssigner(vnode);
  1575. if (value !== oldValue) {
  1576. el.checked = shared.looseEqual(value, vnode.props.value);
  1577. }
  1578. }
  1579. };
  1580. const vModelSelect = {
  1581. // <select multiple> value need to be deep traversed
  1582. deep: true,
  1583. created(el, { value, modifiers: { number } }, vnode) {
  1584. const isSetModel = shared.isSet(value);
  1585. addEventListener(el, "change", () => {
  1586. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  1587. (o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
  1588. );
  1589. el[assignKey](
  1590. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  1591. );
  1592. el._assigning = true;
  1593. runtimeCore.nextTick(() => {
  1594. el._assigning = false;
  1595. });
  1596. });
  1597. el[assignKey] = getModelAssigner(vnode);
  1598. },
  1599. // set value in mounted & updated because <select> relies on its children
  1600. // <option>s.
  1601. mounted(el, { value }) {
  1602. setSelected(el, value);
  1603. },
  1604. beforeUpdate(el, _binding, vnode) {
  1605. el[assignKey] = getModelAssigner(vnode);
  1606. },
  1607. updated(el, { value }) {
  1608. if (!el._assigning) {
  1609. setSelected(el, value);
  1610. }
  1611. }
  1612. };
  1613. function setSelected(el, value) {
  1614. const isMultiple = el.multiple;
  1615. const isArrayValue = shared.isArray(value);
  1616. if (isMultiple && !isArrayValue && !shared.isSet(value)) {
  1617. runtimeCore.warn(
  1618. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  1619. );
  1620. return;
  1621. }
  1622. for (let i = 0, l = el.options.length; i < l; i++) {
  1623. const option = el.options[i];
  1624. const optionValue = getValue(option);
  1625. if (isMultiple) {
  1626. if (isArrayValue) {
  1627. const optionType = typeof optionValue;
  1628. if (optionType === "string" || optionType === "number") {
  1629. option.selected = value.some((v) => String(v) === String(optionValue));
  1630. } else {
  1631. option.selected = shared.looseIndexOf(value, optionValue) > -1;
  1632. }
  1633. } else {
  1634. option.selected = value.has(optionValue);
  1635. }
  1636. } else if (shared.looseEqual(getValue(option), value)) {
  1637. if (el.selectedIndex !== i) el.selectedIndex = i;
  1638. return;
  1639. }
  1640. }
  1641. if (!isMultiple && el.selectedIndex !== -1) {
  1642. el.selectedIndex = -1;
  1643. }
  1644. }
  1645. function getValue(el) {
  1646. return "_value" in el ? el._value : el.value;
  1647. }
  1648. function getCheckboxValue(el, checked) {
  1649. const key = checked ? "_trueValue" : "_falseValue";
  1650. return key in el ? el[key] : checked;
  1651. }
  1652. const vModelDynamic = {
  1653. created(el, binding, vnode) {
  1654. callModelHook(el, binding, vnode, null, "created");
  1655. },
  1656. mounted(el, binding, vnode) {
  1657. callModelHook(el, binding, vnode, null, "mounted");
  1658. },
  1659. beforeUpdate(el, binding, vnode, prevVNode) {
  1660. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  1661. },
  1662. updated(el, binding, vnode, prevVNode) {
  1663. callModelHook(el, binding, vnode, prevVNode, "updated");
  1664. }
  1665. };
  1666. function resolveDynamicModel(tagName, type) {
  1667. switch (tagName) {
  1668. case "SELECT":
  1669. return vModelSelect;
  1670. case "TEXTAREA":
  1671. return vModelText;
  1672. default:
  1673. switch (type) {
  1674. case "checkbox":
  1675. return vModelCheckbox;
  1676. case "radio":
  1677. return vModelRadio;
  1678. default:
  1679. return vModelText;
  1680. }
  1681. }
  1682. }
  1683. function callModelHook(el, binding, vnode, prevVNode, hook) {
  1684. const modelToUse = resolveDynamicModel(
  1685. el.tagName,
  1686. vnode.props && vnode.props.type
  1687. );
  1688. const fn = modelToUse[hook];
  1689. fn && fn(el, binding, vnode, prevVNode);
  1690. }
  1691. function initVModelForSSR() {
  1692. vModelText.getSSRProps = ({ value }) => ({ value });
  1693. vModelRadio.getSSRProps = ({ value }, vnode) => {
  1694. if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
  1695. return { checked: true };
  1696. }
  1697. };
  1698. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  1699. if (shared.isArray(value)) {
  1700. if (vnode.props && shared.looseIndexOf(value, vnode.props.value) > -1) {
  1701. return { checked: true };
  1702. }
  1703. } else if (shared.isSet(value)) {
  1704. if (vnode.props && value.has(vnode.props.value)) {
  1705. return { checked: true };
  1706. }
  1707. } else if (value) {
  1708. return { checked: true };
  1709. }
  1710. };
  1711. vModelDynamic.getSSRProps = (binding, vnode) => {
  1712. if (typeof vnode.type !== "string") {
  1713. return;
  1714. }
  1715. const modelToUse = resolveDynamicModel(
  1716. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  1717. vnode.type.toUpperCase(),
  1718. vnode.props && vnode.props.type
  1719. );
  1720. if (modelToUse.getSSRProps) {
  1721. return modelToUse.getSSRProps(binding, vnode);
  1722. }
  1723. };
  1724. }
  1725. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  1726. const modifierGuards = {
  1727. stop: (e) => e.stopPropagation(),
  1728. prevent: (e) => e.preventDefault(),
  1729. self: (e) => e.target !== e.currentTarget,
  1730. ctrl: (e) => !e.ctrlKey,
  1731. shift: (e) => !e.shiftKey,
  1732. alt: (e) => !e.altKey,
  1733. meta: (e) => !e.metaKey,
  1734. left: (e) => "button" in e && e.button !== 0,
  1735. middle: (e) => "button" in e && e.button !== 1,
  1736. right: (e) => "button" in e && e.button !== 2,
  1737. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  1738. };
  1739. const withModifiers = (fn, modifiers) => {
  1740. if (!fn) return fn;
  1741. const cache = fn._withMods || (fn._withMods = {});
  1742. const cacheKey = modifiers.join(".");
  1743. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  1744. for (let i = 0; i < modifiers.length; i++) {
  1745. const guard = modifierGuards[modifiers[i]];
  1746. if (guard && guard(event, modifiers)) return;
  1747. }
  1748. return fn(event, ...args);
  1749. }));
  1750. };
  1751. const keyNames = {
  1752. esc: "escape",
  1753. space: " ",
  1754. up: "arrow-up",
  1755. left: "arrow-left",
  1756. right: "arrow-right",
  1757. down: "arrow-down",
  1758. delete: "backspace"
  1759. };
  1760. const withKeys = (fn, modifiers) => {
  1761. const cache = fn._withKeys || (fn._withKeys = {});
  1762. const cacheKey = modifiers.join(".");
  1763. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  1764. if (!("key" in event)) {
  1765. return;
  1766. }
  1767. const eventKey = shared.hyphenate(event.key);
  1768. if (modifiers.some(
  1769. (k) => k === eventKey || keyNames[k] === eventKey
  1770. )) {
  1771. return fn(event);
  1772. }
  1773. }));
  1774. };
  1775. const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
  1776. let renderer;
  1777. let enabledHydration = false;
  1778. function ensureRenderer() {
  1779. return renderer || (renderer = runtimeCore.createRenderer(rendererOptions));
  1780. }
  1781. function ensureHydrationRenderer() {
  1782. renderer = enabledHydration ? renderer : runtimeCore.createHydrationRenderer(rendererOptions);
  1783. enabledHydration = true;
  1784. return renderer;
  1785. }
  1786. const render = ((...args) => {
  1787. ensureRenderer().render(...args);
  1788. });
  1789. const hydrate = ((...args) => {
  1790. ensureHydrationRenderer().hydrate(...args);
  1791. });
  1792. const createApp = ((...args) => {
  1793. const app = ensureRenderer().createApp(...args);
  1794. {
  1795. injectNativeTagCheck(app);
  1796. injectCompilerOptionsCheck(app);
  1797. }
  1798. const { mount } = app;
  1799. app.mount = (containerOrSelector) => {
  1800. const container = normalizeContainer(containerOrSelector);
  1801. if (!container) return;
  1802. const component = app._component;
  1803. if (!shared.isFunction(component) && !component.render && !component.template) {
  1804. component.template = container.innerHTML;
  1805. }
  1806. if (container.nodeType === 1) {
  1807. container.textContent = "";
  1808. }
  1809. const proxy = mount(container, false, resolveRootNamespace(container));
  1810. if (container instanceof Element) {
  1811. container.removeAttribute("v-cloak");
  1812. container.setAttribute("data-v-app", "");
  1813. }
  1814. return proxy;
  1815. };
  1816. return app;
  1817. });
  1818. const createSSRApp = ((...args) => {
  1819. const app = ensureHydrationRenderer().createApp(...args);
  1820. {
  1821. injectNativeTagCheck(app);
  1822. injectCompilerOptionsCheck(app);
  1823. }
  1824. const { mount } = app;
  1825. app.mount = (containerOrSelector) => {
  1826. const container = normalizeContainer(containerOrSelector);
  1827. if (container) {
  1828. return mount(container, true, resolveRootNamespace(container));
  1829. }
  1830. };
  1831. return app;
  1832. });
  1833. function resolveRootNamespace(container) {
  1834. if (container instanceof SVGElement) {
  1835. return "svg";
  1836. }
  1837. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  1838. return "mathml";
  1839. }
  1840. }
  1841. function injectNativeTagCheck(app) {
  1842. Object.defineProperty(app.config, "isNativeTag", {
  1843. value: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
  1844. writable: false
  1845. });
  1846. }
  1847. function injectCompilerOptionsCheck(app) {
  1848. if (runtimeCore.isRuntimeOnly()) {
  1849. const isCustomElement = app.config.isCustomElement;
  1850. Object.defineProperty(app.config, "isCustomElement", {
  1851. get() {
  1852. return isCustomElement;
  1853. },
  1854. set() {
  1855. runtimeCore.warn(
  1856. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  1857. );
  1858. }
  1859. });
  1860. const compilerOptions = app.config.compilerOptions;
  1861. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  1862. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  1863. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  1864. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  1865. Object.defineProperty(app.config, "compilerOptions", {
  1866. get() {
  1867. runtimeCore.warn(msg);
  1868. return compilerOptions;
  1869. },
  1870. set() {
  1871. runtimeCore.warn(msg);
  1872. }
  1873. });
  1874. }
  1875. }
  1876. function normalizeContainer(container) {
  1877. if (shared.isString(container)) {
  1878. const res = document.querySelector(container);
  1879. if (!res) {
  1880. runtimeCore.warn(
  1881. `Failed to mount app: mount target selector "${container}" returned null.`
  1882. );
  1883. }
  1884. return res;
  1885. }
  1886. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  1887. runtimeCore.warn(
  1888. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  1889. );
  1890. }
  1891. return container;
  1892. }
  1893. let ssrDirectiveInitialized = false;
  1894. const initDirectivesForSSR = () => {
  1895. if (!ssrDirectiveInitialized) {
  1896. ssrDirectiveInitialized = true;
  1897. initVModelForSSR();
  1898. initVShowForSSR();
  1899. }
  1900. } ;
  1901. exports.Transition = Transition;
  1902. exports.TransitionGroup = TransitionGroup;
  1903. exports.VueElement = VueElement;
  1904. exports.createApp = createApp;
  1905. exports.createSSRApp = createSSRApp;
  1906. exports.defineCustomElement = defineCustomElement;
  1907. exports.defineSSRCustomElement = defineSSRCustomElement;
  1908. exports.hydrate = hydrate;
  1909. exports.initDirectivesForSSR = initDirectivesForSSR;
  1910. exports.nodeOps = nodeOps;
  1911. exports.patchProp = patchProp;
  1912. exports.render = render;
  1913. exports.useCssModule = useCssModule;
  1914. exports.useCssVars = useCssVars;
  1915. exports.useHost = useHost;
  1916. exports.useShadowRoot = useShadowRoot;
  1917. exports.vModelCheckbox = vModelCheckbox;
  1918. exports.vModelDynamic = vModelDynamic;
  1919. exports.vModelRadio = vModelRadio;
  1920. exports.vModelSelect = vModelSelect;
  1921. exports.vModelText = vModelText;
  1922. exports.vShow = vShow;
  1923. exports.withKeys = withKeys;
  1924. exports.withModifiers = withModifiers;
  1925. Object.keys(runtimeCore).forEach(function (k) {
  1926. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
  1927. });