@solid-design-system/components 5.15.0 → 5.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/cdn/chunks/{chunk.P46TXTLQ.js → chunk.N2QTZPQZ.js} +1 -1
  2. package/cdn/chunks/{chunk.QEIRLXKH.js → chunk.Y6QP3CKR.js} +1 -1
  3. package/cdn/components/checkbox/checkbox.js +1 -1
  4. package/cdn/components/navigation-item/navigation-item.js +1 -1
  5. package/cdn/custom-elements.json +224 -224
  6. package/cdn/solid-components.bundle.js +2 -2
  7. package/cdn/solid-components.iife.js +2 -2
  8. package/cdn/solid-components.js +1 -1
  9. package/cdn/vscode.html-custom-data.json +42 -42
  10. package/cdn/web-types.json +66 -66
  11. package/cdn-versioned/chunks/chunk.2FN4O4QC.js +1 -1
  12. package/cdn-versioned/chunks/chunk.35Q2HMDE.js +1 -1
  13. package/cdn-versioned/chunks/chunk.3G25QQJC.js +1 -1
  14. package/cdn-versioned/chunks/chunk.3HSQ2Z2H.js +1 -1
  15. package/cdn-versioned/chunks/chunk.3NXEOOQY.js +1 -1
  16. package/cdn-versioned/chunks/chunk.3QQBA7ZB.js +1 -1
  17. package/cdn-versioned/chunks/chunk.5NCRVBOH.js +1 -1
  18. package/cdn-versioned/chunks/chunk.5WKY435J.js +1 -1
  19. package/cdn-versioned/chunks/chunk.64FNEKLV.js +1 -1
  20. package/cdn-versioned/chunks/chunk.75YRQDIX.js +1 -1
  21. package/cdn-versioned/chunks/chunk.7JV32P5Q.js +1 -1
  22. package/cdn-versioned/chunks/chunk.A3ATIGVC.js +1 -1
  23. package/cdn-versioned/chunks/chunk.AVDTGVC2.js +1 -1
  24. package/cdn-versioned/chunks/chunk.B3ARBH5A.js +4 -4
  25. package/cdn-versioned/chunks/chunk.BUJEQKP4.js +1 -1
  26. package/cdn-versioned/chunks/chunk.BVQEQFOI.js +1 -1
  27. package/cdn-versioned/chunks/chunk.CBATEBTB.js +1 -1
  28. package/cdn-versioned/chunks/chunk.CEVVDV52.js +1 -1
  29. package/cdn-versioned/chunks/chunk.CLJGWFHA.js +1 -1
  30. package/cdn-versioned/chunks/chunk.DKI2UXRQ.js +1 -1
  31. package/cdn-versioned/chunks/chunk.F4HX43DG.js +1 -1
  32. package/cdn-versioned/chunks/chunk.FT6CHNH7.js +1 -1
  33. package/cdn-versioned/chunks/chunk.FVYMXJRE.js +1 -1
  34. package/cdn-versioned/chunks/chunk.GKULTMOH.js +1 -1
  35. package/cdn-versioned/chunks/chunk.GYYHNTEP.js +1 -1
  36. package/cdn-versioned/chunks/chunk.HMHMBWUC.js +1 -1
  37. package/cdn-versioned/chunks/chunk.IARZ5WX7.js +2 -2
  38. package/cdn-versioned/chunks/chunk.IHKACSKZ.js +1 -1
  39. package/cdn-versioned/chunks/chunk.KD5YA4NW.js +1 -1
  40. package/cdn-versioned/chunks/chunk.KEJGWWON.js +1 -1
  41. package/cdn-versioned/chunks/chunk.KTS2L7KB.js +1 -1
  42. package/cdn-versioned/chunks/chunk.KUNW6IVR.js +1 -1
  43. package/cdn-versioned/chunks/chunk.KVLS3OE7.js +1 -1
  44. package/cdn-versioned/chunks/chunk.LMYU4GM4.js +1 -1
  45. package/cdn-versioned/chunks/chunk.MCRPEKBH.js +1 -1
  46. package/cdn-versioned/chunks/{chunk.P46TXTLQ.js → chunk.N2QTZPQZ.js} +1 -1
  47. package/cdn-versioned/chunks/chunk.N7TPWVK3.js +1 -1
  48. package/cdn-versioned/chunks/chunk.NMJKLBZG.js +1 -1
  49. package/cdn-versioned/chunks/chunk.NMZIXMMF.js +1 -1
  50. package/cdn-versioned/chunks/chunk.NOCXFEZL.js +1 -1
  51. package/cdn-versioned/chunks/chunk.NQF6SSZQ.js +1 -1
  52. package/cdn-versioned/chunks/chunk.O7S6H4U5.js +1 -1
  53. package/cdn-versioned/chunks/chunk.OGCPYUUV.js +1 -1
  54. package/cdn-versioned/chunks/chunk.PM5HD6JE.js +1 -1
  55. package/cdn-versioned/chunks/chunk.QHS7ZRVI.js +1 -1
  56. package/cdn-versioned/chunks/chunk.QY23RB35.js +1 -1
  57. package/cdn-versioned/chunks/chunk.R4E7AJDS.js +1 -1
  58. package/cdn-versioned/chunks/chunk.S2746Y7L.js +1 -1
  59. package/cdn-versioned/chunks/chunk.SX7AMKP2.js +2 -2
  60. package/cdn-versioned/chunks/chunk.TPVQ7ZU3.js +1 -1
  61. package/cdn-versioned/chunks/chunk.VINV25A7.js +1 -1
  62. package/cdn-versioned/chunks/chunk.VPECZPLY.js +1 -1
  63. package/cdn-versioned/chunks/chunk.VVM6Q5W5.js +4 -4
  64. package/cdn-versioned/chunks/chunk.W7A3TU2Z.js +1 -1
  65. package/cdn-versioned/chunks/chunk.WOVNF4UB.js +1 -1
  66. package/cdn-versioned/chunks/chunk.X67M4VEV.js +1 -1
  67. package/cdn-versioned/chunks/{chunk.QEIRLXKH.js → chunk.Y6QP3CKR.js} +1 -1
  68. package/cdn-versioned/chunks/chunk.YGMAKCAO.js +1 -1
  69. package/cdn-versioned/chunks/chunk.Z2YNXRLX.js +1 -1
  70. package/cdn-versioned/chunks/chunk.Z5LJ5HLC.js +1 -1
  71. package/cdn-versioned/chunks/chunk.ZEI6MVG3.js +1 -1
  72. package/cdn-versioned/components/accordion/accordion.d.ts +1 -1
  73. package/cdn-versioned/components/accordion-group/accordion-group.d.ts +1 -1
  74. package/cdn-versioned/components/animation/animation.d.ts +1 -1
  75. package/cdn-versioned/components/audio/audio.d.ts +1 -1
  76. package/cdn-versioned/components/badge/badge.d.ts +1 -1
  77. package/cdn-versioned/components/brandshape/brandshape.d.ts +1 -1
  78. package/cdn-versioned/components/breadcrumb/breadcrumb.d.ts +1 -1
  79. package/cdn-versioned/components/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  80. package/cdn-versioned/components/button/button.d.ts +1 -1
  81. package/cdn-versioned/components/button-group/button-group.d.ts +1 -1
  82. package/cdn-versioned/components/carousel/carousel.d.ts +1 -1
  83. package/cdn-versioned/components/carousel-item/carousel-item.d.ts +1 -1
  84. package/cdn-versioned/components/checkbox/checkbox.d.ts +1 -1
  85. package/cdn-versioned/components/checkbox/checkbox.js +1 -1
  86. package/cdn-versioned/components/checkbox-group/checkbox-group.d.ts +1 -1
  87. package/cdn-versioned/components/combobox/combobox.d.ts +1 -1
  88. package/cdn-versioned/components/dialog/dialog.d.ts +1 -1
  89. package/cdn-versioned/components/divider/divider.d.ts +1 -1
  90. package/cdn-versioned/components/drawer/drawer.d.ts +1 -1
  91. package/cdn-versioned/components/dropdown/dropdown.d.ts +1 -1
  92. package/cdn-versioned/components/expandable/expandable.d.ts +1 -1
  93. package/cdn-versioned/components/flipcard/flipcard.d.ts +1 -1
  94. package/cdn-versioned/components/header/header.d.ts +1 -1
  95. package/cdn-versioned/components/icon/icon.d.ts +1 -1
  96. package/cdn-versioned/components/include/include.d.ts +1 -1
  97. package/cdn-versioned/components/input/input.d.ts +1 -1
  98. package/cdn-versioned/components/link/link.d.ts +1 -1
  99. package/cdn-versioned/components/loader/loader.d.ts +1 -1
  100. package/cdn-versioned/components/map-marker/map-marker.d.ts +1 -1
  101. package/cdn-versioned/components/menu/menu.d.ts +1 -1
  102. package/cdn-versioned/components/menu-item/menu-item.d.ts +1 -1
  103. package/cdn-versioned/components/navigation-item/navigation-item.d.ts +1 -1
  104. package/cdn-versioned/components/navigation-item/navigation-item.js +1 -1
  105. package/cdn-versioned/components/notification/notification.d.ts +1 -1
  106. package/cdn-versioned/components/optgroup/optgroup.d.ts +1 -1
  107. package/cdn-versioned/components/option/option.d.ts +1 -1
  108. package/cdn-versioned/components/popup/popup.d.ts +1 -1
  109. package/cdn-versioned/components/quickfact/quickfact.d.ts +1 -1
  110. package/cdn-versioned/components/radio/radio.d.ts +1 -1
  111. package/cdn-versioned/components/radio-button/radio-button.d.ts +1 -1
  112. package/cdn-versioned/components/radio-group/radio-group.d.ts +1 -1
  113. package/cdn-versioned/components/range/range.d.ts +1 -1
  114. package/cdn-versioned/components/range-tick/range-tick.d.ts +1 -1
  115. package/cdn-versioned/components/scrollable/scrollable.d.ts +1 -1
  116. package/cdn-versioned/components/select/select.d.ts +1 -1
  117. package/cdn-versioned/components/spinner/spinner.d.ts +1 -1
  118. package/cdn-versioned/components/step/step.d.ts +1 -1
  119. package/cdn-versioned/components/step-group/step-group.d.ts +1 -1
  120. package/cdn-versioned/components/switch/switch.d.ts +1 -1
  121. package/cdn-versioned/components/tab/tab.d.ts +1 -1
  122. package/cdn-versioned/components/tab-group/tab-group.d.ts +1 -1
  123. package/cdn-versioned/components/tab-panel/tab-panel.d.ts +1 -1
  124. package/cdn-versioned/components/tag/tag.d.ts +1 -1
  125. package/cdn-versioned/components/textarea/textarea.d.ts +1 -1
  126. package/cdn-versioned/components/tooltip/tooltip.d.ts +1 -1
  127. package/cdn-versioned/components/video/video.d.ts +1 -1
  128. package/cdn-versioned/custom-elements.json +457 -457
  129. package/cdn-versioned/internal/form.js +3 -3
  130. package/cdn-versioned/solid-components.bundle.js +14 -14
  131. package/cdn-versioned/solid-components.css +2 -2
  132. package/cdn-versioned/solid-components.iife.js +14 -14
  133. package/cdn-versioned/solid-components.js +1 -1
  134. package/cdn-versioned/vscode.html-custom-data.json +131 -131
  135. package/cdn-versioned/web-types.json +217 -217
  136. package/dist/chunks/{chunk.RQVQQ7ZE.js → chunk.T5YQM2UK.js} +1 -1
  137. package/dist/chunks/{chunk.JQJXSQKT.js → chunk.ZOGRR75S.js} +4 -1
  138. package/dist/components/checkbox/checkbox.js +1 -1
  139. package/dist/components/navigation-item/navigation-item.js +1 -1
  140. package/dist/custom-elements.json +224 -224
  141. package/dist/solid-components.js +2 -2
  142. package/dist/vscode.html-custom-data.json +42 -42
  143. package/dist/web-types.json +66 -66
  144. package/dist-versioned/chunks/chunk.26VYQIOD.js +3 -3
  145. package/dist-versioned/chunks/chunk.2MJJHZR4.js +24 -24
  146. package/dist-versioned/chunks/chunk.32WTYFY6.js +4 -4
  147. package/dist-versioned/chunks/chunk.37LBEMXS.js +12 -12
  148. package/dist-versioned/chunks/chunk.37TNCACC.js +2 -2
  149. package/dist-versioned/chunks/chunk.3EQ2WOVC.js +2 -2
  150. package/dist-versioned/chunks/chunk.4FYYKKBL.js +3 -3
  151. package/dist-versioned/chunks/chunk.4I4QBVGB.js +3 -3
  152. package/dist-versioned/chunks/chunk.5KQPPIBZ.js +2 -2
  153. package/dist-versioned/chunks/chunk.5LLVB6R3.js +5 -5
  154. package/dist-versioned/chunks/chunk.5PM33S4N.js +2 -2
  155. package/dist-versioned/chunks/chunk.6DKXZWRN.js +4 -4
  156. package/dist-versioned/chunks/chunk.7YQJWIYJ.js +1 -1
  157. package/dist-versioned/chunks/chunk.AE3WPKVR.js +1 -1
  158. package/dist-versioned/chunks/chunk.AHMEVJMX.js +1 -1
  159. package/dist-versioned/chunks/chunk.ALVVYYIR.js +1 -1
  160. package/dist-versioned/chunks/chunk.ANOMYZE3.js +11 -11
  161. package/dist-versioned/chunks/chunk.B3PDWSAO.js +2 -2
  162. package/dist-versioned/chunks/chunk.B4AW33FC.js +1 -1
  163. package/dist-versioned/chunks/chunk.B6FL47S6.js +2 -2
  164. package/dist-versioned/chunks/chunk.BA3MSKPQ.js +5 -5
  165. package/dist-versioned/chunks/chunk.BDUEFRPO.js +2 -2
  166. package/dist-versioned/chunks/chunk.BJ6QDKVA.js +4 -4
  167. package/dist-versioned/chunks/chunk.BMFACTFH.js +3 -3
  168. package/dist-versioned/chunks/chunk.C332XERU.js +2 -2
  169. package/dist-versioned/chunks/chunk.CNDCBFFV.js +1 -1
  170. package/dist-versioned/chunks/chunk.CS6G3MPN.js +2 -2
  171. package/dist-versioned/chunks/chunk.DIXRYCRP.js +1 -1
  172. package/dist-versioned/chunks/chunk.EYGJ6QWJ.js +1 -1
  173. package/dist-versioned/chunks/chunk.GGCTLJ4D.js +2 -2
  174. package/dist-versioned/chunks/chunk.GIS5TWPR.js +1 -1
  175. package/dist-versioned/chunks/chunk.HMK6KRAR.js +6 -6
  176. package/dist-versioned/chunks/chunk.HV3AJIJO.js +1 -1
  177. package/dist-versioned/chunks/chunk.I2LO4IGY.js +3 -3
  178. package/dist-versioned/chunks/chunk.JW5YX4GK.js +2 -2
  179. package/dist-versioned/chunks/chunk.K2DJQDJ4.js +1 -1
  180. package/dist-versioned/chunks/chunk.KEJFWGZI.js +4 -4
  181. package/dist-versioned/chunks/chunk.KNWAH4Z5.js +1 -1
  182. package/dist-versioned/chunks/chunk.KPWKRZGL.js +14 -14
  183. package/dist-versioned/chunks/chunk.KQLO4TZ5.js +2 -2
  184. package/dist-versioned/chunks/chunk.LGELFCZP.js +2 -2
  185. package/dist-versioned/chunks/chunk.MHLZ7GKR.js +12 -12
  186. package/dist-versioned/chunks/chunk.NAFCDIL3.js +26 -26
  187. package/dist-versioned/chunks/chunk.NFY6NE6Z.js +2 -2
  188. package/dist-versioned/chunks/chunk.NXS7DO7N.js +1 -1
  189. package/dist-versioned/chunks/chunk.PBEPE2U7.js +2 -2
  190. package/dist-versioned/chunks/chunk.QCA2GRRO.js +5 -5
  191. package/dist-versioned/chunks/chunk.RUNTBTHS.js +1 -1
  192. package/dist-versioned/chunks/chunk.SGJLP4HM.js +2 -2
  193. package/dist-versioned/chunks/chunk.SMMMT4SZ.js +8 -8
  194. package/dist-versioned/chunks/chunk.SRLNYSZB.js +5 -5
  195. package/dist-versioned/chunks/chunk.SV7PKNLF.js +4 -4
  196. package/dist-versioned/chunks/{chunk.RQVQQ7ZE.js → chunk.T5YQM2UK.js} +7 -7
  197. package/dist-versioned/chunks/chunk.UIQBHPD3.js +2 -2
  198. package/dist-versioned/chunks/chunk.VGC5A42Q.js +1 -1
  199. package/dist-versioned/chunks/chunk.WFIIU6PJ.js +3 -3
  200. package/dist-versioned/chunks/chunk.WUIOLD72.js +6 -6
  201. package/dist-versioned/chunks/chunk.XCQC3F3H.js +3 -3
  202. package/dist-versioned/chunks/chunk.XWZNY4BH.js +3 -3
  203. package/dist-versioned/chunks/chunk.ZK4EFZJB.js +1 -1
  204. package/dist-versioned/chunks/{chunk.JQJXSQKT.js → chunk.ZOGRR75S.js} +7 -4
  205. package/dist-versioned/components/accordion/accordion.d.ts +1 -1
  206. package/dist-versioned/components/accordion-group/accordion-group.d.ts +1 -1
  207. package/dist-versioned/components/animation/animation.d.ts +1 -1
  208. package/dist-versioned/components/audio/audio.d.ts +1 -1
  209. package/dist-versioned/components/badge/badge.d.ts +1 -1
  210. package/dist-versioned/components/brandshape/brandshape.d.ts +1 -1
  211. package/dist-versioned/components/breadcrumb/breadcrumb.d.ts +1 -1
  212. package/dist-versioned/components/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  213. package/dist-versioned/components/button/button.d.ts +1 -1
  214. package/dist-versioned/components/button-group/button-group.d.ts +1 -1
  215. package/dist-versioned/components/carousel/carousel.d.ts +1 -1
  216. package/dist-versioned/components/carousel-item/carousel-item.d.ts +1 -1
  217. package/dist-versioned/components/checkbox/checkbox.d.ts +1 -1
  218. package/dist-versioned/components/checkbox/checkbox.js +1 -1
  219. package/dist-versioned/components/checkbox-group/checkbox-group.d.ts +1 -1
  220. package/dist-versioned/components/combobox/combobox.d.ts +1 -1
  221. package/dist-versioned/components/dialog/dialog.d.ts +1 -1
  222. package/dist-versioned/components/divider/divider.d.ts +1 -1
  223. package/dist-versioned/components/drawer/drawer.d.ts +1 -1
  224. package/dist-versioned/components/dropdown/dropdown.d.ts +1 -1
  225. package/dist-versioned/components/expandable/expandable.d.ts +1 -1
  226. package/dist-versioned/components/flipcard/flipcard.d.ts +1 -1
  227. package/dist-versioned/components/header/header.d.ts +1 -1
  228. package/dist-versioned/components/icon/icon.d.ts +1 -1
  229. package/dist-versioned/components/include/include.d.ts +1 -1
  230. package/dist-versioned/components/input/input.d.ts +1 -1
  231. package/dist-versioned/components/link/link.d.ts +1 -1
  232. package/dist-versioned/components/loader/loader.d.ts +1 -1
  233. package/dist-versioned/components/map-marker/map-marker.d.ts +1 -1
  234. package/dist-versioned/components/menu/menu.d.ts +1 -1
  235. package/dist-versioned/components/menu-item/menu-item.d.ts +1 -1
  236. package/dist-versioned/components/navigation-item/navigation-item.d.ts +1 -1
  237. package/dist-versioned/components/navigation-item/navigation-item.js +1 -1
  238. package/dist-versioned/components/notification/notification.d.ts +1 -1
  239. package/dist-versioned/components/optgroup/optgroup.d.ts +1 -1
  240. package/dist-versioned/components/option/option.d.ts +1 -1
  241. package/dist-versioned/components/popup/popup.d.ts +1 -1
  242. package/dist-versioned/components/quickfact/quickfact.d.ts +1 -1
  243. package/dist-versioned/components/radio/radio.d.ts +1 -1
  244. package/dist-versioned/components/radio-button/radio-button.d.ts +1 -1
  245. package/dist-versioned/components/radio-group/radio-group.d.ts +1 -1
  246. package/dist-versioned/components/range/range.d.ts +1 -1
  247. package/dist-versioned/components/range-tick/range-tick.d.ts +1 -1
  248. package/dist-versioned/components/scrollable/scrollable.d.ts +1 -1
  249. package/dist-versioned/components/select/select.d.ts +1 -1
  250. package/dist-versioned/components/spinner/spinner.d.ts +1 -1
  251. package/dist-versioned/components/step/step.d.ts +1 -1
  252. package/dist-versioned/components/step-group/step-group.d.ts +1 -1
  253. package/dist-versioned/components/switch/switch.d.ts +1 -1
  254. package/dist-versioned/components/tab/tab.d.ts +1 -1
  255. package/dist-versioned/components/tab-group/tab-group.d.ts +1 -1
  256. package/dist-versioned/components/tab-panel/tab-panel.d.ts +1 -1
  257. package/dist-versioned/components/tag/tag.d.ts +1 -1
  258. package/dist-versioned/components/textarea/textarea.d.ts +1 -1
  259. package/dist-versioned/components/tooltip/tooltip.d.ts +1 -1
  260. package/dist-versioned/components/video/video.d.ts +1 -1
  261. package/dist-versioned/custom-elements.json +457 -457
  262. package/dist-versioned/internal/form.js +3 -3
  263. package/dist-versioned/solid-components.css +2 -2
  264. package/dist-versioned/solid-components.js +2 -2
  265. package/dist-versioned/vscode.html-custom-data.json +131 -131
  266. package/dist-versioned/web-types.json +217 -217
  267. package/package.json +1 -1
