@oslokommune/punkt-elements 17.1.3 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{accordion-BeLvLPrB.js → accordion-1_pdxTgJ.js} +27 -27
  3. package/dist/{accordion-B3GBlvUC.cjs → accordion-DobbH-Sv.cjs} +5 -5
  4. package/dist/{alert-Cs4Rmq_J.cjs → alert-COeHz6o2.cjs} +6 -6
  5. package/dist/{alert-DKK_Tb9J.js → alert-xspFetQ8.js} +26 -26
  6. package/dist/{async-directive-Da7TJpnq.cjs → async-directive-B5pcIMfO.cjs} +1 -1
  7. package/dist/{async-directive-BPf6K-V2.js → async-directive-D2Sht790.js} +5 -5
  8. package/dist/{backlink-D1y26pj3.js → backlink-C0jZFnZ2.js} +8 -8
  9. package/dist/{backlink-CMmrKTe4.cjs → backlink-ZMhqHaVs.cjs} +3 -3
  10. package/dist/base-elements/element.d.ts +13 -1
  11. package/dist/base-elements/input-element.d.ts +4 -2
  12. package/dist/{breadcrumbs-B6JGhJgC.cjs → breadcrumbs-BS64xd1s.cjs} +7 -7
  13. package/dist/{breadcrumbs-CcTQ3Grm.js → breadcrumbs-BvMownZN.js} +16 -16
  14. package/dist/{button-2-OSPJkj.js → button-C44vNLFC.js} +28 -28
  15. package/dist/{button-CE97NQIk.cjs → button-CR4CXtnj.cjs} +7 -7
  16. package/dist/{calendar-kn4SrtJy.cjs → calendar-DQ4byeom.cjs} +28 -27
  17. package/dist/{calendar-pOW3R5Pw.js → calendar-DgjCKMMV.js} +82 -68
  18. package/dist/{card-zQ0eKRMV.js → card-DhHqC265.js} +44 -44
  19. package/dist/{card-CETDFkxR.cjs → card-Dpqi6HVt.cjs} +26 -26
  20. package/dist/{checkbox-CH7NpINF.js → checkbox-BQ1K57AB.js} +23 -23
  21. package/dist/{checkbox-CQNr_sEg.cjs → checkbox-CXQxbiaX.cjs} +11 -11
  22. package/dist/{class-map-BeimMvPv.cjs → class-map-CzCE5pqG.cjs} +1 -1
  23. package/dist/{class-map-CnWCnBSX.js → class-map-F1DJHyb7.js} +3 -3
  24. package/dist/{combobox-Bvg0UO9w.cjs → combobox-BV4oDiII.cjs} +19 -18
  25. package/dist/{combobox-CRdYYlxu.js → combobox-DPck39I2.js} +55 -54
  26. package/dist/components/calendar/calendar.d.ts +21 -6
  27. package/dist/components/checkbox/checkbox.d.ts +4 -2
  28. package/dist/components/combobox/combobox-base.d.ts +2 -1
  29. package/dist/components/consent/strings.d.ts +1 -85
  30. package/dist/components/datepicker/datepicker-base.d.ts +0 -3
  31. package/dist/components/datepicker/datepicker-multiple.d.ts +0 -2
  32. package/dist/components/datepicker/datepicker-range.d.ts +0 -2
  33. package/dist/components/datepicker/datepicker-single.d.ts +0 -2
  34. package/dist/components/datepicker/datepicker-utils.d.ts +2 -1
  35. package/dist/components/fileupload/fileupload-base.d.ts +3 -2
  36. package/dist/components/header/header-service.d.ts +3 -1
  37. package/dist/components/header/header.d.ts +2 -1
  38. package/dist/components/helptext/helptext.d.ts +2 -1
  39. package/dist/components/index.d.ts +2 -0
  40. package/dist/components/input-wrapper/input-wrapper.d.ts +4 -2
  41. package/dist/components/radiobutton/radiobutton.d.ts +4 -2
  42. package/dist/components/searchinput/searchinput.d.ts +2 -1
  43. package/dist/{consent-DZEkhgJ1.js → consent-BneInZov.js} +10 -10
  44. package/dist/{consent-CyY3RyoC.cjs → consent-_N9foluG.cjs} +5 -5
  45. package/dist/controllers/strings-controller.d.ts +27 -0
  46. package/dist/{datepicker-VTqSDQk5.cjs → datepicker-9NX5qt2z.cjs} +38 -37
  47. package/dist/{datepicker-ButIas85.js → datepicker-nSSSr1U7.js} +104 -104
  48. package/dist/{directive-helpers-CI8YZqku.js → directive-helpers-BARw3nEZ.js} +1 -1
  49. package/dist/{directive-helpers-BlAV5EQD.cjs → directive-helpers-D6AAMFKs.cjs} +1 -1
  50. package/dist/docs/components/fileupload.d.ts +1 -0
  51. package/dist/element-B8OGznK0.cjs +2 -0
  52. package/dist/{element-ChsFgr_B.js → element-BKSPVgs2.js} +240 -100
  53. package/dist/{element-with-slot-Bj7nm7fO.cjs → element-with-slot-DTxILHVv.cjs} +1 -1
  54. package/dist/{element-with-slot-BvG9ctC-.js → element-with-slot-YUAUFRqw.js} +4 -4
  55. package/dist/fileupload-D05VSbEP.cjs +402 -0
  56. package/dist/{fileupload-D5IQ9HDe.js → fileupload-E0LGGNgj.js} +370 -380
  57. package/dist/{footer-DbYQUYNR.cjs → footer-DBApIdGh.cjs} +32 -32
  58. package/dist/{footer-DrR64HiK.js → footer-DYilVBMC.js} +91 -91
  59. package/dist/format-B8meU8Tm.cjs +1 -0
  60. package/dist/format-BTeSVkED.js +18 -0
  61. package/dist/{header-ClgIac6n.cjs → header-B7tbX-Ok.cjs} +84 -84
  62. package/dist/{header-menu-BAsUNKSx.cjs → header-menu-1FFWhvNc.cjs} +24 -24
  63. package/dist/{header-menu-hVPXsb8g.js → header-menu-D522-VTV.js} +75 -75
  64. package/dist/{header-KvJ1mGwA.js → header-v3GWAzOK.js} +267 -264
  65. package/dist/{heading-CFmiSuCQ.cjs → heading-CvytvcL7.cjs} +1 -1
  66. package/dist/{heading-g-_IUB5T.js → heading-rx_oSCqe.js} +16 -16
  67. package/dist/helptext-DYFdcylX.cjs +27 -0
  68. package/dist/{helptext-DZng1D5i.js → helptext-LShGPm-b.js} +18 -19
  69. package/dist/{icon-9iwd2F2l.cjs → icon-BmMC09mi.cjs} +1 -1
  70. package/dist/{icon-D-LA22xD.js → icon-HYU1f54x.js} +17 -17
  71. package/dist/{if-defined-CGzIlZ9-.js → if-defined-BF8XcDi5.js} +1 -1
  72. package/dist/if-defined-CVYApOgK.cjs +1 -0
  73. package/dist/{input-element-DBMNBplu.js → input-element-D07DmR34.js} +121 -120
  74. package/dist/input-element-DumGj_oJ.cjs +1 -0
  75. package/dist/input-wrapper-Cci_wTvD.js +308 -0
  76. package/dist/input-wrapper-DDfapoRX.cjs +58 -0
  77. package/dist/{link-DK7gvmnj.cjs → link-11g2ZNin.cjs} +4 -4
  78. package/dist/{link-D-Eqm5KH.js → link-CQK0SH4H.js} +13 -13
  79. package/dist/{linkcard-zqbg7Oqm.js → linkcard-B4GlmjJ6.js} +16 -16
  80. package/dist/linkcard-DNYsVlV6.cjs +13 -0
  81. package/dist/{listbox-Dc4rGdPi.cjs → listbox-BlFRhyI7.cjs} +15 -15
  82. package/dist/{listbox-va_E8afs.js → listbox-wd_OofyF.js} +100 -99
  83. package/dist/{loader-D_RDICnw.js → loader-0C3qVk16.js} +14 -14
  84. package/dist/{loader-CMUkVJmE.cjs → loader-B9u2qUlR.cjs} +5 -5
  85. package/dist/{messagebox-Cv8LaSxv.cjs → messagebox-BD5tGmT-.cjs} +5 -5
  86. package/dist/{messagebox-Cw-OWDya.js → messagebox-C-y1ICmr.js} +15 -15
  87. package/dist/{modal-BtInv031.cjs → modal-BzPGQYCs.cjs} +8 -8
  88. package/dist/{modal-D0t_X2dX.js → modal-Cghs3w-d.js} +20 -20
  89. package/dist/pkt-accordion.cjs +1 -1
  90. package/dist/pkt-accordion.js +1 -1
  91. package/dist/pkt-alert.cjs +1 -1
  92. package/dist/pkt-alert.js +1 -1
  93. package/dist/pkt-backlink.cjs +1 -1
  94. package/dist/pkt-backlink.js +1 -1
  95. package/dist/pkt-breadcrumbs.cjs +1 -1
  96. package/dist/pkt-breadcrumbs.js +1 -1
  97. package/dist/pkt-button.cjs +1 -1
  98. package/dist/pkt-button.js +1 -1
  99. package/dist/pkt-calendar.cjs +1 -1
  100. package/dist/pkt-calendar.js +1 -1
  101. package/dist/pkt-card.cjs +1 -1
  102. package/dist/pkt-card.js +1 -1
  103. package/dist/pkt-checkbox.cjs +1 -1
  104. package/dist/pkt-checkbox.js +1 -1
  105. package/dist/pkt-combobox.cjs +1 -1
  106. package/dist/pkt-combobox.js +1 -1
  107. package/dist/pkt-consent.cjs +1 -1
  108. package/dist/pkt-consent.js +1 -1
  109. package/dist/pkt-datepicker.cjs +1 -1
  110. package/dist/pkt-datepicker.js +1 -1
  111. package/dist/pkt-fileupload.cjs +1 -1
  112. package/dist/pkt-fileupload.js +1 -1
  113. package/dist/pkt-footer.cjs +1 -1
  114. package/dist/pkt-footer.js +1 -1
  115. package/dist/pkt-header-menu.cjs +1 -1
  116. package/dist/pkt-header-menu.js +1 -1
  117. package/dist/pkt-header.cjs +1 -1
  118. package/dist/pkt-header.js +1 -1
  119. package/dist/pkt-heading.cjs +1 -1
  120. package/dist/pkt-heading.js +1 -1
  121. package/dist/pkt-helptext.cjs +1 -1
  122. package/dist/pkt-helptext.js +1 -1
  123. package/dist/pkt-icon.cjs +1 -1
  124. package/dist/pkt-icon.js +1 -1
  125. package/dist/pkt-index.cjs +1 -1
  126. package/dist/pkt-index.js +35 -34
  127. package/dist/pkt-input-wrapper.cjs +1 -1
  128. package/dist/pkt-input-wrapper.js +1 -1
  129. package/dist/pkt-link.cjs +1 -1
  130. package/dist/pkt-link.js +1 -1
  131. package/dist/pkt-linkcard.cjs +1 -1
  132. package/dist/pkt-linkcard.js +1 -1
  133. package/dist/pkt-listbox.cjs +1 -1
  134. package/dist/pkt-listbox.js +1 -1
  135. package/dist/pkt-loader.cjs +1 -1
  136. package/dist/pkt-loader.js +1 -1
  137. package/dist/pkt-messagebox.cjs +1 -1
  138. package/dist/pkt-messagebox.js +1 -1
  139. package/dist/pkt-modal.cjs +1 -1
  140. package/dist/pkt-modal.js +1 -1
  141. package/dist/{pkt-options-controller-C5EBX2T0.cjs → pkt-options-controller-CEEAqXaB.cjs} +1 -1
  142. package/dist/{pkt-options-controller-B77vH3PE.js → pkt-options-controller-PtjhmTGk.js} +1 -1
  143. package/dist/pkt-progressbar.cjs +1 -1
  144. package/dist/pkt-progressbar.js +1 -1
  145. package/dist/pkt-radiobutton.cjs +1 -1
  146. package/dist/pkt-radiobutton.js +1 -1
  147. package/dist/pkt-searchinput.cjs +1 -1
  148. package/dist/pkt-searchinput.js +1 -1
  149. package/dist/pkt-select.cjs +1 -1
  150. package/dist/pkt-select.js +1 -1
  151. package/dist/pkt-tabs.cjs +1 -1
  152. package/dist/pkt-tabs.js +1 -1
  153. package/dist/pkt-tag.cjs +1 -1
  154. package/dist/pkt-tag.js +1 -1
  155. package/dist/pkt-textarea.cjs +1 -1
  156. package/dist/pkt-textarea.js +1 -1
  157. package/dist/pkt-textinput.cjs +1 -1
  158. package/dist/pkt-textinput.js +1 -1
  159. package/dist/pkt-timepicker.cjs +1 -1
  160. package/dist/pkt-timepicker.js +1 -1
  161. package/dist/{progressbar-CbcfLerF.js → progressbar-BexQQw1o.js} +21 -21
  162. package/dist/{progressbar-D5MmnQId.cjs → progressbar-X9mSvpjw.cjs} +5 -5
  163. package/dist/{radiobutton-BUnf3EPi.js → radiobutton-CkhTasn4.js} +24 -24
  164. package/dist/{radiobutton-DpsO1F-8.cjs → radiobutton-ln29Ad3U.cjs} +8 -8
  165. package/dist/{ref-CQoEIIp0.cjs → ref-CHbJYtKE.cjs} +1 -1
  166. package/dist/{ref-CWD6PjVd.js → ref-Chc_DZAb.js} +2 -2
  167. package/dist/{repeat-sY6B7fAT.cjs → repeat-CHDs__rN.cjs} +1 -1
  168. package/dist/{repeat-C02g7d5S.js → repeat-P9SMlKd5.js} +4 -4
  169. package/dist/searchinput-CPgMEAZZ.cjs +60 -0
  170. package/dist/{searchinput-DwnjsvJ1.js → searchinput-Da7dKHBH.js} +43 -43
  171. package/dist/{select-BOJi6H6T.cjs → select-DCuvdAuK.cjs} +4 -3
  172. package/dist/{select-DMre80qs.js → select-jabMSjft.js} +21 -20
  173. package/dist/shared-strings/consent.d.ts +71 -0
  174. package/dist/shared-strings/format.d.ts +21 -0
  175. package/dist/shared-strings/index.d.ts +14 -0
  176. package/dist/shared-strings/nb.d.ts +118 -0
  177. package/dist/shared-strings/resolve.d.ts +12 -0
  178. package/dist/shared-strings/store.d.ts +27 -0
  179. package/dist/shared-strings/types.d.ts +29 -0
  180. package/dist/shared-types/fileupload.d.ts +0 -27
  181. package/dist/shared-types/index.d.ts +1 -2
  182. package/dist/shared-utils/combobox/index.d.ts +1 -0
  183. package/dist/shared-utils/combobox/input-utils.d.ts +2 -1
  184. package/dist/shared-utils/combobox/messages.d.ts +7 -0
  185. package/dist/shared-utils/combobox/option-utils.d.ts +2 -1
  186. package/dist/shared-utils/combobox/selection-manager.d.ts +3 -2
  187. package/dist/{tabs-Cf9ai0FD.cjs → tabs-DV5CQNDL.cjs} +7 -7
  188. package/dist/{tabs-TvxgbrCF.js → tabs-D_hoi1zu.js} +32 -32
  189. package/dist/tag-BxYulmZn.cjs +27 -0
  190. package/dist/{tag-Ds6n1LIs.js → tag-DK5SgKry.js} +33 -32
  191. package/dist/tests/strings-override.test.d.ts +0 -0
  192. package/dist/{textarea-vfzIcXhX.js → textarea-BR7Riace.js} +30 -29
  193. package/dist/{textarea-BydiLM9Z.cjs → textarea-ffBD_VHq.cjs} +3 -2
  194. package/dist/{textinput-CMP2jPP_.js → textinput-CRNrsRNV.js} +28 -27
  195. package/dist/{textinput-DGdicNSx.cjs → textinput-CtHFzAux.cjs} +13 -12
  196. package/dist/timepicker-AfgJipo6.cjs +196 -0
  197. package/dist/{timepicker-ClwgYywH.js → timepicker-ixs_E5RY.js} +67 -64
  198. package/package.json +3 -3
  199. package/src/components/backlink/backlink.ts +1 -1
  200. package/src/components/breadcrumbs/breadcrumbs.ts +1 -1
  201. package/src/components/calendar/calendar.ts +56 -26
  202. package/src/components/checkbox/checkbox.test.ts +0 -2
  203. package/src/components/checkbox/checkbox.ts +8 -4
  204. package/src/components/combobox/combobox-base.ts +2 -1
  205. package/src/components/combobox/combobox-value.ts +10 -9
  206. package/src/components/combobox/combobox.selection.test.ts +5 -1
  207. package/src/components/combobox/combobox.ts +4 -1
  208. package/src/components/consent/strings.ts +1 -125
  209. package/src/components/datepicker/date-tags.ts +4 -1
  210. package/src/components/datepicker/datepicker-base.ts +2 -6
  211. package/src/components/datepicker/datepicker-multiple.ts +0 -3
  212. package/src/components/datepicker/datepicker-range.ts +4 -7
  213. package/src/components/datepicker/datepicker-single.ts +0 -3
  214. package/src/components/datepicker/datepicker-utils.test.ts +5 -5
  215. package/src/components/datepicker/datepicker-utils.ts +6 -11
  216. package/src/components/datepicker/datepicker.ts +8 -1
  217. package/src/components/fileupload/fileupload-base.ts +25 -16
  218. package/src/components/fileupload/fileupload-renderers.ts +2 -1
  219. package/src/components/fileupload/fileupload.test.ts +16 -0
  220. package/src/components/fileupload/fileupload.ts +19 -15
  221. package/src/components/header/header-global.ts +3 -3
  222. package/src/components/header/header-service.ts +13 -8
  223. package/src/components/header/header.ts +2 -1
  224. package/src/components/helptext/helptext.test.ts +1 -1
  225. package/src/components/helptext/helptext.ts +3 -3
  226. package/src/components/index.ts +9 -0
  227. package/src/components/input-wrapper/input-wrapper.ts +18 -10
  228. package/src/components/listbox/listbox.ts +3 -3
  229. package/src/components/radiobutton/radiobutton.ts +8 -4
  230. package/src/components/searchinput/searchinput.ts +5 -3
  231. package/src/components/select/select.ts +1 -0
  232. package/src/components/tag/tag.ts +2 -1
  233. package/src/components/textarea/textarea.ts +1 -0
  234. package/src/components/textinput/textinput.ts +1 -0
  235. package/src/components/timepicker/timepicker.ts +23 -21
  236. package/dist/element-BA8v6S7z.cjs +0 -2
  237. package/dist/fileupload-BeWiTAoW.cjs +0 -401
  238. package/dist/helptext-CTtKJcML.cjs +0 -27
  239. package/dist/if-defined-B89_ZeCj.cjs +0 -1
  240. package/dist/input-element-DYmQw-fH.cjs +0 -1
  241. package/dist/input-wrapper-BmxNvznr.js +0 -128
  242. package/dist/input-wrapper-D-fPaTbY.js +0 -176
  243. package/dist/input-wrapper-D5PR0rJn.cjs +0 -1
  244. package/dist/input-wrapper-Q-B-aBeb.cjs +0 -54
  245. package/dist/linkcard-B29cmZqh.cjs +0 -13
  246. package/dist/searchinput-Bh975rjX.cjs +0 -60
  247. package/dist/tag-CzojNU7z.cjs +0 -27
  248. package/dist/timepicker-DYrnLHqN.cjs +0 -195
  249. package/dist/translations/no.json.d.ts +0 -94
