@swisspost/internet-header 1.16.0 → 1.16.1
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/focus-trap.cjs.entry.js +32 -50
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{post-internet-header-72edf928.js → post-internet-header-5c0dbfd2.js} +2 -3
- package/dist/cjs/swisspost-internet-header.cjs.entry.js +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js +2 -8
- package/dist/collection/components/post-internet-header/post-internet-header.js +14 -60
- package/dist/components/focus-trap2.js +32 -50
- package/dist/components/swisspost-internet-header.js +2 -3
- package/dist/docs.json +18 -118
- package/dist/esm/focus-trap.entry.js +32 -50
- package/dist/esm/index.js +1 -1
- package/dist/esm/{post-internet-header-25cbaecc.js → post-internet-header-6768743b.js} +2 -3
- package/dist/esm/swisspost-internet-header.entry.js +1 -1
- package/dist/esm-es5/focus-trap.entry.js +3 -3
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{post-internet-header-25cbaecc.js → post-internet-header-6768743b.js} +1 -1
- package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
- package/dist/swisspost-internet-header/index.esm.js +1 -1
- package/dist/swisspost-internet-header/{p-c45a080c.system.entry.js → p-4d5bddc5.system.entry.js} +3 -3
- package/dist/swisspost-internet-header/p-695fe962.system.js +1 -1
- package/dist/swisspost-internet-header/{p-2ca95ddf.system.js → p-7ceca008.system.js} +1 -1
- package/dist/swisspost-internet-header/p-944e8412.entry.js +11 -0
- package/dist/swisspost-internet-header/{p-572ff7a8.js → p-ccc07e33.js} +1 -1
- package/dist/swisspost-internet-header/{p-df70d07e.system.entry.js → p-f6e9c9eb.system.entry.js} +1 -1
- package/dist/swisspost-internet-header/{p-935c52e3.entry.js → p-fa6b0e3c.entry.js} +1 -1
- package/dist/swisspost-internet-header/{p-5a806d1a.system.js → p-fc7b59e2.system.js} +1 -1
- package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
- package/dist/types/components/post-internet-breadcrumbs/post-internet-breadcrumbs.d.ts +0 -2
- package/dist/types/components/post-internet-header/post-internet-header.d.ts +0 -15
- package/dist/types/components.d.ts +0 -33
- package/package.json +2 -2
- package/dist/swisspost-internet-header/p-085d38af.entry.js +0 -11
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-bb0e68fd.js';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* tabbable 6.
|
|
4
|
+
* tabbable 6.2.0
|
|
5
5
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
8
8
|
// `:not([inert], [inert] *)` (Feb 2023)
|
|
9
|
-
|
|
9
|
+
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
|
|
10
|
+
// the entire query to fail, resulting in no nodes found, which will break a lot
|
|
11
|
+
// of things... so we have to rely on JS to identify nodes inside an inert container
|
|
12
|
+
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
|
|
10
13
|
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
11
14
|
var NoElement = typeof Element === 'undefined';
|
|
12
15
|
var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
@@ -19,13 +22,13 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
|
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Determines if a node is inert or in an inert ancestor.
|
|
22
|
-
* @param {
|
|
25
|
+
* @param {Element} [node]
|
|
23
26
|
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
|
|
24
27
|
* see if any of them are inert. If false, only `node` itself is considered.
|
|
25
28
|
* @returns {boolean} True if inert itself or by way of being in an inert ancestor.
|
|
26
29
|
* False if `node` is falsy.
|
|
27
30
|
*/
|
|
28
|
-
var
|
|
31
|
+
var isInert = function isInert(node, lookUp) {
|
|
29
32
|
var _node$getAttribute;
|
|
30
33
|
if (lookUp === void 0) {
|
|
31
34
|
lookUp = true;
|
|
@@ -39,10 +42,10 @@ var _isInert = function isInert(node, lookUp) {
|
|
|
39
42
|
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
|
|
40
43
|
// if it weren't for `matches()` not being a function on shadow roots; the following
|
|
41
44
|
// code works for any kind of node
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
|
|
46
|
+
// so it likely would not support `:is([inert] *)` either...
|
|
47
|
+
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
|
|
48
|
+
|
|
46
49
|
return result;
|
|
47
50
|
};
|
|
48
51
|
|
|
@@ -68,8 +71,8 @@ var isContentEditable = function isContentEditable(node) {
|
|
|
68
71
|
*/
|
|
69
72
|
var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
70
73
|
// even if `includeContainer=false`, we still have to check it for inertness because
|
|
71
|
-
// if it's inert
|
|
72
|
-
if (
|
|
74
|
+
// if it's inert, all its children are inert
|
|
75
|
+
if (isInert(el)) {
|
|
73
76
|
return [];
|
|
74
77
|
}
|
|
75
78
|
var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
|
@@ -114,12 +117,12 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
|
114
117
|
* @param {IterativeOptions} options
|
|
115
118
|
* @returns {Array.<Element|CandidateScope>}
|
|
116
119
|
*/
|
|
117
|
-
var
|
|
120
|
+
var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
|
|
118
121
|
var candidates = [];
|
|
119
122
|
var elementsToCheck = Array.from(elements);
|
|
120
123
|
while (elementsToCheck.length) {
|
|
121
124
|
var element = elementsToCheck.shift();
|
|
122
|
-
if (
|
|
125
|
+
if (isInert(element, false)) {
|
|
123
126
|
// no need to look up since we're drilling down
|
|
124
127
|
// anything inside this container will also be inert
|
|
125
128
|
continue;
|
|
@@ -128,7 +131,7 @@ var _getCandidatesIteratively = function getCandidatesIteratively(elements, incl
|
|
|
128
131
|
// add shadow dom slot scope (slot itself cannot be focusable)
|
|
129
132
|
var assigned = element.assignedElements();
|
|
130
133
|
var content = assigned.length ? assigned : element.children;
|
|
131
|
-
var nestedCandidates =
|
|
134
|
+
var nestedCandidates = getCandidatesIteratively(content, true, options);
|
|
132
135
|
if (options.flatten) {
|
|
133
136
|
candidates.push.apply(candidates, nestedCandidates);
|
|
134
137
|
} else {
|
|
@@ -152,7 +155,7 @@ var _getCandidatesIteratively = function getCandidatesIteratively(elements, incl
|
|
|
152
155
|
// no inert look up because we're already drilling down and checking for inertness
|
|
153
156
|
// on the way down, so all containers to this root node should have already been
|
|
154
157
|
// vetted as non-inert
|
|
155
|
-
var validShadowRoot = !
|
|
158
|
+
var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
156
159
|
if (shadowRoot && validShadowRoot) {
|
|
157
160
|
// add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
|
|
158
161
|
// shadow exists, so look at light dom children as fallback BUT create a scope for any
|
|
@@ -160,7 +163,7 @@ var _getCandidatesIteratively = function getCandidatesIteratively(elements, incl
|
|
|
160
163
|
// children of the web component element (which has the shadow), in the light dom, but
|
|
161
164
|
// slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
|
|
162
165
|
// _after_ we return from this recursive call
|
|
163
|
-
var _nestedCandidates =
|
|
166
|
+
var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
|
|
164
167
|
if (options.flatten) {
|
|
165
168
|
candidates.push.apply(candidates, _nestedCandidates);
|
|
166
169
|
} else {
|
|
@@ -337,28 +340,6 @@ var isZeroArea = function isZeroArea(node) {
|
|
|
337
340
|
var isHidden = function isHidden(node, _ref) {
|
|
338
341
|
var displayCheck = _ref.displayCheck,
|
|
339
342
|
getShadowRoot = _ref.getShadowRoot;
|
|
340
|
-
if (displayCheck === 'full-native') {
|
|
341
|
-
if ('checkVisibility' in node) {
|
|
342
|
-
// Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4
|
|
343
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility
|
|
344
|
-
var visible = node.checkVisibility({
|
|
345
|
-
// Checking opacity might be desirable for some use cases, but natively,
|
|
346
|
-
// opacity zero elements _are_ focusable and tabbable.
|
|
347
|
-
checkOpacity: false,
|
|
348
|
-
opacityProperty: false,
|
|
349
|
-
contentVisibilityAuto: true,
|
|
350
|
-
visibilityProperty: true,
|
|
351
|
-
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
352
|
-
// support both. However, this alias has wider browser support (Chrome
|
|
353
|
-
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
354
|
-
// we include it anyway.
|
|
355
|
-
checkVisibilityCSS: true
|
|
356
|
-
});
|
|
357
|
-
return !visible;
|
|
358
|
-
}
|
|
359
|
-
// Fall through to manual visibility checks
|
|
360
|
-
}
|
|
361
|
-
|
|
362
343
|
// NOTE: visibility will be `undefined` if node is detached from the document
|
|
363
344
|
// (see notes about this further down), which means we will consider it visible
|
|
364
345
|
// (this is legacy behavior from a very long way back)
|
|
@@ -372,10 +353,7 @@ var isHidden = function isHidden(node, _ref) {
|
|
|
372
353
|
if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
|
|
373
354
|
return true;
|
|
374
355
|
}
|
|
375
|
-
if (!displayCheck || displayCheck === 'full' ||
|
|
376
|
-
// full-native can run this branch when it falls through in case
|
|
377
|
-
// Element#checkVisibility is unsupported
|
|
378
|
-
displayCheck === 'full-native' || displayCheck === 'legacy-full') {
|
|
356
|
+
if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
|
|
379
357
|
if (typeof getShadowRoot === 'function') {
|
|
380
358
|
// figure out if we should consider the node to be in an undisclosed shadow and use the
|
|
381
359
|
// 'non-zero-area' fallback
|
|
@@ -484,7 +462,11 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
|
|
|
484
462
|
return false;
|
|
485
463
|
};
|
|
486
464
|
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
|
|
487
|
-
if (node.disabled ||
|
|
465
|
+
if (node.disabled ||
|
|
466
|
+
// we must do an inert look up to filter out any elements inside an inert ancestor
|
|
467
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
468
|
+
// note related to `candidateSelectors`)
|
|
469
|
+
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
|
|
488
470
|
// For a details element with a summary, the summary element gets the focus
|
|
489
471
|
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
490
472
|
return false;
|
|
@@ -497,7 +479,7 @@ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(opt
|
|
|
497
479
|
}
|
|
498
480
|
return true;
|
|
499
481
|
};
|
|
500
|
-
var
|
|
482
|
+
var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
|
|
501
483
|
var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
|
|
502
484
|
if (isNaN(tabIndex) || tabIndex >= 0) {
|
|
503
485
|
return true;
|
|
@@ -511,14 +493,14 @@ var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
|
|
|
511
493
|
* @param {Array.<Element|CandidateScope>} candidates
|
|
512
494
|
* @returns Element[]
|
|
513
495
|
*/
|
|
514
|
-
var
|
|
496
|
+
var sortByOrder = function sortByOrder(candidates) {
|
|
515
497
|
var regularTabbables = [];
|
|
516
498
|
var orderedTabbables = [];
|
|
517
499
|
candidates.forEach(function (item, i) {
|
|
518
500
|
var isScope = !!item.scopeParent;
|
|
519
501
|
var element = isScope ? item.scopeParent : item;
|
|
520
502
|
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
521
|
-
var elements = isScope ?
|
|
503
|
+
var elements = isScope ? sortByOrder(item.candidates) : element;
|
|
522
504
|
if (candidateTabindex === 0) {
|
|
523
505
|
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
524
506
|
} else {
|
|
@@ -540,22 +522,22 @@ var tabbable = function tabbable(container, options) {
|
|
|
540
522
|
options = options || {};
|
|
541
523
|
var candidates;
|
|
542
524
|
if (options.getShadowRoot) {
|
|
543
|
-
candidates =
|
|
525
|
+
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
544
526
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
545
527
|
flatten: false,
|
|
546
528
|
getShadowRoot: options.getShadowRoot,
|
|
547
|
-
shadowRootFilter:
|
|
529
|
+
shadowRootFilter: isValidShadowRootTabbable
|
|
548
530
|
});
|
|
549
531
|
} else {
|
|
550
532
|
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
551
533
|
}
|
|
552
|
-
return
|
|
534
|
+
return sortByOrder(candidates);
|
|
553
535
|
};
|
|
554
536
|
var focusable = function focusable(container, options) {
|
|
555
537
|
options = options || {};
|
|
556
538
|
var candidates;
|
|
557
539
|
if (options.getShadowRoot) {
|
|
558
|
-
candidates =
|
|
540
|
+
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
559
541
|
filter: isNodeMatchingSelectorFocusable.bind(null, options),
|
|
560
542
|
flatten: true,
|
|
561
543
|
getShadowRoot: options.getShadowRoot
|
|
@@ -575,7 +557,7 @@ var isTabbable = function isTabbable(node, options) {
|
|
|
575
557
|
}
|
|
576
558
|
return isNodeMatchingSelectorTabbable(options, node);
|
|
577
559
|
};
|
|
578
|
-
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe
|
|
560
|
+
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
|
|
579
561
|
var isFocusable = function isFocusable(node, options) {
|
|
580
562
|
options = options || {};
|
|
581
563
|
if (!node) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as PostInternetHeader } from './post-internet-header-
|
|
1
|
+
export { P as PostInternetHeader } from './post-internet-header-6768743b.js';
|
|
2
2
|
export { P as PostInternetBreadcrumbs } from './post-internet-breadcrumbs-ee507bec.js';
|
|
3
3
|
export { P as PostInternetFooter } from './post-internet-footer-cae59692.js';
|
|
4
4
|
export { P as PostSkiplinks } from './post-skiplinks-0779348d.js';
|
|
@@ -371,7 +371,7 @@ const setMainNavigationIds = (navMainEntities) => {
|
|
|
371
371
|
};
|
|
372
372
|
|
|
373
373
|
const name = "@swisspost/internet-header";
|
|
374
|
-
const version = "1.16.
|
|
374
|
+
const version = "1.16.1";
|
|
375
375
|
const description = "The header for client facing applications.";
|
|
376
376
|
const author = "Swiss Post <design-system@post.ch>";
|
|
377
377
|
const license = "Apache-2.0";
|
|
@@ -412,7 +412,7 @@ const scripts = {
|
|
|
412
412
|
generate: "stencil generate"
|
|
413
413
|
};
|
|
414
414
|
const dependencies = {
|
|
415
|
-
"@swisspost/design-system-styles": "workspace:9.
|
|
415
|
+
"@swisspost/design-system-styles": "workspace:9.8.0",
|
|
416
416
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
417
417
|
"iframe-resizer": "4.4.5",
|
|
418
418
|
jquery: "3.7.1",
|
|
@@ -582,7 +582,6 @@ const PostInternetHeader = class {
|
|
|
582
582
|
/**
|
|
583
583
|
* Get the currently set language as a two letter string ("de", "fr" "it" or "en")
|
|
584
584
|
* @returns string
|
|
585
|
-
* @deprecated use `document.documentElement.lang` instead
|
|
586
585
|
*/
|
|
587
586
|
async getCurrentLanguage() {
|
|
588
587
|
var _a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as swisspost_internet_header } from './post-internet-header-
|
|
1
|
+
export { P as swisspost_internet_header } from './post-internet-header-6768743b.js';
|
|
2
2
|
import './index-bb0e68fd.js';
|
|
3
3
|
import './index-d3f1363d.js';
|
|
4
4
|
import './language.service-2960ab93.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import{r as registerInstance,h,H as Host,g as getElement}from"./index-bb0e68fd.js";
|
|
2
2
|
/*!
|
|
3
|
-
* tabbable 6.
|
|
3
|
+
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var candidateSelectors=["input:not([inert])
|
|
6
|
+
var candidateSelectors=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"];var candidateSelector=candidateSelectors.join(",");var NoElement=typeof Element==="undefined";var matches=NoElement?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;var getRootNode=!NoElement&&Element.prototype.getRootNode?function(e){var t;return e===null||e===void 0?void 0:(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e===null||e===void 0?void 0:e.ownerDocument};var isInert=function e(t,r){var n;if(r===void 0){r=true}var a=t===null||t===void 0?void 0:(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"inert");var i=a===""||a==="true";var o=i||r&&t&&e(t.parentNode);return o};var isContentEditable=function e(t){var r;var n=t===null||t===void 0?void 0:(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"contenteditable");return n===""||n==="true"};var getCandidates=function e(t,r,n){if(isInert(t)){return[]}var a=Array.prototype.slice.apply(t.querySelectorAll(candidateSelector));if(r&&matches.call(t,candidateSelector)){a.unshift(t)}a=a.filter(n);return a};var getCandidatesIteratively=function e(t,r,n){var a=[];var i=Array.from(t);while(i.length){var o=i.shift();if(isInert(o,false)){continue}if(o.tagName==="SLOT"){var u=o.assignedElements();var f=u.length?u:o.children;var s=e(f,true,n);if(n.flatten){a.push.apply(a,s)}else{a.push({scopeParent:o,candidates:s})}}else{var l=matches.call(o,candidateSelector);if(l&&n.filter(o)&&(r||!t.includes(o))){a.push(o)}var c=o.shadowRoot||typeof n.getShadowRoot==="function"&&n.getShadowRoot(o);var d=!isInert(c,false)&&(!n.shadowRootFilter||n.shadowRootFilter(o));if(c&&d){var v=e(c===true?o.children:c.children,true,n);if(n.flatten){a.push.apply(a,v)}else{a.push({scopeParent:o,candidates:v})}}else{i.unshift.apply(i,o.children)}}}return a};var hasTabIndex=function e(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))};var getTabIndex=function e(t){if(!t){throw new Error("No node provided")}if(t.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||isContentEditable(t))&&!hasTabIndex(t)){return 0}}return t.tabIndex};var getSortOrderTabIndex=function e(t,r){var n=getTabIndex(t);if(n<0&&r&&!hasTabIndex(t)){return 0}return n};var sortOrderedTabbables=function e(t,r){return t.tabIndex===r.tabIndex?t.documentOrder-r.documentOrder:t.tabIndex-r.tabIndex};var isInput=function e(t){return t.tagName==="INPUT"};var isHiddenInput=function e(t){return isInput(t)&&t.type==="hidden"};var isDetailsWithSummary=function e(t){var r=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some((function(e){return e.tagName==="SUMMARY"}));return r};var getCheckedRadio=function e(t,r){for(var n=0;n<t.length;n++){if(t[n].checked&&t[n].form===r){return t[n]}}};var isTabbableRadio=function e(t){if(!t.name){return true}var r=t.form||getRootNode(t);var n=function e(t){return r.querySelectorAll('input[type="radio"][name="'+t+'"]')};var a;if(typeof window!=="undefined"&&typeof window.CSS!=="undefined"&&typeof window.CSS.escape==="function"){a=n(window.CSS.escape(t.name))}else{try{a=n(t.name)}catch(e){console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message);return false}}var i=getCheckedRadio(a,t.form);return!i||i===t};var isRadio=function e(t){return isInput(t)&&t.type==="radio"};var isNonTabbableRadio=function e(t){return isRadio(t)&&!isTabbableRadio(t)};var isNodeAttached=function e(t){var r;var n=t&&getRootNode(t);var a=(r=n)===null||r===void 0?void 0:r.host;var i=false;if(n&&n!==t){var o,u,f;i=!!((o=a)!==null&&o!==void 0&&(u=o.ownerDocument)!==null&&u!==void 0&&u.contains(a)||t!==null&&t!==void 0&&(f=t.ownerDocument)!==null&&f!==void 0&&f.contains(t));while(!i&&a){var s,l,c;n=getRootNode(a);a=(s=n)===null||s===void 0?void 0:s.host;i=!!((l=a)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(a))}}return i};var isZeroArea=function e(t){var r=t.getBoundingClientRect(),n=r.width,a=r.height;return n===0&&a===0};var isHidden=function e(t,r){var n=r.displayCheck,a=r.getShadowRoot;if(getComputedStyle(t).visibility==="hidden"){return true}var i=matches.call(t,"details>summary:first-of-type");var o=i?t.parentElement:t;if(matches.call(o,"details:not([open]) *")){return true}if(!n||n==="full"||n==="legacy-full"){if(typeof a==="function"){var u=t;while(t){var f=t.parentElement;var s=getRootNode(t);if(f&&!f.shadowRoot&&a(f)===true){return isZeroArea(t)}else if(t.assignedSlot){t=t.assignedSlot}else if(!f&&s!==t.ownerDocument){t=s.host}else{t=f}}t=u}if(isNodeAttached(t)){return!t.getClientRects().length}if(n!=="legacy-full"){return true}}else if(n==="non-zero-area"){return isZeroArea(t)}return false};var isDisabledFromFieldset=function e(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)){var r=t.parentElement;while(r){if(r.tagName==="FIELDSET"&&r.disabled){for(var n=0;n<r.children.length;n++){var a=r.children.item(n);if(a.tagName==="LEGEND"){return matches.call(r,"fieldset[disabled] *")?true:!a.contains(t)}}return true}r=r.parentElement}}return false};var isNodeMatchingSelectorFocusable=function e(t,r){if(r.disabled||isInert(r)||isHiddenInput(r)||isHidden(r,t)||isDetailsWithSummary(r)||isDisabledFromFieldset(r)){return false}return true};var isNodeMatchingSelectorTabbable=function e(t,r){if(isNonTabbableRadio(r)||getTabIndex(r)<0||!isNodeMatchingSelectorFocusable(t,r)){return false}return true};var isValidShadowRootTabbable=function e(t){var r=parseInt(t.getAttribute("tabindex"),10);if(isNaN(r)||r>=0){return true}return false};var sortByOrder=function e(t){var r=[];var n=[];t.forEach((function(t,a){var i=!!t.scopeParent;var o=i?t.scopeParent:t;var u=getSortOrderTabIndex(o,i);var f=i?e(t.candidates):o;if(u===0){i?r.push.apply(r,f):r.push(o)}else{n.push({documentOrder:a,tabIndex:u,item:t,isScope:i,content:f})}}));return n.sort(sortOrderedTabbables).reduce((function(e,t){t.isScope?e.push.apply(e,t.content):e.push(t.content);return e}),[]).concat(r)};var tabbable=function e(t,r){r=r||{};var n;if(r.getShadowRoot){n=getCandidatesIteratively([t],r.includeContainer,{filter:isNodeMatchingSelectorTabbable.bind(null,r),flatten:false,getShadowRoot:r.getShadowRoot,shadowRootFilter:isValidShadowRootTabbable})}else{n=getCandidates(t,r.includeContainer,isNodeMatchingSelectorTabbable.bind(null,r))}return sortByOrder(n)};var focusable=function e(t,r){r=r||{};var n;if(r.getShadowRoot){n=getCandidatesIteratively([t],r.includeContainer,{filter:isNodeMatchingSelectorFocusable.bind(null,r),flatten:true,getShadowRoot:r.getShadowRoot})}else{n=getCandidates(t,r.includeContainer,isNodeMatchingSelectorFocusable.bind(null,r))}return n};var isTabbable=function e(t,r){r=r||{};if(!t){throw new Error("No node provided")}if(matches.call(t,candidateSelector)===false){return false}return isNodeMatchingSelectorTabbable(r,t)};var focusableCandidateSelector=candidateSelectors.concat("iframe").join(",");var isFocusable=function e(t,r){r=r||{};if(!t){throw new Error("No node provided")}if(matches.call(t,focusableCandidateSelector)===false){return false}return isNodeMatchingSelectorFocusable(r,t)};
|
|
7
7
|
/*!
|
|
8
8
|
* focus-trap 7.5.4
|
|
9
9
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
10
|
-
*/function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){t=_toPropertyKey(t);if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function _toPrimitive(e,t){if(typeof e!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==undefined){var n=r.call(e,t||"default");if(typeof n!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return typeof t==="symbol"?t:String(t)}var activeFocusTraps={activateTrap:function e(t,r){if(t.length>0){var n=t[t.length-1];if(n!==r){n.pause()}}var i=t.indexOf(r);if(i===-1){t.push(r)}else{t.splice(i,1);t.push(r)}},deactivateTrap:function e(t,r){var n=t.indexOf(r);if(n!==-1){t.splice(n,1)}if(t.length>0){t[t.length-1].unpause()}}};var isSelectableInput=function e(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select==="function"};var isEscapeEvent=function e(t){return(t===null||t===void 0?void 0:t.key)==="Escape"||(t===null||t===void 0?void 0:t.key)==="Esc"||(t===null||t===void 0?void 0:t.keyCode)===27};var isTabEvent=function e(t){return(t===null||t===void 0?void 0:t.key)==="Tab"||(t===null||t===void 0?void 0:t.keyCode)===9};var isKeyForward=function e(t){return isTabEvent(t)&&!t.shiftKey};var isKeyBackward=function e(t){return isTabEvent(t)&&t.shiftKey};var delay=function e(t){return setTimeout(t,0)};var findIndex=function e(t,r){var n=-1;t.every((function(e,t){if(r(e)){n=t;return false}return true}));return n};var valueOrHandler=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}return typeof t==="function"?t.apply(void 0,n):t};var getActualTarget=function e(t){return t.target.shadowRoot&&typeof t.composedPath==="function"?t.composedPath()[0]:t.target};var internalTrapStack=[];var createFocusTrap=function e(t,r){var n=(r===null||r===void 0?void 0:r.document)||document;var i=(r===null||r===void 0?void 0:r.trapStack)||internalTrapStack;var a=_objectSpread2({returnFocusOnDeactivate:true,escapeDeactivates:true,delayInitialFocus:true,isKeyForward:isKeyForward,isKeyBackward:isKeyBackward},r);var o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:false,paused:false,delayInitialFocusTimer:undefined,recentNavEvent:undefined};var u;var f=function e(t,r,n){return t&&t[r]!==undefined?t[r]:a[n||r]};var s=function e(t,r){var n=typeof(r===null||r===void 0?void 0:r.composedPath)==="function"?r.composedPath():undefined;return o.containerGroups.findIndex((function(e){var r=e.container,i=e.tabbableNodes;return r.contains(t)||(n===null||n===void 0?void 0:n.includes(r))||i.find((function(e){return e===t}))}))};var l=function e(t){var r=a[t];if(typeof r==="function"){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++){o[u-1]=arguments[u]}r=r.apply(void 0,o)}if(r===true){r=undefined}if(!r){if(r===undefined||r===false){return r}throw new Error("`".concat(t,"` was specified but was not a node, or did not return a node"))}var f=r;if(typeof r==="string"){f=n.querySelector(r);if(!f){throw new Error("`".concat(t,"` as selector refers to no known node"))}}return f};var c=function e(){var t=l("initialFocus");if(t===false){return false}if(t===undefined||!isFocusable(t,a.tabbableOptions)){if(s(n.activeElement)>=0){t=n.activeElement}else{var r=o.tabbableGroups[0];var i=r&&r.firstTabbableNode;t=i||l("fallbackFocus")}}if(!t){throw new Error("Your focus-trap needs to have at least one focusable element")}return t};var d=function e(){o.containerGroups=o.containers.map((function(e){var t=tabbable(e,a.tabbableOptions);var r=focusable(e,a.tabbableOptions);var n=t.length>0?t[0]:undefined;var i=t.length>0?t[t.length-1]:undefined;var o=r.find((function(e){return isTabbable(e)}));var u=r.slice().reverse().find((function(e){return isTabbable(e)}));var f=!!t.find((function(e){return getTabIndex(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:r,posTabIndexesFound:f,firstTabbableNode:n,lastTabbableNode:i,firstDomTabbableNode:o,lastDomTabbableNode:u,nextTabbableNode:function e(n){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var a=t.indexOf(n);if(a<0){if(i){return r.slice(r.indexOf(n)+1).find((function(e){return isTabbable(e)}))}return r.slice(0,r.indexOf(n)).reverse().find((function(e){return isTabbable(e)}))}return t[a+(i?1:-1)]}}}));o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0}));if(o.tabbableGroups.length<=0&&!l("fallbackFocus")){throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")}if(o.containerGroups.find((function(e){return e.posTabIndexesFound}))&&o.containerGroups.length>1){throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}};var v=function e(t){var r=t.activeElement;if(!r){return}if(r.shadowRoot&&r.shadowRoot.activeElement!==null){return e(r.shadowRoot)}return r};var b=function e(t){if(t===false){return}if(t===v(document)){return}if(!t||!t.focus){e(c());return}t.focus({preventScroll:!!a.preventScroll});o.mostRecentlyFocusedNode=t;if(isSelectableInput(t)){t.select()}};var p=function e(t){var r=l("setReturnFocus",t);return r?r:r===false?false:t};var h=function e(t){var r=t.target,n=t.event,i=t.isBackward,u=i===void 0?false:i;r=r||getActualTarget(n);d();var f=null;if(o.tabbableGroups.length>0){var c=s(r,n);var v=c>=0?o.containerGroups[c]:undefined;if(c<0){if(u){f=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode}else{f=o.tabbableGroups[0].firstTabbableNode}}else if(u){var b=findIndex(o.tabbableGroups,(function(e){var t=e.firstTabbableNode;return r===t}));if(b<0&&(v.container===r||isFocusable(r,a.tabbableOptions)&&!isTabbable(r,a.tabbableOptions)&&!v.nextTabbableNode(r,false))){b=c}if(b>=0){var p=b===0?o.tabbableGroups.length-1:b-1;var h=o.tabbableGroups[p];f=getTabIndex(r)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else if(!isTabEvent(n)){f=v.nextTabbableNode(r,false)}}else{var y=findIndex(o.tabbableGroups,(function(e){var t=e.lastTabbableNode;return r===t}));if(y<0&&(v.container===r||isFocusable(r,a.tabbableOptions)&&!isTabbable(r,a.tabbableOptions)&&!v.nextTabbableNode(r))){y=c}if(y>=0){var T=y===o.tabbableGroups.length-1?0:y+1;var g=o.tabbableGroups[T];f=getTabIndex(r)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else if(!isTabEvent(n)){f=v.nextTabbableNode(r)}}}else{f=l("fallbackFocus")}return f};var y=function e(t){var r=getActualTarget(t);if(s(r,t)>=0){return}if(valueOrHandler(a.clickOutsideDeactivates,t)){u.deactivate({returnFocus:a.returnFocusOnDeactivate});return}if(valueOrHandler(a.allowOutsideClick,t)){return}t.preventDefault()};var T=function e(t){var r=getActualTarget(t);var n=s(r,t)>=0;if(n||r instanceof Document){if(n){o.mostRecentlyFocusedNode=r}}else{t.stopImmediatePropagation();var i;var u=true;if(o.mostRecentlyFocusedNode){if(getTabIndex(o.mostRecentlyFocusedNode)>0){var f=s(o.mostRecentlyFocusedNode);var l=o.containerGroups[f].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===o.mostRecentlyFocusedNode}));if(d>=0){if(a.isKeyForward(o.recentNavEvent)){if(d+1<l.length){i=l[d+1];u=false}}else{if(d-1>=0){i=l[d-1];u=false}}}}}else{if(!o.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return getTabIndex(e)>0}))}))){u=false}}}else{u=false}if(u){i=h({target:o.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(o.recentNavEvent)})}if(i){b(i)}else{b(o.mostRecentlyFocusedNode||c())}}o.recentNavEvent=undefined};var g=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;o.recentNavEvent=t;var n=h({event:t,isBackward:r});if(n){if(isTabEvent(t)){t.preventDefault()}b(n)}};var w=function e(t){if(isEscapeEvent(t)&&valueOrHandler(a.escapeDeactivates,t)!==false){t.preventDefault();u.deactivate();return}if(a.isKeyForward(t)||a.isKeyBackward(t)){g(t,a.isKeyBackward(t))}};var m=function e(t){var r=getActualTarget(t);if(s(r,t)>=0){return}if(valueOrHandler(a.clickOutsideDeactivates,t)){return}if(valueOrHandler(a.allowOutsideClick,t)){return}t.preventDefault();t.stopImmediatePropagation()};var S=function e(){if(!o.active){return}activeFocusTraps.activateTrap(i,u);o.delayInitialFocusTimer=a.delayInitialFocus?delay((function(){b(c())})):b(c());n.addEventListener("focusin",T,true);n.addEventListener("mousedown",y,{capture:true,passive:false});n.addEventListener("touchstart",y,{capture:true,passive:false});n.addEventListener("click",m,{capture:true,passive:false});n.addEventListener("keydown",w,{capture:true,passive:false});return u};var I=function e(){if(!o.active){return}n.removeEventListener("focusin",T,true);n.removeEventListener("mousedown",y,true);n.removeEventListener("touchstart",y,true);n.removeEventListener("click",m,true);n.removeEventListener("keydown",w,true);return u};var E=function e(t){var r=t.some((function(e){var t=Array.from(e.removedNodes);return t.some((function(e){return e===o.mostRecentlyFocusedNode}))}));if(r){b(c())}};var F=typeof window!=="undefined"&&"MutationObserver"in window?new MutationObserver(E):undefined;var N=function e(){if(!F){return}F.disconnect();if(o.active&&!o.paused){o.containers.map((function(e){F.observe(e,{subtree:true,childList:true})}))}};u={get active(){return o.active},get paused(){return o.paused},activate:function e(t){if(o.active){return this}var r=f(t,"onActivate");var i=f(t,"onPostActivate");var a=f(t,"checkCanFocusTrap");if(!a){d()}o.active=true;o.paused=false;o.nodeFocusedBeforeActivation=n.activeElement;r===null||r===void 0||r();var u=function e(){if(a){d()}S();N();i===null||i===void 0||i()};if(a){a(o.containers.concat()).then(u,u);return this}u();return this},deactivate:function e(t){if(!o.active){return this}var r=_objectSpread2({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},t);clearTimeout(o.delayInitialFocusTimer);o.delayInitialFocusTimer=undefined;I();o.active=false;o.paused=false;N();activeFocusTraps.deactivateTrap(i,u);var n=f(r,"onDeactivate");var s=f(r,"onPostDeactivate");var l=f(r,"checkCanReturnFocus");var c=f(r,"returnFocus","returnFocusOnDeactivate");n===null||n===void 0||n();var d=function e(){delay((function(){if(c){b(p(o.nodeFocusedBeforeActivation))}s===null||s===void 0||s()}))};if(c&&l){l(p(o.nodeFocusedBeforeActivation)).then(d,d);return this}d();return this},pause:function e(t){if(o.paused||!o.active){return this}var r=f(t,"onPause");var n=f(t,"onPostPause");o.paused=true;r===null||r===void 0||r();I();N();n===null||n===void 0||n();return this},unpause:function e(t){if(!o.paused||!o.active){return this}var r=f(t,"onUnpause");var n=f(t,"onPostUnpause");o.paused=false;r===null||r===void 0||r();d();S();N();n===null||n===void 0||n();return this},updateContainerElements:function e(t){var r=[].concat(t).filter(Boolean);o.containers=r.map((function(e){return typeof e==="string"?n.querySelector(e):e}));if(o.active){d()}N();return this}};u.updateContainerElements(t);return u};var FocusTrap=function(){function e(e){registerInstance(this,e);this.active=false;this.trap=undefined}e.prototype.handleActiveChange=function(e){this.toggleTrap(e)};e.prototype.connectedCallback=function(){var e;if(!this.trap){this.trap=createFocusTrap((e=this.host)===null||e===void 0?void 0:e.firstElementChild,{allowOutsideClick:true})}};e.prototype.componentDidLoad=function(){this.toggleTrap(this.active)};e.prototype.disconnectedCallback=function(){var e;(e=this.trap)===null||e===void 0?void 0:e.deactivate()};e.prototype.toggleTrap=function(e){var t,r;if(e){(t=this.trap)===null||t===void 0?void 0:t.activate()}else{(r=this.trap)===null||r===void 0?void 0:r.deactivate()}};e.prototype.render=function(){return h(Host,{key:"40e6912cae0ae3e92b46cf4d251e1b1a47320d0f"},h("slot",{key:"39fe2c6ad0e0b419090ac8270840a83e49c286cf"}))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{active:["handleActiveChange"]}},enumerable:false,configurable:true});return e}();export{FocusTrap as focus_trap};
|
|
10
|
+
*/function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){t=_toPropertyKey(t);if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function _toPrimitive(e,t){if(typeof e!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==undefined){var n=r.call(e,t||"default");if(typeof n!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return typeof t==="symbol"?t:String(t)}var activeFocusTraps={activateTrap:function e(t,r){if(t.length>0){var n=t[t.length-1];if(n!==r){n.pause()}}var a=t.indexOf(r);if(a===-1){t.push(r)}else{t.splice(a,1);t.push(r)}},deactivateTrap:function e(t,r){var n=t.indexOf(r);if(n!==-1){t.splice(n,1)}if(t.length>0){t[t.length-1].unpause()}}};var isSelectableInput=function e(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select==="function"};var isEscapeEvent=function e(t){return(t===null||t===void 0?void 0:t.key)==="Escape"||(t===null||t===void 0?void 0:t.key)==="Esc"||(t===null||t===void 0?void 0:t.keyCode)===27};var isTabEvent=function e(t){return(t===null||t===void 0?void 0:t.key)==="Tab"||(t===null||t===void 0?void 0:t.keyCode)===9};var isKeyForward=function e(t){return isTabEvent(t)&&!t.shiftKey};var isKeyBackward=function e(t){return isTabEvent(t)&&t.shiftKey};var delay=function e(t){return setTimeout(t,0)};var findIndex=function e(t,r){var n=-1;t.every((function(e,t){if(r(e)){n=t;return false}return true}));return n};var valueOrHandler=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++){n[a-1]=arguments[a]}return typeof t==="function"?t.apply(void 0,n):t};var getActualTarget=function e(t){return t.target.shadowRoot&&typeof t.composedPath==="function"?t.composedPath()[0]:t.target};var internalTrapStack=[];var createFocusTrap=function e(t,r){var n=(r===null||r===void 0?void 0:r.document)||document;var a=(r===null||r===void 0?void 0:r.trapStack)||internalTrapStack;var i=_objectSpread2({returnFocusOnDeactivate:true,escapeDeactivates:true,delayInitialFocus:true,isKeyForward:isKeyForward,isKeyBackward:isKeyBackward},r);var o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:false,paused:false,delayInitialFocusTimer:undefined,recentNavEvent:undefined};var u;var f=function e(t,r,n){return t&&t[r]!==undefined?t[r]:i[n||r]};var s=function e(t,r){var n=typeof(r===null||r===void 0?void 0:r.composedPath)==="function"?r.composedPath():undefined;return o.containerGroups.findIndex((function(e){var r=e.container,a=e.tabbableNodes;return r.contains(t)||(n===null||n===void 0?void 0:n.includes(r))||a.find((function(e){return e===t}))}))};var l=function e(t){var r=i[t];if(typeof r==="function"){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u<a;u++){o[u-1]=arguments[u]}r=r.apply(void 0,o)}if(r===true){r=undefined}if(!r){if(r===undefined||r===false){return r}throw new Error("`".concat(t,"` was specified but was not a node, or did not return a node"))}var f=r;if(typeof r==="string"){f=n.querySelector(r);if(!f){throw new Error("`".concat(t,"` as selector refers to no known node"))}}return f};var c=function e(){var t=l("initialFocus");if(t===false){return false}if(t===undefined||!isFocusable(t,i.tabbableOptions)){if(s(n.activeElement)>=0){t=n.activeElement}else{var r=o.tabbableGroups[0];var a=r&&r.firstTabbableNode;t=a||l("fallbackFocus")}}if(!t){throw new Error("Your focus-trap needs to have at least one focusable element")}return t};var d=function e(){o.containerGroups=o.containers.map((function(e){var t=tabbable(e,i.tabbableOptions);var r=focusable(e,i.tabbableOptions);var n=t.length>0?t[0]:undefined;var a=t.length>0?t[t.length-1]:undefined;var o=r.find((function(e){return isTabbable(e)}));var u=r.slice().reverse().find((function(e){return isTabbable(e)}));var f=!!t.find((function(e){return getTabIndex(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:r,posTabIndexesFound:f,firstTabbableNode:n,lastTabbableNode:a,firstDomTabbableNode:o,lastDomTabbableNode:u,nextTabbableNode:function e(n){var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var i=t.indexOf(n);if(i<0){if(a){return r.slice(r.indexOf(n)+1).find((function(e){return isTabbable(e)}))}return r.slice(0,r.indexOf(n)).reverse().find((function(e){return isTabbable(e)}))}return t[i+(a?1:-1)]}}}));o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0}));if(o.tabbableGroups.length<=0&&!l("fallbackFocus")){throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")}if(o.containerGroups.find((function(e){return e.posTabIndexesFound}))&&o.containerGroups.length>1){throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}};var v=function e(t){var r=t.activeElement;if(!r){return}if(r.shadowRoot&&r.shadowRoot.activeElement!==null){return e(r.shadowRoot)}return r};var b=function e(t){if(t===false){return}if(t===v(document)){return}if(!t||!t.focus){e(c());return}t.focus({preventScroll:!!i.preventScroll});o.mostRecentlyFocusedNode=t;if(isSelectableInput(t)){t.select()}};var p=function e(t){var r=l("setReturnFocus",t);return r?r:r===false?false:t};var h=function e(t){var r=t.target,n=t.event,a=t.isBackward,u=a===void 0?false:a;r=r||getActualTarget(n);d();var f=null;if(o.tabbableGroups.length>0){var c=s(r,n);var v=c>=0?o.containerGroups[c]:undefined;if(c<0){if(u){f=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode}else{f=o.tabbableGroups[0].firstTabbableNode}}else if(u){var b=findIndex(o.tabbableGroups,(function(e){var t=e.firstTabbableNode;return r===t}));if(b<0&&(v.container===r||isFocusable(r,i.tabbableOptions)&&!isTabbable(r,i.tabbableOptions)&&!v.nextTabbableNode(r,false))){b=c}if(b>=0){var p=b===0?o.tabbableGroups.length-1:b-1;var h=o.tabbableGroups[p];f=getTabIndex(r)>=0?h.lastTabbableNode:h.lastDomTabbableNode}else if(!isTabEvent(n)){f=v.nextTabbableNode(r,false)}}else{var T=findIndex(o.tabbableGroups,(function(e){var t=e.lastTabbableNode;return r===t}));if(T<0&&(v.container===r||isFocusable(r,i.tabbableOptions)&&!isTabbable(r,i.tabbableOptions)&&!v.nextTabbableNode(r))){T=c}if(T>=0){var y=T===o.tabbableGroups.length-1?0:T+1;var g=o.tabbableGroups[y];f=getTabIndex(r)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else if(!isTabEvent(n)){f=v.nextTabbableNode(r)}}}else{f=l("fallbackFocus")}return f};var T=function e(t){var r=getActualTarget(t);if(s(r,t)>=0){return}if(valueOrHandler(i.clickOutsideDeactivates,t)){u.deactivate({returnFocus:i.returnFocusOnDeactivate});return}if(valueOrHandler(i.allowOutsideClick,t)){return}t.preventDefault()};var y=function e(t){var r=getActualTarget(t);var n=s(r,t)>=0;if(n||r instanceof Document){if(n){o.mostRecentlyFocusedNode=r}}else{t.stopImmediatePropagation();var a;var u=true;if(o.mostRecentlyFocusedNode){if(getTabIndex(o.mostRecentlyFocusedNode)>0){var f=s(o.mostRecentlyFocusedNode);var l=o.containerGroups[f].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===o.mostRecentlyFocusedNode}));if(d>=0){if(i.isKeyForward(o.recentNavEvent)){if(d+1<l.length){a=l[d+1];u=false}}else{if(d-1>=0){a=l[d-1];u=false}}}}}else{if(!o.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return getTabIndex(e)>0}))}))){u=false}}}else{u=false}if(u){a=h({target:o.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(o.recentNavEvent)})}if(a){b(a)}else{b(o.mostRecentlyFocusedNode||c())}}o.recentNavEvent=undefined};var g=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;o.recentNavEvent=t;var n=h({event:t,isBackward:r});if(n){if(isTabEvent(t)){t.preventDefault()}b(n)}};var w=function e(t){if(isEscapeEvent(t)&&valueOrHandler(i.escapeDeactivates,t)!==false){t.preventDefault();u.deactivate();return}if(i.isKeyForward(t)||i.isKeyBackward(t)){g(t,i.isKeyBackward(t))}};var m=function e(t){var r=getActualTarget(t);if(s(r,t)>=0){return}if(valueOrHandler(i.clickOutsideDeactivates,t)){return}if(valueOrHandler(i.allowOutsideClick,t)){return}t.preventDefault();t.stopImmediatePropagation()};var S=function e(){if(!o.active){return}activeFocusTraps.activateTrap(a,u);o.delayInitialFocusTimer=i.delayInitialFocus?delay((function(){b(c())})):b(c());n.addEventListener("focusin",y,true);n.addEventListener("mousedown",T,{capture:true,passive:false});n.addEventListener("touchstart",T,{capture:true,passive:false});n.addEventListener("click",m,{capture:true,passive:false});n.addEventListener("keydown",w,{capture:true,passive:false});return u};var E=function e(){if(!o.active){return}n.removeEventListener("focusin",y,true);n.removeEventListener("mousedown",T,true);n.removeEventListener("touchstart",T,true);n.removeEventListener("click",m,true);n.removeEventListener("keydown",w,true);return u};var I=function e(t){var r=t.some((function(e){var t=Array.from(e.removedNodes);return t.some((function(e){return e===o.mostRecentlyFocusedNode}))}));if(r){b(c())}};var F=typeof window!=="undefined"&&"MutationObserver"in window?new MutationObserver(I):undefined;var N=function e(){if(!F){return}F.disconnect();if(o.active&&!o.paused){o.containers.map((function(e){F.observe(e,{subtree:true,childList:true})}))}};u={get active(){return o.active},get paused(){return o.paused},activate:function e(t){if(o.active){return this}var r=f(t,"onActivate");var a=f(t,"onPostActivate");var i=f(t,"checkCanFocusTrap");if(!i){d()}o.active=true;o.paused=false;o.nodeFocusedBeforeActivation=n.activeElement;r===null||r===void 0||r();var u=function e(){if(i){d()}S();N();a===null||a===void 0||a()};if(i){i(o.containers.concat()).then(u,u);return this}u();return this},deactivate:function e(t){if(!o.active){return this}var r=_objectSpread2({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},t);clearTimeout(o.delayInitialFocusTimer);o.delayInitialFocusTimer=undefined;E();o.active=false;o.paused=false;N();activeFocusTraps.deactivateTrap(a,u);var n=f(r,"onDeactivate");var s=f(r,"onPostDeactivate");var l=f(r,"checkCanReturnFocus");var c=f(r,"returnFocus","returnFocusOnDeactivate");n===null||n===void 0||n();var d=function e(){delay((function(){if(c){b(p(o.nodeFocusedBeforeActivation))}s===null||s===void 0||s()}))};if(c&&l){l(p(o.nodeFocusedBeforeActivation)).then(d,d);return this}d();return this},pause:function e(t){if(o.paused||!o.active){return this}var r=f(t,"onPause");var n=f(t,"onPostPause");o.paused=true;r===null||r===void 0||r();E();N();n===null||n===void 0||n();return this},unpause:function e(t){if(!o.paused||!o.active){return this}var r=f(t,"onUnpause");var n=f(t,"onPostUnpause");o.paused=false;r===null||r===void 0||r();d();S();N();n===null||n===void 0||n();return this},updateContainerElements:function e(t){var r=[].concat(t).filter(Boolean);o.containers=r.map((function(e){return typeof e==="string"?n.querySelector(e):e}));if(o.active){d()}N();return this}};u.updateContainerElements(t);return u};var FocusTrap=function(){function e(e){registerInstance(this,e);this.active=false;this.trap=undefined}e.prototype.handleActiveChange=function(e){this.toggleTrap(e)};e.prototype.connectedCallback=function(){var e;if(!this.trap){this.trap=createFocusTrap((e=this.host)===null||e===void 0?void 0:e.firstElementChild,{allowOutsideClick:true})}};e.prototype.componentDidLoad=function(){this.toggleTrap(this.active)};e.prototype.disconnectedCallback=function(){var e;(e=this.trap)===null||e===void 0?void 0:e.deactivate()};e.prototype.toggleTrap=function(e){var t,r;if(e){(t=this.trap)===null||t===void 0?void 0:t.activate()}else{(r=this.trap)===null||r===void 0?void 0:r.deactivate()}};e.prototype.render=function(){return h(Host,{key:"40e6912cae0ae3e92b46cf4d251e1b1a47320d0f"},h("slot",{key:"39fe2c6ad0e0b419090ac8270840a83e49c286cf"}))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{active:["handleActiveChange"]}},enumerable:false,configurable:true});return e}();export{FocusTrap as focus_trap};
|
package/dist/esm-es5/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as PostInternetHeader}from"./post-internet-header-
|
|
1
|
+
export{P as PostInternetHeader}from"./post-internet-header-6768743b.js";export{P as PostInternetBreadcrumbs}from"./post-internet-breadcrumbs-ee507bec.js";export{P as PostInternetFooter}from"./post-internet-footer-cae59692.js";export{P as PostSkiplinks}from"./post-skiplinks-0779348d.js";export{P as PostMetaNavigation}from"./post-meta-navigation-4bf72315.js";export{P as PostLanguageSwitch}from"./post-language-switch-d9159f47.js";export{P as PostLogo}from"./post-logo-2c3faf36.js";export{P as PostMainNavigation}from"./post-main-navigation-58b5c03d.js";export{P as PostSearch}from"./post-search-daf7d66d.js";export{P as PostKlpLoginWidget}from"./post-klp-login-widget-6aeb2fd2.js";import"./index-bb0e68fd.js";import"./index-d3f1363d.js";import"./language.service-2960ab93.js";import"./store-629cab77.js";import"./utils-c8805f81.js";import"./svg-sprite.component-abb69a1b.js";import"./svg-icon.component-70692acc.js";import"./if.component-d88d9e48.js";import"./bodyScrollLock.esm-afcc00e3.js";import"./ui.service-22f2c593.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function o(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):o(t.value).then(s,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];o=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e,i){if(i||arguments.length===2)for(var n=0,o=e.length,r;n<o;n++){if(r||!(n in e)){if(!r)r=Array.prototype.slice.call(e,0,n);r[n]=e[n]}}return t.concat(r||Array.prototype.slice.call(e))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-bb0e68fd.js";import{d as debounce,t as throttle}from"./index-d3f1363d.js";import{g as getUserLang,p as persistLanguageChoice,t as translate}from"./language.service-2960ab93.js";import{u as uniqueId}from"./utils-c8805f81.js";import{s as state,d as dispose}from"./store-629cab77.js";import{S as SvgSprite}from"./svg-sprite.component-abb69a1b.js";import{S as SvgIcon}from"./svg-icon.component-70692acc.js";import{I as If}from"./if.component-d88d9e48.js";var markActiveRoute=function(t,e){if(e===false){return t}var i;var n=false;t=resetOverrideConfig(t);if(e==="auto"||e==="exact"){if(hasActivePortalRoute(t)){return resetActiveStateToPortalConfig(t)}i=new URL(window.location.href)}else{try{n=e.startsWith("/")||e.startsWith("./");i=new URL(e,window.location.href)}catch(i){console.warn("Active Route: ".concat(e," is not a valid URL. Navigation highlighting has been disabled."));return t}}var o=compileScoreList(t,i,e,n);if(o.length===0){return t}var r=o[0];r.main.isActiveOverride=true;if(r.sub)r.sub.isActiveOverride=true;return t};var hasActivePortalRoute=function(t){return t.filter((function(t){return t.isActive})).length>0};var resetActiveStateToPortalConfig=function(t){return t.map((function(t){var e;return Object.assign(Object.assign({},t),{isActiveOverride:t.isActive,flyout:(e=t.flyout)===null||e===void 0?void 0:e.map((function(t){return Object.assign(Object.assign({},t),{linkList:t.linkList.map((function(t){return Object.assign(Object.assign({},t),{isActiveOverride:t.isActive})}))})}))})}))};var resetOverrideConfig=function(t){return t.map((function(t){var e;return Object.assign(Object.assign({},t),{isActiveOverride:false,flyout:((e=t.flyout)===null||e===void 0?void 0:e.map((function(t){return Object.assign(Object.assign({},t),{linkList:t.linkList.map((function(t){return Object.assign(Object.assign({},t),{isActiveOverride:false})}))})})))||[]})}))};var compileScoreList=function(t,e,i,n){var o=false;var r=[];t.filter((function(t){return!o&&t})).forEach((function(t){var s;try{var a=new URL(t.url);var l=compareRoutes(e,a,n,i);o=updateScoreList(r,l,{main:t,score:l},o)}catch(t){}(s=t.flyout)===null||s===void 0?void 0:s.forEach((function(s){var a;(a=s.linkList)===null||a===void 0?void 0:a.forEach((function(s){if(s.isActive&&(i==="auto"||i==="exact")){o=true;return}try{var a=new URL(s.url);var l=compareRoutes(e,a,n,i);o=updateScoreList(r,l,{main:t,sub:s,score:l},o)}catch(t){}}))}))}));return r.sort((function(t,e){return e.score-t.score}))};function updateScoreList(t,e,i,n){var o=n;if(e>0){if(e===Infinity)o=true;t.push(i)}return o}var compareRoutes=function(t,e,i,n){if(t===null||e===null){return 0}if(!i&&t.origin!==e.origin){return 0}var o=t.pathname.toLocaleLowerCase();var r=e.pathname.toLocaleLowerCase();if(o===r){return Infinity}if(t.pathname.length<e.pathname.length){return 0}if(n==="auto"){var s=__spreadArray([t.origin.toLocaleLowerCase()],o.split("/").filter((function(t){return t!==null&&t!==""})),true);var a=__spreadArray([e.origin.toLocaleLowerCase()],r.split("/").filter((function(t){return t!==null&&t!==""})),true);var l=getSimilarityScore(s,a);return Math.min(s.length,a.length)===l?l:0}return 0};var getSimilarityScore=function(t,e){if(t==null||e==null||t.length===0||e.length===0){return 0}var i=0;for(;i<Math.min(t.length,e.length);i++){if(t[i]!==e[i]){return 0}}return i};var request=null;var osFlyoutCache=null;var getPPMConfig=function(){var t=document.querySelector("#PPM_HEADER_DATA");if((t===null||t===void 0?void 0:t.textContent)!=null){return JSON.parse(t.textContent)}return null};var getLocalizedConfig=function(t){return __awaiter(void 0,[t],void 0,(function(t){var e,i,n,o,r,s,a;var l=t.projectId,c=t.environment,d=t.language,u=t.cookieKey,h=t.localStorageKey,f=t.activeRouteProp,p=t.localizedCustomConfig,g=t.osFlyoutOverrides;return __generator(this,(function(t){switch(t.label){case 0:n=getPPMConfig();r=null;if(!n)return[3,1];o=n;s=document.documentElement.lang;return[3,3];case 1:if(request==null){request=fetchConfig(l,c)}return[4,request];case 2:r=t.sent();s=getUserLang(Object.keys(r),d,h,u);if(s===undefined){throw new Error("Internet Header: unable to determine current language")}o=Object.assign({},r[s]);t.label=3;case 3:if(p){a=((e=p===null||p===void 0?void 0:p.header)===null||e===void 0?void 0:e.navMain)?Object.assign(Object.assign({},o.header),{navMain:__spreadArray(__spreadArray([],o.header.navMain,true),p.header.navMain,true)}):o.header;o=Object.assign(Object.assign({},o),{header:a})}if(g)o.header.navMain=mergeOsFlyoutOverrides(o,g);if(f!=null)o.header.navMain=markActiveRoute(o.header.navMain,f);setMainNavigationIds((i=o===null||o===void 0?void 0:o.header)===null||i===void 0?void 0:i.navMain);persistLanguageChoice(s,u,h);return[2,o]}}))}))};var mergeOsFlyoutOverrides=function(t,e){if(e==null)return t.header.navMain;return t.header.navMain.map((function(t){var i,n,o;if(t.id!=="flyout_os")return t;if(osFlyoutCache===null){osFlyoutCache=JSON.parse(JSON.stringify(t))}var r=(i=e.text)!==null&&i!==void 0?i:osFlyoutCache.text;var s=(n=e.title)!==null&&n!==void 0?n:osFlyoutCache.title;if(osFlyoutCache.flyout==null||osFlyoutCache.flyout.length===0||e.flyout==null||e.flyout.length===0)return Object.assign(Object.assign({},t),{title:s,text:r});var a=__spreadArray(__spreadArray([],osFlyoutCache.flyout.map((function(t,i){var n,o;var r=(n=e.flyout)===null||n===void 0?void 0:n[i];var s=(o=r===null||r===void 0?void 0:r.title)!==null&&o!==void 0?o:t.title;var a=(r===null||r===void 0?void 0:r.linkList)!=null?r.linkList:[];return{title:s,linkList:__spreadArray(__spreadArray([],t.linkList,true),a,true)}})),true),((o=e.flyout)===null||o===void 0?void 0:o.slice(osFlyoutCache.flyout.length))||[],true);return Object.assign(Object.assign({},t),{text:r,title:s,flyout:a})}))};var fetchConfig=function(t,e){return __awaiter(void 0,void 0,void 0,(function(){var i,n,o;return __generator(this,(function(r){switch(r.label){case 0:if(!isValidProjectId(t)){throw new Error('Internet Header: invalid project id "'.concat(t,'"'))}if(t==="test"){e="int01"}i=generateConfigUrl(t,e);r.label=1;case 1:r.trys.push([1,4,,5]);return[4,fetch(i)];case 2:n=r.sent();return[4,n.json()];case 3:return[2,r.sent()];case 4:o=r.sent();throw new Error("Internet Header: fetching config failed. ".concat(o.message));case 5:return[2]}}))}))};var generateConfigUrl=function(t,e){if(t==="test")return"assets/config/test-configuration.json";var i=e.toLowerCase();var n=i==="prod";var o="https://".concat(n?"www":"int",".post.ch");try{return new URL("".concat(o,"/api/headerjs/Json?serviceid=").concat(encodeURIComponent(t)).concat(!n?"&environment="+i:"")).toString()}catch(t){throw new Error("Internet Header: Config URL is invalid.")}};var isValidProjectId=function(t){return t!==""&&t.length>0&&/^[a-zA-Z][\w-]*[a-zA-Z0-9]$/.test(t)};var getLocalizedCustomConfig=function(t,e){var i;var n;try{n=typeof t==="string"?JSON.parse(t):t}catch(t){throw new Error("Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. ")}var o=n[e];if((i=o===null||o===void 0?void 0:o.header)===null||i===void 0?void 0:i.navMain)setMainNavigationIds(o.header.navMain);return o};var setMainNavigationIds=function(t){t.forEach((function(t){t.id=t.id==="flyout_os"?t.id:uniqueId("main-nav-")}))};var name="@swisspost/internet-header";var version="1.16.0";var description="The header for client facing applications.";var author="Swiss Post <design-system@post.ch>";var license="Apache-2.0";var repository={type:"git",url:"https://github.com/swisspost/design-system.git"};var homepage="https://design-system.post.ch";var bugs={url:"https://github.com/swisspost/design-system/issues"};var main="loader/index.cjs.js";var module="loader/index.js";var es2017="loader/index.es2017.js";var types="loader/index.d.ts";var collection="dist/collection/collection-manifest.json";var unpkg="dist/swisspost-internet-header/swisspost-internet-header.esm.js";var publishConfig={access:"public"};var files=["dist/","loader/"];var scripts={dev:"stencil build --serve --port 9310 --watch --docs-readme --dev --config stencil.config.dev.ts",start:"stencil build --watch --docs-readme",build:"stencil build --docs-readme",clean:"rimraf www dist loader",test:"pnpm run unit",unit:"jest","unit:watch":"jest --watch",e2e:"cypress run","e2e:ci":"xvfb-run -a cypress run","e2e:watch":"cypress open",lint:"eslint src/**/*{.ts,.tsx}","lint:fix":"eslint src/**/*{.ts,.tsx} --fix",generate:"stencil generate"};var dependencies={"@swisspost/design-system-styles":"workspace:9.7.0","body-scroll-lock":"4.0.0-beta.0","iframe-resizer":"4.4.5",jquery:"3.7.1","throttle-debounce":"5.0.2","url-polyfill":"1.1.12"};var devDependencies={"@babel/core":"7.25.2","@percy/cli":"1.29.1","@percy/cypress":"3.1.2","@stencil-community/eslint-plugin":"0.8.0","@stencil/core":"4.19.2","@stencil/sass":"3.0.12","@stencil/store":"2.0.16","@types/body-scroll-lock":"3.1.2","@types/iframe-resizer":"3.5.13","@types/jest":"29.5.12","@types/jquery":"3.5.30","@types/node":"20.14.14","@types/throttle-debounce":"5.0.2","babel-loader":"9.1.3",bootstrap:"5.3.3",cypress:"13.13.2","cypress-each":"1.14.0","cypress-storybook":"1.0.0",eslint:"8.57.0","eslint-plugin-react":"7.35.0","focus-trap":"7.5.4",globby:"14.0.2",jest:"29.7.0","jest-environment-jsdom":"29.7.0",rimraf:"6.0.1","rollup-plugin-node-polyfills":"0.2.1","rollup-plugin-scss":"4.0.0","rollup-plugin-visualizer":"5.12.0",sass:"1.77.8","start-server-and-test":"2.0.5","ts-jest":"29.2.4",typescript:"5.9.3"};var keywords=["components","web-components","header","stencil","design-system","ui","frontend"];var packageJson={name:name,version:version,description:description,author:author,license:license,repository:repository,homepage:homepage,bugs:bugs,main:main,module:module,es2017:es2017,types:types,collection:collection,"collection:main":"dist/collection/index.js",unpkg:unpkg,publishConfig:publishConfig,files:files,scripts:scripts,dependencies:dependencies,devDependencies:devDependencies,keywords:keywords};var isScrollable=function(t){if(!(t instanceof HTMLElement||t instanceof SVGElement)){return false}var e=getComputedStyle(t);return["overflow","overflow-x","overflow-y"].some((function(t){var i=e.getPropertyValue(t);return i==="auto"||i==="scroll"}))};var getScrollParent=function(t){var e=t.parentElement;while(e){if(e.nodeName==="BODY"){return document}if(isScrollable(e)){return e}e=e.parentElement}return document};var getLogoScale=function(t,e){var i=getScrollParent(t);var n=i instanceof Element?i.scrollTop:i.documentElement.scrollTop;var o=state.stickyness==="full"?0:n;var r,s;if(e){r=t.clientHeight-1;s=e.clientHeight}else{var a=window.getComputedStyle(t);var l=parseFloat(a.getPropertyValue("font-size"));s=parseFloat(a.getPropertyValue("--meta-header-height"))*l;r=s+parseFloat(a.getPropertyValue("--header-height"))*l}var c=1;if(s>0){c=Math.max((r-Math.max(o,0))/(r-s),1)}return c.toString()};var registerLogoAnimationObserver=function(t,e){var i=getScrollParent(e);var n=function(){e.style.setProperty("--logo-scale",getLogoScale(e,t))};var o=debounce(150,n);var r=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting&&t.intersectionRatio>0){i.addEventListener("scroll",n,{passive:true});window.addEventListener("resize",o);window.requestAnimationFrame(n)}else{i.removeEventListener("scroll",n);window.removeEventListener("resize",o);window.requestAnimationFrame(n)}}))}),{threshold:[0,.001]});r.observe(t);return n};var postInternetHeaderCss=':host{--post-contrast-color:#000;--post-focus-color:#1976c8;--post-contrast-color-inverted:#fff;--post-gray-10:hsl(0, 0%, 90%);--post-gray-20:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-60:hsl(0, 0%, 40%);--post-gray-80:hsl(0, 0%, 20%);--post-yellow:#fc0;--post-white:#fff;--post-light:#faf9f8;--post-gray:#f4f3f1;--post-dark:hsl(0, 0%, 20%);--post-black:#000;--post-primary:hsl(0, 0%, 20%);--post-secondary:hsl(0, 0%, 40%);--post-success:#2c871d;--post-warning:#f49e00;--post-error:#a51728;--post-info:#cce4ee;--post-success-background:#c0debb;--post-warning-background:#fce2b2;--post-error-background:#ffdade;--post-nightblue:#004976;--post-nightblue-bright:#0076a8;--post-petrol:#006d68;--post-petrol-bright:#00968f;--post-coral:#9e2a2f;--post-coral-bright:#e03c31;--post-olive:#716135;--post-olive-bright:#aa9d2e;--post-purple:#80276c;--post-purple-bright:#c5299b;--post-aubergine:#523178;--post-aubergine-bright:#7566a0;--post-contrast-color-rgb:0, 0, 0;--post-contrast-color-inverted-rgb:255, 255, 255;--post-gray-10-rgb:230, 230, 230;--post-gray-20-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-60-rgb:102, 102, 102;--post-gray-80-rgb:51, 51, 51;--post-black-alpha-10-rgba:rgba(0, 0, 0, 0.1);--post-black-alpha-20-rgba:rgba(0, 0, 0, 0.2);--post-black-alpha-40-rgba:rgba(0, 0, 0, 0.4);--post-black-alpha-60-rgba:rgba(0, 0, 0, 0.6);--post-black-alpha-80-rgba:rgba(0, 0, 0, 0.8);--post-white-alpha-10-rgba:rgba(255, 255, 255, 0.1);--post-white-alpha-20-rgba:rgba(255, 255, 255, 0.2);--post-white-alpha-40-rgba:rgba(255, 255, 255, 0.4);--post-white-alpha-60-rgba:rgba(255, 255, 255, 0.6);--post-white-alpha-80-rgba:rgba(255, 255, 255, 0.8);--post-yellow-rgb:255, 204, 0;--post-white-rgb:255, 255, 255;--post-light-rgb:250, 249, 248;--post-gray-rgb:244, 243, 241;--post-dark-rgb:51, 51, 51;--post-black-rgb:0, 0, 0;--post-primary-rgb:51, 51, 51;--post-secondary-rgb:102, 102, 102;--post-success-rgb:44, 135, 29;--post-warning-rgb:244, 158, 0;--post-error-rgb:165, 23, 40;--post-info-rgb:204, 228, 238;--post-success-background-rgb:192, 222, 187;--post-warning-background-rgb:252, 226, 178;--post-error-background-rgb:255, 218, 222;--post-nightblue-rgb:0, 73, 118;--post-nightblue-bright-rgb:0, 118, 168;--post-petrol-rgb:0, 109, 104;--post-petrol-bright-rgb:0, 150, 143;--post-coral-rgb:158, 42, 47;--post-coral-bright-rgb:224, 60, 49;--post-olive-rgb:113, 97, 53;--post-olive-bright-rgb:170, 157, 46;--post-purple-rgb:128, 39, 108;--post-purple-bright-rgb:197, 41, 155;--post-aubergine-rgb:82, 49, 120;--post-aubergine-bright-rgb:117, 102, 160}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:700;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Bold.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:400;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Regular.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Regular.woff") format("woff")}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:300;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Light.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Light.woff") format("woff")}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}.btn-blank{background-color:rgba(0,0,0,0);border:none;border-radius:0;padding:0}.nav-link{outline:none;outline-offset:2px;text-decoration:none;color:rgba(0,0,0,.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:rgba(0,0,0,0);-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:.5rem}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.nav-link:hover,.nav-link:focus{color:#000}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){z-index:1;position:relative}.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Swiss Post Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}button{font:inherit;padding:0}a,button{border-radius:4px;outline:none;outline-offset:2px}a:is(:focus-visible,:focus-within,.pretend-focus),button:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color);border-radius:4px}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){svg{color:currentColor;forced-color-adjust:preserve-parent-color}}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-none{display:none !important}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px)and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1439.98px){.hidden-xxl{display:none}}:host{--logo-scale:1}@media (max-width: 1023.98px){:host{--logo-scale:1 !important}}post-header-logo{height:var(--header-height);width:var(--header-height);-webkit-transform-origin:bottom left;transform-origin:bottom left;-webkit-transform:scale(var(--logo-scale));transform:scale(var(--logo-scale))}post-main-navigation{margin-left:calc(var(--header-height)*var(--logo-scale) - var(--header-height))}:host{display:block;position:relative;font-size:1rem;font-weight:300;z-index:var(--header-z-index, 10);--language-dropdown-margin-top:0px;--meta-header-height:var(--post-meta-header-height, 0px);--header-height:var(--post-header-height, 3.5rem)}@media (min-width: 1024px){:host{--meta-header-height:var(--post-meta-header-height, 3rem)}}@media (min-width: 1024px){:host{--header-height:var(--post-header-height, 4rem)}}@media (min-width: 1280px){:host{--header-height:var(--post-header-height, 4.5rem)}}:host([meta=false]){--meta-header-height:0px;--language-dropdown-margin-top:1px}@supports ((position: -webkit-sticky) or (position: sticky)){:host(:not(.stickyness-none)){position:-webkit-sticky;position:sticky}:host(.stickyness-full){top:0}:host(.stickyness-main){top:calc(var(--meta-header-height, 0px)*-1)}:host(.stickyness-minimal){top:calc((var(--header-height, 0px) + var(--meta-header-height, 0px) + 1px)*-1);-webkit-transition:top 200ms ease-in;transition:top 200ms ease-in}:host(.stickyness-minimal.scrolling-up),:host(.stickyness-minimal.dropdown-open){top:calc(var(--meta-header-height, 0px)*-1);--header-slide-in-transition:var(--post-header-slide-in-transition, top 200ms ease-out);-webkit-transition:var(--header-slide-in-transition);transition:var(--header-slide-in-transition)}}.post-internet-header{border-bottom:1px solid #e6e6e6;background-color:#fff}.main-navigation-container{display:-ms-flexbox;display:flex}.main-navigation-container>.main-navigation-controls{-ms-flex:0 1 auto;flex:0 1 auto}.main-navigation{display:-ms-flexbox;display:flex}.sub-navigation-container{position:absolute;top:100%;left:0;width:100%;display:-ms-flexbox;display:flex;background:#fff;visibility:hidden}.main-navigation-item:hover .sub-navigation-container{visibility:visible}.main-navigation-controls{display:-ms-flexbox;display:flex;margin-left:auto}@media (max-width: 1023.98px){.main-navigation-controls{font-weight:400}}@media (min-width: 1024px){.main-navigation-controls{font-size:1.0625rem}}.main-navigation-controls>*{border-left:1px solid #e6e6e6;-ms-flex:0 0 auto;flex:0 0 auto}.main-navigation-custom-content{max-height:var(--header-height);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-negative:1;flex-shrink:1}.menu-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 calc(1rem - 1px);font-weight:300;cursor:pointer;border-left:1px solid #e6e6e6;-ms-flex-order:1;order:1}@media (min-width: 1024px){.menu-button{display:none}}@media (min-width: 600px)and (max-width: 1023.98px){.menu-button .visually-hidden{position:static;width:auto;height:auto;margin:auto;overflow:visible;clip:auto;visibility:visible;margin-right:.5rem}}.menu-button svg{width:1.5rem;height:1.5rem}.full-width .wide-container{max-width:none}';var SwisspostInternetHeaderStyle0=postInternetHeaderCss;var PostInternetHeader=function(){function t(t){registerInstance(this,t);this.headerLoaded=createEvent(this,"headerLoaded",7);this.lastScrollTop=window.scrollY||document.documentElement.scrollTop;this.lastWindowWidth=window.innerWidth;this.handleClickOutsideBound=this.handleClickOutside.bind(this);this.project=undefined;this.stickyness="minimal";this.language=undefined;this.meta=true;this.login=true;this.search=true;this.skiplinks=true;this.configProxy=undefined;this.environment="prod";this.languageSwitchOverrides=undefined;this.customConfig=undefined;this.languageCookieKey=undefined;this.languageLocalStorageKey="swisspost-internet-header-language";this.logoutUrl=undefined;this.selfAdminOrigin=undefined;this.activeRoute="auto";this.osFlyoutOverrides=undefined;this.fullWidth=false;this.activeFlyout=null;this.activeDropdownElement=null;this.isMainSlotEmpty=true;if(this.project===undefined||this.project===""||!isValidProjectId(this.project)){throw new Error('Internet Header project key is "'.concat(this.project,'". Please provide a valid project key.'))}}t.prototype.getCurrentLanguage=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){return[2,(t=state.currentLanguage)!==null&&t!==void 0?t:"de"]}))}))};t.prototype.connectedCallback=function(){var t=this;this.throttledScroll=throttle(300,(function(){return t.handleScrollEvent()}));this.debouncedResize=debounce(200,(function(){return t.handleResize()}))};t.prototype.disconnectedCallback=function(){this.scrollParent.removeEventListener("scroll",this.throttledScroll);this.scrollParent.removeEventListener("resize",this.debouncedResize);dispose()};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n;return __generator(this,(function(o){switch(o.label){case 0:this.scrollParent=getScrollParent(this.host);this.scrollParent.addEventListener("scroll",this.throttledScroll,{passive:true});this.scrollParent.addEventListener("resize",this.debouncedResize,{passive:true});o.label=1;case 1:o.trys.push([1,3,,4]);state.projectId=this.project;state.stickyness=this.stickyness;state.environment=this.environment.toLocaleLowerCase();if(this.language!==undefined)state.currentLanguage=this.language;state.languageSwitchOverrides=typeof this.languageSwitchOverrides==="string"?JSON.parse(this.languageSwitchOverrides):this.languageSwitchOverrides;state.osFlyoutOverrides=typeof this.osFlyoutOverrides==="string"?JSON.parse(this.osFlyoutOverrides):this.osFlyoutOverrides;if(this.customConfig!==undefined){t=Object.keys(typeof this.customConfig==="string"?JSON.parse(this.customConfig):this.customConfig);e=state.currentLanguage||getUserLang(t,this.language);state.localizedCustomConfig=getLocalizedCustomConfig(this.customConfig,e)}i=state;return[4,getLocalizedConfig({projectId:this.project,environment:state.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 2:i.localizedConfig=o.sent();return[3,4];case 3:n=o.sent();console.error(n);return[3,4];case 4:return[2]}}))}))};t.prototype.componentDidLoad=function(){var t=this;window.requestAnimationFrame((function(){t.handleResize();t.headerLoaded.emit();t.host.classList.add("header-loaded");if(t.meta&&t.metaNav){t.updateLogoAnimation=registerLogoAnimationObserver(t.metaNav,t.host)}else{var e=window.getComputedStyle(document.documentElement);if(e.getPropertyValue("--post-meta-header-height")!==""){document.documentElement.style.setProperty("--post-meta-header-height","0px")}}}));if(this.stickyness==="full")console.warn('Internet Header: The stickyness="full" option is deprecated.')};t.prototype.handleLanguageChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:state.currentLanguage=t;e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:t,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();if(this.customConfig!==undefined)state.localizedCustomConfig=getLocalizedCustomConfig(this.customConfig,t);return[2]}}))}))};t.prototype.handleAvailableLanguagesChange=function(t){state.languageSwitchOverrides=typeof t==="string"?JSON.parse(t):t};t.prototype.handleOsFlyoutOverrides=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:state.osFlyoutOverrides=typeof t==="string"?JSON.parse(t):t;e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();return[2]}}))}))};t.prototype.handleActiveRouteChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:t,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();return[2]}}))}))};t.prototype.handleCustomConfigChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:if(this.language===undefined)return[2];e=getLocalizedCustomConfig(t,this.language);state.localizedCustomConfig=e;i=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:e,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:i.localizedConfig=n.sent();return[2]}}))}))};t.prototype.handleSearchChange=function(t){state.search=t};t.prototype.handleLoginChange=function(t){state.login=t};t.prototype.handleMetaChange=function(t){state.meta=t};t.prototype.handleLanguageChangeEvent=function(t){void this.handleLanguageChange(t.detail)};t.prototype.handleStickynessChange=function(t){state.stickyness=t;if(typeof this.updateLogoAnimation==="function")this.updateLogoAnimation()};t.prototype.handleClickOutside=function(t){if(this.activeDropdownElement&&!t.composedPath().includes(this.activeDropdownElement)){void this.activeDropdownElement.toggleDropdown(false)}};t.prototype.handleKeyUp=function(t){if(t.key==="Escape"){if(this.activeDropdownElement){void this.activeDropdownElement.toggleDropdown(false)}if(this.activeFlyout!==null&&this.mainNav){void this.mainNav.toggleDropdown(false)}}};t.prototype.handleScrollEvent=function(){var t=this.scrollParent instanceof Document?this.scrollParent.documentElement.scrollTop:this.scrollParent.scrollTop;if(this.stickyness==="minimal"){this.host.classList.toggle("scrolling-up",t<=this.lastScrollTop)}this.lastScrollTop=t<=0?0:t};t.prototype.handleResize=function(){var t;if(this.isMainNavOpen()&&this.lastWindowWidth<1024&&window.innerWidth>=1024){(t=this.activeDropdownElement)===null||t===void 0?void 0:t.toggleDropdown(false)}this.lastWindowWidth=window.innerWidth};t.prototype.handleDropdownToggled=function(t){var e=this;if(!t.detail.open&&this.activeDropdownElement!==t.detail.element){return}if(t.detail.open){if(this.activeDropdownElement){void this.activeDropdownElement.toggleDropdown(false)}this.activeDropdownElement=t.detail.element;if(window.innerWidth>=1024){window.setTimeout((function(){window.addEventListener("click",e.handleClickOutsideBound)}),10)}if(this.activeFlyout!==null&&this.mainNav){void this.mainNav.setActiveFlyout(null)}}else{this.activeDropdownElement=null;window.removeEventListener("click",this.handleClickOutsideBound)}};t.prototype.handleFlyoutToggled=function(t){this.activeFlyout=t.detail;if(this.activeDropdownElement&&t.detail!==null&&!this.isMainNavOpen()){void this.activeDropdownElement.toggleDropdown(false)}};t.prototype.toggleMobileDropdown=function(){var t;(t=this.mainNav)===null||t===void 0?void 0:t.toggleDropdown()};t.prototype.isMainNavOpen=function(){return this.activeDropdownElement&&this.activeDropdownElement.tagName==="POST-MAIN-NAVIGATION"};t.prototype.handleMainSlotChange=function(t){var e=t.target;this.isMainSlotEmpty=e.assignedElements().length===0};t.prototype.render=function(){var t=this;var e,i,n;if(!((e=state.localizedConfig)===null||e===void 0?void 0:e.header)){console.error(new Error("Internet Header: Config cannot be loaded"));return}var o=state.localizedConfig;var r=this.meta&&o.header.navMeta!==undefined&&((i=o.header.navMeta)===null||i===void 0?void 0:i.filter((function(t){return!t.isHomeLink})).length)>0;var s=((n=this.login)!==null&&n!==void 0?n:!o.header.isLoginWidgetHidden)&&o.header.loginWidgetOptions;var a=o.header.navLang.length>1;var l=r?getLogoScale(this.host):"1";return h(Host,{class:"stickyness-".concat(this.stickyness," ").concat(Boolean(this.activeDropdownElement)||Boolean(this.activeFlyout)?"dropdown-open":""),"data-version":packageJson.version,onKeyup:function(e){return t.handleKeyUp(e)},style:{"--logo-scale":l}},h("header",{class:"post-internet-header".concat(this.fullWidth?" full-width":"")},h(SvgSprite,null),h("h1",{class:"visually-hidden"},translate("Navigate on post.ch")),h(If,{condition:this.skiplinks},h("post-skiplinks",null)),h(If,{condition:r},h("post-meta-navigation",{orientation:"horizontal",class:"hidden-lg","full-width":this.fullWidth,ref:function(e){return t.metaNav=e}},h(If,{condition:a},h("post-language-switch",{id:"post-language-switch-desktop",mode:"dropdown",onDropdownToggled:function(e){return t.handleDropdownToggled(e)}})))),h("div",{class:"main-navigation-container wide-container"},h("post-header-logo",null),h("button",{class:"menu-button nav-link",onClick:function(){return t.toggleMobileDropdown()},"aria-haspopup":"menu","aria-controls":"post-internet-header-main-navigation","aria-expanded":this.activeDropdownElement?"true":"false"},h("span",{class:"menu-button-text visually-hidden"},o.header.mobileMenu.text),h(SvgIcon,{name:this.isMainNavOpen()?"pi-close":"pi-menu"})),h("post-main-navigation",{onDropdownToggled:function(e){return t.handleDropdownToggled(e)},onFlyoutToggled:function(e){return t.handleFlyoutToggled(e)},ref:function(e){return t.mainNav=e}},h(If,{condition:r},h("post-meta-navigation",{orientation:"vertical"},h(If,{condition:a},h("post-language-switch",{id:"post-language-switch-mobile",mode:"list"}))))),h("div",{class:"main-navigation-controls"},h("div",{class:"main-navigation-custom-content".concat(this.isMainSlotEmpty?" d-none":"")},h("slot",{name:"main",onSlotchange:function(e){return t.handleMainSlotChange(e)}})),h(If,{condition:this.search},h("post-search",{onDropdownToggled:function(e){return t.handleDropdownToggled(e)}})),h(If,{condition:!!s},h("post-klp-login-widget",{"logout-url":this.logoutUrl,"self-admin-origin":this.selfAdminOrigin},h("slot",{name:"login-widget"}))),h(If,{condition:!r&&a},h("post-language-switch",{id:"post-language-switch-no-meta",onDropdownToggled:function(e){return t.handleDropdownToggled(e)},mode:"dropdown"}))))))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{language:["handleLanguageChange"],languageSwitchOverrides:["handleAvailableLanguagesChange"],osFlyoutOverrides:["handleOsFlyoutOverrides"],activeRoute:["handleActiveRouteChange"],customConfig:["handleCustomConfigChange"],search:["handleSearchChange"],login:["handleLoginChange"],meta:["handleMetaChange"],stickyness:["handleStickynessChange"]}},enumerable:false,configurable:true});return t}();PostInternetHeader.style=SwisspostInternetHeaderStyle0;export{PostInternetHeader as P};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function o(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):o(t.value).then(s,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];o=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e,i){if(i||arguments.length===2)for(var n=0,o=e.length,r;n<o;n++){if(r||!(n in e)){if(!r)r=Array.prototype.slice.call(e,0,n);r[n]=e[n]}}return t.concat(r||Array.prototype.slice.call(e))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-bb0e68fd.js";import{d as debounce,t as throttle}from"./index-d3f1363d.js";import{g as getUserLang,p as persistLanguageChoice,t as translate}from"./language.service-2960ab93.js";import{u as uniqueId}from"./utils-c8805f81.js";import{s as state,d as dispose}from"./store-629cab77.js";import{S as SvgSprite}from"./svg-sprite.component-abb69a1b.js";import{S as SvgIcon}from"./svg-icon.component-70692acc.js";import{I as If}from"./if.component-d88d9e48.js";var markActiveRoute=function(t,e){if(e===false){return t}var i;var n=false;t=resetOverrideConfig(t);if(e==="auto"||e==="exact"){if(hasActivePortalRoute(t)){return resetActiveStateToPortalConfig(t)}i=new URL(window.location.href)}else{try{n=e.startsWith("/")||e.startsWith("./");i=new URL(e,window.location.href)}catch(i){console.warn("Active Route: ".concat(e," is not a valid URL. Navigation highlighting has been disabled."));return t}}var o=compileScoreList(t,i,e,n);if(o.length===0){return t}var r=o[0];r.main.isActiveOverride=true;if(r.sub)r.sub.isActiveOverride=true;return t};var hasActivePortalRoute=function(t){return t.filter((function(t){return t.isActive})).length>0};var resetActiveStateToPortalConfig=function(t){return t.map((function(t){var e;return Object.assign(Object.assign({},t),{isActiveOverride:t.isActive,flyout:(e=t.flyout)===null||e===void 0?void 0:e.map((function(t){return Object.assign(Object.assign({},t),{linkList:t.linkList.map((function(t){return Object.assign(Object.assign({},t),{isActiveOverride:t.isActive})}))})}))})}))};var resetOverrideConfig=function(t){return t.map((function(t){var e;return Object.assign(Object.assign({},t),{isActiveOverride:false,flyout:((e=t.flyout)===null||e===void 0?void 0:e.map((function(t){return Object.assign(Object.assign({},t),{linkList:t.linkList.map((function(t){return Object.assign(Object.assign({},t),{isActiveOverride:false})}))})})))||[]})}))};var compileScoreList=function(t,e,i,n){var o=false;var r=[];t.filter((function(t){return!o&&t})).forEach((function(t){var s;try{var a=new URL(t.url);var l=compareRoutes(e,a,n,i);o=updateScoreList(r,l,{main:t,score:l},o)}catch(t){}(s=t.flyout)===null||s===void 0?void 0:s.forEach((function(s){var a;(a=s.linkList)===null||a===void 0?void 0:a.forEach((function(s){if(s.isActive&&(i==="auto"||i==="exact")){o=true;return}try{var a=new URL(s.url);var l=compareRoutes(e,a,n,i);o=updateScoreList(r,l,{main:t,sub:s,score:l},o)}catch(t){}}))}))}));return r.sort((function(t,e){return e.score-t.score}))};function updateScoreList(t,e,i,n){var o=n;if(e>0){if(e===Infinity)o=true;t.push(i)}return o}var compareRoutes=function(t,e,i,n){if(t===null||e===null){return 0}if(!i&&t.origin!==e.origin){return 0}var o=t.pathname.toLocaleLowerCase();var r=e.pathname.toLocaleLowerCase();if(o===r){return Infinity}if(t.pathname.length<e.pathname.length){return 0}if(n==="auto"){var s=__spreadArray([t.origin.toLocaleLowerCase()],o.split("/").filter((function(t){return t!==null&&t!==""})),true);var a=__spreadArray([e.origin.toLocaleLowerCase()],r.split("/").filter((function(t){return t!==null&&t!==""})),true);var l=getSimilarityScore(s,a);return Math.min(s.length,a.length)===l?l:0}return 0};var getSimilarityScore=function(t,e){if(t==null||e==null||t.length===0||e.length===0){return 0}var i=0;for(;i<Math.min(t.length,e.length);i++){if(t[i]!==e[i]){return 0}}return i};var request=null;var osFlyoutCache=null;var getPPMConfig=function(){var t=document.querySelector("#PPM_HEADER_DATA");if((t===null||t===void 0?void 0:t.textContent)!=null){return JSON.parse(t.textContent)}return null};var getLocalizedConfig=function(t){return __awaiter(void 0,[t],void 0,(function(t){var e,i,n,o,r,s,a;var l=t.projectId,c=t.environment,d=t.language,u=t.cookieKey,h=t.localStorageKey,f=t.activeRouteProp,p=t.localizedCustomConfig,g=t.osFlyoutOverrides;return __generator(this,(function(t){switch(t.label){case 0:n=getPPMConfig();r=null;if(!n)return[3,1];o=n;s=document.documentElement.lang;return[3,3];case 1:if(request==null){request=fetchConfig(l,c)}return[4,request];case 2:r=t.sent();s=getUserLang(Object.keys(r),d,h,u);if(s===undefined){throw new Error("Internet Header: unable to determine current language")}o=Object.assign({},r[s]);t.label=3;case 3:if(p){a=((e=p===null||p===void 0?void 0:p.header)===null||e===void 0?void 0:e.navMain)?Object.assign(Object.assign({},o.header),{navMain:__spreadArray(__spreadArray([],o.header.navMain,true),p.header.navMain,true)}):o.header;o=Object.assign(Object.assign({},o),{header:a})}if(g)o.header.navMain=mergeOsFlyoutOverrides(o,g);if(f!=null)o.header.navMain=markActiveRoute(o.header.navMain,f);setMainNavigationIds((i=o===null||o===void 0?void 0:o.header)===null||i===void 0?void 0:i.navMain);persistLanguageChoice(s,u,h);return[2,o]}}))}))};var mergeOsFlyoutOverrides=function(t,e){if(e==null)return t.header.navMain;return t.header.navMain.map((function(t){var i,n,o;if(t.id!=="flyout_os")return t;if(osFlyoutCache===null){osFlyoutCache=JSON.parse(JSON.stringify(t))}var r=(i=e.text)!==null&&i!==void 0?i:osFlyoutCache.text;var s=(n=e.title)!==null&&n!==void 0?n:osFlyoutCache.title;if(osFlyoutCache.flyout==null||osFlyoutCache.flyout.length===0||e.flyout==null||e.flyout.length===0)return Object.assign(Object.assign({},t),{title:s,text:r});var a=__spreadArray(__spreadArray([],osFlyoutCache.flyout.map((function(t,i){var n,o;var r=(n=e.flyout)===null||n===void 0?void 0:n[i];var s=(o=r===null||r===void 0?void 0:r.title)!==null&&o!==void 0?o:t.title;var a=(r===null||r===void 0?void 0:r.linkList)!=null?r.linkList:[];return{title:s,linkList:__spreadArray(__spreadArray([],t.linkList,true),a,true)}})),true),((o=e.flyout)===null||o===void 0?void 0:o.slice(osFlyoutCache.flyout.length))||[],true);return Object.assign(Object.assign({},t),{text:r,title:s,flyout:a})}))};var fetchConfig=function(t,e){return __awaiter(void 0,void 0,void 0,(function(){var i,n,o;return __generator(this,(function(r){switch(r.label){case 0:if(!isValidProjectId(t)){throw new Error('Internet Header: invalid project id "'.concat(t,'"'))}if(t==="test"){e="int01"}i=generateConfigUrl(t,e);r.label=1;case 1:r.trys.push([1,4,,5]);return[4,fetch(i)];case 2:n=r.sent();return[4,n.json()];case 3:return[2,r.sent()];case 4:o=r.sent();throw new Error("Internet Header: fetching config failed. ".concat(o.message));case 5:return[2]}}))}))};var generateConfigUrl=function(t,e){if(t==="test")return"assets/config/test-configuration.json";var i=e.toLowerCase();var n=i==="prod";var o="https://".concat(n?"www":"int",".post.ch");try{return new URL("".concat(o,"/api/headerjs/Json?serviceid=").concat(encodeURIComponent(t)).concat(!n?"&environment="+i:"")).toString()}catch(t){throw new Error("Internet Header: Config URL is invalid.")}};var isValidProjectId=function(t){return t!==""&&t.length>0&&/^[a-zA-Z][\w-]*[a-zA-Z0-9]$/.test(t)};var getLocalizedCustomConfig=function(t,e){var i;var n;try{n=typeof t==="string"?JSON.parse(t):t}catch(t){throw new Error("Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. ")}var o=n[e];if((i=o===null||o===void 0?void 0:o.header)===null||i===void 0?void 0:i.navMain)setMainNavigationIds(o.header.navMain);return o};var setMainNavigationIds=function(t){t.forEach((function(t){t.id=t.id==="flyout_os"?t.id:uniqueId("main-nav-")}))};var name="@swisspost/internet-header";var version="1.16.1";var description="The header for client facing applications.";var author="Swiss Post <design-system@post.ch>";var license="Apache-2.0";var repository={type:"git",url:"https://github.com/swisspost/design-system.git"};var homepage="https://design-system.post.ch";var bugs={url:"https://github.com/swisspost/design-system/issues"};var main="loader/index.cjs.js";var module="loader/index.js";var es2017="loader/index.es2017.js";var types="loader/index.d.ts";var collection="dist/collection/collection-manifest.json";var unpkg="dist/swisspost-internet-header/swisspost-internet-header.esm.js";var publishConfig={access:"public"};var files=["dist/","loader/"];var scripts={dev:"stencil build --serve --port 9310 --watch --docs-readme --dev --config stencil.config.dev.ts",start:"stencil build --watch --docs-readme",build:"stencil build --docs-readme",clean:"rimraf www dist loader",test:"pnpm run unit",unit:"jest","unit:watch":"jest --watch",e2e:"cypress run","e2e:ci":"xvfb-run -a cypress run","e2e:watch":"cypress open",lint:"eslint src/**/*{.ts,.tsx}","lint:fix":"eslint src/**/*{.ts,.tsx} --fix",generate:"stencil generate"};var dependencies={"@swisspost/design-system-styles":"workspace:9.8.0","body-scroll-lock":"4.0.0-beta.0","iframe-resizer":"4.4.5",jquery:"3.7.1","throttle-debounce":"5.0.2","url-polyfill":"1.1.12"};var devDependencies={"@babel/core":"7.25.2","@percy/cli":"1.29.1","@percy/cypress":"3.1.2","@stencil-community/eslint-plugin":"0.8.0","@stencil/core":"4.19.2","@stencil/sass":"3.0.12","@stencil/store":"2.0.16","@types/body-scroll-lock":"3.1.2","@types/iframe-resizer":"3.5.13","@types/jest":"29.5.12","@types/jquery":"3.5.30","@types/node":"20.14.14","@types/throttle-debounce":"5.0.2","babel-loader":"9.1.3",bootstrap:"5.3.3",cypress:"13.13.2","cypress-each":"1.14.0","cypress-storybook":"1.0.0",eslint:"8.57.0","eslint-plugin-react":"7.35.0","focus-trap":"7.5.4",globby:"14.0.2",jest:"29.7.0","jest-environment-jsdom":"29.7.0",rimraf:"6.0.1","rollup-plugin-node-polyfills":"0.2.1","rollup-plugin-scss":"4.0.0","rollup-plugin-visualizer":"5.12.0",sass:"1.77.8","start-server-and-test":"2.0.5","ts-jest":"29.2.4",typescript:"5.9.3"};var keywords=["components","web-components","header","stencil","design-system","ui","frontend"];var packageJson={name:name,version:version,description:description,author:author,license:license,repository:repository,homepage:homepage,bugs:bugs,main:main,module:module,es2017:es2017,types:types,collection:collection,"collection:main":"dist/collection/index.js",unpkg:unpkg,publishConfig:publishConfig,files:files,scripts:scripts,dependencies:dependencies,devDependencies:devDependencies,keywords:keywords};var isScrollable=function(t){if(!(t instanceof HTMLElement||t instanceof SVGElement)){return false}var e=getComputedStyle(t);return["overflow","overflow-x","overflow-y"].some((function(t){var i=e.getPropertyValue(t);return i==="auto"||i==="scroll"}))};var getScrollParent=function(t){var e=t.parentElement;while(e){if(e.nodeName==="BODY"){return document}if(isScrollable(e)){return e}e=e.parentElement}return document};var getLogoScale=function(t,e){var i=getScrollParent(t);var n=i instanceof Element?i.scrollTop:i.documentElement.scrollTop;var o=state.stickyness==="full"?0:n;var r,s;if(e){r=t.clientHeight-1;s=e.clientHeight}else{var a=window.getComputedStyle(t);var l=parseFloat(a.getPropertyValue("font-size"));s=parseFloat(a.getPropertyValue("--meta-header-height"))*l;r=s+parseFloat(a.getPropertyValue("--header-height"))*l}var c=1;if(s>0){c=Math.max((r-Math.max(o,0))/(r-s),1)}return c.toString()};var registerLogoAnimationObserver=function(t,e){var i=getScrollParent(e);var n=function(){e.style.setProperty("--logo-scale",getLogoScale(e,t))};var o=debounce(150,n);var r=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting&&t.intersectionRatio>0){i.addEventListener("scroll",n,{passive:true});window.addEventListener("resize",o);window.requestAnimationFrame(n)}else{i.removeEventListener("scroll",n);window.removeEventListener("resize",o);window.requestAnimationFrame(n)}}))}),{threshold:[0,.001]});r.observe(t);return n};var postInternetHeaderCss=':host{--post-contrast-color:#000;--post-focus-color:#1976c8;--post-contrast-color-inverted:#fff;--post-gray-10:hsl(0, 0%, 90%);--post-gray-20:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-60:hsl(0, 0%, 40%);--post-gray-80:hsl(0, 0%, 20%);--post-yellow:#fc0;--post-white:#fff;--post-light:#faf9f8;--post-gray:#f4f3f1;--post-dark:hsl(0, 0%, 20%);--post-black:#000;--post-primary:hsl(0, 0%, 20%);--post-secondary:hsl(0, 0%, 40%);--post-success:#2c871d;--post-warning:#f49e00;--post-error:#a51728;--post-info:#cce4ee;--post-success-background:#c0debb;--post-warning-background:#fce2b2;--post-error-background:#ffdade;--post-nightblue:#004976;--post-nightblue-bright:#0076a8;--post-petrol:#006d68;--post-petrol-bright:#00968f;--post-coral:#9e2a2f;--post-coral-bright:#e03c31;--post-olive:#716135;--post-olive-bright:#aa9d2e;--post-purple:#80276c;--post-purple-bright:#c5299b;--post-aubergine:#523178;--post-aubergine-bright:#7566a0;--post-contrast-color-rgb:0, 0, 0;--post-contrast-color-inverted-rgb:255, 255, 255;--post-gray-10-rgb:230, 230, 230;--post-gray-20-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-60-rgb:102, 102, 102;--post-gray-80-rgb:51, 51, 51;--post-black-alpha-10-rgba:rgba(0, 0, 0, 0.1);--post-black-alpha-20-rgba:rgba(0, 0, 0, 0.2);--post-black-alpha-40-rgba:rgba(0, 0, 0, 0.4);--post-black-alpha-60-rgba:rgba(0, 0, 0, 0.6);--post-black-alpha-80-rgba:rgba(0, 0, 0, 0.8);--post-white-alpha-10-rgba:rgba(255, 255, 255, 0.1);--post-white-alpha-20-rgba:rgba(255, 255, 255, 0.2);--post-white-alpha-40-rgba:rgba(255, 255, 255, 0.4);--post-white-alpha-60-rgba:rgba(255, 255, 255, 0.6);--post-white-alpha-80-rgba:rgba(255, 255, 255, 0.8);--post-yellow-rgb:255, 204, 0;--post-white-rgb:255, 255, 255;--post-light-rgb:250, 249, 248;--post-gray-rgb:244, 243, 241;--post-dark-rgb:51, 51, 51;--post-black-rgb:0, 0, 0;--post-primary-rgb:51, 51, 51;--post-secondary-rgb:102, 102, 102;--post-success-rgb:44, 135, 29;--post-warning-rgb:244, 158, 0;--post-error-rgb:165, 23, 40;--post-info-rgb:204, 228, 238;--post-success-background-rgb:192, 222, 187;--post-warning-background-rgb:252, 226, 178;--post-error-background-rgb:255, 218, 222;--post-nightblue-rgb:0, 73, 118;--post-nightblue-bright-rgb:0, 118, 168;--post-petrol-rgb:0, 109, 104;--post-petrol-bright-rgb:0, 150, 143;--post-coral-rgb:158, 42, 47;--post-coral-bright-rgb:224, 60, 49;--post-olive-rgb:113, 97, 53;--post-olive-bright-rgb:170, 157, 46;--post-purple-rgb:128, 39, 108;--post-purple-bright-rgb:197, 41, 155;--post-aubergine-rgb:82, 49, 120;--post-aubergine-bright-rgb:117, 102, 160}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:700;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Bold.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Bold.woff") format("woff")}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:400;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Regular.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Regular.woff") format("woff")}@font-face{font-display:swap;font-family:"Swiss Post Sans";font-weight:300;src:url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Light.woff2") format("woff2"),url("https://fonts.post.ch/swiss-post-sans/v1/SwissPostSans-Light.woff") format("woff")}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}.btn-blank{background-color:rgba(0,0,0,0);border:none;border-radius:0;padding:0}.nav-link{outline:none;outline-offset:2px;text-decoration:none;color:rgba(0,0,0,.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:rgba(0,0,0,0);-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:.5rem}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.nav-link:hover,.nav-link:focus{color:#000}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){z-index:1;position:relative}.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:"Swiss Post Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}button{font:inherit;padding:0}a,button{border-radius:4px;outline:none;outline-offset:2px}a:is(:focus-visible,:focus-within,.pretend-focus),button:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color);border-radius:4px}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){svg{color:currentColor;forced-color-adjust:preserve-parent-color}}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-none{display:none !important}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px)and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1439.98px){.hidden-xxl{display:none}}:host{--logo-scale:1}@media (max-width: 1023.98px){:host{--logo-scale:1 !important}}post-header-logo{height:var(--header-height);width:var(--header-height);-webkit-transform-origin:bottom left;transform-origin:bottom left;-webkit-transform:scale(var(--logo-scale));transform:scale(var(--logo-scale))}post-main-navigation{margin-left:calc(var(--header-height)*var(--logo-scale) - var(--header-height))}:host{display:block;position:relative;font-size:1rem;font-weight:300;z-index:var(--header-z-index, 10);--language-dropdown-margin-top:0px;--meta-header-height:var(--post-meta-header-height, 0px);--header-height:var(--post-header-height, 3.5rem)}@media (min-width: 1024px){:host{--meta-header-height:var(--post-meta-header-height, 3rem)}}@media (min-width: 1024px){:host{--header-height:var(--post-header-height, 4rem)}}@media (min-width: 1280px){:host{--header-height:var(--post-header-height, 4.5rem)}}:host([meta=false]){--meta-header-height:0px;--language-dropdown-margin-top:1px}@supports ((position: -webkit-sticky) or (position: sticky)){:host(:not(.stickyness-none)){position:-webkit-sticky;position:sticky}:host(.stickyness-full){top:0}:host(.stickyness-main){top:calc(var(--meta-header-height, 0px)*-1)}:host(.stickyness-minimal){top:calc((var(--header-height, 0px) + var(--meta-header-height, 0px) + 1px)*-1);-webkit-transition:top 200ms ease-in;transition:top 200ms ease-in}:host(.stickyness-minimal.scrolling-up),:host(.stickyness-minimal.dropdown-open){top:calc(var(--meta-header-height, 0px)*-1);--header-slide-in-transition:var(--post-header-slide-in-transition, top 200ms ease-out);-webkit-transition:var(--header-slide-in-transition);transition:var(--header-slide-in-transition)}}.post-internet-header{border-bottom:1px solid #e6e6e6;background-color:#fff}.main-navigation-container{display:-ms-flexbox;display:flex}.main-navigation-container>.main-navigation-controls{-ms-flex:0 1 auto;flex:0 1 auto}.main-navigation{display:-ms-flexbox;display:flex}.sub-navigation-container{position:absolute;top:100%;left:0;width:100%;display:-ms-flexbox;display:flex;background:#fff;visibility:hidden}.main-navigation-item:hover .sub-navigation-container{visibility:visible}.main-navigation-controls{display:-ms-flexbox;display:flex;margin-left:auto}@media (max-width: 1023.98px){.main-navigation-controls{font-weight:400}}@media (min-width: 1024px){.main-navigation-controls{font-size:1.0625rem}}.main-navigation-controls>*{border-left:1px solid #e6e6e6;-ms-flex:0 0 auto;flex:0 0 auto}.main-navigation-custom-content{max-height:var(--header-height);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-negative:1;flex-shrink:1}.menu-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 calc(1rem - 1px);font-weight:300;cursor:pointer;border-left:1px solid #e6e6e6;-ms-flex-order:1;order:1}@media (min-width: 1024px){.menu-button{display:none}}@media (min-width: 600px)and (max-width: 1023.98px){.menu-button .visually-hidden{position:static;width:auto;height:auto;margin:auto;overflow:visible;clip:auto;visibility:visible;margin-right:.5rem}}.menu-button svg{width:1.5rem;height:1.5rem}.full-width .wide-container{max-width:none}';var SwisspostInternetHeaderStyle0=postInternetHeaderCss;var PostInternetHeader=function(){function t(t){registerInstance(this,t);this.headerLoaded=createEvent(this,"headerLoaded",7);this.lastScrollTop=window.scrollY||document.documentElement.scrollTop;this.lastWindowWidth=window.innerWidth;this.handleClickOutsideBound=this.handleClickOutside.bind(this);this.project=undefined;this.stickyness="minimal";this.language=undefined;this.meta=true;this.login=true;this.search=true;this.skiplinks=true;this.configProxy=undefined;this.environment="prod";this.languageSwitchOverrides=undefined;this.customConfig=undefined;this.languageCookieKey=undefined;this.languageLocalStorageKey="swisspost-internet-header-language";this.logoutUrl=undefined;this.selfAdminOrigin=undefined;this.activeRoute="auto";this.osFlyoutOverrides=undefined;this.fullWidth=false;this.activeFlyout=null;this.activeDropdownElement=null;this.isMainSlotEmpty=true;if(this.project===undefined||this.project===""||!isValidProjectId(this.project)){throw new Error('Internet Header project key is "'.concat(this.project,'". Please provide a valid project key.'))}}t.prototype.getCurrentLanguage=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){return[2,(t=state.currentLanguage)!==null&&t!==void 0?t:"de"]}))}))};t.prototype.connectedCallback=function(){var t=this;this.throttledScroll=throttle(300,(function(){return t.handleScrollEvent()}));this.debouncedResize=debounce(200,(function(){return t.handleResize()}))};t.prototype.disconnectedCallback=function(){this.scrollParent.removeEventListener("scroll",this.throttledScroll);this.scrollParent.removeEventListener("resize",this.debouncedResize);dispose()};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n;return __generator(this,(function(o){switch(o.label){case 0:this.scrollParent=getScrollParent(this.host);this.scrollParent.addEventListener("scroll",this.throttledScroll,{passive:true});this.scrollParent.addEventListener("resize",this.debouncedResize,{passive:true});o.label=1;case 1:o.trys.push([1,3,,4]);state.projectId=this.project;state.stickyness=this.stickyness;state.environment=this.environment.toLocaleLowerCase();if(this.language!==undefined)state.currentLanguage=this.language;state.languageSwitchOverrides=typeof this.languageSwitchOverrides==="string"?JSON.parse(this.languageSwitchOverrides):this.languageSwitchOverrides;state.osFlyoutOverrides=typeof this.osFlyoutOverrides==="string"?JSON.parse(this.osFlyoutOverrides):this.osFlyoutOverrides;if(this.customConfig!==undefined){t=Object.keys(typeof this.customConfig==="string"?JSON.parse(this.customConfig):this.customConfig);e=state.currentLanguage||getUserLang(t,this.language);state.localizedCustomConfig=getLocalizedCustomConfig(this.customConfig,e)}i=state;return[4,getLocalizedConfig({projectId:this.project,environment:state.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 2:i.localizedConfig=o.sent();return[3,4];case 3:n=o.sent();console.error(n);return[3,4];case 4:return[2]}}))}))};t.prototype.componentDidLoad=function(){var t=this;window.requestAnimationFrame((function(){t.handleResize();t.headerLoaded.emit();t.host.classList.add("header-loaded");if(t.meta&&t.metaNav){t.updateLogoAnimation=registerLogoAnimationObserver(t.metaNav,t.host)}else{var e=window.getComputedStyle(document.documentElement);if(e.getPropertyValue("--post-meta-header-height")!==""){document.documentElement.style.setProperty("--post-meta-header-height","0px")}}}));if(this.stickyness==="full")console.warn('Internet Header: The stickyness="full" option is deprecated.')};t.prototype.handleLanguageChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:state.currentLanguage=t;e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:t,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();if(this.customConfig!==undefined)state.localizedCustomConfig=getLocalizedCustomConfig(this.customConfig,t);return[2]}}))}))};t.prototype.handleAvailableLanguagesChange=function(t){state.languageSwitchOverrides=typeof t==="string"?JSON.parse(t):t};t.prototype.handleOsFlyoutOverrides=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:state.osFlyoutOverrides=typeof t==="string"?JSON.parse(t):t;e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();return[2]}}))}))};t.prototype.handleActiveRouteChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:e=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:t,localizedCustomConfig:state.localizedCustomConfig,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:e.localizedConfig=i.sent();return[2]}}))}))};t.prototype.handleCustomConfigChange=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:if(this.language===undefined)return[2];e=getLocalizedCustomConfig(t,this.language);state.localizedCustomConfig=e;i=state;return[4,getLocalizedConfig({projectId:this.project,environment:this.environment,language:this.language,cookieKey:this.languageCookieKey,localStorageKey:this.languageLocalStorageKey,activeRouteProp:this.activeRoute,localizedCustomConfig:e,osFlyoutOverrides:state.osFlyoutOverrides})];case 1:i.localizedConfig=n.sent();return[2]}}))}))};t.prototype.handleSearchChange=function(t){state.search=t};t.prototype.handleLoginChange=function(t){state.login=t};t.prototype.handleMetaChange=function(t){state.meta=t};t.prototype.handleLanguageChangeEvent=function(t){void this.handleLanguageChange(t.detail)};t.prototype.handleStickynessChange=function(t){state.stickyness=t;if(typeof this.updateLogoAnimation==="function")this.updateLogoAnimation()};t.prototype.handleClickOutside=function(t){if(this.activeDropdownElement&&!t.composedPath().includes(this.activeDropdownElement)){void this.activeDropdownElement.toggleDropdown(false)}};t.prototype.handleKeyUp=function(t){if(t.key==="Escape"){if(this.activeDropdownElement){void this.activeDropdownElement.toggleDropdown(false)}if(this.activeFlyout!==null&&this.mainNav){void this.mainNav.toggleDropdown(false)}}};t.prototype.handleScrollEvent=function(){var t=this.scrollParent instanceof Document?this.scrollParent.documentElement.scrollTop:this.scrollParent.scrollTop;if(this.stickyness==="minimal"){this.host.classList.toggle("scrolling-up",t<=this.lastScrollTop)}this.lastScrollTop=t<=0?0:t};t.prototype.handleResize=function(){var t;if(this.isMainNavOpen()&&this.lastWindowWidth<1024&&window.innerWidth>=1024){(t=this.activeDropdownElement)===null||t===void 0?void 0:t.toggleDropdown(false)}this.lastWindowWidth=window.innerWidth};t.prototype.handleDropdownToggled=function(t){var e=this;if(!t.detail.open&&this.activeDropdownElement!==t.detail.element){return}if(t.detail.open){if(this.activeDropdownElement){void this.activeDropdownElement.toggleDropdown(false)}this.activeDropdownElement=t.detail.element;if(window.innerWidth>=1024){window.setTimeout((function(){window.addEventListener("click",e.handleClickOutsideBound)}),10)}if(this.activeFlyout!==null&&this.mainNav){void this.mainNav.setActiveFlyout(null)}}else{this.activeDropdownElement=null;window.removeEventListener("click",this.handleClickOutsideBound)}};t.prototype.handleFlyoutToggled=function(t){this.activeFlyout=t.detail;if(this.activeDropdownElement&&t.detail!==null&&!this.isMainNavOpen()){void this.activeDropdownElement.toggleDropdown(false)}};t.prototype.toggleMobileDropdown=function(){var t;(t=this.mainNav)===null||t===void 0?void 0:t.toggleDropdown()};t.prototype.isMainNavOpen=function(){return this.activeDropdownElement&&this.activeDropdownElement.tagName==="POST-MAIN-NAVIGATION"};t.prototype.handleMainSlotChange=function(t){var e=t.target;this.isMainSlotEmpty=e.assignedElements().length===0};t.prototype.render=function(){var t=this;var e,i,n;if(!((e=state.localizedConfig)===null||e===void 0?void 0:e.header)){console.error(new Error("Internet Header: Config cannot be loaded"));return}var o=state.localizedConfig;var r=this.meta&&o.header.navMeta!==undefined&&((i=o.header.navMeta)===null||i===void 0?void 0:i.filter((function(t){return!t.isHomeLink})).length)>0;var s=((n=this.login)!==null&&n!==void 0?n:!o.header.isLoginWidgetHidden)&&o.header.loginWidgetOptions;var a=o.header.navLang.length>1;var l=r?getLogoScale(this.host):"1";return h(Host,{class:"stickyness-".concat(this.stickyness," ").concat(Boolean(this.activeDropdownElement)||Boolean(this.activeFlyout)?"dropdown-open":""),"data-version":packageJson.version,onKeyup:function(e){return t.handleKeyUp(e)},style:{"--logo-scale":l}},h("header",{class:"post-internet-header".concat(this.fullWidth?" full-width":"")},h(SvgSprite,null),h("h1",{class:"visually-hidden"},translate("Navigate on post.ch")),h(If,{condition:this.skiplinks},h("post-skiplinks",null)),h(If,{condition:r},h("post-meta-navigation",{orientation:"horizontal",class:"hidden-lg","full-width":this.fullWidth,ref:function(e){return t.metaNav=e}},h(If,{condition:a},h("post-language-switch",{id:"post-language-switch-desktop",mode:"dropdown",onDropdownToggled:function(e){return t.handleDropdownToggled(e)}})))),h("div",{class:"main-navigation-container wide-container"},h("post-header-logo",null),h("button",{class:"menu-button nav-link",onClick:function(){return t.toggleMobileDropdown()},"aria-haspopup":"menu","aria-controls":"post-internet-header-main-navigation","aria-expanded":this.activeDropdownElement?"true":"false"},h("span",{class:"menu-button-text visually-hidden"},o.header.mobileMenu.text),h(SvgIcon,{name:this.isMainNavOpen()?"pi-close":"pi-menu"})),h("post-main-navigation",{onDropdownToggled:function(e){return t.handleDropdownToggled(e)},onFlyoutToggled:function(e){return t.handleFlyoutToggled(e)},ref:function(e){return t.mainNav=e}},h(If,{condition:r},h("post-meta-navigation",{orientation:"vertical"},h(If,{condition:a},h("post-language-switch",{id:"post-language-switch-mobile",mode:"list"}))))),h("div",{class:"main-navigation-controls"},h("div",{class:"main-navigation-custom-content".concat(this.isMainSlotEmpty?" d-none":"")},h("slot",{name:"main",onSlotchange:function(e){return t.handleMainSlotChange(e)}})),h(If,{condition:this.search},h("post-search",{onDropdownToggled:function(e){return t.handleDropdownToggled(e)}})),h(If,{condition:!!s},h("post-klp-login-widget",{"logout-url":this.logoutUrl,"self-admin-origin":this.selfAdminOrigin},h("slot",{name:"login-widget"}))),h(If,{condition:!r&&a},h("post-language-switch",{id:"post-language-switch-no-meta",onDropdownToggled:function(e){return t.handleDropdownToggled(e)},mode:"dropdown"}))))))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{language:["handleLanguageChange"],languageSwitchOverrides:["handleAvailableLanguagesChange"],osFlyoutOverrides:["handleOsFlyoutOverrides"],activeRoute:["handleActiveRouteChange"],customConfig:["handleCustomConfigChange"],search:["handleSearchChange"],login:["handleLoginChange"],meta:["handleMetaChange"],stickyness:["handleStickynessChange"]}},enumerable:false,configurable:true});return t}();PostInternetHeader.style=SwisspostInternetHeaderStyle0;export{PostInternetHeader as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as swisspost_internet_header}from"./post-internet-header-
|
|
1
|
+
export{P as swisspost_internet_header}from"./post-internet-header-6768743b.js";import"./index-bb0e68fd.js";import"./index-d3f1363d.js";import"./language.service-2960ab93.js";import"./store-629cab77.js";import"./utils-c8805f81.js";import"./svg-sprite.component-abb69a1b.js";import"./svg-icon.component-70692acc.js";import"./if.component-d88d9e48.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as PostInternetHeader}from"./p-
|
|
1
|
+
export{P as PostInternetHeader}from"./p-ccc07e33.js";export{P as PostInternetBreadcrumbs}from"./p-158715a0.js";export{P as PostInternetFooter}from"./p-6dfbb3f2.js";export{P as PostSkiplinks}from"./p-511f2bdf.js";export{P as PostMetaNavigation}from"./p-2f3fec1b.js";export{P as PostLanguageSwitch}from"./p-707faa23.js";export{P as PostLogo}from"./p-63047c81.js";export{P as PostMainNavigation}from"./p-1e791ed5.js";export{P as PostSearch}from"./p-4d24ffae.js";export{P as PostKlpLoginWidget}from"./p-cf4d8f82.js";import"./p-67f6b5a8.js";import"./p-151d419a.js";import"./p-6c4128db.js";import"./p-78d28548.js";import"./p-a39139a9.js";import"./p-fa4599e6.js";import"./p-a0313d87.js";import"./p-840aa5c6.js";import"./p-a119b38d.js";import"./p-dc2f1d20.js";
|