@oslokommune/punkt-elements 19.20.0 → 20.0.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/{alert-UbQzzkXb.js → alert-CA1fDbyc.js} +2 -2
  3. package/dist/{alert-KxCE28nq.cjs → alert-DkyTTo7S.cjs} +1 -1
  4. package/dist/{backlink-bbYpIZJI.js → backlink-CDBRcaAu.js} +1 -1
  5. package/dist/{backlink-CqRcFURx.cjs → backlink-CXOxMeyt.cjs} +1 -1
  6. package/dist/{breadcrumbs-D7gddV5F.js → breadcrumbs-5oUaCef3.js} +1 -1
  7. package/dist/{breadcrumbs-C_JR4ZI_.cjs → breadcrumbs-zfUto2U5.cjs} +1 -1
  8. package/dist/{button-BJ6QLwxJ.js → button-Bswo1C0M.js} +1 -1
  9. package/dist/{button-pFlrTF2P.cjs → button-bVWAX98x.cjs} +1 -1
  10. package/dist/{calendar-CYsQEfZn.js → calendar-BOd-9PDd.js} +1 -1
  11. package/dist/{calendar-Fk5ubNGR.cjs → calendar-CDTCgTJn.cjs} +1 -1
  12. package/dist/card-BbV4OBqb.cjs +67 -0
  13. package/dist/{card-CKu696QC.js → card-CKStAH0Q.js} +40 -38
  14. package/dist/{checkbox-BLmQSdWB.js → checkbox-DIJbuqWm.js} +1 -1
  15. package/dist/{checkbox-group-DFKzbaHC.js → checkbox-group-DLLbWgQb.js} +2 -2
  16. package/dist/{checkbox-group-B9TtWVpG.cjs → checkbox-group-Kua6HuRE.cjs} +1 -1
  17. package/dist/{checkbox-PAtsn1TO.cjs → checkbox-iMOdzpJ_.cjs} +1 -1
  18. package/dist/{combobox-CJAmzQFD.cjs → combobox-CWL8T3UK.cjs} +1 -1
  19. package/dist/{combobox-KnYdXXRm.js → combobox-Pxa80TeZ.js} +3 -3
  20. package/dist/components/card/card.d.ts +0 -10
  21. package/dist/components/card/index.d.ts +2 -2
  22. package/dist/components/link/link.d.ts +1 -1
  23. package/dist/components/linkcard/linkcard.d.ts +0 -1
  24. package/dist/components/tabs/tabitem.d.ts +2 -1
  25. package/dist/components/tag/tag.d.ts +5 -11
  26. package/dist/{consent-BjWx64Gv.cjs → consent-UkinU27V.cjs} +1 -1
  27. package/dist/{consent-CeJKY2EB.js → consent-p-0n2b9x.js} +1 -1
  28. package/dist/{datepicker-Cco0rRLa.js → datepicker-BpxUWiIC.js} +8 -6
  29. package/dist/{datepicker-IMxHS-ex.cjs → datepicker-Cpiu_Nrf.cjs} +2 -2
  30. package/dist/{fileupload-CjqIhSJ1.cjs → fileupload-DXJtAagE.cjs} +1 -1
  31. package/dist/{fileupload-BrSWPUcy.js → fileupload-vPDmtXiM.js} +4 -4
  32. package/dist/{footer-BJCxJUW9.cjs → footer-CpE05IW2.cjs} +1 -1
  33. package/dist/{footer-DQq09VjI.js → footer-D8t0PCPC.js} +2 -2
  34. package/dist/{header-C_BUBeOQ.js → header-ChT1hHNA.js} +6 -6
  35. package/dist/{header-_KjqW2oJ.cjs → header-CiwHNHKD.cjs} +1 -1
  36. package/dist/{header-menu-BV0XlRez.js → header-menu-BrjsNjBH.js} +1 -1
  37. package/dist/{header-menu-BiW5cNun.cjs → header-menu-Dq9lwNr1.cjs} +1 -1
  38. package/dist/{helptext-CL1vxEaL.js → helptext-BFQzrOw4.js} +1 -1
  39. package/dist/{helptext-B4h3Xlqa.cjs → helptext-Bse1LpRd.cjs} +1 -1
  40. package/dist/icon-5A378_yh.cjs +1 -0
  41. package/dist/{icon-C82IxnSO.js → icon-C1oCGwEe.js} +1 -1
  42. package/dist/{input-wrapper-BNu6kOOn.cjs → input-wrapper-C_Rzwxx7.cjs} +2 -2
  43. package/dist/{input-wrapper-DowJHbGF.js → input-wrapper-DkpJS1hR.js} +4 -4
  44. package/dist/{link-D9kjggXZ.js → link-DLPpwjq4.js} +13 -7
  45. package/dist/{link-DqPFlWxz.cjs → link-pkFJ11Zd.cjs} +3 -3
  46. package/dist/linkcard-DIG6VYpl.cjs +15 -0
  47. package/dist/{linkcard-BEmG-2lN.js → linkcard-Dr-r8jBO.js} +22 -18
  48. package/dist/{loader-lDVe6rUf.js → loader-CFidlqSG.js} +1 -1
  49. package/dist/{loader-C4fbS8vr.cjs → loader-DTIrOtTo.cjs} +1 -1
  50. package/dist/messagebox-BLYx3AL7.cjs +16 -0
  51. package/dist/{messagebox-C8dsqW20.js → messagebox-B_07P0QA.js} +22 -13
  52. package/dist/{modal-EgQREcb8.cjs → modal-BvTfLfFq.cjs} +1 -1
  53. package/dist/{modal-D389hSbe.js → modal-CA_M2Ix6.js} +1 -1
  54. package/dist/{option-group-element-DhYJmGgW.cjs → option-group-element-CVNaBIlP.cjs} +1 -1
  55. package/dist/{option-group-element-CB0Qqev_.js → option-group-element-DzM8YznZ.js} +1 -1
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-breadcrumbs.cjs +1 -1
  61. package/dist/pkt-breadcrumbs.js +1 -1
  62. package/dist/pkt-button.cjs +1 -1
  63. package/dist/pkt-button.js +1 -1
  64. package/dist/pkt-calendar.cjs +1 -1
  65. package/dist/pkt-calendar.js +1 -1
  66. package/dist/pkt-card.cjs +1 -1
  67. package/dist/pkt-card.js +1 -1
  68. package/dist/pkt-checkbox-group.cjs +1 -1
  69. package/dist/pkt-checkbox-group.js +1 -1
  70. package/dist/pkt-checkbox.cjs +1 -1
  71. package/dist/pkt-checkbox.js +1 -1
  72. package/dist/pkt-combobox.cjs +1 -1
  73. package/dist/pkt-combobox.js +1 -1
  74. package/dist/pkt-consent.cjs +1 -1
  75. package/dist/pkt-consent.js +1 -1
  76. package/dist/pkt-datepicker.cjs +1 -1
  77. package/dist/pkt-datepicker.js +1 -1
  78. package/dist/pkt-fileupload.cjs +1 -1
  79. package/dist/pkt-fileupload.js +1 -1
  80. package/dist/pkt-footer.cjs +1 -1
  81. package/dist/pkt-footer.js +1 -1
  82. package/dist/pkt-header-menu.cjs +1 -1
  83. package/dist/pkt-header-menu.js +1 -1
  84. package/dist/pkt-header.cjs +1 -1
  85. package/dist/pkt-header.js +1 -1
  86. package/dist/pkt-helptext.cjs +1 -1
  87. package/dist/pkt-helptext.js +1 -1
  88. package/dist/pkt-icon.cjs +1 -1
  89. package/dist/pkt-icon.js +1 -1
  90. package/dist/pkt-index.cjs +1 -1
  91. package/dist/pkt-index.js +35 -35
  92. package/dist/pkt-input-wrapper.cjs +1 -1
  93. package/dist/pkt-input-wrapper.js +1 -1
  94. package/dist/pkt-link.cjs +1 -1
  95. package/dist/pkt-link.js +1 -1
  96. package/dist/pkt-linkcard.cjs +1 -1
  97. package/dist/pkt-linkcard.js +1 -1
  98. package/dist/pkt-loader.cjs +1 -1
  99. package/dist/pkt-loader.js +1 -1
  100. package/dist/pkt-messagebox.cjs +1 -1
  101. package/dist/pkt-messagebox.js +1 -1
  102. package/dist/pkt-modal.cjs +1 -1
  103. package/dist/pkt-modal.js +1 -1
  104. package/dist/pkt-radio-group.cjs +1 -1
  105. package/dist/pkt-radio-group.js +1 -1
  106. package/dist/pkt-radiobutton.cjs +1 -1
  107. package/dist/pkt-radiobutton.js +1 -1
  108. package/dist/pkt-searchinput.cjs +1 -1
  109. package/dist/pkt-searchinput.js +1 -1
  110. package/dist/pkt-select.cjs +1 -1
  111. package/dist/pkt-select.js +1 -1
  112. package/dist/pkt-tabs.cjs +1 -1
  113. package/dist/pkt-tabs.js +1 -1
  114. package/dist/pkt-tag.cjs +1 -1
  115. package/dist/pkt-tag.js +1 -1
  116. package/dist/pkt-textarea.cjs +1 -1
  117. package/dist/pkt-textarea.js +1 -1
  118. package/dist/pkt-textinput.cjs +1 -1
  119. package/dist/pkt-textinput.js +1 -1
  120. package/dist/pkt-timepicker.cjs +1 -1
  121. package/dist/pkt-timepicker.js +1 -1
  122. package/dist/{radio-group-CSs8YnEO.js → radio-group-BRY_74od.js} +2 -2
  123. package/dist/{radio-group-DRNGFfUh.cjs → radio-group-CsUgnEv0.cjs} +1 -1
  124. package/dist/{radiobutton-Be66H6On.cjs → radiobutton-CQhuG2lj.cjs} +1 -1
  125. package/dist/{radiobutton-BN67oAvC.js → radiobutton-lHnq8wX_.js} +1 -1
  126. package/dist/{searchinput-B26-Xp00.js → searchinput-BLGaXkP6.js} +1 -1
  127. package/dist/{searchinput-Trn6uU2J.cjs → searchinput-TAqMUJ0B.cjs} +1 -1
  128. package/dist/{select-DZftfjQt.js → select-BvtUxW0Q.js} +1 -1
  129. package/dist/{select-o6iuy9hC.cjs → select-Dle67Uwv.cjs} +1 -1
  130. package/dist/shared-types/card.d.ts +5 -17
  131. package/dist/shared-types/combobox.d.ts +3 -3
  132. package/dist/shared-types/icon.d.ts +2 -2
  133. package/dist/shared-types/index.d.ts +10 -8
  134. package/dist/shared-types/linkcard.d.ts +7 -4
  135. package/dist/shared-types/messagebox.d.ts +4 -2
  136. package/dist/shared-types/skin.d.ts +1 -4
  137. package/dist/shared-types/tag.d.ts +46 -0
  138. package/dist/{tabs-gRjrFqeG.cjs → tabs-B96Orh6O.cjs} +1 -1
  139. package/dist/{tabs-Bu9PP33-.js → tabs-BmmTUKuC.js} +1 -1
  140. package/dist/tag-BZdC0voc.cjs +27 -0
  141. package/dist/{tag-CtdOrK18.js → tag-Cam7ISOF.js} +14 -81
  142. package/dist/{textarea-Cc2aQLbm.cjs → textarea-DSX3jMlI.cjs} +1 -1
  143. package/dist/{textarea-DP7GVL2c.js → textarea-Djp5L2Zd.js} +2 -2
  144. package/dist/{textinput-Dhwotaxv.js → textinput-CBrOZcvL.js} +2 -2
  145. package/dist/{textinput-B6FPNOJB.cjs → textinput-CN2F3Q3H.cjs} +1 -1
  146. package/dist/{timepicker-DxwQ7-Bl.js → timepicker-CT4wfrgQ.js} +2 -2
  147. package/dist/{timepicker-Ce9hXP0B.cjs → timepicker-CkaJkIGn.cjs} +1 -1
  148. package/package.json +3 -3
  149. package/src/components/card/card.test.ts +50 -53
  150. package/src/components/card/card.ts +14 -24
  151. package/src/components/card/index.ts +2 -2
  152. package/src/components/checkbox/checkbox.test.ts +3 -3
  153. package/src/components/checkbox/checkbox.ts +1 -1
  154. package/src/components/input-wrapper/input-wrapper.ts +1 -1
  155. package/src/components/link/link.test.ts +14 -18
  156. package/src/components/link/link.ts +2 -3
  157. package/src/components/linkcard/linkcard.test.ts +18 -6
  158. package/src/components/linkcard/linkcard.ts +5 -7
  159. package/src/components/messagebox/messagebox.test.ts +14 -1
  160. package/src/components/messagebox/messagebox.ts +13 -2
  161. package/src/components/radiobutton/radiobutton.test.ts +1 -1
  162. package/src/components/radiobutton/radiobutton.ts +1 -1
  163. package/src/components/tabs/tabitem.ts +6 -2
  164. package/src/components/tag/tag.test.ts +27 -12
  165. package/src/components/tag/tag.ts +22 -19
  166. package/dist/card-Da0JkVcv.cjs +0 -64
  167. package/dist/icon-B3YGHHa7.cjs +0 -1
  168. package/dist/linkcard-BMJvjo7R.cjs +0 -14
  169. package/dist/messagebox-DFaDuvHQ.cjs +0 -13
  170. package/dist/tag-BgHEzLM3.cjs +0 -27
