runtime-dom.cjs.prod.js 53 KB

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