@oslokommune/punkt-elements 19.5.0 → 19.5.2

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 (162) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{accordion-CZ0O4c0_.cjs → accordion-5lSFQToJ.cjs} +6 -6
  3. package/dist/{accordion-DFcdonl-.js → accordion-BJh6X1Ek.js} +6 -6
  4. package/dist/{alert-CUOWdvit.js → alert-C0PiYnot.js} +28 -35
  5. package/dist/alert-IaZzEgyI.cjs +39 -0
  6. package/dist/{backlink-vLhK1hsj.cjs → backlink-BRqhwUr2.cjs} +1 -1
  7. package/dist/base-elements/checkable-native-parity.test.d.ts +0 -0
  8. package/dist/base-elements/form-disabled.test.d.ts +0 -0
  9. package/dist/base-elements/input-element.d.ts +10 -1
  10. package/dist/{button-B0uSFQVn.js → button-B78im4wB.js} +15 -15
  11. package/dist/button-BNVTj7nB.cjs +32 -0
  12. package/dist/{card-CfFW7_-K.js → card-CYKhPUNI.js} +11 -11
  13. package/dist/{card-C15acwk4.cjs → card-CaLEuumN.cjs} +10 -10
  14. package/dist/{checkbox-B2O0fkh9.js → checkbox-Bbxt-tVW.js} +8 -8
  15. package/dist/checkbox-_NnoYkue.cjs +40 -0
  16. package/dist/{combobox-DvsnfA0c.cjs → combobox-BBx87DCG.cjs} +27 -27
  17. package/dist/{combobox-Bhfh04Su.js → combobox-CjLX_Gfd.js} +41 -41
  18. package/dist/components/alert/alert.d.ts +0 -2
  19. package/dist/{consent-_DBvIRT2.js → consent-CleJMbVH.js} +1 -1
  20. package/dist/{consent-BfLkJbOk.cjs → consent-Dl-R0iC3.cjs} +1 -1
  21. package/dist/{datepicker-Cg-iueRC.cjs → datepicker-Bk-m5Zaa.cjs} +31 -31
  22. package/dist/{datepicker-BY2IKrPk.js → datepicker-CFCRxFQL.js} +13 -13
  23. package/dist/directives/slot-content.d.ts +36 -1
  24. package/dist/element-with-slot-D7sTqOr3.cjs +1 -0
  25. package/dist/{element-with-slot-FD826ooP.js → element-with-slot-DQv0cbbD.js} +80 -21
  26. package/dist/{fileupload-iuXrgrog.js → fileupload-B2606SvG.js} +31 -31
  27. package/dist/{fileupload-Djp6VJYY.cjs → fileupload-COAxc3sX.cjs} +21 -21
  28. package/dist/{footer-BCdb0wlF.js → footer-DdLls3F-.js} +13 -13
  29. package/dist/{footer-bTpLxigB.cjs → footer-vy9NqT65.cjs} +9 -9
  30. package/dist/{header-2fF-Zu5T.js → header-BQdc29IO.js} +55 -55
  31. package/dist/{header-DbSSOX-h.cjs → header-BhM7FRoC.cjs} +50 -50
  32. package/dist/{header-menu-DVYLZyez.js → header-menu-ANj5nL2M.js} +1 -1
  33. package/dist/{header-menu-ChDMnWhW.cjs → header-menu-BfkCp8jw.cjs} +1 -1
  34. package/dist/{heading-BRHCV_5J.js → heading-CUrZvkrM.js} +1 -1
  35. package/dist/{heading-u9Arof4p.cjs → heading-zoz-QZJ9.cjs} +1 -1
  36. package/dist/{helptext-CmsuAXSE.cjs → helptext-BCkwSz1m.cjs} +2 -2
  37. package/dist/{helptext-4TAHKV5_.js → helptext-DCT_9dw1.js} +1 -1
  38. package/dist/input-element-CSfDGslx.cjs +1 -0
  39. package/dist/{input-element-B1BntJeJ.js → input-element-lLzfwdim.js} +198 -173
  40. package/dist/{input-wrapper-B5rqKWSB.cjs → input-wrapper-BBG8EXQ8.cjs} +28 -28
  41. package/dist/{input-wrapper-CaMP5-Vm.js → input-wrapper-Bz9GwYrn.js} +46 -46
  42. package/dist/{link-CCFAmhL5.js → link-CmZwAw5u.js} +1 -1
  43. package/dist/{link-Bo2o0Akv.cjs → link-LO_5_La8.cjs} +2 -2
  44. package/dist/{linkcard-9L6QF7US.js → linkcard-CQluSyJJ.js} +7 -7
  45. package/dist/{linkcard-D7NbrluR.cjs → linkcard-UKsxADrP.cjs} +3 -3
  46. package/dist/{listbox-DEzd-dxF.js → listbox-Ct9jIV_5.js} +8 -8
  47. package/dist/{listbox-BoBwzL4p.cjs → listbox-g-vHHLkD.cjs} +20 -20
  48. package/dist/{loader-CQaGvyF9.cjs → loader-C_PH05aw.cjs} +2 -2
  49. package/dist/{loader-RQQ_o2aR.js → loader-DzctJ9jW.js} +1 -1
  50. package/dist/{messagebox-C-BQREWz.js → messagebox-DPFBuisE.js} +1 -1
  51. package/dist/{messagebox-BRqI3DW2.cjs → messagebox-JWKMJEFc.cjs} +2 -2
  52. package/dist/{modal-BGTTVHeW.cjs → modal-BymjMIJi.cjs} +2 -2
  53. package/dist/{modal-DCwqqNQc.js → modal-CELmA0-8.js} +1 -1
  54. package/dist/pkt-accordion.cjs +1 -1
  55. package/dist/pkt-accordion.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-button.cjs +1 -1
  61. package/dist/pkt-button.js +1 -1
  62. package/dist/pkt-card.cjs +1 -1
  63. package/dist/pkt-card.js +1 -1
  64. package/dist/pkt-checkbox.cjs +1 -1
  65. package/dist/pkt-checkbox.js +1 -1
  66. package/dist/pkt-combobox.cjs +1 -1
  67. package/dist/pkt-combobox.js +1 -1
  68. package/dist/pkt-consent.cjs +1 -1
  69. package/dist/pkt-consent.js +1 -1
  70. package/dist/pkt-datepicker.cjs +1 -1
  71. package/dist/pkt-datepicker.js +1 -1
  72. package/dist/pkt-fileupload.cjs +1 -1
  73. package/dist/pkt-fileupload.js +1 -1
  74. package/dist/pkt-footer.cjs +1 -1
  75. package/dist/pkt-footer.js +1 -1
  76. package/dist/pkt-header-menu.cjs +1 -1
  77. package/dist/pkt-header-menu.js +1 -1
  78. package/dist/pkt-header.cjs +1 -1
  79. package/dist/pkt-header.js +1 -1
  80. package/dist/pkt-heading.cjs +1 -1
  81. package/dist/pkt-heading.js +1 -1
  82. package/dist/pkt-helptext.cjs +1 -1
  83. package/dist/pkt-helptext.js +1 -1
  84. package/dist/pkt-index.cjs +1 -1
  85. package/dist/pkt-index.js +30 -30
  86. package/dist/pkt-input-wrapper.cjs +1 -1
  87. package/dist/pkt-input-wrapper.js +1 -1
  88. package/dist/pkt-link.cjs +1 -1
  89. package/dist/pkt-link.js +1 -1
  90. package/dist/pkt-linkcard.cjs +1 -1
  91. package/dist/pkt-linkcard.js +1 -1
  92. package/dist/pkt-listbox.cjs +1 -1
  93. package/dist/pkt-listbox.js +1 -1
  94. package/dist/pkt-loader.cjs +1 -1
  95. package/dist/pkt-loader.js +1 -1
  96. package/dist/pkt-messagebox.cjs +1 -1
  97. package/dist/pkt-messagebox.js +1 -1
  98. package/dist/pkt-modal.cjs +1 -1
  99. package/dist/pkt-modal.js +1 -1
  100. package/dist/{pkt-options-controller-Dz-rYCG1.cjs → pkt-options-controller-CpEZcomb.cjs} +1 -1
  101. package/dist/{pkt-options-controller-sUzxHa5A.js → pkt-options-controller-D7l18Iw0.js} +1 -1
  102. package/dist/pkt-progressbar.cjs +1 -1
  103. package/dist/pkt-progressbar.js +1 -1
  104. package/dist/pkt-radiobutton.cjs +1 -1
  105. package/dist/pkt-radiobutton.js +1 -1
  106. package/dist/pkt-searchinput.cjs +1 -1
  107. package/dist/pkt-searchinput.js +1 -1
  108. package/dist/pkt-select.cjs +1 -1
  109. package/dist/pkt-select.js +1 -1
  110. package/dist/pkt-tabs.cjs +1 -1
  111. package/dist/pkt-tabs.js +1 -1
  112. package/dist/pkt-tag.cjs +1 -1
  113. package/dist/pkt-tag.js +1 -1
  114. package/dist/pkt-textarea.cjs +1 -1
  115. package/dist/pkt-textarea.js +1 -1
  116. package/dist/pkt-textinput.cjs +1 -1
  117. package/dist/pkt-textinput.js +1 -1
  118. package/dist/pkt-timepicker.cjs +1 -1
  119. package/dist/pkt-timepicker.js +1 -1
  120. package/dist/{progressbar-CAEQkFpP.cjs → progressbar-CIXNSwTy.cjs} +2 -3
  121. package/dist/{progressbar-DzX0p2vn.js → progressbar-DH5lIBpx.js} +6 -4
  122. package/dist/{radiobutton-Cv1BlwLV.cjs → radiobutton-C3kEjvHQ.cjs} +2 -2
  123. package/dist/{radiobutton-B0V-jSEX.js → radiobutton-D9htviZG.js} +5 -5
  124. package/dist/{searchinput-D6vtMUHw.cjs → searchinput-CbClDE-d.cjs} +1 -1
  125. package/dist/{select-C0GafKtu.js → select-BizHes0n.js} +20 -20
  126. package/dist/{select-Bd6Gg4Ar.cjs → select-BuQxosyi.cjs} +15 -15
  127. package/dist/{tabs-B134M9k2.js → tabs-B8blHQrL.js} +18 -18
  128. package/dist/{tabs-Dw9E06fL.cjs → tabs-CjX-GWvM.cjs} +15 -15
  129. package/dist/tag-B5dUg7AD.cjs +27 -0
  130. package/dist/{tag-CvFakm1k.js → tag-Bns7Xj1O.js} +10 -10
  131. package/dist/{textarea-CeqScqQa.cjs → textarea-BXadsEdL.cjs} +12 -12
  132. package/dist/{textarea-BZ2ufamc.js → textarea-CL1yUDVL.js} +18 -18
  133. package/dist/{textinput-DI8Tgmep.js → textinput-Csil0Zda.js} +16 -16
  134. package/dist/{textinput-L218fT2-.cjs → textinput-qi0f5NZH.cjs} +12 -12
  135. package/dist/{timepicker-ZSHZt0aW.cjs → timepicker-CvL2-Siz.cjs} +17 -17
  136. package/dist/{timepicker-CgXpmG3h.js → timepicker-DNoYMBAL.js} +22 -22
  137. package/package.json +2 -2
  138. package/src/components/alert/alert.test.ts +15 -0
  139. package/src/components/alert/alert.ts +0 -12
  140. package/src/components/checkbox/checkbox.ts +6 -9
  141. package/src/components/combobox/combobox-handlers.ts +6 -6
  142. package/src/components/combobox/combobox-value.ts +1 -1
  143. package/src/components/combobox/combobox.ts +8 -8
  144. package/src/components/datepicker/datepicker.ts +9 -9
  145. package/src/components/helptext/helptext-association.test.ts +79 -0
  146. package/src/components/input-wrapper/input-wrapper.test.ts +85 -0
  147. package/src/components/input-wrapper/input-wrapper.ts +17 -8
  148. package/src/components/progressbar/progressbar.test.ts +19 -0
  149. package/src/components/progressbar/progressbar.ts +2 -6
  150. package/src/components/radiobutton/radiobutton.ts +3 -6
  151. package/src/components/select/select.ts +5 -5
  152. package/src/components/textarea/textarea.ts +5 -5
  153. package/src/components/textinput/textinput.ts +5 -5
  154. package/src/components/timepicker/timepicker.ts +10 -10
  155. package/dist/alert-DcyO0WfW.cjs +0 -40
  156. package/dist/button-PcKtiNGS.cjs +0 -32
  157. package/dist/checkbox-C0zLtnCI.cjs +0 -40
  158. package/dist/element-with-slot-2PHu2w7O.cjs +0 -1
  159. package/dist/input-element-W6Gklt2E.cjs +0 -1
  160. package/dist/tag--kFPXNaj.cjs +0 -27
  161. package/dist/{backlink-DdyQq62f.js → backlink-BslFewn-.js} +1 -1
  162. package/dist/{searchinput-DyjUl08X.js → searchinput-Co8tcq-l.js} +1 -1
