@oslokommune/punkt-react 15.4.2 → 15.4.3
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
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [15.4.3](https://github.com/oslokommune/punkt/compare/15.4.2...15.4.3) (2026-02-26)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* Diverse datepicker-bugs (#3309).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [15.4.2](https://github.com/oslokommune/punkt/compare/15.4.1...15.4.2) (2026-02-25)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -7405,9 +7405,7 @@ let ze = class extends W {
|
|
|
7405
7405
|
n && s && typeof n.handleDateSelect == "function" ? n.handleDateSelect(s) : (t = this.calRef.value) == null || t.handleDateSelect(s);
|
|
7406
7406
|
}}
|
|
7407
7407
|
></pkt-date-tags>` : $}
|
|
7408
|
-
<div
|
|
7409
|
-
class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
|
|
7410
|
-
>
|
|
7408
|
+
<div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
|
|
7411
7409
|
${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
|
|
7412
7410
|
</div>
|
|
7413
7411
|
</pkt-input-wrapper>
|
|
@@ -12790,7 +12788,7 @@ function Af(i, e) {
|
|
|
12790
12788
|
const D = Cf(f);
|
|
12791
12789
|
return Object.entries(D).filter(([, E]) => E).map(([E]) => E).join(" ");
|
|
12792
12790
|
}, [f]), V = Pe(
|
|
12793
|
-
() => ["pkt-datepicker__inputs", h &&
|
|
12791
|
+
() => ["pkt-datepicker__inputs", h && "pkt-input__range-inputs"].filter(Boolean).join(" "),
|
|
12794
12792
|
[h, f]
|
|
12795
12793
|
), Z = Pe(() => {
|
|
12796
12794
|
if (_) return _;
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1015,9 +1015,7 @@
|
|
|
1015
1015
|
id-base=${this.id}
|
|
1016
1016
|
@date-tag-removed=${e=>{var t;const i=this.datepickerPopupRef.value,n=ts(e.detail);i&&n&&typeof i.handleDateSelect=="function"?i.handleDateSelect(n):(t=this.calRef.value)==null||t.handleDateSelect(n)}}
|
|
1017
1017
|
></pkt-date-tags>`:w}
|
|
1018
|
-
<div
|
|
1019
|
-
class="pkt-datepicker__inputs ${this.range&&this.showRangeLabels?"pkt-input__range-inputs":""}"
|
|
1020
|
-
>
|
|
1018
|
+
<div class="pkt-datepicker__inputs ${this.range?"pkt-input__range-inputs":""}">
|
|
1021
1019
|
${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
|
|
1022
1020
|
</div>
|
|
1023
1021
|
</pkt-input-wrapper>
|
|
@@ -1690,4 +1688,4 @@
|
|
|
1690
1688
|
Copyright (c) 2018 Jed Watson.
|
|
1691
1689
|
Licensed under the MIT License (MIT), see
|
|
1692
1690
|
http://jedwatson.github.io/classnames
|
|
1693
|
-
*/var Pa;function Ch(){return Pa||(Pa=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})()})(Yn)),Yn.exports}var Th=Ch();const oe=Sh(Th),rn=({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]})]})})};rn.displayName="PktAlert";const Aa=It({tagName:"pkt-backlink",elementClass:Hs,react:h,displayName:"PktBackLink"});Aa.displayName="PktBackLink";const Ia=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(zo.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})]})});Ia.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 La=6048e5,Nh=864e5,Ba=Symbol.for("constructDateFrom");function jt(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 kt(s,e){return jt(e||s,s)}function Fa(s,e,t){const i=kt(s,t==null?void 0:t.in);return isNaN(e)?jt(s,NaN):(e&&i.setDate(i.getDate()+e),i)}let Mh={};function an(){return Mh}function Ti(s,e){var l,d,p,m;const t=an(),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=kt(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 on(s,e){return Ti(s,{...e,weekStartsOn:1})}function Ha(s,e){const t=kt(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=on(n),a=jt(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=on(a);return t.getTime()>=r.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function Va(s){const e=kt(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 Ua(s,...e){const t=jt.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function Kn(s,e){const t=kt(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function Dh(s,e,t){const[i,n]=Ua(t==null?void 0:t.in,s,e),r=Kn(i),a=Kn(n),l=+r-Va(r),d=+a-Va(a);return Math.round((l-d)/Nh)}function Oh(s,e){const t=Ha(s,e),i=jt(s,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),on(i)}function Eh(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Ph(s){return!(!Eh(s)&&typeof s!="number"||isNaN(+kt(s)))}function Ah(s,e){const t=kt(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Ih(s,e){const[t,i]=Ua(s,e.start,e.end);return{start:t,end:i}}function ja(s,e){const{start:t,end:i}=Ih(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 Lh(s,e){const t=kt(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Bh={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"}},Fh=(s,e,t)=>{let i;const n=Bh[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 Gn(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const Hh={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Vh={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Uh={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jh={date:Gn({formats:Hh,defaultWidth:"full"}),time:Gn({formats:Vh,defaultWidth:"full"}),dateTime:Gn({formats:Uh,defaultWidth:"full"})},qh={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Wh=(s,e,t,i)=>qh[s];function Ni(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 zh={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Yh={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Kh={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"]},Gh={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"]},Xh={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"}},Qh={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"}},Zh={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:Ni({values:zh,defaultWidth:"wide"}),quarter:Ni({values:Yh,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Ni({values:Kh,defaultWidth:"wide"}),day:Ni({values:Gh,defaultWidth:"wide"}),dayPeriod:Ni({values:Xh,defaultWidth:"wide",formattingValues:Qh,defaultFormattingWidth:"wide"})};function Mi(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)?Rh(l,b=>b.test(a)):Jh(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 Jh(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Rh(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function ep(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 tp=/^(\d+)(th|st|nd|rd)?/i,sp=/\d+/i,ip={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},np={any:[/^b/i,/^(a|c)/i]},rp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ap={any:[/1/i,/2/i,/3/i,/4/i]},op={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},lp={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]},cp={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},dp={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]},up={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},hp={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}},pp={ordinalNumber:ep({matchPattern:tp,parsePattern:sp,valueCallback:s=>parseInt(s,10)}),era:Mi({matchPatterns:ip,defaultMatchWidth:"wide",parsePatterns:np,defaultParseWidth:"any"}),quarter:Mi({matchPatterns:rp,defaultMatchWidth:"wide",parsePatterns:ap,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Mi({matchPatterns:op,defaultMatchWidth:"wide",parsePatterns:lp,defaultParseWidth:"any"}),day:Mi({matchPatterns:cp,defaultMatchWidth:"wide",parsePatterns:dp,defaultParseWidth:"any"}),dayPeriod:Mi({matchPatterns:up,defaultMatchWidth:"any",parsePatterns:hp,defaultParseWidth:"any"})},fp={code:"en-US",formatDistance:Fh,formatLong:jh,formatRelative:Wh,localize:Zh,match:pp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mp(s,e){const t=kt(s,e==null?void 0:e.in);return Dh(t,Lh(t))+1}function gp(s,e){const t=kt(s,e==null?void 0:e.in),i=+on(t)-+Oh(t);return Math.round(i/La)+1}function qa(s,e){var m,b,y,k;const t=kt(s,e==null?void 0:e.in),i=t.getFullYear(),n=an(),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=Ti(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=Ti(d,e);return+t>=+l?i+1:+t>=+p?i:i-1}function vp(s,e){var l,d,p,m;const t=an(),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=qa(s,e),r=jt((e==null?void 0:e.in)||s,0);return r.setFullYear(n,0,i),r.setHours(0,0,0,0),Ti(r,e)}function Wa(s,e){const t=kt(s,e==null?void 0:e.in),i=+Ti(t,e)-+vp(t,e);return Math.round(i/La)+1}function me(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 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)}},Zs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},za={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=qa(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=Ha(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 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 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=Wa(s,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):me(n,e.length)},I:function(s,e,t){const i=gp(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"}):as.d(s,e)},D:function(s,e,t){const i=mp(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 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"}):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"}):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 Ka(i);case"XXXX":case"XX":return Ms(i);case"XXXXX":case"XXX":default:return Ms(i,":")}},x:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"x":return Ka(i);case"xxxx":case"xx":return Ms(i);case"xxxxx":case"xxx":default:return Ms(i,":")}},O:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ya(i,":");case"OOOO":default:return"GMT"+Ms(i,":")}},z:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ya(i,":");case"zzzz":default:return"GMT"+Ms(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 Ya(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 Ka(s,e){return s%60===0?(s>0?"-":"+")+me(Math.abs(s)/60,2):Ms(s,e)}function Ms(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 Ga=(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"})}},Xa=(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"})}},bp={p:Xa,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Ga(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}}",Ga(i,e)).replace("{{time}}",Xa(n,e))}},yp=/^D+$/,kp=/^Y+$/,_p=["D","DD","YY","YYYY"];function $p(s){return yp.test(s)}function wp(s){return kp.test(s)}function xp(s,e,t){const i=Sp(s,e,t);if(console.warn(i),_p.includes(s))throw new RangeError(i)}function Sp(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 Cp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Tp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Np=/^'([^]*?)'?$/,Mp=/''/g,Dp=/[a-zA-Z]/;function Op(s,e,t){var m,b,y,k;const i=an(),n=i.locale??fp,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=kt(s,t==null?void 0:t.in);if(!Ph(l))throw new RangeError("Invalid time value");let d=e.match(Tp).map(g=>{const $=g[0];if($==="p"||$==="P"){const T=bp[$];return T(g,n.formatLong)}return g}).join("").match(Cp).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const $=g[0];if($==="'")return{isToken:!1,value:Ep(g)};if(za[$])return{isToken:!0,value:g};if($.match(Dp))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;(wp($)||$p($))&&xp($,e,String(s));const T=za[$[0]];return T(l,$,n.localize,p)}).join("")}function Ep(s){const e=s.match(Np);return e?e[1].replace(Mp,"'"):s}function Pp(s,e){const t=kt(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Ap(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 Xn={},Di={};function Ds(s,e){try{const i=(Xn[s]||(Xn[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return i in Di?Di[i]:Qa(i,i.split(":"))}catch{if(s in Di)return Di[s];const t=s==null?void 0:s.match(Ip);return t?Qa(s,t.slice(1)):NaN}}const Ip=/([+-]\d\d):?(\d\d)?/;function Qa(s,e){const t=+(e[0]||0),i=+(e[1]||0),n=+(e[2]||0)/60;return Di[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(Ds(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)),Ja(this),Qn(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=-Ds(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Qn(this),+this}[Symbol.for("constructDateFrom")](e){return new qt(+new Date(e),this.timeZone)}}const Za=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Za.test(s))return;const e=s.replace(Za,"$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),Lp(this),+this},qt.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Qn(this),+this}))});function Qn(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Ds(s.timeZone,s)*60))}function Lp(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()),Ja(s)}function Ja(s){const e=Ds(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(-(Ds(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=Ds(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=Ds(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} (${Ap(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 Bp=(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}`},Oi=s=>{if(!s)return null;const e=Wt(s);return isNaN(e.getTime())?null:e},Fp=(s,e)=>{const t=Qt(s);return isNaN(t.getTime())?"":Op(t,e)},Qt=(s="",e)=>{const t=typeof s=="string"?Wt(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Ah(t):Kn(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},Ei=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 Zn=null,Ra;const Hp=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Zn||Ra!==e)&&(Zn=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),Ra=e),Zn.format(s)},Vp=(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)},Up=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=ot(s);return e.includes(t)},jp=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},eo=(s,e,t,i,n)=>!(!s||isNaN(s.getTime())||!Vp(s,e,t)||i&&Up(s,i)||n&&jp(s,n)),qp=(s,e,t,i,n)=>s.filter(r=>{const a=Oi(r);return a&&eo(a,e,t,i,n)}),Wp=s=>s.slice().sort((e,t)=>{const i=Oi(e),n=Oi(t);return!i||!n?0:i.getTime()-n.getTime()}),zp=(s,e)=>{const t=Oi(s),i=Oi(e);return!t||!i?!1:t<=i};function to(s,e){const t=(e.excludedates??[]).map(i=>typeof i=="string"?i:ot(i));return!eo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function Yp(s,e,t,i){return!!(to(s,t)||!e&&i.multiple&&i.maxMultiple>0&&i.selectedCount>=i.maxMultiple)}function Kp(s,e,t){const i=Js(s,e,0);return!(t&&Qt(t)>i)}function Gp(s,e,t){const i=Js(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Qt(t)<i)}function so(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>Wt(e))}function io(s,e){const t=ja({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 no(s,e,t,i){if(e.length!==1)return!0;const n=ja({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(Pp(n[r]).toString()))return!1}return!0}function Jn(s,e){const t=ot(s);return e.includes(t)?e:[...e,t]}function Rn(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 ro(s,e,t){const i=ot(s);return e.includes(i)?Rn(s,e):t>0&&e.length>=t?e:Jn(s,e)}function Xp(s,e,t){const i=ot(s),n=so(e);if(e.includes(i))return e.indexOf(i)===0?[]:Rn(s,e);if(e.length>1)return[i];if(e.length===1){if(!no(s,n,t.excludedates,t.excludeweekdays))return[i];if(n[0]>s)return[i]}return Jn(s,e)}const Pi=7,Qp=6;function Zp(s,e){const t=Js(s,e,1),i=Js(s,e+1,0),n=(t.getDay()+Qp)%Pi,r=i.getDate(),a=Math.ceil((r+n)/Pi),d=Js(s,e,0).getDate(),p=Wa(t);return{firstDayOfMonth:t,lastDayOfMonth:i,startingDay:n,numDays:r,numRows:a,numDaysPrevMonth:d,initialWeek:p}}function Jp(s,e,t,i){const{startingDay:n,numDays:r}=i;return s===0&&e<n?"prev-month":t>r?"next-month":"current-month"}function Rp(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 ef={ArrowLeft:-1,ArrowRight:1,ArrowUp:-Pi,ArrowDown:Pi};function tf(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function sf(s,e,t){let i=Fa(s,e);if(!i)return null;let n=t(`button[data-date="${ot(i)}"]`);for(;n instanceof HTMLButtonElement&&n.dataset.disabled;)if(i=Fa(i,e),n=t(`button[data-date="${ot(i)}"]`),!n)return null;return i}function nf(s){return ef[s]??null}const rf={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 af(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(()=>({...rf,...k}),[k]),U=h.useMemo(()=>y?Wt(y):Bp(),[y]),X=h.useMemo(()=>l?l.map(f=>typeof f=="string"?Wt(f):f):[],[l]),te=e!==void 0,[$e,q]=h.useState([]),C=te?e:$e,H=h.useMemo(()=>so(C),[C]),[W,Q]=h.useState(0),[se,ie]=h.useState(0),[ue,ne]=h.useState({}),[ge,K]=h.useState(null),[G,Ae]=h.useState(null),re=h.useRef(null),ae=h.useRef([]),Re=h.useRef(0),Ve=h.useRef(!1),Se=h.useRef(!1),Ke=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=Ei(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())?Ei(U):u}else f=Ei(U);if((!f||isNaN(f.getTime()))&&(f=Ei(U)),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(io(H[0],H[1])):(!n||H.length<2)&&ne({})},[n,H]);const lt=h.useCallback(f=>{te||q(f),g==null||g(f)},[te,g]),we=h.useCallback(()=>{$==null||$()},[$]),Ne=h.useCallback((f,u)=>{Q(typeof f=="string"?parseInt(f):f),ie(typeof u=="string"?parseInt(u):u),Re.current=0,Ae(null),ae.current=[],Ve.current=!0},[]),Ge=h.useCallback(()=>{const f=se===0?11:se-1,u=se===0?W-1:W;Ne(u,f)},[W,se,Ne]),Xe=h.useCallback(()=>{const f=se===11?0:se+1,u=se===11?W+1:W;Ne(u,f)},[W,se,Ne]),et=h.useCallback(f=>to(f,Ke),[Ke]),ce=h.useCallback((f,u)=>Yp(f,u,Ke,{multiple:t,maxMultiple:i,selectedCount:C.length}),[Ke,t,i,C.length]),be=h.useCallback(()=>typeof C=="string"?C.split(","):C,[C]),Ie=h.useCallback(f=>{if(!n||H.length!==1||!no(f,H,X,d)||H[0]>=f){K(null);return}K(f),ne(io(H[0],f))},[n,H,X,d]),Me=h.useCallback(f=>{if(!f)return;let u;if(n)u=Xp(f,be(),{excludedates:X,excludeweekdays:d}),te||q(u),u.length===2?(g==null||g(u),we()):(u.length===1&&ne({}),g==null||g(u));else if(t)u=ro(f,be(),i),lt(u);else{const _=ot(f);C.includes(_)?u=[]:u=[_],lt(u),we()}},[n,t,i,be,C,X,d,te,lt,we,g]),xe=h.useCallback(f=>{const u=Jn(f,be());te||q(u),n&&u.length===2&&(g==null||g(u),we())},[be,te,n,g,we]),V=h.useCallback(f=>{const u=Rn(f,be());te||q(u)},[be,te]),De=h.useCallback(f=>{const u=ro(f,be(),i);te||q(u)},[be,i,te]),he=h.useCallback(()=>{var x,L;const f=ot(Ei(U)),u=(x=re.current)==null?void 0:x.querySelector(`button[data-date="${f}"]`);if(u instanceof HTMLButtonElement){Ae(f),u.focus();return}const _=ae.current.find(j=>!j.isDisabled);if(_){const j=(L=re.current)==null?void 0:L.querySelector(`button[data-date="${_.currentDateISO}"]`);j instanceof HTMLButtonElement&&(Ae(_.currentDateISO),j.focus())}},[]),ye=h.useCallback((f,u)=>{const _=f.target;if(tf(_))return;if(f.preventDefault(),!G){he();return}const x=Qt(G),L=sf(x,u,re.current.querySelector.bind(re.current));if(L){const j=re.current.querySelector(`button[data-date="${ot(L)}"]`);j instanceof HTMLButtonElement&&!j.dataset.disabled&&(Ae(ot(L)),j.focus())}},[G,he]),Ue=h.useCallback(f=>{if(f.key==="Escape"){f.preventDefault(),we();return}const u=nf(f.key);u!==null&&ye(f.nativeEvent,u)},[we,ye]),ct=h.useCallback(f=>{re.current&&!re.current.contains(f.relatedTarget)&&!f.target.classList.contains("pkt-hide")&&we()},[we]);return{componentId:O,strings:N,todayDate:U,year:W,month:se,activeSelected:C,_selected:H,inRange:ue,rangeHovered:ge,focusedDate:G,range:n,multiple:t,weeknumbers:p,withcontrols:m,earliest:r,latest:a,excludedates:X,excludeweekdays:d,className:M,dateConstraints:Ke,calendarRef:re,selectableDatesRef:ae,tabIndexSetRef:Re,prevMonth:Ge,nextMonth:Xe,changeMonth:Ne,handleDateSelect:Me,addToSelected:xe,removeFromSelected:V,toggleSelectedDate:De,handleRangeHover:Ie,isExcluded:et,isDayDisabled:ce,focusOnCurrentDate:he,handleKeydown:Ue,handleFocusOut:ct,close:we,setFocusedDate:Ae}}const of=({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?Kp(t,i,n):Gp(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 lf(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:Hp(i),tabindex:d}}function cf(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 df(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 uf=({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:$},U=()=>{const q=[];m&&q.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++)q.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:q})},X=(q,C)=>{const H=lf(q,C,O),{currentDate:W,currentDateISO:Q,isSelected:se,isDisabled:ie,ariaLabel:ue,tabindex:ne}=H;b.current.push({currentDateISO:Q,isDisabled:ie,tabindex:ne});const ge=cf(H,N),K=df(H,N);return o.jsx("td",{className:ge,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":ue,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:q})})},Q)},te=(q,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:q})})},C),$e=()=>{const q=S,C=Zp(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 ue=0;ue<Pi;ue++){const ne=Jp(se,ue,H,C);if(ne==="current-month")ie.push(X(H,q)),H++;else{const ge=Rp(ne,ue,H,C);ie.push(te(ge,`${ne}-${se}-${ue}`)),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:U()}),o.jsx("tbody",{children:$e()})]})},er=h.forwardRef((s,e)=>{const t=af(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(of,{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(uf,{state:t})]})});er.displayName="PktCalendar";const hf=It({tagName:"pkt-card",elementClass:We,react:h,displayName:"PktCard",events:{}}),ao=h.forwardRef(({children:s,...e},t)=>o.jsx(hf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));ao.displayName="PktCard";const oo=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 U=[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(" "),$e=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),q=()=>o.jsxs(o.Fragment,{children:[M&&o.jsx("span",{className:$e+" pkt-tag--gray",children:M}),k&&o.jsx("span",{className:$e+" pkt-tag--blue-light",children:g}),$&&o.jsx("span",{className:$e+" pkt-tag--beige",children:T})]});return o.jsx("div",{className:U,children:o.jsxs("div",{className:te,children:[p==="left"&&o.jsxs("label",{className:X,htmlFor:s,children:[i," ",q(),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," ",q(),n&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:n})]})]})})});oo.displayName="PktCheckbox";const pf=It({tagName:"pkt-combobox",elementClass:Pe,react:h,displayName:"PktCombobox",events:{onClick:"click",onChange:"change",onInput:"input",onBlur:"blur",onFocus:"focus",onValueChange:"value-change",onToggleHelpText:"toggleHelpText"}}),lo=h.forwardRef(({children:s,helptext:e,...t},i)=>o.jsxs(pf,{...t,ref:i,children:[e&&o.jsx("div",{slot:"helptext",className:"pkt-contents",children:e}),s]}));lo.displayName="PktCombobox";const ln=It({tagName:"pkt-consent",elementClass:Tt,react:h,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});ln.displayName="PktConsent";const Os=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:U=!1,role:X="group",counterPosition:te="bottom"},$e)=>{const[q,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),ue=["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(" "),ge=()=>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?U?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})},Ae=()=>!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:q?"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 ${q?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:i})]})]}),re=o.jsxs(o.Fragment,{children:[G(),Ae(),Q&&o.jsx(ge,{}),O,se&&o.jsx(ge,{}),k&&g&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(rn,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:g})})]});return o.jsx("div",{className:ue,ref:$e,role:X,children:U?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":H,children:re}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:re})})});Os.displayName="PktInputWrapper";const co=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},ff=()=>co()?"text":"date",mf=s=>!s||s.length!==2?!0:zp(s[0],s[1]),gf=(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"}),vf=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),bf=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),yf=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,kf=(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},cn=(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&&kf(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(er,{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})})},dn=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},U={"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(U,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})]})});dn.displayName="PktTag";const $f=({dates:s,dateformat:e,idBase:t,strings:i,onDateRemoved:n})=>{var l;const r=Wp(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=Fp(d,e);return o.jsx(dn,{id:`${t}${d}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>n(d),children:o.jsx("time",{dateTime:d,children:p})},d)})})},wf=({state:s})=>{var Ke,lt,we,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:U,buttonClasses:X,rangeLabelClasses:te,datepickerInputsClasses:$e,isInputDisabled:q,inputRef:C,inputRefTo:H,btnRef:W,toggleCalendar:Q,handleFocus:se,handleSingleInputChange:ie,handleRangeFromChange:ue,handleRangeToChange:ne,handleRangeBlur:ge,handleMultipleBlur:K,handleTagRemoved:G,handleSingleKeydown:Ae,handleRangeFromKeydown:re,handleRangeToKeydown:ae,handleMultipleKeydown:Re,restProps:Ve}=s,Se=()=>{var Ge,Xe;return o.jsxs("button",{ref:W,className:X,type:"button",onClick:Q,disabled:d,"aria-label":((Ge=N.calendar)==null?void 0:Ge.buttonAltText)??"Åpne kalender",children:[o.jsx(Y,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Xe=N.calendar)==null?void 0:Xe.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx($f,{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:U,type:S,id:t,name:y??e,placeholder:k,readOnly:p||O&&!p,disabled:q,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":g,"aria-errormessage":g?`${e}-error`:void 0,onClick:Q,onKeyDown:Re,onFocus:se,onBlur:K}),Se()]})})]}):a?o.jsx("div",{className:$e,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Ke=N.generic)==null?void 0:Ke.from)??"Fra"}),o.jsx("input",{...Ve,ref:C,className:U,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:ge,onChange:ue}),o.jsx("div",{className:te,id:`${e}-to-label`,children:((we=N.generic)==null?void 0:we.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:H,className:U,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:ge,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:U,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:Ae,onFocus:se,onBlur:void 0,onChange:ie}),Se()]})})},xf={calendar:{buttonAltText:"Åpne kalender"}},Sf={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},uo=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Cf(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:U=!1,helptext:X,helptextDropdown:te,helptextDropdownButton:$e,hasError:q=!1,errorMessage:C,optionalTag:H=!1,optionalText:W,requiredTag:Q=!1,requiredText:se,tagText:ie,useWrapper:ue=!0,strings:ne,disabled:ge=!1,readOnly:K=!1,required:G=!1,name:Ae,min:re,max:ae,placeholder:Re,onChange:Ve,onValueChange:Se,className:Ke,...lt}=s,we=h.useCallback(D=>D===void 0?[]:uo(D),[]),Ne=n!==void 0,Ge=typeof r=="number"?void 0:r,[Xe,et]=h.useState(()=>we(n??Ge)),ce=Ne?we(n):Xe;h.useEffect(()=>{Ne&&et(we(n))},[n,Ne,we]);const[be,Ie]=h.useState(M??!1);h.useEffect(()=>{M!==void 0&&Ie(M)},[M]);const Me=h.useRef(null),xe=h.useRef(null),V=h.useRef(null),De=h.useRef(null),he=h.useRef(null),ye=h.useMemo(()=>ff(),[]),Ue=h.useMemo(()=>co(),[]),ct=h.useMemo(()=>ne??(p?Sf:xf),[ne,p]),f=typeof re=="string"?re:re!==void 0?String(re):void 0,u=typeof ae=="string"?ae:ae!==void 0?String(ae):void 0,_=h.useMemo(()=>{const D=gf(O,m,l,p,K,ye);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[O,m,l,p,K,ye]),x=h.useMemo(()=>{const D=vf();return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[]),L=h.useMemo(()=>{const D=bf(m);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[m]),j=h.useMemo(()=>["pkt-datepicker__inputs",p&&m&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,m]),R=h.useMemo(()=>{if($)return $;if(u)return u.slice(0,7)},[$,u]),ft=ge||l&&d!=null&&ce.length>=d,Qe=l&&d!=null,mt=`${t}-input`,ls=ce.join(",");h.useEffect(()=>{V.current&&(V.current.value=ls)},[ls]),h.useEffect(()=>{S&&typeof window<"u"&&S!==window.pktTz&&(window.pktTz=S)},[S]);const tt=h.useCallback((D,E=!0)=>{Ne||et(D),E&&(Se==null||Se(D))},[Ne,Se]),dr=h.useMemo(()=>{var D;return(D=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:D.set},[]),_t=h.useCallback(D=>{const E=V.current;!E||!dr||(dr.call(E,D.join(",")),E.dispatchEvent(new Event("input",{bubbles:!0})))},[dr]),Zt=h.useCallback(()=>{ge||Ie(D=>!D)},[ge]),cs=h.useCallback(()=>{Ie(!1)},[]);h.useEffect(()=>{if(!be)return;const D=st=>{var vn;const Ze=st.target;he.current&&!he.current.contains(Ze)&&!((vn=Ze.closest)!=null&&vn.call(Ze,".pkt-calendar-popup"))&&cs()},E=st=>{var Ze;st.key==="Escape"&&(cs(),(Ze=Me.current)==null||Ze.focus())};return document.addEventListener("click",D,!0),document.addEventListener("keydown",E),()=>{document.removeEventListener("click",D,!0),document.removeEventListener("keydown",E)}},[be,cs]);const zm=h.useCallback(()=>{Ue&&!be&&Ie(!0)},[Ue,be]),Ym=h.useCallback(D=>{var Ze;const E=yf(D,l,p),st=uo(E);tt(st),_t(st),!l&&!p&&(cs(),(Ze=Me.current)==null||Ze.focus())},[l,p,tt,_t,cs]),Km=h.useCallback(()=>{var D;cs(),(D=Me.current)==null||D.focus()},[cs]),Gm=h.useCallback(D=>{const E=D.target.value,st=E?[E]:[];tt(st),_t(st)},[tt,_t]),Xm=h.useCallback(D=>{const E=D.target.value,st=ce[1]??"",Ze=[E,st].filter(Boolean);tt(Ze),_t(Ze)},[ce,tt,_t]),Qm=h.useCallback(D=>{const E=ce[0]??"",st=D.target.value,Ze=[E,st].filter(Boolean);tt(Ze),_t(Ze)},[ce,tt,_t]),Zm=h.useCallback(()=>{ce.length===2&&!mf(ce)&&(tt([ce[0]]),_t([ce[0]]))},[ce,tt,_t]),gn=h.useCallback(D=>{const E=Qt(D),st=f?Qt(f):null,Ze=u?Qt(u):null;if(E&&!isNaN(E.getTime())&&(!st||E>=st)&&(!Ze||E<=Ze)){const vn=qp([...ce,D],f,u,k,g),jo=[...new Set(vn)];tt(jo),_t(jo)}},[ce,f,u,k,g,tt,_t]),Jm=h.useCallback(D=>{const E=D.target;E.value&&(gn(E.value.split(",")[0]),E.value="")},[gn]),Uo=h.useCallback(D=>{const E=D.target;E.value&&(gn(E.value.split(",")[0]),E.value="")},[gn]),Rm=h.useCallback(D=>{const E=ce.filter(st=>st!==D);tt(E),_t(E)},[ce,tt,_t]),ds=h.useCallback(D=>{const E=D==null?void 0:D.closest("form");E?E.requestSubmit():D==null||D.blur()},[]),eg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),void 0,()=>{var E;return(E=Me.current)==null?void 0:E.blur()})},[Zt,ds]),tg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),()=>{var E;return(E=xe.current)==null?void 0:E.focus()},()=>{var E;return(E=Me.current)==null?void 0:E.blur()})},[Zt,ds]),sg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(xe.current),void 0,()=>{var E;return(E=xe.current)==null?void 0:E.blur()})},[Zt,ds]),ig=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),void 0,()=>{var E;return(E=Me.current)==null?void 0:E.blur()},Uo)},[Zt,ds,Uo]);return h.useImperativeHandle(e,()=>({get value(){var D;return((D=V.current)==null?void 0:D.value)??""},set value(D){const E=D?D.split(",").filter(Boolean):[];et(E),V.current&&(V.current.value=D??"")},focus(){var D;(D=Me.current)==null||D.focus()},blur(){var D;(D=Me.current)==null||D.blur()}}),[]),{id:t,inputId:mt,label:i,values:ce,calendarOpen:be,dateformat:a,multiple:l,maxlength:d,range:p,showRangeLabels:m,weeknumbers:b,withcontrols:y,excludedates:k,excludeweekdays:g,disabled:ge,readOnly:K,required:G,name:Ae,placeholder:Re,fullwidth:O,hasFieldset:N,inline:U,helptext:X,helptextDropdown:te,helptextDropdownButton:$e,hasError:q,errorMessage:C,optionalTag:H,optionalText:W,requiredTag:Q,requiredText:se,tagText:ie,useWrapper:ue,className:Ke,minStr:f,maxStr:u,effectiveCurrentMonth:R,today:T,inputType:ye,isIOSDevice:Ue,strings:ct,inputClasses:_,buttonClasses:x,rangeLabelClasses:L,datepickerInputsClasses:j,isInputDisabled:ft,hasCounter:Qe,inputRef:Me,inputRefTo:xe,changeInputRef:V,btnRef:De,wrapperRef:he,onChange:Ve,toggleCalendar:Zt,hideCalendar:cs,handleDateSelected:Ym,handleCalendarClose:Km,handleFocus:zm,handleSingleInputChange:Gm,handleRangeFromChange:Xm,handleRangeToChange:Qm,handleRangeBlur:Zm,handleMultipleBlur:Jm,handleTagRemoved:Rm,handleSingleKeydown:eg,handleRangeFromKeydown:tg,handleRangeToKeydown:sg,handleMultipleKeydown:ig,restProps:lt}}const ho=h.forwardRef((s,e)=>{const t=Cf(s,e),i=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:i,children:[o.jsx(Os,{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(wf,{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"})]})});ho.displayName="PktDatepicker";const Tf={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},Nf={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},Mf={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},Df={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},po=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),Of=()=>{const s=po(),e=po();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class fo{constructor(e,t){bn(this,"fileId");bn(this,"file");bn(this,"attributes",{});this.fileId=t||Of(),this.file=e,this.attributes={targetFilename:e.name}}}const tr=h.createContext({}),Ef=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",Pf=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():Ef,[k]);h.useImperativeHandle(b,()=>y.current);const[$,T]=h.useState(!1),M=h.useMemo(()=>l?e?Mf:Df:e?Tf:Nf,[e,l]),S=h.useCallback(C=>{if(y.current)try{y.current.files=Af(C)}catch{}},[y.current,t]);h.useEffect(()=>{S(t)},[y,t]);const O=h.useCallback(C=>{const H=C.map(W=>new fo(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))},U=C=>{O(C)},X=C=>{if(C.preventDefault(),T(!1),d)return;const H=C.dataTransfer.files,W=Array.from(H);U(W)},te=C=>{C.preventDefault(),!d&&T(!0)},$e=()=>{T(!1)},q=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:$e,onClick:q,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]})]})]})}),Af=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},sr=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:U,rows:X,useWrapper:te=!0,onChange:$e,value:q,autoComplete:C="off",minLength:H,maxLength:W,readOnly:Q,skipForwardTestid:se=!1,...ie},ue)=>{const ne=[r,"pkt-textinput","pkt-textarea"].join(" "),ge=`${s}-input`,K=`${ge}-label`,G=t||K,[Ae,re]=h.useState(0),ae=Re=>{var Ve,Se;i&&re(((Se=(Ve=Re.currentTarget)==null?void 0:Ve.value)==null?void 0:Se.length)||0),$e&&$e(Re)};return h.useEffect(()=>{q!==void 0&&re((q==null?void 0:q.length)||0)},[q]),o.jsx(Os,{ariaDescribedby:e,className:ne,disabled:a,errorMessage:l,forId:ge,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:Ae,counterMaxLength:n,children:o.jsx("textarea",{ref:ue,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${n&&Ae>n?"pkt-input--counter-error":""}`,name:`${$||s}`,id:ge,placeholder:U,disabled:a,rows:X,"aria-labelledby":G,"aria-invalid":d,"aria-errormessage":`${s}-error`,...ie,onChange:ae,value:q,autoComplete:C,minLength:H,maxLength:W,readOnly:Q,"data-skip-forward-testid":se?"true":void 0})})});sr.displayName="PktTextarea";const If=Symbol("comment"),Lf=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}`},Bf=({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(sr,{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"})]})},Ff=({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:Lf(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,Hf=s=>{const e=h.useContext(tr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},Vf=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(Bf,{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(Ff,{comments:l,onDeleteComment:d=>i(n.fileId,d),onEditComment:r?()=>r():void 0})},renderHidden:n=>o.jsx(Hf,{comments:e.get(n.fileId)},`comments${n.fileId}`),symbol:If}},Uf=Symbol("deleteFile"),jf=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:Uf}),qf=Symbol("renameFile"),Wf=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"})]})},zf=s=>{const e=h.useContext(tr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},Yf=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,i)=>o.jsx(Wf,{value:e.get(t.fileId)||void 0,onSave:n=>{e.set(t.fileId,n),i()},onCancel:i}),renderHidden:t=>o.jsx(zf,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:qf}},Kf=(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])}},Gf=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}},Xf=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}},Qf=It({tagName:"pkt-modal",elementClass:xt,react:h,displayName:"PktModal",events:{}}),ir=h.forwardRef(({children:s,...e},t)=>o.jsx(Qf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));ir.displayName="PktModal";const mo=2,Zf=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},Jf=(s,e,t)=>{const i=e*t;return s.getBoundingClientRect().height>i+.5},go=h.createContext({tail:5}),Ai=({children:s,tail:e,...t})=>{const i=s,n=h.useContext(go),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 $=Zf(k);m(Jf(g,$,mo))},[]),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:mo,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})]})},Rf=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}},un=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`,nr=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"}),em=()=>{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)]})},tm=({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(Ai,{children:e.attributes.targetFilename})}),o.jsx(nr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(mn,{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:un(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(em,{})]})},sm=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx(nr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(mn,{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:un(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},im=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx(nr,{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})]}),nm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(sm,{transferItem:s,onRemove:e}):o.jsx(im,{transferItem:s,onRemove:e}),rm=({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})},vo=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:un(s.file.size)})]}),am=({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(Ai,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},bo=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(ir,{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});bo.displayName="ImagePreviewModal";const om=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||"")},rr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",lm=({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(rm,{operation:n,onActivate:t,transferItem:i},n.symbol.toString()))}),cm=({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()))}),dm=({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(lm,{operations:p,activatedOperation:e,onActivate:n,transferItem:s}),o.jsx(cm,{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)})]})},um=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,enableImagePreview:n,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:d})=>{const p=rr(s.progress),m=n&&s.progress==="done"&&om(s);switch(p){case"in-progress":return o.jsx(tm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(nm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(dm,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,onActivate:r,onClose:a,onPreviewClick:m?()=>d(s.fileId):void 0})}},hm=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||"")},pm=(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[rr(r.progress)]-n[rr(a.progress)])},[s,e,t]),fm=(s,e)=>h.useMemo(()=>e?s.filter(t=>t.progress==="done"&&hm(t)):[],[s,e]),mm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:i=[],ItemRenderer:n=vo,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const d=pm(s,t,l),p=fm(d,a),m=Xf(i),b=Gf(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(go.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(um,{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(bo,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},ar={filename:vo,thumbnail:am},yo=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=ar.filename,fullWidth:y=!1,allowedFormats:k,formatErrorMessage:g,maxFileSize:$,sizeErrorMessage:T,onFileValidation:M,errorMessage:S,hasError:O=!1,disabled:N=!1,label:U,helptext:X,optionalTag:te,requiredTag:$e,enableImagePreview:q=!1,...C},H)=>{const W="transfers"in C?C.transfers:void 0,[Q,se]=h.useState(null),ie=O||!!Q,ue=S||Q,ne=$?Rf($):void 0,ge=h.useCallback(V=>{var De;if(k&&k.length>0){const he=((De=V.name.split(".").pop())==null?void 0:De.toLowerCase())||"",ye=V.type.toLowerCase();if(!k.some(ct=>{const f=ct.toLowerCase().replace(/^\./,"");if(f.includes("/")){if(f.endsWith("/*")){const u=f.replace("/*","");return ye.startsWith(u+"/")}return ye===f}return he===f})){const ct=k.join(", "),f=`Ugyldig filtype. Tillatte formater: ${ct}`;return(g==null?void 0:g.replace("{formats}",ct))||f}}if(ne&&V.size>ne){const he=un(ne),ye=`Filen er for stor. Maks størrelse er ${he}.`;return(T==null?void 0:T.replace("{maxSize}",he))||ye}return M?M(V):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||[],Ae=typeof b=="string"?ar[b]:b,re=b==="thumbnail",ae=typeof C.accept=="string"?C.accept.trim():void 0,Re=h.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const De=V.toLowerCase();return De.includes("/")||De.startsWith(".")?De:`.${De}`}).join(", ")},[k]),Ve=ae||Re,Se=a&&!re,Ke=r&&!re,lt=h.useCallback(V=>{for(const he of V){const ye=ge(he.file);if(ye){se(ye);return}}se(null);const De=i?[...G,...V]:[V[0]];d&&d(De),n==="custom"&&p&&V.forEach(he=>{p==null||p(he)})},[d,G,i,n,p,ge]),we=h.useCallback((V,De)=>{const he=G.map(ye=>ye.fileId===V?{...ye,...De}:ye);d&&d(he)},[d,G]),Ne=h.useCallback(V=>{var he;const De=G.filter(ye=>ye.fileId!==V);d&&d(De),"onTransferCancelled"in C&&C.onTransferCancelled&&((he=C.onTransferCancelled)==null||he.call(C,V))},[d,G,C]),{fileAttributes:Ge}=Kf(G,we),Xe=h.useMemo(()=>[{op:Yf,enabled:Se},{op:V=>Vf(V),enabled:Ke}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...m),[Se,Ke]),et=h.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ce,uploadedCount:be,failedCount:Ie}=h.useMemo(()=>{const V=G.length;if(!W)return{totalCount:V,uploadedCount:0,failedCount:0};let De=0,he=0;for(const ye of G){const Ue=W.find(ct=>ct.fileId===ye.fileId);(Ue==null?void 0:Ue.progress)==="done"&&De++,(Ue==null?void 0:Ue.progress)==="error"&&he++}return{totalCount:V,uploadedCount:De,failedCount:he}},[G,W]),Me=ce===1?"fil":"filer",xe=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(tr.Provider,{value:{name:C.name||"",multiple:!!i,id:t},children:[o.jsx("div",{id:et.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ce>0&&be>0&&`${be} av ${ce} ${Me} lastet opp`}),o.jsx("div",{id:et.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ce>0&&Ie>0&&`Feil ved opplasting: ${Ie} av ${ce} ${Me} feilet`}),o.jsx(Pf,{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:et}),ie&&ue&&o.jsx(rn,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:ue}),o.jsx(mm,{files:G,cancelTransfer:Ne,truncateTail:l,transfers:W,uploadStrategy:n,ItemRenderer:Ae,enableImagePreview:re&&q,queueItemOperations:Xe.map(V=>V(Ge)).concat(jf(Ne))})]})});return U?o.jsx(Os,{forId:t,label:U,helptext:X,disabled:N,hasError:ie,optionalTag:te,requiredTag:$e,className:oe("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":y}),children:xe}):xe});yo.displayName="PktFileUpload";const gm=({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(ln,{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}`))})]})]})})},vm=({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(ln,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:d,cookieSecure:p,cookieExpiryDays:m,onToggleConsent:b})})]})})})},bm=(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 ym(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 hn=({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]})};hn.displayName="PktLink";const km=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},pn=({item:s,className:e})=>"href"in s?o.jsx(hn,{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(pn,{item:e})},t))}),ko=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(km);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(pn,{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(pn,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(pn,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});ko.displayName="PktHeaderUserMenu";const fn=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:U,tagText:X=null,placeholder:te,prefix:$e,suffix:q,type:C="text",useWrapper:H=!0,omitSearchIcon:W=!1,value:Q,minLength:se,maxLength:ie,min:ue,max:ne,step:ge,size:K,readonly:G,required:Ae,dataTestid:re,onChange:ae,skipForwardTestid:Re=!1,...Ve},Se)=>{const Ke=[a,"pkt-textinput"].join(" "),lt=C==="search"&&!k&&!W,we=C==="date"&&Q?Q.slice(0,10):Q,[Ne,Ge]=h.useState((Q==null?void 0:Q.length)||0),Xe=`${s}`,et=`${Xe}-label`,ce=t||et,be=Ie=>{var Me,xe;n&&Ge(((xe=(Me=Ie.currentTarget)==null?void 0:Me.value)==null?void 0:xe.length)||0),ae&&ae(Ie)};return h.useEffect(()=>{Q!==void 0&&Ge((Q==null?void 0:Q.length)||0)},[Q]),o.jsx(Os,{ariaDescribedby:e,className:Ke,disabled:l,errorMessage:d,forId:Xe,hasError:p,helptext:m,helptextDropdown:b,helptextDropdownButton:y,inline:g,label:T,optionalTag:S,optionalText:O,requiredTag:N,requiredText:U,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":Re?"true":void 0,children:[$e&&o.jsx("div",{className:"pkt-input-prefix",children:$e}),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:we,id:Xe,placeholder:te,autoComplete:i,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ce,min:ue,max:ne,onChange:be,step:ge,minLength:se,maxLength:ie,size:K,readOnly:G,required:Ae}),q&&o.jsxs("p",{className:"pkt-input-suffix",children:[q,k&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:k}),lt&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!q&&k&&o.jsx(Y,{className:"pkt-input-icon",name:k}),!q&<&&o.jsx(Y,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});fn.displayName="PktTextinput";const or=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:U,canChangeRepresentation:X=!1,changeRepresentation:te,hideLogo:$e=!1,logoLink:q,logoClick:C,position:H="fixed",scrollBehavior:W="hide",slotMenuVariant:Q="icon-only",slotMenuText:se="Meny"},ie)=>{const ue=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(()=>{U&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[U]),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 ge=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[Ae,re]=h.useState(!1),[ae,Re]=h.useState(0),[Ve,Se]=h.useState(!1),[Ke,lt]=h.useState(!1),we=h.useRef(null),Ne=h.useRef(null),Ge=h.useRef(null),Xe=h.useRef(null),et=h.useRef(null),ce=h.useRef(null),be=h.useRef(null),Ie=h.useRef(!1),Me=bm(we),xe=Me<s,V=Me<e,De=h.useCallback(u=>{we.current=u,typeof ie=="function"?ie(u):ie&&(ie.current=u)},[ie]);ym(ue&&xe&&K!=="none");const he=h.useCallback((u,_)=>{const x=u.relatedTarget;let L;switch(_){case"user":L=Ne;break;case"slot":L=Ge;break;case"search":L=Xe;break;default:return}const j=L.current;j&&(!x||!j.contains(x))&&G("none")},[]),ye=h.useCallback(()=>{Ie.current&&be.current&&document.contains(be.current)&&be.current.focus(),be.current=null,Ie.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(),Ie.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),Re(_)}};return document&&window.addEventListener("scroll",u),()=>{document&&window.removeEventListener("scroll",u)}},[ne,ae]);const Ue=h.useCallback(u=>{const _=u==="slot"?Ge:Xe,x=u==="slot"?et:ce;if(!_.current||!x.current||!V||xe)return;const L=_.current.getBoundingClientRect(),j=x.current.offsetWidth,R=L.left+j>window.innerWidth;u==="slot"?Se(R):lt(R)},[V,xe]),ct=h.useCallback(u=>{K!=="none"?G("none"):(be.current=document.activeElement,G(u))},[K]);h.useEffect(()=>{(K==="slot"||K==="search")&&requestAnimationFrame(()=>{Ue(K)})},[K,Ue]);const f=o.jsxs("header",{className:oe("pkt-header-service",n&&"pkt-header-service--compact",xe&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",ue&&"pkt-header-service--fixed",ne&&"pkt-header-service--scroll-to-hide",Ae&&"pkt-header-service--hidden",i),"data-mode":r,ref:De,children:[o.jsxs("div",{className:oe("pkt-header-service__logo-area",(!M||M==="")&&"pkt-header-service__logo-area--without-service"),children:[!$e&&o.jsx("span",{className:"pkt-header-service__logo",children:q?o.jsx("a",{href:q,"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(hn,{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=>he(u,"slot"),ref:Ge,children:[V&&t&&o.jsx(at,{skin:"secondary",variant:Q,iconName:"menu",size:xe?"small":"medium",state:K==="slot"?"active":"normal",onClick:()=>ct("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:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:et,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:oe("pkt-header-service__search-container",K==="search"&&"is-open"),onBlur:u=>he(u,"search"),ref:Xe,children:[o.jsx(at,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:xe?"small":"medium",onClick:()=>ct("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",Ke&&"align-right"),ref:ce,children:K==="search"&&o.jsx(fn,{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(fn,{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))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"secondary",size:xe?"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=>he(u,"user"),ref:Ne,children:[o.jsxs(at,{className:oe("pkt-header-service__user-button",xe&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:xe?"small":"medium",state:K==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:K==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>ct("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(xe?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(ko,{user:S,formattedLastLoggedIn:ge,representing:g,userMenu:O,canChangeRepresentation:X,changeRepresentation:te,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!xe&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return ue?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",xe&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):f});or.displayName="PktHeaderService";const _o=h.forwardRef((s,e)=>o.jsx(or,{...s,ref:e}));_o.displayName="PktHeader";const $m=It({tagName:"pkt-heading",elementClass:ss,react:h,displayName:"PktHeading"}),$o=h.forwardRef(({children:s,...e},t)=>o.jsx($m,{"data-testid":"pkt-heading",...e,ref:t,children:s}));$o.displayName="PktHeading";const wm=It({tagName:"pkt-helptext",elementClass:Yt,react:h,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),wo=h.forwardRef(({children:s,...e},t)=>o.jsx(wm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));wo.displayName="PktHelptext";const xo=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]}));xo.displayName="PktInput";const So=({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})]})};So.displayName="PktLinkCard";const xm=It({tagName:"pkt-loader",elementClass:Pt,react:h,displayName:"PktLoader",events:{}}),Co=h.forwardRef(({children:s,...e},t)=>o.jsx(xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Co.displayName="PktLoader";const To=({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})]})};To.displayName="PktMessagebox";const Sm=It({tagName:"pkt-progressbar",elementClass:Fe,react:h,displayName:"PktProgressbar",events:{}}),mn=h.forwardRef(({children:s,...e},t)=>o.jsx(Sm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));mn.displayName="PktProgressbar";const No=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(" "),U=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),X=()=>o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:U+" pkt-tag--gray",children:g}),m&&o.jsx("span",{className:U+" pkt-tag--blue-light",children:b}),y&&o.jsx("span",{className:U+" 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})]})]})})});No.displayName="PktRadioButton";const Mo=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,U)=>{N?N():k&&k(U)},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,U)=>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,U),onKeyUp:X=>X.key==="Enter"&&T(N.onClick,U)},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-${U}`))})]}))});Mo.displayName="PktSearchInput";const Do=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},U)=>{const X=[i,"pkt-select"].join(" ");return o.jsx(Os,{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:U,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})})});Do.displayName="PktSelect";const Cm=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)"}})}),Tm=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"})]}),Nm=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"})]}),Mm=({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"?Tm:t==="completed"?Nm:Cm}),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})]})]}),Oo=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})});Oo.displayName="PktStepper";const Dm=({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}),Om=({id:s,children:e,className:t,...i})=>o.jsx("tbody",{id:s,className:oe(t,"pkt-table__body",{}),...i,role:"rowgroup",children:e}),Em=({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}),Pm=({className:s,children:e,...t})=>o.jsx("thead",{className:oe(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),Am=({className:s,children:e,...t})=>o.jsx("th",{className:oe(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),Im=({className:s,children:e,...t})=>o.jsx("tr",{className:oe(s,"pkt-table__row",{}),role:"row",...t,children:e}),lr=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}=Lm(),$={"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(dn,{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})});lr.displayName="PktTabItem";const Eo=h.createContext(null),Lm=()=>{const s=h.useContext(Eo);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Po=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(lr,{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(Eo.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})})})});Po.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 Ao(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function Bm(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 Ii(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 Io(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function Fm(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function cr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Lo(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=Lo(n[r].shadowRoot),i));r++);return i}function Bo(s){return s.isConnected||document.body.contains(s)}function Fo(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=le.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 Hm(s){if(!s.defaultPrevented){var e=s.target,t=le.imagemapUseValue,i=Fo(s);t===null&&i&&(t=i.value);var n=Ii(e);if(n){var r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?n.close(t):n.close())}}}function Ho(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",Hm,!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))}Ho.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Bo(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_),le.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=Lo(this.dialog_)),Io(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(!Bo(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!le.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Bm(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,le.needsCentering(this.dialog_)?(le.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});Ao(this.dialog_,e)}};var le={};if(le.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"},le.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||!Fm(a,s))){var l=r.style.getPropertyValue("top"),d=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||d&&d!=="auto")return!0}}}return!1},le.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:!le.isInlinePositionSetByStylesheet(s)},le.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 Ho(s)},le.registerDialog=function(s){s.showModal||le.forceRegisterDialog(s)},le.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)}))},le.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})},le.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},le.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)},le.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=Ii(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},le.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(),Io(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}},le.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&&Ao(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},le.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},le.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)},le.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())},le.dm=new le.DialogManager,le.formSubmitter=null,le.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Vo=document.createElement("form");if(Vo.setAttribute("method","dialog"),Vo.method!=="dialog"){var ei=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(ei){var Vm=ei.get;ei.get=function(){return cr(this)?"dialog":Vm.call(this)};var Um=ei.set;ei.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):Um.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",ei)}}document.addEventListener("click",function(s){if(le.formSubmitter=null,le.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!cr(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;le.imagemapUseValue=s.offsetX+","+s.offsetY}var n=Ii(e);n&&(le.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=Ii(e);if(!t){var i=Fo(s),n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&s.preventDefault()}});var jm=HTMLFormElement.prototype.submit,qm=function(){if(!cr(this))return jm.call(this);var s=Ii(this);s&&s.close()};HTMLFormElement.prototype.submit=qm}const Wm=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));A.FileItem=fo,A.ItemRenderers=ar,A.PktAccordion=hr,A.PktAccordionItem=Ea,A.PktAlert=rn,A.PktBackLink=Aa,A.PktBreadcrumbs=Ia,A.PktButton=at,A.PktCalendar=er,A.PktCard=ao,A.PktCheckbox=oo,A.PktCombobox=lo,A.PktConsent=ln,A.PktDatepicker=ho,A.PktFileUpload=yo,A.PktFooter=gm,A.PktFooterSimple=vm,A.PktHeader=_o,A.PktHeaderService=or,A.PktHeading=$o,A.PktHelptext=wo,A.PktIcon=Y,A.PktInput=xo,A.PktInputWrapper=Os,A.PktLink=hn,A.PktLinkCard=So,A.PktLoader=Co,A.PktMessagebox=To,A.PktModal=ir,A.PktProgressbar=mn,A.PktRadioButton=No,A.PktSearchInput=Mo,A.PktSelect=Do,A.PktStep=Mm,A.PktStepper=Oo,A.PktTabItem=lr,A.PktTable=Dm,A.PktTableBody=Om,A.PktTableDataCell=Em,A.PktTableHeader=Pm,A.PktTableHeaderCell=Am,A.PktTableRow=Im,A.PktTabs=Po,A.PktTag=dn,A.PktTextarea=sr,A.PktTextinput=fn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
|
1691
|
+
*/var Pa;function Ch(){return Pa||(Pa=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})()})(Yn)),Yn.exports}var Th=Ch();const oe=Sh(Th),rn=({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]})]})})};rn.displayName="PktAlert";const Aa=It({tagName:"pkt-backlink",elementClass:Hs,react:h,displayName:"PktBackLink"});Aa.displayName="PktBackLink";const Ia=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(zo.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})]})});Ia.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 La=6048e5,Nh=864e5,Ba=Symbol.for("constructDateFrom");function jt(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 kt(s,e){return jt(e||s,s)}function Fa(s,e,t){const i=kt(s,t==null?void 0:t.in);return isNaN(e)?jt(s,NaN):(e&&i.setDate(i.getDate()+e),i)}let Mh={};function an(){return Mh}function Ti(s,e){var l,d,p,m;const t=an(),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=kt(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 on(s,e){return Ti(s,{...e,weekStartsOn:1})}function Ha(s,e){const t=kt(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=on(n),a=jt(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=on(a);return t.getTime()>=r.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function Va(s){const e=kt(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 Ua(s,...e){const t=jt.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function Kn(s,e){const t=kt(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function Dh(s,e,t){const[i,n]=Ua(t==null?void 0:t.in,s,e),r=Kn(i),a=Kn(n),l=+r-Va(r),d=+a-Va(a);return Math.round((l-d)/Nh)}function Oh(s,e){const t=Ha(s,e),i=jt(s,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),on(i)}function Eh(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Ph(s){return!(!Eh(s)&&typeof s!="number"||isNaN(+kt(s)))}function Ah(s,e){const t=kt(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Ih(s,e){const[t,i]=Ua(s,e.start,e.end);return{start:t,end:i}}function ja(s,e){const{start:t,end:i}=Ih(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 Lh(s,e){const t=kt(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Bh={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"}},Fh=(s,e,t)=>{let i;const n=Bh[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 Gn(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const Hh={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Vh={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Uh={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jh={date:Gn({formats:Hh,defaultWidth:"full"}),time:Gn({formats:Vh,defaultWidth:"full"}),dateTime:Gn({formats:Uh,defaultWidth:"full"})},qh={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Wh=(s,e,t,i)=>qh[s];function Ni(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 zh={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Yh={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Kh={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"]},Gh={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"]},Xh={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"}},Qh={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"}},Zh={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:Ni({values:zh,defaultWidth:"wide"}),quarter:Ni({values:Yh,defaultWidth:"wide",argumentCallback:s=>s-1}),month:Ni({values:Kh,defaultWidth:"wide"}),day:Ni({values:Gh,defaultWidth:"wide"}),dayPeriod:Ni({values:Xh,defaultWidth:"wide",formattingValues:Qh,defaultFormattingWidth:"wide"})};function Mi(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)?Rh(l,b=>b.test(a)):Jh(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 Jh(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function Rh(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function ep(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 tp=/^(\d+)(th|st|nd|rd)?/i,sp=/\d+/i,ip={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},np={any:[/^b/i,/^(a|c)/i]},rp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ap={any:[/1/i,/2/i,/3/i,/4/i]},op={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},lp={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]},cp={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},dp={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]},up={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},hp={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}},pp={ordinalNumber:ep({matchPattern:tp,parsePattern:sp,valueCallback:s=>parseInt(s,10)}),era:Mi({matchPatterns:ip,defaultMatchWidth:"wide",parsePatterns:np,defaultParseWidth:"any"}),quarter:Mi({matchPatterns:rp,defaultMatchWidth:"wide",parsePatterns:ap,defaultParseWidth:"any",valueCallback:s=>s+1}),month:Mi({matchPatterns:op,defaultMatchWidth:"wide",parsePatterns:lp,defaultParseWidth:"any"}),day:Mi({matchPatterns:cp,defaultMatchWidth:"wide",parsePatterns:dp,defaultParseWidth:"any"}),dayPeriod:Mi({matchPatterns:up,defaultMatchWidth:"any",parsePatterns:hp,defaultParseWidth:"any"})},fp={code:"en-US",formatDistance:Fh,formatLong:jh,formatRelative:Wh,localize:Zh,match:pp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mp(s,e){const t=kt(s,e==null?void 0:e.in);return Dh(t,Lh(t))+1}function gp(s,e){const t=kt(s,e==null?void 0:e.in),i=+on(t)-+Oh(t);return Math.round(i/La)+1}function qa(s,e){var m,b,y,k;const t=kt(s,e==null?void 0:e.in),i=t.getFullYear(),n=an(),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=Ti(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=Ti(d,e);return+t>=+l?i+1:+t>=+p?i:i-1}function vp(s,e){var l,d,p,m;const t=an(),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=qa(s,e),r=jt((e==null?void 0:e.in)||s,0);return r.setFullYear(n,0,i),r.setHours(0,0,0,0),Ti(r,e)}function Wa(s,e){const t=kt(s,e==null?void 0:e.in),i=+Ti(t,e)-+vp(t,e);return Math.round(i/La)+1}function me(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 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)}},Zs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},za={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=qa(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=Ha(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 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 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=Wa(s,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):me(n,e.length)},I:function(s,e,t){const i=gp(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"}):as.d(s,e)},D:function(s,e,t){const i=mp(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 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"}):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"}):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 Ka(i);case"XXXX":case"XX":return Ms(i);case"XXXXX":case"XXX":default:return Ms(i,":")}},x:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"x":return Ka(i);case"xxxx":case"xx":return Ms(i);case"xxxxx":case"xxx":default:return Ms(i,":")}},O:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ya(i,":");case"OOOO":default:return"GMT"+Ms(i,":")}},z:function(s,e,t){const i=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ya(i,":");case"zzzz":default:return"GMT"+Ms(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 Ya(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 Ka(s,e){return s%60===0?(s>0?"-":"+")+me(Math.abs(s)/60,2):Ms(s,e)}function Ms(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 Ga=(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"})}},Xa=(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"})}},bp={p:Xa,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Ga(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}}",Ga(i,e)).replace("{{time}}",Xa(n,e))}},yp=/^D+$/,kp=/^Y+$/,_p=["D","DD","YY","YYYY"];function $p(s){return yp.test(s)}function wp(s){return kp.test(s)}function xp(s,e,t){const i=Sp(s,e,t);if(console.warn(i),_p.includes(s))throw new RangeError(i)}function Sp(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 Cp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Tp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Np=/^'([^]*?)'?$/,Mp=/''/g,Dp=/[a-zA-Z]/;function Op(s,e,t){var m,b,y,k;const i=an(),n=i.locale??fp,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=kt(s,t==null?void 0:t.in);if(!Ph(l))throw new RangeError("Invalid time value");let d=e.match(Tp).map(g=>{const $=g[0];if($==="p"||$==="P"){const T=bp[$];return T(g,n.formatLong)}return g}).join("").match(Cp).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const $=g[0];if($==="'")return{isToken:!1,value:Ep(g)};if(za[$])return{isToken:!0,value:g};if($.match(Dp))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;(wp($)||$p($))&&xp($,e,String(s));const T=za[$[0]];return T(l,$,n.localize,p)}).join("")}function Ep(s){const e=s.match(Np);return e?e[1].replace(Mp,"'"):s}function Pp(s,e){const t=kt(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Ap(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 Xn={},Di={};function Ds(s,e){try{const i=(Xn[s]||(Xn[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return i in Di?Di[i]:Qa(i,i.split(":"))}catch{if(s in Di)return Di[s];const t=s==null?void 0:s.match(Ip);return t?Qa(s,t.slice(1)):NaN}}const Ip=/([+-]\d\d):?(\d\d)?/;function Qa(s,e){const t=+(e[0]||0),i=+(e[1]||0),n=+(e[2]||0)/60;return Di[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(Ds(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)),Ja(this),Qn(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=-Ds(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Qn(this),+this}[Symbol.for("constructDateFrom")](e){return new qt(+new Date(e),this.timeZone)}}const Za=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Za.test(s))return;const e=s.replace(Za,"$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),Lp(this),+this},qt.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Qn(this),+this}))});function Qn(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Ds(s.timeZone,s)*60))}function Lp(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()),Ja(s)}function Ja(s){const e=Ds(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(-(Ds(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=Ds(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=Ds(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} (${Ap(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 Bp=(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}`},Oi=s=>{if(!s)return null;const e=Wt(s);return isNaN(e.getTime())?null:e},Fp=(s,e)=>{const t=Qt(s);return isNaN(t.getTime())?"":Op(t,e)},Qt=(s="",e)=>{const t=typeof s=="string"?Wt(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Ah(t):Kn(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},Ei=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 Zn=null,Ra;const Hp=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Zn||Ra!==e)&&(Zn=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),Ra=e),Zn.format(s)},Vp=(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)},Up=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=ot(s);return e.includes(t)},jp=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},eo=(s,e,t,i,n)=>!(!s||isNaN(s.getTime())||!Vp(s,e,t)||i&&Up(s,i)||n&&jp(s,n)),qp=(s,e,t,i,n)=>s.filter(r=>{const a=Oi(r);return a&&eo(a,e,t,i,n)}),Wp=s=>s.slice().sort((e,t)=>{const i=Oi(e),n=Oi(t);return!i||!n?0:i.getTime()-n.getTime()}),zp=(s,e)=>{const t=Oi(s),i=Oi(e);return!t||!i?!1:t<=i};function to(s,e){const t=(e.excludedates??[]).map(i=>typeof i=="string"?i:ot(i));return!eo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function Yp(s,e,t,i){return!!(to(s,t)||!e&&i.multiple&&i.maxMultiple>0&&i.selectedCount>=i.maxMultiple)}function Kp(s,e,t){const i=Js(s,e,0);return!(t&&Qt(t)>i)}function Gp(s,e,t){const i=Js(e===11?s+1:s,e===11?0:e+1,1);return!(t&&Qt(t)<i)}function so(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>Wt(e))}function io(s,e){const t=ja({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 no(s,e,t,i){if(e.length!==1)return!0;const n=ja({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(Pp(n[r]).toString()))return!1}return!0}function Jn(s,e){const t=ot(s);return e.includes(t)?e:[...e,t]}function Rn(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 ro(s,e,t){const i=ot(s);return e.includes(i)?Rn(s,e):t>0&&e.length>=t?e:Jn(s,e)}function Xp(s,e,t){const i=ot(s),n=so(e);if(e.includes(i))return e.indexOf(i)===0?[]:Rn(s,e);if(e.length>1)return[i];if(e.length===1){if(!no(s,n,t.excludedates,t.excludeweekdays))return[i];if(n[0]>s)return[i]}return Jn(s,e)}const Pi=7,Qp=6;function Zp(s,e){const t=Js(s,e,1),i=Js(s,e+1,0),n=(t.getDay()+Qp)%Pi,r=i.getDate(),a=Math.ceil((r+n)/Pi),d=Js(s,e,0).getDate(),p=Wa(t);return{firstDayOfMonth:t,lastDayOfMonth:i,startingDay:n,numDays:r,numRows:a,numDaysPrevMonth:d,initialWeek:p}}function Jp(s,e,t,i){const{startingDay:n,numDays:r}=i;return s===0&&e<n?"prev-month":t>r?"next-month":"current-month"}function Rp(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 ef={ArrowLeft:-1,ArrowRight:1,ArrowUp:-Pi,ArrowDown:Pi};function tf(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function sf(s,e,t){let i=Fa(s,e);if(!i)return null;let n=t(`button[data-date="${ot(i)}"]`);for(;n instanceof HTMLButtonElement&&n.dataset.disabled;)if(i=Fa(i,e),n=t(`button[data-date="${ot(i)}"]`),!n)return null;return i}function nf(s){return ef[s]??null}const rf={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 af(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(()=>({...rf,...k}),[k]),U=h.useMemo(()=>y?Wt(y):Bp(),[y]),X=h.useMemo(()=>l?l.map(f=>typeof f=="string"?Wt(f):f):[],[l]),te=e!==void 0,[$e,q]=h.useState([]),C=te?e:$e,H=h.useMemo(()=>so(C),[C]),[W,Q]=h.useState(0),[se,ie]=h.useState(0),[ue,ne]=h.useState({}),[ge,K]=h.useState(null),[G,Ae]=h.useState(null),re=h.useRef(null),ae=h.useRef([]),Re=h.useRef(0),Ve=h.useRef(!1),Se=h.useRef(!1),Ke=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=Ei(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())?Ei(U):u}else f=Ei(U);if((!f||isNaN(f.getTime()))&&(f=Ei(U)),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(io(H[0],H[1])):(!n||H.length<2)&&ne({})},[n,H]);const lt=h.useCallback(f=>{te||q(f),g==null||g(f)},[te,g]),we=h.useCallback(()=>{$==null||$()},[$]),Ne=h.useCallback((f,u)=>{Q(typeof f=="string"?parseInt(f):f),ie(typeof u=="string"?parseInt(u):u),Re.current=0,Ae(null),ae.current=[],Ve.current=!0},[]),Ge=h.useCallback(()=>{const f=se===0?11:se-1,u=se===0?W-1:W;Ne(u,f)},[W,se,Ne]),Xe=h.useCallback(()=>{const f=se===11?0:se+1,u=se===11?W+1:W;Ne(u,f)},[W,se,Ne]),et=h.useCallback(f=>to(f,Ke),[Ke]),ce=h.useCallback((f,u)=>Yp(f,u,Ke,{multiple:t,maxMultiple:i,selectedCount:C.length}),[Ke,t,i,C.length]),be=h.useCallback(()=>typeof C=="string"?C.split(","):C,[C]),Ie=h.useCallback(f=>{if(!n||H.length!==1||!no(f,H,X,d)||H[0]>=f){K(null);return}K(f),ne(io(H[0],f))},[n,H,X,d]),Me=h.useCallback(f=>{if(!f)return;let u;if(n)u=Xp(f,be(),{excludedates:X,excludeweekdays:d}),te||q(u),u.length===2?(g==null||g(u),we()):(u.length===1&&ne({}),g==null||g(u));else if(t)u=ro(f,be(),i),lt(u);else{const _=ot(f);C.includes(_)?u=[]:u=[_],lt(u),we()}},[n,t,i,be,C,X,d,te,lt,we,g]),xe=h.useCallback(f=>{const u=Jn(f,be());te||q(u),n&&u.length===2&&(g==null||g(u),we())},[be,te,n,g,we]),V=h.useCallback(f=>{const u=Rn(f,be());te||q(u)},[be,te]),De=h.useCallback(f=>{const u=ro(f,be(),i);te||q(u)},[be,i,te]),he=h.useCallback(()=>{var x,L;const f=ot(Ei(U)),u=(x=re.current)==null?void 0:x.querySelector(`button[data-date="${f}"]`);if(u instanceof HTMLButtonElement){Ae(f),u.focus();return}const _=ae.current.find(j=>!j.isDisabled);if(_){const j=(L=re.current)==null?void 0:L.querySelector(`button[data-date="${_.currentDateISO}"]`);j instanceof HTMLButtonElement&&(Ae(_.currentDateISO),j.focus())}},[]),ye=h.useCallback((f,u)=>{const _=f.target;if(tf(_))return;if(f.preventDefault(),!G){he();return}const x=Qt(G),L=sf(x,u,re.current.querySelector.bind(re.current));if(L){const j=re.current.querySelector(`button[data-date="${ot(L)}"]`);j instanceof HTMLButtonElement&&!j.dataset.disabled&&(Ae(ot(L)),j.focus())}},[G,he]),Ue=h.useCallback(f=>{if(f.key==="Escape"){f.preventDefault(),we();return}const u=nf(f.key);u!==null&&ye(f.nativeEvent,u)},[we,ye]),ct=h.useCallback(f=>{re.current&&!re.current.contains(f.relatedTarget)&&!f.target.classList.contains("pkt-hide")&&we()},[we]);return{componentId:O,strings:N,todayDate:U,year:W,month:se,activeSelected:C,_selected:H,inRange:ue,rangeHovered:ge,focusedDate:G,range:n,multiple:t,weeknumbers:p,withcontrols:m,earliest:r,latest:a,excludedates:X,excludeweekdays:d,className:M,dateConstraints:Ke,calendarRef:re,selectableDatesRef:ae,tabIndexSetRef:Re,prevMonth:Ge,nextMonth:Xe,changeMonth:Ne,handleDateSelect:Me,addToSelected:xe,removeFromSelected:V,toggleSelectedDate:De,handleRangeHover:Ie,isExcluded:et,isDayDisabled:ce,focusOnCurrentDate:he,handleKeydown:Ue,handleFocusOut:ct,close:we,setFocusedDate:Ae}}const of=({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?Kp(t,i,n):Gp(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 lf(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:Hp(i),tabindex:d}}function cf(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 df(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 uf=({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:$},U=()=>{const q=[];m&&q.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++)q.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:q})},X=(q,C)=>{const H=lf(q,C,O),{currentDate:W,currentDateISO:Q,isSelected:se,isDisabled:ie,ariaLabel:ue,tabindex:ne}=H;b.current.push({currentDateISO:Q,isDisabled:ie,tabindex:ne});const ge=cf(H,N),K=df(H,N);return o.jsx("td",{className:ge,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":ue,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:q})})},Q)},te=(q,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:q})})},C),$e=()=>{const q=S,C=Zp(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 ue=0;ue<Pi;ue++){const ne=Jp(se,ue,H,C);if(ne==="current-month")ie.push(X(H,q)),H++;else{const ge=Rp(ne,ue,H,C);ie.push(te(ge,`${ne}-${se}-${ue}`)),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:U()}),o.jsx("tbody",{children:$e()})]})},er=h.forwardRef((s,e)=>{const t=af(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(of,{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(uf,{state:t})]})});er.displayName="PktCalendar";const hf=It({tagName:"pkt-card",elementClass:We,react:h,displayName:"PktCard",events:{}}),ao=h.forwardRef(({children:s,...e},t)=>o.jsx(hf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));ao.displayName="PktCard";const oo=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 U=[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(" "),$e=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),q=()=>o.jsxs(o.Fragment,{children:[M&&o.jsx("span",{className:$e+" pkt-tag--gray",children:M}),k&&o.jsx("span",{className:$e+" pkt-tag--blue-light",children:g}),$&&o.jsx("span",{className:$e+" pkt-tag--beige",children:T})]});return o.jsx("div",{className:U,children:o.jsxs("div",{className:te,children:[p==="left"&&o.jsxs("label",{className:X,htmlFor:s,children:[i," ",q(),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," ",q(),n&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:n})]})]})})});oo.displayName="PktCheckbox";const pf=It({tagName:"pkt-combobox",elementClass:Pe,react:h,displayName:"PktCombobox",events:{onClick:"click",onChange:"change",onInput:"input",onBlur:"blur",onFocus:"focus",onValueChange:"value-change",onToggleHelpText:"toggleHelpText"}}),lo=h.forwardRef(({children:s,helptext:e,...t},i)=>o.jsxs(pf,{...t,ref:i,children:[e&&o.jsx("div",{slot:"helptext",className:"pkt-contents",children:e}),s]}));lo.displayName="PktCombobox";const ln=It({tagName:"pkt-consent",elementClass:Tt,react:h,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});ln.displayName="PktConsent";const Os=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:U=!1,role:X="group",counterPosition:te="bottom"},$e)=>{const[q,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),ue=["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(" "),ge=()=>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?U?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})},Ae=()=>!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:q?"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 ${q?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:i})]})]}),re=o.jsxs(o.Fragment,{children:[G(),Ae(),Q&&o.jsx(ge,{}),O,se&&o.jsx(ge,{}),k&&g&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(rn,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:g})})]});return o.jsx("div",{className:ue,ref:$e,role:X,children:U?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":H,children:re}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:re})})});Os.displayName="PktInputWrapper";const co=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},ff=()=>co()?"text":"date",mf=s=>!s||s.length!==2?!0:zp(s[0],s[1]),gf=(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"}),vf=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),bf=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),yf=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,kf=(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},cn=(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&&kf(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(er,{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})})},dn=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},U={"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(U,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})]})});dn.displayName="PktTag";const $f=({dates:s,dateformat:e,idBase:t,strings:i,onDateRemoved:n})=>{var l;const r=Wp(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=Fp(d,e);return o.jsx(dn,{id:`${t}${d}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>n(d),children:o.jsx("time",{dateTime:d,children:p})},d)})})},wf=({state:s})=>{var Ke,lt,we,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:U,buttonClasses:X,rangeLabelClasses:te,datepickerInputsClasses:$e,isInputDisabled:q,inputRef:C,inputRefTo:H,btnRef:W,toggleCalendar:Q,handleFocus:se,handleSingleInputChange:ie,handleRangeFromChange:ue,handleRangeToChange:ne,handleRangeBlur:ge,handleMultipleBlur:K,handleTagRemoved:G,handleSingleKeydown:Ae,handleRangeFromKeydown:re,handleRangeToKeydown:ae,handleMultipleKeydown:Re,restProps:Ve}=s,Se=()=>{var Ge,Xe;return o.jsxs("button",{ref:W,className:X,type:"button",onClick:Q,disabled:d,"aria-label":((Ge=N.calendar)==null?void 0:Ge.buttonAltText)??"Åpne kalender",children:[o.jsx(Y,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Xe=N.calendar)==null?void 0:Xe.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx($f,{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:U,type:S,id:t,name:y??e,placeholder:k,readOnly:p||O&&!p,disabled:q,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":g,"aria-errormessage":g?`${e}-error`:void 0,onClick:Q,onKeyDown:Re,onFocus:se,onBlur:K}),Se()]})})]}):a?o.jsx("div",{className:$e,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Ke=N.generic)==null?void 0:Ke.from)??"Fra"}),o.jsx("input",{...Ve,ref:C,className:U,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:ge,onChange:ue}),o.jsx("div",{className:te,id:`${e}-to-label`,children:((we=N.generic)==null?void 0:we.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:H,className:U,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:ge,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:U,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:Ae,onFocus:se,onBlur:void 0,onChange:ie}),Se()]})})},xf={calendar:{buttonAltText:"Åpne kalender"}},Sf={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},uo=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Cf(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:U=!1,helptext:X,helptextDropdown:te,helptextDropdownButton:$e,hasError:q=!1,errorMessage:C,optionalTag:H=!1,optionalText:W,requiredTag:Q=!1,requiredText:se,tagText:ie,useWrapper:ue=!0,strings:ne,disabled:ge=!1,readOnly:K=!1,required:G=!1,name:Ae,min:re,max:ae,placeholder:Re,onChange:Ve,onValueChange:Se,className:Ke,...lt}=s,we=h.useCallback(D=>D===void 0?[]:uo(D),[]),Ne=n!==void 0,Ge=typeof r=="number"?void 0:r,[Xe,et]=h.useState(()=>we(n??Ge)),ce=Ne?we(n):Xe;h.useEffect(()=>{Ne&&et(we(n))},[n,Ne,we]);const[be,Ie]=h.useState(M??!1);h.useEffect(()=>{M!==void 0&&Ie(M)},[M]);const Me=h.useRef(null),xe=h.useRef(null),V=h.useRef(null),De=h.useRef(null),he=h.useRef(null),ye=h.useMemo(()=>ff(),[]),Ue=h.useMemo(()=>co(),[]),ct=h.useMemo(()=>ne??(p?Sf:xf),[ne,p]),f=typeof re=="string"?re:re!==void 0?String(re):void 0,u=typeof ae=="string"?ae:ae!==void 0?String(ae):void 0,_=h.useMemo(()=>{const D=gf(O,m,l,p,K,ye);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[O,m,l,p,K,ye]),x=h.useMemo(()=>{const D=vf();return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[]),L=h.useMemo(()=>{const D=bf(m);return Object.entries(D).filter(([,E])=>E).map(([E])=>E).join(" ")},[m]),j=h.useMemo(()=>["pkt-datepicker__inputs",p&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,m]),R=h.useMemo(()=>{if($)return $;if(u)return u.slice(0,7)},[$,u]),ft=ge||l&&d!=null&&ce.length>=d,Qe=l&&d!=null,mt=`${t}-input`,ls=ce.join(",");h.useEffect(()=>{V.current&&(V.current.value=ls)},[ls]),h.useEffect(()=>{S&&typeof window<"u"&&S!==window.pktTz&&(window.pktTz=S)},[S]);const tt=h.useCallback((D,E=!0)=>{Ne||et(D),E&&(Se==null||Se(D))},[Ne,Se]),dr=h.useMemo(()=>{var D;return(D=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:D.set},[]),_t=h.useCallback(D=>{const E=V.current;!E||!dr||(dr.call(E,D.join(",")),E.dispatchEvent(new Event("input",{bubbles:!0})))},[dr]),Zt=h.useCallback(()=>{ge||Ie(D=>!D)},[ge]),cs=h.useCallback(()=>{Ie(!1)},[]);h.useEffect(()=>{if(!be)return;const D=st=>{var vn;const Ze=st.target;he.current&&!he.current.contains(Ze)&&!((vn=Ze.closest)!=null&&vn.call(Ze,".pkt-calendar-popup"))&&cs()},E=st=>{var Ze;st.key==="Escape"&&(cs(),(Ze=Me.current)==null||Ze.focus())};return document.addEventListener("click",D,!0),document.addEventListener("keydown",E),()=>{document.removeEventListener("click",D,!0),document.removeEventListener("keydown",E)}},[be,cs]);const zm=h.useCallback(()=>{Ue&&!be&&Ie(!0)},[Ue,be]),Ym=h.useCallback(D=>{var Ze;const E=yf(D,l,p),st=uo(E);tt(st),_t(st),!l&&!p&&(cs(),(Ze=Me.current)==null||Ze.focus())},[l,p,tt,_t,cs]),Km=h.useCallback(()=>{var D;cs(),(D=Me.current)==null||D.focus()},[cs]),Gm=h.useCallback(D=>{const E=D.target.value,st=E?[E]:[];tt(st),_t(st)},[tt,_t]),Xm=h.useCallback(D=>{const E=D.target.value,st=ce[1]??"",Ze=[E,st].filter(Boolean);tt(Ze),_t(Ze)},[ce,tt,_t]),Qm=h.useCallback(D=>{const E=ce[0]??"",st=D.target.value,Ze=[E,st].filter(Boolean);tt(Ze),_t(Ze)},[ce,tt,_t]),Zm=h.useCallback(()=>{ce.length===2&&!mf(ce)&&(tt([ce[0]]),_t([ce[0]]))},[ce,tt,_t]),gn=h.useCallback(D=>{const E=Qt(D),st=f?Qt(f):null,Ze=u?Qt(u):null;if(E&&!isNaN(E.getTime())&&(!st||E>=st)&&(!Ze||E<=Ze)){const vn=qp([...ce,D],f,u,k,g),jo=[...new Set(vn)];tt(jo),_t(jo)}},[ce,f,u,k,g,tt,_t]),Jm=h.useCallback(D=>{const E=D.target;E.value&&(gn(E.value.split(",")[0]),E.value="")},[gn]),Uo=h.useCallback(D=>{const E=D.target;E.value&&(gn(E.value.split(",")[0]),E.value="")},[gn]),Rm=h.useCallback(D=>{const E=ce.filter(st=>st!==D);tt(E),_t(E)},[ce,tt,_t]),ds=h.useCallback(D=>{const E=D==null?void 0:D.closest("form");E?E.requestSubmit():D==null||D.blur()},[]),eg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),void 0,()=>{var E;return(E=Me.current)==null?void 0:E.blur()})},[Zt,ds]),tg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),()=>{var E;return(E=xe.current)==null?void 0:E.focus()},()=>{var E;return(E=Me.current)==null?void 0:E.blur()})},[Zt,ds]),sg=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(xe.current),void 0,()=>{var E;return(E=xe.current)==null?void 0:E.blur()})},[Zt,ds]),ig=h.useCallback(D=>{cn(D.nativeEvent,()=>Zt(),()=>ds(Me.current),void 0,()=>{var E;return(E=Me.current)==null?void 0:E.blur()},Uo)},[Zt,ds,Uo]);return h.useImperativeHandle(e,()=>({get value(){var D;return((D=V.current)==null?void 0:D.value)??""},set value(D){const E=D?D.split(",").filter(Boolean):[];et(E),V.current&&(V.current.value=D??"")},focus(){var D;(D=Me.current)==null||D.focus()},blur(){var D;(D=Me.current)==null||D.blur()}}),[]),{id:t,inputId:mt,label:i,values:ce,calendarOpen:be,dateformat:a,multiple:l,maxlength:d,range:p,showRangeLabels:m,weeknumbers:b,withcontrols:y,excludedates:k,excludeweekdays:g,disabled:ge,readOnly:K,required:G,name:Ae,placeholder:Re,fullwidth:O,hasFieldset:N,inline:U,helptext:X,helptextDropdown:te,helptextDropdownButton:$e,hasError:q,errorMessage:C,optionalTag:H,optionalText:W,requiredTag:Q,requiredText:se,tagText:ie,useWrapper:ue,className:Ke,minStr:f,maxStr:u,effectiveCurrentMonth:R,today:T,inputType:ye,isIOSDevice:Ue,strings:ct,inputClasses:_,buttonClasses:x,rangeLabelClasses:L,datepickerInputsClasses:j,isInputDisabled:ft,hasCounter:Qe,inputRef:Me,inputRefTo:xe,changeInputRef:V,btnRef:De,wrapperRef:he,onChange:Ve,toggleCalendar:Zt,hideCalendar:cs,handleDateSelected:Ym,handleCalendarClose:Km,handleFocus:zm,handleSingleInputChange:Gm,handleRangeFromChange:Xm,handleRangeToChange:Qm,handleRangeBlur:Zm,handleMultipleBlur:Jm,handleTagRemoved:Rm,handleSingleKeydown:eg,handleRangeFromKeydown:tg,handleRangeToKeydown:sg,handleMultipleKeydown:ig,restProps:lt}}const ho=h.forwardRef((s,e)=>{const t=Cf(s,e),i=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:i,children:[o.jsx(Os,{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(wf,{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"})]})});ho.displayName="PktDatepicker";const Tf={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},Nf={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},Mf={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},Df={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},po=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),Of=()=>{const s=po(),e=po();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class fo{constructor(e,t){bn(this,"fileId");bn(this,"file");bn(this,"attributes",{});this.fileId=t||Of(),this.file=e,this.attributes={targetFilename:e.name}}}const tr=h.createContext({}),Ef=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",Pf=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():Ef,[k]);h.useImperativeHandle(b,()=>y.current);const[$,T]=h.useState(!1),M=h.useMemo(()=>l?e?Mf:Df:e?Tf:Nf,[e,l]),S=h.useCallback(C=>{if(y.current)try{y.current.files=Af(C)}catch{}},[y.current,t]);h.useEffect(()=>{S(t)},[y,t]);const O=h.useCallback(C=>{const H=C.map(W=>new fo(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))},U=C=>{O(C)},X=C=>{if(C.preventDefault(),T(!1),d)return;const H=C.dataTransfer.files,W=Array.from(H);U(W)},te=C=>{C.preventDefault(),!d&&T(!0)},$e=()=>{T(!1)},q=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:$e,onClick:q,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]})]})]})}),Af=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},sr=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:U,rows:X,useWrapper:te=!0,onChange:$e,value:q,autoComplete:C="off",minLength:H,maxLength:W,readOnly:Q,skipForwardTestid:se=!1,...ie},ue)=>{const ne=[r,"pkt-textinput","pkt-textarea"].join(" "),ge=`${s}-input`,K=`${ge}-label`,G=t||K,[Ae,re]=h.useState(0),ae=Re=>{var Ve,Se;i&&re(((Se=(Ve=Re.currentTarget)==null?void 0:Ve.value)==null?void 0:Se.length)||0),$e&&$e(Re)};return h.useEffect(()=>{q!==void 0&&re((q==null?void 0:q.length)||0)},[q]),o.jsx(Os,{ariaDescribedby:e,className:ne,disabled:a,errorMessage:l,forId:ge,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:Ae,counterMaxLength:n,children:o.jsx("textarea",{ref:ue,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${n&&Ae>n?"pkt-input--counter-error":""}`,name:`${$||s}`,id:ge,placeholder:U,disabled:a,rows:X,"aria-labelledby":G,"aria-invalid":d,"aria-errormessage":`${s}-error`,...ie,onChange:ae,value:q,autoComplete:C,minLength:H,maxLength:W,readOnly:Q,"data-skip-forward-testid":se?"true":void 0})})});sr.displayName="PktTextarea";const If=Symbol("comment"),Lf=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}`},Bf=({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(sr,{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"})]})},Ff=({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:Lf(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,Hf=s=>{const e=h.useContext(tr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},Vf=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(Bf,{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(Ff,{comments:l,onDeleteComment:d=>i(n.fileId,d),onEditComment:r?()=>r():void 0})},renderHidden:n=>o.jsx(Hf,{comments:e.get(n.fileId)},`comments${n.fileId}`),symbol:If}},Uf=Symbol("deleteFile"),jf=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:Uf}),qf=Symbol("renameFile"),Wf=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"})]})},zf=s=>{const e=h.useContext(tr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},Yf=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,i)=>o.jsx(Wf,{value:e.get(t.fileId)||void 0,onSave:n=>{e.set(t.fileId,n),i()},onCancel:i}),renderHidden:t=>o.jsx(zf,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:qf}},Kf=(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])}},Gf=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}},Xf=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}},Qf=It({tagName:"pkt-modal",elementClass:xt,react:h,displayName:"PktModal",events:{}}),ir=h.forwardRef(({children:s,...e},t)=>o.jsx(Qf,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));ir.displayName="PktModal";const mo=2,Zf=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},Jf=(s,e,t)=>{const i=e*t;return s.getBoundingClientRect().height>i+.5},go=h.createContext({tail:5}),Ai=({children:s,tail:e,...t})=>{const i=s,n=h.useContext(go),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 $=Zf(k);m(Jf(g,$,mo))},[]),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:mo,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})]})},Rf=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}},un=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`,nr=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"}),em=()=>{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)]})},tm=({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(Ai,{children:e.attributes.targetFilename})}),o.jsx(nr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(mn,{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:un(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(em,{})]})},sm=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx(nr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(mn,{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:un(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},im=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx(nr,{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})]}),nm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(sm,{transferItem:s,onRemove:e}):o.jsx(im,{transferItem:s,onRemove:e}),rm=({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})},vo=({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(Ai,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:un(s.file.size)})]}),am=({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(Ai,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},bo=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(ir,{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});bo.displayName="ImagePreviewModal";const om=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||"")},rr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",lm=({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(rm,{operation:n,onActivate:t,transferItem:i},n.symbol.toString()))}),cm=({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()))}),dm=({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(lm,{operations:p,activatedOperation:e,onActivate:n,transferItem:s}),o.jsx(cm,{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)})]})},um=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,enableImagePreview:n,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:d})=>{const p=rr(s.progress),m=n&&s.progress==="done"&&om(s);switch(p){case"in-progress":return o.jsx(tm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(nm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(dm,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:i,onActivate:r,onClose:a,onPreviewClick:m?()=>d(s.fileId):void 0})}},hm=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||"")},pm=(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[rr(r.progress)]-n[rr(a.progress)])},[s,e,t]),fm=(s,e)=>h.useMemo(()=>e?s.filter(t=>t.progress==="done"&&hm(t)):[],[s,e]),mm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:i=[],ItemRenderer:n=vo,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const d=pm(s,t,l),p=fm(d,a),m=Xf(i),b=Gf(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(go.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(um,{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(bo,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},ar={filename:vo,thumbnail:am},yo=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=ar.filename,fullWidth:y=!1,allowedFormats:k,formatErrorMessage:g,maxFileSize:$,sizeErrorMessage:T,onFileValidation:M,errorMessage:S,hasError:O=!1,disabled:N=!1,label:U,helptext:X,optionalTag:te,requiredTag:$e,enableImagePreview:q=!1,...C},H)=>{const W="transfers"in C?C.transfers:void 0,[Q,se]=h.useState(null),ie=O||!!Q,ue=S||Q,ne=$?Rf($):void 0,ge=h.useCallback(V=>{var De;if(k&&k.length>0){const he=((De=V.name.split(".").pop())==null?void 0:De.toLowerCase())||"",ye=V.type.toLowerCase();if(!k.some(ct=>{const f=ct.toLowerCase().replace(/^\./,"");if(f.includes("/")){if(f.endsWith("/*")){const u=f.replace("/*","");return ye.startsWith(u+"/")}return ye===f}return he===f})){const ct=k.join(", "),f=`Ugyldig filtype. Tillatte formater: ${ct}`;return(g==null?void 0:g.replace("{formats}",ct))||f}}if(ne&&V.size>ne){const he=un(ne),ye=`Filen er for stor. Maks størrelse er ${he}.`;return(T==null?void 0:T.replace("{maxSize}",he))||ye}return M?M(V):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||[],Ae=typeof b=="string"?ar[b]:b,re=b==="thumbnail",ae=typeof C.accept=="string"?C.accept.trim():void 0,Re=h.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const De=V.toLowerCase();return De.includes("/")||De.startsWith(".")?De:`.${De}`}).join(", ")},[k]),Ve=ae||Re,Se=a&&!re,Ke=r&&!re,lt=h.useCallback(V=>{for(const he of V){const ye=ge(he.file);if(ye){se(ye);return}}se(null);const De=i?[...G,...V]:[V[0]];d&&d(De),n==="custom"&&p&&V.forEach(he=>{p==null||p(he)})},[d,G,i,n,p,ge]),we=h.useCallback((V,De)=>{const he=G.map(ye=>ye.fileId===V?{...ye,...De}:ye);d&&d(he)},[d,G]),Ne=h.useCallback(V=>{var he;const De=G.filter(ye=>ye.fileId!==V);d&&d(De),"onTransferCancelled"in C&&C.onTransferCancelled&&((he=C.onTransferCancelled)==null||he.call(C,V))},[d,G,C]),{fileAttributes:Ge}=Kf(G,we),Xe=h.useMemo(()=>[{op:Yf,enabled:Se},{op:V=>Vf(V),enabled:Ke}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...m),[Se,Ke]),et=h.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ce,uploadedCount:be,failedCount:Ie}=h.useMemo(()=>{const V=G.length;if(!W)return{totalCount:V,uploadedCount:0,failedCount:0};let De=0,he=0;for(const ye of G){const Ue=W.find(ct=>ct.fileId===ye.fileId);(Ue==null?void 0:Ue.progress)==="done"&&De++,(Ue==null?void 0:Ue.progress)==="error"&&he++}return{totalCount:V,uploadedCount:De,failedCount:he}},[G,W]),Me=ce===1?"fil":"filer",xe=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(tr.Provider,{value:{name:C.name||"",multiple:!!i,id:t},children:[o.jsx("div",{id:et.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ce>0&&be>0&&`${be} av ${ce} ${Me} lastet opp`}),o.jsx("div",{id:et.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ce>0&&Ie>0&&`Feil ved opplasting: ${Ie} av ${ce} ${Me} feilet`}),o.jsx(Pf,{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:et}),ie&&ue&&o.jsx(rn,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:ue}),o.jsx(mm,{files:G,cancelTransfer:Ne,truncateTail:l,transfers:W,uploadStrategy:n,ItemRenderer:Ae,enableImagePreview:re&&q,queueItemOperations:Xe.map(V=>V(Ge)).concat(jf(Ne))})]})});return U?o.jsx(Os,{forId:t,label:U,helptext:X,disabled:N,hasError:ie,optionalTag:te,requiredTag:$e,className:oe("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":y}),children:xe}):xe});yo.displayName="PktFileUpload";const gm=({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(ln,{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}`))})]})]})})},vm=({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(ln,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:d,cookieSecure:p,cookieExpiryDays:m,onToggleConsent:b})})]})})})},bm=(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 ym(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 hn=({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]})};hn.displayName="PktLink";const km=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},pn=({item:s,className:e})=>"href"in s?o.jsx(hn,{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(pn,{item:e})},t))}),ko=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(km);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(pn,{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(pn,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(pn,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});ko.displayName="PktHeaderUserMenu";const fn=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:U,tagText:X=null,placeholder:te,prefix:$e,suffix:q,type:C="text",useWrapper:H=!0,omitSearchIcon:W=!1,value:Q,minLength:se,maxLength:ie,min:ue,max:ne,step:ge,size:K,readonly:G,required:Ae,dataTestid:re,onChange:ae,skipForwardTestid:Re=!1,...Ve},Se)=>{const Ke=[a,"pkt-textinput"].join(" "),lt=C==="search"&&!k&&!W,we=C==="date"&&Q?Q.slice(0,10):Q,[Ne,Ge]=h.useState((Q==null?void 0:Q.length)||0),Xe=`${s}`,et=`${Xe}-label`,ce=t||et,be=Ie=>{var Me,xe;n&&Ge(((xe=(Me=Ie.currentTarget)==null?void 0:Me.value)==null?void 0:xe.length)||0),ae&&ae(Ie)};return h.useEffect(()=>{Q!==void 0&&Ge((Q==null?void 0:Q.length)||0)},[Q]),o.jsx(Os,{ariaDescribedby:e,className:Ke,disabled:l,errorMessage:d,forId:Xe,hasError:p,helptext:m,helptextDropdown:b,helptextDropdownButton:y,inline:g,label:T,optionalTag:S,optionalText:O,requiredTag:N,requiredText:U,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":Re?"true":void 0,children:[$e&&o.jsx("div",{className:"pkt-input-prefix",children:$e}),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:we,id:Xe,placeholder:te,autoComplete:i,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ce,min:ue,max:ne,onChange:be,step:ge,minLength:se,maxLength:ie,size:K,readOnly:G,required:Ae}),q&&o.jsxs("p",{className:"pkt-input-suffix",children:[q,k&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:k}),lt&&o.jsx(Y,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!q&&k&&o.jsx(Y,{className:"pkt-input-icon",name:k}),!q&<&&o.jsx(Y,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});fn.displayName="PktTextinput";const or=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:U,canChangeRepresentation:X=!1,changeRepresentation:te,hideLogo:$e=!1,logoLink:q,logoClick:C,position:H="fixed",scrollBehavior:W="hide",slotMenuVariant:Q="icon-only",slotMenuText:se="Meny"},ie)=>{const ue=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(()=>{U&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[U]),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 ge=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[Ae,re]=h.useState(!1),[ae,Re]=h.useState(0),[Ve,Se]=h.useState(!1),[Ke,lt]=h.useState(!1),we=h.useRef(null),Ne=h.useRef(null),Ge=h.useRef(null),Xe=h.useRef(null),et=h.useRef(null),ce=h.useRef(null),be=h.useRef(null),Ie=h.useRef(!1),Me=bm(we),xe=Me<s,V=Me<e,De=h.useCallback(u=>{we.current=u,typeof ie=="function"?ie(u):ie&&(ie.current=u)},[ie]);ym(ue&&xe&&K!=="none");const he=h.useCallback((u,_)=>{const x=u.relatedTarget;let L;switch(_){case"user":L=Ne;break;case"slot":L=Ge;break;case"search":L=Xe;break;default:return}const j=L.current;j&&(!x||!j.contains(x))&&G("none")},[]),ye=h.useCallback(()=>{Ie.current&&be.current&&document.contains(be.current)&&be.current.focus(),be.current=null,Ie.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(),Ie.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),Re(_)}};return document&&window.addEventListener("scroll",u),()=>{document&&window.removeEventListener("scroll",u)}},[ne,ae]);const Ue=h.useCallback(u=>{const _=u==="slot"?Ge:Xe,x=u==="slot"?et:ce;if(!_.current||!x.current||!V||xe)return;const L=_.current.getBoundingClientRect(),j=x.current.offsetWidth,R=L.left+j>window.innerWidth;u==="slot"?Se(R):lt(R)},[V,xe]),ct=h.useCallback(u=>{K!=="none"?G("none"):(be.current=document.activeElement,G(u))},[K]);h.useEffect(()=>{(K==="slot"||K==="search")&&requestAnimationFrame(()=>{Ue(K)})},[K,Ue]);const f=o.jsxs("header",{className:oe("pkt-header-service",n&&"pkt-header-service--compact",xe&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",ue&&"pkt-header-service--fixed",ne&&"pkt-header-service--scroll-to-hide",Ae&&"pkt-header-service--hidden",i),"data-mode":r,ref:De,children:[o.jsxs("div",{className:oe("pkt-header-service__logo-area",(!M||M==="")&&"pkt-header-service__logo-area--without-service"),children:[!$e&&o.jsx("span",{className:"pkt-header-service__logo",children:q?o.jsx("a",{href:q,"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(hn,{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=>he(u,"slot"),ref:Ge,children:[V&&t&&o.jsx(at,{skin:"secondary",variant:Q,iconName:"menu",size:xe?"small":"medium",state:K==="slot"?"active":"normal",onClick:()=>ct("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:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:et,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:oe("pkt-header-service__search-container",K==="search"&&"is-open"),onBlur:u=>he(u,"search"),ref:Xe,children:[o.jsx(at,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:xe?"small":"medium",onClick:()=>ct("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",Ke&&"align-right"),ref:ce,children:K==="search"&&o.jsx(fn,{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(fn,{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))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"secondary",size:xe?"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=>he(u,"user"),ref:Ne,children:[o.jsxs(at,{className:oe("pkt-header-service__user-button",xe&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:xe?"small":"medium",state:K==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:K==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>ct("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(xe?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(ko,{user:S,formattedLastLoggedIn:ge,representing:g,userMenu:O,canChangeRepresentation:X,changeRepresentation:te,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!xe&&l&&(a==="header"||a==="both")&&o.jsx(at,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return ue?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",xe&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):f});or.displayName="PktHeaderService";const _o=h.forwardRef((s,e)=>o.jsx(or,{...s,ref:e}));_o.displayName="PktHeader";const $m=It({tagName:"pkt-heading",elementClass:ss,react:h,displayName:"PktHeading"}),$o=h.forwardRef(({children:s,...e},t)=>o.jsx($m,{"data-testid":"pkt-heading",...e,ref:t,children:s}));$o.displayName="PktHeading";const wm=It({tagName:"pkt-helptext",elementClass:Yt,react:h,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),wo=h.forwardRef(({children:s,...e},t)=>o.jsx(wm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));wo.displayName="PktHelptext";const xo=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]}));xo.displayName="PktInput";const So=({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})]})};So.displayName="PktLinkCard";const xm=It({tagName:"pkt-loader",elementClass:Pt,react:h,displayName:"PktLoader",events:{}}),Co=h.forwardRef(({children:s,...e},t)=>o.jsx(xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Co.displayName="PktLoader";const To=({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})]})};To.displayName="PktMessagebox";const Sm=It({tagName:"pkt-progressbar",elementClass:Fe,react:h,displayName:"PktProgressbar",events:{}}),mn=h.forwardRef(({children:s,...e},t)=>o.jsx(Sm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));mn.displayName="PktProgressbar";const No=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(" "),U=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),X=()=>o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:U+" pkt-tag--gray",children:g}),m&&o.jsx("span",{className:U+" pkt-tag--blue-light",children:b}),y&&o.jsx("span",{className:U+" 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})]})]})})});No.displayName="PktRadioButton";const Mo=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,U)=>{N?N():k&&k(U)},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,U)=>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,U),onKeyUp:X=>X.key==="Enter"&&T(N.onClick,U)},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-${U}`))})]}))});Mo.displayName="PktSearchInput";const Do=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},U)=>{const X=[i,"pkt-select"].join(" ");return o.jsx(Os,{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:U,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})})});Do.displayName="PktSelect";const Cm=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)"}})}),Tm=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"})]}),Nm=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"})]}),Mm=({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"?Tm:t==="completed"?Nm:Cm}),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})]})]}),Oo=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})});Oo.displayName="PktStepper";const Dm=({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}),Om=({id:s,children:e,className:t,...i})=>o.jsx("tbody",{id:s,className:oe(t,"pkt-table__body",{}),...i,role:"rowgroup",children:e}),Em=({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}),Pm=({className:s,children:e,...t})=>o.jsx("thead",{className:oe(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),Am=({className:s,children:e,...t})=>o.jsx("th",{className:oe(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),Im=({className:s,children:e,...t})=>o.jsx("tr",{className:oe(s,"pkt-table__row",{}),role:"row",...t,children:e}),lr=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}=Lm(),$={"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(dn,{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})});lr.displayName="PktTabItem";const Eo=h.createContext(null),Lm=()=>{const s=h.useContext(Eo);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Po=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(lr,{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(Eo.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})})})});Po.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 Ao(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function Bm(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 Ii(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 Io(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function Fm(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function cr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Lo(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=Lo(n[r].shadowRoot),i));r++);return i}function Bo(s){return s.isConnected||document.body.contains(s)}function Fo(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=le.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 Hm(s){if(!s.defaultPrevented){var e=s.target,t=le.imagemapUseValue,i=Fo(s);t===null&&i&&(t=i.value);var n=Ii(e);if(n){var r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?n.close(t):n.close())}}}function Ho(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",Hm,!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))}Ho.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Bo(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_),le.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=Lo(this.dialog_)),Io(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(!Bo(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!le.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Bm(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,le.needsCentering(this.dialog_)?(le.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});Ao(this.dialog_,e)}};var le={};if(le.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"},le.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||!Fm(a,s))){var l=r.style.getPropertyValue("top"),d=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||d&&d!=="auto")return!0}}}return!1},le.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:!le.isInlinePositionSetByStylesheet(s)},le.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 Ho(s)},le.registerDialog=function(s){s.showModal||le.forceRegisterDialog(s)},le.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)}))},le.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})},le.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},le.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)},le.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=Ii(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},le.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(),Io(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}},le.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&&Ao(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},le.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},le.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)},le.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())},le.dm=new le.DialogManager,le.formSubmitter=null,le.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Vo=document.createElement("form");if(Vo.setAttribute("method","dialog"),Vo.method!=="dialog"){var ei=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(ei){var Vm=ei.get;ei.get=function(){return cr(this)?"dialog":Vm.call(this)};var Um=ei.set;ei.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):Um.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",ei)}}document.addEventListener("click",function(s){if(le.formSubmitter=null,le.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!cr(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;le.imagemapUseValue=s.offsetX+","+s.offsetY}var n=Ii(e);n&&(le.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=Ii(e);if(!t){var i=Fo(s),n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&s.preventDefault()}});var jm=HTMLFormElement.prototype.submit,qm=function(){if(!cr(this))return jm.call(this);var s=Ii(this);s&&s.close()};HTMLFormElement.prototype.submit=qm}const Wm=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));A.FileItem=fo,A.ItemRenderers=ar,A.PktAccordion=hr,A.PktAccordionItem=Ea,A.PktAlert=rn,A.PktBackLink=Aa,A.PktBreadcrumbs=Ia,A.PktButton=at,A.PktCalendar=er,A.PktCard=ao,A.PktCheckbox=oo,A.PktCombobox=lo,A.PktConsent=ln,A.PktDatepicker=ho,A.PktFileUpload=yo,A.PktFooter=gm,A.PktFooterSimple=vm,A.PktHeader=_o,A.PktHeaderService=or,A.PktHeading=$o,A.PktHelptext=wo,A.PktIcon=Y,A.PktInput=xo,A.PktInputWrapper=Os,A.PktLink=hn,A.PktLinkCard=So,A.PktLoader=Co,A.PktMessagebox=To,A.PktModal=ir,A.PktProgressbar=mn,A.PktRadioButton=No,A.PktSearchInput=Mo,A.PktSelect=Do,A.PktStep=Mm,A.PktStepper=Oo,A.PktTabItem=lr,A.PktTable=Dm,A.PktTableBody=Om,A.PktTableDataCell=Em,A.PktTableHeader=Pm,A.PktTableHeaderCell=Am,A.PktTableRow=Im,A.PktTabs=Po,A.PktTag=dn,A.PktTextarea=sr,A.PktTextinput=fn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.3",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@lit-labs/ssr-dom-shim": "^1.2.1",
|
|
41
41
|
"@lit/react": "^1.0.7",
|
|
42
|
-
"@oslokommune/punkt-elements": "^15.4.
|
|
42
|
+
"@oslokommune/punkt-elements": "^15.4.3",
|
|
43
43
|
"classnames": "^2.5.1",
|
|
44
44
|
"prettier": "^3.3.3",
|
|
45
45
|
"react-hook-form": "^7.53.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@eslint/eslintrc": "^3.3.3",
|
|
51
51
|
"@eslint/js": "^9.37.0",
|
|
52
52
|
"@oslokommune/punkt-assets": "^15.0.0",
|
|
53
|
-
"@oslokommune/punkt-css": "^15.4.
|
|
53
|
+
"@oslokommune/punkt-css": "^15.4.3",
|
|
54
54
|
"@testing-library/jest-dom": "^6.5.0",
|
|
55
55
|
"@testing-library/react": "^16.0.1",
|
|
56
56
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
110
110
|
},
|
|
111
111
|
"license": "MIT",
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "2209815d9725ba435cd62f140625a3f40903202a"
|
|
113
113
|
}
|
|
@@ -15,10 +15,7 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import type { IPktDatepicker, IDatepickerState } from './types'
|
|
17
17
|
|
|
18
|
-
export function useDatepickerState(
|
|
19
|
-
props: IPktDatepicker,
|
|
20
|
-
ref: React.ForwardedRef<HTMLDivElement>,
|
|
21
|
-
): IDatepickerState {
|
|
18
|
+
export function useDatepickerState(props: IPktDatepicker, ref: React.ForwardedRef<HTMLDivElement>): IDatepickerState {
|
|
22
19
|
const {
|
|
23
20
|
id,
|
|
24
21
|
label,
|
|
@@ -72,7 +69,7 @@ export function useDatepickerState(
|
|
|
72
69
|
}, [])
|
|
73
70
|
|
|
74
71
|
const isControlled = value !== undefined
|
|
75
|
-
const initialDefault = typeof defaultValue === 'number' ? undefined : defaultValue as string | string[] | undefined
|
|
72
|
+
const initialDefault = typeof defaultValue === 'number' ? undefined : (defaultValue as string | string[] | undefined)
|
|
76
73
|
const [internalValue, setInternalValue] = useState<string[]>(() => normalizeValue(value ?? initialDefault))
|
|
77
74
|
const values = isControlled ? normalizeValue(value) : internalValue
|
|
78
75
|
|
|
@@ -134,7 +131,7 @@ export function useDatepickerState(
|
|
|
134
131
|
}, [showRangeLabels])
|
|
135
132
|
|
|
136
133
|
const datepickerInputsClasses = useMemo(
|
|
137
|
-
() => ['pkt-datepicker__inputs', range &&
|
|
134
|
+
() => ['pkt-datepicker__inputs', range && 'pkt-input__range-inputs'].filter(Boolean).join(' '),
|
|
138
135
|
[range, showRangeLabels],
|
|
139
136
|
)
|
|
140
137
|
|