@geotrekce/geotrek-rando-widget 0.0.10 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/css-shim-6f592941.js +6 -0
- package/dist/cjs/dom-d5e52c7e.js +75 -0
- package/dist/cjs/geotrek-rando-widget.cjs.js +73 -6
- package/dist/cjs/grw-app.cjs.entry.js +14 -12
- package/dist/cjs/grw-filter_6.cjs.entry.js +17 -13
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +11 -6
- package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
- package/dist/cjs/{index-4c76daa3.js → index-66d58516.js} +90 -7
- package/dist/cjs/loader.cjs.js +16 -2
- package/dist/cjs/shadow-css-cf936b02.js +389 -0
- package/dist/cjs/{store-b4c3c507.js → store-d301af22.js} +13 -5
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/grw-app/grw-app.js +12 -10
- package/dist/collection/components/grw-map/grw-map.js +4 -3
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +6 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +1 -1
- package/dist/collection/store/grw-trek-provider.js +6 -3
- package/dist/collection/store/store.js +1 -0
- package/dist/components/grw-app.js +12 -10
- package/dist/components/grw-filter2.js +1 -1
- package/dist/components/grw-information-desk-detail2.js +1 -1
- package/dist/components/grw-map2.js +5 -4
- package/dist/components/grw-poi-detail2.js +1 -1
- package/dist/components/grw-sensitive-area-detail2.js +7 -2
- package/dist/components/grw-trek-card2.js +1 -1
- package/dist/components/grw-trek-detail2.js +2 -2
- package/dist/components/grw-trek-provider2.js +6 -3
- package/dist/components/grw-treks-list2.js +1 -1
- package/dist/components/index.d.ts +11 -5
- package/dist/components/index.js +11 -0
- package/dist/components/store.js +12 -4
- package/dist/esm/css-shim-2d0a698c.js +4 -0
- package/dist/esm/dom-9794f747.js +73 -0
- package/dist/esm/geotrek-rando-widget.js +73 -6
- package/dist/esm/grw-app.entry.js +14 -12
- package/dist/esm/grw-filter_6.entry.js +17 -13
- package/dist/esm/grw-information-desk-detail_3.entry.js +11 -6
- package/dist/esm/grw-trek-card.entry.js +3 -3
- package/dist/esm/{index-ee473772.js → index-899307bb.js} +86 -8
- package/dist/esm/loader.js +16 -2
- package/dist/esm/shadow-css-4cd4480f.js +387 -0
- package/dist/esm/{store-a5f523fd.js → store-70461a28.js} +13 -5
- package/dist/esm-es5/css-shim-2d0a698c.js +1 -0
- package/dist/esm-es5/dom-9794f747.js +21 -0
- package/dist/esm-es5/geotrek-rando-widget.js +1 -0
- package/dist/esm-es5/grw-app.entry.js +1 -0
- package/dist/esm-es5/grw-filter_6.entry.js +6 -0
- package/dist/esm-es5/grw-information-desk-detail_3.entry.js +1 -0
- package/dist/esm-es5/grw-trek-card.entry.js +1 -0
- package/dist/esm-es5/index-899307bb.js +2 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/length-d82189db.js +1 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/shadow-css-4cd4480f.js +12 -0
- package/dist/esm-es5/store-70461a28.js +1 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/geotrek-rando-widget.js +133 -0
- package/dist/geotrek-rando-widget/p-067c02c4.system.js +1 -0
- package/dist/geotrek-rando-widget/p-0c5b047c.js +1 -0
- package/dist/geotrek-rando-widget/p-18038011.js +1 -0
- package/dist/geotrek-rando-widget/p-2712caa8.system.entry.js +6 -0
- package/dist/geotrek-rando-widget/p-2bd0278f.system.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-32d97a4f.system.js +1 -0
- package/dist/geotrek-rando-widget/p-3ed52659.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-4690907e.js +2 -0
- package/dist/geotrek-rando-widget/p-48d5dde7.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-4eaf20b7.js +12 -0
- package/dist/geotrek-rando-widget/p-50ea2036.system.js +1 -0
- package/dist/geotrek-rando-widget/p-533fc2bb.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-82ca029f.system.js +1 -0
- package/dist/geotrek-rando-widget/p-8f9914f4.system.js +2 -0
- package/dist/geotrek-rando-widget/p-a99db140.system.js +1 -0
- package/dist/geotrek-rando-widget/p-b1530d9c.system.js +13 -0
- package/dist/geotrek-rando-widget/p-c8c96517.system.js +21 -0
- package/dist/geotrek-rando-widget/p-d1582cff.js +19 -0
- package/dist/geotrek-rando-widget/p-e1431f36.system.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-e38f4ff4.system.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-f5d98aae.entry.js +1 -0
- package/dist/index.js +1 -1
- package/dist/types/components/grw-app/grw-app.d.ts +1 -0
- package/dist/types/store/grw-trek-provider.d.ts +0 -1
- package/dist/types/store/store.d.ts +3 -1
- package/dist/types/types/types.d.ts +6 -5
- package/loader/index.js +1 -1
- package/package.json +12 -12
- package/dist/geotrek-rando-widget/p-0510e16b.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-22562f4d.js +0 -1
- package/dist/geotrek-rando-widget/p-34fbbb97.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-500436f1.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-b62909db.js +0 -2
|
@@ -6,6 +6,7 @@ let isSvgMode = false;
|
|
|
6
6
|
let renderingRef = null;
|
|
7
7
|
let queuePending = false;
|
|
8
8
|
const win = typeof window !== 'undefined' ? window : {};
|
|
9
|
+
const CSS = win.CSS ;
|
|
9
10
|
const doc = win.document || { head: {} };
|
|
10
11
|
const plt = {
|
|
11
12
|
$flags$: 0,
|
|
@@ -16,11 +17,13 @@ const plt = {
|
|
|
16
17
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
17
18
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
18
19
|
};
|
|
20
|
+
const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
21
|
+
;
|
|
19
22
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
20
|
-
const
|
|
23
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
21
24
|
try {
|
|
22
25
|
new CSSStyleSheet();
|
|
23
|
-
return typeof new CSSStyleSheet().
|
|
26
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
24
27
|
}
|
|
25
28
|
catch (e) { }
|
|
26
29
|
return false;
|
|
@@ -78,9 +81,14 @@ const uniqueTime = (key, measureText) => {
|
|
|
78
81
|
const rootAppliedStyles = new WeakMap();
|
|
79
82
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
80
83
|
let style = styles.get(scopeId);
|
|
81
|
-
if (
|
|
84
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
82
85
|
style = (style || new CSSStyleSheet());
|
|
83
|
-
style
|
|
86
|
+
if (typeof style === 'string') {
|
|
87
|
+
style = cssText;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
style.replaceSync(cssText);
|
|
91
|
+
}
|
|
84
92
|
}
|
|
85
93
|
else {
|
|
86
94
|
style = cssText;
|
|
@@ -103,7 +111,18 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
103
111
|
}
|
|
104
112
|
if (!appliedStyles.has(scopeId)) {
|
|
105
113
|
{
|
|
106
|
-
{
|
|
114
|
+
if (plt.$cssShim$) {
|
|
115
|
+
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
116
|
+
const newScopeId = styleElm['s-sc'];
|
|
117
|
+
if (newScopeId) {
|
|
118
|
+
scopeId = newScopeId;
|
|
119
|
+
// we don't want to add this styleID to the appliedStyles Set
|
|
120
|
+
// since the cssVarShim might need to apply several different
|
|
121
|
+
// stylesheets for the same component
|
|
122
|
+
appliedStyles = null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
107
126
|
styleElm = doc.createElement('style');
|
|
108
127
|
styleElm.innerHTML = style;
|
|
109
128
|
}
|
|
@@ -125,7 +144,7 @@ const attachStyles = (hostRef) => {
|
|
|
125
144
|
const elm = hostRef.$hostElement$;
|
|
126
145
|
const flags = cmpMeta.$flags$;
|
|
127
146
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
128
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
147
|
+
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
|
|
129
148
|
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
130
149
|
// only required when we're NOT using native shadow dom (slot)
|
|
131
150
|
// or this browser doesn't support native shadow dom
|
|
@@ -659,6 +678,9 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
659
678
|
hostRef.$queuedListeners$ = null;
|
|
660
679
|
}
|
|
661
680
|
}
|
|
681
|
+
{
|
|
682
|
+
promise = safeCall(instance, 'componentWillLoad');
|
|
683
|
+
}
|
|
662
684
|
}
|
|
663
685
|
endSchedule();
|
|
664
686
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -676,6 +698,9 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
676
698
|
{
|
|
677
699
|
callRender(hostRef, instance);
|
|
678
700
|
}
|
|
701
|
+
if (plt.$cssShim$) {
|
|
702
|
+
plt.$cssShim$.updateHost(elm);
|
|
703
|
+
}
|
|
679
704
|
if (rc) {
|
|
680
705
|
// ok, so turns out there are some child host elements
|
|
681
706
|
// waiting on this parent element to load
|
|
@@ -1044,6 +1069,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1044
1069
|
const scopeId = getScopeId(cmpMeta);
|
|
1045
1070
|
if (!styles.has(scopeId)) {
|
|
1046
1071
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1072
|
+
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1073
|
+
style = await import('./shadow-css-4cd4480f.js').then((m) => m.scopeCss(style, scopeId, false));
|
|
1074
|
+
}
|
|
1047
1075
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1048
1076
|
endRegisterStyles();
|
|
1049
1077
|
}
|
|
@@ -1129,11 +1157,52 @@ const disconnectedCallback = (elm) => {
|
|
|
1129
1157
|
hostRef.$rmListeners$ = undefined;
|
|
1130
1158
|
}
|
|
1131
1159
|
}
|
|
1160
|
+
// clear CSS var-shim tracking
|
|
1161
|
+
if (plt.$cssShim$) {
|
|
1162
|
+
plt.$cssShim$.removeHost(elm);
|
|
1163
|
+
}
|
|
1132
1164
|
{
|
|
1133
1165
|
safeCall(instance, 'disconnectedCallback');
|
|
1134
1166
|
}
|
|
1135
1167
|
}
|
|
1136
1168
|
};
|
|
1169
|
+
const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
1170
|
+
class FakeNodeList extends Array {
|
|
1171
|
+
item(n) {
|
|
1172
|
+
return this[n];
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1176
|
+
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
1177
|
+
Object.defineProperty(elm, 'children', {
|
|
1178
|
+
get() {
|
|
1179
|
+
return this.childNodes.map((n) => n.nodeType === 1);
|
|
1180
|
+
},
|
|
1181
|
+
});
|
|
1182
|
+
Object.defineProperty(elm, 'childElementCount', {
|
|
1183
|
+
get() {
|
|
1184
|
+
return elm.children.length;
|
|
1185
|
+
},
|
|
1186
|
+
});
|
|
1187
|
+
Object.defineProperty(elm, 'childNodes', {
|
|
1188
|
+
get() {
|
|
1189
|
+
const childNodes = childNodesFn.call(this);
|
|
1190
|
+
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
1191
|
+
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
1192
|
+
const result = new FakeNodeList();
|
|
1193
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
1194
|
+
const slot = childNodes[i]['s-nr'];
|
|
1195
|
+
if (slot) {
|
|
1196
|
+
result.push(slot);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
return result;
|
|
1200
|
+
}
|
|
1201
|
+
return FakeNodeList.from(childNodes);
|
|
1202
|
+
},
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1137
1206
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1138
1207
|
const endBootstrap = createTime();
|
|
1139
1208
|
const cmpTags = [];
|
|
@@ -1164,6 +1233,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1164
1233
|
{
|
|
1165
1234
|
cmpMeta.$watchers$ = {};
|
|
1166
1235
|
}
|
|
1236
|
+
if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1237
|
+
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
1238
|
+
}
|
|
1167
1239
|
const tagName = cmpMeta.$tagName$;
|
|
1168
1240
|
const HostElement = class extends HTMLElement {
|
|
1169
1241
|
// StencilLazyHost
|
|
@@ -1177,11 +1249,17 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1177
1249
|
// and this browser supports shadow dom
|
|
1178
1250
|
// add the read-only property "shadowRoot" to the host element
|
|
1179
1251
|
// adding the shadow root build conditionals to minimize runtime
|
|
1180
|
-
{
|
|
1252
|
+
if (supportsShadow) {
|
|
1181
1253
|
{
|
|
1182
1254
|
self.attachShadow({ mode: 'open' });
|
|
1183
1255
|
}
|
|
1184
1256
|
}
|
|
1257
|
+
else if (!('shadowRoot' in self)) {
|
|
1258
|
+
self.shadowRoot = self;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
{
|
|
1262
|
+
patchChildSlotNodes(self, cmpMeta);
|
|
1185
1263
|
}
|
|
1186
1264
|
}
|
|
1187
1265
|
connectedCallback() {
|
|
@@ -1315,4 +1393,4 @@ const flush = () => {
|
|
|
1315
1393
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1316
1394
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1317
1395
|
|
|
1318
|
-
export { Host as H,
|
|
1396
|
+
export { CSS as C, Host as H, NAMESPACE as N, promiseResolve as a, bootstrapLazy as b, getRenderingRef as c, doc as d, createEvent as e, forceUpdate as f, getElement as g, h, plt as p, registerInstance as r, win as w };
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { C as CSS, p as plt, w as win, a as promiseResolve, b as bootstrapLazy } from './index-899307bb.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
|
-
Stencil Client Patch Esm v2.
|
|
4
|
+
Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
5
5
|
*/
|
|
6
6
|
const patchEsm = () => {
|
|
7
|
+
// NOTE!! This fn cannot use async/await!
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
if (!(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-2d0a698c.js').then(() => {
|
|
12
|
+
if ((plt.$cssShim$ = win.__cssshim)) {
|
|
13
|
+
return plt.$cssShim$.i();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
// for better minification
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
7
21
|
return promiseResolve();
|
|
8
22
|
};
|
|
9
23
|
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Stencil Client Platform v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10
|
+
*
|
|
11
|
+
* This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
12
|
+
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
13
|
+
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
14
|
+
*/
|
|
15
|
+
const safeSelector = (selector) => {
|
|
16
|
+
const placeholders = [];
|
|
17
|
+
let index = 0;
|
|
18
|
+
// Replaces attribute selectors with placeholders.
|
|
19
|
+
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
|
|
20
|
+
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
21
|
+
const replaceBy = `__ph-${index}__`;
|
|
22
|
+
placeholders.push(keep);
|
|
23
|
+
index++;
|
|
24
|
+
return replaceBy;
|
|
25
|
+
});
|
|
26
|
+
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
27
|
+
// WS and "+" would otherwise be interpreted as selector separators.
|
|
28
|
+
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
29
|
+
const replaceBy = `__ph-${index}__`;
|
|
30
|
+
placeholders.push(exp);
|
|
31
|
+
index++;
|
|
32
|
+
return pseudo + replaceBy;
|
|
33
|
+
});
|
|
34
|
+
const ss = {
|
|
35
|
+
content,
|
|
36
|
+
placeholders,
|
|
37
|
+
};
|
|
38
|
+
return ss;
|
|
39
|
+
};
|
|
40
|
+
const restoreSafeSelector = (placeholders, content) => {
|
|
41
|
+
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
42
|
+
};
|
|
43
|
+
const _polyfillHost = '-shadowcsshost';
|
|
44
|
+
const _polyfillSlotted = '-shadowcssslotted';
|
|
45
|
+
// note: :host-context pre-processed to -shadowcsshostcontext.
|
|
46
|
+
const _polyfillHostContext = '-shadowcsscontext';
|
|
47
|
+
const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
|
|
48
|
+
const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
|
|
49
|
+
const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
|
|
50
|
+
const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
|
|
51
|
+
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
52
|
+
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
53
|
+
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
54
|
+
const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
|
|
55
|
+
const _polyfillHostRe = /-shadowcsshost/gim;
|
|
56
|
+
const _colonHostRe = /:host/gim;
|
|
57
|
+
const _colonSlottedRe = /::slotted/gim;
|
|
58
|
+
const _colonHostContextRe = /:host-context/gim;
|
|
59
|
+
const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
60
|
+
const stripComments = (input) => {
|
|
61
|
+
return input.replace(_commentRe, '');
|
|
62
|
+
};
|
|
63
|
+
const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
64
|
+
const extractCommentsWithHash = (input) => {
|
|
65
|
+
return input.match(_commentWithHashRe) || [];
|
|
66
|
+
};
|
|
67
|
+
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
68
|
+
const _curlyRe = /([{}])/g;
|
|
69
|
+
const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
70
|
+
const OPEN_CURLY = '{';
|
|
71
|
+
const CLOSE_CURLY = '}';
|
|
72
|
+
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
73
|
+
const processRules = (input, ruleCallback) => {
|
|
74
|
+
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
75
|
+
let nextBlockIndex = 0;
|
|
76
|
+
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
77
|
+
const selector = m[2];
|
|
78
|
+
let content = '';
|
|
79
|
+
let suffix = m[4];
|
|
80
|
+
let contentPrefix = '';
|
|
81
|
+
if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
|
|
82
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
83
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
84
|
+
contentPrefix = '{';
|
|
85
|
+
}
|
|
86
|
+
const cssRule = {
|
|
87
|
+
selector,
|
|
88
|
+
content,
|
|
89
|
+
};
|
|
90
|
+
const rule = ruleCallback(cssRule);
|
|
91
|
+
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const escapeBlocks = (input) => {
|
|
95
|
+
const inputParts = input.split(_curlyRe);
|
|
96
|
+
const resultParts = [];
|
|
97
|
+
const escapedBlocks = [];
|
|
98
|
+
let bracketCount = 0;
|
|
99
|
+
let currentBlockParts = [];
|
|
100
|
+
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
101
|
+
const part = inputParts[partIndex];
|
|
102
|
+
if (part === CLOSE_CURLY) {
|
|
103
|
+
bracketCount--;
|
|
104
|
+
}
|
|
105
|
+
if (bracketCount > 0) {
|
|
106
|
+
currentBlockParts.push(part);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (currentBlockParts.length > 0) {
|
|
110
|
+
escapedBlocks.push(currentBlockParts.join(''));
|
|
111
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
112
|
+
currentBlockParts = [];
|
|
113
|
+
}
|
|
114
|
+
resultParts.push(part);
|
|
115
|
+
}
|
|
116
|
+
if (part === OPEN_CURLY) {
|
|
117
|
+
bracketCount++;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (currentBlockParts.length > 0) {
|
|
121
|
+
escapedBlocks.push(currentBlockParts.join(''));
|
|
122
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
123
|
+
}
|
|
124
|
+
const strEscapedBlocks = {
|
|
125
|
+
escapedString: resultParts.join(''),
|
|
126
|
+
blocks: escapedBlocks,
|
|
127
|
+
};
|
|
128
|
+
return strEscapedBlocks;
|
|
129
|
+
};
|
|
130
|
+
const insertPolyfillHostInCssText = (selector) => {
|
|
131
|
+
selector = selector
|
|
132
|
+
.replace(_colonHostContextRe, _polyfillHostContext)
|
|
133
|
+
.replace(_colonHostRe, _polyfillHost)
|
|
134
|
+
.replace(_colonSlottedRe, _polyfillSlotted);
|
|
135
|
+
return selector;
|
|
136
|
+
};
|
|
137
|
+
const convertColonRule = (cssText, regExp, partReplacer) => {
|
|
138
|
+
// m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
|
|
139
|
+
return cssText.replace(regExp, (...m) => {
|
|
140
|
+
if (m[2]) {
|
|
141
|
+
const parts = m[2].split(',');
|
|
142
|
+
const r = [];
|
|
143
|
+
for (let i = 0; i < parts.length; i++) {
|
|
144
|
+
const p = parts[i].trim();
|
|
145
|
+
if (!p)
|
|
146
|
+
break;
|
|
147
|
+
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
148
|
+
}
|
|
149
|
+
return r.join(',');
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return _polyfillHostNoCombinator + m[3];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const colonHostPartReplacer = (host, part, suffix) => {
|
|
157
|
+
return host + part.replace(_polyfillHost, '') + suffix;
|
|
158
|
+
};
|
|
159
|
+
const convertColonHost = (cssText) => {
|
|
160
|
+
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
161
|
+
};
|
|
162
|
+
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
163
|
+
if (part.indexOf(_polyfillHost) > -1) {
|
|
164
|
+
return colonHostPartReplacer(host, part, suffix);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return host + part + suffix + ', ' + part + ' ' + host + suffix;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
171
|
+
const slotClass = '.' + slotScopeId + ' > ';
|
|
172
|
+
const selectors = [];
|
|
173
|
+
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
174
|
+
if (m[2]) {
|
|
175
|
+
const compound = m[2].trim();
|
|
176
|
+
const suffix = m[3];
|
|
177
|
+
const slottedSelector = slotClass + compound + suffix;
|
|
178
|
+
let prefixSelector = '';
|
|
179
|
+
for (let i = m[4] - 1; i >= 0; i--) {
|
|
180
|
+
const char = m[5][i];
|
|
181
|
+
if (char === '}' || char === ',') {
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
prefixSelector = char + prefixSelector;
|
|
185
|
+
}
|
|
186
|
+
const orgSelector = prefixSelector + slottedSelector;
|
|
187
|
+
const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
|
|
188
|
+
if (orgSelector.trim() !== addedSelector.trim()) {
|
|
189
|
+
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
190
|
+
selectors.push({
|
|
191
|
+
orgSelector,
|
|
192
|
+
updatedSelector,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return slottedSelector;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return _polyfillHostNoCombinator + m[3];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
return {
|
|
202
|
+
selectors,
|
|
203
|
+
cssText,
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const convertColonHostContext = (cssText) => {
|
|
207
|
+
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
208
|
+
};
|
|
209
|
+
const convertShadowDOMSelectors = (cssText) => {
|
|
210
|
+
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
|
|
211
|
+
};
|
|
212
|
+
const makeScopeMatcher = (scopeSelector) => {
|
|
213
|
+
const lre = /\[/g;
|
|
214
|
+
const rre = /\]/g;
|
|
215
|
+
scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
|
|
216
|
+
return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
|
|
217
|
+
};
|
|
218
|
+
const selectorNeedsScoping = (selector, scopeSelector) => {
|
|
219
|
+
const re = makeScopeMatcher(scopeSelector);
|
|
220
|
+
return !re.test(selector);
|
|
221
|
+
};
|
|
222
|
+
const injectScopingSelector = (selector, scopingSelector) => {
|
|
223
|
+
return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
|
|
224
|
+
return before + scopingSelector + colon + after;
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
228
|
+
// In Android browser, the lastIndex is not reset when the regex is used in String.replace()
|
|
229
|
+
_polyfillHostRe.lastIndex = 0;
|
|
230
|
+
if (_polyfillHostRe.test(selector)) {
|
|
231
|
+
const replaceBy = `.${hostSelector}`;
|
|
232
|
+
return selector
|
|
233
|
+
.replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
|
|
234
|
+
.replace(_polyfillHostRe, replaceBy + ' ');
|
|
235
|
+
}
|
|
236
|
+
return scopeSelector + ' ' + selector;
|
|
237
|
+
};
|
|
238
|
+
const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
239
|
+
const isRe = /\[is=([^\]]*)\]/g;
|
|
240
|
+
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
241
|
+
const className = '.' + scopeSelector;
|
|
242
|
+
const _scopeSelectorPart = (p) => {
|
|
243
|
+
let scopedP = p.trim();
|
|
244
|
+
if (!scopedP) {
|
|
245
|
+
return '';
|
|
246
|
+
}
|
|
247
|
+
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
248
|
+
scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// remove :host since it should be unnecessary
|
|
252
|
+
const t = p.replace(_polyfillHostRe, '');
|
|
253
|
+
if (t.length > 0) {
|
|
254
|
+
scopedP = injectScopingSelector(t, className);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return scopedP;
|
|
258
|
+
};
|
|
259
|
+
const safeContent = safeSelector(selector);
|
|
260
|
+
selector = safeContent.content;
|
|
261
|
+
let scopedSelector = '';
|
|
262
|
+
let startIndex = 0;
|
|
263
|
+
let res;
|
|
264
|
+
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
265
|
+
// If a selector appears before :host it should not be shimmed as it
|
|
266
|
+
// matches on ancestor elements and not on elements in the host's shadow
|
|
267
|
+
// `:host-context(div)` is transformed to
|
|
268
|
+
// `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
|
|
269
|
+
// the `div` is not part of the component in the 2nd selectors and should not be scoped.
|
|
270
|
+
// Historically `component-tag:host` was matching the component so we also want to preserve
|
|
271
|
+
// this behavior to avoid breaking legacy apps (it should not match).
|
|
272
|
+
// The behavior should be:
|
|
273
|
+
// - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
|
|
274
|
+
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
|
|
275
|
+
// `:host-context(tag)`)
|
|
276
|
+
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
277
|
+
// Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
|
|
278
|
+
let shouldScope = !hasHost;
|
|
279
|
+
while ((res = sep.exec(selector)) !== null) {
|
|
280
|
+
const separator = res[1];
|
|
281
|
+
const part = selector.slice(startIndex, res.index).trim();
|
|
282
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
283
|
+
const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
|
|
284
|
+
scopedSelector += `${scopedPart} ${separator} `;
|
|
285
|
+
startIndex = sep.lastIndex;
|
|
286
|
+
}
|
|
287
|
+
const part = selector.substring(startIndex);
|
|
288
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
289
|
+
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
290
|
+
// replace the placeholders with their original values
|
|
291
|
+
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
292
|
+
};
|
|
293
|
+
const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
294
|
+
return selector
|
|
295
|
+
.split(',')
|
|
296
|
+
.map((shallowPart) => {
|
|
297
|
+
if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
|
|
298
|
+
return shallowPart.trim();
|
|
299
|
+
}
|
|
300
|
+
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
301
|
+
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
return shallowPart.trim();
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
.join(', ');
|
|
308
|
+
};
|
|
309
|
+
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
310
|
+
return processRules(cssText, (rule) => {
|
|
311
|
+
let selector = rule.selector;
|
|
312
|
+
let content = rule.content;
|
|
313
|
+
if (rule.selector[0] !== '@') {
|
|
314
|
+
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
315
|
+
}
|
|
316
|
+
else if (rule.selector.startsWith('@media') ||
|
|
317
|
+
rule.selector.startsWith('@supports') ||
|
|
318
|
+
rule.selector.startsWith('@page') ||
|
|
319
|
+
rule.selector.startsWith('@document')) {
|
|
320
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
|
|
321
|
+
}
|
|
322
|
+
const cssRule = {
|
|
323
|
+
selector: selector.replace(/\s{2,}/g, ' ').trim(),
|
|
324
|
+
content,
|
|
325
|
+
};
|
|
326
|
+
return cssRule;
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
330
|
+
cssText = insertPolyfillHostInCssText(cssText);
|
|
331
|
+
cssText = convertColonHost(cssText);
|
|
332
|
+
cssText = convertColonHostContext(cssText);
|
|
333
|
+
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
334
|
+
cssText = slotted.cssText;
|
|
335
|
+
cssText = convertShadowDOMSelectors(cssText);
|
|
336
|
+
if (scopeId) {
|
|
337
|
+
cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
|
|
338
|
+
}
|
|
339
|
+
cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
340
|
+
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
|
|
341
|
+
return {
|
|
342
|
+
cssText: cssText.trim(),
|
|
343
|
+
slottedSelectors: slotted.selectors,
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
347
|
+
const hostScopeId = scopeId + '-h';
|
|
348
|
+
const slotScopeId = scopeId + '-s';
|
|
349
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
350
|
+
cssText = stripComments(cssText);
|
|
351
|
+
const orgSelectors = [];
|
|
352
|
+
if (commentOriginalSelector) {
|
|
353
|
+
const processCommentedSelector = (rule) => {
|
|
354
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
355
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
356
|
+
orgSelectors.push({ placeholder, comment });
|
|
357
|
+
rule.selector = placeholder + rule.selector;
|
|
358
|
+
return rule;
|
|
359
|
+
};
|
|
360
|
+
cssText = processRules(cssText, (rule) => {
|
|
361
|
+
if (rule.selector[0] !== '@') {
|
|
362
|
+
return processCommentedSelector(rule);
|
|
363
|
+
}
|
|
364
|
+
else if (rule.selector.startsWith('@media') ||
|
|
365
|
+
rule.selector.startsWith('@supports') ||
|
|
366
|
+
rule.selector.startsWith('@page') ||
|
|
367
|
+
rule.selector.startsWith('@document')) {
|
|
368
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
369
|
+
return rule;
|
|
370
|
+
}
|
|
371
|
+
return rule;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
|
|
375
|
+
cssText = [scoped.cssText, ...commentsWithHash].join('\n');
|
|
376
|
+
if (commentOriginalSelector) {
|
|
377
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
378
|
+
cssText = cssText.replace(placeholder, comment);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
382
|
+
cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
|
|
383
|
+
});
|
|
384
|
+
return cssText;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export { scopeCss };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as getRenderingRef, f as forceUpdate } from './index-899307bb.js';
|
|
2
2
|
|
|
3
3
|
const appendToMap = (map, propName, value) => {
|
|
4
4
|
const items = map.get(propName);
|
|
@@ -66,8 +66,10 @@ const stencilSubscription = () => {
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
69
70
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
70
|
-
|
|
71
|
+
const unwrappedState = unwrap(defaultState);
|
|
72
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
71
73
|
const handlers = {
|
|
72
74
|
dispose: [],
|
|
73
75
|
get: [],
|
|
@@ -75,7 +77,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
75
77
|
reset: [],
|
|
76
78
|
};
|
|
77
79
|
const reset = () => {
|
|
78
|
-
|
|
80
|
+
var _a;
|
|
81
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
82
|
+
// otherwise, the state won't be properly reset
|
|
83
|
+
states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
79
84
|
handlers.reset.forEach((cb) => cb());
|
|
80
85
|
};
|
|
81
86
|
const dispose = () => {
|
|
@@ -97,7 +102,7 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
97
102
|
};
|
|
98
103
|
const state = (typeof Proxy === 'undefined'
|
|
99
104
|
? {}
|
|
100
|
-
: new Proxy(
|
|
105
|
+
: new Proxy(unwrappedState, {
|
|
101
106
|
get(_, propName) {
|
|
102
107
|
return get(propName);
|
|
103
108
|
},
|
|
@@ -130,7 +135,9 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
130
135
|
cb(newValue);
|
|
131
136
|
}
|
|
132
137
|
});
|
|
133
|
-
|
|
138
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
139
|
+
// Otherwise we might not be sending the right reset value.
|
|
140
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
134
141
|
return () => {
|
|
135
142
|
unSet();
|
|
136
143
|
unReset();
|
|
@@ -200,6 +207,7 @@ const { state, onChange } = createStore({
|
|
|
200
207
|
sources: null,
|
|
201
208
|
accessibilities: null,
|
|
202
209
|
accessibilitiesLevel: null,
|
|
210
|
+
poiTypes: null,
|
|
203
211
|
currentTrek: null,
|
|
204
212
|
currentPois: null,
|
|
205
213
|
currentInformationDesks: null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
|