@@ -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-mwwC2Rra.js";
2
2
  import { t as s } from "./class-map-C4hdfSfY.js";
3
- import { t as c } from "./if-defined-Bebu3LXY.js";
4
- import { n as l, t as u } from "./format-BTeSVkED.js";
5
- import "./alert-CUOWdvit.js";
3
+ import { n as c, t as l } from "./format-BTeSVkED.js";
4
+ import "./alert-C0PiYnot.js";
6
5
  import "./icon-JigbxxF7.js";
6
+ import { t as u } from "./if-defined-Bebu3LXY.js";
7
7
  import { t as d } from "./converters-CkjLSYpa.js";
8
8
  import { n as f } from "./utils-BwF4QSrq.js";
9
- import "./input-wrapper-CaMP5-Vm.js";
9
+ import "./input-wrapper-Bz9GwYrn.js";
10
10
  import { r as p } from "./focus-trap-DG3pEuyJ.js";
11
- import "./modal-DCwqqNQc.js";
12
- import "./progressbar-DzX0p2vn.js";
11
+ import "./modal-CELmA0-8.js";
12
+ import "./progressbar-DH5lIBpx.js";
13
13
  //#region ../../shared-utils/fileupload/size.ts
14
14
  function m(e) {
15
15
  if (e == null || e === "") return;
@@ -246,7 +246,7 @@ var j = class extends a {
246
246
  file: e,
247
247
  attributes: { targetFilename: e.name }
248
248
  })), r = this.pktStrings.get("fileupload");
