UNPKG

76.5 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = function (d, b) {
3 extendStatics = Object.setPrototypeOf ||
4 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6 return extendStatics(d, b);
7 };
8 return function (d, b) {
9 extendStatics(d, b);
10 function __() { this.constructor = d; }
11 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12 };
13})();
14var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16 return new (P || (P = Promise))(function (resolve, reject) {
17 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20 step((generator = generator.apply(thisArg, _arguments || [])).next());
21 });
22};
23var __generator = (this && this.__generator) || function (thisArg, body) {
24 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26 function verb(n) { return function (v) { return step([n, v]); }; }
27 function step(op) {
28 if (f) throw new TypeError("Generator is already executing.");
29 while (_) try {
30 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31 if (y = 0, t) op = [op[0] & 2, t.value];
32 switch (op[0]) {
33 case 0: case 1: t = op; break;
34 case 4: _.label++; return { value: op[1], done: false };
35 case 5: _.label++; y = op[1]; op = [0]; continue;
36 case 7: op = _.ops.pop(); _.trys.pop(); continue;
37 default:
38 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42 if (t[2]) _.ops.pop();
43 _.trys.pop(); continue;
44 }
45 op = body.call(thisArg, _);
46 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48 }
49};
50var __spreadArrays = (this && this.__spreadArrays) || function () {
51 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
52 for (var r = Array(s), k = 0, i = 0; i < il; i++)
53 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
54 r[k] = a[j];
55 return r;
56};
57var NAMESPACE = 'bulmil';
58var contentRef;
59var hostTagName;
60var useNativeShadowDom = false;
61var checkSlotFallbackVisibility = false;
62var checkSlotRelocate = false;
63var isSvgMode = false;
64var queueCongestion = 0;
65var queuePending = false;
66var win = typeof window !== 'undefined' ? window : {};
67var CSS = win.CSS;
68var doc = win.document || { head: {} };
69var plt = {
70 $flags$: 0,
71 $resourcesUrl$: '',
72 jmp: function (h) { return h(); },
73 raf: function (h) { return requestAnimationFrame(h); },
74 ael: function (el, eventName, listener, opts) { return el.addEventListener(eventName, listener, opts); },
75 rel: function (el, eventName, listener, opts) { return el.removeEventListener(eventName, listener, opts); },
76};
77var supportsShadow = true;
78var promiseResolve = function (v) { return Promise.resolve(v); };
79var supportsConstructibleStylesheets = /*@__PURE__*/ (function () {
80 try {
81 new CSSStyleSheet();
82 return true;
83 }
84 catch (e) { }
85 return false;
86})();
87var CONTENT_REF_ID = 'r';
88var ORG_LOCATION_ID = 'o';
89var SLOT_NODE_ID = 's';
90var TEXT_NODE_ID = 't';
91var HYDRATE_ID = 's-id';
92var HYDRATED_STYLE_ID = 'sty-id';
93var HYDRATE_CHILD_ID = 'c-id';
94var HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
95var createTime = function (fnName, tagName) {
96 if (tagName === void 0) { tagName = ''; }
97 {
98 return function () {
99 return;
100 };
101 }
102};
103var uniqueTime = function (key, measureText) {
104 {
105 return function () {
106 return;
107 };
108 }
109};
110var rootAppliedStyles = new WeakMap();
111var registerStyle = function (scopeId, cssText, allowCS) {
112 var style = styles.get(scopeId);
113 if (supportsConstructibleStylesheets && allowCS) {
114 style = (style || new CSSStyleSheet());
115 style.replace(cssText);
116 }
117 else {
118 style = cssText;
119 }
120 styles.set(scopeId, style);
121};
122var addStyle = function (styleContainerNode, cmpMeta, mode, hostElm) {
123 var scopeId = getScopeId(cmpMeta);
124 var style = styles.get(scopeId);
125 // if an element is NOT connected then getRootNode() will return the wrong root node
126 // so the fallback is to always use the document for the root node in those cases
127 styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
128 if (style) {
129 if (typeof style === 'string') {
130 styleContainerNode = styleContainerNode.head || styleContainerNode;
131 var appliedStyles = rootAppliedStyles.get(styleContainerNode);
132 var styleElm = void 0;
133 if (!appliedStyles) {
134 rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
135 }
136 if (!appliedStyles.has(scopeId)) {
137 if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector("[" + HYDRATED_STYLE_ID + "=\"" + scopeId + "\"]"))) {
138 // This is only happening on native shadow-dom, do not needs CSS var shim
139 styleElm.innerHTML = style;
140 }
141 else {
142 if (plt.$cssShim$) {
143 styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
144 var newScopeId = styleElm['s-sc'];
145 if (newScopeId) {
146 scopeId = newScopeId;
147 // we don't want to add this styleID to the appliedStyles Set
148 // since the cssVarShim might need to apply several different
149 // stylesheets for the same component
150 appliedStyles = null;
151 }
152 }
153 else {
154 styleElm = doc.createElement('style');
155 styleElm.innerHTML = style;
156 }
157 styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
158 }
159 if (appliedStyles) {
160 appliedStyles.add(scopeId);
161 }
162 }
163 }
164 else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
165 styleContainerNode.adoptedStyleSheets = __spreadArrays(styleContainerNode.adoptedStyleSheets, [style]);
166 }
167 }
168 return scopeId;
169};
170var attachStyles = function (hostRef) {
171 var cmpMeta = hostRef.$cmpMeta$;
172 var elm = hostRef.$hostElement$;
173 var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
174 var scopeId = addStyle(elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
175 endAttachStyles();
176};
177var getScopeId = function (cmp, mode) { return 'sc-' + (cmp.$tagName$); };
178/**
179 * Default style mode id
180 */
181/**
182 * Reusable empty obj/array
183 * Don't add values to these!!
184 */
185var EMPTY_OBJ = {};
186var isComplexType = function (o) {
187 // https://jsperf.com/typeof-fn-object/5
188 o = typeof o;
189 return o === 'object' || o === 'function';
190};
191var getDynamicImportFunction = function (namespace) { return "__sc_import_" + namespace.replace(/\s|-/g, '_'); };
192/**
193 * Production h() function based on Preact by
194 * Jason Miller (@developit)
195 * Licensed under the MIT License
196 * https://github.com/developit/preact/blob/master/LICENSE
197 *
198 * Modified for Stencil's compiler and vdom
199 */
200// const stack: any[] = [];
201// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
202// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
203var h = function (nodeName, vnodeData) {
204 var children = [];
205 for (var _i = 2; _i < arguments.length; _i++) {
206 children[_i - 2] = arguments[_i];
207 }
208 var child = null;
209 var slotName = null;
210 var simple = false;
211 var lastSimple = false;
212 var vNodeChildren = [];
213 var walk = function (c) {
214 for (var i = 0; i < c.length; i++) {
215 child = c[i];
216 if (Array.isArray(child)) {
217 walk(child);
218 }
219 else if (child != null && typeof child !== 'boolean') {
220 if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
221 child = String(child);
222 }
223 if (simple && lastSimple) {
224 // If the previous child was simple (string), we merge both
225 vNodeChildren[vNodeChildren.length - 1].$text$ += child;
226 }
227 else {
228 // Append a new vNode, if it's text, we create a text vNode
229 vNodeChildren.push(simple ? newVNode(null, child) : child);
230 }
231 lastSimple = simple;
232 }
233 }
234 };
235 walk(children);
236 if (vnodeData) {
237 if (vnodeData.name) {
238 slotName = vnodeData.name;
239 }
240 {
241 var classData_1 = vnodeData.className || vnodeData.class;
242 if (classData_1) {
243 vnodeData.class =
244 typeof classData_1 !== 'object'
245 ? classData_1
246 : Object.keys(classData_1)
247 .filter(function (k) { return classData_1[k]; })
248 .join(' ');
249 }
250 }
251 }
252 if (typeof nodeName === 'function') {
253 // nodeName is a functional component
254 return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
255 }
256 var vnode = newVNode(nodeName, null);
257 vnode.$attrs$ = vnodeData;
258 if (vNodeChildren.length > 0) {
259 vnode.$children$ = vNodeChildren;
260 }
261 {
262 vnode.$name$ = slotName;
263 }
264 return vnode;
265};
266var newVNode = function (tag, text) {
267 var vnode = {
268 $flags$: 0,
269 $tag$: tag,
270 $text$: text,
271 $elm$: null,
272 $children$: null,
273 };
274 {
275 vnode.$attrs$ = null;
276 }
277 {
278 vnode.$name$ = null;
279 }
280 return vnode;
281};
282var Host = {};
283var isHost = function (node) { return node && node.$tag$ === Host; };
284var vdomFnUtils = {
285 forEach: function (children, cb) { return children.map(convertToPublic).forEach(cb); },
286 map: function (children, cb) { return children
287 .map(convertToPublic)
288 .map(cb)
289 .map(convertToPrivate); },
290};
291var convertToPublic = function (node) { return ({
292 vattrs: node.$attrs$,
293 vchildren: node.$children$,
294 vkey: node.$key$,
295 vname: node.$name$,
296 vtag: node.$tag$,
297 vtext: node.$text$,
298}); };
299var convertToPrivate = function (node) {
300 var vnode = newVNode(node.vtag, node.vtext);
301 vnode.$attrs$ = node.vattrs;
302 vnode.$children$ = node.vchildren;
303 vnode.$key$ = node.vkey;
304 vnode.$name$ = node.vname;
305 return vnode;
306};
307/**
308 * Production setAccessor() function based on Preact by
309 * Jason Miller (@developit)
310 * Licensed under the MIT License
311 * https://github.com/developit/preact/blob/master/LICENSE
312 *
313 * Modified for Stencil's compiler and vdom
314 */
315var setAccessor = function (elm, memberName, oldValue, newValue, isSvg, flags) {
316 if (oldValue !== newValue) {
317 var isProp = isMemberInElement(elm, memberName);
318 var ln = memberName.toLowerCase();
319 if (memberName === 'class') {
320 var classList = elm.classList;
321 var oldClasses_1 = parseClassList(oldValue);
322 var newClasses_1 = parseClassList(newValue);
323 classList.remove.apply(classList, oldClasses_1.filter(function (c) { return c && !newClasses_1.includes(c); }));
324 classList.add.apply(classList, newClasses_1.filter(function (c) { return c && !oldClasses_1.includes(c); }));
325 }
326 else if ((!isProp) && memberName[0] === 'o' && memberName[1] === 'n') {
327 // Event Handlers
328 // so if the member name starts with "on" and the 3rd characters is
329 // a capital letter, and it's not already a member on the element,
330 // then we're assuming it's an event listener
331 if (memberName[2] === '-') {
332 // on- prefixed events
333 // allows to be explicit about the dom event to listen without any magic
334 // under the hood:
335 // <my-cmp on-click> // listens for "click"
336 // <my-cmp on-Click> // listens for "Click"
337 // <my-cmp on-ionChange> // listens for "ionChange"
338 // <my-cmp on-EVENTS> // listens for "EVENTS"
339 memberName = memberName.slice(3);
340 }
341 else if (isMemberInElement(win, ln)) {
342 // standard event
343 // the JSX attribute could have been "onMouseOver" and the
344 // member name "onmouseover" is on the window's prototype
345 // so let's add the listener "mouseover", which is all lowercased
346 memberName = ln.slice(2);
347 }
348 else {
349 // custom event
350 // the JSX attribute could have been "onMyCustomEvent"
351 // so let's trim off the "on" prefix and lowercase the first character
352 // and add the listener "myCustomEvent"
353 // except for the first character, we keep the event name case
354 memberName = ln[2] + memberName.slice(3);
355 }
356 if (oldValue) {
357 plt.rel(elm, memberName, oldValue, false);
358 }
359 if (newValue) {
360 plt.ael(elm, memberName, newValue, false);
361 }
362 }
363 else {
364 // Set property if it exists and it's not a SVG
365 var isComplex = isComplexType(newValue);
366 if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
367 try {
368 if (!elm.tagName.includes('-')) {
369 var n = newValue == null ? '' : newValue;
370 // Workaround for Safari, moving the <input> caret when re-assigning the same valued
371 if (memberName === 'list') {
372 isProp = false;
373 // tslint:disable-next-line: triple-equals
374 }
375 else if (oldValue == null || elm[memberName] != n) {
376 elm[memberName] = n;
377 }
378 }
379 else {
380 elm[memberName] = newValue;
381 }
382 }
383 catch (e) { }
384 }
385 if (newValue == null || newValue === false) {
386 {
387 elm.removeAttribute(memberName);
388 }
389 }
390 else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
391 newValue = newValue === true ? '' : newValue;
392 {
393 elm.setAttribute(memberName, newValue);
394 }
395 }
396 }
397 }
398};
399var parseClassListRegex = /\s/;
400var parseClassList = function (value) { return (!value ? [] : value.split(parseClassListRegex)); };
401var updateElement = function (oldVnode, newVnode, isSvgMode, memberName) {
402 // if the element passed in is a shadow root, which is a document fragment
403 // then we want to be adding attrs/props to the shadow root's "host" element
404 // if it's not a shadow root, then we add attrs/props to the same element
405 var elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
406 var oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
407 var newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
408 {
409 // remove attributes no longer present on the vnode by setting them to undefined
410 for (memberName in oldVnodeAttrs) {
411 if (!(memberName in newVnodeAttrs)) {
412 setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
413 }
414 }
415 }
416 // add new & update changed attributes
417 for (memberName in newVnodeAttrs) {
418 setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
419 }
420};
421var createElm = function (oldParentVNode, newParentVNode, childIndex, parentElm) {
422 // tslint:disable-next-line: prefer-const
423 var newVNode = newParentVNode.$children$[childIndex];
424 var i = 0;
425 var elm;
426 var childNode;
427 var oldVNode;
428 if (!useNativeShadowDom) {
429 // remember for later we need to check to relocate nodes
430 checkSlotRelocate = true;
431 if (newVNode.$tag$ === 'slot') {
432 newVNode.$flags$ |= newVNode.$children$
433 ? // slot element has fallback content
434 2 /* isSlotFallback */
435 : // slot element does not have fallback content
436 1 /* isSlotReference */;
437 }
438 }
439 if (newVNode.$text$ !== null) {
440 // create text node
441 elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
442 }
443 else if (newVNode.$flags$ & 1 /* isSlotReference */) {
444 // create a slot reference node
445 elm = newVNode.$elm$ = doc.createTextNode('');
446 }
447 else {
448 // create element
449 elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$));
450 // add css classes, attrs, props, listeners, etc.
451 {
452 updateElement(null, newVNode, isSvgMode);
453 }
454 if (newVNode.$children$) {
455 for (i = 0; i < newVNode.$children$.length; ++i) {
456 // create the node
457 childNode = createElm(oldParentVNode, newVNode, i);
458 // return node could have been null
459 if (childNode) {
460 // append our new node
461 elm.appendChild(childNode);
462 }
463 }
464 }
465 }
466 {
467 elm['s-hn'] = hostTagName;
468 if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
469 // remember the content reference comment
470 elm['s-sr'] = true;
471 // remember the content reference comment
472 elm['s-cr'] = contentRef;
473 // remember the slot name, or empty string for default slot
474 elm['s-sn'] = newVNode.$name$ || '';
475 // check if we've got an old vnode for this slot
476 oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
477 if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
478 // we've got an old slot vnode and the wrapper is being replaced
479 // so let's move the old slot content back to it's original location
480 putBackInOriginalLocation(oldParentVNode.$elm$, false);
481 }
482 }
483 }
484 return elm;
485};
486var putBackInOriginalLocation = function (parentElm, recursive) {
487 plt.$flags$ |= 1 /* isTmpDisconnected */;
488 var oldSlotChildNodes = parentElm.childNodes;
489 for (var i = oldSlotChildNodes.length - 1; i >= 0; i--) {
490 var childNode = oldSlotChildNodes[i];
491 if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
492 // // this child node in the old element is from another component
493 // // remove this node from the old slot's parent
494 // childNode.remove();
495 // and relocate it back to it's original location
496 parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
497 // remove the old original location comment entirely
498 // later on the patch function will know what to do
499 // and move this to the correct spot in need be
500 childNode['s-ol'].remove();
501 childNode['s-ol'] = undefined;
502 checkSlotRelocate = true;
503 }
504 if (recursive) {
505 putBackInOriginalLocation(childNode, recursive);
506 }
507 }
508 plt.$flags$ &= ~1 /* isTmpDisconnected */;
509};
510var addVnodes = function (parentElm, before, parentVNode, vnodes, startIdx, endIdx) {
511 var containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
512 var childNode;
513 for (; startIdx <= endIdx; ++startIdx) {
514 if (vnodes[startIdx]) {
515 childNode = createElm(null, parentVNode, startIdx);
516 if (childNode) {
517 vnodes[startIdx].$elm$ = childNode;
518 containerElm.insertBefore(childNode, referenceNode(before));
519 }
520 }
521 }
522};
523var removeVnodes = function (vnodes, startIdx, endIdx, vnode, elm) {
524 for (; startIdx <= endIdx; ++startIdx) {
525 if ((vnode = vnodes[startIdx])) {
526 elm = vnode.$elm$;
527 {
528 // we're removing this element
529 // so it's possible we need to show slot fallback content now
530 checkSlotFallbackVisibility = true;
531 if (elm['s-ol']) {
532 // remove the original location comment
533 elm['s-ol'].remove();
534 }
535 else {
536 // it's possible that child nodes of the node
537 // that's being removed are slot nodes
538 putBackInOriginalLocation(elm, true);
539 }
540 }
541 // remove the vnode's element from the dom
542 elm.remove();
543 }
544 }
545};
546var updateChildren = function (parentElm, oldCh, newVNode, newCh) {
547 var oldStartIdx = 0;
548 var newStartIdx = 0;
549 var oldEndIdx = oldCh.length - 1;
550 var oldStartVnode = oldCh[0];
551 var oldEndVnode = oldCh[oldEndIdx];
552 var newEndIdx = newCh.length - 1;
553 var newStartVnode = newCh[0];
554 var newEndVnode = newCh[newEndIdx];
555 var node;
556 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
557 if (oldStartVnode == null) {
558 // Vnode might have been moved left
559 oldStartVnode = oldCh[++oldStartIdx];
560 }
561 else if (oldEndVnode == null) {
562 oldEndVnode = oldCh[--oldEndIdx];
563 }
564 else if (newStartVnode == null) {
565 newStartVnode = newCh[++newStartIdx];
566 }
567 else if (newEndVnode == null) {
568 newEndVnode = newCh[--newEndIdx];
569 }
570 else if (isSameVnode(oldStartVnode, newStartVnode)) {
571 patch(oldStartVnode, newStartVnode);
572 oldStartVnode = oldCh[++oldStartIdx];
573 newStartVnode = newCh[++newStartIdx];
574 }
575 else if (isSameVnode(oldEndVnode, newEndVnode)) {
576 patch(oldEndVnode, newEndVnode);
577 oldEndVnode = oldCh[--oldEndIdx];
578 newEndVnode = newCh[--newEndIdx];
579 }
580 else if (isSameVnode(oldStartVnode, newEndVnode)) {
581 // Vnode moved right
582 if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
583 putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
584 }
585 patch(oldStartVnode, newEndVnode);
586 parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
587 oldStartVnode = oldCh[++oldStartIdx];
588 newEndVnode = newCh[--newEndIdx];
589 }
590 else if (isSameVnode(oldEndVnode, newStartVnode)) {
591 // Vnode moved left
592 if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
593 putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
594 }
595 patch(oldEndVnode, newStartVnode);
596 parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
597 oldEndVnode = oldCh[--oldEndIdx];
598 newStartVnode = newCh[++newStartIdx];
599 }
600 else {
601 {
602 // new element
603 node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
604 newStartVnode = newCh[++newStartIdx];
605 }
606 if (node) {
607 {
608 parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
609 }
610 }
611 }
612 }
613 if (oldStartIdx > oldEndIdx) {
614 addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
615 }
616 else if (newStartIdx > newEndIdx) {
617 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
618 }
619};
620var isSameVnode = function (vnode1, vnode2) {
621 // compare if two vnode to see if they're "technically" the same
622 // need to have the same element tag, and same key to be the same
623 if (vnode1.$tag$ === vnode2.$tag$) {
624 if (vnode1.$tag$ === 'slot') {
625 return vnode1.$name$ === vnode2.$name$;
626 }
627 return true;
628 }
629 return false;
630};
631var referenceNode = function (node) {
632 // this node was relocated to a new location in the dom
633 // because of some other component's slot
634 // but we still have an html comment in place of where
635 // it's original location was according to it's original vdom
636 return (node && node['s-ol']) || node;
637};
638var parentReferenceNode = function (node) { return (node['s-ol'] ? node['s-ol'] : node).parentNode; };
639var patch = function (oldVNode, newVNode) {
640 var elm = (newVNode.$elm$ = oldVNode.$elm$);
641 var oldChildren = oldVNode.$children$;
642 var newChildren = newVNode.$children$;
643 var tag = newVNode.$tag$;
644 var text = newVNode.$text$;
645 var defaultHolder;
646 if (text === null) {
647 // element node
648 {
649 if (tag === 'slot')
650 ;
651 else {
652 // either this is the first render of an element OR it's an update
653 // AND we already know it's possible it could have changed
654 // this updates the element's css classes, attrs, props, listeners, etc.
655 updateElement(oldVNode, newVNode, isSvgMode);
656 }
657 }
658 if (oldChildren !== null && newChildren !== null) {
659 // looks like there's child vnodes for both the old and new vnodes
660 updateChildren(elm, oldChildren, newVNode, newChildren);
661 }
662 else if (newChildren !== null) {
663 // no old child vnodes, but there are new child vnodes to add
664 if (oldVNode.$text$ !== null) {
665 // the old vnode was text, so be sure to clear it out
666 elm.textContent = '';
667 }
668 // add the new vnode children
669 addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
670 }
671 else if (oldChildren !== null) {
672 // no new child vnodes, but there are old child vnodes to remove
673 removeVnodes(oldChildren, 0, oldChildren.length - 1);
674 }
675 }
676 else if ((defaultHolder = elm['s-cr'])) {
677 // this element has slotted content
678 defaultHolder.parentNode.textContent = text;
679 }
680 else if (oldVNode.$text$ !== text) {
681 // update the text content for the text only vnode
682 // and also only if the text is different than before
683 elm.data = text;
684 }
685};
686var updateFallbackSlotVisibility = function (elm) {
687 // tslint:disable-next-line: prefer-const
688 var childNodes = elm.childNodes;
689 var childNode;
690 var i;
691 var ilen;
692 var j;
693 var slotNameAttr;
694 var nodeType;
695 for (i = 0, ilen = childNodes.length; i < ilen; i++) {
696 childNode = childNodes[i];
697 if (childNode.nodeType === 1 /* ElementNode */) {
698 if (childNode['s-sr']) {
699 // this is a slot fallback node
700 // get the slot name for this slot reference node
701 slotNameAttr = childNode['s-sn'];
702 // by default always show a fallback slot node
703 // then hide it if there are other slots in the light dom
704 childNode.hidden = false;
705 for (j = 0; j < ilen; j++) {
706 if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
707 // this sibling node is from a different component
708 nodeType = childNodes[j].nodeType;
709 if (slotNameAttr !== '') {
710 // this is a named fallback slot node
711 if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
712 childNode.hidden = true;
713 break;
714 }
715 }
716 else {
717 // this is a default fallback slot node
718 // any element or text node (with content)
719 // should hide the default fallback slot node
720 if (nodeType === 1 /* ElementNode */ || (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
721 childNode.hidden = true;
722 break;
723 }
724 }
725 }
726 }
727 }
728 // keep drilling down
729 updateFallbackSlotVisibility(childNode);
730 }
731 }
732};
733var relocateNodes = [];
734var relocateSlotContent = function (elm) {
735 // tslint:disable-next-line: prefer-const
736 var childNode;
737 var node;
738 var hostContentNodes;
739 var slotNameAttr;
740 var relocateNodeData;
741 var j;
742 var i = 0;
743 var childNodes = elm.childNodes;
744 var ilen = childNodes.length;
745 for (; i < ilen; i++) {
746 childNode = childNodes[i];
747 if (childNode['s-sr'] && (node = childNode['s-cr'])) {
748 // first got the content reference comment node
749 // then we got it's parent, which is where all the host content is in now
750 hostContentNodes = node.parentNode.childNodes;
751 slotNameAttr = childNode['s-sn'];
752 for (j = hostContentNodes.length - 1; j >= 0; j--) {
753 node = hostContentNodes[j];
754 if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
755 // let's do some relocating to its new home
756 // but never relocate a content reference node
757 // that is suppose to always represent the original content location
758 if (isNodeLocatedInSlot(node, slotNameAttr)) {
759 // it's possible we've already decided to relocate this node
760 relocateNodeData = relocateNodes.find(function (r) { return r.$nodeToRelocate$ === node; });
761 // made some changes to slots
762 // let's make sure we also double check
763 // fallbacks are correctly hidden or shown
764 checkSlotFallbackVisibility = true;
765 node['s-sn'] = node['s-sn'] || slotNameAttr;
766 if (relocateNodeData) {
767 // previously we never found a slot home for this node
768 // but turns out we did, so let's remember it now
769 relocateNodeData.$slotRefNode$ = childNode;
770 }
771 else {
772 // add to our list of nodes to relocate
773 relocateNodes.push({
774 $slotRefNode$: childNode,
775 $nodeToRelocate$: node,
776 });
777 }
778 if (node['s-sr']) {
779 relocateNodes.map(function (relocateNode) {
780 if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
781 relocateNodeData = relocateNodes.find(function (r) { return r.$nodeToRelocate$ === node; });
782 if (relocateNodeData && !relocateNode.$slotRefNode$) {
783 relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
784 }
785 }
786 });
787 }
788 }
789 else if (!relocateNodes.some(function (r) { return r.$nodeToRelocate$ === node; })) {
790 // so far this element does not have a slot home, not setting slotRefNode on purpose
791 // if we never find a home for this element then we'll need to hide it
792 relocateNodes.push({
793 $nodeToRelocate$: node,
794 });
795 }
796 }
797 }
798 }
799 if (childNode.nodeType === 1 /* ElementNode */) {
800 relocateSlotContent(childNode);
801 }
802 }
803};
804var isNodeLocatedInSlot = function (nodeToRelocate, slotNameAttr) {
805 if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
806 if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
807 return true;
808 }
809 if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
810 return true;
811 }
812 return false;
813 }
814 if (nodeToRelocate['s-sn'] === slotNameAttr) {
815 return true;
816 }
817 return slotNameAttr === '';
818};
819var renderVdom = function (hostRef, renderFnResults) {
820 var hostElm = hostRef.$hostElement$;
821 var cmpMeta = hostRef.$cmpMeta$;
822 var oldVNode = hostRef.$vnode$ || newVNode(null, null);
823 var rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
824 hostTagName = hostElm.tagName;
825 if (cmpMeta.$attrsToReflect$) {
826 rootVnode.$attrs$ = rootVnode.$attrs$ || {};
827 cmpMeta.$attrsToReflect$.map(function (_a) {
828 var propName = _a[0], attribute = _a[1];
829 return (rootVnode.$attrs$[attribute] = hostElm[propName]);
830 });
831 }
832 rootVnode.$tag$ = null;
833 rootVnode.$flags$ |= 4 /* isHost */;
834 hostRef.$vnode$ = rootVnode;
835 rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
836 {
837 contentRef = hostElm['s-cr'];
838 useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
839 // always reset
840 checkSlotFallbackVisibility = false;
841 }
842 // synchronous patch
843 patch(oldVNode, rootVnode);
844 {
845 // while we're moving nodes around existing nodes, temporarily disable
846 // the disconnectCallback from working
847 plt.$flags$ |= 1 /* isTmpDisconnected */;
848 if (checkSlotRelocate) {
849 relocateSlotContent(rootVnode.$elm$);
850 var relocateData = void 0;
851 var nodeToRelocate = void 0;
852 var orgLocationNode = void 0;
853 var parentNodeRef = void 0;
854 var insertBeforeNode = void 0;
855 var refNode = void 0;
856 var i = 0;
857 for (; i < relocateNodes.length; i++) {
858 relocateData = relocateNodes[i];
859 nodeToRelocate = relocateData.$nodeToRelocate$;
860 if (!nodeToRelocate['s-ol']) {
861 // add a reference node marking this node's original location
862 // keep a reference to this node for later lookups
863 orgLocationNode = doc.createTextNode('');
864 orgLocationNode['s-nr'] = nodeToRelocate;
865 nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
866 }
867 }
868 for (i = 0; i < relocateNodes.length; i++) {
869 relocateData = relocateNodes[i];
870 nodeToRelocate = relocateData.$nodeToRelocate$;
871 if (relocateData.$slotRefNode$) {
872 // by default we're just going to insert it directly
873 // after the slot reference node
874 parentNodeRef = relocateData.$slotRefNode$.parentNode;
875 insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
876 orgLocationNode = nodeToRelocate['s-ol'];
877 while ((orgLocationNode = orgLocationNode.previousSibling)) {
878 refNode = orgLocationNode['s-nr'];
879 if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
880 refNode = refNode.nextSibling;
881 if (!refNode || !refNode['s-nr']) {
882 insertBeforeNode = refNode;
883 break;
884 }
885 }
886 }
887 if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
888 // we've checked that it's worth while to relocate
889 // since that the node to relocate
890 // has a different next sibling or parent relocated
891 if (nodeToRelocate !== insertBeforeNode) {
892 if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
893 // probably a component in the index.html that doesn't have it's hostname set
894 nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
895 }
896 // add it back to the dom but in its new home
897 parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
898 }
899 }
900 }
901 else {
902 // this node doesn't have a slot home to go to, so let's hide it
903 if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
904 nodeToRelocate.hidden = true;
905 }
906 }
907 }
908 }
909 if (checkSlotFallbackVisibility) {
910 updateFallbackSlotVisibility(rootVnode.$elm$);
911 }
912 // done moving nodes around
913 // allow the disconnect callback to work again
914 plt.$flags$ &= ~1 /* isTmpDisconnected */;
915 // always reset
916 relocateNodes.length = 0;
917 }
918};
919var emitEvent = function (elm, name, opts) {
920 var ev = new (CustomEvent)(name, opts);
921 elm.dispatchEvent(ev);
922 return ev;
923};
924var attachToAncestor = function (hostRef, ancestorComponent) {
925 if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
926 ancestorComponent['s-p'].push(new Promise(function (r) { return (hostRef.$onRenderResolve$ = r); }));
927 }
928};
929var scheduleUpdate = function (hostRef, isInitialLoad) {
930 {
931 hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
932 }
933 if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
934 hostRef.$flags$ |= 512 /* needsRerender */;
935 return;
936 }
937 attachToAncestor(hostRef, hostRef.$ancestorComponent$);
938 // there is no ancestorc omponent or the ancestor component
939 // has already fired off its lifecycle update then
940 // fire off the initial update
941 var dispatch = function () { return dispatchHooks(hostRef, isInitialLoad); };
942 return writeTask(dispatch);
943};
944var dispatchHooks = function (hostRef, isInitialLoad) {
945 var endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
946 var instance = hostRef.$lazyInstance$;
947 var promise;
948 endSchedule();
949 return then(promise, function () { return updateComponent(hostRef, instance, isInitialLoad); });
950};
951var updateComponent = function (hostRef, instance, isInitialLoad) {
952 // updateComponent
953 var elm = hostRef.$hostElement$;
954 var endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
955 var rc = elm['s-rc'];
956 if (isInitialLoad) {
957 // DOM WRITE!
958 attachStyles(hostRef);
959 }
960 var endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
961 {
962 {
963 // looks like we've got child nodes to render into this host element
964 // or we need to update the css class/attrs on the host element
965 // DOM WRITE!
966 renderVdom(hostRef, callRender(hostRef, instance));
967 }
968 }
969 if (plt.$cssShim$) {
970 plt.$cssShim$.updateHost(elm);
971 }
972 if (rc) {
973 // ok, so turns out there are some child host elements
974 // waiting on this parent element to load
975 // let's fire off all update callbacks waiting
976 rc.map(function (cb) { return cb(); });
977 elm['s-rc'] = undefined;
978 }
979 endRender();
980 endUpdate();
981 {
982 var childrenPromises = elm['s-p'];
983 var postUpdate = function () { return postUpdateComponent(hostRef); };
984 if (childrenPromises.length === 0) {
985 postUpdate();
986 }
987 else {
988 Promise.all(childrenPromises).then(postUpdate);
989 hostRef.$flags$ |= 4 /* isWaitingForChildren */;
990 childrenPromises.length = 0;
991 }
992 }
993};
994var callRender = function (hostRef, instance) {
995 try {
996 instance = instance.render();
997 {
998 hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
999 }
1000 {
1001 hostRef.$flags$ |= 2 /* hasRendered */;
1002 }
1003 }
1004 catch (e) {
1005 consoleError(e);
1006 }
1007 return instance;
1008};
1009var postUpdateComponent = function (hostRef) {
1010 var tagName = hostRef.$cmpMeta$.$tagName$;
1011 var elm = hostRef.$hostElement$;
1012 var endPostUpdate = createTime('postUpdate', tagName);
1013 var ancestorComponent = hostRef.$ancestorComponent$;
1014 if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1015 hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1016 {
1017 // DOM WRITE!
1018 addHydratedFlag(elm);
1019 }
1020 endPostUpdate();
1021 {
1022 hostRef.$onReadyResolve$(elm);
1023 if (!ancestorComponent) {
1024 appDidLoad();
1025 }
1026 }
1027 }
1028 else {
1029 endPostUpdate();
1030 }
1031 // load events fire from bottom to top
1032 // the deepest elements load first then bubbles up
1033 {
1034 if (hostRef.$onRenderResolve$) {
1035 hostRef.$onRenderResolve$();
1036 hostRef.$onRenderResolve$ = undefined;
1037 }
1038 if (hostRef.$flags$ & 512 /* needsRerender */) {
1039 nextTick(function () { return scheduleUpdate(hostRef, false); });
1040 }
1041 hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1042 }
1043 // ( •_•)
1044 // ( •_•)>⌐■-■
1045 // (⌐■_■)
1046};
1047var forceUpdate = function (ref) {
1048 {
1049 var hostRef = getHostRef(ref);
1050 var isConnected = hostRef.$hostElement$.isConnected;
1051 if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1052 scheduleUpdate(hostRef, false);
1053 }
1054 // Returns "true" when the forced update was successfully scheduled
1055 return isConnected;
1056 }
1057};
1058var appDidLoad = function (who) {
1059 // on appload
1060 // we have finish the first big initial render
1061 {
1062 addHydratedFlag(doc.documentElement);
1063 }
1064 {
1065 plt.$flags$ |= 2 /* appLoaded */;
1066 }
1067 nextTick(function () { return emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }); });
1068};
1069var then = function (promise, thenFn) {
1070 return promise && promise.then ? promise.then(thenFn) : thenFn();
1071};
1072var addHydratedFlag = function (elm) { return (elm.classList.add('hydrated')); };
1073var initializeClientHydrate = function (hostElm, tagName, hostId, hostRef) {
1074 var endHydrate = createTime('hydrateClient', tagName);
1075 var shadowRoot = hostElm.shadowRoot;
1076 var childRenderNodes = [];
1077 var slotNodes = [];
1078 var shadowRootNodes = null;
1079 var vnode = (hostRef.$vnode$ = newVNode(tagName, null));
1080 if (!plt.$orgLocNodes$) {
1081 initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1082 }
1083 hostElm[HYDRATE_ID] = hostId;
1084 hostElm.removeAttribute(HYDRATE_ID);
1085 clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1086 childRenderNodes.map(function (c) {
1087 var orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1088 var orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1089 var node = c.$elm$;
1090 if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
1091 orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1092 }
1093 if (!shadowRoot) {
1094 node['s-hn'] = tagName;
1095 if (orgLocationNode) {
1096 node['s-ol'] = orgLocationNode;
1097 node['s-ol']['s-nr'] = node;
1098 }
1099 }
1100 plt.$orgLocNodes$.delete(orgLocationId);
1101 });
1102 endHydrate();
1103};
1104var clientHydrate = function (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) {
1105 var childNodeType;
1106 var childIdSplt;
1107 var childVNode;
1108 var i;
1109 if (node.nodeType === 1 /* ElementNode */) {
1110 childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1111 if (childNodeType) {
1112 // got the node data from the element's attribute
1113 // `${hostId}.${nodeId}.${depth}.${index}`
1114 childIdSplt = childNodeType.split('.');
1115 if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
1116 childVNode = {
1117 $flags$: 0,
1118 $hostId$: childIdSplt[0],
1119 $nodeId$: childIdSplt[1],
1120 $depth$: childIdSplt[2],
1121 $index$: childIdSplt[3],
1122 $tag$: node.tagName.toLowerCase(),
1123 $elm$: node,
1124 $attrs$: null,
1125 $children$: null,
1126 $key$: null,
1127 $name$: null,
1128 $text$: null,
1129 };
1130 childRenderNodes.push(childVNode);
1131 node.removeAttribute(HYDRATE_CHILD_ID);
1132 // this is a new child vnode
1133 // so ensure its parent vnode has the vchildren array
1134 if (!parentVNode.$children$) {
1135 parentVNode.$children$ = [];
1136 }
1137 // add our child vnode to a specific index of the vnode's children
1138 parentVNode.$children$[childVNode.$index$] = childVNode;
1139 // this is now the new parent vnode for all the next child checks
1140 parentVNode = childVNode;
1141 if (shadowRootNodes && childVNode.$depth$ === '0') {
1142 shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1143 }
1144 }
1145 }
1146 // recursively drill down, end to start so we can remove nodes
1147 for (i = node.childNodes.length - 1; i >= 0; i--) {
1148 clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
1149 }
1150 if (node.shadowRoot) {
1151 // keep drilling down through the shadow root nodes
1152 for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
1153 clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
1154 }
1155 }
1156 }
1157 else if (node.nodeType === 8 /* CommentNode */) {
1158 // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
1159 childIdSplt = node.nodeValue.split('.');
1160 if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
1161 // comment node for either the host id or a 0 host id
1162 childNodeType = childIdSplt[0];
1163 childVNode = {
1164 $flags$: 0,
1165 $hostId$: childIdSplt[1],
1166 $nodeId$: childIdSplt[2],
1167 $depth$: childIdSplt[3],
1168 $index$: childIdSplt[4],
1169 $elm$: node,
1170 $attrs$: null,
1171 $children$: null,
1172 $key$: null,
1173 $name$: null,
1174 $tag$: null,
1175 $text$: null,
1176 };
1177 if (childNodeType === TEXT_NODE_ID) {
1178 childVNode.$elm$ = node.nextSibling;
1179 if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1180 childVNode.$text$ = childVNode.$elm$.textContent;
1181 childRenderNodes.push(childVNode);
1182 // remove the text comment since it's no longer needed
1183 node.remove();
1184 if (!parentVNode.$children$) {
1185 parentVNode.$children$ = [];
1186 }
1187 parentVNode.$children$[childVNode.$index$] = childVNode;
1188 if (shadowRootNodes && childVNode.$depth$ === '0') {
1189 shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1190 }
1191 }
1192 }
1193 else if (childVNode.$hostId$ === hostId) {
1194 // this comment node is specifcally for this host id
1195 if (childNodeType === SLOT_NODE_ID) {
1196 // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
1197 childVNode.$tag$ = 'slot';
1198 if (childIdSplt[5]) {
1199 node['s-sn'] = childVNode.$name$ = childIdSplt[5];
1200 }
1201 else {
1202 node['s-sn'] = '';
1203 }
1204 node['s-sr'] = true;
1205 slotNodes.push(childVNode);
1206 if (!parentVNode.$children$) {
1207 parentVNode.$children$ = [];
1208 }
1209 parentVNode.$children$[childVNode.$index$] = childVNode;
1210 }
1211 else if (childNodeType === CONTENT_REF_ID) {
1212 // `${CONTENT_REF_ID}.${hostId}`;
1213 {
1214 hostElm['s-cr'] = node;
1215 node['s-cn'] = true;
1216 }
1217 }
1218 }
1219 }
1220 }
1221 else if (parentVNode && parentVNode.$tag$ === 'style') {
1222 var vnode = newVNode(null, node.textContent);
1223 vnode.$elm$ = node;
1224 vnode.$index$ = '0';
1225 parentVNode.$children$ = [vnode];
1226 }
1227};
1228var initializeDocumentHydrate = function (node, orgLocNodes) {
1229 if (node.nodeType === 1 /* ElementNode */) {
1230 var i = 0;
1231 for (; i < node.childNodes.length; i++) {
1232 initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
1233 }
1234 if (node.shadowRoot) {
1235 for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
1236 initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
1237 }
1238 }
1239 }
1240 else if (node.nodeType === 8 /* CommentNode */) {
1241 var childIdSplt = node.nodeValue.split('.');
1242 if (childIdSplt[0] === ORG_LOCATION_ID) {
1243 orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
1244 node.nodeValue = '';
1245 // useful to know if the original location is
1246 // the root light-dom of a shadow dom component
1247 node['s-en'] = childIdSplt[3];
1248 }
1249 }
1250};
1251var parsePropertyValue = function (propValue, propType) {
1252 // ensure this value is of the correct prop type
1253 if (propValue != null && !isComplexType(propValue)) {
1254 if (propType & 4 /* Boolean */) {
1255 // per the HTML spec, any string value means it is a boolean true value
1256 // but we'll cheat here and say that the string "false" is the boolean false
1257 return propValue === 'false' ? false : propValue === '' || !!propValue;
1258 }
1259 if (propType & 2 /* Number */) {
1260 // force it to be a number
1261 return parseFloat(propValue);
1262 }
1263 if (propType & 1 /* String */) {
1264 // could have been passed as a number or boolean
1265 // but we still want it as a string
1266 return String(propValue);
1267 }
1268 // redundant return here for better minification
1269 return propValue;
1270 }
1271 // not sure exactly what type we want
1272 // so no need to change to a different type
1273 return propValue;
1274};
1275var getValue = function (ref, propName) { return getHostRef(ref).$instanceValues$.get(propName); };
1276var setValue = function (ref, propName, newVal, cmpMeta) {
1277 // check our new property value against our internal value
1278 var hostRef = getHostRef(ref);
1279 var oldVal = hostRef.$instanceValues$.get(propName);
1280 var flags = hostRef.$flags$;
1281 var instance = hostRef.$lazyInstance$;
1282 newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1283 if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1284 // gadzooks! the property's value has changed!!
1285 // set our new value!
1286 hostRef.$instanceValues$.set(propName, newVal);
1287 if (instance) {
1288 if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1289 // looks like this value actually changed, so we've got work to do!
1290 // but only if we've already rendered, otherwise just chill out
1291 // queue that we need to do an update, but don't worry about queuing
1292 // up millions cuz this function ensures it only runs once
1293 scheduleUpdate(hostRef, false);
1294 }
1295 }
1296 }
1297};
1298var proxyComponent = function (Cstr, cmpMeta, flags) {
1299 if (cmpMeta.$members$) {
1300 // It's better to have a const than two Object.entries()
1301 var members = Object.entries(cmpMeta.$members$);
1302 var prototype_1 = Cstr.prototype;
1303 members.map(function (_a) {
1304 var memberName = _a[0], memberFlags = _a[1][0];
1305 if ((memberFlags & 31 /* Prop */ || ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1306 // proxyComponent - prop
1307 Object.defineProperty(prototype_1, memberName, {
1308 get: function () {
1309 // proxyComponent, get value
1310 return getValue(this, memberName);
1311 },
1312 set: function (newValue) {
1313 // proxyComponent, set value
1314 setValue(this, memberName, newValue, cmpMeta);
1315 },
1316 configurable: true,
1317 enumerable: true,
1318 });
1319 }
1320 });
1321 if ((flags & 1 /* isElementConstructor */)) {
1322 var attrNameToPropName_1 = new Map();
1323 prototype_1.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1324 var _this = this;
1325 plt.jmp(function () {
1326 var propName = attrNameToPropName_1.get(attrName);
1327 _this[propName] = newValue === null && typeof _this[propName] === 'boolean' ? false : newValue;
1328 });
1329 };
1330 // create an array of attributes to observe
1331 // and also create a map of html attribute name to js property name
1332 Cstr.observedAttributes = members
1333 .filter(function (_a) {
1334 var _ = _a[0], m = _a[1];
1335 return m[0] & 15;
1336 } /* HasAttribute */) // filter to only keep props that should match attributes
1337 .map(function (_a) {
1338 var propName = _a[0], m = _a[1];
1339 var attrName = m[1] || propName;
1340 attrNameToPropName_1.set(attrName, propName);
1341 if (m[0] & 512 /* ReflectAttr */) {
1342 cmpMeta.$attrsToReflect$.push([propName, attrName]);
1343 }
1344 return attrName;
1345 });
1346 }
1347 }
1348 return Cstr;
1349};
1350var initializeComponent = function (elm, hostRef, cmpMeta, hmrVersionId, Cstr) { return __awaiter(void 0, void 0, void 0, function () {
1351 var endLoad, endNewInstance, scopeId, endRegisterStyles, style, ancestorComponent, schedule;
1352 return __generator(this, function (_a) {
1353 switch (_a.label) {
1354 case 0:
1355 if (!((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0)) return [3 /*break*/, 3];
1356 // we haven't initialized this element yet
1357 hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1358 // lazy loaded components
1359 // request the component's implementation to be
1360 // wired up with the host element
1361 Cstr = loadModule(cmpMeta);
1362 if (!Cstr.then) return [3 /*break*/, 2];
1363 endLoad = uniqueTime();
1364 return [4 /*yield*/, Cstr];
1365 case 1:
1366 Cstr = _a.sent();
1367 endLoad();
1368 _a.label = 2;
1369 case 2:
1370 if (!Cstr.isProxied) {
1371 proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1372 Cstr.isProxied = true;
1373 }
1374 endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1375 // ok, time to construct the instance
1376 // but let's keep track of when we start and stop
1377 // so that the getters/setters don't incorrectly step on data
1378 {
1379 hostRef.$flags$ |= 8 /* isConstructingInstance */;
1380 }
1381 // construct the lazy-loaded component implementation
1382 // passing the hostRef is very important during
1383 // construction in order to directly wire together the
1384 // host element and the lazy-loaded instance
1385 try {
1386 new Cstr(hostRef);
1387 }
1388 catch (e) {
1389 consoleError(e);
1390 }
1391 {
1392 hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1393 }
1394 endNewInstance();
1395 scopeId = getScopeId(cmpMeta);
1396 if (!styles.has(scopeId) && Cstr.style) {
1397 endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1398 style = Cstr.style;
1399 registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1400 endRegisterStyles();
1401 }
1402 _a.label = 3;
1403 case 3:
1404 ancestorComponent = hostRef.$ancestorComponent$;
1405 schedule = function () { return scheduleUpdate(hostRef, true); };
1406 if (ancestorComponent && ancestorComponent['s-rc']) {
1407 // this is the intial load and this component it has an ancestor component
1408 // but the ancestor component has NOT fired its will update lifecycle yet
1409 // so let's just cool our jets and wait for the ancestor to continue first
1410 // this will get fired off when the ancestor component
1411 // finally gets around to rendering its lazy self
1412 // fire off the initial update
1413 ancestorComponent['s-rc'].push(schedule);
1414 }
1415 else {
1416 schedule();
1417 }
1418 return [2 /*return*/];
1419 }
1420 });
1421}); };
1422var connectedCallback = function (elm) {
1423 if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1424 var hostRef_1 = getHostRef(elm);
1425 var cmpMeta_1 = hostRef_1.$cmpMeta$;
1426 var endConnected = createTime('connectedCallback', cmpMeta_1.$tagName$);
1427 if (!(hostRef_1.$flags$ & 1 /* hasConnected */)) {
1428 // first time this component has connected
1429 hostRef_1.$flags$ |= 1 /* hasConnected */;
1430 var hostId = void 0;
1431 {
1432 hostId = elm.getAttribute(HYDRATE_ID);
1433 if (hostId) {
1434 initializeClientHydrate(elm, cmpMeta_1.$tagName$, hostId, hostRef_1);
1435 }
1436 }
1437 if (!hostId) {
1438 // initUpdate
1439 // if the slot polyfill is required we'll need to put some nodes
1440 // in here to act as original content anchors as we move nodes around
1441 // host element has been connected to the DOM
1442 if ((cmpMeta_1.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1443 setContentReference(elm);
1444 }
1445 }
1446 {
1447 // find the first ancestor component (if there is one) and register
1448 // this component as one of the actively loading child components for its ancestor
1449 var ancestorComponent = elm;
1450 while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1451 // climb up the ancestors looking for the first
1452 // component that hasn't finished its lifecycle update yet
1453 if ((ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute('s-id') && ancestorComponent['s-p']) ||
1454 ancestorComponent['s-p']) {
1455 // we found this components first ancestor component
1456 // keep a reference to this component's ancestor component
1457 attachToAncestor(hostRef_1, (hostRef_1.$ancestorComponent$ = ancestorComponent));
1458 break;
1459 }
1460 }
1461 }
1462 // Lazy properties
1463 // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1464 if (cmpMeta_1.$members$) {
1465 Object.entries(cmpMeta_1.$members$).map(function (_a) {
1466 var memberName = _a[0], memberFlags = _a[1][0];
1467 if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1468 var value = elm[memberName];
1469 delete elm[memberName];
1470 elm[memberName] = value;
1471 }
1472 });
1473 }
1474 {
1475 // connectedCallback, taskQueue, initialLoad
1476 // angular sets attribute AFTER connectCallback
1477 // https://github.com/angular/angular/issues/18909
1478 // https://github.com/angular/angular/issues/19940
1479 nextTick(function () { return initializeComponent(elm, hostRef_1, cmpMeta_1); });
1480 }
1481 }
1482 endConnected();
1483 }
1484};
1485var setContentReference = function (elm) {
1486 // only required when we're NOT using native shadow dom (slot)
1487 // or this browser doesn't support native shadow dom
1488 // and this host element was NOT created with SSR
1489 // let's pick out the inner content for slot projection
1490 // create a node to represent where the original
1491 // content was first placed, which is useful later on
1492 var contentRefElm = (elm['s-cr'] = doc.createComment(''));
1493 contentRefElm['s-cn'] = true;
1494 elm.insertBefore(contentRefElm, elm.firstChild);
1495};
1496var disconnectedCallback = function (elm) {
1497 if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1498 var hostRef = getHostRef(elm);
1499 // clear CSS var-shim tracking
1500 if (plt.$cssShim$) {
1501 plt.$cssShim$.removeHost(elm);
1502 }
1503 }
1504};
1505var bootstrapLazy = function (lazyBundles, options) {
1506 if (options === void 0) { options = {}; }
1507 var endBootstrap = createTime();
1508 var cmpTags = [];
1509 var exclude = options.exclude || [];
1510 var customElements = win.customElements;
1511 var head = doc.head;
1512 var metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1513 var visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1514 var deferredConnectedCallbacks = [];
1515 var appLoadFallback;
1516 var isBootstrapping = true;
1517 Object.assign(plt, options);
1518 plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1519 {
1520 if (options.syncQueue) {
1521 plt.$flags$ |= 4 /* queueSync */;
1522 }
1523 }
1524 {
1525 // If the app is already hydrated there is not point to disable the
1526 // async queue. This will improve the first input delay
1527 plt.$flags$ |= 2 /* appLoaded */;
1528 }
1529 lazyBundles.map(function (lazyBundle) { return lazyBundle[1].map(function (compactMeta) {
1530 var cmpMeta = {
1531 $flags$: compactMeta[0],
1532 $tagName$: compactMeta[1],
1533 $members$: compactMeta[2],
1534 $listeners$: compactMeta[3],
1535 };
1536 {
1537 cmpMeta.$members$ = compactMeta[2];
1538 }
1539 {
1540 cmpMeta.$attrsToReflect$ = [];
1541 }
1542 var tagName = cmpMeta.$tagName$;
1543 var HostElement = /** @class */ (function (_super) {
1544 __extends(HostElement, _super);
1545 // StencilLazyHost
1546 function HostElement(self) {
1547 var _this =
1548 // @ts-ignore
1549 _super.call(this, self) || this;
1550 self = _this;
1551 registerHost(self, cmpMeta);
1552 return _this;
1553 }
1554 HostElement.prototype.connectedCallback = function () {
1555 var _this = this;
1556 if (appLoadFallback) {
1557 clearTimeout(appLoadFallback);
1558 appLoadFallback = null;
1559 }
1560 if (isBootstrapping) {
1561 // connectedCallback will be processed once all components have been registered
1562 deferredConnectedCallbacks.push(this);
1563 }
1564 else {
1565 plt.jmp(function () { return connectedCallback(_this); });
1566 }
1567 };
1568 HostElement.prototype.disconnectedCallback = function () {
1569 var _this = this;
1570 plt.jmp(function () { return disconnectedCallback(_this); });
1571 };
1572 HostElement.prototype.forceUpdate = function () {
1573 forceUpdate(this);
1574 };
1575 HostElement.prototype.componentOnReady = function () {
1576 return getHostRef(this).$onReadyPromise$;
1577 };
1578 return HostElement;
1579 }(HTMLElement));
1580 cmpMeta.$lazyBundleIds$ = lazyBundle[0];
1581 if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1582 cmpTags.push(tagName);
1583 customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1584 }
1585 }); });
1586 {
1587 visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1588 visibilityStyle.setAttribute('data-styles', '');
1589 head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1590 }
1591 // Process deferred connectedCallbacks now all components have been registered
1592 isBootstrapping = false;
1593 if (deferredConnectedCallbacks.length) {
1594 deferredConnectedCallbacks.map(function (host) { return host.connectedCallback(); });
1595 }
1596 else {
1597 {
1598 plt.jmp(function () { return (appLoadFallback = setTimeout(appDidLoad, 30)); });
1599 }
1600 }
1601 // Fallback appLoad event
1602 endBootstrap();
1603};
1604var hostRefs = new WeakMap();
1605var getHostRef = function (ref) { return hostRefs.get(ref); };
1606var registerInstance = function (lazyInstance, hostRef) { return hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); };
1607var registerHost = function (elm, cmpMeta) {
1608 var hostRef = {
1609 $flags$: 0,
1610 $hostElement$: elm,
1611 $cmpMeta$: cmpMeta,
1612 $instanceValues$: new Map(),
1613 };
1614 {
1615 hostRef.$onReadyPromise$ = new Promise(function (r) { return (hostRef.$onReadyResolve$ = r); });
1616 elm['s-p'] = [];
1617 elm['s-rc'] = [];
1618 }
1619 return hostRefs.set(elm, hostRef);
1620};
1621var isMemberInElement = function (elm, memberName) { return memberName in elm; };
1622var consoleError = function (e) { return console.error(e); };
1623var cmpModules = /*@__PURE__*/ new Map();
1624var loadModule = function (cmpMeta, hostRef, hmrVersionId) {
1625 // loadModuleImport
1626 var exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1627 var bundleId = (cmpMeta.$lazyBundleIds$);
1628 var module = cmpModules.get(bundleId);
1629 if (module) {
1630 return module[exportName];
1631 }
1632 return import(
1633 /* webpackInclude: /\.entry\.js$/ */
1634 /* webpackExclude: /\.system\.entry\.js$/ */
1635 /* webpackMode: "lazy" */
1636 "./" + bundleId + ".entry.js" + '').then(function (importedModule) {
1637 {
1638 cmpModules.set(bundleId, importedModule);
1639 }
1640 return importedModule[exportName];
1641 }, consoleError);
1642};
1643var styles = new Map();
1644var queueDomReads = [];
1645var queueDomWrites = [];
1646var queueDomWritesLow = [];
1647var queueTask = function (queue, write) { return function (cb) {
1648 queue.push(cb);
1649 if (!queuePending) {
1650 queuePending = true;
1651 if (write && plt.$flags$ & 4 /* queueSync */) {
1652 nextTick(flush);
1653 }
1654 else {
1655 plt.raf(flush);
1656 }
1657 }
1658}; };
1659var consume = function (queue) {
1660 for (var i = 0; i < queue.length; i++) {
1661 try {
1662 queue[i](performance.now());
1663 }
1664 catch (e) {
1665 consoleError(e);
1666 }
1667 }
1668 queue.length = 0;
1669};
1670var consumeTimeout = function (queue, timeout) {
1671 var i = 0;
1672 var ts = 0;
1673 while (i < queue.length && (ts = performance.now()) < timeout) {
1674 try {
1675 queue[i++](ts);
1676 }
1677 catch (e) {
1678 consoleError(e);
1679 }
1680 }
1681 if (i === queue.length) {
1682 queue.length = 0;
1683 }
1684 else if (i !== 0) {
1685 queue.splice(0, i);
1686 }
1687};
1688var flush = function () {
1689 {
1690 queueCongestion++;
1691 }
1692 // always force a bunch of medium callbacks to run, but still have
1693 // a throttle on how many can run in a certain time
1694 // DOM READS!!!
1695 consume(queueDomReads);
1696 // DOM WRITES!!!
1697 {
1698 var timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity;
1699 consumeTimeout(queueDomWrites, timeout);
1700 consumeTimeout(queueDomWritesLow, timeout);
1701 if (queueDomWrites.length > 0) {
1702 queueDomWritesLow.push.apply(queueDomWritesLow, queueDomWrites);
1703 queueDomWrites.length = 0;
1704 }
1705 if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
1706 // still more to do yet, but we've run out of time
1707 // let's let this thing cool off and try again in the next tick
1708 plt.raf(flush);
1709 }
1710 else {
1711 queueCongestion = 0;
1712 }
1713 }
1714};
1715var nextTick = /*@__PURE__*/ function (cb) { return promiseResolve().then(cb); };
1716var writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1717var patchEsm = function () {
1718 // @ts-ignore
1719 if (!(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
1720 // @ts-ignore
1721 return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-8a9bfe22.js').then(function () {
1722 if ((plt.$cssShim$ = win.__cssshim)) {
1723 return plt.$cssShim$.i();
1724 }
1725 else {
1726 // for better minification
1727 return 0;
1728 }
1729 });
1730 }
1731 return promiseResolve();
1732};
1733var patchBrowser = function () {
1734 {
1735 // shim css vars
1736 plt.$cssShim$ = win.__cssshim;
1737 }
1738 // @ts-ignore
1739 var scriptElm = Array.from(doc.querySelectorAll('script')).find(function (s) { return new RegExp("/" + NAMESPACE + "(\\.esm)?\\.js($|\\?|#)").test(s.src) || s.getAttribute('data-stencil-namespace') === NAMESPACE; });
1740 var opts = scriptElm['data-opts'] || {};
1741 if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
1742 // Safari < v11 support: This IF is true if it's Safari below v11.
1743 // This fn cannot use async/await since Safari didn't support it until v11,
1744 // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
1745 // so both the ESM file and nomodule file would get downloaded. Only Safari
1746 // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
1747 // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
1748 // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
1749 return {
1750 then: function () {
1751 /* promise noop */
1752 },
1753 };
1754 }
1755 {
1756 opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
1757 {
1758 patchDynamicImport(opts.resourcesUrl, scriptElm);
1759 }
1760 if (!win.customElements) {
1761 // module support, but no custom elements support (Old Edge)
1762 // @ts-ignore
1763 return import(/* webpackChunkName: "polyfills-dom" */ './dom-24a54a40.js').then(function () { return opts; });
1764 }
1765 }
1766 return promiseResolve(opts);
1767};
1768var patchDynamicImport = function (base, orgScriptElm) {
1769 var importFunctionName = getDynamicImportFunction(NAMESPACE);
1770 try {
1771 // test if this browser supports dynamic imports
1772 // There is a caching issue in V8, that breaks using import() in Function
1773 // By generating a random string, we can workaround it
1774 // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
1775 win[importFunctionName] = new Function('w', "return import(w);//" + Math.random());
1776 }
1777 catch (e) {
1778 // this shim is specifically for browsers that do support "esm" imports
1779 // however, they do NOT support "dynamic" imports
1780 // basically this code is for old Edge, v18 and below
1781 var moduleMap_1 = new Map();
1782 win[importFunctionName] = function (src) {
1783 var url = new URL(src, base).href;
1784 var mod = moduleMap_1.get(url);
1785 if (!mod) {
1786 var script_1 = doc.createElement('script');
1787 script_1.type = 'module';
1788 script_1.crossOrigin = orgScriptElm.crossOrigin;
1789 script_1.src = URL.createObjectURL(new Blob(["import * as m from '" + url + "'; window." + importFunctionName + ".m = m;"], { type: 'application/javascript' }));
1790 mod = new Promise(function (resolve) {
1791 script_1.onload = function () {
1792 resolve(win[importFunctionName].m);
1793 script_1.remove();
1794 };
1795 });
1796 moduleMap_1.set(url, mod);
1797 doc.head.appendChild(script_1);
1798 }
1799 return mod;
1800 };
1801 }
1802};
1803export { Host as H, patchEsm as a, bootstrapLazy as b, h, patchBrowser as p, registerInstance as r };