runtime-dom.esm-bundler.js 63 KB

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