249
- this.setAddedAnnouncement(n.length === 1 ? u(r.srFileAdded, { filename: n[0].attributes.targetFilename }) : u(r.srFilesAdded, { count: n.length }));
249
+ this.setAddedAnnouncement(n.length === 1 ? l(r.srFileAdded, { filename: n[0].attributes.targetFilename }) : l(r.srFilesAdded, { count: n.length }));
250
250
  let i = this.getCurrentFiles(), a = this.multiple ? [...i, ...n] : [n[0]];
251
251
  this.commitFiles(a, "add", n.map((e) => e.fileId)), this.uploadStrategy === "custom" && n.forEach((e) => {
252
252
  this.dispatchEvent(new CustomEvent("file-upload-requested", {
@@ -379,20 +379,20 @@ var j = class extends a {
379
379
  let { totalCount: e, uploadedCount: t } = k(this.getCurrentFiles(), this.transfers);
380
380
  if (e === 0 || t === 0) return "";
381
381
  let n = this.pktStrings.get("fileupload");
382
- return u(n.srFilesUploadedOfTotal, {
382
+ return l(n.srFilesUploadedOfTotal, {
383
383
  uploaded: t,
384
384
  total: e,
385
- label: l(e, n.fileLabelOne, n.fileLabelOther)
385
+ label: c(e, n.fileLabelOne, n.fileLabelOther)
386
386
  });
387
387
  }
388
388
  getSrErrorsMessage() {
389
389
  let { totalCount: e, failedCount: t } = k(this.getCurrentFiles(), this.transfers);
390
390
  if (e === 0 || t === 0) return "";
391
391
  let n = this.pktStrings.get("fileupload");
392
- return u(n.srFilesFailedOfTotal, {
392
+ return l(n.srFilesFailedOfTotal, {
393
393
  failed: t,
394
394
  total: e,
395
- label: l(e, n.fileLabelOne, n.fileLabelOther)
395
+ label: c(e, n.fileLabelOne, n.fileLabelOther)
396
396
  });
397
397
  }
398
398
  get ownerForm() {
@@ -491,7 +491,7 @@ var M = "comments", N = (e, t) => {
491
491
  let n = new Date(e);
492
492
  if (Number.isNaN(n.getTime())) return e;
493
493
  let r = String(n.getDate()).padStart(2, "0"), i = String(n.getMonth() + 1).padStart(2, "0"), a = n.getFullYear(), o = String(n.getHours()).padStart(2, "0"), s = String(n.getMinutes()).padStart(2, "0");
494
- return u(t.commentTimestamp, {
494
+ return l(t.commentTimestamp, {
495
495
  date: `${r}.${i}.${a}`,
496
496
  time: `${o}:${s}`
497
497
  });
@@ -730,7 +730,7 @@ var M = "comments", N = (e, t) => {
730
730
  >${o}</span
731
731
  >` : null}
732
732
  `;
733
- }, K = ({ file: t, disabled: n, inputName: r, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: l, setFileAttribute: u }) => {
733
+ }, K = ({ file: t, disabled: n, inputName: r, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => {
734
734
  let d = i.find((e) => e.id === a);
735
735
  if (d?.renderInlineUI || d?.renderExtendedUI) return null;
736
736
  let f = i.map((i) => {
@@ -742,15 +742,15 @@ var M = "comments", N = (e, t) => {
742
742
  isActive: i.id === a,
743
743
  onActivateOperation: o,
744
744
  onCloseOperation: s,
745
- getFileAttribute: l,
746
- setFileAttribute: u
745
+ getFileAttribute: c,
746
+ setFileAttribute: l
747
747
  }), f = typeof i.title == "function" ? i.title(t) : i.title;
748
748
  if (!f) return null;
749
749
  let p = typeof i.ariaLabel == "function" ? i.ariaLabel(t) : i.ariaLabel;
750
750
  return e`<button
751
751
  type="button"
752
752
  class="pkt-fileupload__queue-display__item__operation"
753
- aria-label=${c(p)}
753
+ aria-label=${u(p)}
754
754
  ?disabled=${n}
755
755
  @click=${() => {
756
756
  (i.renderInlineUI || i.renderExtendedUI) && d.activate(), i.onClick?.(d);
@@ -818,8 +818,8 @@ var M = "comments", N = (e, t) => {
818
818
  ></pkt-icon>
819
819
  ${B(i, n, r)}
820
820
  `;
821
- }, Z = ({ file: t, thumbnailUrl: n, previewEnabled: r, canOpenPreview: i, truncateTail: a, strings: o, onOpenPreview: l, onThumbnailImageError: d }) => {
822
- let f = A(t), p = !!n, m = !!r && !!i, h = m && !!l;
821
+ }, Z = ({ file: t, thumbnailUrl: n, previewEnabled: r, canOpenPreview: i, truncateTail: a, strings: o, onOpenPreview: c, onThumbnailImageError: d }) => {
822
+ let f = A(t), p = !!n, m = !!r && !!i, h = m && !!c;
823
823
  return e`
824
824
  <div
825
825
  class=${s({
@@ -830,10 +830,10 @@ var M = "comments", N = (e, t) => {
830
830
  <button
831
831
  type="button"
832
832
  class="pkt-fileupload__queue-display__item__thumbnail__image-wrapper pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--label-only"
833
- aria-label=${u(o.previewImage, { filename: f })}
833
+ aria-label=${l(o.previewImage, { filename: f })}
834
834
  ?disabled=${!h}
835
835
  @click=${() => {
836
- !h || !l || l(t.fileId);
836
+ !h || !c || c(t.fileId);
837
837
  }}
838
838
  >
839
839
  <span class="pkt-btn__text">
@@ -843,7 +843,7 @@ var M = "comments", N = (e, t) => {
843
843
  aria-hidden="true"
844
844
  ></pkt-icon>` : null}
845
845
  ${p ? e`<img
846
- src=${c(n)}
846
+ src=${u(n)}
847
847
  alt=${f}
848
848
  @error=${() => d?.(t.fileId)}
849
849
  />` : e`<pkt-icon
@@ -1160,23 +1160,23 @@ var M = "comments", N = (e, t) => {
1160
1160
  <input
1161
1161
  id=${`${this.id}-input`}
1162
1162
  type="file"
1163
- name=${c(this.uploadStrategy === "form" ? this.name : void 0)}
1164
- form=${c(this.form)}
1163
+ name=${u(this.uploadStrategy === "form" ? this.name : void 0)}
1164
+ form=${u(this.form)}
1165
1165
  ?multiple=${this.multiple}
1166
1166
  ?disabled=${this.disabled}
1167
1167
  ?required=${this.required && this.uploadStrategy === "form"}
1168
1168
  accept=${this.getResolvedAcceptValue()}
1169
- aria-label=${c(this.label ? void 0 : this.multiple ? this.pktStrings.get("fileupload").openFileDialogLabelMultiple : this.pktStrings.get("fileupload").openFileDialogLabelSingle)}
1170
- aria-required=${c(this.required ? "true" : void 0)}
1171
- aria-invalid=${c(this.hasEffectiveError ? "true" : void 0)}
1172
- aria-describedby=${c(a)}
1169
+ aria-label=${u(this.label ? void 0 : this.multiple ? this.pktStrings.get("fileupload").openFileDialogLabelMultiple : this.pktStrings.get("fileupload").openFileDialogLabelSingle)}
1170
+ aria-required=${u(this.required ? "true" : void 0)}
1171
+ aria-invalid=${u(this.hasEffectiveError ? "true" : void 0)}
1172
+ aria-describedby=${u(a)}
1173
1173
  @change=${this.onNativeFileChange}
1174
1174
  />
1175
1175
  ${this.uploadStrategy === "custom" ? t.map((t) => e`<input
1176
1176
  type="hidden"
1177
1177
  name=${this.name}
1178
1178
  value=${t.fileId}
1179
- form=${c(this.form)}
1179
+ form=${u(this.form)}
1180
1180
  />`) : null}
1181
1181
  <div class="pkt-fileupload__drop-zone__placeholder">
1182
1182
  <pkt-icon
@@ -1313,7 +1313,7 @@ var M = "comments", N = (e, t) => {
1313
1313
  ${i ? e`<button
1314
1314
  type="button"
1315
1315
  class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
1316
- aria-label=${u(n.previewPrevious, {
1316
+ aria-label=${l(n.previewPrevious, {
1317
1317
  index: this.previewCurrentIndex,
1318
1318
  total: t.length
1319
1319
  })}
@@ -1330,7 +1330,7 @@ var M = "comments", N = (e, t) => {
1330
1330
  <div class="pkt-fileupload__image-preview__content">
1331
1331
  ${o ? e`<img
1332
1332
  src=${a}
1333
- alt=${u(n.previewImageAlt, {
1333
+ alt=${l(n.previewImageAlt, {
1334
1334
  filename: s,
1335
1335
  index: this.previewCurrentIndex + 1,
1336
1336
  total: t.length
@@ -1350,7 +1350,7 @@ var M = "comments", N = (e, t) => {
1350
1350
  ${i ? e`<button
1351
1351
  type="button"
1352
1352
  class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
1353
- aria-label=${u(n.previewNext, {
1353
+ aria-label=${l(n.previewNext, {
1354
1354
  index: this.previewCurrentIndex + 2,
1355
1355
  total: t.length
1356
1356
  })}
@@ -1,4 +1,4 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./format-B8meU8Tm.cjs");require("./alert-DcyO0WfW.cjs"),require("./icon-Dnv6LtPC.cjs");const i=require("./converters-BJ9Fe0kW.cjs"),a=require("./utils-63cRpWut.cjs");require("./input-wrapper-B5rqKWSB.cjs");const o=require("./focus-trap-DSv4Ifqm.cjs");require("./modal-BGTTVHeW.cjs"),require("./progressbar-CAEQkFpP.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.hasInitializedValue||=(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),!0),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))}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 n=t.map(e=>({fileId:a.n(),file:e,attributes:{targetFilename:e.name}})),i=this.pktStrings.get(`fileupload`);this.setAddedAnnouncement(n.length===1?r.t(i.srFileAdded,{filename:n[0].attributes.targetFilename}):r.t(i.srFilesAdded,{count:n.length}));let o=this.getCurrentFiles(),s=this.multiple?[...o,...n]:[n[0]];this.commitFiles(s,`add`,n.map(e=>e.fileId)),this.uploadStrategy===`custom`&&n.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(){if(typeof URL>`u`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}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 n=this.pktStrings.get(`fileupload`);return r.t(n.srFilesUploadedOfTotal,{uploaded:t,total:e,label:r.n(e,n.fileLabelOne,n.fileLabelOther)})}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=C(this.getCurrentFiles(),this.transfers);if(e===0||t===0)return``;let n=this.pktStrings.get(`fileupload`);return r.t(n.srFilesFailedOfTotal,{failed:t,total:e,label:r.n(e,n.fileLabelOne,n.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 n=new Date(e);if(Number.isNaN(n.getTime()))return e;let i=String(n.getDate()).padStart(2,`0`),a=String(n.getMonth()+1).padStart(2,`0`),o=n.getFullYear(),s=String(n.getHours()).padStart(2,`0`),c=String(n.getMinutes()).padStart(2,`0`);return r.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-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./format-B8meU8Tm.cjs");require("./alert-IaZzEgyI.cjs"),require("./icon-Dnv6LtPC.cjs");const r=require("./if-defined-2mkIDgOm.cjs"),i=require("./converters-BJ9Fe0kW.cjs"),a=require("./utils-63cRpWut.cjs");require("./input-wrapper-BBG8EXQ8.cjs");const o=require("./focus-trap-DSv4Ifqm.cjs");require("./modal-BymjMIJi.cjs"),require("./progressbar-CIXNSwTy.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.hasInitializedValue||=(this.files=this.value??this.defaultValue??[],this.syncThumbnailUrls(this.files),!0),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))}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(){if(typeof URL>`u`||typeof URL.revokeObjectURL!=`function`){this.thumbnailUrls={},this.thumbnailFileById.clear();return}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}
@@ -166,11 +166,11 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
166
166
  ${o?e._`<span class="pkt-fileupload__queue-display__item__error-message"
167
167
  >${o}</span
168
168
  >`:null}
169
- `},B=({file:t,disabled:r,inputName:i,operations:a,activeOperationId:o,onActivateOperation:s,onCloseOperation:c,getFileAttribute:l,setFileAttribute:u})=>{let d=a.find(e=>e.id===o);if(d?.renderInlineUI||d?.renderExtendedUI)return null;let f=a.map(a=>{let d=L({operationId:a.id,file:t,inputName:i,disabled:r,isActive:a.id===o,onActivateOperation:s,onCloseOperation:c,getFileAttribute:l,setFileAttribute:u}),f=typeof a.title==`function`?a.title(t):a.title;if(!f)return null;let p=typeof a.ariaLabel==`function`?a.ariaLabel(t):a.ariaLabel;return e._`<button
169
+ `},B=({file:t,disabled:n,inputName:i,operations:a,activeOperationId:o,onActivateOperation:s,onCloseOperation:c,getFileAttribute:l,setFileAttribute:u})=>{let d=a.find(e=>e.id===o);if(d?.renderInlineUI||d?.renderExtendedUI)return null;let f=a.map(a=>{let d=L({operationId:a.id,file:t,inputName:i,disabled:n,isActive:a.id===o,onActivateOperation:s,onCloseOperation:c,getFileAttribute:l,setFileAttribute:u}),f=typeof a.title==`function`?a.title(t):a.title;if(!f)return null;let p=typeof a.ariaLabel==`function`?a.ariaLabel(t):a.ariaLabel;return e._`<button
170
170
  type="button"
171
171
  class="pkt-fileupload__queue-display__item__operation"
172
- aria-label=${n.t(p)}
173
- ?disabled=${r}
172
+ aria-label=${r.t(p)}
173
+ ?disabled=${n}
174
174
  @click=${()=>{(a.renderInlineUI||a.renderExtendedUI)&&d.activate(),a.onClick?.(d)}}
175
175
  >
176
176
  ${f}
@@ -192,7 +192,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
192
192
  <button
193
193
  type="button"
194
194
  class="pkt-fileupload__queue-display__item__thumbnail__image-wrapper pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--label-only"
195
- aria-label=${r.t(l.previewImage,{filename:f})}
195
+ aria-label=${n.t(l.previewImage,{filename:f})}
196
196
  ?disabled=${!h}
197
197
  @click=${()=>{!h||!u||u(i.fileId)}}
198
198
  >
@@ -203,7 +203,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
203
203
  aria-hidden="true"
204
204
  ></pkt-icon>`:null}
205
205
  ${p?e._`<img
206
- src=${n.t(a)}
206
+ src=${r.t(a)}
207
207
  alt=${f}
208
208
  @error=${()=>d?.(i.fileId)}
209
209
  />`:e._`<pkt-icon
@@ -274,7 +274,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
274
274
  >
275
275
  ${n}
276
276
  </pkt-input-wrapper>
277
- `}renderContent(){let r=this.getSortedFilesAndTransfers(),i=this.getPreviewableImages(r),a=this.pktStrings.get(`fileupload`),o=this.getSupportedFormatsText(),s=[this.helptext?`${this.id}-input-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,c=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:a.dropZoneDragMultipleThumbnail,dragActive:a.dropZoneDragActiveMultipleThumbnail,openFileDialog:a.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:a.dropZoneDragSingleThumbnail,dragActive:a.dropZoneDragActiveSingleThumbnail,openFileDialog:a.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:a.dropZoneDragMultiple,dragActive:a.dropZoneDragActiveMultiple,openFileDialog:a.dropZoneOpenFileDialogMultiple}:{dragInactive:a.dropZoneDragSingle,dragActive:a.dropZoneDragActiveSingle,openFileDialog:a.dropZoneOpenFileDialogSingle};return e._`
277
+ `}renderContent(){let n=this.getSortedFilesAndTransfers(),i=this.getPreviewableImages(n),a=this.pktStrings.get(`fileupload`),o=this.getSupportedFormatsText(),s=[this.helptext?`${this.id}-input-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,c=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:a.dropZoneDragMultipleThumbnail,dragActive:a.dropZoneDragActiveMultipleThumbnail,openFileDialog:a.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:a.dropZoneDragSingleThumbnail,dragActive:a.dropZoneDragActiveSingleThumbnail,openFileDialog:a.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:a.dropZoneDragMultiple,dragActive:a.dropZoneDragActiveMultiple,openFileDialog:a.dropZoneOpenFileDialogMultiple}:{dragInactive:a.dropZoneDragSingle,dragActive:a.dropZoneDragActiveSingle,openFileDialog:a.dropZoneOpenFileDialogSingle};return e._`
278
278
  <div
279
279
  class=${t.t({"pkt-fileupload":!0,"pkt-fileupload--full-width":this.fullwidth,"pkt-fileupload--error":this.hasEffectiveError,"pkt-fileupload--disabled":this.disabled})}
280
280
  aria-disabled=${String(this.disabled)}
@@ -296,23 +296,23 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
296
296
  <input
297
297
  id=${`${this.id}-input`}
298
298
  type="file"
299
- name=${n.t(this.uploadStrategy===`form`?this.name:void 0)}
300
- form=${n.t(this.form)}
299
+ name=${r.t(this.uploadStrategy===`form`?this.name:void 0)}
300
+ form=${r.t(this.form)}
301
301
  ?multiple=${this.multiple}
302
302
  ?disabled=${this.disabled}
303
303
  ?required=${this.required&&this.uploadStrategy===`form`}
304
304
  accept=${this.getResolvedAcceptValue()}
305
- aria-label=${n.t(this.label?void 0:this.multiple?this.pktStrings.get(`fileupload`).openFileDialogLabelMultiple:this.pktStrings.get(`fileupload`).openFileDialogLabelSingle)}
306
- aria-required=${n.t(this.required?`true`:void 0)}
307
- aria-invalid=${n.t(this.hasEffectiveError?`true`:void 0)}
308
- aria-describedby=${n.t(s)}
305
+ aria-label=${r.t(this.label?void 0:this.multiple?this.pktStrings.get(`fileupload`).openFileDialogLabelMultiple:this.pktStrings.get(`fileupload`).openFileDialogLabelSingle)}
306
+ aria-required=${r.t(this.required?`true`:void 0)}
307
+ aria-invalid=${r.t(this.hasEffectiveError?`true`:void 0)}
308
+ aria-describedby=${r.t(s)}
309
309
  @change=${this.onNativeFileChange}
310
310
  />
311
- ${this.uploadStrategy===`custom`?r.map(t=>e._`<input
311
+ ${this.uploadStrategy===`custom`?n.map(t=>e._`<input
312
312
  type="hidden"
313
313
  name=${this.name}
314
314
  value=${t.fileId}
315
- form=${n.t(this.form)}
315
+ form=${r.t(this.form)}
316
316
  />`):null}
317
317
  <div class="pkt-fileupload__drop-zone__placeholder">
318
318
  <pkt-icon
@@ -347,12 +347,12 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
347
347
  ${this.effectiveErrorMessage}
348
348
  </pkt-alert>
349
349
  `:null}
350
- ${r.length>0?e._`<ul class="pkt-fileupload__queue-display">
351
- ${r.map(e=>this.renderQueueItem(e,i))}
350
+ ${n.length>0?e._`<ul class="pkt-fileupload__queue-display">
351
+ ${n.map(e=>this.renderQueueItem(e,i))}
352
352
  </ul>`:null}
353
353
  ${this.renderPreviewModal(i)}
354
354
  </div>
355
- `}renderQueueItem(e,t){let n=typeof e.file?.size==`number`?this.formatFileSize(e.file.size):``,r=this.getQueueItemOperations(),i=this.pktStrings.get(`fileupload`);if(this.itemRenderer===`thumbnail`){let a=this.canOpenPreview(e),o=this.failedImageFileIds[e.fileId]?.thumbnail?void 0:this.getThumbnailUrl(e);return q({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),thumbnailUrl:o,previewEnabled:this.enableImagePreview,canOpenPreview:a,transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,strings:i,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e),onOpenPreview:e=>this.openPreview(e,t),onThumbnailImageError:e=>this.markImageFailed(e,`thumbnail`)})}return K({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,strings:i,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e)})}markImageFailed(e,t){this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],[t]:!0}}}getPreviewableImages(e){return this.enableImagePreview?e.filter(e=>e.progress===`done`&&this.isImageFile(e)):[]}canOpenPreview(e){return this.enableImagePreview&&e.progress===`done`&&this.isImageFile(e)}openPreview(e,t){let n=t.findIndex(t=>t.fileId===e);n<0||(this.previewCurrentIndex=n,this.isPreviewModalOpen=!0,this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],preview:!1}})}navigatePreview(e,t){t.length!==0&&(this.previewCurrentIndex=S(this.previewCurrentIndex,e,t.length))}renderPreviewModal(t){if(!this.enableImagePreview||t.length===0)return null;let n=this.pktStrings.get(`fileupload`),i=t[this.previewCurrentIndex];if(!i)return null;let a=t.length>1,o=this.getThumbnailUrl(i),s=!!o&&!this.failedImageFileIds[i.fileId]?.preview,c=i.attributes?.targetFilename||i.file?.name||n.previewFallbackName;return e._`
355
+ `}renderQueueItem(e,t){let n=typeof e.file?.size==`number`?this.formatFileSize(e.file.size):``,r=this.getQueueItemOperations(),i=this.pktStrings.get(`fileupload`);if(this.itemRenderer===`thumbnail`){let a=this.canOpenPreview(e),o=this.failedImageFileIds[e.fileId]?.thumbnail?void 0:this.getThumbnailUrl(e);return q({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),thumbnailUrl:o,previewEnabled:this.enableImagePreview,canOpenPreview:a,transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,strings:i,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e),onOpenPreview:e=>this.openPreview(e,t),onThumbnailImageError:e=>this.markImageFailed(e,`thumbnail`)})}return K({file:e,inputName:this.name,disabled:this.disabled,fileSize:n,operations:r,activeOperationId:this.activeOperationByFileId[e.fileId],onActivateOperation:(e,t)=>this.activateOperation(e,t),onCloseOperation:e=>this.closeOperation(e),getFileAttribute:(e,t)=>this.getFileAttribute(e,t),setFileAttribute:(e,t,n)=>this.setFileAttribute(e,t,n),transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,strings:i,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e)})}markImageFailed(e,t){this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],[t]:!0}}}getPreviewableImages(e){return this.enableImagePreview?e.filter(e=>e.progress===`done`&&this.isImageFile(e)):[]}canOpenPreview(e){return this.enableImagePreview&&e.progress===`done`&&this.isImageFile(e)}openPreview(e,t){let n=t.findIndex(t=>t.fileId===e);n<0||(this.previewCurrentIndex=n,this.isPreviewModalOpen=!0,this.failedImageFileIds={...this.failedImageFileIds,[e]:{...this.failedImageFileIds[e],preview:!1}})}navigatePreview(e,t){t.length!==0&&(this.previewCurrentIndex=S(this.previewCurrentIndex,e,t.length))}renderPreviewModal(t){if(!this.enableImagePreview||t.length===0)return null;let r=this.pktStrings.get(`fileupload`),i=t[this.previewCurrentIndex];if(!i)return null;let a=t.length>1,o=this.getThumbnailUrl(i),s=!!o&&!this.failedImageFileIds[i.fileId]?.preview,c=i.attributes?.targetFilename||i.file?.name||r.previewFallbackName;return e._`
356
356
  <pkt-modal
357
357
  .open=${this.isPreviewModalOpen}
358
358
  .headingText=${c}
@@ -365,7 +365,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
365
365
  ${a?e._`<button
366
366
  type="button"
367
367
  class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
368
- aria-label=${r.t(n.previewPrevious,{index:this.previewCurrentIndex,total:t.length})}
368
+ aria-label=${n.t(r.previewPrevious,{index:this.previewCurrentIndex,total:t.length})}
369
369
  @click=${()=>this.navigatePreview(`prev`,t)}
370
370
  >
371
371
  <pkt-icon
@@ -379,7 +379,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
379
379
  <div class="pkt-fileupload__image-preview__content">
380
380
  ${s?e._`<img
381
381
  src=${o}
382
- alt=${r.t(n.previewImageAlt,{filename:c,index:this.previewCurrentIndex+1,total:t.length})}
382
+ alt=${n.t(r.previewImageAlt,{filename:c,index:this.previewCurrentIndex+1,total:t.length})}
383
383
  class="pkt-fileupload__image-preview__image"
384
384
  @error=${()=>this.markImageFailed(i.fileId,`preview`)}
385
385
  />`:e._`<pkt-icon
@@ -395,7 +395,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),
395
395
  ${a?e._`<button
396
396
  type="button"
397
397
  class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
398
- aria-label=${r.t(n.previewNext,{index:this.previewCurrentIndex+2,total:t.length})}
398
+ aria-label=${n.t(r.previewNext,{index:this.previewCurrentIndex+2,total:t.length})}
399
399
  @click=${()=>this.navigatePreview(`next`,t)}
400
400
  >
401
401
  <pkt-icon
@@ -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-mwwC2Rra.js";
2
- import { t as s } from "./if-defined-Bebu3LXY.js";
3
- import "./consent-_DBvIRT2.js";
4
- import { t as c } from "./booleanish-OQJTYSrw.js";
5
- import { n as l, r as u, t as d } from "./fetch-header-footer-data-Pc32etrk.js";
2
+ import "./consent-CleJMbVH.js";
3
+ import { t as s } from "./booleanish-OQJTYSrw.js";
4
+ import { n as c, r as l, t as u } from "./fetch-header-footer-data-Pc32etrk.js";
6
5
  import "./icon-JigbxxF7.js";
6
+ import { t as d } from "./if-defined-Bebu3LXY.js";
7
7
  //#region ../../shared-utils/header-footer/external-domain.ts
8
8
  var f = "oslo.kommune.no", p = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
9
9
  function m(e) {
@@ -50,7 +50,7 @@ var _ = "#cb-trigger", v = class extends a {
50
50
  async loadData() {
51
51
  this.abortController?.abort(), this.abortController = new AbortController();
52
52
  try {
53
- this.fetchedData = await d(this.dataUrl, this.abortController.signal);
53
+ this.fetchedData = await u(this.dataUrl, this.abortController.signal);
54
54
  } catch (e) {
55
55
  if (e.name === "AbortError") return;
56
56
  console.warn("Failed to fetch header/footer data:", e), this.dispatchEvent(new CustomEvent("data-error", {
@@ -61,7 +61,7 @@ var _ = "#cb-trigger", v = class extends a {
61
61
  }
62
62
  }
63
63
  get globalFooterData() {
64
- return l(this.data ?? this.fetchedData, this.locale)?.footer;
64
+ return c(this.data ?? this.fetchedData, this.locale)?.footer;
65
65
  }
66
66
  linkTarget(e) {
67
67
  return e.openInNewTab || this.openLinksInNewTab ? {
@@ -77,7 +77,7 @@ var _ = "#cb-trigger", v = class extends a {
77
77
  renderCustomLink(t) {
78
78
  let { target: n, rel: r } = this.linkTarget(t);
79
79
  return e`
80
- <a href=${t.href} target=${n} rel=${s(r)}
80
+ <a href=${t.href} target=${n} rel=${d(r)}
81
81
  >${t.text}${this.renderLinkDomain(t)}</a
82
82
  >
83
83
  `;
@@ -130,7 +130,7 @@ var _ = "#cb-trigger", v = class extends a {
130
130
  `;
131
131
  }
132
132
  renderSomeLink(t) {
133
- let n = u(t.url, t.text);
133
+ let n = l(t.url, t.text);
134
134
  return n ? e`
135
135
  <li>
136
136
  <a class="pkt-footer__some-link" href=${t.url} aria-label=${t.text}>
@@ -180,15 +180,15 @@ i([o({
180
180
  })], v.prototype, "data", void 0), i([o({ type: String })], v.prototype, "locale", void 0), i([o({
181
181
  type: Boolean,
182
182
  attribute: "skip-global",
183
- converter: c
183
+ converter: s
184
184
  })], v.prototype, "skipGlobal", void 0), i([o({
185
185
  type: Boolean,
186
186
  attribute: "open-links-in-new-tab",
187
- converter: c
187
+ converter: s
188
188
  })], v.prototype, "openLinksInNewTab", void 0), i([o({
189
189
  type: Boolean,
190
190
  attribute: "include-consent",
191
- converter: c
191
+ converter: s
192
192
  })], v.prototype, "includeConsent", void 0), i([o({
193
193
  type: String,
194
194
  attribute: "hotjar-id"
@@ -198,7 +198,7 @@ i([o({
198
198
  })], v.prototype, "googleAnalyticsId", void 0), i([o({
199
199
  type: Boolean,
200
200
  attribute: "dev-mode",
201
- converter: c
201
+ converter: s
202
202
  })], v.prototype, "devMode", void 0), i([o({
203
203
  type: String,
204
204
  attribute: "cookie-domain"
@@ -268,7 +268,7 @@ var b = class extends v {
268
268
  renderLink(t) {
269
269
  let { target: n, rel: r } = this.linkTarget(t);
270
270
  return e`
271
- <a class="pkt-footer-simple__link" href=${t.href} target=${n} rel=${s(r)}>
271
+ <a class="pkt-footer-simple__link" href=${t.href} target=${n} rel=${d(r)}>
272
272
  <pkt-icon class="pkt-footer-simple__link-icon" name="arrow-link"></pkt-icon>
273
273
  <span>${t.text}${this.renderLinkDomain(t, "pkt-footer-simple__link-domain")}</span>
274
274
  </a>
@@ -1,6 +1,6 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./if-defined-2mkIDgOm.cjs");require("./consent-BfLkJbOk.cjs");const n=require("./booleanish-BF8l4scU.cjs"),r=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-Dnv6LtPC.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 r.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 r.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(n){let{target:r,rel:i}=this.linkTarget(n);return e._`
2
- <a href=${n.href} target=${r} rel=${t.t(i)}
3
- >${n.text}${this.renderLinkDomain(n)}</a
1
+ const e=require("./element-BOmr9YLv.cjs");require("./consent-Dl-R0iC3.cjs");const t=require("./booleanish-BF8l4scU.cjs"),n=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-Dnv6LtPC.cjs");const r=require("./if-defined-2mkIDgOm.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
+ <a href=${t.href} target=${n} rel=${r.t(i)}
3
+ >${t.text}${this.renderLinkDomain(t)}</a
4
4
  >
5
5
  `}renderConsent(){return this.includeConsent?e._`
6
6
  <pkt-consent
@@ -38,10 +38,10 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./if-defined-2mkIDgOm.cjs")
38
38
  ${t.links.map(e=>this.renderGlobalSectionLink(e))}
39
39
  </ul>
40
40
  </section>
41
- `}renderSomeLink(t){let n=r.r(t.url,t.text);return n?e._`
41
+ `}renderSomeLink(t){let r=n.r(t.url,t.text);return r?e._`
42
42
  <li>
43
43
  <a class="pkt-footer__some-link" href=${t.url} aria-label=${t.text}>
44
- <pkt-icon class="pkt-footer__some-icon" name=${n}></pkt-icon>
44
+ <pkt-icon class="pkt-footer__some-icon" name=${r}></pkt-icon>
45
45
  </a>
46
46
  </li>
47
47
  `:e._`<li><a href=${t.url}>${t.text}</a></li>`}renderGlobalBottom(t){let n=t.links?.length>0,r=t.some?.length>0;return!n&&!r?e.h:e._`
@@ -66,7 +66,7 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./if-defined-2mkIDgOm.cjs")
66
66
  </div>
67
67
  </div>
68
68
  </div>
69
- `:e.h}};e.n([e.u({type:String,attribute:`data-url`})],u.prototype,`dataUrl`,void 0),e.n([e.u({type:Object,attribute:!1})],u.prototype,`data`,void 0),e.n([e.u({type:String})],u.prototype,`locale`,void 0),e.n([e.u({type:Boolean,attribute:`skip-global`,converter:n.t})],u.prototype,`skipGlobal`,void 0),e.n([e.u({type:Boolean,attribute:`open-links-in-new-tab`,converter:n.t})],u.prototype,`openLinksInNewTab`,void 0),e.n([e.u({type:Boolean,attribute:`include-consent`,converter:n.t})],u.prototype,`includeConsent`,void 0),e.n([e.u({type:String,attribute:`hotjar-id`})],u.prototype,`hotjarId`,void 0),e.n([e.u({type:String,attribute:`google-analytics-id`})],u.prototype,`googleAnalyticsId`,void 0),e.n([e.u({type:Boolean,attribute:`dev-mode`,converter:n.t})],u.prototype,`devMode`,void 0),e.n([e.u({type:String,attribute:`cookie-domain`})],u.prototype,`cookieDomain`,void 0),e.n([e.u({type:String,attribute:`cookie-secure`})],u.prototype,`cookieSecure`,void 0),e.n([e.u({type:String,attribute:`cookie-expiry-days`})],u.prototype,`cookieExpiryDays`,void 0),e.n([e.l()],u.prototype,`fetchedData`,void 0);var d=class extends u{connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-footer-host`)}renderColumn(t){return e._`
69
+ `:e.h}};e.n([e.u({type:String,attribute:`data-url`})],u.prototype,`dataUrl`,void 0),e.n([e.u({type:Object,attribute:!1})],u.prototype,`data`,void 0),e.n([e.u({type:String})],u.prototype,`locale`,void 0),e.n([e.u({type:Boolean,attribute:`skip-global`,converter:t.t})],u.prototype,`skipGlobal`,void 0),e.n([e.u({type:Boolean,attribute:`open-links-in-new-tab`,converter:t.t})],u.prototype,`openLinksInNewTab`,void 0),e.n([e.u({type:Boolean,attribute:`include-consent`,converter:t.t})],u.prototype,`includeConsent`,void 0),e.n([e.u({type:String,attribute:`hotjar-id`})],u.prototype,`hotjarId`,void 0),e.n([e.u({type:String,attribute:`google-analytics-id`})],u.prototype,`googleAnalyticsId`,void 0),e.n([e.u({type:Boolean,attribute:`dev-mode`,converter:t.t})],u.prototype,`devMode`,void 0),e.n([e.u({type:String,attribute:`cookie-domain`})],u.prototype,`cookieDomain`,void 0),e.n([e.u({type:String,attribute:`cookie-secure`})],u.prototype,`cookieSecure`,void 0),e.n([e.u({type:String,attribute:`cookie-expiry-days`})],u.prototype,`cookieExpiryDays`,void 0),e.n([e.l()],u.prototype,`fetchedData`,void 0);var d=class extends u{connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-footer-host`)}renderColumn(t){return e._`
70
70
  <section>
71
71
  <h2>${t.title}</h2>
72
72
  ${t.text?e._`<p>${t.text}</p>`:e.h}
@@ -92,10 +92,10 @@ const e=require("./element-BOmr9YLv.cjs"),t=require("./if-defined-2mkIDgOm.cjs")
92
92
  ${t||n?this.renderSecondary():e.h}
93
93
  ${this.renderGlobalFooter()}
94
94
  </footer>
95
- `}};e.n([e.u({type:Array})],d.prototype,`columns`,void 0);try{e.d(`pkt-footer`)(d)}catch{console.warn(`Forsøker å definere <pkt-footer>, men den er allerede definert`)}var f=class extends u{connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-footer-simple-host`)}renderLink(n){let{target:r,rel:i}=this.linkTarget(n);return e._`
96
- <a class="pkt-footer-simple__link" href=${n.href} target=${r} rel=${t.t(i)}>
95
+ `}};e.n([e.u({type:Array})],d.prototype,`columns`,void 0);try{e.d(`pkt-footer`)(d)}catch{console.warn(`Forsøker å definere <pkt-footer>, men den er allerede definert`)}var f=class extends u{connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-footer-simple-host`)}renderLink(t){let{target:n,rel:i}=this.linkTarget(t);return e._`
96
+ <a class="pkt-footer-simple__link" href=${t.href} target=${n} rel=${r.t(i)}>
97
97
  <pkt-icon class="pkt-footer-simple__link-icon" name="arrow-link"></pkt-icon>
98
- <span>${n.text}${this.renderLinkDomain(n,`pkt-footer-simple__link-domain`)}</span>
98
+ <span>${t.text}${this.renderLinkDomain(t,`pkt-footer-simple__link-domain`)}</span>
99
99
  </a>
100
100
  `}render(){let t=!!this.links?.length,n=this.skipGlobal&&this.includeConsent;return e._`
101
101
  <footer class="pkt-footer-simple">