@@ -5,8 +5,6 @@ import { IPktHeading } from '../heading';
5
5
  import { IAriaAttributes, TCardSkin, TLayout } from '../../shared-types';
6
6
  import { IPktStringsProps } from '../../shared-strings';
7
7
  export type { TCardSkin, TLayout };
8
- export type TCardPadding = 'none' | 'default';
9
- export type TCardImageShape = 'square' | 'round';
10
8
  export type TCardImageAspect = 'auto' | '1-1' | '4-3' | '3-2' | '16-9' | '19-10';
11
9
  export type TCardTagPosition = 'top' | 'bottom';
12
10
  export interface IPktCard extends IPktStringsProps<'card'> {
@@ -20,14 +18,10 @@ export interface IPktCard extends IPktStringsProps<'card'> {
20
18
  src: string;
21
19
  alt: string;
22
20
  };
23
- imageShape?: TCardImageShape;
24
21
  imageAspect?: TCardImageAspect | null;
25
- restrictImageHeight?: boolean | null;
26
22
  clickCardLink?: string | null;
27
23
  openLinkInNewTab?: boolean | null;
28
- borderOnHover?: boolean | null;
29
24
  zoom?: boolean | null;
30
- padding?: TCardPadding;
31
25
  skin?: TCardSkin;
32
26
  subheading?: string;
33
27
  tagPosition?: TCardTagPosition;
@@ -38,10 +32,8 @@ export interface IPktCard extends IPktStringsProps<'card'> {
38
32
  export declare class PktCard extends PktElementWithSlot implements IPktCard {
39
33
  ariaLabel: string;
40
34
  metaLead: string | null;
41
- borderOnHover: boolean;
42
35
  zoom: boolean;
43
36
  imageAspect: TCardImageAspect | null;
44
- restrictImageHeight: boolean;
45
37
  clickCardLink: IPktCard['clickCardLink'];
46
38
  metaTrail: string | null;
47
39
  layout: TLayout;
@@ -51,9 +43,7 @@ export declare class PktCard extends PktElementWithSlot implements IPktCard {
51
43
  src: string;
52
44
  alt: string;
53
45
  };
54
- imageShape: TCardImageShape;
55
46
  openLinkInNewTab: boolean;
56
- padding: TCardPadding;
57
47
  skin: TCardSkin;
58
48
  subheading: string;
59
49
  tagPosition: 'top' | 'bottom';
@@ -1,3 +1,3 @@
1
- import { PktCard, TCardSkin, TLayout, TCardPadding, TCardImageShape, TCardTagPosition } from './card';
2
- export { PktCard, TCardSkin, TLayout, TCardPadding, TCardImageShape, TCardTagPosition };
1
+ import { PktCard, TCardSkin, TLayout, TCardTagPosition } from './card';
2
+ export { PktCard, TCardSkin, TLayout, TCardTagPosition };
3
3
  export default PktCard;
@@ -6,7 +6,7 @@ export declare class PktLink extends PktElementWithSlot {
6
6
  href: string;
7
7
  iconName: string | undefined;
8
8
  iconPosition: string | undefined;
9
- external: boolean;
9
+ rel: string | null;
10
10
  target: string | null;
11
11
  render(): import('lit-html').TemplateResult<1>;
12
12
  }
@@ -7,7 +7,6 @@ export declare class PktLinkCard extends PktElementWithSlot<IPktLinkCard> implem
7
7
  title: string;
8
8
  href: string;
9
9
  iconName: string;
10
- external: boolean;
11
10
  openInNewTab: boolean;
12
11
  skin?: TLinkCardSkin;
13
12
  render(): import('lit-html').TemplateResult<1>;
@@ -1,7 +1,8 @@
1
1
  import { PktElementWithSlot } from '../../base-elements/element-with-slot';
2
2
  import { Ref } from 'lit/directives/ref.js';
3
3
  import { TabsContext } from './tabs-context';
4
- export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray' | 'blue-light';
4
+ import { TTagSkin } from '../../shared-types';
5
+ export type TSkin = TTagSkin;
5
6
  export interface IPktTabItem {
6
7
  active?: boolean;
7
8
  disabled?: boolean;
@@ -1,18 +1,11 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { PktElementWithSlot } from '../../base-elements/element-with-slot';
3
- import { IAriaAttributes, THTMLButtonType, TPktSizeBase } from '../../shared-types';
3
+ import { IPktTagBase, THTMLButtonType, TTagSkin, TTagState, TTagTextStyle, TPktSizeBase } from '../../shared-types';
4
4
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
5
- import { IPktStringsProps } from '../../shared-strings';
6
- export type TTagSkin = 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey';
5
+ export type { TTagSkin, TTagState };
7
6
  export type TTagType = THTMLButtonType;
8
- export interface IPktTag extends IPktStringsProps<'tag'> {
9
- closeTag?: boolean;
10
- size?: TPktSizeBase;
11
- skin?: TTagSkin;
12
- textStyle?: string | null;
7
+ export interface IPktTag extends IPktTagBase {
13
8
  iconName?: PktIconName;
14
- type?: TTagType;
15
- ariaLabel?: IAriaAttributes['aria-label'] | null;
16
9
  }
17
10
  export declare class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
18
11
  constructor();
@@ -22,7 +15,8 @@ export declare class PktTag extends PktElementWithSlot<IPktTag> implements IPktT
22
15
  closeTag: boolean;
23
16
  size: TPktSizeBase;
24
17
  skin: TTagSkin;
25
- textStyle: string | null;
18
+ state: TTagState | null;
19
+ textStyle: TTagTextStyle | null;
26
20
  iconName: string | undefined;
27
21
  type: TTagType;
28
22
  ariaLabel: string | null;
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./button-pFlrTF2P.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n={devMode:!1,i18nLanguage:`nb`,triggerType:`button`},r=null;function i(){return r||(r=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),r)}var a=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},o=e=>a(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),s=class extends e.t{constructor(...e){super(...e),this.devMode=n.devMode,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=n.triggerType,this.triggerText=null,this.i18nLanguage=n.i18nLanguage}connectedCallback(){super.connectedCallback();let e=Object.prototype.hasOwnProperty.call(t.i18n,this.i18nLanguage)?this.i18nLanguage:`nb`;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return a(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:o(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await i(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;e&&t&&e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
1
+ const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./button-bVWAX98x.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n={devMode:!1,i18nLanguage:`nb`,triggerType:`button`},r=null;function i(){return r||(r=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),r)}var a=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},o=e=>a(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),s=class extends e.t{constructor(...e){super(...e),this.devMode=n.devMode,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=n.triggerType,this.triggerText=null,this.i18nLanguage=n.i18nLanguage}connectedCallback(){super.connectedCallback();let e=Object.prototype.hasOwnProperty.call(t.i18n,this.i18nLanguage)?this.i18nLanguage:`nb`;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return a(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:o(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await i(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;e&&t&&e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
2
2
  >${this.triggerText}</a
3
3
  >`:this.triggerType===`footerlink`?e._`<a
4
4
  href="#"
@@ -1,6 +1,6 @@
1
1
  import { _ as e, d as t, n, t as r, u as i } from "./element-DLgZkx5L.js";
2
2
  import "./shared-types-A6iGIX-f.js";
3
- import "./button-BJ6QLwxJ.js";
3
+ import "./button-Bswo1C0M.js";
4
4
  //#region ../../shared-strings/consent.ts
5
5
  var a = {
6
6
  i18n: {
@@ -1,13 +1,13 @@
1
1
  import { _ as e, d as t, h as n, l as r, n as i, s as a, t as o, u as s } from "./element-DLgZkx5L.js";
2
2
  import { t as c } from "./class-map-BDwVSgLb.js";
3
3
  import { n as l } from "./element-with-slot-mG-h7Sjw.js";
4
- import "./icon-C82IxnSO.js";
5
- import "./input-wrapper-DowJHbGF.js";
6
- import "./calendar-CYsQEfZn.js";
4
+ import "./icon-C1oCGwEe.js";
5
+ import "./input-wrapper-DkpJS1hR.js";
6
+ import "./tag-Cam7ISOF.js";
7
+ import "./calendar-BOd-9PDd.js";
7
8
  import { t as u } from "./if-defined-DiYi2v_Q.js";
8
9
  import { n as d, t as f } from "./ref-BAegS9BR.js";
9
10
  import { a as p, c as m, d as h, h as g, i as _, m as v, n as y, r as b, s as x, t as S, u as ee } from "./converters-CYgQrWVm.js";
10
- import "./tag-CtdOrK18.js";
11
11
  import { t as te } from "./repeat-Cy1M16Di.js";
12
12
  import { n as C, t as w } from "./utils-BwF4QSrq.js";
13
13
  import { t as T } from "./input-element-De40zUox.js";
@@ -150,7 +150,8 @@ var D = {
150
150
  type: "boolean",
151
151
  reflect: !0,
152
152
  default: !1,
153
- category: "functionality"
153
+ category: "functionality",
154
+ exclusiveGroup: "selectionMode"
154
155
  },
155
156
  maxlength: {
156
157
  name: "Maks antall datoer i flervalg",
@@ -163,7 +164,8 @@ var D = {
163
164
  type: "boolean",
164
165
  reflect: !0,
165
166
  default: !1,
166
- category: "functionality"
167
+ category: "functionality",
168
+ exclusiveGroup: "selectionMode"
167
169
  },
168
170
  showRangeLabels: {
169
171
  attribute: "show-range-labels",
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs");require("./icon-B3YGHHa7.cjs"),require("./input-wrapper-BNu6kOOn.cjs"),require("./calendar-Fk5ubNGR.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs"),i=require("./ref-B6p6mQkO.cjs"),a=require("./converters-CW6SN0TT.cjs");require("./tag-BgHEzLM3.cjs");const o=require("./repeat-CjvNrcUr.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-2LHxo0em.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs");require("./icon-5A378_yh.cjs"),require("./input-wrapper-C_Rzwxx7.cjs"),require("./tag-BZdC0voc.cjs"),require("./calendar-CDTCgTJn.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs"),i=require("./ref-B6p6mQkO.cjs"),a=require("./converters-CW6SN0TT.cjs"),o=require("./repeat-CjvNrcUr.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-2LHxo0em.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
2
2
  <div class=${t.t(this.classes)} aria-live="polite">
3
3
  ${Array.isArray(this.dates)&&this.dates[0]?o.t(a.h((this.dates??[]).filter(Boolean)),e=>e,t=>e._` <pkt-tag
4
4
  id=${this.idBase+t+`-tag`}
@@ -9,7 +9,7 @@ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),
9
9
  <time datetime=${t}>${a.c(t,this.dateformat)}</time>
10
10
  </pkt-tag>`):e.h}
11
11
  </div>
12
- `}};e.n([e.u({type:Array})],l.prototype,`dates`,void 0),e.n([e.u({type:String})],l.prototype,`dateformat`,void 0),e.n([e.u({type:String,attribute:`class`})],l.prototype,`className`,void 0),e.n([e.u({type:String,attribute:`id-base`})],l.prototype,`idBase`,void 0);try{e.d(`pkt-date-tags`)(l)}catch{console.warn(`Forsøker å definere <pkt-date-tags>, men den er allerede definert`)}var u={name:`pkt-datepicker`,react:`PktDatepicker`,"css-class":`pkt-datepicker`,isElement:!0,isPureReact:!0,"dark-mode":!0,props:{name:{type:`string`,name:`Navn for innsending`,category:`tech`},form:{name:`Skjema`,description:`ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet`,type:`string`,required:!1,category:`tech`},label:{type:`string`,name:`Tekst/label`,category:`contents`},helptext:{type:`string`,name:`Hjelpetekst`,category:`contents`},helptextDropdown:{type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{type:`string`,name:`Knappetekst for utvidet hjelpetekst`,default:`Les mer`,category:`contents`},dateformat:{name:`Datoformat for tags i flervalg`,type:`string`,default:`dd.MM.yyyy`,category:`tech`},currentmonth:{name:`Måned som vises i datovelgeren`,type:`ISOdatestring`,category:`tech`},value:{name:`Verdi (kommaseparert ved flervalg)`,type:`ISOdatestring`,variant:`multiple`,category:`tech`},excludeweekdays:{name:`Utelat ukedager`,type:`string`,description:`Kommaseparert liste over ukedager (1-7) som skal ekskluderes`,category:`functionality`},excludedates:{name:`Utelat datoer (Kommaseparerte ISO-datoer)`,type:`ISOdatestring`,variant:`multiple`,category:`functionality`},min:{name:`Tidligst tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},max:{name:`Senest tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},weeknumbers:{name:`Vis ukenummer`,type:`boolean`,reflect:!0,default:!1,category:`ui`},withcontrols:{name:`Med velgere for måned/år`,type:`boolean`,reflect:!0,default:!1,category:`ui`},multiple:{name:`Flervalg`,type:`boolean`,reflect:!0,default:!1,category:`functionality`},maxlength:{name:`Maks antall datoer i flervalg`,type:`number`,category:`functionality`,showIf:{multiple:!0}},range:{name:`Datotidsrom (fra og til)`,type:`boolean`,reflect:!0,default:!1,category:`functionality`},showRangeLabels:{attribute:`show-range-labels`,name:`Vis fra/til-etiketter`,type:`boolean`,default:!1,category:`ui`,showIf:{range:!0}},today:{name:`Dagens dato (overstyring)`,type:`ISOdatestring`,description:`ISO-datostreng som overstyrer dagens dato i kalenderen. Nyttig for snapshot-tester.`,category:`tech`},calendarOpen:{attribute:`calendar-open`,name:`Kalender åpen`,type:`boolean`,reflect:!0,default:!1,category:`ui`},hasError:{type:`boolean`,name:`Feil`,default:!1,category:`ui`},errorMessage:{type:`string`,name:`Feilmelding ved feil`,category:`contents`},disabled:{type:`boolean`,name:`Deaktivert`,default:!1,reflect:!0,category:`tech`},fullwidth:{type:`boolean`,name:`Full bredde`,default:!1,reflect:!0,category:`ui`},inputSize:{attribute:`input-size`,name:`Størrelse`,description:`Størrelsen på komponenten`,type:[`medium`,`small`,`xsmall`],default:`medium`,category:`ui`},required:{type:`boolean`,name:`Påkrevd`,default:!1,reflect:!0,category:`tech`},requiredTag:{type:`boolean`,name:`Vise påkrevd-merking`,default:!1,category:`ui`},requiredText:{type:`string`,name:`Påkrevd-tekst`,default:`Må fylles ut`,category:`contents`},optionalTag:{type:`boolean`,name:`Vise valgfritt-merking`,default:!1,category:`ui`},optionalText:{type:`string`,name:`Valgfritt-tekst`,default:`Valgfritt`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},useWrapper:{type:`boolean`,name:`Bruk wrapper`,description:`Indikerer at feltet skal ha synlig label og hjelpetekst`,displayAsFalse:!0,default:!0,category:`ui`},id:{type:`string`,name:`ID`,description:`Unik identifikasjon for datovelgeren`,category:`tech`},ariaDescribedby:{attribute:`aria-describedby`,name:`aria-describedby`,description:`Spesifiserer ID-en til elementet som beskriver feltet.`,type:`string`,category:`accessibility`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},hasFieldset:{name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet består av flere kontroller.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`}},events:{change:{type:`Event`,name:`change (Elements)`,description:`Returnerer valgt dato som streng i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},"value-change":{type:`CustomEvent`,name:`value-change (Elements)`,description:`Returnerer en <code>array</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`},onChange:{type:`Event`,name:`onChange (React)`,reactOnly:!0,description:`Utløses når en dato velges. <code>e.target.value</code> inneholder kommaseparerte ISO-datoer. I range-modus utløses kun når begge datoer er valgt.`},onValueChange:{type:`string[]`,name:`onValueChange (React)`,reactOnly:!0,description:`Returnerer en <code>string[]</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`}}},d=()=>{let e=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(e)||/Macintosh/.test(e)&&`ontouchend`in document)},f=()=>d()?`text`:`date`,p=e=>!e||e.length!==2||a.u(e[0],e[1]),m=e=>a.h(e),h=(e,t,n,r,i)=>a.i(e,t,n,r,i),g=(e,t,n,r,i,a,o=`medium`)=>({"pkt-input":!0,"pkt-datepicker__input":!0,[`pkt-input--${o}`]:!0,"pkt-input--fullwidth":e,"pkt-datepicker--hasrangelabels":t,"pkt-datepicker--multiple":n,"pkt-datepicker--range":r,"ios-readonly-hack":i===!1&&a===`text`}),_=(e=`medium`)=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,[`pkt-btn--${e}`]:!0,"pkt-datepicker__calendar-button":!0}),v=e=>({"pkt-input-prefix":e,"pkt-hide":!e}),y=(e,t,n)=>!t&&!n?Array.isArray(e)?e[0]||``:e:Array.isArray(e)?e.join(`,`):e,b=(e,t,n=!1)=>{if(!e||!t)return;let r=t.parentElement?.getBoundingClientRect()||t.getBoundingClientRect(),i=n?r.height+30:r.height,a=e.getBoundingClientRect().height,o=n?`calc(100% - 30px)`:`100%`;r&&typeof window<`u`&&r.top+a>window.innerHeight&&r.top-a>0&&(o=`calc(100% - ${i}px - ${a}px)`),e.style.top=o},x=(e,t,n,r,i,a)=>{let{key:o}=e;o===`,`&&(e.preventDefault(),a?a(e):i&&i()),(o===`Space`||o===` `)&&(e.preventDefault(),t(e)),o===`Enter`&&(e.preventDefault(),n?n():r?r():i&&i())},S=(e,t)=>{let{key:n}=e;(n===`Enter`||n===` `||n===`Space`)&&(e.preventDefault(),t(e))},C={validateRangeOrder:p,sortDates:m,filterSelectableDates:h},w={getInputType:f},T={submitForm(e){let t=e.internals?.form;t&&t.requestSubmit()},submitFormOrFallback(e,t){let n=e?.form;n?n.requestSubmit():t()},validateDateInput(t,n,r,i,a){let o=t.value;if(!o)return;let s={...e.s.validation,...a};r&&r>o?n.setValidity({rangeUnderflow:!0},s.dateUnderflow,t):i&&i<o&&n.setValidity({rangeOverflow:!0},s.dateOverflow,t)}},E={addToSelected(e,t,n,r){let i=e.target;if(!i.value)return;let o=n?a.d(n):null,s=r?a.d(r):null,c=a.d(i.value.split(`,`)[0]);c&&!isNaN(c.getTime())&&(!o||c>=o)&&(!s||c<=s)&&t.value&&t.value.handleDateSelect(c),i.value=``},handleCalendarPosition(e,t,n=!1){b(e.value??null,t.value??null,n)}},D={getInputClasses:g,getButtonClasses:_,getRangeLabelClasses:v},O={processDateSelection:y,updateInputValues(e,t,n,r,i,a){e.value&&(r&&t?.value?(e.value.value=n[0]??``,t.value.value=n[1]??``,a(e.value),a(t.value)):i||(e.value.value=n.length?n[0]:``,a(e.value)))},processRangeBlur(e,t,n,r,i){let o=e.target;if(o.value){i(o);let e=a.s(o.value);e&&n?.value?.handleDateSelect(e)}else t[0]&&r()}},k={handleInputKeydown:x,handleButtonKeydown:S},A=class extends e.t{constructor(...e){super(...e),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=i.t(),this.calendarRef=i.t(),this.handleDocumentClick=e=>{if(!this.open)return;let t=e.composedPath(),n=this.parentElement,r=this.popupRef.value;!t.includes(this)&&!t.includes(r)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key===`Escape`&&(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}willUpdate(e){super.willUpdate(e),e.has(`open`)&&this.open&&(this._hasBeenOpened=!0)}updated(e){super.updated(e),e.has(`open`)&&(this.open?(document.addEventListener(`keydown`,this.handleDocumentKeydown),document.addEventListener(`click`,this.handleDocumentClick)):(document.removeEventListener(`click`,this.handleDocumentClick),document.removeEventListener(`keydown`,this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`click`,this.handleDocumentClick),document.removeEventListener(`keydown`,this.handleDocumentKeydown)}show(){this.open=!0,this.calendarRef.value?.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){return!!e&&!!this.popupRef.value?.contains(e)}focusOnCurrentDate(){let e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate==`function`&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof E.addToSelected==`function`)return E.addToSelected(e,this.calendarRef,t,n);let r=e.target;if(!r.value)return;let i=t?a.d(t):null,o=n?a.d(n):null,s=a.d(r.value.split(`,`)[0]);s&&!isNaN(s.getTime())&&(!i||s>=i)&&(!o||s<=o)&&this.handleDateSelect(s),r.value=``}handleDateSelect(e){let t=this.calendarRef.value;if(t&&typeof t.handleDateSelect==`function`)return t.handleDateSelect(e);let n=a.a(e),r=this.selected.indexOf(n)>=0?this.selected.filter(e=>e!==n):[...this.selected,n];this.selected=r,this.dispatchEvent(new CustomEvent(`date-selected`,{detail:r,bubbles:!0,composed:!0}))}render(){let n={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return e._`
12
+ `}};e.n([e.u({type:Array})],l.prototype,`dates`,void 0),e.n([e.u({type:String})],l.prototype,`dateformat`,void 0),e.n([e.u({type:String,attribute:`class`})],l.prototype,`className`,void 0),e.n([e.u({type:String,attribute:`id-base`})],l.prototype,`idBase`,void 0);try{e.d(`pkt-date-tags`)(l)}catch{console.warn(`Forsøker å definere <pkt-date-tags>, men den er allerede definert`)}var u={name:`pkt-datepicker`,react:`PktDatepicker`,"css-class":`pkt-datepicker`,isElement:!0,isPureReact:!0,"dark-mode":!0,props:{name:{type:`string`,name:`Navn for innsending`,category:`tech`},form:{name:`Skjema`,description:`ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet`,type:`string`,required:!1,category:`tech`},label:{type:`string`,name:`Tekst/label`,category:`contents`},helptext:{type:`string`,name:`Hjelpetekst`,category:`contents`},helptextDropdown:{type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{type:`string`,name:`Knappetekst for utvidet hjelpetekst`,default:`Les mer`,category:`contents`},dateformat:{name:`Datoformat for tags i flervalg`,type:`string`,default:`dd.MM.yyyy`,category:`tech`},currentmonth:{name:`Måned som vises i datovelgeren`,type:`ISOdatestring`,category:`tech`},value:{name:`Verdi (kommaseparert ved flervalg)`,type:`ISOdatestring`,variant:`multiple`,category:`tech`},excludeweekdays:{name:`Utelat ukedager`,type:`string`,description:`Kommaseparert liste over ukedager (1-7) som skal ekskluderes`,category:`functionality`},excludedates:{name:`Utelat datoer (Kommaseparerte ISO-datoer)`,type:`ISOdatestring`,variant:`multiple`,category:`functionality`},min:{name:`Tidligst tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},max:{name:`Senest tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},weeknumbers:{name:`Vis ukenummer`,type:`boolean`,reflect:!0,default:!1,category:`ui`},withcontrols:{name:`Med velgere for måned/år`,type:`boolean`,reflect:!0,default:!1,category:`ui`},multiple:{name:`Flervalg`,type:`boolean`,reflect:!0,default:!1,category:`functionality`,exclusiveGroup:`selectionMode`},maxlength:{name:`Maks antall datoer i flervalg`,type:`number`,category:`functionality`,showIf:{multiple:!0}},range:{name:`Datotidsrom (fra og til)`,type:`boolean`,reflect:!0,default:!1,category:`functionality`,exclusiveGroup:`selectionMode`},showRangeLabels:{attribute:`show-range-labels`,name:`Vis fra/til-etiketter`,type:`boolean`,default:!1,category:`ui`,showIf:{range:!0}},today:{name:`Dagens dato (overstyring)`,type:`ISOdatestring`,description:`ISO-datostreng som overstyrer dagens dato i kalenderen. Nyttig for snapshot-tester.`,category:`tech`},calendarOpen:{attribute:`calendar-open`,name:`Kalender åpen`,type:`boolean`,reflect:!0,default:!1,category:`ui`},hasError:{type:`boolean`,name:`Feil`,default:!1,category:`ui`},errorMessage:{type:`string`,name:`Feilmelding ved feil`,category:`contents`},disabled:{type:`boolean`,name:`Deaktivert`,default:!1,reflect:!0,category:`tech`},fullwidth:{type:`boolean`,name:`Full bredde`,default:!1,reflect:!0,category:`ui`},inputSize:{attribute:`input-size`,name:`Størrelse`,description:`Størrelsen på komponenten`,type:[`medium`,`small`,`xsmall`],default:`medium`,category:`ui`},required:{type:`boolean`,name:`Påkrevd`,default:!1,reflect:!0,category:`tech`},requiredTag:{type:`boolean`,name:`Vise påkrevd-merking`,default:!1,category:`ui`},requiredText:{type:`string`,name:`Påkrevd-tekst`,default:`Må fylles ut`,category:`contents`},optionalTag:{type:`boolean`,name:`Vise valgfritt-merking`,default:!1,category:`ui`},optionalText:{type:`string`,name:`Valgfritt-tekst`,default:`Valgfritt`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},useWrapper:{type:`boolean`,name:`Bruk wrapper`,description:`Indikerer at feltet skal ha synlig label og hjelpetekst`,displayAsFalse:!0,default:!0,category:`ui`},id:{type:`string`,name:`ID`,description:`Unik identifikasjon for datovelgeren`,category:`tech`},ariaDescribedby:{attribute:`aria-describedby`,name:`aria-describedby`,description:`Spesifiserer ID-en til elementet som beskriver feltet.`,type:`string`,category:`accessibility`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},hasFieldset:{name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet består av flere kontroller.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`}},events:{change:{type:`Event`,name:`change (Elements)`,description:`Returnerer valgt dato som streng i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},"value-change":{type:`CustomEvent`,name:`value-change (Elements)`,description:`Returnerer en <code>array</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`},onChange:{type:`Event`,name:`onChange (React)`,reactOnly:!0,description:`Utløses når en dato velges. <code>e.target.value</code> inneholder kommaseparerte ISO-datoer. I range-modus utløses kun når begge datoer er valgt.`},onValueChange:{type:`string[]`,name:`onValueChange (React)`,reactOnly:!0,description:`Returnerer en <code>string[]</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`}}},d=()=>{let e=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(e)||/Macintosh/.test(e)&&`ontouchend`in document)},f=()=>d()?`text`:`date`,p=e=>!e||e.length!==2||a.u(e[0],e[1]),m=e=>a.h(e),h=(e,t,n,r,i)=>a.i(e,t,n,r,i),g=(e,t,n,r,i,a,o=`medium`)=>({"pkt-input":!0,"pkt-datepicker__input":!0,[`pkt-input--${o}`]:!0,"pkt-input--fullwidth":e,"pkt-datepicker--hasrangelabels":t,"pkt-datepicker--multiple":n,"pkt-datepicker--range":r,"ios-readonly-hack":i===!1&&a===`text`}),_=(e=`medium`)=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,[`pkt-btn--${e}`]:!0,"pkt-datepicker__calendar-button":!0}),v=e=>({"pkt-input-prefix":e,"pkt-hide":!e}),y=(e,t,n)=>!t&&!n?Array.isArray(e)?e[0]||``:e:Array.isArray(e)?e.join(`,`):e,b=(e,t,n=!1)=>{if(!e||!t)return;let r=t.parentElement?.getBoundingClientRect()||t.getBoundingClientRect(),i=n?r.height+30:r.height,a=e.getBoundingClientRect().height,o=n?`calc(100% - 30px)`:`100%`;r&&typeof window<`u`&&r.top+a>window.innerHeight&&r.top-a>0&&(o=`calc(100% - ${i}px - ${a}px)`),e.style.top=o},x=(e,t,n,r,i,a)=>{let{key:o}=e;o===`,`&&(e.preventDefault(),a?a(e):i&&i()),(o===`Space`||o===` `)&&(e.preventDefault(),t(e)),o===`Enter`&&(e.preventDefault(),n?n():r?r():i&&i())},S=(e,t)=>{let{key:n}=e;(n===`Enter`||n===` `||n===`Space`)&&(e.preventDefault(),t(e))},C={validateRangeOrder:p,sortDates:m,filterSelectableDates:h},w={getInputType:f},T={submitForm(e){let t=e.internals?.form;t&&t.requestSubmit()},submitFormOrFallback(e,t){let n=e?.form;n?n.requestSubmit():t()},validateDateInput(t,n,r,i,a){let o=t.value;if(!o)return;let s={...e.s.validation,...a};r&&r>o?n.setValidity({rangeUnderflow:!0},s.dateUnderflow,t):i&&i<o&&n.setValidity({rangeOverflow:!0},s.dateOverflow,t)}},E={addToSelected(e,t,n,r){let i=e.target;if(!i.value)return;let o=n?a.d(n):null,s=r?a.d(r):null,c=a.d(i.value.split(`,`)[0]);c&&!isNaN(c.getTime())&&(!o||c>=o)&&(!s||c<=s)&&t.value&&t.value.handleDateSelect(c),i.value=``},handleCalendarPosition(e,t,n=!1){b(e.value??null,t.value??null,n)}},D={getInputClasses:g,getButtonClasses:_,getRangeLabelClasses:v},O={processDateSelection:y,updateInputValues(e,t,n,r,i,a){e.value&&(r&&t?.value?(e.value.value=n[0]??``,t.value.value=n[1]??``,a(e.value),a(t.value)):i||(e.value.value=n.length?n[0]:``,a(e.value)))},processRangeBlur(e,t,n,r,i){let o=e.target;if(o.value){i(o);let e=a.s(o.value);e&&n?.value?.handleDateSelect(e)}else t[0]&&r()}},k={handleInputKeydown:x,handleButtonKeydown:S},A=class extends e.t{constructor(...e){super(...e),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=i.t(),this.calendarRef=i.t(),this.handleDocumentClick=e=>{if(!this.open)return;let t=e.composedPath(),n=this.parentElement,r=this.popupRef.value;!t.includes(this)&&!t.includes(r)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key===`Escape`&&(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}willUpdate(e){super.willUpdate(e),e.has(`open`)&&this.open&&(this._hasBeenOpened=!0)}updated(e){super.updated(e),e.has(`open`)&&(this.open?(document.addEventListener(`keydown`,this.handleDocumentKeydown),document.addEventListener(`click`,this.handleDocumentClick)):(document.removeEventListener(`click`,this.handleDocumentClick),document.removeEventListener(`keydown`,this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`click`,this.handleDocumentClick),document.removeEventListener(`keydown`,this.handleDocumentKeydown)}show(){this.open=!0,this.calendarRef.value?.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){return!!e&&!!this.popupRef.value?.contains(e)}focusOnCurrentDate(){let e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate==`function`&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof E.addToSelected==`function`)return E.addToSelected(e,this.calendarRef,t,n);let r=e.target;if(!r.value)return;let i=t?a.d(t):null,o=n?a.d(n):null,s=a.d(r.value.split(`,`)[0]);s&&!isNaN(s.getTime())&&(!i||s>=i)&&(!o||s<=o)&&this.handleDateSelect(s),r.value=``}handleDateSelect(e){let t=this.calendarRef.value;if(t&&typeof t.handleDateSelect==`function`)return t.handleDateSelect(e);let n=a.a(e),r=this.selected.indexOf(n)>=0?this.selected.filter(e=>e!==n):[...this.selected,n];this.selected=r,this.dispatchEvent(new CustomEvent(`date-selected`,{detail:r,bubbles:!0,composed:!0}))}render(){let n={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return e._`
13
13
  <div
14
14
  class="${t.t(n)}"
15
15
  ${i.n(this.popupRef)}
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs");require("./alert-KxCE28nq.cjs"),require("./icon-B3YGHHa7.cjs"),require("./input-wrapper-BNu6kOOn.cjs"),require("./progressbar-BdqIhC1Z.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs"),i=require("./converters-CW6SN0TT.cjs"),a=require("./utils-63cRpWut.cjs"),o=require("./focus-trap-DSv4Ifqm.cjs");require("./modal-EgQREcb8.cjs");function s(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function c(e){return e<1024?`${Math.round(e)} B`:e<1048576?`${Math.round(e/1024)} KB`:e<1073741824?`${Math.round(e/1048576)} MB`:`${Math.round(e/1073741824)} GB`}function l(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function u(e){return e?e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean):[]}function d(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function f(e,t){let n=l(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>d(e,r,i))}function p(e,t){let n=(e??``).trim();if(n)return n;let r=l(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function m(e){return e.includes(`/`)?e:e.replace(/^\./,``).toUpperCase()}function h(e,t){let n=l(e);if(n.length>0)return n.map(m).join(`, `);let r=u(t);return r.length>0?r.map(m).join(`, `):``}function g(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function _(t,n){let r=l(n.allowedFormats);if(r.length>0&&!f(t,r)){let t=r.join(`, `),i=e.s.fileupload.invalidFormat;return g(n.formatErrorMessage,i,{formats:t})}let i=s(n.maxFileSize);if(i!==void 0&&t.size>i){let t=c(i),r=e.s.fileupload.sizeTooLarge;return g(n.sizeErrorMessage,r,{maxSize:t})}if(n.onFileValidation){let e=n.onFileValidation(t);if(e)return e}return null}function v(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function y(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function b(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[y(e.progress)]-r[y(t.progress)])}function x(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function S(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function C(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}function w(t,n=e.s.fileupload.unknownFilename){return t.attributes?.targetFilename||t.file?.name||n}var T=class extends e.t{constructor(...e){super(...e),this.id=`pkt-fileupload-${a.n()}`,this.name=`files`,this.label=``,this.helptext=``,this.helptextDropdown=``,this.required=!1,this.multiple=!1,this.disabled=!1,this.fullwidth=!1,this.uploadStrategy=`form`,this.itemRenderer=`filename`,this.accept=``,this.allowedFormats=[],this.formatErrorMessage=``,this.sizeErrorMessage=``,this.transfers=[],this.addCommentsEnabled=!1,this.renameFilesEnabled=!1,this.extraOperations=[],this.enableImagePreview=!1,this.hasError=!1,this.errorMessage=``,this.optionalTag=!1,this.requiredTag=!1,this.tagText=null,this.truncateTail=4,this.files=[],this.isDragActive=!1,this.validationErrorMessage=null,this.addedAnnouncement=``,this.thumbnailUrls={},this.hasInitializedValue=!1,this.hasWarnedInvalidValueCombo=!1,this.thumbnailFileById=new Map,this.connectedForm=null,this.addedAnnouncementTimer=null,this.onNativeFileChange=e=>{let t=e.target;this.addFiles(t.files?Array.from(t.files):[]),this.uploadStrategy===`custom`&&(t.value=``)},this.openFileDialog=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.querySelector(`#${this.id}-input`)?.click()},this.onDropZoneClick=e=>{this.disabled||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||this.querySelector(`#${this.id}-input`)?.click()},this.onDragOver=e=>{e.preventDefault(),!this.disabled&&(this.isDragActive=!0)},this.onDragLeave=()=>{this.isDragActive=!1},this.onDrop=e=>{if(e.preventDefault(),this.isDragActive=!1,this.disabled)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this.addFiles(t)},this.onHostFormSubmit=e=>{this.required&&this.uploadStrategy===`custom`&&(this.getCurrentFiles().length>0||(this.validationErrorMessage=this.requiredSelectionMessage,e.preventDefault()))}}get requiredSelectionMessage(){return this.pktStrings.get(`fileupload`).requiredMissing}get isControlled(){return this.value!==void 0}get hasEffectiveError(){return!!this.validationErrorMessage||this.hasError||!!this.errorMessage.trim()}get effectiveErrorMessage(){return this.validationErrorMessage??this.errorMessage??``}get hasValidationError(){return!!this.validationErrorMessage}firstUpdated(e){super.firstUpdated?.(e),this.value!==void 0&&this.defaultValue!==void 0&&this.warnInvalidValueCombo()}willUpdate(e){super.willUpdate(e),this.hasInitializedValue?this.isControlled&&(e.has(`value`)||e.has(`itemRenderer`)||e.has(`enableImagePreview`))&&(this.files=this.value??[],this.syncThumbnailUrls(this.files)):(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),this.hasInitializedValue=!0)}updated(e){super.updated(e),(e.has(`uploadStrategy`)||e.has(`required`)||e.has(`value`)||e.has(`form`))&&this.syncFormSubmitListener(),this.uploadStrategy===`form`&&(e.has(`value`)||e.has(`files`)||e.has(`uploadStrategy`))&&this.syncNativeInputFiles()}syncNativeInputFiles(){let e=this.querySelector(`#${this.id}-input`);if(e&&typeof DataTransfer<`u`)try{let t=new DataTransfer;for(let e of this.getCurrentFiles())e.file&&t.items.add(e.file);e.files=t.files}catch{}}warnInvalidValueCombo(){this.hasWarnedInvalidValueCombo||=(console.warn(`PktFileUpload: Både value og defaultValue er angitt. Komponenten kan være enten kontrollert eller ukontrollert, ikke begge. value vil bli prioritert.`),!0)}disconnectedCallback(){this.teardownFormSubmitListener(),this.addedAnnouncementTimer&&=(clearTimeout(this.addedAnnouncementTimer),null),super.disconnectedCallback(),this.revokeAllThumbnailUrls()}setAddedAnnouncement(e){this.addedAnnouncement=e,this.addedAnnouncementTimer&&clearTimeout(this.addedAnnouncementTimer),this.addedAnnouncementTimer=setTimeout(()=>{this.addedAnnouncement=``,this.addedAnnouncementTimer=null},1500)}connectedCallback(){super.connectedCallback(),this.syncFormSubmitListener()}addFiles(e){if(e.length===0)return;let t=this.multiple?e:[e[0]];for(let e of t){let t=this.validateFile(e);if(t){this.validationErrorMessage=t;return}}this.validationErrorMessage=null;let r=t.map(e=>({fileId:a.n(),file:e,attributes:{targetFilename:e.name}})),i=this.pktStrings.get(`fileupload`);this.setAddedAnnouncement(r.length===1?n.t(i.srFileAdded,{filename:r[0].attributes.targetFilename}):n.t(i.srFilesAdded,{count:r.length}));let o=this.getCurrentFiles(),s=this.multiple?[...o,...r]:[r[0]];this.commitFiles(s,`add`,r.map(e=>e.fileId)),this.uploadStrategy===`custom`&&r.forEach(e=>{this.dispatchEvent(new CustomEvent(`file-upload-requested`,{detail:{fileId:e.fileId,file:e.file,attributes:e.attributes},bubbles:!0,composed:!0}))})}getCurrentFiles(){return this.isControlled?this.value??[]:this.files}cancelTransfer(e){if(this.disabled)return;let t=this.getCurrentFiles().find(t=>t.fileId===e);t&&(this.removeFileItem(e),this.dispatchEvent(new CustomEvent(`transfer-cancelled`,{detail:{fileId:t.fileId,file:t.file,attributes:t.attributes},bubbles:!0,composed:!0})))}removeFileItem(e){if(this.disabled)return;let t=this.getCurrentFiles(),n=t.filter(t=>t.fileId!==e);n.length!==t.length&&this.commitFiles(n,`remove`,[e])}updateFileItem(e,t){let n=this.getCurrentFiles().map(n=>n.fileId===e?{...n,...t}:n);this.commitFiles(n,`update`,[e])}commitFiles(e,t,n){this.isControlled||(this.files=e,this.syncThumbnailUrls(e)),this.validationErrorMessage===this.requiredSelectionMessage&&e.length>0&&(this.validationErrorMessage=null),this.dispatchEvent(new CustomEvent(`files-changed`,{detail:{files:e,reason:t,changedFileIds:n},bubbles:!0,composed:!0}))}getThumbnailUrl(e){return this.thumbnailUrls[e.fileId]}getTransferProgress(e){let t=this.transfers.find(t=>t.fileId===e);return t?t.progress:this.uploadStrategy===`form`?`done`:`queued`}getTransferForFile(e){return this.transfers.find(t=>t.fileId===e)}isImageFile(e){return v(e)}formatFileSize(e){return c(e)}getResolvedAcceptValue(){return p(this.accept,this.allowedFormats)}getSupportedFormatsText(){return h(this.allowedFormats,this.accept)}getSortedFilesAndTransfers(){return b(this.getCurrentFiles(),this.transfers,this.uploadStrategy)}validateFile(e){let t=_(e,{allowedFormats:this.allowedFormats,maxFileSize:this.maxFileSize,formatErrorMessage:this.formatErrorMessage,sizeErrorMessage:this.sizeErrorMessage,onFileValidation:this.onFileValidation});if(t)return t;let n={file:e,errorMessage:null},r=new CustomEvent(`file-validate`,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(r),n.errorMessage?n.errorMessage:r.defaultPrevented?this.pktStrings.get(`fileupload`).genericValidationRejection:null}syncThumbnailUrls(e){if(typeof URL>`u`||typeof URL.createObjectURL!=`function`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}let t=new Set(e.map(e=>e.fileId)),n={};for(let[e,n]of Object.entries(this.thumbnailUrls))t.has(e)||(URL.revokeObjectURL(n),this.thumbnailFileById.delete(e));for(let t of e){let e=this.thumbnailUrls[t.fileId],r=this.thumbnailFileById.get(t.fileId);if(!t.file||!this.isImageFile(t)){e&&(URL.revokeObjectURL(e),this.thumbnailFileById.delete(t.fileId));continue}if(e&&r===t.file){n[t.fileId]=e;continue}e&&r!==t.file&&URL.revokeObjectURL(e);let i=URL.createObjectURL(t.file);this.thumbnailFileById.set(t.fileId,t.file),n[t.fileId]=i}this.thumbnailUrls=n}revokeAllThumbnailUrls(){typeof URL>`u`||typeof URL.revokeObjectURL!=`function`?(this.thumbnailUrls={},this.thumbnailFileById.clear()):(Object.values(this.thumbnailUrls).forEach(e=>URL.revokeObjectURL(e)),this.thumbnailUrls={},this.thumbnailFileById.clear())}getSrUploadedMessage(){if(this.addedAnnouncement)return this.addedAnnouncement;let{totalCount:e,uploadedCount:t}=C(this.getCurrentFiles(),this.transfers);if(e===0||t===0)return``;let r=this.pktStrings.get(`fileupload`);return n.t(r.srFilesUploadedOfTotal,{uploaded:t,total:e,label:n.n(e,r.fileLabelOne,r.fileLabelOther)})}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=C(this.getCurrentFiles(),this.transfers);if(e===0||t===0)return``;let r=this.pktStrings.get(`fileupload`);return n.t(r.srFilesFailedOfTotal,{failed:t,total:e,label:n.n(e,r.fileLabelOne,r.fileLabelOther)})}get ownerForm(){if(this.form!==void 0){if(!this.form)return null;let e=this.ownerDocument?.getElementById(this.form);return e instanceof HTMLFormElement?e:null}return this.closest(`form`)}syncFormSubmitListener(){let e=this.ownerForm;this.connectedForm!==e&&(this.teardownFormSubmitListener(),this.connectedForm=e,this.connectedForm&&this.connectedForm.addEventListener(`submit`,this.onHostFormSubmit))}teardownFormSubmitListener(){this.connectedForm&&=(this.connectedForm.removeEventListener(`submit`,this.onHostFormSubmit),null)}};e.n([e.u({type:String})],T.prototype,`id`,void 0),e.n([e.u({type:String})],T.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],T.prototype,`form`,void 0),e.n([e.u({type:String})],T.prototype,`label`,void 0),e.n([e.u({type:String})],T.prototype,`helptext`,void 0),e.n([e.u({type:String,attribute:`helptext-dropdown`})],T.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,attribute:`helptext-dropdown-button`})],T.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`required`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`multiple`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`fullwidth`})],T.prototype,`fullwidth`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`upload-strategy`})],T.prototype,`uploadStrategy`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`item-renderer`})],T.prototype,`itemRenderer`,void 0),e.n([e.u({type:String})],T.prototype,`accept`,void 0),e.n([e.u({converter:i.t.csvToArray,attribute:`allowed-formats`})],T.prototype,`allowedFormats`,void 0),e.n([e.u({type:String,attribute:`format-error-message`})],T.prototype,`formatErrorMessage`,void 0),e.n([e.u({attribute:`max-file-size`})],T.prototype,`maxFileSize`,void 0),e.n([e.u({type:String,attribute:`size-error-message`})],T.prototype,`sizeErrorMessage`,void 0),e.n([e.u({attribute:!1})],T.prototype,`onFileValidation`,void 0),e.n([e.u({attribute:!1})],T.prototype,`transfers`,void 0),e.n([e.u({type:Boolean,attribute:`add-comments-enabled`})],T.prototype,`addCommentsEnabled`,void 0),e.n([e.u({type:Boolean,attribute:`rename-files-enabled`})],T.prototype,`renameFilesEnabled`,void 0),e.n([e.u({attribute:!1})],T.prototype,`extraOperations`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`enable-image-preview`})],T.prototype,`enableImagePreview`,void 0),e.n([e.u({type:Boolean,attribute:`has-error`})],T.prototype,`hasError`,void 0),e.n([e.u({type:String,attribute:`error-message`})],T.prototype,`errorMessage`,void 0),e.n([e.u({type:Boolean,attribute:`optional-tag`})],T.prototype,`optionalTag`,void 0),e.n([e.u({type:String,attribute:`optional-text`})],T.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean,attribute:`required-tag`})],T.prototype,`requiredTag`,void 0),e.n([e.u({type:String,attribute:`required-text`})],T.prototype,`requiredText`,void 0),e.n([e.u({type:String,attribute:`tag-text`})],T.prototype,`tagText`,void 0),e.n([e.u({type:Number,attribute:`truncate-tail`})],T.prototype,`truncateTail`,void 0),e.n([e.u({attribute:!1})],T.prototype,`value`,void 0),e.n([e.u({attribute:!1})],T.prototype,`defaultValue`,void 0),e.n([e.l()],T.prototype,`files`,void 0),e.n([e.l()],T.prototype,`isDragActive`,void 0),e.n([e.l()],T.prototype,`validationErrorMessage`,void 0),e.n([e.l()],T.prototype,`addedAnnouncement`,void 0),e.n([e.l()],T.prototype,`thumbnailUrls`,void 0);var E=`comments`,D=(e,t)=>{let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=String(r.getDate()).padStart(2,`0`),a=String(r.getMonth()+1).padStart(2,`0`),o=r.getFullYear(),s=String(r.getHours()).padStart(2,`0`),c=String(r.getMinutes()).padStart(2,`0`);return n.t(t.commentTimestamp,{date:`${i}.${a}.${o}`,time:`${s}:${c}`})},O=(e,t,n)=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},k=(e,t,n)=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},A=(e,t)=>({id:`remove`,title:t.remove,ariaLabel:t.removeFile,onClick:({file:t})=>e(t.fileId)}),j=t=>({id:`rename`,title:t.rename,ariaLabel:t.renameFile,renderInlineUI:n=>{let r=n.getAttribute(`targetFilename`)||n.file.attributes?.targetFilename||n.file.file?.name||``,i=`pkt-fileupload-rename-${n.file.fileId}`,a=()=>{let e=document.getElementById(i)?.value?.trim();e&&n.setAttribute(`targetFilename`,e),n.close()};return e._`
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs");require("./alert-DkyTTo7S.cjs"),require("./icon-5A378_yh.cjs"),require("./input-wrapper-C_Rzwxx7.cjs"),require("./progressbar-BdqIhC1Z.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs"),i=require("./converters-CW6SN0TT.cjs"),a=require("./utils-63cRpWut.cjs"),o=require("./focus-trap-DSv4Ifqm.cjs");require("./modal-BvTfLfFq.cjs");function s(e){if(e==null||e===``)return;if(typeof e==`number`)return Number.isFinite(e)&&e>0?e:void 0;let t=String(e).trim(),n=Number(t);if(!Number.isNaN(n)&&n>0)return n;let r=t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!r){console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);return}let i=parseFloat(r[1]);switch(r[2].toUpperCase()){case`B`:return i;case`KB`:return i*1024;case`MB`:return i*1024*1024;case`GB`:return i*1024*1024*1024;default:return}}function c(e){return e<1024?`${Math.round(e)} B`:e<1048576?`${Math.round(e/1024)} KB`:e<1073741824?`${Math.round(e/1048576)} MB`:`${Math.round(e/1073741824)} GB`}function l(e){return Array.isArray(e)?e.map(e=>String(e).trim().toLowerCase()).filter(Boolean):[]}function u(e){return e?e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean):[]}function d(e,t,n){let r=e.toLowerCase().replace(/^\./,``);if(r.includes(`/`)){if(r.endsWith(`/*`)){let e=r.replace(`/*`,``);return n.startsWith(`${e}/`)}return n===r}return t===r}function f(e,t){let n=l(t);if(n.length===0)return!0;let r=e.name.split(`.`).pop()?.toLowerCase()??``,i=e.type.toLowerCase();return n.some(e=>d(e,r,i))}function p(e,t){let n=(e??``).trim();if(n)return n;let r=l(t);return r.length===0?``:r.map(e=>e.includes(`/`)||e.startsWith(`.`)?e:`.${e}`).join(`, `)}function m(e){return e.includes(`/`)?e:e.replace(/^\./,``).toUpperCase()}function h(e,t){let n=l(e);if(n.length>0)return n.map(m).join(`, `);let r=u(t);return r.length>0?r.map(m).join(`, `):``}function g(e,t,n){return((e??``).trim()||t).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`)}function _(t,n){let r=l(n.allowedFormats);if(r.length>0&&!f(t,r)){let t=r.join(`, `),i=e.s.fileupload.invalidFormat;return g(n.formatErrorMessage,i,{formats:t})}let i=s(n.maxFileSize);if(i!==void 0&&t.size>i){let t=c(i),r=e.s.fileupload.sizeTooLarge;return g(n.sizeErrorMessage,r,{maxSize:t})}if(n.onFileValidation){let e=n.onFileValidation(t);if(e)return e}return null}function v(e){let t=e.file;if(t?.type?.startsWith(`image/`))return!0;let n=e.attributes?.targetFilename||t?.name||``;return/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n)}function y(e){return typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`}function b(e,t,n){let r={"in-progress":0,error:1,idle:2};return e.map(e=>{let r=t?.find(t=>t.fileId===e.fileId);return{...e,progress:r?.progress??(n===`form`?`done`:`queued`),errorMessage:r?.errorMessage,showProgress:r?.showProgress,lastProgress:r?.lastProgress}}).sort((e,t)=>r[y(e.progress)]-r[y(t.progress)])}function x(e,t){return!t||t<=0||e.length<=t+3?null:{head:e.slice(0,e.length-t),tail:e.slice(-t)}}function S(e,t,n){return n<=0?0:t===`prev`?e<=0?n-1:e-1:e>=n-1?0:e+1}function C(e,t){let n=e.length;if(n===0||!t||t.length===0)return{totalCount:n,uploadedCount:0,failedCount:0};let r=0,i=0;for(let n of e){let e=t.find(e=>e.fileId===n.fileId);e?.progress===`done`?r++:e?.progress===`error`&&i++}return{totalCount:n,uploadedCount:r,failedCount:i}}function w(t,n=e.s.fileupload.unknownFilename){return t.attributes?.targetFilename||t.file?.name||n}var T=class extends e.t{constructor(...e){super(...e),this.id=`pkt-fileupload-${a.n()}`,this.name=`files`,this.label=``,this.helptext=``,this.helptextDropdown=``,this.required=!1,this.multiple=!1,this.disabled=!1,this.fullwidth=!1,this.uploadStrategy=`form`,this.itemRenderer=`filename`,this.accept=``,this.allowedFormats=[],this.formatErrorMessage=``,this.sizeErrorMessage=``,this.transfers=[],this.addCommentsEnabled=!1,this.renameFilesEnabled=!1,this.extraOperations=[],this.enableImagePreview=!1,this.hasError=!1,this.errorMessage=``,this.optionalTag=!1,this.requiredTag=!1,this.tagText=null,this.truncateTail=4,this.files=[],this.isDragActive=!1,this.validationErrorMessage=null,this.addedAnnouncement=``,this.thumbnailUrls={},this.hasInitializedValue=!1,this.hasWarnedInvalidValueCombo=!1,this.thumbnailFileById=new Map,this.connectedForm=null,this.addedAnnouncementTimer=null,this.onNativeFileChange=e=>{let t=e.target;this.addFiles(t.files?Array.from(t.files):[]),this.uploadStrategy===`custom`&&(t.value=``)},this.openFileDialog=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.querySelector(`#${this.id}-input`)?.click()},this.onDropZoneClick=e=>{this.disabled||e.target.closest(`.pkt-fileupload__drop-zone__placeholder__title__open-file-dialog`)||this.querySelector(`#${this.id}-input`)?.click()},this.onDragOver=e=>{e.preventDefault(),!this.disabled&&(this.isDragActive=!0)},this.onDragLeave=()=>{this.isDragActive=!1},this.onDrop=e=>{if(e.preventDefault(),this.isDragActive=!1,this.disabled)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this.addFiles(t)},this.onHostFormSubmit=e=>{this.required&&this.uploadStrategy===`custom`&&(this.getCurrentFiles().length>0||(this.validationErrorMessage=this.requiredSelectionMessage,e.preventDefault()))}}get requiredSelectionMessage(){return this.pktStrings.get(`fileupload`).requiredMissing}get isControlled(){return this.value!==void 0}get hasEffectiveError(){return!!this.validationErrorMessage||this.hasError||!!this.errorMessage.trim()}get effectiveErrorMessage(){return this.validationErrorMessage??this.errorMessage??``}get hasValidationError(){return!!this.validationErrorMessage}firstUpdated(e){super.firstUpdated?.(e),this.value!==void 0&&this.defaultValue!==void 0&&this.warnInvalidValueCombo()}willUpdate(e){super.willUpdate(e),this.hasInitializedValue?this.isControlled&&(e.has(`value`)||e.has(`itemRenderer`)||e.has(`enableImagePreview`))&&(this.files=this.value??[],this.syncThumbnailUrls(this.files)):(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),this.hasInitializedValue=!0)}updated(e){super.updated(e),(e.has(`uploadStrategy`)||e.has(`required`)||e.has(`value`)||e.has(`form`))&&this.syncFormSubmitListener(),this.uploadStrategy===`form`&&(e.has(`value`)||e.has(`files`)||e.has(`uploadStrategy`))&&this.syncNativeInputFiles()}syncNativeInputFiles(){let e=this.querySelector(`#${this.id}-input`);if(e&&typeof DataTransfer<`u`)try{let t=new DataTransfer;for(let e of this.getCurrentFiles())e.file&&t.items.add(e.file);e.files=t.files}catch{}}warnInvalidValueCombo(){this.hasWarnedInvalidValueCombo||=(console.warn(`PktFileUpload: Både value og defaultValue er angitt. Komponenten kan være enten kontrollert eller ukontrollert, ikke begge. value vil bli prioritert.`),!0)}disconnectedCallback(){this.teardownFormSubmitListener(),this.addedAnnouncementTimer&&=(clearTimeout(this.addedAnnouncementTimer),null),super.disconnectedCallback(),this.revokeAllThumbnailUrls()}setAddedAnnouncement(e){this.addedAnnouncement=e,this.addedAnnouncementTimer&&clearTimeout(this.addedAnnouncementTimer),this.addedAnnouncementTimer=setTimeout(()=>{this.addedAnnouncement=``,this.addedAnnouncementTimer=null},1500)}connectedCallback(){super.connectedCallback(),this.syncFormSubmitListener()}addFiles(e){if(e.length===0)return;let t=this.multiple?e:[e[0]];for(let e of t){let t=this.validateFile(e);if(t){this.validationErrorMessage=t;return}}this.validationErrorMessage=null;let r=t.map(e=>({fileId:a.n(),file:e,attributes:{targetFilename:e.name}})),i=this.pktStrings.get(`fileupload`);this.setAddedAnnouncement(r.length===1?n.t(i.srFileAdded,{filename:r[0].attributes.targetFilename}):n.t(i.srFilesAdded,{count:r.length}));let o=this.getCurrentFiles(),s=this.multiple?[...o,...r]:[r[0]];this.commitFiles(s,`add`,r.map(e=>e.fileId)),this.uploadStrategy===`custom`&&r.forEach(e=>{this.dispatchEvent(new CustomEvent(`file-upload-requested`,{detail:{fileId:e.fileId,file:e.file,attributes:e.attributes},bubbles:!0,composed:!0}))})}getCurrentFiles(){return this.isControlled?this.value??[]:this.files}cancelTransfer(e){if(this.disabled)return;let t=this.getCurrentFiles().find(t=>t.fileId===e);t&&(this.removeFileItem(e),this.dispatchEvent(new CustomEvent(`transfer-cancelled`,{detail:{fileId:t.fileId,file:t.file,attributes:t.attributes},bubbles:!0,composed:!0})))}removeFileItem(e){if(this.disabled)return;let t=this.getCurrentFiles(),n=t.filter(t=>t.fileId!==e);n.length!==t.length&&this.commitFiles(n,`remove`,[e])}updateFileItem(e,t){let n=this.getCurrentFiles().map(n=>n.fileId===e?{...n,...t}:n);this.commitFiles(n,`update`,[e])}commitFiles(e,t,n){this.isControlled||(this.files=e,this.syncThumbnailUrls(e)),this.validationErrorMessage===this.requiredSelectionMessage&&e.length>0&&(this.validationErrorMessage=null),this.dispatchEvent(new CustomEvent(`files-changed`,{detail:{files:e,reason:t,changedFileIds:n},bubbles:!0,composed:!0}))}getThumbnailUrl(e){return this.thumbnailUrls[e.fileId]}getTransferProgress(e){let t=this.transfers.find(t=>t.fileId===e);return t?t.progress:this.uploadStrategy===`form`?`done`:`queued`}getTransferForFile(e){return this.transfers.find(t=>t.fileId===e)}isImageFile(e){return v(e)}formatFileSize(e){return c(e)}getResolvedAcceptValue(){return p(this.accept,this.allowedFormats)}getSupportedFormatsText(){return h(this.allowedFormats,this.accept)}getSortedFilesAndTransfers(){return b(this.getCurrentFiles(),this.transfers,this.uploadStrategy)}validateFile(e){let t=_(e,{allowedFormats:this.allowedFormats,maxFileSize:this.maxFileSize,formatErrorMessage:this.formatErrorMessage,sizeErrorMessage:this.sizeErrorMessage,onFileValidation:this.onFileValidation});if(t)return t;let n={file:e,errorMessage:null},r=new CustomEvent(`file-validate`,{detail:n,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(r),n.errorMessage?n.errorMessage:r.defaultPrevented?this.pktStrings.get(`fileupload`).genericValidationRejection:null}syncThumbnailUrls(e){if(typeof URL>`u`||typeof URL.createObjectURL!=`function`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}let t=new Set(e.map(e=>e.fileId)),n={};for(let[e,n]of Object.entries(this.thumbnailUrls))t.has(e)||(URL.revokeObjectURL(n),this.thumbnailFileById.delete(e));for(let t of e){let e=this.thumbnailUrls[t.fileId],r=this.thumbnailFileById.get(t.fileId);if(!t.file||!this.isImageFile(t)){e&&(URL.revokeObjectURL(e),this.thumbnailFileById.delete(t.fileId));continue}if(e&&r===t.file){n[t.fileId]=e;continue}e&&r!==t.file&&URL.revokeObjectURL(e);let i=URL.createObjectURL(t.file);this.thumbnailFileById.set(t.fileId,t.file),n[t.fileId]=i}this.thumbnailUrls=n}revokeAllThumbnailUrls(){typeof URL>`u`||typeof URL.revokeObjectURL!=`function`?(this.thumbnailUrls={},this.thumbnailFileById.clear()):(Object.values(this.thumbnailUrls).forEach(e=>URL.revokeObjectURL(e)),this.thumbnailUrls={},this.thumbnailFileById.clear())}getSrUploadedMessage(){if(this.addedAnnouncement)return this.addedAnnouncement;let{totalCount:e,uploadedCount:t}=C(this.getCurrentFiles(),this.transfers);if(e===0||t===0)return``;let r=this.pktStrings.get(`fileupload`);return n.t(r.srFilesUploadedOfTotal,{uploaded:t,total:e,label:n.n(e,r.fileLabelOne,r.fileLabelOther)})}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=C(this.getCurrentFiles(),this.transfers);if(e===0||t===0)return``;let r=this.pktStrings.get(`fileupload`);return n.t(r.srFilesFailedOfTotal,{failed:t,total:e,label:n.n(e,r.fileLabelOne,r.fileLabelOther)})}get ownerForm(){if(this.form!==void 0){if(!this.form)return null;let e=this.ownerDocument?.getElementById(this.form);return e instanceof HTMLFormElement?e:null}return this.closest(`form`)}syncFormSubmitListener(){let e=this.ownerForm;this.connectedForm!==e&&(this.teardownFormSubmitListener(),this.connectedForm=e,this.connectedForm&&this.connectedForm.addEventListener(`submit`,this.onHostFormSubmit))}teardownFormSubmitListener(){this.connectedForm&&=(this.connectedForm.removeEventListener(`submit`,this.onHostFormSubmit),null)}};e.n([e.u({type:String})],T.prototype,`id`,void 0),e.n([e.u({type:String})],T.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],T.prototype,`form`,void 0),e.n([e.u({type:String})],T.prototype,`label`,void 0),e.n([e.u({type:String})],T.prototype,`helptext`,void 0),e.n([e.u({type:String,attribute:`helptext-dropdown`})],T.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,attribute:`helptext-dropdown-button`})],T.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`required`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`multiple`,void 0),e.n([e.u({type:Boolean,reflect:!0})],T.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`fullwidth`})],T.prototype,`fullwidth`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`upload-strategy`})],T.prototype,`uploadStrategy`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`item-renderer`})],T.prototype,`itemRenderer`,void 0),e.n([e.u({type:String})],T.prototype,`accept`,void 0),e.n([e.u({converter:i.t.csvToArray,attribute:`allowed-formats`})],T.prototype,`allowedFormats`,void 0),e.n([e.u({type:String,attribute:`format-error-message`})],T.prototype,`formatErrorMessage`,void 0),e.n([e.u({attribute:`max-file-size`})],T.prototype,`maxFileSize`,void 0),e.n([e.u({type:String,attribute:`size-error-message`})],T.prototype,`sizeErrorMessage`,void 0),e.n([e.u({attribute:!1})],T.prototype,`onFileValidation`,void 0),e.n([e.u({attribute:!1})],T.prototype,`transfers`,void 0),e.n([e.u({type:Boolean,attribute:`add-comments-enabled`})],T.prototype,`addCommentsEnabled`,void 0),e.n([e.u({type:Boolean,attribute:`rename-files-enabled`})],T.prototype,`renameFilesEnabled`,void 0),e.n([e.u({attribute:!1})],T.prototype,`extraOperations`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`enable-image-preview`})],T.prototype,`enableImagePreview`,void 0),e.n([e.u({type:Boolean,attribute:`has-error`})],T.prototype,`hasError`,void 0),e.n([e.u({type:String,attribute:`error-message`})],T.prototype,`errorMessage`,void 0),e.n([e.u({type:Boolean,attribute:`optional-tag`})],T.prototype,`optionalTag`,void 0),e.n([e.u({type:String,attribute:`optional-text`})],T.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean,attribute:`required-tag`})],T.prototype,`requiredTag`,void 0),e.n([e.u({type:String,attribute:`required-text`})],T.prototype,`requiredText`,void 0),e.n([e.u({type:String,attribute:`tag-text`})],T.prototype,`tagText`,void 0),e.n([e.u({type:Number,attribute:`truncate-tail`})],T.prototype,`truncateTail`,void 0),e.n([e.u({attribute:!1})],T.prototype,`value`,void 0),e.n([e.u({attribute:!1})],T.prototype,`defaultValue`,void 0),e.n([e.l()],T.prototype,`files`,void 0),e.n([e.l()],T.prototype,`isDragActive`,void 0),e.n([e.l()],T.prototype,`validationErrorMessage`,void 0),e.n([e.l()],T.prototype,`addedAnnouncement`,void 0),e.n([e.l()],T.prototype,`thumbnailUrls`,void 0);var E=`comments`,D=(e,t)=>{let r=new Date(e);if(Number.isNaN(r.getTime()))return e;let i=String(r.getDate()).padStart(2,`0`),a=String(r.getMonth()+1).padStart(2,`0`),o=r.getFullYear(),s=String(r.getHours()).padStart(2,`0`),c=String(r.getMinutes()).padStart(2,`0`);return n.t(t.commentTimestamp,{date:`${i}.${a}.${o}`,time:`${s}:${c}`})},O=(e,t,n)=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},k=(e,t,n)=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},A=(e,t)=>({id:`remove`,title:t.remove,ariaLabel:t.removeFile,onClick:({file:t})=>e(t.fileId)}),j=t=>({id:`rename`,title:t.rename,ariaLabel:t.renameFile,renderInlineUI:n=>{let r=n.getAttribute(`targetFilename`)||n.file.attributes?.targetFilename||n.file.file?.name||``,i=`pkt-fileupload-rename-${n.file.fileId}`,a=()=>{let e=document.getElementById(i)?.value?.trim();e&&n.setAttribute(`targetFilename`,e),n.close()};return e._`
2
2
  <label for=${i} class="pkt-sr-only">${t.renameInputLabel}</label>
3
3
  <input
4
4
  id=${i}
@@ -1,15 +1,15 @@
1
1
  import { _ as e, d as t, l as n, n as r, s as i, t as a, u as o } from "./element-DLgZkx5L.js";
2
2
  import { t as s } from "./class-map-BDwVSgLb.js";
3
3
  import { n as c, t as l } from "./format-BTeSVkED.js";
4
- import "./alert-UbQzzkXb.js";
5
- import "./icon-C82IxnSO.js";
6
- import "./input-wrapper-DowJHbGF.js";
4
+ import "./alert-CA1fDbyc.js";
5
+ import "./icon-C1oCGwEe.js";
6
+ import "./input-wrapper-DkpJS1hR.js";
7
7
  import "./progressbar-CfCc2zhp.js";
8
8
  import { t as u } from "./if-defined-DiYi2v_Q.js";
9
9
  import { t as d } from "./converters-CYgQrWVm.js";
10
10
  import { n as f } from "./utils-BwF4QSrq.js";
11
11
  import { r as p } from "./focus-trap-DG3pEuyJ.js";
12
- import "./modal-D389hSbe.js";
12
+ import "./modal-CA_M2Ix6.js";
13
13
  //#region ../../shared-utils/fileupload/size.ts
14
14
  function m(e) {
15
15
  if (e == null || e === "") return;
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs");require("./consent-BjWx64Gv.cjs");const t=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const n=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-B3YGHHa7.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs");var i=`oslo.kommune.no`,a=/\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;function o(e){let t=e.toLowerCase().replace(/\.$/,``),n=t.split(`.`);return n.length<=2?t:n.slice(a.test(t)?-3:-2).join(`.`)}function s(e){if(!e)return;let t;try{t=new URL(e)}catch{return}if(t.protocol===`http:`||t.protocol===`https:`)return o(t.hostname.toLowerCase().replace(/\.$/,``))}function c(e,t=i){if(!e)return;let n;try{n=new URL(e)}catch{return}if(n.protocol!==`http:`&&n.protocol!==`https:`)return;let r=n.hostname.toLowerCase().replace(/\.$/,``),a=t.toLowerCase();if(!(r===a||r.endsWith(`.${a}`)))return o(r)}var l=`#cb-trigger`,u=class extends e.t{constructor(...e){super(...e),this.locale=`nb-NO`,this.skipGlobal=!1,this.openLinksInNewTab=!1,this.includeConsent=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.devMode=!1,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null}connectedCallback(){super.connectedCallback(),!this.data&&!this.skipGlobal&&this.loadData()}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort()}updated(e){super.updated(e),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData()}async loadData(){this.abortController?.abort(),this.abortController=new AbortController;try{this.fetchedData=await n.t(this.dataUrl,this.abortController.signal)}catch(e){if(e.name===`AbortError`)return;console.warn(`Failed to fetch header/footer data:`,e),this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}get globalFooterData(){return n.n(this.data??this.fetchedData,this.locale)?.footer}linkTarget(e){return e.openInNewTab||this.openLinksInNewTab?{target:`_blank`,rel:`noopener noreferrer`}:{target:`_self`}}renderLinkDomain(t,n=`pkt-footer__link-domain`){if(!t.external)return e.h;let r=s(t.href);return r?e._` <span class=${n}>(${r})</span>`:e.h}renderCustomLink(t){let{target:n,rel:i}=this.linkTarget(t);return e._`
1
+ const e=require("./element-CEarCnHH.cjs");require("./consent-UkinU27V.cjs");const t=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const n=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-5A378_yh.cjs");const r=require("./if-defined-Ci4ZQsgL.cjs");var i=`oslo.kommune.no`,a=/\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;function o(e){let t=e.toLowerCase().replace(/\.$/,``),n=t.split(`.`);return n.length<=2?t:n.slice(a.test(t)?-3:-2).join(`.`)}function s(e){if(!e)return;let t;try{t=new URL(e)}catch{return}if(t.protocol===`http:`||t.protocol===`https:`)return o(t.hostname.toLowerCase().replace(/\.$/,``))}function c(e,t=i){if(!e)return;let n;try{n=new URL(e)}catch{return}if(n.protocol!==`http:`&&n.protocol!==`https:`)return;let r=n.hostname.toLowerCase().replace(/\.$/,``),a=t.toLowerCase();if(!(r===a||r.endsWith(`.${a}`)))return o(r)}var l=`#cb-trigger`,u=class extends e.t{constructor(...e){super(...e),this.locale=`nb-NO`,this.skipGlobal=!1,this.openLinksInNewTab=!1,this.includeConsent=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.devMode=!1,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null}connectedCallback(){super.connectedCallback(),!this.data&&!this.skipGlobal&&this.loadData()}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort()}updated(e){super.updated(e),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData()}async loadData(){this.abortController?.abort(),this.abortController=new AbortController;try{this.fetchedData=await n.t(this.dataUrl,this.abortController.signal)}catch(e){if(e.name===`AbortError`)return;console.warn(`Failed to fetch header/footer data:`,e),this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}get globalFooterData(){return n.n(this.data??this.fetchedData,this.locale)?.footer}linkTarget(e){return e.openInNewTab||this.openLinksInNewTab?{target:`_blank`,rel:`noopener noreferrer`}:{target:`_self`}}renderLinkDomain(t,n=`pkt-footer__link-domain`){if(!t.external)return e.h;let r=s(t.href);return r?e._` <span class=${n}>(${r})</span>`:e.h}renderCustomLink(t){let{target:n,rel:i}=this.linkTarget(t);return e._`
2
2
  <a href=${t.href} target=${n} rel=${r.t(i)}
3
3
  >${t.text}${this.renderLinkDomain(t)}</a
4
4
  >
@@ -1,9 +1,9 @@
1
1
  import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-DLgZkx5L.js";
2
- import "./consent-CeJKY2EB.js";
2
+ import "./consent-p-0n2b9x.js";
3
3
  import { t as s } from "./booleanish-OQJTYSrw.js";
4
4
  import "./shared-types-A6iGIX-f.js";
5
5
  import { n as c, r as l, t as u } from "./fetch-header-footer-data-Pc32etrk.js";
6
- import "./icon-C82IxnSO.js";
6
+ import "./icon-C1oCGwEe.js";
7
7
  import { t as d } from "./if-defined-DiYi2v_Q.js";
8
8
  //#region ../../shared-utils/header-footer/external-domain.ts
9
9
  var f = "oslo.kommune.no", p = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
@@ -5,16 +5,16 @@ import { i as l, t as u } from "./element-with-slot-mG-h7Sjw.js";
5
5
  import { t as d } from "./booleanish-OQJTYSrw.js";
6
6
  import "./shared-types-A6iGIX-f.js";
7
7
  import { n as f, o as p, t as m } from "./fetch-header-footer-data-Pc32etrk.js";
8
- import "./icon-C82IxnSO.js";
9
- import "./textinput-Dhwotaxv.js";
8
+ import "./icon-C1oCGwEe.js";
9
+ import "./textinput-CBrOZcvL.js";
10
10
  import { t as h } from "./if-defined-DiYi2v_Q.js";
11
- import "./button-BJ6QLwxJ.js";
11
+ import "./button-Bswo1C0M.js";
12
12
  import { n as g, t as _ } from "./ref-BAegS9BR.js";
13
13
  import { n as v, t as y } from "./focus-trap-DG3pEuyJ.js";
14
14
  import { n as b, t as x } from "./scroll-lock-CR-g54ai.js";
15
- import "./link-D9kjggXZ.js";
16
- import "./searchinput-B26-Xp00.js";
17
- import "./header-menu-BV0XlRez.js";
15
+ import "./link-DLPpwjq4.js";
16
+ import "./searchinput-BLGaXkP6.js";
17
+ import "./header-menu-BrjsNjBH.js";
18
18
  //#region ../../shared-types/header.ts
19
19
  var S = (e) => typeof e.target == "string" ? {
20
20
  title: e.title,
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CeKuRE3_.cjs"),i=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-B3YGHHa7.cjs"),require("./textinput-B6FPNOJB.cjs");const o=require("./if-defined-Ci4ZQsgL.cjs");require("./button-pFlrTF2P.cjs");const s=require("./ref-B6p6mQkO.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-x0VxhKWZ.cjs");require("./link-DqPFlWxz.cjs"),require("./searchinput-Trn6uU2J.cjs"),require("./header-menu-BiW5cNun.cjs");var u=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},d=e=>u(e),f=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=l.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.initialWidthEstimated=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostUpdate(){this.initialWidthEstimated||(this.initialWidthEstimated=!0,this.componentWidth=this.host.offsetWidth,this.applyBreakpoints())}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),l.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){this.applyBreakpoints()&&this.host.requestUpdate()}applyBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;return n===this.isMobile&&r===this.isTablet?!1:(this.isMobile=n,this.isTablet=r,!0)}setScrollLock(e){l.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},m=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e._`
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CeKuRE3_.cjs"),i=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-5A378_yh.cjs"),require("./textinput-CN2F3Q3H.cjs");const o=require("./if-defined-Ci4ZQsgL.cjs");require("./button-bVWAX98x.cjs");const s=require("./ref-B6p6mQkO.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-x0VxhKWZ.cjs");require("./link-pkFJ11Zd.cjs"),require("./searchinput-TAqMUJ0B.cjs"),require("./header-menu-Dq9lwNr1.cjs");var u=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},d=e=>u(e),f=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=l.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.initialWidthEstimated=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostUpdate(){this.initialWidthEstimated||(this.initialWidthEstimated=!0,this.componentWidth=this.host.offsetWidth,this.applyBreakpoints())}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),l.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){this.applyBreakpoints()&&this.host.requestUpdate()}applyBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;return n===this.isMobile&&r===this.isTablet?!1:(this.isMobile=n,this.isTablet=r,!0)}setScrollLock(e){l.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},m=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e._`
2
2
  <pkt-link
3
3
  iconName=${n.iconName||e.h}
4
4
  href=${n.href}
@@ -3,7 +3,7 @@ import { t as s } from "./class-map-BDwVSgLb.js";
3
3
  import { t as c } from "./booleanish-OQJTYSrw.js";
4
4
  import "./shared-types-A6iGIX-f.js";
5
5
  import { a as l, i as u, n as d, r as f, t as p } from "./fetch-header-footer-data-Pc32etrk.js";
6
- import "./icon-C82IxnSO.js";
6
+ import "./icon-C1oCGwEe.js";
7
7
  import "./accordion-C5cu1xXT.js";
8
8
  //#region src/components/header-menu/header-menu.ts
9
9
  var m = class extends a {
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const r=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-B3YGHHa7.cjs"),require("./accordion-5N_ptxrN.cjs");var i=class extends e.t{constructor(...e){super(...e),this.dataUrl=r.a,this.locale=`nb-NO`,this.open=!1,this.mobileBreakpoint=768,this.loadState=`idle`,this.isMobile=!1,this.menuWidth=0}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-menu`),this.updateOpenClass(),this.observeWidth(),this.data?(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0}))):this.loadData()}updateOpenClass(){this.classList.toggle(`pkt-header-menu--open`,!!this.open)}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0}updated(e){super.updated(e),e.has(`open`)&&this.updateOpenClass(),e.has(`mobileBreakpoint`)&&e.get(`mobileBreakpoint`)!==void 0&&this.refreshIsMobile(),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData(),e.has(`data`)&&e.get(`data`)!==void 0&&this.data&&(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0})))}observeWidth(){typeof ResizeObserver<`u`&&(this.menuWidth=this.offsetWidth,this.refreshIsMobile(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.menuWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshIsMobile()}),this.resizeObserver.observe(this))}refreshIsMobile(){this.isMobile=this.menuWidth<this.mobileBreakpoint}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadState=`loading`;try{let e=await r.t(this.dataUrl,this.abortController.signal);this.fetchedData=e,this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:e},bubbles:!0,composed:!0}))}catch(e){if(e.name===`AbortError`)return;this.loadState=`error`,this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}get effectiveData(){return this.data??this.fetchedData}get localeData(){return r.n(this.effectiveData,this.locale)}render(){if(this.loadState===`loading`)return e._`
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const r=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-5A378_yh.cjs"),require("./accordion-5N_ptxrN.cjs");var i=class extends e.t{constructor(...e){super(...e),this.dataUrl=r.a,this.locale=`nb-NO`,this.open=!1,this.mobileBreakpoint=768,this.loadState=`idle`,this.isMobile=!1,this.menuWidth=0}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-header-menu`),this.updateOpenClass(),this.observeWidth(),this.data?(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0}))):this.loadData()}updateOpenClass(){this.classList.toggle(`pkt-header-menu--open`,!!this.open)}disconnectedCallback(){super.disconnectedCallback(),this.abortController?.abort(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0}updated(e){super.updated(e),e.has(`open`)&&this.updateOpenClass(),e.has(`mobileBreakpoint`)&&e.get(`mobileBreakpoint`)!==void 0&&this.refreshIsMobile(),e.has(`dataUrl`)&&e.get(`dataUrl`)!==void 0&&!this.data&&this.loadData(),e.has(`data`)&&e.get(`data`)!==void 0&&this.data&&(this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:this.data},bubbles:!0,composed:!0})))}observeWidth(){typeof ResizeObserver<`u`&&(this.menuWidth=this.offsetWidth,this.refreshIsMobile(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.menuWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshIsMobile()}),this.resizeObserver.observe(this))}refreshIsMobile(){this.isMobile=this.menuWidth<this.mobileBreakpoint}async loadData(){this.abortController?.abort(),this.abortController=new AbortController,this.loadState=`loading`;try{let e=await r.t(this.dataUrl,this.abortController.signal);this.fetchedData=e,this.loadState=`ready`,this.dispatchEvent(new CustomEvent(`data-loaded`,{detail:{data:e},bubbles:!0,composed:!0}))}catch(e){if(e.name===`AbortError`)return;this.loadState=`error`,this.dispatchEvent(new CustomEvent(`data-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}get effectiveData(){return this.data??this.fetchedData}get localeData(){return r.n(this.effectiveData,this.locale)}render(){if(this.loadState===`loading`)return e._`
2
2
  <nav aria-busy="true">
3
3
  <p class="pkt-header-menu__loading">${this.pktStrings.get(`header`).menuLoading}</p>
4
4
  </nav>
@@ -1,7 +1,7 @@
1
1
  import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-DLgZkx5L.js";
2
2
  import { t as o } from "./class-map-BDwVSgLb.js";
3
3
  import { i as s, t as c } from "./element-with-slot-mG-h7Sjw.js";
4
- import { r as l } from "./icon-C82IxnSO.js";
4
+ import { r as l } from "./icon-C1oCGwEe.js";
5
5
  import { n as u } from "./utils-BwF4QSrq.js";
6
6
  //#region src/components/helptext/helptext.ts
7
7
  var d = class extends c {
@@ -1,4 +1,4 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs"),r=require("./icon-B3YGHHa7.cjs"),i=require("./utils-63cRpWut.cjs");var a=class extends n.t{constructor(...e){super(...e),this.forId=i.n(),this.helptext=``,this.helptextDropdown=``,this.isHelpTextOpen=!1}render(){let i=()=>{let e=!this.isHelpTextOpen;this.isHelpTextOpen=e,this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!0,detail:{isOpen:e}}))},a=t.t({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()});return e._`${e._`<div class="${a}">
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs"),r=require("./icon-5A378_yh.cjs"),i=require("./utils-63cRpWut.cjs");var a=class extends n.t{constructor(...e){super(...e),this.forId=i.n(),this.helptext=``,this.helptextDropdown=``,this.isHelpTextOpen=!1}render(){let i=()=>{let e=!this.isHelpTextOpen;this.isHelpTextOpen=e,this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!0,detail:{isOpen:e}}))},a=t.t({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()});return e._`${e._`<div class="${a}">
2
2
  <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
3
3
  <div class="pkt-contents">${n.i(this)}</div>
4
4
  ${this.helptext?e._`<span>${r.r(this.helptext)}</span>`:e.h}
@@ -0,0 +1 @@
1
+ const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs");var t=`https://cdn.ikoner.oslo.kommune.no/icons/`,n=`https://punkt-cdn.oslo.kommune.no/latest/animations/`,r={name:``,path:t},i=class extends e.p{constructor(t){if(super(t),this.it=e.h,t.type!==e.m.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.h||t==null)return this._t=void 0,this.it=t;if(t===e.g)return t;if(typeof t!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(t===this.it)return this._t;this.it=t;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};i.directiveName=`unsafeHTML`,i.resultType=1;var a=e.f(i),o=class extends i{};o.directiveName=`unsafeSVG`,o.resultType=2;var s=e.f(o);typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||r.path);var c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,l={},u=2,d=1500,f=(()=>{try{return typeof Storage<`u`&&typeof sessionStorage<`u`}catch{return!1}})(),p=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),m=async(e,t=u)=>{try{return await p(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,d)),m(e,t-1)):(console.error(`Failed to fetch icon: `+e),c)}},h=async(e,t)=>{let n=t+e+`.svg`;return f&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in l?l[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(l[n]=m(n).then(e=>(e!==c&&f&&sessionStorage.setItem(n,e),delete l[n],e)),l[n]):c},g=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:r.path,this.name=r.name,this.ariaHidden=null,this.ariaLabel=null,this.icon=s(c),this._updatedProps=[]}get effectiveAriaHidden(){return this.ariaHidden!==null&&this.ariaHidden!==void 0?this.ariaHidden===``||this.ariaHidden===`true`:!this.ariaLabel}get effectiveAriaLabel(){return this.effectiveAriaHidden?null:this.ariaLabel||this.name||null}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name),this.applyAriaToSvg()}applyAriaToSvg(){let e=this.querySelector(`svg`);if(!e)return;e.setAttribute(`aria-hidden`,String(this.effectiveAriaHidden));let t=this.effectiveAriaLabel;t?e.setAttribute(`aria-label`,t):e.removeAttribute(`aria-label`)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:r.path;try{this.icon=s(await h(this.name||``,this.path))}catch{this.icon=s(c)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e._`${this.name&&this.icon}`}};e.n([e.u({type:String,reflect:!1})],g.prototype,`path`,void 0),e.n([e.u({type:String,reflect:!0})],g.prototype,`name`,void 0),e.n([e.u({type:String,attribute:`aria-hidden`,reflect:!0})],g.prototype,`ariaHidden`,void 0),e.n([e.u({type:String,attribute:`aria-label`,reflect:!0})],g.prototype,`ariaLabel`,void 0),e.n([e.u({type:SVGElement})],g.prototype,`icon`,void 0),e.n([e.u({type:Array,noAccessor:!0})],g.prototype,`_updatedProps`,void 0);try{e.d(`pkt-icon`)(g)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var _=g;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
@@ -1,7 +1,7 @@
1
1
  import { _ as e, d as t, f as n, g as r, h as i, m as a, n as o, p as s, t as c, u as l } from "./element-DLgZkx5L.js";
2
2
  import "./shared-types-A6iGIX-f.js";
3
3
  //#region ../../shared-types/icon.ts
4
- var u = "https://punkt-cdn.oslo.kommune.no/latest/icons/", d = "https://punkt-cdn.oslo.kommune.no/latest/animations/", f = {
4
+ var u = "https://cdn.ikoner.oslo.kommune.no/icons/", d = "https://punkt-cdn.oslo.kommune.no/latest/animations/", f = {
5
5
  name: "",
6
6
  path: u
7
7
  }, p = class extends s {
@@ -1,6 +1,6 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs"),r=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./alert-KxCE28nq.cjs");const i=require("./icon-B3YGHHa7.cjs"),a=require("./if-defined-Ci4ZQsgL.cjs"),o=require("./utils-63cRpWut.cjs");require("./helptext-B4h3Xlqa.cjs");const s=require("./focus-modality-controller-C1ocyv2J.cjs");var c={counter:!1,counterCurrent:0,counterPosition:`bottom`,optionalTag:!1,requiredTag:!1,hasError:!1,disabled:!1,inline:!1,hasFieldset:!1,layout:`vertical`,useWrapper:!0,size:`medium`},l=e=>{let t=[];return e.hasHelptext&&t.push(`${e.id}-helptext`),e.hasCounter&&t.push(`${e.id}-counter-status`),e.ariaDescribedby&&t.push(e.ariaDescribedby),t.length?t.join(` `):void 0},u=e=>`${e}-counter-status`,d=(e,t)=>!!t&&t>0&&(e??0)>t,f=class extends n.t{constructor(...e){super(...e),this.forId=o.n(),this.label=``,this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=c.counter,this.counterCurrent=c.counterCurrent,this.counterMaxLength=0,this.counterError=null,this.counterPosition=c.counterPosition,this.optionalTag=c.optionalTag,this.requiredTag=c.requiredTag,this.tagText=null,this.hasError=c.hasError,this.errorMessage=``,this.disabled=c.disabled,this.inline=c.inline,this.ariaDescribedby=void 0,this.hasFieldset=c.hasFieldset,this.layout=c.layout,this.role=null,this.useWrapper=c.useWrapper,this.size=c.size,this.focusModality=new s.t(this)}updated(e){super.updated(e),this.classList.add(`pkt-inputwrapper`),this.classList.toggle(`pkt-inputwrapper--error`,this.hasError),this.classList.toggle(`pkt-inputwrapper--disabled`,this.disabled),this.classList.toggle(`pkt-inputwrapper--inline`,this.inline),this.classList.toggle(`pkt-inputwrapper--medium`,this.size===`medium`),this.classList.toggle(`pkt-inputwrapper--small`,this.size===`small`),this.classList.toggle(`pkt-inputwrapper--xsmall`,this.size===`xsmall`),this.role?this.setAttribute(`aria-labelledby`,`${this.forId}-label`):this.removeAttribute(`aria-labelledby`)}render(){let r=`pkt-tag pkt-tag--small pkt-tag--thin-text`,o=!!this.helptext||this.hasSlotContent(`helptext`),s=new Set([this.ariaDescribedby||(o?`${this.forId}-helptext`:``),this.hasError&&this.errorMessage?`${this.forId}-error`:``].join(` `).split(` `).filter(Boolean)),c=s.size?[...s].join(` `):e.h,l=this.pktStrings.get(`forms`),f=()=>e._`
1
+ const e=require("./element-CEarCnHH.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs"),r=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./alert-DkyTTo7S.cjs");const i=require("./icon-5A378_yh.cjs"),a=require("./if-defined-Ci4ZQsgL.cjs"),o=require("./utils-63cRpWut.cjs");require("./helptext-Bse1LpRd.cjs");const s=require("./focus-modality-controller-C1ocyv2J.cjs");var c={counter:!1,counterCurrent:0,counterPosition:`bottom`,optionalTag:!1,requiredTag:!1,hasError:!1,disabled:!1,inline:!1,hasFieldset:!1,layout:`vertical`,useWrapper:!0,size:`medium`},l=e=>{let t=[];return e.hasHelptext&&t.push(`${e.id}-helptext`),e.hasCounter&&t.push(`${e.id}-counter-status`),e.ariaDescribedby&&t.push(e.ariaDescribedby),t.length?t.join(` `):void 0},u=e=>`${e}-counter-status`,d=(e,t)=>!!t&&t>0&&(e??0)>t,f=class extends n.t{constructor(...e){super(...e),this.forId=o.n(),this.label=``,this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=c.counter,this.counterCurrent=c.counterCurrent,this.counterMaxLength=0,this.counterError=null,this.counterPosition=c.counterPosition,this.optionalTag=c.optionalTag,this.requiredTag=c.requiredTag,this.tagText=null,this.hasError=c.hasError,this.errorMessage=``,this.disabled=c.disabled,this.inline=c.inline,this.ariaDescribedby=void 0,this.hasFieldset=c.hasFieldset,this.layout=c.layout,this.role=null,this.useWrapper=c.useWrapper,this.size=c.size,this.focusModality=new s.t(this)}updated(e){super.updated(e),this.classList.add(`pkt-inputwrapper`),this.classList.toggle(`pkt-inputwrapper--error`,this.hasError),this.classList.toggle(`pkt-inputwrapper--disabled`,this.disabled),this.classList.toggle(`pkt-inputwrapper--inline`,this.inline),this.classList.toggle(`pkt-inputwrapper--medium`,this.size===`medium`),this.classList.toggle(`pkt-inputwrapper--small`,this.size===`small`),this.classList.toggle(`pkt-inputwrapper--xsmall`,this.size===`xsmall`),this.role?this.setAttribute(`aria-labelledby`,`${this.forId}-label`):this.removeAttribute(`aria-labelledby`)}render(){let r=`pkt-tag pkt-tag--small pkt-tag--thin-text`,o=!!this.helptext||this.hasSlotContent(`helptext`),s=new Set([this.ariaDescribedby||(o?`${this.forId}-helptext`:``),this.hasError&&this.errorMessage?`${this.forId}-error`:``].join(` `).split(` `).filter(Boolean)),c=s.size?[...s].join(` `):e.h,l=this.pktStrings.get(`forms`),f=()=>e._`
2
2
  ${this.tagText?e._`<span class=${r+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
3
- ${this.optionalTag?e._`<span class=${r+` pkt-tag--blue-light`}
3
+ ${this.optionalTag?e._`<span class=${r+` pkt-tag--blue-pale`}
4
4
  >${this.optionalText??l.optional}</span
5
5
  >`:e.h}
6
6
  ${this.requiredTag?e._`<span class=${r+` pkt-tag--beige`}
@@ -3,11 +3,11 @@ import { t as a } from "./format-BTeSVkED.js";
3
3
  import { i as o, n as s, t as c } from "./element-with-slot-mG-h7Sjw.js";
4
4
  import { t as l } from "./booleanish-OQJTYSrw.js";
5
5
  import "./shared-types-A6iGIX-f.js";
6
- import "./alert-UbQzzkXb.js";
7
- import { r as u } from "./icon-C82IxnSO.js";
6
+ import "./alert-CA1fDbyc.js";
7
+ import { r as u } from "./icon-C1oCGwEe.js";
8
8
  import { t as d } from "./if-defined-DiYi2v_Q.js";
9
9
  import { n as f } from "./utils-BwF4QSrq.js";
10
- import "./helptext-CL1vxEaL.js";
10
+ import "./helptext-BFQzrOw4.js";
11
11
  import { t as p } from "./focus-modality-controller-Dc2S-KqR.js";
12
12
  //#region ../../shared-types/input-wrapper.ts
13
13
  var m = {
@@ -36,7 +36,7 @@ var m = {
36
36
  render() {
37
37
  let t = "pkt-tag pkt-tag--small pkt-tag--thin-text", r = !!this.helptext || this.hasSlotContent("helptext"), i = new Set([this.ariaDescribedby || (r ? `${this.forId}-helptext` : ""), this.hasError && this.errorMessage ? `${this.forId}-error` : ""].join(" ").split(" ").filter(Boolean)), c = i.size ? [...i].join(" ") : n, l = this.pktStrings.get("forms"), f = () => e`
38
38
  ${this.tagText ? e`<span class=${t + " pkt-tag--gray"}>${this.tagText}</span>` : n}
39
- ${this.optionalTag ? e`<span class=${t + " pkt-tag--blue-light"}
39
+ ${this.optionalTag ? e`<span class=${t + " pkt-tag--blue-pale"}
40
40
  >${this.optionalText ?? l.optional}</span
41
41
  >` : n}
42
42
  ${this.requiredTag ? e`<span class=${t + " pkt-tag--beige"}