@@ -1 +1 @@
1
- import{a as Dt}from"./chunk.26V4EXHB.js";import{a as kt,b as E,d as Et,h as Rt}from"./chunk.2FN4O4QC.js";import{b as Mt,e as Ot}from"./chunk.ZR5P6TQI.js";import{a as C,b as V,c as dt,e as b}from"./chunk.TJOCV4DC.js";var _=Math.min,T=Math.max,ct=Math.round,ft=Math.floor,F=t=>({x:t,y:t}),de={left:"right",right:"left",bottom:"top",top:"bottom"},me={start:"end",end:"start"};function pt(t,e,n){return T(t,_(e,n))}function Z(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function tt(t){return t.split("-")[1]}function Ct(t){return t==="x"?"y":"x"}function gt(t){return t==="y"?"height":"width"}var pe=new Set(["top","bottom"]);function j(t){return pe.has(q(t))?"y":"x"}function wt(t){return Ct(j(t))}function $t(t,e,n){n===void 0&&(n=!1);let i=tt(t),o=wt(t),s=gt(o),r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=lt(r)),[r,lt(r)]}function Nt(t){let e=lt(t);return[mt(t),e,mt(e)]}function mt(t){return t.replace(/start|end/g,e=>me[e])}var Bt=["left","right"],Ft=["right","left"],ge=["top","bottom"],we=["bottom","top"];function ye(t,e,n){switch(t){case"top":case"bottom":return n?e?Ft:Bt:e?Bt:Ft;case"left":case"right":return e?ge:we;default:return[]}}function Ht(t,e,n,i){let o=tt(t),s=ye(q(t),n==="start",i);return o&&(s=s.map(r=>r+"-"+o),e&&(s=s.concat(s.map(mt)))),s}function lt(t){return t.replace(/left|right|bottom|top/g,e=>de[e])}function xe(t){return C({top:0,right:0,bottom:0,left:0},t)}function Tt(t){return typeof t!="number"?xe(t):{top:t,right:t,bottom:t,left:t}}function et(t){let{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Wt(t,e,n){let{reference:i,floating:o}=t,s=j(e),r=wt(e),a=gt(r),c=q(e),l=s==="y",f=i.x+i.width/2-o.width/2,h=i.y+i.height/2-o.height/2,m=i[a]/2-o[a]/2,u;switch(c){case"top":u={x:f,y:i.y-o.height};break;case"bottom":u={x:f,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:h};break;case"left":u={x:i.x-o.width,y:h};break;default:u={x:i.x,y:i.y}}switch(tt(e)){case"start":u[r]-=m*(n&&l?-1:1);break;case"end":u[r]+=m*(n&&l?-1:1);break}return u}var Vt=async(t,e,n)=>{let{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,a=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(e)),l=await r.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:h}=Wt(l,i,c),m=i,u={},d=0;for(let p=0;p<a.length;p++){let{name:w,fn:g}=a[p],{x:y,y:v,data:A,reset:O}=await g({x:f,y:h,initialPlacement:i,placement:m,strategy:o,middlewareData:u,rects:l,platform:r,elements:{reference:t,floating:e}});f=y!=null?y:f,h=v!=null?v:h,u=V(C({},u),{[w]:C(C({},u[w]),A)}),O&&d<=50&&(d++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(l=O.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:f,y:h}=Wt(l,m,c)),p=-1)}return{x:f,y:h,placement:m,strategy:o,middlewareData:u}};async function yt(t,e){var n;e===void 0&&(e={});let{x:i,y:o,platform:s,rects:r,elements:a,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:u=0}=Z(e,t),d=Tt(u),w=a[m?h==="floating"?"reference":"floating":h],g=et(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:c})),y=h==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),A=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},O=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:c}):y);return{top:(g.top-O.top+d.top)/A.y,bottom:(O.bottom-g.bottom+d.bottom)/A.y,left:(g.left-O.left+d.left)/A.x,right:(O.right-g.right+d.right)/A.x}}var _t=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:i,placement:o,rects:s,platform:r,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Z(t,e)||{};if(l==null)return{};let h=Tt(f),m={x:n,y:i},u=wt(o),d=gt(u),p=await r.getDimensions(l),w=u==="y",g=w?"top":"left",y=w?"bottom":"right",v=w?"clientHeight":"clientWidth",A=s.reference[d]+s.reference[u]-m[u]-s.floating[d],O=m[u]-s.reference[u],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l)),R=k?k[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(k)))&&(R=a.floating[v]||s.floating[d]);let I=A/2-O/2,H=R/2-p[d]/2-1,L=_(h[g],H),U=_(h[y],H),W=L,K=R-p[d]-U,S=R/2-p[d]/2+I,D=pt(W,S,K),J=!c.arrow&&tt(o)!=null&&S!==D&&s.reference[d]/2-(S<W?L:U)-p[d]/2<0,Y=J?S<W?S-W:S-K:0;return{[u]:m[u]+Y,data:C({[u]:D,centerOffset:S-D-Y},J&&{alignmentOffset:Y}),reset:J}}});var jt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;let{placement:o,middlewareData:s,rects:r,initialPlacement:a,platform:c,elements:l}=e,S=Z(t,e),{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0}=S,w=dt(S,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let g=q(o),y=j(a),v=q(a)===a,A=await(c.isRTL==null?void 0:c.isRTL(l.floating)),O=m||(v||!p?[lt(a)]:Nt(a)),k=d!=="none";!m&&k&&O.push(...Ht(a,p,d,A));let R=[a,...O],I=await yt(e,w),H=[],L=((i=s.flip)==null?void 0:i.overflows)||[];if(f&&H.push(I[g]),h){let D=$t(o,r,A);H.push(I[D[0]],I[D[1]])}if(L=[...L,{placement:o,overflows:H}],!H.every(D=>D<=0)){var U,W;let D=(((U=s.flip)==null?void 0:U.index)||0)+1,J=R[D];if(J&&(!(h==="alignment"?y!==j(J):!1)||L.every(B=>j(B.placement)===y?B.overflows[0]>0:!0)))return{data:{index:D,overflows:L},reset:{placement:J}};let Y=(W=L.filter(Q=>Q.overflows[0]<=0).sort((Q,B)=>Q.overflows[1]-B.overflows[1])[0])==null?void 0:W.placement;if(!Y)switch(u){case"bestFit":{var K;let Q=(K=L.filter(B=>{if(k){let G=j(B.placement);return G===y||G==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(G=>G>0).reduce((G,he)=>G+he,0)]).sort((B,G)=>B[1]-G[1])[0])==null?void 0:K[0];Q&&(Y=Q);break}case"initialPlacement":Y=a;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};var ve=new Set(["left","top"]);async function be(t,e){let{placement:n,platform:i,elements:o}=t,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),r=q(n),a=tt(n),c=j(n)==="y",l=ve.has(r)?-1:1,f=s&&c?-1:1,h=Z(e,t),{mainAxis:m,crossAxis:u,alignmentAxis:d}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof d=="number"&&(u=a==="end"?d*-1:d),c?{x:u*f,y:m*l}:{x:m*l,y:u*f}}var It=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;let{x:o,y:s,placement:r,middlewareData:a}=e,c=await be(e,t);return r===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:V(C({},c),{placement:r})}}}},Yt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:i,placement:o}=e,w=Z(t,e),{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}}}=w,c=dt(w,["mainAxis","crossAxis","limiter"]),l={x:n,y:i},f=await yt(e,c),h=j(q(o)),m=Ct(h),u=l[m],d=l[h];if(s){let g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=u+f[g],A=u-f[y];u=pt(v,u,A)}if(r){let g=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=d+f[g],A=d-f[y];d=pt(v,d,A)}let p=a.fn(V(C({},e),{[m]:u,[h]:d}));return V(C({},p),{data:{x:p.x-n,y:p.y-i,enabled:{[m]:s,[h]:r}}})}}};var qt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;let{placement:o,rects:s,platform:r,elements:a}=e,L=Z(t,e),{apply:c=()=>{}}=L,l=dt(L,["apply"]),f=await yt(e,l),h=q(o),m=tt(o),u=j(o)==="y",{width:d,height:p}=s.floating,w,g;h==="top"||h==="bottom"?(w=h,g=m===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right"):(g=h,w=m==="end"?"top":"bottom");let y=p-f.top-f.bottom,v=d-f.left-f.right,A=_(p-f[w],y),O=_(d-f[g],v),k=!e.middlewareData.shift,R=A,I=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=v),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(R=y),k&&!m){let U=T(f.left,0),W=T(f.right,0),K=T(f.top,0),S=T(f.bottom,0);u?I=d-2*(U!==0||W!==0?U+W:T(f.left,f.right)):R=p-2*(K!==0||S!==0?K+S:T(f.top,f.bottom))}await c(V(C({},e),{availableWidth:I,availableHeight:R}));let H=await r.getDimensions(a.floating);return d!==H.width||p!==H.height?{reset:{rects:!0}}:{}}}};function xt(){return typeof window!="undefined"}function nt(t){return Ut(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $(t){var e;return(e=(Ut(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ut(t){return xt()?t instanceof Node||t instanceof P(t).Node:!1}function z(t){return xt()?t instanceof Element||t instanceof P(t).Element:!1}function N(t){return xt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Xt(t){return!xt()||typeof ShadowRoot=="undefined"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}var Ae=new Set(["inline","contents"]);function st(t){let{overflow:e,overflowX:n,overflowY:i,display:o}=M(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!Ae.has(o)}var Oe=new Set(["table","td","th"]);function Kt(t){return Oe.has(nt(t))}var Ee=[":popover-open",":modal"];function ut(t){return Ee.some(e=>{try{return t.matches(e)}catch(n){return!1}})}var Re=["transform","translate","scale","rotate","perspective"],Ce=["transform","translate","scale","rotate","perspective","filter"],Te=["paint","layout","strict","content"];function vt(t){let e=bt(),n=z(t)?M(t):t;return Re.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Ce.some(i=>(n.willChange||"").includes(i))||Te.some(i=>(n.contain||"").includes(i))}function Gt(t){let e=X(t);for(;N(e)&&!it(e);){if(vt(e))return e;if(ut(e))return null;e=X(e)}return null}function bt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Pe=new Set(["html","body","#document"]);function it(t){return Pe.has(nt(t))}function M(t){return P(t).getComputedStyle(t)}function ht(t){return z(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function X(t){if(nt(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Xt(t)&&t.host||$(t);return Xt(e)?e.host:e}function Jt(t){let e=X(t);return it(e)?t.ownerDocument?t.ownerDocument.body:t.body:N(e)&&st(e)?e:Jt(e)}function rt(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=Jt(t),s=o===((i=t.ownerDocument)==null?void 0:i.body),r=P(o);if(s){let a=At(r);return e.concat(r,r.visualViewport||[],st(o)?o:[],a&&n?rt(a):[])}return e.concat(o,rt(o,[],n))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function te(t){let e=M(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,o=N(t),s=o?t.offsetWidth:n,r=o?t.offsetHeight:i,a=ct(n)!==s||ct(i)!==r;return a&&(n=s,i=r),{width:n,height:i,$:a}}function St(t){return z(t)?t:t.contextElement}function at(t){let e=St(t);if(!N(e))return F(1);let n=e.getBoundingClientRect(),{width:i,height:o,$:s}=te(e),r=(s?ct(n.width):n.width)/i,a=(s?ct(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var Se=F(0);function ee(t){let e=P(t);return!bt()||!e.visualViewport?Se:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Le(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==P(t)?!1:e}function ot(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),s=St(t),r=F(1);e&&(i?z(i)&&(r=at(i)):r=at(t));let a=Le(s,n,i)?ee(s):F(0),c=(o.left+a.x)/r.x,l=(o.top+a.y)/r.y,f=o.width/r.x,h=o.height/r.y;if(s){let m=P(s),u=i&&z(i)?P(i):i,d=m,p=At(d);for(;p&&i&&u!==d;){let w=at(p),g=p.getBoundingClientRect(),y=M(p),v=g.left+(p.clientLeft+parseFloat(y.paddingLeft))*w.x,A=g.top+(p.clientTop+parseFloat(y.paddingTop))*w.y;c*=w.x,l*=w.y,f*=w.x,h*=w.y,c+=v,l+=A,d=P(p),p=At(d)}}return et({width:f,height:h,x:c,y:l})}function Lt(t,e){let n=ht(t).scrollLeft;return e?e.left+n:ot($(t)).left+n}function ne(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=i.left+e.scrollLeft-(n?0:Lt(t,i)),s=i.top+e.scrollTop;return{x:o,y:s}}function ze(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t,s=o==="fixed",r=$(i),a=e?ut(e.floating):!1;if(i===r||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=F(1),f=F(0),h=N(i);if((h||!h&&!s)&&((nt(i)!=="body"||st(r))&&(c=ht(i)),N(i))){let u=ot(i);l=at(i),f.x=u.x+i.clientLeft,f.y=u.y+i.clientTop}let m=r&&!h&&!s?ne(r,c,!0):F(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+f.x+m.x,y:n.y*l.y-c.scrollTop*l.y+f.y+m.y}}function Me(t){return Array.from(t.getClientRects())}function ke(t){let e=$(t),n=ht(t),i=t.ownerDocument.body,o=T(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=T(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),r=-n.scrollLeft+Lt(t),a=-n.scrollTop;return M(i).direction==="rtl"&&(r+=T(e.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:a}}function De(t,e){let n=P(t),i=$(t),o=n.visualViewport,s=i.clientWidth,r=i.clientHeight,a=0,c=0;if(o){s=o.width,r=o.height;let l=bt();(!l||l&&e==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:s,height:r,x:a,y:c}}var Be=new Set(["absolute","fixed"]);function Fe(t,e){let n=ot(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,s=N(t)?at(t):F(1),r=t.clientWidth*s.x,a=t.clientHeight*s.y,c=o*s.x,l=i*s.y;return{width:r,height:a,x:c,y:l}}function Qt(t,e,n){let i;if(e==="viewport")i=De(t,n);else if(e==="document")i=ke($(t));else if(z(e))i=Fe(e,n);else{let o=ee(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return et(i)}function ie(t,e){let n=X(t);return n===e||!z(n)||it(n)?!1:M(n).position==="fixed"||ie(n,e)}function $e(t,e){let n=e.get(t);if(n)return n;let i=rt(t,[],!1).filter(a=>z(a)&&nt(a)!=="body"),o=null,s=M(t).position==="fixed",r=s?X(t):t;for(;z(r)&&!it(r);){let a=M(r),c=vt(r);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&Be.has(o.position)||st(r)&&!c&&ie(t,r))?i=i.filter(f=>f!==r):o=a,r=X(r)}return e.set(t,i),i}function Ne(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t,r=[...n==="clippingAncestors"?ut(e)?[]:$e(e,this._c):[].concat(n),i],a=r[0],c=r.reduce((l,f)=>{let h=Qt(e,f,o);return l.top=T(h.top,l.top),l.right=_(h.right,l.right),l.bottom=_(h.bottom,l.bottom),l.left=T(h.left,l.left),l},Qt(e,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function He(t){let{width:e,height:n}=te(t);return{width:e,height:n}}function We(t,e,n){let i=N(e),o=$(e),s=n==="fixed",r=ot(t,!0,s,e),a={scrollLeft:0,scrollTop:0},c=F(0);function l(){c.x=Lt(o)}if(i||!i&&!s)if((nt(e)!=="body"||st(o))&&(a=ht(e)),i){let u=ot(e,!0,s,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop}else o&&l();s&&!i&&o&&l();let f=o&&!i&&!s?ne(o,a):F(0),h=r.left+a.scrollLeft-c.x-f.x,m=r.top+a.scrollTop-c.y-f.y;return{x:h,y:m,width:r.width,height:r.height}}function Pt(t){return M(t).position==="static"}function Zt(t,e){if(!N(t)||M(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){let n=P(t);if(ut(t))return n;if(!N(t)){let o=X(t);for(;o&&!it(o);){if(z(o)&&!Pt(o))return o;o=X(o)}return n}let i=Zt(t,e);for(;i&&Kt(i)&&Pt(i);)i=Zt(i,e);return i&&it(i)&&Pt(i)&&!vt(i)?n:i||Gt(t)||n}var Ve=async function(t){let e=this.getOffsetParent||oe,n=this.getDimensions,i=await n(t.floating);return{reference:We(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _e(t){return M(t).direction==="rtl"}var je={convertOffsetParentRelativeRectToViewportRelativeRect:ze,getDocumentElement:$,getClippingRect:Ne,getOffsetParent:oe,getElementRects:Ve,getClientRects:Me,getDimensions:He,getScale:at,isElement:z,isRTL:_e};function re(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ie(t,e){let n=null,i,o=$(t);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();let l=t.getBoundingClientRect(),{left:f,top:h,width:m,height:u}=l;if(a||e(),!m||!u)return;let d=ft(h),p=ft(o.clientWidth-(f+m)),w=ft(o.clientHeight-(h+u)),g=ft(f),v={rootMargin:-d+"px "+-p+"px "+-w+"px "+-g+"px",threshold:T(0,_(1,c))||1},A=!0;function O(k){let R=k[0].intersectionRatio;if(R!==c){if(!A)return r();R?r(!1,R):i=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!re(l,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(O,V(C({},v),{root:o.ownerDocument}))}catch(k){n=new IntersectionObserver(O,v)}n.observe(t)}return r(!0),s}function se(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=St(t),f=o||s?[...l?rt(l):[],...rt(e)]:[];f.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});let h=l&&a?Ie(l,n):null,m=-1,u=null;r&&(u=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(e)})),n()}),l&&!c&&u.observe(l),u.observe(e));let d,p=c?ot(t):null;c&&w();function w(){let g=ot(t);p&&!re(p,g)&&n(),p=g,d=requestAnimationFrame(w)}return n(),()=>{var g;f.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),h==null||h(),(g=u)==null||g.disconnect(),u=null,c&&cancelAnimationFrame(d)}}var ae=It;var le=Yt,ce=jt,zt=qt;var fe=_t;var ue=(t,e,n)=>{let i=new Map,o=C({platform:je},n),s=V(C({},o.platform),{_c:i});return Vt(t,e,V(C({},o),{platform:s}))};var x=class extends Rt{constructor(){super(...arguments);this.active=!1;this.placement="top";this.strategy="absolute";this.distance=0;this.skidding=0;this.arrow=!1;this.arrowPlacement="anchor";this.arrowPadding=10;this.flip=!1;this.flipFallbackPlacements="";this.flipFallbackStrategy="best-fit";this.flipPadding=0;this.shift=!1;this.shiftPadding=0;this.autoSizePadding=0}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start(),this.setupMutationObserver()}disconnectedCallback(){this.stop(),this.mutationObserver&&this.mutationObserver.disconnect()}async updated(n){super.updated(n),n.has("active")&&(this.active?this.start():this.stop()),n.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}setupMutationObserver(){this.mutationObserver=new MutationObserver(i=>this.handleCurrentPlacementChange(i));let n={attributes:!0};this.mutationObserver.observe(this,n)}handleCurrentPlacementChange(n){return n.forEach(i=>{if(i.attributeName==="data-current-placement"){let o=this.getAttribute("data-current-placement");this.emit("sd-current-placement",{detail:o})}})}async handleAnchorChange(){if(await this.stop(),this.anchor&&typeof this.anchor=="string"){let n=this.getRootNode();this.anchorEl=n.getElementById(this.anchor)}else this.anchor instanceof HTMLElement?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');if(this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),!this.anchorEl)throw new Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");this.start()}start(){this.anchorEl&&(this.cleanup=se(this.anchorEl,this.popup,()=>{this.reposition()}))}async stop(){return new Promise(n=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame(()=>n())):n()})}reposition(){if(!this.active||!this.anchorEl)return;let n=[ae({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?n.push(zt({apply:({rects:i})=>{let o=this.sync==="width"||this.sync==="both",s=this.sync==="height"||this.sync==="both";this.popup.style.width=o?`${i.reference.width}px`:"",this.popup.style.height=s?`${i.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&n.push(ce({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:this.flipFallbackStrategy==="best-fit"?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&n.push(le({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?n.push(zt({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:i,availableHeight:o})=>{this.autoSize==="vertical"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-height",`${o}px`):this.style.removeProperty("--auto-size-available-height"),this.autoSize==="horizontal"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-width",`${i}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&n.push(fe({element:this.arrowEl,padding:this.arrowPadding})),ue(this.anchorEl,this.popup,{placement:this.placement,middleware:n,strategy:this.strategy}).then(({x:i,y:o,middlewareData:s,placement:r})=>{let a=getComputedStyle(this).direction==="rtl",c={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];if(this.setAttribute("data-current-placement",r),Object.assign(this.popup.style,{left:`${i}px`,top:`${o}px`}),this.arrow){let l=s.arrow.x,f=s.arrow.y,h="",m="",u="",d="";if(this.arrowPlacement==="start"){let p=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";h=typeof f=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",m=a?p:"",d=a?"":p}else if(this.arrowPlacement==="end"){let p=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";m=a?"":p,d=a?p:"",u=typeof f=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else this.arrowPlacement==="center"?(d=typeof l=="number"?"calc(50% - var(--arrow-size-diagonal))":"",h=typeof f=="number"?"calc(50% - var(--arrow-size-diagonal))":""):(d=typeof l=="number"?`${l}px`:"",h=typeof f=="number"?`${f}px`:"");Object.assign(this.arrowEl.style,{top:h,right:m,bottom:u,left:d,[c]:"calc(var(--arrow-size-diagonal) * -1)"})}}),this.emit("sd-reposition")}render(){return Ot`<slot name="anchor" @slotchange="${this.handleAnchorChange}"></slot><div part="popup" class="${Dt("isolate",this.strategy!=="fixed"?"absolute":"fixed",!this.active&&"hidden")}"><slot></slot>${this.arrow?Ot`<div part="arrow" class="absolute rotate-45 -z-10" role="presentation"></div>`:""}</div>`}};x.styles=[...Rt.styles,Mt`:host{--arrow-color:var(--sd-color-neutral-1000);--arrow-size:6px;--arrow-size-diagonal:calc(var(--arrow-size)*0.7071);--arrow-padding-offset:calc(var(--arrow-size-diagonal) - var(--arrow-size));display:contents}[part=popup]{max-height:var(--auto-size-available-height,none);max-width:var(--auto-size-available-width,none)}[part=arrow]{background:var(--arrow-color);height:calc(var(--arrow-size-diagonal)*2);width:calc(var(--arrow-size-diagonal)*2)}`],b([Et('[part="popup"]')],x.prototype,"popup",2),b([Et('[part="arrow"]')],x.prototype,"arrowEl",2),b([E({reflect:!0})],x.prototype,"anchor",2),b([E({type:Boolean,reflect:!0})],x.prototype,"active",2),b([E({type:String,reflect:!0})],x.prototype,"placement",2),b([E({type:String,reflect:!0})],x.prototype,"strategy",2),b([E({type:Number,reflect:!0})],x.prototype,"distance",2),b([E({type:Number,reflect:!0})],x.prototype,"skidding",2),b([E({type:Boolean,reflect:!0})],x.prototype,"arrow",2),b([E({type:String,attribute:"arrow-placement",reflect:!0})],x.prototype,"arrowPlacement",2),b([E({attribute:"arrow-padding",type:Number,reflect:!0})],x.prototype,"arrowPadding",2),b([E({type:Boolean,reflect:!0})],x.prototype,"flip",2),b([E({attribute:"flip-fallback-placements",converter:{fromAttribute:n=>n.split(" ").map(i=>i.trim()).filter(i=>i!==""),toAttribute:n=>n.join(" ")}})],x.prototype,"flipFallbackPlacements",2),b([E({type:String,attribute:"flip-fallback-strategy"})],x.prototype,"flipFallbackStrategy",2),b([E({type:Object})],x.prototype,"flipBoundary",2),b([E({attribute:"flip-padding",type:Number})],x.prototype,"flipPadding",2),b([E({type:Boolean})],x.prototype,"shift",2),b([E({type:Object})],x.prototype,"shiftBoundary",2),b([E({attribute:"shift-padding",type:Number})],x.prototype,"shiftPadding",2),b([E({type:String,attribute:"auto-size"})],x.prototype,"autoSize",2),b([E()],x.prototype,"sync",2),b([E({type:Object})],x.prototype,"autoSizeBoundary",2),b([E({attribute:"auto-size-padding",type:Number})],x.prototype,"autoSizePadding",2),x=b([kt("sd-5-15-0-popup")],x);export{x as a};
1
+ import{a as Dt}from"./chunk.26V4EXHB.js";import{a as kt,b as E,d as Et,h as Rt}from"./chunk.2FN4O4QC.js";import{b as Mt,e as Ot}from"./chunk.ZR5P6TQI.js";import{a as C,b as V,c as dt,e as b}from"./chunk.TJOCV4DC.js";var _=Math.min,T=Math.max,ct=Math.round,ft=Math.floor,F=t=>({x:t,y:t}),de={left:"right",right:"left",bottom:"top",top:"bottom"},me={start:"end",end:"start"};function pt(t,e,n){return T(t,_(e,n))}function Z(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function tt(t){return t.split("-")[1]}function Ct(t){return t==="x"?"y":"x"}function gt(t){return t==="y"?"height":"width"}var pe=new Set(["top","bottom"]);function j(t){return pe.has(q(t))?"y":"x"}function wt(t){return Ct(j(t))}function $t(t,e,n){n===void 0&&(n=!1);let i=tt(t),o=wt(t),s=gt(o),r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=lt(r)),[r,lt(r)]}function Nt(t){let e=lt(t);return[mt(t),e,mt(e)]}function mt(t){return t.replace(/start|end/g,e=>me[e])}var Bt=["left","right"],Ft=["right","left"],ge=["top","bottom"],we=["bottom","top"];function ye(t,e,n){switch(t){case"top":case"bottom":return n?e?Ft:Bt:e?Bt:Ft;case"left":case"right":return e?ge:we;default:return[]}}function Ht(t,e,n,i){let o=tt(t),s=ye(q(t),n==="start",i);return o&&(s=s.map(r=>r+"-"+o),e&&(s=s.concat(s.map(mt)))),s}function lt(t){return t.replace(/left|right|bottom|top/g,e=>de[e])}function xe(t){return C({top:0,right:0,bottom:0,left:0},t)}function Tt(t){return typeof t!="number"?xe(t):{top:t,right:t,bottom:t,left:t}}function et(t){let{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Wt(t,e,n){let{reference:i,floating:o}=t,s=j(e),r=wt(e),a=gt(r),c=q(e),l=s==="y",f=i.x+i.width/2-o.width/2,h=i.y+i.height/2-o.height/2,m=i[a]/2-o[a]/2,u;switch(c){case"top":u={x:f,y:i.y-o.height};break;case"bottom":u={x:f,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:h};break;case"left":u={x:i.x-o.width,y:h};break;default:u={x:i.x,y:i.y}}switch(tt(e)){case"start":u[r]-=m*(n&&l?-1:1);break;case"end":u[r]+=m*(n&&l?-1:1);break}return u}var Vt=async(t,e,n)=>{let{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,a=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(e)),l=await r.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:h}=Wt(l,i,c),m=i,u={},d=0;for(let p=0;p<a.length;p++){let{name:w,fn:g}=a[p],{x:y,y:v,data:A,reset:O}=await g({x:f,y:h,initialPlacement:i,placement:m,strategy:o,middlewareData:u,rects:l,platform:r,elements:{reference:t,floating:e}});f=y!=null?y:f,h=v!=null?v:h,u=V(C({},u),{[w]:C(C({},u[w]),A)}),O&&d<=50&&(d++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(l=O.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:f,y:h}=Wt(l,m,c)),p=-1)}return{x:f,y:h,placement:m,strategy:o,middlewareData:u}};async function yt(t,e){var n;e===void 0&&(e={});let{x:i,y:o,platform:s,rects:r,elements:a,strategy:c}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:u=0}=Z(e,t),d=Tt(u),w=a[m?h==="floating"?"reference":"floating":h],g=et(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:c})),y=h==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),A=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},O=et(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:c}):y);return{top:(g.top-O.top+d.top)/A.y,bottom:(O.bottom-g.bottom+d.bottom)/A.y,left:(g.left-O.left+d.left)/A.x,right:(O.right-g.right+d.right)/A.x}}var _t=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:i,placement:o,rects:s,platform:r,elements:a,middlewareData:c}=e,{element:l,padding:f=0}=Z(t,e)||{};if(l==null)return{};let h=Tt(f),m={x:n,y:i},u=wt(o),d=gt(u),p=await r.getDimensions(l),w=u==="y",g=w?"top":"left",y=w?"bottom":"right",v=w?"clientHeight":"clientWidth",A=s.reference[d]+s.reference[u]-m[u]-s.floating[d],O=m[u]-s.reference[u],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l)),R=k?k[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(k)))&&(R=a.floating[v]||s.floating[d]);let I=A/2-O/2,H=R/2-p[d]/2-1,L=_(h[g],H),U=_(h[y],H),W=L,K=R-p[d]-U,S=R/2-p[d]/2+I,D=pt(W,S,K),J=!c.arrow&&tt(o)!=null&&S!==D&&s.reference[d]/2-(S<W?L:U)-p[d]/2<0,Y=J?S<W?S-W:S-K:0;return{[u]:m[u]+Y,data:C({[u]:D,centerOffset:S-D-Y},J&&{alignmentOffset:Y}),reset:J}}});var jt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;let{placement:o,middlewareData:s,rects:r,initialPlacement:a,platform:c,elements:l}=e,S=Z(t,e),{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:p=!0}=S,w=dt(S,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let g=q(o),y=j(a),v=q(a)===a,A=await(c.isRTL==null?void 0:c.isRTL(l.floating)),O=m||(v||!p?[lt(a)]:Nt(a)),k=d!=="none";!m&&k&&O.push(...Ht(a,p,d,A));let R=[a,...O],I=await yt(e,w),H=[],L=((i=s.flip)==null?void 0:i.overflows)||[];if(f&&H.push(I[g]),h){let D=$t(o,r,A);H.push(I[D[0]],I[D[1]])}if(L=[...L,{placement:o,overflows:H}],!H.every(D=>D<=0)){var U,W;let D=(((U=s.flip)==null?void 0:U.index)||0)+1,J=R[D];if(J&&(!(h==="alignment"?y!==j(J):!1)||L.every(B=>j(B.placement)===y?B.overflows[0]>0:!0)))return{data:{index:D,overflows:L},reset:{placement:J}};let Y=(W=L.filter(Q=>Q.overflows[0]<=0).sort((Q,B)=>Q.overflows[1]-B.overflows[1])[0])==null?void 0:W.placement;if(!Y)switch(u){case"bestFit":{var K;let Q=(K=L.filter(B=>{if(k){let G=j(B.placement);return G===y||G==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(G=>G>0).reduce((G,he)=>G+he,0)]).sort((B,G)=>B[1]-G[1])[0])==null?void 0:K[0];Q&&(Y=Q);break}case"initialPlacement":Y=a;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};var ve=new Set(["left","top"]);async function be(t,e){let{placement:n,platform:i,elements:o}=t,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),r=q(n),a=tt(n),c=j(n)==="y",l=ve.has(r)?-1:1,f=s&&c?-1:1,h=Z(e,t),{mainAxis:m,crossAxis:u,alignmentAxis:d}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof d=="number"&&(u=a==="end"?d*-1:d),c?{x:u*f,y:m*l}:{x:m*l,y:u*f}}var It=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;let{x:o,y:s,placement:r,middlewareData:a}=e,c=await be(e,t);return r===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:V(C({},c),{placement:r})}}}},Yt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:i,placement:o}=e,w=Z(t,e),{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:g=>{let{x:y,y:v}=g;return{x:y,y:v}}}}=w,c=dt(w,["mainAxis","crossAxis","limiter"]),l={x:n,y:i},f=await yt(e,c),h=j(q(o)),m=Ct(h),u=l[m],d=l[h];if(s){let g=m==="y"?"top":"left",y=m==="y"?"bottom":"right",v=u+f[g],A=u-f[y];u=pt(v,u,A)}if(r){let g=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=d+f[g],A=d-f[y];d=pt(v,d,A)}let p=a.fn(V(C({},e),{[m]:u,[h]:d}));return V(C({},p),{data:{x:p.x-n,y:p.y-i,enabled:{[m]:s,[h]:r}}})}}};var qt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;let{placement:o,rects:s,platform:r,elements:a}=e,L=Z(t,e),{apply:c=()=>{}}=L,l=dt(L,["apply"]),f=await yt(e,l),h=q(o),m=tt(o),u=j(o)==="y",{width:d,height:p}=s.floating,w,g;h==="top"||h==="bottom"?(w=h,g=m===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right"):(g=h,w=m==="end"?"top":"bottom");let y=p-f.top-f.bottom,v=d-f.left-f.right,A=_(p-f[w],y),O=_(d-f[g],v),k=!e.middlewareData.shift,R=A,I=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=v),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(R=y),k&&!m){let U=T(f.left,0),W=T(f.right,0),K=T(f.top,0),S=T(f.bottom,0);u?I=d-2*(U!==0||W!==0?U+W:T(f.left,f.right)):R=p-2*(K!==0||S!==0?K+S:T(f.top,f.bottom))}await c(V(C({},e),{availableWidth:I,availableHeight:R}));let H=await r.getDimensions(a.floating);return d!==H.width||p!==H.height?{reset:{rects:!0}}:{}}}};function xt(){return typeof window!="undefined"}function nt(t){return Ut(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $(t){var e;return(e=(Ut(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ut(t){return xt()?t instanceof Node||t instanceof P(t).Node:!1}function z(t){return xt()?t instanceof Element||t instanceof P(t).Element:!1}function N(t){return xt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Xt(t){return!xt()||typeof ShadowRoot=="undefined"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}var Ae=new Set(["inline","contents"]);function st(t){let{overflow:e,overflowX:n,overflowY:i,display:o}=M(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!Ae.has(o)}var Oe=new Set(["table","td","th"]);function Kt(t){return Oe.has(nt(t))}var Ee=[":popover-open",":modal"];function ut(t){return Ee.some(e=>{try{return t.matches(e)}catch(n){return!1}})}var Re=["transform","translate","scale","rotate","perspective"],Ce=["transform","translate","scale","rotate","perspective","filter"],Te=["paint","layout","strict","content"];function vt(t){let e=bt(),n=z(t)?M(t):t;return Re.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Ce.some(i=>(n.willChange||"").includes(i))||Te.some(i=>(n.contain||"").includes(i))}function Gt(t){let e=X(t);for(;N(e)&&!it(e);){if(vt(e))return e;if(ut(e))return null;e=X(e)}return null}function bt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Pe=new Set(["html","body","#document"]);function it(t){return Pe.has(nt(t))}function M(t){return P(t).getComputedStyle(t)}function ht(t){return z(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function X(t){if(nt(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Xt(t)&&t.host||$(t);return Xt(e)?e.host:e}function Jt(t){let e=X(t);return it(e)?t.ownerDocument?t.ownerDocument.body:t.body:N(e)&&st(e)?e:Jt(e)}function rt(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=Jt(t),s=o===((i=t.ownerDocument)==null?void 0:i.body),r=P(o);if(s){let a=At(r);return e.concat(r,r.visualViewport||[],st(o)?o:[],a&&n?rt(a):[])}return e.concat(o,rt(o,[],n))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function te(t){let e=M(t),n=parseFloat(e.width)||0,i=parseFloat(e.height)||0,o=N(t),s=o?t.offsetWidth:n,r=o?t.offsetHeight:i,a=ct(n)!==s||ct(i)!==r;return a&&(n=s,i=r),{width:n,height:i,$:a}}function St(t){return z(t)?t:t.contextElement}function at(t){let e=St(t);if(!N(e))return F(1);let n=e.getBoundingClientRect(),{width:i,height:o,$:s}=te(e),r=(s?ct(n.width):n.width)/i,a=(s?ct(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var Se=F(0);function ee(t){let e=P(t);return!bt()||!e.visualViewport?Se:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Le(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==P(t)?!1:e}function ot(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),s=St(t),r=F(1);e&&(i?z(i)&&(r=at(i)):r=at(t));let a=Le(s,n,i)?ee(s):F(0),c=(o.left+a.x)/r.x,l=(o.top+a.y)/r.y,f=o.width/r.x,h=o.height/r.y;if(s){let m=P(s),u=i&&z(i)?P(i):i,d=m,p=At(d);for(;p&&i&&u!==d;){let w=at(p),g=p.getBoundingClientRect(),y=M(p),v=g.left+(p.clientLeft+parseFloat(y.paddingLeft))*w.x,A=g.top+(p.clientTop+parseFloat(y.paddingTop))*w.y;c*=w.x,l*=w.y,f*=w.x,h*=w.y,c+=v,l+=A,d=P(p),p=At(d)}}return et({width:f,height:h,x:c,y:l})}function Lt(t,e){let n=ht(t).scrollLeft;return e?e.left+n:ot($(t)).left+n}function ne(t,e,n){n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=i.left+e.scrollLeft-(n?0:Lt(t,i)),s=i.top+e.scrollTop;return{x:o,y:s}}function ze(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t,s=o==="fixed",r=$(i),a=e?ut(e.floating):!1;if(i===r||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=F(1),f=F(0),h=N(i);if((h||!h&&!s)&&((nt(i)!=="body"||st(r))&&(c=ht(i)),N(i))){let u=ot(i);l=at(i),f.x=u.x+i.clientLeft,f.y=u.y+i.clientTop}let m=r&&!h&&!s?ne(r,c,!0):F(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+f.x+m.x,y:n.y*l.y-c.scrollTop*l.y+f.y+m.y}}function Me(t){return Array.from(t.getClientRects())}function ke(t){let e=$(t),n=ht(t),i=t.ownerDocument.body,o=T(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=T(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),r=-n.scrollLeft+Lt(t),a=-n.scrollTop;return M(i).direction==="rtl"&&(r+=T(e.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:a}}function De(t,e){let n=P(t),i=$(t),o=n.visualViewport,s=i.clientWidth,r=i.clientHeight,a=0,c=0;if(o){s=o.width,r=o.height;let l=bt();(!l||l&&e==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:s,height:r,x:a,y:c}}var Be=new Set(["absolute","fixed"]);function Fe(t,e){let n=ot(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,s=N(t)?at(t):F(1),r=t.clientWidth*s.x,a=t.clientHeight*s.y,c=o*s.x,l=i*s.y;return{width:r,height:a,x:c,y:l}}function Qt(t,e,n){let i;if(e==="viewport")i=De(t,n);else if(e==="document")i=ke($(t));else if(z(e))i=Fe(e,n);else{let o=ee(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return et(i)}function ie(t,e){let n=X(t);return n===e||!z(n)||it(n)?!1:M(n).position==="fixed"||ie(n,e)}function $e(t,e){let n=e.get(t);if(n)return n;let i=rt(t,[],!1).filter(a=>z(a)&&nt(a)!=="body"),o=null,s=M(t).position==="fixed",r=s?X(t):t;for(;z(r)&&!it(r);){let a=M(r),c=vt(r);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&Be.has(o.position)||st(r)&&!c&&ie(t,r))?i=i.filter(f=>f!==r):o=a,r=X(r)}return e.set(t,i),i}function Ne(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t,r=[...n==="clippingAncestors"?ut(e)?[]:$e(e,this._c):[].concat(n),i],a=r[0],c=r.reduce((l,f)=>{let h=Qt(e,f,o);return l.top=T(h.top,l.top),l.right=_(h.right,l.right),l.bottom=_(h.bottom,l.bottom),l.left=T(h.left,l.left),l},Qt(e,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function He(t){let{width:e,height:n}=te(t);return{width:e,height:n}}function We(t,e,n){let i=N(e),o=$(e),s=n==="fixed",r=ot(t,!0,s,e),a={scrollLeft:0,scrollTop:0},c=F(0);function l(){c.x=Lt(o)}if(i||!i&&!s)if((nt(e)!=="body"||st(o))&&(a=ht(e)),i){let u=ot(e,!0,s,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop}else o&&l();s&&!i&&o&&l();let f=o&&!i&&!s?ne(o,a):F(0),h=r.left+a.scrollLeft-c.x-f.x,m=r.top+a.scrollTop-c.y-f.y;return{x:h,y:m,width:r.width,height:r.height}}function Pt(t){return M(t).position==="static"}function Zt(t,e){if(!N(t)||M(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){let n=P(t);if(ut(t))return n;if(!N(t)){let o=X(t);for(;o&&!it(o);){if(z(o)&&!Pt(o))return o;o=X(o)}return n}let i=Zt(t,e);for(;i&&Kt(i)&&Pt(i);)i=Zt(i,e);return i&&it(i)&&Pt(i)&&!vt(i)?n:i||Gt(t)||n}var Ve=async function(t){let e=this.getOffsetParent||oe,n=this.getDimensions,i=await n(t.floating);return{reference:We(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _e(t){return M(t).direction==="rtl"}var je={convertOffsetParentRelativeRectToViewportRelativeRect:ze,getDocumentElement:$,getClippingRect:Ne,getOffsetParent:oe,getElementRects:Ve,getClientRects:Me,getDimensions:He,getScale:at,isElement:z,isRTL:_e};function re(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ie(t,e){let n=null,i,o=$(t);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();let l=t.getBoundingClientRect(),{left:f,top:h,width:m,height:u}=l;if(a||e(),!m||!u)return;let d=ft(h),p=ft(o.clientWidth-(f+m)),w=ft(o.clientHeight-(h+u)),g=ft(f),v={rootMargin:-d+"px "+-p+"px "+-w+"px "+-g+"px",threshold:T(0,_(1,c))||1},A=!0;function O(k){let R=k[0].intersectionRatio;if(R!==c){if(!A)return r();R?r(!1,R):i=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!re(l,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(O,V(C({},v),{root:o.ownerDocument}))}catch(k){n=new IntersectionObserver(O,v)}n.observe(t)}return r(!0),s}function se(t,e,n,i){i===void 0&&(i={});let{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=St(t),f=o||s?[...l?rt(l):[],...rt(e)]:[];f.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});let h=l&&a?Ie(l,n):null,m=-1,u=null;r&&(u=new ResizeObserver(g=>{let[y]=g;y&&y.target===l&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(e)})),n()}),l&&!c&&u.observe(l),u.observe(e));let d,p=c?ot(t):null;c&&w();function w(){let g=ot(t);p&&!re(p,g)&&n(),p=g,d=requestAnimationFrame(w)}return n(),()=>{var g;f.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),h==null||h(),(g=u)==null||g.disconnect(),u=null,c&&cancelAnimationFrame(d)}}var ae=It;var le=Yt,ce=jt,zt=qt;var fe=_t;var ue=(t,e,n)=>{let i=new Map,o=C({platform:je},n),s=V(C({},o.platform),{_c:i});return Vt(t,e,V(C({},o),{platform:s}))};var x=class extends Rt{constructor(){super(...arguments);this.active=!1;this.placement="top";this.strategy="absolute";this.distance=0;this.skidding=0;this.arrow=!1;this.arrowPlacement="anchor";this.arrowPadding=10;this.flip=!1;this.flipFallbackPlacements="";this.flipFallbackStrategy="best-fit";this.flipPadding=0;this.shift=!1;this.shiftPadding=0;this.autoSizePadding=0}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start(),this.setupMutationObserver()}disconnectedCallback(){this.stop(),this.mutationObserver&&this.mutationObserver.disconnect()}async updated(n){super.updated(n),n.has("active")&&(this.active?this.start():this.stop()),n.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}setupMutationObserver(){this.mutationObserver=new MutationObserver(i=>this.handleCurrentPlacementChange(i));let n={attributes:!0};this.mutationObserver.observe(this,n)}handleCurrentPlacementChange(n){return n.forEach(i=>{if(i.attributeName==="data-current-placement"){let o=this.getAttribute("data-current-placement");this.emit("sd-current-placement",{detail:o})}})}async handleAnchorChange(){if(await this.stop(),this.anchor&&typeof this.anchor=="string"){let n=this.getRootNode();this.anchorEl=n.getElementById(this.anchor)}else this.anchor instanceof HTMLElement?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');if(this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),!this.anchorEl)throw new Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");this.start()}start(){this.anchorEl&&(this.cleanup=se(this.anchorEl,this.popup,()=>{this.reposition()}))}async stop(){return new Promise(n=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame(()=>n())):n()})}reposition(){if(!this.active||!this.anchorEl)return;let n=[ae({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?n.push(zt({apply:({rects:i})=>{let o=this.sync==="width"||this.sync==="both",s=this.sync==="height"||this.sync==="both";this.popup.style.width=o?`${i.reference.width}px`:"",this.popup.style.height=s?`${i.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&n.push(ce({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:this.flipFallbackStrategy==="best-fit"?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&n.push(le({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?n.push(zt({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:i,availableHeight:o})=>{this.autoSize==="vertical"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-height",`${o}px`):this.style.removeProperty("--auto-size-available-height"),this.autoSize==="horizontal"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-width",`${i}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&n.push(fe({element:this.arrowEl,padding:this.arrowPadding})),ue(this.anchorEl,this.popup,{placement:this.placement,middleware:n,strategy:this.strategy}).then(({x:i,y:o,middlewareData:s,placement:r})=>{let a=getComputedStyle(this).direction==="rtl",c={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];if(this.setAttribute("data-current-placement",r),Object.assign(this.popup.style,{left:`${i}px`,top:`${o}px`}),this.arrow){let l=s.arrow.x,f=s.arrow.y,h="",m="",u="",d="";if(this.arrowPlacement==="start"){let p=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";h=typeof f=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",m=a?p:"",d=a?"":p}else if(this.arrowPlacement==="end"){let p=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";m=a?"":p,d=a?p:"",u=typeof f=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else this.arrowPlacement==="center"?(d=typeof l=="number"?"calc(50% - var(--arrow-size-diagonal))":"",h=typeof f=="number"?"calc(50% - var(--arrow-size-diagonal))":""):(d=typeof l=="number"?`${l}px`:"",h=typeof f=="number"?`${f}px`:"");Object.assign(this.arrowEl.style,{top:h,right:m,bottom:u,left:d,[c]:"calc(var(--arrow-size-diagonal) * -1)"})}}),this.emit("sd-reposition")}render(){return Ot`<slot name="anchor" @slotchange="${this.handleAnchorChange}"></slot><div part="popup" class="${Dt("isolate",this.strategy!=="fixed"?"absolute":"fixed",!this.active&&"hidden")}"><slot></slot>${this.arrow?Ot`<div part="arrow" class="absolute rotate-45 -z-10" role="presentation"></div>`:""}</div>`}};x.styles=[...Rt.styles,Mt`:host{--arrow-color:var(--sd-color-neutral-1000);--arrow-size:6px;--arrow-size-diagonal:calc(var(--arrow-size)*0.7071);--arrow-padding-offset:calc(var(--arrow-size-diagonal) - var(--arrow-size));display:contents}[part=popup]{max-height:var(--auto-size-available-height,none);max-width:var(--auto-size-available-width,none)}[part=arrow]{background:var(--arrow-color);height:calc(var(--arrow-size-diagonal)*2);width:calc(var(--arrow-size-diagonal)*2)}`],b([Et('[part="popup"]')],x.prototype,"popup",2),b([Et('[part="arrow"]')],x.prototype,"arrowEl",2),b([E({reflect:!0})],x.prototype,"anchor",2),b([E({type:Boolean,reflect:!0})],x.prototype,"active",2),b([E({type:String,reflect:!0})],x.prototype,"placement",2),b([E({type:String,reflect:!0})],x.prototype,"strategy",2),b([E({type:Number,reflect:!0})],x.prototype,"distance",2),b([E({type:Number,reflect:!0})],x.prototype,"skidding",2),b([E({type:Boolean,reflect:!0})],x.prototype,"arrow",2),b([E({type:String,attribute:"arrow-placement",reflect:!0})],x.prototype,"arrowPlacement",2),b([E({attribute:"arrow-padding",type:Number,reflect:!0})],x.prototype,"arrowPadding",2),b([E({type:Boolean,reflect:!0})],x.prototype,"flip",2),b([E({attribute:"flip-fallback-placements",converter:{fromAttribute:n=>n.split(" ").map(i=>i.trim()).filter(i=>i!==""),toAttribute:n=>n.join(" ")}})],x.prototype,"flipFallbackPlacements",2),b([E({type:String,attribute:"flip-fallback-strategy"})],x.prototype,"flipFallbackStrategy",2),b([E({type:Object})],x.prototype,"flipBoundary",2),b([E({attribute:"flip-padding",type:Number})],x.prototype,"flipPadding",2),b([E({type:Boolean})],x.prototype,"shift",2),b([E({type:Object})],x.prototype,"shiftBoundary",2),b([E({attribute:"shift-padding",type:Number})],x.prototype,"shiftPadding",2),b([E({type:String,attribute:"auto-size"})],x.prototype,"autoSize",2),b([E()],x.prototype,"sync",2),b([E({type:Object})],x.prototype,"autoSizeBoundary",2),b([E({attribute:"auto-size-padding",type:Number})],x.prototype,"autoSizePadding",2),x=b([kt("sd-5-15-2-popup")],x);export{x as a};
@@ -1 +1 @@
1
- import{a as T}from"./chunk.MHWW3RZB.js";import{c as b}from"./chunk.3L472FD4.js";import{a as u}from"./chunk.GLVMB2MH.js";import{a as c}from"./chunk.26V4EXHB.js";import{a as w}from"./chunk.Y7NVH75J.js";import{a as g,b as y,c as v,d as h,h as f}from"./chunk.2FN4O4QC.js";import{b as m,e as d}from"./chunk.ZR5P6TQI.js";import{a as p,e as l}from"./chunk.TJOCV4DC.js";var a=class extends f{constructor(){super(...arguments);this.localize=new w(this);this.tabs=[];this.panels=[];this.hasScrollControls=!1;this.variant="default";this.canScroll={left:!1,right:!1};this.activation="auto"}connectedCallback(){let t=Promise.all([customElements.whenDefined("sd-5-15-0-tab"),customElements.whenDefined("sd-5-15-0-tab-panel")]);super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>{this.updateScrollControls(),this.repositionIndicator()}),this.mutationObserver=new MutationObserver(s=>{s.some(e=>!["aria-labelledby","aria-controls"].includes(e.attributeName))&&setTimeout(()=>this.setAriaLabels()),s.some(e=>e.attributeName==="disabled")&&this.syncTabsAndPanels()}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav),this.handleScroll(),this.nav.addEventListener("scroll",()=>this.handleScroll()),t.then(()=>{new IntersectionObserver((e,o)=>{var i;e[0].intersectionRatio>0&&(this.setAriaLabels(),this.setActiveTab((i=this.activeTab)!=null?i:this.tabs[0],{emitEvents:!1}),o.unobserve(e[0].target))}).observe(this.tabGroup)})})}disconnectedCallback(){var t;this.mutationObserver.disconnect(),this.nav&&((t=this.resizeObserver)==null||t.unobserve(this.nav))}getAllTabs(t={includeDisabled:!0}){let s=this.shadowRoot.querySelector('slot[name="nav"]');return Array.from(s.assignedElements()).map(e=>e.tagName.toLocaleLowerCase()==="sd-5-15-0-tab"?e:e.querySelector("sd-5-15-0-tab")).filter(e=>e&&t.includeDisabled?e.tagName.toLowerCase()==="sd-5-15-0-tab":e.tagName.toLowerCase()==="sd-5-15-0-tab"&&!e.disabled)}getAllPanels(){return[...this.body.assignedElements()].filter(t=>t.tagName.toLowerCase()==="sd-5-15-0-tab-panel")}getActiveTab(){return this.tabs.find(t=>t.matches(":focus"))}handleClick(t){let e=t.target.closest("sd-5-15-0-tab");(e==null?void 0:e.closest("sd-5-15-0-tab-group"))===this&&e!==null&&this.setActiveTab(e,{scrollBehavior:"smooth"})}handleKeyDown(t){let e=t.target.closest("sd-5-15-0-tab");if((e==null?void 0:e.closest("sd-5-15-0-tab-group"))===this){if(["Enter"," "].includes(t.key)&&e!==null&&(this.setActiveTab(e,{scrollBehavior:"smooth"}),t.preventDefault()),["Tab"].includes(t.key)){let i=this.tabs.indexOf(this.getActiveTab()),n=this.tabs[i+1];e!==null&&n&&b(n,this.nav,"horizontal")}if(["Shift","Tab"].includes(t.key)){let i=this.tabs.indexOf(this.getActiveTab()),n=this.tabs[i-1];e!==null&&n&&b(n,this.nav,"horizontal")}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){let i=this.tabs.find(r=>r.matches(":focus")),n=this.localize.dir()==="rtl";if((i==null?void 0:i.tagName.toLowerCase())==="sd-5-15-0-tab"){let r=this.tabs.indexOf(i);t.key==="Home"?r=0:t.key==="End"?r=this.tabs.length-1:t.key===(n?"ArrowRight":"ArrowLeft")||t.key==="ArrowUp"?r--:(t.key===(n?"ArrowLeft":"ArrowRight")||t.key==="ArrowDown")&&r++,r<0&&(r=this.tabs.length-1),r>this.tabs.length-1&&(r=0),this.tabs[r].focus({preventScroll:!0}),this.activation==="auto"&&this.setActiveTab(this.tabs[r],{scrollBehavior:"smooth"}),b(this.tabs[r],this.nav,"horizontal"),t.preventDefault()}}}}handleScroll(){this.canScroll={left:this.nav.scrollLeft>0,right:this.nav.scrollLeft+this.nav.clientWidth<this.nav.scrollWidth-1}}handleScrollToStart(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(t,s){if(s=p({emitEvents:!0,scrollBehavior:"auto"},s),t!==this.activeTab&&!t.disabled&&!t.visuallyDisabled){let e=this.activeTab;this.activeTab=t,this.tabs.map(o=>o.active=o===this.activeTab),this.panels.map(o=>{var i;return o.active=o.name===((i=this.activeTab)==null?void 0:i.panel)}),this.repositionIndicator(),b(this.activeTab,this.nav,"horizontal",s.scrollBehavior),s.emitEvents&&(e&&this.emit("sd-tab-hide",{detail:{name:e.panel}}),this.emit("sd-tab-show",{detail:{name:this.activeTab.panel}}))}}setAriaLabels(){this.tabs.forEach(t=>{let s=this.panels.find(e=>e.name===t.panel);s&&t.setAttribute("aria-controls",s.getAttribute("id"))})}syncTabsAndPanels(){this.tabs=this.getAllTabs({includeDisabled:!1}),this.panels=this.getAllPanels(),this.repositionIndicator(),this.panels.forEach(t=>{t.tabIndex=0}),this.updateComplete.then(()=>this.updateScrollControls()),this.tabs.length!==0&&this.tabs[0].variant==="container"&&(this.variant="container")}updateScrollControls(){this.hasScrollControls=this.nav.scrollWidth>this.nav.clientWidth}async repositionIndicator(){await this.updateComplete;let t=this.activeTab,s=this.indicator,e=this.tabsContainer;if(!t||!s||!e||t.variant==="container")return;let o=t.getBoundingClientRect(),i=e.getBoundingClientRect(),n=getComputedStyle(e).justifyContent==="center",r=i.left+i.width/2,A=o.left+o.width/2,x=t.offsetWidth,C=n?A-r:o.left-i.left;s.style.width=`${x}px`,s.style.transform=`translateX(${C}px)`}show(t){let s=this.tabs.find(e=>e.panel===t);s&&this.setActiveTab(s,{scrollBehavior:"smooth"})}render(){var s;let t=this.localize.dir()==="rtl";return d`<div part="base" class="${c("flex flex-col rounded-none")}" @click="${this.handleClick}" @keydown="${this.handleKeyDown}"><div part="nav" class="${c(this.hasScrollControls&&"relative py-0 px-12")}">${this.hasScrollControls?d`<button part="scroll-button--start" exportparts="base:scroll-button__base" tabindex="-1" aria-hidden="true" disabled="${u(!this.canScroll.left||void 0)}" class="${c("sd-interactive flex items-center justify-center absolute top-0 bottom-0 left-0 !outline-offset-0 border-b border-neutral-400 z-10",this.localize.dir()==="rtl"&&"left-auto right-0")}" @click="${this.handleScrollToStart}"><sd-5-15-0-icon library="_internal" name="${t?"chevron-up":"chevron-down"}" label="previous" class="${c("h-6 w-12 rotate-90 grid place-items-center")}"></sd-5-15-0-icon></button>`:""}<div part="scroll-container" class="flex overflow-x-auto focus-visible:focus-outline !outline-offset-0"><div part="tabs" class="${c("flex flex-auto relative flex-row")}" role="tablist">${((s=this.activeTab)==null?void 0:s.variant)!=="container"?d`<div part="active-tab-indicator" id="indicator" class="absolute h-1 bg-accent bottom-0 transition-[transform,width] duration-medium ease-in-out z-30"></div>`:""}<div part="separation" class="border-neutral-400 absolute w-full h-0.25 bottom-0 border-b z-10"></div><slot name="nav" @slotchange="${this.syncTabsAndPanels}"></slot></div></div>${this.hasScrollControls?d`<button part="scroll-button--end" exportparts="base:scroll-button__base" tabindex="-1" aria-hidden="true" disabled="${u(!this.canScroll.right||void 0)}" class="${c("sd-interactive flex items-center justify-center absolute top-0 bottom-0 right-0 !outline-offset-0 border-b border-neutral-400 z-10",this.localize.dir()==="rtl"&&"right-auto left-0")}" @click="${this.handleScrollToEnd}"><sd-5-15-0-icon library="_internal" name="${t?"chevron-down":"chevron-up"}" label="next" class="${c("h-6 w-12 rotate-90 grid place-items-center")}"></sd-5-15-0-icon></button>`:""}</div><slot part="body" class="${c("block auto py-8 px-6",this.variant==="container"&&"border border-neutral-400 border-t-0")}" @slotchange="${this.syncTabsAndPanels}"></slot></div>`}};a.styles=[...f.styles,m`:host{box-sizing:border-box;display:block}[part=scroll-container]{scrollbar-width:none}[part=scroll-container]::-webkit-scrollbar{height:var(--sd-spacing-0,0);width:var(--sd-spacing-0,0)}::slotted(sd-5-15-0-tab-panel){--padding:1rem 0}::slotted(sd-5-15-0-tab-panel:focus-visible){outline-color:rgb(var(--sd-color-primary,0 53 142)/1);outline-offset:2px;outline-style:solid;outline-width:2px}`],l([h("[part=base]")],a.prototype,"tabGroup",2),l([h("[part=body]")],a.prototype,"body",2),l([h("[part=scroll-container]")],a.prototype,"nav",2),l([h("[part=active-tab-indicator]")],a.prototype,"indicator",2),l([h('[part="tabs"]')],a.prototype,"tabsContainer",2),l([v()],a.prototype,"hasScrollControls",2),l([v()],a.prototype,"variant",2),l([v()],a.prototype,"canScroll",2),l([y({type:String,reflect:!0})],a.prototype,"activation",2),l([T(20)],a.prototype,"handleScroll",1),a=l([g("sd-5-15-0-tab-group")],a);export{a};
1
+ import{a as T}from"./chunk.MHWW3RZB.js";import{c as b}from"./chunk.3L472FD4.js";import{a as u}from"./chunk.GLVMB2MH.js";import{a as c}from"./chunk.26V4EXHB.js";import{a as w}from"./chunk.Y7NVH75J.js";import{a as g,b as y,c as v,d as h,h as f}from"./chunk.2FN4O4QC.js";import{b as m,e as d}from"./chunk.ZR5P6TQI.js";import{a as p,e as l}from"./chunk.TJOCV4DC.js";var a=class extends f{constructor(){super(...arguments);this.localize=new w(this);this.tabs=[];this.panels=[];this.hasScrollControls=!1;this.variant="default";this.canScroll={left:!1,right:!1};this.activation="auto"}connectedCallback(){let t=Promise.all([customElements.whenDefined("sd-5-15-2-tab"),customElements.whenDefined("sd-5-15-2-tab-panel")]);super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>{this.updateScrollControls(),this.repositionIndicator()}),this.mutationObserver=new MutationObserver(s=>{s.some(e=>!["aria-labelledby","aria-controls"].includes(e.attributeName))&&setTimeout(()=>this.setAriaLabels()),s.some(e=>e.attributeName==="disabled")&&this.syncTabsAndPanels()}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav),this.handleScroll(),this.nav.addEventListener("scroll",()=>this.handleScroll()),t.then(()=>{new IntersectionObserver((e,o)=>{var i;e[0].intersectionRatio>0&&(this.setAriaLabels(),this.setActiveTab((i=this.activeTab)!=null?i:this.tabs[0],{emitEvents:!1}),o.unobserve(e[0].target))}).observe(this.tabGroup)})})}disconnectedCallback(){var t;this.mutationObserver.disconnect(),this.nav&&((t=this.resizeObserver)==null||t.unobserve(this.nav))}getAllTabs(t={includeDisabled:!0}){let s=this.shadowRoot.querySelector('slot[name="nav"]');return Array.from(s.assignedElements()).map(e=>e.tagName.toLocaleLowerCase()==="sd-5-15-2-tab"?e:e.querySelector("sd-5-15-2-tab")).filter(e=>e&&t.includeDisabled?e.tagName.toLowerCase()==="sd-5-15-2-tab":e.tagName.toLowerCase()==="sd-5-15-2-tab"&&!e.disabled)}getAllPanels(){return[...this.body.assignedElements()].filter(t=>t.tagName.toLowerCase()==="sd-5-15-2-tab-panel")}getActiveTab(){return this.tabs.find(t=>t.matches(":focus"))}handleClick(t){let e=t.target.closest("sd-5-15-2-tab");(e==null?void 0:e.closest("sd-5-15-2-tab-group"))===this&&e!==null&&this.setActiveTab(e,{scrollBehavior:"smooth"})}handleKeyDown(t){let e=t.target.closest("sd-5-15-2-tab");if((e==null?void 0:e.closest("sd-5-15-2-tab-group"))===this){if(["Enter"," "].includes(t.key)&&e!==null&&(this.setActiveTab(e,{scrollBehavior:"smooth"}),t.preventDefault()),["Tab"].includes(t.key)){let i=this.tabs.indexOf(this.getActiveTab()),n=this.tabs[i+1];e!==null&&n&&b(n,this.nav,"horizontal")}if(["Shift","Tab"].includes(t.key)){let i=this.tabs.indexOf(this.getActiveTab()),n=this.tabs[i-1];e!==null&&n&&b(n,this.nav,"horizontal")}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){let i=this.tabs.find(r=>r.matches(":focus")),n=this.localize.dir()==="rtl";if((i==null?void 0:i.tagName.toLowerCase())==="sd-5-15-2-tab"){let r=this.tabs.indexOf(i);t.key==="Home"?r=0:t.key==="End"?r=this.tabs.length-1:t.key===(n?"ArrowRight":"ArrowLeft")||t.key==="ArrowUp"?r--:(t.key===(n?"ArrowLeft":"ArrowRight")||t.key==="ArrowDown")&&r++,r<0&&(r=this.tabs.length-1),r>this.tabs.length-1&&(r=0),this.tabs[r].focus({preventScroll:!0}),this.activation==="auto"&&this.setActiveTab(this.tabs[r],{scrollBehavior:"smooth"}),b(this.tabs[r],this.nav,"horizontal"),t.preventDefault()}}}}handleScroll(){this.canScroll={left:this.nav.scrollLeft>0,right:this.nav.scrollLeft+this.nav.clientWidth<this.nav.scrollWidth-1}}handleScrollToStart(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(t,s){if(s=p({emitEvents:!0,scrollBehavior:"auto"},s),t!==this.activeTab&&!t.disabled&&!t.visuallyDisabled){let e=this.activeTab;this.activeTab=t,this.tabs.map(o=>o.active=o===this.activeTab),this.panels.map(o=>{var i;return o.active=o.name===((i=this.activeTab)==null?void 0:i.panel)}),this.repositionIndicator(),b(this.activeTab,this.nav,"horizontal",s.scrollBehavior),s.emitEvents&&(e&&this.emit("sd-tab-hide",{detail:{name:e.panel}}),this.emit("sd-tab-show",{detail:{name:this.activeTab.panel}}))}}setAriaLabels(){this.tabs.forEach(t=>{let s=this.panels.find(e=>e.name===t.panel);s&&t.setAttribute("aria-controls",s.getAttribute("id"))})}syncTabsAndPanels(){this.tabs=this.getAllTabs({includeDisabled:!1}),this.panels=this.getAllPanels(),this.repositionIndicator(),this.panels.forEach(t=>{t.tabIndex=0}),this.updateComplete.then(()=>this.updateScrollControls()),this.tabs.length!==0&&this.tabs[0].variant==="container"&&(this.variant="container")}updateScrollControls(){this.hasScrollControls=this.nav.scrollWidth>this.nav.clientWidth}async repositionIndicator(){await this.updateComplete;let t=this.activeTab,s=this.indicator,e=this.tabsContainer;if(!t||!s||!e||t.variant==="container")return;let o=t.getBoundingClientRect(),i=e.getBoundingClientRect(),n=getComputedStyle(e).justifyContent==="center",r=i.left+i.width/2,A=o.left+o.width/2,x=t.offsetWidth,C=n?A-r:o.left-i.left;s.style.width=`${x}px`,s.style.transform=`translateX(${C}px)`}show(t){let s=this.tabs.find(e=>e.panel===t);s&&this.setActiveTab(s,{scrollBehavior:"smooth"})}render(){var s;let t=this.localize.dir()==="rtl";return d`<div part="base" class="${c("flex flex-col rounded-none")}" @click="${this.handleClick}" @keydown="${this.handleKeyDown}"><div part="nav" class="${c(this.hasScrollControls&&"relative py-0 px-12")}">${this.hasScrollControls?d`<button part="scroll-button--start" exportparts="base:scroll-button__base" tabindex="-1" aria-hidden="true" disabled="${u(!this.canScroll.left||void 0)}" class="${c("sd-interactive flex items-center justify-center absolute top-0 bottom-0 left-0 !outline-offset-0 border-b border-neutral-400 z-10",this.localize.dir()==="rtl"&&"left-auto right-0")}" @click="${this.handleScrollToStart}"><sd-5-15-2-icon library="_internal" name="${t?"chevron-up":"chevron-down"}" label="previous" class="${c("h-6 w-12 rotate-90 grid place-items-center")}"></sd-5-15-2-icon></button>`:""}<div part="scroll-container" class="flex overflow-x-auto focus-visible:focus-outline !outline-offset-0"><div part="tabs" class="${c("flex flex-auto relative flex-row")}" role="tablist">${((s=this.activeTab)==null?void 0:s.variant)!=="container"?d`<div part="active-tab-indicator" id="indicator" class="absolute h-1 bg-accent bottom-0 transition-[transform,width] duration-medium ease-in-out z-30"></div>`:""}<div part="separation" class="border-neutral-400 absolute w-full h-0.25 bottom-0 border-b z-10"></div><slot name="nav" @slotchange="${this.syncTabsAndPanels}"></slot></div></div>${this.hasScrollControls?d`<button part="scroll-button--end" exportparts="base:scroll-button__base" tabindex="-1" aria-hidden="true" disabled="${u(!this.canScroll.right||void 0)}" class="${c("sd-interactive flex items-center justify-center absolute top-0 bottom-0 right-0 !outline-offset-0 border-b border-neutral-400 z-10",this.localize.dir()==="rtl"&&"right-auto left-0")}" @click="${this.handleScrollToEnd}"><sd-5-15-2-icon library="_internal" name="${t?"chevron-down":"chevron-up"}" label="next" class="${c("h-6 w-12 rotate-90 grid place-items-center")}"></sd-5-15-2-icon></button>`:""}</div><slot part="body" class="${c("block auto py-8 px-6",this.variant==="container"&&"border border-neutral-400 border-t-0")}" @slotchange="${this.syncTabsAndPanels}"></slot></div>`}};a.styles=[...f.styles,m`:host{box-sizing:border-box;display:block}[part=scroll-container]{scrollbar-width:none}[part=scroll-container]::-webkit-scrollbar{height:var(--sd-spacing-0,0);width:var(--sd-spacing-0,0)}::slotted(sd-5-15-2-tab-panel){--padding:1rem 0}::slotted(sd-5-15-2-tab-panel:focus-visible){outline-color:rgb(var(--sd-color-primary,0 53 142)/1);outline-offset:2px;outline-style:solid;outline-width:2px}`],l([h("[part=base]")],a.prototype,"tabGroup",2),l([h("[part=body]")],a.prototype,"body",2),l([h("[part=scroll-container]")],a.prototype,"nav",2),l([h("[part=active-tab-indicator]")],a.prototype,"indicator",2),l([h('[part="tabs"]')],a.prototype,"tabsContainer",2),l([v()],a.prototype,"hasScrollControls",2),l([v()],a.prototype,"variant",2),l([v()],a.prototype,"canScroll",2),l([y({type:String,reflect:!0})],a.prototype,"activation",2),l([T(20)],a.prototype,"handleScroll",1),a=l([g("sd-5-15-2-tab-group")],a);export{a};
@@ -1 +1 @@
1
- import{a as p,b as c,c as _}from"./chunk.IVHEBGOY.js";import{a as A}from"./chunk.RTXVVB2O.js";import{b as E}from"./chunk.7JV32P5Q.js";import{a as M}from"./chunk.CGQ2BPPZ.js";import{a as b}from"./chunk.GLVMB2MH.js";import{a as m}from"./chunk.26V4EXHB.js";import{a as w}from"./chunk.Y7NVH75J.js";import{a as C,b as h,d as f,e as D,h as T}from"./chunk.2FN4O4QC.js";import{b as I,e as v}from"./chunk.ZR5P6TQI.js";import{e as n}from"./chunk.TJOCV4DC.js";var l=class extends T{constructor(){super();this.formControlController=new E(this);this.hasSlotController=new M(this,"label","help-text");this.localize=new w(this);this.name="";this.label="";this.helpText="";this.min=0;this.max=100;this.step=1;this.disabled=!1;this.visuallyDisabled=!1;this.noTrackBar=!1;this.noTooltip=!1;this.defaultValue="";this._value=[0];this._rangeValues=new Map;this._lastChangeValue=[];this._hasFocus=!1;this.tooltipFormatter=this.localize.number.bind(this.localize)}set value(e){this._value=e?e.split(" ").map(Number).sort(p):[]}get value(){return this._value.slice().sort(p).join(" ")}set valueAsArray(e){let t=this._value;this._value=Array.isArray(e)?e.slice().sort(p):e||[],c(t,this._value)&&this.requestUpdate("value",t.join(" "))}get valueAsArray(){return[...this._value].sort(p)}get rtl(){return this.localize.dir()==="rtl"}firstUpdated(){this.formControlController.updateValidity(),this._lastChangeValue=Array.from(this._value)}willUpdate(e){super.willUpdate(e),this.min>this.max&&([this.min,this.max]=[this.max,this.min]),this.step>this.max-this.min&&(this.step=this.max-this.min),this.step<=0&&(this.step=1);let t=this._value.map(i=>{if(i<=this.min)return this.min;if(i>=this.max)return this.max;let a=this.min+this.step*Math.round((i-this.min)/this.step);return a>this.max?this.max:a});c(this._value,t)&&(this._value=t)}updated(e){super.updated(e);for(let t of this.thumbs){let i=+t.dataset.rangeId;this._rangeValues.has(i)&&this.moveThumb(t,this._rangeValues.get(i))}this.updateActiveTrack()}focus(e){let t=this.thumbs.item(0);t?t.focus(e):super.focus(e)}get validity(){return this.input.validity}checkValidity(){var e;return(e=this.input)==null?void 0:e.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(e){this.input.setCustomValidity(e),this.formControlController.updateValidity()}updateTooltip(e){let t=+e.dataset.rangeId;if(!this._rangeValues.has(t))return;let i=this._rangeValues.get(t),a=e.parentElement;a.content=this.tooltipFormatter(i)}updateActiveTrack(){let{activeTrack:e}=this;if(!e)return;if(this.min===this.max){e.style.insetInlineStart="0%",e.style.insetInlineEnd="0%";return}if(this._value.length===1){let s=getComputedStyle(this).getPropertyValue("--track-active-offset")||"0%",o=100*(this._value[0]-this.min)/(this.max-this.min);e.style.insetInlineStart=`min(${s}, ${o}%)`,e.style.insetInlineEnd=`min(calc(100% - ${s}), calc(100% - ${o}%))`;return}let t=this._value.slice().sort(p),i=100*(t[0]-this.min)/(this.max-this.min),a=100*(t[t.length-1]-this.min)/(this.max-this.min);e.style.insetInlineStart=`${i}%`,e.style.insetInlineEnd=`calc(100% - ${a}%)`}moveThumb(e,t){e.setAttribute("aria-valuenow",t.toString()),e.setAttribute("aria-valuetext",this.tooltipFormatter(t));let i=(t-this.min)/(this.max-this.min);e.style.insetInlineStart=`calc(${100*i}% - 8px)`,this.updateTooltip(e)}movementBoundariesForThumb(e,t){let i=this.valueAsArray,s=Array.from(this.thumbs).indexOf(e),o=i[s-1]||this.min,r=i[s+1]||this.max,u=t<o||t>r;return{finalValue:Math.max(o,Math.min(r,t)),isRestricted:u,nextValue:r,prevValue:o}}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}onClickTrack(e,t=!0){if(this.disabled||this.visuallyDisabled)return;let{clientX:i}=e,a=Array.from(this.thumbs),s=_(this.inputWrapper,i),o=this.step/(this.max-this.min),r=this.min+this.step*Math.round(s/o),u=a.reduce((g,x)=>{let V=this._rangeValues.get(+x.dataset.rangeId),L=this._rangeValues.get(+g.dataset.rangeId),$=Math.abs(V-r),k=Math.abs(L-r);return $===k?V<r?x:g:$<k?x:g}),d=+u.dataset.rangeId;if(!d)return;this._rangeValues.set(d,r),this.moveThumb(u,r);let y=this._value;this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),c(y,this._value)&&(this._lastChangeValue=Array.from(this._value),this.emit("sd-input"),this.emit("sd-change"));let F=new PointerEvent("pointerdown",e);t&&u.dispatchEvent(F)&&this.updateTooltip(u)}onClickTrackItem(e){this.onClickTrack(e,!1)}async onClickThumb(e){if(this.disabled||this.visuallyDisabled)return;let t=e.target;this.updateTooltip(t),t.dataset.pointerId&&t.releasePointerCapture(+t.dataset.pointerId),t.dataset.pointerId=e.pointerId.toString(),t.setPointerCapture(e.pointerId),t.classList.add("grabbed"),await t.parentElement.show()}onDragThumb(e){if(this.disabled||this.visuallyDisabled)return;let t=e.target,i=+t.dataset.rangeId;if(!this._rangeValues.has(i)||(t.dataset.pointerId?+t.dataset.pointerId:null)!==e.pointerId)return;let s=_(this.inputWrapper,e.clientX),o=this.step/(this.max-this.min),r=this.min+this.step*Math.round(s/o);if(this.emit("sd-move",{cancelable:!0,detail:{element:t,value:r}}).defaultPrevented)return;let d=this.movementBoundariesForThumb(t,r);d.isRestricted?(r=d.finalValue,t.style.zIndex=(3+this.thumbs.length).toFixed(0)):t.style.zIndex="3",this._rangeValues.set(i,r),this.moveThumb(t,r);let y=this._value;this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),c(y,this._value)&&this.emit("sd-input")}async onReleaseThumb(e){let t=e.target;!t.dataset.pointerId||e.pointerId!==+t.dataset.pointerId||(t.classList.remove("grabbed"),t.releasePointerCapture(e.pointerId),delete t.dataset.pointerId,c(this._lastChangeValue,this._value)&&(this._lastChangeValue=Array.from(this._value),this.emit("sd-change")),await t.parentElement.hide())}onKeyPress(e){let t=e.target,i=+t.dataset.rangeId,a=this._rangeValues.get(i);if(a===void 0)return;let s=a;switch(e.key){case"ArrowUp":case"Up":s=Math.min(a+this.step,this.max);break;case"ArrowDown":case"Down":s=Math.max(a-this.step,this.min);break;case"ArrowLeft":case"Left":s=this.rtl?Math.min(a+this.step,this.max):Math.max(a-this.step,this.min);break;case"ArrowRight":case"Right":s=this.rtl?Math.max(a-this.step,this.min):Math.min(a+this.step,this.max);break;case"PageUp":s=Math.min(a+(this.max-this.min)/5,this.max);break;case"PageDown":s=Math.max(a-(this.max-this.min)/5,this.min);break;case"Home":s=this.min;break;case"End":s=this.max;break;default:return}if(s!==a){if(this.emit("sd-move",{cancelable:!0,detail:{element:t,value:s}}).defaultPrevented)return;let r=this.movementBoundariesForThumb(t,s);r.isRestricted&&(s=r.finalValue),this.moveThumb(t,s),this._rangeValues.set(i,s),this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),this.updateTooltip(t),this._lastChangeValue=Array.from(this._value),this.emit("sd-input"),this.emit("sd-change")}e.preventDefault()}onBlur(e){var t;e.relatedTarget&&((t=this.shadowRoot)!=null&&t.contains(e.relatedTarget))||(this.emit("sd-blur"),this._hasFocus=!1)}onFocusThumb(e){var i;if(this.disabled||this.visuallyDisabled)return;this._hasFocus||(this._hasFocus=!0,this.emit("sd-focus"));let t=e.target;(i=t==null?void 0:t.dataset)!=null&&i.rangeId&&this.updateTooltip(t)}renderThumbs(e){let t=this._value.length>1;return this._rangeValues.clear(),this._value.map((i,a)=>{let s=a+1;this._rangeValues.set(s,i);let o=`thumb-${s}`,r="",u="";return t?(u=e?`label aria-label-hidden ${o}`:`aria-label-hidden ${o}`,a===0?r=`${this.localize.term("minimum")} (${this.tooltipFormatter(i)})`:a===this._value.length-1?r=`${this.localize.term("maximum")} (${this.tooltipFormatter(i)})`:r=this.tooltipFormatter(i)):u=e?"label aria-label-hidden":"",v`<sd-5-15-0-tooltip hoist trigger="focus" disabled="${b(this.disabled||this.visuallyDisabled||this.noTooltip?!0:void 0)}"><div id="${o}" part="thumb" role="slider" tabindex="${this.disabled||this.visuallyDisabled?-1:0}" aria-disabled="${b(this.disabled||this.visuallyDisabled?"true":void 0)}" aria-labelledby="${u}" aria-label="${r}" aria-valuemax="${this.max}" aria-valuemin="${this.min}" aria-valuenow="${i}" aria-valuetext="${this.tooltipFormatter(i)}" data-range-id="${s}" @pointerdown="${this.onClickThumb}" @pointermove="${this.onDragThumb}" @pointerup="${this.onReleaseThumb}" @pointercancel="${this.onReleaseThumb}" @pointerleave="${this.onReleaseThumb}" @keydown="${this.onKeyPress}" @focus="${this.onFocusThumb}" class="${m("rounded-full absolute top-0 size-4 hover:cursor-grab after:-inset-2",this.disabled||this.visuallyDisabled?"bg-neutral-500 outline-none":"bg-primary hover:bg-primary-500 cursor-pointer focus-visible:focus-outline")}"></div></sd-5-15-0-tooltip>`})}render(){let e={label:this.hasSlotController.test("label"),helpText:this.hasSlotController.test("help-text")},t=!!(this.label||e.label),i=!!(this.helpText||e.helpText);return v`<div part="form-control" @focusout="${this.onBlur}" class="flex flex-col">${t?v`<div class="flex items-center gap-1"><label id="label" part="form-control-label" aria-hidden="${t?"false":"true"}" class="${m("w-full",t?"inline-block":"hidden")}" @click="${this.focus}"><slot name="label">${this.label}</slot></label></div>`:null} <label id="aria-label-hidden" class="sr-only">(${this._value.map(this.tooltipFormatter).join(" - ")})</label><div part="base" class="${m("inline-flex w-full",this.visuallyDisabled&&"focus-visible:focus-outline")}" tabindex="${b(this.visuallyDisabled?"0":void 0)}"><div part="input-wrapper" class="relative flex-1 mx-2 mb-[10px]"><input id="input" tabindex="-1" hidden @invalid="${this.handleInvalid}"><div part="track-wrapper" role="presentation" @pointerdown="${this.onClickTrack}" class="relative cursor-pointer -mx-2"><div part="track-click-helper" class="absolute -inset-y-2 inset-x-0"></div><div part="track" class="${m("h-1 my-[6px]",this.disabled||this.visuallyDisabled?"bg-neutral-500":"bg-neutral-400")}"></div><div part="active-track" hidden="${b(this.noTrackBar?!0:void 0)}" class="${m("absolute top-0 h-1",this.disabled||this.visuallyDisabled?"bg-neutral-500":"bg-primary")}"></div></div>${this.renderThumbs(t)}<div class="-mt-[10px]" part="scale-ticks" @pointerdown="${this.onClickTrackItem}" role="presentation"><slot name="scale-ticks"></slot></div></div></div><slot></slot><slot name="help-text" part="form-control-help-text" id="help-text" class="${m("text-sm text-neutral-700 mt-1",i?"block":"hidden")}" aria-hidden="${!i}">${this.helpText}</slot></div>`}};l.styles=[...T.styles,I`[part=base]{touch-action:none;-webkit-touch-callout:none}[part=thumb].grabbed{--tw-bg-opacity:1!important;background-color:rgb(var(--sd-color-primary-800,5 21 48)/var(--tw-bg-opacity,1))!important}`],n([f("#input")],l.prototype,"input",2),n([f('[part="active-track"]')],l.prototype,"activeTrack",2),n([f('[part="input-wrapper"]')],l.prototype,"inputWrapper",2),n([D('[part="thumb"]')],l.prototype,"thumbs",2),n([h({attribute:!1})],l.prototype,"tooltipFormatter",2),n([h({type:String,reflect:!0})],l.prototype,"name",2),n([h({type:String,reflect:!0})],l.prototype,"label",2),n([h({attribute:"help-text",reflect:!0})],l.prototype,"helpText",2),n([h({type:Number,reflect:!0})],l.prototype,"min",2),n([h({type:Number,reflect:!0})],l.prototype,"max",2),n([h({type:Number,reflect:!0})],l.prototype,"step",2),n([h({type:Boolean,reflect:!0})],l.prototype,"disabled",2),n([h({attribute:"visually-disabled",type:Boolean,reflect:!0})],l.prototype,"visuallyDisabled",2),n([h({attribute:"no-track-bar",type:Boolean,reflect:!0})],l.prototype,"noTrackBar",2),n([h({attribute:"no-tooltip",type:Boolean,reflect:!0})],l.prototype,"noTooltip",2),n([A()],l.prototype,"defaultValue",2),n([h({type:String})],l.prototype,"value",1),l=n([C("sd-5-15-0-range")],l);export{l as a};
1
+ import{a as p,b as c,c as _}from"./chunk.IVHEBGOY.js";import{a as A}from"./chunk.RTXVVB2O.js";import{b as E}from"./chunk.7JV32P5Q.js";import{a as M}from"./chunk.CGQ2BPPZ.js";import{a as b}from"./chunk.GLVMB2MH.js";import{a as m}from"./chunk.26V4EXHB.js";import{a as w}from"./chunk.Y7NVH75J.js";import{a as C,b as h,d as f,e as D,h as T}from"./chunk.2FN4O4QC.js";import{b as I,e as v}from"./chunk.ZR5P6TQI.js";import{e as n}from"./chunk.TJOCV4DC.js";var l=class extends T{constructor(){super();this.formControlController=new E(this);this.hasSlotController=new M(this,"label","help-text");this.localize=new w(this);this.name="";this.label="";this.helpText="";this.min=0;this.max=100;this.step=1;this.disabled=!1;this.visuallyDisabled=!1;this.noTrackBar=!1;this.noTooltip=!1;this.defaultValue="";this._value=[0];this._rangeValues=new Map;this._lastChangeValue=[];this._hasFocus=!1;this.tooltipFormatter=this.localize.number.bind(this.localize)}set value(e){this._value=e?e.split(" ").map(Number).sort(p):[]}get value(){return this._value.slice().sort(p).join(" ")}set valueAsArray(e){let t=this._value;this._value=Array.isArray(e)?e.slice().sort(p):e||[],c(t,this._value)&&this.requestUpdate("value",t.join(" "))}get valueAsArray(){return[...this._value].sort(p)}get rtl(){return this.localize.dir()==="rtl"}firstUpdated(){this.formControlController.updateValidity(),this._lastChangeValue=Array.from(this._value)}willUpdate(e){super.willUpdate(e),this.min>this.max&&([this.min,this.max]=[this.max,this.min]),this.step>this.max-this.min&&(this.step=this.max-this.min),this.step<=0&&(this.step=1);let t=this._value.map(i=>{if(i<=this.min)return this.min;if(i>=this.max)return this.max;let a=this.min+this.step*Math.round((i-this.min)/this.step);return a>this.max?this.max:a});c(this._value,t)&&(this._value=t)}updated(e){super.updated(e);for(let t of this.thumbs){let i=+t.dataset.rangeId;this._rangeValues.has(i)&&this.moveThumb(t,this._rangeValues.get(i))}this.updateActiveTrack()}focus(e){let t=this.thumbs.item(0);t?t.focus(e):super.focus(e)}get validity(){return this.input.validity}checkValidity(){var e;return(e=this.input)==null?void 0:e.checkValidity()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.input.reportValidity()}setCustomValidity(e){this.input.setCustomValidity(e),this.formControlController.updateValidity()}updateTooltip(e){let t=+e.dataset.rangeId;if(!this._rangeValues.has(t))return;let i=this._rangeValues.get(t),a=e.parentElement;a.content=this.tooltipFormatter(i)}updateActiveTrack(){let{activeTrack:e}=this;if(!e)return;if(this.min===this.max){e.style.insetInlineStart="0%",e.style.insetInlineEnd="0%";return}if(this._value.length===1){let s=getComputedStyle(this).getPropertyValue("--track-active-offset")||"0%",o=100*(this._value[0]-this.min)/(this.max-this.min);e.style.insetInlineStart=`min(${s}, ${o}%)`,e.style.insetInlineEnd=`min(calc(100% - ${s}), calc(100% - ${o}%))`;return}let t=this._value.slice().sort(p),i=100*(t[0]-this.min)/(this.max-this.min),a=100*(t[t.length-1]-this.min)/(this.max-this.min);e.style.insetInlineStart=`${i}%`,e.style.insetInlineEnd=`calc(100% - ${a}%)`}moveThumb(e,t){e.setAttribute("aria-valuenow",t.toString()),e.setAttribute("aria-valuetext",this.tooltipFormatter(t));let i=(t-this.min)/(this.max-this.min);e.style.insetInlineStart=`calc(${100*i}% - 8px)`,this.updateTooltip(e)}movementBoundariesForThumb(e,t){let i=this.valueAsArray,s=Array.from(this.thumbs).indexOf(e),o=i[s-1]||this.min,r=i[s+1]||this.max,u=t<o||t>r;return{finalValue:Math.max(o,Math.min(r,t)),isRestricted:u,nextValue:r,prevValue:o}}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}onClickTrack(e,t=!0){if(this.disabled||this.visuallyDisabled)return;let{clientX:i}=e,a=Array.from(this.thumbs),s=_(this.inputWrapper,i),o=this.step/(this.max-this.min),r=this.min+this.step*Math.round(s/o),u=a.reduce((g,x)=>{let V=this._rangeValues.get(+x.dataset.rangeId),L=this._rangeValues.get(+g.dataset.rangeId),$=Math.abs(V-r),k=Math.abs(L-r);return $===k?V<r?x:g:$<k?x:g}),d=+u.dataset.rangeId;if(!d)return;this._rangeValues.set(d,r),this.moveThumb(u,r);let y=this._value;this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),c(y,this._value)&&(this._lastChangeValue=Array.from(this._value),this.emit("sd-input"),this.emit("sd-change"));let F=new PointerEvent("pointerdown",e);t&&u.dispatchEvent(F)&&this.updateTooltip(u)}onClickTrackItem(e){this.onClickTrack(e,!1)}async onClickThumb(e){if(this.disabled||this.visuallyDisabled)return;let t=e.target;this.updateTooltip(t),t.dataset.pointerId&&t.releasePointerCapture(+t.dataset.pointerId),t.dataset.pointerId=e.pointerId.toString(),t.setPointerCapture(e.pointerId),t.classList.add("grabbed"),await t.parentElement.show()}onDragThumb(e){if(this.disabled||this.visuallyDisabled)return;let t=e.target,i=+t.dataset.rangeId;if(!this._rangeValues.has(i)||(t.dataset.pointerId?+t.dataset.pointerId:null)!==e.pointerId)return;let s=_(this.inputWrapper,e.clientX),o=this.step/(this.max-this.min),r=this.min+this.step*Math.round(s/o);if(this.emit("sd-move",{cancelable:!0,detail:{element:t,value:r}}).defaultPrevented)return;let d=this.movementBoundariesForThumb(t,r);d.isRestricted?(r=d.finalValue,t.style.zIndex=(3+this.thumbs.length).toFixed(0)):t.style.zIndex="3",this._rangeValues.set(i,r),this.moveThumb(t,r);let y=this._value;this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),c(y,this._value)&&this.emit("sd-input")}async onReleaseThumb(e){let t=e.target;!t.dataset.pointerId||e.pointerId!==+t.dataset.pointerId||(t.classList.remove("grabbed"),t.releasePointerCapture(e.pointerId),delete t.dataset.pointerId,c(this._lastChangeValue,this._value)&&(this._lastChangeValue=Array.from(this._value),this.emit("sd-change")),await t.parentElement.hide())}onKeyPress(e){let t=e.target,i=+t.dataset.rangeId,a=this._rangeValues.get(i);if(a===void 0)return;let s=a;switch(e.key){case"ArrowUp":case"Up":s=Math.min(a+this.step,this.max);break;case"ArrowDown":case"Down":s=Math.max(a-this.step,this.min);break;case"ArrowLeft":case"Left":s=this.rtl?Math.min(a+this.step,this.max):Math.max(a-this.step,this.min);break;case"ArrowRight":case"Right":s=this.rtl?Math.max(a-this.step,this.min):Math.min(a+this.step,this.max);break;case"PageUp":s=Math.min(a+(this.max-this.min)/5,this.max);break;case"PageDown":s=Math.max(a-(this.max-this.min)/5,this.min);break;case"Home":s=this.min;break;case"End":s=this.max;break;default:return}if(s!==a){if(this.emit("sd-move",{cancelable:!0,detail:{element:t,value:s}}).defaultPrevented)return;let r=this.movementBoundariesForThumb(t,s);r.isRestricted&&(s=r.finalValue),this.moveThumb(t,s),this._rangeValues.set(i,s),this._value=Array.from(this._rangeValues.values()),this.updateActiveTrack(),this.updateTooltip(t),this._lastChangeValue=Array.from(this._value),this.emit("sd-input"),this.emit("sd-change")}e.preventDefault()}onBlur(e){var t;e.relatedTarget&&((t=this.shadowRoot)!=null&&t.contains(e.relatedTarget))||(this.emit("sd-blur"),this._hasFocus=!1)}onFocusThumb(e){var i;if(this.disabled||this.visuallyDisabled)return;this._hasFocus||(this._hasFocus=!0,this.emit("sd-focus"));let t=e.target;(i=t==null?void 0:t.dataset)!=null&&i.rangeId&&this.updateTooltip(t)}renderThumbs(e){let t=this._value.length>1;return this._rangeValues.clear(),this._value.map((i,a)=>{let s=a+1;this._rangeValues.set(s,i);let o=`thumb-${s}`,r="",u="";return t?(u=e?`label aria-label-hidden ${o}`:`aria-label-hidden ${o}`,a===0?r=`${this.localize.term("minimum")} (${this.tooltipFormatter(i)})`:a===this._value.length-1?r=`${this.localize.term("maximum")} (${this.tooltipFormatter(i)})`:r=this.tooltipFormatter(i)):u=e?"label aria-label-hidden":"",v`<sd-5-15-2-tooltip hoist trigger="focus" disabled="${b(this.disabled||this.visuallyDisabled||this.noTooltip?!0:void 0)}"><div id="${o}" part="thumb" role="slider" tabindex="${this.disabled||this.visuallyDisabled?-1:0}" aria-disabled="${b(this.disabled||this.visuallyDisabled?"true":void 0)}" aria-labelledby="${u}" aria-label="${r}" aria-valuemax="${this.max}" aria-valuemin="${this.min}" aria-valuenow="${i}" aria-valuetext="${this.tooltipFormatter(i)}" data-range-id="${s}" @pointerdown="${this.onClickThumb}" @pointermove="${this.onDragThumb}" @pointerup="${this.onReleaseThumb}" @pointercancel="${this.onReleaseThumb}" @pointerleave="${this.onReleaseThumb}" @keydown="${this.onKeyPress}" @focus="${this.onFocusThumb}" class="${m("rounded-full absolute top-0 size-4 hover:cursor-grab after:-inset-2",this.disabled||this.visuallyDisabled?"bg-neutral-500 outline-none":"bg-primary hover:bg-primary-500 cursor-pointer focus-visible:focus-outline")}"></div></sd-5-15-2-tooltip>`})}render(){let e={label:this.hasSlotController.test("label"),helpText:this.hasSlotController.test("help-text")},t=!!(this.label||e.label),i=!!(this.helpText||e.helpText);return v`<div part="form-control" @focusout="${this.onBlur}" class="flex flex-col">${t?v`<div class="flex items-center gap-1"><label id="label" part="form-control-label" aria-hidden="${t?"false":"true"}" class="${m("w-full",t?"inline-block":"hidden")}" @click="${this.focus}"><slot name="label">${this.label}</slot></label></div>`:null} <label id="aria-label-hidden" class="sr-only">(${this._value.map(this.tooltipFormatter).join(" - ")})</label><div part="base" class="${m("inline-flex w-full",this.visuallyDisabled&&"focus-visible:focus-outline")}" tabindex="${b(this.visuallyDisabled?"0":void 0)}"><div part="input-wrapper" class="relative flex-1 mx-2 mb-[10px]"><input id="input" tabindex="-1" hidden @invalid="${this.handleInvalid}"><div part="track-wrapper" role="presentation" @pointerdown="${this.onClickTrack}" class="relative cursor-pointer -mx-2"><div part="track-click-helper" class="absolute -inset-y-2 inset-x-0"></div><div part="track" class="${m("h-1 my-[6px]",this.disabled||this.visuallyDisabled?"bg-neutral-500":"bg-neutral-400")}"></div><div part="active-track" hidden="${b(this.noTrackBar?!0:void 0)}" class="${m("absolute top-0 h-1",this.disabled||this.visuallyDisabled?"bg-neutral-500":"bg-primary")}"></div></div>${this.renderThumbs(t)}<div class="-mt-[10px]" part="scale-ticks" @pointerdown="${this.onClickTrackItem}" role="presentation"><slot name="scale-ticks"></slot></div></div></div><slot></slot><slot name="help-text" part="form-control-help-text" id="help-text" class="${m("text-sm text-neutral-700 mt-1",i?"block":"hidden")}" aria-hidden="${!i}">${this.helpText}</slot></div>`}};l.styles=[...T.styles,I`[part=base]{touch-action:none;-webkit-touch-callout:none}[part=thumb].grabbed{--tw-bg-opacity:1!important;background-color:rgb(var(--sd-color-primary-800,5 21 48)/var(--tw-bg-opacity,1))!important}`],n([f("#input")],l.prototype,"input",2),n([f('[part="active-track"]')],l.prototype,"activeTrack",2),n([f('[part="input-wrapper"]')],l.prototype,"inputWrapper",2),n([D('[part="thumb"]')],l.prototype,"thumbs",2),n([h({attribute:!1})],l.prototype,"tooltipFormatter",2),n([h({type:String,reflect:!0})],l.prototype,"name",2),n([h({type:String,reflect:!0})],l.prototype,"label",2),n([h({attribute:"help-text",reflect:!0})],l.prototype,"helpText",2),n([h({type:Number,reflect:!0})],l.prototype,"min",2),n([h({type:Number,reflect:!0})],l.prototype,"max",2),n([h({type:Number,reflect:!0})],l.prototype,"step",2),n([h({type:Boolean,reflect:!0})],l.prototype,"disabled",2),n([h({attribute:"visually-disabled",type:Boolean,reflect:!0})],l.prototype,"visuallyDisabled",2),n([h({attribute:"no-track-bar",type:Boolean,reflect:!0})],l.prototype,"noTrackBar",2),n([h({attribute:"no-tooltip",type:Boolean,reflect:!0})],l.prototype,"noTooltip",2),n([A()],l.prototype,"defaultValue",2),n([h({type:String})],l.prototype,"value",1),l=n([C("sd-5-15-2-range")],l);export{l as a};
@@ -1,11 +1,11 @@
1
- import{a as P}from"./chunk.RTXVVB2O.js";import{a as H}from"./chunk.X2GM34WQ.js";import{a as L,d as R,e as K,f as w}from"./chunk.W7A3TU2Z.js";import{c as A}from"./chunk.3L472FD4.js";import{b as z}from"./chunk.7JV32P5Q.js";import{a as F}from"./chunk.CGQ2BPPZ.js";import{a as M}from"./chunk.GLVMB2MH.js";import{a as E,c as C}from"./chunk.SKUMYG4O.js";import{a as x}from"./chunk.KLRPP4NQ.js";import{a as $}from"./chunk.FODPSMJF.js";import{a as d}from"./chunk.26V4EXHB.js";import{a as V}from"./chunk.Y7NVH75J.js";import{a as g}from"./chunk.E2DRD2OX.js";import{a as k,b as r,c as u,d as c,h as T}from"./chunk.2FN4O4QC.js";import{b as D,e as p}from"./chunk.ZR5P6TQI.js";import{b as S,e as I}from"./chunk.6OTM3PE5.js";import{e as l}from"./chunk.TJOCV4DC.js";var s=class extends T{constructor(){super(...arguments);this.formControlController=new z(this,{assumeInteractionOn:["sd-blur","sd-5-15-0-input"]});this.hasSlotController=new F(this,"help-text","label");this.localize=new V(this);this.hasFocus=!1;this.displayInputValue="";this.selectedTextLabel="";this.selectedOptions=[];this.filteredOptions=[];this.allOptions=[];this.showValidStyle=!1;this.showInvalidStyle=!1;this.deletedTagLabel="";this.name="";this.value="";this.defaultValue="";this.size="lg";this.placeholder="";this.maxOptionsTagLabel="";this.disabled=!1;this.visuallyDisabled=!1;this.clearable=!1;this.open=!1;this.hoist=!1;this.label="";this.placement="bottom";this.helpText="";this.form="";this.required=!1;this.type="text";this.currentPlacement=this.placement;this.getOption=H;this.multiple=!1;this.useTags=!0;this.maxOptionsVisible=3;this.styleOnValid=!1;this.filter=(t,e)=>{let i=w(t.value),a=w(t.getTextLabel()),n=w(e);return i.includes(n)||a.includes(n)};this.getTag=t=>p`<sd-5-15-0-tag ?disabled="${this.disabled}" part="tag" exportparts="
1
+ import{a as P}from"./chunk.RTXVVB2O.js";import{a as H}from"./chunk.X2GM34WQ.js";import{a as L,d as R,e as K,f as w}from"./chunk.W7A3TU2Z.js";import{c as A}from"./chunk.3L472FD4.js";import{b as z}from"./chunk.7JV32P5Q.js";import{a as F}from"./chunk.CGQ2BPPZ.js";import{a as M}from"./chunk.GLVMB2MH.js";import{a as E,c as C}from"./chunk.SKUMYG4O.js";import{a as x}from"./chunk.KLRPP4NQ.js";import{a as $}from"./chunk.FODPSMJF.js";import{a as d}from"./chunk.26V4EXHB.js";import{a as V}from"./chunk.Y7NVH75J.js";import{a as g}from"./chunk.E2DRD2OX.js";import{a as k,b as r,c as u,d as c,h as T}from"./chunk.2FN4O4QC.js";import{b as D,e as p}from"./chunk.ZR5P6TQI.js";import{b as S,e as I}from"./chunk.6OTM3PE5.js";import{e as l}from"./chunk.TJOCV4DC.js";var s=class extends T{constructor(){super(...arguments);this.formControlController=new z(this,{assumeInteractionOn:["sd-blur","sd-5-15-2-input"]});this.hasSlotController=new F(this,"help-text","label");this.localize=new V(this);this.hasFocus=!1;this.displayInputValue="";this.selectedTextLabel="";this.selectedOptions=[];this.filteredOptions=[];this.allOptions=[];this.showValidStyle=!1;this.showInvalidStyle=!1;this.deletedTagLabel="";this.name="";this.value="";this.defaultValue="";this.size="lg";this.placeholder="";this.maxOptionsTagLabel="";this.disabled=!1;this.visuallyDisabled=!1;this.clearable=!1;this.open=!1;this.hoist=!1;this.label="";this.placement="bottom";this.helpText="";this.form="";this.required=!1;this.type="text";this.currentPlacement=this.placement;this.getOption=H;this.multiple=!1;this.useTags=!0;this.maxOptionsVisible=3;this.styleOnValid=!1;this.filter=(t,e)=>{let i=w(t.value),a=w(t.getTextLabel()),n=w(e);return i.includes(n)||a.includes(n)};this.getTag=t=>p`<sd-5-15-2-tag ?disabled="${this.disabled}" part="tag" exportparts="
2
2
  base:tag__base,
3
3
  content:tag__content,
4
4
  removable-indicator:tag__removable-indicator,
5
- " size="${this.size==="sm"?"sm":"lg"}" removable @keydown="${e=>this.handleTagKeyDown(e,t)}" @sd-remove="${e=>this.handleTagRemove(e,t)}">${t.getTextLabel()}</sd-5-15-0-tag>`;this.handleDocumentFocusIn=t=>{let e=t.composedPath();this&&!e.includes(this)&&this.hide()};this.handleDocumentKeyDown=t=>{let i=t.composedPath().some(o=>o instanceof HTMLButtonElement&&o.classList.contains("combobox-button"));if(this.visuallyDisabled){t.preventDefault(),t.stopPropagation();return}if(!(i||t.target.closest(".combobox__clear")!==null)){if(t.key==="Escape"&&(this.open?(t.preventDefault(),t.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})):this.displayInputValue=""),t.key==="Backspace"&&this.multiple&&this.displayInput.value===""){this.handleTagRemove(new CustomEvent("sd-remove"),this.selectedOptions[this.selectedOptions.length-1]),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0}));return}if(t.key==="Enter"){let o=this.getCurrentOption(),f=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;if(!this.open&&!f){setTimeout(()=>{t.defaultPrevented||this.formControlController.submit()});return}if(!this.open||o!=null&&o.disabled)return;if(o&&!o.disabled){let h=this.value;this.multiple?(this.toggleOptionSelection(o),this.lastOption=o,this.setOrderedSelectedOptions(o),this.updateComplete.then(()=>{this.selectionChanged()})):(this.setOrderedSelectedOptions(o),this.setSelectedOptions(o)),this.updateComplete.then(()=>{this.displayInput.focus({preventScroll:!0}),this.value!==h&&(this.emit("sd-input"),this.emit("sd-change"))})}this.displayInput.focus({preventScroll:!0}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}));return}["ArrowUp","ArrowDown"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.open||this.show(),this.selectNextOption(t.key==="ArrowDown")),["Home","End"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),t.key==="Home"?this.displayInput.setSelectionRange(0,0):t.key==="End"&&this.displayInput.setSelectionRange(this.displayInput.value.length,this.displayInput.value.length))}};this.handleDocumentMouseDown=t=>{let e=t.composedPath();this&&!e.includes(this)&&this.hide()}}connectedCallback(){super.connectedCallback(),this.open=!1}firstUpdated(){if(!this.multiple){let t=this.findOptionByValue(this.getSlottedOptions(),this.value);this.selectedTextLabel=(t==null?void 0:t.getTextLabel())||""}this.formControlController.updateValidity()}get validity(){return this.valueInput.validity}get validationMessage(){return this.valueInput.validationMessage}get options(){let t=e=>{let i=this.displayInput.value,a=this.getOption(e,i);return e.tabIndex=0,p`${typeof a=="string"?$(a):a}`};return this.filteredOptions.map(e=>e.tagName.toLowerCase()==="sd-5-15-0-optgroup"?(Array.from(e.children).forEach(i=>{i.tagName.toLowerCase()==="sd-5-15-0-option"&&t(i)}),e):t(e))}get tags(){return this.selectedOptions.length<=this.maxOptionsVisible?this.selectedOptions.map((t,e)=>{if(e<this.maxOptionsVisible||this.maxOptionsVisible<=0){let i=this.getTag(t,e);return p`<div @sd-remove="${a=>this.handleTagRemove(a,t)}">${typeof i=="string"?$(i):i}</div>`}return[p``]}):[p`<sd-5-15-0-tag ?disabled="${this.disabled}" part="tag" exportparts="
5
+ " size="${this.size==="sm"?"sm":"lg"}" removable @keydown="${e=>this.handleTagKeyDown(e,t)}" @sd-remove="${e=>this.handleTagRemove(e,t)}">${t.getTextLabel()}</sd-5-15-2-tag>`;this.handleDocumentFocusIn=t=>{let e=t.composedPath();this&&!e.includes(this)&&this.hide()};this.handleDocumentKeyDown=t=>{let i=t.composedPath().some(o=>o instanceof HTMLButtonElement&&o.classList.contains("combobox-button"));if(this.visuallyDisabled){t.preventDefault(),t.stopPropagation();return}if(!(i||t.target.closest(".combobox__clear")!==null)){if(t.key==="Escape"&&(this.open?(t.preventDefault(),t.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})):this.displayInputValue=""),t.key==="Backspace"&&this.multiple&&this.displayInput.value===""){this.handleTagRemove(new CustomEvent("sd-remove"),this.selectedOptions[this.selectedOptions.length-1]),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0}));return}if(t.key==="Enter"){let o=this.getCurrentOption(),f=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;if(!this.open&&!f){setTimeout(()=>{t.defaultPrevented||this.formControlController.submit()});return}if(!this.open||o!=null&&o.disabled)return;if(o&&!o.disabled){let h=this.value;this.multiple?(this.toggleOptionSelection(o),this.lastOption=o,this.setOrderedSelectedOptions(o),this.updateComplete.then(()=>{this.selectionChanged()})):(this.setOrderedSelectedOptions(o),this.setSelectedOptions(o)),this.updateComplete.then(()=>{this.displayInput.focus({preventScroll:!0}),this.value!==h&&(this.emit("sd-input"),this.emit("sd-change"))})}this.displayInput.focus({preventScroll:!0}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}));return}["ArrowUp","ArrowDown"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.open||this.show(),this.selectNextOption(t.key==="ArrowDown")),["Home","End"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),t.key==="Home"?this.displayInput.setSelectionRange(0,0):t.key==="End"&&this.displayInput.setSelectionRange(this.displayInput.value.length,this.displayInput.value.length))}};this.handleDocumentMouseDown=t=>{let e=t.composedPath();this&&!e.includes(this)&&this.hide()}}connectedCallback(){super.connectedCallback(),this.open=!1}firstUpdated(){if(!this.multiple){let t=this.findOptionByValue(this.getSlottedOptions(),this.value);this.selectedTextLabel=(t==null?void 0:t.getTextLabel())||""}this.formControlController.updateValidity()}get validity(){return this.valueInput.validity}get validationMessage(){return this.valueInput.validationMessage}get options(){let t=e=>{let i=this.displayInput.value,a=this.getOption(e,i);return e.tabIndex=0,p`${typeof a=="string"?$(a):a}`};return this.filteredOptions.map(e=>e.tagName.toLowerCase()==="sd-5-15-2-optgroup"?(Array.from(e.children).forEach(i=>{i.tagName.toLowerCase()==="sd-5-15-2-option"&&t(i)}),e):t(e))}get tags(){return this.selectedOptions.length<=this.maxOptionsVisible?this.selectedOptions.map((t,e)=>{if(e<this.maxOptionsVisible||this.maxOptionsVisible<=0){let i=this.getTag(t,e);return p`<div @sd-remove="${a=>this.handleTagRemove(a,t)}">${typeof i=="string"?$(i):i}</div>`}return[p``]}):[p`<sd-5-15-2-tag ?disabled="${this.disabled}" part="tag" exportparts="
6
6
  base:tag__base,
7
7
  content:tag__content,
8
8
  removable-indicator:tag__removable-indicator,
9
- " size="${this.size==="sm"?"sm":"lg"}" removable @keydown="${t=>this.handleTagMaxOptionsKeyDown(t)}" @sd-remove="${t=>this.handleTagRemove(t)}">${this.selectedOptions.length} ${this.localize.term("tagsSelected")}</sd-5-15-0-tag>`]}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().addEventListener("focusin",this.handleDocumentFocusIn)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().removeEventListener("focusin",this.handleDocumentFocusIn)}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleTagKeyDown(t,e){(t.key==="Backspace"||t.key==="Enter"||t.key===" ")&&this.multiple&&(t.preventDefault(),t.stopPropagation(),this.handleTagRemove(new CustomEvent("sd-remove"),e),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0})))}handleTagMaxOptionsKeyDown(t){(t.key==="Backspace"||t.key==="Enter"||t.key===" ")&&this.multiple&&(t.preventDefault(),t.stopPropagation(),this.handleTagRemove(new CustomEvent("sd-remove"),this.selectedOptions[this.selectedOptions.length-1]),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0})))}handleLabelClick(){this.visuallyDisabled||this.displayInput.focus()}handleTagRemove(t,e){t.stopPropagation(),e||this.clearCombobox(),e&&!this.disabled&&(this.toggleOptionSelection(e,!1),this.setOrderedSelectedOptions(e),this.deletedTagLabel="",this.deletedTagLabel=this.localize.term("removed",e.textContent),this.updateComplete.then(()=>{this.selectionChanged(),this.emit("sd-input"),this.emit("sd-change")}))}handleComboboxMouseDown(t){if(this.visuallyDisabled){t.preventDefault(),t.stopPropagation();return}let i=t.composedPath().some(n=>n instanceof HTMLSlotElement&&n.name==="removable-indicator");if(this.disabled||i)return;(this.open?this.hide():this.show()).then(()=>{setTimeout(()=>this.displayInput.focus({preventScroll:!0}))})}handleComboboxKeyDown(t){t.key!=="Tab"&&this.handleDocumentKeyDown(t)}handleClearClick(t){t.stopPropagation(),this.clearCombobox()}handleNoResultsClick(t){t.preventDefault(),this.hide()}clearCombobox(){this.value!==""&&(this.value="",this.displayInputValue="",this.selectedTextLabel="",this.lastOption=void 0,this.selectedOptions=[],this.getSlottedOptions().forEach(t=>{t.selected=!1}),this.displayInput.focus({preventScroll:!0}),this.updateComplete.then(()=>{this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change")}))}preventLoosingFocus(t){t.stopPropagation(),t.preventDefault()}handleOptionClick(t){let i=t.target.closest("sd-5-15-0-option"),a=this.value;i&&!i.disabled&&(this.multiple?(this.toggleOptionSelection(i),this.lastOption=i,this.setOrderedSelectedOptions(i),this.updateComplete.then(()=>{this.selectionChanged()})):(this.setOrderedSelectedOptions(i),this.setSelectedOptions(i)),this.updateComplete.then(()=>{this.displayInput.focus({preventScroll:!0}),this.value!==a&&(this.emit("sd-input"),this.emit("sd-change"))}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))}selectNextOption(t){let e=this.getAllFilteredOptions();if(e.length===0)return;let i=this.getCurrentOption(),a=e.indexOf(i),n=Math.max(0,a);if(t){let o=a+1;n=o>e.length-1?0:o}else{let o=a-1;n=o<0?e.length-1:o}this.setCurrentOption(e[n],new KeyboardEvent("keydown")),A(this.getCurrentOption(),this.listbox,"vertical","auto")}getAllFilteredOptions(){return[...this.filteredWrapper.querySelectorAll("sd-5-15-0-option")]}getCurrentOption(){return this.getAllFilteredOptions().find(t=>t.current)}setCurrentOption(t,e){let i=this.getAllFilteredOptions();this.displayInput.removeAttribute("aria-activedescendant"),i.forEach(a=>{a.current=!1,a.setAttribute("aria-selected","false"),a.isKeyboardFocus=!1}),t&&(t.current=!0,t.setAttribute("aria-selected","true"),this.displayInput.setAttribute("aria-activedescendant",t.id)),t&&(e==null?void 0:e.type)==="keydown"&&(t.isKeyboardFocus=!0)}toggleOptionSelection(t,e){let a=this.getSlottedOptions().find(n=>n.value&&t.value?n.value===t.value:n.getTextLabel()===t.getTextLabel());a&&(a.selected=e!=null?e:!a.selected)}findOptionByValue(t,e){if(e)return Array.isArray(e)?t.find(i=>e.includes(i.value)):t.find(i=>i.value===e)}selectedOptionsAndValueSynced(){var t;return!this.value&&this.selectedOptions.length===0?!0:Array.isArray(this.value)?this.value.length===this.selectedOptions.length:this.value===((t=this.selectedOptions[0])==null?void 0:t.value)}isOptionSelected(t){return t.value?this.value.includes(t.value):this.value.includes(t.getTextLabel())}syncSelectedOptionsAndValue(){return this.selectedOptionsAndValueSynced()?void 0:(this.getSlottedOptions().forEach(e=>{e.selected=!1}),this.selectedOptions=this.getSlottedOptions().filter(e=>this.isOptionSelected(e)),this.selectedOptions.forEach(e=>{e&&(e.selected=!0)}),Promise.resolve())}compareOptions(t,e){return t.value&&e.value?t.value===e.value:t.getTextLabel()===e.getTextLabel()}setSelectedOptions(t){this.getSlottedOptions().forEach(i=>{i.selected=this.compareOptions(i,t)}),this.selectionChanged()}setOrderedSelectedOptions(t){let e=this.getSlottedOptions().find(i=>this.compareOptions(i,t));this.multiple?this.selectedOptions.length>0&&e&&this.selectedOptions.find(i=>this.compareOptions(i,e))?this.selectedOptions=this.selectedOptions.filter(i=>!this.compareOptions(i,e)):this.selectedOptions=[...this.selectedOptions,e]:this.selectedOptions=[e]}selectionChanged(){var e,i,a;let t=this.selectedOptions.some(n=>n?this.isOptionSelected(n):!1);this.multiple?(!t&&this.selectedOptions.length>0?this.value=[...this.value,...this.selectedOptions.map(n=>n.value||n.getTextLabel())]:this.value=this.selectedOptions.map(n=>(n==null?void 0:n.value)||(n==null?void 0:n.getTextLabel())||""),this.displayInputValue=""):(this.value=((e=this.selectedOptions[0])==null?void 0:e.value)||((i=this.selectedOptions[0])==null?void 0:i.getTextLabel())||"",this.selectedTextLabel=((a=this.selectedOptions[0])==null?void 0:a.getTextLabel())||"",this.displayInputValue=""),this.updateComplete.then(()=>{this.formControlController.updateValidity()})}createComboboxOptionsFromQuery(t){let e=[];this.filteredOptions=this.getSlottedOptions().filter(i=>this.filter(i,t)||t==="").map(i=>{var y,b,m;let a=i.cloneNode(!0);if(a.current=a.value===((y=this.lastOption)==null?void 0:y.value),a.selected=i.selected,a.checkbox=i.checkbox,a.size=i.size,!(((b=i.parentElement)==null?void 0:b.tagName.toLowerCase())==="sd-5-15-0-optgroup"))return a;let o=i.parentElement,f=(m=o.querySelector('[slot="label"]'))==null?void 0:m.cloneNode(!0),h=e.find(O=>O.id===o.id);if(h){h==null||h.appendChild(a),f&&(h==null||h.appendChild(f));return}let v=o.cloneNode();return v.appendChild(a),f&&v.appendChild(f),e.push(v),v}).filter(Boolean)}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleCurrentPlacement(t){let e=t.detail;e&&(this.currentPlacement=e)}handleFilterChange(){this.createComboboxOptionsFromQuery(this.displayInputValue)}handleUseTagsChange(){let t=this.getAllFilteredOptions();customElements.get("sd-5-15-0-option")&&t.forEach(e=>{e.checkbox=this.multiple})}applySizeToOptions(){this.getSlottedOptions().forEach(t=>{t.size=this.size})}handleDisabledChange(){this.formControlController.setValidity(this.disabled),(this.disabled||this.visuallyDisabled)&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.syncSelectedOptionsAndValue(),this.multiple?this.createComboboxOptionsFromQuery(this.displayInput.value):this.createComboboxOptionsFromQuery("")}handleDisplayInputValueChange(){this.createComboboxOptionsFromQuery(this.displayInputValue)}async handleOpenChange(){if(this.open&&(!this.disabled||!this.visuallyDisabled)){this.emit("sd-show"),this.addOpenListeners(),await I(this),this.listbox.hidden=!1,this.popup.active=!0;let{keyframes:i,options:a}=C(this,"combobox.show",{dir:this.localize.dir()});await S(this.popup.popup,i,a),this.emit("sd-after-show"),this.filteredOptions.length===0&&this.emit("sd-error");return}this.setCurrentOption(null),this.displayInput.removeAttribute("aria-activedescendant"),this.emit("sd-hide"),this.removeOpenListeners(),await I(this);let{keyframes:t,options:e}=C(this,"combobox.hide",{dir:this.localize.dir()});await S(this.popup.popup,t,e),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sd-after-hide")}async show(){if(this.open||this.disabled||this.visuallyDisabled){this.open=!1;return}return this.open=!0,Promise.race([x(this,"sd-after-show"),x(this,"sd-error")])}async hide(){if(!this.open||this.disabled){this.open=!1;return}return this.displayInputValue="",this.open=!1,x(this,"sd-after-hide")}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.valueInput.reportValidity()}setCustomValidity(t){this.valueInput.setCustomValidity(t),this.formControlController.updateValidity()}focus(t){this.displayInput.focus(t)}blur(){this.displayInput.blur()}async handleInput(){let t=this.displayInput.value;this.displayInputValue=t,await this.updateComplete,this.open=this.filteredWrapper.children.length>0,this.formControlController.updateValidity(),this.emit("sd-input")}handleChange(){(!this.selectedOptions||!this.multiple)&&(this.selectedTextLabel=this.displayInput.value,this.updateComplete.then(()=>{this.formControlController.updateValidity()}),this.emit("sd-change"))}getSlottedOptions(){return R(L(this.defaultSlot)).flat()}getSlottedOptGroups(){return K(L(this.defaultSlot))}async handleDefaultSlotChange(){if(!customElements.get("sd-5-15-0-option")){customElements.whenDefined("sd-5-15-0-option").then(()=>this.handleDefaultSlotChange());return}let t=this.getSlottedOptions(),e=this.getSlottedOptGroups();this.applySizeToOptions();let i=this.findOptionByValue(t,this.value);this.selectedTextLabel=(i==null?void 0:i.getTextLabel())||"",t.forEach((a,n)=>{this.multiple&&(a.checkbox=!0),a.id=a.id||`sd-5-15-0-combobox-option-${n}`}),e.forEach((a,n)=>{a.id=a.id||`sd-5-15-0-combobox-optgroup-${n}`}),await this.syncSelectedOptionsAndValue(),this.multiple?this.createComboboxOptionsFromQuery(this.displayInputValue):this.createComboboxOptionsFromQuery("")}render(){let t={left:this.hasSlotController.test("left"),right:this.hasSlotController.test("right")},e=this.hasSlotController.test("label"),i=this.hasSlotController.test("help-text"),a=this.label?!0:!!e,n=this.helpText?!0:!!i,o=this.clearable&&!this.disabled&&!this.visuallyDisabled,f=this.disabled?"disabled":this.visuallyDisabled&&!this.hasFocus?"visuallyDisabled":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus||this.open?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",h=this.disabled||this.visuallyDisabled?"cursor-not-allowed":"cursor-pointer",v=this.disabled||this.visuallyDisabled?"text-neutral-500":"text-primary",y={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],b={sm:"mr-1",md:"mr-2",lg:"mr-2"}[this.size],m={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return p`<div part="form-control" class="${d("relative text-left",h,this.size==="sm"?"text-sm":"text-base",this.open&&"z-50")}"><label id="label" part="form-control-label" class="${a&&"inline-block mb-2"}" aria-hidden="${!a}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label> <span aria-live="polite" class="sr-only">${this.deletedTagLabel}</span><div part="form-control-input" class="relative w-full bg-white text-black"><div part="border" class="${d("absolute top-0 w-full h-full pointer-events-none border rounded-default z-10 transition-[border] duration-medium ease-in-out",{disabled:"border-neutral-500",visuallyDisabled:"border-neutral-500",readonly:"border-neutral-800",activeInvalid:"border-error border-2",activeValid:"border-success border-2",active:"border-primary border-2",invalid:"border-error",valid:"border-success",default:"border-neutral-800"}[f],this.open&&(this.currentPlacement==="bottom"?"rounded-bl-none rounded-br-none":"rounded-tl-none rounded-tr-none"))}"></div><sd-5-15-0-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${d("inline-flex relative w-full",this.currentPlacement==="bottom"?"origin-top":"origin-bottom")}" placement="${this.placement}" strategy="${this.hoist?"fixed":"absolute"}" flip shift sync="width" auto-size="vertical" auto-size-padding="10" exportparts="
9
+ " size="${this.size==="sm"?"sm":"lg"}" removable @keydown="${t=>this.handleTagMaxOptionsKeyDown(t)}" @sd-remove="${t=>this.handleTagRemove(t)}">${this.selectedOptions.length} ${this.localize.term("tagsSelected")}</sd-5-15-2-tag>`]}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().addEventListener("focusin",this.handleDocumentFocusIn)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().removeEventListener("focusin",this.handleDocumentFocusIn)}handleFocus(){this.hasFocus=!0,this.emit("sd-focus")}handleBlur(){this.hasFocus=!1,this.emit("sd-blur")}handleTagKeyDown(t,e){(t.key==="Backspace"||t.key==="Enter"||t.key===" ")&&this.multiple&&(t.preventDefault(),t.stopPropagation(),this.handleTagRemove(new CustomEvent("sd-remove"),e),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0})))}handleTagMaxOptionsKeyDown(t){(t.key==="Backspace"||t.key==="Enter"||t.key===" ")&&this.multiple&&(t.preventDefault(),t.stopPropagation(),this.handleTagRemove(new CustomEvent("sd-remove"),this.selectedOptions[this.selectedOptions.length-1]),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0})))}handleLabelClick(){this.visuallyDisabled||this.displayInput.focus()}handleTagRemove(t,e){t.stopPropagation(),e||this.clearCombobox(),e&&!this.disabled&&(this.toggleOptionSelection(e,!1),this.setOrderedSelectedOptions(e),this.deletedTagLabel="",this.deletedTagLabel=this.localize.term("removed",e.textContent),this.updateComplete.then(()=>{this.selectionChanged(),this.emit("sd-input"),this.emit("sd-change")}))}handleComboboxMouseDown(t){if(this.visuallyDisabled){t.preventDefault(),t.stopPropagation();return}let i=t.composedPath().some(n=>n instanceof HTMLSlotElement&&n.name==="removable-indicator");if(this.disabled||i)return;(this.open?this.hide():this.show()).then(()=>{setTimeout(()=>this.displayInput.focus({preventScroll:!0}))})}handleComboboxKeyDown(t){t.key!=="Tab"&&this.handleDocumentKeyDown(t)}handleClearClick(t){t.stopPropagation(),this.clearCombobox()}handleNoResultsClick(t){t.preventDefault(),this.hide()}clearCombobox(){this.value!==""&&(this.value="",this.displayInputValue="",this.selectedTextLabel="",this.lastOption=void 0,this.selectedOptions=[],this.getSlottedOptions().forEach(t=>{t.selected=!1}),this.displayInput.focus({preventScroll:!0}),this.updateComplete.then(()=>{this.emit("sd-clear"),this.emit("sd-input"),this.emit("sd-change")}))}preventLoosingFocus(t){t.stopPropagation(),t.preventDefault()}handleOptionClick(t){let i=t.target.closest("sd-5-15-2-option"),a=this.value;i&&!i.disabled&&(this.multiple?(this.toggleOptionSelection(i),this.lastOption=i,this.setOrderedSelectedOptions(i),this.updateComplete.then(()=>{this.selectionChanged()})):(this.setOrderedSelectedOptions(i),this.setSelectedOptions(i)),this.updateComplete.then(()=>{this.displayInput.focus({preventScroll:!0}),this.value!==a&&(this.emit("sd-input"),this.emit("sd-change"))}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))}selectNextOption(t){let e=this.getAllFilteredOptions();if(e.length===0)return;let i=this.getCurrentOption(),a=e.indexOf(i),n=Math.max(0,a);if(t){let o=a+1;n=o>e.length-1?0:o}else{let o=a-1;n=o<0?e.length-1:o}this.setCurrentOption(e[n],new KeyboardEvent("keydown")),A(this.getCurrentOption(),this.listbox,"vertical","auto")}getAllFilteredOptions(){return[...this.filteredWrapper.querySelectorAll("sd-5-15-2-option")]}getCurrentOption(){return this.getAllFilteredOptions().find(t=>t.current)}setCurrentOption(t,e){let i=this.getAllFilteredOptions();this.displayInput.removeAttribute("aria-activedescendant"),i.forEach(a=>{a.current=!1,a.setAttribute("aria-selected","false"),a.isKeyboardFocus=!1}),t&&(t.current=!0,t.setAttribute("aria-selected","true"),this.displayInput.setAttribute("aria-activedescendant",t.id)),t&&(e==null?void 0:e.type)==="keydown"&&(t.isKeyboardFocus=!0)}toggleOptionSelection(t,e){let a=this.getSlottedOptions().find(n=>n.value&&t.value?n.value===t.value:n.getTextLabel()===t.getTextLabel());a&&(a.selected=e!=null?e:!a.selected)}findOptionByValue(t,e){if(e)return Array.isArray(e)?t.find(i=>e.includes(i.value)):t.find(i=>i.value===e)}selectedOptionsAndValueSynced(){var t;return!this.value&&this.selectedOptions.length===0?!0:Array.isArray(this.value)?this.value.length===this.selectedOptions.length:this.value===((t=this.selectedOptions[0])==null?void 0:t.value)}isOptionSelected(t){return t.value?this.value.includes(t.value):this.value.includes(t.getTextLabel())}syncSelectedOptionsAndValue(){return this.selectedOptionsAndValueSynced()?void 0:(this.getSlottedOptions().forEach(e=>{e.selected=!1}),this.selectedOptions=this.getSlottedOptions().filter(e=>this.isOptionSelected(e)),this.selectedOptions.forEach(e=>{e&&(e.selected=!0)}),Promise.resolve())}compareOptions(t,e){return t.value&&e.value?t.value===e.value:t.getTextLabel()===e.getTextLabel()}setSelectedOptions(t){this.getSlottedOptions().forEach(i=>{i.selected=this.compareOptions(i,t)}),this.selectionChanged()}setOrderedSelectedOptions(t){let e=this.getSlottedOptions().find(i=>this.compareOptions(i,t));this.multiple?this.selectedOptions.length>0&&e&&this.selectedOptions.find(i=>this.compareOptions(i,e))?this.selectedOptions=this.selectedOptions.filter(i=>!this.compareOptions(i,e)):this.selectedOptions=[...this.selectedOptions,e]:this.selectedOptions=[e]}selectionChanged(){var e,i,a;let t=this.selectedOptions.some(n=>n?this.isOptionSelected(n):!1);this.multiple?(!t&&this.selectedOptions.length>0?this.value=[...this.value,...this.selectedOptions.map(n=>n.value||n.getTextLabel())]:this.value=this.selectedOptions.map(n=>(n==null?void 0:n.value)||(n==null?void 0:n.getTextLabel())||""),this.displayInputValue=""):(this.value=((e=this.selectedOptions[0])==null?void 0:e.value)||((i=this.selectedOptions[0])==null?void 0:i.getTextLabel())||"",this.selectedTextLabel=((a=this.selectedOptions[0])==null?void 0:a.getTextLabel())||"",this.displayInputValue=""),this.updateComplete.then(()=>{this.formControlController.updateValidity()})}createComboboxOptionsFromQuery(t){let e=[];this.filteredOptions=this.getSlottedOptions().filter(i=>this.filter(i,t)||t==="").map(i=>{var y,b,m;let a=i.cloneNode(!0);if(a.current=a.value===((y=this.lastOption)==null?void 0:y.value),a.selected=i.selected,a.checkbox=i.checkbox,a.size=i.size,!(((b=i.parentElement)==null?void 0:b.tagName.toLowerCase())==="sd-5-15-2-optgroup"))return a;let o=i.parentElement,f=(m=o.querySelector('[slot="label"]'))==null?void 0:m.cloneNode(!0),h=e.find(O=>O.id===o.id);if(h){h==null||h.appendChild(a),f&&(h==null||h.appendChild(f));return}let v=o.cloneNode();return v.appendChild(a),f&&v.appendChild(f),e.push(v),v}).filter(Boolean)}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t),this.invalidMessage.textContent=t.target.validationMessage}handleCurrentPlacement(t){let e=t.detail;e&&(this.currentPlacement=e)}handleFilterChange(){this.createComboboxOptionsFromQuery(this.displayInputValue)}handleUseTagsChange(){let t=this.getAllFilteredOptions();customElements.get("sd-5-15-2-option")&&t.forEach(e=>{e.checkbox=this.multiple})}applySizeToOptions(){this.getSlottedOptions().forEach(t=>{t.size=this.size})}handleDisabledChange(){this.formControlController.setValidity(this.disabled),(this.disabled||this.visuallyDisabled)&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.syncSelectedOptionsAndValue(),this.multiple?this.createComboboxOptionsFromQuery(this.displayInput.value):this.createComboboxOptionsFromQuery("")}handleDisplayInputValueChange(){this.createComboboxOptionsFromQuery(this.displayInputValue)}async handleOpenChange(){if(this.open&&(!this.disabled||!this.visuallyDisabled)){this.emit("sd-show"),this.addOpenListeners(),await I(this),this.listbox.hidden=!1,this.popup.active=!0;let{keyframes:i,options:a}=C(this,"combobox.show",{dir:this.localize.dir()});await S(this.popup.popup,i,a),this.emit("sd-after-show"),this.filteredOptions.length===0&&this.emit("sd-error");return}this.setCurrentOption(null),this.displayInput.removeAttribute("aria-activedescendant"),this.emit("sd-hide"),this.removeOpenListeners(),await I(this);let{keyframes:t,options:e}=C(this,"combobox.hide",{dir:this.localize.dir()});await S(this.popup.popup,t,e),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sd-after-hide")}async show(){if(this.open||this.disabled||this.visuallyDisabled){this.open=!1;return}return this.open=!0,Promise.race([x(this,"sd-after-show"),x(this,"sd-error")])}async hide(){if(!this.open||this.disabled){this.open=!1;return}return this.displayInputValue="",this.open=!1,x(this,"sd-after-hide")}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.formControlController.fakeUserInteraction(),this.valueInput.reportValidity()}setCustomValidity(t){this.valueInput.setCustomValidity(t),this.formControlController.updateValidity()}focus(t){this.displayInput.focus(t)}blur(){this.displayInput.blur()}async handleInput(){let t=this.displayInput.value;this.displayInputValue=t,await this.updateComplete,this.open=this.filteredWrapper.children.length>0,this.formControlController.updateValidity(),this.emit("sd-input")}handleChange(){(!this.selectedOptions||!this.multiple)&&(this.selectedTextLabel=this.displayInput.value,this.updateComplete.then(()=>{this.formControlController.updateValidity()}),this.emit("sd-change"))}getSlottedOptions(){return R(L(this.defaultSlot)).flat()}getSlottedOptGroups(){return K(L(this.defaultSlot))}async handleDefaultSlotChange(){if(!customElements.get("sd-5-15-2-option")){customElements.whenDefined("sd-5-15-2-option").then(()=>this.handleDefaultSlotChange());return}let t=this.getSlottedOptions(),e=this.getSlottedOptGroups();this.applySizeToOptions();let i=this.findOptionByValue(t,this.value);this.selectedTextLabel=(i==null?void 0:i.getTextLabel())||"",t.forEach((a,n)=>{this.multiple&&(a.checkbox=!0),a.id=a.id||`sd-5-15-2-combobox-option-${n}`}),e.forEach((a,n)=>{a.id=a.id||`sd-5-15-2-combobox-optgroup-${n}`}),await this.syncSelectedOptionsAndValue(),this.multiple?this.createComboboxOptionsFromQuery(this.displayInputValue):this.createComboboxOptionsFromQuery("")}render(){let t={left:this.hasSlotController.test("left"),right:this.hasSlotController.test("right")},e=this.hasSlotController.test("label"),i=this.hasSlotController.test("help-text"),a=this.label?!0:!!e,n=this.helpText?!0:!!i,o=this.clearable&&!this.disabled&&!this.visuallyDisabled,f=this.disabled?"disabled":this.visuallyDisabled&&!this.hasFocus?"visuallyDisabled":this.hasFocus&&this.showInvalidStyle?"activeInvalid":this.hasFocus&&this.styleOnValid&&this.showValidStyle?"activeValid":this.hasFocus||this.open?"active":this.showInvalidStyle?"invalid":this.styleOnValid&&this.showValidStyle?"valid":"default",h=this.disabled||this.visuallyDisabled?"cursor-not-allowed":"cursor-pointer",v=this.disabled||this.visuallyDisabled?"text-neutral-500":"text-primary",y={sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size],b={sm:"mr-1",md:"mr-2",lg:"mr-2"}[this.size],m={sm:"text-base",md:"text-lg",lg:"text-xl"}[this.size];return p`<div part="form-control" class="${d("relative text-left",h,this.size==="sm"?"text-sm":"text-base",this.open&&"z-50")}"><label id="label" part="form-control-label" class="${a&&"inline-block mb-2"}" aria-hidden="${!a}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label> <span aria-live="polite" class="sr-only">${this.deletedTagLabel}</span><div part="form-control-input" class="relative w-full bg-white text-black"><div part="border" class="${d("absolute top-0 w-full h-full pointer-events-none border rounded-default z-10 transition-[border] duration-medium ease-in-out",{disabled:"border-neutral-500",visuallyDisabled:"border-neutral-500",readonly:"border-neutral-800",activeInvalid:"border-error border-2",activeValid:"border-success border-2",active:"border-primary border-2",invalid:"border-error",valid:"border-success",default:"border-neutral-800"}[f],this.open&&(this.currentPlacement==="bottom"?"rounded-bl-none rounded-br-none":"rounded-tl-none rounded-tr-none"))}"></div><sd-5-15-2-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${d("inline-flex relative w-full",this.currentPlacement==="bottom"?"origin-top":"origin-bottom")}" placement="${this.placement}" strategy="${this.hoist?"fixed":"absolute"}" flip shift sync="width" auto-size="vertical" auto-size-padding="10" exportparts="
10
10
  popup:popup__content,
11
- "><div part="combobox" class="${d("relative w-full px-4 flex flex-row items-center rounded-default transition-colors hover:duration-fast ease-in-out",this.visuallyDisabled||this.disabled?"hover:bg-transparent":"hover:bg-neutral-200",this.open&&"shadow transition-shadow duration-medium ease-in-out",{sm:"py-1 min-h-[32px]",md:"py-1 min-h-[40px]",lg:"py-2 min-h-[48px]"}[this.size])}" slot="anchor" @keydown="${this.handleComboboxKeyDown}" @mousedown="${this.handleComboboxMouseDown}">${t.left?p`<slot part="left" name="left" class="${d("inline-flex",b,v,m)}"></slot>`:""} ${this.multiple&&this.useTags&&this.tags.length>0?p`<div part="tags" class="${d("flex items-center gap-1",b)}">${this.tags}</div>`:null} <input id="display-input" name="${this.name}" form="${this.form}" part="display-input" class="${d("appearance-none outline-none bg-transparent flex-auto min-w-0",h,this.selectedTextLabel&&!this.multiple?"placeholder-black":"placeholder-neutral-700")}" type="text" placeholder="${this.selectedTextLabel&&!this.multiple?this.selectedTextLabel:this.placeholder||this.localize.term("comboboxDefaultPlaceholder")}" .disabled="${this.disabled}" .value="${this.displayInputValue}" autocomplete="off" spellcheck="false" autocapitalize="off" aria-controls="listbox" aria-expanded="${this.open}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled||this.visuallyDisabled}" aria-describedby="help-text invalid-message" aria-invalid="${this.showInvalidStyle}" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}" aria-autocomplete="list" aria-owns="listbox" @input="${this.handleInput}" @change="${this.handleChange}"><div aria-live="polite" id="control-value" class="absolute top-0 left-0 opacity-0 -z-10">${this.selectedOptions.map(O=>O==null?void 0:O.getTextLabel()).join(", ")}</div><input class="${d("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",h)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value)?this.value.join(", "):this.value}" tabindex="-1" aria-controls="control-value" aria-hidden="true" @focus="${()=>this.focus()}" @invalid="${this.handleInvalid}"> ${o?p`<button part="clear-button" class="${d("flex justify-center",y,this.value.length>0?"visible":"invisible")}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.preventLoosingFocus}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-5-15-0-icon class="${d("text-neutral-700",m)}" name="closing-round" library="_internal"></sd-5-15-0-icon></slot></button>`:""} ${this.showInvalidStyle?p`<sd-5-15-0-icon part="invalid-icon" class="${d(y,m,"text-error")}" library="_internal" name="risk"></sd-5-15-0-icon>`:""} ${this.styleOnValid&&this.showValidStyle?p`<sd-5-15-0-icon part="valid-icon" class="${d("flex-shrink-0 text-success",y,m)}" library="_internal" name="status-check"></sd-5-15-0-icon>`:""}<slot name="right" part="right" class="${d("inline-flex ml-2 leading-[0]",this.disabled||this.visuallyDisabled?"text-neutral-500":"text-primary",m)}">${this.type!=="search"?p`<sd-5-15-0-icon class="${d("transition-transform duration-medium ease-in-out",this.open?"rotate-180":"rotate-0")}" name="chevron-down" part="chevron" library="_internal" color="currentColor" label="${this.localize.term("open")}"></sd-5-15-0-icon>`:""}</slot>${this.type==="search"?p`<button class="${d("flex items-center sd-interactive",y)}" type="button"><sd-5-15-0-icon class="${d(v,m)}" library="_internal" name="magnifying-glass" label="${this.localize.term("search")}"></sd-5-15-0-icon></button>`:p`<button class="sd-interactive combobox-button absolute top-2" @keydown="${this.handleComboboxMouseDown}" type="button"><span class="sr-only">${this.localize.term("open")}</span></button>`}</div><div id="listbox" role="${M(this.multiple?void 0:"listbox")}" aria-expanded="${this.open}" aria-multiselectable="${this.multiple}" aria-labelledby="label" part="listbox" class="${d("bg-white px-2 py-3 relative border-primary overflow-y-auto",this.open&&"shadow transition-shadow duration-medium ease-in-out",this.currentPlacement==="bottom"?"border-r-2 border-b-2 border-l-2 rounded-br-default rounded-bl-default":"border-r-2 border-t-2 border-l-2 rounded-tr-default rounded-tl-default")}" tabindex="-1" @mousedown="${this.preventLoosingFocus}" @mouseup="${this.handleOptionClick}"><div part="filtered-listbox">${this.filteredOptions.length===0?p`<span id="noResults" class="px-4 flex items-center w-full transition-all text-left text-base relative text-black py-3" aria-hidden="true" @click="${this.handleNoResultsClick}">${this.localize.term("noResults")}</span>`:this.options}</div><slot id="defaultOptionsSlot" class="hidden" @slotchange="${this.handleDefaultSlotChange}"></slot></div></sd-5-15-0-popup></div><div part="form-control-help-text" id="help-text" class="text-sm text-neutral-700 mt-1" aria-hidden="${!n}"><slot name="help-text">${this.helpText}</slot></div></div>${this.formControlController.renderInvalidMessage()}`}};s.styles=[...T.styles,D`:host{display:block;position:relative;width:100%}:host([required]) #label:after{content:" *"}:host([disabled]) ::-moz-placeholder,:host([visually-disabled]) ::-moz-placeholder{--tw-text-opacity:1;color:rgb(var(--sd-color-neutral-500,174 174 174)/var(--tw-text-opacity,1))}:host([disabled]) ::placeholder,:host([visually-disabled]) ::placeholder{--tw-text-opacity:1;color:rgb(var(--sd-color-neutral-500,174 174 174)/var(--tw-text-opacity,1))}:host([visually-disabled]) input{caret-color:transparent}:host([size=sm]) .combobox-button{height:var(--sd-spacing-4,1rem);right:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem)}:host([size=md]) .combobox-button{height:var(--sd-spacing-6,1.5rem);right:.85rem;width:var(--sd-spacing-6,1.5rem)}:host([size=lg]) .combobox-button{height:var(--sd-spacing-8,2rem);right:var(--sd-spacing-3,.75rem);width:var(--sd-spacing-8,2rem)}[part=listbox]{max-height:var(--auto-size-available-height,auto)}sd-5-15-0-popup::part(popup){z-index:var(--sd-z-index-dropdown,900)}sd-5-15-0-tag::part(base){border-radius:var(--sd-border-radius-default,.25rem);padding-left:var(--sd-spacing-1,.25rem);padding-right:var(--sd-spacing-1,.25rem)}sd-5-15-0-tag::part(content){display:inline-block;max-width:var(--tag-max-width,15ch);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}sd-5-15-0-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-5-15-0-tag[disabled=false]::part(base):hover{--tw-bg-opacity:1;background-color:rgb(var(--sd-color-primary-100,236 240 249)/var(--tw-bg-opacity,1))}[part=filtered-listbox] sd-5-15-0-optgroup:first-of-type{--display-divider:none}mark{background-color:transparent;color:inherit;font-weight:700}`],l([c("sd-5-15-0-popup")],s.prototype,"popup",2),l([c('[part="combobox"]')],s.prototype,"combobox",2),l([c('[part="display-input"]')],s.prototype,"displayInput",2),l([c(".value-input")],s.prototype,"valueInput",2),l([c('[part="listbox"]')],s.prototype,"listbox",2),l([c('[part="tags"]')],s.prototype,"tagWrapper",2),l([c('[part="filtered-listbox"]')],s.prototype,"filteredWrapper",2),l([c("slot:not([name])")],s.prototype,"defaultSlot",2),l([c("#invalid-message")],s.prototype,"invalidMessage",2),l([u()],s.prototype,"hasFocus",2),l([u()],s.prototype,"displayInputValue",2),l([u()],s.prototype,"selectedTextLabel",2),l([u()],s.prototype,"selectedOptions",2),l([u()],s.prototype,"filteredOptions",2),l([u()],s.prototype,"allOptions",2),l([u()],s.prototype,"lastOption",2),l([u()],s.prototype,"showValidStyle",2),l([u()],s.prototype,"showInvalidStyle",2),l([u()],s.prototype,"deletedTagLabel",2),l([r({reflect:!0})],s.prototype,"name",2),l([r({converter:{fromAttribute:t=>t.split(" "),toAttribute:t=>t.join(" ")}})],s.prototype,"value",2),l([P()],s.prototype,"defaultValue",2),l([r({type:String,reflect:!0})],s.prototype,"size",2),l([r({type:String,reflect:!0})],s.prototype,"placeholder",2),l([r({type:String,attribute:"max-options-tag-label",reflect:!0})],s.prototype,"maxOptionsTagLabel",2),l([r({type:Boolean,reflect:!0})],s.prototype,"disabled",2),l([r({type:Boolean,reflect:!0,attribute:"visually-disabled"})],s.prototype,"visuallyDisabled",2),l([r({type:Boolean,reflect:!0})],s.prototype,"clearable",2),l([r({type:Boolean,reflect:!0})],s.prototype,"open",2),l([r({type:Boolean,reflect:!0})],s.prototype,"hoist",2),l([r({type:String,reflect:!0})],s.prototype,"label",2),l([r({type:String,reflect:!0})],s.prototype,"placement",2),l([r({type:String,attribute:"help-text",reflect:!0})],s.prototype,"helpText",2),l([r({type:String,reflect:!0})],s.prototype,"form",2),l([r({type:Boolean,reflect:!0})],s.prototype,"required",2),l([r({type:String,reflect:!0})],s.prototype,"type",2),l([u()],s.prototype,"currentPlacement",2),l([r()],s.prototype,"getOption",2),l([r({type:Boolean,reflect:!0})],s.prototype,"multiple",2),l([r({type:Boolean,reflect:!0})],s.prototype,"useTags",2),l([r({type:Number,reflect:!0,attribute:"max-options-visible"})],s.prototype,"maxOptionsVisible",2),l([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],s.prototype,"styleOnValid",2),l([r()],s.prototype,"filter",2),l([r()],s.prototype,"getTag",2),l([g("filter",{waitUntilFirstUpdate:!0})],s.prototype,"handleFilterChange",1),l([g("useTags",{waitUntilFirstUpdate:!0})],s.prototype,"handleUseTagsChange",1),l([g("size",{waitUntilFirstUpdate:!0})],s.prototype,"applySizeToOptions",1),l([g(["disabled","visually-disabled"],{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),l([g("value",{waitUntilFirstUpdate:!0})],s.prototype,"handleValueChange",1),l([g("displayInputValue",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisplayInputValueChange",1),l([g("open",{waitUntilFirstUpdate:!0})],s.prototype,"handleOpenChange",1),s=l([k("sd-5-15-0-combobox")],s);E("combobox.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});E("combobox.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});export{s as a};
11
+ "><div part="combobox" class="${d("relative w-full px-4 flex flex-row items-center rounded-default transition-colors hover:duration-fast ease-in-out",this.visuallyDisabled||this.disabled?"hover:bg-transparent":"hover:bg-neutral-200",this.open&&"shadow transition-shadow duration-medium ease-in-out",{sm:"py-1 min-h-[32px]",md:"py-1 min-h-[40px]",lg:"py-2 min-h-[48px]"}[this.size])}" slot="anchor" @keydown="${this.handleComboboxKeyDown}" @mousedown="${this.handleComboboxMouseDown}">${t.left?p`<slot part="left" name="left" class="${d("inline-flex",b,v,m)}"></slot>`:""} ${this.multiple&&this.useTags&&this.tags.length>0?p`<div part="tags" class="${d("flex items-center gap-1",b)}">${this.tags}</div>`:null} <input id="display-input" name="${this.name}" form="${this.form}" part="display-input" class="${d("appearance-none outline-none bg-transparent flex-auto min-w-0",h,this.selectedTextLabel&&!this.multiple?"placeholder-black":"placeholder-neutral-700")}" type="text" placeholder="${this.selectedTextLabel&&!this.multiple?this.selectedTextLabel:this.placeholder||this.localize.term("comboboxDefaultPlaceholder")}" .disabled="${this.disabled}" .value="${this.displayInputValue}" autocomplete="off" spellcheck="false" autocapitalize="off" aria-controls="listbox" aria-expanded="${this.open}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled||this.visuallyDisabled}" aria-describedby="help-text invalid-message" aria-invalid="${this.showInvalidStyle}" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}" aria-autocomplete="list" aria-owns="listbox" @input="${this.handleInput}" @change="${this.handleChange}"><div aria-live="polite" id="control-value" class="absolute top-0 left-0 opacity-0 -z-10">${this.selectedOptions.map(O=>O==null?void 0:O.getTextLabel()).join(", ")}</div><input class="${d("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10",h)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value)?this.value.join(", "):this.value}" tabindex="-1" aria-controls="control-value" aria-hidden="true" @focus="${()=>this.focus()}" @invalid="${this.handleInvalid}"> ${o?p`<button part="clear-button" class="${d("flex justify-center",y,this.value.length>0?"visible":"invisible")}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.preventLoosingFocus}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-5-15-2-icon class="${d("text-neutral-700",m)}" name="closing-round" library="_internal"></sd-5-15-2-icon></slot></button>`:""} ${this.showInvalidStyle?p`<sd-5-15-2-icon part="invalid-icon" class="${d(y,m,"text-error")}" library="_internal" name="risk"></sd-5-15-2-icon>`:""} ${this.styleOnValid&&this.showValidStyle?p`<sd-5-15-2-icon part="valid-icon" class="${d("flex-shrink-0 text-success",y,m)}" library="_internal" name="status-check"></sd-5-15-2-icon>`:""}<slot name="right" part="right" class="${d("inline-flex ml-2 leading-[0]",this.disabled||this.visuallyDisabled?"text-neutral-500":"text-primary",m)}">${this.type!=="search"?p`<sd-5-15-2-icon class="${d("transition-transform duration-medium ease-in-out",this.open?"rotate-180":"rotate-0")}" name="chevron-down" part="chevron" library="_internal" color="currentColor" label="${this.localize.term("open")}"></sd-5-15-2-icon>`:""}</slot>${this.type==="search"?p`<button class="${d("flex items-center sd-interactive",y)}" type="button"><sd-5-15-2-icon class="${d(v,m)}" library="_internal" name="magnifying-glass" label="${this.localize.term("search")}"></sd-5-15-2-icon></button>`:p`<button class="sd-interactive combobox-button absolute top-2" @keydown="${this.handleComboboxMouseDown}" type="button"><span class="sr-only">${this.localize.term("open")}</span></button>`}</div><div id="listbox" role="${M(this.multiple?void 0:"listbox")}" aria-expanded="${this.open}" aria-multiselectable="${this.multiple}" aria-labelledby="label" part="listbox" class="${d("bg-white px-2 py-3 relative border-primary overflow-y-auto",this.open&&"shadow transition-shadow duration-medium ease-in-out",this.currentPlacement==="bottom"?"border-r-2 border-b-2 border-l-2 rounded-br-default rounded-bl-default":"border-r-2 border-t-2 border-l-2 rounded-tr-default rounded-tl-default")}" tabindex="-1" @mousedown="${this.preventLoosingFocus}" @mouseup="${this.handleOptionClick}"><div part="filtered-listbox">${this.filteredOptions.length===0?p`<span id="noResults" class="px-4 flex items-center w-full transition-all text-left text-base relative text-black py-3" aria-hidden="true" @click="${this.handleNoResultsClick}">${this.localize.term("noResults")}</span>`:this.options}</div><slot id="defaultOptionsSlot" class="hidden" @slotchange="${this.handleDefaultSlotChange}"></slot></div></sd-5-15-2-popup></div><div part="form-control-help-text" id="help-text" class="text-sm text-neutral-700 mt-1" aria-hidden="${!n}"><slot name="help-text">${this.helpText}</slot></div></div>${this.formControlController.renderInvalidMessage()}`}};s.styles=[...T.styles,D`:host{display:block;position:relative;width:100%}:host([required]) #label:after{content:" *"}:host([disabled]) ::-moz-placeholder,:host([visually-disabled]) ::-moz-placeholder{--tw-text-opacity:1;color:rgb(var(--sd-color-neutral-500,174 174 174)/var(--tw-text-opacity,1))}:host([disabled]) ::placeholder,:host([visually-disabled]) ::placeholder{--tw-text-opacity:1;color:rgb(var(--sd-color-neutral-500,174 174 174)/var(--tw-text-opacity,1))}:host([visually-disabled]) input{caret-color:transparent}:host([size=sm]) .combobox-button{height:var(--sd-spacing-4,1rem);right:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem)}:host([size=md]) .combobox-button{height:var(--sd-spacing-6,1.5rem);right:.85rem;width:var(--sd-spacing-6,1.5rem)}:host([size=lg]) .combobox-button{height:var(--sd-spacing-8,2rem);right:var(--sd-spacing-3,.75rem);width:var(--sd-spacing-8,2rem)}[part=listbox]{max-height:var(--auto-size-available-height,auto)}sd-5-15-2-popup::part(popup){z-index:var(--sd-z-index-dropdown,900)}sd-5-15-2-tag::part(base){border-radius:var(--sd-border-radius-default,.25rem);padding-left:var(--sd-spacing-1,.25rem);padding-right:var(--sd-spacing-1,.25rem)}sd-5-15-2-tag::part(content){display:inline-block;max-width:var(--tag-max-width,15ch);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}sd-5-15-2-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-5-15-2-tag[disabled=false]::part(base):hover{--tw-bg-opacity:1;background-color:rgb(var(--sd-color-primary-100,236 240 249)/var(--tw-bg-opacity,1))}[part=filtered-listbox] sd-5-15-2-optgroup:first-of-type{--display-divider:none}mark{background-color:transparent;color:inherit;font-weight:700}`],l([c("sd-5-15-2-popup")],s.prototype,"popup",2),l([c('[part="combobox"]')],s.prototype,"combobox",2),l([c('[part="display-input"]')],s.prototype,"displayInput",2),l([c(".value-input")],s.prototype,"valueInput",2),l([c('[part="listbox"]')],s.prototype,"listbox",2),l([c('[part="tags"]')],s.prototype,"tagWrapper",2),l([c('[part="filtered-listbox"]')],s.prototype,"filteredWrapper",2),l([c("slot:not([name])")],s.prototype,"defaultSlot",2),l([c("#invalid-message")],s.prototype,"invalidMessage",2),l([u()],s.prototype,"hasFocus",2),l([u()],s.prototype,"displayInputValue",2),l([u()],s.prototype,"selectedTextLabel",2),l([u()],s.prototype,"selectedOptions",2),l([u()],s.prototype,"filteredOptions",2),l([u()],s.prototype,"allOptions",2),l([u()],s.prototype,"lastOption",2),l([u()],s.prototype,"showValidStyle",2),l([u()],s.prototype,"showInvalidStyle",2),l([u()],s.prototype,"deletedTagLabel",2),l([r({reflect:!0})],s.prototype,"name",2),l([r({converter:{fromAttribute:t=>t.split(" "),toAttribute:t=>t.join(" ")}})],s.prototype,"value",2),l([P()],s.prototype,"defaultValue",2),l([r({type:String,reflect:!0})],s.prototype,"size",2),l([r({type:String,reflect:!0})],s.prototype,"placeholder",2),l([r({type:String,attribute:"max-options-tag-label",reflect:!0})],s.prototype,"maxOptionsTagLabel",2),l([r({type:Boolean,reflect:!0})],s.prototype,"disabled",2),l([r({type:Boolean,reflect:!0,attribute:"visually-disabled"})],s.prototype,"visuallyDisabled",2),l([r({type:Boolean,reflect:!0})],s.prototype,"clearable",2),l([r({type:Boolean,reflect:!0})],s.prototype,"open",2),l([r({type:Boolean,reflect:!0})],s.prototype,"hoist",2),l([r({type:String,reflect:!0})],s.prototype,"label",2),l([r({type:String,reflect:!0})],s.prototype,"placement",2),l([r({type:String,attribute:"help-text",reflect:!0})],s.prototype,"helpText",2),l([r({type:String,reflect:!0})],s.prototype,"form",2),l([r({type:Boolean,reflect:!0})],s.prototype,"required",2),l([r({type:String,reflect:!0})],s.prototype,"type",2),l([u()],s.prototype,"currentPlacement",2),l([r()],s.prototype,"getOption",2),l([r({type:Boolean,reflect:!0})],s.prototype,"multiple",2),l([r({type:Boolean,reflect:!0})],s.prototype,"useTags",2),l([r({type:Number,reflect:!0,attribute:"max-options-visible"})],s.prototype,"maxOptionsVisible",2),l([r({type:Boolean,reflect:!0,attribute:"style-on-valid"})],s.prototype,"styleOnValid",2),l([r()],s.prototype,"filter",2),l([r()],s.prototype,"getTag",2),l([g("filter",{waitUntilFirstUpdate:!0})],s.prototype,"handleFilterChange",1),l([g("useTags",{waitUntilFirstUpdate:!0})],s.prototype,"handleUseTagsChange",1),l([g("size",{waitUntilFirstUpdate:!0})],s.prototype,"applySizeToOptions",1),l([g(["disabled","visually-disabled"],{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),l([g("value",{waitUntilFirstUpdate:!0})],s.prototype,"handleValueChange",1),l([g("displayInputValue",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisplayInputValueChange",1),l([g("open",{waitUntilFirstUpdate:!0})],s.prototype,"handleOpenChange",1),s=l([k("sd-5-15-2-combobox")],s);E("combobox.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});E("combobox.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});export{s as a};
@@ -1 +1 @@
1
- var p=t=>Array.from(t.assignedElements({flatten:!0})),o=t=>t.tagName.toLocaleLowerCase()==="sd-5-15-0-option"?t:Array.from(t.querySelectorAll(":scope > sd-5-15-0-option")),e=t=>t.tagName.toLocaleLowerCase()==="sd-5-15-0-optgroup",r=t=>t.map(o),n=t=>t.filter(e),s=t=>t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();export{p as a,o as b,e as c,r as d,n as e,s as f};
1
+ var p=t=>Array.from(t.assignedElements({flatten:!0})),o=t=>t.tagName.toLocaleLowerCase()==="sd-5-15-2-option"?t:Array.from(t.querySelectorAll(":scope > sd-5-15-2-option")),e=t=>t.tagName.toLocaleLowerCase()==="sd-5-15-2-optgroup",r=t=>t.map(o),n=t=>t.filter(e),s=t=>t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();export{p as a,o as b,e as c,r as d,n as e,s as f};
@@ -1 +1 @@
1
- import{a as u}from"./chunk.CGQ2BPPZ.js";import{a as i}from"./chunk.26V4EXHB.js";import{a as o}from"./chunk.E2DRD2OX.js";import{a as h,b as a,c as r,d,h as n}from"./chunk.2FN4O4QC.js";import{b as c,e as l}from"./chunk.ZR5P6TQI.js";import{e as t}from"./chunk.TJOCV4DC.js";var e=class extends n{constructor(){super(...arguments);this.hasSlotController=new u(this,"default","left","right");this.current=!1;this.selected=!1;this.hasHover=!1;this.isKeyboardFocus=!1;this.size="lg";this.checkbox=!1;this.disabled=!1;this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){let s=this.getTextLabel();if(typeof this.cachedTextLabel=="undefined"){this.cachedTextLabel=s;return}s!==this.cachedTextLabel&&(this.cachedTextLabel=s,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){var s;return((s=this.textContent)!=null?s:"").trim()}render(){let s={default:this.hasSlotController.test("default"),left:this.hasSlotController.test("left"),right:this.hasSlotController.test("right")};return l`<div part="base" class="${i("px-4 flex items-center w-full transition-colors duration-fast ease-in-out text-left text-base relative text-black",{sm:"text-sm py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-700 cursor-not-allowed":"cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.isKeyboardFocus?"focus-outline focus-outline-offset":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${i("absolute w-full left-0 top-0 pointer-events-none transition-[height,top] duration-fast ease-in-out border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?l`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${i("relative flex flex-shrink-0 items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"bg-white border-neutral-800")}">${this.selected?l`<sd-5-15-0-icon part="checked-icon" class="text-white w-3 h-3" library="_internal" name="status-check"></sd-5-15-0-icon>`:""}</span>`:""} ${s.left?l`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${s.right?l`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};e.styles=[...n.styles,c`:host{display:block;outline:2px solid transparent!important;outline-offset:2px!important;position:relative;width:100%}.focus-outline-offset{outline-offset:-2px}`],t([d('[part="base"]')],e.prototype,"defaultSlot",2),t([r()],e.prototype,"current",2),t([r()],e.prototype,"selected",2),t([r()],e.prototype,"hasHover",2),t([r()],e.prototype,"isKeyboardFocus",2),t([a({type:String,reflect:!0})],e.prototype,"size",2),t([a({type:Boolean,reflect:!0})],e.prototype,"checkbox",2),t([a({type:Boolean,reflect:!0})],e.prototype,"disabled",2),t([a({type:String,reflect:!0})],e.prototype,"value",2),t([o("disabled")],e.prototype,"handleDisabledChange",1),t([o("selected")],e.prototype,"handleSelectedChange",1),t([o("value")],e.prototype,"handleValueChange",1),e=t([h("sd-5-15-0-option")],e);export{e as a};
1
+ import{a as u}from"./chunk.CGQ2BPPZ.js";import{a as i}from"./chunk.26V4EXHB.js";import{a as o}from"./chunk.E2DRD2OX.js";import{a as h,b as a,c as r,d,h as n}from"./chunk.2FN4O4QC.js";import{b as c,e as l}from"./chunk.ZR5P6TQI.js";import{e as t}from"./chunk.TJOCV4DC.js";var e=class extends n{constructor(){super(...arguments);this.hasSlotController=new u(this,"default","left","right");this.current=!1;this.selected=!1;this.hasHover=!1;this.isKeyboardFocus=!1;this.size="lg";this.checkbox=!1;this.disabled=!1;this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){let s=this.getTextLabel();if(typeof this.cachedTextLabel=="undefined"){this.cachedTextLabel=s;return}s!==this.cachedTextLabel&&(this.cachedTextLabel=s,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){var s;return((s=this.textContent)!=null?s:"").trim()}render(){let s={default:this.hasSlotController.test("default"),left:this.hasSlotController.test("left"),right:this.hasSlotController.test("right")};return l`<div part="base" class="${i("px-4 flex items-center w-full transition-colors duration-fast ease-in-out text-left text-base relative text-black",{sm:"text-sm py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-700 cursor-not-allowed":"cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.isKeyboardFocus?"focus-outline focus-outline-offset":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${i("absolute w-full left-0 top-0 pointer-events-none transition-[height,top] duration-fast ease-in-out border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?l`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${i("relative flex flex-shrink-0 items-center justify-center border rounded-sm h-4 w-4 mr-2",this.disabled?"border-neutral-500":this.selected?"bg-accent border-accent":"bg-white border-neutral-800")}">${this.selected?l`<sd-5-15-2-icon part="checked-icon" class="text-white w-3 h-3" library="_internal" name="status-check"></sd-5-15-2-icon>`:""}</span>`:""} ${s.left?l`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${s.right?l`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};e.styles=[...n.styles,c`:host{display:block;outline:2px solid transparent!important;outline-offset:2px!important;position:relative;width:100%}.focus-outline-offset{outline-offset:-2px}`],t([d('[part="base"]')],e.prototype,"defaultSlot",2),t([r()],e.prototype,"current",2),t([r()],e.prototype,"selected",2),t([r()],e.prototype,"hasHover",2),t([r()],e.prototype,"isKeyboardFocus",2),t([a({type:String,reflect:!0})],e.prototype,"size",2),t([a({type:Boolean,reflect:!0})],e.prototype,"checkbox",2),t([a({type:Boolean,reflect:!0})],e.prototype,"disabled",2),t([a({type:String,reflect:!0})],e.prototype,"value",2),t([o("disabled")],e.prototype,"handleDisabledChange",1),t([o("selected")],e.prototype,"handleSelectedChange",1),t([o("value")],e.prototype,"handleValueChange",1),e=t([h("sd-5-15-2-option")],e);export{e as a};
@@ -1 +1 @@
1
- import{b as m}from"./chunk.JMGRPC2F.js";import{a as s}from"./chunk.26V4EXHB.js";import{a as b}from"./chunk.Y7NVH75J.js";import{a as p}from"./chunk.E2DRD2OX.js";import{a as d,b as a,d as n,h as o}from"./chunk.2FN4O4QC.js";import{b as r}from"./chunk.ZR5P6TQI.js";import{e as t}from"./chunk.TJOCV4DC.js";var e=class extends o{constructor(){super(...arguments);this.localize=new b(this);this.disabled=!1;this.label=""}handleDisableOptions(){let{disabled:l}=this;this.defaultSlot.assignedElements().filter(i=>i.tagName.toLowerCase()==="sd-5-15-0-option").forEach(i=>{i.disabled=l})}handleDisabledChange(){this.handleDisableOptions()}render(){let{disabled:l}=this;return m`<div role="${l?"presentation":"group"}" class="${s(this.disabled?"text-neutral-500":"")}" part="base" aria-labelledby="group-label"><sd-5-15-0-divider id="divider" class="pt-2 pb-4" part="divider"></sd-5-15-0-divider><div part="label-container" class="${s(this.disabled?"text-neutral-500":"text-black")} px-4 font-bold text-left" role="presentation" id="group-label"><slot name="label"><span>${this.label}</span></slot></div><div role="listbox" part="options" aria-label="${this.localize.term("optionGroup")}"><slot @slotchange="${this.handleDisableOptions}"></slot></div></div>`}};e.styles=[...o.styles,r`:host{--display-divider:block}#divider{display:var(--display-divider)}`],t([n("slot:not([name])")],e.prototype,"defaultSlot",2),t([a({reflect:!0,type:Boolean})],e.prototype,"disabled",2),t([a({type:String,reflect:!0})],e.prototype,"label",2),t([p("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e=t([d("sd-5-15-0-optgroup")],e);export{e as a};
1
+ import{b as m}from"./chunk.JMGRPC2F.js";import{a as s}from"./chunk.26V4EXHB.js";import{a as b}from"./chunk.Y7NVH75J.js";import{a as p}from"./chunk.E2DRD2OX.js";import{a as d,b as a,d as n,h as o}from"./chunk.2FN4O4QC.js";import{b as r}from"./chunk.ZR5P6TQI.js";import{e as t}from"./chunk.TJOCV4DC.js";var e=class extends o{constructor(){super(...arguments);this.localize=new b(this);this.disabled=!1;this.label=""}handleDisableOptions(){let{disabled:l}=this;this.defaultSlot.assignedElements().filter(i=>i.tagName.toLowerCase()==="sd-5-15-2-option").forEach(i=>{i.disabled=l})}handleDisabledChange(){this.handleDisableOptions()}render(){let{disabled:l}=this;return m`<div role="${l?"presentation":"group"}" class="${s(this.disabled?"text-neutral-500":"")}" part="base" aria-labelledby="group-label"><sd-5-15-2-divider id="divider" class="pt-2 pb-4" part="divider"></sd-5-15-2-divider><div part="label-container" class="${s(this.disabled?"text-neutral-500":"text-black")} px-4 font-bold text-left" role="presentation" id="group-label"><slot name="label"><span>${this.label}</span></slot></div><div role="listbox" part="options" aria-label="${this.localize.term("optionGroup")}"><slot @slotchange="${this.handleDisableOptions}"></slot></div></div>`}};e.styles=[...o.styles,r`:host{--display-divider:block}#divider{display:var(--display-divider)}`],t([n("slot:not([name])")],e.prototype,"defaultSlot",2),t([a({reflect:!0,type:Boolean})],e.prototype,"disabled",2),t([a({type:String,reflect:!0})],e.prototype,"label",2),t([p("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e=t([d("sd-5-15-2-optgroup")],e);export{e as a};
@@ -1 +1 @@
1
- import{a as y}from"./chunk.CGQ2BPPZ.js";import{a as o}from"./chunk.GLVMB2MH.js";import{a as u,b as s}from"./chunk.JMGRPC2F.js";import{a as l}from"./chunk.26V4EXHB.js";import{a as b}from"./chunk.Y7NVH75J.js";import{a as m,b as i,d as p,h as f}from"./chunk.2FN4O4QC.js";import{b as v}from"./chunk.ZR5P6TQI.js";import{e as r}from"./chunk.TJOCV4DC.js";var t=class extends f{constructor(){super(...arguments);this.hasSlotController=new y(this,"[default]","description","children");this.localize=new b(this);this.vertical=!1;this.size="md";this.current=!1;this.disabled=!1;this.chevron=!1;this.relaxed=!1;this.divider=!1;this.indented=!1;this.open=!1;this.separated=!1}get isButton(){return!this.href&&!this.hasSlotController.test("children")}get isLink(){return!!this.href}get isAccordion(){return!this.separated&&!this.href&&this.hasSlotController.test("children")}get isIconOnly(){if(!this.defaultSlot)return!1;let e=this.defaultSlot.assignedNodes({flatten:!0});return e.length>0&&e.every(a=>{var d;return a.nodeType===Node.TEXT_NODE?!((d=a.textContent)!=null&&d.trim()):a.nodeType===Node.ELEMENT_NODE?a.tagName.toLowerCase()==="sd-5-15-0-icon":!1})}handleClickButton(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}handleClickSummary(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open?this.hideDetails():this.showDetails())}hideDetails(){this.open=!1,this.emit("sd-hide",{cancelable:!0})}showDetails(){this.open=!0,this.emit("sd-show",{cancelable:!0})}get calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}get tag(){return this.separated&&!this.isLink?u`div`:this.isAccordion&&!this.isLink?u`summary`:this.isLink?u`a`:u`button`}focus(){var e;this.disabled||(e=this.button)==null||e.focus()}blur(){var e;(e=this.button)==null||e.blur()}render(){let e=this.tag,a=this.isLink,d=this.isButton,n=this.isAccordion,w=this.isIconOnly,c={label:this.hasSlotController.test("[default]"),main:this.hasSlotController.test("main"),description:this.hasSlotController.test("description"),children:this.hasSlotController.test("children")},x=this.vertical?"py-3":"py-2",h=s`<${e} part="base" class="${l("flex items-center cursor-pointer relative focus-visible:focus-outline group hover:bg-neutral-200 transition-colors duration-fast ease-in-out min-h-[48px]",{md:"text-base",lg:"text-lg",sm:"text-[14px]"}[this.size],this.disabled?"text-neutral-500 pointer-events-none":"text-primary",this.current&&"font-bold",!n&&"w-full",this.divider&&this.vertical&&"mt-0.25",!this.vertical&&"inline-flex items-center",!this.separated&&"hover:bg-neutral-200 group transition-colors duration-fast ease-in-out min-h-[48px]",w?"justify-center aspect-square p-3":"px-4")}" aria-current="${o(this.current?"page":void 0)}" aria-disabled="${this.disabled}" aria-labelledby="content" aria-describedby="description" ?disabled="${o(d?this.disabled:void 0)}" href="${o(a?this.href:void 0)}" target="${o(a?this.target:void 0)}" download="${o(a?this.download:void 0)}" rel="${o(a&&this.target?"noreferrer noopener":void 0)}" tabindex="${this.disabled?"-1":"0"}" @click="${this.separated?void 0:n?this.handleClickSummary:d?this.handleClickButton:void 0}"><div part="current-indicator" class="${l("absolute bg-accent left-0 pointer-events-none",this.vertical?"w-1 h-[calc(100%-16px)] top-2 group-hover:h-full group-hover:top-0":"h-1 w-[calc(100%-16px)] bottom-0 left-2 group-hover:w-full group-hover:left-0",this.disabled&&"bg-neutral-500")}"></div><div class="inline-flex flex-col justify-center gap-1 w-full h-full"><span part="content-area" class="${l("relative inline-flex justify-between items-center",n?"grow":"w-full",c.description&&"pt-3",!c.description&&!this.separated&&x,this.calculatePaddingX)}">${this.divider&&this.vertical?s`<sd-5-15-0-divider part="divider" class="${l("w-full transition-all absolute -top-0.25 left-0",this.calculatePaddingX)}"></sd-5-15-0-divider>`:""} <span id="content" part="content-container" class="inline-flex items-center flex-auto"><slot part="content" class="inline-flex text-start"></slot></span>${this.chevron||c.children&&this.vertical&&!this.separated?s`<sd-5-15-0-icon name="chevron-down" part="chevron" library="_internal" color="currentColor" class="${l("h-6 w-6 ml-2 transition-all",n?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-5-15-0-icon>`:""} </span>${c.description&&this.vertical?s`<slot id="description" name="description" part="description" class="${l("inline-block text-sm text-left font-normal text-black pb-3",n||this.separated?"grow":"w-full",this.calculatePaddingX)}"></slot>`:""}</div></${e}>`;return this.separated?s`<div part="details" id="navigation-item-details" class="relative flex flex-col"><div class="flex items-start">${h} ${c.children&&this.vertical?s`<button type="button" title="${this.open?this.localize.term("collapseNavigationItem"):this.localize.term("expandNavigationItem")}" class="sd-interactive sd-interactive--reset -mt-1" @click="${this.handleClickSummary}"><sd-5-15-0-icon name="chevron-down" part="chevron" library="_internal" color="currentColor" class="${l("m-4 h-6 w-6 transition-all",n||this.separated?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-5-15-0-icon></button>`:""}</div>${this.open?s`<slot name="children"></slot>`:""}</div>`:n?s`<details aria-expanded="${this.open}" part="details" id="navigation-item-details" ?open="${this.open}" class="relative">${h}<slot name="children"></slot></details>`:s`${h}`}};t.styles=[...f.styles,v`:host{box-sizing:border-box;display:inline-block;position:relative}:host([vertical]){display:block}details summary::-webkit-details-marker{display:none}[part=current-indicator]{--tw-scale-x:0;--tw-scale-y:0;opacity:var(--sd-opacity-0,0);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-duration:var(--sd-duration-fast,.15s);transition:width var(--sd-duration-fast) ease-in-out,height var(--sd-duration-fast) ease-in-out,left var(--sd-duration-fast) ease-in-out,top var(--sd-duration-fast) ease-in-out,opacity var(--sd-duration-fast) ease-in-out,transform var(--sd-duration-fast) ease-in-out var(--sd-duration-fast)}:host([current]) [part=current-indicator]{--tw-scale-x:1;--tw-scale-y:1;opacity:var(--sd-opacity-100,1);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition:width var(--sd-duration-fast) ease-in-out,height var(--sd-duration-fast) ease-in-out,left var(--sd-duration-fast) ease-in-out,top var(--sd-duration-fast) ease-in-out,transform var(--sd-duration-fast) ease-in-out}`],r([p('a[part="base"], button[part="base"]')],t.prototype,"button",2),r([p("slot:not([name])")],t.prototype,"defaultSlot",2),r([i({type:Boolean,reflect:!0})],t.prototype,"vertical",2),r([i({type:String,reflect:!0})],t.prototype,"size",2),r([i({reflect:!0})],t.prototype,"href",2),r([i({type:String,reflect:!0})],t.prototype,"target",2),r([i({reflect:!0})],t.prototype,"download",2),r([i({type:Boolean,reflect:!0})],t.prototype,"current",2),r([i({type:Boolean,reflect:!0})],t.prototype,"disabled",2),r([i({type:Boolean,reflect:!0})],t.prototype,"chevron",2),r([i({type:Boolean,reflect:!0})],t.prototype,"relaxed",2),r([i({type:Boolean,reflect:!0})],t.prototype,"divider",2),r([i({type:Boolean,reflect:!0})],t.prototype,"indented",2),r([i({type:Boolean,reflect:!0})],t.prototype,"open",2),r([i({type:Boolean,reflect:!0})],t.prototype,"separated",2),t=r([m("sd-5-15-0-navigation-item")],t);export{t as a};
1
+ import{a as y}from"./chunk.CGQ2BPPZ.js";import{a as o}from"./chunk.GLVMB2MH.js";import{a as u,b as s}from"./chunk.JMGRPC2F.js";import{a as l}from"./chunk.26V4EXHB.js";import{a as b}from"./chunk.Y7NVH75J.js";import{a as m,b as i,d as p,h as f}from"./chunk.2FN4O4QC.js";import{b as v}from"./chunk.ZR5P6TQI.js";import{e as r}from"./chunk.TJOCV4DC.js";var t=class extends f{constructor(){super(...arguments);this.hasSlotController=new y(this,"[default]","description","children");this.localize=new b(this);this.vertical=!1;this.size="md";this.current=!1;this.disabled=!1;this.chevron=!1;this.relaxed=!1;this.divider=!1;this.indented=!1;this.open=!1;this.separated=!1}get isButton(){return!this.href&&!this.hasSlotController.test("children")}get isLink(){return!!this.href}get isAccordion(){return!this.separated&&!this.href&&this.hasSlotController.test("children")}get isIconOnly(){if(!this.defaultSlot)return!1;let e=this.defaultSlot.assignedNodes({flatten:!0});return e.length>0&&e.every(a=>{var d;return a.nodeType===Node.TEXT_NODE?!((d=a.textContent)!=null&&d.trim()):a.nodeType===Node.ELEMENT_NODE?a.tagName.toLowerCase()==="sd-5-15-2-icon":!1})}handleClickButton(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}handleClickSummary(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.open?this.hideDetails():this.showDetails())}hideDetails(){this.open=!1,this.emit("sd-hide",{cancelable:!0})}showDetails(){this.open=!0,this.emit("sd-show",{cancelable:!0})}get calculatePaddingX(){return this.relaxed&&this.indented?"pl-8 pr-4":this.relaxed?"px-4":this.indented?"pl-4":""}get tag(){return this.separated&&!this.isLink?u`div`:this.isAccordion&&!this.isLink?u`summary`:this.isLink?u`a`:u`button`}focus(){var e;this.disabled||(e=this.button)==null||e.focus()}blur(){var e;(e=this.button)==null||e.blur()}render(){let e=this.tag,a=this.isLink,d=this.isButton,n=this.isAccordion,w=this.isIconOnly,c={label:this.hasSlotController.test("[default]"),main:this.hasSlotController.test("main"),description:this.hasSlotController.test("description"),children:this.hasSlotController.test("children")},x=this.vertical?"py-3":"py-2",h=s`<${e} part="base" class="${l("flex items-center cursor-pointer relative focus-visible:focus-outline group hover:bg-neutral-200 transition-colors duration-fast ease-in-out min-h-[48px]",{md:"text-base",lg:"text-lg",sm:"text-[14px]"}[this.size],this.disabled?"text-neutral-500 pointer-events-none":"text-primary",this.current&&"font-bold",!n&&"w-full",this.divider&&this.vertical&&"mt-0.25",!this.vertical&&"inline-flex items-center",!this.separated&&"hover:bg-neutral-200 group transition-colors duration-fast ease-in-out min-h-[48px]",w?"justify-center aspect-square p-3":"px-4")}" aria-current="${o(this.current?"page":void 0)}" aria-disabled="${this.disabled}" aria-labelledby="content" aria-describedby="description" ?disabled="${o(d?this.disabled:void 0)}" href="${o(a?this.href:void 0)}" target="${o(a?this.target:void 0)}" download="${o(a?this.download:void 0)}" rel="${o(a&&this.target?"noreferrer noopener":void 0)}" tabindex="${this.disabled?"-1":"0"}" @click="${this.separated?void 0:n?this.handleClickSummary:d?this.handleClickButton:void 0}"><div part="current-indicator" class="${l("absolute bg-accent left-0 pointer-events-none",this.vertical?"w-1 h-[calc(100%-16px)] top-2 group-hover:h-full group-hover:top-0":"h-1 w-[calc(100%-16px)] bottom-0 left-2 group-hover:w-full group-hover:left-0",this.disabled&&"bg-neutral-500")}"></div><div class="inline-flex flex-col justify-center gap-1 w-full h-full"><span part="content-area" class="${l("relative inline-flex justify-between items-center",n?"grow":"w-full",c.description&&"pt-3",!c.description&&!this.separated&&x,this.calculatePaddingX)}">${this.divider&&this.vertical?s`<sd-5-15-2-divider part="divider" class="${l("w-full transition-all absolute -top-0.25 left-0",this.calculatePaddingX)}"></sd-5-15-2-divider>`:""} <span id="content" part="content-container" class="inline-flex items-center flex-auto"><slot part="content" class="inline-flex text-start"></slot></span>${this.chevron||c.children&&this.vertical&&!this.separated?s`<sd-5-15-2-icon name="chevron-down" part="chevron" library="_internal" color="currentColor" class="${l("h-6 w-6 ml-2 transition-all",n?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-5-15-2-icon>`:""} </span>${c.description&&this.vertical?s`<slot id="description" name="description" part="description" class="${l("inline-block text-sm text-left font-normal text-black pb-3",n||this.separated?"grow":"w-full",this.calculatePaddingX)}"></slot>`:""}</div></${e}>`;return this.separated?s`<div part="details" id="navigation-item-details" class="relative flex flex-col"><div class="flex items-start">${h} ${c.children&&this.vertical?s`<button type="button" title="${this.open?this.localize.term("collapseNavigationItem"):this.localize.term("expandNavigationItem")}" class="sd-interactive sd-interactive--reset -mt-1" @click="${this.handleClickSummary}"><sd-5-15-2-icon name="chevron-down" part="chevron" library="_internal" color="currentColor" class="${l("m-4 h-6 w-6 transition-all",n||this.separated?this.open?"rotate-180":"rotate-0":"rotate-[270deg]")}"></sd-5-15-2-icon></button>`:""}</div>${this.open?s`<slot name="children"></slot>`:""}</div>`:n?s`<details aria-expanded="${this.open}" part="details" id="navigation-item-details" ?open="${this.open}" class="relative">${h}<slot name="children"></slot></details>`:s`${h}`}};t.styles=[...f.styles,v`:host{box-sizing:border-box;display:inline-block;position:relative}:host([vertical]){display:block}details summary::-webkit-details-marker{display:none}[part=current-indicator]{--tw-scale-x:0;--tw-scale-y:0;opacity:var(--sd-opacity-0,0);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-duration:var(--sd-duration-fast,.15s);transition:width var(--sd-duration-fast) ease-in-out,height var(--sd-duration-fast) ease-in-out,left var(--sd-duration-fast) ease-in-out,top var(--sd-duration-fast) ease-in-out,opacity var(--sd-duration-fast) ease-in-out,transform var(--sd-duration-fast) ease-in-out var(--sd-duration-fast)}:host([current]) [part=current-indicator]{--tw-scale-x:1;--tw-scale-y:1;opacity:var(--sd-opacity-100,1);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition:width var(--sd-duration-fast) ease-in-out,height var(--sd-duration-fast) ease-in-out,left var(--sd-duration-fast) ease-in-out,top var(--sd-duration-fast) ease-in-out,transform var(--sd-duration-fast) ease-in-out}`],r([p('[part="base"]')],t.prototype,"button",2),r([p("slot:not([name])")],t.prototype,"defaultSlot",2),r([i({type:Boolean,reflect:!0})],t.prototype,"vertical",2),r([i({type:String,reflect:!0})],t.prototype,"size",2),r([i({reflect:!0})],t.prototype,"href",2),r([i({type:String,reflect:!0})],t.prototype,"target",2),r([i({reflect:!0})],t.prototype,"download",2),r([i({type:Boolean,reflect:!0})],t.prototype,"current",2),r([i({type:Boolean,reflect:!0})],t.prototype,"disabled",2),r([i({type:Boolean,reflect:!0})],t.prototype,"chevron",2),r([i({type:Boolean,reflect:!0})],t.prototype,"relaxed",2),r([i({type:Boolean,reflect:!0})],t.prototype,"divider",2),r([i({type:Boolean,reflect:!0})],t.prototype,"indented",2),r([i({type:Boolean,reflect:!0})],t.prototype,"open",2),r([i({type:Boolean,reflect:!0})],t.prototype,"separated",2),t=r([m("sd-5-15-2-navigation-item")],t);export{t as a};
@@ -1 +1 @@
1
- import{a as g}from"./chunk.I2H6CZK5.js";import{a as A}from"./chunk.2AQOPKKH.js";import{a as z}from"./chunk.G7HKVXLR.js";import{a as m,b as f}from"./chunk.3L472FD4.js";import{a as E}from"./chunk.CGQ2BPPZ.js";import{a as o,c as l}from"./chunk.SKUMYG4O.js";import{a as w}from"./chunk.KLRPP4NQ.js";import{a as p}from"./chunk.26V4EXHB.js";import{a as C}from"./chunk.Y7NVH75J.js";import{a as v}from"./chunk.E2DRD2OX.js";import{a as x,b as r,d as c,h as b}from"./chunk.2FN4O4QC.js";import{b as k,e as u}from"./chunk.ZR5P6TQI.js";import{b as n,e as h}from"./chunk.6OTM3PE5.js";import{e as i}from"./chunk.TJOCV4DC.js";var t=class extends b{constructor(){super(...arguments);this.hasSlotController=new E(this,"footer");this.localize=new C(this);this.modal=new A(this);this.open=!1;this.label="";this.placement="end";this.contained=!1;this.noHeader=!1;this.handleDocumentKeyDown=e=>{this.open&&e.key==="Escape"&&(e.stopPropagation(),this.requestClose("keyboard"))}}firstUpdated(){this.drawer.hidden=!this.open,this.open&&(this.addOpenListeners(),this.contained||(this.modal.activate(),m(this)))}disconnectedCallback(){super.disconnectedCallback(),f(this)}requestClose(e){if(this.emit("sd-request-close",{cancelable:!0,detail:{source:e}}).defaultPrevented){let a=l(this,"drawer.denyClose",{dir:this.localize.dir()});n(this.panel,a.keyframes,a.options);return}this.hide()}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}async handleOpenChange(){var y;let e=(y=this.closeButton.shadowRoot)==null?void 0:y.querySelector('[part="base"]');if(this.open){this.emit("sd-show"),this.addOpenListeners(),this.originalTrigger=z(),this.contained||(this.modal.activate(),m(this));let a=this.querySelector("[autofocus]");a&&a.removeAttribute("autofocus"),await Promise.all([h(this.drawer),h(this.overlay)]),this.drawer.hidden=!1,this.drawer.removeAttribute("inert");let d=l(this,`drawer.show${g(this.placement)}`,{dir:this.localize.dir()}),s=l(this,"drawer.overlay.show",{dir:this.localize.dir()});await Promise.all([n(this.panel,d.keyframes,d.options),n(this.overlay,s.keyframes,s.options)]),e==null||e.setAttribute("aria-controls","drawer"),e==null||e.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{this.emit("sd-initial-focus",{cancelable:!0}).defaultPrevented||(a?a.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),a?a.setAttribute("autofocus",""):this.closeButton.focus()}),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),this.contained||(this.modal.deactivate(),f(this)),await Promise.all([h(this.drawer),h(this.overlay)]);let a=l(this,`drawer.hide${g(this.placement)}`,{dir:this.localize.dir()}),d=l(this,"drawer.overlay.hide",{dir:this.localize.dir()});await Promise.all([n(this.overlay,d.keyframes,d.options).then(()=>{this.overlay.hidden=!0}),n(this.panel,a.keyframes,a.options).then(()=>{this.panel.hidden=!0})]),this.drawer.hidden=!0,this.drawer.setAttribute("inert",""),this.overlay.hidden=!1,this.panel.hidden=!1;let s=this.originalTrigger;typeof(s==null?void 0:s.focus)=="function"&&setTimeout(()=>s.focus()),e==null||e.setAttribute("aria-expanded","false"),this.emit("sd-after-hide")}}handleNoModalChange(){this.open&&!this.contained&&(this.modal.activate(),m(this)),this.open&&this.contained&&(this.modal.deactivate(),f(this))}async show(){if(!this.open)return this.open=!0,w(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,w(this,"sd-after-hide")}render(){return u`<section id="drawer" part="base" class="${p("top-0 start-0 w-full h-full pointer-events-none overflow-hidden",this.contained?"absolute":"fixed")}" aria-label="${this.label}"><div part="overlay" class="${p("block top-0 left-0 right-0 bottom-0 bg-neutral-800/75 pointer-events-auto",this.contained?"absolute":"fixed")}" @click="${()=>this.requestClose("overlay")}"></div><div part="panel" class="${p("absolute flex flex-col gap-4 z-10 max-w-full max-h-full bg-white shadow-lg overflow-auto pointer-events-auto focus:outline-none",{end:"top-0 end-0 bottom-auto start-auto w-[--width] h-full",start:"top-0 end-auto bottom-auto start-0 w-[--width] h-full"}[this.placement])}" role="dialog" aria-modal="true" aria-label="${this.label}" tabindex="0">${this.noHeader?u`<sd-5-15-0-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}" class="absolute top-2 end-2 z-10"><sd-5-15-0-icon label="${this.localize.term("close")}" name="close" library="_internal"></sd-5-15-0-icon></sd-5-15-0-button>`:u`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:64px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ms-4 absolute top-2 end-2"><sd-5-15-0-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}"><sd-5-15-0-icon label="${this.localize.term("close")}" name="close" library="_internal"></sd-5-15-0-icon></sd-5-15-0-button></div></header>`}<div part="body" class="flex-auto block px-4 focus-visible:focus-outline !-outline-offset-2" tabindex="0"><slot></slot></div><footer part="footer" class="${p(this.hasSlotController.test("footer")?"text-left p-4":"hidden")}"><slot name="footer"></slot></footer></div></section>`}};t.styles=[...b.styles,k`:host{--width:25rem;display:contents}:host([contained]){z-index:auto}:host(:not([contained])){z-index:var(--sd-z-index-drawer,700)}[part=body]{-webkit-overflow-scrolling:touch;overflow-y:scroll;scrollbar-width:none}[part=body]::-webkit-scrollbar{height:var(--sd-spacing-0,0);width:var(--sd-spacing-0,0)}`],i([c("[part=base]")],t.prototype,"drawer",2),i([c("[part=panel]")],t.prototype,"panel",2),i([c("[part=overlay]")],t.prototype,"overlay",2),i([c("[part=close-button]")],t.prototype,"closeButton",2),i([r({type:Boolean,reflect:!0})],t.prototype,"open",2),i([r({type:String,attribute:"label",reflect:!0})],t.prototype,"label",2),i([r({type:String,reflect:!0})],t.prototype,"placement",2),i([r({type:Boolean,reflect:!0})],t.prototype,"contained",2),i([r({attribute:"no-header",type:Boolean,reflect:!0})],t.prototype,"noHeader",2),i([v("open",{waitUntilFirstUpdate:!0})],t.prototype,"handleOpenChange",1),i([v("contained",{waitUntilFirstUpdate:!0})],t.prototype,"handleNoModalChange",1),t=i([x("sd-5-15-0-drawer")],t);o("drawer.showStart",{keyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.hideStart",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});o("drawer.showEnd",{keyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.hideEnd",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});o("drawer.denyClose",{keyframes:[{scale:1},{scale:1.01},{scale:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.overlay.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.overlay.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});export{t as a};
1
+ import{a as g}from"./chunk.I2H6CZK5.js";import{a as A}from"./chunk.2AQOPKKH.js";import{a as z}from"./chunk.G7HKVXLR.js";import{a as m,b as f}from"./chunk.3L472FD4.js";import{a as E}from"./chunk.CGQ2BPPZ.js";import{a as o,c as l}from"./chunk.SKUMYG4O.js";import{a as w}from"./chunk.KLRPP4NQ.js";import{a as p}from"./chunk.26V4EXHB.js";import{a as C}from"./chunk.Y7NVH75J.js";import{a as v}from"./chunk.E2DRD2OX.js";import{a as x,b as r,d as c,h as b}from"./chunk.2FN4O4QC.js";import{b as k,e as u}from"./chunk.ZR5P6TQI.js";import{b as n,e as h}from"./chunk.6OTM3PE5.js";import{e as i}from"./chunk.TJOCV4DC.js";var t=class extends b{constructor(){super(...arguments);this.hasSlotController=new E(this,"footer");this.localize=new C(this);this.modal=new A(this);this.open=!1;this.label="";this.placement="end";this.contained=!1;this.noHeader=!1;this.handleDocumentKeyDown=e=>{this.open&&e.key==="Escape"&&(e.stopPropagation(),this.requestClose("keyboard"))}}firstUpdated(){this.drawer.hidden=!this.open,this.open&&(this.addOpenListeners(),this.contained||(this.modal.activate(),m(this)))}disconnectedCallback(){super.disconnectedCallback(),f(this)}requestClose(e){if(this.emit("sd-request-close",{cancelable:!0,detail:{source:e}}).defaultPrevented){let a=l(this,"drawer.denyClose",{dir:this.localize.dir()});n(this.panel,a.keyframes,a.options);return}this.hide()}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}async handleOpenChange(){var y;let e=(y=this.closeButton.shadowRoot)==null?void 0:y.querySelector('[part="base"]');if(this.open){this.emit("sd-show"),this.addOpenListeners(),this.originalTrigger=z(),this.contained||(this.modal.activate(),m(this));let a=this.querySelector("[autofocus]");a&&a.removeAttribute("autofocus"),await Promise.all([h(this.drawer),h(this.overlay)]),this.drawer.hidden=!1,this.drawer.removeAttribute("inert");let d=l(this,`drawer.show${g(this.placement)}`,{dir:this.localize.dir()}),s=l(this,"drawer.overlay.show",{dir:this.localize.dir()});await Promise.all([n(this.panel,d.keyframes,d.options),n(this.overlay,s.keyframes,s.options)]),e==null||e.setAttribute("aria-controls","drawer"),e==null||e.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{this.emit("sd-initial-focus",{cancelable:!0}).defaultPrevented||(a?a.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),a?a.setAttribute("autofocus",""):this.closeButton.focus()}),this.emit("sd-after-show")}else{this.emit("sd-hide"),this.removeOpenListeners(),this.contained||(this.modal.deactivate(),f(this)),await Promise.all([h(this.drawer),h(this.overlay)]);let a=l(this,`drawer.hide${g(this.placement)}`,{dir:this.localize.dir()}),d=l(this,"drawer.overlay.hide",{dir:this.localize.dir()});await Promise.all([n(this.overlay,d.keyframes,d.options).then(()=>{this.overlay.hidden=!0}),n(this.panel,a.keyframes,a.options).then(()=>{this.panel.hidden=!0})]),this.drawer.hidden=!0,this.drawer.setAttribute("inert",""),this.overlay.hidden=!1,this.panel.hidden=!1;let s=this.originalTrigger;typeof(s==null?void 0:s.focus)=="function"&&setTimeout(()=>s.focus()),e==null||e.setAttribute("aria-expanded","false"),this.emit("sd-after-hide")}}handleNoModalChange(){this.open&&!this.contained&&(this.modal.activate(),m(this)),this.open&&this.contained&&(this.modal.deactivate(),f(this))}async show(){if(!this.open)return this.open=!0,w(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,w(this,"sd-after-hide")}render(){return u`<section id="drawer" part="base" class="${p("top-0 start-0 w-full h-full pointer-events-none overflow-hidden",this.contained?"absolute":"fixed")}" aria-label="${this.label}"><div part="overlay" class="${p("block top-0 left-0 right-0 bottom-0 bg-neutral-800/75 pointer-events-auto",this.contained?"absolute":"fixed")}" @click="${()=>this.requestClose("overlay")}"></div><div part="panel" class="${p("absolute flex flex-col gap-4 z-10 max-w-full max-h-full bg-white shadow-lg overflow-auto pointer-events-auto focus:outline-none",{end:"top-0 end-0 bottom-auto start-auto w-[--width] h-full",start:"top-0 end-auto bottom-auto start-0 w-[--width] h-full"}[this.placement])}" role="dialog" aria-modal="true" aria-label="${this.label}" tabindex="0">${this.noHeader?u`<sd-5-15-2-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}" class="absolute top-2 end-2 z-10"><sd-5-15-2-icon label="${this.localize.term("close")}" name="close" library="_internal"></sd-5-15-2-icon></sd-5-15-2-button>`:u`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:64px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ms-4 absolute top-2 end-2"><sd-5-15-2-button variant="tertiary" size="lg" part="close-button" @click="${()=>this.requestClose("close-button")}"><sd-5-15-2-icon label="${this.localize.term("close")}" name="close" library="_internal"></sd-5-15-2-icon></sd-5-15-2-button></div></header>`}<div part="body" class="flex-auto block px-4 focus-visible:focus-outline !-outline-offset-2" tabindex="0"><slot></slot></div><footer part="footer" class="${p(this.hasSlotController.test("footer")?"text-left p-4":"hidden")}"><slot name="footer"></slot></footer></div></section>`}};t.styles=[...b.styles,k`:host{--width:25rem;display:contents}:host([contained]){z-index:auto}:host(:not([contained])){z-index:var(--sd-z-index-drawer,700)}[part=body]{-webkit-overflow-scrolling:touch;overflow-y:scroll;scrollbar-width:none}[part=body]::-webkit-scrollbar{height:var(--sd-spacing-0,0);width:var(--sd-spacing-0,0)}`],i([c("[part=base]")],t.prototype,"drawer",2),i([c("[part=panel]")],t.prototype,"panel",2),i([c("[part=overlay]")],t.prototype,"overlay",2),i([c("[part=close-button]")],t.prototype,"closeButton",2),i([r({type:Boolean,reflect:!0})],t.prototype,"open",2),i([r({type:String,attribute:"label",reflect:!0})],t.prototype,"label",2),i([r({type:String,reflect:!0})],t.prototype,"placement",2),i([r({type:Boolean,reflect:!0})],t.prototype,"contained",2),i([r({attribute:"no-header",type:Boolean,reflect:!0})],t.prototype,"noHeader",2),i([v("open",{waitUntilFirstUpdate:!0})],t.prototype,"handleOpenChange",1),i([v("contained",{waitUntilFirstUpdate:!0})],t.prototype,"handleNoModalChange",1),t=i([x("sd-5-15-2-drawer")],t);o("drawer.showStart",{keyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.hideStart",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});o("drawer.showEnd",{keyframes:[{opacity:0,translate:"100%"},{opacity:1,translate:"0"}],rtlKeyframes:[{opacity:0,translate:"-100%"},{opacity:1,translate:"0"}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.hideEnd",{keyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"100%"}],rtlKeyframes:[{opacity:1,translate:"0"},{opacity:0,translate:"-100%"}],options:{duration:"var(--sd-duration-fast, 150)",easing:"ease-in-out"}});o("drawer.denyClose",{keyframes:[{scale:1},{scale:1.01},{scale:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.overlay.show",{keyframes:[{opacity:0},{opacity:1}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});o("drawer.overlay.hide",{keyframes:[{opacity:1},{opacity:0}],options:{duration:"var(--sd-duration-medium, 300)",easing:"ease-in-out"}});export{t as a};
@@ -1 +1 @@
1
- import{a as n}from"./chunk.MWDEA25W.js";import{a as p}from"./chunk.E2DRD2OX.js";import{a as m,b as o,h as a}from"./chunk.2FN4O4QC.js";import{b as l,e as c}from"./chunk.ZR5P6TQI.js";import{e as s}from"./chunk.TJOCV4DC.js";var t=class extends a{constructor(){super(...arguments);this.mode="cors";this.allowScripts=!1}executeScript(e){let r=document.createElement("script");[...e.attributes].forEach(i=>r.setAttribute(i.name,i.value)),r.textContent=e.textContent,e.parentNode.replaceChild(r,e)}async handleSrcChange(){try{let e=this.src,r=await n(e,this.mode);if(e!==this.src)return;if(!r.ok){this.emit("sd-error",{detail:{status:r.status}});return}this.innerHTML=r.html,this.allowScripts&&[...this.querySelectorAll("script")].forEach(i=>this.executeScript(i)),this.emit("sd-load")}catch(e){this.emit("sd-error",{detail:{status:-1}})}}render(){return c`<slot></slot>`}};t.styles=[...a.styles,l`:host{display:block}`],s([o({reflect:!0})],t.prototype,"src",2),s([o({type:String,reflect:!0})],t.prototype,"mode",2),s([o({attribute:"allow-scripts",type:Boolean,reflect:!0})],t.prototype,"allowScripts",2),s([p("src")],t.prototype,"handleSrcChange",1),t=s([m("sd-5-15-0-include")],t);export{t as a};
1
+ import{a as n}from"./chunk.MWDEA25W.js";import{a as p}from"./chunk.E2DRD2OX.js";import{a as m,b as o,h as a}from"./chunk.2FN4O4QC.js";import{b as l,e as c}from"./chunk.ZR5P6TQI.js";import{e as s}from"./chunk.TJOCV4DC.js";var t=class extends a{constructor(){super(...arguments);this.mode="cors";this.allowScripts=!1}executeScript(e){let r=document.createElement("script");[...e.attributes].forEach(i=>r.setAttribute(i.name,i.value)),r.textContent=e.textContent,e.parentNode.replaceChild(r,e)}async handleSrcChange(){try{let e=this.src,r=await n(e,this.mode);if(e!==this.src)return;if(!r.ok){this.emit("sd-error",{detail:{status:r.status}});return}this.innerHTML=r.html,this.allowScripts&&[...this.querySelectorAll("script")].forEach(i=>this.executeScript(i)),this.emit("sd-load")}catch(e){this.emit("sd-error",{detail:{status:-1}})}}render(){return c`<slot></slot>`}};t.styles=[...a.styles,l`:host{display:block}`],s([o({reflect:!0})],t.prototype,"src",2),s([o({type:String,reflect:!0})],t.prototype,"mode",2),s([o({attribute:"allow-scripts",type:Boolean,reflect:!0})],t.prototype,"allowScripts",2),s([p("src")],t.prototype,"handleSrcChange",1),t=s([m("sd-5-15-2-include")],t);export{t as a};