chunk-P6MX663D.js 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945
  1. // node_modules/@stencil/core/internal/app-data/index.js
  2. var BUILD = {
  3. allRenderFn: false,
  4. cmpDidLoad: true,
  5. cmpDidUnload: false,
  6. cmpDidUpdate: true,
  7. cmpDidRender: true,
  8. cmpWillLoad: true,
  9. cmpWillUpdate: true,
  10. cmpWillRender: true,
  11. connectedCallback: true,
  12. disconnectedCallback: true,
  13. element: true,
  14. event: true,
  15. hasRenderFn: true,
  16. lifecycle: true,
  17. hostListener: true,
  18. hostListenerTargetWindow: true,
  19. hostListenerTargetDocument: true,
  20. hostListenerTargetBody: true,
  21. hostListenerTargetParent: false,
  22. hostListenerTarget: true,
  23. member: true,
  24. method: true,
  25. mode: true,
  26. observeAttribute: true,
  27. prop: true,
  28. propMutable: true,
  29. reflect: true,
  30. scoped: true,
  31. shadowDom: true,
  32. slot: true,
  33. cssAnnotations: true,
  34. state: true,
  35. style: true,
  36. svg: true,
  37. updatable: true,
  38. vdomAttribute: true,
  39. vdomXlink: true,
  40. vdomClass: true,
  41. vdomFunctional: true,
  42. vdomKey: true,
  43. vdomListener: true,
  44. vdomRef: true,
  45. vdomPropOrAttr: true,
  46. vdomRender: true,
  47. vdomStyle: true,
  48. vdomText: true,
  49. watchCallback: true,
  50. taskQueue: true,
  51. hotModuleReplacement: false,
  52. isDebug: false,
  53. isDev: false,
  54. isTesting: false,
  55. hydrateServerSide: false,
  56. hydrateClientSide: false,
  57. lifecycleDOMEvents: false,
  58. lazyLoad: false,
  59. profile: false,
  60. slotRelocation: true,
  61. appendChildSlotFix: false,
  62. cloneNodeFix: false,
  63. hydratedAttribute: false,
  64. hydratedClass: true,
  65. safari10: false,
  66. scriptDataOpts: false,
  67. scopedSlotTextContentFix: false,
  68. shadowDomShim: false,
  69. slotChildNodesFix: false,
  70. invisiblePrehydration: true,
  71. propBoolean: true,
  72. propNumber: true,
  73. propString: true,
  74. cssVarShim: false,
  75. constructableCSS: true,
  76. cmpShouldUpdate: true,
  77. devTools: false,
  78. dynamicImportShim: false,
  79. shadowDelegatesFocus: true,
  80. initializeNextTick: false,
  81. asyncLoading: false,
  82. asyncQueue: false,
  83. transformTagName: false,
  84. attachStyles: true
  85. };
  86. var NAMESPACE = "app";
  87. // node_modules/@stencil/core/internal/client/index.js
  88. var scopeId;
  89. var contentRef;
  90. var hostTagName;
  91. var customError;
  92. var i = 0;
  93. var useNativeShadowDom = false;
  94. var checkSlotFallbackVisibility = false;
  95. var checkSlotRelocate = false;
  96. var isSvgMode = false;
  97. var renderingRef = null;
  98. var queueCongestion = 0;
  99. var queuePending = false;
  100. var win = typeof window !== "undefined" ? window : {};
  101. var CSS = BUILD.cssVarShim ? win.CSS : null;
  102. var doc = win.document || { head: {} };
  103. var H = win.HTMLElement || class {
  104. };
  105. var plt = {
  106. $flags$: 0,
  107. $resourcesUrl$: "",
  108. jmp: (h2) => h2(),
  109. raf: (h2) => requestAnimationFrame(h2),
  110. ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
  111. rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
  112. ce: (eventName, opts) => new CustomEvent(eventName, opts)
  113. };
  114. var supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom ? (() => (doc.head.attachShadow + "").indexOf("[native") > -1)() : true;
  115. var supportsListenerOptions = (() => {
  116. let supportsListenerOptions2 = false;
  117. try {
  118. doc.addEventListener("e", null, Object.defineProperty({}, "passive", {
  119. get() {
  120. supportsListenerOptions2 = true;
  121. }
  122. }));
  123. } catch (e) {
  124. }
  125. return supportsListenerOptions2;
  126. })();
  127. var promiseResolve = (v) => Promise.resolve(v);
  128. var supportsConstructibleStylesheets = BUILD.constructableCSS ? (() => {
  129. try {
  130. new CSSStyleSheet();
  131. return typeof new CSSStyleSheet().replace === "function";
  132. } catch (e) {
  133. }
  134. return false;
  135. })() : false;
  136. var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
  137. if (BUILD.hostListener && listeners) {
  138. if (BUILD.hostListenerTargetParent) {
  139. if (attachParentListeners) {
  140. listeners = listeners.filter(([flags]) => flags & 32);
  141. } else {
  142. listeners = listeners.filter(([flags]) => !(flags & 32));
  143. }
  144. }
  145. listeners.map(([flags, name, method]) => {
  146. const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
  147. const handler = hostListenerProxy(hostRef, method);
  148. const opts = hostListenerOpts(flags);
  149. plt.ael(target, name, handler, opts);
  150. (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
  151. });
  152. }
  153. };
  154. var hostListenerProxy = (hostRef, methodName) => (ev) => {
  155. try {
  156. if (BUILD.lazyLoad) {
  157. if (hostRef.$flags$ & 256) {
  158. hostRef.$lazyInstance$[methodName](ev);
  159. } else {
  160. (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
  161. }
  162. } else {
  163. hostRef.$hostElement$[methodName](ev);
  164. }
  165. } catch (e) {
  166. consoleError(e);
  167. }
  168. };
  169. var getHostListenerTarget = (elm, flags) => {
  170. if (BUILD.hostListenerTargetDocument && flags & 4)
  171. return doc;
  172. if (BUILD.hostListenerTargetWindow && flags & 8)
  173. return win;
  174. if (BUILD.hostListenerTargetBody && flags & 16)
  175. return doc.body;
  176. if (BUILD.hostListenerTargetParent && flags & 32)
  177. return elm.parentElement;
  178. return elm;
  179. };
  180. var hostListenerOpts = (flags) => supportsListenerOptions ? {
  181. passive: (flags & 1) !== 0,
  182. capture: (flags & 2) !== 0
  183. } : (flags & 2) !== 0;
  184. var CONTENT_REF_ID = "r";
  185. var ORG_LOCATION_ID = "o";
  186. var SLOT_NODE_ID = "s";
  187. var TEXT_NODE_ID = "t";
  188. var HYDRATE_ID = "s-id";
  189. var HYDRATED_STYLE_ID = "sty-id";
  190. var HYDRATE_CHILD_ID = "c-id";
  191. var XLINK_NS = "http://www.w3.org/1999/xlink";
  192. var createTime = (fnName, tagName = "") => {
  193. if (BUILD.profile && performance.mark) {
  194. const key = `st:${fnName}:${tagName}:${i++}`;
  195. performance.mark(key);
  196. return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
  197. } else {
  198. return () => {
  199. return;
  200. };
  201. }
  202. };
  203. var uniqueTime = (key, measureText) => {
  204. if (BUILD.profile && performance.mark) {
  205. if (performance.getEntriesByName(key).length === 0) {
  206. performance.mark(key);
  207. }
  208. return () => {
  209. if (performance.getEntriesByName(measureText).length === 0) {
  210. performance.measure(measureText, key);
  211. }
  212. };
  213. } else {
  214. return () => {
  215. return;
  216. };
  217. }
  218. };
  219. var rootAppliedStyles = new WeakMap();
  220. var registerStyle = (scopeId2, cssText, allowCS) => {
  221. let style = styles.get(scopeId2);
  222. if (supportsConstructibleStylesheets && allowCS) {
  223. style = style || new CSSStyleSheet();
  224. style.replace(cssText);
  225. } else {
  226. style = cssText;
  227. }
  228. styles.set(scopeId2, style);
  229. };
  230. var addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
  231. let scopeId2 = getScopeId(cmpMeta, mode);
  232. let style = styles.get(scopeId2);
  233. if (!BUILD.attachStyles) {
  234. return scopeId2;
  235. }
  236. styleContainerNode = styleContainerNode.nodeType === 11 ? styleContainerNode : doc;
  237. if (style) {
  238. if (typeof style === "string") {
  239. styleContainerNode = styleContainerNode.head || styleContainerNode;
  240. let appliedStyles = rootAppliedStyles.get(styleContainerNode);
  241. let styleElm;
  242. if (!appliedStyles) {
  243. rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
  244. }
  245. if (!appliedStyles.has(scopeId2)) {
  246. if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
  247. styleElm.innerHTML = style;
  248. } else {
  249. if (BUILD.cssVarShim && plt.$cssShim$) {
  250. styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId2, style, !!(cmpMeta.$flags$ & 10));
  251. const newScopeId = styleElm["s-sc"];
  252. if (newScopeId) {
  253. scopeId2 = newScopeId;
  254. appliedStyles = null;
  255. }
  256. } else {
  257. styleElm = doc.createElement("style");
  258. styleElm.innerHTML = style;
  259. }
  260. if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
  261. styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
  262. }
  263. styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
  264. }
  265. if (appliedStyles) {
  266. appliedStyles.add(scopeId2);
  267. }
  268. }
  269. } else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
  270. styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
  271. }
  272. }
  273. return scopeId2;
  274. };
  275. var attachStyles = (hostRef) => {
  276. const cmpMeta = hostRef.$cmpMeta$;
  277. const elm = hostRef.$hostElement$;
  278. const flags = cmpMeta.$flags$;
  279. const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
  280. const scopeId2 = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
  281. if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10) {
  282. elm["s-sc"] = scopeId2;
  283. elm.classList.add(scopeId2 + "-h");
  284. if (BUILD.scoped && flags & 2) {
  285. elm.classList.add(scopeId2 + "-s");
  286. }
  287. }
  288. endAttachStyles();
  289. };
  290. var getScopeId = (cmp, mode) => "sc-" + (BUILD.mode && mode && cmp.$flags$ & 32 ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
  291. var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
  292. var EMPTY_OBJ = {};
  293. var SVG_NS = "http://www.w3.org/2000/svg";
  294. var HTML_NS = "http://www.w3.org/1999/xhtml";
  295. var isDef = (v) => v != null;
  296. var isComplexType = (o) => {
  297. o = typeof o;
  298. return o === "object" || o === "function";
  299. };
  300. var h = (nodeName, vnodeData, ...children) => {
  301. let child = null;
  302. let key = null;
  303. let slotName = null;
  304. let simple = false;
  305. let lastSimple = false;
  306. let vNodeChildren = [];
  307. const walk = (c) => {
  308. for (let i2 = 0; i2 < c.length; i2++) {
  309. child = c[i2];
  310. if (Array.isArray(child)) {
  311. walk(child);
  312. } else if (child != null && typeof child !== "boolean") {
  313. if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
  314. child = String(child);
  315. } else if (BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
  316. consoleDevError(`vNode passed as children has unexpected type.
  317. Make sure it's using the correct h() function.
  318. Empty objects can also be the cause, look for JSX comments that became objects.`);
  319. }
  320. if (simple && lastSimple) {
  321. vNodeChildren[vNodeChildren.length - 1].$text$ += child;
  322. } else {
  323. vNodeChildren.push(simple ? newVNode(null, child) : child);
  324. }
  325. lastSimple = simple;
  326. }
  327. }
  328. };
  329. walk(children);
  330. if (vnodeData) {
  331. if (BUILD.isDev && nodeName === "input") {
  332. validateInputProperties(vnodeData);
  333. }
  334. if (BUILD.vdomKey && vnodeData.key) {
  335. key = vnodeData.key;
  336. }
  337. if (BUILD.slotRelocation && vnodeData.name) {
  338. slotName = vnodeData.name;
  339. }
  340. if (BUILD.vdomClass) {
  341. const classData = vnodeData.className || vnodeData.class;
  342. if (classData) {
  343. vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
  344. }
  345. }
  346. }
  347. if (BUILD.isDev && vNodeChildren.some(isHost)) {
  348. consoleDevError(`The <Host> must be the single root component. Make sure:
  349. - You are NOT using hostData() and <Host> in the same component.
  350. - <Host> is used once, and it's the single root component of the render() function.`);
  351. }
  352. if (BUILD.vdomFunctional && typeof nodeName === "function") {
  353. return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
  354. }
  355. const vnode = newVNode(nodeName, null);
  356. vnode.$attrs$ = vnodeData;
  357. if (vNodeChildren.length > 0) {
  358. vnode.$children$ = vNodeChildren;
  359. }
  360. if (BUILD.vdomKey) {
  361. vnode.$key$ = key;
  362. }
  363. if (BUILD.slotRelocation) {
  364. vnode.$name$ = slotName;
  365. }
  366. return vnode;
  367. };
  368. var newVNode = (tag, text) => {
  369. const vnode = {
  370. $flags$: 0,
  371. $tag$: tag,
  372. $text$: text,
  373. $elm$: null,
  374. $children$: null
  375. };
  376. if (BUILD.vdomAttribute) {
  377. vnode.$attrs$ = null;
  378. }
  379. if (BUILD.vdomKey) {
  380. vnode.$key$ = null;
  381. }
  382. if (BUILD.slotRelocation) {
  383. vnode.$name$ = null;
  384. }
  385. return vnode;
  386. };
  387. var Host = {};
  388. var isHost = (node) => node && node.$tag$ === Host;
  389. var vdomFnUtils = {
  390. forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
  391. map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
  392. };
  393. var convertToPublic = (node) => ({
  394. vattrs: node.$attrs$,
  395. vchildren: node.$children$,
  396. vkey: node.$key$,
  397. vname: node.$name$,
  398. vtag: node.$tag$,
  399. vtext: node.$text$
  400. });
  401. var convertToPrivate = (node) => {
  402. if (typeof node.vtag === "function") {
  403. const vnodeData = Object.assign({}, node.vattrs);
  404. if (node.vkey) {
  405. vnodeData.key = node.vkey;
  406. }
  407. if (node.vname) {
  408. vnodeData.name = node.vname;
  409. }
  410. return h(node.vtag, vnodeData, ...node.vchildren || []);
  411. }
  412. const vnode = newVNode(node.vtag, node.vtext);
  413. vnode.$attrs$ = node.vattrs;
  414. vnode.$children$ = node.vchildren;
  415. vnode.$key$ = node.vkey;
  416. vnode.$name$ = node.vname;
  417. return vnode;
  418. };
  419. var validateInputProperties = (inputElm) => {
  420. const props = Object.keys(inputElm);
  421. const value = props.indexOf("value");
  422. if (value === -1) {
  423. return;
  424. }
  425. const typeIndex = props.indexOf("type");
  426. const minIndex = props.indexOf("min");
  427. const maxIndex = props.indexOf("max");
  428. const stepIndex = props.indexOf("step");
  429. if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
  430. consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
  431. }
  432. };
  433. var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
  434. if (oldValue !== newValue) {
  435. let isProp = isMemberInElement(elm, memberName);
  436. let ln = memberName.toLowerCase();
  437. if (BUILD.vdomClass && memberName === "class") {
  438. const classList = elm.classList;
  439. const oldClasses = parseClassList(oldValue);
  440. const newClasses = parseClassList(newValue);
  441. classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
  442. classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
  443. } else if (BUILD.vdomStyle && memberName === "style") {
  444. if (BUILD.updatable) {
  445. for (const prop in oldValue) {
  446. if (!newValue || newValue[prop] == null) {
  447. if (!BUILD.hydrateServerSide && prop.includes("-")) {
  448. elm.style.removeProperty(prop);
  449. } else {
  450. elm.style[prop] = "";
  451. }
  452. }
  453. }
  454. }
  455. for (const prop in newValue) {
  456. if (!oldValue || newValue[prop] !== oldValue[prop]) {
  457. if (!BUILD.hydrateServerSide && prop.includes("-")) {
  458. elm.style.setProperty(prop, newValue[prop]);
  459. } else {
  460. elm.style[prop] = newValue[prop];
  461. }
  462. }
  463. }
  464. } else if (BUILD.vdomKey && memberName === "key")
  465. ;
  466. else if (BUILD.vdomRef && memberName === "ref") {
  467. if (newValue) {
  468. newValue(elm);
  469. }
  470. } else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
  471. if (memberName[2] === "-") {
  472. memberName = memberName.slice(3);
  473. } else if (isMemberInElement(win, ln)) {
  474. memberName = ln.slice(2);
  475. } else {
  476. memberName = ln[2] + memberName.slice(3);
  477. }
  478. if (oldValue) {
  479. plt.rel(elm, memberName, oldValue, false);
  480. }
  481. if (newValue) {
  482. plt.ael(elm, memberName, newValue, false);
  483. }
  484. } else if (BUILD.vdomPropOrAttr) {
  485. const isComplex = isComplexType(newValue);
  486. if ((isProp || isComplex && newValue !== null) && !isSvg) {
  487. try {
  488. if (!elm.tagName.includes("-")) {
  489. let n = newValue == null ? "" : newValue;
  490. if (memberName === "list") {
  491. isProp = false;
  492. } else if (oldValue == null || elm[memberName] != n) {
  493. elm[memberName] = n;
  494. }
  495. } else {
  496. elm[memberName] = newValue;
  497. }
  498. } catch (e) {
  499. }
  500. }
  501. let xlink = false;
  502. if (BUILD.vdomXlink) {
  503. if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
  504. memberName = ln;
  505. xlink = true;
  506. }
  507. }
  508. if (newValue == null || newValue === false) {
  509. if (newValue !== false || elm.getAttribute(memberName) === "") {
  510. if (BUILD.vdomXlink && xlink) {
  511. elm.removeAttributeNS(XLINK_NS, memberName);
  512. } else {
  513. elm.removeAttribute(memberName);
  514. }
  515. }
  516. } else if ((!isProp || flags & 4 || isSvg) && !isComplex) {
  517. newValue = newValue === true ? "" : newValue;
  518. if (BUILD.vdomXlink && xlink) {
  519. elm.setAttributeNS(XLINK_NS, memberName, newValue);
  520. } else {
  521. elm.setAttribute(memberName, newValue);
  522. }
  523. }
  524. }
  525. }
  526. };
  527. var parseClassListRegex = /\s/;
  528. var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
  529. var updateElement = (oldVnode, newVnode, isSvgMode2, memberName) => {
  530. const elm = newVnode.$elm$.nodeType === 11 && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
  531. const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
  532. const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
  533. if (BUILD.updatable) {
  534. for (memberName in oldVnodeAttrs) {
  535. if (!(memberName in newVnodeAttrs)) {
  536. setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
  537. }
  538. }
  539. }
  540. for (memberName in newVnodeAttrs) {
  541. setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
  542. }
  543. };
  544. var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
  545. let newVNode2 = newParentVNode.$children$[childIndex];
  546. let i2 = 0;
  547. let elm;
  548. let childNode;
  549. let oldVNode;
  550. if (BUILD.slotRelocation && !useNativeShadowDom) {
  551. checkSlotRelocate = true;
  552. if (newVNode2.$tag$ === "slot") {
  553. if (scopeId) {
  554. parentElm.classList.add(scopeId + "-s");
  555. }
  556. newVNode2.$flags$ |= newVNode2.$children$ ? 2 : 1;
  557. }
  558. }
  559. if (BUILD.isDev && newVNode2.$elm$) {
  560. consoleDevError(`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
  561. }
  562. if (BUILD.vdomText && newVNode2.$text$ !== null) {
  563. elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
  564. } else if (BUILD.slotRelocation && newVNode2.$flags$ & 1) {
  565. elm = newVNode2.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
  566. } else {
  567. if (BUILD.svg && !isSvgMode) {
  568. isSvgMode = newVNode2.$tag$ === "svg";
  569. }
  570. elm = newVNode2.$elm$ = BUILD.svg ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$) : doc.createElement(BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$);
  571. if (BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
  572. isSvgMode = false;
  573. }
  574. if (BUILD.vdomAttribute) {
  575. updateElement(null, newVNode2, isSvgMode);
  576. }
  577. if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
  578. elm.classList.add(elm["s-si"] = scopeId);
  579. }
  580. if (newVNode2.$children$) {
  581. for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
  582. childNode = createElm(oldParentVNode, newVNode2, i2, elm);
  583. if (childNode) {
  584. elm.appendChild(childNode);
  585. }
  586. }
  587. }
  588. if (BUILD.svg) {
  589. if (newVNode2.$tag$ === "svg") {
  590. isSvgMode = false;
  591. } else if (elm.tagName === "foreignObject") {
  592. isSvgMode = true;
  593. }
  594. }
  595. }
  596. if (BUILD.slotRelocation) {
  597. elm["s-hn"] = hostTagName;
  598. if (newVNode2.$flags$ & (2 | 1)) {
  599. elm["s-sr"] = true;
  600. elm["s-cr"] = contentRef;
  601. elm["s-sn"] = newVNode2.$name$ || "";
  602. oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
  603. if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
  604. putBackInOriginalLocation(oldParentVNode.$elm$, false);
  605. }
  606. }
  607. }
  608. return elm;
  609. };
  610. var putBackInOriginalLocation = (parentElm, recursive) => {
  611. plt.$flags$ |= 1;
  612. const oldSlotChildNodes = parentElm.childNodes;
  613. for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
  614. const childNode = oldSlotChildNodes[i2];
  615. if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
  616. parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
  617. childNode["s-ol"].remove();
  618. childNode["s-ol"] = void 0;
  619. checkSlotRelocate = true;
  620. }
  621. if (recursive) {
  622. putBackInOriginalLocation(childNode, recursive);
  623. }
  624. }
  625. plt.$flags$ &= ~1;
  626. };
  627. var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
  628. let containerElm = BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
  629. let childNode;
  630. if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
  631. containerElm = containerElm.shadowRoot;
  632. }
  633. for (; startIdx <= endIdx; ++startIdx) {
  634. if (vnodes[startIdx]) {
  635. childNode = createElm(null, parentVNode, startIdx, parentElm);
  636. if (childNode) {
  637. vnodes[startIdx].$elm$ = childNode;
  638. containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
  639. }
  640. }
  641. }
  642. };
  643. var removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
  644. for (; startIdx <= endIdx; ++startIdx) {
  645. if (vnode = vnodes[startIdx]) {
  646. elm = vnode.$elm$;
  647. callNodeRefs(vnode);
  648. if (BUILD.slotRelocation) {
  649. checkSlotFallbackVisibility = true;
  650. if (elm["s-ol"]) {
  651. elm["s-ol"].remove();
  652. } else {
  653. putBackInOriginalLocation(elm, true);
  654. }
  655. }
  656. elm.remove();
  657. }
  658. }
  659. };
  660. var updateChildren = (parentElm, oldCh, newVNode2, newCh) => {
  661. let oldStartIdx = 0;
  662. let newStartIdx = 0;
  663. let idxInOld = 0;
  664. let i2 = 0;
  665. let oldEndIdx = oldCh.length - 1;
  666. let oldStartVnode = oldCh[0];
  667. let oldEndVnode = oldCh[oldEndIdx];
  668. let newEndIdx = newCh.length - 1;
  669. let newStartVnode = newCh[0];
  670. let newEndVnode = newCh[newEndIdx];
  671. let node;
  672. let elmToMove;
  673. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  674. if (oldStartVnode == null) {
  675. oldStartVnode = oldCh[++oldStartIdx];
  676. } else if (oldEndVnode == null) {
  677. oldEndVnode = oldCh[--oldEndIdx];
  678. } else if (newStartVnode == null) {
  679. newStartVnode = newCh[++newStartIdx];
  680. } else if (newEndVnode == null) {
  681. newEndVnode = newCh[--newEndIdx];
  682. } else if (isSameVnode(oldStartVnode, newStartVnode)) {
  683. patch(oldStartVnode, newStartVnode);
  684. oldStartVnode = oldCh[++oldStartIdx];
  685. newStartVnode = newCh[++newStartIdx];
  686. } else if (isSameVnode(oldEndVnode, newEndVnode)) {
  687. patch(oldEndVnode, newEndVnode);
  688. oldEndVnode = oldCh[--oldEndIdx];
  689. newEndVnode = newCh[--newEndIdx];
  690. } else if (isSameVnode(oldStartVnode, newEndVnode)) {
  691. if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
  692. putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
  693. }
  694. patch(oldStartVnode, newEndVnode);
  695. parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
  696. oldStartVnode = oldCh[++oldStartIdx];
  697. newEndVnode = newCh[--newEndIdx];
  698. } else if (isSameVnode(oldEndVnode, newStartVnode)) {
  699. if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
  700. putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
  701. }
  702. patch(oldEndVnode, newStartVnode);
  703. parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
  704. oldEndVnode = oldCh[--oldEndIdx];
  705. newStartVnode = newCh[++newStartIdx];
  706. } else {
  707. idxInOld = -1;
  708. if (BUILD.vdomKey) {
  709. for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
  710. if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
  711. idxInOld = i2;
  712. break;
  713. }
  714. }
  715. }
  716. if (BUILD.vdomKey && idxInOld >= 0) {
  717. elmToMove = oldCh[idxInOld];
  718. if (elmToMove.$tag$ !== newStartVnode.$tag$) {
  719. node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
  720. } else {
  721. patch(elmToMove, newStartVnode);
  722. oldCh[idxInOld] = void 0;
  723. node = elmToMove.$elm$;
  724. }
  725. newStartVnode = newCh[++newStartIdx];
  726. } else {
  727. node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
  728. newStartVnode = newCh[++newStartIdx];
  729. }
  730. if (node) {
  731. if (BUILD.slotRelocation) {
  732. parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
  733. } else {
  734. oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
  735. }
  736. }
  737. }
  738. }
  739. if (oldStartIdx > oldEndIdx) {
  740. addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode2, newCh, newStartIdx, newEndIdx);
  741. } else if (BUILD.updatable && newStartIdx > newEndIdx) {
  742. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  743. }
  744. };
  745. var isSameVnode = (vnode1, vnode2) => {
  746. if (vnode1.$tag$ === vnode2.$tag$) {
  747. if (BUILD.slotRelocation && vnode1.$tag$ === "slot") {
  748. return vnode1.$name$ === vnode2.$name$;
  749. }
  750. if (BUILD.vdomKey) {
  751. return vnode1.$key$ === vnode2.$key$;
  752. }
  753. return true;
  754. }
  755. return false;
  756. };
  757. var referenceNode = (node) => {
  758. return node && node["s-ol"] || node;
  759. };
  760. var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
  761. var patch = (oldVNode, newVNode2) => {
  762. const elm = newVNode2.$elm$ = oldVNode.$elm$;
  763. const oldChildren = oldVNode.$children$;
  764. const newChildren = newVNode2.$children$;
  765. const tag = newVNode2.$tag$;
  766. const text = newVNode2.$text$;
  767. let defaultHolder;
  768. if (!BUILD.vdomText || text === null) {
  769. if (BUILD.svg) {
  770. isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
  771. }
  772. if (BUILD.vdomAttribute || BUILD.reflect) {
  773. if (BUILD.slot && tag === "slot")
  774. ;
  775. else {
  776. updateElement(oldVNode, newVNode2, isSvgMode);
  777. }
  778. }
  779. if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
  780. updateChildren(elm, oldChildren, newVNode2, newChildren);
  781. } else if (newChildren !== null) {
  782. if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
  783. elm.textContent = "";
  784. }
  785. addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
  786. } else if (BUILD.updatable && oldChildren !== null) {
  787. removeVnodes(oldChildren, 0, oldChildren.length - 1);
  788. }
  789. if (BUILD.svg && isSvgMode && tag === "svg") {
  790. isSvgMode = false;
  791. }
  792. } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
  793. defaultHolder.parentNode.textContent = text;
  794. } else if (BUILD.vdomText && oldVNode.$text$ !== text) {
  795. elm.data = text;
  796. }
  797. };
  798. var updateFallbackSlotVisibility = (elm) => {
  799. let childNodes = elm.childNodes;
  800. let childNode;
  801. let i2;
  802. let ilen;
  803. let j;
  804. let slotNameAttr;
  805. let nodeType;
  806. for (i2 = 0, ilen = childNodes.length; i2 < ilen; i2++) {
  807. childNode = childNodes[i2];
  808. if (childNode.nodeType === 1) {
  809. if (childNode["s-sr"]) {
  810. slotNameAttr = childNode["s-sn"];
  811. childNode.hidden = false;
  812. for (j = 0; j < ilen; j++) {
  813. nodeType = childNodes[j].nodeType;
  814. if (childNodes[j]["s-hn"] !== childNode["s-hn"] || slotNameAttr !== "") {
  815. if (nodeType === 1 && slotNameAttr === childNodes[j].getAttribute("slot")) {
  816. childNode.hidden = true;
  817. break;
  818. }
  819. } else {
  820. if (nodeType === 1 || nodeType === 3 && childNodes[j].textContent.trim() !== "") {
  821. childNode.hidden = true;
  822. break;
  823. }
  824. }
  825. }
  826. }
  827. updateFallbackSlotVisibility(childNode);
  828. }
  829. }
  830. };
  831. var relocateNodes = [];
  832. var relocateSlotContent = (elm) => {
  833. let childNode;
  834. let node;
  835. let hostContentNodes;
  836. let slotNameAttr;
  837. let relocateNodeData;
  838. let j;
  839. let i2 = 0;
  840. let childNodes = elm.childNodes;
  841. let ilen = childNodes.length;
  842. for (; i2 < ilen; i2++) {
  843. childNode = childNodes[i2];
  844. if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
  845. hostContentNodes = node.parentNode.childNodes;
  846. slotNameAttr = childNode["s-sn"];
  847. for (j = hostContentNodes.length - 1; j >= 0; j--) {
  848. node = hostContentNodes[j];
  849. if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"]) {
  850. if (isNodeLocatedInSlot(node, slotNameAttr)) {
  851. relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
  852. checkSlotFallbackVisibility = true;
  853. node["s-sn"] = node["s-sn"] || slotNameAttr;
  854. if (relocateNodeData) {
  855. relocateNodeData.$slotRefNode$ = childNode;
  856. } else {
  857. relocateNodes.push({
  858. $slotRefNode$: childNode,
  859. $nodeToRelocate$: node
  860. });
  861. }
  862. if (node["s-sr"]) {
  863. relocateNodes.map((relocateNode) => {
  864. if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
  865. relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
  866. if (relocateNodeData && !relocateNode.$slotRefNode$) {
  867. relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
  868. }
  869. }
  870. });
  871. }
  872. } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
  873. relocateNodes.push({
  874. $nodeToRelocate$: node
  875. });
  876. }
  877. }
  878. }
  879. }
  880. if (childNode.nodeType === 1) {
  881. relocateSlotContent(childNode);
  882. }
  883. }
  884. };
  885. var isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
  886. if (nodeToRelocate.nodeType === 1) {
  887. if (nodeToRelocate.getAttribute("slot") === null && slotNameAttr === "") {
  888. return true;
  889. }
  890. if (nodeToRelocate.getAttribute("slot") === slotNameAttr) {
  891. return true;
  892. }
  893. return false;
  894. }
  895. if (nodeToRelocate["s-sn"] === slotNameAttr) {
  896. return true;
  897. }
  898. return slotNameAttr === "";
  899. };
  900. var callNodeRefs = (vNode) => {
  901. if (BUILD.vdomRef) {
  902. vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
  903. vNode.$children$ && vNode.$children$.map(callNodeRefs);
  904. }
  905. };
  906. var renderVdom = (hostRef, renderFnResults) => {
  907. const hostElm = hostRef.$hostElement$;
  908. const cmpMeta = hostRef.$cmpMeta$;
  909. const oldVNode = hostRef.$vnode$ || newVNode(null, null);
  910. const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
  911. hostTagName = hostElm.tagName;
  912. if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
  913. throw new Error(`The <Host> must be the single root component.
  914. Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
  915. The render() function should look like this instead:
  916. render() {
  917. // Do not return an array
  918. return (
  919. <Host>{content}</Host>
  920. );
  921. }
  922. `);
  923. }
  924. if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
  925. rootVnode.$attrs$ = rootVnode.$attrs$ || {};
  926. cmpMeta.$attrsToReflect$.map(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
  927. }
  928. rootVnode.$tag$ = null;
  929. rootVnode.$flags$ |= 4;
  930. hostRef.$vnode$ = rootVnode;
  931. rootVnode.$elm$ = oldVNode.$elm$ = BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
  932. if (BUILD.scoped || BUILD.shadowDom) {
  933. scopeId = hostElm["s-sc"];
  934. }
  935. if (BUILD.slotRelocation) {
  936. contentRef = hostElm["s-cr"];
  937. useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1) !== 0;
  938. checkSlotFallbackVisibility = false;
  939. }
  940. patch(oldVNode, rootVnode);
  941. if (BUILD.slotRelocation) {
  942. plt.$flags$ |= 1;
  943. if (checkSlotRelocate) {
  944. relocateSlotContent(rootVnode.$elm$);
  945. let relocateData;
  946. let nodeToRelocate;
  947. let orgLocationNode;
  948. let parentNodeRef;
  949. let insertBeforeNode;
  950. let refNode;
  951. let i2 = 0;
  952. for (; i2 < relocateNodes.length; i2++) {
  953. relocateData = relocateNodes[i2];
  954. nodeToRelocate = relocateData.$nodeToRelocate$;
  955. if (!nodeToRelocate["s-ol"]) {
  956. orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
  957. orgLocationNode["s-nr"] = nodeToRelocate;
  958. nodeToRelocate.parentNode.insertBefore(nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
  959. }
  960. }
  961. for (i2 = 0; i2 < relocateNodes.length; i2++) {
  962. relocateData = relocateNodes[i2];
  963. nodeToRelocate = relocateData.$nodeToRelocate$;
  964. if (relocateData.$slotRefNode$) {
  965. parentNodeRef = relocateData.$slotRefNode$.parentNode;
  966. insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
  967. orgLocationNode = nodeToRelocate["s-ol"];
  968. while (orgLocationNode = orgLocationNode.previousSibling) {
  969. refNode = orgLocationNode["s-nr"];
  970. if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
  971. refNode = refNode.nextSibling;
  972. if (!refNode || !refNode["s-nr"]) {
  973. insertBeforeNode = refNode;
  974. break;
  975. }
  976. }
  977. }
  978. if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
  979. if (nodeToRelocate !== insertBeforeNode) {
  980. if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
  981. nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
  982. }
  983. parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
  984. }
  985. }
  986. } else {
  987. if (nodeToRelocate.nodeType === 1) {
  988. nodeToRelocate.hidden = true;
  989. }
  990. }
  991. }
  992. }
  993. if (checkSlotFallbackVisibility) {
  994. updateFallbackSlotVisibility(rootVnode.$elm$);
  995. }
  996. plt.$flags$ &= ~1;
  997. relocateNodes.length = 0;
  998. }
  999. };
  1000. var slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`);
  1001. var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`));
  1002. var getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
  1003. var createEvent = (ref, name, flags) => {
  1004. const elm = getElement(ref);
  1005. return {
  1006. emit: (detail) => {
  1007. if (BUILD.isDev && !elm.isConnected) {
  1008. consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
  1009. }
  1010. return emitEvent(elm, name, {
  1011. bubbles: !!(flags & 4),
  1012. composed: !!(flags & 2),
  1013. cancelable: !!(flags & 1),
  1014. detail
  1015. });
  1016. }
  1017. };
  1018. };
  1019. var emitEvent = (elm, name, opts) => {
  1020. const ev = plt.ce(name, opts);
  1021. elm.dispatchEvent(ev);
  1022. return ev;
  1023. };
  1024. var attachToAncestor = (hostRef, ancestorComponent) => {
  1025. if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
  1026. ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
  1027. }
  1028. };
  1029. var scheduleUpdate = (hostRef, isInitialLoad) => {
  1030. if (BUILD.taskQueue && BUILD.updatable) {
  1031. hostRef.$flags$ |= 16;
  1032. }
  1033. if (BUILD.asyncLoading && hostRef.$flags$ & 4) {
  1034. hostRef.$flags$ |= 512;
  1035. return;
  1036. }
  1037. attachToAncestor(hostRef, hostRef.$ancestorComponent$);
  1038. const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
  1039. return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
  1040. };
  1041. var dispatchHooks = (hostRef, isInitialLoad) => {
  1042. const elm = hostRef.$hostElement$;
  1043. const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
  1044. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1045. let promise;
  1046. if (isInitialLoad) {
  1047. if (BUILD.lazyLoad && BUILD.hostListener) {
  1048. hostRef.$flags$ |= 256;
  1049. if (hostRef.$queuedListeners$) {
  1050. hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
  1051. hostRef.$queuedListeners$ = null;
  1052. }
  1053. }
  1054. emitLifecycleEvent(elm, "componentWillLoad");
  1055. if (BUILD.cmpWillLoad) {
  1056. promise = safeCall(instance, "componentWillLoad");
  1057. }
  1058. } else {
  1059. emitLifecycleEvent(elm, "componentWillUpdate");
  1060. if (BUILD.cmpWillUpdate) {
  1061. promise = safeCall(instance, "componentWillUpdate");
  1062. }
  1063. }
  1064. emitLifecycleEvent(elm, "componentWillRender");
  1065. if (BUILD.cmpWillRender) {
  1066. promise = then(promise, () => safeCall(instance, "componentWillRender"));
  1067. }
  1068. endSchedule();
  1069. return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
  1070. };
  1071. var updateComponent = async (hostRef, instance, isInitialLoad) => {
  1072. const elm = hostRef.$hostElement$;
  1073. const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
  1074. const rc = elm["s-rc"];
  1075. if (BUILD.style && isInitialLoad) {
  1076. attachStyles(hostRef);
  1077. }
  1078. const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
  1079. if (BUILD.isDev) {
  1080. hostRef.$flags$ |= 1024;
  1081. }
  1082. if (BUILD.hydrateServerSide) {
  1083. await callRender(hostRef, instance, elm);
  1084. } else {
  1085. callRender(hostRef, instance, elm);
  1086. }
  1087. if (BUILD.cssVarShim && plt.$cssShim$) {
  1088. plt.$cssShim$.updateHost(elm);
  1089. }
  1090. if (BUILD.isDev) {
  1091. hostRef.$renderCount$++;
  1092. hostRef.$flags$ &= ~1024;
  1093. }
  1094. if (BUILD.hydrateServerSide) {
  1095. try {
  1096. serverSideConnected(elm);
  1097. if (isInitialLoad) {
  1098. if (hostRef.$cmpMeta$.$flags$ & 1) {
  1099. elm["s-en"] = "";
  1100. } else if (hostRef.$cmpMeta$.$flags$ & 2) {
  1101. elm["s-en"] = "c";
  1102. }
  1103. }
  1104. } catch (e) {
  1105. consoleError(e, elm);
  1106. }
  1107. }
  1108. if (BUILD.asyncLoading && rc) {
  1109. rc.map((cb) => cb());
  1110. elm["s-rc"] = void 0;
  1111. }
  1112. endRender();
  1113. endUpdate();
  1114. if (BUILD.asyncLoading) {
  1115. const childrenPromises = elm["s-p"];
  1116. const postUpdate = () => postUpdateComponent(hostRef);
  1117. if (childrenPromises.length === 0) {
  1118. postUpdate();
  1119. } else {
  1120. Promise.all(childrenPromises).then(postUpdate);
  1121. hostRef.$flags$ |= 4;
  1122. childrenPromises.length = 0;
  1123. }
  1124. } else {
  1125. postUpdateComponent(hostRef);
  1126. }
  1127. };
  1128. var callRender = (hostRef, instance, elm) => {
  1129. const allRenderFn = BUILD.allRenderFn ? true : false;
  1130. const lazyLoad = BUILD.lazyLoad ? true : false;
  1131. const taskQueue = BUILD.taskQueue ? true : false;
  1132. const updatable = BUILD.updatable ? true : false;
  1133. try {
  1134. renderingRef = instance;
  1135. instance = allRenderFn ? instance.render() : instance.render && instance.render();
  1136. if (updatable && taskQueue) {
  1137. hostRef.$flags$ &= ~16;
  1138. }
  1139. if (updatable || lazyLoad) {
  1140. hostRef.$flags$ |= 2;
  1141. }
  1142. if (BUILD.hasRenderFn || BUILD.reflect) {
  1143. if (BUILD.vdomRender || BUILD.reflect) {
  1144. if (BUILD.hydrateServerSide) {
  1145. return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
  1146. } else {
  1147. renderVdom(hostRef, instance);
  1148. }
  1149. } else {
  1150. elm.textContent = instance;
  1151. }
  1152. }
  1153. } catch (e) {
  1154. consoleError(e, hostRef.$hostElement$);
  1155. }
  1156. renderingRef = null;
  1157. return null;
  1158. };
  1159. var postUpdateComponent = (hostRef) => {
  1160. const tagName = hostRef.$cmpMeta$.$tagName$;
  1161. const elm = hostRef.$hostElement$;
  1162. const endPostUpdate = createTime("postUpdate", tagName);
  1163. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1164. const ancestorComponent = hostRef.$ancestorComponent$;
  1165. if (BUILD.cmpDidRender) {
  1166. if (BUILD.isDev) {
  1167. hostRef.$flags$ |= 1024;
  1168. }
  1169. safeCall(instance, "componentDidRender");
  1170. if (BUILD.isDev) {
  1171. hostRef.$flags$ &= ~1024;
  1172. }
  1173. }
  1174. emitLifecycleEvent(elm, "componentDidRender");
  1175. if (!(hostRef.$flags$ & 64)) {
  1176. hostRef.$flags$ |= 64;
  1177. if (BUILD.asyncLoading && BUILD.cssAnnotations) {
  1178. addHydratedFlag(elm);
  1179. }
  1180. if (BUILD.cmpDidLoad) {
  1181. if (BUILD.isDev) {
  1182. hostRef.$flags$ |= 2048;
  1183. }
  1184. safeCall(instance, "componentDidLoad");
  1185. if (BUILD.isDev) {
  1186. hostRef.$flags$ &= ~2048;
  1187. }
  1188. }
  1189. emitLifecycleEvent(elm, "componentDidLoad");
  1190. endPostUpdate();
  1191. if (BUILD.asyncLoading) {
  1192. hostRef.$onReadyResolve$(elm);
  1193. if (!ancestorComponent) {
  1194. appDidLoad(tagName);
  1195. }
  1196. }
  1197. } else {
  1198. if (BUILD.cmpDidUpdate) {
  1199. if (BUILD.isDev) {
  1200. hostRef.$flags$ |= 1024;
  1201. }
  1202. safeCall(instance, "componentDidUpdate");
  1203. if (BUILD.isDev) {
  1204. hostRef.$flags$ &= ~1024;
  1205. }
  1206. }
  1207. emitLifecycleEvent(elm, "componentDidUpdate");
  1208. endPostUpdate();
  1209. }
  1210. if (BUILD.hotModuleReplacement) {
  1211. elm["s-hmr-load"] && elm["s-hmr-load"]();
  1212. }
  1213. if (BUILD.method && BUILD.lazyLoad) {
  1214. hostRef.$onInstanceResolve$(elm);
  1215. }
  1216. if (BUILD.asyncLoading) {
  1217. if (hostRef.$onRenderResolve$) {
  1218. hostRef.$onRenderResolve$();
  1219. hostRef.$onRenderResolve$ = void 0;
  1220. }
  1221. if (hostRef.$flags$ & 512) {
  1222. nextTick(() => scheduleUpdate(hostRef, false));
  1223. }
  1224. hostRef.$flags$ &= ~(4 | 512);
  1225. }
  1226. };
  1227. var forceUpdate = (ref) => {
  1228. if (BUILD.updatable) {
  1229. const hostRef = getHostRef(ref);
  1230. const isConnected = hostRef.$hostElement$.isConnected;
  1231. if (isConnected && (hostRef.$flags$ & (2 | 16)) === 2) {
  1232. scheduleUpdate(hostRef, false);
  1233. }
  1234. return isConnected;
  1235. }
  1236. return false;
  1237. };
  1238. var appDidLoad = (who) => {
  1239. if (BUILD.cssAnnotations) {
  1240. addHydratedFlag(doc.documentElement);
  1241. }
  1242. if (BUILD.asyncQueue) {
  1243. plt.$flags$ |= 2;
  1244. }
  1245. nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
  1246. if (BUILD.profile && performance.measure) {
  1247. performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
  1248. }
  1249. };
  1250. var safeCall = (instance, method, arg) => {
  1251. if (instance && instance[method]) {
  1252. try {
  1253. return instance[method](arg);
  1254. } catch (e) {
  1255. consoleError(e);
  1256. }
  1257. }
  1258. return void 0;
  1259. };
  1260. var then = (promise, thenFn) => {
  1261. return promise && promise.then ? promise.then(thenFn) : thenFn();
  1262. };
  1263. var emitLifecycleEvent = (elm, lifecycleName) => {
  1264. if (BUILD.lifecycleDOMEvents) {
  1265. emitEvent(elm, "stencil_" + lifecycleName, {
  1266. bubbles: true,
  1267. composed: true,
  1268. detail: {
  1269. namespace: NAMESPACE
  1270. }
  1271. });
  1272. }
  1273. };
  1274. var addHydratedFlag = (elm) => BUILD.hydratedClass ? elm.classList.add("hydrated") : BUILD.hydratedAttribute ? elm.setAttribute("hydrated", "") : void 0;
  1275. var serverSideConnected = (elm) => {
  1276. const children = elm.children;
  1277. if (children != null) {
  1278. for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
  1279. const childElm = children[i2];
  1280. if (typeof childElm.connectedCallback === "function") {
  1281. childElm.connectedCallback();
  1282. }
  1283. serverSideConnected(childElm);
  1284. }
  1285. }
  1286. };
  1287. var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
  1288. const endHydrate = createTime("hydrateClient", tagName);
  1289. const shadowRoot = hostElm.shadowRoot;
  1290. const childRenderNodes = [];
  1291. const slotNodes = [];
  1292. const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
  1293. const vnode = hostRef.$vnode$ = newVNode(tagName, null);
  1294. if (!plt.$orgLocNodes$) {
  1295. initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
  1296. }
  1297. hostElm[HYDRATE_ID] = hostId;
  1298. hostElm.removeAttribute(HYDRATE_ID);
  1299. clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
  1300. childRenderNodes.map((c) => {
  1301. const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
  1302. const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
  1303. const node = c.$elm$;
  1304. if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
  1305. orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
  1306. }
  1307. if (!shadowRoot) {
  1308. node["s-hn"] = tagName;
  1309. if (orgLocationNode) {
  1310. node["s-ol"] = orgLocationNode;
  1311. node["s-ol"]["s-nr"] = node;
  1312. }
  1313. }
  1314. plt.$orgLocNodes$.delete(orgLocationId);
  1315. });
  1316. if (BUILD.shadowDom && shadowRoot) {
  1317. shadowRootNodes.map((shadowRootNode) => {
  1318. if (shadowRootNode) {
  1319. shadowRoot.appendChild(shadowRootNode);
  1320. }
  1321. });
  1322. }
  1323. endHydrate();
  1324. };
  1325. var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
  1326. let childNodeType;
  1327. let childIdSplt;
  1328. let childVNode;
  1329. let i2;
  1330. if (node.nodeType === 1) {
  1331. childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
  1332. if (childNodeType) {
  1333. childIdSplt = childNodeType.split(".");
  1334. if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
  1335. childVNode = {
  1336. $flags$: 0,
  1337. $hostId$: childIdSplt[0],
  1338. $nodeId$: childIdSplt[1],
  1339. $depth$: childIdSplt[2],
  1340. $index$: childIdSplt[3],
  1341. $tag$: node.tagName.toLowerCase(),
  1342. $elm$: node,
  1343. $attrs$: null,
  1344. $children$: null,
  1345. $key$: null,
  1346. $name$: null,
  1347. $text$: null
  1348. };
  1349. childRenderNodes.push(childVNode);
  1350. node.removeAttribute(HYDRATE_CHILD_ID);
  1351. if (!parentVNode.$children$) {
  1352. parentVNode.$children$ = [];
  1353. }
  1354. parentVNode.$children$[childVNode.$index$] = childVNode;
  1355. parentVNode = childVNode;
  1356. if (shadowRootNodes && childVNode.$depth$ === "0") {
  1357. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  1358. }
  1359. }
  1360. }
  1361. for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
  1362. clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i2], hostId);
  1363. }
  1364. if (node.shadowRoot) {
  1365. for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
  1366. clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i2], hostId);
  1367. }
  1368. }
  1369. } else if (node.nodeType === 8) {
  1370. childIdSplt = node.nodeValue.split(".");
  1371. if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
  1372. childNodeType = childIdSplt[0];
  1373. childVNode = {
  1374. $flags$: 0,
  1375. $hostId$: childIdSplt[1],
  1376. $nodeId$: childIdSplt[2],
  1377. $depth$: childIdSplt[3],
  1378. $index$: childIdSplt[4],
  1379. $elm$: node,
  1380. $attrs$: null,
  1381. $children$: null,
  1382. $key$: null,
  1383. $name$: null,
  1384. $tag$: null,
  1385. $text$: null
  1386. };
  1387. if (childNodeType === TEXT_NODE_ID) {
  1388. childVNode.$elm$ = node.nextSibling;
  1389. if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3) {
  1390. childVNode.$text$ = childVNode.$elm$.textContent;
  1391. childRenderNodes.push(childVNode);
  1392. node.remove();
  1393. if (!parentVNode.$children$) {
  1394. parentVNode.$children$ = [];
  1395. }
  1396. parentVNode.$children$[childVNode.$index$] = childVNode;
  1397. if (shadowRootNodes && childVNode.$depth$ === "0") {
  1398. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  1399. }
  1400. }
  1401. } else if (childVNode.$hostId$ === hostId) {
  1402. if (childNodeType === SLOT_NODE_ID) {
  1403. childVNode.$tag$ = "slot";
  1404. if (childIdSplt[5]) {
  1405. node["s-sn"] = childVNode.$name$ = childIdSplt[5];
  1406. } else {
  1407. node["s-sn"] = "";
  1408. }
  1409. node["s-sr"] = true;
  1410. if (BUILD.shadowDom && shadowRootNodes) {
  1411. childVNode.$elm$ = doc.createElement(childVNode.$tag$);
  1412. if (childVNode.$name$) {
  1413. childVNode.$elm$.setAttribute("name", childVNode.$name$);
  1414. }
  1415. node.parentNode.insertBefore(childVNode.$elm$, node);
  1416. node.remove();
  1417. if (childVNode.$depth$ === "0") {
  1418. shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
  1419. }
  1420. }
  1421. slotNodes.push(childVNode);
  1422. if (!parentVNode.$children$) {
  1423. parentVNode.$children$ = [];
  1424. }
  1425. parentVNode.$children$[childVNode.$index$] = childVNode;
  1426. } else if (childNodeType === CONTENT_REF_ID) {
  1427. if (BUILD.shadowDom && shadowRootNodes) {
  1428. node.remove();
  1429. } else if (BUILD.slotRelocation) {
  1430. hostElm["s-cr"] = node;
  1431. node["s-cn"] = true;
  1432. }
  1433. }
  1434. }
  1435. }
  1436. } else if (parentVNode && parentVNode.$tag$ === "style") {
  1437. const vnode = newVNode(null, node.textContent);
  1438. vnode.$elm$ = node;
  1439. vnode.$index$ = "0";
  1440. parentVNode.$children$ = [vnode];
  1441. }
  1442. };
  1443. var initializeDocumentHydrate = (node, orgLocNodes) => {
  1444. if (node.nodeType === 1) {
  1445. let i2 = 0;
  1446. for (; i2 < node.childNodes.length; i2++) {
  1447. initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
  1448. }
  1449. if (node.shadowRoot) {
  1450. for (i2 = 0; i2 < node.shadowRoot.childNodes.length; i2++) {
  1451. initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
  1452. }
  1453. }
  1454. } else if (node.nodeType === 8) {
  1455. const childIdSplt = node.nodeValue.split(".");
  1456. if (childIdSplt[0] === ORG_LOCATION_ID) {
  1457. orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
  1458. node.nodeValue = "";
  1459. node["s-en"] = childIdSplt[3];
  1460. }
  1461. }
  1462. };
  1463. var parsePropertyValue = (propValue, propType) => {
  1464. if (propValue != null && !isComplexType(propValue)) {
  1465. if (BUILD.propBoolean && propType & 4) {
  1466. return propValue === "false" ? false : propValue === "" || !!propValue;
  1467. }
  1468. if (BUILD.propNumber && propType & 2) {
  1469. return parseFloat(propValue);
  1470. }
  1471. if (BUILD.propString && propType & 1) {
  1472. return String(propValue);
  1473. }
  1474. return propValue;
  1475. }
  1476. return propValue;
  1477. };
  1478. var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
  1479. var setValue = (ref, propName, newVal, cmpMeta) => {
  1480. const hostRef = getHostRef(ref);
  1481. const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
  1482. const oldVal = hostRef.$instanceValues$.get(propName);
  1483. const flags = hostRef.$flags$;
  1484. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1485. newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
  1486. const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
  1487. const didValueChange = newVal !== oldVal && !areBothNaN;
  1488. if ((!BUILD.lazyLoad || !(flags & 8) || oldVal === void 0) && didValueChange) {
  1489. hostRef.$instanceValues$.set(propName, newVal);
  1490. if (BUILD.isDev) {
  1491. if (hostRef.$flags$ & 1024) {
  1492. consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
  1493. } else if (hostRef.$flags$ & 2048) {
  1494. consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
  1495. }
  1496. }
  1497. if (!BUILD.lazyLoad || instance) {
  1498. if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128) {
  1499. const watchMethods = cmpMeta.$watchers$[propName];
  1500. if (watchMethods) {
  1501. watchMethods.map((watchMethodName) => {
  1502. try {
  1503. instance[watchMethodName](newVal, oldVal, propName);
  1504. } catch (e) {
  1505. consoleError(e, elm);
  1506. }
  1507. });
  1508. }
  1509. }
  1510. if (BUILD.updatable && (flags & (2 | 16)) === 2) {
  1511. if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
  1512. if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
  1513. return;
  1514. }
  1515. }
  1516. scheduleUpdate(hostRef, false);
  1517. }
  1518. }
  1519. }
  1520. };
  1521. var proxyComponent = (Cstr, cmpMeta, flags) => {
  1522. if (BUILD.member && cmpMeta.$members$) {
  1523. if (BUILD.watchCallback && Cstr.watchers) {
  1524. cmpMeta.$watchers$ = Cstr.watchers;
  1525. }
  1526. const members = Object.entries(cmpMeta.$members$);
  1527. const prototype = Cstr.prototype;
  1528. members.map(([memberName, [memberFlags]]) => {
  1529. if ((BUILD.prop || BUILD.state) && (memberFlags & 31 || (!BUILD.lazyLoad || flags & 2) && memberFlags & 32)) {
  1530. Object.defineProperty(prototype, memberName, {
  1531. get() {
  1532. return getValue(this, memberName);
  1533. },
  1534. set(newValue) {
  1535. if (BUILD.isDev) {
  1536. const ref = getHostRef(this);
  1537. if ((flags & 1) === 0 && (ref.$flags$ & 8) === 0 && (memberFlags & 31) !== 0 && (memberFlags & 1024) === 0) {
  1538. consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
  1539. More information: https://stenciljs.com/docs/properties#prop-mutability`);
  1540. }
  1541. }
  1542. setValue(this, memberName, newValue, cmpMeta);
  1543. },
  1544. configurable: true,
  1545. enumerable: true
  1546. });
  1547. } else if (BUILD.lazyLoad && BUILD.method && flags & 1 && memberFlags & 64) {
  1548. Object.defineProperty(prototype, memberName, {
  1549. value(...args) {
  1550. const ref = getHostRef(this);
  1551. return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
  1552. }
  1553. });
  1554. }
  1555. });
  1556. if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1)) {
  1557. const attrNameToPropName = new Map();
  1558. prototype.attributeChangedCallback = function(attrName, _oldValue, newValue) {
  1559. plt.jmp(() => {
  1560. const propName = attrNameToPropName.get(attrName);
  1561. if (this.hasOwnProperty(propName)) {
  1562. newValue = this[propName];
  1563. delete this[propName];
  1564. } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
  1565. return;
  1566. }
  1567. this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
  1568. });
  1569. };
  1570. Cstr.observedAttributes = members.filter(([_, m]) => m[0] & 15).map(([propName, m]) => {
  1571. const attrName = m[1] || propName;
  1572. attrNameToPropName.set(attrName, propName);
  1573. if (BUILD.reflect && m[0] & 512) {
  1574. cmpMeta.$attrsToReflect$.push([propName, attrName]);
  1575. }
  1576. return attrName;
  1577. });
  1578. }
  1579. }
  1580. return Cstr;
  1581. };
  1582. var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
  1583. if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32) === 0) {
  1584. if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
  1585. hostRef.$flags$ |= 32;
  1586. Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
  1587. if (Cstr.then) {
  1588. const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
  1589. Cstr = await Cstr;
  1590. endLoad();
  1591. }
  1592. if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
  1593. throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
  1594. }
  1595. if (BUILD.member && !Cstr.isProxied) {
  1596. if (BUILD.watchCallback) {
  1597. cmpMeta.$watchers$ = Cstr.watchers;
  1598. }
  1599. proxyComponent(Cstr, cmpMeta, 2);
  1600. Cstr.isProxied = true;
  1601. }
  1602. const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
  1603. if (BUILD.member) {
  1604. hostRef.$flags$ |= 8;
  1605. }
  1606. try {
  1607. new Cstr(hostRef);
  1608. } catch (e) {
  1609. consoleError(e);
  1610. }
  1611. if (BUILD.member) {
  1612. hostRef.$flags$ &= ~8;
  1613. }
  1614. if (BUILD.watchCallback) {
  1615. hostRef.$flags$ |= 128;
  1616. }
  1617. endNewInstance();
  1618. fireConnectedCallback(hostRef.$lazyInstance$);
  1619. } else {
  1620. Cstr = elm.constructor;
  1621. hostRef.$flags$ |= 32;
  1622. customElements.whenDefined(cmpMeta.$tagName$).then(() => hostRef.$flags$ |= 128);
  1623. }
  1624. if (BUILD.style && Cstr.style) {
  1625. let style = Cstr.style;
  1626. if (BUILD.mode && typeof style !== "string") {
  1627. style = style[hostRef.$modeName$ = computeMode(elm)];
  1628. if (BUILD.hydrateServerSide && hostRef.$modeName$) {
  1629. elm.setAttribute("s-mode", hostRef.$modeName$);
  1630. }
  1631. }
  1632. const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
  1633. if (!styles.has(scopeId2)) {
  1634. const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
  1635. if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8) {
  1636. style = await import("./shadow-css-SEB4SDQE.js").then((m) => m.scopeCss(style, scopeId2, false));
  1637. }
  1638. registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1));
  1639. endRegisterStyles();
  1640. }
  1641. }
  1642. }
  1643. const ancestorComponent = hostRef.$ancestorComponent$;
  1644. const schedule = () => scheduleUpdate(hostRef, true);
  1645. if (BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
  1646. ancestorComponent["s-rc"].push(schedule);
  1647. } else {
  1648. schedule();
  1649. }
  1650. };
  1651. var fireConnectedCallback = (instance) => {
  1652. if (BUILD.lazyLoad && BUILD.connectedCallback) {
  1653. safeCall(instance, "connectedCallback");
  1654. }
  1655. };
  1656. var connectedCallback = (elm) => {
  1657. if ((plt.$flags$ & 1) === 0) {
  1658. const hostRef = getHostRef(elm);
  1659. const cmpMeta = hostRef.$cmpMeta$;
  1660. const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
  1661. if (BUILD.hostListenerTargetParent) {
  1662. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
  1663. }
  1664. if (!(hostRef.$flags$ & 1)) {
  1665. hostRef.$flags$ |= 1;
  1666. let hostId;
  1667. if (BUILD.hydrateClientSide) {
  1668. hostId = elm.getAttribute(HYDRATE_ID);
  1669. if (hostId) {
  1670. if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1) {
  1671. const scopeId2 = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
  1672. elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
  1673. }
  1674. initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
  1675. }
  1676. }
  1677. if (BUILD.slotRelocation && !hostId) {
  1678. if (BUILD.hydrateServerSide || (BUILD.slot || BUILD.shadowDom) && cmpMeta.$flags$ & (4 | 8)) {
  1679. setContentReference(elm);
  1680. }
  1681. }
  1682. if (BUILD.asyncLoading) {
  1683. let ancestorComponent = elm;
  1684. while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
  1685. if (BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
  1686. attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
  1687. break;
  1688. }
  1689. }
  1690. }
  1691. if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
  1692. Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
  1693. if (memberFlags & 31 && elm.hasOwnProperty(memberName)) {
  1694. const value = elm[memberName];
  1695. delete elm[memberName];
  1696. elm[memberName] = value;
  1697. }
  1698. });
  1699. }
  1700. if (BUILD.initializeNextTick) {
  1701. nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
  1702. } else {
  1703. initializeComponent(elm, hostRef, cmpMeta);
  1704. }
  1705. } else {
  1706. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
  1707. fireConnectedCallback(hostRef.$lazyInstance$);
  1708. }
  1709. endConnected();
  1710. }
  1711. };
  1712. var setContentReference = (elm) => {
  1713. const contentRefElm = elm["s-cr"] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : "");
  1714. contentRefElm["s-cn"] = true;
  1715. elm.insertBefore(contentRefElm, elm.firstChild);
  1716. };
  1717. var disconnectedCallback = (elm) => {
  1718. if ((plt.$flags$ & 1) === 0) {
  1719. const hostRef = getHostRef(elm);
  1720. const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
  1721. if (BUILD.hostListener) {
  1722. if (hostRef.$rmListeners$) {
  1723. hostRef.$rmListeners$.map((rmListener) => rmListener());
  1724. hostRef.$rmListeners$ = void 0;
  1725. }
  1726. }
  1727. if (BUILD.cssVarShim && plt.$cssShim$) {
  1728. plt.$cssShim$.removeHost(elm);
  1729. }
  1730. if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
  1731. safeCall(instance, "disconnectedCallback");
  1732. }
  1733. if (BUILD.cmpDidUnload) {
  1734. safeCall(instance, "componentDidUnload");
  1735. }
  1736. }
  1737. };
  1738. var proxyCustomElement = (Cstr, compactMeta) => {
  1739. const cmpMeta = {
  1740. $flags$: compactMeta[0],
  1741. $tagName$: compactMeta[1]
  1742. };
  1743. if (BUILD.member) {
  1744. cmpMeta.$members$ = compactMeta[2];
  1745. }
  1746. if (BUILD.hostListener) {
  1747. cmpMeta.$listeners$ = compactMeta[3];
  1748. }
  1749. if (BUILD.watchCallback) {
  1750. cmpMeta.$watchers$ = Cstr.$watchers$;
  1751. }
  1752. if (BUILD.reflect) {
  1753. cmpMeta.$attrsToReflect$ = [];
  1754. }
  1755. if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1) {
  1756. cmpMeta.$flags$ |= 8;
  1757. }
  1758. const originalConnectedCallback = Cstr.prototype.connectedCallback;
  1759. const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
  1760. Object.assign(Cstr.prototype, {
  1761. __registerHost() {
  1762. registerHost(this, cmpMeta);
  1763. },
  1764. connectedCallback() {
  1765. connectedCallback(this);
  1766. if (BUILD.connectedCallback && originalConnectedCallback) {
  1767. originalConnectedCallback.call(this);
  1768. }
  1769. },
  1770. disconnectedCallback() {
  1771. disconnectedCallback(this);
  1772. if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
  1773. originalDisconnectedCallback.call(this);
  1774. }
  1775. },
  1776. __attachShadow() {
  1777. if (supportsShadow) {
  1778. if (BUILD.shadowDelegatesFocus) {
  1779. this.attachShadow({
  1780. mode: "open",
  1781. delegatesFocus: !!(cmpMeta.$flags$ & 16)
  1782. });
  1783. } else {
  1784. this.attachShadow({ mode: "open" });
  1785. }
  1786. } else {
  1787. this.shadowRoot = this;
  1788. }
  1789. }
  1790. });
  1791. Cstr.is = cmpMeta.$tagName$;
  1792. return proxyComponent(Cstr, cmpMeta, 1 | 2);
  1793. };
  1794. var getAssetPath = (path) => {
  1795. const assetUrl = new URL(path, plt.$resourcesUrl$);
  1796. return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
  1797. };
  1798. var setAssetPath = (path) => plt.$resourcesUrl$ = path;
  1799. var hostRefs = new WeakMap();
  1800. var getHostRef = (ref) => hostRefs.get(ref);
  1801. var registerHost = (elm, cmpMeta) => {
  1802. const hostRef = {
  1803. $flags$: 0,
  1804. $hostElement$: elm,
  1805. $cmpMeta$: cmpMeta,
  1806. $instanceValues$: new Map()
  1807. };
  1808. if (BUILD.isDev) {
  1809. hostRef.$renderCount$ = 0;
  1810. }
  1811. if (BUILD.method && BUILD.lazyLoad) {
  1812. hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
  1813. }
  1814. if (BUILD.asyncLoading) {
  1815. hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
  1816. elm["s-p"] = [];
  1817. elm["s-rc"] = [];
  1818. }
  1819. addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
  1820. return hostRefs.set(elm, hostRef);
  1821. };
  1822. var isMemberInElement = (elm, memberName) => memberName in elm;
  1823. var consoleError = (e, el) => (customError || console.error)(e, el);
  1824. var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
  1825. "%cstencil",
  1826. "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
  1827. ];
  1828. var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
  1829. var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
  1830. var cmpModules = new Map();
  1831. var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
  1832. const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
  1833. const bundleId = cmpMeta.$lazyBundleId$;
  1834. if (BUILD.isDev && typeof bundleId !== "string") {
  1835. consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
  1836. return void 0;
  1837. }
  1838. const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
  1839. if (module) {
  1840. return module[exportName];
  1841. }
  1842. return import(
  1843. /* webpackInclude: /\.entry\.js$/ */
  1844. /* webpackExclude: /\.system\.entry\.js$/ */
  1845. /* webpackMode: "lazy" */
  1846. `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
  1847. ).then((importedModule) => {
  1848. if (!BUILD.hotModuleReplacement) {
  1849. cmpModules.set(bundleId, importedModule);
  1850. }
  1851. return importedModule[exportName];
  1852. }, consoleError);
  1853. };
  1854. var styles = new Map();
  1855. var modeResolutionChain = [];
  1856. var queueDomReads = [];
  1857. var queueDomWrites = [];
  1858. var queueDomWritesLow = [];
  1859. var queueTask = (queue, write) => (cb) => {
  1860. queue.push(cb);
  1861. if (!queuePending) {
  1862. queuePending = true;
  1863. if (write && plt.$flags$ & 4) {
  1864. nextTick(flush);
  1865. } else {
  1866. plt.raf(flush);
  1867. }
  1868. }
  1869. };
  1870. var consume = (queue) => {
  1871. for (let i2 = 0; i2 < queue.length; i2++) {
  1872. try {
  1873. queue[i2](performance.now());
  1874. } catch (e) {
  1875. consoleError(e);
  1876. }
  1877. }
  1878. queue.length = 0;
  1879. };
  1880. var consumeTimeout = (queue, timeout) => {
  1881. let i2 = 0;
  1882. let ts = 0;
  1883. while (i2 < queue.length && (ts = performance.now()) < timeout) {
  1884. try {
  1885. queue[i2++](ts);
  1886. } catch (e) {
  1887. consoleError(e);
  1888. }
  1889. }
  1890. if (i2 === queue.length) {
  1891. queue.length = 0;
  1892. } else if (i2 !== 0) {
  1893. queue.splice(0, i2);
  1894. }
  1895. };
  1896. var flush = () => {
  1897. if (BUILD.asyncQueue) {
  1898. queueCongestion++;
  1899. }
  1900. consume(queueDomReads);
  1901. if (BUILD.asyncQueue) {
  1902. const timeout = (plt.$flags$ & 6) === 2 ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
  1903. consumeTimeout(queueDomWrites, timeout);
  1904. consumeTimeout(queueDomWritesLow, timeout);
  1905. if (queueDomWrites.length > 0) {
  1906. queueDomWritesLow.push(...queueDomWrites);
  1907. queueDomWrites.length = 0;
  1908. }
  1909. if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) {
  1910. plt.raf(flush);
  1911. } else {
  1912. queueCongestion = 0;
  1913. }
  1914. } else {
  1915. consume(queueDomWrites);
  1916. if (queuePending = queueDomReads.length > 0) {
  1917. plt.raf(flush);
  1918. }
  1919. }
  1920. };
  1921. var nextTick = (cb) => promiseResolve().then(cb);
  1922. var readTask = queueTask(queueDomReads, false);
  1923. var writeTask = queueTask(queueDomWrites, true);
  1924. var Build = {
  1925. isDev: BUILD.isDev ? true : false,
  1926. isBrowser: true,
  1927. isServer: false,
  1928. isTesting: BUILD.isTesting ? true : false
  1929. };
  1930. export {
  1931. H,
  1932. h,
  1933. Host,
  1934. createEvent,
  1935. forceUpdate,
  1936. proxyCustomElement,
  1937. getAssetPath,
  1938. setAssetPath,
  1939. Build
  1940. };
  1941. //# sourceMappingURL=chunk-P6MX663D.js.map