@@ -1,2 +0,0 @@
1
- var e=globalThis,t=e=>e,n=e.trustedTypes,r=n?n.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,i=`$lit$`,a=`lit$${Math.random().toFixed(9).slice(2)}$`,o=`?`+a,s=`<${o}>`,c=document,l=()=>c.createComment(``),u=e=>e===null||typeof e!=`object`&&typeof e!=`function`,d=Array.isArray,f=e=>d(e)||typeof e?.[Symbol.iterator]==`function`,p=`[
2
- \f\r]`,m=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,h=/-->/g,g=/>/g,_=RegExp(`>|${p}(?:([^\\s"'>=/]+)(${p}*=${p}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),v=/'/g,y=/"/g,b=/^(?:script|style|textarea|title)$/i,x=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),S=Symbol.for(`lit-noChange`),C=Symbol.for(`lit-nothing`),w=new WeakMap,T=c.createTreeWalker(c,129);function E(e,t){if(!d(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return r===void 0?t:r.createHTML(t)}var D=(e,t)=>{let n=e.length-1,r=[],o,c=t===2?`<svg>`:t===3?`<math>`:``,l=m;for(let t=0;t<n;t++){let n=e[t],u,d,f=-1,p=0;for(;p<n.length&&(l.lastIndex=p,d=l.exec(n),d!==null);)p=l.lastIndex,l===m?d[1]===`!--`?l=h:d[1]===void 0?d[2]===void 0?d[3]!==void 0&&(l=_):(b.test(d[2])&&(o=RegExp(`</`+d[2],`g`)),l=_):l=g:l===_?d[0]===`>`?(l=o??m,f=-1):d[1]===void 0?f=-2:(f=l.lastIndex-d[2].length,u=d[1],l=d[3]===void 0?_:d[3]===`"`?y:v):l===y||l===v?l=_:l===h||l===g?l=m:(l=_,o=void 0);let x=l===_&&e[t+1].startsWith(`/>`)?` `:``;c+=l===m?n+s:f>=0?(r.push(u),n.slice(0,f)+i+n.slice(f)+a+x):n+a+(f===-2?t:x)}return[E(e,c+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},O=class e{constructor({strings:t,_$litType$:r},s){let c;this.parts=[];let u=0,d=0,f=t.length-1,p=this.parts,[m,h]=D(t,r);if(this.el=e.createElement(m,s),T.currentNode=this.el.content,r===2||r===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(c=T.nextNode())!==null&&p.length<f;){if(c.nodeType===1){if(c.hasAttributes())for(let e of c.getAttributeNames())if(e.endsWith(i)){let t=h[d++],n=c.getAttribute(e).split(a),r=/([.?@])?(.*)/.exec(t);p.push({type:1,index:u,name:r[2],strings:n,ctor:r[1]===`.`?N:r[1]===`?`?P:r[1]===`@`?F:M}),c.removeAttribute(e)}else e.startsWith(a)&&(p.push({type:6,index:u}),c.removeAttribute(e));if(b.test(c.tagName)){let e=c.textContent.split(a),t=e.length-1;if(t>0){c.textContent=n?n.emptyScript:``;for(let n=0;n<t;n++)c.append(e[n],l()),T.nextNode(),p.push({type:2,index:++u});c.append(e[t],l())}}}else if(c.nodeType===8){if(c.data===o)p.push({type:2,index:u});else{let e=-1;for(;(e=c.data.indexOf(a,e+1))!==-1;)p.push({type:7,index:u}),e+=a.length-1}}u++}}static createElement(e,t){let n=c.createElement(`template`);return n.innerHTML=e,n}};function k(e,t,n=e,r){if(t===S)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=u(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=k(e,i._$AS(e,t.values),i,r)),t}var A=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??c).importNode(t,!0);T.currentNode=r;let i=T.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new j(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new I(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=T.nextNode(),a++)}return T.currentNode=c,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},j=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),u(e)?e===C||e==null||e===``?(this._$AH!==C&&this._$AR(),this._$AH=C):e!==this._$AH&&e!==S&&this._(e):e._$litType$===void 0?e.nodeType===void 0?f(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==C&&u(this._$AH)?this._$AA.nextSibling.data=e:this.T(c.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=O.createElement(E(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new A(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=w.get(e.strings);return t===void 0&&w.set(e.strings,t=new O(e)),t}k(t){d(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(l()),this.O(l()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let n=t(e).nextSibling;t(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=C,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=C}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=k(this,e,t,0),a=!u(e)||e!==this._$AH&&e!==S,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=k(this,r[n+o],t,o),s===S&&(s=this._$AH[o]),a||=!u(s)||s!==this._$AH[o],s===C?e=C:e!==C&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},N=class extends M{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===C?void 0:e}},P=class extends M{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==C)}},F=class extends M{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=k(this,e,t,0)??C)===S)return;let n=this._$AH,r=e===C&&n!==C||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==C&&(n===C||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},I=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){k(this,e)}},ee={M:i,P:a,A:o,C:1,L:D,R:A,D:f,V:k,I:j,H:M,N:P,U:F,B:N,F:I},te=e.litHtmlPolyfillSupport;te?.(O,j),(e.litHtmlVersions??=[]).push(`3.3.3`);var ne=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new j(t.insertBefore(l(),e),e,void 0,n??{})}return i._$AI(e),i},re={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ie=e=>(...t)=>({_$litDirective$:e,values:t}),ae=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},oe=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},L=globalThis,R=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,z=Symbol(),B=new WeakMap,se=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==z)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(R&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=B.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&B.set(t,e))}return e}toString(){return this.cssText}},ce=e=>new se(typeof e==`string`?e:e+``,void 0,z),le=(e,t)=>{if(R)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=L.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},V=R?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ce(t)})(e):e,{is:ue,defineProperty:de,getOwnPropertyDescriptor:fe,getOwnPropertyNames:pe,getOwnPropertySymbols:me,getPrototypeOf:he}=Object,H=globalThis,U=H.trustedTypes,ge=U?U.emptyScript:``,_e=H.reactiveElementPolyfillSupport,W=(e,t)=>e,G={toAttribute(e,t){switch(t){case Boolean:e=e?ge:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},K=(e,t)=>!ue(e,t),q={attribute:!0,type:String,converter:G,reflect:!1,useDefault:!1,hasChanged:K};Symbol.metadata??=Symbol(`metadata`),H.litPropertyMetadata??=new WeakMap;var J=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=q){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&de(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=fe(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??q}static _$Ei(){if(this.hasOwnProperty(W(`elementProperties`)))return;let e=he(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W(`properties`))){let e=this.properties,t=[...pe(e),...me(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(V(e))}else e!==void 0&&t.push(V(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return le(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?G:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?G:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??K)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};J.elementStyles=[],J.shadowRootOptions={mode:`open`},J[W(`elementProperties`)]=new Map,J[W(`finalized`)]=new Map,_e?.({ReactiveElement:J}),(H.reactiveElementVersions??=[]).push(`2.1.2`);var ve={attribute:!0,type:String,converter:G,reflect:!1,hasChanged:K},ye=(e=ve,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Y(e){return(t,n)=>typeof n==`object`?ye(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function be(e){return Y({...e,state:!0,attribute:!1})}var X=globalThis,Z=class extends J{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ne(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return S}};Z._$litElement$=!0,Z.finalized=!0,X.litElementHydrateSupport?.({LitElement:Z});var xe=X.litElementPolyfillSupport;xe?.({LitElement:Z}),(X.litElementVersions??=[]).push(`4.2.2`);var Se={example:{hi:`Hei!`},generic:{from:`Fra`,to:`Til`},calendar:{buttonAltText:`Åpne kalender`,deleteDate:`Fjern dato`},dates:{month:`Måned`,year:`År`,days:[`Mandag`,`Tirsdag`,`Onsdag`,`Torsdag`,`Fredag`,`Lørdag`,`Søndag`],daysShort:[`Man`,`Tir`,`Ons`,`Tor`,`Fre`,`Lør`,`Søn`],months:[`Januar`,`Februar`,`Mars`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Desember`],monthsShort:[`Jan`,`Feb`,`Mar`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Des`],week:`Uke`,prevMonth:`Forrige måned`,nextMonth:`Neste måned`},timepicker:{hours:`Timer`,minutes:`Minutter`,openPicker:`Åpne tidspunkt-velger`,prevTime:`Forrige tidspunkt`,nextTime:`Neste tidspunkt`,selectTime:`Velg tidspunkt`},forms:{search:{placeholder:`Søk…`},labels:{optional:`Valgfritt`,required:`Må fylles ut`},messages:{required:`Dette feltet er påkrevd`,invalid:`Ugyldig verdi`,invalidPattern:`Ugyldig format`,tooShort:`For kort`,tooLong:`For lang`,rangeUnderflow:`For lav verdi`,rangeOverflow:`For høy verdi`,stepMismatch:`Må treffe på steget som er definert i elementet`,timeStepMismatch:`Må treffe på et steg, for eksempel 0, {step} minutter`,timeStepMismatchHour:`Må treffe på hver hele time`,timeStepMismatchHalfHour:`Må treffe på hver hele eller halve time`,rangeUnderflowMin:`Verdien må være større enn eller lik {min}.`,rangeOverflowMax:`Verdien må være mindre enn eller lik {max}.`,dateUnderflow:`For tidlig dato`,dateOverflow:`For sen dato`,counterExceeded:`Du har brukt {current} av {max}`},helptext:{helptextDropdownButton:`Les mer`},date:{multiple:`Her kan du velge flere datoer. Trykk komma eller enter når du har skrevet inn en dato.`}}};function Q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var $=class extends Z{constructor(...e){super(...e),this.strings=Se,this.role=null}hotReplacedCallback(){this.requestUpdate()}};Q([Y({type:Object})],$.prototype,`strings`,void 0),Q([Y({type:String})],$.prototype,`role`,void 0);var Ce=class extends ${createRenderRoot(){return this}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return re}});
@@ -1,401 +0,0 @@
1
- const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs");require("./alert-Cs4Rmq_J.cjs"),require("./icon-9iwd2F2l.cjs");const n=require("./if-defined-B89_ZeCj.cjs"),r=require("./converters-BJ9Fe0kW.cjs"),i=require("./utils-63cRpWut.cjs");require("./input-wrapper-Q-B-aBeb.cjs");const a=require("./focus-trap-DSv4Ifqm.cjs");require("./modal-BtInv031.cjs"),require("./progressbar-D5MmnQId.cjs");var o={dropZoneDragMultiple:`Dra filer hit for å laste dem opp eller`,dropZoneDragSingle:`Dra en fil hit for å laste den opp eller`,dropZoneDragMultipleThumbnail:`Dra bilder hit for å laste dem opp eller`,dropZoneDragSingleThumbnail:`Dra et bilde hit for å laste det opp eller`,dropZoneDragActiveMultiple:`Slipp filene her`,dropZoneDragActiveSingle:`Slipp filen her`,dropZoneDragActiveMultipleThumbnail:`Slipp bildene her`,dropZoneDragActiveSingleThumbnail:`Slipp bildet her`,dropZoneOpenFileDialogMultiple:`velg filer`,dropZoneOpenFileDialogSingle:`velg en fil`,dropZoneOpenFileDialogMultipleThumbnail:`velg fra kamerarull`,dropZoneOpenFileDialogSingleThumbnail:`velg fra kamerarull`,supportedFormatsPrefix:`Format:`,invalidFormatDefault:e=>`Ugyldig filtype. Tillatte formater: ${e}`,sizeTooLargeDefault:e=>`Filen er for stor. Maks størrelse er ${e}.`,requiredMissing:`Du må laste opp minst én fil.`,genericValidationRejection:`Filen ble avvist av validering.`,unknownFilename:`Ukjent fil`,fileLabel:e=>e===1?`fil`:`filer`,srFileAdded:e=>`Filen «${e}» er lagt til`,srFilesAdded:e=>`${e} filer er lagt til`,srFilesUploadedOfTotal:(e,t,n)=>`${e} av ${t} ${n} lastet opp`,srFilesFailedOfTotal:(e,t,n)=>`Feil ved opplasting: ${e} av ${t} ${n} feilet`};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 _(e,t){let n=l(t.allowedFormats);if(n.length>0&&!f(e,n)){let e=n.join(`, `),r=`Ugyldig filtype. Tillatte formater: ${e}`;return g(t.formatErrorMessage,r,{formats:e})}let r=s(t.maxFileSize);if(r!==void 0&&e.size>r){let e=c(r),n=`Filen er for stor. Maks størrelse er ${e}.`;return g(t.sizeErrorMessage,n,{maxSize:e})}if(t.onFileValidation){let n=t.onFileValidation(e);if(n)return n}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(e,t=o.unknownFilename){return e.attributes?.targetFilename||e.file?.name||t}var T={name:`pkt-fileupload`,react:`PktFileUpload`,"css-class":`pkt-fileupload`,isElement:!1,isPureReact:!0,"dark-mode":!0,props:{name:{type:`string`,name:`Navn for innsending`,category:`tech`,required:!0},label:{type:`string`,name:`Etikett`,description:`Etikett/tittel over komponenten`,category:`form`},helptext:{type:`string | ReactNode`,name:`Hjelpetekst`,description:`Hjelpetekst under etiketten`,category:`form`},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`},required:{type:`boolean`,name:`Påkrevd`,description:"Gjør feltet obligatorisk. I `uploadStrategy='form'` brukes native validering på file input. I `uploadStrategy='custom'` valideres kravet ved submit og komponenten viser feilmelding hvis ingen filer er valgt.",default:!1,category:`form`},value:{type:`FileItemList`,name:`Fil-liste (controlled)`,description:`Liste over filer i komponenten. Bruk denne for controlled-modus.`,category:`form`},defaultValue:{type:`FileItem[]`,name:`Default-verdi (uncontrolled)`,description:"Default-verdi når komponenten brukes 'uncontrolled'. Ingen grunn til at denne ikke skal være tom array `[]`",category:`form`},onFilesChanged:{type:`(files: FileItem[]) => void`,name:`Callback ved fil-endring`,description:`Kalles når fil(er) legges til, fjernes eller oppdateres`,category:`tech`},uploadStrategy:{name:`Opplastingstype`,type:[`form`,`custom`],values:{form:`form (når filer lastes opp ved submit)`,custom:`custom (når filer lastes opp via webappens egen logikk)`},description:"Velg mellom skjemaopplasting (filene sendes når skjemaet sendes inn) og bakgrunnsopplasting (webappen håndterer opplasting via `onFileUploadRequested` og oppdaterer `transfers`).",default:`form`,category:`functionality`},multiple:{type:`boolean`,name:`Tillat opplasting av flere filer`,default:!1,category:`functionality`},itemRenderer:{type:[`filename`,`thumbnail`],name:`Visningtype av filer`,description:`Hvordan filer skal vises i opplastings-køen. Enten filnavn eller som thumbnails. Du kan også (eksperimentelt) lage din egen komponent.`,default:`filename`,category:`functionality`},optionalTag:{type:`boolean`,name:`Vis 'Valgfritt'-tag`,description:`Vis 'Valgfritt'-tag ved etiketten`,category:`form`},optionalText:{type:`string`,name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,default:`Valgfritt`,category:`contents`},requiredTag:{type:`boolean`,name:`Vis 'Må fylles ut'-tag`,description:`Vis 'Må fylles ut'-tag ved etiketten`,category:`form`},requiredText:{type:`string`,name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,default:`Må fylles ut`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},disabled:{type:`boolean`,name:`Deaktivert`,description:`Deaktiverer hele komponenten - ingen interaksjon mulig`,default:!1,category:`form`},errorMessage:{type:`string`,name:`Feilmelding`,description:`Feilmelding for å vise under komponenten (ekstern/programmatisk feil)`,default:`Det oppstod en feil ved opplastingen av fil(ene).`,category:`form`},hasError:{type:`boolean`,name:`Har feil`,description:`Om komponenten har en feiltilstand`,default:!1,category:`form`},allowedFormats:{type:`string[]`,name:`Tillatte filformater`,description:`Liste over tillatte filformater. F.eks. ['pdf', 'jpg', 'png'] eller ['image/*', 'application/pdf']`,category:`validation`},formatErrorMessage:{type:`string`,name:`Feilmelding for ugyldig format`,description:`Tilpasset feilmelding ved ugyldig filtype.`,category:`validation`},maxFileSize:{type:`string | number`,name:`Maks filstørrelse`,description:`Maksimal filstørrelse. F.eks. '5MB', '500KB', '1GB' eller antall bytes`,category:`validation`},onFileValidation:{type:`(file: File) => string | null`,name:`Egendefinert validering`,description:`Kjører etter innebygd format/størrelse-validering. Returner feilmeldingsstreng hvis ugyldig, null hvis gyldig.`,category:`validation`},sizeErrorMessage:{type:`string`,name:`Feilmelding for stor fil`,description:`Tilpasset feilmelding ved for stor fil.`,category:`validation`},addCommentsEnabled:{type:`boolean`,name:`Tillat kommentarer`,description:"La brukeren skrive en kommentar pr fil. Kommentarene postes i felter med navn `{fileupload-navn}-comment`",default:!1,showIf:{itemRenderer:`filename`},category:`functionality`},enableImagePreview:{type:`boolean`,name:`Forhåndsvisning av bilder`,description:`Aktiver forhåndsvisning av bilder i modal (kun for thumbnail-visning)`,default:!1,showIf:{itemRenderer:`thumbnail`},category:`functionality`},extraOperations:{type:`Array<QueueItemOperation>`,name:`Ekstra operasjoner`,description:"Ekstra operasjoner pr fil (eksperimentelt). Hver operasjon er et objekt med stabil `id`, `title` og valgfrie `onClick`/`renderInlineUI`/`renderExtendedUI`/`renderContent`/`renderHidden`. Callbacks får et `context`-objekt med file, disabled, isActive, activate, close, getAttribute og setAttribute.",category:`functionality`},fullwidth:{type:`boolean`,name:`Full bredde`,description:`Om komponenten skal ta full bredde av foreldreelementet`,default:!1,category:`styling`},onFileUploadRequested:{type:`(fileItem: FileItem) => void`,name:`Callback for opplastingsforespørsel`,description:`Ved <code>uploadStrategy='custom'</code> blir denne funksjonen kalt når brukeren velger en eller flere filer. Dette lar webappen sette i gang opplasting i bakgrunnen.`,relatedTypes:[`FileItem`],category:`functionality`},onTransferCancelled:{type:`(fileItemId: string) => void`,name:`Callback for avbrutt opplasting`,description:`Kalles når brukeren klikker 'Slett' eller 'Avbryt'. Webappen må dermed avbryte opplastingen av denne fila.`,category:`functionality`},renameFilesEnabled:{type:`boolean`,name:`Tillat å gi nytt navn`,description:"La brukeren angi et navn pr fil. Filnavnene postes i felter med navn `{fileupload-navn}-targetFilename`",default:!1,showIf:{itemRenderer:`filename`},category:`functionality`},transfers:{type:`Array<FileTransfer>`,name:`Pågående filoverføringer`,description:`Ved <code>uploadStrategy='custom'</code> vil du fortelle komponenten om pågående overføringer her. Hver fil har en progress-verdi.`,items:{type:`object`,elementType:`FileTransfer`,ref:`FileTransfer`},category:`functionality`},truncateTail:{type:`number`,name:`Forkort filnavn`,description:"Hvordan lange filnavn skal forkortes med ellipse i køen. Med `4` vil filnavnet vises som `langt-filnavn-med ... .pdf`. Med verdi `0` kommer ellipsen til slutt.",category:`functionality`},previewUploadIntervalMs:{type:`number`,name:`Demo: opplastingshastighet (ms/5%)`,description:"Kun for dokumentasjons-forhåndsvisning. Senker simulert opplasting for å demonstrere statusvisning. Gjelder kun i `uploadStrategy='custom'`.",default:100,showIf:{uploadStrategy:`custom`},category:`demo`},previewSimulateUploadError:{type:`boolean`,name:`Demo: simuler feil ved 90% opplasting`,description:`Kun for dokumentasjons-forhåndsvisning. Hvis aktivert feiler simulert opplasting rundt 90%.`,default:!1,showIf:{uploadStrategy:`custom`},category:`demo`},previewUploadStatus:{type:[`progressbar`,`text`],name:`Visning av opplastingstatus`,description:"Kun for dokumentasjons-forhåndsvisning. Vises kun når `uploadStrategy='custom'`. Status vises først etter at brukeren faktisk har valgt fil(er).",default:`progressbar`,showIf:{uploadStrategy:`custom`},category:`demo`}},types:{FileItem:{description:`En valgt fil i køen. <code>FileItemList</code> er en array av <code>FileItem</code>. Brukes som parameter i callbacks som <code>onFileUploadRequested</code> og i <code>FileItemList</code> (<code>value</code> / <code>defaultValue</code>).`,properties:{fileId:{type:`string`,description:`Unik id for filen i komponenten.`},file:{type:`File`,description:`Fil-objektet fra nettleseren.`},attributes:{type:`Record<string, unknown>`,description:`Metadata per fil (f.eks. <code>targetFilename</code> for visningsnavn).`}}},FileTransfer:{description:`Status for én pågående opplasting når <code>uploadStrategy="custom"</code>.`,properties:{fileId:{type:`string`,description:`Kobler til <code>FileItem.fileId</code>.`},progress:{type:`number | 'done' | 'error' | 'canceled' | 'queued'`,description:`Fremdrift (<code>0..1</code>) eller tilstand.`},errorMessage:{type:`string`,description:`Feilmelding ved <code>error</code>.`,required:!1},showProgress:{type:`boolean`,description:`Vis determinate progress vs. «Laster opp…».`,required:!1}}}}},E=class extends e.t{constructor(...e){super(...e),this.id=`pkt-fileupload-${i.n()}`,this.name=`files`,this.label=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=T.props.helptextDropdownButton.default,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.optionalText=T.props.optionalText.default,this.requiredTag=!1,this.requiredText=T.props.requiredText.default,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.requiredSelectionMessage=o.requiredMissing,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 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`))&&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:i.n(),file:e,attributes:{targetFilename:e.name}}));this.setAddedAnnouncement(n.length===1?o.srFileAdded(n[0].attributes.targetFilename):o.srFilesAdded(n.length));let r=this.getCurrentFiles(),a=this.multiple?[...r,...n]:[n[0]];this.commitFiles(a,`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?o.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);return e===0||t===0?``:o.srFilesUploadedOfTotal(t,e,o.fileLabel(e))}getSrErrorsMessage(){let{totalCount:e,failedCount:t}=C(this.getCurrentFiles(),this.transfers);return e===0||t===0?``:o.srFilesFailedOfTotal(t,e,o.fileLabel(e))}syncFormSubmitListener(){let e=this.closest(`form`);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.o({type:String})],E.prototype,`id`,void 0),e.n([e.o({type:String})],E.prototype,`name`,void 0),e.n([e.o({type:String})],E.prototype,`label`,void 0),e.n([e.o({type:String})],E.prototype,`helptext`,void 0),e.n([e.o({type:String,attribute:`helptext-dropdown`})],E.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String,attribute:`helptext-dropdown-button`})],E.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:Boolean,reflect:!0})],E.prototype,`required`,void 0),e.n([e.o({type:Boolean,reflect:!0})],E.prototype,`multiple`,void 0),e.n([e.o({type:Boolean,reflect:!0})],E.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,reflect:!0,attribute:`fullwidth`})],E.prototype,`fullwidth`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`upload-strategy`})],E.prototype,`uploadStrategy`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`item-renderer`})],E.prototype,`itemRenderer`,void 0),e.n([e.o({type:String})],E.prototype,`accept`,void 0),e.n([e.o({converter:r.t.csvToArray,attribute:`allowed-formats`})],E.prototype,`allowedFormats`,void 0),e.n([e.o({type:String,attribute:`format-error-message`})],E.prototype,`formatErrorMessage`,void 0),e.n([e.o({attribute:`max-file-size`})],E.prototype,`maxFileSize`,void 0),e.n([e.o({type:String,attribute:`size-error-message`})],E.prototype,`sizeErrorMessage`,void 0),e.n([e.o({attribute:!1})],E.prototype,`onFileValidation`,void 0),e.n([e.o({attribute:!1})],E.prototype,`transfers`,void 0),e.n([e.o({type:Boolean,attribute:`add-comments-enabled`})],E.prototype,`addCommentsEnabled`,void 0),e.n([e.o({type:Boolean,attribute:`rename-files-enabled`})],E.prototype,`renameFilesEnabled`,void 0),e.n([e.o({attribute:!1})],E.prototype,`extraOperations`,void 0),e.n([e.o({type:Boolean,reflect:!0,attribute:`enable-image-preview`})],E.prototype,`enableImagePreview`,void 0),e.n([e.o({type:Boolean,attribute:`has-error`})],E.prototype,`hasError`,void 0),e.n([e.o({type:String,attribute:`error-message`})],E.prototype,`errorMessage`,void 0),e.n([e.o({type:Boolean,attribute:`optional-tag`})],E.prototype,`optionalTag`,void 0),e.n([e.o({type:String,attribute:`optional-text`})],E.prototype,`optionalText`,void 0),e.n([e.o({type:Boolean,attribute:`required-tag`})],E.prototype,`requiredTag`,void 0),e.n([e.o({type:String,attribute:`required-text`})],E.prototype,`requiredText`,void 0),e.n([e.o({type:String,attribute:`tag-text`})],E.prototype,`tagText`,void 0),e.n([e.o({type:Number,attribute:`truncate-tail`})],E.prototype,`truncateTail`,void 0),e.n([e.o({attribute:!1})],E.prototype,`value`,void 0),e.n([e.o({attribute:!1})],E.prototype,`defaultValue`,void 0),e.n([e.a()],E.prototype,`files`,void 0),e.n([e.a()],E.prototype,`isDragActive`,void 0),e.n([e.a()],E.prototype,`validationErrorMessage`,void 0),e.n([e.a()],E.prototype,`addedAnnouncement`,void 0),e.n([e.a()],E.prototype,`thumbnailUrls`,void 0);var D=`comments`,O=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:`${String(t.getDate()).padStart(2,`0`)}.${String(t.getMonth()+1).padStart(2,`0`)}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`},k=(e,t,n)=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t()),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},A=(e,t,n)=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},j=e=>({id:`remove`,title:`Slett`,ariaLabel:`Slett fil`,onClick:({file:t})=>e(t.fileId)}),M=()=>({id:`rename`,title:`Rediger`,ariaLabel:`Rediger filnavn`,renderInlineUI:t=>{let n=t.getAttribute(`targetFilename`)||t.file.attributes?.targetFilename||t.file.file?.name||``,r=`pkt-fileupload-rename-${t.file.fileId}`,i=()=>{let e=document.getElementById(r)?.value?.trim();e&&t.setAttribute(`targetFilename`,e),t.close()};return e.p`
2
- <label for=${r} class="pkt-sr-only">Endre filnavn</label>
3
- <input
4
- id=${r}
5
- type="text"
6
- class="pkt-fileupload__queue-display__item__rename-input"
7
- ?disabled=${t.disabled}
8
- .value=${n}
9
- @keydown=${e=>k(e,i,t.close)}
10
- />
11
- <button
12
- type="button"
13
- class="pkt-btn pkt-btn--secondary pkt-btn--small"
14
- ?disabled=${t.disabled}
15
- @click=${i}
16
- >
17
- Lagre
18
- </button>
19
- <button
20
- type="button"
21
- class="pkt-btn pkt-btn--tertiary pkt-btn--small"
22
- ?disabled=${t.disabled}
23
- @click=${t.close}
24
- >
25
- Avbryt
26
- </button>
27
- `},renderHidden:t=>{let n=t.getAttribute(`targetFilename`)||t.file.attributes?.targetFilename||t.file.file?.name||``;return e.p`<input
28
- type="hidden"
29
- name=${`${t.inputName}-targetFilename`}
30
- value=${n}
31
- />`}}),N=()=>({id:`comment`,title:e=>(e.attributes?.[D]??[]).length>0?``:`Legg til kommentar`,ariaLabel:`Legg til kommentar`,renderExtendedUI:t=>{let n=(t.getAttribute(D)??[])[0],r=`pkt-fileupload-comment-${t.file.fileId}`,i=()=>{let e=document.getElementById(r)?.value?.trim();e&&t.setAttribute(D,[{text:e,timestamp:new Date().toISOString()}]),t.close()};return e.p`
32
- <label for=${r} class="pkt-fileupload__queue-display__item__comment-label">
33
- ${n?`Rediger kommentar`:`Legg til kommentar`}
34
- </label>
35
- <textarea
36
- id=${r}
37
- class="pkt-fileupload__queue-display__item__comment-input"
38
- ?disabled=${t.disabled}
39
- .value=${n?.text??``}
40
- rows="2"
41
- placeholder="Skriv inn kommentar"
42
- @keydown=${e=>A(e,i,t.close)}
43
- ></textarea>
44
- <button
45
- type="button"
46
- class="pkt-btn pkt-btn--secondary pkt-btn--small"
47
- ?disabled=${t.disabled}
48
- @click=${i}
49
- >
50
- ${n?`Lagre kommentar`:`Legg til kommentar`}
51
- </button>
52
- <button
53
- type="button"
54
- class="pkt-btn pkt-btn--tertiary pkt-btn--small"
55
- ?disabled=${t.disabled}
56
- @click=${t.close}
57
- >
58
- Avbryt
59
- </button>
60
- `},renderContent:t=>{if(t.isActive)return null;let n=t.getAttribute(D)??[];if(n.length===0)return null;let r=n[0];return e.p`
61
- <div class="pkt-fileupload__queue-display__item__comments">
62
- <div class="pkt-fileupload__queue-display__item__comment">
63
- <div class="pkt-fileupload__queue-display__item__comment__content">
64
- <span class="pkt-fileupload__queue-display__item__comment__text" aria-label="Kommentar tekst">
65
- ${r.text}
66
- </span>
67
- <time class="pkt-fileupload__queue-display__item__comment__time">
68
- ${O(r.timestamp)}
69
- </time>
70
- </div>
71
- <div class="pkt-fileupload__queue-display__item__comment__actions">
72
- <button
73
- type="button"
74
- class="pkt-fileupload__queue-display__item__comment__action"
75
- aria-label="Rediger kommentar"
76
- ?disabled=${t.disabled}
77
- @click=${t.activate}
78
- >
79
- <pkt-icon name="edit"></pkt-icon>
80
- </button>
81
- <button
82
- type="button"
83
- class="pkt-fileupload__queue-display__item__comment__action"
84
- aria-label="Slett kommentar"
85
- ?disabled=${t.disabled}
86
- @click=${()=>t.setAttribute(D,void 0)}
87
- >
88
- <pkt-icon name="trash-can"></pkt-icon>
89
- </button>
90
- </div>
91
- </div>
92
- </div>
93
- `},renderHidden:t=>{let n=t.getAttribute(D);return e.p`<input
94
- type="hidden"
95
- name=${`${t.inputName}-comments`}
96
- value=${n?JSON.stringify(n):``}
97
- />`}}),P=(t,n)=>{let r=x(t,n);return r?e.p`<span
98
- class="pkt-fileupload__queue-display__item__title__head"
99
- data-pkt-truncate-part="first"
100
- >${r.head}</span
101
- ><span
102
- class="pkt-fileupload__queue-display__item__title__tail"
103
- data-pkt-truncate-part="tail"
104
- >${r.tail}</span
105
- >`:e.p`<span data-pkt-truncate-part="first">${t}</span>`},F=(t,n,r)=>e.p`
106
- <p class="pkt-fileupload__queue-display__item__title">
107
- ${P(t,r)}${n?e.p`<span class="pkt-fileupload__queue-display__item__filesize"> (${n})</span>`:null}
108
- </p>
109
- `,I=e=>typeof e==`number`?`in-progress`:e===`error`?`error`:`idle`,L=t=>e.p`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
110
- >${t??`Laster opp...`}</span
111
- >`,R=({operationId:e,file:t,inputName:n,disabled:r,isActive:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>({file:t,inputName:n,disabled:r,isActive:i,activate:()=>a(t.fileId,e),close:()=>o(t.fileId),getAttribute:e=>s(t.fileId,e),setAttribute:(e,n)=>c(t.fileId,e,n)}),z=({file:t,fileSize:n,disabled:r,transferProgress:i,transferShowProgress:a,loadingText:o,truncateTail:s,onCancel:c,iconName:l=`document-text`})=>{let u=w(t),d=a??i!==0;return e.p`
112
- <pkt-icon
113
- name=${l}
114
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
115
- aria-hidden="true"
116
- ></pkt-icon>
117
- ${F(u,n,s)}
118
- <button
119
- type="button"
120
- class="pkt-fileupload__queue-display__item__cancel-button"
121
- aria-label="Avbryt opplasting"
122
- ?disabled=${r}
123
- @click=${()=>c(t.fileId)}
124
- >
125
- Avbryt
126
- </button>
127
- ${d?e.p`
128
- <pkt-progressbar
129
- class="pkt-fileupload__queue-display__item__progress"
130
- valueCurrent=${Math.round(i*100)}
131
- valueMax=${100}
132
- statusType="none"
133
- statusPlacement="following"
134
- ></pkt-progressbar>
135
- <span class="pkt-fileupload__queue-display__item__percentage" aria-hidden="true"
136
- >${Math.round(i*100)}%</span
137
- >
138
- `:L(o)}
139
- `},B=({file:t,fileSize:n,disabled:r,transferShowProgress:i,transferLastProgress:a,transferErrorMessage:o,truncateTail:s,onCancel:c})=>{let l=w(t),u=!!i,d=Math.round((a??1)*100);return e.p`
140
- <pkt-icon
141
- name="alert-error"
142
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
143
- aria-hidden="true"
144
- ></pkt-icon>
145
- ${F(l,n,s)}
146
- <button
147
- type="button"
148
- class="pkt-fileupload__queue-display__item__cancel-button"
149
- aria-label="Fjern fil som feilet under opplasting"
150
- ?disabled=${r}
151
- @click=${()=>c(t.fileId)}
152
- >
153
- Fjern
154
- </button>
155
- ${u?e.p`
156
- <pkt-progressbar
157
- class="pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"
158
- valueCurrent=${d}
159
- valueMax=${100}
160
- statusType="none"
161
- statusPlacement="following"
162
- ></pkt-progressbar>
163
- `:null}
164
- ${o?e.p`<span class="pkt-fileupload__queue-display__item__error-message"
165
- >${o}</span
166
- >`:null}
167
- `},V=({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=R({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.p`<button
168
- type="button"
169
- class="pkt-fileupload__queue-display__item__operation"
170
- aria-label=${n.t(p)}
171
- ?disabled=${r}
172
- @click=${()=>{(a.renderInlineUI||a.renderExtendedUI)&&d.activate(),a.onClick?.(d)}}
173
- >
174
- ${f}
175
- </button>`}).filter(Boolean);return f.length===0?null:e.p`<div class="pkt-fileupload__queue-display__item__actions">${f}</div>`},H=({file:t,disabled:n,inputName:r,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})=>i.map(i=>{if(!i.renderContent)return null;let u=R({operationId:i.id,file:t,inputName:r,disabled:n,isActive:i.id===a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l}),d=i.renderContent(u);return d==null?null:e.p`<div class="pkt-fileupload__queue-display__item__operation-content">
176
- ${d}
177
- </div>`}),U=({file:t,disabled:n,inputName:r,operations:i,activeOperationId:a,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l})=>{if(!a)return null;let u=i.find(e=>e.id===a);if(!u?.renderExtendedUI)return null;let d=R({operationId:u.id,file:t,inputName:r,disabled:n,isActive:!0,onActivateOperation:o,onCloseOperation:s,getFileAttribute:c,setFileAttribute:l});return e.p`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
178
- ${u.renderExtendedUI(d)}
179
- </div>`},W=({file:e,disabled:t,inputName:n,operations:r,activeOperationId:i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c})=>r.map(r=>{if(!r.renderHidden)return null;let l=R({operationId:r.id,file:e,inputName:n,disabled:t,isActive:r.id===i,onActivateOperation:a,onCloseOperation:o,getFileAttribute:s,setFileAttribute:c});return r.renderHidden(l)}),G=(t,n,r)=>{let i=w(t);return e.p`
180
- <pkt-icon
181
- name="document-text"
182
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
183
- aria-hidden="true"
184
- ></pkt-icon>
185
- ${F(i,n,r)}
186
- `},K=({file:r,thumbnailUrl:i,previewEnabled:a,canOpenPreview:o,truncateTail:s,onOpenPreview:c,onThumbnailImageError:l})=>{let u=w(r),d=!!i,f=!!a&&!!o,p=f&&!!c;return e.p`
187
- <div
188
- class=${t.t({"pkt-fileupload__queue-display__item__thumbnail":!0,"pkt-fileupload__queue-display__item__thumbnail--fallback":!d})}
189
- >
190
- <button
191
- type="button"
192
- class="pkt-fileupload__queue-display__item__thumbnail__image-wrapper pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--label-only"
193
- aria-label=${`Forhåndsvis bilde ${u}`}
194
- ?disabled=${!p}
195
- @click=${()=>{!p||!c||c(r.fileId)}}
196
- >
197
- <span class="pkt-btn__text">
198
- ${f?e.p`<pkt-icon
199
- name="expand"
200
- class="pkt-fileupload__queue-display__item__thumbnail__expand-icon"
201
- aria-hidden="true"
202
- ></pkt-icon>`:null}
203
- ${d?e.p`<img
204
- src=${n.t(i)}
205
- alt=${u}
206
- @error=${()=>l?.(r.fileId)}
207
- />`:e.p`<pkt-icon
208
- name="document-text"
209
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
210
- aria-hidden="true"
211
- ></pkt-icon>`}
212
- </span>
213
- </button>
214
- <span class="pkt-fileupload__queue-display__item__thumbnail__title"
215
- >${P(u,s)}</span
216
- >
217
- </div>
218
- `},q=({file:n,inputName:r,disabled:i,fileSize:a,operations:o,activeOperationId:s,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d,transferProgress:f,transferErrorMessage:p,transferShowProgress:m,transferLastProgress:h,loadingText:g,truncateTail:_,onCancel:v})=>{let y=I(f),b=o.find(e=>e.id===s),x=b?.renderInlineUI?b.renderInlineUI(R({operationId:b.id,file:n,inputName:r,disabled:i,isActive:!0,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d})):null;return e.p`
219
- <li
220
- class=${t.t({"pkt-fileupload__queue-display__item":!0,"pkt-fileupload__queue-display__item--in-progress":y===`in-progress`,"pkt-fileupload__queue-display__item--error":y===`error`,[`pkt-fileupload__queue-display__item--${f}`]:typeof f==`string`})}
221
- >
222
- ${W({file:n,disabled:i,inputName:r,operations:o,activeOperationId:s,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d})}
223
- ${y===`in-progress`?z({file:n,fileSize:a,disabled:i,transferProgress:f,transferShowProgress:m,loadingText:g,truncateTail:_,onCancel:v}):y===`error`?B({file:n,fileSize:a,disabled:i,transferShowProgress:m,transferLastProgress:h,transferErrorMessage:p,truncateTail:_,onCancel:v}):x?e.p`
224
- <pkt-icon
225
- name="document-text"
226
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
227
- aria-hidden="true"
228
- ></pkt-icon>
229
- <div class="pkt-fileupload__queue-display__item__inline-ui">
230
- ${x}
231
- </div>
232
- `:G(n,a,_)}
233
- ${y===`idle`?V({file:n,disabled:i,inputName:r,operations:o,activeOperationId:s,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d}):null}
234
- ${y===`idle`?H({file:n,disabled:i,inputName:r,operations:o,activeOperationId:s,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d}):null}
235
- ${y===`idle`?U({file:n,disabled:i,inputName:r,operations:o,activeOperationId:s,onActivateOperation:c,onCloseOperation:l,getFileAttribute:u,setFileAttribute:d}):null}
236
- </li>
237
- `},J=({file:n,inputName:r,disabled:i,fileSize:a,thumbnailUrl:o,previewEnabled:s,canOpenPreview:c,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m,transferProgress:h,transferErrorMessage:g,transferShowProgress:_,transferLastProgress:v,loadingText:y,truncateTail:b,onCancel:x,onOpenPreview:S,onThumbnailImageError:C})=>{let w=I(h),T=l.find(e=>e.id===u),E=T?.renderInlineUI?T.renderInlineUI(R({operationId:T.id,file:n,inputName:r,disabled:i,isActive:!0,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m})):null;return e.p`
238
- <li
239
- class=${t.t({"pkt-fileupload__queue-display__item":!0,"pkt-fileupload__queue-display__item--in-progress":w===`in-progress`,"pkt-fileupload__queue-display__item--error":w===`error`,[`pkt-fileupload__queue-display__item--${h}`]:typeof h==`string`})}
240
- >
241
- ${W({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m})}
242
- ${w===`in-progress`?z({file:n,fileSize:a,disabled:i,transferProgress:h,transferShowProgress:_,loadingText:y,truncateTail:b,onCancel:x,iconName:`picture`}):w===`error`?B({file:n,fileSize:a,disabled:i,transferShowProgress:_,transferLastProgress:v,transferErrorMessage:g,truncateTail:b,onCancel:x}):E?e.p`
243
- <pkt-icon
244
- name="picture"
245
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
246
- aria-hidden="true"
247
- ></pkt-icon>
248
- <div class="pkt-fileupload__queue-display__item__inline-ui">
249
- ${E}
250
- </div>
251
- `:K({file:n,thumbnailUrl:o,previewEnabled:s,canOpenPreview:c,truncateTail:b,onOpenPreview:S,onThumbnailImageError:C})}
252
- ${w===`idle`?V({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m}):null}
253
- ${w===`idle`?H({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m}):null}
254
- ${w===`idle`?U({file:n,disabled:i,inputName:r,operations:l,activeOperationId:u,onActivateOperation:d,onCloseOperation:f,getFileAttribute:p,setFileAttribute:m}):null}
255
- </li>
256
- `},Y=class extends E{constructor(...e){super(...e),this.activeOperationByFileId={},this.isPreviewModalOpen=!1,this.previewCurrentIndex=0,this.failedImageFileIds={},this.closePreview=()=>{this.isPreviewModalOpen=!1},this.onPreviewKeyDown=(e,t)=>{if(this.isPreviewModalOpen){if(e.key===`Tab`){a.r(e,e.currentTarget);return}switch(e.key){case`ArrowLeft`:e.preventDefault(),this.navigatePreview(`prev`,t);break;case`ArrowRight`:e.preventDefault(),this.navigatePreview(`next`,t);break;case`Escape`:e.preventDefault(),this.closePreview()}}}}updated(e){super.updated(e),this.classList.add(`pkt-fileupload-component`)}render(){let n=this.renderContent();return this.label?e.p`
257
- <pkt-input-wrapper
258
- .forId=${`${this.id}-input`}
259
- .label=${this.label}
260
- .helptext=${this.helptext}
261
- .helptextDropdown=${this.helptextDropdown}
262
- .helptextDropdownButton=${this.helptextDropdownButton}
263
- ?disabled=${this.disabled}
264
- ?hasError=${this.hasEffectiveError}
265
- ?optionalTag=${this.optionalTag}
266
- .optionalText=${this.optionalText}
267
- ?requiredTag=${this.requiredTag}
268
- .requiredText=${this.requiredText}
269
- .tagText=${this.tagText}
270
- class=${t.t({"pkt-fileupload-wrapper":!0,"pkt-fileupload-wrapper--full-width":this.fullwidth})}
271
- >
272
- ${n}
273
- </pkt-input-wrapper>
274
- `:n}renderContent(){let r=this.getSortedFilesAndTransfers(),i=this.getPreviewableImages(r),a=this.getSupportedFormatsText(),s=[!this.label&&this.helptext?`${this.id}-helptext`:void 0,this.hasEffectiveError?`${this.id}-error`:void 0].filter(Boolean).join(` `)||void 0,c=this.itemRenderer===`thumbnail`?this.multiple?{dragInactive:o.dropZoneDragMultipleThumbnail,dragActive:o.dropZoneDragActiveMultipleThumbnail,openFileDialog:o.dropZoneOpenFileDialogMultipleThumbnail}:{dragInactive:o.dropZoneDragSingleThumbnail,dragActive:o.dropZoneDragActiveSingleThumbnail,openFileDialog:o.dropZoneOpenFileDialogSingleThumbnail}:this.multiple?{dragInactive:o.dropZoneDragMultiple,dragActive:o.dropZoneDragActiveMultiple,openFileDialog:o.dropZoneOpenFileDialogMultiple}:{dragInactive:o.dropZoneDragSingle,dragActive:o.dropZoneDragActiveSingle,openFileDialog:o.dropZoneOpenFileDialogSingle};return e.p`
275
- <div
276
- class=${t.t({"pkt-fileupload":!0,"pkt-fileupload--full-width":this.fullwidth,"pkt-fileupload--error":this.hasEffectiveError,"pkt-fileupload--disabled":this.disabled})}
277
- aria-disabled=${String(this.disabled)}
278
- ?inert=${this.disabled}
279
- >
280
- <div class="pkt-sr-only" aria-live="polite" aria-atomic="true">
281
- ${this.getSrUploadedMessage()}
282
- </div>
283
- <div class="pkt-sr-only" aria-live="assertive" aria-atomic="true">
284
- ${this.getSrErrorsMessage()}
285
- </div>
286
- <div
287
- class=${t.t({"pkt-fileupload__drop-zone":!0,"pkt-fileupload__drop-zone--drag-active":this.isDragActive,"pkt-fileupload__drop-zone--disabled":this.disabled})}
288
- @dragover=${this.onDragOver}
289
- @dragleave=${this.onDragLeave}
290
- @drop=${this.onDrop}
291
- @click=${this.onDropZoneClick}
292
- >
293
- <input
294
- id=${`${this.id}-input`}
295
- type="file"
296
- name=${n.t(this.uploadStrategy===`form`?this.name:void 0)}
297
- ?multiple=${this.multiple}
298
- ?disabled=${this.disabled}
299
- ?required=${this.required&&this.uploadStrategy===`form`}
300
- accept=${this.getResolvedAcceptValue()}
301
- aria-label=${n.t(this.label?void 0:this.multiple?`Velg filer`:`Velg fil`)}
302
- aria-required=${n.t(this.required?`true`:void 0)}
303
- aria-invalid=${n.t(this.hasEffectiveError?`true`:void 0)}
304
- aria-describedby=${n.t(s)}
305
- @change=${this.onNativeFileChange}
306
- />
307
- ${this.uploadStrategy===`custom`?r.map(t=>e.p`<input type="hidden" name=${this.name} value=${t.fileId} />`):null}
308
- <div class="pkt-fileupload__drop-zone__placeholder">
309
- <pkt-icon
310
- name="attachment"
311
- class="pkt-fileupload__drop-zone__placeholder__icon"
312
- aria-hidden="true"
313
- ></pkt-icon>
314
- <p class="pkt-fileupload__drop-zone__placeholder__title">
315
- ${this.isDragActive?`${c.dragActive} ...`:e.p`${c.dragInactive}
316
- <button
317
- type="button"
318
- class="pkt-fileupload__drop-zone__placeholder__title__open-file-dialog"
319
- @click=${this.openFileDialog}
320
- >
321
- ${c.openFileDialog}
322
- </button>`}
323
- </p>
324
- ${a?e.p`<p class="pkt-fileupload__drop-zone__placeholder__formats">
325
- ${o.supportedFormatsPrefix} ${a}
326
- </p>`:null}
327
- </div>
328
- </div>
329
- ${this.hasEffectiveError?e.p`
330
- <pkt-alert
331
- skin="error"
332
- role="alert"
333
- aria-live="assertive"
334
- compact
335
- id=${`${this.id}-error`}
336
- class="pkt-alert--error pkt-fileupload__error-alert"
337
- >
338
- ${this.effectiveErrorMessage}
339
- </pkt-alert>
340
- `:null}
341
- ${r.length>0?e.p`<ul class="pkt-fileupload__queue-display">
342
- ${r.map(e=>this.renderQueueItem(e,i))}
343
- </ul>`:null}
344
- ${this.renderPreviewModal(i)}
345
- </div>
346
- `}renderQueueItem(e,t){let n=typeof e.file?.size==`number`?this.formatFileSize(e.file.size):``,r=this.getQueueItemOperations();if(this.itemRenderer===`thumbnail`){let i=this.canOpenPreview(e),a=this.failedImageFileIds[e.fileId]?.thumbnail?void 0:this.getThumbnailUrl(e);return J({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:a,previewEnabled:this.enableImagePreview,canOpenPreview:i,transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,truncateTail:this.truncateTail,onCancel:e=>this.cancelTransfer(e),onOpenPreview:e=>this.openPreview(e,t),onThumbnailImageError:e=>this.markImageFailed(e,`thumbnail`)})}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),transferProgress:e.progress,transferErrorMessage:e.errorMessage,transferShowProgress:e.showProgress,transferLastProgress:e.lastProgress,loadingText:`Laster opp`,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=t[this.previewCurrentIndex];if(!n)return null;let r=t.length>1,i=this.getThumbnailUrl(n),a=!!i&&!this.failedImageFileIds[n.fileId]?.preview,o=n.attributes?.targetFilename||n.file?.name||`Forhåndsvisning`;return e.p`
347
- <pkt-modal
348
- .open=${this.isPreviewModalOpen}
349
- .headingText=${o}
350
- closeOnBackdropClick
351
- class="pkt-fileupload__image-preview-modal"
352
- @close=${this.closePreview}
353
- @keydown=${e=>this.onPreviewKeyDown(e,t)}
354
- >
355
- <div class="pkt-fileupload__image-preview">
356
- ${r?e.p`<button
357
- type="button"
358
- class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
359
- aria-label=${`Forrige bilde ${this.previewCurrentIndex} / ${t.length}`}
360
- @click=${()=>this.navigatePreview(`prev`,t)}
361
- >
362
- <pkt-icon
363
- class="pkt-btn__icon pkt-icon"
364
- name="chevron-thin-left"
365
- aria-hidden="true"
366
- ></pkt-icon>
367
- <span class="pkt-btn__text"></span>
368
- </button>`:null}
369
-
370
- <div class="pkt-fileupload__image-preview__content">
371
- ${a?e.p`<img
372
- src=${i}
373
- alt=${`${o} - ${this.previewCurrentIndex+1} av ${t.length}`}
374
- class="pkt-fileupload__image-preview__image"
375
- @error=${()=>this.markImageFailed(n.fileId,`preview`)}
376
- />`:e.p`<pkt-icon
377
- name="picture"
378
- class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
379
- aria-hidden="true"
380
- ></pkt-icon>`}
381
- </div>
382
-
383
- ${r?e.p`<span class="pkt-fileupload__image-preview__counter">
384
- ${this.previewCurrentIndex+1} / ${t.length}
385
- </span>`:null}
386
- ${r?e.p`<button
387
- type="button"
388
- class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
389
- aria-label=${`Neste bilde ${this.previewCurrentIndex+2} / ${t.length}`}
390
- @click=${()=>this.navigatePreview(`next`,t)}
391
- >
392
- <pkt-icon
393
- class="pkt-btn__icon pkt-icon"
394
- name="chevron-thin-right"
395
- aria-hidden="true"
396
- ></pkt-icon>
397
- <span class="pkt-btn__text"></span>
398
- </button>`:null}
399
- </div>
400
- </pkt-modal>
401
- `}getQueueItemOperations(){let e=[];return this.renameFilesEnabled&&this.itemRenderer!==`thumbnail`&&e.push(M()),this.addCommentsEnabled&&this.itemRenderer!==`thumbnail`&&e.push(N()),e.push(...this.extraOperations),e.push(j(e=>this.removeFileItem(e))),e}activateOperation(e,t){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:t}}closeOperation(e){this.activeOperationByFileId={...this.activeOperationByFileId,[e]:void 0}}getFileAttribute(e,t){let n=this.getCurrentFiles().find(t=>t.fileId===e);if(n)return n.attributes?.[t]??void 0}setFileAttribute(e,t,n){let r=this.getCurrentFiles().find(t=>t.fileId===e);if(!r)return;let i={...r.attributes,[t]:n};n===void 0&&delete i[t],this.updateFileItem(e,{attributes:i})}};e.n([e.a()],Y.prototype,`activeOperationByFileId`,void 0),e.n([e.a()],Y.prototype,`isPreviewModalOpen`,void 0),e.n([e.a()],Y.prototype,`previewCurrentIndex`,void 0),e.n([e.a()],Y.prototype,`failedImageFileIds`,void 0),Y=e.n([e.s(`pkt-fileupload`)],Y);var X=Y;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return X}});
@@ -1,27 +0,0 @@
1
- const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./element-with-slot-Bj7nm7fO.cjs"),r=require("./icon-9iwd2F2l.cjs"),i=require("./utils-63cRpWut.cjs"),a=require("./input-wrapper-D5PR0rJn.cjs");var o=class extends n.t{constructor(...e){super(...e),this.forId=i.n(),this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=a.t.props.helptextDropdownButton.default,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.p`${e.p`<div class="${a}">
2
- <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
3
- <div class="pkt-contents" name="helptext">${n.n(this)}</div>
4
- ${this.helptext&&r.r(this.helptext)}
5
- </div>
6
- ${this.helptextDropdown?e.p`<div class="pkt-inputwrapper__helptext-expandable">
7
- <button
8
- class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
9
- type="button"
10
- aria-expanded=${this.isHelpTextOpen?`true`:`false`}
11
- aria-controls="${this.forId}-helptext-expandable"
12
- @click=${i}
13
- >
14
- <pkt-icon
15
- class="pkt-btn__icon"
16
- name="${this.isHelpTextOpen?`chevron-thin-up`:`chevron-thin-down`}"
17
- ></pkt-icon>
18
- <span class="pkt-btn__text">${r.r(this.helptextDropdownButton)}</span>
19
- </button>
20
- <div
21
- id="${this.forId}-helptext-expandable"
22
- class="${t.t({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
23
- >
24
- ${r.r(this.helptextDropdown)}
25
- </div>
26
- </div>`:e.d}
27
- </div>`}`}};e.n([e.o({type:String,reflect:!0})],o.prototype,`forId`,void 0),e.n([e.o({type:String})],o.prototype,`helptext`,void 0),e.n([e.o({type:String})],o.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String})],o.prototype,`helptextDropdownButton`,void 0),e.n([e.a()],o.prototype,`isHelpTextOpen`,void 0);try{e.s(`pkt-helptext`)(o)}catch{console.warn(`Forsøker å definere <pkt-helptext>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
@@ -1 +0,0 @@
1
- const e=require("./element-BA8v6S7z.cjs");var t=t=>t??e.d;Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1 +0,0 @@
1
- const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7fO.cjs"),n=require("./utils-63cRpWut.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./input-wrapper-D5PR0rJn.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(O(e.target))},E=e=>{T(O(e.target))},te=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},ne=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},D=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),te(t),t.addEventListener(`reset`,ne),t.addEventListener(`input`,ee),t.addEventListener(`change`,E)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},O=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=O(t)),t},k=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},A=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},j=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),D(e,i,n)}return t};function M(){return typeof MutationObserver<`u`}var N={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},P=(e,t)=>{for(let n in N){t[n]=null;let r=null,i=N[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},re=(e,t)=>{s.set(t,[]),R.observe?.(e,L)};function F(e){let t=c.get(e),{form:n}=t;D(e,n,t),w(e,t.labels)}var I=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},L={attributes:!0,attributeFilter:[`disabled`,`name`]},R=M()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&I(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function z(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&F(e),m.has(e)){let t=m.get(e);Object.keys(N).filter(e=>t[e]!==null).forEach(n=>{b(e,N[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)F(r),r=n.nextNode()}e.localName===`fieldset`&&(R.observe?.(e,L),I(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function ie(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&j(t),n.disconnect()})})}var ae=e=>{let t=new MutationObserver(ie);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};M()&&new MutationObserver(z);var B={childList:!0,subtree:!0},oe=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},se=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),ce=(e,t,n)=>(e.valid=le(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),le=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},V=new WeakMap;function H(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var U=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);V.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=V.get(this),r=`state${e}`;return n.isConnected?H(n,r):setTimeout(()=>{H(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=V.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},ue=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},W=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},G,de=class{constructor(e){G.set(this,void 0),ue(this,G,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return W(this,G,`f`).length}[(G=new WeakMap,Symbol.iterator)](){return W(this,G,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function fe(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return A(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return A(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new de(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var K=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new oe;this.states=new U(e),a.set(this,e),o.set(this,n),c.set(e,this),P(e,this),re(e,this),Object.seal(this),t instanceof DocumentFragment&&ae(t)}checkValidity(){let e=a.get(this);if(k(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);k(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=O(e)),t}get labels(){let e=a.get(this);k(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(k(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(k(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(k(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&se(i);let c={...i,...s};delete c.valid;let{valid:u}=ce(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return k(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return k(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return k(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function pe(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var q=!1,J=!1;function Y(e){J||(J=!0,window.CustomStateSet=U,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new U(this),n}))}function me(e=!0){let t=!1;if(!q){if(q=!0,typeof window<`u`&&(window.ElementInternals=K),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=j(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new K(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),M()){let e=new MutationObserver(z);window.ShadyDOM?e.observe(this,B):e.observe(n,B),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}M()&&typeof document<`u`&&new MutationObserver(z).observe(document.documentElement,B),typeof HTMLFormElement<`u`&&fe(),(e||typeof window<`u`&&!window.CustomStateSet)&&Y()}}customElements.polyfillWrapFlushCallback||(pe()?typeof window<`u`&&!window.CustomStateSet&&Y(HTMLElement.prototype.attachInternals):me(!1));var X=`on`,Z=`--checked`,Q=`,`,$=class extends t.t{static get formAssociated(){return!0}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedby=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=n.n(),this.counter=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=i.t.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.r.forms.labels.optional,this.requiredText=e.r.forms.labels.required,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.touched=!1,this._initialized=!1,this.internals=this.attachInternals()}manageValidity(t){if(!t){console.warn(`manageValidity called without valid input element`);return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.r.forms.messages.required,t):t.validity?.typeMismatch||t.validity?.badInput?this.internals.setValidity({typeMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.r.forms.messages.invalidPattern,t):t.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.r.forms.messages.tooShort,t):t.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.r.forms.messages.tooLong,t):t.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.r.forms.messages.rangeUnderflowMin.replace(`{min}`,this.min?.toString()):e.r.forms.messages.rangeUnderflow,t):t.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.r.forms.messages.invalid,t):t.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.r.forms.messages.rangeOverflowMax.replace(`{max}`,this.max?.toString()):e.r.forms.messages.rangeOverflow,t):t.validity?.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(e){if(this.internals){if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}}coordinateRadioGroup(){if(!this.form||!this.name||this.type!==`radio`)return;let e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(e=>{if(e!==this&&e.getAttribute(`name`)===this.name&&e.getAttribute(`value`)!==this.value){let t=e;t.checked&&(t.checked=!1,t.internals&&(t.internals.setFormValue(null),t.internals.states?.delete(Z)))}})}valueChecked(e){if(!this.touched)return;let t=this.internals.form||this.closest(`form`),n=t?new FormData(t):null;if(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?(this.checked=e===`true`,this.internals.ariaChecked=String(e===`true`)):typeof e==`boolean`&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){let e=(typeof this.value==`string`?this.value:``)||X;this.internals.setFormValue(e),n&&n.append(this.name,e),this.internals.states.add(Z)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(Z);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Q)&&(e=e.split(Q)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Q)?e.split(Q):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked=`false`,this.internals.setFormValue(``),this.inputRef?.value&&`checked`in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}firstUpdated(e){if(super.firstUpdated(e),!this.form){let e=this.internals.form||this.closest(`form`);this.form=e}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`,this.checked=!0),this.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){let e=this.checked===``||this.checked===`true`||this.checked===!0;this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||X:null;this.internals.setFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.o({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.o({type:Boolean})],$.prototype,`range`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.o()],$.prototype,`defaultValue`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.o({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.o({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.o({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.o({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.o({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.o({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.o({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.o({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.o({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.o({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.o({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.o({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.o({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.o({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.o({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.o({type:String})],$.prototype,`helptext`,void 0),e.n([e.o({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.o({type:String})],$.prototype,`label`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.o({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.o({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.o({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});