runtime-dom.cjs.prod.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var runtimeCore = require('@vue/runtime-core');
  4. var shared = require('@vue/shared');
  5. const svgNS = "http://www.w3.org/2000/svg";
  6. const doc = typeof document !== "undefined" ? document : null;
  7. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  8. const nodeOps = {
  9. insert: (child, parent, anchor) => {
  10. parent.insertBefore(child, anchor || null);
  11. },
  12. remove: (child) => {
  13. const parent = child.parentNode;
  14. if (parent) {
  15. parent.removeChild(child);
  16. }
  17. },
  18. createElement: (tag, isSVG, is, props) => {
  19. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  20. if (tag === "select" && props && props.multiple != null) {
  21. el.setAttribute("multiple", props.multiple);
  22. }
  23. return el;
  24. },
  25. createText: (text) => doc.createTextNode(text),
  26. createComment: (text) => doc.createComment(text),
  27. setText: (node, text) => {
  28. node.nodeValue = text;
  29. },
  30. setElementText: (el, text) => {
  31. el.textContent = text;
  32. },
  33. parentNode: (node) => node.parentNode,
  34. nextSibling: (node) => node.nextSibling,
  35. querySelector: (selector) => doc.querySelector(selector),
  36. setScopeId(el, id) {
  37. el.setAttribute(id, "");
  38. },
  39. // __UNSAFE__
  40. // Reason: innerHTML.
  41. // Static content here can only come from compiled templates.
  42. // As long as the user only uses trusted templates, this is safe.
  43. insertStaticContent(content, parent, anchor, isSVG, start, end) {
  44. const before = anchor ? anchor.previousSibling : parent.lastChild;
  45. if (start && (start === end || start.nextSibling)) {
  46. while (true) {
  47. parent.insertBefore(start.cloneNode(true), anchor);
  48. if (start === end || !(start = start.nextSibling))
  49. break;
  50. }
  51. } else {
  52. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  53. const template = templateContainer.content;
  54. if (isSVG) {
  55. const wrapper = template.firstChild;
  56. while (wrapper.firstChild) {
  57. template.appendChild(wrapper.firstChild);
  58. }
  59. template.removeChild(wrapper);
  60. }
  61. parent.insertBefore(template, anchor);
  62. }
  63. return [
  64. // first
  65. before ? before.nextSibling : parent.firstChild,
  66. // last
  67. anchor ? anchor.previousSibling : parent.lastChild
  68. ];
  69. }
  70. };
  71. const TRANSITION = "transition";
  72. const ANIMATION = "animation";
  73. const vtcKey = Symbol("_vtc");
  74. const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
  75. Transition.displayName = "Transition";
  76. const DOMTransitionPropsValidators = {
  77. name: String,
  78. type: String,
  79. css: {
  80. type: Boolean,
  81. default: true
  82. },
  83. duration: [String, Number, Object],
  84. enterFromClass: String,
  85. enterActiveClass: String,
  86. enterToClass: String,
  87. appearFromClass: String,
  88. appearActiveClass: String,
  89. appearToClass: String,
  90. leaveFromClass: String,
  91. leaveActiveClass: String,
  92. leaveToClass: String
  93. };
  94. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
  95. {},
  96. runtimeCore.BaseTransitionPropsValidators,
  97. DOMTransitionPropsValidators
  98. );
  99. const callHook = (hook, args = []) => {
  100. if (shared.isArray(hook)) {
  101. hook.forEach((h2) => h2(...args));
  102. } else if (hook) {
  103. hook(...args);
  104. }
  105. };
  106. const hasExplicitCallback = (hook) => {
  107. return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  108. };
  109. function resolveTransitionProps(rawProps) {
  110. const baseProps = {};
  111. for (const key in rawProps) {
  112. if (!(key in DOMTransitionPropsValidators)) {
  113. baseProps[key] = rawProps[key];
  114. }
  115. }
  116. if (rawProps.css === false) {
  117. return baseProps;
  118. }
  119. const {
  120. name = "v",
  121. type,
  122. duration,
  123. enterFromClass = `${name}-enter-from`,
  124. enterActiveClass = `${name}-enter-active`,
  125. enterToClass = `${name}-enter-to`,
  126. appearFromClass = enterFromClass,
  127. appearActiveClass = enterActiveClass,
  128. appearToClass = enterToClass,
  129. leaveFromClass = `${name}-leave-from`,
  130. leaveActiveClass = `${name}-leave-active`,
  131. leaveToClass = `${name}-leave-to`
  132. } = rawProps;
  133. const durations = normalizeDuration(duration);
  134. const enterDuration = durations && durations[0];
  135. const leaveDuration = durations && durations[1];
  136. const {
  137. onBeforeEnter,
  138. onEnter,
  139. onEnterCancelled,
  140. onLeave,
  141. onLeaveCancelled,
  142. onBeforeAppear = onBeforeEnter,
  143. onAppear = onEnter,
  144. onAppearCancelled = onEnterCancelled
  145. } = baseProps;
  146. const finishEnter = (el, isAppear, done) => {
  147. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  148. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  149. done && done();
  150. };
  151. const finishLeave = (el, done) => {
  152. el._isLeaving = false;
  153. removeTransitionClass(el, leaveFromClass);
  154. removeTransitionClass(el, leaveToClass);
  155. removeTransitionClass(el, leaveActiveClass);
  156. done && done();
  157. };
  158. const makeEnterHook = (isAppear) => {
  159. return (el, done) => {
  160. const hook = isAppear ? onAppear : onEnter;
  161. const resolve = () => finishEnter(el, isAppear, done);
  162. callHook(hook, [el, resolve]);
  163. nextFrame(() => {
  164. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  165. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  166. if (!hasExplicitCallback(hook)) {
  167. whenTransitionEnds(el, type, enterDuration, resolve);
  168. }
  169. });
  170. };
  171. };
  172. return shared.extend(baseProps, {
  173. onBeforeEnter(el) {
  174. callHook(onBeforeEnter, [el]);
  175. addTransitionClass(el, enterFromClass);
  176. addTransitionClass(el, enterActiveClass);
  177. },
  178. onBeforeAppear(el) {
  179. callHook(onBeforeAppear, [el]);
  180. addTransitionClass(el, appearFromClass);
  181. addTransitionClass(el, appearActiveClass);
  182. },
  183. onEnter: makeEnterHook(false),
  184. onAppear: makeEnterHook(true),
  185. onLeave(el, done) {
  186. el._isLeaving = true;
  187. const resolve = () => finishLeave(el, done);
  188. addTransitionClass(el, leaveFromClass);
  189. forceReflow();
  190. addTransitionClass(el, leaveActiveClass);
  191. nextFrame(() => {
  192. if (!el._isLeaving) {
  193. return;
  194. }
  195. removeTransitionClass(el, leaveFromClass);
  196. addTransitionClass(el, leaveToClass);
  197. if (!hasExplicitCallback(onLeave)) {
  198. whenTransitionEnds(el, type, leaveDuration, resolve);
  199. }
  200. });
  201. callHook(onLeave, [el, resolve]);
  202. },
  203. onEnterCancelled(el) {
  204. finishEnter(el, false);
  205. callHook(onEnterCancelled, [el]);
  206. },
  207. onAppearCancelled(el) {
  208. finishEnter(el, true);
  209. callHook(onAppearCancelled, [el]);
  210. },
  211. onLeaveCancelled(el) {
  212. finishLeave(el);
  213. callHook(onLeaveCancelled, [el]);
  214. }
  215. });
  216. }
  217. function normalizeDuration(duration) {
  218. if (duration == null) {
  219. return null;
  220. } else if (shared.isObject(duration)) {
  221. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  222. } else {
  223. const n = NumberOf(duration);
  224. return [n, n];
  225. }
  226. }
  227. function NumberOf(val) {
  228. const res = shared.toNumber(val);
  229. return res;
  230. }
  231. function addTransitionClass(el, cls) {
  232. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  233. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  234. }
  235. function removeTransitionClass(el, cls) {
  236. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  237. const _vtc = el[vtcKey];
  238. if (_vtc) {
  239. _vtc.delete(cls);
  240. if (!_vtc.size) {
  241. el[vtcKey] = void 0;
  242. }
  243. }
  244. }
  245. function nextFrame(cb) {
  246. requestAnimationFrame(() => {
  247. requestAnimationFrame(cb);
  248. });
  249. }
  250. let endId = 0;
  251. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  252. const id = el._endId = ++endId;
  253. const resolveIfNotStale = () => {
  254. if (id === el._endId) {
  255. resolve();
  256. }
  257. };
  258. if (explicitTimeout) {
  259. return setTimeout(resolveIfNotStale, explicitTimeout);
  260. }
  261. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  262. if (!type) {
  263. return resolve();
  264. }
  265. const endEvent = type + "end";
  266. let ended = 0;
  267. const end = () => {
  268. el.removeEventListener(endEvent, onEnd);
  269. resolveIfNotStale();
  270. };
  271. const onEnd = (e) => {
  272. if (e.target === el && ++ended >= propCount) {
  273. end();
  274. }
  275. };
  276. setTimeout(() => {
  277. if (ended < propCount) {
  278. end();
  279. }
  280. }, timeout + 1);
  281. el.addEventListener(endEvent, onEnd);
  282. }
  283. function getTransitionInfo(el, expectedType) {
  284. const styles = window.getComputedStyle(el);
  285. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  286. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  287. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  288. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  289. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  290. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  291. const animationTimeout = getTimeout(animationDelays, animationDurations);
  292. let type = null;
  293. let timeout = 0;
  294. let propCount = 0;
  295. if (expectedType === TRANSITION) {
  296. if (transitionTimeout > 0) {
  297. type = TRANSITION;
  298. timeout = transitionTimeout;
  299. propCount = transitionDurations.length;
  300. }
  301. } else if (expectedType === ANIMATION) {
  302. if (animationTimeout > 0) {
  303. type = ANIMATION;
  304. timeout = animationTimeout;
  305. propCount = animationDurations.length;
  306. }
  307. } else {
  308. timeout = Math.max(transitionTimeout, animationTimeout);
  309. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  310. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  311. }
  312. const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
  313. getStyleProperties(`${TRANSITION}Property`).toString()
  314. );
  315. return {
  316. type,
  317. timeout,
  318. propCount,
  319. hasTransform
  320. };
  321. }
  322. function getTimeout(delays, durations) {
  323. while (delays.length < durations.length) {
  324. delays = delays.concat(delays);
  325. }
  326. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  327. }
  328. function toMs(s) {
  329. if (s === "auto")
  330. return 0;
  331. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  332. }
  333. function forceReflow() {
  334. return document.body.offsetHeight;
  335. }
  336. function patchClass(el, value, isSVG) {
  337. const transitionClasses = el[vtcKey];
  338. if (transitionClasses) {
  339. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  340. }
  341. if (value == null) {
  342. el.removeAttribute("class");
  343. } else if (isSVG) {
  344. el.setAttribute("class", value);
  345. } else {
  346. el.className = value;
  347. }
  348. }
  349. const vShowOldKey = Symbol("_vod");
  350. const vShow = {
  351. beforeMount(el, { value }, { transition }) {
  352. el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
  353. if (transition && value) {
  354. transition.beforeEnter(el);
  355. } else {
  356. setDisplay(el, value);
  357. }
  358. },
  359. mounted(el, { value }, { transition }) {
  360. if (transition && value) {
  361. transition.enter(el);
  362. }
  363. },
  364. updated(el, { value, oldValue }, { transition }) {
  365. if (!value === !oldValue)
  366. return;
  367. if (transition) {
  368. if (value) {
  369. transition.beforeEnter(el);
  370. setDisplay(el, true);
  371. transition.enter(el);
  372. } else {
  373. transition.leave(el, () => {
  374. setDisplay(el, false);
  375. });
  376. }
  377. } else {
  378. setDisplay(el, value);
  379. }
  380. },
  381. beforeUnmount(el, { value }) {
  382. setDisplay(el, value);
  383. }
  384. };
  385. function setDisplay(el, value) {
  386. el.style.display = value ? el[vShowOldKey] : "none";
  387. }
  388. function initVShowForSSR() {
  389. vShow.getSSRProps = ({ value }) => {
  390. if (!value) {
  391. return { style: { display: "none" } };
  392. }
  393. };
  394. }
  395. function patchStyle(el, prev, next) {
  396. const style = el.style;
  397. const isCssString = shared.isString(next);
  398. if (next && !isCssString) {
  399. if (prev && !shared.isString(prev)) {
  400. for (const key in prev) {
  401. if (next[key] == null) {
  402. setStyle(style, key, "");
  403. }
  404. }
  405. }
  406. for (const key in next) {
  407. setStyle(style, key, next[key]);
  408. }
  409. } else {
  410. const currentDisplay = style.display;
  411. if (isCssString) {
  412. if (prev !== next) {
  413. style.cssText = next;
  414. }
  415. } else if (prev) {
  416. el.removeAttribute("style");
  417. }
  418. if (vShowOldKey in el) {
  419. style.display = currentDisplay;
  420. }
  421. }
  422. }
  423. const importantRE = /\s*!important$/;
  424. function setStyle(style, name, val) {
  425. if (shared.isArray(val)) {
  426. val.forEach((v) => setStyle(style, name, v));
  427. } else {
  428. if (val == null)
  429. val = "";
  430. if (name.startsWith("--")) {
  431. style.setProperty(name, val);
  432. } else {
  433. const prefixed = autoPrefix(style, name);
  434. if (importantRE.test(val)) {
  435. style.setProperty(
  436. shared.hyphenate(prefixed),
  437. val.replace(importantRE, ""),
  438. "important"
  439. );
  440. } else {
  441. style[prefixed] = val;
  442. }
  443. }
  444. }
  445. }
  446. const prefixes = ["Webkit", "Moz", "ms"];
  447. const prefixCache = {};
  448. function autoPrefix(style, rawName) {
  449. const cached = prefixCache[rawName];
  450. if (cached) {
  451. return cached;
  452. }
  453. let name = runtimeCore.camelize(rawName);
  454. if (name !== "filter" && name in style) {
  455. return prefixCache[rawName] = name;
  456. }
  457. name = shared.capitalize(name);
  458. for (let i = 0; i < prefixes.length; i++) {
  459. const prefixed = prefixes[i] + name;
  460. if (prefixed in style) {
  461. return prefixCache[rawName] = prefixed;
  462. }
  463. }
  464. return rawName;
  465. }
  466. const xlinkNS = "http://www.w3.org/1999/xlink";
  467. function patchAttr(el, key, value, isSVG, instance) {
  468. if (isSVG && key.startsWith("xlink:")) {
  469. if (value == null) {
  470. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  471. } else {
  472. el.setAttributeNS(xlinkNS, key, value);
  473. }
  474. } else {
  475. const isBoolean = shared.isSpecialBooleanAttr(key);
  476. if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
  477. el.removeAttribute(key);
  478. } else {
  479. el.setAttribute(key, isBoolean ? "" : value);
  480. }
  481. }
  482. }
  483. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  484. if (key === "innerHTML" || key === "textContent") {
  485. if (prevChildren) {
  486. unmountChildren(prevChildren, parentComponent, parentSuspense);
  487. }
  488. el[key] = value == null ? "" : value;
  489. return;
  490. }
  491. const tag = el.tagName;
  492. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  493. !tag.includes("-")) {
  494. el._value = value;
  495. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  496. const newValue = value == null ? "" : value;
  497. if (oldValue !== newValue) {
  498. el.value = newValue;
  499. }
  500. if (value == null) {
  501. el.removeAttribute(key);
  502. }
  503. return;
  504. }
  505. let needRemove = false;
  506. if (value === "" || value == null) {
  507. const type = typeof el[key];
  508. if (type === "boolean") {
  509. value = shared.includeBooleanAttr(value);
  510. } else if (value == null && type === "string") {
  511. value = "";
  512. needRemove = true;
  513. } else if (type === "number") {
  514. value = 0;
  515. needRemove = true;
  516. }
  517. }
  518. try {
  519. el[key] = value;
  520. } catch (e) {
  521. }
  522. needRemove && el.removeAttribute(key);
  523. }
  524. function addEventListener(el, event, handler, options) {
  525. el.addEventListener(event, handler, options);
  526. }
  527. function removeEventListener(el, event, handler, options) {
  528. el.removeEventListener(event, handler, options);
  529. }
  530. const veiKey = Symbol("_vei");
  531. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  532. const invokers = el[veiKey] || (el[veiKey] = {});
  533. const existingInvoker = invokers[rawName];
  534. if (nextValue && existingInvoker) {
  535. existingInvoker.value = nextValue;
  536. } else {
  537. const [name, options] = parseName(rawName);
  538. if (nextValue) {
  539. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  540. addEventListener(el, name, invoker, options);
  541. } else if (existingInvoker) {
  542. removeEventListener(el, name, existingInvoker, options);
  543. invokers[rawName] = void 0;
  544. }
  545. }
  546. }
  547. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  548. function parseName(name) {
  549. let options;
  550. if (optionsModifierRE.test(name)) {
  551. options = {};
  552. let m;
  553. while (m = name.match(optionsModifierRE)) {
  554. name = name.slice(0, name.length - m[0].length);
  555. options[m[0].toLowerCase()] = true;
  556. }
  557. }
  558. const event = name[2] === ":" ? name.slice(3) : shared.hyphenate(name.slice(2));
  559. return [event, options];
  560. }
  561. let cachedNow = 0;
  562. const p = /* @__PURE__ */ Promise.resolve();
  563. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  564. function createInvoker(initialValue, instance) {
  565. const invoker = (e) => {
  566. if (!e._vts) {
  567. e._vts = Date.now();
  568. } else if (e._vts <= invoker.attached) {
  569. return;
  570. }
  571. runtimeCore.callWithAsyncErrorHandling(
  572. patchStopImmediatePropagation(e, invoker.value),
  573. instance,
  574. 5,
  575. [e]
  576. );
  577. };
  578. invoker.value = initialValue;
  579. invoker.attached = getNow();
  580. return invoker;
  581. }
  582. function patchStopImmediatePropagation(e, value) {
  583. if (shared.isArray(value)) {
  584. const originalStop = e.stopImmediatePropagation;
  585. e.stopImmediatePropagation = () => {
  586. originalStop.call(e);
  587. e._stopped = true;
  588. };
  589. return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
  590. } else {
  591. return value;
  592. }
  593. }
  594. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  595. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  596. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  597. if (key === "class") {
  598. patchClass(el, nextValue, isSVG);
  599. } else if (key === "style") {
  600. patchStyle(el, prevValue, nextValue);
  601. } else if (shared.isOn(key)) {
  602. if (!shared.isModelListener(key)) {
  603. patchEvent(el, key, prevValue, nextValue, parentComponent);
  604. }
  605. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  606. patchDOMProp(
  607. el,
  608. key,
  609. nextValue,
  610. prevChildren,
  611. parentComponent,
  612. parentSuspense,
  613. unmountChildren
  614. );
  615. } else {
  616. if (key === "true-value") {
  617. el._trueValue = nextValue;
  618. } else if (key === "false-value") {
  619. el._falseValue = nextValue;
  620. }
  621. patchAttr(el, key, nextValue, isSVG);
  622. }
  623. };
  624. function shouldSetAsProp(el, key, value, isSVG) {
  625. if (isSVG) {
  626. if (key === "innerHTML" || key === "textContent") {
  627. return true;
  628. }
  629. if (key in el && isNativeOn(key) && shared.isFunction(value)) {
  630. return true;
  631. }
  632. return false;
  633. }
  634. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  635. return false;
  636. }
  637. if (key === "form") {
  638. return false;
  639. }
  640. if (key === "list" && el.tagName === "INPUT") {
  641. return false;
  642. }
  643. if (key === "type" && el.tagName === "TEXTAREA") {
  644. return false;
  645. }
  646. if (key === "width" || key === "height") {
  647. const tag = el.tagName;
  648. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  649. return false;
  650. }
  651. }
  652. if (isNativeOn(key) && shared.isString(value)) {
  653. return false;
  654. }
  655. return key in el;
  656. }
  657. /*! #__NO_SIDE_EFFECTS__ */
  658. // @__NO_SIDE_EFFECTS__
  659. function defineCustomElement(options, hydrate2) {
  660. const Comp = runtimeCore.defineComponent(options);
  661. class VueCustomElement extends VueElement {
  662. constructor(initialProps) {
  663. super(Comp, initialProps, hydrate2);
  664. }
  665. }
  666. VueCustomElement.def = Comp;
  667. return VueCustomElement;
  668. }
  669. /*! #__NO_SIDE_EFFECTS__ */
  670. const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
  671. return /* @__PURE__ */ defineCustomElement(options, hydrate);
  672. };
  673. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  674. };
  675. class VueElement extends BaseClass {
  676. constructor(_def, _props = {}, hydrate2) {
  677. super();
  678. this._def = _def;
  679. this._props = _props;
  680. /**
  681. * @internal
  682. */
  683. this._instance = null;
  684. this._connected = false;
  685. this._resolved = false;
  686. this._numberProps = null;
  687. this._ob = null;
  688. if (this.shadowRoot && hydrate2) {
  689. hydrate2(this._createVNode(), this.shadowRoot);
  690. } else {
  691. this.attachShadow({ mode: "open" });
  692. if (!this._def.__asyncLoader) {
  693. this._resolveProps(this._def);
  694. }
  695. }
  696. }
  697. connectedCallback() {
  698. this._connected = true;
  699. if (!this._instance) {
  700. if (this._resolved) {
  701. this._update();
  702. } else {
  703. this._resolveDef();
  704. }
  705. }
  706. }
  707. disconnectedCallback() {
  708. this._connected = false;
  709. if (this._ob) {
  710. this._ob.disconnect();
  711. this._ob = null;
  712. }
  713. runtimeCore.nextTick(() => {
  714. if (!this._connected) {
  715. render(null, this.shadowRoot);
  716. this._instance = null;
  717. }
  718. });
  719. }
  720. /**
  721. * resolve inner component definition (handle possible async component)
  722. */
  723. _resolveDef() {
  724. this._resolved = true;
  725. for (let i = 0; i < this.attributes.length; i++) {
  726. this._setAttr(this.attributes[i].name);
  727. }
  728. this._ob = new MutationObserver((mutations) => {
  729. for (const m of mutations) {
  730. this._setAttr(m.attributeName);
  731. }
  732. });
  733. this._ob.observe(this, { attributes: true });
  734. const resolve = (def, isAsync = false) => {
  735. const { props, styles } = def;
  736. let numberProps;
  737. if (props && !shared.isArray(props)) {
  738. for (const key in props) {
  739. const opt = props[key];
  740. if (opt === Number || opt && opt.type === Number) {
  741. if (key in this._props) {
  742. this._props[key] = shared.toNumber(this._props[key]);
  743. }
  744. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[shared.camelize(key)] = true;
  745. }
  746. }
  747. }
  748. this._numberProps = numberProps;
  749. if (isAsync) {
  750. this._resolveProps(def);
  751. }
  752. this._applyStyles(styles);
  753. this._update();
  754. };
  755. const asyncDef = this._def.__asyncLoader;
  756. if (asyncDef) {
  757. asyncDef().then((def) => resolve(def, true));
  758. } else {
  759. resolve(this._def);
  760. }
  761. }
  762. _resolveProps(def) {
  763. const { props } = def;
  764. const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
  765. for (const key of Object.keys(this)) {
  766. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  767. this._setProp(key, this[key], true, false);
  768. }
  769. }
  770. for (const key of declaredPropKeys.map(shared.camelize)) {
  771. Object.defineProperty(this, key, {
  772. get() {
  773. return this._getProp(key);
  774. },
  775. set(val) {
  776. this._setProp(key, val);
  777. }
  778. });
  779. }
  780. }
  781. _setAttr(key) {
  782. let value = this.getAttribute(key);
  783. const camelKey = shared.camelize(key);
  784. if (this._numberProps && this._numberProps[camelKey]) {
  785. value = shared.toNumber(value);
  786. }
  787. this._setProp(camelKey, value, false);
  788. }
  789. /**
  790. * @internal
  791. */
  792. _getProp(key) {
  793. return this._props[key];
  794. }
  795. /**
  796. * @internal
  797. */
  798. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  799. if (val !== this._props[key]) {
  800. this._props[key] = val;
  801. if (shouldUpdate && this._instance) {
  802. this._update();
  803. }
  804. if (shouldReflect) {
  805. if (val === true) {
  806. this.setAttribute(shared.hyphenate(key), "");
  807. } else if (typeof val === "string" || typeof val === "number") {
  808. this.setAttribute(shared.hyphenate(key), val + "");
  809. } else if (!val) {
  810. this.removeAttribute(shared.hyphenate(key));
  811. }
  812. }
  813. }
  814. }
  815. _update() {
  816. render(this._createVNode(), this.shadowRoot);
  817. }
  818. _createVNode() {
  819. const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
  820. if (!this._instance) {
  821. vnode.ce = (instance) => {
  822. this._instance = instance;
  823. instance.isCE = true;
  824. const dispatch = (event, args) => {
  825. this.dispatchEvent(
  826. new CustomEvent(event, {
  827. detail: args
  828. })
  829. );
  830. };
  831. instance.emit = (event, ...args) => {
  832. dispatch(event, args);
  833. if (shared.hyphenate(event) !== event) {
  834. dispatch(shared.hyphenate(event), args);
  835. }
  836. };
  837. let parent = this;
  838. while (parent = parent && (parent.parentNode || parent.host)) {
  839. if (parent instanceof VueElement) {
  840. instance.parent = parent._instance;
  841. instance.provides = parent._instance.provides;
  842. break;
  843. }
  844. }
  845. };
  846. }
  847. return vnode;
  848. }
  849. _applyStyles(styles) {
  850. if (styles) {
  851. styles.forEach((css) => {
  852. const s = document.createElement("style");
  853. s.textContent = css;
  854. this.shadowRoot.appendChild(s);
  855. });
  856. }
  857. }
  858. }
  859. function useCssModule(name = "$style") {
  860. {
  861. const instance = runtimeCore.getCurrentInstance();
  862. if (!instance) {
  863. return shared.EMPTY_OBJ;
  864. }
  865. const modules = instance.type.__cssModules;
  866. if (!modules) {
  867. return shared.EMPTY_OBJ;
  868. }
  869. const mod = modules[name];
  870. if (!mod) {
  871. return shared.EMPTY_OBJ;
  872. }
  873. return mod;
  874. }
  875. }
  876. function useCssVars(getter) {
  877. return;
  878. }
  879. const positionMap = /* @__PURE__ */ new WeakMap();
  880. const newPositionMap = /* @__PURE__ */ new WeakMap();
  881. const moveCbKey = Symbol("_moveCb");
  882. const enterCbKey = Symbol("_enterCb");
  883. const TransitionGroupImpl = {
  884. name: "TransitionGroup",
  885. props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
  886. tag: String,
  887. moveClass: String
  888. }),
  889. setup(props, { slots }) {
  890. const instance = runtimeCore.getCurrentInstance();
  891. const state = runtimeCore.useTransitionState();
  892. let prevChildren;
  893. let children;
  894. runtimeCore.onUpdated(() => {
  895. if (!prevChildren.length) {
  896. return;
  897. }
  898. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  899. if (!hasCSSTransform(
  900. prevChildren[0].el,
  901. instance.vnode.el,
  902. moveClass
  903. )) {
  904. return;
  905. }
  906. prevChildren.forEach(callPendingCbs);
  907. prevChildren.forEach(recordPosition);
  908. const movedChildren = prevChildren.filter(applyTranslation);
  909. forceReflow();
  910. movedChildren.forEach((c) => {
  911. const el = c.el;
  912. const style = el.style;
  913. addTransitionClass(el, moveClass);
  914. style.transform = style.webkitTransform = style.transitionDuration = "";
  915. const cb = el[moveCbKey] = (e) => {
  916. if (e && e.target !== el) {
  917. return;
  918. }
  919. if (!e || /transform$/.test(e.propertyName)) {
  920. el.removeEventListener("transitionend", cb);
  921. el[moveCbKey] = null;
  922. removeTransitionClass(el, moveClass);
  923. }
  924. };
  925. el.addEventListener("transitionend", cb);
  926. });
  927. });
  928. return () => {
  929. const rawProps = runtimeCore.toRaw(props);
  930. const cssTransitionProps = resolveTransitionProps(rawProps);
  931. let tag = rawProps.tag || runtimeCore.Fragment;
  932. prevChildren = children;
  933. children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
  934. for (let i = 0; i < children.length; i++) {
  935. const child = children[i];
  936. if (child.key != null) {
  937. runtimeCore.setTransitionHooks(
  938. child,
  939. runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
  940. );
  941. }
  942. }
  943. if (prevChildren) {
  944. for (let i = 0; i < prevChildren.length; i++) {
  945. const child = prevChildren[i];
  946. runtimeCore.setTransitionHooks(
  947. child,
  948. runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
  949. );
  950. positionMap.set(child, child.el.getBoundingClientRect());
  951. }
  952. }
  953. return runtimeCore.createVNode(tag, null, children);
  954. };
  955. }
  956. };
  957. const removeMode = (props) => delete props.mode;
  958. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  959. const TransitionGroup = TransitionGroupImpl;
  960. function callPendingCbs(c) {
  961. const el = c.el;
  962. if (el[moveCbKey]) {
  963. el[moveCbKey]();
  964. }
  965. if (el[enterCbKey]) {
  966. el[enterCbKey]();
  967. }
  968. }
  969. function recordPosition(c) {
  970. newPositionMap.set(c, c.el.getBoundingClientRect());
  971. }
  972. function applyTranslation(c) {
  973. const oldPos = positionMap.get(c);
  974. const newPos = newPositionMap.get(c);
  975. const dx = oldPos.left - newPos.left;
  976. const dy = oldPos.top - newPos.top;
  977. if (dx || dy) {
  978. const s = c.el.style;
  979. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  980. s.transitionDuration = "0s";
  981. return c;
  982. }
  983. }
  984. function hasCSSTransform(el, root, moveClass) {
  985. const clone = el.cloneNode();
  986. const _vtc = el[vtcKey];
  987. if (_vtc) {
  988. _vtc.forEach((cls) => {
  989. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  990. });
  991. }
  992. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  993. clone.style.display = "none";
  994. const container = root.nodeType === 1 ? root : root.parentNode;
  995. container.appendChild(clone);
  996. const { hasTransform } = getTransitionInfo(clone);
  997. container.removeChild(clone);
  998. return hasTransform;
  999. }
  1000. const getModelAssigner = (vnode) => {
  1001. const fn = vnode.props["onUpdate:modelValue"] || false;
  1002. return shared.isArray(fn) ? (value) => shared.invokeArrayFns(fn, value) : fn;
  1003. };
  1004. function onCompositionStart(e) {
  1005. e.target.composing = true;
  1006. }
  1007. function onCompositionEnd(e) {
  1008. const target = e.target;
  1009. if (target.composing) {
  1010. target.composing = false;
  1011. target.dispatchEvent(new Event("input"));
  1012. }
  1013. }
  1014. const assignKey = Symbol("_assign");
  1015. const vModelText = {
  1016. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  1017. el[assignKey] = getModelAssigner(vnode);
  1018. const castToNumber = number || vnode.props && vnode.props.type === "number";
  1019. addEventListener(el, lazy ? "change" : "input", (e) => {
  1020. if (e.target.composing)
  1021. return;
  1022. let domValue = el.value;
  1023. if (trim) {
  1024. domValue = domValue.trim();
  1025. }
  1026. if (castToNumber) {
  1027. domValue = shared.looseToNumber(domValue);
  1028. }
  1029. el[assignKey](domValue);
  1030. });
  1031. if (trim) {
  1032. addEventListener(el, "change", () => {
  1033. el.value = el.value.trim();
  1034. });
  1035. }
  1036. if (!lazy) {
  1037. addEventListener(el, "compositionstart", onCompositionStart);
  1038. addEventListener(el, "compositionend", onCompositionEnd);
  1039. addEventListener(el, "change", onCompositionEnd);
  1040. }
  1041. },
  1042. // set value on mounted so it's after min/max for type="range"
  1043. mounted(el, { value }) {
  1044. el.value = value == null ? "" : value;
  1045. },
  1046. beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
  1047. el[assignKey] = getModelAssigner(vnode);
  1048. if (el.composing)
  1049. return;
  1050. const elValue = number || el.type === "number" ? shared.looseToNumber(el.value) : el.value;
  1051. const newValue = value == null ? "" : value;
  1052. if (elValue === newValue) {
  1053. return;
  1054. }
  1055. if (document.activeElement === el && el.type !== "range") {
  1056. if (lazy) {
  1057. return;
  1058. }
  1059. if (trim && el.value.trim() === newValue) {
  1060. return;
  1061. }
  1062. }
  1063. el.value = newValue;
  1064. }
  1065. };
  1066. const vModelCheckbox = {
  1067. // #4096 array checkboxes need to be deep traversed
  1068. deep: true,
  1069. created(el, _, vnode) {
  1070. el[assignKey] = getModelAssigner(vnode);
  1071. addEventListener(el, "change", () => {
  1072. const modelValue = el._modelValue;
  1073. const elementValue = getValue(el);
  1074. const checked = el.checked;
  1075. const assign = el[assignKey];
  1076. if (shared.isArray(modelValue)) {
  1077. const index = shared.looseIndexOf(modelValue, elementValue);
  1078. const found = index !== -1;
  1079. if (checked && !found) {
  1080. assign(modelValue.concat(elementValue));
  1081. } else if (!checked && found) {
  1082. const filtered = [...modelValue];
  1083. filtered.splice(index, 1);
  1084. assign(filtered);
  1085. }
  1086. } else if (shared.isSet(modelValue)) {
  1087. const cloned = new Set(modelValue);
  1088. if (checked) {
  1089. cloned.add(elementValue);
  1090. } else {
  1091. cloned.delete(elementValue);
  1092. }
  1093. assign(cloned);
  1094. } else {
  1095. assign(getCheckboxValue(el, checked));
  1096. }
  1097. });
  1098. },
  1099. // set initial checked on mount to wait for true-value/false-value
  1100. mounted: setChecked,
  1101. beforeUpdate(el, binding, vnode) {
  1102. el[assignKey] = getModelAssigner(vnode);
  1103. setChecked(el, binding, vnode);
  1104. }
  1105. };
  1106. function setChecked(el, { value, oldValue }, vnode) {
  1107. el._modelValue = value;
  1108. if (shared.isArray(value)) {
  1109. el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
  1110. } else if (shared.isSet(value)) {
  1111. el.checked = value.has(vnode.props.value);
  1112. } else if (value !== oldValue) {
  1113. el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
  1114. }
  1115. }
  1116. const vModelRadio = {
  1117. created(el, { value }, vnode) {
  1118. el.checked = shared.looseEqual(value, vnode.props.value);
  1119. el[assignKey] = getModelAssigner(vnode);
  1120. addEventListener(el, "change", () => {
  1121. el[assignKey](getValue(el));
  1122. });
  1123. },
  1124. beforeUpdate(el, { value, oldValue }, vnode) {
  1125. el[assignKey] = getModelAssigner(vnode);
  1126. if (value !== oldValue) {
  1127. el.checked = shared.looseEqual(value, vnode.props.value);
  1128. }
  1129. }
  1130. };
  1131. const vModelSelect = {
  1132. // <select multiple> value need to be deep traversed
  1133. deep: true,
  1134. created(el, { value, modifiers: { number } }, vnode) {
  1135. const isSetModel = shared.isSet(value);
  1136. addEventListener(el, "change", () => {
  1137. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  1138. (o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
  1139. );
  1140. el[assignKey](
  1141. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  1142. );
  1143. });
  1144. el[assignKey] = getModelAssigner(vnode);
  1145. },
  1146. // set value in mounted & updated because <select> relies on its children
  1147. // <option>s.
  1148. mounted(el, { value }) {
  1149. setSelected(el, value);
  1150. },
  1151. beforeUpdate(el, _binding, vnode) {
  1152. el[assignKey] = getModelAssigner(vnode);
  1153. },
  1154. updated(el, { value }) {
  1155. setSelected(el, value);
  1156. }
  1157. };
  1158. function setSelected(el, value) {
  1159. const isMultiple = el.multiple;
  1160. if (isMultiple && !shared.isArray(value) && !shared.isSet(value)) {
  1161. return;
  1162. }
  1163. for (let i = 0, l = el.options.length; i < l; i++) {
  1164. const option = el.options[i];
  1165. const optionValue = getValue(option);
  1166. if (isMultiple) {
  1167. if (shared.isArray(value)) {
  1168. option.selected = shared.looseIndexOf(value, optionValue) > -1;
  1169. } else {
  1170. option.selected = value.has(optionValue);
  1171. }
  1172. } else {
  1173. if (shared.looseEqual(getValue(option), value)) {
  1174. if (el.selectedIndex !== i)
  1175. el.selectedIndex = i;
  1176. return;
  1177. }
  1178. }
  1179. }
  1180. if (!isMultiple && el.selectedIndex !== -1) {
  1181. el.selectedIndex = -1;
  1182. }
  1183. }
  1184. function getValue(el) {
  1185. return "_value" in el ? el._value : el.value;
  1186. }
  1187. function getCheckboxValue(el, checked) {
  1188. const key = checked ? "_trueValue" : "_falseValue";
  1189. return key in el ? el[key] : checked;
  1190. }
  1191. const vModelDynamic = {
  1192. created(el, binding, vnode) {
  1193. callModelHook(el, binding, vnode, null, "created");
  1194. },
  1195. mounted(el, binding, vnode) {
  1196. callModelHook(el, binding, vnode, null, "mounted");
  1197. },
  1198. beforeUpdate(el, binding, vnode, prevVNode) {
  1199. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  1200. },
  1201. updated(el, binding, vnode, prevVNode) {
  1202. callModelHook(el, binding, vnode, prevVNode, "updated");
  1203. }
  1204. };
  1205. function resolveDynamicModel(tagName, type) {
  1206. switch (tagName) {
  1207. case "SELECT":
  1208. return vModelSelect;
  1209. case "TEXTAREA":
  1210. return vModelText;
  1211. default:
  1212. switch (type) {
  1213. case "checkbox":
  1214. return vModelCheckbox;
  1215. case "radio":
  1216. return vModelRadio;
  1217. default:
  1218. return vModelText;
  1219. }
  1220. }
  1221. }
  1222. function callModelHook(el, binding, vnode, prevVNode, hook) {
  1223. const modelToUse = resolveDynamicModel(
  1224. el.tagName,
  1225. vnode.props && vnode.props.type
  1226. );
  1227. const fn = modelToUse[hook];
  1228. fn && fn(el, binding, vnode, prevVNode);
  1229. }
  1230. function initVModelForSSR() {
  1231. vModelText.getSSRProps = ({ value }) => ({ value });
  1232. vModelRadio.getSSRProps = ({ value }, vnode) => {
  1233. if (vnode.props && shared.looseEqual(vnode.props.value, value)) {
  1234. return { checked: true };
  1235. }
  1236. };
  1237. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  1238. if (shared.isArray(value)) {
  1239. if (vnode.props && shared.looseIndexOf(value, vnode.props.value) > -1) {
  1240. return { checked: true };
  1241. }
  1242. } else if (shared.isSet(value)) {
  1243. if (vnode.props && value.has(vnode.props.value)) {
  1244. return { checked: true };
  1245. }
  1246. } else if (value) {
  1247. return { checked: true };
  1248. }
  1249. };
  1250. vModelDynamic.getSSRProps = (binding, vnode) => {
  1251. if (typeof vnode.type !== "string") {
  1252. return;
  1253. }
  1254. const modelToUse = resolveDynamicModel(
  1255. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  1256. vnode.type.toUpperCase(),
  1257. vnode.props && vnode.props.type
  1258. );
  1259. if (modelToUse.getSSRProps) {
  1260. return modelToUse.getSSRProps(binding, vnode);
  1261. }
  1262. };
  1263. }
  1264. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  1265. const modifierGuards = {
  1266. stop: (e) => e.stopPropagation(),
  1267. prevent: (e) => e.preventDefault(),
  1268. self: (e) => e.target !== e.currentTarget,
  1269. ctrl: (e) => !e.ctrlKey,
  1270. shift: (e) => !e.shiftKey,
  1271. alt: (e) => !e.altKey,
  1272. meta: (e) => !e.metaKey,
  1273. left: (e) => "button" in e && e.button !== 0,
  1274. middle: (e) => "button" in e && e.button !== 1,
  1275. right: (e) => "button" in e && e.button !== 2,
  1276. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  1277. };
  1278. const withModifiers = (fn, modifiers) => {
  1279. return fn._withMods || (fn._withMods = (event, ...args) => {
  1280. for (let i = 0; i < modifiers.length; i++) {
  1281. const guard = modifierGuards[modifiers[i]];
  1282. if (guard && guard(event, modifiers))
  1283. return;
  1284. }
  1285. return fn(event, ...args);
  1286. });
  1287. };
  1288. const keyNames = {
  1289. esc: "escape",
  1290. space: " ",
  1291. up: "arrow-up",
  1292. left: "arrow-left",
  1293. right: "arrow-right",
  1294. down: "arrow-down",
  1295. delete: "backspace"
  1296. };
  1297. const withKeys = (fn, modifiers) => {
  1298. return fn._withKeys || (fn._withKeys = (event) => {
  1299. if (!("key" in event)) {
  1300. return;
  1301. }
  1302. const eventKey = shared.hyphenate(event.key);
  1303. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  1304. return fn(event);
  1305. }
  1306. });
  1307. };
  1308. const rendererOptions = /* @__PURE__ */ shared.extend({ patchProp }, nodeOps);
  1309. let renderer;
  1310. let enabledHydration = false;
  1311. function ensureRenderer() {
  1312. return renderer || (renderer = runtimeCore.createRenderer(rendererOptions));
  1313. }
  1314. function ensureHydrationRenderer() {
  1315. renderer = enabledHydration ? renderer : runtimeCore.createHydrationRenderer(rendererOptions);
  1316. enabledHydration = true;
  1317. return renderer;
  1318. }
  1319. const render = (...args) => {
  1320. ensureRenderer().render(...args);
  1321. };
  1322. const hydrate = (...args) => {
  1323. ensureHydrationRenderer().hydrate(...args);
  1324. };
  1325. const createApp = (...args) => {
  1326. const app = ensureRenderer().createApp(...args);
  1327. const { mount } = app;
  1328. app.mount = (containerOrSelector) => {
  1329. const container = normalizeContainer(containerOrSelector);
  1330. if (!container)
  1331. return;
  1332. const component = app._component;
  1333. if (!shared.isFunction(component) && !component.render && !component.template) {
  1334. component.template = container.innerHTML;
  1335. }
  1336. container.innerHTML = "";
  1337. const proxy = mount(container, false, container instanceof SVGElement);
  1338. if (container instanceof Element) {
  1339. container.removeAttribute("v-cloak");
  1340. container.setAttribute("data-v-app", "");
  1341. }
  1342. return proxy;
  1343. };
  1344. return app;
  1345. };
  1346. const createSSRApp = (...args) => {
  1347. const app = ensureHydrationRenderer().createApp(...args);
  1348. const { mount } = app;
  1349. app.mount = (containerOrSelector) => {
  1350. const container = normalizeContainer(containerOrSelector);
  1351. if (container) {
  1352. return mount(container, true, container instanceof SVGElement);
  1353. }
  1354. };
  1355. return app;
  1356. };
  1357. function normalizeContainer(container) {
  1358. if (shared.isString(container)) {
  1359. const res = document.querySelector(container);
  1360. return res;
  1361. }
  1362. return container;
  1363. }
  1364. let ssrDirectiveInitialized = false;
  1365. const initDirectivesForSSR = () => {
  1366. if (!ssrDirectiveInitialized) {
  1367. ssrDirectiveInitialized = true;
  1368. initVModelForSSR();
  1369. initVShowForSSR();
  1370. }
  1371. } ;
  1372. exports.Transition = Transition;
  1373. exports.TransitionGroup = TransitionGroup;
  1374. exports.VueElement = VueElement;
  1375. exports.createApp = createApp;
  1376. exports.createSSRApp = createSSRApp;
  1377. exports.defineCustomElement = defineCustomElement;
  1378. exports.defineSSRCustomElement = defineSSRCustomElement;
  1379. exports.hydrate = hydrate;
  1380. exports.initDirectivesForSSR = initDirectivesForSSR;
  1381. exports.render = render;
  1382. exports.useCssModule = useCssModule;
  1383. exports.useCssVars = useCssVars;
  1384. exports.vModelCheckbox = vModelCheckbox;
  1385. exports.vModelDynamic = vModelDynamic;
  1386. exports.vModelRadio = vModelRadio;
  1387. exports.vModelSelect = vModelSelect;
  1388. exports.vModelText = vModelText;
  1389. exports.vShow = vShow;
  1390. exports.withKeys = withKeys;
  1391. exports.withModifiers = withModifiers;
  1392. Object.keys(runtimeCore).forEach(function (k) {
  1393. if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
  1394. });