@oslokommune/punkt-react 15.4.6 → 16.0.0
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/CHANGELOG.md +74 -0
- package/dist/index.d.ts +38 -15
- package/dist/punkt-react.es.js +12025 -10664
- package/dist/punkt-react.umd.js +562 -549
- package/package.json +5 -5
- package/src/components/accordion/Accordion.test.tsx +3 -2
- package/src/components/alert/Alert.test.tsx +2 -1
- package/src/components/backlink/BackLink.test.tsx +2 -1
- package/src/components/button/Button.test.tsx +4 -3
- package/src/components/calendar/Calendar.interaction.test.tsx +2 -1
- package/src/components/checkbox/Checkbox.test.tsx +2 -1
- package/src/components/combobox/Combobox.accessibility.test.tsx +277 -0
- package/src/components/combobox/Combobox.core.test.tsx +469 -0
- package/src/components/combobox/Combobox.interaction.test.tsx +607 -0
- package/src/components/combobox/Combobox.selection.test.tsx +548 -0
- package/src/components/combobox/Combobox.tsx +59 -54
- package/src/components/combobox/ComboboxInput.tsx +140 -0
- package/src/components/combobox/ComboboxTags.tsx +110 -0
- package/src/components/combobox/Listbox.tsx +172 -0
- package/src/components/combobox/types.ts +145 -0
- package/src/components/combobox/useComboboxState.ts +1141 -0
- package/src/components/datepicker/Datepicker.accessibility.test.tsx +5 -4
- package/src/components/datepicker/Datepicker.input.test.tsx +3 -2
- package/src/components/datepicker/Datepicker.selection.test.tsx +8 -8
- package/src/components/datepicker/Datepicker.validation.test.tsx +2 -1
- package/src/components/radio/RadioButton.test.tsx +3 -2
- package/src/components/searchinput/SearchInput.test.tsx +6 -5
- package/src/components/tabs/Tabs.test.tsx +13 -12
- package/src/components/tag/Tag.test.tsx +2 -1
package/dist/punkt-react.umd.js
CHANGED
|
@@ -33,108 +33,108 @@
|
|
|
33
33
|
return [];
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
(function(
|
|
36
|
+
(function(H,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-router-dom"],o):(H=typeof globalThis<"u"?globalThis:H||self,o(H["punkt-react"]={},H.ReactJsxRuntime,H.React,H.ReactRouterDOM))})(this,(function(H,o,d,Yl){"use strict";var _b=Object.defineProperty;var wb=(H,o,d)=>o in H?_b(H,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):H[o]=d;var tr=(H,o,d)=>wb(H,typeof o!="symbol"?o+"":o,d);const sa=d.createContext({}),Kl=()=>d.useContext(sa),na=d.forwardRef(({compact:s=!1,skin:e="borderless",ariaLabelledBy:t,children:n,name:i,className:r},a)=>{const l=["pkt-accordion",s&&"pkt-accordion--compact",e&&`pkt-accordion--${e}`,r].filter(Boolean).join(" ");return o.jsx(sa.Provider,{value:{name:i},children:o.jsx("div",{ref:a,className:l,"data-testid":"pkt-accordion","aria-labelledby":t||void 0,children:n})})});na.displayName="PktAccordion";/**
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2018 Google LLC
|
|
39
39
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/const
|
|
40
|
+
*/const Gl=new Set(["children","localName","ref","style","className"]),ia=new WeakMap,ra=(s,e,t,n,i)=>{const r=i==null?void 0:i[e];r===void 0?(s[e]=t,t==null&&e in HTMLElement.prototype&&s.removeAttribute(e)):t!==n&&((a,l,c)=>{let p=ia.get(a);p===void 0&&ia.set(a,p=new Map);let g=p.get(l);c!==void 0?g===void 0?(p.set(l,g={handleEvent:c}),a.addEventListener(l,g)):g.handleEvent=c:g!==void 0&&(p.delete(l),a.removeEventListener(l,g))})(s,r,t)},os=({react:s,tagName:e,elementClass:t,events:n,displayName:i})=>{const r=new Set(Object.keys(n??{})),a=s.forwardRef(((l,c)=>{const p=s.useRef(new Map),g=s.useRef(null),b={},f={};for(const[k,v]of Object.entries(l))Gl.has(k)?b[k==="className"?"class":k]=v:r.has(k)||k in t.prototype?f[k]=v:b[k]=v;return s.useLayoutEffect((()=>{if(g.current===null)return;const k=new Map;for(const v in f)ra(g.current,v,l[v],p.current.get(v),n),p.current.delete(v),k.set(v,l[v]);for(const[v,$]of p.current)ra(g.current,v,void 0,$,n);p.current=k})),s.useLayoutEffect((()=>{var k;(k=g.current)==null||k.removeAttribute("defer-hydration")}),[]),b.suppressHydrationWarning=!0,s.createElement(e,{...b,ref:s.useCallback((k=>{g.current=k,typeof c=="function"?c(k):c!==null&&(c.current=k)}),[c])})}));return a.displayName=i??t.name,a};/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2017 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/const
|
|
45
|
-
\f\r]`,
|
|
46
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g")
|
|
44
|
+
*/const gi=globalThis,aa=s=>s,mi=gi.trustedTypes,oa=mi?mi.createPolicy("lit-html",{createHTML:s=>s}):void 0,la="$lit$",bs=`lit$${Math.random().toFixed(9).slice(2)}$`,ca="?"+bs,Xl=`<${ca}>`,Ms=document,Cn=()=>Ms.createComment(""),Tn=s=>s===null||typeof s!="object"&&typeof s!="function",sr=Array.isArray,Ql=s=>sr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",nr=`[
|
|
45
|
+
\f\r]`,Nn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ua=/-->/g,da=/>/g,Ds=RegExp(`>|${nr}(?:([^\\s"'>=/]+)(${nr}*=${nr}*(?:[^
|
|
46
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ha=/'/g,pa=/"/g,fa=/^(?:script|style|textarea|title)$/i,Zl=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),y=Zl(1),wt=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),ga=new WeakMap,Os=Ms.createTreeWalker(Ms,129);function ma(s,e){if(!sr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return oa!==void 0?oa.createHTML(e):e}const Jl=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":e===3?"<math>":"",a=Nn;for(let l=0;l<t;l++){const c=s[l];let p,g,b=-1,f=0;for(;f<c.length&&(a.lastIndex=f,g=a.exec(c),g!==null);)f=a.lastIndex,a===Nn?g[1]==="!--"?a=ua:g[1]!==void 0?a=da:g[2]!==void 0?(fa.test(g[2])&&(i=RegExp("</"+g[2],"g")),a=Ds):g[3]!==void 0&&(a=Ds):a===Ds?g[0]===">"?(a=i??Nn,b=-1):g[1]===void 0?b=-2:(b=a.lastIndex-g[2].length,p=g[1],a=g[3]===void 0?Ds:g[3]==='"'?pa:ha):a===pa||a===ha?a=Ds:a===ua||a===da?a=Nn:(a=Ds,i=void 0);const k=a===Ds&&s[l+1].startsWith("/>")?" ":"";r+=a===Nn?c+Xl:b>=0?(n.push(p),c.slice(0,b)+la+c.slice(b)+bs+k):c+bs+(b===-2?l:k)}return[ma(s,r+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let ir=class Wl{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const l=e.length-1,c=this.parts,[p,g]=Jl(e,t);if(this.el=Wl.createElement(p,n),Os.currentNode=this.el.content,t===2||t===3){const b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Os.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const b of i.getAttributeNames())if(b.endsWith(la)){const f=g[a++],k=i.getAttribute(b).split(bs),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:r,name:v[2],strings:k,ctor:v[1]==="."?ec:v[1]==="?"?tc:v[1]==="@"?sc:vi}),i.removeAttribute(b)}else b.startsWith(bs)&&(c.push({type:6,index:r}),i.removeAttribute(b));if(fa.test(i.tagName)){const b=i.textContent.split(bs),f=b.length-1;if(f>0){i.textContent=mi?mi.emptyScript:"";for(let k=0;k<f;k++)i.append(b[k],Cn()),Os.nextNode(),c.push({type:2,index:++r});i.append(b[f],Cn())}}}else if(i.nodeType===8)if(i.data===ca)c.push({type:2,index:r});else{let b=-1;for(;(b=i.data.indexOf(bs,b+1))!==-1;)c.push({type:7,index:r}),b+=bs.length-1}r++}}static createElement(e,t){const n=Ms.createElement("template");return n.innerHTML=e,n}};function Rs(s,e,t=s,n){var i,r;if(e===wt)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const l=Tn(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==l&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),l===void 0?a=void 0:(a=new l(s),a._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=Rs(s,a._$AS(s,e.values),a,n)),e}let Rl=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=((e==null?void 0:e.creationScope)??Ms).importNode(t,!0);Os.currentNode=i;let r=Os.nextNode(),a=0,l=0,c=n[0];for(;c!==void 0;){if(a===c.index){let p;c.type===2?p=new bi(r,r.nextSibling,this,e):c.type===1?p=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(p=new nc(r,this,e)),this._$AV.push(p),c=n[++l]}a!==(c==null?void 0:c.index)&&(r=Os.nextNode(),a++)}return Os.currentNode=Ms,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},bi=class zl{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Rs(this,e,t),Tn(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==wt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ql(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==x&&Tn(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ms.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=ir.createElement(ma(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new Rl(r,this),l=a.u(this.options);a.p(n),this.T(l),this._$AH=a}}_$AC(e){let t=ga.get(e.strings);return t===void 0&&ga.set(e.strings,t=new ir(e)),t}k(e){sr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new zl(this.O(Cn()),this.O(Cn()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e!==this._$AB;){const i=aa(e).nextSibling;aa(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},vi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}_$AI(e,t=this,n,i){const r=this.strings;let a=!1;if(r===void 0)e=Rs(this,e,t,0),a=!Tn(e)||e!==this._$AH&&e!==wt,a&&(this._$AH=e);else{const l=e;let c,p;for(e=r[0],c=0;c<r.length-1;c++)p=Rs(this,l[n+c],t,c),p===wt&&(p=this._$AH[c]),a||(a=!Tn(p)||p!==this._$AH[c]),p===x?e=x:e!==x&&(e+=(p??"")+r[c+1]),this._$AH[c]=p}a&&!i&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ec=class extends vi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}},tc=class extends vi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}},sc=class extends vi{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=Rs(this,e,t,0)??x)===wt)return;const n=this._$AH,i=e===x&&n!==x||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==x&&(n===x||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}},nc=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Rs(this,e)}};const ic={I:bi},ba=gi.litHtmlPolyfillSupport;ba==null||ba(ir,bi),(gi.litHtmlVersions??(gi.litHtmlVersions=[])).push("3.3.2");const rc=(s,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new bi(e.insertBefore(Cn(),r),r,void 0,t??{})}return i._$AI(s),i};/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2017 Google LLC
|
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/const
|
|
50
|
+
*/const ge=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2019 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
-
*/const
|
|
54
|
+
*/const ki=globalThis,rr=ki.ShadowRoot&&(ki.ShadyCSS===void 0||ki.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,va=Symbol(),ka=new WeakMap;let ac=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==va)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(rr&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=ka.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ka.set(t,e))}return e}toString(){return this.cssText}};const oc=s=>new ac(typeof s=="string"?s:s+"",void 0,va),lc=(s,e)=>{if(rr)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=ki.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,s.appendChild(n)}},ya=rr?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return oc(t)})(s):s;/**
|
|
55
55
|
* @license
|
|
56
56
|
* Copyright 2017 Google LLC
|
|
57
57
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
58
|
-
*/const{is:
|
|
58
|
+
*/const{is:cc,defineProperty:uc,getOwnPropertyDescriptor:dc,getOwnPropertyNames:hc,getOwnPropertySymbols:pc,getPrototypeOf:fc}=Object,en=globalThis,_a=en.trustedTypes,gc=_a?_a.emptyScript:"",wa=en.reactiveElementPolyfillSupport,Mn=(s,e)=>s,yi={toAttribute(s,e){switch(e){case Boolean:s=s?gc:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},ar=(s,e)=>!cc(s,e),$a={attribute:!0,type:String,converter:yi,reflect:!1,useDefault:!1,hasChanged:ar};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),en.litPropertyMetadata??(en.litPropertyMetadata=new WeakMap);let tn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$a){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&uc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=dc(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const l=i==null?void 0:i.call(this);r==null||r.call(this,a),this.requestUpdate(e,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$a}static _$Ei(){if(this.hasOwnProperty(Mn("elementProperties")))return;const e=fc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Mn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Mn("properties"))){const t=this.properties,n=[...hc(t),...pc(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(ya(i))}else e!==void 0&&t.push(ya(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return lc(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:yi).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var n,i;const r=this.constructor,a=r._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const l=r.getPropertyOptions(a),c=typeof l.converter=="function"?{fromAttribute:l.converter}:((n=l.converter)==null?void 0:n.fromAttribute)!==void 0?l.converter:yi;this._$Em=a;const p=c.fromAttribute(t,l.type);this[a]=p??((i=this._$Ej)==null?void 0:i.get(a))??p,this._$Em=null}}requestUpdate(e,t,n,i=!1,r){var a;if(e!==void 0){const l=this.constructor;if(i===!1&&(r=this[e]),n??(n=l.getPropertyOptions(e)),!((n.hasChanged??ar)(r,t)||n.useDefault&&n.reflect&&r===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(l._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},a){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),r!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,a]of this._$Ep)this[r]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,a]of i){const{wrapped:l}=a,c=this[r];l!==!0||this._$AL.has(r)||c===void 0||this.C(r,void 0,a,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(n)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};tn.elementStyles=[],tn.shadowRootOptions={mode:"open"},tn[Mn("elementProperties")]=new Map,tn[Mn("finalized")]=new Map,wa==null||wa({ReactiveElement:tn}),(en.reactiveElementVersions??(en.reactiveElementVersions=[])).push("2.1.2");/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright 2017 Google LLC
|
|
61
61
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
-
*/const
|
|
62
|
+
*/const mc={attribute:!0,type:String,converter:yi,reflect:!1,hasChanged:ar},bc=(s=mc,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((s=Object.create(s)).wrapped=!0),r.set(t.name,s),n==="accessor"){const{name:a}=t;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(a,c,s,!0,l)},init(l){return l!==void 0&&this.C(a,void 0,s,l),l}}}if(n==="setter"){const{name:a}=t;return function(l){const c=this[a];e.call(this,l),this.requestUpdate(a,c,s,!0,l)}}throw Error("Unsupported decorator location: "+n)};function u(s){return(e,t)=>typeof t=="object"?bc(s,e,t):((n,i,r)=>{const a=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),a?Object.getOwnPropertyDescriptor(i,r):void 0})(s,e,t)}/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright 2017 Google LLC
|
|
65
65
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
-
*/const
|
|
66
|
+
*/const Dn=globalThis;let sn=class extends tn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rc(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return wt}};var xa;sn._$litElement$=!0,sn.finalized=!0,(xa=Dn.litElementHydrateSupport)==null||xa.call(Dn,{LitElement:sn});const Sa=Dn.litElementPolyfillSupport;Sa==null||Sa({LitElement:sn}),(Dn.litElementVersions??(Dn.litElementVersions=[])).push("4.2.2");const vc={hi:"Hei!"},kc={from:"Fra",to:"Til"},yc={buttonAltText:"Åpne kalender",deleteDate:"Fjern dato"},_c={month:"Måned",year:"År",days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"},wc={search:{placeholder:"Søk…"},labels:{optional:"Valgfritt",required:"Må fylles ut"},messages:{required:"Dette feltet er påkrevd",invalid:"Ugyldig verdi",invalidPattern:"Ugyldig format",tooShort:"For kort",tooLong:"For lang",rangeUnderflow:"For lav verdi",rangeOverflow:"For høy verdi",rangeUnderflowMin:"Verdien må være større enn eller lik {min}.",rangeOverflowMax:"Verdien må være mindre enn eller lik {max}.",dateUnderflow:"For tidlig dato",dateOverflow:"For sen dato"},helptext:{helptextDropdownButton:"Les mer"},date:{multiple:"Her kan du velge flere datoer. Trykk komma eller enter når du har skrevet inn en dato."}},$t={example:vc,generic:kc,calendar:yc,dates:_c,forms:wc};var $c=Object.defineProperty,Ca=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&$c(e,t,i),i};let _i=class extends sn{constructor(){super(...arguments),this.strings=$t,this.role=null}hotReplacedCallback(){this.requestUpdate()}};Ca([u({type:Object})],_i.prototype,"strings"),Ca([u({type:String})],_i.prototype,"role");let Oe=class extends _i{createRenderRoot(){return this}};/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2017 Google LLC
|
|
69
69
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/const
|
|
70
|
+
*/const Ht={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},Es=s=>(...e)=>({_$litDirective$:s,values:e});let nn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
|
|
71
71
|
* @license
|
|
72
72
|
* Copyright 2018 Google LLC
|
|
73
73
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
74
|
-
*/const
|
|
74
|
+
*/const z=Es(class extends nn{constructor(s){var e;if(super(s),s.type!==Ht.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var t,n;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in e)e[r]&&!((t=this.nt)!=null&&t.has(r))&&this.st.add(r);return this.render(e)}const i=s.element.classList;for(const r of this.st)r in e||(i.remove(r),this.st.delete(r));for(const r in e){const a=!!e[r];a===this.st.has(r)||(n=this.nt)!=null&&n.has(r)||(a?(i.add(r),this.st.add(r)):(i.remove(r),this.st.delete(r)))}return wt}});/**
|
|
75
75
|
* @license
|
|
76
76
|
* Copyright 2017 Google LLC
|
|
77
77
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
78
|
-
*/function
|
|
78
|
+
*/function ce(s){return u({...s,state:!0,attribute:!1})}function Ta(s,e){return e.some(t=>t.value===s)}function On(s){return s.classList&&(s.classList.contains("_dialog_overlay")||s.classList.contains("backdrop"))?!0:typeof s.hasAttribute=="function"&&s.hasAttribute("data-skip")}function rn(s){return s.nodeName==="OPTION"||s.nodeName==="DATA"}function xc(s,e){return s.nodeType===Node.ELEMENT_NODE&&!Ta(s,e)}function or(s){var e;return s.nodeType===Node.TEXT_NODE&&((e=s.nodeValue)==null?void 0:e.trim())!==""}let Qe=class{constructor(e,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.needsSlotUpdate=!0,this.host=e,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(n=>{this.handleMutations(n),this.handleSlotMutations(n)})}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0,subtree:!0})}hostDisconnected(){this.observer.disconnect()}hostUpdated(){this.needsSlotUpdate&&(this.needsSlotUpdate=!1,this.updateSlots())}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(e=>{On(e)||rn(e)&&this.skipOptions||(!Ta(e,this.slots)||or(e))&&this.nodes.push(e)})}updateSlots(){if(this.updatingSlots)return;this.updatingSlots=!0;const e=new Set;this.slots.forEach(t=>{if(!t.value)return;const n=t.value.getAttribute("name");Array.from(t.value.childNodes).some(r=>{var a,l;if(r.nodeType===Node.COMMENT_NODE)return!1;if(r.nodeType===Node.TEXT_NODE)return!!((a=r.textContent)!=null&&a.trim());if(r.nodeType===Node.ELEMENT_NODE){if(On(r))return!1;if((l=r.textContent)!=null&&l.trim())return!0}return!1})&&e.add(n);const i=this.nodes.flatMap(r=>or(r)||r.getAttribute&&r.getAttribute("slot")==n&&!On(r)?r:[]).filter(r=>t.value&&!t.value.contains(r)&&!r.contains(t.value));if(i.length>0)if(typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...i)}else t.value.replaceChildren(...i)}),(this.filledSlots.size!==e.size||![...this.filledSlots].every(t=>e.has(t)))&&(this.filledSlots=e,typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)),this.updatingSlots=!1}handleMutations(e){let t=!1;e.forEach(n=>{n.type!=="childList"||n.target!==this.host||(n.addedNodes.forEach(i=>{On(i)||rn(i)&&this.skipOptions||(xc(i,this.slots)||or(i))&&(this.nodes.push(i),t=!0)}),n.removedNodes.forEach(i=>{On(i)||rn(i)&&this.skipOptions||(this.nodes=this.nodes.filter(r=>r!==i),t=!0)}))}),t&&(this.needsSlotUpdate=!0,this.updateSlots())}handleSlotMutations(e){let t=!1;e.forEach(n=>{const i=n.target.parentElement;if(i!=null&&i.hasAttribute("slot")){const r=i.getAttribute("slot"),a=i.hasChildNodes();a&&!this.filledSlots.has(r)?(this.filledSlots.add(r),t=!0):!a&&this.filledSlots.has(r)&&(this.filledSlots.delete(r),t=!0)}}),t&&typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)}};/**
|
|
79
79
|
* @license
|
|
80
80
|
* Copyright 2020 Google LLC
|
|
81
81
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
|
-
*/const{I:
|
|
82
|
+
*/const{I:Sc}=ic,Na=s=>s,Ma=s=>s.strings===void 0,Da=()=>document.createComment(""),En=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=i.insertBefore(Da(),r),l=i.insertBefore(Da(),r);t=new Sc(a,l,s,s.options)}else{const a=t._$AB.nextSibling,l=t._$AM,c=l!==s;if(c){let p;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(p=s._$AU)!==l._$AU&&t._$AP(p)}if(a!==r||c){let p=t._$AA;for(;p!==a;){const g=Na(p).nextSibling;Na(i).insertBefore(p,r),p=g}}}return t},Ps=(s,e,t=s)=>(s._$AI(e,t),s),Cc={},Oa=(s,e=Cc)=>s._$AH=e,Tc=s=>s._$AH,lr=s=>{s._$AR(),s._$AA.remove()};/**
|
|
83
83
|
* @license
|
|
84
84
|
* Copyright 2017 Google LLC
|
|
85
85
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
86
|
-
*/const
|
|
86
|
+
*/const Pn=(s,e)=>{var t;const n=s._$AN;if(n===void 0)return!1;for(const i of n)(t=i._$AO)==null||t.call(i,e,!1),Pn(i,e);return!0},wi=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},Ea=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),Dc(e)}};function Nc(s){this._$AN!==void 0?(wi(this),this._$AM=s,Ea(this)):this._$AM=s}function Mc(s,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let r=t;r<n.length;r++)Pn(n[r],!1),wi(n[r]);else n!=null&&(Pn(n,!1),wi(n));else Pn(this,s)}const Dc=s=>{s.type==Ht.CHILD&&(s._$AP??(s._$AP=Mc),s._$AQ??(s._$AQ=Nc))};let Oc=class extends nn{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Ea(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)==null||n.call(this):(i=this.disconnected)==null||i.call(this)),t&&(Pn(this,e),wi(this))}setValue(e){if(Ma(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};/**
|
|
87
87
|
* @license
|
|
88
88
|
* Copyright 2020 Google LLC
|
|
89
89
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
|
-
*/const
|
|
90
|
+
*/const Z=()=>new Ec;let Ec=class{};const cr=new WeakMap,X=Es(class extends Oc{render(s){return x}update(s,[e]){var t;const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=(t=s.options)==null?void 0:t.host,this.rt(this.ct=s.element)),x}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=cr.get(e);t===void 0&&(t=new WeakMap,cr.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){var s,e;return typeof this.G=="function"?(s=cr.get(this.ht??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Pa(s,e,t){const n=s.getAttribute("class")||"",i=new Set(n.split(/\s+/).filter(Boolean));t?i.add(e):i.delete(e),s.setAttribute("class",Array.from(i).join(" "))}/**
|
|
91
91
|
* @license
|
|
92
92
|
* Copyright 2017 Google LLC
|
|
93
93
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
94
|
-
*/let
|
|
94
|
+
*/let $i=class extends nn{constructor(e){if(super(e),this.it=x,e.type!==Ht.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===x||e==null)return this._t=void 0,this.it=e;if(e===wt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};$i.directiveName="unsafeHTML",$i.resultType=1;const xi=Es($i);/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2017 Google LLC
|
|
97
97
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
|
-
*/let
|
|
98
|
+
*/let ur=class extends $i{};ur.directiveName="unsafeSVG",ur.resultType=2;const dr=Es(ur);var Pc=Object.defineProperty,Ac=Object.getOwnPropertyDescriptor,An=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ac(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Pc(e,t,i),i};const hr="https://punkt-cdn.oslo.kommune.no/16.0/icons/";typeof window<"u"&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||hr);const In='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',Ln={},Ic=2,Lc=1500,Aa=typeof Storage<"u"&&typeof sessionStorage<"u",Bc=s=>window.pktFetch(s).then(e=>{if(!e.ok)throw new Error("Missing icon: "+s);return e.text()}),Ia=async(s,e=Ic)=>{try{return await Bc(s)}catch{return e>0?(await new Promise(t=>setTimeout(t,Lc)),Ia(s,e-1)):(console.error("Failed to fetch icon: "+s),In)}},Fc=async(s,e)=>{const t=e+s+".svg";return Aa&&sessionStorage.getItem(t)?sessionStorage.getItem(t):t in Ln?Ln[t]:typeof window<"u"&&typeof window.pktFetch=="function"?(Ln[t]=Ia(t).then(n=>(n!==In&&Aa&&sessionStorage.setItem(t,n),delete Ln[t],n)),Ln[t]):In};let As=class extends Oe{constructor(){super(...arguments),this.path=typeof window<"u"?window.pktIconPath:hr,this.name="",this.icon=dr(In),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e==="name"||e==="path")&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has("name")||e.has("path"))&&this.getIcon(this.name)}async getIcon(e=""){if(this._updatedProps.length>0){this.path||(this.path=typeof window<"u"?window.pktIconPath:hr);try{this.icon=dr(await Fc(this.name||"",this.path))}catch{this.icon=dr(In)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return y`${this.name&&this.icon}`}};An([u({type:String,reflect:!1})],As.prototype,"path",2),An([u({type:String,reflect:!0})],As.prototype,"name",2),An([u({type:SVGElement})],As.prototype,"icon",2),An([u({type:Array,noAccessor:!0})],As.prototype,"_updatedProps",2),As=An([ge("pkt-icon")],As);/**
|
|
99
99
|
* @license
|
|
100
100
|
* Copyright 2018 Google LLC
|
|
101
101
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
102
|
-
*/const
|
|
102
|
+
*/const A=s=>s??x;var Vc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,ut=(s,e,t,n)=>{for(var i=n>1?void 0:n?Uc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vc(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let rt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="disabled"&&n==="false"&&(this.disabled=!1),(e==="isloading"||e==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(e){super.firstUpdated(e),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const e=this.form??this.getAttribute("form")??void 0,t={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return y`
|
|
103
103
|
<button
|
|
104
|
-
class=${
|
|
104
|
+
class=${z(t)}
|
|
105
105
|
type=${this.type}
|
|
106
106
|
?disabled=${!!this.disabled}
|
|
107
|
-
aria-busy=${
|
|
108
|
-
aria-disabled=${
|
|
109
|
-
form=${
|
|
107
|
+
aria-busy=${A(this.isLoading?"true":void 0)}
|
|
108
|
+
aria-disabled=${A(this.disabled||this.isLoading?"true":void 0)}
|
|
109
|
+
form=${A(e)}
|
|
110
110
|
>
|
|
111
|
-
${this.isLoading?
|
|
111
|
+
${this.isLoading?y`<pkt-icon
|
|
112
112
|
class="pkt-btn__icon pkt-btn__spinner"
|
|
113
113
|
name="spinner-blue"
|
|
114
|
-
path=${
|
|
115
|
-
></pkt-icon>`:
|
|
116
|
-
${this.variant!=="label-only"?
|
|
114
|
+
path=${A(this.loadingAnimationPath)}
|
|
115
|
+
></pkt-icon>`:x}
|
|
116
|
+
${this.variant!=="label-only"?y`<pkt-icon
|
|
117
117
|
class="pkt-btn__icon pkt-icon"
|
|
118
118
|
name=${this.iconName}
|
|
119
|
-
path=${
|
|
120
|
-
></pkt-icon>`:
|
|
121
|
-
<span class="pkt-btn__text" ${
|
|
122
|
-
${this.variant==="icons-right-and-left"?
|
|
119
|
+
path=${A(this.iconPath)}
|
|
120
|
+
></pkt-icon>`:x}
|
|
121
|
+
<span class="pkt-btn__text" ${X(this.defaultSlot)}></span>
|
|
122
|
+
${this.variant==="icons-right-and-left"?y`<pkt-icon
|
|
123
123
|
class="pkt-btn__icon"
|
|
124
124
|
name=${this.secondIconName}
|
|
125
|
-
path=${
|
|
126
|
-
></pkt-icon>`:
|
|
125
|
+
path=${A(this.secondIconPath)}
|
|
126
|
+
></pkt-icon>`:x}
|
|
127
127
|
</button>
|
|
128
|
-
`}};
|
|
129
|
-
<div class=${
|
|
130
|
-
<div class=${
|
|
128
|
+
`}};ut([u({type:String})],rt.prototype,"iconName",2),ut([u({type:String})],rt.prototype,"secondIconName",2),ut([u({type:String})],rt.prototype,"iconPath",2),ut([u({type:String})],rt.prototype,"secondIconPath",2),ut([u({type:String})],rt.prototype,"mode",2),ut([u({type:String})],rt.prototype,"size",2),ut([u({type:Boolean,attribute:"full-width"})],rt.prototype,"fullWidth",2),ut([u({type:Boolean,attribute:"full-width-on-mobile"})],rt.prototype,"fullWidthOnMobile",2),ut([u({type:String})],rt.prototype,"color",2),ut([u({type:String})],rt.prototype,"skin",2),ut([u({type:String})],rt.prototype,"variant",2),ut([u({type:String,reflect:!0})],rt.prototype,"state",2),ut([u({type:String,reflect:!0})],rt.prototype,"type",2),ut([u({type:String})],rt.prototype,"form",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"isLoading",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"disabled",2),ut([u({type:String})],rt.prototype,"loadingAnimationPath",2),rt=ut([ge("pkt-button")],rt);const Hc={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},Si={props:Hc};var jc=Object.defineProperty,qc=Object.getOwnPropertyDescriptor,Qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?qc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&jc(e,t,i),i};let jt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.compact=Si.props.compact.default,this.title="",this.skin=Si.props.skin.default,this.ariaLive=Si.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=Si.props.closeAlert.default,this.date=null,this.role="status",this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,t,n){e==="ariaLive"&&(this["aria-live"]=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},t={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return y`
|
|
129
|
+
<div class=${z(e)} aria-live=${this["aria-live"]}>
|
|
130
|
+
<div class=${z(t)}>
|
|
131
131
|
<pkt-icon
|
|
132
132
|
class="pkt-alert__icon"
|
|
133
133
|
aria-hidden="true"
|
|
134
134
|
name=${this.skin==="info"?"alert-information":`alert-${this.skin}`}
|
|
135
135
|
></pkt-icon>
|
|
136
136
|
|
|
137
|
-
${this.closeAlert?
|
|
137
|
+
${this.closeAlert?y`
|
|
138
138
|
<div class="pkt-alert__close">
|
|
139
139
|
<pkt-button
|
|
140
140
|
tabindex="0"
|
|
@@ -149,30 +149,30 @@
|
|
|
149
149
|
<span class="sr-only">Lukk</span>
|
|
150
150
|
</pkt-button>
|
|
151
151
|
</div>
|
|
152
|
-
`:
|
|
153
|
-
${this.title?
|
|
152
|
+
`:x}
|
|
153
|
+
${this.title?y`<div class="pkt-alert__title">${this.title}</div>`:x}
|
|
154
154
|
|
|
155
|
-
<div class="pkt-alert__text" ${
|
|
155
|
+
<div class="pkt-alert__text" ${X(this.defaultSlot)}></div>
|
|
156
156
|
|
|
157
|
-
${this.date?
|
|
157
|
+
${this.date?y`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:x}
|
|
158
158
|
</div>
|
|
159
159
|
</div>
|
|
160
|
-
`}};
|
|
160
|
+
`}};Qt([u({type:Boolean,reflect:!1})],jt.prototype,"compact",2),Qt([u({type:String,reflect:!0})],jt.prototype,"title",2),Qt([u({type:String,reflect:!0})],jt.prototype,"skin",2),Qt([u({type:String})],jt.prototype,"ariaLive",2),Qt([u({type:String,reflect:!0})],jt.prototype,"aria-live",2),Qt([u({type:Boolean,reflect:!0})],jt.prototype,"closeAlert",2),Qt([u({type:String,reflect:!0})],jt.prototype,"date",2),Qt([u({type:String,reflect:!0})],jt.prototype,"role",2),Qt([ce()],jt.prototype,"_isClosed",2),jt=Qt([ge("pkt-alert")],jt);var Wc=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,Bn=(s,e,t,n)=>{for(var i=n>1?void 0:n?zc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wc(e,t,i),i};let an=class extends sn{constructor(){super(...arguments),this.ariaLabelledBy="",this.compact=!1,this.skin="borderless",this.name=""}updated(e){e.has("skin")&&this.requestUpdate(),e.has("name")&&this.updateAccordionItemNames()}updateAccordionItemNames(){var e;if(this.name){const t=(e=this.renderRoot)==null?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(n=>{n.tagName.toLowerCase()==="pkt-accordion-item"&&(n.hasAttribute("name")||n.setAttribute("name",this.name))})}}firstUpdated(){var e;const t=(e=this.renderRoot)==null?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",()=>{this.updateAccordionItemNames()})}render(){const e={"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin};return y`
|
|
161
161
|
<div
|
|
162
162
|
part="container"
|
|
163
|
-
class=${
|
|
163
|
+
class=${z(e)}
|
|
164
164
|
data-testid="pkt-accordion"
|
|
165
165
|
aria-labelledby=${this.ariaLabelledBy}
|
|
166
166
|
>
|
|
167
167
|
<slot></slot>
|
|
168
168
|
</div>
|
|
169
|
-
`}};
|
|
169
|
+
`}};Bn([u({type:String,reflect:!0,attribute:"aria-labelledby"})],an.prototype,"ariaLabelledBy",2),Bn([u({type:Boolean,reflect:!0,attribute:"compact"})],an.prototype,"compact",2),Bn([u({type:String,reflect:!0,attribute:"skin"})],an.prototype,"skin",2),Bn([u({type:String,reflect:!0,attribute:"name"})],an.prototype,"name",2),an=Bn([ge("pkt-accordion")],an);var Yc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Is=(s,e,t,n)=>{for(var i=n>1?void 0:n?Kc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Yc(e,t,i),i};let vs=class extends Oe{constructor(){super(),this.defaultOpen=!1,this.title="",this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=Z(),this.defaultSlot=Z(),this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){this.defaultOpen&&(this.isOpen=!0)}render(){const e={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin};return y`
|
|
170
170
|
<details
|
|
171
|
-
class=${
|
|
171
|
+
class=${z(e)}
|
|
172
172
|
id=${this.id}
|
|
173
173
|
?open=${this.isOpen}
|
|
174
|
-
${
|
|
175
|
-
name=${
|
|
174
|
+
${X(this.accordionItemRef)}
|
|
175
|
+
name=${A(this.name)}
|
|
176
176
|
>
|
|
177
177
|
<summary class="pkt-accordion-item__title" id=${`pkt-accordion-item-summary-${this.id}`}>
|
|
178
178
|
${this.title}
|
|
@@ -187,14 +187,14 @@
|
|
|
187
187
|
id="pkt-accordion-item__content-${this.id}"
|
|
188
188
|
role="region"
|
|
189
189
|
>
|
|
190
|
-
<div class="pkt-accordion-item__content-inner" ${
|
|
190
|
+
<div class="pkt-accordion-item__content-inner" ${X(this.defaultSlot)}></div>
|
|
191
191
|
</div>
|
|
192
192
|
</details>
|
|
193
|
-
`}};
|
|
193
|
+
`}};Is([u({type:Boolean})],vs.prototype,"defaultOpen",2),Is([u({type:String})],vs.prototype,"title",2),Is([u({type:String,reflect:!0})],vs.prototype,"skin",2),Is([u({type:Boolean,reflect:!0})],vs.prototype,"compact",2),Is([u({type:Boolean,reflect:!0})],vs.prototype,"isOpen",2),Is([u({type:String,reflect:!0})],vs.prototype,"name",2),vs=Is([ge("pkt-accordion-item")],vs);var Gc=Object.defineProperty,Xc=Object.getOwnPropertyDescriptor,Ci=(s,e,t,n)=>{for(var i=n>1?void 0:n?Xc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Gc(e,t,i),i};let on=class extends Oe{constructor(){super(...arguments),this.href="",this.text="Forsiden",this.ariaLabel=""}attributeChangedCallback(e,t,n){e==="arialabel"&&this.removeAttribute("arialabel"),e==="href"&&this.removeAttribute("href"),e==="text"&&this.removeAttribute("text"),super.attributeChangedCallback(e,t,n)}render(){return y`<nav
|
|
194
194
|
class="pkt-back-link"
|
|
195
195
|
aria-label=${this.ariaLabel||"Gå tilbake til forrige side"}
|
|
196
196
|
>
|
|
197
|
-
<a href=${
|
|
197
|
+
<a href=${A(this.href||"/")} class="pkt-link pkt-link--icon-left"
|
|
198
198
|
><pkt-icon
|
|
199
199
|
class="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
200
200
|
name="chevron-thin-left"
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
></pkt-icon
|
|
203
203
|
><span class="pkt-back-link__text">${this.text}</span></a
|
|
204
204
|
>
|
|
205
|
-
</nav>`}};Qi([c({type:String})],Hs.prototype,"href",2),Qi([c({type:String})],Hs.prototype,"text",2),Qi([c({type:String})],Hs.prototype,"ariaLabel",2),Hs=Qi([ee("pkt-backlink")],Hs);const Yr=6048e5,Ql=864e5,Kr=Symbol.for("constructDateFrom");function Bt(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Kr in s?s[Kr](e):s instanceof Date?new s.constructor(e):new Date(e)}function $t(s,e){return Bt(e||s,s)}function Gr(s,e,t){const i=$t(s,void 0);return isNaN(e)?Bt(s,NaN):(e&&i.setDate(i.getDate()+e),i)}let Zl={};function Zi(){return Zl}function fi(s,e){var t,i,n,r;const a=Zi(),l=(e==null?void 0:e.weekStartsOn)??((i=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:i.weekStartsOn)??a.weekStartsOn??((r=(n=a.locale)==null?void 0:n.options)==null?void 0:r.weekStartsOn)??0,d=$t(s,e==null?void 0:e.in),p=d.getDay(),m=(p<l?7:0)+p-l;return d.setDate(d.getDate()-m),d.setHours(0,0,0,0),d}function Ji(s,e){return fi(s,{...e,weekStartsOn:1})}function Xr(s,e){const t=$t(s,void 0),i=t.getFullYear(),n=Bt(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const r=Ji(n),a=Bt(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=Ji(a);return t.getTime()>=r.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function Qr(s){const e=$t(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Zr(s,...e){const t=Bt.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function Jr(s,e){const t=$t(s,void 0);return t.setHours(0,0,0,0),t}function Jl(s,e,t){const[i,n]=Zr(void 0,s,e),r=Jr(i),a=Jr(n),l=+r-Qr(r),d=+a-Qr(a);return Math.round((l-d)/Ql)}function Rl(s,e){const t=Xr(s),i=Bt(s,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),Ji(i)}function ec(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function tc(s){return!(!ec(s)&&typeof s!="number"||isNaN(+$t(s)))}function sc(s,e){const[t,i]=Zr(s,e.start,e.end);return{start:t,end:i}}function Rr(s,e){const{start:t,end:i}=sc(void 0,s);let n=+t>+i;const r=n?+t:+i,a=n?i:t;a.setHours(0,0,0,0);let l=1;const d=[];for(;+a<=r;)d.push(Bt(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return n?d.reverse():d}function ic(s,e){const t=$t(s,void 0);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const nc={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rc=(s,e,t)=>{let i;const n=nc[s];return typeof n=="string"?i=n:e===1?i=n.one:i=n.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function On(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ac={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},oc={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},lc={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},cc={date:On({formats:ac,defaultWidth:"full"}),time:On({formats:oc,defaultWidth:"full"}),dateTime:On({formats:lc,defaultWidth:"full"})},dc={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},uc=(s,e,t,i)=>dc[s];function mi(s){return(e,t)=>{const i=t!=null&&t.context?String(t.context):"standalone";let n;if(i==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;n=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;n=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return n[r]}}const hc={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},pc={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},fc={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},mc={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},gc={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},vc={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},bc=(s,e)=>{const t=Number(s),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},yc={ordinalNumber:bc,era:mi({values:hc,defaultWidth:"wide"}),quarter:mi({values:pc,defaultWidth:"wide",argumentCallback:s=>s-1}),month:mi({values:fc,defaultWidth:"wide"}),day:mi({values:mc,defaultWidth:"wide"}),dayPeriod:mi({values:gc,defaultWidth:"wide",formattingValues:vc,defaultFormattingWidth:"wide"})};function gi(s){return(e,t={})=>{const i=t.width,n=i&&s.matchPatterns[i]||s.matchPatterns[s.defaultMatchWidth],r=e.match(n);if(!r)return null;const a=r[0],l=i&&s.parsePatterns[i]||s.parsePatterns[s.defaultParseWidth],d=Array.isArray(l)?_c(l,b=>b.test(a)):kc(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(d):d,p=t.valueCallback?t.valueCallback(p):p;const m=e.slice(a.length);return{value:p,rest:m}}}function kc(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function _c(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function $c(s){return(e,t={})=>{const i=e.match(s.matchPattern);if(!i)return null;const n=i[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(n.length);return{value:a,rest:l}}}const wc=/^(\d+)(th|st|nd|rd)?/i,xc=/\d+/i,Sc={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Cc={any:[/^b/i,/^(a|c)/i]},Tc={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Nc={any:[/1/i,/2/i,/3/i,/4/i]},Mc={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Dc={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Oc={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ec={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Pc={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ac={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ic={ordinalNumber:$c({matchPattern:wc,parsePattern:xc,valueCallback:s=>parseInt(s,10)}),era:gi({matchPatterns:Sc,defaultMatchWidth:"wide",parsePatterns:Cc,defaultParseWidth:"any"}),quarter:gi({matchPatterns:Tc,defaultMatchWidth:"wide",parsePatterns:Nc,defaultParseWidth:"any",valueCallback:s=>s+1}),month:gi({matchPatterns:Mc,defaultMatchWidth:"wide",parsePatterns:Dc,defaultParseWidth:"any"}),day:gi({matchPatterns:Oc,defaultMatchWidth:"wide",parsePatterns:Ec,defaultParseWidth:"any"}),dayPeriod:gi({matchPatterns:Pc,defaultMatchWidth:"any",parsePatterns:Ac,defaultParseWidth:"any"})},Lc={code:"en-US",formatDistance:rc,formatLong:cc,formatRelative:uc,localize:yc,match:Ic,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Bc(s,e){const t=$t(s,void 0);return Jl(t,ic(t))+1}function Fc(s,e){const t=$t(s,void 0),i=+Ji(t)-+Rl(t);return Math.round(i/Yr)+1}function ea(s,e){var t,i,n,r;const a=$t(s,e==null?void 0:e.in),l=a.getFullYear(),d=Zi(),p=(e==null?void 0:e.firstWeekContainsDate)??((i=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:i.firstWeekContainsDate)??d.firstWeekContainsDate??((r=(n=d.locale)==null?void 0:n.options)==null?void 0:r.firstWeekContainsDate)??1,m=Bt((e==null?void 0:e.in)||s,0);m.setFullYear(l+1,0,p),m.setHours(0,0,0,0);const b=fi(m,e),y=Bt((e==null?void 0:e.in)||s,0);y.setFullYear(l,0,p),y.setHours(0,0,0,0);const k=fi(y,e);return+a>=+b?l+1:+a>=+k?l:l-1}function Hc(s,e){var t,i,n,r;const a=Zi(),l=(e==null?void 0:e.firstWeekContainsDate)??((i=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:i.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(n=a.locale)==null?void 0:n.options)==null?void 0:r.firstWeekContainsDate)??1,d=ea(s,e),p=Bt((e==null?void 0:e.in)||s,0);return p.setFullYear(d,0,l),p.setHours(0,0,0,0),fi(p,e)}function ta(s,e){const t=$t(s,e==null?void 0:e.in),i=+fi(t,e)-+Hc(t,e);return Math.round(i/Yr)+1}function me(s,e){const t=s<0?"-":"",i=Math.abs(s).toString().padStart(e,"0");return t+i}const es={y(s,e){const t=s.getFullYear(),i=t>0?t:1-t;return me(e==="yy"?i%100:i,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):me(t+1,2)},d(s,e){return me(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return me(s.getHours()%12||12,e.length)},H(s,e){return me(s.getHours(),e.length)},m(s,e){return me(s.getMinutes(),e.length)},s(s,e){return me(s.getSeconds(),e.length)},S(s,e){const t=e.length,i=s.getMilliseconds(),n=Math.trunc(i*Math.pow(10,t-3));return me(n,e.length)}},Vs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sa={G:function(s,e,t){const i=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});case"GGGG":default:return t.era(i,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const i=s.getFullYear(),n=i>0?i:1-i;return t.ordinalNumber(n,{unit:"year"})}return es.y(s,e)},Y:function(s,e,t,i){const n=ea(s,i),r=n>0?n:1-n;if(e==="YY"){const a=r%100;return me(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):me(r,e.length)},R:function(s,e){const t=Xr(s);return me(t,e.length)},u:function(s,e){const t=s.getFullYear();return me(t,e.length)},Q:function(s,e,t){const i=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return me(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(s,e,t){const i=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return me(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(s,e,t){const i=s.getMonth();switch(e){case"M":case"MM":return es.M(s,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(s,e,t){const i=s.getMonth();switch(e){case"L":return String(i+1);case"LL":return me(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(s,e,t,i){const n=ta(s,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):me(n,e.length)},I:function(s,e,t){const i=Fc(s);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):me(i,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):es.d(s,e)},D:function(s,e,t){const i=Bc(s);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):me(i,e.length)},E:function(s,e,t){const i=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});case"EEEE":default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(s,e,t,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return me(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});case"eeee":default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(s,e,t,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return me(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});case"cccc":default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(s,e,t){const i=s.getDay(),n=i===0?7:i;switch(e){case"i":return String(n);case"ii":return me(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});case"iiii":default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const i=s.getHours();let n;switch(i===12?n=Vs.noon:i===0?n=Vs.midnight:n=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(s,e,t){const i=s.getHours();let n;switch(i>=17?n=Vs.evening:i>=12?n=Vs.afternoon:i>=4?n=Vs.morning:n=Vs.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let i=s.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return es.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):es.H(s,e)},K:function(s,e,t){const i=s.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):me(i,e.length)},k:function(s,e,t){let i=s.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):me(i,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):es.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):es.s(s,e)},S:function(s,e){return es.S(s,e)},X:function(s,e,t){const i=s.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return na(i);case"XXXX":case"XX":return vs(i);case"XXXXX":case"XXX":default:return vs(i,":")}},x:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"x":return na(i);case"xxxx":case"xx":return vs(i);case"xxxxx":case"xxx":default:return vs(i,":")}},O:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+ia(i,":");case"OOOO":default:return"GMT"+vs(i,":")}},z:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+ia(i,":");case"zzzz":default:return"GMT"+vs(i,":")}},t:function(s,e,t){const i=Math.trunc(+s/1e3);return me(i,e.length)},T:function(s,e,t){return me(+s,e.length)}};function ia(s,e=""){const t=s>0?"-":"+",i=Math.abs(s),n=Math.trunc(i/60),r=i%60;return r===0?t+String(n):t+String(n)+e+me(r,2)}function na(s,e){return s%60===0?(s>0?"-":"+")+me(Math.abs(s)/60,2):vs(s,e)}function vs(s,e=""){const t=s>0?"-":"+",i=Math.abs(s),n=me(Math.trunc(i/60),2),r=me(i%60,2);return t+n+e+r}const ra=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},aa=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Vc=(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return ra(s,e);let r;switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",ra(i,e)).replace("{{time}}",aa(n,e))},Uc={p:aa,P:Vc},jc=/^D+$/,qc=/^Y+$/,Wc=["D","DD","YY","YYYY"];function zc(s){return jc.test(s)}function Yc(s){return qc.test(s)}function Kc(s,e,t){const i=Gc(s,e,t);if(console.warn(i),Wc.includes(s))throw new RangeError(i)}function Gc(s,e,t){const i=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Xc=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qc=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zc=/^'([^]*?)'?$/,Jc=/''/g,Rc=/[a-zA-Z]/;function ed(s,e,t){var i,n,r,a;const l=Zi(),d=l.locale??Lc,p=l.firstWeekContainsDate??((n=(i=l.locale)==null?void 0:i.options)==null?void 0:n.firstWeekContainsDate)??1,m=l.weekStartsOn??((a=(r=l.locale)==null?void 0:r.options)==null?void 0:a.weekStartsOn)??0,b=$t(s,void 0);if(!tc(b))throw new RangeError("Invalid time value");let y=e.match(Qc).map(g=>{const $=g[0];if($==="p"||$==="P"){const T=Uc[$];return T(g,d.formatLong)}return g}).join("").match(Xc).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const $=g[0];if($==="'")return{isToken:!1,value:td(g)};if(sa[$])return{isToken:!0,value:g};if($.match(Rc))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:g}});d.localize.preprocessor&&(y=d.localize.preprocessor(b,y));const k={firstWeekContainsDate:p,weekStartsOn:m,locale:d};return y.map(g=>{if(!g.isToken)return g.value;const $=g.value;(Yc($)||zc($))&&Kc($,e,String(s));const T=sa[$[0]];return T(b,$,d.localize,k)}).join("")}function td(s){const e=s.match(Zc);return e?e[1].replace(Jc,"'"):s}function sd(s,e){const t=$t(s,void 0).getDay();return t===0?7:t}function id(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const oa={},vi={};function bs(s,e){try{const t=(oa[s]||(oa[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return t in vi?vi[t]:la(t,t.split(":"))}catch{if(s in vi)return vi[s];const t=s==null?void 0:s.match(nd);return t?la(s,t.slice(1)):NaN}}const nd=/([+-]\d\d):?(\d\d)?/;function la(s,e){const t=+(e[0]||0),i=+(e[1]||0),n=+(e[2]||0)/60;return vi[s]=t*60+i>0?t*60+i+n:t*60-i-n}let bi=class Bi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(bs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),da(this),En(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Bi(...t,e):new Bi(Date.now(),e)}withTimeZone(e){return new Bi(+this,e)}getTimezoneOffset(){const e=-bs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),En(this),+this}[Symbol.for("constructDateFrom")](e){return new Bi(+new Date(e),this.timeZone)}};const ca=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!ca.test(s))return;const e=s.replace(ca,"$1UTC");bi.prototype[e]&&(s.startsWith("get")?bi.prototype[s]=function(){return this.internal[e]()}:(bi.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),rd(this),+this},bi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),En(this),+this}))});function En(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-bs(s.timeZone,s)*60))}function rd(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),da(s)}function da(s){const e=bs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+s);i.setUTCHours(i.getUTCHours()-1);const n=-new Date(+s).getTimezoneOffset(),r=-new Date(+i).getTimezoneOffset(),a=n-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const d=n-t;d&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+d);const p=new Date(+s);p.setUTCSeconds(0);const m=n>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(bs(s.timeZone,s)*60))%60;(b||m)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+m));const y=bs(s.timeZone,s),k=y>0?Math.floor(y):Math.ceil(y),g=-new Date(+s).getTimezoneOffset()-k,$=k!==t,T=g-d;if($&&T){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+T);const M=bs(s.timeZone,s),S=M>0?Math.floor(M):Math.ceil(M),O=k-S;O&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+O),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+O))}}let Pn=class Fi extends bi{static tz(e,...t){return t.length?new Fi(...t,e):new Fi(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),n=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+n}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,n]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${i} ${t} ${n}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,n]=this.tzComponents();return`${e} GMT${t}${i}${n} (${id(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),n=String(Math.abs(e)%60).padStart(2,"0");return[t,i,n]}withTimeZone(e){return new Fi(+this,e)}[Symbol.for("constructDateFrom")](e){return new Fi(+new Date(e),this.timeZone)}};window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const ad=(s=window.pktTz)=>{const e=new Pn(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function zt(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,i]=s.split("-").map(Number);return new Date(e,t-1,i)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const We=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),i=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${i}`},ts=s=>{if(!s)return null;const e=zt(s);return isNaN(e.getTime())?null:e},ua=(s,e)=>{const t=Ct(s);return isNaN(t.getTime())?"":ed(t,e)},Ct=(s="",e)=>{const t=typeof s=="string"?zt(s):s;return!t||isNaN(t.getTime())?new Date:t},ys=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const i=new Date(s,e,t);return isNaN(i.getTime())?new Date:i},yi=s=>{let e;return typeof s=="number"?e=new Pn(s,window.pktTz):e=new Pn(s,window.pktTz),e.setHours(12,0,0,0),e};let An=null,ha;const od=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!An||ha!==e)&&(An=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),ha=e),An.format(s)},ld=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const i=e?Ct(e):null,n=t?Ct(t):null;return!(i&&s<i||n&&s>n)},cd=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=We(s);return e.includes(t)},dd=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},pa=(s,e,t,i,n)=>!(!s||isNaN(s.getTime())||!ld(s,e,t)||i&&cd(s,i)||n&&dd(s,n)),ud=(s,e,t,i,n)=>s.filter(r=>{const a=ts(r);return a&&pa(a,e,t,i,n)}),fa=s=>s.slice().sort((e,t)=>{const i=ts(e),n=ts(t);return!i||!n?0:i.getTime()-n.getTime()}),hd=(s,e)=>{const t=ts(s),i=ts(e);return!t||!i?!1:t<=i},ki=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[],pd=s=>s.join(","),fd=s=>ki(s),md=s=>s?zt(s):null,gd=s=>{if(typeof s=="string")return s.split(",").map(e=>zt(e));if(Array.isArray(s))return s.map(e=>zt(e))},Us={csvToArray:fd,stringToDate:md,stringsToDate:gd},vd={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},ks={props:vd};function ma(s,e){const t=(e.excludedates??[]).map(i=>typeof i=="string"?i:We(i));return!pa(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function bd(s,e,t,i){return!!(ma(s,t)||!e&&i.multiple&&i.maxMultiple>0&&i.selectedCount>=i.maxMultiple)}function yd(s,e,t){const i=ys(s,e,0);return!(t&&Ct(t)>i)}function kd(s,e,t){const i=ys(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Ct(t)<i)}const _i=7,_d=6;function $d(s,e){const t=ys(s,e,1),i=ys(s,e+1,0),n=(t.getDay()+_d)%_i,r=i.getDate(),a=Math.ceil((r+n)/_i),l=ys(s,e,0).getDate(),d=ta(t);return{firstDayOfMonth:t,lastDayOfMonth:i,startingDay:n,numDays:r,numRows:a,numDaysPrevMonth:l,initialWeek:d}}function wd(s,e,t,i){const{startingDay:n,numDays:r}=i;return s===0&&e<n?"prev-month":t>r?"next-month":"current-month"}function xd(s,e,t,i){const{startingDay:n,numDaysPrevMonth:r,numDays:a}=i;return s==="prev-month"?r-(n-e-1):s==="next-month"?t-a:t}function js(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>zt(e))}function ga(s,e){const t=Rr({start:s,end:e}),i={};if(Array.isArray(t)&&t.length)for(let n=0;n<t.length;n++){const r=t[n],a=r>s&&r<e;i[We(r)]=a}return i}function va(s,e,t,i){if(e.length!==1)return!0;const n=Rr({start:e[0],end:s});if(!Array.isArray(n)||!n.length)return!0;for(let r=0;r<n.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((i??[]).includes(sd(n[r]).toString()))return!1}return!0}function In(s,e){const t=We(s);return e.includes(t)?e:[...e,t]}function Ln(s,e){const t=We(s),i=e.indexOf(t);if(i===-1)return e;if(e.length===1)return[];const n=[...e];return n.splice(i,1),n}function Sd(s,e,t){const i=We(s);return e.includes(i)?Ln(s,e):t>0&&e.length>=t?e:In(s,e)}function Cd(s,e,t){const i=We(s),n=js(e);if(e.includes(i))return e.indexOf(i)===0?[]:Ln(s,e);if(e.length>1)return[i];if(e.length===1){if(!va(s,n,t.excludedates,t.excludeweekdays))return[i];if(n[0]>s)return[i]}return In(s,e)}const Td={ArrowLeft:-1,ArrowRight:1,ArrowUp:-_i,ArrowDown:_i};function Nd(s){var e;const t=s.nodeName;return t==="INPUT"||t==="SELECT"||t==="BUTTON"&&!((e=s.dataset)!=null&&e.date)}function Md(s,e,t){let i=Gr(s,e);if(!i)return null;let n=t(`button[data-date="${We(i)}"]`);for(;n instanceof HTMLButtonElement&&n.dataset.disabled;)if(i=Gr(i,e),n=t(`button[data-date="${We(i)}"]`),!n)return null;return i}function Dd(s){return Td[s]??null}var Od=Object.defineProperty,Ed=Object.getOwnPropertyDescriptor,$e=(s,e,t,i)=>{for(var n=i>1?void 0:i?Ed(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Od(e,t,n),n};let ke=class extends _e{constructor(){super(...arguments),this.selected=[],this.multiple=ks.props.multiple.default,this.maxMultiple=ks.props.maxMultiple.default,this.range=ks.props.range.default,this.earliest=ks.props.earliest.default,this.latest=ks.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=ks.props.weeknumbers.default,this.withcontrols=ks.props.withcontrols.default,this.currentmonth=null,this.today=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get todayDate(){return this.today?zt(this.today):ad()}firstUpdated(e){this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has("selected")&&this.convertSelected()}convertSelected(){typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=js(this.selected),this.range&&this.selected.length===2&&(this.inRange=ga(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const e=zt(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?yi(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=yi(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=yi(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){const t=Dd(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){const i=e.target;if(Nd(i))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}const n=this.focusedDate?Ct(this.focusedDate):ys(this.year,this.month,1),r=Md(n,t,this.querySelector.bind(this));if(r){const a=this.querySelector(`button[data-date="${We(r)}"]`);a instanceof HTMLButtonElement&&!a.dataset.disabled&&(this.focusedDate=We(r),a.focus())}}render(){return v`
|
|
205
|
+
</nav>`}};Ci([u({type:String})],on.prototype,"href",2),Ci([u({type:String})],on.prototype,"text",2),Ci([u({type:String})],on.prototype,"ariaLabel",2),on=Ci([ge("pkt-backlink")],on);const La=6048e5,Qc=864e5,Ba=Symbol.for("constructDateFrom");function Zt(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ba in s?s[Ba](e):s instanceof Date?new s.constructor(e):new Date(e)}function Mt(s,e){return Zt(e||s,s)}function Fa(s,e,t){const n=Mt(s,void 0);return isNaN(e)?Zt(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let Zc={};function Ti(){return Zc}function Fn(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.weekStartsOn)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.weekStartsOn)??a.weekStartsOn??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.weekStartsOn)??0,c=Mt(s,e==null?void 0:e.in),p=c.getDay(),g=(p<l?7:0)+p-l;return c.setDate(c.getDate()-g),c.setHours(0,0,0,0),c}function Ni(s,e){return Fn(s,{...e,weekStartsOn:1})}function Va(s,e){const t=Mt(s,void 0),n=t.getFullYear(),i=Zt(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Ni(i),a=Zt(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Ni(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Ua(s){const e=Mt(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Ha(s,...e){const t=Zt.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function ja(s,e){const t=Mt(s,void 0);return t.setHours(0,0,0,0),t}function Jc(s,e,t){const[n,i]=Ha(void 0,s,e),r=ja(n),a=ja(i),l=+r-Ua(r),c=+a-Ua(a);return Math.round((l-c)/Qc)}function Rc(s,e){const t=Va(s),n=Zt(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Ni(n)}function eu(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function tu(s){return!(!eu(s)&&typeof s!="number"||isNaN(+Mt(s)))}function su(s,e){const[t,n]=Ha(s,e.start,e.end);return{start:t,end:n}}function qa(s,e){const{start:t,end:n}=su(void 0,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(Zt(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function nu(s,e){const t=Mt(s,void 0);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const iu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ru=(s,e,t)=>{let n;const i=iu[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function pr(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const au={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ou={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},lu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},cu={date:pr({formats:au,defaultWidth:"full"}),time:pr({formats:ou,defaultWidth:"full"}),dateTime:pr({formats:lu,defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},du=(s,e,t,n)=>uu[s];function Vn(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const hu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},pu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},fu={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},gu={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},bu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},vu=(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},ku={ordinalNumber:vu,era:Vn({values:hu,defaultWidth:"wide"}),quarter:Vn({values:pu,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Vn({values:fu,defaultWidth:"wide"}),day:Vn({values:gu,defaultWidth:"wide"}),dayPeriod:Vn({values:mu,defaultWidth:"wide",formattingValues:bu,defaultFormattingWidth:"wide"})};function Un(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?_u(l,b=>b.test(a)):yu(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(c):c,p=t.valueCallback?t.valueCallback(p):p;const g=e.slice(a.length);return{value:p,rest:g}}}function yu(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function _u(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function wu(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const $u=/^(\d+)(th|st|nd|rd)?/i,xu=/\d+/i,Su={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Cu={any:[/^b/i,/^(a|c)/i]},Tu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Nu={any:[/1/i,/2/i,/3/i,/4/i]},Mu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Du={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ou={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Eu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Pu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Au={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Iu={ordinalNumber:wu({matchPattern:$u,parsePattern:xu,valueCallback:s=>parseInt(s,10)}),era:Un({matchPatterns:Su,defaultMatchWidth:"wide",parsePatterns:Cu,defaultParseWidth:"any"}),quarter:Un({matchPatterns:Tu,defaultMatchWidth:"wide",parsePatterns:Nu,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Un({matchPatterns:Mu,defaultMatchWidth:"wide",parsePatterns:Du,defaultParseWidth:"any"}),day:Un({matchPatterns:Ou,defaultMatchWidth:"wide",parsePatterns:Eu,defaultParseWidth:"any"}),dayPeriod:Un({matchPatterns:Pu,defaultMatchWidth:"any",parsePatterns:Au,defaultParseWidth:"any"})},Lu={code:"en-US",formatDistance:ru,formatLong:cu,formatRelative:du,localize:ku,match:Iu,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Bu(s,e){const t=Mt(s,void 0);return Jc(t,nu(t))+1}function Fu(s,e){const t=Mt(s,void 0),n=+Ni(t)-+Rc(t);return Math.round(n/La)+1}function Wa(s,e){var t,n,i,r;const a=Mt(s,e==null?void 0:e.in),l=a.getFullYear(),c=Ti(),p=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??c.firstWeekContainsDate??((r=(i=c.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,g=Zt((e==null?void 0:e.in)||s,0);g.setFullYear(l+1,0,p),g.setHours(0,0,0,0);const b=Fn(g,e),f=Zt((e==null?void 0:e.in)||s,0);f.setFullYear(l,0,p),f.setHours(0,0,0,0);const k=Fn(f,e);return+a>=+b?l+1:+a>=+k?l:l-1}function Vu(s,e){var t,n,i,r;const a=Ti(),l=(e==null?void 0:e.firstWeekContainsDate)??((n=(t=e==null?void 0:e.locale)==null?void 0:t.options)==null?void 0:n.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(i=a.locale)==null?void 0:i.options)==null?void 0:r.firstWeekContainsDate)??1,c=Wa(s,e),p=Zt((e==null?void 0:e.in)||s,0);return p.setFullYear(c,0,l),p.setHours(0,0,0,0),Fn(p,e)}function za(s,e){const t=Mt(s,e==null?void 0:e.in),n=+Fn(t,e)-+Vu(t,e);return Math.round(n/La)+1}function Se(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const ks={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Se(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Se(t+1,2)},d(s,e){return Se(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Se(s.getHours()%12||12,e.length)},H(s,e){return Se(s.getHours(),e.length)},m(s,e){return Se(s.getMinutes(),e.length)},s(s,e){return Se(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Se(i,e.length)}},ln={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ya={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return ks.y(s,e)},Y:function(s,e,t,n){const i=Wa(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Se(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Se(r,e.length)},R:function(s,e){const t=Va(s);return Se(t,e.length)},u:function(s,e){const t=s.getFullYear();return Se(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Se(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Se(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return ks.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Se(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=za(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Se(i,e.length)},I:function(s,e,t){const n=Fu(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Se(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):ks.d(s,e)},D:function(s,e,t){const n=Bu(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Se(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Se(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Se(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Se(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const n=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=ln.noon:n===0?i=ln.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=ln.evening:n>=12?i=ln.afternoon:n>=4?i=ln.morning:i=ln.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return ks.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):ks.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Se(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):ks.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):ks.s(s,e)},S:function(s,e){return ks.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Ga(n);case"XXXX":case"XX":return Ls(n);case"XXXXX":case"XXX":default:return Ls(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return Ga(n);case"xxxx":case"xx":return Ls(n);case"xxxxx":case"xxx":default:return Ls(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ka(n,":");case"OOOO":default:return"GMT"+Ls(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ka(n,":");case"zzzz":default:return"GMT"+Ls(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Se(n,e.length)},T:function(s,e,t){return Se(+s,e.length)}};function Ka(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Se(r,2)}function Ga(s,e){return s%60===0?(s>0?"-":"+")+Se(Math.abs(s)/60,2):Ls(s,e)}function Ls(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Se(Math.trunc(n/60),2),r=Se(n%60,2);return t+i+e+r}const Xa=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Qa=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Uu=(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return Xa(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",Xa(n,e)).replace("{{time}}",Qa(i,e))},Hu={p:Qa,P:Uu},ju=/^D+$/,qu=/^Y+$/,Wu=["D","DD","YY","YYYY"];function zu(s){return ju.test(s)}function Yu(s){return qu.test(s)}function Ku(s,e,t){const n=Gu(s,e,t);if(console.warn(n),Wu.includes(s))throw new RangeError(n)}function Gu(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Xu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zu=/^'([^]*?)'?$/,Ju=/''/g,Ru=/[a-zA-Z]/;function ed(s,e,t){var n,i,r,a;const l=Ti(),c=l.locale??Lu,p=l.firstWeekContainsDate??((i=(n=l.locale)==null?void 0:n.options)==null?void 0:i.firstWeekContainsDate)??1,g=l.weekStartsOn??((a=(r=l.locale)==null?void 0:r.options)==null?void 0:a.weekStartsOn)??0,b=Mt(s,void 0);if(!tu(b))throw new RangeError("Invalid time value");let f=e.match(Qu).map(v=>{const $=v[0];if($==="p"||$==="P"){const M=Hu[$];return M(v,c.formatLong)}return v}).join("").match(Xu).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:td(v)};if(Ya[$])return{isToken:!0,value:v};if($.match(Ru))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});c.localize.preprocessor&&(f=c.localize.preprocessor(b,f));const k={firstWeekContainsDate:p,weekStartsOn:g,locale:c};return f.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Yu($)||zu($))&&Ku($,e,String(s));const M=Ya[$[0]];return M(b,$,c.localize,k)}).join("")}function td(s){const e=s.match(Zu);return e?e[1].replace(Ju,"'"):s}function sd(s,e){const t=Mt(s,void 0).getDay();return t===0?7:t}function nd(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Za={},Hn={};function Bs(s,e){try{const t=(Za[s]||(Za[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return t in Hn?Hn[t]:Ja(t,t.split(":"))}catch{if(s in Hn)return Hn[s];const t=s==null?void 0:s.match(id);return t?Ja(s,t.slice(1)):NaN}}const id=/([+-]\d\d):?(\d\d)?/;function Ja(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return Hn[s]=t*60+n>0?t*60+n+i:t*60-n-i}let jn=class pi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Bs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),eo(this),fr(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new pi(...t,e):new pi(Date.now(),e)}withTimeZone(e){return new pi(+this,e)}getTimezoneOffset(){const e=-Bs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),fr(this),+this}[Symbol.for("constructDateFrom")](e){return new pi(+new Date(e),this.timeZone)}};const Ra=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Ra.test(s))return;const e=s.replace(Ra,"$1UTC");jn.prototype[e]&&(s.startsWith("get")?jn.prototype[s]=function(){return this.internal[e]()}:(jn.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),rd(this),+this},jn.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),fr(this),+this}))});function fr(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Bs(s.timeZone,s)*60))}function rd(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),eo(s)}function eo(s){const e=Bs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const p=new Date(+s);p.setUTCSeconds(0);const g=i>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(Bs(s.timeZone,s)*60))%60;(b||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+g));const f=Bs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),v=-new Date(+s).getTimezoneOffset()-k,$=k!==t,M=v-c;if($&&M){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+M);const S=Bs(s.timeZone,s),T=S>0?Math.floor(S):Math.ceil(S),L=k-T;L&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+L),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+L))}}let gr=class fi extends jn{static tz(e,...t){return t.length?new fi(...t,e):new fi(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${nd(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new fi(+this,e)}[Symbol.for("constructDateFrom")](e){return new fi(+new Date(e),this.timeZone)}};window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const ad=(s=window.pktTz)=>{const e=new gr(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function ls(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const at=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ys=s=>{if(!s)return null;const e=ls(s);return isNaN(e.getTime())?null:e},to=(s,e)=>{const t=At(s);return isNaN(t.getTime())?"":ed(t,e)},At=(s="",e)=>{const t=typeof s=="string"?ls(s):s;return!t||isNaN(t.getTime())?new Date:t},Fs=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},qn=s=>{let e;return typeof s=="number"?e=new gr(s,window.pktTz):e=new gr(s,window.pktTz),e.setHours(12,0,0,0),e};let mr=null,so;const od=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!mr||so!==e)&&(mr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),so=e),mr.format(s)},ld=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?At(e):null,i=t?At(t):null;return!(n&&s<n||i&&s>i)},cd=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=at(s);return e.includes(t)},ud=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},no=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!ld(s,e,t)||n&&cd(s,n)||i&&ud(s,i)),dd=(s,e,t,n,i)=>s.filter(r=>{const a=ys(r);return a&&no(a,e,t,n,i)}),io=s=>s.slice().sort((e,t)=>{const n=ys(e),i=ys(t);return!n||!i?0:n.getTime()-i.getTime()}),hd=(s,e)=>{const t=ys(s),n=ys(e);return!t||!n?!1:t<=n},Wn=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[],pd=s=>s.join(","),fd=s=>Wn(s),gd=s=>s?ls(s):null,md=s=>{if(typeof s=="string")return s.split(",").map(e=>ls(e));if(Array.isArray(s))return s.map(e=>ls(e))},cn={csvToArray:fd,stringToDate:gd,stringsToDate:md},bd={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},Vs={props:bd};function ro(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:at(n));return!no(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function vd(s,e,t,n){return!!(ro(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function kd(s,e,t){const n=Fs(s,e,0);return!(t&&At(t)>n)}function yd(s,e,t){const n=Fs(e===11?s+1:s,e===11?0:e+1,1);return!(t&&At(t)<n)}const zn=7,_d=6;function wd(s,e){const t=Fs(s,e,1),n=Fs(s,e+1,0),i=(t.getDay()+_d)%zn,r=n.getDate(),a=Math.ceil((r+i)/zn),l=Fs(s,e,0).getDate(),c=za(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:l,initialWeek:c}}function $d(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function xd(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}function un(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>ls(e))}function ao(s,e){const t=qa({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[at(r)]=a}return n}function oo(s,e,t,n){if(e.length!==1)return!0;const i=qa({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(sd(i[r]).toString()))return!1}return!0}function br(s,e){const t=at(s);return e.includes(t)?e:[...e,t]}function vr(s,e){const t=at(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function Sd(s,e,t){const n=at(s);return e.includes(n)?vr(s,e):t>0&&e.length>=t?e:br(s,e)}function Cd(s,e,t){const n=at(s),i=un(e);if(e.includes(n))return e.indexOf(n)===0?[]:vr(s,e);if(e.length>1)return[n];if(e.length===1){if(!oo(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return br(s,e)}const Td={ArrowLeft:-1,ArrowRight:1,ArrowUp:-zn,ArrowDown:zn};function Nd(s){var e;const t=s.nodeName;return t==="INPUT"||t==="SELECT"||t==="BUTTON"&&!((e=s.dataset)!=null&&e.date)}function Md(s,e,t){let n=Fa(s,e);if(!n)return null;let i=t(`button[data-date="${at(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Fa(n,e),i=t(`button[data-date="${at(n)}"]`),!i)return null;return n}function Dd(s){return Td[s]??null}var Od=Object.defineProperty,Ed=Object.getOwnPropertyDescriptor,Ee=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ed(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Od(e,t,i),i};let Ne=class extends Oe{constructor(){super(...arguments),this.selected=[],this.multiple=Vs.props.multiple.default,this.maxMultiple=Vs.props.maxMultiple.default,this.range=Vs.props.range.default,this.earliest=Vs.props.earliest.default,this.latest=Vs.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=Vs.props.weeknumbers.default,this.withcontrols=Vs.props.withcontrols.default,this.currentmonth=null,this.today=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get todayDate(){return this.today?ls(this.today):ad()}firstUpdated(e){this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has("selected")&&this.convertSelected()}convertSelected(){typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=un(this.selected),this.range&&this.selected.length===2&&(this.inRange=ao(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const e=ls(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?qn(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=qn(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=qn(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){const t=Dd(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){const n=e.target;if(Nd(n))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}const i=this.focusedDate?At(this.focusedDate):Fs(this.year,this.month,1),r=Md(i,t,this.querySelector.bind(this));if(r){const a=this.querySelector(`button[data-date="${at(r)}"]`);a instanceof HTMLButtonElement&&!a.dataset.disabled&&(this.focusedDate=at(r),a.focus())}}render(){return y`
|
|
206
206
|
<div
|
|
207
207
|
class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":""}"
|
|
208
208
|
@focusout=${this.closeEvent}
|
|
@@ -226,25 +226,25 @@
|
|
|
226
226
|
</tbody>
|
|
227
227
|
</table>
|
|
228
228
|
</div>
|
|
229
|
-
`}renderMonthNavButton(e){const t=e==="prev",
|
|
229
|
+
`}renderMonthNavButton(e){const t=e==="prev",n=t?this.isPrevMonthAllowed():this.isNextMonthAllowed(),i=t?this.prevMonthString:this.nextMonthString,r=t?"chevron-thin-left":"chevron-thin-right",a=t?"pkt-calendar__prev-month":"pkt-calendar__next-month",l=t?()=>this.prevMonth():()=>this.nextMonth();return y`<div>
|
|
230
230
|
<button
|
|
231
231
|
type="button"
|
|
232
|
-
aria-label="${
|
|
233
|
-
@click=${()=>
|
|
234
|
-
@keydown=${
|
|
235
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${a} ${
|
|
236
|
-
.data-disabled=${
|
|
237
|
-
?aria-disabled=${!
|
|
238
|
-
tabindex=${
|
|
232
|
+
aria-label="${i}"
|
|
233
|
+
@click=${()=>n&&l()}
|
|
234
|
+
@keydown=${c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n&&l())}}
|
|
235
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${a} ${n?"":"pkt-invisible"}"
|
|
236
|
+
.data-disabled=${n?x:"disabled"}
|
|
237
|
+
?aria-disabled=${!n}
|
|
238
|
+
tabindex=${n?"0":"-1"}
|
|
239
239
|
>
|
|
240
240
|
<pkt-icon class="pkt-btn__icon" name="${r}"></pkt-icon>
|
|
241
|
-
<span class="pkt-btn__text">${
|
|
241
|
+
<span class="pkt-btn__text">${i}</span>
|
|
242
242
|
</button>
|
|
243
|
-
</div>`}renderDayNames(){const e=[];this.weeknumbers&&e.push(
|
|
243
|
+
</div>`}renderDayNames(){const e=[];this.weeknumbers&&e.push(y`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);for(let t=0;t<this.dayStrings.length;t++)e.push(y`<th>
|
|
244
244
|
<div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[t]}">
|
|
245
245
|
${this.dayStrings[t]}
|
|
246
246
|
</div>
|
|
247
|
-
</th>`);return
|
|
247
|
+
</th>`);return y`<tr class="pkt-cal-week-row">${e}</tr>`}renderMonthNav(){return this.withcontrols?y`<div class="pkt-cal-month-picker">
|
|
248
248
|
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
249
249
|
<select
|
|
250
250
|
aria-label="${this.strings.dates.month}"
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
id="${this.id}-monthnav"
|
|
253
253
|
@change=${e=>{e.stopImmediatePropagation();const t=e.target;this.changeMonth(this.year,parseInt(t.value))}}
|
|
254
254
|
>
|
|
255
|
-
${this.monthStrings.map((e,t)=>
|
|
255
|
+
${this.monthStrings.map((e,t)=>y`<option value=${t} ?selected=${this.month===t}>${e}</option>`)}
|
|
256
256
|
</select>
|
|
257
257
|
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
258
258
|
<input
|
|
@@ -265,79 +265,80 @@
|
|
|
265
265
|
@change=${e=>{e.stopImmediatePropagation();const t=e.target;this.changeMonth(parseInt(t.value),this.month)}}
|
|
266
266
|
.value=${this.year}
|
|
267
267
|
/>
|
|
268
|
-
</div>`:
|
|
268
|
+
</div>`:y`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
269
269
|
${this.monthStrings[this.month]} ${this.year}
|
|
270
|
-
</div>`}getDayViewData(e,t){const
|
|
270
|
+
</div>`}getDayViewData(e,t){const n=Fs(this.year,this.month,e),i=at(n),r=i===at(t),a=this.selected.includes(i),l=this.isDayDisabled(n,a),c=this.calculateTabIndex(i,l,e);return{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:od(n),tabindex:c}}getDateConstraints(){return{earliest:this.earliest,latest:this.latest,excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}}isDayDisabled(e,t){return vd(e,t,this.getDateConstraints(),{multiple:this.multiple,maxMultiple:this.maxMultiple,selectedCount:this.selected.length})}calculateTabIndex(e,t,n){return this.focusedDate?this.focusedDate===e&&!t?"0":"-1":!t&&this.tabIndexSet===0?(this.tabIndexSet=n,"0"):this.tabIndexSet===n?"0":"-1"}getDayCellClasses(e){const{currentDateISO:t,isToday:n,isSelected:i}=e,r=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],a=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[t],"pkt-cal-excluded":this.isExcluded(e.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":this.rangeHovered!==null&&t===at(this.rangeHovered)}}getDayButtonClasses(e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=e,a=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],l=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":this.inRange[t],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&t===at(this.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l}}handleDayFocus(e,t){this.range&&!this.isExcluded(e)&&this.handleRangeHover(e),this.focusedDate=t}renderDayView(e,t){const n=this.getDayViewData(e,t),{currentDate:i,currentDateISO:r,isSelected:a,isDisabled:l,ariaLabel:c,tabindex:p}=n;this.selectableDates.push({currentDateISO:r,isDisabled:l,tabindex:p});const g=this.getDayCellClasses(n),b=this.getDayButtonClasses(n);return y`<td class=${z(g)}>
|
|
271
271
|
<button
|
|
272
272
|
type="button"
|
|
273
273
|
aria-pressed=${a?"true":"false"}
|
|
274
274
|
?disabled=${l}
|
|
275
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${
|
|
276
|
-
@mouseover=${()=>this.range&&!this.isExcluded(
|
|
277
|
-
@focus=${()=>this.handleDayFocus(
|
|
278
|
-
aria-label="${
|
|
275
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${z(b)}"
|
|
276
|
+
@mouseover=${()=>this.range&&!this.isExcluded(i)&&this.handleRangeHover(i)}
|
|
277
|
+
@focus=${()=>this.handleDayFocus(i,r)}
|
|
278
|
+
aria-label="${c}"
|
|
279
279
|
tabindex=${p}
|
|
280
|
-
data-disabled=${l?"disabled":
|
|
280
|
+
data-disabled=${l?"disabled":x}
|
|
281
281
|
data-date=${r}
|
|
282
|
-
@keydown=${
|
|
283
|
-
@click=${
|
|
282
|
+
@keydown=${f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),this.handleDateSelect(i))}}
|
|
283
|
+
@click=${f=>{l||(f.preventDefault(),this.handleDateSelect(i))}}
|
|
284
284
|
>
|
|
285
285
|
<span class="pkt-btn__text pkt-txt-14-light">${e}</span>
|
|
286
286
|
</button>
|
|
287
|
-
</td>`}renderEmptyDayCell(e){return
|
|
287
|
+
</td>`}renderEmptyDayCell(e){return y`<td class="pkt-cal-other">
|
|
288
288
|
<div
|
|
289
289
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
290
290
|
data-disabled="disabled"
|
|
291
291
|
>
|
|
292
292
|
<span class="pkt-btn__text pkt-txt-14-light">${e}</span>
|
|
293
293
|
</div>
|
|
294
|
-
</td>`}renderWeekRow(e){return
|
|
294
|
+
</td>`}renderWeekRow(e){return y`<tr class="pkt-cal-week-row" role="row">${e}</tr>`}renderCalendarBody(){const e=this.todayDate,t=wd(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let n=1;this.week=t.initialWeek;const i=[];for(let r=0;r<t.numRows;r++){const a=[];this.weeknumbers&&a.push(y`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let l=0;l<zn;l++){const c=$d(r,l,n,t);if(c==="current-month")a.push(this.renderDayView(n,e)),n++;else{const p=xd(c,l,n,t);a.push(this.renderEmptyDayCell(p)),c==="next-month"&&n++}}i.push(this.renderWeekRow(a))}return i}isExcluded(e){return ro(e,this.getDateConstraints())}isPrevMonthAllowed(){return kd(this.year,this.month,this.earliest)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return yd(this.year,this.month,this.latest)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e=="string"?parseInt(e):e,this.month=typeof t=="string"?parseInt(t):t,this.currentmonth=qn(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected=="string"?this.selected.split(","):this.selected}addToSelected(e){this.selected=br(e,this.normalizeSelected()),this._selected=un(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=vr(e,this.normalizeSelected()),this._selected=un(this.selected)}toggleSelected(e){this.selected=Sd(e,this.normalizeSelected(),this.maxMultiple),this._selected=un(this.selected)}isRangeAllowed(e){return oo(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=Cd(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=un(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e){this.rangeHovered=null;return}this.rangeHovered=e,this.inRange=ao(this._selected[0],e)}handleDateSelect(e){return e&&(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(at(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){const e=at(qn(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}const n=this.selectableDates.find(i=>!i.isDisabled);if(n){const i=this.querySelector(`button[data-date="${n.currentDateISO}"]`);i instanceof HTMLButtonElement&&(this.focusedDate=n.currentDateISO,i.focus())}}closeEvent(e){!this.contains(e.relatedTarget)&&!e.target.classList.contains("pkt-invisible")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};Ee([u({converter:cn.csvToArray})],Ne.prototype,"selected",2),Ee([u({type:Boolean})],Ne.prototype,"multiple",2),Ee([u({type:Number,attribute:"max-multiple"})],Ne.prototype,"maxMultiple",2),Ee([u({type:Boolean})],Ne.prototype,"range",2),Ee([u({type:String})],Ne.prototype,"earliest",2),Ee([u({type:String})],Ne.prototype,"latest",2),Ee([u({converter:cn.stringsToDate})],Ne.prototype,"excludedates",2),Ee([u({converter:cn.csvToArray})],Ne.prototype,"excludeweekdays",2),Ee([u({type:Boolean})],Ne.prototype,"weeknumbers",2),Ee([u({type:Boolean})],Ne.prototype,"withcontrols",2),Ee([u({converter:cn.stringToDate})],Ne.prototype,"currentmonth",2),Ee([u({type:String})],Ne.prototype,"today",2),Ee([u({type:Array,attribute:"day-strings"})],Ne.prototype,"dayStrings",2),Ee([u({type:Array,attribute:"day-strings-long"})],Ne.prototype,"dayStringsLong",2),Ee([u({type:Array,attribute:"month-strings"})],Ne.prototype,"monthStrings",2),Ee([u({type:String,attribute:"week-string"})],Ne.prototype,"weekString",2),Ee([u({type:String,attribute:"prev-month-string"})],Ne.prototype,"prevMonthString",2),Ee([u({type:String,attribute:"next-month-string"})],Ne.prototype,"nextMonthString",2),Ee([u({type:Array})],Ne.prototype,"_selected",2),Ee([ce()],Ne.prototype,"inRange",2),Ee([u({type:Date})],Ne.prototype,"rangeHovered",2),Ee([u({type:Number})],Ne.prototype,"year",2),Ee([u({type:Number})],Ne.prototype,"month",2),Ee([u({type:Number})],Ne.prototype,"week",2),Ee([ce()],Ne.prototype,"currentmonthtouched",2),Ee([ce()],Ne.prototype,"focusedDate",2),Ne=Ee([ge("pkt-calendar")],Ne);const Pd={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},Mi={props:Pd};var Ad=Object.defineProperty,Id=Object.getOwnPropertyDescriptor,qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Id(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ad(e,t,i),i};let It=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.closeTag=Mi.props.closeTag.default,this.size=Mi.props.size.default,this.skin=Mi.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=Mi.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var t,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(t=this.defaultSlot.value)==null?void 0:t.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},t={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?y`
|
|
295
295
|
<button
|
|
296
|
-
class=${
|
|
296
|
+
class=${z(t)}
|
|
297
297
|
type=${this.type}
|
|
298
|
+
tabindex=${A(this.buttonTabindex)}
|
|
298
299
|
@click=${this.close}
|
|
299
|
-
aria-label=${
|
|
300
|
-
aria-description=${
|
|
300
|
+
aria-label=${A(this.ariaLabel||void 0)}
|
|
301
|
+
aria-description=${A(this._ariaDescription||void 0)}
|
|
301
302
|
>
|
|
302
|
-
${this.iconName&&
|
|
303
|
+
${this.iconName&&y`<pkt-icon
|
|
303
304
|
class="pkt-tag__icon"
|
|
304
305
|
name=${this.iconName}
|
|
305
306
|
aria-hidden="true"
|
|
306
307
|
></pkt-icon>`}
|
|
307
|
-
<span ${
|
|
308
|
+
<span ${X(this.defaultSlot)}></span>
|
|
308
309
|
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
309
310
|
</button>
|
|
310
|
-
`:
|
|
311
|
-
<span class=${
|
|
312
|
-
${this.iconName&&
|
|
311
|
+
`:y`
|
|
312
|
+
<span class=${z(e)}>
|
|
313
|
+
${this.iconName&&y`<pkt-icon
|
|
313
314
|
class="pkt-tag__icon"
|
|
314
315
|
name=${this.iconName}
|
|
315
316
|
aria-hidden="true"
|
|
316
317
|
></pkt-icon>`}
|
|
317
|
-
<span ${
|
|
318
|
+
<span ${X(this.defaultSlot)}></span>
|
|
318
319
|
</span>
|
|
319
|
-
`}};
|
|
320
|
+
`}};qt([u({type:Boolean,reflect:!0})],It.prototype,"closeTag",2),qt([u({type:String,reflect:!0})],It.prototype,"size",2),qt([u({type:String,reflect:!0})],It.prototype,"skin",2),qt([u({type:String,reflect:!0})],It.prototype,"textStyle",2),qt([u({type:String,reflect:!0})],It.prototype,"iconName",2),qt([u({type:String})],It.prototype,"type",2),qt([u({type:String})],It.prototype,"ariaLabel",2),qt([u({type:Number,attribute:"button-tabindex"})],It.prototype,"buttonTabindex",2),qt([ce()],It.prototype,"_isClosed",2),qt([ce()],It.prototype,"_ariaDescription",2),It=qt([ge("pkt-tag")],It);var Ld=Object.defineProperty,Bd=Object.getOwnPropertyDescriptor,dn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Bd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ld(e,t,i),i};let _s=class extends _i{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="level"&&n&&this.setLevel(Number(n)),e==="visuallyHidden"&&(this.visuallyHidden=n!==null&&n!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return y`<slot></slot>`}};dn([u({type:String,reflect:!0})],_s.prototype,"size",2),dn([u({type:Number,reflect:!0})],_s.prototype,"level",2),dn([u({type:String,reflect:!0})],_s.prototype,"weight",2),dn([u({type:Boolean,reflect:!0})],_s.prototype,"visuallyHidden",2),dn([u({type:String,reflect:!0})],_s.prototype,"align",2),_s=dn([ge("pkt-heading")],_s);const Fd={layout:{default:"vertical"},skin:{type:["outlined","outlined-beige","gray","blue","beige","green"],default:"outlined"},padding:{default:"default"}},hn={props:Fd};var Vd=Object.defineProperty,Ud=Object.getOwnPropertyDescriptor,ht=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ud(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vd(e,t,i),i};let ot=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.ariaLabel="",this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=hn.props.layout.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=hn.props.padding.default,this.skin=hn.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[],this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){var e,t;const n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},i=((e=this.ariaLabel)==null?void 0:e.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),r=((t=this.ariaLabel)==null?void 0:t.trim())||(this.heading?this.heading:"kort");return y`
|
|
320
321
|
<article
|
|
321
|
-
class=${
|
|
322
|
-
aria-label=${
|
|
322
|
+
class=${z(n)}
|
|
323
|
+
aria-label=${A(this.clickCardLink?i:r)}
|
|
323
324
|
>
|
|
324
325
|
${this.renderImage()}
|
|
325
326
|
<div class="pkt-card__wrapper">
|
|
326
|
-
${this.tagPosition==="top"?this.renderTags():
|
|
327
|
+
${this.tagPosition==="top"?this.renderTags():x}
|
|
327
328
|
${this.renderHeader()}
|
|
328
329
|
${this.renderSlot()}
|
|
329
|
-
${this.tagPosition==="bottom"?this.renderTags():
|
|
330
|
+
${this.tagPosition==="bottom"?this.renderTags():x}
|
|
330
331
|
${this.renderMetadata()}
|
|
331
332
|
</div>
|
|
332
333
|
</article>
|
|
333
|
-
`}renderImage(){const e={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return
|
|
334
|
-
${this.image.src&&
|
|
335
|
-
<div class=${
|
|
334
|
+
`}renderImage(){const e={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return y`
|
|
335
|
+
${this.image.src&&y`
|
|
336
|
+
<div class=${z(e)}>
|
|
336
337
|
<img src=${this.image.src} alt=${this.image.alt||""} />
|
|
337
338
|
</div>
|
|
338
339
|
`}
|
|
339
|
-
`}renderHeading(){return
|
|
340
|
-
${this.heading&&!this.clickCardLink?
|
|
340
|
+
`}renderHeading(){return y`
|
|
341
|
+
${this.heading&&!this.clickCardLink?y`
|
|
341
342
|
<pkt-heading
|
|
342
343
|
class="pkt-card__heading"
|
|
343
344
|
.level=${this.headinglevel||3}
|
|
@@ -347,9 +348,9 @@
|
|
|
347
348
|
>
|
|
348
349
|
${this.heading}
|
|
349
350
|
</pkt-heading>
|
|
350
|
-
`:
|
|
351
|
-
`}renderLinkHeading(){return
|
|
352
|
-
${this.clickCardLink?
|
|
351
|
+
`:x}
|
|
352
|
+
`}renderLinkHeading(){return y`
|
|
353
|
+
${this.clickCardLink?y`
|
|
353
354
|
<pkt-heading
|
|
354
355
|
class="pkt-card__link-heading pkt-card__heading"
|
|
355
356
|
.level=${this.headinglevel||3}
|
|
@@ -364,144 +365,67 @@
|
|
|
364
365
|
>${this.heading}</a
|
|
365
366
|
>
|
|
366
367
|
</pkt-heading>
|
|
367
|
-
`:
|
|
368
|
-
`}renderSubheading(){return
|
|
369
|
-
${this.subheading?
|
|
370
|
-
`}renderHeader(){const e=!!this.heading||!!this.subheading;return
|
|
371
|
-
${e?
|
|
368
|
+
`:x}
|
|
369
|
+
`}renderSubheading(){return y`
|
|
370
|
+
${this.subheading?y` <p class="pkt-card__subheading ">${this.subheading}</p> `:x}
|
|
371
|
+
`}renderHeader(){const e=!!this.heading||!!this.subheading;return y`
|
|
372
|
+
${e?y`
|
|
372
373
|
<header class="pkt-card__header">
|
|
373
374
|
${this.renderHeading()}
|
|
374
375
|
${this.renderLinkHeading()}
|
|
375
376
|
${this.renderSubheading()}
|
|
376
377
|
</header>
|
|
377
|
-
`:
|
|
378
|
-
`}renderTags(){const e={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return
|
|
379
|
-
${this.tags.length>0?
|
|
378
|
+
`:x}
|
|
379
|
+
`}renderTags(){const e={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return y`
|
|
380
|
+
${this.tags.length>0?y`
|
|
380
381
|
<div
|
|
381
|
-
class=${
|
|
382
|
+
class=${z(e)}
|
|
382
383
|
role="list"
|
|
383
384
|
aria-label=${this.tags.length>1?"merkelapper":"merkelapp"}
|
|
384
385
|
>
|
|
385
|
-
${this.tags.map(t=>
|
|
386
|
+
${this.tags.map(t=>y`
|
|
386
387
|
<pkt-tag
|
|
387
388
|
role="listitem"
|
|
388
389
|
textStyle="normal-text"
|
|
389
390
|
size="medium"
|
|
390
|
-
skin=${
|
|
391
|
-
iconName=${
|
|
391
|
+
skin=${A(t.skin)}
|
|
392
|
+
iconName=${A(t.iconName)}
|
|
392
393
|
>
|
|
393
394
|
<span>${t.text}</span>
|
|
394
395
|
</pkt-tag>
|
|
395
396
|
`)}
|
|
396
397
|
</div>
|
|
397
|
-
`:
|
|
398
|
-
`}renderSlot(){return
|
|
399
|
-
${this.defaultSlot&&
|
|
400
|
-
`}renderMetadata(){return
|
|
401
|
-
${this.metaLead||this.metaTrail?
|
|
398
|
+
`:x}
|
|
399
|
+
`}renderSlot(){return y`
|
|
400
|
+
${this.defaultSlot&&y`<section class="pkt-card__content" ${X(this.defaultSlot)}></section>`}
|
|
401
|
+
`}renderMetadata(){return y`
|
|
402
|
+
${this.metaLead||this.metaTrail?y`
|
|
402
403
|
<footer class="pkt-card__metadata">
|
|
403
|
-
${this.metaLead?
|
|
404
|
-
${this.metaTrail?
|
|
404
|
+
${this.metaLead?y`<span class="pkt-card__metadata-lead">${this.metaLead}</span>`:x}
|
|
405
|
+
${this.metaTrail?y`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:x}
|
|
405
406
|
</footer>
|
|
406
|
-
`:
|
|
407
|
-
`}};
|
|
407
|
+
`:x}
|
|
408
|
+
`}};ht([u({type:String})],ot.prototype,"ariaLabel",2),ht([u({type:String})],ot.prototype,"metaLead",2),ht([u({type:Boolean})],ot.prototype,"borderOnHover",2),ht([u({type:String,reflect:!0})],ot.prototype,"clickCardLink",2),ht([u({type:String})],ot.prototype,"metaTrail",2),ht([u({type:String})],ot.prototype,"layout",2),ht([u({type:String})],ot.prototype,"heading",2),ht([u({type:Number})],ot.prototype,"headinglevel",2),ht([u({type:Object})],ot.prototype,"image",2),ht([u({type:String})],ot.prototype,"imageShape",2),ht([u({type:Boolean})],ot.prototype,"openLinkInNewTab",2),ht([u({type:String})],ot.prototype,"padding",2),ht([u({type:String,converter:{fromAttribute:s=>{const e=hn.props.skin.type;return s&&e.includes(s)?s:(s&&!e.includes(s)&&console.warn(`Invalid skin value "${s}". Using default skin "${hn.props.skin.default}".`),hn.props.skin.default)},toAttribute:s=>s}})],ot.prototype,"skin",2),ht([u({type:String})],ot.prototype,"subheading",2),ht([u({type:String})],ot.prototype,"tagPosition",2),ht([u({type:Array})],ot.prototype,"tags",2),ot=ht([ge("pkt-card")],ot);/**
|
|
408
409
|
* @license
|
|
409
410
|
* Copyright 2017 Google LLC
|
|
410
411
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
411
|
-
*/const ba=(s,e,t)=>{const i=new Map;for(let n=e;n<=t;n++)i.set(s[n],n);return i},Bn=ps(class extends Ls{constructor(s){if(super(s),s.type!==Mt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const n=[],r=[];let a=0;for(const l of s)n[a]=i?i(l,a):a,r[a]=t(l,a),a++;return{values:r,keys:n}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const n=Tl(s),{values:r,keys:a}=this.dt(e,t,i);if(!Array.isArray(n))return this.ut=a,r;const l=this.ut??(this.ut=[]),d=[];let p,m,b=0,y=n.length-1,k=0,g=r.length-1;for(;b<=y&&k<=g;)if(n[b]===null)b++;else if(n[y]===null)y--;else if(l[b]===a[k])d[k]=fs(n[b],r[k]),b++,k++;else if(l[y]===a[g])d[g]=fs(n[y],r[g]),y--,g--;else if(l[b]===a[g])d[g]=fs(n[b],r[g]),li(s,d[g+1],n[b]),b++,g--;else if(l[y]===a[k])d[k]=fs(n[y],r[k]),li(s,n[b],n[y]),y--,k++;else if(p===void 0&&(p=ba(a,k,g),m=ba(l,b,y)),p.has(l[b]))if(p.has(l[y])){const $=m.get(a[k]),T=$!==void 0?n[$]:null;if(T===null){const M=li(s,n[b]);fs(M,r[k]),d[k]=M}else d[k]=fs(T,r[k]),li(s,n[b],T),n[$]=null;k++}else Cn(n[y]),y--;else Cn(n[b]),b++;for(;k<=g;){const $=li(s,d[g+1]);fs($,r[k]),d[k++]=$}for(;b<=y;){const $=n[b++];$!==null&&Cn($)}return this.ut=a,Ur(s,d),mt}}),ya=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),Ud=s=>new Promise(e=>setTimeout(e,s)),is=()=>{const s=ya(),e=ya();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)},vt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},jd={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},wt={props:jd};var qd={},ka;function Wd(){return ka||(ka=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,i=new WeakMap,n=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,d=new WeakMap,p=new WeakMap,m=new WeakMap,b=new WeakMap,y=new WeakMap,k=new WeakMap,g=new WeakMap,$=new WeakMap,T={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},M=(f,u)=>{for(let _ in T){u[_]=null;let x=null;const L=T[_];Object.defineProperty(u,_,{get(){return x},set(U){x=U,f.isConnected?C(f,L,U):m.set(f,u)}})}};function S(f){const u=n.get(f),{form:_}=u;Pe(f,_,u),ie(f,u.labels)}const O=(f,u=!1)=>{const _=document.createTreeWalker(f,NodeFilter.SHOW_ELEMENT,{acceptNode(U){return n.has(U)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let x=_.nextNode();const L=!u||f.disabled;for(;x;)x.formDisabledCallback&&L&&H(x,f.disabled),x=_.nextNode()},N={attributes:!0,attributeFilter:["disabled","name"]},V=Se()?new MutationObserver(f=>{for(const u of f){const _=u.target;if(u.attributeName==="disabled"&&(_.constructor.formAssociated?H(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&O(_)),u.attributeName==="name"&&_.constructor.formAssociated){const x=n.get(_),L=p.get(_);x.setFormValue(L)}}}):{};function X(f){f.forEach(u=>{const{addedNodes:_,removedNodes:x}=u,L=Array.from(_),U=Array.from(x);L.forEach(R=>{var pt;if(n.has(R)&&R.constructor.formAssociated&&S(R),m.has(R)){const Je=m.get(R);Object.keys(T).filter(ft=>Je[ft]!==null).forEach(ft=>{C(R,T[ft],Je[ft])}),m.delete(R)}if($.has(R)){const Je=$.get(R);C(R,"internals-valid",Je.validity.valid.toString()),C(R,"internals-invalid",(!Je.validity.valid).toString()),C(R,"aria-invalid",(!Je.validity.valid).toString()),$.delete(R)}if(R.localName==="form"){const Je=d.get(R),ft=document.createTreeWalker(R,NodeFilter.SHOW_ELEMENT,{acceptNode(ti){return n.has(ti)&&ti.constructor.formAssociated&&!(Je&&Je.has(ti))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Os=ft.nextNode();for(;Os;)S(Os),Os=ft.nextNode()}R.localName==="fieldset"&&((pt=V.observe)===null||pt===void 0||pt.call(V,R,N),O(R,!0))}),U.forEach(R=>{const pt=n.get(R);pt&&i.get(pt)&&W(pt),l.has(R)&&l.get(R).disconnect()})})}function te(f){f.forEach(u=>{const{removedNodes:_}=u;_.forEach(x=>{const L=k.get(u.target);n.has(x)&&Ve(x),L.disconnect()})})}const we=f=>{var u,_;const x=new MutationObserver(te);!((u=window==null?void 0:window.ShadyDOM)===null||u===void 0)&&u.inUse&&f.mode&&f.host&&(f=f.host),(_=x.observe)===null||_===void 0||_.call(x,f,{childList:!0}),k.set(f,x)};Se()&&new MutationObserver(X);const j={childList:!0,subtree:!0},C=(f,u,_)=>{f.getAttribute(u)!==_&&f.setAttribute(u,_)},H=(f,u)=>{f.toggleAttribute("internals-disabled",u),u?C(f,"aria-disabled","true"):f.removeAttribute("aria-disabled"),f.formDisabledCallback&&f.formDisabledCallback.apply(f,[u])},W=f=>{i.get(f).forEach(u=>{u.remove()}),i.set(f,[])},Q=(f,u)=>{const _=document.createElement("input");return _.type="hidden",_.name=f.getAttribute("name"),f.after(_),i.get(u).push(_),_},se=(f,u)=>{var _;i.set(u,[]),(_=V.observe)===null||_===void 0||_.call(V,f,N)},ie=(f,u)=>{if(u.length){Array.from(u).forEach(x=>x.addEventListener("click",f.click.bind(f)));let _=u[0].id;u[0].id||(_=`${u[0].htmlFor}_Label`,u[0].id=_),C(f,"aria-labelledby",_)}},pe=f=>{const u=Array.from(f.elements).filter(U=>!U.tagName.includes("-")&&U.validity).map(U=>U.validity.valid),_=d.get(f)||[],x=Array.from(_).filter(U=>U.isConnected).map(U=>n.get(U).validity.valid),L=[...u,...x].includes(!1);f.toggleAttribute("internals-invalid",L),f.toggleAttribute("internals-valid",!L)},ne=f=>{pe(re(f.target))},ve=f=>{pe(re(f.target))},K=f=>{const u=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${f.id?`,${_}[form='${f.id}']`:""}`).join(",");f.addEventListener("click",_=>{if(_.target.closest(u)){const x=d.get(f);if(f.noValidate)return;x.size&&Array.from(x).reverse().map(L=>n.get(L).reportValidity()).includes(!1)&&_.preventDefault()}})},G=f=>{const u=d.get(f.target);u&&u.size&&u.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},Pe=(f,u,_)=>{if(u){const x=d.get(u);if(x)x.add(f);else{const L=new Set;L.add(f),d.set(u,L),K(u),u.addEventListener("reset",G),u.addEventListener("input",ne),u.addEventListener("change",ve)}a.set(u,{ref:f,internals:_}),f.constructor.formAssociated&&f.formAssociatedCallback&&setTimeout(()=>{f.formAssociatedCallback.apply(f,[u])},0),pe(u)}},re=f=>{let u=f.parentNode;return u&&u.tagName!=="FORM"&&(u=re(u)),u},ae=(f,u,_=DOMException)=>{if(!f.constructor.formAssociated)throw new _(u)},tt=(f,u,_)=>{const x=d.get(f);return x&&x.size&&x.forEach(L=>{n.get(L)[_]()||(u=!1)}),u},Ve=f=>{if(f.constructor.formAssociated){const u=n.get(f),{labels:_,form:x}=u;ie(f,_),Pe(f,x,u)}};function Se(){return typeof MutationObserver<"u"}class Ge{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const lt=f=>(f.badInput=!1,f.customError=!1,f.patternMismatch=!1,f.rangeOverflow=!1,f.rangeUnderflow=!1,f.stepMismatch=!1,f.tooLong=!1,f.tooShort=!1,f.typeMismatch=!1,f.valid=!0,f.valueMissing=!1,f),xe=(f,u,_)=>(f.valid=Ne(u),Object.keys(u).forEach(x=>f[x]=u[x]),_&&pe(_),f),Ne=f=>{let u=!0;for(let _ in f)_!=="valid"&&f[_]!==!1&&(u=!1);return u},Xe=new WeakMap;function Ue(f,u){f.toggleAttribute(u,!0),f.part&&f.part.add(u)}class Qe extends Set{static get isPolyfilled(){return!0}constructor(u){if(super(),!u||!u.tagName||u.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Xe.set(this,u)}add(u){if(!/^--/.test(u)||typeof u!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${u} must start with '--'.`);const _=super.add(u),x=Xe.get(this),L=`state${u}`;return x.isConnected?Ue(x,L):setTimeout(()=>{Ue(x,L)}),_}clear(){for(let[u]of this.entries())this.delete(u);super.clear()}delete(u){const _=super.delete(u),x=Xe.get(this);return x.isConnected?(x.toggleAttribute(`state${u}`,!1),x.part&&x.part.remove(`state${u}`)):setTimeout(()=>{x.toggleAttribute(`state${u}`,!1),x.part&&x.part.remove(`state${u}`)}),_}}function ue(f,u,_,x){if(typeof u=="function"?f!==u||!x:!u.has(f))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?x:_==="a"?x.call(f):x?x.value:u.get(f)}function Me(f,u,_,x,L){if(typeof u=="function"?f!==u||!0:!u.has(f))throw new TypeError("Cannot write private member to an object whose class did not declare it");return u.set(f,_),_}var Ae;class st{constructor(u){Ae.set(this,void 0),Me(this,Ae,u);for(let _=0;_<u.length;_++){let x=u[_];this[_]=x,x.hasAttribute("name")&&(this[x.getAttribute("name")]=x)}Object.freeze(this)}get length(){return ue(this,Ae,"f").length}[(Ae=new WeakMap,Symbol.iterator)](){return ue(this,Ae,"f")[Symbol.iterator]()}item(u){return this[u]==null?null:this[u]}namedItem(u){return this[u]==null?null:this[u]}}function le(){const f=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const u=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=x;function _(...U){let R=f.apply(this,U);return tt(this,R,"checkValidity")}function x(...U){let R=u.apply(this,U);return tt(this,R,"reportValidity")}const{get:L}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...U){const R=L.call(this,...U),pt=Array.from(d.get(this)||[]);if(pt.length===0)return R;const Je=Array.from(R).concat(pt).sort((ft,Os)=>ft.compareDocumentPosition?ft.compareDocumentPosition(Os)&2?1:-1:0);return new st(Je)}})}class q{static get isPolyfilled(){return!0}constructor(u){if(!u||!u.tagName||u.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=u.getRootNode(),x=new Ge;this.states=new Qe(u),e.set(this,u),t.set(this,x),n.set(u,this),M(u,this),se(u,this),Object.seal(this),_ instanceof DocumentFragment&&we(_)}checkValidity(){const u=e.get(this);if(ae(u,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const x=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});u.dispatchEvent(x)}return _.valid}get form(){const u=e.get(this);ae(u,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return u.constructor.formAssociated===!0&&(_=re(u)),_}get labels(){const u=e.get(this);ae(u,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=u.getAttribute("id"),x=u.getRootNode();return x&&_?x.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const u=e.get(this);if(ae(u,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),x=y.get(this);if(x&&!u.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&x&&(u.focus(),x.focus()),_}setFormValue(u){const _=e.get(this);if(ae(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),W(this),u!=null&&!(u instanceof FormData)){if(_.getAttribute("name")){const x=Q(_,this);x.value=u}}else u!=null&&u instanceof FormData&&Array.from(u).reverse().forEach(([x,L])=>{if(typeof L=="string"){const U=Q(_,this);U.name=x,U.value=L}});p.set(_,u)}setValidity(u,_,x){const L=e.get(this);if(ae(L,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!u)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");y.set(this,x);const U=t.get(this),R={};for(const ft in u)R[ft]=u[ft];Object.keys(R).length===0&<(U);const pt=Object.assign(Object.assign({},U),R);delete pt.valid;const{valid:Je}=xe(U,pt,this.form);if(!Je&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Je?"":_),L.isConnected?(L.toggleAttribute("internals-invalid",!Je),L.toggleAttribute("internals-valid",Je),C(L,"aria-invalid",`${!Je}`)):$.set(L,this)}get shadowRoot(){const u=e.get(this);return b.get(u)||null}get validationMessage(){const u=e.get(this);return ae(u,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const u=e.get(this);return ae(u,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const u=e.get(this);return ae(u,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(u.disabled||u.hasAttribute("disabled")||u.hasAttribute("readonly"))}}function ce(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class f extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const u=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(u,f);const _=new f;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(x=>x in _.internals)}let be=!1,ye=!1;function je(f){ye||(ye=!0,window.CustomStateSet=Qe,f&&(HTMLElement.prototype.attachInternals=function(...u){const _=f.call(this,u);return _.states=new Qe(this),_}))}function Ze(f=!0){if(!be){if(be=!0,typeof window<"u"&&(window.ElementInternals=q),typeof CustomElementRegistry<"u"){const u=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,x,L){if(x.formAssociated){const U=x.prototype.connectedCallback;x.prototype.connectedCallback=function(){g.has(this)||(g.set(this,!0),this.hasAttribute("disabled")&&H(this,!0)),U!=null&&U.apply(this),Ve(this)}}u.call(this,_,x,L)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(n.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new q(this)}),typeof Element<"u"){let u=function(...x){const L=_.apply(this,x);if(b.set(this,L),Se()){const U=new MutationObserver(X);window.ShadyDOM?U.observe(this,j):U.observe(L,j),l.set(this,U)}return L};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=u}Se()&&typeof document<"u"&&new MutationObserver(X).observe(document.documentElement,j),typeof HTMLFormElement<"u"&&le(),(f||typeof window<"u"&&!window.CustomStateSet)&&je()}}return customElements.polyfillWrapFlushCallback||(ce()?typeof window<"u"&&!window.CustomStateSet&&je(HTMLElement.prototype.attachInternals):Ze(!1)),s.forceCustomStateSetPolyfill=je,s.forceElementInternalsPolyfill=Ze,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),qd}Wd();var zd=Object.defineProperty,J=(s,e,t,i)=>{for(var n=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=a(e,t,n)||n);return n&&zd(e,t,n),n};const _a="on",Fn="--checked",en=",";let z=class extends _e{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=is(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=wt.props.helptextDropdownButton.default,this.label=null,this.optionalText=gt.forms.labels.optional,this.requiredText=gt.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,i,n,r,a,l,d,p,m,b,y;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},gt.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(i=e.validity)!=null&&i.badInput?this.internals.setValidity({typeMismatch:!0},gt.forms.messages.invalid,e):(n=e.validity)!=null&&n.patternMismatch?this.internals.setValidity({patternMismatch:!0},gt.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},gt.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},gt.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?gt.forms.messages.rangeUnderflowMin.replace("{min}",(d=this.min)==null?void 0:d.toString()):gt.forms.messages.rangeUnderflow,e):(p=e.validity)!=null&&p.stepMismatch?this.internals.setValidity({stepMismatch:!0},gt.forms.messages.invalid,e):(m=e.validity)!=null&&m.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?gt.forms.messages.rangeOverflowMax.replace("{max}",(b=this.max)==null?void 0:b.toString()):gt.forms.messages.rangeOverflow,e):(y=e.validity)!=null&&y.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(i=>{t.append(this.name,i)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var i;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const n=t;n.checked&&(n.checked=!1,n.internals&&(n.internals.setFormValue(null),(i=n.internals.states)==null||i.delete(Fn)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),i=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const n=(typeof this.value=="string"?this.value:"")||_a;this.internals.setFormValue(n),i&&i.append(this.name,n),this.internals.states.add(Fn)}else this.internals.setFormValue(null),i&&i.delete(this.name),this.internals.states.delete(Fn);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(en)&&(e=e.split(en)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(en)?e.split(en):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const i=t?(typeof this.value=="string"?this.value:"")||_a:null;this.internals.setFormValue(i)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};J([c({type:Boolean,reflect:!0})],z.prototype,"checked"),J([c({type:Boolean})],z.prototype,"defaultChecked"),J([c({type:Boolean})],z.prototype,"multiple"),J([c({type:Boolean})],z.prototype,"range"),J([c({type:String,reflect:!0})],z.prototype,"type"),J([c()],z.prototype,"defaultValue"),J([c({type:Boolean,reflect:!0})],z.prototype,"disabled"),J([c({type:Boolean,reflect:!0})],z.prototype,"readonly"),J([c({type:Boolean,reflect:!0})],z.prototype,"required"),J([c({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],z.prototype,"max"),J([c({type:Number,reflect:!0})],z.prototype,"maxlength"),J([c({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],z.prototype,"min"),J([c({type:Number,reflect:!0})],z.prototype,"minlength"),J([c({type:Number,reflect:!0})],z.prototype,"step"),J([c({type:String})],z.prototype,"ariaDescribedBy"),J([c({type:String})],z.prototype,"ariaLabelledby"),J([c({type:String,reflect:!0})],z.prototype,"name"),J([c({type:String,reflect:!0})],z.prototype,"pattern"),J([c({type:String,reflect:!0})],z.prototype,"placeholder"),J([c({type:String,reflect:!0})],z.prototype,"id"),J([c({type:Boolean})],z.prototype,"counter"),J([c({type:Boolean})],z.prototype,"hasError"),J([c({type:Boolean})],z.prototype,"inline"),J([c({type:Boolean})],z.prototype,"hasFieldset"),J([c({type:Boolean})],z.prototype,"optionalTag"),J([c({type:Boolean})],z.prototype,"requiredTag"),J([c({type:Boolean})],z.prototype,"skipForwardTestid"),J([c({type:Boolean,reflect:!0,converter:vt})],z.prototype,"useWrapper"),J([c({type:Boolean,reflect:!0})],z.prototype,"fullwidth"),J([c({type:Number})],z.prototype,"counterMaxLength"),J([c({type:String})],z.prototype,"errorMessage"),J([c({type:String})],z.prototype,"helptext"),J([c({type:String})],z.prototype,"helptextDropdown"),J([c({type:String,reflect:!1})],z.prototype,"helptextDropdownButton"),J([c({type:String})],z.prototype,"label"),J([c({type:String,reflect:!1})],z.prototype,"optionalText"),J([c({type:String,reflect:!1})],z.prototype,"requiredText"),J([c({type:String,reflect:!1})],z.prototype,"tagText"),J([c({type:String,attribute:"data-testid"})],z.prototype,"dataTestid");let $a=class{constructor(e){this.nodes=[],this.options=[],this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(i=>{i.type==="childList"&&(i.addedNodes.forEach(n=>{Bs(n)&&(this.addNode(n),t=!0)}),i.removedNodes.forEach(n=>{Bs(n)&&(this.nodes=this.nodes.filter(r=>r!==n),t=!0)})),i.type==="attributes"&&Bs(i.target)&&(this.addNode(i.target),t=!0)}),t&&this.createOptions()}};var Yd=Object.defineProperty,Kd=Object.getOwnPropertyDescriptor,_s=(s,e,t,i)=>{for(var n=i>1?void 0:i?Kd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Yd(e,t,n),n};let Yt=class extends _e{constructor(){super(),this.defaultSlot=B(),this.forId=is(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=wt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new Ie(this,this.defaultSlot)}updateSlots(e){this.filledSlots=new Set(e)}render(){const e=()=>{const n=!this.isHelpTextOpen;this.isHelpTextOpen=n,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:n}}))},t=I({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),i=()=>this.helptextDropdown?v`<div class="pkt-inputwrapper__helptext-expandable">
|
|
412
|
-
<button
|
|
413
|
-
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
414
|
-
type="button"
|
|
415
|
-
@click=${e}
|
|
416
|
-
>
|
|
417
|
-
<pkt-icon
|
|
418
|
-
class="pkt-btn__icon"
|
|
419
|
-
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
420
|
-
></pkt-icon>
|
|
421
|
-
<span class="pkt-btn__text">${Gi(this.helptextDropdownButton)}</span>
|
|
422
|
-
</button>
|
|
423
|
-
<div
|
|
424
|
-
class="${I({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
425
|
-
>
|
|
426
|
-
${Gi(this.helptextDropdown)}
|
|
427
|
-
</div>
|
|
428
|
-
</div>`:w;return v`${v`<div class="${t}">
|
|
429
|
-
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
430
|
-
<div class="pkt-contents" ${F(this.defaultSlot)} name="helptext"></div>
|
|
431
|
-
${this.helptext&&Gi(this.helptext)}
|
|
432
|
-
</div>
|
|
433
|
-
${i()}
|
|
434
|
-
</div>`}`}};_s([c({type:String,reflect:!0})],Yt.prototype,"forId",2),_s([c({type:String})],Yt.prototype,"helptext",2),_s([c({type:String})],Yt.prototype,"helptextDropdown",2),_s([c({type:String})],Yt.prototype,"helptextDropdownButton",2),_s([Z()],Yt.prototype,"isHelpTextOpen",2),_s([Z()],Yt.prototype,"filledSlots",2),Yt=_s([ee("pkt-helptext")],Yt);var Gd=Object.defineProperty,Xd=Object.getOwnPropertyDescriptor,De=(s,e,t,i)=>{for(var n=i>1?void 0:i?Xd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Gd(e,t,n),n};let Ce=class extends _e{constructor(){super(),this.defaultSlot=B(),this.helptextSlot=B(),this.forId=is(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=wt.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=wt.props.optionalTag.default,this.optionalText=wt.props.optionalText.default,this.requiredTag=wt.props.requiredTag.default,this.requiredText=wt.props.requiredText.default,this.tagText=null,this.hasError=wt.props.hasError.default,this.errorMessage="",this.disabled=wt.props.disabled.default,this.inline=wt.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=wt.props.hasFieldset.default,this.role="group",this.useWrapper=wt.props.useWrapper.default,this.slotController=new Ie(this,this.defaultSlot,this.helptextSlot)}updated(e){super.updated(e)}render(){const e={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},t="pkt-tag pkt-tag--small pkt-tag--thin-text",i=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:w,n=()=>v`
|
|
435
|
-
${this.tagText?v`<span class=${t+" pkt-tag--gray"}>${this.tagText}</span>`:w}
|
|
436
|
-
${this.optionalTag?v`<span class=${t+" pkt-tag--blue-light"}>${this.optionalText}</span>`:w}
|
|
437
|
-
${this.requiredTag?v`<span class=${t+" pkt-tag--beige"}>${this.requiredText}</span>`:w}
|
|
438
|
-
`,r=()=>this.useWrapper?this.hasFieldset?v`<legend
|
|
439
|
-
class="pkt-inputwrapper__legend"
|
|
440
|
-
id="${this.forId}-label"
|
|
441
|
-
@click=${this.handleLabelClick}
|
|
442
|
-
>
|
|
443
|
-
${this.label} ${n()}
|
|
444
|
-
</legend>`:v`<label
|
|
445
|
-
class="pkt-inputwrapper__label"
|
|
446
|
-
for="${this.forId}"
|
|
447
|
-
aria-describedby="${i}"
|
|
448
|
-
id="${this.forId}-label"
|
|
449
|
-
@click=${this.handleLabelClick}
|
|
450
|
-
>${this.label}${n()}</label
|
|
451
|
-
>`:v`<label
|
|
452
|
-
for="${this.forId}"
|
|
453
|
-
class="pkt-sr-only"
|
|
454
|
-
aria-describedby="${i}"
|
|
455
|
-
id="${this.forId}-label"
|
|
456
|
-
>
|
|
457
|
-
${this.label}
|
|
458
|
-
</label>`,a=()=>v`
|
|
459
|
-
<pkt-helptext
|
|
460
|
-
class="${P(this.useWrapper?void 0:"pkt-hide")}"
|
|
461
|
-
.forId=${this.forId}
|
|
462
|
-
.helptext=${this.helptext}
|
|
463
|
-
.helptextDropdown=${this.helptextDropdown}
|
|
464
|
-
.helptextDropdownButton=${this.helptextDropdownButton||wt.props.helptextDropdownButton.default}
|
|
465
|
-
@toggleHelpText=${b=>{this.toggleDropdown(b)}}
|
|
466
|
-
${F(this.helptextSlot)}
|
|
467
|
-
name="helptext"
|
|
468
|
-
></pkt-helptext>
|
|
469
|
-
`,l=()=>this.counter?v`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
470
|
-
${this.counterError?this.counterError:w} ${this.counterCurrent||0}
|
|
471
|
-
${this.counterMaxLength?`/${this.counterMaxLength}`:w}
|
|
472
|
-
</div>`:w,d=()=>this.hasError&&this.errorMessage?v`<pkt-alert
|
|
473
|
-
skin="error"
|
|
474
|
-
compact
|
|
475
|
-
id=${`${this.forId}-error`}
|
|
476
|
-
aria-live="assertive"
|
|
477
|
-
aria-atomic="true"
|
|
478
|
-
>
|
|
479
|
-
${Gi(this.errorMessage)}
|
|
480
|
-
</pkt-alert>`:w,p=()=>v`
|
|
481
|
-
${r()}
|
|
482
|
-
${a()}
|
|
483
|
-
${this.counterPosition==="top"?l():w}
|
|
484
|
-
<div class="pkt-contents" ${F(this.defaultSlot)}></div>
|
|
485
|
-
${this.counterPosition==="bottom"?l():w}
|
|
486
|
-
${d()}
|
|
487
|
-
`,m=()=>this.hasFieldset?v`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${i}">
|
|
488
|
-
${p()}
|
|
489
|
-
</fieldset>`:v`<div class="pkt-inputwrapper__fieldset">${p()}</div>`;return v`<div class=${I(e)}>${m()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};De([c({type:String})],Ce.prototype,"forId",2),De([c({type:String})],Ce.prototype,"label",2),De([c({type:String})],Ce.prototype,"helptext",2),De([c({type:String})],Ce.prototype,"helptextDropdown",2),De([c({type:String})],Ce.prototype,"helptextDropdownButton",2),De([c({type:Boolean})],Ce.prototype,"counter",2),De([c({type:Number})],Ce.prototype,"counterCurrent",2),De([c({type:Number})],Ce.prototype,"counterMaxLength",2),De([c({type:String})],Ce.prototype,"counterError",2),De([c({type:String,reflect:!1})],Ce.prototype,"counterPosition",2),De([c({type:Boolean})],Ce.prototype,"optionalTag",2),De([c({type:String})],Ce.prototype,"optionalText",2),De([c({type:Boolean})],Ce.prototype,"requiredTag",2),De([c({type:String})],Ce.prototype,"requiredText",2),De([c({type:String})],Ce.prototype,"tagText",2),De([c({type:Boolean})],Ce.prototype,"hasError",2),De([c({type:String})],Ce.prototype,"errorMessage",2),De([c({type:Boolean})],Ce.prototype,"disabled",2),De([c({type:Boolean})],Ce.prototype,"inline",2),De([c({type:String})],Ce.prototype,"ariaDescribedby",2),De([c({type:Boolean})],Ce.prototype,"hasFieldset",2),De([c({type:String,reflect:!0})],Ce.prototype,"role",2),De([c({type:Boolean,reflect:!0,converter:vt})],Ce.prototype,"useWrapper",2),Ce=De([ee("pkt-input-wrapper")],Ce);var Qd=Object.defineProperty,Zd=Object.getOwnPropertyDescriptor,ct=(s,e,t,i)=>{for(var n=i>1?void 0:i?Zd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Qd(e,t,n),n};let nt=class extends _e{constructor(){super(...arguments),this.id=is(),this.label=null,this.options=[],this.isOpen=!1,this.disabled=!1,this.includeSearch=!1,this.isMultiSelect=!1,this.allowUserInput=!1,this.maxIsReached=!1,this.customUserInput=null,this.searchPlaceholder=null,this.searchValue=null,this.maxLength=0,this.userMessage=null,this._selectedOptions=0,this._filteredOptions=[]}connectedCallback(){super.connectedCallback(),this.includeSearch&&!this.searchValue&&(this.searchValue=""),this.options.length>0&&this.filterOptions(),this.setAttribute("tabindex","-1"),this.addEventListener("focus",this.focusFirstOrSelectedOption)}updated(e){(e.has("options")||e.has("searchValue"))&&this.filterOptions(),super.updated(e)}attributeChangedCallback(e,t,i){(e==="options"||e==="searchValue"||e==="search-value")&&this.filterOptions(),super.attributeChangedCallback(e,t,i)}render(){return v`
|
|
412
|
+
*/const lo=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},kr=Es(class extends nn{constructor(s){if(super(s),s.type!==Ht.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let a=0;for(const l of s)i[a]=n?n(l,a):a,r[a]=t(l,a),a++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=Tc(s),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=a,r;const l=this.ut??(this.ut=[]),c=[];let p,g,b=0,f=i.length-1,k=0,v=r.length-1;for(;b<=f&&k<=v;)if(i[b]===null)b++;else if(i[f]===null)f--;else if(l[b]===a[k])c[k]=Ps(i[b],r[k]),b++,k++;else if(l[f]===a[v])c[v]=Ps(i[f],r[v]),f--,v--;else if(l[b]===a[v])c[v]=Ps(i[b],r[v]),En(s,c[v+1],i[b]),b++,v--;else if(l[f]===a[k])c[k]=Ps(i[f],r[k]),En(s,i[b],i[f]),f--,k++;else if(p===void 0&&(p=lo(a,k,v),g=lo(l,b,f)),p.has(l[b]))if(p.has(l[f])){const $=g.get(a[k]),M=$!==void 0?i[$]:null;if(M===null){const S=En(s,i[b]);Ps(S,r[k]),c[k]=S}else c[k]=Ps(M,r[k]),En(s,i[b],M),i[$]=null;k++}else lr(i[f]),f--;else lr(i[b]),b++;for(;k<=v;){const $=En(s,c[v+1]);Ps($,r[k]),c[k++]=$}for(;b<=f;){const $=i[b++];$!==null&&lr($)}return this.ut=a,Oa(s,c),wt}}),co=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),Hd=s=>new Promise(e=>setTimeout(e,s)),ws=()=>{const s=co(),e=co();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)},Jt=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,uo=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},jd=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},ho=s=>s.value+(s.label||"")+(s.prefix||""),Di=(s,e)=>e!==null&&s>=e,qd=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},Wd=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},zd=s=>/^[\p{L} ]$/u.test(s),Yd=(s=500)=>{let e="",t;return{append:n=>(e+=n.toLowerCase(),t!==void 0&&clearTimeout(t),t=setTimeout(()=>{e=""},s),e),reset:()=>{e="",t!==void 0&&(clearTimeout(t),t=void 0)},getBuffer:()=>e}},Kd=(s,e)=>{const t=e.toLowerCase();return s.findIndex(n=>{var i;return(i=n.textContent)==null?void 0:i.trim().toLowerCase().startsWith(t)})},cs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},Yn=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),Gd=s=>{const e=s.nextElementSibling;e&&cs(e)},Xd=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&cs(i)}else n&&cs(n)},yr=s=>{const e=Yn(s);e[0]&&cs(e[0])},po=s=>{const e=Yn(s),t=e[e.length-1];t&&cs(t)},Qd=(s,e)=>{if(e.disabled)return;const t=Yn(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){cs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){cs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&cs(t[0])};var Zd=Object.defineProperty,Jd=Object.getOwnPropertyDescriptor,bt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Jd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Zd(e,t,i),i};let pt=class extends Oe{constructor(){super(...arguments),this.id=ws(),this.label=null,this.options=[],this.isOpen=!1,this.disabled=!1,this.includeSearch=!1,this.isMultiSelect=!1,this.allowUserInput=!1,this.maxIsReached=!1,this.customUserInput=null,this.searchPlaceholder=null,this.searchValue=null,this.maxLength=0,this.userMessage=null,this._selectedOptions=0,this.typeahead=Yd(),this._filteredOptions=[]}connectedCallback(){super.connectedCallback(),this.includeSearch&&!this.searchValue&&(this.searchValue=""),this.options.length>0&&this.filterOptions(),this.setAttribute("tabindex","-1"),this.addEventListener("focus",this.focusFirstOrSelectedOption)}disconnectedCallback(){super.disconnectedCallback(),this.typeahead.reset()}updated(e){(e.has("options")||e.has("searchValue"))&&this.filterOptions(),super.updated(e)}attributeChangedCallback(e,t,n){(e==="options"||e==="search-value")&&this.filterOptions(),super.attributeChangedCallback(e,t,n)}get _hasOptions(){return this._filteredOptions.length>0||this.options.length>0}render(){return y`
|
|
490
413
|
<div
|
|
491
|
-
class=${
|
|
492
|
-
role
|
|
493
|
-
aria-multiselectable=${
|
|
494
|
-
aria-label=${
|
|
414
|
+
class=${z({"pkt-listbox":!0,"pkt-listbox__open":this.isOpen,"pkt-txt-16-light":!0})}
|
|
415
|
+
role=${A(this._hasOptions?"listbox":void 0)}
|
|
416
|
+
aria-multiselectable=${A(this._hasOptions&&this.isMultiSelect?"true":void 0)}
|
|
417
|
+
aria-label=${A(this._hasOptions?this.label??void 0:void 0)}
|
|
495
418
|
>
|
|
496
419
|
<div class="pkt-listbox__banners">
|
|
497
|
-
${this.renderMaximumReachedBanner()} ${this.renderUserMessage()}
|
|
498
|
-
${this.
|
|
420
|
+
${this.renderSearch()} ${this.renderMaximumReachedBanner()} ${this.renderUserMessage()}
|
|
421
|
+
${this.renderEmptyMessage()} ${this.renderNewOptionBanner()}
|
|
499
422
|
</div>
|
|
500
423
|
<ul class="pkt-listbox__options" role="presentation">
|
|
501
424
|
${this.renderList()}
|
|
502
425
|
</ul>
|
|
503
426
|
</div>
|
|
504
|
-
|
|
427
|
+
<div aria-live="polite" class="pkt-visually-hidden">${this.userMessage}</div>
|
|
428
|
+
`}renderCheckboxOrCheckIcon(e,t){return this.isMultiSelect?y`
|
|
505
429
|
<input
|
|
506
430
|
class="pkt-input-check__input-checkbox"
|
|
507
431
|
type="checkbox"
|
|
@@ -512,32 +436,36 @@
|
|
|
512
436
|
aria-labelledby=${this.id+"-option-label-"+t}
|
|
513
437
|
?disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected}
|
|
514
438
|
/>
|
|
515
|
-
`:e.selected?
|
|
516
|
-
|
|
439
|
+
`:e.selected?y`<pkt-icon name="check-big"></pkt-icon>`:x}renderEmptyMessage(){return this.options.length>0||this._filteredOptions.length>0||this.userMessage?x:y`<div class="pkt-listbox__banner pkt-listbox__banner--empty">
|
|
440
|
+
<pkt-icon class="pkt-listbox__banner-icon" name="exclamation-mark-circle" size="large"></pkt-icon>
|
|
441
|
+
Tom liste
|
|
442
|
+
</div>`}renderList(){return y`
|
|
443
|
+
${kr(this._filteredOptions,e=>e.value,(e,t)=>y`
|
|
517
444
|
<li
|
|
518
445
|
@click=${()=>{this.toggleOption(e)}}
|
|
519
446
|
aria-selected=${e.selected?"true":"false"}
|
|
520
447
|
@keydown=${this.handleOptionKeydown}
|
|
521
|
-
class=${
|
|
448
|
+
class=${z({"pkt-listbox__option":!0,"pkt-listbox__option--selected":!!(!this.isMultiSelect&&e.selected),"pkt-listbox__option--checkBox":this.isMultiSelect})}
|
|
522
449
|
tabindex="${this.disabled||e.disabled?"-1":"0"}"
|
|
523
450
|
data-index=${t}
|
|
524
451
|
data-value=${e.value}
|
|
525
452
|
data-selected=${e.selected?"true":"false"}
|
|
526
453
|
?data-disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected}
|
|
454
|
+
aria-disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected?"true":"false"}
|
|
527
455
|
role="option"
|
|
528
456
|
id=${`${this.id}-${t}`}
|
|
529
457
|
>
|
|
530
458
|
${this.renderCheckboxOrCheckIcon(e,t)}
|
|
531
459
|
<span class="pkt-listbox__option-label" id=${this.id+"-option-label-"+t}>
|
|
532
|
-
${e.prefix?
|
|
460
|
+
${e.prefix?y`<span class="pkt-listbox__option-prefix">${e.prefix}</span>`:x}
|
|
533
461
|
${e.label||e.value}
|
|
534
462
|
</span>
|
|
535
|
-
${e.description?
|
|
463
|
+
${e.description?y`<span class="pkt-listbox__option-description pkt-txt-14-light"
|
|
536
464
|
>${e.description}</span
|
|
537
|
-
>`:
|
|
465
|
+
>`:x}
|
|
538
466
|
</li>
|
|
539
467
|
`)}
|
|
540
|
-
`}renderNewOptionBanner(){return this.allowUserInput&&this.customUserInput?
|
|
468
|
+
`}renderNewOptionBanner(){return this.allowUserInput&&this.customUserInput?y`
|
|
541
469
|
<div
|
|
542
470
|
class="pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option"
|
|
543
471
|
data-type="new-option"
|
|
@@ -548,20 +476,20 @@
|
|
|
548
476
|
@keydown=${this.handleOptionKeydown}
|
|
549
477
|
>
|
|
550
478
|
<pkt-icon class="pkt-listbox__banner-icon" name="plus-sign" size="large"></pkt-icon>
|
|
551
|
-
Legg til
|
|
479
|
+
Legg til "${this.customUserInput}"
|
|
552
480
|
</div>
|
|
553
|
-
`:
|
|
481
|
+
`:x}renderMaximumReachedBanner(){return this._selectedOptions=this.options.filter(e=>e.selected).length,this.isMultiSelect&&this._selectedOptions>0&&this.maxLength>0?y`
|
|
554
482
|
<div class="pkt-listbox__banner pkt-listbox__banner--maximum-reached">
|
|
555
483
|
${this._selectedOptions} av maks ${this.maxLength} mulige er valgt.
|
|
556
484
|
</div>
|
|
557
|
-
`:
|
|
485
|
+
`:x}renderUserMessage(){return this.userMessage?y`<div class="pkt-listbox__banner pkt-listbox__banner--user-message">
|
|
558
486
|
<pkt-icon
|
|
559
487
|
class="pkt-listbox__banner-icon"
|
|
560
488
|
name="exclamation-mark-circle"
|
|
561
489
|
size="large"
|
|
562
490
|
></pkt-icon>
|
|
563
491
|
${this.userMessage}
|
|
564
|
-
</div>`:
|
|
492
|
+
</div>`:x}renderSearch(){return this.includeSearch?y`
|
|
565
493
|
<div class="pkt-listbox__search">
|
|
566
494
|
<span class="pkt-listbox__search-icon">
|
|
567
495
|
<pkt-icon name="magnifying-glass-small" size="large"></pkt-icon>
|
|
@@ -571,7 +499,7 @@
|
|
|
571
499
|
type="text"
|
|
572
500
|
aria-label="Søk i listen"
|
|
573
501
|
form=""
|
|
574
|
-
placeholder=${this.searchPlaceholder
|
|
502
|
+
placeholder=${this.searchPlaceholder||$t.forms.search.placeholder}
|
|
575
503
|
@input=${this.handleSearchInput}
|
|
576
504
|
@keydown=${this.handleSearchKeydown}
|
|
577
505
|
.value=${this.searchValue}
|
|
@@ -581,12 +509,90 @@
|
|
|
581
509
|
role="searchbox"
|
|
582
510
|
/>
|
|
583
511
|
</div>
|
|
584
|
-
`:w}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":case"Tab":this.focusFirstOrSelectedOption();break}}handleOptionKeydown(e){const t=e.currentTarget,i=t.dataset.value,n=t.dataset.type,r=t.dataset.selected==="true";if(!(!this.getOptionElements().length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&n!=="new-option"&&n!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":i&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":case"Tab":this.closeOptions();break;case"ArrowDown":e.altKey?this.focusLastOption():n==="searchbox"||n==="new-option"?this.focusFirstOption():this.focusNextOption(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)this.focusFirstOption();else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else this.focusPreviousOption(t);e.preventDefault();break;case"Home":this.focusFirstOption(),e.preventDefault();break;case"End":this.focusLastOption(),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),this.isLetterOrSpace(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusAndScrollIntoView(e){e.scrollIntoView({block:"nearest"}),window.setTimeout(()=>e.focus(),0)}focusNextOption(e){const t=e.nextElementSibling;t&&this.focusAndScrollIntoView(t)}focusPreviousOption(e){const t=e.previousElementSibling;if(e.dataset.index==="0"&&this.includeSearch){const i=this.querySelector('[role="searchbox"]');i&&this.focusAndScrollIntoView(i)}else t&&this.focusAndScrollIntoView(t)}focusFirstOption(){const e=this.getOptionElements()[0];e&&this.focusAndScrollIntoView(e)}focusLastOption(){const e=this.getOptionElements().pop();e&&this.focusAndScrollIntoView(e)}focusFirstOrSelectedOption(){if(this.disabled)return;const e=this.getOptionElements().find(t=>t.dataset.selected==="true");if(this.allowUserInput&&this.customUserInput){const t=this.querySelector('[data-type="new-option"]');this.focusAndScrollIntoView(t)}else if(e)this.focusAndScrollIntoView(e);else if(this.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const t=this.querySelector('[role="searchbox"]');window.setTimeout(()=>t.focus(),0)}else this.focusFirstOption()}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const i=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:i,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}filterOptions(){this.searchValue?this._filteredOptions=this.options.filter(e=>{var t;return(e.fulltext||e.label+e.value+(e.prefix||"")).toLowerCase().includes(((t=this.searchValue)==null?void 0:t.toLowerCase())||"")}):this._filteredOptions=[...this.options]}isLetterOrSpace(e){return/^[\p{L} ]$/u.test(e)}handleTypeAhead(e){this.typeAheadString+=e.toLowerCase(),this.typeAheadTimeout&&clearTimeout(this.typeAheadTimeout),this.typeAheadTimeout=window.setTimeout(()=>{this.typeAheadString=""},500);const t=this.getOptionElements().find(i=>{var n;return(n=i.textContent)==null?void 0:n.trim().toLowerCase().startsWith(this.typeAheadString)});t&&this.focusAndScrollIntoView(t)}getOptionElements(){return this._filteredOptions.length?Array.from(this.querySelectorAll('[role="option"]:not([data-disabled])')||[]):[]}};ct([c({type:String})],nt.prototype,"id",2),ct([c({type:String})],nt.prototype,"label",2),ct([c({type:Array})],nt.prototype,"options",2),ct([c({type:Boolean,reflect:!0})],nt.prototype,"isOpen",2),ct([c({type:Boolean})],nt.prototype,"disabled",2),ct([c({type:Boolean})],nt.prototype,"includeSearch",2),ct([c({type:Boolean})],nt.prototype,"isMultiSelect",2),ct([c({type:Boolean})],nt.prototype,"allowUserInput",2),ct([c({type:Boolean})],nt.prototype,"maxIsReached",2),ct([c({type:String})],nt.prototype,"customUserInput",2),ct([c({type:String})],nt.prototype,"searchPlaceholder",2),ct([c({type:String})],nt.prototype,"searchValue",2),ct([c({type:Number})],nt.prototype,"maxLength",2),ct([c({type:String})],nt.prototype,"userMessage",2),ct([Z()],nt.prototype,"_filteredOptions",2),nt=ct([ee("pkt-listbox")],nt);const Jd={displayValueAs:{default:"label"}},Rd={props:Jd};var eu=Object.defineProperty,tu=Object.getOwnPropertyDescriptor,Le=(s,e,t,i)=>{for(var n=i>1?void 0:i?tu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&eu(e,t,n),n};let Ee=class extends z{constructor(){super(),this.helptextSlot=B(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=Rd.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=B(),this.arrowRef=B(),this.listboxRef=B(),this.focusRef=B(),this.optionTagRef=B(),this.optionsController=new $a(this),this.slotController=new Ie(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){var e,t;if(super.connectedCallback(),document&&document.body.addEventListener("click",i=>{this._isOptionsOpen&&!this.contains(i.target)&&this.handleFocusOut(i)}),this._options=[],this.defaultOptions&&this.defaultOptions.length){const i=((e=this.options)==null?void 0:e.filter(n=>n.userAdded))||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const i=[];this.optionsController.nodes.forEach(n=>{if(!n.textContent&&!n.getAttribute("value"))return null;const r={value:n.getAttribute("value")||n.textContent||"",label:n.textContent||n.getAttribute("value")||""};n.getAttribute("data-prefix")&&(r.prefix=n.getAttribute("data-prefix")||void 0),n.getAttribute("tagskincolor")&&(r.tagSkinColor=n.getAttribute("tagskincolor")),n.getAttribute("description")&&(r.description=n.getAttribute("description")||void 0),r.fulltext=r.value+r.label+(r.prefix||""),i.push(r)}),i.length&&(this.options=[...i],this._options=[...i])}}updated(e){if(e.has("_value")&&this.valueChanged(this._value,e.get("_value")),e.has("value")&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),e.has("defaultOptions")&&this.defaultOptions.length){const t=(Array.isArray(this.options)?this.options:[]).filter(i=>i.userAdded)||[];this.options=[...t,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const t=(e.get("options")||this._options||[]).filter(n=>n&&n.userAdded).filter(n=>!(Array.isArray(this.options)?this.options:[]).some(r=>r.value===n.value)),i=[...t,...this.options];this._options=i,t.length>0&&(this.options=i),this._options.forEach(n=>{if(n.value&&!n.label&&(n.label=n.value),n.selected&&!this._value.includes(n.value)){const r=[...this._value];this._value=[...this._value,n.value],this.valueChanged(this._value,r)}n.fulltext=n.value+n.label+(n.prefix||""),n.selected=n.selected||this._value.includes(n.value)})}e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(e)}attributeChangedCallback(e,t,i){e==="value"&&(Array.isArray(this.value)?this._value=this.value:this.value&&this.multiple?this._value=this.value.split(","):this.value?this._value=[this.value]:this._value=[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),e==="options"&&(this._options=Array.isArray(this.options)?[...this.options]:[],this._options.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!this._value.includes(n.value)&&(this._value=[...this._value,n.value]),n.fulltext=n.value+n.label+(n.prefix||"")}),this._search=""),super.attributeChangedCallback(e,t,i)}render(){return v`
|
|
512
|
+
`:x}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,n=t.dataset.value,i=t.dataset.type,r=t.dataset.selected==="true";if(!(!Yn(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":n&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?po(this):i==="searchbox"||i==="new-option"?yr(this):Gd(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)yr(this);else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else Xd(t,this,this.includeSearch);e.preventDefault();break;case"Home":yr(this),e.preventDefault();break;case"End":po(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),zd(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){Qd(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=jd(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),n=Yn(this),i=Kd(n,t);i>=0&&cs(n[i])}};bt([u({type:String})],pt.prototype,"id",2),bt([u({type:String})],pt.prototype,"label",2),bt([u({type:Array})],pt.prototype,"options",2),bt([u({type:Boolean,reflect:!0,attribute:"is-open"})],pt.prototype,"isOpen",2),bt([u({type:Boolean})],pt.prototype,"disabled",2),bt([u({type:Boolean,attribute:"include-search"})],pt.prototype,"includeSearch",2),bt([u({type:Boolean,attribute:"is-multi-select"})],pt.prototype,"isMultiSelect",2),bt([u({type:Boolean,attribute:"allow-user-input"})],pt.prototype,"allowUserInput",2),bt([u({type:Boolean,attribute:"max-is-reached"})],pt.prototype,"maxIsReached",2),bt([u({type:String,attribute:"custom-user-input"})],pt.prototype,"customUserInput",2),bt([u({type:String,attribute:"search-placeholder"})],pt.prototype,"searchPlaceholder",2),bt([u({type:String,attribute:"search-value"})],pt.prototype,"searchValue",2),bt([u({type:Number,attribute:"max-length"})],pt.prototype,"maxLength",2),bt([u({type:String,attribute:"user-message"})],pt.prototype,"userMessage",2),bt([ce()],pt.prototype,"_filteredOptions",2),pt=bt([ge("pkt-listbox")],pt);const xt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},Rd={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Dt={props:Rd};var eh={},fo;function th(){return fo||(fo=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,p=new WeakMap,g=new WeakMap,b=new WeakMap,f=new WeakMap,k=new WeakMap,v=new WeakMap,$=new WeakMap,M={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},S=(m,h)=>{for(let _ in M){h[_]=null;let C=null;const j=M[_];Object.defineProperty(h,_,{get(){return C},set(W){C=W,m.isConnected?N(m,j,W):g.set(m,h)}})}};function T(m){const h=i.get(m),{form:_}=h;Ue(m,_,h),ae(m,h.labels)}const L=(m,h=!1)=>{const _=document.createTreeWalker(m,NodeFilter.SHOW_ELEMENT,{acceptNode(W){return i.has(W)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let C=_.nextNode();const j=!h||m.disabled;for(;C;)C.formDisabledCallback&&j&&q(C,m.disabled),C=_.nextNode()},D={attributes:!0,attributeFilter:["disabled","name"]},Y=ne()?new MutationObserver(m=>{for(const h of m){const _=h.target;if(h.attributeName==="disabled"&&(_.constructor.formAssociated?q(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&L(_)),h.attributeName==="name"&&_.constructor.formAssociated){const C=i.get(_),j=p.get(_);C.setFormValue(j)}}}):{};function ee(m){m.forEach(h=>{const{addedNodes:_,removedNodes:C}=h,j=Array.from(_),W=Array.from(C);j.forEach(de=>{var it;if(i.has(de)&&de.constructor.formAssociated&&T(de),g.has(de)){const Re=g.get(de);Object.keys(M).filter(Le=>Re[Le]!==null).forEach(Le=>{N(de,M[Le],Re[Le])}),g.delete(de)}if($.has(de)){const Re=$.get(de);N(de,"internals-valid",Re.validity.valid.toString()),N(de,"internals-invalid",(!Re.validity.valid).toString()),N(de,"aria-invalid",(!Re.validity.valid).toString()),$.delete(de)}if(de.localName==="form"){const Re=c.get(de),Le=document.createTreeWalker(de,NodeFilter.SHOW_ELEMENT,{acceptNode(Gt){return i.has(Gt)&&Gt.constructor.formAssociated&&!(Re&&Re.has(Gt))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Kt=Le.nextNode();for(;Kt;)T(Kt),Kt=Le.nextNode()}de.localName==="fieldset"&&((it=Y.observe)===null||it===void 0||it.call(Y,de,D),L(de,!0))}),W.forEach(de=>{const it=i.get(de);it&&n.get(it)&&B(it),l.has(de)&&l.get(de).disconnect()})})}function oe(m){m.forEach(h=>{const{removedNodes:_}=h;_.forEach(C=>{const j=k.get(h.target);i.has(C)&&De(C),j.disconnect()})})}const ye=m=>{var h,_;const C=new MutationObserver(oe);!((h=window==null?void 0:window.ShadyDOM)===null||h===void 0)&&h.inUse&&m.mode&&m.host&&(m=m.host),(_=C.observe)===null||_===void 0||_.call(C,m,{childList:!0}),k.set(m,C)};ne()&&new MutationObserver(ee);const K={childList:!0,subtree:!0},N=(m,h,_)=>{m.getAttribute(h)!==_&&m.setAttribute(h,_)},q=(m,h)=>{m.toggleAttribute("internals-disabled",h),h?N(m,"aria-disabled","true"):m.removeAttribute("aria-disabled"),m.formDisabledCallback&&m.formDisabledCallback.apply(m,[h])},B=m=>{n.get(m).forEach(h=>{h.remove()}),n.set(m,[])},G=(m,h)=>{const _=document.createElement("input");return _.type="hidden",_.name=m.getAttribute("name"),m.after(_),n.get(h).push(_),_},le=(m,h)=>{var _;n.set(h,[]),(_=Y.observe)===null||_===void 0||_.call(Y,m,D)},ae=(m,h)=>{if(h.length){Array.from(h).forEach(C=>C.addEventListener("click",m.click.bind(m)));let _=h[0].id;h[0].id||(_=`${h[0].htmlFor}_Label`,h[0].id=_),N(m,"aria-labelledby",_)}},pe=m=>{const h=Array.from(m.elements).filter(W=>!W.tagName.includes("-")&&W.validity).map(W=>W.validity.valid),_=c.get(m)||[],C=Array.from(_).filter(W=>W.isConnected).map(W=>i.get(W).validity.valid),j=[...h,...C].includes(!1);m.toggleAttribute("internals-invalid",j),m.toggleAttribute("internals-valid",!j)},ue=m=>{pe(Q(m.target))},be=m=>{pe(Q(m.target))},se=m=>{const h=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${m.id?`,${_}[form='${m.id}']`:""}`).join(",");m.addEventListener("click",_=>{if(_.target.closest(h)){const C=c.get(m);if(m.noValidate)return;C.size&&Array.from(C).reverse().map(j=>i.get(j).reportValidity()).includes(!1)&&_.preventDefault()}})},re=m=>{const h=c.get(m.target);h&&h.size&&h.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},Ue=(m,h,_)=>{if(h){const C=c.get(h);if(C)C.add(m);else{const j=new Set;j.add(m),c.set(h,j),se(h),h.addEventListener("reset",re),h.addEventListener("input",ue),h.addEventListener("change",be)}a.set(h,{ref:m,internals:_}),m.constructor.formAssociated&&m.formAssociatedCallback&&setTimeout(()=>{m.formAssociatedCallback.apply(m,[h])},0),pe(h)}},Q=m=>{let h=m.parentNode;return h&&h.tagName!=="FORM"&&(h=Q(h)),h},P=(m,h,_=DOMException)=>{if(!m.constructor.formAssociated)throw new _(h)},Me=(m,h,_)=>{const C=c.get(m);return C&&C.size&&C.forEach(j=>{i.get(j)[_]()||(h=!1)}),h},De=m=>{if(m.constructor.formAssociated){const h=i.get(m),{labels:_,form:C}=h;ae(m,_),Ue(m,C,h)}};function ne(){return typeof MutationObserver<"u"}class He{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const Pe=m=>(m.badInput=!1,m.customError=!1,m.patternMismatch=!1,m.rangeOverflow=!1,m.rangeUnderflow=!1,m.stepMismatch=!1,m.tooLong=!1,m.tooShort=!1,m.typeMismatch=!1,m.valid=!0,m.valueMissing=!1,m),$e=(m,h,_)=>(m.valid=Te(h),Object.keys(h).forEach(C=>m[C]=h[C]),_&&pe(_),m),Te=m=>{let h=!0;for(let _ in m)_!=="valid"&&m[_]!==!1&&(h=!1);return h},Ae=new WeakMap;function ze(m,h){m.toggleAttribute(h,!0),m.part&&m.part.add(h)}class We extends Set{static get isPolyfilled(){return!0}constructor(h){if(super(),!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Ae.set(this,h)}add(h){if(!/^--/.test(h)||typeof h!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${h} must start with '--'.`);const _=super.add(h),C=Ae.get(this),j=`state${h}`;return C.isConnected?ze(C,j):setTimeout(()=>{ze(C,j)}),_}clear(){for(let[h]of this.entries())this.delete(h);super.clear()}delete(h){const _=super.delete(h),C=Ae.get(this);return C.isConnected?(C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)):setTimeout(()=>{C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)}),_}}function ve(m,h,_,C){if(typeof h=="function"?m!==h||!C:!h.has(m))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?C:_==="a"?C.call(m):C?C.value:h.get(m)}function E(m,h,_,C,j){if(typeof h=="function"?m!==h||!0:!h.has(m))throw new TypeError("Cannot write private member to an object whose class did not declare it");return h.set(m,_),_}var Ie;class Ye{constructor(h){Ie.set(this,void 0),E(this,Ie,h);for(let _=0;_<h.length;_++){let C=h[_];this[_]=C,C.hasAttribute("name")&&(this[C.getAttribute("name")]=C)}Object.freeze(this)}get length(){return ve(this,Ie,"f").length}[(Ie=new WeakMap,Symbol.iterator)](){return ve(this,Ie,"f")[Symbol.iterator]()}item(h){return this[h]==null?null:this[h]}namedItem(h){return this[h]==null?null:this[h]}}function U(){const m=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const h=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=C;function _(...W){let de=m.apply(this,W);return Me(this,de,"checkValidity")}function C(...W){let de=h.apply(this,W);return Me(this,de,"reportValidity")}const{get:j}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...W){const de=j.call(this,...W),it=Array.from(c.get(this)||[]);if(it.length===0)return de;const Re=Array.from(de).concat(it).sort((Le,Kt)=>Le.compareDocumentPosition?Le.compareDocumentPosition(Kt)&2?1:-1:0);return new Ye(Re)}})}class V{static get isPolyfilled(){return!0}constructor(h){if(!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=h.getRootNode(),C=new He;this.states=new We(h),e.set(this,h),t.set(this,C),i.set(h,this),S(h,this),le(h,this),Object.seal(this),_ instanceof DocumentFragment&&ye(_)}checkValidity(){const h=e.get(this);if(P(h,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const C=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});h.dispatchEvent(C)}return _.valid}get form(){const h=e.get(this);P(h,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return h.constructor.formAssociated===!0&&(_=Q(h)),_}get labels(){const h=e.get(this);P(h,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=h.getAttribute("id"),C=h.getRootNode();return C&&_?C.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const h=e.get(this);if(P(h,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),C=f.get(this);if(C&&!h.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&C&&(h.focus(),C.focus()),_}setFormValue(h){const _=e.get(this);if(P(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),B(this),h!=null&&!(h instanceof FormData)){if(_.getAttribute("name")){const C=G(_,this);C.value=h}}else h!=null&&h instanceof FormData&&Array.from(h).reverse().forEach(([C,j])=>{if(typeof j=="string"){const W=G(_,this);W.name=C,W.value=j}});p.set(_,h)}setValidity(h,_,C){const j=e.get(this);if(P(j,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!h)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");f.set(this,C);const W=t.get(this),de={};for(const Le in h)de[Le]=h[Le];Object.keys(de).length===0&&Pe(W);const it=Object.assign(Object.assign({},W),de);delete it.valid;const{valid:Re}=$e(W,it,this.form);if(!Re&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Re?"":_),j.isConnected?(j.toggleAttribute("internals-invalid",!Re),j.toggleAttribute("internals-valid",Re),N(j,"aria-invalid",`${!Re}`)):$.set(j,this)}get shadowRoot(){const h=e.get(this);return b.get(h)||null}get validationMessage(){const h=e.get(this);return P(h,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const h=e.get(this);return P(h,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const h=e.get(this);return P(h,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(h.disabled||h.hasAttribute("disabled")||h.hasAttribute("readonly"))}}function te(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class m extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const h=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(h,m);const _=new m;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(C=>C in _.internals)}let me=!1,fe=!1;function Xe(m){fe||(fe=!0,window.CustomStateSet=We,m&&(HTMLElement.prototype.attachInternals=function(...h){const _=m.call(this,h);return _.states=new We(this),_}))}function Ke(m=!0){if(!me){if(me=!0,typeof window<"u"&&(window.ElementInternals=V),typeof CustomElementRegistry<"u"){const h=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,C,j){if(C.formAssociated){const W=C.prototype.connectedCallback;C.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute("disabled")&&q(this,!0)),W!=null&&W.apply(this),De(this)}}h.call(this,_,C,j)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(i.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new V(this)}),typeof Element<"u"){let h=function(...C){const j=_.apply(this,C);if(b.set(this,j),ne()){const W=new MutationObserver(ee);window.ShadyDOM?W.observe(this,K):W.observe(j,K),l.set(this,W)}return j};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=h}ne()&&typeof document<"u"&&new MutationObserver(ee).observe(document.documentElement,K),typeof HTMLFormElement<"u"&&U(),(m||typeof window<"u"&&!window.CustomStateSet)&&Xe()}}return customElements.polyfillWrapFlushCallback||(te()?typeof window<"u"&&!window.CustomStateSet&&Xe(HTMLElement.prototype.attachInternals):Ke(!1)),s.forceCustomStateSetPolyfill=Xe,s.forceElementInternalsPolyfill=Ke,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),eh}th();var sh=Object.defineProperty,he=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&sh(e,t,i),i};const go="on",_r="--checked",Oi=",";let ie=class extends Oe{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=ws(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.label=null,this.optionalText=$t.forms.labels.optional,this.requiredText=$t.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,n,i,r,a,l,c,p,g,b,f;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(n=e.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,e):(i=e.validity)!=null&&i.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?$t.forms.messages.rangeUnderflowMin.replace("{min}",(c=this.min)==null?void 0:c.toString()):$t.forms.messages.rangeUnderflow,e):(p=e.validity)!=null&&p.stepMismatch?this.internals.setValidity({stepMismatch:!0},$t.forms.messages.invalid,e):(g=e.validity)!=null&&g.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?$t.forms.messages.rangeOverflowMax.replace("{max}",(b=this.max)==null?void 0:b.toString()):$t.forms.messages.rangeOverflow,e):(f=e.validity)!=null&&f.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(n=>{t.append(this.name,n)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var n;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const i=t;i.checked&&(i.checked=!1,i.internals&&(i.internals.setFormValue(null),(n=i.internals.states)==null||n.delete(_r)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),n=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const i=(typeof this.value=="string"?this.value:"")||go;this.internals.setFormValue(i),n&&n.append(this.name,i),this.internals.states.add(_r)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(_r);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(Oi)&&(e=e.split(Oi)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(Oi)?e.split(Oi):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const n=t?(typeof this.value=="string"?this.value:"")||go:null;this.internals.setFormValue(n)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};he([u({type:Boolean,reflect:!0})],ie.prototype,"checked"),he([u({type:Boolean})],ie.prototype,"defaultChecked"),he([u({type:Boolean})],ie.prototype,"multiple"),he([u({type:Boolean})],ie.prototype,"range"),he([u({type:String,reflect:!0})],ie.prototype,"type"),he([u()],ie.prototype,"defaultValue"),he([u({type:Boolean,reflect:!0})],ie.prototype,"disabled"),he([u({type:Boolean,reflect:!0})],ie.prototype,"readonly"),he([u({type:Boolean,reflect:!0})],ie.prototype,"required"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"max"),he([u({type:Number,reflect:!0})],ie.prototype,"maxlength"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"min"),he([u({type:Number,reflect:!0})],ie.prototype,"minlength"),he([u({type:Number,reflect:!0})],ie.prototype,"step"),he([u({type:String})],ie.prototype,"ariaDescribedBy"),he([u({type:String})],ie.prototype,"ariaLabelledby"),he([u({type:String,reflect:!0})],ie.prototype,"name"),he([u({type:String,reflect:!0})],ie.prototype,"pattern"),he([u({type:String,reflect:!0})],ie.prototype,"placeholder"),he([u({type:String,reflect:!0})],ie.prototype,"id"),he([u({type:Boolean})],ie.prototype,"counter"),he([u({type:Boolean})],ie.prototype,"hasError"),he([u({type:Boolean})],ie.prototype,"inline"),he([u({type:Boolean})],ie.prototype,"hasFieldset"),he([u({type:Boolean})],ie.prototype,"optionalTag"),he([u({type:Boolean})],ie.prototype,"requiredTag"),he([u({type:Boolean})],ie.prototype,"skipForwardTestid"),he([u({type:Boolean,reflect:!0,converter:xt})],ie.prototype,"useWrapper"),he([u({type:Boolean,reflect:!0})],ie.prototype,"fullwidth"),he([u({type:Number})],ie.prototype,"counterMaxLength"),he([u({type:String})],ie.prototype,"errorMessage"),he([u({type:String})],ie.prototype,"helptext"),he([u({type:String})],ie.prototype,"helptextDropdown"),he([u({type:String,reflect:!1})],ie.prototype,"helptextDropdownButton"),he([u({type:String})],ie.prototype,"label"),he([u({type:String,reflect:!1})],ie.prototype,"optionalText"),he([u({type:String,reflect:!1})],ie.prototype,"requiredText"),he([u({type:String,reflect:!1})],ie.prototype,"tagText"),he([u({type:String,attribute:"data-testid"})],ie.prototype,"dataTestid");let mo=class{constructor(e){this.nodes=[],this.options=[],this.generation=0,this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.generation++,this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(n=>{n.type==="childList"&&(n.addedNodes.forEach(i=>{rn(i)&&(this.addNode(i),t=!0)}),n.removedNodes.forEach(i=>{rn(i)&&(this.nodes=this.nodes.filter(r=>r!==i),t=!0)})),n.type==="attributes"&&rn(n.target)&&(this.addNode(n.target),t=!0)}),t&&this.createOptions()}};var nh=Object.defineProperty,ih=Object.getOwnPropertyDescriptor,Us=(s,e,t,n)=>{for(var i=n>1?void 0:n?ih(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&nh(e,t,i),i};let us=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.forId=ws(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.filledSlots=new Set(e)}render(){const e=()=>{const i=!this.isHelpTextOpen;this.isHelpTextOpen=i,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:i}}))},t=z({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),n=()=>this.helptextDropdown?y`<div class="pkt-inputwrapper__helptext-expandable">
|
|
513
|
+
<button
|
|
514
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
515
|
+
type="button"
|
|
516
|
+
@click=${e}
|
|
517
|
+
>
|
|
518
|
+
<pkt-icon
|
|
519
|
+
class="pkt-btn__icon"
|
|
520
|
+
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
521
|
+
></pkt-icon>
|
|
522
|
+
<span class="pkt-btn__text">${xi(this.helptextDropdownButton)}</span>
|
|
523
|
+
</button>
|
|
524
|
+
<div
|
|
525
|
+
class="${z({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
526
|
+
>
|
|
527
|
+
${xi(this.helptextDropdown)}
|
|
528
|
+
</div>
|
|
529
|
+
</div>`:x;return y`${y`<div class="${t}">
|
|
530
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
531
|
+
<div class="pkt-contents" ${X(this.defaultSlot)} name="helptext"></div>
|
|
532
|
+
${this.helptext&&xi(this.helptext)}
|
|
533
|
+
</div>
|
|
534
|
+
${n()}
|
|
535
|
+
</div>`}`}};Us([u({type:String,reflect:!0})],us.prototype,"forId",2),Us([u({type:String})],us.prototype,"helptext",2),Us([u({type:String})],us.prototype,"helptextDropdown",2),Us([u({type:String})],us.prototype,"helptextDropdownButton",2),Us([ce()],us.prototype,"isHelpTextOpen",2),Us([ce()],us.prototype,"filledSlots",2),us=Us([ge("pkt-helptext")],us);var rh=Object.defineProperty,ah=Object.getOwnPropertyDescriptor,je=(s,e,t,n)=>{for(var i=n>1?void 0:n?ah(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rh(e,t,i),i};let Fe=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.helptextSlot=Z(),this.forId=ws(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=Dt.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=Dt.props.optionalTag.default,this.optionalText=Dt.props.optionalText.default,this.requiredTag=Dt.props.requiredTag.default,this.requiredText=Dt.props.requiredText.default,this.tagText=null,this.hasError=Dt.props.hasError.default,this.errorMessage="",this.disabled=Dt.props.disabled.default,this.inline=Dt.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=Dt.props.hasFieldset.default,this.role="group",this.useWrapper=Dt.props.useWrapper.default,this.slotController=new Qe(this,this.defaultSlot,this.helptextSlot)}updated(e){super.updated(e)}render(){const e={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},t="pkt-tag pkt-tag--small pkt-tag--thin-text",n=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:x,i=()=>y`
|
|
536
|
+
${this.tagText?y`<span class=${t+" pkt-tag--gray"}>${this.tagText}</span>`:x}
|
|
537
|
+
${this.optionalTag?y`<span class=${t+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
|
|
538
|
+
${this.requiredTag?y`<span class=${t+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
|
|
539
|
+
`,r=()=>this.useWrapper?this.hasFieldset?y`<legend
|
|
540
|
+
class="pkt-inputwrapper__legend"
|
|
541
|
+
id="${this.forId}-label"
|
|
542
|
+
@click=${this.handleLabelClick}
|
|
543
|
+
>
|
|
544
|
+
${this.label} ${i()}
|
|
545
|
+
</legend>`:y`<label
|
|
546
|
+
class="pkt-inputwrapper__label"
|
|
547
|
+
for="${this.forId}"
|
|
548
|
+
aria-describedby="${n}"
|
|
549
|
+
id="${this.forId}-label"
|
|
550
|
+
@click=${this.handleLabelClick}
|
|
551
|
+
>${this.label}${i()}</label
|
|
552
|
+
>`:y`<label
|
|
553
|
+
for="${this.forId}"
|
|
554
|
+
class="pkt-sr-only"
|
|
555
|
+
aria-describedby="${n}"
|
|
556
|
+
id="${this.forId}-label"
|
|
557
|
+
>
|
|
558
|
+
${this.label}
|
|
559
|
+
</label>`,a=()=>y`
|
|
560
|
+
<pkt-helptext
|
|
561
|
+
class="${A(this.useWrapper?void 0:"pkt-hide")}"
|
|
562
|
+
.forId=${this.forId}
|
|
563
|
+
.helptext=${this.helptext}
|
|
564
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
565
|
+
.helptextDropdownButton=${this.helptextDropdownButton||Dt.props.helptextDropdownButton.default}
|
|
566
|
+
@toggleHelpText=${b=>{this.toggleDropdown(b)}}
|
|
567
|
+
${X(this.helptextSlot)}
|
|
568
|
+
name="helptext"
|
|
569
|
+
></pkt-helptext>
|
|
570
|
+
`,l=()=>this.counter?y`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
571
|
+
${this.counterError?this.counterError:x} ${this.counterCurrent||0}
|
|
572
|
+
${this.counterMaxLength?`/${this.counterMaxLength}`:x}
|
|
573
|
+
</div>`:x,c=()=>this.hasError&&this.errorMessage?y`<pkt-alert
|
|
574
|
+
skin="error"
|
|
575
|
+
compact
|
|
576
|
+
id=${`${this.forId}-error`}
|
|
577
|
+
aria-live="assertive"
|
|
578
|
+
aria-atomic="true"
|
|
579
|
+
>
|
|
580
|
+
${xi(this.errorMessage)}
|
|
581
|
+
</pkt-alert>`:x,p=()=>y`
|
|
582
|
+
${r()}
|
|
583
|
+
${a()}
|
|
584
|
+
${this.counterPosition==="top"?l():x}
|
|
585
|
+
<div class="pkt-contents" ${X(this.defaultSlot)}></div>
|
|
586
|
+
${this.counterPosition==="bottom"?l():x}
|
|
587
|
+
${c()}
|
|
588
|
+
`,g=()=>this.hasFieldset?y`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${n}">
|
|
589
|
+
${p()}
|
|
590
|
+
</fieldset>`:y`<div class="pkt-inputwrapper__fieldset">${p()}</div>`;return y`<div class=${z(e)}>${g()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};je([u({type:String})],Fe.prototype,"forId",2),je([u({type:String})],Fe.prototype,"label",2),je([u({type:String})],Fe.prototype,"helptext",2),je([u({type:String})],Fe.prototype,"helptextDropdown",2),je([u({type:String})],Fe.prototype,"helptextDropdownButton",2),je([u({type:Boolean})],Fe.prototype,"counter",2),je([u({type:Number})],Fe.prototype,"counterCurrent",2),je([u({type:Number})],Fe.prototype,"counterMaxLength",2),je([u({type:String})],Fe.prototype,"counterError",2),je([u({type:String,reflect:!1})],Fe.prototype,"counterPosition",2),je([u({type:Boolean})],Fe.prototype,"optionalTag",2),je([u({type:String})],Fe.prototype,"optionalText",2),je([u({type:Boolean})],Fe.prototype,"requiredTag",2),je([u({type:String})],Fe.prototype,"requiredText",2),je([u({type:String})],Fe.prototype,"tagText",2),je([u({type:Boolean})],Fe.prototype,"hasError",2),je([u({type:String})],Fe.prototype,"errorMessage",2),je([u({type:Boolean})],Fe.prototype,"disabled",2),je([u({type:Boolean})],Fe.prototype,"inline",2),je([u({type:String})],Fe.prototype,"ariaDescribedby",2),je([u({type:Boolean})],Fe.prototype,"hasFieldset",2),je([u({type:String,reflect:!0})],Fe.prototype,"role",2),je([u({type:Boolean,reflect:!0,converter:xt})],Fe.prototype,"useWrapper",2),Fe=je([ge("pkt-input-wrapper")],Fe);const oh=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},lh=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=Jt(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ch=(s,e,t,n,i)=>s.trim().toLowerCase()?{...Wd(s,e,t,n),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!e[0],shouldResetInput:!0},Ei=(s,e,t)=>{const n=Jt(e,s);return t==="label"&&n!=null&&n.label?n.label:s},Kn={markOptionSelected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!0;break}}},markOptionDeselected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!1;break}}},markAllSelected(s){for(const e of s)e.selected=!0},markAllDeselected(s){for(const e of s)e.selected=!1},removeUserAddedOptions(s){return s.filter(e=>!e.userAdded)}},bo={parseOptionsFromSlot(s){const e=[];return s.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return;const n={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(n.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(n.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(n.description=t.getAttribute("description")||void 0),n.fulltext=ho(n),e.push(n)}),e}},wr={syncOptionsWithValues(s,e){const t=[...e];return s.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!t.includes(n.value)&&t.push(n.value),n.fulltext=ho(n),n.selected=n.selected||t.includes(n.value)}),{options:s,newValues:t}},mergeWithUserAdded(s,e){return[...e.filter(t=>(t==null?void 0:t.userAdded)&&t.selected).filter(t=>!(Array.isArray(s)?s:[]).some(n=>n.value===t.value)),...s]}},uh={displayValueAs:{default:"label"}},dh={props:uh};var hh=Object.defineProperty,st=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&hh(e,t,i),i};let Ze=class extends ie{constructor(){super(),this.helptextSlot=Z(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=dh.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=Z(),this.triggerRef=Z(),this.listboxRef=Z(),this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var e,t;this._hasTextInput?(e=this.inputRef.value)==null||e.focus():(t=this.triggerRef.value)==null||t.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(","):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=Di(this._value.length,this.maxlength)}syncValueAndDispatch(e){const t=this._value,n=this.multiple?t.join(","):t[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(n!==i&&(this._internalValueSync=!0,this.value=n),(e==null?void 0:e.join(","))!==t.join(",")){const r=this.multiple?[...t]:t[0]||"";this.onChange(r)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};st([u({type:String,reflect:!0})],Ze.prototype,"value"),st([u({type:Array})],Ze.prototype,"options"),st([u({type:Array,attribute:"default-options"})],Ze.prototype,"defaultOptions"),st([u({type:Boolean,attribute:"allow-user-input"})],Ze.prototype,"allowUserInput"),st([u({type:Boolean})],Ze.prototype,"typeahead"),st([u({type:Boolean,attribute:"include-search"})],Ze.prototype,"includeSearch"),st([u({type:String,attribute:"search-placeholder"})],Ze.prototype,"searchPlaceholder"),st([u({type:Boolean})],Ze.prototype,"multiple"),st([u({type:Number})],Ze.prototype,"maxlength"),st([u({type:String,attribute:"display-value-as"})],Ze.prototype,"displayValueAs"),st([u({type:String,attribute:"tag-placement"})],Ze.prototype,"tagPlacement"),st([u({type:Boolean,attribute:"open"})],Ze.prototype,"isOpen"),st([ce()],Ze.prototype,"_options"),st([ce()],Ze.prototype,"_value"),st([ce()],Ze.prototype,"_isOptionsOpen"),st([ce()],Ze.prototype,"_userInfoMessage"),st([ce()],Ze.prototype,"_addValueText"),st([ce()],Ze.prototype,"_maxIsReached"),st([ce()],Ze.prototype,"_search"),st([ce()],Ze.prototype,"_inputFocus");class ph extends Ze{toggleValue(e){var t,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const i=((t=Jt(this.options,e))==null?void 0:t.value)||null,r=this._value.includes(e||i||""),a=!!i,l=((n=this._options.find(M=>M.value===e))==null?void 0:n.disabled)||!1,c=!(e!=null&&e.trim()),p=!this.multiple,g=this.multiple,b=Di(this._value.length,this.maxlength);let f=!1,k=!0,v="",$="";l||(!a&&this.allowUserInput&&!c?(this.addNewUserValue(e),v="Ny verdi lagt til",f=g):!a&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),k=!1,f=!0,v="Ingen treff i søket"):r?(this.removeValue(i),f=!0,p&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):c&&p?(this.removeAllSelected(),f=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(i),f=!1):g&&!b?(this.setSelected(i),f=!0):g&&b?(v="Maks antall valg nådd",k=!1,$=e):(p&&this.removeAllSelected(),v="Ingen gyldig verdi valgt",k=!1,f=!0,$=e),this._isOptionsOpen=f,f||(p&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=v,this._search=$||"",this.resetComboboxInput(k),g&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&Di(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,Kn.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(n=>n!==e);const t=Jt(this.options,e);t&&(Kn.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(n=>n.value!==e)],this.options=[...this.options.filter(n=>n.value!==e)]):this._options.some(n=>n.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),Kn.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],Kn.markAllDeselected(this._options),this._options=Kn.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!Jt(this.options,e)){if(Di(this._value.length,this.maxlength))return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}}class fh extends ph{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:n,suggestion:i}=qd(this.options,this._search);this._options=n,e.inputType!=="deleteContentBackward"&&i!=null&&i.label&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(t.value=i.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,n;if(this.disabled||!this._isOptionsOpen)return;const i=e.relatedTarget;((t=i==null?void 0:i.closest("pkt-combobox"))==null?void 0:t.id)===this.id||((n=e.target)==null?void 0:n.getAttribute("data-focusfix"))===this.id||i===this.inputRef.value||i===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.inputRef.value.value;if(this.multiple){if(e!==""){const{action:t,value:n}=lh(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case"addUserValue":this.addNewUserValue(n);break;case"selectOption":this.setSelected(n);break;case"removeValue":this.removeValue(n);break}}}else if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{const t=Jt(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}!this.multiple&&this._value[0]?this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){var t,n;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?((t=this.inputRef.value)==null||t.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption()))}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){var t,n;if(!this.disabled)switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(e.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":e.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){var t,n,i;if(e.key==="Backspace"){const a=!((t=this.inputRef.value)!=null&&t.value);!this._search&&a&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const a=this.inputRef.value;if(a&&a.selectionStart===0&&!a.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}const r=oh(e.key,e.shiftKey,this.multiple);if(r&&!(e.key==="Tab"&&!this._isOptionsOpen)){if(r==="focusListbox"&&e.key==="Tab"&&!((n=this.listboxRef.value)!=null&&n.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(e.preventDefault(),r){case"addValue":this.addValue();break;case"focusListbox":(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(".pkt-combobox__input .pkt-combobox__tag-list pkt-tag"))}focusTag(e){var t;const n=this.getInsideTags();n.forEach((r,a)=>{r.buttonTabindex=a===e?0:-1});const i=(t=n[e])==null?void 0:t.querySelector("button");i==null||i.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();const n=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(e.key){case"ArrowLeft":e.preventDefault(),t>0&&this.focusTag(t-1);break;case"ArrowRight":e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case"Backspace":case"Delete":e.preventDefault();{const i=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(i),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case"Tab":this.resetTagTabindices();break;case"Escape":e.preventDefault(),n();break}}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",n=ch(t,this._value,this.options,this.allowUserInput,this.multiple);if(n.shouldRemoveValue&&this.removeValue(this._value[0]),n.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=n.addValueText,this._userInfoMessage=n.userInfoMessage}}var gh=(s,e,t,n)=>{for(var i=e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(i)||i);return i};let vo=class extends fh{constructor(){super(...arguments),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){var e,t;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const n=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...n,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const n=bo.parseOptionsFromSlot(this.optionsController.nodes);n.length&&(this.options=[...n],this._options=[...n],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){const t=this.optionsController.generation;if(t!==this._lastSlotGeneration){this._lastSlotGeneration=t;const n=bo.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(r=>r.userAdded);this.options=[...i,...n]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const t=e.has("value"),n=e.has("_value");if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get("_value"));else if(t){const i=[...this._value],r=this.parseValue();r.join(",")!==this._value.join(",")&&(this._value=r),this.updateMaxReached(),this.syncValueAndDispatch(i)}else n&&this.syncValueAndDispatch(e.get("_value"));if(e.has("defaultOptions")&&this.defaultOptions.length){const i=(Array.isArray(this.options)?this.options:[]).filter(r=>r.userAdded)||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const i=e.get("options")||this._options||[],r=wr.mergeWithUserAdded(this.options,i);this._options=r,r.length>this.options.length&&(this.options=r);const a=wr.syncOptionsWithValues(this._options,this._value);if(this._options=a.options,a.newValues.length>this._value.length){const l=[...this._value];this._value=a.newValues,this.syncValueAndDispatch(l)}}if(e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const i=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==i&&(this.inputRef.value.value=i)}super.updated(e)}formResetCallback(){this.touched=!1;const e=this.defaultValue||(this.multiple,"");this.value=e,this._value=this.parseValue(),this._options=this._options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this.options=this.options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this._search="",this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=""),this.internals.setFormValue(""),this.internals.ariaInvalid="false",this.requestUpdate()}attributeChangedCallback(e,t,n){if(e==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=wr.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(e,t,n)}render(){return y`
|
|
585
591
|
<pkt-input-wrapper
|
|
586
592
|
.label=${this.label}
|
|
587
593
|
.helptext=${this.helptext}
|
|
588
|
-
.helptextDropdown=${
|
|
589
|
-
.helptextDropdownButton=${
|
|
594
|
+
.helptextDropdown=${A(this.helptextDropdown)}
|
|
595
|
+
.helptextDropdownButton=${A(this.helptextDropdownButton)}
|
|
590
596
|
?fullwidth=${this.fullwidth}
|
|
591
597
|
?hasError=${this.hasError}
|
|
592
598
|
?inline=${this.inline}
|
|
@@ -598,47 +604,37 @@
|
|
|
598
604
|
.requiredText=${this.requiredText}
|
|
599
605
|
.tagText=${this.tagText}
|
|
600
606
|
useWrapper=${this.useWrapper}
|
|
601
|
-
.forId=${this.
|
|
607
|
+
.forId=${this._hasTextInput?this.id+"-input":this.id+"-combobox"}
|
|
608
|
+
?hasFieldset=${!this._hasTextInput}
|
|
602
609
|
class="pkt-combobox__wrapper"
|
|
603
610
|
@labelClick=${this.handleInputClick}
|
|
604
611
|
>
|
|
605
|
-
<div class="pkt-contents" ${
|
|
612
|
+
<div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
606
613
|
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
607
614
|
<div
|
|
608
|
-
class=${
|
|
609
|
-
|
|
615
|
+
class=${z({"pkt-combobox__input":!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.disabled})}
|
|
616
|
+
id=${A(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
617
|
+
role=${A(this._hasTextInput?void 0:"combobox")}
|
|
618
|
+
aria-expanded=${A(this._hasTextInput?void 0:this._isOptionsOpen?"true":"false")}
|
|
619
|
+
aria-controls=${A(this._hasTextInput?void 0:`${this.id}-listbox`)}
|
|
620
|
+
aria-haspopup=${A(this._hasTextInput?void 0:"listbox")}
|
|
621
|
+
aria-labelledby=${A(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
|
|
622
|
+
aria-activedescendant=${A(!this._hasTextInput&&this._value[0]&&Jt(this.options,this._value[0])?`${this.id}-listbox-${uo(this._options,this._value[0])}`:void 0)}
|
|
623
|
+
aria-description=${A(this._selectionDescription||void 0)}
|
|
624
|
+
tabindex=${this._hasTextInput||this.disabled?"-1":"0"}
|
|
610
625
|
@click=${this.handleInputClick}
|
|
626
|
+
@keydown=${this._hasTextInput?x:this.handleSelectOnlyKeydown}
|
|
627
|
+
${X(this.triggerRef)}
|
|
611
628
|
>
|
|
612
|
-
${this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?
|
|
629
|
+
${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?y`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
|
|
613
630
|
>${this.placeholder}</span
|
|
614
|
-
>`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():
|
|
631
|
+
>`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():x}
|
|
615
632
|
${this.renderInputField()}
|
|
616
|
-
<
|
|
617
|
-
class
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
${F(this.arrowRef)}
|
|
622
|
-
aria-expanded=${this._isOptionsOpen}
|
|
623
|
-
aria-controls="${this.id}-listbox"
|
|
624
|
-
aria-haspopup="listbox"
|
|
625
|
-
aria-label="Åpne liste"
|
|
626
|
-
?disabled=${this.disabled}
|
|
627
|
-
?data-disabled=${this.disabled}
|
|
628
|
-
role="button"
|
|
629
|
-
tabindex="${this.disabled?"-1":"0"}"
|
|
630
|
-
>
|
|
631
|
-
<pkt-icon
|
|
632
|
-
class=${I({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
633
|
-
name="chevron-thin-down"
|
|
634
|
-
></pkt-icon>
|
|
635
|
-
</div>
|
|
636
|
-
<div
|
|
637
|
-
${F(this.focusRef)}
|
|
638
|
-
tabindex="-1"
|
|
639
|
-
@keydown=${this.handleArrowClick}
|
|
640
|
-
class="pkt-contents"
|
|
641
|
-
></div>
|
|
633
|
+
<pkt-icon
|
|
634
|
+
class=${z({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
635
|
+
name="chevron-thin-down"
|
|
636
|
+
aria-hidden="true"
|
|
637
|
+
></pkt-icon>
|
|
642
638
|
</div>
|
|
643
639
|
|
|
644
640
|
<pkt-listbox
|
|
@@ -647,97 +643,114 @@
|
|
|
647
643
|
.isOpen=${this._isOptionsOpen}
|
|
648
644
|
.searchPlaceholder=${this.searchPlaceholder}
|
|
649
645
|
.label="Liste: ${this.label||""}"
|
|
650
|
-
?
|
|
651
|
-
?
|
|
652
|
-
?
|
|
653
|
-
?
|
|
654
|
-
.customUserInput=${
|
|
646
|
+
?include-search=${this.includeSearch}
|
|
647
|
+
?is-multi-select=${this.multiple}
|
|
648
|
+
?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
|
|
649
|
+
?max-is-reached=${this._maxIsReached}
|
|
650
|
+
.customUserInput=${A(this._addValueText)}
|
|
655
651
|
.userMessage=${this._userInfoMessage}
|
|
656
652
|
@search=${this.handleSearch}
|
|
657
653
|
@option-toggle=${this.handleOptionToggled}
|
|
658
654
|
@select-all=${this.addAllOptions}
|
|
659
655
|
@close-options=${()=>this._isOptionsOpen=!1}
|
|
656
|
+
@tab-close=${()=>this.closeAndProcessInput()}
|
|
660
657
|
.searchValue=${this._search||null}
|
|
661
658
|
.maxLength=${this.maxlength||0}
|
|
662
|
-
${
|
|
659
|
+
${X(this.listboxRef)}
|
|
663
660
|
></pkt-listbox>
|
|
664
661
|
</div>
|
|
665
662
|
|
|
666
|
-
${this.tagPlacement==="outside"&&this.multiple?
|
|
663
|
+
${this.tagPlacement==="outside"&&this.multiple?y`<div class="pkt-combobox__tags-outside">
|
|
667
664
|
${this.renderSingleOrMultipleValues()}
|
|
668
|
-
</div>`:
|
|
665
|
+
</div>`:x}
|
|
669
666
|
</pkt-input-wrapper>
|
|
670
|
-
`}renderInputField(){return this.typeahead||this.allowUserInput?
|
|
667
|
+
`}renderInputField(){return this.typeahead||this.allowUserInput?y`
|
|
671
668
|
<div class="pkt-combobox__input-div combobox__input">
|
|
672
669
|
<input
|
|
673
670
|
type="text"
|
|
674
671
|
id="${this.id}-input"
|
|
675
672
|
name=${(this.name||this.id)+"-input"}
|
|
673
|
+
placeholder=${A(!this._value.length||this.multiple&&this.tagPlacement==="outside"?this.placeholder:void 0)}
|
|
676
674
|
@input=${this.handleInput}
|
|
675
|
+
@change=${e=>{e.stopPropagation(),e.stopImmediatePropagation()}}
|
|
677
676
|
@keydown=${this.handleInputKeydown}
|
|
678
677
|
@focus=${this.handleFocus}
|
|
679
678
|
@blur=${this.handleBlur}
|
|
680
679
|
autocomplete="off"
|
|
681
680
|
role="combobox"
|
|
682
|
-
aria-
|
|
683
|
-
aria-
|
|
681
|
+
aria-expanded=${this._isOptionsOpen?"true":"false"}
|
|
682
|
+
aria-label=${A(this.label)}
|
|
683
|
+
aria-autocomplete=${this.typeahead?"both":this.allowUserInput?"list":"none"}
|
|
684
684
|
aria-controls="${this.id}-listbox"
|
|
685
|
-
aria-activedescendant=${
|
|
686
|
-
|
|
685
|
+
aria-activedescendant=${A(this._value[0]&&Jt(this.options,this._value[0])?`${this.id}-listbox-${uo(this._options,this._value[0])}`:void 0)}
|
|
686
|
+
aria-description=${A(this._selectionDescription||void 0)}
|
|
687
|
+
${X(this.inputRef)}
|
|
687
688
|
/>
|
|
688
689
|
</div>
|
|
689
|
-
`:
|
|
690
|
+
`:y`
|
|
690
691
|
<input
|
|
691
692
|
type="hidden"
|
|
692
693
|
id="${this.id}-input"
|
|
693
694
|
name=${(this.name||this.id)+"-input"}
|
|
694
695
|
.value=${this._value.join(",")}
|
|
695
|
-
${
|
|
696
|
+
${X(this.inputRef)}
|
|
696
697
|
/>
|
|
697
|
-
`}renderSingleOrMultipleValues(){const e=!this.multiple,t=this.
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
698
|
+
`}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return x;const e=!this.multiple,t=this.renderValueTag(Jt(this.options,this._value[0])),n=this.tagPlacement==="outside",i=y`
|
|
699
|
+
<ul role="list" class="pkt-combobox__tag-list">
|
|
700
|
+
${kr(this._value,r=>r,(r,a)=>{const l=Jt(this.options,r),c=l==null?void 0:l.tagSkinColor;return y`
|
|
701
|
+
<li
|
|
702
|
+
role="listitem"
|
|
703
|
+
@click=${n?x:p=>p.stopPropagation()}
|
|
704
|
+
@mousedown=${n?x:p=>p.preventDefault()}
|
|
705
|
+
>
|
|
706
|
+
<pkt-tag
|
|
707
|
+
skin=${c||"blue-dark"}
|
|
708
|
+
?closeTag=${!this.disabled}
|
|
709
|
+
.buttonTabindex=${n?void 0:-1}
|
|
710
|
+
@close=${()=>this.handleTagRemove(r)}
|
|
711
|
+
@keydown=${n?x:p=>this.handleTagKeydown(p,a)}
|
|
712
|
+
>
|
|
713
|
+
${this.renderValueTag(l)}
|
|
714
|
+
</pkt-tag>
|
|
715
|
+
</li>
|
|
716
|
+
`})}
|
|
717
|
+
</ul>
|
|
718
|
+
`;return e?t:i}renderValueTag(e){if(!e)return"";switch(this.displayValueAs){case"prefixAndValue":return y`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
706
719
|
>${e.prefix||""} ${e.value}</span
|
|
707
|
-
>`;case"value":return
|
|
720
|
+
>`;case"value":return y`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
708
721
|
>${e.value}</span
|
|
709
|
-
>`;case"label":default:return
|
|
722
|
+
>`;case"label":default:return y`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
710
723
|
>${e.label||e.value}</span
|
|
711
|
-
>`}}handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){if(this._options=this.options.filter(i=>{var n;return(n=i.fulltext)==null?void 0:n.toLowerCase().includes(this._search.toLowerCase())}),e.inputType!=="deleteContentBackward"){const i=this._options.filter(n=>{var r;return!n.selected&&((r=n.label)==null?void 0:r.toLowerCase().startsWith(this._search.toLowerCase()))});if(i.length>0&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const n=i[0];n!=null&&n.label&&(t.value=n.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}}}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.findValueInOptions(this._value[0]);this._editingSingleValue=!0,this.inputRef.value.value=this.displayValueAs==="label"&&e!=null&&e.label?e.label:this._value[0]}this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,i,n,r,a;if(!this.disabled&&((i=(t=e.relatedTarget)==null?void 0:t.closest("pkt-combobox"))==null?void 0:i.id)!==this.id&&((r=(n=e.relatedTarget)==null?void 0:n.closest("pkt-combobox"))==null?void 0:r.id)!==this.id&&((a=e.target)==null?void 0:a.getAttribute("data-focusfix"))!==this.id&&e.relatedTarget!==this.focusRef.value&&e.relatedTarget!==this.inputRef.value&&e.relatedTarget!==this.arrowRef.value&&this._isOptionsOpen){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"&&this.inputRef.value.value!==""){const l=this.inputRef.value.value,d=this.findValueInOptions(l);!this._value.includes(l)&&!d?this.allowUserInput?this.addNewUserValue(l):this.multiple||this.removeValue(this._value[0]):d&&!this._value.includes(d.value)&&this.setSelected(d.value),this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}}handleBlur(){this._inputFocus=!1,this._editingSingleValue=!1,this.onBlur()}handleInputClick(e){var t,i;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.currentTarget&&e.currentTarget!==this.arrowRef.value&&((t=this.inputRef.value)==null?void 0:t.type)!=="hidden"?((i=this.inputRef.value)==null||i.focus(),this.requestUpdate()):this.handleArrowClick(e)}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()))}handleArrowClick(e){var t,i;this.disabled||e instanceof KeyboardEvent&&e.key&&e.key!=="Enter"&&e.key!==" "&&e.key!=="ArrowDown"||(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen?(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption():(i=this.arrowRef.value)==null||i.focus())}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase()}handleInputKeydown(e){var t,i,n;switch(e.key){case",":this.multiple&&(e.preventDefault(),this.addValue());break;case"Enter":e.preventDefault(),this.addValue();break;case"Backspace":!this._search&&((t=this.inputRef.value)==null?void 0:t.type)==="hidden"&&this.removeLastValue(e);break;case"Tab":case"ArrowDown":e.shiftKey||((i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption(),e.preventDefault());break;case"Escape":this._isOptionsOpen=!1,(n=this.arrowRef.value)==null||n.focus(),e.preventDefault();break}}handleTagRemove(e){this.removeSelected(e)}blurInput(){this.inputRef.value&&this.inputRef.value.matches(":focus")&&this.inputRef.value.blur()}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",i=t.trim().toLowerCase()||"";if(!i){!this.multiple&&this._value[0]&&this.removeValue(this._value[0]),this.resetComboboxInput(!1);return}const n=this._value.find(l=>l.toLowerCase()===i),r=this._options.filter(l=>{var d;return((d=l.label)==null?void 0:d.toLowerCase().includes(i))??!1}),a=r.find(l=>{var d;return((d=l.label)==null?void 0:d.toLowerCase())===i||l.value.toLowerCase()===i});switch(!0){case((r.length===0||!a)&&this.allowUserInput):this._addValueText=t,this._userInfoMessage="";break;case(r.length===0&&!this._options.length&&!this.allowUserInput):this._addValueText=null,this._userInfoMessage="Ingen match i søket";break;case!!n:this._addValueText=null,this._userInfoMessage="Verdien er allerede valgt";break;case r.length>1:this._addValueText=null,this._userInfoMessage="";break;default:this._addValueText=null,this._userInfoMessage=""}}findValueInOptions(e){return this.options.find(t=>t.value===e||t.label===e)||null}findIndexInOptions(e){return this._options.findIndex(t=>t.value===e||t.label===e)}isMaxItemsReached(){const e=this.maxlength!==null&&this._value.length>=this.maxlength;return e?this._maxIsReached=!0:this._maxIsReached=!1,e}toggleValue(e){var t,i;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const n=((t=this.findValueInOptions(e))==null?void 0:t.value)||null,r=this._value.includes(e||n||""),a=!!n,l=((i=this._options.find(T=>T.value===e))==null?void 0:i.disabled)||!1,d=!(e!=null&&e.trim()),p=!this.multiple,m=this.multiple,b=this.isMaxItemsReached();let y=!1,k=!0,g="",$="";l||(!a&&this.allowUserInput&&!d?(this.addNewUserValue(e),g="Ny verdi lagt til",y=!m):!a&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),k=!1,y=!0,g="Ingen treff i søket"):r?(this.removeValue(n),y=!0):d&&p?(this.removeAllSelected(),y=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(n),y=!1,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="",this.inputRef.value.blur())):m&&!b?(this.setSelected(n),y=!0):m&&b?(this._userInfoMessage="Maks antall valg nådd",k=!1,$=e):(p&&this.removeAllSelected(),this._userInfoMessage="Ingen gyldig verdi valgt",k=!1,y=!0,$=e),this._isOptionsOpen=y,y||window.setTimeout(()=>{var T;(T=this.focusRef.value)==null||T.focus()},0),this._userInfoMessage=g,this._search=$||"",this.resetComboboxInput(k),m&&this.isMaxItemsReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&this.isMaxItemsReached()){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,this._options=this._options.map(t=>(t.value===e&&(t.selected=!0),t)),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(i=>i!==e);const t=this.findValueInOptions(e);t?(t.selected=!1,t.userAdded?(this._options=[...this._options.filter(i=>i.value!==e)],this.options=[...this.options.filter(i=>i.value!==e)]):this._options=[...this._options,t]):!e&&!this.multiple&&(this._options=this._options.map(i=>(i.selected=!1,i)))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),this._options=this._options.map(e=>(e.selected=!0,e)),this.requestUpdate()}}removeAllSelected(){this._value=[],this._options=this._options.map(e=>(e.selected=!1,e)),this._options=this._options.filter(e=>!e.userAdded),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";this._search=t,this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e],this._isOptionsOpen=!1,this.blurInput();else if(!this.findValueInOptions(e)){if(this.isMaxItemsReached())return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.setSelected(e),this.requestUpdate()}resetComboboxInput(e=!0){if(this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e)if(this._search="",this.multiple)this.inputRef.value.value="";else{const t=this.findValueInOptions(this._value[0]);window.setTimeout(()=>{!this.inputRef.value||this.inputRef.value.type==="hidden"||(this.inputRef.value.value=this.displayValueAs==="label"&&t!=null&&t.label?t.label:this._value[0]||"")},0),this._userInfoMessage=""}this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.isMaxItemsReached()}};Le([c({type:String,reflect:!0})],Ee.prototype,"value",2),Le([c({type:Array})],Ee.prototype,"options",2),Le([c({type:Array})],Ee.prototype,"defaultOptions",2),Le([c({type:Boolean})],Ee.prototype,"allowUserInput",2),Le([c({type:Boolean})],Ee.prototype,"typeahead",2),Le([c({type:Boolean})],Ee.prototype,"includeSearch",2),Le([c({type:String})],Ee.prototype,"searchPlaceholder",2),Le([c({type:Boolean})],Ee.prototype,"multiple",2),Le([c({type:Number})],Ee.prototype,"maxlength",2),Le([c({type:String})],Ee.prototype,"displayValueAs",2),Le([c({type:String})],Ee.prototype,"tagPlacement",2),Le([Z()],Ee.prototype,"_options",2),Le([Z()],Ee.prototype,"_value",2),Le([Z()],Ee.prototype,"_isOptionsOpen",2),Le([Z()],Ee.prototype,"_userInfoMessage",2),Le([Z()],Ee.prototype,"_addValueText",2),Le([Z()],Ee.prototype,"_maxIsReached",2),Le([Z()],Ee.prototype,"_search",2),Le([Z()],Ee.prototype,"_inputFocus",2),Le([Z()],Ee.prototype,"_editingSingleValue",2),Ee=Le([ee("pkt-combobox")],Ee);const su={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}};var iu=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,Ht=(s,e,t,i)=>{for(var n=i>1?void 0:i?nu(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&iu(e,t,n),n};let Hn=null;function ru(){return Hn||(Hn=new Promise((s,e)=>{if(document.querySelector("#oslo-consent-script")){s();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>s(),t.onerror=e,document.head.appendChild(t);const i=document.createElement("link");i.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",i.type="text/css",i.rel="stylesheet",i.id="oslo-consent-styles",document.head.appendChild(i)}),Hn)}let Tt=class extends _e{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||su.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const t=this.returnJsonOrObject(e.value).items.reduce((i,n)=>(i[n.name]=n.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:t,bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await ru(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const t={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(t),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=i=>{this.emitCookieConsents(i)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?v`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?v`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
724
|
+
>`}}};vo=gh([ge("pkt-combobox")],vo);const mh={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}};var bh=Object.defineProperty,vh=Object.getOwnPropertyDescriptor,Rt=(s,e,t,n)=>{for(var i=n>1?void 0:n?vh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&bh(e,t,i),i};let $r=null;function kh(){return $r||($r=new Promise((s,e)=>{if(document.querySelector("#oslo-consent-script")){s();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>s(),t.onerror=e,document.head.appendChild(t);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),$r)}let Lt=class extends Oe{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||mh.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const t=this.returnJsonOrObject(e.value).items.reduce((n,i)=>(n[i.name]=i.consent,n),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:t,bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await kh(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const t={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(t),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=n=>{this.emitCookieConsents(n)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?y`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?y`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
712
725
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
713
726
|
${this.triggerText}
|
|
714
|
-
</a>`:this.triggerType==="icon"?
|
|
727
|
+
</a>`:this.triggerType==="icon"?y`<pkt-button
|
|
715
728
|
skin="tertiary"
|
|
716
729
|
variant="icon-only"
|
|
717
730
|
iconName="cookie"
|
|
718
731
|
@click=${this.openModal}
|
|
719
732
|
>
|
|
720
733
|
>${this.triggerText}</pkt-button
|
|
721
|
-
>`:
|
|
722
|
-
${this.tagText?
|
|
723
|
-
${this.optionalTag?
|
|
724
|
-
${this.requiredTag?
|
|
725
|
-
`,a=()=>
|
|
726
|
-
<label class=${
|
|
734
|
+
>`:y`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};Rt([u({type:Boolean})],Lt.prototype,"devMode",2),Rt([u({type:String})],Lt.prototype,"hotjarId",2),Rt([u({type:String})],Lt.prototype,"googleAnalyticsId",2),Rt([u({type:String})],Lt.prototype,"cookieDomain",2),Rt([u({type:String})],Lt.prototype,"cookieSecure",2),Rt([u({type:String})],Lt.prototype,"cookieExpiryDays",2),Rt([u({type:String})],Lt.prototype,"triggerType",2),Rt([u({type:String})],Lt.prototype,"triggerText",2),Rt([u({type:String})],Lt.prototype,"i18nLanguage",2),Lt=Rt([ge("pkt-consent")],Lt);var yh=Object.defineProperty,_h=Object.getOwnPropertyDescriptor,vt=(s,e,t,n)=>{for(var i=n>1?void 0:n?_h(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&yh(e,t,i),i};let ft=class extends ie{constructor(){super(...arguments),this.inputRef=Z(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.indeterminate=!1,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e==="indeterminate"&&(this.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),e.has("indeterminate")&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.updated(e)}render(){const e=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i="pkt-tag pkt-tag--small pkt-tag--thin-text",r=()=>y`
|
|
735
|
+
${this.tagText?y`<span class=${i+" pkt-tag--gray"}>${this.tagText}</span>`:x}
|
|
736
|
+
${this.optionalTag?y`<span class=${i+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
|
|
737
|
+
${this.requiredTag?y`<span class=${i+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
|
|
738
|
+
`,a=()=>y`
|
|
739
|
+
<label class=${n} for=${this.id+"-internal"}>
|
|
727
740
|
${this.label} ${r()}
|
|
728
|
-
${this.checkHelptext?
|
|
741
|
+
${this.checkHelptext?y`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:x}
|
|
729
742
|
</label>
|
|
730
|
-
`;return
|
|
743
|
+
`;return y`
|
|
731
744
|
<div class="pkt-input-check">
|
|
732
745
|
<div class=${e}>
|
|
733
|
-
${this.labelPosition==="left"?a():
|
|
746
|
+
${this.labelPosition==="left"?a():x}
|
|
734
747
|
<input
|
|
735
748
|
id=${this.id+"-internal"}
|
|
736
749
|
class=${t}
|
|
737
750
|
type="checkbox"
|
|
738
751
|
?disabled=${this.disabled}
|
|
739
752
|
name=${this.name+"-internal"}
|
|
740
|
-
${
|
|
753
|
+
${X(this.inputRef)}
|
|
741
754
|
@change=${this.handleChange}
|
|
742
755
|
@click=${this.handleClick}
|
|
743
756
|
@blur=${this.onBlur}
|
|
@@ -745,30 +758,30 @@
|
|
|
745
758
|
?checked=${this.checked}
|
|
746
759
|
role=${this.isSwitch?"switch":"checkbox"}
|
|
747
760
|
/>
|
|
748
|
-
${this.labelPosition==="right"?a():
|
|
761
|
+
${this.labelPosition==="right"?a():x}
|
|
749
762
|
</div>
|
|
750
763
|
</div>
|
|
751
|
-
`}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}const t=e.target;if(t&&t.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}};
|
|
752
|
-
<div class=${
|
|
753
|
-
${Array.isArray(this.dates)&&this.dates[0]?
|
|
764
|
+
`}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}const t=e.target;if(t&&t.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}};vt([u({type:String,reflect:!0})],ft.prototype,"value",2),vt([u({type:String})],ft.prototype,"checkHelptext",2),vt([u({type:Boolean})],ft.prototype,"defaultChecked",2),vt([u({type:Boolean})],ft.prototype,"hasTile",2),vt([u({type:Boolean})],ft.prototype,"isSwitch",2),vt([u({type:String})],ft.prototype,"labelPosition",2),vt([u({type:Boolean})],ft.prototype,"hideLabel",2),vt([u({type:Boolean,reflect:!0})],ft.prototype,"checked",2),vt([u({type:Boolean,reflect:!0})],ft.prototype,"indeterminate",2),vt([u({type:String,reflect:!0})],ft.prototype,"type",2),vt([u({type:String})],ft.prototype,"tagText",2),vt([u({type:Boolean})],ft.prototype,"optionalTag",2),vt([u({type:String})],ft.prototype,"optionalText",2),vt([u({type:Boolean})],ft.prototype,"requiredTag",2),vt([u({type:String})],ft.prototype,"requiredText",2),ft=vt([ge("pkt-checkbox")],ft);const ko={calendar:{buttonAltText:"Åpne kalender"}},wh={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var $h=Object.defineProperty,xh=Object.getOwnPropertyDescriptor,Gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?xh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&$h(e,t,i),i};let pn=class extends Oe{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=ws()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},y`
|
|
765
|
+
<div class=${z(this.classes)} aria-live="polite">
|
|
766
|
+
${Array.isArray(this.dates)&&this.dates[0]?kr(io((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return y` <pkt-tag
|
|
754
767
|
id=${this.idBase+e+"-tag"}
|
|
755
768
|
closeTag
|
|
756
769
|
@close=${()=>{this.dispatchEvent(new CustomEvent("date-tag-removed",{detail:e}))}}
|
|
757
|
-
.ariaLabel=${`${(t=this.strings)==null?void 0:t.calendar.deleteDate} ${
|
|
770
|
+
.ariaLabel=${`${(t=this.strings)==null?void 0:t.calendar.deleteDate} ${to(e,this.dateformat)}`}
|
|
758
771
|
>
|
|
759
|
-
<time datetime=${e}>${
|
|
760
|
-
</pkt-tag>`}):
|
|
772
|
+
<time datetime=${e}>${to(e,this.dateformat)}</time>
|
|
773
|
+
</pkt-tag>`}):x}
|
|
761
774
|
</div>
|
|
762
|
-
`}}
|
|
775
|
+
`}};Gn([u({type:Array})],pn.prototype,"dates",2),Gn([u({type:String})],pn.prototype,"dateformat",2),Gn([u({type:String,attribute:"class"})],pn.prototype,"className",2),Gn([u({type:String,attribute:"id-base"})],pn.prototype,"idBase",2),pn=Gn([ge("pkt-date-tags")],pn);const Sh={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},Xn={props:Sh},Hs=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ch=()=>Hs()?"text":"date",Th=s=>!s||s.length!==2?!0:hd(s[0],s[1]),Nh=s=>io(s),Mh=(s,e,t,n,i)=>dd(s,e,t,n,i),Dh=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),Oh=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Eh=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),Ph=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Ah=(s,e,t=!1)=>{var n;if(!s||!e)return;const i=((n=e.parentElement)==null?void 0:n.getBoundingClientRect())||e.getBoundingClientRect(),r=t?i.height+30:i.height,a=s.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(l=`calc(100% - ${r}px - ${a}px)`),s.style.top=l},Ih=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Lh=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},yo={validateRangeOrder:Th,sortDates:Nh,filterSelectableDates:Mh},Bh={getInputType:Ch},Qn={submitForm(s){var e;const t=(e=s.internals)==null?void 0:e.form;t&&t.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,n,i){var r,a,l,c;const p=s.value;p&&(t&&t>p?e.setValidity({rangeUnderflow:!0},((a=(r=i==null?void 0:i.forms)==null?void 0:r.messages)==null?void 0:a.rangeUnderflow)||"Value is below minimum",s):n&&n<p&&e.setValidity({rangeOverflow:!0},((c=(l=i==null?void 0:i.forms)==null?void 0:l.messages)==null?void 0:c.rangeOverflow)||"Value is above maximum",s))}},Pi={addToSelected(s,e,t,n){const i=s.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&e.value&&e.value.handleDateSelect(l),i.value=""},handleCalendarPosition(s,e,t=!1){Ah(s.value??null,e.value??null,t)}},xr={getInputClasses:Dh,getButtonClasses:Oh,getRangeLabelClasses:Eh},Sr={processDateSelection:Ph,updateInputValues(s,e,t,n,i,r){s.value&&(n&&e!=null&&e.value?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,n,i){var r;const a=s.target;if(a.value){i(a);const l=ys(a.value);l&&((r=t==null?void 0:t.value)==null||r.handleDateSelect(l))}else e[0]&&n()}},Ai={handleInputKeydown:Ih,handleButtonKeydown:Lh};var Fh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,_t=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fh(e,t,i),i};let kt=class extends Oe{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=Z(),this.calendarRef=Z(),this.handleDocumentClick=e=>{if(!this.open)return;const t=e.composedPath(),n=this.parentElement,i=this.popupRef.value;!t.includes(this)&&!t.includes(i)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(e){super.updated(e),e.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var e;this.open=!0,(e=this.calendarRef.value)==null||e.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){var t;return!!e&&!!((t=this.popupRef.value)!=null&&t.contains(e))}focusOnCurrentDate(){const e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate=="function"&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof Pi.addToSelected=="function")return Pi.addToSelected(e,this.calendarRef,t,n);const i=e.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&this.handleDateSelect(l),i.value=""}handleDateSelect(e){const t=this.calendarRef.value;if(t&&typeof t.handleDateSelect=="function")return t.handleDateSelect(e);const n=at(e),i=this.selected.indexOf(n)>=0?this.selected.filter(r=>r!==n):[...this.selected,n];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const e={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return y`
|
|
763
776
|
<div
|
|
764
|
-
class="${
|
|
765
|
-
${
|
|
777
|
+
class="${z(e)}"
|
|
778
|
+
${X(this.popupRef)}
|
|
766
779
|
id="date-popup"
|
|
767
780
|
?hidden=${!this.open}
|
|
768
781
|
aria-hidden="${!this.open}"
|
|
769
782
|
>
|
|
770
|
-
${this.open||this._hasBeenOpened?
|
|
771
|
-
${
|
|
783
|
+
${this.open||this._hasBeenOpened?y`<pkt-calendar
|
|
784
|
+
${X(this.calendarRef)}
|
|
772
785
|
?multiple=${this.multiple}
|
|
773
786
|
?range=${this.range}
|
|
774
787
|
?weeknumbers=${this.weeknumbers}
|
|
@@ -783,116 +796,116 @@
|
|
|
783
796
|
.today=${this.today}
|
|
784
797
|
@date-selected=${t=>{this.selected=t.detail,this.dispatchEvent(new CustomEvent("date-selected",{detail:t.detail,bubbles:!0,composed:!0}))}}
|
|
785
798
|
@close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}
|
|
786
|
-
></pkt-calendar>`:
|
|
799
|
+
></pkt-calendar>`:x}
|
|
787
800
|
</div>
|
|
788
|
-
`}};
|
|
801
|
+
`}};_t([u({type:Boolean,reflect:!0})],kt.prototype,"open",2),_t([u({type:Boolean})],kt.prototype,"multiple",2),_t([u({type:Boolean})],kt.prototype,"range",2),_t([u({type:Boolean})],kt.prototype,"weeknumbers",2),_t([u({type:Boolean})],kt.prototype,"withcontrols",2),_t([u({type:Number})],kt.prototype,"maxMultiple",2),_t([u({type:Array})],kt.prototype,"selected",2),_t([u({type:String})],kt.prototype,"earliest",2),_t([u({type:String})],kt.prototype,"latest",2),_t([u({type:Array})],kt.prototype,"excludedates",2),_t([u({type:Array})],kt.prototype,"excludeweekdays",2),_t([u({type:String})],kt.prototype,"currentmonth",2),_t([u({type:String})],kt.prototype,"today",2),_t([ce()],kt.prototype,"_hasBeenOpened",2),kt=_t([ge("pkt-datepicker-popup")],kt);var Uh=Object.defineProperty,ds=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Uh(e,t,i),i};let Bt=class extends Oe{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=Z(),this.btnRef=Z()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return y`
|
|
789
802
|
<button
|
|
790
|
-
class="${
|
|
803
|
+
class="${z(xr.getButtonClasses())}"
|
|
791
804
|
type="button"
|
|
792
805
|
@click=${t=>this.dispatchToggleCalendar(t)}
|
|
793
|
-
@keydown=${t=>{const{key:
|
|
806
|
+
@keydown=${t=>{const{key:n}=t;(n==="Enter"||n===" "||n==="Space")&&(t.preventDefault(),this.dispatchToggleCalendar(t))}}
|
|
794
807
|
?disabled=${this.disabled}
|
|
795
808
|
${this.btnRef}
|
|
796
809
|
>
|
|
797
810
|
<pkt-icon name="calendar"></pkt-icon>
|
|
798
811
|
<span class="pkt-btn__text">${((e=this.strings.calendar)==null?void 0:e.buttonAltText)||"Åpne kalender"}</span>
|
|
799
812
|
</button>
|
|
800
|
-
`}createRenderRoot(){return this}};
|
|
813
|
+
`}createRenderRoot(){return this}};ds([u({type:String})],Bt.prototype,"inputType"),ds([u({type:String})],Bt.prototype,"id"),ds([u({type:String})],Bt.prototype,"min"),ds([u({type:String})],Bt.prototype,"max"),ds([u({type:String})],Bt.prototype,"placeholder"),ds([u({type:Boolean})],Bt.prototype,"readonly"),ds([u({type:Boolean})],Bt.prototype,"disabled"),ds([u({type:Object})],Bt.prototype,"inputClasses"),ds([u({type:Object})],Bt.prototype,"internals");var Hh=Object.defineProperty,jh=Object.getOwnPropertyDescriptor,Cr=(s,e,t,n)=>{for(var i=n>1?void 0:n?jh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Hh(e,t,i),i};let Ii=class extends Bt{constructor(){super(...arguments),this.value="",this.strings=ko}dispatchManageValidity(e){this.dispatchEvent(new CustomEvent("manage-validity",{detail:e,bubbles:!0,composed:!0}))}render(){return y`
|
|
801
814
|
<div class="pkt-input__container">
|
|
802
815
|
<input
|
|
803
|
-
class="${
|
|
816
|
+
class="${z(this.inputClasses)}"
|
|
804
817
|
.type=${this.inputType}
|
|
805
818
|
id="${this.id}-input"
|
|
806
819
|
.value=${this.value}
|
|
807
|
-
min=${
|
|
808
|
-
max=${
|
|
809
|
-
placeholder=${
|
|
820
|
+
min=${A(this.min)}
|
|
821
|
+
max=${A(this.max)}
|
|
822
|
+
placeholder=${A(this.placeholder)}
|
|
810
823
|
?readonly=${this.isInputReadonly}
|
|
811
824
|
aria-describedby="${this.id}-helptext"
|
|
812
825
|
@click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
813
826
|
@touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
814
827
|
?disabled=${this.disabled}
|
|
815
|
-
@keydown=${e=>
|
|
828
|
+
@keydown=${e=>Ai.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>Qn.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()})}
|
|
816
829
|
@input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
|
|
817
|
-
@focus=${()=>{this.dispatchFocus()
|
|
830
|
+
@focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
818
831
|
@blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent("value-change",{detail:e.target.value,bubbles:!0,composed:!0}))}}
|
|
819
832
|
@change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
|
|
820
|
-
${
|
|
833
|
+
${X(this.inputRef)}
|
|
821
834
|
/>
|
|
822
835
|
${this.renderCalendarButton()}
|
|
823
836
|
</div>
|
|
824
|
-
`}};
|
|
837
|
+
`}};Cr([u({type:String})],Ii.prototype,"value",2),Cr([u({type:Object})],Ii.prototype,"strings",2),Ii=Cr([ge("pkt-datepicker-single")],Ii);var qh=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,Zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qh(e,t,i),i};let fn=class extends Bt{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=wh,this.inputRefTo=Z()}get inputElementTo(){return this.inputRefTo.value}render(){var e,t,n,i;const r=xr.getRangeLabelClasses(this.showRangeLabels);return y`
|
|
825
838
|
<div class="pkt-input__container">
|
|
826
|
-
${this.showRangeLabels?
|
|
839
|
+
${this.showRangeLabels?y` <div class="pkt-input-prefix">${(e=this.strings.generic)==null?void 0:e.from}</div> `:x}
|
|
827
840
|
<input
|
|
828
|
-
class=${
|
|
841
|
+
class=${z(this.inputClasses)}
|
|
829
842
|
.type=${this.inputType}
|
|
830
843
|
id="${this.id}-input"
|
|
831
844
|
aria-label="${this.label} ${((t=this.strings.generic)==null?void 0:t.from)??"Fra"}"
|
|
832
845
|
.value=${this.value[0]??""}
|
|
833
|
-
min=${
|
|
834
|
-
max=${
|
|
835
|
-
placeholder=${
|
|
846
|
+
min=${A(this.min)}
|
|
847
|
+
max=${A(this.max)}
|
|
848
|
+
placeholder=${A(this.placeholder)}
|
|
836
849
|
?readonly=${this.isInputReadonly}
|
|
837
850
|
?disabled=${this.disabled}
|
|
838
851
|
@click=${a=>{a.preventDefault(),this.dispatchToggleCalendar(a)}}
|
|
839
852
|
@touchend=${a=>{a.preventDefault(),this.dispatchToggleCalendar(a)}}
|
|
840
|
-
@keydown=${a=>
|
|
853
|
+
@keydown=${a=>Ai.handleInputKeydown(a,l=>this.dispatchToggleCalendar(l),()=>Qn.submitFormOrFallback(this.internals,()=>{var l;return(l=this.inputRefTo.value)==null?void 0:l.focus()}),()=>{var l;return(l=this.inputRefTo.value)==null?void 0:l.focus()},()=>{var l;return(l=this.inputRef.value)==null?void 0:l.blur()})}
|
|
841
854
|
@input=${a=>{this.dispatchInput(a),a.stopImmediatePropagation()}}
|
|
842
|
-
@focus=${()=>{this.dispatchFocus()
|
|
855
|
+
@focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
843
856
|
@blur=${a=>{this.dispatchBlur(a),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:a,values:this.value,inputType:"from"},bubbles:!0,composed:!0}))}}
|
|
844
857
|
@change=${a=>{this.dispatchChange(a),a.stopImmediatePropagation()}}
|
|
845
|
-
${
|
|
858
|
+
${X(this.inputRef)}
|
|
846
859
|
/>
|
|
847
|
-
<div class="${
|
|
848
|
-
${(
|
|
860
|
+
<div class="${z(r)}" id="${this.id}-to-label">
|
|
861
|
+
${(n=this.strings.generic)==null?void 0:n.to}
|
|
849
862
|
</div>
|
|
850
|
-
${this.showRangeLabels?
|
|
863
|
+
${this.showRangeLabels?x:y` <div class="pkt-input-separator">–</div> `}
|
|
851
864
|
<input
|
|
852
|
-
class=${
|
|
865
|
+
class=${z(this.inputClasses)}
|
|
853
866
|
.type=${this.inputType}
|
|
854
867
|
id="${this.id}-to"
|
|
855
|
-
aria-label="${this.label} ${((
|
|
868
|
+
aria-label="${this.label} ${((i=this.strings.generic)==null?void 0:i.to)??"Til"}"
|
|
856
869
|
.value=${this.value[1]??""}
|
|
857
|
-
min=${
|
|
858
|
-
max=${
|
|
859
|
-
placeholder=${
|
|
870
|
+
min=${A(this.min)}
|
|
871
|
+
max=${A(this.max)}
|
|
872
|
+
placeholder=${A(this.placeholder)}
|
|
860
873
|
?readonly=${this.isInputReadonly}
|
|
861
874
|
?disabled=${this.disabled}
|
|
862
875
|
@click=${a=>{a.preventDefault(),this.dispatchToggleCalendar(a)}}
|
|
863
876
|
@touchend=${a=>{a.preventDefault(),this.dispatchToggleCalendar(a)}}
|
|
864
|
-
@keydown=${a=>
|
|
877
|
+
@keydown=${a=>Ai.handleInputKeydown(a,l=>this.dispatchToggleCalendar(l),()=>Qn.submitFormOrFallback(this.internals,()=>{var l;return(l=this.inputRefTo.value)==null?void 0:l.blur()}),void 0,()=>{var l;return(l=this.inputRefTo.value)==null?void 0:l.blur()})}
|
|
865
878
|
@input=${a=>{this.dispatchInput(a),a.stopImmediatePropagation()}}
|
|
866
|
-
@focus=${()=>{this.dispatchFocus()
|
|
879
|
+
@focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
867
880
|
@blur=${a=>{this.dispatchBlur(a),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:a,values:this.value,inputType:"to"},bubbles:!0,composed:!0}))}}
|
|
868
881
|
@change=${a=>{this.dispatchChange(a),a.stopImmediatePropagation()}}
|
|
869
|
-
${
|
|
882
|
+
${X(this.inputRefTo)}
|
|
870
883
|
/>
|
|
871
884
|
${this.renderCalendarButton()}
|
|
872
885
|
</div>
|
|
873
|
-
`}};
|
|
886
|
+
`}};Zn([u({type:Array})],fn.prototype,"value",2),Zn([u({type:String})],fn.prototype,"label",2),Zn([u({type:Boolean})],fn.prototype,"showRangeLabels",2),Zn([u({type:Object})],fn.prototype,"strings",2),fn=Zn([ge("pkt-datepicker-range")],fn);var zh=Object.defineProperty,Yh=Object.getOwnPropertyDescriptor,Li=(s,e,t,n)=>{for(var i=n>1?void 0:n?Yh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&zh(e,t,i),i};let Jn=class extends Bt{constructor(){super(...arguments),this.value=[],this.strings=ko}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent("add-to-selected",{detail:e,bubbles:!0,composed:!0}))}render(){return y`
|
|
874
887
|
<div class="pkt-input__container">
|
|
875
888
|
<input
|
|
876
|
-
class=${
|
|
889
|
+
class=${z(this.inputClasses)}
|
|
877
890
|
.type=${this.inputType}
|
|
878
891
|
id="${this.id}-input"
|
|
879
|
-
min=${
|
|
880
|
-
max=${
|
|
881
|
-
placeholder=${
|
|
892
|
+
min=${A(this.min)}
|
|
893
|
+
max=${A(this.max)}
|
|
894
|
+
placeholder=${A(this.placeholder)}
|
|
882
895
|
?readonly=${this.isInputReadonly}
|
|
883
896
|
?disabled=${this.isInputDisabled}
|
|
884
897
|
@click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
885
898
|
@touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
886
899
|
@blur=${e=>{this.dispatchBlur(e),this.dispatchAddToSelected(e)}}
|
|
887
900
|
@input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
|
|
888
|
-
@focus=${()=>{this.dispatchFocus()
|
|
889
|
-
@keydown=${e=>
|
|
901
|
+
@focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
902
|
+
@keydown=${e=>Ai.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>Qn.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.dispatchAddToSelected(t))}
|
|
890
903
|
@change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
|
|
891
|
-
${
|
|
904
|
+
${X(this.inputRef)}
|
|
892
905
|
/>
|
|
893
906
|
${this.renderCalendarButton()}
|
|
894
907
|
</div>
|
|
895
|
-
`}};
|
|
908
|
+
`}};Li([u({type:Array})],Jn.prototype,"value",2),Li([u({type:Number})],Jn.prototype,"maxlength",2),Li([u({type:Object})],Jn.prototype,"strings",2),Jn=Li([ge("pkt-datepicker-multiple")],Jn);var Kh=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,lt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Gh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Kh(e,t,i),i};let nt=class extends ie{constructor(){super(),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=Z(),this._value=[],this.label="Datovelger",this.dateformat=Xn.props.dateformat.default,this.multiple=Xn.props.multiple.default,this.maxlength=null,this.range=Xn.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=Xn.props.weeknumbers.default,this.withcontrols=Xn.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=Z(),this.popupRef=Z(),this.helptextSlot=Z(),this.singleInputRef=Z(),this.rangeInputRef=Z(),this.multipleInputRef=Z(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):Pi.addToSelected(e,this.calRef,this.min,this.max)},this.slotController=new Qe(this,this.helptextSlot)}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Bh.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const n=Wn(e),i=this.multiple&&n.length>1?yo.filterSelectableDates(n,this.min,this.max,this.excludedates,this.excludeweekdays):n;if(this.range&&!yo.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=pd(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&this.valueChanged(n,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=Wn(n||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=Wn(n||"")),super.attributeChangedCallback(e,t,n)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,n=e.get("value"),i=Array.isArray(n)?n.join(","):n;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=Wn(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(n=this.singleInputRef.value)==null?void 0:n.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(n=this.singleInputRef.value)==null?void 0:n.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return y`
|
|
896
909
|
<pkt-datepicker-single
|
|
897
910
|
.value=${this._value[0]??""}
|
|
898
911
|
.inputType=${this.inputType}
|
|
@@ -912,9 +925,9 @@
|
|
|
912
925
|
@manage-validity=${e=>this.manageValidity(e.detail)}
|
|
913
926
|
@value-change=${e=>{this.value=e.detail}}
|
|
914
927
|
@input-changed=${()=>{this.touched=!0}}
|
|
915
|
-
${
|
|
928
|
+
${X(this.singleInputRef)}
|
|
916
929
|
></pkt-datepicker-single>
|
|
917
|
-
`}renderRangeInput(){return
|
|
930
|
+
`}renderRangeInput(){return y`
|
|
918
931
|
<pkt-datepicker-range
|
|
919
932
|
.value=${this._value}
|
|
920
933
|
.inputType=${this.inputType}
|
|
@@ -933,14 +946,14 @@
|
|
|
933
946
|
@input-change=${()=>this.onInput()}
|
|
934
947
|
@input-focus=${()=>this.onFocus()}
|
|
935
948
|
@input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
|
|
936
|
-
@range-blur=${e=>{const t=this.currentInputElement,
|
|
949
|
+
@range-blur=${e=>{const t=this.currentInputElement,n=this.currentInputElementTo;if(t&&n){const i=t.value,r=n.value;if(i&&r&&i>r)n.value="",this._value=[i],this.value=i;else{const a=[i,r].filter(Boolean);a.length>0&&(a[0]!==this._value[0]||a[1]!==this._value[1])&&(this._value=a,this.value=a.join(","))}}Sr.processRangeBlur(e.detail.event,e.detail.values,this.calRef,()=>this.clearInputValue(),i=>this.manageValidity(i))}}
|
|
937
950
|
@manage-validity=${e=>this.manageValidity(e.detail)}
|
|
938
|
-
@validate-date-input=${e=>{
|
|
939
|
-
@handle-date-select=${e=>{var t,
|
|
951
|
+
@validate-date-input=${e=>{Qn.validateDateInput(e.detail,this.internals,this.min,this.max,this.strings)}}
|
|
952
|
+
@handle-date-select=${e=>{var t,n;const i=ys(e.detail);if(i){const r=at(i);this._value[0]!==r&&this._value[1]!==r&&((n=(t=this.calRef)==null?void 0:t.value)==null||n.handleDateSelect(i))}}}
|
|
940
953
|
@input-changed=${()=>{this.touched=!0}}
|
|
941
|
-
${
|
|
954
|
+
${X(this.rangeInputRef)}
|
|
942
955
|
></pkt-datepicker-range>
|
|
943
|
-
`}renderMultipleInput(){return
|
|
956
|
+
`}renderMultipleInput(){return y`
|
|
944
957
|
<pkt-datepicker-multiple
|
|
945
958
|
.value=${this._value}
|
|
946
959
|
.inputType=${this.inputType}
|
|
@@ -960,9 +973,9 @@
|
|
|
960
973
|
@input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
|
|
961
974
|
@add-to-selected=${e=>this.addToSelected(e.detail)}
|
|
962
975
|
@input-changed=${()=>{this.touched=!0}}
|
|
963
|
-
${
|
|
976
|
+
${X(this.multipleInputRef)}
|
|
964
977
|
></pkt-datepicker-multiple>
|
|
965
|
-
`}renderCalendar(){return
|
|
978
|
+
`}renderCalendar(){return y`
|
|
966
979
|
<pkt-datepicker-popup
|
|
967
980
|
class="pkt-contents"
|
|
968
981
|
?open=${this.calendarOpen}
|
|
@@ -976,13 +989,13 @@
|
|
|
976
989
|
.latest=${this.max}
|
|
977
990
|
.excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
|
|
978
991
|
.excludeweekdays=${this.excludeweekdays}
|
|
979
|
-
.currentmonth=${this.currentmonth?
|
|
992
|
+
.currentmonth=${this.currentmonth?ls(this.currentmonth):null}
|
|
980
993
|
.today=${this.today}
|
|
981
|
-
@date-selected=${e=>{this.value=
|
|
994
|
+
@date-selected=${e=>{this.value=Sr.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,Sr.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
|
|
982
995
|
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
983
|
-
${
|
|
996
|
+
${X(this.datepickerPopupRef)}
|
|
984
997
|
></pkt-datepicker-popup>
|
|
985
|
-
`}render(){return this.inputClasses=
|
|
998
|
+
`}render(){return this.inputClasses=xr.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType),y`
|
|
986
999
|
<pkt-input-wrapper
|
|
987
1000
|
label="${this.label}"
|
|
988
1001
|
forId="${this.id}-input"
|
|
@@ -1007,26 +1020,26 @@
|
|
|
1007
1020
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
1008
1021
|
class="pkt-datepicker"
|
|
1009
1022
|
>
|
|
1010
|
-
<div class="pkt-contents" ${
|
|
1011
|
-
${this.multiple?
|
|
1023
|
+
<div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1024
|
+
${this.multiple?y`<pkt-date-tags
|
|
1012
1025
|
.dates=${this._value}
|
|
1013
1026
|
dateformat=${this.dateformat}
|
|
1014
1027
|
strings=${this.strings}
|
|
1015
1028
|
id-base=${this.id}
|
|
1016
|
-
@date-tag-removed=${e=>{var t;const
|
|
1017
|
-
></pkt-date-tags>`:
|
|
1029
|
+
@date-tag-removed=${e=>{var t;const n=this.datepickerPopupRef.value,i=ys(e.detail);n&&i&&typeof n.handleDateSelect=="function"?n.handleDateSelect(i):(t=this.calRef.value)==null||t.handleDateSelect(i)}}
|
|
1030
|
+
></pkt-date-tags>`:x}
|
|
1018
1031
|
<div class="pkt-datepicker__inputs ${this.range?"pkt-input__range-inputs":""}">
|
|
1019
1032
|
${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
|
|
1020
1033
|
</div>
|
|
1021
1034
|
</pkt-input-wrapper>
|
|
1022
1035
|
${this.renderCalendar()}
|
|
1023
|
-
`}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;
|
|
1024
|
-
class=${
|
|
1036
|
+
`}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;Pi.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var e;const t=this.datepickerPopupRef.value;if(this.calendarOpen=!0,t&&typeof t.show=="function"){t.show(),Hs()&&t.focusOnCurrentDate();return}await Hd(20),this.handleCalendarPosition(),Hs()&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const n=!!t.open;t.toggle(),this.calendarOpen=!n;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};lt([u({type:String,reflect:!0})],nt.prototype,"value",1),lt([u({type:String,reflect:!0})],nt.prototype,"label",2),lt([u({type:String})],nt.prototype,"dateformat",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"multiple",2),lt([u({type:Number,reflect:!0})],nt.prototype,"maxlength",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"range",2),lt([u({type:Boolean,attribute:"show-range-labels"})],nt.prototype,"showRangeLabels",2),lt([u({type:String,reflect:!0})],nt.prototype,"min",2),lt([u({type:String,reflect:!0})],nt.prototype,"max",2),lt([u({type:Boolean})],nt.prototype,"weeknumbers",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"withcontrols",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludedates",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludeweekdays",2),lt([u({type:String})],nt.prototype,"currentmonth",2),lt([u({type:String})],nt.prototype,"today",2),lt([u({type:Boolean,reflect:!0,attribute:"calendar-open"})],nt.prototype,"calendarOpen",2),lt([u({type:String})],nt.prototype,"timezone",2),lt([ce()],nt.prototype,"inputClasses",2),nt=lt([ge("pkt-datepicker")],nt);const Xh={href:{default:"#"},target:{default:"_self"}},_o={props:Xh};var Qh=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Zh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Qh(e,t,i),i};let js=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.href=_o.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=_o.props.target.default,this.slotController=new Qe(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return y`<a
|
|
1037
|
+
class=${z(e)}
|
|
1025
1038
|
href=${this.href}
|
|
1026
1039
|
.target=${this.target}
|
|
1027
|
-
.rel=${this.external?"noopener noreferrer":
|
|
1028
|
-
>${this.iconName?
|
|
1029
|
-
>`}};
|
|
1040
|
+
.rel=${this.external?"noopener noreferrer":x}
|
|
1041
|
+
>${this.iconName?y`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${X(this.defaultSlot)}>Link</span></a
|
|
1042
|
+
>`}};gn([u({type:String,reflect:!0})],js.prototype,"href",2),gn([u({type:String,reflect:!0})],js.prototype,"iconName",2),gn([u({type:String,reflect:!0})],js.prototype,"iconPosition",2),gn([u({type:Boolean,reflect:!0})],js.prototype,"external",2),gn([u({type:String,reflect:!0})],js.prototype,"target",2),js=gn([ge("pkt-link")],js);var Jh=Object.defineProperty,Rh=Object.getOwnPropertyDescriptor,es=(s,e,t,n)=>{for(var i=n>1?void 0:n?Rh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jh(e,t,i),i};let Wt=class extends ie{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,t=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return y`
|
|
1030
1043
|
<pkt-input-wrapper
|
|
1031
1044
|
label="${this.label}"
|
|
1032
1045
|
?counter=${this.counter}
|
|
@@ -1051,115 +1064,115 @@
|
|
|
1051
1064
|
.tagText=${this.tagText}
|
|
1052
1065
|
class="pkt-textinput"
|
|
1053
1066
|
>
|
|
1054
|
-
<div class="pkt-contents" ${
|
|
1067
|
+
<div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1055
1068
|
<div class="pkt-input__container">
|
|
1056
|
-
${this.prefix?
|
|
1069
|
+
${this.prefix?y`<div class="pkt-input-prefix">${this.prefix}</div>`:x}
|
|
1057
1070
|
<input
|
|
1058
|
-
${
|
|
1071
|
+
${X(this.inputRef)}
|
|
1059
1072
|
class=${t}
|
|
1060
1073
|
type=${this.type}
|
|
1061
1074
|
name=${(this.name||this.id)+"-input"}
|
|
1062
1075
|
id=${this.id+"-input"}
|
|
1063
|
-
placeholder=${
|
|
1064
|
-
aria-labelledby=${
|
|
1076
|
+
placeholder=${A(this.placeholder)}
|
|
1077
|
+
aria-labelledby=${n}
|
|
1065
1078
|
autocomplete=${this.autocomplete||"off"}
|
|
1066
|
-
minlength=${
|
|
1067
|
-
maxlength=${
|
|
1068
|
-
min=${
|
|
1069
|
-
max=${
|
|
1070
|
-
step=${
|
|
1079
|
+
minlength=${A(this.minlength||void 0)}
|
|
1080
|
+
maxlength=${A(this.maxlength||void 0)}
|
|
1081
|
+
min=${A(this.min||void 0)}
|
|
1082
|
+
max=${A(this.max||void 0)}
|
|
1083
|
+
step=${A(this.step||void 0)}
|
|
1071
1084
|
?readonly=${this.readonly}
|
|
1072
|
-
size=${this.size||
|
|
1085
|
+
size=${this.size||x}
|
|
1073
1086
|
.value=${this.value}
|
|
1074
1087
|
?disabled=${this.disabled}
|
|
1075
1088
|
aria-invalid=${this.hasError}
|
|
1076
1089
|
aria-errormessage=${`${this.id}-error`}
|
|
1077
|
-
@input=${
|
|
1078
|
-
@change=${
|
|
1079
|
-
@focus=${
|
|
1080
|
-
@blur=${
|
|
1081
|
-
@keydown=${
|
|
1090
|
+
@input=${i=>{this.value=i.target.value,this.onInput(),i.stopImmediatePropagation()}}
|
|
1091
|
+
@change=${i=>{i.stopImmediatePropagation()}}
|
|
1092
|
+
@focus=${i=>{this.onFocus(),i.stopImmediatePropagation()}}
|
|
1093
|
+
@blur=${i=>{this.value=i.target.value,this.onBlur(),i.stopImmediatePropagation()}}
|
|
1094
|
+
@keydown=${i=>{var r;if(i.key==="Enter"){const a=this.internals.form;a?a.requestSubmit():(r=this.inputRef.value)==null||r.blur()}}}
|
|
1082
1095
|
/>
|
|
1083
|
-
${this.suffix?
|
|
1096
|
+
${this.suffix?y`<div class="pkt-input-suffix">
|
|
1084
1097
|
${this.suffix}
|
|
1085
|
-
${this.iconNameRight?
|
|
1098
|
+
${this.iconNameRight?y`<pkt-icon
|
|
1086
1099
|
class="pkt-input-suffix-icon"
|
|
1087
1100
|
name=${this.iconNameRight}
|
|
1088
|
-
></pkt-icon>`:
|
|
1089
|
-
${e?
|
|
1101
|
+
></pkt-icon>`:x}
|
|
1102
|
+
${e?y`<pkt-icon
|
|
1090
1103
|
class="pkt-input-suffix-icon"
|
|
1091
1104
|
name="magnifying-glass-big"
|
|
1092
|
-
></pkt-icon>`:
|
|
1093
|
-
</div>`:
|
|
1094
|
-
${!this.suffix&&this.iconNameRight?
|
|
1095
|
-
${!this.suffix&&e?
|
|
1105
|
+
></pkt-icon>`:x}
|
|
1106
|
+
</div>`:x}
|
|
1107
|
+
${!this.suffix&&this.iconNameRight?y`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>`:x}
|
|
1108
|
+
${!this.suffix&&e?y`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:x}
|
|
1096
1109
|
</div>
|
|
1097
1110
|
</pkt-input-wrapper>
|
|
1098
|
-
`}};
|
|
1111
|
+
`}};es([u({type:String,reflect:!0})],Wt.prototype,"value",2),es([u({type:String})],Wt.prototype,"type",2),es([u({type:Number})],Wt.prototype,"size",2),es([u({type:String})],Wt.prototype,"autocomplete",2),es([u({type:String})],Wt.prototype,"iconNameRight",2),es([u({type:String})],Wt.prototype,"prefix",2),es([u({type:String})],Wt.prototype,"suffix",2),es([u({type:Boolean})],Wt.prototype,"omitSearchIcon",2),es([ce()],Wt.prototype,"counterCurrent",2),Wt=es([ge("pkt-textinput")],Wt);const ep=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},tp=s=>ep(s),sp=s=>{if(!s)return;const e=typeof s=="string"?new Date(s):s;if(!isNaN(e.getTime()))return e.toLocaleDateString("nb-NO",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})};var np=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,qs=(s,e,t,n)=>{for(var i=n>1?void 0:n?ip(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&np(e,t,i),i};let $s=class extends Oe{constructor(){super(...arguments),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent("change-representation",{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleMenuItemClick(e){"onClick"in e&&typeof e.onClick=="function"&&e.onClick()}renderLinkOrButton(e,t){const n="href"in e,i=z({"pkt-user-menu__link":!0,"pkt-link-button":!n,"pkt-link":!n,"pkt-link--icon-left":!n,[t||""]:!!t});return n?y`
|
|
1099
1112
|
<pkt-link
|
|
1100
|
-
icon-name=${e.iconName||
|
|
1113
|
+
icon-name=${e.iconName||x}
|
|
1101
1114
|
href=${e.href}
|
|
1102
1115
|
aria-hidden="true"
|
|
1103
1116
|
class="pkt-user-menu__link ${t||""}"
|
|
1104
1117
|
>
|
|
1105
1118
|
${e.title}
|
|
1106
1119
|
</pkt-link>
|
|
1107
|
-
`:
|
|
1108
|
-
<button class=${
|
|
1109
|
-
${e.iconName?
|
|
1120
|
+
`:y`
|
|
1121
|
+
<button class=${i} type="button" @click=${()=>this.handleMenuItemClick(e)}>
|
|
1122
|
+
${e.iconName?y`<pkt-icon
|
|
1110
1123
|
name=${e.iconName}
|
|
1111
1124
|
class="pkt-link__icon"
|
|
1112
1125
|
aria-hidden="true"
|
|
1113
|
-
></pkt-icon>`:
|
|
1126
|
+
></pkt-icon>`:x}
|
|
1114
1127
|
${e.title}
|
|
1115
1128
|
</button>
|
|
1116
|
-
`}renderLinkSection(e){return
|
|
1129
|
+
`}renderLinkSection(e){return y`
|
|
1117
1130
|
<ul class="pkt-user-menu__sublist">
|
|
1118
|
-
${e.map(t=>
|
|
1131
|
+
${e.map(t=>y`
|
|
1119
1132
|
<li class="pkt-user-menu__subitem">${this.renderLinkOrButton(t)}</li>
|
|
1120
1133
|
`)}
|
|
1121
1134
|
</ul>
|
|
1122
|
-
`}render(){var e;const t=(e=this.userMenu)==null?void 0:e.map(
|
|
1135
|
+
`}render(){var e;const t=(e=this.userMenu)==null?void 0:e.map(tp);return y`
|
|
1123
1136
|
<nav class="pkt-user-menu" aria-label="Meny for innlogget bruker">
|
|
1124
1137
|
<ul class="pkt-user-menu__list">
|
|
1125
1138
|
<!-- User section -->
|
|
1126
|
-
${this.user?
|
|
1139
|
+
${this.user?y`
|
|
1127
1140
|
<li class="pkt-user-menu__item">
|
|
1128
1141
|
<div class="pkt-user-menu__label">Pålogget som</div>
|
|
1129
1142
|
<div class="pkt-user-menu__name" translate="no">${this.user.name}</div>
|
|
1130
|
-
${this.formattedLastLoggedIn?
|
|
1143
|
+
${this.formattedLastLoggedIn?y`
|
|
1131
1144
|
<div class="pkt-user-menu__last-logged-in">
|
|
1132
1145
|
Sist pålogget: <time>${this.formattedLastLoggedIn}</time>
|
|
1133
1146
|
</div>
|
|
1134
|
-
`:
|
|
1147
|
+
`:x}
|
|
1135
1148
|
</li>
|
|
1136
|
-
`:
|
|
1149
|
+
`:x}
|
|
1137
1150
|
|
|
1138
1151
|
<!-- User menu items -->
|
|
1139
|
-
${t&&t.length>0?
|
|
1152
|
+
${t&&t.length>0?y`
|
|
1140
1153
|
<li class="pkt-user-menu__item">${this.renderLinkSection(t)}</li>
|
|
1141
|
-
`:
|
|
1154
|
+
`:x}
|
|
1142
1155
|
|
|
1143
1156
|
<!-- Representing section -->
|
|
1144
|
-
${this.representing?
|
|
1157
|
+
${this.representing?y`
|
|
1145
1158
|
<li class="pkt-user-menu__item">
|
|
1146
1159
|
<div class="pkt-user-menu__label">Representerer</div>
|
|
1147
1160
|
<div class="pkt-user-menu__name" translate="no">${this.representing.name}</div>
|
|
1148
|
-
${this.representing.orgNumber?
|
|
1161
|
+
${this.representing.orgNumber?y`<div class="pkt-user-menu__org-number">
|
|
1149
1162
|
Org.nr. ${this.representing.orgNumber}
|
|
1150
|
-
</div>`:
|
|
1151
|
-
${this.canChangeRepresentation?
|
|
1163
|
+
</div>`:x}
|
|
1164
|
+
${this.canChangeRepresentation?y`
|
|
1152
1165
|
<ul class="pkt-user-menu__sublist mt-size-16">
|
|
1153
1166
|
<li class="pkt-user-menu__subitem">
|
|
1154
1167
|
${this.renderLinkOrButton({title:"Endre organisasjon",iconName:"cogwheel",onClick:()=>this.handleChangeRepresentation()})}
|
|
1155
1168
|
</li>
|
|
1156
1169
|
</ul>
|
|
1157
|
-
`:
|
|
1170
|
+
`:x}
|
|
1158
1171
|
</li>
|
|
1159
|
-
`:
|
|
1172
|
+
`:x}
|
|
1160
1173
|
|
|
1161
1174
|
<!-- Change representation without representing object -->
|
|
1162
|
-
${!this.representing&&this.canChangeRepresentation?
|
|
1175
|
+
${!this.representing&&this.canChangeRepresentation?y`
|
|
1163
1176
|
<li class="pkt-user-menu__item">
|
|
1164
1177
|
<ul class="pkt-user-menu__sublist">
|
|
1165
1178
|
<li class="pkt-user-menu__subitem">
|
|
@@ -1167,25 +1180,25 @@
|
|
|
1167
1180
|
</li>
|
|
1168
1181
|
</ul>
|
|
1169
1182
|
</li>
|
|
1170
|
-
`:
|
|
1183
|
+
`:x}
|
|
1171
1184
|
|
|
1172
1185
|
<!-- Logout -->
|
|
1173
|
-
${this.logoutOnClick?
|
|
1186
|
+
${this.logoutOnClick?y`
|
|
1174
1187
|
<li class="pkt-user-menu__item">
|
|
1175
1188
|
${this.renderLinkOrButton({title:"Logg ut",iconName:"exit",onClick:()=>this.handleLogout()})}
|
|
1176
1189
|
</li>
|
|
1177
|
-
`:
|
|
1190
|
+
`:x}
|
|
1178
1191
|
</ul>
|
|
1179
1192
|
</nav>
|
|
1180
|
-
`}};
|
|
1181
|
-
<pkt-icon name="oslologo" aria-hidden="true" path=${
|
|
1182
|
-
`;return this.logoLink&&typeof this.logoLink=="string"?
|
|
1193
|
+
`}};qs([u({type:Object})],$s.prototype,"user",2),qs([u({type:String,attribute:"formatted-last-logged-in"})],$s.prototype,"formattedLastLoggedIn",2),qs([u({type:Object})],$s.prototype,"representing",2),qs([u({type:Array,attribute:"user-menu"})],$s.prototype,"userMenu",2),qs([u({type:Boolean,attribute:"can-change-representation",converter:xt})],$s.prototype,"canChangeRepresentation",2),qs([u({type:Boolean,attribute:"logout-on-click",converter:xt})],$s.prototype,"logoutOnClick",2),$s=qs([ge("pkt-header-user-menu")],$s);var rp=Object.defineProperty,ap=Object.getOwnPropertyDescriptor,xe=(s,e,t,n)=>{for(var i=n>1?void 0:n?ap(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rp(e,t,i),i};const op="https://punkt-cdn.oslo.kommune.no/16.0/logos/";let we=class extends Oe{constructor(){super(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.isMobile=!1,this.isTablet=!1,this.openMenu="none",this.isHidden=!1,this.componentWidth=typeof window<"u"?window.innerWidth:0,this.hasSlotContent=!1,this.alignSlotRight=!1,this.alignSearchRight=!1,this.defaultSlot=Z(),this.headerRef=Z(),this.userContainerRef=Z(),this.slotContainerRef=Z(),this.searchContainerRef=Z(),this.slotContentRef=Z(),this.searchMenuRef=Z(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;const e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{const t=e.target;this.user&&this.openMenu==="user"&&!t.closest(".pkt-header-service__user-container")&&(this.openMenu="none"),this.openMenu==="slot"&&!t.closest(".pkt-header-service__slot-container")&&(this.openMenu="none"),this.openMenu==="search"&&!t.closest(".pkt-header-service__search-container")&&!t.closest(".pkt-header-service__search-input")&&(this.openMenu="none")},this.handleFocusOut=(e,t)=>{const n=e.relatedTarget;let i;switch(t){case"user":i=this.userContainerRef;break;case"slot":i=this.slotContainerRef;break;case"search":i=this.searchContainerRef;break;default:return}const r=i.value;r&&(!n||!r.contains(n))&&(this.openMenu="none")},this.handleEscapeKey=e=>{e.key==="Escape"&&this.openMenu!=="none"&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu="none")},this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.hasSlotContent=e.has(null)||e.has(void 0)}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),window.removeEventListener("scroll",this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has("openedMenu")&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has("mobileBreakpoint")||e.has("tabletBreakpoint"))&&(this.updateIsMobile(),this.updateIsTablet()),e.has("openMenu")){const t=e.get("openMenu");this.openMenu!=="none"&&(t==="none"||t===void 0)?(document.addEventListener("mousedown",this.handleClickOutside),document.addEventListener("keydown",this.handleEscapeKey),(this.openMenu==="slot"||this.openMenu==="search")&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu==="none"&&t!=="none"&&(document.removeEventListener("mousedown",this.handleClickOutside),document.removeEventListener("keydown",this.handleEscapeKey),this.restoreFocus())}(e.has("openMenu")||e.has("isMobile"))&&this.updateScrollLock()}setupResizeObserver(){const e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(t=>{for(const n of t)n.borderBoxSize&&n.borderBoxSize.length>0?this.componentWidth=n.borderBoxSize[0].inlineSize:this.componentWidth=n.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position==="fixed"&&this.isMobile&&this.openMenu!=="none"?this.lockScroll():this.unlockScroll()}lockScroll(){const e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;const n=window.innerWidth-t.clientWidth;n>0&&(e.style.paddingRight=`${n}px`),e.style.position="fixed",e.style.top=`-${this.savedScrollY}px`,e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden",t.classList.add("is-scroll-locked")}unlockScroll(){const e=document.body,t=document.documentElement;t.classList.contains("is-scroll-locked")&&(e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("width"),e.style.removeProperty("overflow"),e.style.removeProperty("padding-right"),t.classList.remove("is-scroll-locked"),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener("scroll",this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){const t=e==="slot"?this.slotContainerRef:this.searchContainerRef,n=e==="slot"?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;const i=t.value.getBoundingClientRect(),r=n.value.offsetWidth,a=i.left+r>window.innerWidth;e==="slot"?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu!=="none"?this.openMenu="none":(this.lastFocusedElement=document.activeElement,this.openMenu=e)}handleLogoClick(e){this.dispatchEvent(new CustomEvent("logo-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent("service-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent("search",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent("search-change",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){const t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key==="Enter"&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){var e;return sp((e=this.user)==null?void 0:e.lastLoggedIn)}get isFixed(){return this.position==="fixed"}get shouldHideOnScroll(){return this.scrollBehavior==="hide"}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement==="header"||this.logOutButtonPlacement==="both")}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement==="userMenu"||this.logOutButtonPlacement==="both")}renderLogo(){if(this.hideLogo)return x;const e=y`
|
|
1194
|
+
<pkt-icon name="oslologo" aria-hidden="true" path=${op}></pkt-icon>
|
|
1195
|
+
`;return this.logoLink&&typeof this.logoLink=="string"?y`
|
|
1183
1196
|
<span class="pkt-header-service__logo">
|
|
1184
1197
|
<a href=${this.logoLink} aria-label="Tilbake til forside" @click=${this.handleLogoClick}>
|
|
1185
1198
|
${e}
|
|
1186
1199
|
</a>
|
|
1187
1200
|
</span>
|
|
1188
|
-
`:this.hasAttribute("logo-link")?
|
|
1201
|
+
`:this.hasAttribute("logo-link")?y`
|
|
1189
1202
|
<span class="pkt-header-service__logo">
|
|
1190
1203
|
<button
|
|
1191
1204
|
aria-label="Tilbake til forside"
|
|
@@ -1195,9 +1208,9 @@
|
|
|
1195
1208
|
${e}
|
|
1196
1209
|
</button>
|
|
1197
1210
|
</span>
|
|
1198
|
-
`:
|
|
1211
|
+
`:y`
|
|
1199
1212
|
<span class="pkt-header-service__logo" @click=${this.handleLogoClick}>${e}</span>
|
|
1200
|
-
`}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink=="string"?
|
|
1213
|
+
`}renderServiceName(){return this.serviceName?this.serviceLink&&typeof this.serviceLink=="string"?y`
|
|
1201
1214
|
<span class="pkt-header-service__service-name">
|
|
1202
1215
|
<pkt-link
|
|
1203
1216
|
href=${this.serviceLink}
|
|
@@ -1207,7 +1220,7 @@
|
|
|
1207
1220
|
${this.serviceName}
|
|
1208
1221
|
</pkt-link>
|
|
1209
1222
|
</span>
|
|
1210
|
-
`:this.hasAttribute("service-link")?
|
|
1223
|
+
`:this.hasAttribute("service-link")?y`
|
|
1211
1224
|
<span class="pkt-header-service__service-name">
|
|
1212
1225
|
<button
|
|
1213
1226
|
class="pkt-link-button pkt-link pkt-header-service__service-link"
|
|
@@ -1216,17 +1229,17 @@
|
|
|
1216
1229
|
${this.serviceName}
|
|
1217
1230
|
</button>
|
|
1218
1231
|
</span>
|
|
1219
|
-
`:
|
|
1232
|
+
`:y`
|
|
1220
1233
|
<span class="pkt-header-service__service-name" @click=${this.handleServiceClick}>
|
|
1221
1234
|
<span class="pkt-header-service__service-link">${this.serviceName}</span>
|
|
1222
1235
|
</span>
|
|
1223
|
-
`:
|
|
1236
|
+
`:x}renderSlotContainer(){const e=z({"pkt-header-service__slot-container":!0,"is-open":this.openMenu==="slot"}),t=z({"pkt-header-service__slot-content":!0,"align-right":this.alignSlotRight});return y`
|
|
1224
1237
|
<div
|
|
1225
1238
|
class=${e}
|
|
1226
|
-
@focusout=${
|
|
1227
|
-
${
|
|
1239
|
+
@focusout=${n=>this.handleFocusOut(n,"slot")}
|
|
1240
|
+
${X(this.slotContainerRef)}
|
|
1228
1241
|
>
|
|
1229
|
-
${this.isTablet&&this.hasSlotContent?
|
|
1242
|
+
${this.isTablet&&this.hasSlotContent?y`
|
|
1230
1243
|
<pkt-button
|
|
1231
1244
|
skin="secondary"
|
|
1232
1245
|
variant=${this.slotMenuVariant}
|
|
@@ -1240,21 +1253,21 @@
|
|
|
1240
1253
|
>
|
|
1241
1254
|
${this.slotMenuText}
|
|
1242
1255
|
</pkt-button>
|
|
1243
|
-
`:
|
|
1256
|
+
`:x}
|
|
1244
1257
|
<div
|
|
1245
1258
|
class=${t}
|
|
1246
1259
|
id="mobile-slot-menu"
|
|
1247
|
-
role=${this.isTablet?"menu":
|
|
1248
|
-
aria-label=${this.isTablet?"Meny":
|
|
1249
|
-
${
|
|
1250
|
-
${
|
|
1260
|
+
role=${this.isTablet?"menu":x}
|
|
1261
|
+
aria-label=${this.isTablet?"Meny":x}
|
|
1262
|
+
${X(this.slotContentRef)}
|
|
1263
|
+
${X(this.defaultSlot)}
|
|
1251
1264
|
></div>
|
|
1252
1265
|
</div>
|
|
1253
|
-
`}renderSearch(){if(!this.showSearch)return
|
|
1266
|
+
`}renderSearch(){if(!this.showSearch)return x;if(this.isTablet){const e=z({"pkt-header-service__search-container":!0,"is-open":this.openMenu==="search"}),t=z({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu==="search","align-right":this.alignSearchRight});return y`
|
|
1254
1267
|
<div
|
|
1255
1268
|
class=${e}
|
|
1256
|
-
@focusout=${
|
|
1257
|
-
${
|
|
1269
|
+
@focusout=${n=>this.handleFocusOut(n,"search")}
|
|
1270
|
+
${X(this.searchContainerRef)}
|
|
1258
1271
|
>
|
|
1259
1272
|
<pkt-button
|
|
1260
1273
|
skin="secondary"
|
|
@@ -1269,8 +1282,8 @@
|
|
|
1269
1282
|
>
|
|
1270
1283
|
Søk
|
|
1271
1284
|
</pkt-button>
|
|
1272
|
-
<div class=${t} ${
|
|
1273
|
-
${this.openMenu==="search"?
|
|
1285
|
+
<div class=${t} ${X(this.searchMenuRef)}>
|
|
1286
|
+
${this.openMenu==="search"?y`
|
|
1274
1287
|
<pkt-textinput
|
|
1275
1288
|
id="mobile-search-menu"
|
|
1276
1289
|
class="pkt-header-service__search-input"
|
|
@@ -1282,12 +1295,12 @@
|
|
|
1282
1295
|
autofocus
|
|
1283
1296
|
fullwidth
|
|
1284
1297
|
@input=${this.handleSearchInputChange}
|
|
1285
|
-
@keydown=${
|
|
1298
|
+
@keydown=${n=>{n.key==="Enter"&&this.handleSearch(n.target.value)}}
|
|
1286
1299
|
></pkt-textinput>
|
|
1287
|
-
`:
|
|
1300
|
+
`:x}
|
|
1288
1301
|
</div>
|
|
1289
1302
|
</div>
|
|
1290
|
-
`}return
|
|
1303
|
+
`}return y`
|
|
1291
1304
|
<pkt-textinput
|
|
1292
1305
|
id="header-service-search"
|
|
1293
1306
|
class="pkt-header-service__search-input"
|
|
@@ -1299,14 +1312,14 @@
|
|
|
1299
1312
|
@input=${this.handleSearchInputChange}
|
|
1300
1313
|
@keydown=${this.handleSearchKeyDown}
|
|
1301
1314
|
></pkt-textinput>
|
|
1302
|
-
`}renderUserButton(){var e;if(!this.user)return
|
|
1315
|
+
`}renderUserButton(){var e;if(!this.user)return x;const t=z({"pkt-header-service__user-menu":this.isMobile===!1,"pkt-header-service__mobile-menu":this.isMobile===!0,"is-open":this.openMenu==="user"});return y`
|
|
1303
1316
|
<div
|
|
1304
1317
|
class="pkt-header-service__user-container"
|
|
1305
|
-
@focusout=${
|
|
1306
|
-
${
|
|
1318
|
+
@focusout=${n=>this.handleFocusOut(n,"user")}
|
|
1319
|
+
${X(this.userContainerRef)}
|
|
1307
1320
|
>
|
|
1308
1321
|
<pkt-button
|
|
1309
|
-
class=${
|
|
1322
|
+
class=${z({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
|
|
1310
1323
|
skin="secondary"
|
|
1311
1324
|
size=${this.isMobile?"small":"medium"}
|
|
1312
1325
|
state=${this.openMenu==="user"?"active":"normal"}
|
|
@@ -1318,11 +1331,11 @@
|
|
|
1318
1331
|
<span class="pkt-sr-only">Brukermeny: </span>
|
|
1319
1332
|
${((e=this.representing)==null?void 0:e.name)||this.user.name}
|
|
1320
1333
|
</pkt-button>
|
|
1321
|
-
${this.openMenu==="user"&&this.user?
|
|
1334
|
+
${this.openMenu==="user"&&this.user?y`
|
|
1322
1335
|
<div class=${t}>
|
|
1323
1336
|
<pkt-header-user-menu
|
|
1324
1337
|
.user=${this.user}
|
|
1325
|
-
formatted-last-logged-in=${this.formattedLastLoggedIn||
|
|
1338
|
+
formatted-last-logged-in=${this.formattedLastLoggedIn||x}
|
|
1326
1339
|
.representing=${this.representing}
|
|
1327
1340
|
.userMenu=${this.userMenu}
|
|
1328
1341
|
?can-change-representation=${this.canChangeRepresentation}
|
|
@@ -1331,15 +1344,15 @@
|
|
|
1331
1344
|
@log-out=${this.handleLogout}
|
|
1332
1345
|
></pkt-header-user-menu>
|
|
1333
1346
|
</div>
|
|
1334
|
-
`:
|
|
1347
|
+
`:x}
|
|
1335
1348
|
</div>
|
|
1336
|
-
`}renderHeader(){const e=
|
|
1337
|
-
<header class=${e} ${
|
|
1349
|
+
`}renderHeader(){const e=z({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),t=z({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return y`
|
|
1350
|
+
<header class=${e} ${X(this.headerRef)}>
|
|
1338
1351
|
<div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
|
|
1339
1352
|
|
|
1340
1353
|
<div class="pkt-header-service__content">
|
|
1341
1354
|
${this.renderSlotContainer()} ${this.renderSearch()}
|
|
1342
|
-
${this.isTablet&&this.showLogoutInHeader?
|
|
1355
|
+
${this.isTablet&&this.showLogoutInHeader?y`
|
|
1343
1356
|
<pkt-button
|
|
1344
1357
|
skin="secondary"
|
|
1345
1358
|
size=${this.isMobile?"small":"medium"}
|
|
@@ -1349,12 +1362,12 @@
|
|
|
1349
1362
|
>
|
|
1350
1363
|
Logg ut
|
|
1351
1364
|
</pkt-button>
|
|
1352
|
-
`:
|
|
1365
|
+
`:x}
|
|
1353
1366
|
</div>
|
|
1354
1367
|
|
|
1355
1368
|
<div class="pkt-header-service__user">
|
|
1356
1369
|
${this.renderUserButton()}
|
|
1357
|
-
${!this.isTablet&&this.showLogoutInHeader?
|
|
1370
|
+
${!this.isTablet&&this.showLogoutInHeader?y`
|
|
1358
1371
|
<pkt-button
|
|
1359
1372
|
skin="tertiary"
|
|
1360
1373
|
size="medium"
|
|
@@ -1364,19 +1377,19 @@
|
|
|
1364
1377
|
>
|
|
1365
1378
|
Logg ut
|
|
1366
1379
|
</pkt-button>
|
|
1367
|
-
`:
|
|
1380
|
+
`:x}
|
|
1368
1381
|
</div>
|
|
1369
1382
|
</header>
|
|
1370
|
-
`}render(){const e=this.renderHeader();if(this.isFixed){const t=
|
|
1383
|
+
`}render(){const e=this.renderHeader();if(this.isFixed){const t=z({"pkt-header-service-spacer":!0,"pkt-header-service-spacer--compact":this.compact,"pkt-header-service-spacer--has-user":!!this.user,"pkt-header-service-spacer--mobile":this.isMobile});return y`
|
|
1371
1384
|
<div class="pkt-header-service-wrapper">
|
|
1372
1385
|
${e}
|
|
1373
1386
|
<div class=${t}></div>
|
|
1374
1387
|
</div>
|
|
1375
|
-
`}return e}};
|
|
1388
|
+
`}return e}};xe([u({type:String,attribute:"service-name"})],we.prototype,"serviceName",2),xe([u({type:String,attribute:"service-link"})],we.prototype,"serviceLink",2),xe([u({type:String,attribute:"logo-link"})],we.prototype,"logoLink",2),xe([u({type:String,attribute:"search-placeholder"})],we.prototype,"searchPlaceholder",2),xe([u({type:String,attribute:"search-value"})],we.prototype,"searchValue",2),xe([u({type:Number,attribute:"mobile-breakpoint"})],we.prototype,"mobileBreakpoint",2),xe([u({type:Number,attribute:"tablet-breakpoint"})],we.prototype,"tabletBreakpoint",2),xe([u({type:String,attribute:"opened-menu"})],we.prototype,"openedMenu",2),xe([u({type:String,attribute:"log-out-button-placement"})],we.prototype,"logOutButtonPlacement",2),xe([u({type:String})],we.prototype,"position",2),xe([u({type:String,attribute:"scroll-behavior"})],we.prototype,"scrollBehavior",2),xe([u({type:String,attribute:"slot-menu-variant"})],we.prototype,"slotMenuVariant",2),xe([u({type:String,attribute:"slot-menu-text"})],we.prototype,"slotMenuText",2),xe([u({type:Boolean,attribute:"hide-logo",converter:xt})],we.prototype,"hideLogo",2),xe([u({type:Boolean,converter:xt})],we.prototype,"compact",2),xe([u({type:Boolean,attribute:"show-search",converter:xt})],we.prototype,"showSearch",2),xe([u({type:Boolean,attribute:"can-change-representation",converter:xt})],we.prototype,"canChangeRepresentation",2),xe([u({type:Boolean,attribute:"has-log-out",converter:xt})],we.prototype,"hasLogOut",2),xe([u({type:Object})],we.prototype,"user",2),xe([u({type:Array,attribute:"user-menu"})],we.prototype,"userMenu",2),xe([u({type:Object})],we.prototype,"representing",2),xe([ce()],we.prototype,"isMobile",2),xe([ce()],we.prototype,"isTablet",2),xe([ce()],we.prototype,"openMenu",2),xe([ce()],we.prototype,"isHidden",2),xe([ce()],we.prototype,"componentWidth",2),xe([ce()],we.prototype,"hasSlotContent",2),xe([ce()],we.prototype,"alignSlotRight",2),xe([ce()],we.prototype,"alignSearchRight",2),we=xe([ge("pkt-header-service")],we);var lp=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,qe=(s,e,t,n)=>{for(var i=n>1?void 0:n?cp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&lp(e,t,i),i};let Ve=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn("[PktHeader] userMenuFooter is deprecated. Use userMenu instead."),this.userOptions!==void 0&&console.warn("[PktHeader] userOptions is deprecated. Use userMenu instead.")}get effectiveUserMenu(){const e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}render(){return y`
|
|
1376
1389
|
<pkt-header-service
|
|
1377
|
-
service-name=${
|
|
1378
|
-
service-link=${
|
|
1379
|
-
logo-link=${
|
|
1390
|
+
service-name=${A(this.serviceName)}
|
|
1391
|
+
service-link=${A(this.serviceLink)}
|
|
1392
|
+
logo-link=${A(this.logoLink)}
|
|
1380
1393
|
search-placeholder=${this.searchPlaceholder}
|
|
1381
1394
|
search-value=${this.searchValue}
|
|
1382
1395
|
mobile-breakpoint=${this.mobileBreakpoint}
|
|
@@ -1396,37 +1409,37 @@
|
|
|
1396
1409
|
.userMenu=${this.effectiveUserMenu}
|
|
1397
1410
|
.representing=${this.representing}
|
|
1398
1411
|
>
|
|
1399
|
-
<div class="pkt-contents" ${
|
|
1412
|
+
<div class="pkt-contents" ${X(this.defaultSlot)}></div>
|
|
1400
1413
|
</pkt-header-service>
|
|
1401
|
-
`}};
|
|
1414
|
+
`}};qe([u({type:String,attribute:"service-name"})],Ve.prototype,"serviceName",2),qe([u({type:String,attribute:"service-link"})],Ve.prototype,"serviceLink",2),qe([u({type:String,attribute:"logo-link"})],Ve.prototype,"logoLink",2),qe([u({type:String,attribute:"search-placeholder"})],Ve.prototype,"searchPlaceholder",2),qe([u({type:String,attribute:"search-value"})],Ve.prototype,"searchValue",2),qe([u({type:Number,attribute:"mobile-breakpoint"})],Ve.prototype,"mobileBreakpoint",2),qe([u({type:Number,attribute:"tablet-breakpoint"})],Ve.prototype,"tabletBreakpoint",2),qe([u({type:String,attribute:"opened-menu"})],Ve.prototype,"openedMenu",2),qe([u({type:String,attribute:"log-out-button-placement"})],Ve.prototype,"logOutButtonPlacement",2),qe([u({type:String})],Ve.prototype,"position",2),qe([u({type:String,attribute:"scroll-behavior"})],Ve.prototype,"scrollBehavior",2),qe([u({type:String,attribute:"slot-menu-variant"})],Ve.prototype,"slotMenuVariant",2),qe([u({type:String,attribute:"slot-menu-text"})],Ve.prototype,"slotMenuText",2),qe([u({type:Boolean,attribute:"hide-logo",converter:xt})],Ve.prototype,"hideLogo",2),qe([u({type:Boolean,converter:xt})],Ve.prototype,"compact",2),qe([u({type:Boolean,attribute:"show-search",converter:xt})],Ve.prototype,"showSearch",2),qe([u({type:Boolean,attribute:"can-change-representation",converter:xt})],Ve.prototype,"canChangeRepresentation",2),qe([u({type:Boolean,attribute:"has-log-out",converter:xt})],Ve.prototype,"hasLogOut",2),qe([u({type:Object})],Ve.prototype,"user",2),qe([u({type:Array,attribute:"user-menu"})],Ve.prototype,"userMenu",2),qe([u({type:Object})],Ve.prototype,"representing",2),qe([u({type:Array,attribute:"user-menu-footer"})],Ve.prototype,"userMenuFooter",2),qe([u({type:Array,attribute:"user-options"})],Ve.prototype,"userOptions",2),Ve=qe([ge("pkt-header")],Ve);var up=Object.defineProperty,dp=Object.getOwnPropertyDescriptor,Ws=(s,e,t,n)=>{for(var i=n>1?void 0:n?dp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&up(e,t,i),i};let xs=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new Qe(this,this.defaultSlot)}render(){const e=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),t=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return y`
|
|
1402
1415
|
<a
|
|
1403
1416
|
href=${this.href}
|
|
1404
1417
|
class=${e}
|
|
1405
1418
|
target=${this.openInNewTab?"_blank":"_self"}
|
|
1406
|
-
rel=${
|
|
1419
|
+
rel=${A(this.openInNewTab?"noopener noreferrer":void 0)}
|
|
1407
1420
|
>
|
|
1408
|
-
${this.iconName&&
|
|
1409
|
-
${this.title&&
|
|
1421
|
+
${this.iconName&&y`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
1422
|
+
${this.title&&y`<div class=${t}>${this.title}</div>`}
|
|
1410
1423
|
|
|
1411
|
-
<div class="pkt-linkcard__text" ${
|
|
1424
|
+
<div class="pkt-linkcard__text" ${X(this.defaultSlot)}></div>
|
|
1412
1425
|
</a>
|
|
1413
|
-
`}};
|
|
1426
|
+
`}};Ws([u({type:String,reflect:!0})],xs.prototype,"title",2),Ws([u({type:String,reflect:!0})],xs.prototype,"href",2),Ws([u({type:String,reflect:!0})],xs.prototype,"iconName",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"external",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"openInNewTab",2),Ws([u({type:String,reflect:!0})],xs.prototype,"skin",2),xs=Ws([ge("pkt-linkcard")],xs);var hp=Object.defineProperty,pp=Object.getOwnPropertyDescriptor,hs=(s,e,t,n)=>{for(var i=n>1?void 0:n?pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&hp(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let zt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has("delay")&&this.setupLoader()}render(){const e=z({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=z({"pkt-contents":!0,"pkt-hide":this.isLoading});return y`<div
|
|
1414
1427
|
role="status"
|
|
1415
1428
|
aria-live="polite"
|
|
1416
1429
|
aria-busy=${this.isLoading?"true":"false"}
|
|
1417
1430
|
class=${e}
|
|
1418
1431
|
>
|
|
1419
|
-
${this.isLoading&&this._shouldDisplayLoader?
|
|
1432
|
+
${this.isLoading&&this._shouldDisplayLoader?y`<div class="pkt-loader__spinner">
|
|
1420
1433
|
<pkt-icon
|
|
1421
1434
|
name=${this.getVariant(this.variant)}
|
|
1422
1435
|
path=${this.loadingAnimationPath}
|
|
1423
1436
|
class="pkt-loader__svg pkt-loader__${this.variant}"
|
|
1424
1437
|
></pkt-icon>
|
|
1425
|
-
${this.message&&
|
|
1426
|
-
</div>`:
|
|
1427
|
-
<div class=${t} ${
|
|
1428
|
-
</div>`}getVariant(e){switch(e){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};
|
|
1429
|
-
${this.closable?
|
|
1438
|
+
${this.message&&y`<p>${this.message}</p>`}
|
|
1439
|
+
</div>`:x}
|
|
1440
|
+
<div class=${t} ${X(this.defaultSlot)}></div>
|
|
1441
|
+
</div>`}getVariant(e){switch(e){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};hs([u({type:Number})],zt.prototype,"delay",2),hs([u({type:Boolean})],zt.prototype,"inline",2),hs([u({type:Boolean})],zt.prototype,"isLoading",2),hs([u({type:String})],zt.prototype,"message",2),hs([u({type:String})],zt.prototype,"size",2),hs([u({type:String})],zt.prototype,"variant",2),hs([u({type:String})],zt.prototype,"loadingAnimationPath",2),hs([ce()],zt.prototype,"_shouldDisplayLoader",2),zt=hs([ge("pkt-loader")],zt);const fp={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},Tr={props:fp};var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,mn=(s,e,t,n)=>{for(var i=n>1?void 0:n?mp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&gp(e,t,i),i};let zs=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.closable=Tr.props.closable.default,this.compact=Tr.props.compact.default,this.title="",this.skin=Tr.props.skin.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:s},bubbles:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}updated(s){super.updated(s),s.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const s={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return y`<div class=${z(s)}>
|
|
1442
|
+
${this.closable?y`<div class="pkt-messagebox__close">
|
|
1430
1443
|
<button
|
|
1431
1444
|
@click=${this.close}
|
|
1432
1445
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
@@ -1434,75 +1447,75 @@
|
|
|
1434
1447
|
>
|
|
1435
1448
|
<pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
|
|
1436
1449
|
</button>
|
|
1437
|
-
</div>`:
|
|
1438
|
-
${this.title?
|
|
1439
|
-
<div class="pkt-messagebox__text" ${
|
|
1440
|
-
</div>`}};
|
|
1450
|
+
</div>`:x}
|
|
1451
|
+
${this.title?y`<div class="pkt-messagebox__title">${this.title}</div>`:x}
|
|
1452
|
+
<div class="pkt-messagebox__text" ${X(this.defaultSlot)}></div>
|
|
1453
|
+
</div>`}};mn([u({type:Boolean,reflect:!0})],zs.prototype,"closable",2),mn([u({type:Boolean,reflect:!0})],zs.prototype,"compact",2),mn([u({type:String,reflect:!0})],zs.prototype,"title",2),mn([u({type:String,reflect:!0})],zs.prototype,"skin",2),mn([ce()],zs.prototype,"_isClosed",2),zs=mn([ge("pkt-messagebox")],zs);const bp={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},Nr={props:bp};var vp=Object.defineProperty,kp=Object.getOwnPropertyDescriptor,Yt=(s,e,t,n)=>{for(var i=n>1?void 0:n?kp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vp(e,t,i),i};let Ot=class extends Oe{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=Nr.props.hideCloseButton.default,this.closeOnBackdropClick=Nr.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=Nr.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.defaultSlot=Z(),this.dialogRef=Z(),this._isOpen=!1,this.close=(s,e=!1)=>{var t;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0,composed:!0})),e||(t=this.dialogRef.value)==null||t.close(),this.requestUpdate()},this.showModal=(s=null)=>{var e;this._isOpen=!0,(e=this.dialogRef.value)==null||e.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var n;this.dialogRef.value&&((n=this.dialogRef.value)==null||n.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:s},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new Qe(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(s){super.firstUpdated(s),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>mb).then(e=>e.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(s){s.key==="Escape"&&this.close(s)}handleBackdropClick(s){var e;this.closeOnBackdropClick&&s.target===((e=this.dialogRef)==null?void 0:e.value)&&this.close(s)}isElementInViewport(s){const e=s.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const s={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,"pkt-modal--noShadow":this.closeButtonSkin==="yellow-filled","pkt-modal--transparentBackdrop":this.transparentBackdrop??!1,[`pkt-modal--${this.size}`]:this.size!==void 0,[`pkt-modal__${this.variant}`]:this.variant!==void 0,[`pkt-modal__drawer--${this.drawerPosition}`]:this.variant==="drawer"},e={"pkt-modal__headingText":!0,"pkt-txt-24":!0},t={"pkt-modal__content":!0,"pkt-txt-18-light":!0},n=this.closeButtonSkin==="blue",i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return y`
|
|
1441
1454
|
<dialog
|
|
1442
|
-
class=${
|
|
1443
|
-
${
|
|
1455
|
+
class=${z(s)}
|
|
1456
|
+
${X(this.dialogRef)}
|
|
1444
1457
|
aria-labelledby="pkt-modal__headingText"
|
|
1445
1458
|
aria-describedby="pkt-modal__content"
|
|
1446
1459
|
@close=${r=>this.close(r,!0)}
|
|
1447
1460
|
>
|
|
1448
1461
|
<div class="pkt-modal__wrapper">
|
|
1449
|
-
${this.headingText||!this.hideCloseButton?
|
|
1462
|
+
${this.headingText||!this.hideCloseButton?y`<div class="pkt-modal__header">
|
|
1450
1463
|
<div class="pkt-modal__header-background"></div>
|
|
1451
|
-
${this.headingText?
|
|
1464
|
+
${this.headingText?y`<h1 id="pkt-modal__headingText" class=${z(e)}>
|
|
1452
1465
|
${this.headingText}
|
|
1453
|
-
</h1>`:
|
|
1454
|
-
${this.hideCloseButton?
|
|
1466
|
+
</h1>`:y`<div class="pkt-modal__headingText"></div>`}
|
|
1467
|
+
${this.hideCloseButton?y`<div class="pkt-modal__noCloseButton"></div>`:y`<div class="${z(i)}">
|
|
1455
1468
|
<pkt-button
|
|
1456
1469
|
@click=${r=>this.close(r)}
|
|
1457
1470
|
aria-label="close"
|
|
1458
1471
|
iconname="close"
|
|
1459
1472
|
variant="icon-only"
|
|
1460
1473
|
size="medium"
|
|
1461
|
-
skin=${
|
|
1474
|
+
skin=${n?"tertiary":"primary"}
|
|
1462
1475
|
>
|
|
1463
1476
|
Lukk
|
|
1464
1477
|
</pkt-button>
|
|
1465
1478
|
</div>`}
|
|
1466
|
-
</div>`:
|
|
1479
|
+
</div>`:x}
|
|
1467
1480
|
<div class="pkt-modal__container">
|
|
1468
1481
|
<div
|
|
1469
1482
|
id="pkt-modal__content"
|
|
1470
|
-
class=${
|
|
1471
|
-
${
|
|
1483
|
+
class=${z(t)}
|
|
1484
|
+
${X(this.defaultSlot)}
|
|
1472
1485
|
></div>
|
|
1473
1486
|
</div>
|
|
1474
1487
|
</div>
|
|
1475
1488
|
</dialog>
|
|
1476
|
-
`}};
|
|
1489
|
+
`}};Yt([u({type:String})],Ot.prototype,"headingText",2),Yt([u({type:Boolean})],Ot.prototype,"removePadding",2),Yt([u({type:Boolean})],Ot.prototype,"hideCloseButton",2),Yt([u({type:Boolean})],Ot.prototype,"closeOnBackdropClick",2),Yt([u({type:String})],Ot.prototype,"closeButtonSkin",2),Yt([u({type:String})],Ot.prototype,"size",2),Yt([u({type:String})],Ot.prototype,"variant",2),Yt([u({type:String})],Ot.prototype,"drawerPosition",2),Yt([u({type:Boolean})],Ot.prototype,"transparentBackdrop",2),Yt([ce()],Ot.prototype,"_isOpen",2),Ot=Yt([ge("pkt-modal")],Ot);/**
|
|
1477
1490
|
* @license
|
|
1478
1491
|
* Copyright 2018 Google LLC
|
|
1479
1492
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1480
|
-
*/const
|
|
1493
|
+
*/const wo="important",yp=" !"+wo,_p=Es(class extends nn{constructor(s){var e;if(super(s),s.type!==Ht.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(yp);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?wo:""):t[n]=i}}return wt}});var wp=Object.defineProperty,$p=Object.getOwnPropertyDescriptor,ct=(s,e,t,n)=>{for(var i=n>1?void 0:n?$p(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&wp(e,t,i),i};let Je=class extends Oe{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=ws(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=Z(),this.progressBarRef=Z()}firstUpdated(e){super.firstUpdated(e),this.setComputedValues(),this.syncAttributes()}updated(e){super.updated(e),e.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),e.has("id")&&this.id&&(this.progressBarId=this.id),(e.has("statusType")||e.has("id")||e.has("ariaLabelledby"))&&(this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(e.has("ariaValueText")||e.has("valueCurrent")||e.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const e=this.statusType!=="none",t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,i=this.statusType==="fraction"?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),r=`${this.valueCurrent} av ${t}`,a=z({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),l=z({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),c=z({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),p=z({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return y` <div
|
|
1481
1494
|
class="pkt-progressbar__container"
|
|
1482
1495
|
.ref=${this.progressBarRef}
|
|
1483
|
-
style=${
|
|
1496
|
+
style=${_p({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${i}%`})}
|
|
1484
1497
|
>
|
|
1485
|
-
${this.title?
|
|
1498
|
+
${this.title?y`<p id=${`${this.progressBarId}-title`} class=${l}>${this.title}</p>`:x}
|
|
1486
1499
|
|
|
1487
1500
|
<div class="pkt-progressbar__bar-wrapper">
|
|
1488
1501
|
<div class=${a}></div>
|
|
1489
1502
|
</div>
|
|
1490
1503
|
|
|
1491
|
-
${e?
|
|
1492
|
-
<span class=${p} ${
|
|
1493
|
-
${this.statusType==="percentage"?`${
|
|
1504
|
+
${e?y`<div class=${c}>
|
|
1505
|
+
<span class=${p} ${X(this.labelRef)}>
|
|
1506
|
+
${this.statusType==="percentage"?`${i}%`:r}
|
|
1494
1507
|
</span>
|
|
1495
|
-
</div>`:
|
|
1496
|
-
</div>`}setComputedValues(){this.progressbarId=this.id||
|
|
1497
|
-
${this.tagText?
|
|
1498
|
-
${this.optionalTag?
|
|
1499
|
-
${this.requiredTag?
|
|
1500
|
-
`,r=()=>
|
|
1508
|
+
</div>`:x}
|
|
1509
|
+
</div>`}setComputedValues(){this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===""?this.removeAttribute(e):this.setAttribute(e,String(t))}};ct([u({type:String})],Je.prototype,"ariaLabel",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaLabelledby",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaValueText",2),ct([u({type:String})],Je.prototype,"ariaLive",2),ct([u({type:String,reflect:!0})],Je.prototype,"id",2),ct([u({type:String})],Je.prototype,"role",2),ct([u({type:String})],Je.prototype,"skin",2),ct([u({type:String})],Je.prototype,"statusPlacement",2),ct([u({type:String})],Je.prototype,"statusType",2),ct([u({type:String,reflect:!0})],Je.prototype,"title",2),ct([u({type:String})],Je.prototype,"titlePosition",2),ct([u({type:Number,reflect:!0})],Je.prototype,"valueCurrent",2),ct([u({type:Number})],Je.prototype,"valueMax",2),ct([u({type:Number})],Je.prototype,"valueMin",2),ct([ce()],Je.prototype,"labelWidth",2),ct([ce()],Je.prototype,"progressbarId",2),ct([ce()],Je.prototype,"computedAriaLabelledby",2),ct([ce()],Je.prototype,"computedAriaValueText",2),Je=ct([ge("pkt-progressbar")],Je);var xp=Object.defineProperty,Sp=Object.getOwnPropertyDescriptor,Et=(s,e,t,n)=>{for(var i=n>1?void 0:n?Sp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&xp(e,t,i),i};let St=class extends ie{constructor(){super(...arguments),this.inputRef=Z(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(s,e,t){s==="defaultChecked"&&(this._checked=this.defaultChecked),s==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(s,e,t)}render(){const s=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),e=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),t=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),n="pkt-tag pkt-tag--small pkt-tag--thin-text",i=()=>y`
|
|
1510
|
+
${this.tagText?y`<span class=${n+" pkt-tag--gray"}>${this.tagText}</span>`:x}
|
|
1511
|
+
${this.optionalTag?y`<span class=${n+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
|
|
1512
|
+
${this.requiredTag?y`<span class=${n+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
|
|
1513
|
+
`,r=()=>y`
|
|
1501
1514
|
<label class=${t} for=${this.id+"-internal"}>
|
|
1502
|
-
${this.label} ${
|
|
1503
|
-
${this.checkHelptext?
|
|
1515
|
+
${this.label} ${i()}
|
|
1516
|
+
${this.checkHelptext?y`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:x}
|
|
1504
1517
|
</label>
|
|
1505
|
-
`;return
|
|
1518
|
+
`;return y`
|
|
1506
1519
|
<div class="pkt-input-check">
|
|
1507
1520
|
<div class=${s}>
|
|
1508
1521
|
<input
|
|
@@ -1513,7 +1526,7 @@
|
|
|
1513
1526
|
?disabled=${this.disabled}
|
|
1514
1527
|
form=""
|
|
1515
1528
|
name=${this.name+"-internal"}
|
|
1516
|
-
${
|
|
1529
|
+
${X(this.inputRef)}
|
|
1517
1530
|
@change=${this.toggleChecked}
|
|
1518
1531
|
@input=${this.onInput}
|
|
1519
1532
|
@blur=${this.onBlur}
|
|
@@ -1523,11 +1536,11 @@
|
|
|
1523
1536
|
${r()}
|
|
1524
1537
|
</div>
|
|
1525
1538
|
</div>
|
|
1526
|
-
`}toggleChecked(s=null){s&&s.preventDefault(),s&&s.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};
|
|
1539
|
+
`}toggleChecked(s=null){s&&s.preventDefault(),s&&s.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};Et([u({type:String,reflect:!0})],St.prototype,"value",2),Et([u({type:String})],St.prototype,"checkHelptext",2),Et([u({type:Boolean})],St.prototype,"defaultChecked",2),Et([u({type:Boolean})],St.prototype,"hasTile",2),Et([u({type:Boolean,reflect:!0})],St.prototype,"checked",2),Et([u({type:String,reflect:!0})],St.prototype,"type",2),Et([u({type:String})],St.prototype,"tagText",2),Et([u({type:Boolean})],St.prototype,"optionalTag",2),Et([u({type:String})],St.prototype,"optionalText",2),Et([u({type:Boolean})],St.prototype,"requiredTag",2),Et([u({type:String})],St.prototype,"requiredText",2),Et([ce()],St.prototype,"_checked",2),St=Et([ge("pkt-radiobutton")],St);/**
|
|
1527
1540
|
* @license
|
|
1528
1541
|
* Copyright 2021 Google LLC
|
|
1529
1542
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1530
|
-
*/let
|
|
1543
|
+
*/let $o=class extends Event{constructor(e,t,n,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=i??!1}};/**
|
|
1531
1544
|
* @license
|
|
1532
1545
|
* Copyright 2021 Google LLC
|
|
1533
1546
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1535,63 +1548,63 @@
|
|
|
1535
1548
|
* @license
|
|
1536
1549
|
* Copyright 2021 Google LLC
|
|
1537
1550
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1538
|
-
*/let
|
|
1551
|
+
*/let xo=class{constructor(e,t,n,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,a)),this.unsubscribe=a},this.host=e,t.context!==void 0){const r=t;this.context=r.context,this.callback=r.callback,this.subscribe=r.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new $o(this.context,this.host,this.t,this.subscribe))}};/**
|
|
1539
1552
|
* @license
|
|
1540
1553
|
* Copyright 2021 Google LLC
|
|
1541
1554
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1542
|
-
*/let
|
|
1555
|
+
*/let Cp=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){const n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(const[t,{disposer:n}]of this.subscriptions)t(this.o,n)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});const{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};/**
|
|
1543
1556
|
* @license
|
|
1544
1557
|
* Copyright 2021 Google LLC
|
|
1545
1558
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1546
|
-
*/let
|
|
1559
|
+
*/let Tp=class extends Event{constructor(s,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=s,this.contextTarget=e}},So=class extends Cp{constructor(e,t,n){var i,r;super(t.context!==void 0?t.initialValue:n),this.onContextRequest=a=>{if(a.context!==this.context)return;const l=a.contextTarget??a.composedPath()[0];l!==this.host&&(a.stopPropagation(),this.addCallback(a.callback,l,a.subscribe))},this.onProviderRequest=a=>{if(a.context!==this.context||(a.contextTarget??a.composedPath()[0])===this.host)return;const l=new Set;for(const[c,{consumerHost:p}]of this.subscriptions)l.has(c)||(l.add(c),p.dispatchEvent(new $o(this.context,p,c,!0)));a.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),(r=(i=this.host).addController)==null||r.call(i,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Tp(this.context,this.host))}};/**
|
|
1547
1560
|
* @license
|
|
1548
1561
|
* Copyright 2017 Google LLC
|
|
1549
1562
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1550
|
-
*/function
|
|
1563
|
+
*/function Np({context:s}){return(e,t)=>{const n=new WeakMap;if(typeof t=="object")return{get(){return e.get.call(this)},set(i){return n.get(this).setValue(i),e.set.call(this,i)},init(i){return n.set(this,new So(this,{context:s,initialValue:i})),i}};{e.constructor.addInitializer((a=>{n.set(a,new So(a,{context:s}))}));const i=Object.getOwnPropertyDescriptor(e,t);let r;if(i===void 0){const a=new WeakMap;r={get(){return a.get(this)},set(l){n.get(this).setValue(l),a.set(this,l)},configurable:!0,enumerable:!0}}else{const a=i.set;r={...i,set(l){n.get(this).setValue(l),a==null||a.call(this,l)}}}return void Object.defineProperty(e,t,r)}}}/**
|
|
1551
1564
|
* @license
|
|
1552
1565
|
* Copyright 2022 Google LLC
|
|
1553
1566
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1554
|
-
*/function
|
|
1567
|
+
*/function Mp({context:s,subscribe:e}){return(t,n)=>{typeof n=="object"?n.addInitializer((function(){new xo(this,{context:s,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new xo(i,{context:s,callback:r=>{i[n]=r},subscribe:e})}))}}const Co=Symbol("pkt-tabs-context");var Dp=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,bn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Op(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Dp(e,t,i),i};let Ys=class extends Oe{constructor(){super(),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.defaultSlot=Z(),this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)},this.slotController=new Qe(this,this.defaultSlot)}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has("arrowNav")||e.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(e,t){this.tabRefs[t]=e,this.tabCount=Math.max(this.tabCount,t+1)}handleClick(e){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){var n,i;this.useArrowNav&&(e.code==="ArrowLeft"&&t!==0&&((n=this.tabRefs[t-1])==null||n.focus()),e.code==="ArrowRight"&&t<this.tabCount-1&&((i=this.tabRefs[t+1])==null||i.focus()),(e.code==="ArrowDown"||e.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0})))}render(){const e=this.useArrowNav?"tablist":"navigation";return y`
|
|
1555
1568
|
<div class="pkt-tabs">
|
|
1556
|
-
<div class="pkt-tabs__list" role=${e} ${
|
|
1569
|
+
<div class="pkt-tabs__list" role=${e} ${X(this.defaultSlot)}></div>
|
|
1557
1570
|
</div>
|
|
1558
|
-
`}};
|
|
1559
|
-
${this.icon?
|
|
1560
|
-
<span ${
|
|
1561
|
-
${this.tag?
|
|
1562
|
-
`;return this.href?
|
|
1571
|
+
`}};bn([u({type:Boolean,reflect:!0,attribute:"arrow-nav"})],Ys.prototype,"arrowNav",2),bn([u({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],Ys.prototype,"disableArrowNav",2),bn([ce()],Ys.prototype,"tabRefs",2),bn([ce()],Ys.prototype,"tabCount",2),bn([Np({context:Co}),ce()],Ys.prototype,"context",2),Ys=bn([ge("pkt-tabs")],Ys);var Ep=Object.defineProperty,Pp=Object.getOwnPropertyDescriptor,ps=(s,e,t,n)=>{for(var i=n>1?void 0:n?Pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ep(e,t,i),i};let ts=class extends Oe{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=Z(),this.defaultSlot=Z(),this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(e){this.context&&this.context.handleKeyUp(e,this.index)}render(){var e;const t=((e=this.context)==null?void 0:e.useArrowNav)??!0,n=this.active?"active":"",i=t?"tab":void 0,r=t?this.active:void 0,a=this.active||!t?void 0:-1,l=y`
|
|
1572
|
+
${this.icon?y`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
|
|
1573
|
+
<span ${X(this.defaultSlot)}></span>
|
|
1574
|
+
${this.tag?y`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
|
|
1575
|
+
`;return this.href?y`
|
|
1563
1576
|
<a
|
|
1564
|
-
${
|
|
1577
|
+
${X(this.elementRef)}
|
|
1565
1578
|
href=${this.href}
|
|
1566
|
-
class="pkt-tabs__link ${
|
|
1567
|
-
role=${
|
|
1568
|
-
aria-selected=${
|
|
1569
|
-
aria-controls=${
|
|
1570
|
-
tabindex=${
|
|
1579
|
+
class="pkt-tabs__link ${n}"
|
|
1580
|
+
role=${A(i)}
|
|
1581
|
+
aria-selected=${A(r)}
|
|
1582
|
+
aria-controls=${A(this.controls||void 0)}
|
|
1583
|
+
tabindex=${A(a)}
|
|
1571
1584
|
@click=${this.handleClick}
|
|
1572
1585
|
@keyup=${this.handleKeyUp}
|
|
1573
1586
|
>
|
|
1574
1587
|
${l}
|
|
1575
1588
|
</a>
|
|
1576
|
-
`:
|
|
1589
|
+
`:y`
|
|
1577
1590
|
<button
|
|
1578
|
-
${
|
|
1591
|
+
${X(this.elementRef)}
|
|
1579
1592
|
type="button"
|
|
1580
|
-
class="pkt-tabs__button pkt-link-button ${
|
|
1581
|
-
role=${
|
|
1582
|
-
aria-selected=${
|
|
1583
|
-
aria-controls=${
|
|
1584
|
-
tabindex=${
|
|
1593
|
+
class="pkt-tabs__button pkt-link-button ${n}"
|
|
1594
|
+
role=${A(i)}
|
|
1595
|
+
aria-selected=${A(r)}
|
|
1596
|
+
aria-controls=${A(this.controls||void 0)}
|
|
1597
|
+
tabindex=${A(a)}
|
|
1585
1598
|
@click=${this.handleClick}
|
|
1586
1599
|
@keyup=${this.handleKeyUp}
|
|
1587
1600
|
>
|
|
1588
1601
|
${l}
|
|
1589
1602
|
</button>
|
|
1590
|
-
`}};
|
|
1603
|
+
`}};ps([u({type:Boolean,reflect:!0})],ts.prototype,"active",2),ps([u({type:String,reflect:!0})],ts.prototype,"href",2),ps([u({type:String,reflect:!0})],ts.prototype,"icon",2),ps([u({type:String,reflect:!0})],ts.prototype,"controls",2),ps([u({type:String,reflect:!0})],ts.prototype,"tag",2),ps([u({type:String,reflect:!0,attribute:"tag-skin"})],ts.prototype,"tagSkin",2),ps([u({type:Number,reflect:!0})],ts.prototype,"index",2),ps([Mp({context:Co,subscribe:!0}),u({attribute:!1})],ts.prototype,"context",2),ts=ps([ge("pkt-tab-item")],ts);/**
|
|
1591
1604
|
* @license
|
|
1592
1605
|
* Copyright 2020 Google LLC
|
|
1593
1606
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1594
|
-
*/const
|
|
1607
|
+
*/const Ap=Es(class extends nn{constructor(s){if(super(s),s.type!==Ht.PROPERTY&&s.type!==Ht.ATTRIBUTE&&s.type!==Ht.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ma(s))throw Error("`live` bindings can only contain a single expression")}render(s){return s}update(s,[e]){if(e===wt||e===x)return e;const t=s.element,n=s.name;if(s.type===Ht.PROPERTY){if(e===t[n])return wt}else if(s.type===Ht.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return wt}else if(s.type===Ht.ATTRIBUTE&&t.getAttribute(n)===e+"")return wt;return Oa(s),e}});var Ip=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,Rn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Lp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ip(e,t,i),i};let vn=class extends ie{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(s,e,t){s==="value"&&this.value!==e&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}updated(s){var e;super.updated(s),s.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const s=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),e=this.ariaLabelledby||`${this.id}-input-label`;return y`<pkt-input-wrapper
|
|
1595
1608
|
label=${this.label}
|
|
1596
1609
|
?counter=${this.counter}
|
|
1597
1610
|
?disabled=${this.disabled}
|
|
@@ -1614,16 +1627,16 @@
|
|
|
1614
1627
|
.tagText=${this.tagText}
|
|
1615
1628
|
class="pkt-textarea"
|
|
1616
1629
|
>
|
|
1617
|
-
<div class="pkt-contents" ${
|
|
1630
|
+
<div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1618
1631
|
<textarea
|
|
1619
|
-
${
|
|
1632
|
+
${X(this.inputRef)}
|
|
1620
1633
|
class=${s}
|
|
1621
1634
|
id=${this.id+"-input"}
|
|
1622
1635
|
name=${(this.name||this.id)+"-input"}
|
|
1623
|
-
placeholder=${
|
|
1624
|
-
.value=${
|
|
1625
|
-
minlength=${
|
|
1626
|
-
maxlength=${
|
|
1636
|
+
placeholder=${A(this.placeholder)}
|
|
1637
|
+
.value=${Ap(this.value)}
|
|
1638
|
+
minlength=${A(this.minlength)}
|
|
1639
|
+
maxlength=${A(this.maxlength)}
|
|
1627
1640
|
?readonly=${this.readonly}
|
|
1628
1641
|
autocomplete=${this.autocomplete}
|
|
1629
1642
|
aria-labelledby=${e}
|
|
@@ -1636,7 +1649,7 @@
|
|
|
1636
1649
|
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
1637
1650
|
@blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
|
|
1638
1651
|
></textarea>
|
|
1639
|
-
</pkt-input-wrapper>`}};
|
|
1652
|
+
</pkt-input-wrapper>`}};Rn([u({type:String,reflect:!0})],vn.prototype,"value",2),Rn([u({type:String})],vn.prototype,"autocomplete",2),Rn([u({type:Number})],vn.prototype,"rows",2),Rn([ce()],vn.prototype,"counterCurrent",2),vn=Rn([ge("pkt-textarea")],vn);var Bp=Object.defineProperty,To=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Bp(e,t,i),i};let Mr=class extends ie{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){var e,t;const n=this._optionsProp.length>0,i=((t=(e=this.optionsController)==null?void 0:e.nodes)==null?void 0:t.length)&&this.optionsController.nodes.length>0;n?this._options=this._optionsProp:i&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};To([u({type:Array,attribute:"options"})],Mr.prototype,"_optionsProp"),To([ce()],Mr.prototype,"_options");var Fp=Object.defineProperty,Vp=Object.getOwnPropertyDescriptor,No=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fp(e,t,i),i};let Dr=class extends Mr{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)})}add(s,e){const t={value:s.value||s.text,label:s.text||s.value,selected:s.selected,disabled:s.disabled};if(e===void 0)this._options.push(t);else if(typeof e=="number")this._options.splice(e,0,t);else{const n=e.value||e.text,i=this._options.findIndex(r=>r.value===n);i>=0?this._options.splice(i,0,t):this._options.push(t)}s.selected&&(this.value=s.value||s.text,this.selectedIndex=this._options.findIndex(n=>n.value===this.value)),this.requestUpdate()}remove(s){var e;typeof s=="number"&&(this.selectedIndex===s&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(s,1),this.requestUpdate())}item(s){var e;return(e=this.inputRef.value)==null?void 0:e.item(s)}namedItem(s){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(s)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(s,e,t){var n,i;s==="options"&&(this._options=t?JSON.parse(t):[]),s==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((n=this.inputRef.value)==null?void 0:n.selectedIndex):this._options.findIndex(r=>r.value===t),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}update(s){var e,t;super.update(s),s.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),s.has("value")&&this.value!==s.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(n=>n.value===this.value),this.selectedOptions=(t=this.inputRef.value)==null?void 0:t.selectedOptions,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(s){var e;super.firstUpdated(s),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(t=>t.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const s=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return y`
|
|
1640
1653
|
<pkt-input-wrapper
|
|
1641
1654
|
?counter=${this.counter}
|
|
1642
1655
|
?disabled=${this.disabled}
|
|
@@ -1646,23 +1659,23 @@
|
|
|
1646
1659
|
?optionalTag=${this.optionalTag}
|
|
1647
1660
|
?requiredTag=${this.requiredTag}
|
|
1648
1661
|
useWrapper=${this.useWrapper}
|
|
1649
|
-
ariaDescribedBy=${
|
|
1662
|
+
ariaDescribedBy=${A(this.ariaDescribedBy)}
|
|
1650
1663
|
class="pkt-select"
|
|
1651
|
-
errorMessage=${
|
|
1664
|
+
errorMessage=${A(this.errorMessage)}
|
|
1652
1665
|
forId=${this.id+"-input"}
|
|
1653
|
-
helptext=${
|
|
1654
|
-
helptextDropdown=${
|
|
1655
|
-
helptextDropdownButton=${
|
|
1656
|
-
label=${
|
|
1657
|
-
optionalText=${
|
|
1658
|
-
requiredText=${
|
|
1659
|
-
tagText=${
|
|
1666
|
+
helptext=${A(this.helptext)}
|
|
1667
|
+
helptextDropdown=${A(this.helptextDropdown)}
|
|
1668
|
+
helptextDropdownButton=${A(this.helptextDropdownButton)}
|
|
1669
|
+
label=${A(this.label)}
|
|
1670
|
+
optionalText=${A(this.optionalText)}
|
|
1671
|
+
requiredText=${A(this.requiredText)}
|
|
1672
|
+
tagText=${A(this.tagText)}
|
|
1660
1673
|
>
|
|
1661
1674
|
<select
|
|
1662
1675
|
class=${s}
|
|
1663
1676
|
aria-invalid=${this.hasError}
|
|
1664
1677
|
aria-errormessage=${`${this.id}-error`}
|
|
1665
|
-
aria-labelledby=${
|
|
1678
|
+
aria-labelledby=${A(this.ariaLabelledby)}
|
|
1666
1679
|
?disabled=${this.disabled}
|
|
1667
1680
|
id=${this.id+"-input"}
|
|
1668
1681
|
name=${(this.name||this.id)+"-input"}
|
|
@@ -1671,9 +1684,9 @@
|
|
|
1671
1684
|
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
1672
1685
|
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
1673
1686
|
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
1674
|
-
${
|
|
1687
|
+
${X(this.inputRef)}
|
|
1675
1688
|
>
|
|
1676
|
-
${this._options.length>0?this._options.map(e=>
|
|
1689
|
+
${this._options.length>0?this._options.map(e=>y`<option
|
|
1677
1690
|
value=${e.value}
|
|
1678
1691
|
?selected=${this.value==e.value||e.selected}
|
|
1679
1692
|
?disabled=${e.disabled}
|
|
@@ -1682,10 +1695,10 @@
|
|
|
1682
1695
|
${e.label}
|
|
1683
1696
|
</option>`):""}
|
|
1684
1697
|
</select>
|
|
1685
|
-
<div class="pkt-contents" ${
|
|
1698
|
+
<div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
1686
1699
|
</pkt-input-wrapper>
|
|
1687
|
-
`}returnNumberOrNull(s){return s==null||isNaN(s)?null:s}};
|
|
1700
|
+
`}returnNumberOrNull(s){return s==null||isNaN(s)?null:s}};No([u({type:String})],Dr.prototype,"value",2),Dr=No([ge("pkt-select")],Dr);const R=os({tagName:"pkt-icon",elementClass:As,react:d,displayName:"PktIcon",events:{}}),Mo=d.forwardRef(({defaultOpen:s=!1,id:e,title:t,skin:n,compact:i=!1,isOpen:r,children:a,name:l,className:c,onClick:p,onToggle:g},b)=>{const[f,k]=d.useState(s),{name:v}=Kl(),$=l||v,M=r!==void 0?r:f;d.useEffect(()=>{r===void 0&&k(s)},[s,r]);const S=D=>{const ee=D.currentTarget.open;r===void 0&&k(ee),g==null||g(D)},T=D=>{setTimeout(()=>{p==null||p(D)},0)},L=["pkt-accordion-item",i&&"pkt-accordion-item--compact",n&&`pkt-accordion-item--${n}`,c].filter(Boolean).join(" ");return o.jsxs("details",{ref:b,className:L,id:e,open:M,onClick:T,name:$,onToggle:S,children:[o.jsxs("summary",{className:"pkt-accordion-item__title",id:`pkt-accordion-item-summary-${e}`,children:[t,o.jsx(R,{name:"chevron-thin-down",className:"pkt-accordion-item__icon","aria-hidden":"true"})]}),o.jsx("div",{className:"pkt-accordion-item__content",id:`pkt-accordion-item__content-${e}`,role:"region",children:o.jsx("div",{className:"pkt-accordion-item__content-inner",children:a})})]})});Mo.displayName="PktAccordionItem";function Up(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Or={exports:{}};/*!
|
|
1688
1701
|
Copyright (c) 2018 Jed Watson.
|
|
1689
1702
|
Licensed under the MIT License (MIT), see
|
|
1690
1703
|
http://jedwatson.github.io/classnames
|
|
1691
|
-
*/var Aa;function Th(){return Aa||(Aa=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=n(r,i(l)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=n(a,l));return a}function n(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Kn)),Kn.exports}var Nh=Th();const oe=Ch(Nh),an=({children:s,closeAlert:e,compact:t,title:i,date:n,ariaLive:r,"aria-live":a="polite",role:l="status",skin:d="info",className:p,...m})=>{const[b,y]=h.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${d}`]:d,"pkt-hide":b},g={"pkt-alert__grid":!0,"pkt-alert__noTitle":!i,"pkt-alert__noDate":!n},$=h.useCallback(()=>{y(!0),m.onClose&&m.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[m.onClose,y]),T=r||a;return o.jsx("div",{...m,"aria-live":T,role:l,className:oe(k,p),children:o.jsxs("div",{className:oe(g),children:[o.jsx(Y,{className:"pkt-alert__icon","aria-hidden":"true",name:d==="info"?"alert-information":`alert-${d}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(at,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),i&&o.jsx("div",{className:"pkt-alert__title",children:i}),o.jsx("div",{className:"pkt-alert__text",children:s}),n&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",n]})]})})};an.displayName="PktAlert";const Ia=It({tagName:"pkt-backlink",elementClass:Hs,react:h,displayName:"PktBackLink"});Ia.displayName="PktBackLink";const La=h.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:i,...n},r)=>{const a=s,l=a[a.length-2],d=[i,"pkt-breadcrumbs"].filter(Boolean).join(" "),p=t||(e==="router"?({href:m,className:b,children:y,props:k})=>o.jsx(Yo.Link,{to:m,className:b,...k,children:y}):({href:m,className:b,children:y,props:k})=>o.jsx("a",{href:m,className:b,...k,children:y}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:d,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((m,b)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:b===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:m.text})}):p({href:m.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(Y,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:m.text})]}),props:n})},`breadcrumb-${b}`))}),p({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(Y,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:n})]})});La.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/15.4/animations/";const at=h.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:i="user",iconPath:n,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:d=!1,skin:p="primary",type:m="button",variant:b="label-only",state:y,color:k,isLoading:g=void 0,disabled:$=void 0,loadingAnimationPath:T=window.pktAnimationPath,...M},S)=>{const O=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",d&&"pkt-btn--full-small",p&&`pkt-btn--${p}`,b&&`pkt-btn--${b}`,k&&`pkt-btn--${k}`,y&&`pkt-btn--${y}`,g&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...M,"aria-busy":g||void 0,"aria-disabled":$||void 0,disabled:$,className:O,type:m,ref:S,children:[g&&o.jsx(Y,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:T}),b!=="label-only"&&o.jsx(Y,{className:"pkt-btn__icon",name:t,...n&&{path:n}}),o.jsx("span",{className:"pkt-btn__text",children:s}),b==="icons-right-and-left"&&o.jsx(Y,{className:"pkt-btn__icon",name:i,...r&&{path:r}})]})});at.displayName="PktButton";const Ba=6048e5,Mh=864e5,Fa=Symbol.for("constructDateFrom");function jt(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Fa in s?s[Fa](e):s instanceof Date?new s.constructor(e):new Date(e)}function yt(s,e){return jt(e||s,s)}function Ha(s,e,t){const i=yt(s,t==null?void 0:t.in);return isNaN(e)?jt(s,NaN):(e&&i.setDate(i.getDate()+e),i)}let Dh={};function on(){return Dh}function Ni(s,e){var l,d,p,m;const t=on(),i=(e==null?void 0:e.weekStartsOn)??((d=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??t.weekStartsOn??((m=(p=t.locale)==null?void 0:p.options)==null?void 0:m.weekStartsOn)??0,n=yt(s,e==null?void 0:e.in),r=n.getDay(),a=(r<i?7:0)+r-i;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ln(s,e){return Ni(s,{...e,weekStartsOn:1})}function Va(s,e){const t=yt(s,e==null?void 0:e.in),i=t.getFullYear(),n=jt(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const r=ln(n),a=jt(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ln(a);return t.getTime()>=r.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function Ua(s){const e=yt(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function ja(s,...e){const t=jt.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function Gn(s,e){const t=yt(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function Oh(s,e,t){const[i,n]=ja(t==null?void 0:t.in,s,e),r=Gn(i),a=Gn(n),l=+r-Ua(r),d=+a-Ua(a);return Math.round((l-d)/Mh)}function Eh(s,e){const t=Va(s,e),i=jt(s,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ln(i)}function Ph(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Ah(s){return!(!Ph(s)&&typeof s!="number"||isNaN(+yt(s)))}function Ih(s,e){const t=yt(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Lh(s,e){const[t,i]=ja(s,e.start,e.end);return{start:t,end:i}}function qa(s,e){const{start:t,end:i}=Lh(e==null?void 0:e.in,s);let n=+t>+i;const r=n?+t:+i,a=n?i:t;a.setHours(0,0,0,0);let l=1;const d=[];for(;+a<=r;)d.push(jt(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return n?d.reverse():d}function Bh(s,e){const t=yt(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Fh={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Hh=(s,e,t)=>{let i;const n=Fh[s];return typeof n=="string"?i=n:e===1?i=n.one:i=n.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Xn(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const Vh={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Uh={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jh={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qh={date:Xn({formats:Vh,defaultWidth:"full"}),time:Xn({formats:Uh,defaultWidth:"full"}),dateTime:Xn({formats:jh,defaultWidth:"full"})},Wh={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},zh=(s,e,t,i)=>Wh[s];function Mi(s){return(e,t)=>{const i=t!=null&&t.context?String(t.context):"standalone";let n;if(i==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;n=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;n=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return n[r]}}const Yh={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kh={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Gh={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Xh={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Qh={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Zh={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Jh={ordinalNumber:(s,e)=>{const t=Number(s),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Mi({values:Yh,defaultWidth:"wide"}),quarter:Mi({values:Kh,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Mi({values:Gh,defaultWidth:"wide"}),day:Mi({values:Xh,defaultWidth:"wide"}),dayPeriod:Mi({values:Qh,defaultWidth:"wide",formattingValues:Zh,defaultFormattingWidth:"wide"})};function Di(s){return(e,t={})=>{const i=t.width,n=i&&s.matchPatterns[i]||s.matchPatterns[s.defaultMatchWidth],r=e.match(n);if(!r)return null;const a=r[0],l=i&&s.parsePatterns[i]||s.parsePatterns[s.defaultParseWidth],d=Array.isArray(l)?ep(l,b=>b.test(a)):Rh(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(d):d,p=t.valueCallback?t.valueCallback(p):p;const m=e.slice(a.length);return{value:p,rest:m}}}function Rh(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function ep(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function tp(s){return(e,t={})=>{const i=e.match(s.matchPattern);if(!i)return null;const n=i[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(n.length);return{value:a,rest:l}}}const sp=/^(\d+)(th|st|nd|rd)?/i,ip=/\d+/i,np={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},rp={any:[/^b/i,/^(a|c)/i]},ap={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},op={any:[/1/i,/2/i,/3/i,/4/i]},lp={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cp={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},dp={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},up={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},hp={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},pp={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fp={ordinalNumber:tp({matchPattern:sp,parsePattern:ip,valueCallback:s=>parseInt(s,10)}),era:Di({matchPatterns:np,defaultMatchWidth:"wide",parsePatterns:rp,defaultParseWidth:"any"}),quarter:Di({matchPatterns:ap,defaultMatchWidth:"wide",parsePatterns:op,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Di({matchPatterns:lp,defaultMatchWidth:"wide",parsePatterns:cp,defaultParseWidth:"any"}),day:Di({matchPatterns:dp,defaultMatchWidth:"wide",parsePatterns:up,defaultParseWidth:"any"}),dayPeriod:Di({matchPatterns:hp,defaultMatchWidth:"any",parsePatterns:pp,defaultParseWidth:"any"})},mp={code:"en-US",formatDistance:Hh,formatLong:qh,formatRelative:zh,localize:Jh,match:fp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function gp(s,e){const t=yt(s,e==null?void 0:e.in);return Oh(t,Bh(t))+1}function vp(s,e){const t=yt(s,e==null?void 0:e.in),i=+ln(t)-+Eh(t);return Math.round(i/Ba)+1}function Wa(s,e){var m,b,y,k;const t=yt(s,e==null?void 0:e.in),i=t.getFullYear(),n=on(),r=(e==null?void 0:e.firstWeekContainsDate)??((b=(m=e==null?void 0:e.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??n.firstWeekContainsDate??((k=(y=n.locale)==null?void 0:y.options)==null?void 0:k.firstWeekContainsDate)??1,a=jt((e==null?void 0:e.in)||s,0);a.setFullYear(i+1,0,r),a.setHours(0,0,0,0);const l=Ni(a,e),d=jt((e==null?void 0:e.in)||s,0);d.setFullYear(i,0,r),d.setHours(0,0,0,0);const p=Ni(d,e);return+t>=+l?i+1:+t>=+p?i:i-1}function bp(s,e){var l,d,p,m;const t=on(),i=(e==null?void 0:e.firstWeekContainsDate)??((d=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??t.firstWeekContainsDate??((m=(p=t.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)??1,n=Wa(s,e),r=jt((e==null?void 0:e.in)||s,0);return r.setFullYear(n,0,i),r.setHours(0,0,0,0),Ni(r,e)}function za(s,e){const t=yt(s,e==null?void 0:e.in),i=+Ni(t,e)-+bp(t,e);return Math.round(i/Ba)+1}function ge(s,e){const t=s<0?"-":"",i=Math.abs(s).toString().padStart(e,"0");return t+i}const as={y(s,e){const t=s.getFullYear(),i=t>0?t:1-t;return ge(e==="yy"?i%100:i,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):ge(t+1,2)},d(s,e){return ge(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return ge(s.getHours()%12||12,e.length)},H(s,e){return ge(s.getHours(),e.length)},m(s,e){return ge(s.getMinutes(),e.length)},s(s,e){return ge(s.getSeconds(),e.length)},S(s,e){const t=e.length,i=s.getMilliseconds(),n=Math.trunc(i*Math.pow(10,t-3));return ge(n,e.length)}},Zs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ya={G:function(s,e,t){const i=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});case"GGGG":default:return t.era(i,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const i=s.getFullYear(),n=i>0?i:1-i;return t.ordinalNumber(n,{unit:"year"})}return as.y(s,e)},Y:function(s,e,t,i){const n=Wa(s,i),r=n>0?n:1-n;if(e==="YY"){const a=r%100;return ge(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):ge(r,e.length)},R:function(s,e){const t=Va(s);return ge(t,e.length)},u:function(s,e){const t=s.getFullYear();return ge(t,e.length)},Q:function(s,e,t){const i=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return ge(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(s,e,t){const i=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return ge(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(s,e,t){const i=s.getMonth();switch(e){case"M":case"MM":return as.M(s,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(s,e,t){const i=s.getMonth();switch(e){case"L":return String(i+1);case"LL":return ge(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(s,e,t,i){const n=za(s,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):ge(n,e.length)},I:function(s,e,t){const i=vp(s);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):ge(i,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):as.d(s,e)},D:function(s,e,t){const i=gp(s);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):ge(i,e.length)},E:function(s,e,t){const i=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});case"EEEE":default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(s,e,t,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return ge(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});case"eeee":default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(s,e,t,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return ge(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});case"cccc":default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(s,e,t){const i=s.getDay(),n=i===0?7:i;switch(e){case"i":return String(n);case"ii":return ge(n,e.length);case"io":return t.ordinalNumber(n,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});case"iiii":default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(s,e,t){const n=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(s,e,t){const i=s.getHours();let n;switch(i===12?n=Zs.noon:i===0?n=Zs.midnight:n=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(s,e,t){const i=s.getHours();let n;switch(i>=17?n=Zs.evening:i>=12?n=Zs.afternoon:i>=4?n=Zs.morning:n=Zs.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let i=s.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return as.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):as.H(s,e)},K:function(s,e,t){const i=s.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):ge(i,e.length)},k:function(s,e,t){let i=s.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):ge(i,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):as.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):as.s(s,e)},S:function(s,e){return as.S(s,e)},X:function(s,e,t){const i=s.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ga(i);case"XXXX":case"XX":return Ns(i);case"XXXXX":case"XXX":default:return Ns(i,":")}},x:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"x":return Ga(i);case"xxxx":case"xx":return Ns(i);case"xxxxx":case"xxx":default:return Ns(i,":")}},O:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ka(i,":");case"OOOO":default:return"GMT"+Ns(i,":")}},z:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ka(i,":");case"zzzz":default:return"GMT"+Ns(i,":")}},t:function(s,e,t){const i=Math.trunc(+s/1e3);return ge(i,e.length)},T:function(s,e,t){return ge(+s,e.length)}};function Ka(s,e=""){const t=s>0?"-":"+",i=Math.abs(s),n=Math.trunc(i/60),r=i%60;return r===0?t+String(n):t+String(n)+e+ge(r,2)}function Ga(s,e){return s%60===0?(s>0?"-":"+")+ge(Math.abs(s)/60,2):Ns(s,e)}function Ns(s,e=""){const t=s>0?"-":"+",i=Math.abs(s),n=ge(Math.trunc(i/60),2),r=ge(i%60,2);return t+n+e+r}const Xa=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Qa=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},yp={p:Qa,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Xa(s,e);let r;switch(i){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",Xa(i,e)).replace("{{time}}",Qa(n,e))}},kp=/^D+$/,_p=/^Y+$/,$p=["D","DD","YY","YYYY"];function wp(s){return kp.test(s)}function xp(s){return _p.test(s)}function Sp(s,e,t){const i=Cp(s,e,t);if(console.warn(i),$p.includes(s))throw new RangeError(i)}function Cp(s,e,t){const i=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Tp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Np=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mp=/^'([^]*?)'?$/,Dp=/''/g,Op=/[a-zA-Z]/;function Ep(s,e,t){var m,b,y,k;const i=on(),n=i.locale??mp,r=i.firstWeekContainsDate??((b=(m=i.locale)==null?void 0:m.options)==null?void 0:b.firstWeekContainsDate)??1,a=i.weekStartsOn??((k=(y=i.locale)==null?void 0:y.options)==null?void 0:k.weekStartsOn)??0,l=yt(s,t==null?void 0:t.in);if(!Ah(l))throw new RangeError("Invalid time value");let d=e.match(Np).map(g=>{const $=g[0];if($==="p"||$==="P"){const T=yp[$];return T(g,n.formatLong)}return g}).join("").match(Tp).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const $=g[0];if($==="'")return{isToken:!1,value:Pp(g)};if(Ya[$])return{isToken:!0,value:g};if($.match(Op))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:g}});n.localize.preprocessor&&(d=n.localize.preprocessor(l,d));const p={firstWeekContainsDate:r,weekStartsOn:a,locale:n};return d.map(g=>{if(!g.isToken)return g.value;const $=g.value;(xp($)||wp($))&&Sp($,e,String(s));const T=Ya[$[0]];return T(l,$,n.localize,p)}).join("")}function Pp(s){const e=s.match(Mp);return e?e[1].replace(Dp,"'"):s}function Ap(s,e){const t=yt(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Ip(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Qn={},Oi={};function Ms(s,e){try{const i=(Qn[s]||(Qn[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return i in Oi?Oi[i]:Za(i,i.split(":"))}catch{if(s in Oi)return Oi[s];const t=s==null?void 0:s.match(Lp);return t?Za(s,t.slice(1)):NaN}}const Lp=/([+-]\d\d):?(\d\d)?/;function Za(s,e){const t=+(e[0]||0),i=+(e[1]||0),n=+(e[2]||0)/60;return Oi[s]=t*60+i>0?t*60+i+n:t*60-i-n}class qt extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Ms(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Ra(this),Zn(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new qt(...t,e):new qt(Date.now(),e)}withTimeZone(e){return new qt(+this,e)}getTimezoneOffset(){const e=-Ms(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Zn(this),+this}[Symbol.for("constructDateFrom")](e){return new qt(+new Date(e),this.timeZone)}}const Ja=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Ja.test(s))return;const e=s.replace(Ja,"$1UTC");qt.prototype[e]&&(s.startsWith("get")?qt.prototype[s]=function(){return this.internal[e]()}:(qt.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),Bp(this),+this},qt.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Zn(this),+this}))});function Zn(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Ms(s.timeZone,s)*60))}function Bp(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),Ra(s)}function Ra(s){const e=Ms(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+s);i.setUTCHours(i.getUTCHours()-1);const n=-new Date(+s).getTimezoneOffset(),r=-new Date(+i).getTimezoneOffset(),a=n-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const d=n-t;d&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+d);const p=new Date(+s);p.setUTCSeconds(0);const m=n>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(Ms(s.timeZone,s)*60))%60;(b||m)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+m));const y=Ms(s.timeZone,s),k=y>0?Math.floor(y):Math.ceil(y),$=-new Date(+s).getTimezoneOffset()-k,T=k!==t,M=$-d;if(T&&M){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+M);const S=Ms(s.timeZone,s),O=S>0?Math.floor(S):Math.ceil(S),N=k-O;N&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+N),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+N))}}class os extends qt{static tz(e,...t){return t.length?new os(...t,e):new os(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),n=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+n}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,n]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${i} ${t} ${n}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,n]=this.tzComponents();return`${e} GMT${t}${i}${n} (${Ip(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),n=String(Math.abs(e)%60).padStart(2,"0");return[t,i,n]}withTimeZone(e){return new os(+this,e)}[Symbol.for("constructDateFrom")](e){return new os(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Fp=(s=window.pktTz)=>{const e=new os(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function Wt(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,i]=s.split("-").map(Number);return new Date(e,t-1,i)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const ot=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),i=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${i}`},Ei=s=>{if(!s)return null;const e=Wt(s);return isNaN(e.getTime())?null:e},Hp=(s,e)=>{const t=Qt(s);return isNaN(t.getTime())?"":Ep(t,e)},Qt=(s="",e)=>{const t=typeof s=="string"?Wt(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Ih(t):Gn(t):t},Js=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const i=new Date(s,e,t);return isNaN(i.getTime())?new Date:i},Pi=s=>{let e;return typeof s=="number"?e=new os(s,window.pktTz):e=new os(s,window.pktTz),e.setHours(12,0,0,0),e};let Jn=null,eo;const Vp=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Jn||eo!==e)&&(Jn=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),eo=e),Jn.format(s)},Up=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const i=e?Qt(e):null,n=t?Qt(t):null;return!(i&&s<i||n&&s>n)},jp=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=ot(s);return e.includes(t)},qp=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},to=(s,e,t,i,n)=>!(!s||isNaN(s.getTime())||!Up(s,e,t)||i&&jp(s,i)||n&&qp(s,n)),Wp=(s,e,t,i,n)=>s.filter(r=>{const a=Ei(r);return a&&to(a,e,t,i,n)}),zp=s=>s.slice().sort((e,t)=>{const i=Ei(e),n=Ei(t);return!i||!n?0:i.getTime()-n.getTime()}),Yp=(s,e)=>{const t=Ei(s),i=Ei(e);return!t||!i?!1:t<=i};function so(s,e){const t=(e.excludedates??[]).map(i=>typeof i=="string"?i:ot(i));return!to(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function Kp(s,e,t,i){return!!(so(s,t)||!e&&i.multiple&&i.maxMultiple>0&&i.selectedCount>=i.maxMultiple)}function Gp(s,e,t){const i=Js(s,e,0);return!(t&&Qt(t)>i)}function Xp(s,e,t){const i=Js(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Qt(t)<i)}function io(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>Wt(e))}function no(s,e){const t=qa({start:s,end:e}),i={};if(Array.isArray(t)&&t.length)for(let n=0;n<t.length;n++){const r=t[n],a=r>s&&r<e;i[ot(r)]=a}return i}function ro(s,e,t,i){if(e.length!==1)return!0;const n=qa({start:e[0],end:s});if(!Array.isArray(n)||!n.length)return!0;for(let r=0;r<n.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((i??[]).includes(Ap(n[r]).toString()))return!1}return!0}function Rn(s,e){const t=ot(s);return e.includes(t)?e:[...e,t]}function er(s,e){const t=ot(s),i=e.indexOf(t);if(i===-1)return e;if(e.length===1)return[];const n=[...e];return n.splice(i,1),n}function ao(s,e,t){const i=ot(s);return e.includes(i)?er(s,e):t>0&&e.length>=t?e:Rn(s,e)}function Qp(s,e,t){const i=ot(s),n=io(e);if(e.includes(i))return e.indexOf(i)===0?[]:er(s,e);if(e.length>1)return[i];if(e.length===1){if(!ro(s,n,t.excludedates,t.excludeweekdays))return[i];if(n[0]>s)return[i]}return Rn(s,e)}const Ai=7,Zp=6;function Jp(s,e){const t=Js(s,e,1),i=Js(s,e+1,0),n=(t.getDay()+Zp)%Ai,r=i.getDate(),a=Math.ceil((r+n)/Ai),d=Js(s,e,0).getDate(),p=za(t);return{firstDayOfMonth:t,lastDayOfMonth:i,startingDay:n,numDays:r,numRows:a,numDaysPrevMonth:d,initialWeek:p}}function Rp(s,e,t,i){const{startingDay:n,numDays:r}=i;return s===0&&e<n?"prev-month":t>r?"next-month":"current-month"}function ef(s,e,t,i){const{startingDay:n,numDaysPrevMonth:r,numDays:a}=i;return s==="prev-month"?r-(n-e-1):s==="next-month"?t-a:t}const tf={ArrowLeft:-1,ArrowRight:1,ArrowUp:-Ai,ArrowDown:Ai};function sf(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function nf(s,e,t){let i=Ha(s,e);if(!i)return null;let n=t(`button[data-date="${ot(i)}"]`);for(;n instanceof HTMLButtonElement&&n.dataset.disabled;)if(i=Ha(i,e),n=t(`button[data-date="${ot(i)}"]`),!n)return null;return i}function rf(s){return tf[s]??null}const af={month:"Måned",year:"År",days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"};function of(s){const{selected:e,multiple:t=!1,maxMultiple:i=0,range:n=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:d=[],weeknumbers:p=!1,withcontrols:m=!1,currentmonth:b,today:y,strings:k,onDateSelected:g,onClose:$,id:T,className:M}=s,S=h.useId(),O=T??S,N=h.useMemo(()=>({...af,...k}),[k]),V=h.useMemo(()=>y?Wt(y):Fp(),[y]),X=h.useMemo(()=>l?l.map(f=>typeof f=="string"?Wt(f):f):[],[l]),te=e!==void 0,[we,j]=h.useState([]),C=te?e:we,H=h.useMemo(()=>io(C),[C]),[W,Q]=h.useState(0),[se,ie]=h.useState(0),[pe,ne]=h.useState({}),[ve,K]=h.useState(null),[G,Pe]=h.useState(null),re=h.useRef(null),ae=h.useRef([]),tt=h.useRef(0),Ve=h.useRef(!1),Se=h.useRef(!1),Ge=h.useMemo(()=>({earliest:r,latest:a,excludedates:X,excludeweekdays:d}),[r,a,X,d]);h.useEffect(()=>{let f=null;if(b!=null&&(b instanceof Date?f=Pi(b):typeof b=="string"&&(f=Wt(b))),!f||isNaN(f.getTime()))if(C.length>0&&C[0]!==""){const u=Wt(C[C.length-1]);f=isNaN(u.getTime())?Pi(V):u}else f=Pi(V);if((!f||isNaN(f.getTime()))&&(f=Pi(V)),a){const u=typeof a=="string"?Wt(a):a;!isNaN(u.getTime())&&f>u&&(f=u)}if(r){const u=typeof r=="string"?Wt(r):r;!isNaN(u.getTime())&&f<u&&(f=u)}Q(f.getFullYear()),ie(f.getMonth()),Se.current=!0},[]),h.useEffect(()=>{if(Se.current&&!Ve.current&&C.length>0&&C[0]!==""){const f=Wt(C[C.length-1]);isNaN(f.getTime())||(Q(f.getFullYear()),ie(f.getMonth()))}},[C]),h.useEffect(()=>{n&&H.length===2?ne(no(H[0],H[1])):(!n||H.length<2)&&ne({})},[n,H]);const lt=h.useCallback(f=>{te||j(f),g==null||g(f)},[te,g]),xe=h.useCallback(()=>{$==null||$()},[$]),Ne=h.useCallback((f,u)=>{Q(typeof f=="string"?parseInt(f):f),ie(typeof u=="string"?parseInt(u):u),tt.current=0,Pe(null),ae.current=[],Ve.current=!0},[]),Xe=h.useCallback(()=>{const f=se===0?11:se-1,u=se===0?W-1:W;Ne(u,f)},[W,se,Ne]),Ue=h.useCallback(()=>{const f=se===11?0:se+1,u=se===11?W+1:W;Ne(u,f)},[W,se,Ne]),Qe=h.useCallback(f=>so(f,Ge),[Ge]),ue=h.useCallback((f,u)=>Kp(f,u,Ge,{multiple:t,maxMultiple:i,selectedCount:C.length}),[Ge,t,i,C.length]),Me=h.useCallback(()=>typeof C=="string"?C.split(","):C,[C]),Ae=h.useCallback(f=>{if(!n||H.length!==1||!ro(f,H,X,d)||H[0]>=f){K(null);return}K(f),ne(no(H[0],f))},[n,H,X,d]),st=h.useCallback(f=>{if(!f)return;let u;if(n)u=Qp(f,Me(),{excludedates:X,excludeweekdays:d}),te||j(u),u.length===2?(g==null||g(u),xe()):(u.length===1&&ne({}),g==null||g(u));else if(t)u=ao(f,Me(),i),lt(u);else{const _=ot(f);C.includes(_)?u=[]:u=[_],lt(u),xe()}},[n,t,i,Me,C,X,d,te,lt,xe,g]),le=h.useCallback(f=>{const u=Rn(f,Me());te||j(u),n&&u.length===2&&(g==null||g(u),xe())},[Me,te,n,g,xe]),q=h.useCallback(f=>{const u=er(f,Me());te||j(u)},[Me,te]),ce=h.useCallback(f=>{const u=ao(f,Me(),i);te||j(u)},[Me,i,te]),be=h.useCallback(()=>{var x,L;const f=ot(Pi(V)),u=(x=re.current)==null?void 0:x.querySelector(`button[data-date="${f}"]`);if(u instanceof HTMLButtonElement){Pe(f),u.focus();return}const _=ae.current.find(U=>!U.isDisabled);if(_){const U=(L=re.current)==null?void 0:L.querySelector(`button[data-date="${_.currentDateISO}"]`);U instanceof HTMLButtonElement&&(Pe(_.currentDateISO),U.focus())}},[]),ye=h.useCallback((f,u)=>{const _=f.target;if(sf(_))return;if(f.preventDefault(),!G){be();return}const x=Qt(G),L=nf(x,u,re.current.querySelector.bind(re.current));if(L){const U=re.current.querySelector(`button[data-date="${ot(L)}"]`);U instanceof HTMLButtonElement&&!U.dataset.disabled&&(Pe(ot(L)),U.focus())}},[G,be]),je=h.useCallback(f=>{if(f.key==="Escape"){f.preventDefault(),xe();return}const u=rf(f.key);u!==null&&ye(f.nativeEvent,u)},[xe,ye]),Ze=h.useCallback(f=>{re.current&&!re.current.contains(f.relatedTarget)&&!f.target.classList.contains("pkt-hide")&&xe()},[xe]);return{componentId:O,strings:N,todayDate:V,year:W,month:se,activeSelected:C,_selected:H,inRange:pe,rangeHovered:ve,focusedDate:G,range:n,multiple:t,weeknumbers:p,withcontrols:m,earliest:r,latest:a,excludedates:X,excludeweekdays:d,className:M,dateConstraints:Ge,calendarRef:re,selectableDatesRef:ae,tabIndexSetRef:tt,prevMonth:Xe,nextMonth:Ue,changeMonth:Ne,handleDateSelect:st,addToSelected:le,removeFromSelected:q,toggleSelectedDate:ce,handleRangeHover:Ae,isExcluded:Qe,isDayDisabled:ue,focusOnCurrentDate:be,handleKeydown:je,handleFocusOut:Ze,close:xe,setFocusedDate:Pe}}const lf=({componentId:s,strings:e,year:t,month:i,earliest:n,latest:r,withcontrols:a,prevMonth:l,nextMonth:d,changeMonth:p})=>{const m=y=>{const k=y==="prev",g=k?Gp(t,i,n):Xp(t,i,r),$=k?e.prevMonth:e.nextMonth,T=k?"chevron-thin-left":"chevron-thin-right",M=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",S=k?l:d;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>g&&S(),onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),g&&S())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",M,!g&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":g?void 0:"disabled","aria-disabled":!g||void 0,tabIndex:g?0:-1,children:[o.jsx(Y,{className:"pkt-btn__icon",name:T}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},b=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:i,onChange:y=>{y.stopPropagation(),p(t,parseInt(y.target.value))},children:e.months.map((y,k)=>o.jsx("option",{value:k,children:y},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:y=>{y.stopPropagation(),p(parseInt(y.target.value),i)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[i]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[m("prev"),b(),m("next")]})};function cf(s,e,t){const i=Js(t.year,t.month,s),n=ot(i),r=n===ot(e),a=t.activeSelected.includes(n),l=t.isDayDisabled(i,a);let d;return t.focusedDate?d=t.focusedDate===n&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,d="0"):d=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:i,currentDateISO:n,isToday:r,isSelected:a,isDisabled:l,ariaLabel:Vp(i),tabindex:d}}function df(s,e){const{currentDateISO:t,isToday:i,isSelected:n}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return oe({"pkt-cal-today":i,"pkt-cal-selected":n,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===ot(e.rangeHovered)})}function uf(s,e){const{currentDateISO:t,isToday:i,isSelected:n,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return oe({"pkt-calendar__date":!0,"pkt-calendar__date--today":i,"pkt-calendar__date--selected":n,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===ot(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const hf=({state:s})=>{const{strings:e,year:t,month:i,activeSelected:n,focusedDate:r,inRange:a,rangeHovered:l,range:d,multiple:p,weeknumbers:m,selectableDatesRef:b,tabIndexSetRef:y,handleDateSelect:k,handleRangeHover:g,isExcluded:$,isDayDisabled:T,setFocusedDate:M,todayDate:S}=s,O={year:t,month:i,activeSelected:n,focusedDate:r,tabIndexSetRef:y,isDayDisabled:T},N={range:d,activeSelected:n,rangeHovered:l,inRange:a,isExcluded:$},V=()=>{const j=[];m&&j.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let C=0;C<e.daysShort.length;C++)j.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[C],children:e.daysShort[C]})},`day-${C}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:j})},X=(j,C)=>{const H=cf(j,C,O),{currentDate:W,currentDateISO:Q,isSelected:se,isDisabled:ie,ariaLabel:pe,tabindex:ne}=H;b.current.push({currentDateISO:Q,isDisabled:ie,tabindex:ne});const ve=df(H,N),K=uf(H,N);return o.jsx("td",{className:ve,children:o.jsx("button",{type:"button","aria-pressed":se?"true":"false",disabled:ie,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${K}`,onMouseOver:()=>d&&!$(W)&&g(W),onFocus:()=>{d&&!$(W)&&g(W),M(Q)},"aria-label":pe,tabIndex:parseInt(ne),"data-disabled":ie?"disabled":void 0,"data-date":Q,onKeyDown:G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),k(W))},onClick:G=>{ie||(G.preventDefault(),k(W))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:j})})},Q)},te=(j,C)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:j})})},C),we=()=>{const j=S,C=Jp(t,i);b.current=[],y.current=0;let H=1,W=C.initialWeek;const Q=[];for(let se=0;se<C.numRows;se++){const ie=[];m&&ie.push(o.jsx("td",{className:"pkt-cal-week",children:W},`week-${W}`)),W++;for(let pe=0;pe<Ai;pe++){const ne=Rp(se,pe,H,C);if(ne==="current-month")ie.push(X(H,j)),H++;else{const ve=ef(ne,pe,H,C);ie.push(te(ve,`${ne}-${se}-${pe}`)),ne==="next-month"&&H++}}Q.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ie},`row-${se}`))}return Q};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":d||p||void 0,children:[o.jsx("thead",{children:V()}),o.jsx("tbody",{children:we()})]})},tr=h.forwardRef((s,e)=>{const t=of(s);return h.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(lf,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(hf,{state:t})]})});tr.displayName="PktCalendar";const pf=It({tagName:"pkt-card",elementClass:ze,react:h,displayName:"PktCard",events:{}}),oo=h.forwardRef(({children:s,...e},t)=>o.jsx(pf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));oo.displayName="PktCard";const lo=h.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:i,checkHelptext:n,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:d=!1,labelPosition:p="right",defaultChecked:m,checked:b,indeterminate:y,optionalTag:k,optionalText:g="Valgfritt",requiredTag:$,requiredText:T="Må fylles ut",tagText:M,...S},O)=>{const N=h.useRef(null);h.useEffect(()=>{N.current&&y!==void 0&&(N.current.indeterminate=y)},[y]),h.useEffect(()=>{typeof O=="function"?O(N.current):O&&(O.current=N.current)},[O]);const V=[a,"pkt-input-check"].filter(Boolean).join(" "),X=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${p}`,d?"pkt-sr-only":""].filter(Boolean).join(" "),te=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),we=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),j=()=>o.jsxs(o.Fragment,{children:[M&&o.jsx("span",{className:we+" pkt-tag--gray",children:M}),k&&o.jsx("span",{className:we+" pkt-tag--blue-light",children:g}),$&&o.jsx("span",{className:we+" pkt-tag--beige",children:T})]});return o.jsx("div",{className:V,children:o.jsxs("div",{className:te,children:[p==="left"&&o.jsxs("label",{className:X,htmlFor:s,children:[i," ",j(),n&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:n})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:N,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...b!==void 0?{checked:b}:{defaultChecked:m},...S}),p==="right"&&o.jsxs("label",{className:X,htmlFor:s,children:[i," ",j(),n&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:n})]})]})})});lo.displayName="PktCheckbox";const ff=It({tagName:"pkt-combobox",elementClass:Ee,react:h,displayName:"PktCombobox",events:{onClick:"click",onChange:"change",onInput:"input",onBlur:"blur",onFocus:"focus",onValueChange:"value-change",onToggleHelpText:"toggleHelpText"}}),co=h.forwardRef(({children:s,helptext:e,...t},i)=>o.jsxs(ff,{...t,ref:i,children:[e&&o.jsx("div",{slot:"helptext",className:"pkt-contents",children:e}),s]}));co.displayName="PktCombobox";const cn=It({tagName:"pkt-consent",elementClass:Tt,react:h,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});cn.displayName="PktConsent";const Ds=h.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:i,helptextDropdownButton:n,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:d=!1,optionalText:p="Valgfritt",requiredTag:m=!1,requiredText:b="Må fylles ut",tagText:y=null,hasError:k=!1,errorMessage:g,disabled:$=!1,inline:T=!1,ariaDescribedby:M,useWrapper:S=!0,children:O,className:N="",hasFieldset:V=!1,role:X="group",counterPosition:te="bottom"},we)=>{const[j,C]=h.useState(!1),H=M||(t?`${s}-helptext`:void 0),W=!!r,Q=W&&te==="top",se=W&&te==="bottom",ie=()=>C(ae=>!ae),pe=["pkt-inputwrapper",N,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",T?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),ne=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),ve=()=>W?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,K=()=>o.jsxs(o.Fragment,{children:[y&&o.jsx("span",{className:ne+" pkt-tag--gray",children:y}),d&&o.jsx("span",{className:ne+" pkt-tag--blue-light",children:p}),m&&o.jsx("span",{className:ne+" pkt-tag--beige",children:b})]}),G=()=>{const ae=o.jsxs(o.Fragment,{children:[e," ",K()]});return S?V?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:ae}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":H,id:`${s}-label`,children:ae}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":H,id:`${s}-label`,children:e})},Pe=()=>!t&&!i?null:o.jsxs(o.Fragment,{children:[t&&S&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),i&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(at,{skin:"tertiary",size:"small",variant:"icon-right",iconName:j?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ie,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:n??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${j?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:i})]})]}),re=o.jsxs(o.Fragment,{children:[G(),Pe(),Q&&o.jsx(ve,{}),O,se&&o.jsx(ve,{}),k&&g&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(an,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:g})})]});return o.jsx("div",{className:pe,ref:we,role:X,children:V?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":H,children:re}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:re})})});Ds.displayName="PktInputWrapper";const uo=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},mf=()=>uo()?"text":"date",gf=s=>!s||s.length!==2?!0:Yp(s[0],s[1]),vf=(s,e,t,i,n,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":i,"ios-readonly-hack":n===!1&&r==="text"}),bf=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),yf=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),kf=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,_f=(s,e,t=!1)=>{var l;if(!s||!e)return;const i=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),n=t?i.height+30:i.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";i&&i.top+r>window.innerHeight&&i.top-r>0&&(a=`calc(100% - ${n}px - ${r}px)`),s.style.top=a},dn=(s,e,t,i,n,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):n&&n()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():i?i():n&&n())},$f=({open:s,multiple:e=!1,range:t=!1,weeknumbers:i=!1,withcontrols:n=!1,selected:r=[],earliest:a,latest:l,excludedates:d,excludeweekdays:p,maxMultiple:m,currentmonth:b,today:y,inputRef:k,hasCounter:g=!1,onDateSelected:$,onClose:T})=>{const M=h.useRef(null),S=h.useRef(!1);s&&(S.current=!0),h.useEffect(()=>{s&&_f(M.current,(k==null?void 0:k.current)??null,g)},[s,k,g]);const O=["pkt-calendar-popup",s?"show":"hide"].join(" "),N=s||S.current;return o.jsx("div",{ref:M,className:O,hidden:!s,"aria-hidden":!s,children:N&&o.jsx(tr,{multiple:e,range:t,weeknumbers:i,withcontrols:n,selected:r,earliest:a,latest:l,excludedates:d,excludeweekdays:p,maxMultiple:m,currentmonth:b,today:y,onDateSelected:$,onClose:T})})},un=h.forwardRef(({children:s,skin:e,textStyle:t,size:i,closeTag:n,className:r,iconName:a,ariaLabel:l,onClose:d,type:p,"aria-description":m,...b},y)=>{const[k,g]=h.useState(!1),$=h.useCallback(()=>{g(!0),d&&d()},[d]),T=h.useRef(null),[M,S]=h.useState("");h.useEffect(()=>{var X,te;S(((te=(X=T.current)==null?void 0:X.textContent)==null?void 0:te.trim())??"")},[s]);const O=h.useMemo(()=>{if(n&&!l)return M&&`Klikk for å fjerne ${M}`||m},[n,l,M,m]),N={"pkt-tag":!0,[`pkt-tag--${i}`]:!!i,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},V={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${i}`]:!!i,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":n&&!!a,"pkt-hide":k};return n?o.jsxs("button",{...b,className:oe(V,r),type:p,onClick:$,"aria-label":l,"aria-description":O,ref:y,children:[a&&o.jsx(Y,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:T,children:s}),o.jsx(Y,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...b,className:oe(N,r),ref:y,children:[a&&o.jsx(Y,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:T,children:s})]})});un.displayName="PktTag";const wf=({dates:s,dateformat:e,idBase:t,strings:i,onDateRemoved:n})=>{var l;const r=zp(s),a=((l=i==null?void 0:i.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(d=>{const p=Hp(d,e);return o.jsx(un,{id:`${t}${d}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>n(d),children:o.jsx("time",{dateTime:d,children:p})},d)})})},xf=({state:s})=>{var Ge,lt,xe,Ne;const{id:e,inputId:t,values:i,dateformat:n,multiple:r,range:a,showRangeLabels:l,disabled:d,readOnly:p,required:m,label:b,name:y,placeholder:k,hasError:g,helptext:$,minStr:T,maxStr:M,inputType:S,isIOSDevice:O,strings:N,inputClasses:V,buttonClasses:X,rangeLabelClasses:te,datepickerInputsClasses:we,isInputDisabled:j,inputRef:C,inputRefTo:H,btnRef:W,toggleCalendar:Q,handleFocus:se,handleSingleInputChange:ie,handleRangeFromChange:pe,handleRangeToChange:ne,handleRangeBlur:ve,handleMultipleBlur:K,handleTagRemoved:G,handleSingleKeydown:Pe,handleRangeFromKeydown:re,handleRangeToKeydown:ae,handleMultipleKeydown:tt,restProps:Ve}=s,Se=()=>{var Xe,Ue;return o.jsxs("button",{ref:W,className:X,type:"button",onClick:Q,disabled:d,"aria-label":((Xe=N.calendar)==null?void 0:Xe.buttonAltText)??"Åpne kalender",children:[o.jsx(Y,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Ue=N.calendar)==null?void 0:Ue.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(wf,{dates:i,dateformat:n,idBase:e,strings:N,onDateRemoved:G}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...Ve,ref:C,className:V,type:S,id:t,name:y??e,placeholder:k,readOnly:p||O&&!p,disabled:j,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":g,"aria-errormessage":g?`${e}-error`:void 0,onClick:Q,onKeyDown:tt,onFocus:se,onBlur:K}),Se()]})})]}):a?o.jsx("div",{className:we,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Ge=N.generic)==null?void 0:Ge.from)??"Fra"}),o.jsx("input",{...Ve,ref:C,className:V,type:S,id:t,name:y?`${y}-from`:`${e}-from`,value:i[0]??"",min:T,max:M,placeholder:k,readOnly:p||O&&!p,disabled:d,required:m,"aria-label":`${b} ${((lt=N.generic)==null?void 0:lt.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":g,"aria-errormessage":g?`${e}-error`:void 0,onClick:Q,onKeyDown:re,onFocus:se,onBlur:ve,onChange:pe}),o.jsx("div",{className:te,id:`${e}-to-label`,children:((xe=N.generic)==null?void 0:xe.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:H,className:V,type:S,id:`${e}-to`,name:y?`${y}-to`:`${e}-to`,value:i[1]??"",min:T,max:M,readOnly:p||O&&!p,disabled:d,"aria-label":`${b} ${((Ne=N.generic)==null?void 0:Ne.to)??"Til"}`,"aria-invalid":g,onClick:Q,onKeyDown:ae,onFocus:se,onBlur:ve,onChange:ne}),Se()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...Ve,ref:C,className:V,type:S,id:t,name:y??e,value:i[0]??"",min:T,max:M,placeholder:k,readOnly:p||O&&!p,disabled:d,required:m,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":g,"aria-errormessage":g?`${e}-error`:void 0,onClick:Q,onKeyDown:Pe,onFocus:se,onBlur:void 0,onChange:ie}),Se()]})})},Sf={calendar:{buttonAltText:"Åpne kalender"}},Cf={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},ho=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Tf(s,e){const{id:t,label:i,value:n,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:d,range:p=!1,showRangeLabels:m=!1,weeknumbers:b=!1,withcontrols:y=!1,excludedates:k,excludeweekdays:g,currentmonth:$,today:T,calendarOpen:M,timezone:S,fullwidth:O=!1,hasFieldset:N=!1,inline:V=!1,helptext:X,helptextDropdown:te,helptextDropdownButton:we,hasError:j=!1,errorMessage:C,optionalTag:H=!1,optionalText:W,requiredTag:Q=!1,requiredText:se,tagText:ie,useWrapper:pe=!0,strings:ne,disabled:ve=!1,readOnly:K=!1,required:G=!1,name:Pe,min:re,max:ae,placeholder:tt,onChange:Ve,onValueChange:Se,className:Ge,...lt}=s,xe=h.useCallback(D=>D===void 0?[]:ho(D),[]),Ne=n!==void 0,Xe=typeof r=="number"?void 0:r,[Ue,Qe]=h.useState(()=>xe(n??Xe)),ue=Ne?xe(n):Ue,Me=h.useRef(Ue);h.useEffect(()=>{Ne&&Qe(xe(n))},[n,Ne,xe]);const[Ae,st]=h.useState(M??!1);h.useEffect(()=>{M!==void 0&&st(M)},[M]);const le=h.useRef(null),q=h.useRef(null),ce=h.useRef(null),be=h.useRef(null),ye=h.useRef(null),je=h.useMemo(()=>mf(),[]),Ze=h.useMemo(()=>uo(),[]),f=h.useMemo(()=>ne??(p?Cf:Sf),[ne,p]),u=typeof re=="string"?re:re!==void 0?String(re):void 0,_=typeof ae=="string"?ae:ae!==void 0?String(ae):void 0,x=h.useMemo(()=>{const D=vf(O,m,l,p,K,je);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[O,m,l,p,K,je]),L=h.useMemo(()=>{const D=bf();return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[]),U=h.useMemo(()=>{const D=yf(m);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[m]),R=h.useMemo(()=>["pkt-datepicker__inputs",p&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,m]),pt=h.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Je=ve||l&&d!=null&&ue.length>=d,ft=l&&d!=null,Os=`${t}-input`,ti=ue.join(",");h.useEffect(()=>{ce.current&&(ce.current.value=ti)},[ti]),h.useEffect(()=>{S&&typeof window<"u"&&S!==window.pktTz&&(window.pktTz=S)},[S]);const kt=h.useCallback((D,E=!0)=>{Ne||Qe(D),E&&(Se==null||Se(D))},[Ne,Se]),ur=h.useMemo(()=>{var D;return(D=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:D.set},[]),_t=h.useCallback(D=>{const E=ce.current;!E||!ur||(ur.call(E,D.join(",")),E.dispatchEvent(new Event("input",{bubbles:!0})))},[ur]),Zt=h.useCallback(()=>{ve||st(D=>!D)},[ve]),ls=h.useCallback(()=>{st(!1)},[]);h.useEffect(()=>{if(!Ae)return;const D=Fe=>{var bn;const Re=Fe.target;ye.current&&!ye.current.contains(Re)&&!((bn=Re.closest)!=null&&bn.call(Re,".pkt-calendar-popup"))&&ls()},E=Fe=>{var Re;Fe.key==="Escape"&&(ls(),(Re=le.current)==null||Re.focus())};return document.addEventListener("click",D,!0),document.addEventListener("keydown",E),()=>{document.removeEventListener("click",D,!0),document.removeEventListener("keydown",E)}},[Ae,ls]);const Ym=h.useCallback(()=>{Ze&&!Ae&&st(!0)},[Ze,Ae]),Km=h.useCallback(D=>{var Re;const E=kf(D,l,p),Fe=ho(E);kt(Fe),_t(Fe),!l&&!p&&(ls(),(Re=le.current)==null||Re.focus())},[l,p,kt,_t,ls]),Gm=h.useCallback(()=>{var D;ls(),(D=le.current)==null||D.focus()},[ls]),Xm=h.useCallback(D=>{const E=D.target.value,Fe=E?[E]:[];kt(Fe),_t(Fe)},[kt,_t]),Qm=h.useCallback(D=>{const E=D.target.value,Fe=ue[1]??"",Re=[E,Fe].filter(Boolean);kt(Re),_t(Re)},[ue,kt,_t]),Zm=h.useCallback(D=>{const E=ue[0]??"",Fe=D.target.value,Re=[E,Fe].filter(Boolean);kt(Re),_t(Re)},[ue,kt,_t]),Jm=h.useCallback(()=>{ue.length===2&&!gf(ue)&&(kt([ue[0]]),_t([ue[0]]))},[ue,kt,_t]),vn=h.useCallback(D=>{const E=Qt(D),Fe=u?Qt(u):null,Re=_?Qt(_):null;if(E&&!isNaN(E.getTime())&&(!Fe||E>=Fe)&&(!Re||E<=Re)){const bn=Wp([...ue,D],u,_,k,g),qo=[...new Set(bn)];kt(qo),_t(qo)}},[ue,u,_,k,g,kt,_t]),Rm=h.useCallback(D=>{const E=D.target;E.value&&(vn(E.value.split(",")[0]),E.value="")},[vn]),jo=h.useCallback(D=>{const E=D.target;E.value&&(vn(E.value.split(",")[0]),E.value="")},[vn]),eg=h.useCallback(D=>{const E=ue.filter(Fe=>Fe!==D);kt(E),_t(E)},[ue,kt,_t]),cs=h.useCallback(D=>{const E=D==null?void 0:D.closest("form");E?E.requestSubmit():D==null||D.blur()},[]),tg=h.useCallback(D=>{dn(D.nativeEvent,()=>Zt(),()=>cs(le.current),void 0,()=>{var E;return(E=le.current)==null?void 0:E.blur()})},[Zt,cs]),sg=h.useCallback(D=>{dn(D.nativeEvent,()=>Zt(),()=>cs(le.current),()=>{var E;return(E=q.current)==null?void 0:E.focus()},()=>{var E;return(E=le.current)==null?void 0:E.blur()})},[Zt,cs]),ig=h.useCallback(D=>{dn(D.nativeEvent,()=>Zt(),()=>cs(q.current),void 0,()=>{var E;return(E=q.current)==null?void 0:E.blur()})},[Zt,cs]),ng=h.useCallback(D=>{dn(D.nativeEvent,()=>Zt(),()=>cs(le.current),void 0,()=>{var E;return(E=le.current)==null?void 0:E.blur()},jo)},[Zt,cs,jo]);return h.useEffect(()=>{var Fe;const D=(Fe=ye.current)==null?void 0:Fe.closest("form");if(!D)return;const E=()=>{window.setTimeout(()=>{Qe(Me.current),st(!1),ce.current&&(ce.current.value=Me.current.join(","))},0)};return D.addEventListener("reset",E),()=>D.removeEventListener("reset",E)},[]),h.useImperativeHandle(e,()=>({get value(){var D;return((D=ce.current)==null?void 0:D.value)??""},set value(D){const E=D?D.split(",").filter(Boolean):[];Qe(E),ce.current&&(ce.current.value=D??"")},focus(){var D;(D=le.current)==null||D.focus()},blur(){var D;(D=le.current)==null||D.blur()}}),[]),{id:t,inputId:Os,label:i,values:ue,calendarOpen:Ae,dateformat:a,multiple:l,maxlength:d,range:p,showRangeLabels:m,weeknumbers:b,withcontrols:y,excludedates:k,excludeweekdays:g,disabled:ve,readOnly:K,required:G,name:Pe,placeholder:tt,fullwidth:O,hasFieldset:N,inline:V,helptext:X,helptextDropdown:te,helptextDropdownButton:we,hasError:j,errorMessage:C,optionalTag:H,optionalText:W,requiredTag:Q,requiredText:se,tagText:ie,useWrapper:pe,className:Ge,minStr:u,maxStr:_,effectiveCurrentMonth:pt,today:T,inputType:je,isIOSDevice:Ze,strings:f,inputClasses:x,buttonClasses:L,rangeLabelClasses:U,datepickerInputsClasses:R,isInputDisabled:Je,hasCounter:ft,inputRef:le,inputRefTo:q,changeInputRef:ce,btnRef:be,wrapperRef:ye,onChange:Ve,toggleCalendar:Zt,hideCalendar:ls,handleDateSelected:Km,handleCalendarClose:Gm,handleFocus:Ym,handleSingleInputChange:Xm,handleRangeFromChange:Qm,handleRangeToChange:Zm,handleRangeBlur:Jm,handleMultipleBlur:Rm,handleTagRemoved:eg,handleSingleKeydown:tg,handleRangeFromKeydown:sg,handleRangeToKeydown:ig,handleMultipleKeydown:ng,restProps:lt}}const po=h.forwardRef((s,e)=>{const t=Tf(s,e),i=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:i,children:[o.jsx(Ds,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(xf,{state:t})}),o.jsx($f,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});po.displayName="PktDatepicker";const Nf={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},Mf={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},Df={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},Of={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},fo=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),Ef=()=>{const s=fo(),e=fo();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class mo{constructor(e,t){yn(this,"fileId");yn(this,"file");yn(this,"attributes",{});this.fileId=t||Ef(),this.file=e,this.attributes={targetFilename:e.name}}}const sr=h.createContext({}),Pf=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",Af=h.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:i=()=>{},name:n,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:d=!1,srAnnouncementIds:p,...m},b)=>{const y=h.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,g=h.useMemo(()=>k?k.split(/\s*,\s*/).map(C=>C.trim()).filter(Boolean).join(", ").toUpperCase():Pf,[k]);h.useImperativeHandle(b,()=>y.current);const[$,T]=h.useState(!1),M=h.useMemo(()=>l?e?Df:Of:e?Nf:Mf,[e,l]),S=h.useCallback(C=>{if(y.current)try{y.current.files=If(C)}catch{}},[y.current,t]);h.useEffect(()=>{S(t)},[y,t]);const O=h.useCallback(C=>{const H=C.map(W=>new mo(W));i(H),y.current&&(y.current.value="")},[i]),N=C=>{const H=C.target.files;if(H.length===0){e&&S(t);return}O(Array.from(H))},V=C=>{O(C)},X=C=>{if(C.preventDefault(),T(!1),d)return;const H=C.dataTransfer.files,W=Array.from(H);V(W)},te=C=>{C.preventDefault(),!d&&T(!0)},we=()=>{T(!1)},j=h.useCallback(C=>{var W;d||C.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(W=y.current)==null||W.click()},[d]);return o.jsxs("div",{onDrop:X,onDragOver:te,onDragLeave:we,onClick:j,className:oe("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":d}),children:[o.jsx("input",{...m,id:s,type:"file",ref:y,multiple:e,onChange:N,accept:k,disabled:d,name:r==="form"&&n||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(C=>o.jsx("input",{type:"hidden",name:n,value:C.fileId},C.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(Y,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${M.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[M.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:C=>{var H;C.preventDefault(),C.stopPropagation(),(H=y.current)==null||H.click()},type:"button",children:M.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",g]})]})]})}),If=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},ir=h.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:i,counterMaxLength:n,className:r,disabled:a,errorMessage:l,hasError:d,helptext:p,helptextDropdown:m,helptextDropdownButton:b,inline:y,fullwidth:k=!1,label:g,name:$,optionalTag:T=!1,optionalText:M,requiredTag:S=!1,requiredText:O,tagText:N=null,placeholder:V,rows:X,useWrapper:te=!0,onChange:we,value:j,autoComplete:C="off",minLength:H,maxLength:W,readOnly:Q,skipForwardTestid:se=!1,...ie},pe)=>{const ne=[r,"pkt-textinput","pkt-textarea"].join(" "),ve=`${s}-input`,K=`${ve}-label`,G=t||K,[Pe,re]=h.useState(0),ae=tt=>{var Ve,Se;i&&re(((Se=(Ve=tt.currentTarget)==null?void 0:Ve.value)==null?void 0:Se.length)||0),we&&we(tt)};return h.useEffect(()=>{j!==void 0&&re((j==null?void 0:j.length)||0)},[j]),o.jsx(Ds,{ariaDescribedby:e,className:ne,disabled:a,errorMessage:l,forId:ve,hasError:d,helptext:p,helptextDropdown:m,helptextDropdownButton:b,inline:y,label:g,optionalTag:T,optionalText:M,requiredTag:S,requiredText:O,tagText:N,useWrapper:te,counter:i,counterCurrent:Pe,counterMaxLength:n,children:o.jsx("textarea",{ref:pe,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${n&&Pe>n?"pkt-input--counter-error":""}`,name:`${$||s}`,id:ve,placeholder:V,disabled:a,rows:X,"aria-labelledby":G,"aria-invalid":d,"aria-errormessage":`${s}-error`,...ie,onChange:ae,value:j,autoComplete:C,minLength:H,maxLength:W,readOnly:Q,"data-skip-forward-testid":se?"true":void 0})})});ir.displayName="PktTextarea";const Lf=Symbol("comment"),Bf=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),i=s.getFullYear(),n=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${i} kl. ${n}:${r}`},Ff=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:i})=>{const n=h.useRef(null),r=!!i,a=()=>{var d,p;const l=(p=(d=n.current)==null?void 0:d.value)==null?void 0:p.trim();l&&t({text:l,timestamp:new Date}),e()};return h.useLayoutEffect(()=>{const l=setTimeout(()=>{var d;return(d=n.current)==null?void 0:d.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(ir,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:n,defaultValue:i==null?void 0:i.text}),o.jsx(at,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(at,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},Hf=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((i,n)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:i.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:Bf(i.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(n),"aria-label":"Slett kommentar",children:o.jsx(Y,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(n),"aria-label":"Rediger kommentar",children:o.jsx(Y,{name:"edit"})})]})]},n))}):null,Vf=s=>{const e=h.useContext(sr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},Uf=s=>{const e=s("comments"),t=(n,r)=>{e.set(n,[r])},i=(n,r)=>{const l=(e.get(n)||[]).filter((d,p)=>p!==r);e.set(n,l.length>0?l:void 0)};return{title:n=>{const r=e.get(n.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(n,r)=>{const a=e.get(n.fileId),l=a==null?void 0:a[0];return o.jsx(Ff,{fileItem:n,closeOperationUi:r,onAddComment:d=>t(n.fileId,d),existingComment:l})},renderContent:(n,r,a)=>{if(a)return null;const l=e.get(n.fileId);return o.jsx(Hf,{comments:l,onDeleteComment:d=>i(n.fileId,d),onEditComment:r?()=>r():void 0})},renderHidden:n=>o.jsx(Vf,{comments:e.get(n.fileId)},`comments${n.fileId}`),symbol:Lf}},jf=Symbol("deleteFile"),qf=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:jf}),Wf=Symbol("renameFile"),zf=s=>{const e=h.useRef(null),t=h.useId(),i=()=>{var n;s.onSave(((n=e.current)==null?void 0:n.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),n.stopPropagation(),i()),n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),s.onCancel())}}),o.jsx(at,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(at,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},Yf=s=>{const e=h.useContext(sr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},Kf=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,i)=>o.jsx(zf,{value:e.get(t.fileId)||void 0,onSave:n=>{e.set(t.fileId,n),i()},onCancel:i}),renderHidden:t=>o.jsx(Yf,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:Wf}},Gf=(s,e)=>{const t=h.useCallback((r,a,l)=>{const d=s.find(m=>m.fileId===r),p=d.attributes||{};d.attributes={...p,[a]:l},e(r,{attributes:d.attributes})},[e,s]),i=h.useCallback((r,a)=>(s.find(p=>p.fileId===r).attributes||{})[a],[s]);return{fileAttributes:h.useCallback(r=>({get:a=>i(a,r),set:(a,l)=>{t(a,r,l)}}),[i,t])}},Xf=s=>{const[e,t]=h.useState(!1),[i,n]=h.useState(0),r=h.useRef(null),a=h.useCallback(p=>{var b;const m=s.findIndex(y=>y.fileId===p);m>=0&&(n(m),t(!0),(b=r.current)==null||b.showModal())},[s]),l=h.useCallback(()=>{var p;t(!1),(p=r.current)==null||p.close()},[]),d=h.useCallback(p=>{s.length!==0&&n(m=>p==="prev"?m<=0?s.length-1:m-1:m>=s.length-1?0:m+1)},[s.length]);return{isOpen:e,currentIndex:i,modalRef:r,open:a,close:l,navigate:d}},Qf=s=>{const[e,t]=h.useState({}),i=h.useCallback(a=>{const l=e[a];if(l)return s.find(d=>d.symbol===l)},[e,s]),n=h.useCallback((a,l)=>{t(d=>({...d,[a]:l.symbol}))},[]),r=h.useCallback(a=>{t(l=>{const d={...l};return delete d[a],d})},[]);return{getActivated:i,activate:n,close:r}},Zf=It({tagName:"pkt-modal",elementClass:xt,react:h,displayName:"PktModal",events:{}}),nr=h.forwardRef(({children:s,...e},t)=>o.jsx(Zf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));nr.displayName="PktModal";const go=2,Jf=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const i=parseFloat(e.fontSize);return(!Number.isNaN(i)&&i>0?i:16)*1.2},Rf=(s,e,t)=>{const i=e*t;return s.getBoundingClientRect().height>i+.5},vo=h.createContext({tail:5}),Ii=({children:s,tail:e,...t})=>{const i=s,n=h.useContext(vo),r=e!==void 0?e:n.tail||0,a=s.length<=r+3?null:s.slice(-r),l=h.useRef(null),d=h.useRef(null),[p,m]=h.useState(!1),b=h.useCallback(()=>{const k=l.current,g=d.current;if(!k||!g)return;const $=Jf(k);m(Rf(g,$,go))},[]),y=h.useMemo(()=>new ResizeObserver(k=>{k.some(g=>g.target===l.current)&&b()}),[b]);return h.useLayoutEffect(()=>(l.current&&y.observe(l.current),b(),()=>y.disconnect()),[s,y,b]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:go,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:i}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:p?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:d,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},em=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},hn=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,rr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),tm=()=>{const[s,e]=h.useState(1);return h.useEffect(()=>{const t=setInterval(()=>{e(i=>i>=3?1:i+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},sm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(Y,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(Ii,{children:e.attributes.targetFilename})}),o.jsx(rr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(gn,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:hn(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(tm,{})]})},im=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(Y,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(Ii,{children:s.attributes.targetFilename})}),o.jsx(rr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(gn,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:hn(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},nm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(Y,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(Ii,{children:s.attributes.targetFilename})}),o.jsx(rr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),rm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(im,{transferItem:s,onRemove:e}):o.jsx(nm,{transferItem:s,onRemove:e}),am=({operation:s,onActivate:e,transferItem:t})=>{const i=typeof s.title=="function"?s.title(t):s.title;if(!i)return null;const n=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:n,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:i})},bo=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(Y,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(Ii,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:hn(s.file.size)})]}),om=({transferItem:s,onPreviewClick:e})=>{const[t,i]=h.useState(null),[n,r]=h.useState(!1),a=s.file;h.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const m=URL.createObjectURL(a);return i(m),()=>{URL.revokeObjectURL(m)}}i(null)},[a]);const l=t&&!n&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(Y,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),d=!!e,p=!!t&&!n;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${p?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(at,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[d&&o.jsx(Y,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(Ii,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},yo=h.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:i,onNavigate:n},r)=>{const[a,l]=h.useState(null),[d,p]=h.useState(!1),m=e[t],b=e.length>1;return h.useEffect(()=>{if(p(!1),m&&m.file.type.startsWith("image/")){const y=URL.createObjectURL(m.file);return l(y),()=>URL.revokeObjectURL(y)}l(null)},[m]),h.useEffect(()=>{if(!s)return;const y=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),n("prev");break;case"ArrowRight":k.preventDefault(),n("next");break;case"Escape":k.preventDefault(),i();break}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[s,n,i]),m?o.jsx(nr,{ref:r,headingText:m.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[b&&o.jsx(at,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>n("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!d?o.jsx("img",{src:a,alt:`${m.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>p(!0)}):o.jsx(Y,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),b&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),b&&o.jsx(at,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>n("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});yo.displayName="ImagePreviewModal";const lm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},ar=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",cm=({operations:s,activatedOperation:e,onActivate:t,transferItem:i})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(n=>!e||n.symbol!==e.symbol).map(n=>o.jsx(am,{operation:n,onActivate:t,transferItem:i},n.symbol.toString()))}),dm=({operations:s,activatedOperation:e,onActivate:t,transferItem:i})=>o.jsx(o.Fragment,{children:s.filter(n=>n.renderContent).map(n=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:n.renderContent(i,()=>t(i.fileId,n),(e==null?void 0:e.symbol)===n.symbol)},n.symbol.toString()))}),um=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,onActivate:n,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),p=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(Y,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(i,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),p.length>0&&o.jsx(cm,{operations:p,activatedOperation:e,onActivate:n,transferItem:s}),o.jsx(dm,{operations:t,activatedOperation:e,onActivate:n,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},hm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,enableImagePreview:n,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:d})=>{const p=ar(s.progress),m=n&&s.progress==="done"&&lm(s);switch(p){case"in-progress":return o.jsx(sm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(rm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(um,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,onActivate:r,onClose:a,onPreviewClick:m?()=>d(s.fileId):void 0})}},pm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},fm=(s,e,t)=>h.useMemo(()=>{const i=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),n={"in-progress":0,error:1,idle:2};return i.sort((r,a)=>n[ar(r.progress)]-n[ar(a.progress)])},[s,e,t]),mm=(s,e)=>h.useMemo(()=>e?s.filter(t=>t.progress==="done"&&pm(t)):[],[s,e]),gm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:i=[],ItemRenderer:n=bo,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const d=fm(s,t,l),p=mm(d,a),m=Qf(i),b=Xf(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(vo.Provider,{value:{tail:r},children:d.map(y=>o.jsxs("li",{className:oe("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof y.progress=="number",[`pkt-fileupload__queue-display__item--${y.progress}`]:typeof y.progress=="string"}),children:[i.filter(k=>k.renderHidden).map(k=>k.renderHidden(y)),o.jsx(hm,{transferItem:y,activatedOperation:m.getActivated(y.fileId),operations:i,ItemRenderer:n,enableImagePreview:a,onActivate:m.activate,onClose:m.close,onCancelTransfer:e,onOpenPreview:b.open})]},y.fileId))})}),a&&p.length>0&&o.jsx(yo,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},or={filename:bo,thumbnail:om},ko=h.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:i=!1,uploadStrategy:n="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:d,onFileUploadRequested:p,extraOperations:m=[],itemRenderer:b=or.filename,fullWidth:y=!1,allowedFormats:k,formatErrorMessage:g,maxFileSize:$,sizeErrorMessage:T,onFileValidation:M,errorMessage:S,hasError:O=!1,disabled:N=!1,label:V,helptext:X,optionalTag:te,requiredTag:we,enableImagePreview:j=!1,...C},H)=>{const W="transfers"in C?C.transfers:void 0,[Q,se]=h.useState(null),ie=O||!!Q,pe=S||Q,ne=$?em($):void 0,ve=h.useCallback(q=>{var ce;if(k&&k.length>0){const be=((ce=q.name.split(".").pop())==null?void 0:ce.toLowerCase())||"",ye=q.type.toLowerCase();if(!k.some(Ze=>{const f=Ze.toLowerCase().replace(/^\./,"");if(f.includes("/")){if(f.endsWith("/*")){const u=f.replace("/*","");return ye.startsWith(u+"/")}return ye===f}return be===f})){const Ze=k.join(", "),f=`Ugyldig filtype. Tillatte formater: ${Ze}`;return(g==null?void 0:g.replace("{formats}",Ze))||f}}if(ne&&q.size>ne){const be=hn(ne),ye=`Filen er for stor. Maks størrelse er ${be}.`;return(T==null?void 0:T.replace("{maxSize}",be))||ye}return M?M(q):null},[k,g,ne,T,M]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&d===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const G=s!==void 0?s:e||[],Pe=typeof b=="string"?or[b]:b,re=b==="thumbnail",ae=typeof C.accept=="string"?C.accept.trim():void 0,tt=h.useMemo(()=>{if(!(!k||k.length===0))return k.map(q=>q.trim()).filter(Boolean).map(q=>{const ce=q.toLowerCase();return ce.includes("/")||ce.startsWith(".")?ce:`.${ce}`}).join(", ")},[k]),Ve=ae||tt,Se=a&&!re,Ge=r&&!re,lt=h.useCallback(q=>{for(const be of q){const ye=ve(be.file);if(ye){se(ye);return}}se(null);const ce=i?[...G,...q]:[q[0]];d&&d(ce),n==="custom"&&p&&q.forEach(be=>{p==null||p(be)})},[d,G,i,n,p,ve]),xe=h.useCallback((q,ce)=>{const be=G.map(ye=>ye.fileId===q?{...ye,...ce}:ye);d&&d(be)},[d,G]),Ne=h.useCallback(q=>{var be;const ce=G.filter(ye=>ye.fileId!==q);d&&d(ce),"onTransferCancelled"in C&&C.onTransferCancelled&&((be=C.onTransferCancelled)==null||be.call(C,q))},[d,G,C]),{fileAttributes:Xe}=Gf(G,xe),Ue=h.useMemo(()=>[{op:Kf,enabled:Se},{op:q=>Uf(q),enabled:Ge}].filter(({enabled:q})=>q).map(({op:q})=>q).concat(...m),[Se,Ge]),Qe=h.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ue,uploadedCount:Me,failedCount:Ae}=h.useMemo(()=>{const q=G.length;if(!W)return{totalCount:q,uploadedCount:0,failedCount:0};let ce=0,be=0;for(const ye of G){const je=W.find(Ze=>Ze.fileId===ye.fileId);(je==null?void 0:je.progress)==="done"&&ce++,(je==null?void 0:je.progress)==="error"&&be++}return{totalCount:q,uploadedCount:ce,failedCount:be}},[G,W]),st=ue===1?"fil":"filer",le=o.jsx("div",{className:oe("pkt-fileupload",{"pkt-fileupload--full-width":y,"pkt-fileupload--error":ie,"pkt-fileupload--disabled":N}),"aria-disabled":N,...N?{inert:""}:{},children:o.jsxs(sr.Provider,{value:{name:C.name||"",multiple:!!i,id:t},children:[o.jsx("div",{id:Qe.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ue>0&&Me>0&&`${Me} av ${ue} ${st} lastet opp`}),o.jsx("div",{id:Qe.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ue>0&&Ae>0&&`Feil ved opplasting: ${Ae} av ${ue} ${st} feilet`}),o.jsx(Af,{id:t,name:C.name||"",value:G,onFilesAdded:lt,multiple:i,uploadStrategy:n,ref:H,accept:re?".jpeg, .jpg, .png, .gif, .webp, .heic":Ve,isThumbnailView:re,disabled:N,srAnnouncementIds:Qe}),ie&&pe&&o.jsx(an,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:pe}),o.jsx(gm,{files:G,cancelTransfer:Ne,truncateTail:l,transfers:W,uploadStrategy:n,ItemRenderer:Pe,enableImagePreview:re&&j,queueItemOperations:Ue.map(q=>q(Xe)).concat(qf(Ne))})]})});return V?o.jsx(Ds,{forId:t,label:V,helptext:X,disabled:N,hasError:ie,optionalTag:te,requiredTag:we,className:oe("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":y}),children:le}):le});ko.displayName="PktFileUpload";const vm=({columnOne:s,columnTwo:e,socialLinks:t,className:i,openLinksInNewTab:n=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:d=null,googleAnalyticsId:p=null,devMode:m=!1,cookieDomain:b=null,cookieSecure:y=null,cookieExpiryDays:k=null,onToggleConsent:g=$=>{console.log($.detail)}})=>{var T,M;const $=[i,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(T=s.links)==null?void 0:T.map((S,O)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${S.external?"pkt-link--external":""}`,href:S.href,target:S.openInNewTab||n?"_blank":"_self",rel:S.openInNewTab||n?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer__link-icon",name:"chevron-right"}),S.text]})},`links-${O}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(M=e.links)==null?void 0:M.map((S,O)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${S.external?"pkt-link--external":""}`,href:S.href,target:S.openInNewTab||n?"_blank":"_self",rel:S.openInNewTab||n?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer__link-icon",name:"chevron-right"}),S.text]})},`links-${O}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:n?"_blank":"_self",rel:n?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:n?"_blank":"_self",rel:n?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(cn,{triggerType:"footerlink",hotjarId:d,googleAnalyticsId:p,devMode:m,cookieDomain:b,cookieSecure:y,cookieExpiryDays:k,onToggleConsent:g})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(S=>S.language).map((S,O)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:S.href,"aria-label":`til ${S.language} versjon av nettsiden`,target:S.openInNewTab||n?"_blank":"_self",rel:S.openInNewTab||n?"noopener noreferrer":void 0,children:S.language})},`sociallinks-language-${O}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(S=>S.iconName).map((S,O)=>o.jsx(h.Fragment,{children:o.jsx("a",{href:S.href,"aria-label":`til ${S.iconName}`,className:"pkt-footer__social-icon-link",target:S.openInNewTab||n?"_blank":"_self",rel:S.openInNewTab||n?"noopener noreferrer":void 0,children:o.jsx(Y,{className:"pkt-footer__social-icon",name:S.iconName})})},`sociallinks-${O}`))})]})]})})},bm=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:i="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:n=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:d=null,cookieSecure:p=null,cookieExpiryDays:m=null,onToggleConsent:b=k=>{console.log(k.detail)},className:y})=>{const k=[y,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((g,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${g.external?" pkt-link--external":""}`,href:g.href,target:g.openInNewTab||e?"_blank":"_self",rel:g.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),g.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:i,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(Y,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),n&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(cn,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:d,cookieSecure:p,cookieExpiryDays:m,onToggleConsent:b})})]})})})},ym=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[i,n]=h.useState(t);return h.useEffect(()=>{const r=s.current;if(!r)return;if(n(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&n(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const d of l)d.borderBoxSize&&d.borderBoxSize.length>0?n(d.borderBoxSize[0].inlineSize):n(d.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),i};function km(s){const e=h.useRef(0);h.useEffect(()=>{const t=document.body,i=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const n=window.innerWidth-i.clientWidth;n>0&&(t.style.paddingRight=`${n}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",i.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const pn=({href:s,iconName:e,className:t,iconPosition:i,external:n,target:r,children:a,...l})=>{const d={"pkt-link":!0,"pkt-link--icon-left":!!e&&i==="left"||!!(e&&!i),"pkt-link--icon-right":!!e&&i==="right","pkt-link--external":n};return o.jsxs("a",{...l,className:oe(d,t),href:s,target:r,rel:n?"noopener noreferrer":void 0,children:[e&&o.jsx(Y,{name:e,className:"pkt-link__icon"}),a]})};pn.displayName="PktLink";const _m=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},fn=({item:s,className:e})=>"href"in s?o.jsx(pn,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:oe("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:oe("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(Y,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),$m=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(fn,{item:e})},t))}),_o=h.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:i,canChangeRepresentation:n,changeRepresentation:r,logoutOnClick:a},l)=>{const d=i==null?void 0:i.map(_m);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),d&&d.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx($m,{links:d})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),n&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(fn,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&n&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(fn,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(fn,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});_o.displayName="PktHeaderUserMenu";const mn=h.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:i="off",counter:n,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:d,hasError:p=!1,helptext:m,helptextDropdown:b,helptextDropdownButton:y,iconNameRight:k,inline:g=!1,fullwidth:$=!1,label:T,name:M,optionalTag:S=!1,optionalText:O,requiredTag:N=!1,requiredText:V,tagText:X=null,placeholder:te,prefix:we,suffix:j,type:C="text",useWrapper:H=!0,omitSearchIcon:W=!1,value:Q,minLength:se,maxLength:ie,min:pe,max:ne,step:ve,size:K,readonly:G,required:Pe,dataTestid:re,onChange:ae,skipForwardTestid:tt=!1,...Ve},Se)=>{const Ge=[a,"pkt-textinput"].join(" "),lt=C==="search"&&!k&&!W,xe=C==="date"&&Q?Q.slice(0,10):Q,[Ne,Xe]=h.useState((Q==null?void 0:Q.length)||0),Ue=`${s}`,Qe=`${Ue}-label`,ue=t||Qe,Me=Ae=>{var st,le;n&&Xe(((le=(st=Ae.currentTarget)==null?void 0:st.value)==null?void 0:le.length)||0),ae&&ae(Ae)};return h.useEffect(()=>{Q!==void 0&&Xe((Q==null?void 0:Q.length)||0)},[Q]),o.jsx(Ds,{ariaDescribedby:e,className:Ge,disabled:l,errorMessage:d,forId:Ue,hasError:p,helptext:m,helptextDropdown:b,helptextDropdownButton:y,inline:g,label:T,optionalTag:S,optionalText:O,requiredTag:N,requiredText:V,tagText:X,useWrapper:H,counter:n,counterCurrent:Ne,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":re,"data-skip-forward-testid":tt?"true":void 0,children:[we&&o.jsx("div",{className:"pkt-input-prefix",children:we}),o.jsx("input",{...Ve,ref:Se,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Ne>r?"pkt-input--counter-error":""}`,type:C,name:`${M||s}`,value:xe,id:Ue,placeholder:te,autoComplete:i,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ue,min:pe,max:ne,onChange:Me,step:ve,minLength:se,maxLength:ie,size:K,readOnly:G,required:Pe}),j&&o.jsxs("p",{className:"pkt-input-suffix",children:[j,k&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:k}),lt&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!j&&k&&o.jsx(Y,{className:"pkt-input-icon",name:k}),!j&<&&o.jsx(Y,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});mn.displayName="PktTextinput";const lr=h.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:i,compact:n=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:d,showSearch:p=!1,onSearch:m,onSearchChange:b,searchValue:y,searchPlaceholder:k="Søk",representing:g,serviceLink:$,serviceClick:T,serviceName:M,user:S,userMenu:O,userMenuFooter:N,userOptions:V,canChangeRepresentation:X=!1,changeRepresentation:te,hideLogo:we=!1,logoLink:j,logoClick:C,position:H="fixed",scrollBehavior:W="hide",slotMenuVariant:Q="icon-only",slotMenuText:se="Meny"},ie)=>{const pe=H==="fixed",ne=W==="hide";h.useEffect(()=>{N&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[N]),h.useEffect(()=>{V&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[V]),h.useEffect(()=>{S!=null&&S.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),g!=null&&g.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[S==null?void 0:S.shortname,g==null?void 0:g.shortname]);const ve=h.useMemo(()=>{if(S!=null&&S.lastLoggedIn)return typeof S.lastLoggedIn=="string"?S.lastLoggedIn:new Date(S.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[S==null?void 0:S.lastLoggedIn]),[K,G]=h.useState(d||"none");h.useEffect(()=>{d!==void 0&&G(d)},[d]);const[Pe,re]=h.useState(!1),[ae,tt]=h.useState(0),[Ve,Se]=h.useState(!1),[Ge,lt]=h.useState(!1),xe=h.useRef(null),Ne=h.useRef(null),Xe=h.useRef(null),Ue=h.useRef(null),Qe=h.useRef(null),ue=h.useRef(null),Me=h.useRef(null),Ae=h.useRef(!1),st=ym(xe),le=st<s,q=st<e,ce=h.useCallback(u=>{xe.current=u,typeof ie=="function"?ie(u):ie&&(ie.current=u)},[ie]);km(pe&&le&&K!=="none");const be=h.useCallback((u,_)=>{const x=u.relatedTarget;let L;switch(_){case"user":L=Ne;break;case"slot":L=Xe;break;case"search":L=Ue;break;default:return}const U=L.current;U&&(!x||!U.contains(x))&&G("none")},[]),ye=h.useCallback(()=>{Ae.current&&Me.current&&document.contains(Me.current)&&Me.current.focus(),Me.current=null,Ae.current=!1},[]);h.useEffect(()=>{const u=x=>{S&&K==="user"&&!x.target.closest(".pkt-header-service__user-container")&&G("none"),K==="slot"&&!x.target.closest(".pkt-header-service__slot-container")&&G("none"),K==="search"&&!x.target.closest(".pkt-header-service__search-container")&&!x.target.closest(".pkt-header-service__search-input")&&G("none")},_=x=>{x.key==="Escape"&&K!=="none"&&(x.preventDefault(),Ae.current=!0,G("none"))};if(K!=="none")return document.addEventListener("mousedown",u),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",_)};ye()},[K,S,ye]),h.useEffect(()=>{const u=()=>{if(ne){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-ae)<60)return;re(_>ae),tt(_)}};return document&&window.addEventListener("scroll",u),()=>{document&&window.removeEventListener("scroll",u)}},[ne,ae]);const je=h.useCallback(u=>{const _=u==="slot"?Xe:Ue,x=u==="slot"?Qe:ue;if(!_.current||!x.current||!q||le)return;const L=_.current.getBoundingClientRect(),U=x.current.offsetWidth,R=L.left+U>window.innerWidth;u==="slot"?Se(R):lt(R)},[q,le]),Ze=h.useCallback(u=>{K!=="none"?G("none"):(Me.current=document.activeElement,G(u))},[K]);h.useEffect(()=>{(K==="slot"||K==="search")&&requestAnimationFrame(()=>{je(K)})},[K,je]);const f=o.jsxs("header",{className:oe("pkt-header-service",n&&"pkt-header-service--compact",le&&"pkt-header-service--mobile",q&&"pkt-header-service--tablet",pe&&"pkt-header-service--fixed",ne&&"pkt-header-service--scroll-to-hide",Pe&&"pkt-header-service--hidden",i),"data-mode":r,ref:ce,children:[o.jsxs("div",{className:oe("pkt-header-service__logo-area",(!M||M==="")&&"pkt-header-service__logo-area--without-service"),children:[!we&&o.jsx("span",{className:"pkt-header-service__logo",children:j?o.jsx("a",{href:j,"aria-label":"Tilbake til forside",children:o.jsx(Y,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/15.4/logos/"})}):C?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:C,children:o.jsx(Y,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/15.4/logos/"})}):o.jsx(Y,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/15.4/logos/"})}),M&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(pn,{href:$,className:"pkt-header-service__service-link ",children:M}):T?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:T,children:M}):o.jsx("span",{className:"pkt-header-service__service-link",children:M})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:oe("pkt-header-service__slot-container",K==="slot"&&"is-open"),onBlur:u=>be(u,"slot"),ref:Xe,children:[q&&t&&o.jsx(at,{skin:"secondary",variant:Q,iconName:"menu",size:le?"small":"medium",state:K==="slot"?"active":"normal",onClick:()=>Ze("slot"),"aria-expanded":K==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:se}),o.jsx("div",{className:oe("pkt-header-service__slot-content",Ve&&"align-right"),id:"mobile-slot-menu",role:q?"menu":void 0,"aria-label":q?"Meny":void 0,ref:Qe,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:q?o.jsxs("div",{className:oe("pkt-header-service__search-container",K==="search"&&"is-open"),onBlur:u=>be(u,"search"),ref:Ue,children:[o.jsx(at,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:le?"small":"medium",onClick:()=>Ze("search"),state:K==="search"?"active":"normal","aria-expanded":K==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:oe("pkt-header-service__mobile-menu",K==="search"&&"is-open",Ge&&"align-right"),ref:ue,children:K==="search"&&o.jsx(mn,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:y,autoFocus:!0,fullwidth:!0,onChange:u=>b==null?void 0:b(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(m==null||m(u.target.value))}})})]}):o.jsx(mn,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:y,onChange:u=>b==null?void 0:b(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(m==null||m(u.target.value))}})}),q&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"secondary",size:le?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[S&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:u=>be(u,"user"),ref:Ne,children:[o.jsxs(at,{className:oe("pkt-header-service__user-button",le&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:le?"small":"medium",state:K==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:K==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ze("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(g==null?void 0:g.name)||S.name]}),K==="user"&&S&&o.jsx("div",{className:oe(le?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(_o,{user:S,formattedLastLoggedIn:ve,representing:g,userMenu:O,canChangeRepresentation:X,changeRepresentation:te,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!le&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return pe?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[f,o.jsx("div",{className:oe("pkt-header-service-spacer",n&&"pkt-header-service-spacer--compact",S&&"pkt-header-service-spacer--has-user",le&&"pkt-header-service-spacer--mobile",q&&"pkt-header-service-spacer--tablet")})]}):f});lr.displayName="PktHeaderService";const $o=h.forwardRef((s,e)=>o.jsx(lr,{...s,ref:e}));$o.displayName="PktHeader";const wm=It({tagName:"pkt-heading",elementClass:ss,react:h,displayName:"PktHeading"}),wo=h.forwardRef(({children:s,...e},t)=>o.jsx(wm,{"data-testid":"pkt-heading",...e,ref:t,children:s}));wo.displayName="PktHeading";const xm=It({tagName:"pkt-helptext",elementClass:Yt,react:h,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),xo=h.forwardRef(({children:s,...e},t)=>o.jsx(xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));xo.displayName="PktHelptext";const So=h.forwardRef(({label:s,id:e,children:t,...i},n)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...i,ref:n}),t]}));So.displayName="PktInput";const Co=({children:s,skin:e,title:t,href:i,iconName:n,openInNewTab:r,external:a,className:l,...d})=>{const p=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),m=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...d,href:i,className:oe(p,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[n&&o.jsx(Y,{className:"pkt-link__icon",name:n}),t&&o.jsx("div",{className:oe(m),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Co.displayName="PktLinkCard";const Sm=It({tagName:"pkt-loader",elementClass:Pt,react:h,displayName:"PktLoader",events:{}}),To=h.forwardRef(({children:s,...e},t)=>o.jsx(Sm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));To.displayName="PktLoader";const No=({children:s,className:e,skin:t,title:i,compact:n,closable:r,onClose:a,...l})=>{const[d,p]=h.useState(!1),m={"pkt-messagebox":!0,"pkt-messagebox--compact":n,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":d},b=h.createRef(),y=h.useCallback(()=>{p(!0),a&&a()},[p,a]);return o.jsxs("div",{...l,className:oe(m,e),ref:b,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:y,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(Y,{name:"close",className:"pkt-link__icon"})})}),i&&o.jsx("div",{className:"pkt-messagebox__title",children:i}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};No.displayName="PktMessagebox";const Cm=It({tagName:"pkt-progressbar",elementClass:Be,react:h,displayName:"PktProgressbar",events:{}}),gn=h.forwardRef(({children:s,...e},t)=>o.jsx(Cm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));gn.displayName="PktProgressbar";const Mo=h.forwardRef(({id:s,name:e,label:t,className:i,hasTile:n=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:d,checked:p,optionalTag:m,optionalText:b,requiredTag:y,requiredText:k,tagText:g,...$},T)=>{const M=[i,"pkt-input-check"].filter(Boolean).join(" "),S=["pkt-input-check__input",n?"pkt-input-check__input--tile":"",r&&n?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),O=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),N=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),V=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),X=()=>o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:V+" pkt-tag--gray",children:g}),m&&o.jsx("span",{className:V+" pkt-tag--blue-light",children:b}),y&&o.jsx("span",{className:V+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:M,children:o.jsxs("div",{className:S,children:[o.jsx("input",{ref:T,id:s,type:"radio",name:e,disabled:r,className:O,...p!==void 0?{checked:p}:{defaultChecked:d},...$}),o.jsxs("label",{className:N,htmlFor:s,children:[t," ",X(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Mo.displayName="PktRadioButton";const Do=h.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:i,label:n,name:r,placeholder:a="Søk…",suggestions:l,value:d="",action:p,method:m,onChange:b,onSearch:y,onSuggestionClick:k,...g},$)=>{const T=(N,V)=>{N?N():k&&k(V)},M=N=>{d=N.target.value},S=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let O;return p?O=N=>o.jsx("form",{role:"search",className:S,action:p,method:m,children:N}):O=N=>o.jsx("div",{role:"search",className:S,children:N}),O(o.jsxs(o.Fragment,{children:[n&&o.jsx("label",{htmlFor:n?i:void 0,className:n?"pkt-inputwrapper__label":"",children:n}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||i,id:i,placeholder:a,defaultValue:d,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${i}-suggestions`,onChange:b||M,onKeyUp:y&&(N=>{N.key==="Enter"&&(N.preventDefault(),y(d))}),...g}),o.jsx(at,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:y&&(N=>{N.preventDefault(),y(d)}),children:n||a})]}),l&&o.jsx("ul",{id:`${i}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((N,V)=>o.jsx("li",{children:h.createElement(N.href?"a":N.onClick?"button":"div",{href:N.href,className:`pkt-searchinput__suggestion ${N.onClick?"pkt-link-button":""} ${N.href||N.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:N.onClick?"button":void 0,onClick:()=>T(N.onClick,V),onKeyUp:X=>X.key==="Enter"&&T(N.onClick,V)},o.jsxs(o.Fragment,{children:[N.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:N.title}),N.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:N.text})]}))},`search-suggestion-${V}`))})]}))});Do.displayName="PktSearchInput";const Oo=h.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:i,disabled:n=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:d,helptextDropdownButton:p,id:m,inline:b=!1,fullwidth:y=!1,label:k,name:g,optionalTag:$=!1,optionalText:T,requiredTag:M=!1,requiredText:S,tagText:O,...N},V)=>{const X=[i,"pkt-select"].join(" ");return o.jsx(Ds,{className:X,forId:`${m}-input`,label:k,helptext:l,helptextDropdown:d,helptextDropdownButton:p,optionalTag:$,optionalText:T,requiredTag:M,requiredText:S,tagText:O,hasError:a,errorMessage:r,disabled:n,inline:b,ariaDescribedby:s,children:o.jsx("select",{ref:V,className:`pkt-input ${y?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${m}-error`,"aria-labelledby":e||void 0,disabled:n,id:`${m}-input`,name:g||m,...N,children:t})})});Oo.displayName="PktSelect";const Tm=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),Nm=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),Mm=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),Dm=({children:s,className:e,status:t="incomplete",title:i})=>o.jsxs("li",{className:oe("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:oe("pkt-step__indicator"),children:t==="current"?Nm:t==="completed"?Mm:Tm}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:i}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),Eo=h.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:i=!1,hideNonActiveStepsContent:n=!0,orientation:r="vertical",...a},l)=>{const d=oe(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),p=h.Children.map(t,(m,b)=>h.isValidElement(m)?h.cloneElement(m,{className:oe(m.props.className,{"pkt-step--hideStep":i&&b!==s,"pkt-step--hideContent":n&&b!==s})}):m);return o.jsx("ol",{"data-testid":"pkt-stepper",className:d,ref:l,...a,children:p})});Eo.displayName="PktStepper";const Om=({className:s,compact:e=!1,skin:t="basic",responsiveView:i=!0,children:n,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:oe(s,"pkt-table",{"pkt-table--responsive":i,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:n}),Em=({id:s,children:e,className:t,...i})=>o.jsx("tbody",{id:s,className:oe(t,"pkt-table__body",{}),...i,role:"rowgroup",children:e}),Pm=({children:s,className:e,dataLabel:t,...i})=>o.jsx("td",{className:oe(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...i,children:s}),Am=({className:s,children:e,...t})=>o.jsx("thead",{className:oe(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),Im=({className:s,children:e,...t})=>o.jsx("th",{className:oe(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),Lm=({className:s,children:e,...t})=>o.jsx("tr",{className:oe(s,"pkt-table__row",{}),role:"row",...t,children:e}),cr=h.forwardRef(({children:s,active:e,href:t,onClick:i,icon:n,controls:r,tag:a,tagSkin:l,index:d=0},p)=>{const{arrowNav:m,registerTabRef:b,handleKeyPress:y,selectTab:k}=Bm(),$={"aria-selected":m?!!e:void 0,"aria-controls":r,role:m?"tab":void 0,onKeyUp:M=>y(d,M),onClick:M=>{k(d),i==null||i(M)},tabIndex:e||!m?void 0:-1,ref:M=>{b(d,M),typeof p=="function"?p(M):p&&(p.current=M)}},T=o.jsxs(o.Fragment,{children:[n&&o.jsx(Y,{name:n,className:"pkt-icon--small"}),s,a&&o.jsx(un,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:T}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:T})});cr.displayName="PktTabItem";const Po=h.createContext(null),Bm=()=>{const s=h.useContext(Po);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Ao=h.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:i,children:n},r)=>{const a=h.useRef([]),l=s&&!e,p=n&&h.Children.count(n)>0?h.Children.count(n):(t==null?void 0:t.length)||0;h.useEffect(()=>{a.current=a.current.slice(0,p)},[p]);const m=g=>{const $=t==null?void 0:t[g];$!=null&&$.action&&$.action(g),i&&i(g)},b=(g,$)=>{var T,M;l&&($.code==="ArrowLeft"&&g!==0&&((T=a.current[g-1])==null||T.focus()),$.code==="ArrowRight"&&g<p-1&&((M=a.current[g+1])==null||M.focus()),($.code==="ArrowDown"||$.code==="Space")&&m(g))},y=(g,$)=>{a.current[g]=$},k=t==null?void 0:t.map((g,$)=>{var T,M;return o.jsx(cr,{active:g.active,href:g.href,onClick:()=>m($),icon:g.icon,controls:g.controls,tag:(T=g.tag)==null?void 0:T.text,tagSkin:(M=g.tag)==null?void 0:M.skin,index:$,children:g.text},$)});return o.jsx(Po.Provider,{value:{arrowNav:l,registerTabRef:y,handleKeyPress:b,selectTab:m},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:n||k})})})});Ao.displayName="PktTabs";var Rs=window.CustomEvent;(!Rs||typeof Rs=="object")&&(Rs=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},Rs.prototype=window.Event.prototype);function Io(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function Fm(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(i,n){return!(e[i]===void 0||e[i]===n)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function Li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Lo(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function Hm(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function dr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Bo(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=s.querySelector(t.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var n=s.querySelectorAll("*"),r=0;r<n.length&&!(n[r].tagName&&n[r].shadowRoot&&(i=Bo(n[r].shadowRoot),i));r++);return i}function Fo(s){return s.isConnected||document.body.contains(s)}function Ho(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=de.formSubmitter;if(!t){var i=s.target,n="getRootNode"in i&&i.getRootNode()||document;t=n.activeElement}return!t||t.form!==e?null:t}function Vm(s){if(!s.defaultPrevented){var e=s.target,t=de.imagemapUseValue,i=Ho(s);t===null&&i&&(t=i.value);var n=Li(e);if(n){var r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?n.close(t):n.close())}}}function Vo(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",Vm,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,i=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),n,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(n),n=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Vo.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Fo(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),de.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Bo(this.dialog_)),Lo(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Fo(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!de.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Fm(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,de.needsCentering(this.dialog_)?(de.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new Rs("close",{bubbles:!1,cancelable:!1});Io(this.dialog_,e)}};var de={};if(de.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},de.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],i=null;try{i=t.cssRules}catch{}if(i)for(var n=0;n<i.length;++n){var r=i[n],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!Hm(a,s))){var l=r.style.getPropertyValue("top"),d=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||d&&d!=="auto")return!0}}}return!1},de.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!de.isInlinePositionSetByStylesheet(s)},de.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Vo(s)},de.registerDialog=function(s){s.showModal||de.forceRegisterDialog(s)},de.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(i){for(var n=0,r;r=i.removedNodes[n];++n){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},de.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},de.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},de.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var i=this.pendingDialogStack[0];if(i){var n=i.dialog.parentNode||document.body;n.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},de.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=Li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},de.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Lo(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],i=t.dialog,n=i.compareDocumentPosition(e);return n&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},de.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new Rs("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&Io(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},de.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},de.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},de.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},de.dm=new de.DialogManager,de.formSubmitter=null,de.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Uo=document.createElement("form");if(Uo.setAttribute("method","dialog"),Uo.method!=="dialog"){var ei=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(ei){var Um=ei.get;ei.get=function(){return dr(this)?"dialog":Um.call(this)};var jm=ei.set;ei.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):jm.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",ei)}}document.addEventListener("click",function(s){if(de.formSubmitter=null,de.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!dr(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;de.imagemapUseValue=s.offsetX+","+s.offsetY}var n=Li(e);n&&(de.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=Li(e);if(!t){var i=Ho(s),n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&s.preventDefault()}});var qm=HTMLFormElement.prototype.submit,Wm=function(){if(!dr(this))return qm.call(this);var s=Li(this);s&&s.close()};HTMLFormElement.prototype.submit=Wm}const zm=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"}));A.FileItem=mo,A.ItemRenderers=or,A.PktAccordion=pr,A.PktAccordionItem=Pa,A.PktAlert=an,A.PktBackLink=Ia,A.PktBreadcrumbs=La,A.PktButton=at,A.PktCalendar=tr,A.PktCard=oo,A.PktCheckbox=lo,A.PktCombobox=co,A.PktConsent=cn,A.PktDatepicker=po,A.PktFileUpload=ko,A.PktFooter=vm,A.PktFooterSimple=bm,A.PktHeader=$o,A.PktHeaderService=lr,A.PktHeading=wo,A.PktHelptext=xo,A.PktIcon=Y,A.PktInput=So,A.PktInputWrapper=Ds,A.PktLink=pn,A.PktLinkCard=Co,A.PktLoader=To,A.PktMessagebox=No,A.PktModal=nr,A.PktProgressbar=gn,A.PktRadioButton=Mo,A.PktSearchInput=Do,A.PktSelect=Oo,A.PktStep=Dm,A.PktStepper=Eo,A.PktTabItem=cr,A.PktTable=Om,A.PktTableBody=Em,A.PktTableDataCell=Pm,A.PktTableHeader=Am,A.PktTableHeaderCell=Im,A.PktTableRow=Lm,A.PktTabs=Ao,A.PktTag=un,A.PktTextarea=ir,A.PktTextinput=mn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
|
1704
|
+
*/var Do;function Hp(){return Do||(Do=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=i(r,n(l)))}return r}function n(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=i(a,l));return a}function i(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Or)),Or.exports}var jp=Hp();const ke=Up(jp),Bi=({children:s,closeAlert:e,compact:t,title:n,date:i,ariaLive:r,"aria-live":a="polite",role:l="status",skin:c="info",className:p,...g})=>{const[b,f]=d.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${c}`]:c,"pkt-hide":b},v={"pkt-alert__grid":!0,"pkt-alert__noTitle":!n,"pkt-alert__noDate":!i},$=d.useCallback(()=>{f(!0),g.onClose&&g.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[g.onClose,f]),M=r||a;return o.jsx("div",{...g,"aria-live":M,role:l,className:ke(k,p),children:o.jsxs("div",{className:ke(v),children:[o.jsx(R,{className:"pkt-alert__icon","aria-hidden":"true",name:c==="info"?"alert-information":`alert-${c}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(gt,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),n&&o.jsx("div",{className:"pkt-alert__title",children:n}),o.jsx("div",{className:"pkt-alert__text",children:s}),i&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",i]})]})})};Bi.displayName="PktAlert";const Oo=os({tagName:"pkt-backlink",elementClass:on,react:d,displayName:"PktBackLink"});Oo.displayName="PktBackLink";const Eo=d.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:n,...i},r)=>{const a=s,l=a[a.length-2],c=[n,"pkt-breadcrumbs"].filter(Boolean).join(" "),p=t||(e==="router"?({href:g,className:b,children:f,props:k})=>o.jsx(Yl.Link,{to:g,className:b,...k,children:f}):({href:g,className:b,children:f,props:k})=>o.jsx("a",{href:g,className:b,...k,children:f}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((g,b)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:b===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})}):p({href:g.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})]}),props:i})},`breadcrumb-${b}`))}),p({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:i})]})});Eo.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";const gt=d.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:n="user",iconPath:i,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:c=!1,skin:p="primary",type:g="button",variant:b="label-only",state:f,color:k,isLoading:v=void 0,disabled:$=void 0,loadingAnimationPath:M=window.pktAnimationPath,...S},T)=>{const L=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",c&&"pkt-btn--full-small",p&&`pkt-btn--${p}`,b&&`pkt-btn--${b}`,k&&`pkt-btn--${k}`,f&&`pkt-btn--${f}`,v&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...S,"aria-busy":v||void 0,"aria-disabled":$||void 0,disabled:$,className:L,type:g,ref:T,children:[v&&o.jsx(R,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:M}),b!=="label-only"&&o.jsx(R,{className:"pkt-btn__icon",name:t,...i&&{path:i}}),o.jsx("span",{className:"pkt-btn__text",children:s}),b==="icons-right-and-left"&&o.jsx(R,{className:"pkt-btn__icon",name:n,...r&&{path:r}})]})});gt.displayName="PktButton";const Po=6048e5,qp=864e5,Ao=Symbol.for("constructDateFrom");function ss(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ao in s?s[Ao](e):s instanceof Date?new s.constructor(e):new Date(e)}function Ct(s,e){return ss(e||s,s)}function Io(s,e,t){const n=Ct(s,t==null?void 0:t.in);return isNaN(e)?ss(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let Wp={};function Fi(){return Wp}function ei(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,i=Ct(s,e==null?void 0:e.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Vi(s,e){return ei(s,{...e,weekStartsOn:1})}function Lo(s,e){const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=ss(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Vi(i),a=ss(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Vi(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Bo(s){const e=Ct(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Fo(s,...e){const t=ss.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Er(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function zp(s,e,t){const[n,i]=Fo(t==null?void 0:t.in,s,e),r=Er(n),a=Er(i),l=+r-Bo(r),c=+a-Bo(a);return Math.round((l-c)/qp)}function Yp(s,e){const t=Lo(s,e),n=ss(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Vi(n)}function Kp(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Gp(s){return!(!Kp(s)&&typeof s!="number"||isNaN(+Ct(s)))}function Xp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Qp(s,e){const[t,n]=Fo(s,e.start,e.end);return{start:t,end:n}}function Vo(s,e){const{start:t,end:n}=Qp(e==null?void 0:e.in,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(ss(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function Zp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Jp={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Rp=(s,e,t)=>{let n;const i=Jp[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Pr(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ef={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},tf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},sf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nf={date:Pr({formats:ef,defaultWidth:"full"}),time:Pr({formats:tf,defaultWidth:"full"}),dateTime:Pr({formats:sf,defaultWidth:"full"})},rf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},af=(s,e,t,n)=>rf[s];function ti(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const of={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},cf={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},uf={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},df={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hf={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},pf={ordinalNumber:(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ti({values:of,defaultWidth:"wide"}),quarter:ti({values:lf,defaultWidth:"wide",argumentCallback:s=>s-1}),month:ti({values:cf,defaultWidth:"wide"}),day:ti({values:uf,defaultWidth:"wide"}),dayPeriod:ti({values:df,defaultWidth:"wide",formattingValues:hf,defaultFormattingWidth:"wide"})};function si(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?gf(l,b=>b.test(a)):ff(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(c):c,p=t.valueCallback?t.valueCallback(p):p;const g=e.slice(a.length);return{value:p,rest:g}}}function ff(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function gf(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function mf(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const bf=/^(\d+)(th|st|nd|rd)?/i,vf=/\d+/i,kf={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},yf={any:[/^b/i,/^(a|c)/i]},_f={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},wf={any:[/1/i,/2/i,/3/i,/4/i]},$f={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},xf={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Sf={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Cf={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Tf={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Nf={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mf={ordinalNumber:mf({matchPattern:bf,parsePattern:vf,valueCallback:s=>parseInt(s,10)}),era:si({matchPatterns:kf,defaultMatchWidth:"wide",parsePatterns:yf,defaultParseWidth:"any"}),quarter:si({matchPatterns:_f,defaultMatchWidth:"wide",parsePatterns:wf,defaultParseWidth:"any",valueCallback:s=>s+1}),month:si({matchPatterns:$f,defaultMatchWidth:"wide",parsePatterns:xf,defaultParseWidth:"any"}),day:si({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Cf,defaultParseWidth:"any"}),dayPeriod:si({matchPatterns:Tf,defaultMatchWidth:"any",parsePatterns:Nf,defaultParseWidth:"any"})},Df={code:"en-US",formatDistance:Rp,formatLong:nf,formatRelative:af,localize:pf,match:Mf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Of(s,e){const t=Ct(s,e==null?void 0:e.in);return zp(t,Zp(t))+1}function Ef(s,e){const t=Ct(s,e==null?void 0:e.in),n=+Vi(t)-+Yp(t);return Math.round(n/Po)+1}function Uo(s,e){var g,b,f,k;const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=Fi(),r=(e==null?void 0:e.firstWeekContainsDate)??((b=(g=e==null?void 0:e.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(f=i.locale)==null?void 0:f.options)==null?void 0:k.firstWeekContainsDate)??1,a=ss((e==null?void 0:e.in)||s,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=ei(a,e),c=ss((e==null?void 0:e.in)||s,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const p=ei(c,e);return+t>=+l?n+1:+t>=+p?n:n-1}function Pf(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,i=Uo(s,e),r=ss((e==null?void 0:e.in)||s,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),ei(r,e)}function Ho(s,e){const t=Ct(s,e==null?void 0:e.in),n=+ei(t,e)-+Pf(t,e);return Math.round(n/Po)+1}function Ce(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const Ss={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Ce(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Ce(t+1,2)},d(s,e){return Ce(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Ce(s.getHours()%12||12,e.length)},H(s,e){return Ce(s.getHours(),e.length)},m(s,e){return Ce(s.getMinutes(),e.length)},s(s,e){return Ce(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Ce(i,e.length)}},kn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jo={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Ss.y(s,e)},Y:function(s,e,t,n){const i=Uo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Ce(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Ce(r,e.length)},R:function(s,e){const t=Lo(s);return Ce(t,e.length)},u:function(s,e){const t=s.getFullYear();return Ce(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ce(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ce(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return Ss.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ce(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=Ho(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Ce(i,e.length)},I:function(s,e,t){const n=Ef(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Ce(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):Ss.d(s,e)},D:function(s,e,t){const n=Of(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Ce(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ce(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ce(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ce(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=kn.noon:n===0?i=kn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=kn.evening:n>=12?i=kn.afternoon:n>=4?i=kn.morning:i=kn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Ss.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):Ss.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):Ss.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):Ss.s(s,e)},S:function(s,e){return Ss.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Wo(n);case"XXXX":case"XX":return Ks(n);case"XXXXX":case"XXX":default:return Ks(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return Wo(n);case"xxxx":case"xx":return Ks(n);case"xxxxx":case"xxx":default:return Ks(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+qo(n,":");case"OOOO":default:return"GMT"+Ks(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+qo(n,":");case"zzzz":default:return"GMT"+Ks(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Ce(n,e.length)},T:function(s,e,t){return Ce(+s,e.length)}};function qo(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Ce(r,2)}function Wo(s,e){return s%60===0?(s>0?"-":"+")+Ce(Math.abs(s)/60,2):Ks(s,e)}function Ks(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Ce(Math.trunc(n/60),2),r=Ce(n%60,2);return t+i+e+r}const zo=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Yo=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Af={p:Yo,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return zo(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",zo(n,e)).replace("{{time}}",Yo(i,e))}},If=/^D+$/,Lf=/^Y+$/,Bf=["D","DD","YY","YYYY"];function Ff(s){return If.test(s)}function Vf(s){return Lf.test(s)}function Uf(s,e,t){const n=Hf(s,e,t);if(console.warn(n),Bf.includes(s))throw new RangeError(n)}function Hf(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wf=/^'([^]*?)'?$/,zf=/''/g,Yf=/[a-zA-Z]/;function Kf(s,e,t){var g,b,f,k;const n=Fi(),i=n.locale??Df,r=n.firstWeekContainsDate??((b=(g=n.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??1,a=n.weekStartsOn??((k=(f=n.locale)==null?void 0:f.options)==null?void 0:k.weekStartsOn)??0,l=Ct(s,t==null?void 0:t.in);if(!Gp(l))throw new RangeError("Invalid time value");let c=e.match(qf).map(v=>{const $=v[0];if($==="p"||$==="P"){const M=Af[$];return M(v,i.formatLong)}return v}).join("").match(jf).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:Gf(v)};if(jo[$])return{isToken:!0,value:v};if($.match(Yf))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const p={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Vf($)||Ff($))&&Uf($,e,String(s));const M=jo[$[0]];return M(l,$,i.localize,p)}).join("")}function Gf(s){const e=s.match(Wf);return e?e[1].replace(zf,"'"):s}function Xf(s,e){const t=Ct(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Qf(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Ar={},ni={};function Gs(s,e){try{const n=(Ar[s]||(Ar[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return n in ni?ni[n]:Ko(n,n.split(":"))}catch{if(s in ni)return ni[s];const t=s==null?void 0:s.match(Zf);return t?Ko(s,t.slice(1)):NaN}}const Zf=/([+-]\d\d):?(\d\d)?/;function Ko(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return ni[s]=t*60+n>0?t*60+n+i:t*60-n-i}class ns extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Xo(this),Ir(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new ns(...t,e):new ns(Date.now(),e)}withTimeZone(e){return new ns(+this,e)}getTimezoneOffset(){const e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ir(this),+this}[Symbol.for("constructDateFrom")](e){return new ns(+new Date(e),this.timeZone)}}const Go=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Go.test(s))return;const e=s.replace(Go,"$1UTC");ns.prototype[e]&&(s.startsWith("get")?ns.prototype[s]=function(){return this.internal[e]()}:(ns.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),Jf(this),+this},ns.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Ir(this),+this}))});function Ir(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Gs(s.timeZone,s)*60))}function Jf(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),Xo(s)}function Xo(s){const e=Gs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const p=new Date(+s);p.setUTCSeconds(0);const g=i>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(Gs(s.timeZone,s)*60))%60;(b||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+g));const f=Gs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),$=-new Date(+s).getTimezoneOffset()-k,M=k!==t,S=$-c;if(M&&S){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+S);const T=Gs(s.timeZone,s),L=T>0?Math.floor(T):Math.ceil(T),D=k-L;D&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+D))}}class Cs extends ns{static tz(e,...t){return t.length?new Cs(...t,e):new Cs(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${Qf(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new Cs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Cs(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Rf=(s=window.pktTz)=>{const e=new Cs(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function is(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const mt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ii=s=>{if(!s)return null;const e=is(s);return isNaN(e.getTime())?null:e},eg=(s,e)=>{const t=fs(s);return isNaN(t.getTime())?"":Kf(t,e)},fs=(s="",e)=>{const t=typeof s=="string"?is(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Xp(t):Er(t):t},yn=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},ri=s=>{let e;return typeof s=="number"?e=new Cs(s,window.pktTz):e=new Cs(s,window.pktTz),e.setHours(12,0,0,0),e};let Lr=null,Qo;const tg=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Lr||Qo!==e)&&(Lr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),Qo=e),Lr.format(s)},sg=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?fs(e):null,i=t?fs(t):null;return!(n&&s<n||i&&s>i)},ng=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=mt(s);return e.includes(t)},ig=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},Zo=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!sg(s,e,t)||n&&ng(s,n)||i&&ig(s,i)),rg=(s,e,t,n,i)=>s.filter(r=>{const a=ii(r);return a&&Zo(a,e,t,n,i)}),ag=s=>s.slice().sort((e,t)=>{const n=ii(e),i=ii(t);return!n||!i?0:n.getTime()-i.getTime()}),og=(s,e)=>{const t=ii(s),n=ii(e);return!t||!n?!1:t<=n};function Jo(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:mt(n));return!Zo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function lg(s,e,t,n){return!!(Jo(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function cg(s,e,t){const n=yn(s,e,0);return!(t&&fs(t)>n)}function ug(s,e,t){const n=yn(e===11?s+1:s,e===11?0:e+1,1);return!(t&&fs(t)<n)}function Ro(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>is(e))}function el(s,e){const t=Vo({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[mt(r)]=a}return n}function tl(s,e,t,n){if(e.length!==1)return!0;const i=Vo({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(Xf(i[r]).toString()))return!1}return!0}function Br(s,e){const t=mt(s);return e.includes(t)?e:[...e,t]}function Fr(s,e){const t=mt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function sl(s,e,t){const n=mt(s);return e.includes(n)?Fr(s,e):t>0&&e.length>=t?e:Br(s,e)}function dg(s,e,t){const n=mt(s),i=Ro(e);if(e.includes(n))return e.indexOf(n)===0?[]:Fr(s,e);if(e.length>1)return[n];if(e.length===1){if(!tl(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return Br(s,e)}const ai=7,hg=6;function pg(s,e){const t=yn(s,e,1),n=yn(s,e+1,0),i=(t.getDay()+hg)%ai,r=n.getDate(),a=Math.ceil((r+i)/ai),c=yn(s,e,0).getDate(),p=Ho(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:c,initialWeek:p}}function fg(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function gg(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}const mg={ArrowLeft:-1,ArrowRight:1,ArrowUp:-ai,ArrowDown:ai};function bg(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function vg(s,e,t){let n=Io(s,e);if(!n)return null;let i=t(`button[data-date="${mt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Io(n,e),i=t(`button[data-date="${mt(n)}"]`),!i)return null;return n}function kg(s){return mg[s]??null}const yg={month:"Måned",year:"År",days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"};function _g(s){const{selected:e,multiple:t=!1,maxMultiple:n=0,range:i=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:c=[],weeknumbers:p=!1,withcontrols:g=!1,currentmonth:b,today:f,strings:k,onDateSelected:v,onClose:$,id:M,className:S}=s,T=d.useId(),L=M??T,D=d.useMemo(()=>({...yg,...k}),[k]),Y=d.useMemo(()=>f?is(f):Rf(),[f]),ee=d.useMemo(()=>l?l.map(m=>typeof m=="string"?is(m):m):[],[l]),oe=e!==void 0,[ye,K]=d.useState([]),N=oe?e:ye,q=d.useMemo(()=>Ro(N),[N]),[B,G]=d.useState(0),[le,ae]=d.useState(0),[pe,ue]=d.useState({}),[be,se]=d.useState(null),[re,Ue]=d.useState(null),Q=d.useRef(null),P=d.useRef([]),Me=d.useRef(0),De=d.useRef(!1),ne=d.useRef(!1),He=d.useMemo(()=>({earliest:r,latest:a,excludedates:ee,excludeweekdays:c}),[r,a,ee,c]);d.useEffect(()=>{let m=null;if(b!=null&&(b instanceof Date?m=ri(b):typeof b=="string"&&(m=is(b))),!m||isNaN(m.getTime()))if(N.length>0&&N[0]!==""){const h=is(N[N.length-1]);m=isNaN(h.getTime())?ri(Y):h}else m=ri(Y);if((!m||isNaN(m.getTime()))&&(m=ri(Y)),a){const h=typeof a=="string"?is(a):a;!isNaN(h.getTime())&&m>h&&(m=h)}if(r){const h=typeof r=="string"?is(r):r;!isNaN(h.getTime())&&m<h&&(m=h)}G(m.getFullYear()),ae(m.getMonth()),ne.current=!0},[]),d.useEffect(()=>{if(ne.current&&!De.current&&N.length>0&&N[0]!==""){const m=is(N[N.length-1]);isNaN(m.getTime())||(G(m.getFullYear()),ae(m.getMonth()))}},[N]),d.useEffect(()=>{i&&q.length===2?ue(el(q[0],q[1])):(!i||q.length<2)&&ue({})},[i,q]);const Pe=d.useCallback(m=>{oe||K(m),v==null||v(m)},[oe,v]),$e=d.useCallback(()=>{$==null||$()},[$]),Te=d.useCallback((m,h)=>{G(typeof m=="string"?parseInt(m):m),ae(typeof h=="string"?parseInt(h):h),Me.current=0,Ue(null),P.current=[],De.current=!0},[]),Ae=d.useCallback(()=>{const m=le===0?11:le-1,h=le===0?B-1:B;Te(h,m)},[B,le,Te]),ze=d.useCallback(()=>{const m=le===11?0:le+1,h=le===11?B+1:B;Te(h,m)},[B,le,Te]),We=d.useCallback(m=>Jo(m,He),[He]),ve=d.useCallback((m,h)=>lg(m,h,He,{multiple:t,maxMultiple:n,selectedCount:N.length}),[He,t,n,N.length]),E=d.useCallback(()=>typeof N=="string"?N.split(","):N,[N]),Ie=d.useCallback(m=>{if(!i||q.length!==1||!tl(m,q,ee,c)||q[0]>=m){se(null);return}se(m),ue(el(q[0],m))},[i,q,ee,c]),Ye=d.useCallback(m=>{if(!m)return;let h;if(i)h=dg(m,E(),{excludedates:ee,excludeweekdays:c}),oe||K(h),h.length===2?(v==null||v(h),$e()):(h.length===1&&ue({}),v==null||v(h));else if(t)h=sl(m,E(),n),Pe(h);else{const _=mt(m);N.includes(_)?h=[]:h=[_],Pe(h),$e()}},[i,t,n,E,N,ee,c,oe,Pe,$e,v]),U=d.useCallback(m=>{const h=Br(m,E());oe||K(h),i&&h.length===2&&(v==null||v(h),$e())},[E,oe,i,v,$e]),V=d.useCallback(m=>{const h=Fr(m,E());oe||K(h)},[E,oe]),te=d.useCallback(m=>{const h=sl(m,E(),n);oe||K(h)},[E,n,oe]),me=d.useCallback(()=>{var C,j;const m=mt(ri(Y)),h=(C=Q.current)==null?void 0:C.querySelector(`button[data-date="${m}"]`);if(h instanceof HTMLButtonElement){Ue(m),h.focus();return}const _=P.current.find(W=>!W.isDisabled);if(_){const W=(j=Q.current)==null?void 0:j.querySelector(`button[data-date="${_.currentDateISO}"]`);W instanceof HTMLButtonElement&&(Ue(_.currentDateISO),W.focus())}},[]),fe=d.useCallback((m,h)=>{const _=m.target;if(bg(_))return;if(m.preventDefault(),!re){me();return}const C=fs(re),j=vg(C,h,Q.current.querySelector.bind(Q.current));if(j){const W=Q.current.querySelector(`button[data-date="${mt(j)}"]`);W instanceof HTMLButtonElement&&!W.dataset.disabled&&(Ue(mt(j)),W.focus())}},[re,me]),Xe=d.useCallback(m=>{if(m.key==="Escape"){m.preventDefault(),$e();return}const h=kg(m.key);h!==null&&fe(m.nativeEvent,h)},[$e,fe]),Ke=d.useCallback(m=>{Q.current&&!Q.current.contains(m.relatedTarget)&&!m.target.classList.contains("pkt-hide")&&$e()},[$e]);return{componentId:L,strings:D,todayDate:Y,year:B,month:le,activeSelected:N,_selected:q,inRange:pe,rangeHovered:be,focusedDate:re,range:i,multiple:t,weeknumbers:p,withcontrols:g,earliest:r,latest:a,excludedates:ee,excludeweekdays:c,className:S,dateConstraints:He,calendarRef:Q,selectableDatesRef:P,tabIndexSetRef:Me,prevMonth:Ae,nextMonth:ze,changeMonth:Te,handleDateSelect:Ye,addToSelected:U,removeFromSelected:V,toggleSelectedDate:te,handleRangeHover:Ie,isExcluded:We,isDayDisabled:ve,focusOnCurrentDate:me,handleKeydown:Xe,handleFocusOut:Ke,close:$e,setFocusedDate:Ue}}const wg=({componentId:s,strings:e,year:t,month:n,earliest:i,latest:r,withcontrols:a,prevMonth:l,nextMonth:c,changeMonth:p})=>{const g=f=>{const k=f==="prev",v=k?cg(t,n,i):ug(t,n,r),$=k?e.prevMonth:e.nextMonth,M=k?"chevron-thin-left":"chevron-thin-right",S=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",T=k?l:c;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>v&&T(),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),v&&T())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",S,!v&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":v?void 0:"disabled","aria-disabled":!v||void 0,tabIndex:v?0:-1,children:[o.jsx(R,{className:"pkt-btn__icon",name:M}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},b=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:n,onChange:f=>{f.stopPropagation(),p(t,parseInt(f.target.value))},children:e.months.map((f,k)=>o.jsx("option",{value:k,children:f},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:f=>{f.stopPropagation(),p(parseInt(f.target.value),n)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[n]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[g("prev"),b(),g("next")]})};function $g(s,e,t){const n=yn(t.year,t.month,s),i=mt(n),r=i===mt(e),a=t.activeSelected.includes(i),l=t.isDayDisabled(n,a);let c;return t.focusedDate?c=t.focusedDate===i&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,c="0"):c=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:tg(n),tabindex:c}}function xg(s,e){const{currentDateISO:t,isToday:n,isSelected:i}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered)})}function Sg(s,e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const Cg=({state:s})=>{const{strings:e,year:t,month:n,activeSelected:i,focusedDate:r,inRange:a,rangeHovered:l,range:c,multiple:p,weeknumbers:g,selectableDatesRef:b,tabIndexSetRef:f,handleDateSelect:k,handleRangeHover:v,isExcluded:$,isDayDisabled:M,setFocusedDate:S,todayDate:T}=s,L={year:t,month:n,activeSelected:i,focusedDate:r,tabIndexSetRef:f,isDayDisabled:M},D={range:c,activeSelected:i,rangeHovered:l,inRange:a,isExcluded:$},Y=()=>{const K=[];g&&K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let N=0;N<e.daysShort.length;N++)K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[N],children:e.daysShort[N]})},`day-${N}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:K})},ee=(K,N)=>{const q=$g(K,N,L),{currentDate:B,currentDateISO:G,isSelected:le,isDisabled:ae,ariaLabel:pe,tabindex:ue}=q;b.current.push({currentDateISO:G,isDisabled:ae,tabindex:ue});const be=xg(q,D),se=Sg(q,D);return o.jsx("td",{className:be,children:o.jsx("button",{type:"button","aria-pressed":le?"true":"false",disabled:ae,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${se}`,onMouseOver:()=>c&&!$(B)&&v(B),onFocus:()=>{c&&!$(B)&&v(B),S(G)},"aria-label":pe,tabIndex:parseInt(ue),"data-disabled":ae?"disabled":void 0,"data-date":G,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),k(B))},onClick:re=>{ae||(re.preventDefault(),k(B))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},G)},oe=(K,N)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},N),ye=()=>{const K=T,N=pg(t,n);b.current=[],f.current=0;let q=1,B=N.initialWeek;const G=[];for(let le=0;le<N.numRows;le++){const ae=[];g&&ae.push(o.jsx("td",{className:"pkt-cal-week",children:B},`week-${B}`)),B++;for(let pe=0;pe<ai;pe++){const ue=fg(le,pe,q,N);if(ue==="current-month")ae.push(ee(q,K)),q++;else{const be=gg(ue,pe,q,N);ae.push(oe(be,`${ue}-${le}-${pe}`)),ue==="next-month"&&q++}}G.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ae},`row-${le}`))}return G};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":c||p||void 0,children:[o.jsx("thead",{children:Y()}),o.jsx("tbody",{children:ye()})]})},Vr=d.forwardRef((s,e)=>{const t=_g(s);return d.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(wg,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(Cg,{state:t})]})});Vr.displayName="PktCalendar";const Tg=os({tagName:"pkt-card",elementClass:ot,react:d,displayName:"PktCard",events:{}}),nl=d.forwardRef(({children:s,...e},t)=>o.jsx(Tg,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));nl.displayName="PktCard";const il=d.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:n,checkHelptext:i,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:c=!1,labelPosition:p="right",defaultChecked:g,checked:b,indeterminate:f,optionalTag:k,optionalText:v="Valgfritt",requiredTag:$,requiredText:M="Må fylles ut",tagText:S,...T},L)=>{const D=d.useRef(null);d.useEffect(()=>{D.current&&f!==void 0&&(D.current.indeterminate=f)},[f]),d.useEffect(()=>{typeof L=="function"?L(D.current):L&&(L.current=D.current)},[L]);const Y=[a,"pkt-input-check"].filter(Boolean).join(" "),ee=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${p}`,c?"pkt-sr-only":""].filter(Boolean).join(" "),oe=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),ye=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),K=()=>o.jsxs(o.Fragment,{children:[S&&o.jsx("span",{className:ye+" pkt-tag--gray",children:S}),k&&o.jsx("span",{className:ye+" pkt-tag--blue-light",children:v}),$&&o.jsx("span",{className:ye+" pkt-tag--beige",children:M})]});return o.jsx("div",{className:Y,children:o.jsxs("div",{className:oe,children:[p==="left"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:D,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...b!==void 0?{checked:b}:{defaultChecked:g},...T}),p==="right"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]})]})})});il.displayName="PktCheckbox";const Ts=d.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:n,helptextDropdownButton:i,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:c=!1,optionalText:p="Valgfritt",requiredTag:g=!1,requiredText:b="Må fylles ut",tagText:f=null,hasError:k=!1,errorMessage:v,disabled:$=!1,inline:M=!1,ariaDescribedby:S,useWrapper:T=!0,children:L,className:D="",hasFieldset:Y=!1,role:ee="group",counterPosition:oe="bottom"},ye)=>{const[K,N]=d.useState(!1),q=S||(t?`${s}-helptext`:void 0),B=!!r,G=B&&oe==="top",le=B&&oe==="bottom",ae=()=>N(P=>!P),pe=["pkt-inputwrapper",D,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",M?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),ue=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),be=()=>B?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,se=()=>o.jsxs(o.Fragment,{children:[f&&o.jsx("span",{className:ue+" pkt-tag--gray",children:f}),c&&o.jsx("span",{className:ue+" pkt-tag--blue-light",children:p}),g&&o.jsx("span",{className:ue+" pkt-tag--beige",children:b})]}),re=()=>{const P=o.jsxs(o.Fragment,{children:[e," ",se()]});return T?Y?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:P}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":q,id:`${s}-label`,children:P}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":q,id:`${s}-label`,children:e})},Ue=()=>!t&&!n?null:o.jsxs(o.Fragment,{children:[t&&T&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),n&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(gt,{skin:"tertiary",size:"small",variant:"icon-right",iconName:K?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ae,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:i??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${K?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:n})]})]}),Q=o.jsxs(o.Fragment,{children:[re(),Ue(),G&&o.jsx(be,{}),L,le&&o.jsx(be,{}),k&&v&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:v})})]});return o.jsx("div",{className:pe,ref:ye,role:ee,children:Y?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":q,children:Q}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:Q})})});Ts.displayName="PktInputWrapper";const gs=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,Ng=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},Mg=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},Ui=s=>s.value+(s.label||"")+(s.prefix||""),Hi=(s,e)=>e!==null&&s>=e,rl=(s,e)=>{if(!s)return"";switch(e){case"prefixAndValue":return`${s.prefix||""} ${s.value}`.trim();case"value":return s.value;case"label":default:return s.label||s.value}},Ur=(s,e)=>s?Array.isArray(s)?e?s:s.length>0?[s[0]]:[]:e?s.split(",").filter(Boolean):[s]:[],al=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},Dg=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},Og=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},Eg=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=gs(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ji=(s,e,t)=>{const n=gs(e,s);return t==="label"&&(n!=null&&n.label)?n.label:s},Xs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},ol=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),Pg=s=>{const e=s.nextElementSibling;e&&Xs(e)},ll=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&Xs(i)}else n&&Xs(n)},Ag=s=>{const e=ol(s);e[0]&&Xs(e[0])},qi=(s,e)=>{if(e.disabled)return;const t=ol(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){Xs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){Xs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&Xs(t[0])},Qs=d.forwardRef(({children:s,skin:e,textStyle:t,size:n,closeTag:i,className:r,iconName:a,ariaLabel:l,onClose:c,type:p,"aria-description":g,...b},f)=>{const[k,v]=d.useState(!1),$=d.useCallback(()=>{v(!0),c&&c()},[c]),M=d.useRef(null),[S,T]=d.useState("");d.useEffect(()=>{var ee,oe;T(((oe=(ee=M.current)==null?void 0:ee.textContent)==null?void 0:oe.trim())??"")},[s]);const L=d.useMemo(()=>{if(i&&!l)return S&&`Klikk for å fjerne ${S}`||g},[i,l,S,g]),D={"pkt-tag":!0,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},Y={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":i&&!!a,"pkt-hide":k};return i?o.jsxs("button",{...b,className:ke(Y,r),type:p,onClick:$,"aria-label":l,"aria-description":L,ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:M,children:s}),o.jsx(R,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...b,className:ke(D,r),ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:M,children:s})]})});Qs.displayName="PktTag";const cl=({state:s,outside:e=!1})=>{const{values:t,options:n,disabled:i,displayValueAs:r,handleTagRemove:a,handleTagKeydown:l,focusedTagIndex:c}=s,p=d.useRef([]);if(d.useEffect(()=>{var f;!e&&c>=0&&c<t.length&&((f=p.current[c])==null||f.focus())},[e,c,t.length]),t.length===0)return null;const g=(f,k)=>{const v=gs(n,f),$=v==null?void 0:v.tagSkinColor,M=v?rl(v,r):f;return i?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):e?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",closeTag:!0,onClose:()=>a(f),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):o.jsx("li",{role:"listitem",onClick:S=>S.stopPropagation(),onMouseDown:S=>S.preventDefault(),children:o.jsx(Qs,{ref:S=>{p.current[k]=S},skin:$||"blue-dark",closeTag:!0,tabIndex:c===k?0:-1,onClose:()=>a(f),onKeyDown:S=>l(S,k),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f)},b=t.map(g);return e?o.jsx("div",{className:"pkt-combobox__tags-outside",children:o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})}):o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})},Ig=({state:s})=>{const{values:e,options:t,editingSingleValue:n,displayValueAs:i}=s;if(n||e.length===0)return null;const r=gs(t,e[0]);if(!r)return null;const a=rl(r,i);return o.jsx("span",{className:"pkt-combobox__value",children:a})},Lg=({state:s})=>{const{id:e,inputId:t,listboxId:n,values:i,options:r,isOpen:a,multiple:l,typeahead:c,allowUserInput:p,tagPlacement:g,placeholder:b,disabled:f,fullwidth:k,hasError:v,label:$,inputFocus:M,inputRef:S,triggerRef:T,handleInputChange:L,handleInputKeydown:D,handleInputFocus:Y,handleInputBlur:ee,handleInputClick:oe,handlePlaceholderClick:ye,handleSelectOnlyKeydown:K,name:N}=s,q=["pkt-combobox__input",k&&"pkt-combobox__input--fullwidth",a&&"pkt-combobox__input--open",v&&"pkt-combobox__input--error",f&&"pkt-combobox__input--disabled"].filter(Boolean).join(" "),B=["pkt-combobox__arrow-icon",a&&"pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "),G=c||p,le=!G&&b&&(!i.length||l&&g==="outside")&&!M,ae=g!=="outside",pe=i[0]&&gs(r,i[0])?`${n}-${Ng(r,i[0])}`:void 0,ue=l&&i.length>0?`${i.length} valgt`:void 0,be=G?{tabIndex:-1}:{id:`${e}-combobox`,role:"combobox","aria-expanded":a?"true":"false","aria-controls":n,"aria-haspopup":"listbox","aria-labelledby":`${e}-combobox-label`,"aria-activedescendant":pe,"aria-description":ue,tabIndex:f?-1:0,onKeyDown:K};return o.jsxs("div",{ref:T,className:q,onClick:oe,...be,children:[le?o.jsx("span",{className:"pkt-combobox__placeholder",onClick:ye,children:b}):ae?l?o.jsx(cl,{state:s}):G?null:o.jsx(Ig,{state:s}):null,G?o.jsx("div",{className:"pkt-combobox__input-div combobox__input",children:o.jsx("input",{ref:S,type:"text",id:t,name:`${N||e}-input`,onChange:L,onKeyDown:D,onFocus:Y,onBlur:ee,placeholder:!i.length||l&&g==="outside"?b:void 0,autoComplete:"off",role:"combobox","aria-expanded":a?"true":"false","aria-label":$,"aria-autocomplete":c?"both":p?"list":"none","aria-controls":n,"aria-activedescendant":pe,"aria-description":ue,disabled:f})}):o.jsx("input",{ref:S,type:"hidden",id:t,name:`${N||e}-input`,value:i.join(","),readOnly:!0}),o.jsx(R,{className:B,name:"chevron-thin-down","aria-hidden":"true"})]})},Bg=({state:s})=>{const{listboxId:e,label:t,isOpen:n,options:i,filteredOptions:r,multiple:a,disabled:l,maxIsReached:c,maxlength:p,includeSearch:g,allowUserInput:b,addValueText:f,userInfoMessage:k,searchPlaceholder:v,searchValue:$,handleOptionClick:M,handleOptionKeydown:S,handleSearchInput:T,handleSearchKeydown:L,handleNewOptionClick:D,handleNewOptionKeydown:Y,listboxRef:ee}=s,oe=r.filter(B=>B.selected).length,ye=a&&oe>0&&p!=null&&p>0,K=b&&f&&!c,N=!!k,q=["pkt-listbox",n&&"pkt-listbox__open","pkt-txt-16-light"].filter(Boolean).join(" ");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:ee,id:e,className:q,role:r.length>0?"listbox":void 0,"aria-label":r.length>0?`Liste: ${t||""}`:void 0,"aria-multiselectable":r.length>0&&a?"true":void 0,children:[o.jsxs("div",{className:"pkt-listbox__banners",children:[g&&o.jsxs("div",{className:"pkt-listbox__search",children:[o.jsx("span",{className:"pkt-listbox__search-icon",children:o.jsx(R,{name:"magnifying-glass-small"})}),o.jsx("input",{className:"pkt-txt-16-light",type:"text","aria-label":"Søk i listen",form:"",placeholder:v||"Søk...",onChange:T,onKeyDown:L,value:$,"data-type":"searchbox",disabled:l,readOnly:l,role:"searchbox"})]}),ye&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--maximum-reached",children:[oe," av maks ",p," mulige er valgt."]}),N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--user-message",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),k]}),K&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option","data-type":"new-option","data-value":f,"data-selected":"false",tabIndex:0,onClick:()=>D(f),onKeyDown:Y,children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"plus-sign"}),'Legg til "',f,'"']}),i.length===0&&r.length===0&&!N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--empty",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),"Tom liste"]})]}),o.jsx("ul",{className:"pkt-listbox__options",role:"presentation",children:r.map((B,G)=>{const le=["pkt-listbox__option",!a&&B.selected&&"pkt-listbox__option--selected",a&&"pkt-listbox__option--checkBox"].filter(Boolean).join(" "),ae=l||B.disabled||c&&!B.selected;return o.jsxs("li",{className:le,onClick:()=>M(B.value),onKeyDown:pe=>S(pe,B.value),"aria-selected":B.selected?"true":"false",tabIndex:ae?-1:0,"data-index":G,"data-value":B.value,"data-selected":B.selected?"true":"false","data-disabled":ae||void 0,"aria-disabled":ae?"true":"false",role:"option",id:`${e}-${G}`,children:[a?o.jsx("input",{className:"pkt-input-check__input-checkbox",type:"checkbox",tabIndex:-1,value:B.value,checked:B.selected||!1,readOnly:!0,"aria-hidden":"true",disabled:ae}):B.selected?o.jsx(R,{name:"check-big"}):null,o.jsxs("span",{className:"pkt-listbox__option-label",id:`${e}-option-label-${G}`,children:[B.prefix&&o.jsx("span",{className:"pkt-listbox__option-prefix",children:B.prefix}),B.label||B.value]}),B.description&&o.jsx("span",{className:"pkt-listbox__option-description pkt-txt-14-light",children:B.description})]},`${B.value}-${G}`)})})]}),o.jsx("div",{"aria-live":"polite",className:"pkt-visually-hidden",children:k})]})};function Fg(s,e){return s.map(t=>({...t,label:t.label||t.value,fulltext:Ui(t),selected:e.includes(t.value)}))}function Vg(s,e){const{id:t="",label:n,value:i,defaultValue:r,options:a,defaultOptions:l,multiple:c=!1,maxlength:p,typeahead:g=!1,includeSearch:b=!1,allowUserInput:f=!1,displayValueAs:k="label",tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S=!1,required:T=!1,fullwidth:L=!1,hasError:D=!1,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K=!1,optionalText:N,requiredTag:q=!1,requiredText:B,tagText:G,useWrapper:le=!0,name:ae,className:pe,onChange:ue,onValueChange:be,children:se}=s,re=`${t}-input`,Ue=`${t}-listbox`,Q=g||f,P=d.useRef(null),Me=d.useRef(null),De=d.useRef(null),ne=d.useRef(null),He=d.useRef(null),Pe=d.useCallback(()=>{var w,O;Q?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},[Q]),$e=d.useMemo(()=>{const w=[];return d.Children.forEach(se,O=>{if(d.isValidElement(O)&&O.type==="option"){const J=O.props;w.push({value:J.value??J.children??"",label:J.children??J.value??"",selected:J.selected,disabled:J.disabled})}}),w},[se]),Te=d.useMemo(()=>l&&l.length>0?l.map(w=>({...w,fulltext:Ui(w)})):a&&a.length>0?a.map(w=>({...w,fulltext:Ui(w)})):$e.length>0?$e.map(w=>({...w,fulltext:Ui(w)})):[],[l,a,$e]),Ae=i!==void 0,[ze,We]=d.useState(()=>Ur(i??r,c)),ve=d.useRef(ze);d.useEffect(()=>{Ae&&We(Ur(i,c))},[i,Ae,c]);const E=Ae?Ur(i,c):ze,[Ie,Ye]=d.useState([]),U=d.useMemo(()=>{const w=[...Ie.filter(O=>!Te.some(J=>J.value===O.value)),...Te];return Fg(w,E)},[Te,Ie,E]),[V,te]=d.useState(!1),[me,fe]=d.useState(""),[Xe,Ke]=d.useState(""),[m,h]=d.useState(""),[_,C]=d.useState(null),[j,W]=d.useState(!1),[de,it]=d.useState(!1),[Re,Le]=d.useState(-1),Kt=d.useRef(!1),Gt=Hi(E.length,p??null),yt=c&&p!=null,ci=d.useMemo(()=>me?g?al(U,me).filtered:Mg(U,me):U,[U,me,g]),dt=d.useMemo(()=>{var w;return(w=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:w.set},[]),Ft=d.useCallback(w=>{const O=Me.current;if(!O||!dt)return;const J=c?w.join(","):w[0]||"";dt.call(O,J),O.dispatchEvent(new Event("input",{bubbles:!0}))},[dt,c]),Xt=c?E.join(","):E[0]||"";d.useEffect(()=>{Me.current&&(Me.current.value=Xt)},[Xt]),d.useEffect(()=>{if(V||c||!P.current)return;const w=E[0]?ji(E[0],U,k):"";P.current.value!==w&&(P.current.value=w)},[E,U,k,c,V]);const rs=d.useCallback((w,O=!0)=>{Ae||We(w),O&&(be==null||be(w),Ft(w))},[Ae,be,Ft]),Ns=d.useCallback(w=>{if(!w||E.includes(w))return;if(c&&Hi(E.length,p??null)){h("Maks antall valg nådd");return}const O=c?[...E,w]:[w];rs(O)},[E,c,p,rs]),et=d.useCallback(w=>{if(!w)return;const O=E.filter(Be=>Be!==w),J=gs(U,w);J!=null&&J.userAdded&&Ye(Be=>Be.filter(Nt=>Nt.value!==w)),rs(O)},[E,U,rs]),ui=d.useCallback(()=>{Ye([]),rs([])},[rs]),Zs=d.useCallback(w=>{if(!w||w.trim()==="")return;let O;if(!c)O=[w];else{if(gs(U,w)||Hi(E.length,p??null))return;O=[...E,w]}const J={value:w,label:w,userAdded:!0,selected:!0};Ye(Be=>[J,...Be.filter(Nt=>Nt.value!==w)]),rs(O)},[c,U,E,p,rs]),di=d.useCallback((w=!0,O)=>{if(C(null),w&&P.current&&P.current.type!=="hidden"){fe(""),Ke("");const J=O!==void 0?O:E[0];!c&&J?P.current.value=ji(J,U,k):P.current.value="",c||(it(!1),h(""))}},[c,E,U,k]),Vt=d.useCallback(w=>{var jl,ql;if(S)return;h(""),C(null);const O=((jl=gs(U,w))==null?void 0:jl.value)||null,J=E.includes(w||O||""),Be=!!O,Nt=((ql=U.find(yb=>yb.value===w))==null?void 0:ql.disabled)||!1,Js=!(w!=null&&w.trim()),Pt=!c,Ut=c,Ri=Hi(E.length,p??null);let ms=!1,er=!0,hi="",ta="",Sn;Nt||(!Be&&f&&!Js?(Zs(w),hi="Ny verdi lagt til",ms=Ut,Pt&&(Sn=w||"")):!Be&&!f?(Pt&&E[0]&&et(E[0]),er=!1,ms=!0,hi="Ingen treff i søket"):J?(et(O),ms=!0,Sn="",Pt&&Q&&P.current&&P.current.type!=="hidden"&&(P.current.value="")):Js&&Pt?(ui(),ms=!0,Sn=""):Pt?(E[0]&&et(E[0]),Ns(O),ms=!1,Sn=O||""):Ut&&!Ri?(Ns(O),ms=!0):Ut&&Ri?(hi="Maks antall valg nådd",er=!1,ta=w||""):(Pt&&ui(),hi="Ingen gyldig verdi valgt",er=!1,ms=!0,ta=w||"",Sn=""),te(ms),h(hi),fe(ta),di(er,Sn),ms||(Pt&&Q&&(Kt.current=!0),window.setTimeout(()=>{Pe()},0)))},[S,U,E,c,p,f,Zs,et,ui,Ns,di,Pe]),Tt=d.useCallback(()=>{if(W(!1),C(null),h(""),fe(""),P.current&&P.current.type!=="hidden"){const w=P.current.value;let O=E[0];if(c){if(w!==""){const{action:J,value:Be}=Eg(w,E,U,f,c);switch(J){case"addUserValue":Zs(Be);break;case"selectOption":Ns(Be);break;case"removeValue":et(Be);break}}}else if(!w)E[0]&&et(E[0]),O=void 0;else{const J=gs(U,w);J&&J.value!==E[0]?(E[0]&&et(E[0]),Ns(J.value),O=J.value):!J&&f&&(E[0]&&et(E[0]),Zs(w),O=w)}!c&&O?P.current.value=ji(O,U,k):P.current.value=""}te(!1),it(!1)},[E,U,f,c,k,Zs,Ns,et]),$n=d.useCallback(w=>{if(!w.trim().toLowerCase()){C(null),h(""),!c&&E[0]&&et(E[0]);return}const J=Dg(w,E,U,f);C(J.addValueText),h(J.userInfoMessage)},[E,U,f,c,et]),Zi=d.useCallback(w=>{var J;if(S)return;const O=w.target.value;if(Ke(O),fe(O),$n(O),g&&O){const{suggestion:Be}=al(U,O);Be!=null&&Be.label&&P.current&&!((J=w.nativeEvent.inputType)!=null&&J.includes("deleteContent"))&&(P.current.value=Be.label,window.setTimeout(()=>{var Nt;return(Nt=P.current)==null?void 0:Nt.setSelectionRange(O.length,Be.label.length)},0))}},[S,g,U,$n]),Qr=d.useCallback(w=>{var J,Be,Nt,Js,Pt;if(w.key==="Backspace"){const Ut=!((J=P.current)!=null&&J.value);if(!me&&Ut&&c&&E.length>0){w.preventDefault();const Ri=E[E.length-1];et(Ri)}return}if(w.key==="ArrowLeft"&&c&&E.length>0&&(((Be=P.current)==null?void 0:Be.selectionStart)??0)===0&&!((Nt=P.current)!=null&&Nt.value)){w.preventDefault(),Le(E.length-1);return}const O=Og(w.key,w.shiftKey,c);if(O&&!(w.key==="Tab"&&!V)){if(O==="focusListbox"&&w.key==="Tab"&&!((Js=ne.current)==null?void 0:Js.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){Tt();return}switch(w.preventDefault(),O){case"addValue":{const Ut=((Pt=P.current)==null?void 0:Pt.value.trim())||"";if(fe(Ut),Ut&&E.includes(Ut)){di(!0),h("Verdien er allerede valgt");break}Vt(Ut);break}case"focusListbox":ne.current&&(V||te(!0),qi(ne.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b}));break;case"closeOptions":te(!1);break}}},[me,E,c,S,f,_,b,V,et,Vt,Pe]),as=d.useCallback(()=>{if(!S){if(Kt.current){Kt.current=!1,W(!0);return}!c&&E[0]&&P.current&&P.current.type!=="hidden"&&(it(!0),P.current.value=ji(E[0],U,k)),W(!0),fe(""),te(!0)}},[S,c,E,U,k]),Zr=d.useCallback(()=>{W(!1),it(!1)},[]),Jr=d.useCallback(w=>{if(S||!V)return;const O=w.relatedTarget,J=He.current;J&&O&&J.contains(O)||Tt()},[S,V,Tt]),Rr=d.useCallback(w=>{var O;if(S){w.preventDefault(),w.stopPropagation();return}if(Q)(O=P.current)==null||O.focus();else{w.stopPropagation(),w.preventDefault();const J=!V;te(J),J&&ne.current&&qi(ne.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b})}},[S,Q,V,f,_,b]),ea=d.useCallback(w=>{S||(w.stopPropagation(),Q&&P.current?(P.current.focus(),W(!0)):te(O=>!O))},[S,Q]),I=d.useCallback(w=>{if(!S)switch(w.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":w.preventDefault(),V?te(!1):(te(!0),ne.current&&window.setTimeout(()=>{ne.current&&qi(ne.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0));break;case"Escape":V&&(w.preventDefault(),te(!1));break;case"Home":case"End":w.preventDefault(),V||te(!0),ne.current&&window.setTimeout(()=>{ne.current&&qi(ne.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0);break;case"ArrowLeft":c&&E.length>0&&(w.preventDefault(),Le(E.length-1));break;case"Backspace":case"Delete":if(c&&E.length>0){w.preventDefault();const O=E[E.length-1];et(O)}break}},[S,V,f,Gt,_,b,c,E,et]),F=d.useCallback(w=>{Vt(w)},[Vt]),Ge=d.useCallback((w,O)=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(O);break;case"ArrowDown":w.preventDefault(),Pg(w.currentTarget);break;case"ArrowUp":w.preventDefault(),ne.current&&ll(w.currentTarget,ne.current,b);break;case"Escape":w.preventDefault(),te(!1),Pe();break;case"Tab":Tt();break}},[Vt,b,Pe,Tt]),tt=d.useCallback(w=>{et(w),Le(-1),Q&&P.current&&(W(!0),P.current.focus())},[et,Q]),xn=d.useCallback((w,O)=>{var J,Be,Nt;switch(w.stopPropagation(),w.key){case"ArrowLeft":w.preventDefault(),O>0&&Le(O-1);break;case"ArrowRight":w.preventDefault(),O<E.length-1?Le(O+1):(Le(-1),Q&&P.current?P.current.focus():(J=De.current)==null||J.focus());break;case"Backspace":case"Delete":w.preventDefault();{const Js=E[O],Pt=O>=E.length-1?O-1:O;et(Js),Pt>=0?Le(Pt):(Le(-1),Q&&P.current?P.current.focus():(Be=De.current)==null||Be.focus())}break;case"Tab":Le(-1);break;case"Escape":w.preventDefault(),Le(-1),Q&&P.current?P.current.focus():(Nt=De.current)==null||Nt.focus();break}},[E,Q,et]),Ji=d.useCallback(w=>{fe(w.target.value),$n(w.target.value)},[$n]),bb=d.useCallback(w=>{switch(w.key){case"ArrowDown":if(w.preventDefault(),ne.current){const O=ne.current.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]');O==null||O.focus()}break;case"Tab":Tt();break;case"Escape":w.preventDefault(),te(!1),Pe();break}},[Pe,Tt]),vb=d.useCallback(w=>{Vt(w)},[Vt]),kb=d.useCallback(w=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(w.currentTarget.dataset.value||"");break;case"ArrowDown":w.preventDefault(),ne.current&&Ag(ne.current);break;case"ArrowUp":w.preventDefault(),ne.current&&ll(w.currentTarget,ne.current,b);break;case"Escape":w.preventDefault(),te(!1),Pe();break}},[Vt,b,Pe]);return d.useEffect(()=>{if(!V)return;const w=O=>{const J=O.target;He.current&&!He.current.contains(J)&&Tt()};return document.addEventListener("click",w,!0),()=>{document.removeEventListener("click",w,!0)}},[V,Tt]),d.useEffect(()=>{var J;const w=(J=He.current)==null?void 0:J.closest("form");if(!w)return;const O=()=>{window.setTimeout(()=>{if(We(ve.current),Ye([]),Ke(""),fe(""),C(null),h(""),Me.current){const Be=c?ve.current.join(","):ve.current[0]||"";Me.current.value=Be}},0)};return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)},[c]),d.useImperativeHandle(e,()=>({get value(){var w;return((w=Me.current)==null?void 0:w.value)??""},set value(w){const O=Array.isArray(w)?w:w?String(w).split(",").filter(Boolean):[];Ae||We(O),Me.current&&(Me.current.value=O.join(","))},focus(){var w,O;Q?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},blur(){var w,O;Q?(w=P.current)==null||w.blur():(O=De.current)==null||O.blur()}}),[Ae]),{id:t,inputId:re,listboxId:Ue,values:E,inputValue:Xe,searchValue:me,options:U,filteredOptions:ci,isOpen:V,userInfoMessage:m,addValueText:_,maxIsReached:Gt,editingSingleValue:de,inputFocus:j,focusedTagIndex:Re,label:n,multiple:c,maxlength:p,typeahead:g,includeSearch:b,allowUserInput:f,displayValueAs:k,tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S,required:T,fullwidth:L,hasError:D,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K,optionalText:N,requiredTag:q,requiredText:B,tagText:G,useWrapper:le,name:ae,className:pe,hasCounter:yt,inputRef:P,changeInputRef:Me,triggerRef:De,listboxRef:ne,wrapperRef:He,handleInputChange:Zi,handleInputKeydown:Qr,handleInputFocus:as,handleInputBlur:Zr,handleFocusOut:Jr,handleInputClick:Rr,handlePlaceholderClick:ea,handleSelectOnlyKeydown:I,handleOptionClick:F,handleOptionKeydown:Ge,handleTagRemove:tt,handleTagKeydown:xn,handleSearchInput:Ji,handleSearchKeydown:bb,handleNewOptionClick:vb,handleNewOptionKeydown:kb,onChange:ue}}const ul=d.forwardRef((s,e)=>{const t=Vg(s,e),n=["pkt-combobox-component",t.fullwidth&&"pkt-combobox-component--fullwidth",t.className].filter(Boolean).join(" "),i=t.allowUserInput||t.typeahead,r=i?t.inputId:`${t.id}-combobox`;return o.jsxs("div",{className:n,ref:t.wrapperRef,children:[o.jsxs(Ts,{forId:r,hasFieldset:!i,label:t.label||"",helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,className:"pkt-combobox__wrapper",children:[o.jsxs("div",{className:"pkt-combobox",onBlur:t.handleFocusOut,children:[o.jsx(Lg,{state:t}),o.jsx(Bg,{state:t})]}),t.tagPlacement==="outside"&&t.multiple&&o.jsx(cl,{state:t,outside:!0})]}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name||t.id,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});ul.displayName="PktCombobox";const Wi=os({tagName:"pkt-consent",elementClass:Lt,react:d,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});Wi.displayName="PktConsent";const dl=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ug=()=>dl()?"text":"date",Hg=s=>!s||s.length!==2?!0:og(s[0],s[1]),jg=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),qg=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Wg=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),zg=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Yg=(s,e,t=!1)=>{var l;if(!s||!e)return;const n=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),i=t?n.height+30:n.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";n&&n.top+r>window.innerHeight&&n.top-r>0&&(a=`calc(100% - ${i}px - ${r}px)`),s.style.top=a},zi=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Kg=({open:s,multiple:e=!1,range:t=!1,weeknumbers:n=!1,withcontrols:i=!1,selected:r=[],earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,inputRef:k,hasCounter:v=!1,onDateSelected:$,onClose:M})=>{const S=d.useRef(null),T=d.useRef(!1);s&&(T.current=!0),d.useEffect(()=>{s&&Yg(S.current,(k==null?void 0:k.current)??null,v)},[s,k,v]);const L=["pkt-calendar-popup",s?"show":"hide"].join(" "),D=s||T.current;return o.jsx("div",{ref:S,className:L,hidden:!s,"aria-hidden":!s,children:D&&o.jsx(Vr,{multiple:e,range:t,weeknumbers:n,withcontrols:i,selected:r,earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,onDateSelected:$,onClose:M})})},Gg=({dates:s,dateformat:e,idBase:t,strings:n,onDateRemoved:i})=>{var l;const r=ag(s),a=((l=n==null?void 0:n.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(c=>{const p=eg(c,e);return o.jsx(Qs,{id:`${t}${c}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>i(c),children:o.jsx("time",{dateTime:c,children:p})},c)})})},Xg=({state:s})=>{var He,Pe,$e,Te;const{id:e,inputId:t,values:n,dateformat:i,multiple:r,range:a,showRangeLabels:l,disabled:c,readOnly:p,required:g,label:b,name:f,placeholder:k,hasError:v,helptext:$,minStr:M,maxStr:S,inputType:T,isIOSDevice:L,strings:D,inputClasses:Y,buttonClasses:ee,rangeLabelClasses:oe,datepickerInputsClasses:ye,isInputDisabled:K,inputRef:N,inputRefTo:q,btnRef:B,toggleCalendar:G,handleFocus:le,handleSingleInputChange:ae,handleRangeFromChange:pe,handleRangeToChange:ue,handleRangeBlur:be,handleMultipleBlur:se,handleTagRemoved:re,handleSingleKeydown:Ue,handleRangeFromKeydown:Q,handleRangeToKeydown:P,handleMultipleKeydown:Me,restProps:De}=s,ne=()=>{var Ae,ze;return o.jsxs("button",{ref:B,className:ee,type:"button",onClick:G,disabled:c,"aria-label":((Ae=D.calendar)==null?void 0:Ae.buttonAltText)??"Åpne kalender",children:[o.jsx(R,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((ze=D.calendar)==null?void 0:ze.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(Gg,{dates:n,dateformat:i,idBase:e,strings:D,onDateRemoved:re}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,placeholder:k,readOnly:p||L&&!p,disabled:K,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Me,onFocus:le,onBlur:se}),ne()]})})]}):a?o.jsx("div",{className:ye,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((He=D.generic)==null?void 0:He.from)??"Fra"}),o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f?`${f}-from`:`${e}-from`,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-label":`${b} ${((Pe=D.generic)==null?void 0:Pe.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Q,onFocus:le,onBlur:be,onChange:pe}),o.jsx("div",{className:oe,id:`${e}-to-label`,children:(($e=D.generic)==null?void 0:$e.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:q,className:Y,type:T,id:`${e}-to`,name:f?`${f}-to`:`${e}-to`,value:n[1]??"",min:M,max:S,readOnly:p||L&&!p,disabled:c,"aria-label":`${b} ${((Te=D.generic)==null?void 0:Te.to)??"Til"}`,"aria-invalid":v,onClick:G,onKeyDown:P,onFocus:le,onBlur:be,onChange:ue}),ne()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Ue,onFocus:le,onBlur:void 0,onChange:ae}),ne()]})})},Qg={calendar:{buttonAltText:"Åpne kalender"}},Zg={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},hl=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Jg(s,e){const{id:t,label:n,value:i,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:c,range:p=!1,showRangeLabels:g=!1,weeknumbers:b=!1,withcontrols:f=!1,excludedates:k,excludeweekdays:v,currentmonth:$,today:M,calendarOpen:S,timezone:T,fullwidth:L=!1,hasFieldset:D=!1,inline:Y=!1,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K=!1,errorMessage:N,optionalTag:q=!1,optionalText:B,requiredTag:G=!1,requiredText:le,tagText:ae,useWrapper:pe=!0,strings:ue,disabled:be=!1,readOnly:se=!1,required:re=!1,name:Ue,min:Q,max:P,placeholder:Me,onChange:De,onValueChange:ne,className:He,...Pe}=s,$e=d.useCallback(I=>I===void 0?[]:hl(I),[]),Te=i!==void 0,Ae=typeof r=="number"?void 0:r,[ze,We]=d.useState(()=>$e(i??Ae)),ve=Te?$e(i):ze,E=d.useRef(ze);d.useEffect(()=>{Te&&We($e(i))},[i,Te,$e]);const[Ie,Ye]=d.useState(S??!1);d.useEffect(()=>{S!==void 0&&Ye(S)},[S]);const U=d.useRef(null),V=d.useRef(null),te=d.useRef(null),me=d.useRef(null),fe=d.useRef(null),Xe=d.useMemo(()=>Ug(),[]),Ke=d.useMemo(()=>dl(),[]),m=d.useMemo(()=>ue??(p?Zg:Qg),[ue,p]),h=typeof Q=="string"?Q:Q!==void 0?String(Q):void 0,_=typeof P=="string"?P:P!==void 0?String(P):void 0,C=d.useMemo(()=>{const I=jg(L,g,l,p,se,Xe);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[L,g,l,p,se,Xe]),j=d.useMemo(()=>{const I=qg();return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[]),W=d.useMemo(()=>{const I=Wg(g);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[g]),de=d.useMemo(()=>["pkt-datepicker__inputs",p&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,g]),it=d.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Re=be||l&&c!=null&&ve.length>=c,Le=l&&c!=null,Kt=`${t}-input`,Gt=ve.join(",");d.useEffect(()=>{te.current&&(te.current.value=Gt)},[Gt]),d.useEffect(()=>{T&&typeof window<"u"&&T!==window.pktTz&&(window.pktTz=T)},[T]);const yt=d.useCallback((I,F=!0)=>{Te||We(I),F&&(ne==null||ne(I))},[Te,ne]),ci=d.useMemo(()=>{var I;return(I=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:I.set},[]),dt=d.useCallback(I=>{const F=te.current;!F||!ci||(ci.call(F,I.join(",")),F.dispatchEvent(new Event("input",{bubbles:!0})))},[ci]),Ft=d.useCallback(()=>{be||Ye(I=>!I)},[be]),Xt=d.useCallback(()=>{Ye(!1)},[]);d.useEffect(()=>{if(!Ie)return;const I=Ge=>{var xn;const tt=Ge.target;fe.current&&!fe.current.contains(tt)&&!((xn=tt.closest)!=null&&xn.call(tt,".pkt-calendar-popup"))&&Xt()},F=Ge=>{var tt;Ge.key==="Escape"&&(Xt(),(tt=U.current)==null||tt.focus())};return document.addEventListener("click",I,!0),document.addEventListener("keydown",F),()=>{document.removeEventListener("click",I,!0),document.removeEventListener("keydown",F)}},[Ie,Xt]);const rs=d.useCallback(()=>{Ke&&!Ie&&Ye(!0)},[Ke,Ie]),Ns=d.useCallback(I=>{var tt;const F=zg(I,l,p),Ge=hl(F);yt(Ge),dt(Ge),!l&&!p&&(Xt(),(tt=U.current)==null||tt.focus())},[l,p,yt,dt,Xt]),et=d.useCallback(()=>{var I;Xt(),(I=U.current)==null||I.focus()},[Xt]),ui=d.useCallback(I=>{const F=I.target.value,Ge=F?[F]:[];yt(Ge),dt(Ge)},[yt,dt]),Zs=d.useCallback(I=>{const F=I.target.value,Ge=ve[1]??"",tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),di=d.useCallback(I=>{const F=ve[0]??"",Ge=I.target.value,tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),Vt=d.useCallback(()=>{ve.length===2&&!Hg(ve)&&(yt([ve[0]]),dt([ve[0]]))},[ve,yt,dt]),Tt=d.useCallback(I=>{const F=fs(I),Ge=h?fs(h):null,tt=_?fs(_):null;if(F&&!isNaN(F.getTime())&&(!Ge||F>=Ge)&&(!tt||F<=tt)){const xn=rg([...ve,I],h,_,k,v),Ji=[...new Set(xn)];yt(Ji),dt(Ji)}},[ve,h,_,k,v,yt,dt]),$n=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Zi=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Qr=d.useCallback(I=>{const F=ve.filter(Ge=>Ge!==I);yt(F),dt(F)},[ve,yt,dt]),as=d.useCallback(I=>{const F=I==null?void 0:I.closest("form");F?F.requestSubmit():I==null||I.blur()},[]),Zr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Jr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),()=>{var F;return(F=V.current)==null?void 0:F.focus()},()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Rr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(V.current),void 0,()=>{var F;return(F=V.current)==null?void 0:F.blur()})},[Ft,as]),ea=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()},Zi)},[Ft,as,Zi]);return d.useEffect(()=>{var Ge;const I=(Ge=fe.current)==null?void 0:Ge.closest("form");if(!I)return;const F=()=>{window.setTimeout(()=>{We(E.current),Ye(!1),te.current&&(te.current.value=E.current.join(","))},0)};return I.addEventListener("reset",F),()=>I.removeEventListener("reset",F)},[]),d.useImperativeHandle(e,()=>({get value(){var I;return((I=te.current)==null?void 0:I.value)??""},set value(I){const F=I?I.split(",").filter(Boolean):[];We(F),te.current&&(te.current.value=I??"")},focus(){var I;(I=U.current)==null||I.focus()},blur(){var I;(I=U.current)==null||I.blur()}}),[]),{id:t,inputId:Kt,label:n,values:ve,calendarOpen:Ie,dateformat:a,multiple:l,maxlength:c,range:p,showRangeLabels:g,weeknumbers:b,withcontrols:f,excludedates:k,excludeweekdays:v,disabled:be,readOnly:se,required:re,name:Ue,placeholder:Me,fullwidth:L,hasFieldset:D,inline:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K,errorMessage:N,optionalTag:q,optionalText:B,requiredTag:G,requiredText:le,tagText:ae,useWrapper:pe,className:He,minStr:h,maxStr:_,effectiveCurrentMonth:it,today:M,inputType:Xe,isIOSDevice:Ke,strings:m,inputClasses:C,buttonClasses:j,rangeLabelClasses:W,datepickerInputsClasses:de,isInputDisabled:Re,hasCounter:Le,inputRef:U,inputRefTo:V,changeInputRef:te,btnRef:me,wrapperRef:fe,onChange:De,toggleCalendar:Ft,hideCalendar:Xt,handleDateSelected:Ns,handleCalendarClose:et,handleFocus:rs,handleSingleInputChange:ui,handleRangeFromChange:Zs,handleRangeToChange:di,handleRangeBlur:Vt,handleMultipleBlur:$n,handleTagRemoved:Qr,handleSingleKeydown:Zr,handleRangeFromKeydown:Jr,handleRangeToKeydown:Rr,handleMultipleKeydown:ea,restProps:Pe}}const pl=d.forwardRef((s,e)=>{const t=Jg(s,e),n=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:n,children:[o.jsx(Ts,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(Xg,{state:t})}),o.jsx(Kg,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});pl.displayName="PktDatepicker";const Rg={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},em={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},tm={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},sm={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},fl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),nm=()=>{const s=fl(),e=fl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class gl{constructor(e,t){tr(this,"fileId");tr(this,"file");tr(this,"attributes",{});this.fileId=t||nm(),this.file=e,this.attributes={targetFilename:e.name}}}const Hr=d.createContext({}),im=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",rm=d.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:n=()=>{},name:i,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:c=!1,srAnnouncementIds:p,...g},b)=>{const f=d.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,v=d.useMemo(()=>k?k.split(/\s*,\s*/).map(N=>N.trim()).filter(Boolean).join(", ").toUpperCase():im,[k]);d.useImperativeHandle(b,()=>f.current);const[$,M]=d.useState(!1),S=d.useMemo(()=>l?e?tm:sm:e?Rg:em,[e,l]),T=d.useCallback(N=>{if(f.current)try{f.current.files=am(N)}catch{}},[f.current,t]);d.useEffect(()=>{T(t)},[f,t]);const L=d.useCallback(N=>{const q=N.map(B=>new gl(B));n(q),f.current&&(f.current.value="")},[n]),D=N=>{const q=N.target.files;if(q.length===0){e&&T(t);return}L(Array.from(q))},Y=N=>{L(N)},ee=N=>{if(N.preventDefault(),M(!1),c)return;const q=N.dataTransfer.files,B=Array.from(q);Y(B)},oe=N=>{N.preventDefault(),!c&&M(!0)},ye=()=>{M(!1)},K=d.useCallback(N=>{var B;c||N.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(B=f.current)==null||B.click()},[c]);return o.jsxs("div",{onDrop:ee,onDragOver:oe,onDragLeave:ye,onClick:K,className:ke("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":c}),children:[o.jsx("input",{...g,id:s,type:"file",ref:f,multiple:e,onChange:D,accept:k,disabled:c,name:r==="form"&&i||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(N=>o.jsx("input",{type:"hidden",name:i,value:N.fileId},N.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(R,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${S.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[S.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:N=>{var q;N.preventDefault(),N.stopPropagation(),(q=f.current)==null||q.click()},type:"button",children:S.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",v]})]})]})}),am=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},jr=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:n,counterMaxLength:i,className:r,disabled:a,errorMessage:l,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,fullwidth:k=!1,label:v,name:$,optionalTag:M=!1,optionalText:S,requiredTag:T=!1,requiredText:L,tagText:D=null,placeholder:Y,rows:ee,useWrapper:oe=!0,onChange:ye,value:K,autoComplete:N="off",minLength:q,maxLength:B,readOnly:G,skipForwardTestid:le=!1,...ae},pe)=>{const ue=[r,"pkt-textinput","pkt-textarea"].join(" "),be=`${s}-input`,se=`${be}-label`,re=t||se,[Ue,Q]=d.useState(0),P=Me=>{var De,ne;n&&Q(((ne=(De=Me.currentTarget)==null?void 0:De.value)==null?void 0:ne.length)||0),ye&&ye(Me)};return d.useEffect(()=>{K!==void 0&&Q((K==null?void 0:K.length)||0)},[K]),o.jsx(Ts,{ariaDescribedby:e,className:ue,disabled:a,errorMessage:l,forId:be,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,label:v,optionalTag:M,optionalText:S,requiredTag:T,requiredText:L,tagText:D,useWrapper:oe,counter:n,counterCurrent:Ue,counterMaxLength:i,children:o.jsx("textarea",{ref:pe,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${i&&Ue>i?"pkt-input--counter-error":""}`,name:`${$||s}`,id:be,placeholder:Y,disabled:a,rows:ee,"aria-labelledby":re,"aria-invalid":c,"aria-errormessage":`${s}-error`,...ae,onChange:P,value:K,autoComplete:N,minLength:q,maxLength:B,readOnly:G,"data-skip-forward-testid":le?"true":void 0})})});jr.displayName="PktTextarea";const om=Symbol("comment"),lm=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),n=s.getFullYear(),i=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${n} kl. ${i}:${r}`},cm=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:n})=>{const i=d.useRef(null),r=!!n,a=()=>{var c,p;const l=(p=(c=i.current)==null?void 0:c.value)==null?void 0:p.trim();l&&t({text:l,timestamp:new Date}),e()};return d.useLayoutEffect(()=>{const l=setTimeout(()=>{var c;return(c=i.current)==null?void 0:c.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(jr,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:i,defaultValue:n==null?void 0:n.text}),o.jsx(gt,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},um=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((n,i)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:n.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:lm(n.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(i),"aria-label":"Slett kommentar",children:o.jsx(R,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(i),"aria-label":"Rediger kommentar",children:o.jsx(R,{name:"edit"})})]})]},i))}):null,dm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},hm=s=>{const e=s("comments"),t=(i,r)=>{e.set(i,[r])},n=(i,r)=>{const l=(e.get(i)||[]).filter((c,p)=>p!==r);e.set(i,l.length>0?l:void 0)};return{title:i=>{const r=e.get(i.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(i,r)=>{const a=e.get(i.fileId),l=a==null?void 0:a[0];return o.jsx(cm,{fileItem:i,closeOperationUi:r,onAddComment:c=>t(i.fileId,c),existingComment:l})},renderContent:(i,r,a)=>{if(a)return null;const l=e.get(i.fileId);return o.jsx(um,{comments:l,onDeleteComment:c=>n(i.fileId,c),onEditComment:r?()=>r():void 0})},renderHidden:i=>o.jsx(dm,{comments:e.get(i.fileId)},`comments${i.fileId}`),symbol:om}},pm=Symbol("deleteFile"),fm=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:pm}),gm=Symbol("renameFile"),mm=s=>{const e=d.useRef(null),t=d.useId(),n=()=>{var i;s.onSave(((i=e.current)==null?void 0:i.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation(),n()),i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),s.onCancel())}}),o.jsx(gt,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},bm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},vm=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,n)=>o.jsx(mm,{value:e.get(t.fileId)||void 0,onSave:i=>{e.set(t.fileId,i),n()},onCancel:n}),renderHidden:t=>o.jsx(bm,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:gm}},km=(s,e)=>{const t=d.useCallback((r,a,l)=>{const c=s.find(g=>g.fileId===r),p=c.attributes||{};c.attributes={...p,[a]:l},e(r,{attributes:c.attributes})},[e,s]),n=d.useCallback((r,a)=>(s.find(p=>p.fileId===r).attributes||{})[a],[s]);return{fileAttributes:d.useCallback(r=>({get:a=>n(a,r),set:(a,l)=>{t(a,r,l)}}),[n,t])}},ym=s=>{const[e,t]=d.useState(!1),[n,i]=d.useState(0),r=d.useRef(null),a=d.useCallback(p=>{var b;const g=s.findIndex(f=>f.fileId===p);g>=0&&(i(g),t(!0),(b=r.current)==null||b.showModal())},[s]),l=d.useCallback(()=>{var p;t(!1),(p=r.current)==null||p.close()},[]),c=d.useCallback(p=>{s.length!==0&&i(g=>p==="prev"?g<=0?s.length-1:g-1:g>=s.length-1?0:g+1)},[s.length]);return{isOpen:e,currentIndex:n,modalRef:r,open:a,close:l,navigate:c}},_m=s=>{const[e,t]=d.useState({}),n=d.useCallback(a=>{const l=e[a];if(l)return s.find(c=>c.symbol===l)},[e,s]),i=d.useCallback((a,l)=>{t(c=>({...c,[a]:l.symbol}))},[]),r=d.useCallback(a=>{t(l=>{const c={...l};return delete c[a],c})},[]);return{getActivated:n,activate:i,close:r}},wm=os({tagName:"pkt-modal",elementClass:Ot,react:d,displayName:"PktModal",events:{}}),qr=d.forwardRef(({children:s,...e},t)=>o.jsx(wm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));qr.displayName="PktModal";const ml=2,$m=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const n=parseFloat(e.fontSize);return(!Number.isNaN(n)&&n>0?n:16)*1.2},xm=(s,e,t)=>{const n=e*t;return s.getBoundingClientRect().height>n+.5},bl=d.createContext({tail:5}),oi=({children:s,tail:e,...t})=>{const n=s,i=d.useContext(bl),r=e!==void 0?e:i.tail||0,a=s.length<=r+3?null:s.slice(-r),l=d.useRef(null),c=d.useRef(null),[p,g]=d.useState(!1),b=d.useCallback(()=>{const k=l.current,v=c.current;if(!k||!v)return;const $=$m(k);g(xm(v,$,ml))},[]),f=d.useMemo(()=>new ResizeObserver(k=>{k.some(v=>v.target===l.current)&&b()}),[b]);return d.useLayoutEffect(()=>(l.current&&f.observe(l.current),b(),()=>f.disconnect()),[s,f,b]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:ml,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:n}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:p?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:c,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},Sm=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},Yi=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,Wr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),Cm=()=>{const[s,e]=d.useState(1);return d.useEffect(()=>{const t=setInterval(()=>{e(n=>n>=3?1:n+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},Tm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(oi,{children:e.attributes.targetFilename})}),o.jsx(Wr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(Qi,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(Cm,{})]})},Nm=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(Qi,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},Mm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),Dm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(Nm,{transferItem:s,onRemove:e}):o.jsx(Mm,{transferItem:s,onRemove:e}),Om=({operation:s,onActivate:e,transferItem:t})=>{const n=typeof s.title=="function"?s.title(t):s.title;if(!n)return null;const i=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:i,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:n})},vl=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)})]}),Em=({transferItem:s,onPreviewClick:e})=>{const[t,n]=d.useState(null),[i,r]=d.useState(!1),a=s.file;d.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const g=URL.createObjectURL(a);return n(g),()=>{URL.revokeObjectURL(g)}}n(null)},[a]);const l=t&&!i&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),c=!!e,p=!!t&&!i;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${p?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(gt,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[c&&o.jsx(R,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(oi,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},kl=d.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:n,onNavigate:i},r)=>{const[a,l]=d.useState(null),[c,p]=d.useState(!1),g=e[t],b=e.length>1;return d.useEffect(()=>{if(p(!1),g&&g.file.type.startsWith("image/")){const f=URL.createObjectURL(g.file);return l(f),()=>URL.revokeObjectURL(f)}l(null)},[g]),d.useEffect(()=>{if(!s)return;const f=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),i("prev");break;case"ArrowRight":k.preventDefault(),i("next");break;case"Escape":k.preventDefault(),n();break}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,i,n]),g?o.jsx(qr,{ref:r,headingText:g.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>i("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!c?o.jsx("img",{src:a,alt:`${g.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>p(!0)}):o.jsx(R,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),b&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>i("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});kl.displayName="ImagePreviewModal";const Pm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},zr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",Am=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(i=>!e||i.symbol!==e.symbol).map(i=>o.jsx(Om,{operation:i,onActivate:t,transferItem:n},i.symbol.toString()))}),Im=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx(o.Fragment,{children:s.filter(i=>i.renderContent).map(i=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:i.renderContent(n,()=>t(n.fileId,i),(e==null?void 0:e.symbol)===i.symbol)},i.symbol.toString()))}),Lm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:i,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),p=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(n,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),p.length>0&&o.jsx(Am,{operations:p,activatedOperation:e,onActivate:i,transferItem:s}),o.jsx(Im,{operations:t,activatedOperation:e,onActivate:i,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},Bm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,enableImagePreview:i,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:c})=>{const p=zr(s.progress),g=i&&s.progress==="done"&&Pm(s);switch(p){case"in-progress":return o.jsx(Tm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(Dm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(Lm,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:r,onClose:a,onPreviewClick:g?()=>c(s.fileId):void 0})}},Fm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Vm=(s,e,t)=>d.useMemo(()=>{const n=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),i={"in-progress":0,error:1,idle:2};return n.sort((r,a)=>i[zr(r.progress)]-i[zr(a.progress)])},[s,e,t]),Um=(s,e)=>d.useMemo(()=>e?s.filter(t=>t.progress==="done"&&Fm(t)):[],[s,e]),Hm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:n=[],ItemRenderer:i=vl,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const c=Vm(s,t,l),p=Um(c,a),g=_m(n),b=ym(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(bl.Provider,{value:{tail:r},children:c.map(f=>o.jsxs("li",{className:ke("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof f.progress=="number",[`pkt-fileupload__queue-display__item--${f.progress}`]:typeof f.progress=="string"}),children:[n.filter(k=>k.renderHidden).map(k=>k.renderHidden(f)),o.jsx(Bm,{transferItem:f,activatedOperation:g.getActivated(f.fileId),operations:n,ItemRenderer:i,enableImagePreview:a,onActivate:g.activate,onClose:g.close,onCancelTransfer:e,onOpenPreview:b.open})]},f.fileId))})}),a&&p.length>0&&o.jsx(kl,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},Yr={filename:vl,thumbnail:Em},yl=d.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:n=!1,uploadStrategy:i="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:c,onFileUploadRequested:p,extraOperations:g=[],itemRenderer:b=Yr.filename,fullWidth:f=!1,allowedFormats:k,formatErrorMessage:v,maxFileSize:$,sizeErrorMessage:M,onFileValidation:S,errorMessage:T,hasError:L=!1,disabled:D=!1,label:Y,helptext:ee,optionalTag:oe,requiredTag:ye,enableImagePreview:K=!1,...N},q)=>{const B="transfers"in N?N.transfers:void 0,[G,le]=d.useState(null),ae=L||!!G,pe=T||G,ue=$?Sm($):void 0,be=d.useCallback(V=>{var te;if(k&&k.length>0){const me=((te=V.name.split(".").pop())==null?void 0:te.toLowerCase())||"",fe=V.type.toLowerCase();if(!k.some(Ke=>{const m=Ke.toLowerCase().replace(/^\./,"");if(m.includes("/")){if(m.endsWith("/*")){const h=m.replace("/*","");return fe.startsWith(h+"/")}return fe===m}return me===m})){const Ke=k.join(", "),m=`Ugyldig filtype. Tillatte formater: ${Ke}`;return(v==null?void 0:v.replace("{formats}",Ke))||m}}if(ue&&V.size>ue){const me=Yi(ue),fe=`Filen er for stor. Maks størrelse er ${me}.`;return(M==null?void 0:M.replace("{maxSize}",me))||fe}return S?S(V):null},[k,v,ue,M,S]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&c===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const re=s!==void 0?s:e||[],Ue=typeof b=="string"?Yr[b]:b,Q=b==="thumbnail",P=typeof N.accept=="string"?N.accept.trim():void 0,Me=d.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const te=V.toLowerCase();return te.includes("/")||te.startsWith(".")?te:`.${te}`}).join(", ")},[k]),De=P||Me,ne=a&&!Q,He=r&&!Q,Pe=d.useCallback(V=>{for(const me of V){const fe=be(me.file);if(fe){le(fe);return}}le(null);const te=n?[...re,...V]:[V[0]];c&&c(te),i==="custom"&&p&&V.forEach(me=>{p==null||p(me)})},[c,re,n,i,p,be]),$e=d.useCallback((V,te)=>{const me=re.map(fe=>fe.fileId===V?{...fe,...te}:fe);c&&c(me)},[c,re]),Te=d.useCallback(V=>{var me;const te=re.filter(fe=>fe.fileId!==V);c&&c(te),"onTransferCancelled"in N&&N.onTransferCancelled&&((me=N.onTransferCancelled)==null||me.call(N,V))},[c,re,N]),{fileAttributes:Ae}=km(re,$e),ze=d.useMemo(()=>[{op:vm,enabled:ne},{op:V=>hm(V),enabled:He}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...g),[ne,He]),We=d.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ve,uploadedCount:E,failedCount:Ie}=d.useMemo(()=>{const V=re.length;if(!B)return{totalCount:V,uploadedCount:0,failedCount:0};let te=0,me=0;for(const fe of re){const Xe=B.find(Ke=>Ke.fileId===fe.fileId);(Xe==null?void 0:Xe.progress)==="done"&&te++,(Xe==null?void 0:Xe.progress)==="error"&&me++}return{totalCount:V,uploadedCount:te,failedCount:me}},[re,B]),Ye=ve===1?"fil":"filer",U=o.jsx("div",{className:ke("pkt-fileupload",{"pkt-fileupload--full-width":f,"pkt-fileupload--error":ae,"pkt-fileupload--disabled":D}),"aria-disabled":D,...D?{inert:""}:{},children:o.jsxs(Hr.Provider,{value:{name:N.name||"",multiple:!!n,id:t},children:[o.jsx("div",{id:We.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ve>0&&E>0&&`${E} av ${ve} ${Ye} lastet opp`}),o.jsx("div",{id:We.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ve>0&&Ie>0&&`Feil ved opplasting: ${Ie} av ${ve} ${Ye} feilet`}),o.jsx(rm,{id:t,name:N.name||"",value:re,onFilesAdded:Pe,multiple:n,uploadStrategy:i,ref:q,accept:Q?".jpeg, .jpg, .png, .gif, .webp, .heic":De,isThumbnailView:Q,disabled:D,srAnnouncementIds:We}),ae&&pe&&o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:pe}),o.jsx(Hm,{files:re,cancelTransfer:Te,truncateTail:l,transfers:B,uploadStrategy:i,ItemRenderer:Ue,enableImagePreview:Q&&K,queueItemOperations:ze.map(V=>V(Ae)).concat(fm(Te))})]})});return Y?o.jsx(Ts,{forId:t,label:Y,helptext:ee,disabled:D,hasError:ae,optionalTag:oe,requiredTag:ye,className:ke("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":f}),children:U}):U});yl.displayName="PktFileUpload";const jm=({columnOne:s,columnTwo:e,socialLinks:t,className:n,openLinksInNewTab:i=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:c=null,googleAnalyticsId:p=null,devMode:g=!1,cookieDomain:b=null,cookieSecure:f=null,cookieExpiryDays:k=null,onToggleConsent:v=$=>{console.log($.detail)}})=>{var M,S;const $=[n,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(M=s.links)==null?void 0:M.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(S=e.links)==null?void 0:S.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:c,googleAnalyticsId:p,devMode:g,cookieDomain:b,cookieSecure:f,cookieExpiryDays:k,onToggleConsent:v})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(T=>T.language).map((T,L)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:T.href,"aria-label":`til ${T.language} versjon av nettsiden`,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:T.language})},`sociallinks-language-${L}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(T=>T.iconName).map((T,L)=>o.jsx(d.Fragment,{children:o.jsx("a",{href:T.href,"aria-label":`til ${T.iconName}`,className:"pkt-footer__social-icon-link",target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:o.jsx(R,{className:"pkt-footer__social-icon",name:T.iconName})})},`sociallinks-${L}`))})]})]})})},qm=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:n="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:i=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:c=null,cookieSecure:p=null,cookieExpiryDays:g=null,onToggleConsent:b=k=>{console.log(k.detail)},className:f})=>{const k=[f,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((v,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${v.external?" pkt-link--external":""}`,href:v.href,target:v.openInNewTab||e?"_blank":"_self",rel:v.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),v.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:n,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),i&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:c,cookieSecure:p,cookieExpiryDays:g,onToggleConsent:b})})]})})})},Wm=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[n,i]=d.useState(t);return d.useEffect(()=>{const r=s.current;if(!r)return;if(i(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&i(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const c of l)c.borderBoxSize&&c.borderBoxSize.length>0?i(c.borderBoxSize[0].inlineSize):i(c.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),n};function zm(s){const e=d.useRef(0);d.useEffect(()=>{const t=document.body,n=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const i=window.innerWidth-n.clientWidth;i>0&&(t.style.paddingRight=`${i}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",n.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const Ki=({href:s,iconName:e,className:t,iconPosition:n,external:i,target:r,children:a,...l})=>{const c={"pkt-link":!0,"pkt-link--icon-left":!!e&&n==="left"||!!(e&&!n),"pkt-link--icon-right":!!e&&n==="right","pkt-link--external":i};return o.jsxs("a",{...l,className:ke(c,t),href:s,target:r,rel:i?"noopener noreferrer":void 0,children:[e&&o.jsx(R,{name:e,className:"pkt-link__icon"}),a]})};Ki.displayName="PktLink";const Ym=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},Gi=({item:s,className:e})=>"href"in s?o.jsx(Ki,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:ke("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:ke("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(R,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),Km=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:e})},t))}),_l=d.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:n,canChangeRepresentation:i,changeRepresentation:r,logoutOnClick:a},l)=>{const c=n==null?void 0:n.map(Ym);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),c&&c.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Km,{links:c})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),i&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&i&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Gi,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});_l.displayName="PktHeaderUserMenu";const Xi=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:n="off",counter:i,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:c,hasError:p=!1,helptext:g,helptextDropdown:b,helptextDropdownButton:f,iconNameRight:k,inline:v=!1,fullwidth:$=!1,label:M,name:S,optionalTag:T=!1,optionalText:L,requiredTag:D=!1,requiredText:Y,tagText:ee=null,placeholder:oe,prefix:ye,suffix:K,type:N="text",useWrapper:q=!0,omitSearchIcon:B=!1,value:G,minLength:le,maxLength:ae,min:pe,max:ue,step:be,size:se,readonly:re,required:Ue,dataTestid:Q,onChange:P,skipForwardTestid:Me=!1,...De},ne)=>{const He=[a,"pkt-textinput"].join(" "),Pe=N==="search"&&!k&&!B,$e=N==="date"&&G?G.slice(0,10):G,[Te,Ae]=d.useState((G==null?void 0:G.length)||0),ze=`${s}`,We=`${ze}-label`,ve=t||We,E=Ie=>{var Ye,U;i&&Ae(((U=(Ye=Ie.currentTarget)==null?void 0:Ye.value)==null?void 0:U.length)||0),P&&P(Ie)};return d.useEffect(()=>{G!==void 0&&Ae((G==null?void 0:G.length)||0)},[G]),o.jsx(Ts,{ariaDescribedby:e,className:He,disabled:l,errorMessage:c,forId:ze,hasError:p,helptext:g,helptextDropdown:b,helptextDropdownButton:f,inline:v,label:M,optionalTag:T,optionalText:L,requiredTag:D,requiredText:Y,tagText:ee,useWrapper:q,counter:i,counterCurrent:Te,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":Q,"data-skip-forward-testid":Me?"true":void 0,children:[ye&&o.jsx("div",{className:"pkt-input-prefix",children:ye}),o.jsx("input",{...De,ref:ne,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Te>r?"pkt-input--counter-error":""}`,type:N,name:`${S||s}`,value:$e,id:ze,placeholder:oe,autoComplete:n,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ve,min:pe,max:ue,onChange:E,step:be,minLength:le,maxLength:ae,size:se,readOnly:re,required:Ue}),K&&o.jsxs("p",{className:"pkt-input-suffix",children:[K,k&&o.jsx(R,{className:"pkt-input-suffix-icon",name:k}),Pe&&o.jsx(R,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!K&&k&&o.jsx(R,{className:"pkt-input-icon",name:k}),!K&&Pe&&o.jsx(R,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});Xi.displayName="PktTextinput";const Kr=d.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:n,compact:i=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:c,showSearch:p=!1,onSearch:g,onSearchChange:b,searchValue:f,searchPlaceholder:k="Søk",representing:v,serviceLink:$,serviceClick:M,serviceName:S,user:T,userMenu:L,userMenuFooter:D,userOptions:Y,canChangeRepresentation:ee=!1,changeRepresentation:oe,hideLogo:ye=!1,logoLink:K,logoClick:N,position:q="fixed",scrollBehavior:B="hide",slotMenuVariant:G="icon-only",slotMenuText:le="Meny"},ae)=>{const pe=q==="fixed",ue=B==="hide";d.useEffect(()=>{D&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[D]),d.useEffect(()=>{Y&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[Y]),d.useEffect(()=>{T!=null&&T.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),v!=null&&v.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[T==null?void 0:T.shortname,v==null?void 0:v.shortname]);const be=d.useMemo(()=>{if(T!=null&&T.lastLoggedIn)return typeof T.lastLoggedIn=="string"?T.lastLoggedIn:new Date(T.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[T==null?void 0:T.lastLoggedIn]),[se,re]=d.useState(c||"none");d.useEffect(()=>{c!==void 0&&re(c)},[c]);const[Ue,Q]=d.useState(!1),[P,Me]=d.useState(0),[De,ne]=d.useState(!1),[He,Pe]=d.useState(!1),$e=d.useRef(null),Te=d.useRef(null),Ae=d.useRef(null),ze=d.useRef(null),We=d.useRef(null),ve=d.useRef(null),E=d.useRef(null),Ie=d.useRef(!1),Ye=Wm($e),U=Ye<s,V=Ye<e,te=d.useCallback(h=>{$e.current=h,typeof ae=="function"?ae(h):ae&&(ae.current=h)},[ae]);zm(pe&&U&&se!=="none");const me=d.useCallback((h,_)=>{const C=h.relatedTarget;let j;switch(_){case"user":j=Te;break;case"slot":j=Ae;break;case"search":j=ze;break;default:return}const W=j.current;W&&(!C||!W.contains(C))&&re("none")},[]),fe=d.useCallback(()=>{Ie.current&&E.current&&document.contains(E.current)&&E.current.focus(),E.current=null,Ie.current=!1},[]);d.useEffect(()=>{const h=C=>{T&&se==="user"&&!C.target.closest(".pkt-header-service__user-container")&&re("none"),se==="slot"&&!C.target.closest(".pkt-header-service__slot-container")&&re("none"),se==="search"&&!C.target.closest(".pkt-header-service__search-container")&&!C.target.closest(".pkt-header-service__search-input")&&re("none")},_=C=>{C.key==="Escape"&&se!=="none"&&(C.preventDefault(),Ie.current=!0,re("none"))};if(se!=="none")return document.addEventListener("mousedown",h),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",_)};fe()},[se,T,fe]),d.useEffect(()=>{const h=()=>{if(ue){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-P)<60)return;Q(_>P),Me(_)}};return document&&window.addEventListener("scroll",h),()=>{document&&window.removeEventListener("scroll",h)}},[ue,P]);const Xe=d.useCallback(h=>{const _=h==="slot"?Ae:ze,C=h==="slot"?We:ve;if(!_.current||!C.current||!V||U)return;const j=_.current.getBoundingClientRect(),W=C.current.offsetWidth,de=j.left+W>window.innerWidth;h==="slot"?ne(de):Pe(de)},[V,U]),Ke=d.useCallback(h=>{se!=="none"?re("none"):(E.current=document.activeElement,re(h))},[se]);d.useEffect(()=>{(se==="slot"||se==="search")&&requestAnimationFrame(()=>{Xe(se)})},[se,Xe]);const m=o.jsxs("header",{className:ke("pkt-header-service",i&&"pkt-header-service--compact",U&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",pe&&"pkt-header-service--fixed",ue&&"pkt-header-service--scroll-to-hide",Ue&&"pkt-header-service--hidden",n),"data-mode":r,ref:te,children:[o.jsxs("div",{className:ke("pkt-header-service__logo-area",(!S||S==="")&&"pkt-header-service__logo-area--without-service"),children:[!ye&&o.jsx("span",{className:"pkt-header-service__logo",children:K?o.jsx("a",{href:K,"aria-label":"Tilbake til forside",children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):N?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:N,children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}),S&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(Ki,{href:$,className:"pkt-header-service__service-link ",children:S}):M?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:M,children:S}):o.jsx("span",{className:"pkt-header-service__service-link",children:S})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:ke("pkt-header-service__slot-container",se==="slot"&&"is-open"),onBlur:h=>me(h,"slot"),ref:Ae,children:[V&&t&&o.jsx(gt,{skin:"secondary",variant:G,iconName:"menu",size:U?"small":"medium",state:se==="slot"?"active":"normal",onClick:()=>Ke("slot"),"aria-expanded":se==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:le}),o.jsx("div",{className:ke("pkt-header-service__slot-content",De&&"align-right"),id:"mobile-slot-menu",role:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:We,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:ke("pkt-header-service__search-container",se==="search"&&"is-open"),onBlur:h=>me(h,"search"),ref:ze,children:[o.jsx(gt,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:U?"small":"medium",onClick:()=>Ke("search"),state:se==="search"?"active":"normal","aria-expanded":se==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:ke("pkt-header-service__mobile-menu",se==="search"&&"is-open",He&&"align-right"),ref:ve,children:se==="search"&&o.jsx(Xi,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,autoFocus:!0,fullwidth:!0,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})})]}):o.jsx(Xi,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"secondary",size:U?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[T&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:h=>me(h,"user"),ref:Te,children:[o.jsxs(gt,{className:ke("pkt-header-service__user-button",U&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:U?"small":"medium",state:se==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:se==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ke("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(v==null?void 0:v.name)||T.name]}),se==="user"&&T&&o.jsx("div",{className:ke(U?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(_l,{user:T,formattedLastLoggedIn:be,representing:v,userMenu:L,canChangeRepresentation:ee,changeRepresentation:oe,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!U&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return pe?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[m,o.jsx("div",{className:ke("pkt-header-service-spacer",i&&"pkt-header-service-spacer--compact",T&&"pkt-header-service-spacer--has-user",U&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):m});Kr.displayName="PktHeaderService";const wl=d.forwardRef((s,e)=>o.jsx(Kr,{...s,ref:e}));wl.displayName="PktHeader";const Gm=os({tagName:"pkt-heading",elementClass:_s,react:d,displayName:"PktHeading"}),$l=d.forwardRef(({children:s,...e},t)=>o.jsx(Gm,{"data-testid":"pkt-heading",...e,ref:t,children:s}));$l.displayName="PktHeading";const Xm=os({tagName:"pkt-helptext",elementClass:us,react:d,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),xl=d.forwardRef(({children:s,...e},t)=>o.jsx(Xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));xl.displayName="PktHelptext";const Sl=d.forwardRef(({label:s,id:e,children:t,...n},i)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...n,ref:i}),t]}));Sl.displayName="PktInput";const Cl=({children:s,skin:e,title:t,href:n,iconName:i,openInNewTab:r,external:a,className:l,...c})=>{const p=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),g=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...c,href:n,className:ke(p,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[i&&o.jsx(R,{className:"pkt-link__icon",name:i}),t&&o.jsx("div",{className:ke(g),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Cl.displayName="PktLinkCard";const Qm=os({tagName:"pkt-loader",elementClass:zt,react:d,displayName:"PktLoader",events:{}}),Tl=d.forwardRef(({children:s,...e},t)=>o.jsx(Qm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Tl.displayName="PktLoader";const Nl=({children:s,className:e,skin:t,title:n,compact:i,closable:r,onClose:a,...l})=>{const[c,p]=d.useState(!1),g={"pkt-messagebox":!0,"pkt-messagebox--compact":i,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":c},b=d.createRef(),f=d.useCallback(()=>{p(!0),a&&a()},[p,a]);return o.jsxs("div",{...l,className:ke(g,e),ref:b,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:f,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(R,{name:"close",className:"pkt-link__icon"})})}),n&&o.jsx("div",{className:"pkt-messagebox__title",children:n}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};Nl.displayName="PktMessagebox";const Zm=os({tagName:"pkt-progressbar",elementClass:Je,react:d,displayName:"PktProgressbar",events:{}}),Qi=d.forwardRef(({children:s,...e},t)=>o.jsx(Zm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));Qi.displayName="PktProgressbar";const Ml=d.forwardRef(({id:s,name:e,label:t,className:n,hasTile:i=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:c,checked:p,optionalTag:g,optionalText:b,requiredTag:f,requiredText:k,tagText:v,...$},M)=>{const S=[n,"pkt-input-check"].filter(Boolean).join(" "),T=["pkt-input-check__input",i?"pkt-input-check__input--tile":"",r&&i?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),L=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),D=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),Y=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),ee=()=>o.jsxs(o.Fragment,{children:[v&&o.jsx("span",{className:Y+" pkt-tag--gray",children:v}),g&&o.jsx("span",{className:Y+" pkt-tag--blue-light",children:b}),f&&o.jsx("span",{className:Y+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:S,children:o.jsxs("div",{className:T,children:[o.jsx("input",{ref:M,id:s,type:"radio",name:e,disabled:r,className:L,...p!==void 0?{checked:p}:{defaultChecked:c},...$}),o.jsxs("label",{className:D,htmlFor:s,children:[t," ",ee(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Ml.displayName="PktRadioButton";const Dl=d.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:n,label:i,name:r,placeholder:a="Søk…",suggestions:l,value:c="",action:p,method:g,onChange:b,onSearch:f,onSuggestionClick:k,...v},$)=>{const M=(D,Y)=>{D?D():k&&k(Y)},S=D=>{c=D.target.value},T=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let L;return p?L=D=>o.jsx("form",{role:"search",className:T,action:p,method:g,children:D}):L=D=>o.jsx("div",{role:"search",className:T,children:D}),L(o.jsxs(o.Fragment,{children:[i&&o.jsx("label",{htmlFor:i?n:void 0,className:i?"pkt-inputwrapper__label":"",children:i}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||n,id:n,placeholder:a,defaultValue:c,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${n}-suggestions`,onChange:b||S,onKeyUp:f&&(D=>{D.key==="Enter"&&(D.preventDefault(),f(c))}),...v}),o.jsx(gt,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:f&&(D=>{D.preventDefault(),f(c)}),children:i||a})]}),l&&o.jsx("ul",{id:`${n}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((D,Y)=>o.jsx("li",{children:d.createElement(D.href?"a":D.onClick?"button":"div",{href:D.href,className:`pkt-searchinput__suggestion ${D.onClick?"pkt-link-button":""} ${D.href||D.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:D.onClick?"button":void 0,onClick:()=>M(D.onClick,Y),onKeyUp:ee=>ee.key==="Enter"&&M(D.onClick,Y)},o.jsxs(o.Fragment,{children:[D.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:D.title}),D.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:D.text})]}))},`search-suggestion-${Y}`))})]}))});Dl.displayName="PktSearchInput";const Ol=d.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:n,disabled:i=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:c,helptextDropdownButton:p,id:g,inline:b=!1,fullwidth:f=!1,label:k,name:v,optionalTag:$=!1,optionalText:M,requiredTag:S=!1,requiredText:T,tagText:L,...D},Y)=>{const ee=[n,"pkt-select"].join(" ");return o.jsx(Ts,{className:ee,forId:`${g}-input`,label:k,helptext:l,helptextDropdown:c,helptextDropdownButton:p,optionalTag:$,optionalText:M,requiredTag:S,requiredText:T,tagText:L,hasError:a,errorMessage:r,disabled:i,inline:b,ariaDescribedby:s,children:o.jsx("select",{ref:Y,className:`pkt-input ${f?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${g}-error`,"aria-labelledby":e||void 0,disabled:i,id:`${g}-input`,name:v||g,...D,children:t})})});Ol.displayName="PktSelect";const Jm=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),Rm=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),eb=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),tb=({children:s,className:e,status:t="incomplete",title:n})=>o.jsxs("li",{className:ke("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:ke("pkt-step__indicator"),children:t==="current"?Rm:t==="completed"?eb:Jm}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:n}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),El=d.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:n=!1,hideNonActiveStepsContent:i=!0,orientation:r="vertical",...a},l)=>{const c=ke(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),p=d.Children.map(t,(g,b)=>d.isValidElement(g)?d.cloneElement(g,{className:ke(g.props.className,{"pkt-step--hideStep":n&&b!==s,"pkt-step--hideContent":i&&b!==s})}):g);return o.jsx("ol",{"data-testid":"pkt-stepper",className:c,ref:l,...a,children:p})});El.displayName="PktStepper";const sb=({className:s,compact:e=!1,skin:t="basic",responsiveView:n=!0,children:i,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:ke(s,"pkt-table",{"pkt-table--responsive":n,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:i}),nb=({id:s,children:e,className:t,...n})=>o.jsx("tbody",{id:s,className:ke(t,"pkt-table__body",{}),...n,role:"rowgroup",children:e}),ib=({children:s,className:e,dataLabel:t,...n})=>o.jsx("td",{className:ke(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...n,children:s}),rb=({className:s,children:e,...t})=>o.jsx("thead",{className:ke(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),ab=({className:s,children:e,...t})=>o.jsx("th",{className:ke(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),ob=({className:s,children:e,...t})=>o.jsx("tr",{className:ke(s,"pkt-table__row",{}),role:"row",...t,children:e}),Gr=d.forwardRef(({children:s,active:e,href:t,onClick:n,icon:i,controls:r,tag:a,tagSkin:l,index:c=0},p)=>{const{arrowNav:g,registerTabRef:b,handleKeyPress:f,selectTab:k}=lb(),$={"aria-selected":g?!!e:void 0,"aria-controls":r,role:g?"tab":void 0,onKeyUp:S=>f(c,S),onClick:S=>{k(c),n==null||n(S)},tabIndex:e||!g?void 0:-1,ref:S=>{b(c,S),typeof p=="function"?p(S):p&&(p.current=S)}},M=o.jsxs(o.Fragment,{children:[i&&o.jsx(R,{name:i,className:"pkt-icon--small"}),s,a&&o.jsx(Qs,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:M}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:M})});Gr.displayName="PktTabItem";const Pl=d.createContext(null),lb=()=>{const s=d.useContext(Pl);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Al=d.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:n,children:i},r)=>{const a=d.useRef([]),l=s&&!e,p=i&&d.Children.count(i)>0?d.Children.count(i):(t==null?void 0:t.length)||0;d.useEffect(()=>{a.current=a.current.slice(0,p)},[p]);const g=v=>{const $=t==null?void 0:t[v];$!=null&&$.action&&$.action(v),n&&n(v)},b=(v,$)=>{var M,S;l&&($.code==="ArrowLeft"&&v!==0&&((M=a.current[v-1])==null||M.focus()),$.code==="ArrowRight"&&v<p-1&&((S=a.current[v+1])==null||S.focus()),($.code==="ArrowDown"||$.code==="Space")&&g(v))},f=(v,$)=>{a.current[v]=$},k=t==null?void 0:t.map((v,$)=>{var M,S;return o.jsx(Gr,{active:v.active,href:v.href,onClick:()=>g($),icon:v.icon,controls:v.controls,tag:(M=v.tag)==null?void 0:M.text,tagSkin:(S=v.tag)==null?void 0:S.skin,index:$,children:v.text},$)});return o.jsx(Pl.Provider,{value:{arrowNav:l,registerTabRef:f,handleKeyPress:b,selectTab:g},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:i||k})})})});Al.displayName="PktTabs";var _n=window.CustomEvent;(!_n||typeof _n=="object")&&(_n=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},_n.prototype=window.Event.prototype);function Il(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function cb(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(n,i){return!(e[n]===void 0||e[n]===i)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Ll(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function ub(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function Xr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Bl(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var n=s.querySelector(t.join(", "));if(!n&&"attachShadow"in Element.prototype)for(var i=s.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(n=Bl(i[r].shadowRoot),n));r++);return n}function Fl(s){return s.isConnected||document.body.contains(s)}function Vl(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=_e.formSubmitter;if(!t){var n=s.target,i="getRootNode"in n&&n.getRootNode()||document;t=i.activeElement}return!t||t.form!==e?null:t}function db(s){if(!s.defaultPrevented){var e=s.target,t=_e.imagemapUseValue,n=Vl(s);t===null&&n&&(t=n.value);var i=li(e);if(i){var r=n&&n.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?i.close(t):i.close())}}}function Ul(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",db,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,n=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),i,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(i),i=window.setTimeout(n,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Ul.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Fl(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),_e.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Bl(this.dialog_)),Ll(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Fl(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!_e.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");cb(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,_e.needsCentering(this.dialog_)?(_e.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new _n("close",{bubbles:!1,cancelable:!1});Il(this.dialog_,e)}};var _e={};if(_e.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},_e.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],n=null;try{n=t.cssRules}catch{}if(n)for(var i=0;i<n.length;++i){var r=n[i],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!ub(a,s))){var l=r.style.getPropertyValue("top"),c=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||c&&c!=="auto")return!0}}}return!1},_e.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!_e.isInlinePositionSetByStylesheet(s)},_e.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Ul(s)},_e.registerDialog=function(s){s.showModal||_e.forceRegisterDialog(s)},_e.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(n){for(var i=0,r;r=n.removedNodes[i];++i){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},_e.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},_e.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},_e.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var n=this.pendingDialogStack[0];if(n){var i=n.dialog.parentNode||document.body;i.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},_e.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},_e.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Ll(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],n=t.dialog,i=n.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},_e.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new _n("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&Il(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},_e.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},_e.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},_e.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},_e.dm=new _e.DialogManager,_e.formSubmitter=null,_e.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Hl=document.createElement("form");if(Hl.setAttribute("method","dialog"),Hl.method!=="dialog"){var wn=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(wn){var hb=wn.get;wn.get=function(){return Xr(this)?"dialog":hb.call(this)};var pb=wn.set;wn.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):pb.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",wn)}}document.addEventListener("click",function(s){if(_e.formSubmitter=null,_e.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!Xr(e.form))){var n=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!n){if(!(e.localName==="input"&&e.type==="image"))return;_e.imagemapUseValue=s.offsetX+","+s.offsetY}var i=li(e);i&&(_e.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=li(e);if(!t){var n=Vl(s),i=n&&n.getAttribute("formmethod")||e.getAttribute("method");i==="dialog"&&s.preventDefault()}});var fb=HTMLFormElement.prototype.submit,gb=function(){if(!Xr(this))return fb.call(this);var s=li(this);s&&s.close()};HTMLFormElement.prototype.submit=gb}const mb=Object.freeze(Object.defineProperty({__proto__:null,default:_e},Symbol.toStringTag,{value:"Module"}));H.FileItem=gl,H.ItemRenderers=Yr,H.PktAccordion=na,H.PktAccordionItem=Mo,H.PktAlert=Bi,H.PktBackLink=Oo,H.PktBreadcrumbs=Eo,H.PktButton=gt,H.PktCalendar=Vr,H.PktCard=nl,H.PktCheckbox=il,H.PktCombobox=ul,H.PktConsent=Wi,H.PktDatepicker=pl,H.PktFileUpload=yl,H.PktFooter=jm,H.PktFooterSimple=qm,H.PktHeader=wl,H.PktHeaderService=Kr,H.PktHeading=$l,H.PktHelptext=xl,H.PktIcon=R,H.PktInput=Sl,H.PktInputWrapper=Ts,H.PktLink=Ki,H.PktLinkCard=Cl,H.PktLoader=Tl,H.PktMessagebox=Nl,H.PktModal=qr,H.PktProgressbar=Qi,H.PktRadioButton=Ml,H.PktSearchInput=Dl,H.PktSelect=Ol,H.PktStep=tb,H.PktStepper=El,H.PktTabItem=Gr,H.PktTable=sb,H.PktTableBody=nb,H.PktTableDataCell=ib,H.PktTableHeader=rb,H.PktTableHeaderCell=ab,H.PktTableRow=ob,H.PktTabs=Al,H.PktTag=Qs,H.PktTextarea=jr,H.PktTextinput=Xi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|