@vireo-ai/trellis-ui 0.1.27 → 0.1.30

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 (203) hide show
  1. package/package.json +7 -2
  2. package/packages/client/src/components/checkbox/styles.css +7 -0
  3. package/packages/client/src/components/field/styles.css +71 -0
  4. package/packages/client/src/components/file-upload/styles.css +68 -0
  5. package/packages/client/src/components/radio/styles.css +2 -8
  6. package/packages/client/src/components/tabs/styles.css +73 -0
  7. package/packages/client/src/components/toast/styles.css +123 -0
  8. package/packages/client/src/styles/components.css +15 -4
  9. package/packages/client/src/styles/generated/theme-fonts.css +1 -1
  10. package/packages/client/src/styles/generated/theme-palette.css +77 -1462
  11. package/packages/client/src/styles/generated/theme-runtime.css +1 -1390
  12. package/packages/client/src/styles/generated-sources.css +1 -1
  13. package/packages/client/src/styles/recipes/action.css +175 -0
  14. package/packages/client/src/styles/recipes/disabled.css +16 -0
  15. package/packages/client/src/styles/recipes/option.css +123 -0
  16. package/packages/client/src/styles/recipes/selection.css +78 -0
  17. package/packages/client/src/styles/theme.css +45 -719
  18. package/packages/client/types/assets/full-runtime.generated.d.ts +1 -1
  19. package/packages/client/types/capabilities/motion.entry.generated.d.ts +3 -0
  20. package/packages/client/types/capabilities/resizable.entry.generated.d.ts +3 -0
  21. package/packages/client/types/capabilities/sortable.entry.generated.d.ts +3 -0
  22. package/packages/client/types/component-api.d.ts +10 -10
  23. package/packages/client/types/components/accordion/index.d.ts +7 -4
  24. package/packages/client/types/components/accordion/machine.d.ts +51 -57
  25. package/packages/client/types/components/card/contract.d.ts +5 -2
  26. package/packages/client/types/components/checkbox/contract.d.ts +17 -7
  27. package/packages/client/types/components/common.d.ts +6 -1
  28. package/packages/client/types/components/date-picker/index.d.ts +7 -4
  29. package/packages/client/types/components/date-picker/machine.d.ts +46 -362
  30. package/packages/client/types/components/dropdown/index.d.ts +7 -4
  31. package/packages/client/types/components/dropdown/machine.d.ts +5 -67
  32. package/packages/client/types/components/field/index.d.ts +1 -2
  33. package/packages/client/types/components/file-upload/index.d.ts +7 -4
  34. package/packages/client/types/components/file-upload/machine.d.ts +17 -39
  35. package/packages/client/types/components/input/index.d.ts +1 -2
  36. package/packages/client/types/components/modal/index.d.ts +6 -2
  37. package/packages/client/types/components/modal/machine.d.ts +5 -103
  38. package/packages/client/types/components/panels/index.d.ts +6 -2
  39. package/packages/client/types/components/panels/machine.d.ts +59 -81
  40. package/packages/client/types/components/radio/contract.d.ts +12 -4
  41. package/packages/client/types/components/runtime.d.ts +10 -10
  42. package/packages/client/types/components/scroll-area/index.d.ts +1 -2
  43. package/packages/client/types/components/select/index.d.ts +7 -4
  44. package/packages/client/types/components/select/machine.d.ts +37 -331
  45. package/packages/client/types/components/sidebar/index.d.ts +6 -2
  46. package/packages/client/types/components/sidebar/machine.d.ts +11 -47
  47. package/packages/client/types/components/slider/index.d.ts +1 -2
  48. package/packages/client/types/components/switch/index.d.ts +1 -2
  49. package/packages/client/types/components/tabs/contract.d.ts +6 -2
  50. package/packages/client/types/components/tabs/index.d.ts +7 -4
  51. package/packages/client/types/components/tabs/machine.d.ts +11 -29
  52. package/packages/client/types/components/toast/index.d.ts +6 -2
  53. package/packages/client/types/components/toast/machine.d.ts +7 -66
  54. package/packages/client/types/core.d.ts +2 -2
  55. package/packages/client/types/runtime/alpine-data.d.ts +6 -0
  56. package/packages/client/types/runtime/alpine-machine.d.ts +3 -8
  57. package/packages/client/types/runtime/engine/request.d.ts +1 -0
  58. package/packages/client/types/runtime/index.d.ts +7 -3
  59. package/packages/client/types/runtime/transition-coordinator.d.ts +41 -7
  60. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.css +638 -3428
  61. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min.css +1 -1
  62. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/build-metadata.json +492 -376
  63. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js +2 -0
  64. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js.map +1 -0
  65. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js +2 -0
  66. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js.map +1 -0
  67. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js +2 -0
  68. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js.map +1 -0
  69. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-data-DZ17j0jc.js +2 -0
  70. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-data-DZ17j0jc.js.map +1 -0
  71. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-machine-BS13dbK4.js +2 -0
  72. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/alpine-machine-BS13dbK4.js.map +1 -0
  73. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-motion-wMoceguq.js +2 -0
  74. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-motion-wMoceguq.js.map +1 -0
  75. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-resizable-C6LKIbpv.js +2 -0
  76. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-resizable-C6LKIbpv.js.map +1 -0
  77. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-BurX5yRd.js +3 -0
  78. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-BurX5yRd.js.map +1 -0
  79. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{common-DAxHCzB-.js → common-BOd_thC-.js} +2 -2
  80. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{common-DAxHCzB-.js.map → common-BOd_thC-.js.map} +1 -1
  81. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/core-BuKz1uWk.js +2 -0
  82. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{core-DjoX4J-6.js.map → core-BuKz1uWk.js.map} +1 -1
  83. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/drag-and-drop-BV6kB47L.js +2 -0
  84. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/drag-and-drop-BV6kB47L.js.map +1 -0
  85. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-9sxiaVVI.js +2 -0
  86. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-9sxiaVVI.js.map +1 -0
  87. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BehM6Hle.js +2 -0
  88. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BehM6Hle.js.map +1 -0
  89. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BhPEF6oz.js +2 -0
  90. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-xcXw-cEl.js.map → entry.generated-BhPEF6oz.js.map} +1 -1
  91. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BqOi_tIN.js +2 -0
  92. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BqOi_tIN.js.map +1 -0
  93. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BuXeU4zt.js +2 -0
  94. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BuXeU4zt.js.map +1 -0
  95. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C-MH09sf.js +2 -0
  96. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C-MH09sf.js.map +1 -0
  97. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C3h9Czzn.js +2 -0
  98. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C3h9Czzn.js.map +1 -0
  99. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C5Bueyfb.js +2 -0
  100. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C5Bueyfb.js.map +1 -0
  101. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CCka3fIO.js +2 -0
  102. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CCka3fIO.js.map +1 -0
  103. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CSxEK8G9.js +2 -0
  104. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CSxEK8G9.js.map +1 -0
  105. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CoJxfxlc.js +2 -0
  106. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CoJxfxlc.js.map +1 -0
  107. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-D6cdmqiV.js +2 -0
  108. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-D6cdmqiV.js.map +1 -0
  109. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DBSwLHmm.js +2 -0
  110. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DBSwLHmm.js.map +1 -0
  111. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DEiL4FhC.js +2 -0
  112. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DEiL4FhC.js.map +1 -0
  113. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DRqap77P.js +2 -0
  114. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DRqap77P.js.map +1 -0
  115. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Dzw2Rg5F.js +2 -0
  116. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Dzw2Rg5F.js.map +1 -0
  117. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-EtCfrZfr.js +2 -0
  118. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-EtCfrZfr.js.map +1 -0
  119. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-cMueWbY7.js +2 -0
  120. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-cMueWbY7.js.map +1 -0
  121. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-Dqut4h89.js +2 -0
  122. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-Dqut4h89.js.map +1 -0
  123. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-BRaHJwNf.js +3 -0
  124. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-BRaHJwNf.js.map +1 -0
  125. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/semantic-observer-BUswpsNx.js +2 -0
  126. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{semantic-observer-9VxzbQBi.js.map → semantic-observer-BUswpsNx.js.map} +1 -1
  127. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/stream-pMBGbBZH.js +4 -0
  128. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/stream-pMBGbBZH.js.map +1 -0
  129. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-H3t7UHMs.js +2 -0
  130. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-H3t7UHMs.js.map +1 -0
  131. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/accordion.js +1 -1
  132. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/checkbox.js +1 -1
  133. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/date-picker.js +1 -1
  134. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/dropdown.js +1 -1
  135. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/field.js +1 -1
  136. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/file-upload.js +1 -1
  137. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js +2 -1
  138. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js.map +1 -0
  139. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/input.js +1 -1
  140. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/modal.js +1 -1
  141. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/panels.js +1 -1
  142. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/radio.js +1 -1
  143. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/scroll-area.js +1 -1
  144. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/select.js +1 -1
  145. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/sidebar.js +1 -1
  146. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/slider.js +1 -1
  147. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/switch.js +1 -1
  148. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/table.js +1 -1
  149. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tabs.js +1 -1
  150. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/toast.js +1 -1
  151. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/core.js +1 -1
  152. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +1 -1
  153. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js.map +1 -1
  154. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/logical-entry-manifest.json +232 -127
  155. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +9 -9
  156. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +9 -9
  157. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/core-DjoX4J-6.js +0 -2
  158. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-5kNpQFGr.js +0 -2
  159. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-5kNpQFGr.js.map +0 -1
  160. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B85L90Qp.js +0 -2
  161. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B85L90Qp.js.map +0 -1
  162. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BGCM6LAW.js +0 -2
  163. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BGCM6LAW.js.map +0 -1
  164. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bc-uE56r.js +0 -2
  165. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bc-uE56r.js.map +0 -1
  166. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C6ldtrmy.js +0 -2
  167. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-C6ldtrmy.js.map +0 -1
  168. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CPWoMIwn.js +0 -2
  169. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CPWoMIwn.js.map +0 -1
  170. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Co0bLLZE.js +0 -2
  171. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Co0bLLZE.js.map +0 -1
  172. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CtyXH8zf.js +0 -2
  173. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CtyXH8zf.js.map +0 -1
  174. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DGrOItIx.js +0 -2
  175. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DGrOItIx.js.map +0 -1
  176. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DHMRhcYF.js +0 -2
  177. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DHMRhcYF.js.map +0 -1
  178. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DgmqZx_W.js +0 -2
  179. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DgmqZx_W.js.map +0 -1
  180. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DoOgk6l4.js +0 -2
  181. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DoOgk6l4.js.map +0 -1
  182. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DxUOcPkU.js +0 -2
  183. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DxUOcPkU.js.map +0 -1
  184. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DyIjCOhT.js +0 -2
  185. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DyIjCOhT.js.map +0 -1
  186. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DzG9Lai4.js +0 -3
  187. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DzG9Lai4.js.map +0 -1
  188. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-K6qKowpw.js +0 -2
  189. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-K6qKowpw.js.map +0 -1
  190. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-oAIExc1V.js +0 -2
  191. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-oAIExc1V.js.map +0 -1
  192. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-wHjTggCn.js +0 -2
  193. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-wHjTggCn.js.map +0 -1
  194. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-xcXw-cEl.js +0 -2
  195. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js +0 -2
  196. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/machine-CX3wFSoV.js.map +0 -1
  197. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-Bpttk6iZ.js +0 -3
  198. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-Bpttk6iZ.js.map +0 -1
  199. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/resizable-BixtYF9M.js +0 -2
  200. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/resizable-BixtYF9M.js.map +0 -1
  201. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/semantic-observer-9VxzbQBi.js +0 -2
  202. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-xTjuF3uC.js +0 -4
  203. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/ui-xTjuF3uC.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{a as e,d as t,f as n,l as r,m as i,p as a,u as o,y as s}from"./element-adapter-native-data-key-CW8suC9A.js";import{c,f as l,l as u,n as d}from"./codecs-Cb1ns_47.js";import{r as f,s as p,t as m}from"./dom-qAeVl7dc.js";import{i as h,t as g}from"./alpine-machine-BS13dbK4.js";import{t as _}from"./alpine-data-DZ17j0jc.js";import{n as v,t as y}from"./styles-TfvwVPGw.js";import{t as b}from"./machine-Dqut4h89.js";import{n as x,r as ee}from"./form-control-BkVb2Qed.js";function S(e){return e.source.types.includes(`Files`)}function te(e){return e.source.items.filter(function(e){return e.kind===`file`}).map(function(e){return e.getAsFile()}).filter(function(e){return e!=null})}var C=s();function w(e){var r=e.dragEnter,i=r.type,s=r.relatedTarget;return i===`dragenter`?n()?t({dragEnter:r}):s==null?!0:a()?o(s):s instanceof HTMLIFrameElement:!1}function T(e){var t=e.type,n=e.value;return!(t===`application/vnd.pdnd`||t===`text/plain`&&n===`pdnd:android-fallback`)}function E(e){return Array.from(e.types).filter(function(t){return T({type:t,value:e.getData(t)})})}function D(e){return Array.from(e.items).filter(function(t){return t.kind===`file`||T({type:t.type,value:e.getData(t.type)})})}var O=!1,k=e({typeKey:`external`,defaultDropEffect:`copy`,mount:function(e){return(0,C.bind)(window,{type:`dragenter`,listener:function(t){if(!O&&t.dataTransfer&&e.canStart(t)&&w({dragEnter:t})){var n=E(t.dataTransfer);if(n.length){var r={types:n,items:[],getStringData:function(){return null}};e.start({event:t,dragType:{type:`external`,startedFrom:`external`,payload:r,getDropPayload:function(e){if(!e.dataTransfer)return r;var t=D(e.dataTransfer),i=e.dataTransfer.getData.bind(e.dataTransfer);return{types:n,items:t,getStringData:function(e){if(!n.includes(e))return null;var t=i(e);return T({type:e,value:t})?t:null}}}}})}}}})}});function A(e){return k.dropTarget(e)}function j(e){return k.monitor(e)}(function(){if(typeof window>`u`)return;k.registerUsage();var e={type:`idle`},t=e;function n(){t.type===`dragging`&&(O=!1,t.cleanup(),t=e)}function a(){return(0,C.bindAll)(window,[{type:`dragend`,listener:n}].concat(i(r({onDragEnd:n}))),{capture:!0})}(0,C.bind)(window,{type:`dragstart`,listener:function(){t.type===`idle`&&(O=!0,t={type:`dragging`,cleanup:a()})},options:{capture:!0}})})();var M=[`stack`,`inline`],ne=[`auto`,`image`,`none`],N=[`sm`,`md`,`lg`],P={name:l,accept:l,capture:l,multiple:d,required:d,disabled:d,invalid:d,preview:u(ne,`auto`),layout:u(M,`stack`),size:u(N,`md`),heading:l.default(`Drop files here or browse`),text:l,browseLabel:l,empty:l,maxItems:c.min(0).default(0),clearable:d.default(!0),transport:u([`native`,`direct`],`native`),rootClass:l,dropzoneClass:l,listClass:l,itemClass:l,class:l};l.default(`Drop files here or browse`),l.default(`cloud__upload`),u(M,`stack`),u(N,`md`),l.default(`document__blank`),l.default(`Remove file`);var re=[h({name:`uploading`,state:`transfer.direct.uploading`,project:e=>({files:e.context.selection.files.filter(({id:t})=>e.context.transfer.activeIds.includes(t))}),onDone:`UPLOADING_DONE`,onError:`UPLOADING_ERROR`,required:!0,sends:{progress:(e,t,n)=>({type:`UPLOAD_PROGRESS`,id:e,loaded:t,total:n}),cancel:()=>({type:`CANCEL_UPLOAD`})}})],F=e=>e,I=e=>{let t=e.source;return t===`picker`||t===`drop`||t===`remove`||t===`props`?t:`clear`},L=(e,t)=>{let n=t.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!0;let r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.slice(0,-1)):e.includes(`/`)&&i===e)},R=(e,t,n)=>{let r=F(n).records??[],i=r.filter(e=>L(e,t.accept)),a=F(n).append&&t.multiple?[...e.selection.files]:[],o=t.multiple?[...a,...i]:i.slice(0,1),s=t.maxItems>0?o.slice(0,t.maxItems):o;return{files:s,limitReached:t.maxItems>0&&s.length>=t.maxItems,rejectedCount:r.length-i.length+o.length-s.length,limitRejectedCount:o.length-s.length,source:I(n)}},z=({context:e,props:t,event:n})=>R(e,t,n).files,ie=e=>z(e).length===0,ae=({context:e,props:t,event:n})=>R(e,t,n).limitReached,B=({context:e,props:t})=>!t.disabled&&e.transfer.status!==`uploading`,V=({props:e})=>e.transport===`direct`,H=({props:e})=>e.transport===`native`,U=e=>V(e)&&(I(e.event)===`picker`||I(e.event)===`drop`)&&z(e).length>0,W=({context:e,props:t,event:n})=>({context:{selection:R(e,t,n)}}),G=({context:e})=>({context:{selection:{...e.selection,files:[],limitReached:!1,rejectedCount:0,limitRejectedCount:0,source:`clear`}}}),K=({context:e,props:t,event:n})=>{let r=R(e,t,n).files,i=new Set(e.selection.files.map(({id:e})=>e)),a=F(n).append?r.filter(({id:e})=>!i.has(e)).map(({id:e})=>e):r.map(({id:e})=>e);return{context:{transfer:{...e.transfer,status:`uploading`,activeIds:a,progress:{...e.transfer.progress,...Object.fromEntries(a.map(e=>[e,0]))},error:``}}}},q=(e,t,n=``)=>({...e.transfer,status:t,error:n}),oe=({context:e})=>({context:{transfer:{...q(e,`complete`),progress:{...e.transfer.progress,...Object.fromEntries(e.transfer.activeIds.map(e=>[e,1]))},results:{...e.transfer.results,...Object.fromEntries(e.transfer.activeIds.map(e=>[e,`complete`]))}}}}),se=({context:e,event:t})=>({context:{transfer:{...q(e,`failed`,t.error instanceof Error?t.error.message:String(t.error??`Upload failed.`)),results:{...e.transfer.results,...Object.fromEntries(e.transfer.activeIds.map(e=>[e,`failed`]))}}}}),ce=({context:e})=>({context:{transfer:{...q(e,`canceled`),results:{...e.transfer.results,...Object.fromEntries(e.transfer.activeIds.map(e=>[e,`canceled`]))}}}}),le=({context:e,event:t})=>{let n=typeof t.id==`string`?t.id:``;if(!e.transfer.activeIds.includes(n))return;let r=Number(t.loaded),i=Number(t.total),a=Number.isFinite(r)&&Number.isFinite(i)&&i>0?Math.min(1,Math.max(0,r/i)):0;return{context:{transfer:{...e.transfer,progress:{...e.transfer.progress,[n]:a}}}}},J=[{target:`#inventory-empty`,guard:e=>B(e)&&ie(e),reduce:`planSelection`,effects:`commitSelection`},{target:`#inventory-capped`,guard:e=>B(e)&&ae(e),reduce:`planSelection`,effects:`commitSelection`},{target:`#inventory-populated`,guard:B,reduce:`planSelection`,effects:`commitSelection`}],ue=({props:e,context:t,effects:n})=>b({type:`parallel`,on:{PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}},states:{interaction:{initial:`idle`,states:{idle:{on:{DRAG_ENTER:{target:`dragging`,guard:B,effects:`syncDragging`}}},dragging:{tags:[`dragging`],on:{DRAG_LEAVE:{target:`idle`,effects:`syncDragging`},DROP:{target:`idle`,effects:`syncDragging`},RECONCILE:{target:`idle`,guard:({props:e})=>e.disabled,effects:`syncDragging`}}}}},inventory:{initial:`empty`,on:{FILES_CHANGED:J,RECONCILE:J,FILES_RESET:{target:`#inventory-empty`,guard:B,reduce:`clearSelection`,effects:`resetSelection`},CLEAR_EXISTING:{guard:B,reduce:`clearExisting`,effects:`clearExisting`}},states:{empty:{id:`inventory-empty`,tags:[`empty`]},populated:{id:`inventory-populated`,tags:[`has-files`]},capped:{id:`inventory-capped`,tags:[`has-files`,`limit-reached`]}}},transfer:{initial:`inactive`,states:{inactive:{on:{RECONCILE:[{target:`#transfer-direct-idle`,guard:V,reduce:`setDirectIdle`,effects:`syncTransfer`},{target:`#transfer-native`,reduce:`setNative`,effects:`syncTransfer`}]}},native:{id:`transfer-native`,on:{RECONCILE:{target:`#transfer-direct-idle`,guard:V,reduce:`setDirectIdle`,effects:`syncTransfer`}}},direct:{initial:`idle`,on:{RECONCILE:{target:`#transfer-native`,guard:H,reduce:`setNative`,effects:`syncTransfer`}},states:{idle:{id:`transfer-direct-idle`,on:{FILES_CHANGED:{target:`uploading`,guard:U,reduce:`beginUpload`,effects:`syncTransfer`}}},uploading:{id:`transfer-uploading`,tags:[`uploading`],on:{UPLOAD_PROGRESS:{reduce:`updateProgress`,effects:`syncTransfer`},UPLOADING_DONE:{target:`complete`,reduce:`finishUpload`,effects:[`syncTransfer`,`emitComplete`]},UPLOADING_ERROR:{target:`failed`,reduce:`failUpload`,effects:[`syncTransfer`,`emitError`]},CANCEL_UPLOAD:{target:`canceled`,reduce:`cancelUpload`,effects:[`syncTransfer`,`emitCancel`]},RECONCILE:{target:`canceled`,guard:({props:e})=>e.disabled||e.transport!==`direct`,reduce:`cancelUpload`,effects:[`syncTransfer`,`emitCancel`]}}},complete:{on:{FILES_CHANGED:{target:`uploading`,guard:U,reduce:`beginUpload`,effects:`syncTransfer`}}},failed:{tags:[`upload-failed`],on:{RETRY_UPLOAD:{target:`uploading`,reduce:`retryUpload`,effects:`syncTransfer`},FILES_CHANGED:{target:`uploading`,guard:U,reduce:`beginUpload`,effects:`syncTransfer`}}},canceled:{on:{RETRY_UPLOAD:{target:`uploading`,reduce:`retryUpload`,effects:`syncTransfer`},FILES_CHANGED:{target:`uploading`,guard:U,reduce:`beginUpload`,effects:`syncTransfer`}}}}}}}}},{context:t,props:e,reducers:{replaceProps:({event:e,props:t})=>({props:e.props??t}),planSelection:W,clearSelection:G,clearExisting:({context:e})=>({context:{existing:{...e.existing,cleared:!0}}}),beginUpload:K,retryUpload:({context:e})=>({context:{transfer:{...e.transfer,status:`uploading`,error:``,activeIds:e.selection.files.filter(({id:t})=>e.transfer.results[t]!==`complete`).map(({id:e})=>e)}}}),finishUpload:oe,failUpload:se,cancelUpload:ce,updateProgress:le,setNative:({context:e})=>({context:{transfer:q(e,`native`)}}),setDirectIdle:({context:e})=>({context:{transfer:q(e,`idle`)}})},effects:{commitSelection:n.commitSelection,resetSelection:n.resetSelection,syncProps:n.syncProps,syncDragging:n.syncDragging,clearExisting:n.clearExisting,syncTransfer:n.syncTransfer,emitComplete:n.emitComplete,emitError:n.emitError,emitCancel:n.emitCancel}}),Y=e=>e.selection.files.map(t=>({...t,status:e.transfer.activeIds.includes(t.id)&&e.transfer.status===`uploading`?`uploading`:e.transfer.results[t.id]??`selected`,progress:e.transfer.progress[t.id]??0})),X=y({definition:{component:`ui.file-upload`,parts:{root:{base:[`grid w-full min-w-0 gap-3`]},control:{base:`relative grid min-w-0 gap-3`},input:{base:`sr-only`},dropzone:{base:[`relative grid min-w-0 overflow-hidden rounded-surface-md text-inherit outline-none`],variants:{layout:{stack:`justify-items-center text-center`,inline:`grid-cols-[auto_minmax(0,1fr)_auto] items-center text-left`},size:{sm:`gap-2 p-3`,md:`gap-3 p-4`,lg:`gap-3 p-5`}},defaults:{layout:`stack`,size:`md`}},icon:{base:`size-icon-lg shrink-0 fill-current text-surface-ink-muted`},body:{base:`grid min-w-0 gap-1`},heading:{base:`text-sm font-medium text-inherit`},text:{base:`text-xs font-normal text-surface-ink-muted`},browse:{base:[`inline-flex min-w-0 items-center justify-center rounded-control-md px-2 py-1 text-xs font-medium`]},list:{base:`grid min-w-0 gap-2`},empty:{base:`text-xs text-surface-ink-muted`},item:{base:[`grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-surface-sm px-3 py-2`]},preview:{base:`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-surface-xs bg-interaction-hover text-surface-ink-muted`},previewImage:{base:`size-full`},itemIcon:{base:`size-icon fill-current`},itemBody:{base:`grid min-w-0 gap-0.5`},itemName:{base:`truncate text-sm font-medium text-inherit`},itemMeta:{base:`truncate text-xs font-normal text-surface-ink-muted`},itemError:{base:`truncate text-xs font-normal text-intent-danger-text`},remove:{base:[`relative z-20 inline-flex size-control-sm shrink-0 items-center justify-center rounded-control-md border-0 bg-transparent`,`text-surface-ink-muted outline-none`]},removeIcon:{base:`size-icon-xs fill-current leading-none`},clear:{base:`sr-only`}}}}),de=e=>{if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?Math.round(r):Number(r.toFixed(1))} ${t[n]}`},fe=e=>e?Array.from(e):[],Z=e=>e.type.startsWith(`image/`),pe=(e,t)=>t!==`none`&&(t===`image`||Z(e)),me=e=>{if(typeof DataTransfer>`u`)return null;let t=new DataTransfer;return e.forEach(e=>t.items.add(e)),t.files},he=(e,t)=>{let n=me(t);if(!n)return!1;try{return e.files=n,!0}catch{return!1}},ge=(e,t)=>{let n=`http://www.w3.org/2000/svg`,r=document.createElementNS(n,`svg`),i=document.createElementNS(n,`path`);return r.setAttribute(`viewBox`,`0 0 32 32`),r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`class`,t),i.setAttribute(`d`,e),r.append(i),r},_e=e=>{let t=`http://www.w3.org/2000/svg`,n=document.createElementNS(t,`svg`),r=document.createElementNS(t,`polygon`);return n.setAttribute(`viewBox`,`0 0 32 32`),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`class`,e),r.setAttribute(`points`,`17.4141 16 24 9.4141 22.5859 8 16 14.5859 9.4143 8 8 9.4141 14.5859 16 8 22.5859 9.4143 24 16 17.4141 22.5859 24 24 22.5859 17.4141 16`),n.append(r),n},Q=()=>{let e=null,t=[],n=!1,r=0,i=new Map,a=new Map,o=()=>{if(!e)throw Error(`File upload has not been initialized.`);return e},s=()=>{let e=o().querySelector(`[data-ui-file-upload-input]`);if(!e)throw Error(`File upload requires a native file input.`);return e},c=()=>o().querySelector(`[data-ui-file-upload-dropzone]`),l=()=>o().querySelector(`[data-ui-file-upload-list]`),u=()=>D.getSnapshot().props,d=()=>D.getSnapshot().context,h=e=>({id:`file-${++r}`,name:e.name,bytes:e.size,size:de(e.size),type:e.type||`File`}),_=e=>e.map(e=>{let t=h(e);return i.set(t.id,e),t}),y=e=>{let t=a.get(e);t&&URL.revokeObjectURL(t),a.delete(e)},b=()=>{n=!0,s().dispatchEvent(new Event(`input`,{bubbles:!0})),s().dispatchEvent(new Event(`change`,{bubbles:!0}))},C=(e,t,n=!1)=>{u().disabled||D.hasTag(`uploading`)||D.send({type:`FILES_CHANGED`,records:e,source:t,append:n})},w=(e,t)=>{let n=l();if(!n)return;n.querySelectorAll(`[data-ui-file-upload-pending]`).forEach(e=>e.remove());let r=Y(e),o=new Set(r.map(({id:e})=>e));[...a.keys()].filter(e=>!o.has(e)).forEach(y),[...i.keys()].filter(e=>!o.has(e)).forEach(e=>i.delete(e));let s=n.querySelector(`[data-existing-file]:not([hidden])`),c=n.querySelector(`[data-ui-file-upload-empty]`);c&&(c.hidden=r.length>0||!!s);let u=v({part:X.parts.item,className:t.itemClass}),d=v({part:X.parts.preview}),f=v({part:X.parts.previewImage}),p=v({part:X.parts.itemBody}),m=v({part:X.parts.itemName}),h=v({part:X.parts.itemMeta}),g=v({part:X.parts.remove}),_=v({part:X.parts.removeIcon}),b=v({part:X.parts.itemIcon});r.forEach(e=>{let r=document.createElement(`li`);r.dataset.uiFileUploadItem=``,r.dataset.uiFileUploadPending=``,r.dataset.fileId=e.id,r.dataset.status=e.status,r.dataset.progress=String(e.progress),r.className=u;let o=document.createElement(`span`);o.dataset.uiFileUploadPreview=``,o.className=d,o.setAttribute(`aria-hidden`,`true`);let s=i.get(e.id);if(s&&pe(s,t.preview)){let t=a.get(e.id);t||(t=URL.createObjectURL(s),a.set(e.id,t));let n=document.createElement(`img`);n.src=t,n.alt=``,n.loading=`lazy`,n.decoding=`async`,n.className=`outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10 block size-full object-cover ${f}`,o.append(n)}else o.append(ge(`M25.7,9.3l-7-7A.9078.9078,0,0,0,18,2H8A2.0059,2.0059,0,0,0,6,4V28a2.0059,2.0059,0,0,0,2,2H24a2.0059,2.0059,0,0,0,2-2V10A.9078.9078,0,0,0,25.7,9.3ZM18,4.4,23.6,10H18ZM24,28H8V4h8v6a2.0059,2.0059,0,0,0,2,2h6Z`,b));let c=document.createElement(`span`);c.className=p;let l=document.createElement(`span`);l.dataset.uiFileUploadItemName=``,l.className=m,l.textContent=e.name;let v=document.createElement(`span`);v.dataset.uiFileUploadItemMeta=``,v.className=h,v.textContent=[e.size,e.type].filter(Boolean).join(` · `),c.append(l,v);let y=document.createElement(`button`);y.type=`button`,y.dataset.uiFileUploadRemove=``,y.dataset.fileId=e.id,y.className=g,y.disabled=D.hasTag(`uploading`),y.setAttribute(`aria-label`,`Remove ${e.name}`),y.append(_e(_)),r.append(o,c,y),n.append(r)})},T=(e=d(),t=u())=>{let n=Y(e),r=e.existing.present&&!e.existing.cleared,i=n.length>0||r,a=t.disabled||e.selection.limitReached||e.transfer.status===`uploading`,l=s();ee({input:l,state:{disabled:t.disabled,required:t.required,invalid:t.invalid}}),t.transport===`native`&&t.name?l.name=t.name:l.removeAttribute(`name`),l.multiple=t.multiple,t.accept?l.setAttribute(`accept`,t.accept):l.removeAttribute(`accept`),t.capture?l.setAttribute(`capture`,t.capture):l.removeAttribute(`capture`),a&&!t.disabled?(l.setAttribute(`aria-disabled`,`true`),l.tabIndex=-1):t.disabled||(l.removeAttribute(`aria-disabled`),l.removeAttribute(`tabindex`)),l.form&&(l.form.enctype=`multipart/form-data`),x({el:o(),state:t,value:`true`}),p({el:o(),attr:`data-empty`,present:!i,value:`true`}),p({el:o(),attr:`data-has-files`,present:i,value:`true`}),p({el:o(),attr:`data-multiple`,present:t.multiple,value:`true`}),p({el:o(),attr:`data-max-items-reached`,present:e.selection.limitReached,value:`true`}),p({el:o(),attr:`data-has-existing-file`,present:r,value:`true`}),o().dataset.transport=t.transport,o().dataset.transferState=e.transfer.status;let f=c();f&&(x({el:f,state:{disabled:a,invalid:t.invalid},value:`true`}),p({el:f,attr:`data-multiple`,present:t.multiple,value:`true`}),p({el:f,attr:`data-has-files`,present:i,value:`true`}),p({el:f,attr:`data-max-items-reached`,present:e.selection.limitReached,value:`true`})),w(e,t)},E=e=>({selection:{files:[],limitReached:!1,rejectedCount:0,limitRejectedCount:0,source:`clear`},existing:{present:!!o().querySelector(`[data-ui-file-upload-item][data-existing-file]`),cleared:!1},transfer:{status:e.transport===`native`?`native`:`idle`,activeIds:[],progress:{},results:{},error:``}}),D=g({schema:P,hooks:re,createMachine:({props:e})=>ue({props:e,context:E(e),effects:{commitSelection:e=>{let t=e.context.selection.files.flatMap(({id:e})=>i.get(e)??[]);if(!he(s(),t)){s().value=``,D.send(`FILES_RESET`);return}T(e.context,e.props),e.context.selection.limitRejectedCount>0&&f({el:o(),name:`ui:file-upload-limit`,detail:{rejectedCount:e.context.selection.limitRejectedCount}}),e.context.selection.source!==`picker`&&b(),f({el:o(),name:`ui:file-upload-change`,detail:{files:Y(e.context)}})},resetSelection:e=>{s().value=``,T(e.context,e.props)},syncProps:e=>{T(e.context,e.props),D.send({type:`RECONCILE`,records:e.context.selection.files,source:`props`})},syncDragging:e=>{let t=e.snapshot.tags.includes(`dragging`);p({el:o(),attr:`data-dragging`,present:t,value:`true`});let n=c();n&&p({el:n,attr:`data-dragging`,present:t,value:`true`})},clearExisting:e=>{let t=o().querySelector(`[data-ui-file-upload-clear]`);t&&(t.checked=!0,t.dispatchEvent(new Event(`change`,{bubbles:!0})));let n=o().querySelector(`[data-ui-file-upload-item][data-existing-file]`);n&&(n.hidden=!0),T(e.context,e.props),f({el:o(),name:`ui:file-upload-change`,detail:{files:Y(e.context)}})},syncTransfer:e=>T(e.context,e.props),emitComplete:e=>f({el:o(),name:`ui:file-upload-complete`,detail:{files:Y(e.context)}}),emitError:e=>f({el:o(),name:`ui:file-upload-error`,detail:{files:Y(e.context),error:e.context.transfer.error}}),emitCancel:e=>f({el:o(),name:`ui:file-upload-cancel`,detail:{files:Y(e.context)}})}})}),O={...D,get files(){return this.snapshot.current?Y(this.snapshot.current.context):[]},get hasFiles(){return(this.snapshot.current?.context.selection.files.length??0)>0||!!(this.snapshot.current?.context.existing.present&&!this.snapshot.current.context.existing.cleared)},get isDragging(){return this.snapshot.current?.tags.includes(`dragging`)??!1},get isUploading(){return this.snapshot.current?.tags.includes(`uploading`)??!1},get isLimitReached(){return this.snapshot.current?.context.selection.limitReached??!1},init(){e=this.$el,D.connect(this.$el,this.snapshot);let r=s();m({target:r,event:`change`,handler:()=>{if(n){n=!1;return}C(_(fe(r.files)),`picker`)},cleanup:t}),m({target:o(),event:`click`,handler:e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-ui-file-upload-remove][data-file-id]`);if(n?.dataset.fileId){e.preventDefault(),O.remove(n.dataset.fileId);return}t.closest(`[data-ui-file-upload-remove][data-existing-file]`)&&(e.preventDefault(),D.send(`CLEAR_EXISTING`))},cleanup:t});let i=c();i&&(t.push(A({element:i,canDrop:({source:e})=>!u().disabled&&!D.hasTag(`uploading`)&&S({source:e}),getDropEffect:()=>`copy`,onDragEnter:()=>D.send(`DRAG_ENTER`),onDragLeave:()=>D.send(`DRAG_LEAVE`),onDrop:({source:e})=>{D.send(`DROP`),S({source:e})&&C(_(te({source:e})),`drop`,u().multiple)}})),t.push(j({canMonitor:({source:e})=>S({source:e}),onDrop:()=>D.send(`DRAG_LEAVE`)}))),T(),D.send({type:`RECONCILE`,records:[],source:`props`})},destroy(){t.forEach(e=>e()),t=[],a.forEach(e=>URL.revokeObjectURL(e)),a.clear(),i.clear(),D.disconnect(),e=null},browse(){!u().disabled&&!D.hasTag(`uploading`)&&s().click()},remove(e){u().disabled||D.hasTag(`uploading`)||!i.has(e)||C(d().selection.files.filter(t=>t.id!==e),`remove`)},retry(){D.send(`RETRY_UPLOAD`)},cancel(){D.send(`CANCEL_UPLOAD`)},file(e){return i.get(e)??null}};return O},ve=_(`UiFileUpload`,Q),$=new WeakSet,ye=e=>{$.has(e)||($.add(e),ve(e))};export{Q as n,ye as t};
2
+ //# sourceMappingURL=entry.generated-9sxiaVVI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.generated-9sxiaVVI.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/external/file.js","../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-entering-window.js","../../../../../../../../../node_modules/.pnpm/@atlaskit+pragmatic-drag-and-drop@2.0.1/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/external-adapter.js","../../../../../../../../client/src/components/file-upload/contract.ts","../../../../../../../../client/src/components/file-upload/machine.ts","../../../../../../../../client/src/components/file-upload/styles.ts","../../../../../../../../client/src/components/file-upload/index.ts","../../../../../../../../client/src/components/file-upload/entry.generated.ts"],"sourcesContent":["export function containsFiles(_ref) {\n var source = _ref.source;\n return source.types.includes('Files');\n}\n\n/** Obtain an array of the dragged `File`s */\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getFiles(_ref2) {\n var source = _ref2.source;\n return source.items\n // unlike other media types, for files:\n // item.kind is 'file'\n // item.type is the type of file eg 'image/jpg'\n // for other media types, item.type is the mime format\n .filter(function (item) {\n return item.kind === 'file';\n }).map(function (item) {\n return item.getAsFile();\n }).filter(function (file) {\n return file != null;\n });\n}","import { isFirefox } from '../is-firefox';\nimport { isSafari } from '../is-safari';\nimport { isEnteringWindowInSafari } from './count-events-for-safari';\nimport { isFromAnotherWindow } from './is-from-another-window';\nexport function isEnteringWindow(_ref) {\n var dragEnter = _ref.dragEnter;\n var type = dragEnter.type,\n relatedTarget = dragEnter.relatedTarget;\n if (type !== 'dragenter') {\n return false;\n }\n if (isSafari()) {\n return isEnteringWindowInSafari({\n dragEnter: dragEnter\n });\n }\n\n // standard check\n if (relatedTarget == null) {\n return true;\n }\n\n /**\n * 🦊 Exception: `iframe` in Firefox (`125.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `relatedTarget` is the `iframe` element in the parent `window`\n * (foreign element)\n *\n * Case 2: child `iframe` → parent `window`\n * `relatedTarget` is an element inside the child `iframe`\n * (foreign element)\n */\n\n if (isFirefox()) {\n return isFromAnotherWindow(relatedTarget);\n }\n\n /**\n * 🌏 Exception: `iframe` in Chrome (`124.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `relatedTarget` is `null` *(standard check)*\n *\n * Case 2: child `iframe` → parent `window`\n * `relatedTarget` is the `iframe` element in the parent `window`\n */\n\n // Case 2\n // Using `instanceof` check as the element will be in the same `window`\n return relatedTarget instanceof HTMLIFrameElement;\n}","import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport { bind, bindAll } from 'bind-event-listener';\nimport { makeAdapter } from '../make-adapter/make-adapter';\nimport { androidFallbackText } from '../util/android';\nimport { isEnteringWindow } from '../util/changing-window/is-entering-window';\nimport { getBindingsForBrokenDrags } from '../util/detect-broken-drag';\nimport { textMediaType } from '../util/media-types/text-media-type';\nimport { elementAdapterNativeDataKey } from './element-adapter-native-data-key';\nexport function isAnAvailableType(_ref) {\n var type = _ref.type,\n value = _ref.value;\n // We don't want to expose our private elementAdapter key / value\n if (type === elementAdapterNativeDataKey) {\n return false;\n }\n // Not exposing \"text/plain\" if it contains the android fallback text\n // We _could_ add an `isAndroid()` check, but it's probably safest\n // to trim this data out, regardless of what OS we see it on.\n if (type === textMediaType && value === androidFallbackText) {\n return false;\n }\n return true;\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getAvailableTypes(transfer) {\n return Array.from(transfer.types).filter(function (type) {\n return isAnAvailableType({\n type: type,\n value: transfer.getData(type)\n });\n });\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function getAvailableItems(dataTransfer) {\n // item.kind is 'string' | 'file'\n // For 'string' item.type is the mimeType (eg 'text/plain')\n // For 'file' item.type is the file type (eg 'image/jpg')\n\n return Array.from(dataTransfer.items).filter(function (item) {\n return item.kind === 'file' || isAnAvailableType({\n type: item.type,\n value: dataTransfer.getData(item.type)\n });\n });\n}\nvar didDragStartLocally = false;\nvar adapter = makeAdapter({\n typeKey: 'external',\n // for external drags, we are generally making a copy of something that is being dragged\n defaultDropEffect: 'copy',\n mount: function mount(api) {\n // Binding to the `window` so that the element adapter\n // has a chance to get in first on the`document`.\n // We are giving preference to the element adapter.\n return bind(window, {\n type: 'dragenter',\n listener: function listener(event) {\n // drag operation was started within the document, it won't be an \"external\" drag\n if (didDragStartLocally) {\n return;\n }\n\n // Note: not checking if event was cancelled (`event.defaultPrevented`) as\n // cancelling a \"dragenter\" accepts the drag operation (not prevent it)\n\n // Something has gone wrong with our drag event\n if (!event.dataTransfer) {\n // Including this code on \"test\" and \"development\" environments:\n // - Browser tests commonly run against \"development\" builds\n // - Unit tests commonly run in \"test\"\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\"\\n It appears as though you have are not testing DragEvents correctly.\\n\\n - If you are unit testing, ensure you have polyfilled DragEvent.\\n - If you are browser testing, ensure you are dispatching drag events correctly.\\n\\n Please see our testing guides for more information:\\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\\n \".replace(/ {2}/g, ''));\n }\n return;\n }\n if (!api.canStart(event)) {\n return;\n }\n if (!isEnteringWindow({\n dragEnter: event\n })) {\n return;\n }\n\n // Note: not checking types for `elementAdapterNativeDataKey` as we expect to see that\n // key when pdnd started the drag in another document\n var types = getAvailableTypes(event.dataTransfer);\n if (!types.length) {\n return;\n }\n var locked = {\n types: types,\n items: [],\n getStringData: function getStringData() {\n return null;\n }\n };\n api.start({\n event: event,\n dragType: {\n type: 'external',\n startedFrom: 'external',\n payload: locked,\n getDropPayload: function getDropPayload(event) {\n // this would be a platform error\n // trying to handle it gracefully rather than throwing (for now)\n if (!event.dataTransfer) {\n return locked;\n }\n var items = getAvailableItems(event.dataTransfer);\n // need to use `.bind` as `getData` is required\n // to be run with `event.dataTransfer` as the \"this\" context\n var nativeGetData = event.dataTransfer.getData.bind(event.dataTransfer);\n return {\n types: types,\n items: items,\n // return `null` if there is no result, otherwise string\n getStringData: function getStringData(mediaType) {\n // not dragging the requested type\n // return `null` (no result)\n if (!types.includes(mediaType)) {\n return null;\n }\n\n // nativeGetData will return `\"\"` when there is no value,\n // but at this point we know we will only get explicitly set\n // values back as we have checked the `types`.\n // `\"\"` can be an explicitly set value.\n var value = nativeGetData(mediaType);\n\n // not exposing data for unavailable types\n if (!isAnAvailableType({\n type: mediaType,\n value: value\n })) {\n return null;\n }\n return value;\n }\n };\n }\n }\n });\n }\n });\n }\n});\n\n/**\n * Some events don't make sense for the external adapter\n *\n * `onGenerateDragPreview`\n * The browser creates the drag preview for external drags, so we don't\n * need an event to generate the preview for _monitors_ or the _dropTarget_\n *\n * `onDragStart`\n * An external drag can never start from in the `window`, so _dropTarget_'s\n * don't need `onDragStart`\n */\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function dropTargetForExternal(args) {\n // not removing unused events, just leaning on the type system\n return adapter.dropTarget(args);\n}\n\n// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports\nexport function monitorForExternal(args) {\n // not removing unused events, just leaning on the type system\n return adapter.monitor(args);\n}\n(function startup() {\n // server side rendering check\n if (typeof window === 'undefined') {\n return;\n }\n\n // A shared single usage registration as we want to capture\n // all external drag operations, even if there are no drop targets\n // on the page yet\n adapter.registerUsage();\n // independent of pdnd, we need to keep track of\n // all drag operations so that we can know if a drag operation\n // has started locally\n\n var idle = {\n type: 'idle'\n };\n var state = idle;\n function clear() {\n if (state.type !== 'dragging') {\n return;\n }\n didDragStartLocally = false;\n state.cleanup();\n state = idle;\n }\n function bindEndEvents() {\n return bindAll(window, [{\n type: 'dragend',\n listener: clear\n }].concat(_toConsumableArray(getBindingsForBrokenDrags({\n onDragEnd: clear\n }))),\n // we want to make sure we get all the events,\n // and this helps avoid not seeing events when folks stop\n // them later on the event path\n {\n capture: true\n });\n }\n\n // we always keep this event listener active\n bind(window, {\n type: 'dragstart',\n listener: function listener() {\n // something bad has happened if this is true!\n if (state.type !== 'idle') {\n return;\n }\n // set our global flag\n didDragStartLocally = true;\n state = {\n type: 'dragging',\n cleanup: bindEndEvents()\n };\n },\n // binding in the capture phase so these listeners are called\n // before our listeners in the adapters `mount` function\n options: {\n capture: true\n }\n });\n})();\n\n/** Common event payload for all events */\n\n/** A map containing payloads for all events */\n\n/** Common event payload for all drop target events */\n\n/** A map containing payloads for all events on drop targets */\n\n/** Arguments given to all feedback functions (eg `canDrop()`) on a `dropTargetForExternal` */\n\n/** Arguments given to all monitor feedback functions (eg `canMonitor()`) for a `monitorForExternal` */","import {bool, number, oneOf, string, type SchemaToProps} from '../../runtime';\n\nconst FILE_UPLOAD_LAYOUTS = ['stack', 'inline'] as const;\nconst FILE_UPLOAD_PREVIEWS = ['auto', 'image', 'none'] as const;\nconst FILE_UPLOAD_SIZES = ['sm', 'md', 'lg'] as const;\nconst FILE_UPLOAD_TRANSPORTS = ['native', 'direct'] as const;\n\ntype FileUploadLayout = (typeof FILE_UPLOAD_LAYOUTS)[number];\ntype FileUploadPreview = (typeof FILE_UPLOAD_PREVIEWS)[number];\ntype FileUploadSize = (typeof FILE_UPLOAD_SIZES)[number];\ntype FileUploadTransport = (typeof FILE_UPLOAD_TRANSPORTS)[number];\n\nconst fileUploadSchema = {\n name: string,\n accept: string,\n capture: string,\n multiple: bool,\n required: bool,\n disabled: bool,\n invalid: bool,\n preview: oneOf(FILE_UPLOAD_PREVIEWS, 'auto' as FileUploadPreview),\n layout: oneOf(FILE_UPLOAD_LAYOUTS, 'stack' as FileUploadLayout),\n size: oneOf(FILE_UPLOAD_SIZES, 'md' as FileUploadSize),\n heading: string.default('Drop files here or browse'),\n text: string,\n browseLabel: string,\n empty: string,\n maxItems: number.min(0).default(0),\n clearable: bool.default(true),\n transport: oneOf(FILE_UPLOAD_TRANSPORTS, 'native' as FileUploadTransport),\n rootClass: string,\n dropzoneClass: string,\n listClass: string,\n itemClass: string,\n class: string,\n};\n\nconst fileUploadDropzoneSchema = {\n heading: string.default('Drop files here or browse'),\n text: string,\n icon: string.default('cloud__upload'),\n layout: oneOf(FILE_UPLOAD_LAYOUTS, 'stack' as FileUploadLayout),\n size: oneOf(FILE_UPLOAD_SIZES, 'md' as FileUploadSize),\n disabled: bool,\n invalid: bool,\n class: string,\n};\n\nconst fileUploadListSchema = {\n class: string,\n};\n\nconst fileUploadItemSchema = {\n filename: string,\n filesize: string,\n mime: string,\n preview: string,\n icon: string.default('document__blank'),\n invalid: bool,\n error: string,\n class: string,\n};\n\nconst fileUploadRemoveSchema = {\n label: string.default('Remove file'),\n class: string,\n};\n\ntype FileUploadProps = SchemaToProps<typeof fileUploadSchema>;\n\nexport {\n FILE_UPLOAD_LAYOUTS,\n FILE_UPLOAD_PREVIEWS,\n FILE_UPLOAD_SIZES,\n FILE_UPLOAD_TRANSPORTS,\n fileUploadDropzoneSchema,\n fileUploadItemSchema,\n fileUploadListSchema,\n fileUploadRemoveSchema,\n fileUploadSchema,\n};\nexport type {\n FileUploadLayout,\n FileUploadPreview,\n FileUploadProps,\n FileUploadSize,\n FileUploadTransport,\n};\n","import {\n createMachine,\n type Machine,\n type MachineEventObject,\n type MachineScope,\n} from '../../runtime/state-machine';\nimport {defineHook, type TransitionHookDefinition} from '../../runtime/transition-coordinator';\nimport type {FileUploadProps} from './contract';\n\ntype FileSelectionSource = 'picker' | 'drop' | 'remove' | 'props' | 'clear';\ntype FileTransferStatus = 'selected' | 'uploading' | 'complete' | 'failed' | 'canceled';\n\ntype FileUploadMetadata = {\n id: string;\n name: string;\n bytes: number;\n size: string;\n type: string;\n};\n\ntype FileUploadRecord = FileUploadMetadata & {\n status: FileTransferStatus;\n progress: number;\n};\n\ntype FileUploadContext = {\n selection: {\n files: FileUploadMetadata[];\n limitReached: boolean;\n rejectedCount: number;\n limitRejectedCount: number;\n source: FileSelectionSource;\n };\n existing: {present: boolean; cleared: boolean};\n transfer: {\n status: 'native' | 'idle' | 'uploading' | 'complete' | 'failed' | 'canceled';\n activeIds: string[];\n progress: Record<string, number>;\n results: Record<string, Exclude<FileTransferStatus, 'selected' | 'uploading'>>;\n error: string;\n };\n};\n\ntype FileUploadMachineEffects = {\n commitSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n resetSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncProps(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncDragging(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n clearExisting(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n syncTransfer(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitComplete(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitError(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n emitCancel(scope: MachineScope<FileUploadContext, FileUploadProps>): void;\n};\n\ntype CreateFileUploadMachineOptions = {\n props: FileUploadProps;\n context: FileUploadContext;\n effects: FileUploadMachineEffects;\n};\n\ntype FileRecordsEvent = MachineEventObject & {\n records: FileUploadMetadata[];\n append?: boolean;\n source?: FileSelectionSource;\n};\n\nconst uploadingHook = defineHook({\n name: 'uploading',\n state: 'transfer.direct.uploading',\n project: (snapshot) => ({\n files: snapshot.context.selection.files.filter(({id}) => snapshot.context.transfer.activeIds.includes(id)),\n }),\n onDone: 'UPLOADING_DONE',\n onError: 'UPLOADING_ERROR',\n required: true,\n sends: {\n progress: (id: string, loaded: number, total: number) => ({type: 'UPLOAD_PROGRESS', id, loaded, total}),\n cancel: () => ({type: 'CANCEL_UPLOAD'}),\n },\n} satisfies TransitionHookDefinition<\n FileUploadContext,\n FileUploadProps,\n {files: FileUploadMetadata[]},\n 'uploading'\n>);\n\nconst fileUploadHooks = [uploadingHook] as const;\n\nconst recordsEvent = (event: MachineEventObject): FileRecordsEvent => event as FileRecordsEvent;\nconst eventSource = (event: MachineEventObject): FileSelectionSource => {\n const source = event.source;\n return source === 'picker' || source === 'drop' || source === 'remove' || source === 'props' ? source : 'clear';\n};\n\nconst acceptedByAccept = (file: FileUploadMetadata, accept: string): boolean => {\n const tokens = accept.split(',').map((token) => token.trim().toLowerCase()).filter(Boolean);\n if (tokens.length === 0) return true;\n const name = file.name.toLowerCase();\n const type = file.type.toLowerCase();\n return tokens.some((token) => {\n if (token.startsWith('.')) return name.endsWith(token);\n if (token.endsWith('/*')) return type.startsWith(token.slice(0, -1));\n return token.includes('/') && type === token;\n });\n};\n\nconst selectionPlan = (\n context: Readonly<FileUploadContext>,\n props: Readonly<FileUploadProps>,\n event: MachineEventObject,\n): FileUploadContext['selection'] => {\n const candidate = recordsEvent(event).records ?? [];\n const accepted = candidate.filter((file) => acceptedByAccept(file, props.accept));\n const base = recordsEvent(event).append && props.multiple ? [...context.selection.files] : [];\n const combined = props.multiple ? [...base, ...accepted] : accepted.slice(0, 1);\n const files = props.maxItems > 0 ? combined.slice(0, props.maxItems) : combined;\n return {\n files,\n limitReached: props.maxItems > 0 && files.length >= props.maxItems,\n rejectedCount: candidate.length - accepted.length + combined.length - files.length,\n limitRejectedCount: combined.length - files.length,\n source: eventSource(event),\n };\n};\n\nconst plannedFiles = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>): FileUploadMetadata[] => (\n selectionPlan(context, props, event).files\n);\nconst planIsEmpty = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => plannedFiles(scope).length === 0;\nconst planIsCapped = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n selectionPlan(context, props, event).limitReached\n);\nconst canMutate = ({context, props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n !props.disabled && context.transfer.status !== 'uploading'\n);\nconst isDirect = ({props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => props.transport === 'direct';\nconst isNative = ({props}: MachineScope<FileUploadContext, FileUploadProps>): boolean => props.transport === 'native';\nconst shouldUpload = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => (\n isDirect(scope)\n && (eventSource(scope.event) === 'picker' || eventSource(scope.event) === 'drop')\n && plannedFiles(scope).length > 0\n);\n\nconst planSelection = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>) => ({\n context: {selection: selectionPlan(context, props, event)},\n});\nconst clearSelection = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({\n context: {selection: {...context.selection, files: [], limitReached: false, rejectedCount: 0, limitRejectedCount: 0, source: 'clear' as const}},\n});\nconst beginUpload = ({context, props, event}: MachineScope<FileUploadContext, FileUploadProps>) => {\n const files = selectionPlan(context, props, event).files;\n const previousIds = new Set(context.selection.files.map(({id}) => id));\n const activeIds = recordsEvent(event).append ? files.filter(({id}) => !previousIds.has(id)).map(({id}) => id) : files.map(({id}) => id);\n return {context: {transfer: {\n ...context.transfer,\n status: 'uploading' as const,\n activeIds,\n progress: {...context.transfer.progress, ...Object.fromEntries(activeIds.map((id) => [id, 0]))},\n error: '',\n }}};\n};\nconst setTransferStatus = (\n context: Readonly<FileUploadContext>,\n status: 'native' | 'idle' | 'complete' | 'failed' | 'canceled',\n error = '',\n): FileUploadContext['transfer'] => ({...context.transfer, status, error});\nconst finishUpload = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'complete'),\n progress: {...context.transfer.progress, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 1]))},\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'complete' as const]))},\n}}});\nconst failUpload = ({context, event}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'failed', event.error instanceof Error ? event.error.message : String(event.error ?? 'Upload failed.')),\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'failed' as const]))},\n}}});\nconst cancelUpload = ({context}: MachineScope<FileUploadContext, FileUploadProps>) => ({context: {transfer: {\n ...setTransferStatus(context, 'canceled'),\n results: {...context.transfer.results, ...Object.fromEntries(context.transfer.activeIds.map((id) => [id, 'canceled' as const]))},\n}}});\nconst updateProgress = ({context, event}: MachineScope<FileUploadContext, FileUploadProps>) => {\n const id = typeof event.id === 'string' ? event.id : '';\n if (!context.transfer.activeIds.includes(id)) return;\n const loaded = Number(event.loaded);\n const total = Number(event.total);\n const progress = Number.isFinite(loaded) && Number.isFinite(total) && total > 0 ? Math.min(1, Math.max(0, loaded / total)) : 0;\n return {context: {transfer: {...context.transfer, progress: {...context.transfer.progress, [id]: progress}}}};\n};\n\nconst canMutateToEmpty = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => canMutate(scope) && planIsEmpty(scope);\nconst canMutateToCapped = (scope: MachineScope<FileUploadContext, FileUploadProps>): boolean => canMutate(scope) && planIsCapped(scope);\n\nconst inventoryTransitions = [\n {target: '#inventory-empty', guard: canMutateToEmpty, reduce: 'planSelection', effects: 'commitSelection'},\n {target: '#inventory-capped', guard: canMutateToCapped, reduce: 'planSelection', effects: 'commitSelection'},\n {target: '#inventory-populated', guard: canMutate, reduce: 'planSelection', effects: 'commitSelection'},\n];\n\nconst createFileUploadMachine = ({props, context, effects}: CreateFileUploadMachineOptions): Machine<FileUploadContext, FileUploadProps> => createMachine<FileUploadContext, FileUploadProps>({\n type: 'parallel',\n on: {PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'}},\n states: {\n interaction: {\n initial: 'idle',\n states: {\n idle: {on: {DRAG_ENTER: {target: 'dragging', guard: canMutate, effects: 'syncDragging'}}},\n dragging: {tags: ['dragging'], on: {\n DRAG_LEAVE: {target: 'idle', effects: 'syncDragging'},\n DROP: {target: 'idle', effects: 'syncDragging'},\n RECONCILE: {target: 'idle', guard: ({props: currentProps}) => currentProps.disabled, effects: 'syncDragging'},\n }},\n },\n },\n inventory: {\n initial: 'empty',\n on: {\n FILES_CHANGED: inventoryTransitions,\n RECONCILE: inventoryTransitions,\n FILES_RESET: {target: '#inventory-empty', guard: canMutate, reduce: 'clearSelection', effects: 'resetSelection'},\n CLEAR_EXISTING: {guard: canMutate, reduce: 'clearExisting', effects: 'clearExisting'},\n },\n states: {\n empty: {id: 'inventory-empty', tags: ['empty']},\n populated: {id: 'inventory-populated', tags: ['has-files']},\n capped: {id: 'inventory-capped', tags: ['has-files', 'limit-reached']},\n },\n },\n transfer: {\n initial: 'inactive',\n states: {\n inactive: {on: {\n RECONCILE: [{target: '#transfer-direct-idle', guard: isDirect, reduce: 'setDirectIdle', effects: 'syncTransfer'}, {target: '#transfer-native', reduce: 'setNative', effects: 'syncTransfer'}],\n }},\n native: {id: 'transfer-native', on: {\n RECONCILE: {target: '#transfer-direct-idle', guard: isDirect, reduce: 'setDirectIdle', effects: 'syncTransfer'},\n }},\n direct: {\n initial: 'idle',\n on: {RECONCILE: {target: '#transfer-native', guard: isNative, reduce: 'setNative', effects: 'syncTransfer'}},\n states: {\n idle: {id: 'transfer-direct-idle', on: {FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'}}},\n uploading: {id: 'transfer-uploading', tags: ['uploading'], on: {\n UPLOAD_PROGRESS: {reduce: 'updateProgress', effects: 'syncTransfer'},\n UPLOADING_DONE: {target: 'complete', reduce: 'finishUpload', effects: ['syncTransfer', 'emitComplete']},\n UPLOADING_ERROR: {target: 'failed', reduce: 'failUpload', effects: ['syncTransfer', 'emitError']},\n CANCEL_UPLOAD: {target: 'canceled', reduce: 'cancelUpload', effects: ['syncTransfer', 'emitCancel']},\n RECONCILE: {target: 'canceled', guard: ({props: currentProps}) => currentProps.disabled || currentProps.transport !== 'direct', reduce: 'cancelUpload', effects: ['syncTransfer', 'emitCancel']},\n }},\n complete: {on: {FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'}}},\n failed: {tags: ['upload-failed'], on: {\n RETRY_UPLOAD: {target: 'uploading', reduce: 'retryUpload', effects: 'syncTransfer'},\n FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'},\n }},\n canceled: {on: {\n RETRY_UPLOAD: {target: 'uploading', reduce: 'retryUpload', effects: 'syncTransfer'},\n FILES_CHANGED: {target: 'uploading', guard: shouldUpload, reduce: 'beginUpload', effects: 'syncTransfer'},\n }},\n },\n },\n },\n },\n },\n}, {\n context,\n props,\n reducers: {\n replaceProps: ({event, props: currentProps}) => ({props: event.props as FileUploadProps ?? currentProps}),\n planSelection,\n clearSelection,\n clearExisting: ({context: current}) => ({context: {existing: {...current.existing, cleared: true}}}),\n beginUpload,\n retryUpload: ({context: current}) => ({context: {transfer: {...current.transfer, status: 'uploading', error: '', activeIds: current.selection.files.filter(({id}) => current.transfer.results[id] !== 'complete').map(({id}) => id)}}}),\n finishUpload,\n failUpload,\n cancelUpload,\n updateProgress,\n setNative: ({context: current}) => ({context: {transfer: setTransferStatus(current, 'native')}}),\n setDirectIdle: ({context: current}) => ({context: {transfer: setTransferStatus(current, 'idle')}}),\n },\n effects: {\n commitSelection: effects.commitSelection,\n resetSelection: effects.resetSelection,\n syncProps: effects.syncProps,\n syncDragging: effects.syncDragging,\n clearExisting: effects.clearExisting,\n syncTransfer: effects.syncTransfer,\n emitComplete: effects.emitComplete,\n emitError: effects.emitError,\n emitCancel: effects.emitCancel,\n },\n});\n\nconst recordsFromSnapshot = (context: Readonly<FileUploadContext>): FileUploadRecord[] => context.selection.files.map((file) => ({\n ...file,\n status: context.transfer.activeIds.includes(file.id) && context.transfer.status === 'uploading'\n ? 'uploading'\n : context.transfer.results[file.id] ?? 'selected',\n progress: context.transfer.progress[file.id] ?? 0,\n}));\n\nexport {createFileUploadMachine, fileUploadHooks, recordsFromSnapshot};\nexport type {\n CreateFileUploadMachineOptions,\n FileSelectionSource,\n FileTransferStatus,\n FileUploadContext,\n FileUploadMachineEffects,\n FileUploadMetadata,\n FileUploadRecord,\n};\n","import {defineStyles} from '../../runtime';\n\nconst fileUploadStyles = defineStyles({definition: {\n component: 'ui.file-upload',\n parts: {\n root: {\n base: [\n 'grid w-full min-w-0 gap-3',\n ],\n },\n control: {\n base: 'relative grid min-w-0 gap-3',\n },\n input: {\n base: 'sr-only',\n },\n dropzone: {\n base: [\n 'relative grid min-w-0 overflow-hidden rounded-surface-md text-inherit outline-none',\n ],\n variants: {\n layout: {\n stack: 'justify-items-center text-center',\n inline: 'grid-cols-[auto_minmax(0,1fr)_auto] items-center text-left',\n },\n size: {\n sm: 'gap-2 p-3',\n md: 'gap-3 p-4',\n lg: 'gap-3 p-5',\n },\n },\n defaults: {\n layout: 'stack',\n size: 'md',\n },\n },\n icon: {\n base: 'size-icon-lg shrink-0 fill-current text-surface-ink-muted',\n },\n body: {\n base: 'grid min-w-0 gap-1',\n },\n heading: {\n base: 'text-sm font-medium text-inherit',\n },\n text: {\n base: 'text-xs font-normal text-surface-ink-muted',\n },\n browse: {\n base: [\n 'inline-flex min-w-0 items-center justify-center rounded-control-md px-2 py-1 text-xs font-medium',\n ],\n },\n list: {\n base: 'grid min-w-0 gap-2',\n },\n empty: {\n base: 'text-xs text-surface-ink-muted',\n },\n item: {\n base: [\n 'grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-surface-sm px-3 py-2',\n ],\n },\n preview: {\n base: 'flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-surface-xs bg-interaction-hover text-surface-ink-muted',\n },\n previewImage: {\n base: 'size-full',\n },\n itemIcon: {\n base: 'size-icon fill-current',\n },\n itemBody: {\n base: 'grid min-w-0 gap-0.5',\n },\n itemName: {\n base: 'truncate text-sm font-medium text-inherit',\n },\n itemMeta: {\n base: 'truncate text-xs font-normal text-surface-ink-muted',\n },\n itemError: {\n base: 'truncate text-xs font-normal text-intent-danger-text',\n },\n remove: {\n base: [\n 'relative z-20 inline-flex size-control-sm shrink-0 items-center justify-center rounded-control-md border-0 bg-transparent',\n 'text-surface-ink-muted outline-none',\n ],\n },\n removeIcon: {\n base: 'size-icon-xs fill-current leading-none',\n },\n clear: {\n base: 'sr-only',\n },\n },\n}});\n\nexport {fileUploadStyles};\n","import {containsFiles, getFiles} from '@atlaskit/pragmatic-drag-and-drop/external/file';\nimport {dropTargetForExternal, monitorForExternal, type ExternalDropTargetEventPayloadMap} from '@atlaskit/pragmatic-drag-and-drop/external/adapter';\nimport type Alpine from 'alpinejs';\n\nimport {\n createAlpineMachine,\n defineAlpineData,\n type AlpineMachine,\n type TransitionForHook,\n type TrellisAlpineComponent,\n} from '@client/runtime';\nimport {syncControlPresence, syncNativeControl} from '@client/runtime/form-control';\nimport {resolveStyle} from '@client/runtime/styles';\nimport {addListener, dispatch, setPresence, type CleanupStack} from '@client/utils';\nimport {fileUploadSchema, type FileUploadProps} from './contract';\nimport {\n createFileUploadMachine,\n fileUploadHooks,\n recordsFromSnapshot,\n type FileSelectionSource,\n type FileTransferStatus,\n type FileUploadContext,\n type FileUploadMetadata,\n type FileUploadRecord,\n} from './machine';\nimport {fileUploadStyles} from './styles';\n\ntype FileUploadTransitionName = (typeof fileUploadHooks)[number]['name'];\ntype FileUploadTransition<TName extends FileUploadTransitionName = FileUploadTransitionName> = TransitionForHook<\n Extract<(typeof fileUploadHooks)[number], {name: TName}>,\n HTMLElement\n>;\n\n/**\n * Public Alpine API for `ui.file-upload`.\n *\n * @public\n */\ninterface UiFileUploadApi {\n /** Serializable metadata for the current pending or transferred files. */\n readonly files: readonly FileUploadRecord[];\n /** Whether pending or existing file content is present. */\n readonly hasFiles: boolean;\n /** Whether an external file is over the drop target. */\n readonly isDragging: boolean;\n /** Whether the direct transport hook is pending. */\n readonly isUploading: boolean;\n /** Whether the configured client-side item limit is full. */\n readonly isLimitReached: boolean;\n /** Opens the native file picker when interaction is available. */\n browse(): void;\n /** Removes a pending file by its stable record id. */\n remove(id: string): void;\n /** Retries failed or canceled direct-upload records. */\n retry(): void;\n /** Cancels the active direct-upload batch. */\n cancel(): void;\n /** Returns the original browser File for transport code without cloning it. */\n file(id: string): File | null;\n}\n\ntype FileUploadData = AlpineMachine<FileUploadContext, FileUploadProps, typeof fileUploadHooks> & UiFileUploadApi & {\n init(): void;\n destroy(): void;\n};\n\nconst formatBytes = (bytes: number): string => {\n if (bytes === 0) return '0 B';\n const units = ['B', 'KB', 'MB', 'GB'];\n const unitIndex = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n const value = bytes / (1024 ** unitIndex);\n const display = value >= 10 || unitIndex === 0 ? Math.round(value) : Number(value.toFixed(1));\n return `${display} ${units[unitIndex]}`;\n};\n\nconst filesFromList = (list: FileList | null): File[] => list ? Array.from(list) : [];\nconst isImageFile = (file: File): boolean => file.type.startsWith('image/');\nconst canPreviewFile = (file: File, preview: FileUploadProps['preview']): boolean => preview !== 'none' && (preview === 'image' || isImageFile(file));\n\nconst toFileList = (files: File[]): FileList | null => {\n if (typeof DataTransfer === 'undefined') return null;\n const transfer = new DataTransfer();\n files.forEach((file) => transfer.items.add(file));\n return transfer.files;\n};\n\nconst setInputFiles = (input: HTMLInputElement, files: File[]): boolean => {\n const list = toFileList(files);\n if (!list) return false;\n try {\n input.files = list;\n return true;\n } catch {\n return false;\n }\n};\n\nconst iconSvg = (pathData: string, className: string): SVGSVGElement => {\n const namespace = 'http://www.w3.org/2000/svg';\n const icon = document.createElementNS(namespace, 'svg');\n const path = document.createElementNS(namespace, 'path');\n icon.setAttribute('viewBox', '0 0 32 32');\n icon.setAttribute('aria-hidden', 'true');\n icon.setAttribute('class', className);\n path.setAttribute('d', pathData);\n icon.append(path);\n return icon;\n};\n\nconst closeIcon = (className: string): SVGSVGElement => {\n const namespace = 'http://www.w3.org/2000/svg';\n const icon = document.createElementNS(namespace, 'svg');\n const polygon = document.createElementNS(namespace, 'polygon');\n icon.setAttribute('viewBox', '0 0 32 32');\n icon.setAttribute('aria-hidden', 'true');\n icon.setAttribute('class', className);\n polygon.setAttribute('points', '17.4141 16 24 9.4141 22.5859 8 16 14.5859 9.4143 8 8 9.4141 14.5859 16 8 22.5859 9.4143 24 16 17.4141 22.5859 24 24 22.5859 17.4141 16');\n icon.append(polygon);\n return icon;\n};\n\nconst UiFileUpload = (): TrellisAlpineComponent<FileUploadData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let cleanup: CleanupStack = [];\n let ignoreNativeChange = false;\n let fileSequence = 0;\n const rawFiles = new Map<string, File>();\n const previewUrls = new Map<string, string>();\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('File upload has not been initialized.');\n return rootEl;\n };\n const input = (): HTMLInputElement => {\n const control = root().querySelector<HTMLInputElement>('[data-ui-file-upload-input]');\n if (!control) throw new Error('File upload requires a native file input.');\n return control;\n };\n const dropzone = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-file-upload-dropzone]');\n const list = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-file-upload-list]');\n const currentProps = (): Readonly<FileUploadProps> => bridge.getSnapshot().props;\n const currentContext = (): Readonly<FileUploadContext> => bridge.getSnapshot().context;\n\n const metadataFor = (file: File): FileUploadMetadata => ({\n id: `file-${++fileSequence}`,\n name: file.name,\n bytes: file.size,\n size: formatBytes(file.size),\n type: file.type || 'File',\n });\n const registerFiles = (files: File[]): FileUploadMetadata[] => files.map((file) => {\n const metadata = metadataFor(file);\n rawFiles.set(metadata.id, file);\n return metadata;\n });\n const revokePreview = (id: string): void => {\n const url = previewUrls.get(id);\n if (url) URL.revokeObjectURL(url);\n previewUrls.delete(id);\n };\n const dispatchNativeChange = (): void => {\n ignoreNativeChange = true;\n input().dispatchEvent(new Event('input', {bubbles: true}));\n input().dispatchEvent(new Event('change', {bubbles: true}));\n };\n const sendFiles = (records: FileUploadMetadata[], source: FileSelectionSource, append = false): void => {\n if (currentProps().disabled || bridge.hasTag('uploading')) return;\n bridge.send({type: 'FILES_CHANGED', records, source, append});\n };\n\n const renderFiles = (context: Readonly<FileUploadContext>, props: Readonly<FileUploadProps>): void => {\n const container = list();\n if (!container) return;\n container.querySelectorAll('[data-ui-file-upload-pending]').forEach((item) => item.remove());\n const records = recordsFromSnapshot(context);\n const selectedIds = new Set(records.map(({id}) => id));\n [...previewUrls.keys()].filter((id) => !selectedIds.has(id)).forEach(revokePreview);\n [...rawFiles.keys()].filter((id) => !selectedIds.has(id)).forEach((id) => rawFiles.delete(id));\n const existing = container.querySelector<HTMLElement>('[data-existing-file]:not([hidden])');\n const empty = container.querySelector<HTMLElement>('[data-ui-file-upload-empty]');\n if (empty) empty.hidden = records.length > 0 || Boolean(existing);\n\n const itemClass = resolveStyle({part: fileUploadStyles.parts.item, className: props.itemClass});\n const previewClass = resolveStyle({part: fileUploadStyles.parts.preview});\n const imageClass = resolveStyle({part: fileUploadStyles.parts.previewImage});\n const bodyClass = resolveStyle({part: fileUploadStyles.parts.itemBody});\n const nameClass = resolveStyle({part: fileUploadStyles.parts.itemName});\n const metaClass = resolveStyle({part: fileUploadStyles.parts.itemMeta});\n const removeClass = resolveStyle({part: fileUploadStyles.parts.remove});\n const removeIconClass = resolveStyle({part: fileUploadStyles.parts.removeIcon});\n const itemIconClass = resolveStyle({part: fileUploadStyles.parts.itemIcon});\n\n records.forEach((record) => {\n const item = document.createElement('li');\n item.dataset.uiFileUploadItem = '';\n item.dataset.uiFileUploadPending = '';\n item.dataset.fileId = record.id;\n item.dataset.status = record.status;\n item.dataset.progress = String(record.progress);\n item.className = itemClass;\n\n const preview = document.createElement('span');\n preview.dataset.uiFileUploadPreview = '';\n preview.className = previewClass;\n preview.setAttribute('aria-hidden', 'true');\n const file = rawFiles.get(record.id);\n if (file && canPreviewFile(file, props.preview)) {\n let url = previewUrls.get(record.id);\n if (!url) {\n url = URL.createObjectURL(file);\n previewUrls.set(record.id, url);\n }\n const image = document.createElement('img');\n image.src = url;\n image.alt = '';\n image.loading = 'lazy';\n image.decoding = 'async';\n image.className = `outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10 block size-full object-cover ${imageClass}`;\n preview.append(image);\n } else {\n preview.append(iconSvg('M25.7,9.3l-7-7A.9078.9078,0,0,0,18,2H8A2.0059,2.0059,0,0,0,6,4V28a2.0059,2.0059,0,0,0,2,2H24a2.0059,2.0059,0,0,0,2-2V10A.9078.9078,0,0,0,25.7,9.3ZM18,4.4,23.6,10H18ZM24,28H8V4h8v6a2.0059,2.0059,0,0,0,2,2h6Z', itemIconClass));\n }\n\n const body = document.createElement('span');\n body.className = bodyClass;\n const name = document.createElement('span');\n name.dataset.uiFileUploadItemName = '';\n name.className = nameClass;\n name.textContent = record.name;\n const meta = document.createElement('span');\n meta.dataset.uiFileUploadItemMeta = '';\n meta.className = metaClass;\n meta.textContent = [record.size, record.type].filter(Boolean).join(' · ');\n body.append(name, meta);\n\n const remove = document.createElement('button');\n remove.type = 'button';\n remove.dataset.uiFileUploadRemove = '';\n remove.dataset.fileId = record.id;\n remove.className = removeClass;\n remove.disabled = bridge.hasTag('uploading');\n remove.setAttribute('aria-label', `Remove ${record.name}`);\n remove.append(closeIcon(removeIconClass));\n item.append(preview, body, remove);\n container.append(item);\n });\n };\n\n const syncDom = (\n context: Readonly<FileUploadContext> = currentContext(),\n props: Readonly<FileUploadProps> = currentProps(),\n ): void => {\n const records = recordsFromSnapshot(context);\n const existing = context.existing.present && !context.existing.cleared;\n const hasFiles = records.length > 0 || existing;\n const unavailable = props.disabled || context.selection.limitReached || context.transfer.status === 'uploading';\n const control = input();\n syncNativeControl({input: control, state: {disabled: props.disabled, required: props.required, invalid: props.invalid}});\n if (props.transport === 'native' && props.name) control.name = props.name;\n else control.removeAttribute('name');\n control.multiple = props.multiple;\n props.accept ? control.setAttribute('accept', props.accept) : control.removeAttribute('accept');\n props.capture ? control.setAttribute('capture', props.capture) : control.removeAttribute('capture');\n if (unavailable && !props.disabled) {\n control.setAttribute('aria-disabled', 'true');\n control.tabIndex = -1;\n } else if (!props.disabled) {\n control.removeAttribute('aria-disabled');\n control.removeAttribute('tabindex');\n }\n if (control.form) control.form.enctype = 'multipart/form-data';\n\n syncControlPresence({el: root(), state: props, value: 'true'});\n setPresence({el: root(), attr: 'data-empty', present: !hasFiles, value: 'true'});\n setPresence({el: root(), attr: 'data-has-files', present: hasFiles, value: 'true'});\n setPresence({el: root(), attr: 'data-multiple', present: props.multiple, value: 'true'});\n setPresence({el: root(), attr: 'data-max-items-reached', present: context.selection.limitReached, value: 'true'});\n setPresence({el: root(), attr: 'data-has-existing-file', present: existing, value: 'true'});\n root().dataset.transport = props.transport;\n root().dataset.transferState = context.transfer.status;\n const zone = dropzone();\n if (zone) {\n syncControlPresence({el: zone, state: {disabled: unavailable, invalid: props.invalid}, value: 'true'});\n setPresence({el: zone, attr: 'data-multiple', present: props.multiple, value: 'true'});\n setPresence({el: zone, attr: 'data-has-files', present: hasFiles, value: 'true'});\n setPresence({el: zone, attr: 'data-max-items-reached', present: context.selection.limitReached, value: 'true'});\n }\n renderFiles(context, props);\n };\n\n const initialContext = (props: FileUploadProps): FileUploadContext => ({\n selection: {files: [], limitReached: false, rejectedCount: 0, limitRejectedCount: 0, source: 'clear'},\n existing: {present: Boolean(root().querySelector('[data-ui-file-upload-item][data-existing-file]')), cleared: false},\n transfer: {status: props.transport === 'native' ? 'native' : 'idle', activeIds: [], progress: {}, results: {}, error: ''},\n });\n\n const bridge = createAlpineMachine({\n schema: fileUploadSchema,\n hooks: fileUploadHooks,\n createMachine: ({props}) => createFileUploadMachine({\n props,\n context: initialContext(props),\n effects: {\n commitSelection: (scope) => {\n const selected = scope.context.selection.files;\n const selectedFiles = selected.flatMap(({id}) => rawFiles.get(id) ?? []);\n if (!setInputFiles(input(), selectedFiles)) {\n input().value = '';\n bridge.send('FILES_RESET');\n return;\n }\n syncDom(scope.context, scope.props);\n if (scope.context.selection.limitRejectedCount > 0) {\n dispatch({el: root(), name: 'ui:file-upload-limit', detail: {rejectedCount: scope.context.selection.limitRejectedCount}});\n }\n if (scope.context.selection.source !== 'picker') dispatchNativeChange();\n dispatch({el: root(), name: 'ui:file-upload-change', detail: {files: recordsFromSnapshot(scope.context)}});\n },\n resetSelection: (scope) => { input().value = ''; syncDom(scope.context, scope.props); },\n syncProps: (scope) => {\n syncDom(scope.context, scope.props);\n bridge.send({type: 'RECONCILE', records: scope.context.selection.files, source: 'props'});\n },\n syncDragging: (scope) => {\n const dragging = scope.snapshot.tags.includes('dragging');\n setPresence({el: root(), attr: 'data-dragging', present: dragging, value: 'true'});\n const zone = dropzone();\n if (zone) setPresence({el: zone, attr: 'data-dragging', present: dragging, value: 'true'});\n },\n clearExisting: (scope) => {\n const clear = root().querySelector<HTMLInputElement>('[data-ui-file-upload-clear]');\n if (clear) {\n clear.checked = true;\n clear.dispatchEvent(new Event('change', {bubbles: true}));\n }\n const existing = root().querySelector<HTMLElement>('[data-ui-file-upload-item][data-existing-file]');\n if (existing) existing.hidden = true;\n syncDom(scope.context, scope.props);\n dispatch({el: root(), name: 'ui:file-upload-change', detail: {files: recordsFromSnapshot(scope.context)}});\n },\n syncTransfer: (scope) => syncDom(scope.context, scope.props),\n emitComplete: (scope) => dispatch({el: root(), name: 'ui:file-upload-complete', detail: {files: recordsFromSnapshot(scope.context)}}),\n emitError: (scope) => dispatch({el: root(), name: 'ui:file-upload-error', detail: {files: recordsFromSnapshot(scope.context), error: scope.context.transfer.error}}),\n emitCancel: (scope) => dispatch({el: root(), name: 'ui:file-upload-cancel', detail: {files: recordsFromSnapshot(scope.context)}}),\n },\n }),\n });\n\n const component: TrellisAlpineComponent<FileUploadData> = {\n ...bridge,\n get files() { return this.snapshot.current ? recordsFromSnapshot(this.snapshot.current.context) : []; },\n get hasFiles() { return (this.snapshot.current?.context.selection.files.length ?? 0) > 0 || Boolean(this.snapshot.current?.context.existing.present && !this.snapshot.current.context.existing.cleared); },\n get isDragging() { return this.snapshot.current?.tags.includes('dragging') ?? false; },\n get isUploading() { return this.snapshot.current?.tags.includes('uploading') ?? false; },\n get isLimitReached() { return this.snapshot.current?.context.selection.limitReached ?? false; },\n init() {\n rootEl = this.$el;\n bridge.connect(this.$el, this.snapshot);\n const control = input();\n addListener({target: control, event: 'change', handler: () => {\n if (ignoreNativeChange) { ignoreNativeChange = false; return; }\n sendFiles(registerFiles(filesFromList(control.files)), 'picker');\n }, cleanup});\n addListener({target: root(), event: 'click', handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n const remove = target.closest<HTMLElement>('[data-ui-file-upload-remove][data-file-id]');\n if (remove?.dataset.fileId) { event.preventDefault(); component.remove(remove.dataset.fileId); return; }\n const existing = target.closest('[data-ui-file-upload-remove][data-existing-file]');\n if (existing) { event.preventDefault(); bridge.send('CLEAR_EXISTING'); }\n }, cleanup});\n const zone = dropzone();\n if (zone) {\n cleanup.push(dropTargetForExternal({\n element: zone,\n canDrop: ({source}) => !currentProps().disabled && !bridge.hasTag('uploading') && containsFiles({source}),\n getDropEffect: () => 'copy',\n onDragEnter: () => bridge.send('DRAG_ENTER'),\n onDragLeave: () => bridge.send('DRAG_LEAVE'),\n onDrop: ({source}: ExternalDropTargetEventPayloadMap['onDrop']) => {\n bridge.send('DROP');\n if (!containsFiles({source})) return;\n sendFiles(registerFiles(getFiles({source})), 'drop', currentProps().multiple);\n },\n }));\n cleanup.push(monitorForExternal({canMonitor: ({source}) => containsFiles({source}), onDrop: () => bridge.send('DRAG_LEAVE')}));\n }\n syncDom();\n bridge.send({type: 'RECONCILE', records: [], source: 'props'});\n },\n destroy() {\n cleanup.forEach((dispose) => dispose());\n cleanup = [];\n previewUrls.forEach((url) => URL.revokeObjectURL(url));\n previewUrls.clear();\n rawFiles.clear();\n bridge.disconnect();\n rootEl = null;\n },\n browse() { if (!currentProps().disabled && !bridge.hasTag('uploading')) input().click(); },\n remove(id) {\n if (currentProps().disabled || bridge.hasTag('uploading') || !rawFiles.has(id)) return;\n const records = currentContext().selection.files.filter((record) => record.id !== id);\n sendFiles(records, 'remove');\n },\n retry() { bridge.send('RETRY_UPLOAD'); },\n cancel() { bridge.send('CANCEL_UPLOAD'); },\n file(id) { return rawFiles.get(id) ?? null; },\n };\n return component;\n};\n\nconst registerFileUpload = defineAlpineData('UiFileUpload', UiFileUpload);\n\nexport {registerFileUpload, UiFileUpload};\nexport type {\n FileTransferStatus,\n FileUploadData,\n FileUploadMetadata,\n FileUploadRecord,\n FileUploadTransition,\n UiFileUploadApi,\n};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\n\nimport {registerFileUpload as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerFileUpload = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n\n registerComponent(AlpineInstance);\n};\n\nexport {registerFileUpload};\nexport default registerFileUpload;\nexport * from './index';\n"],"x_google_ignoreList":[0,1,2],"mappings":"udAAA,SAAgB,EAAc,EAAM,CAElC,OADa,EAAK,OACJ,MAAM,SAAS,OAAO,CACtC,CAIA,SAAgB,GAAS,EAAO,CAE9B,OADa,EAAM,OACL,MAKb,OAAO,SAAU,EAAM,CACtB,OAAO,EAAK,OAAS,MACvB,CAAC,EAAE,IAAI,SAAU,EAAM,CACrB,OAAO,EAAK,UAAU,CACxB,CAAC,EAAE,OAAO,SAAU,EAAM,CACxB,OAAO,GAAQ,IACjB,CAAC,CACH,WCjBA,SAAA,EAAA,EAAA,+IA+CA,CC3CA,SAAgB,EAAkB,EAAM,CACtC,IAAI,EAAO,EAAK,KACd,EAAQ,EAAK,MAWf,MAHA,EANI,IAAA,wBAMA,IAAA,cAA0B,IAAA,wBAIhC,CAGA,SAAgB,EAAkB,EAAU,CAC1C,OAAO,MAAM,KAAK,EAAS,KAAK,EAAE,OAAO,SAAU,EAAM,CACvD,OAAO,EAAkB,CACjB,OACN,MAAO,EAAS,QAAQ,CAAI,CAC9B,CAAC,CACH,CAAC,CACH,CAGA,SAAgB,EAAkB,EAAc,CAK9C,OAAO,MAAM,KAAK,EAAa,KAAK,EAAE,OAAO,SAAU,EAAM,CAC3D,OAAO,EAAK,OAAS,QAAU,EAAkB,CAC/C,KAAM,EAAK,KACX,MAAO,EAAa,QAAQ,EAAK,IAAI,CACvC,CAAC,CACH,CAAC,CACH,CACA,IAAI,EAAsB,GACtB,EAAU,EAAY,CACxB,QAAS,WAET,kBAAmB,OACnB,MAAO,SAAe,EAAK,CAIzB,OAAA,EAAA,EAAA,MAAY,OAAQ,CAClB,KAAM,YACN,SAAU,SAAkB,EAAO,CAE7B,OAQC,EAAM,cAUN,EAAI,SAAS,CAAK,GAGlB,EAAiB,CACpB,UAAW,CACb,CAAC,EAMD,KAAI,EAAQ,EAAkB,EAAM,YAAY,EAC3C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C,EACX,EAAY,QAAS,GAAQ,IAAI,gBAAgB,CAAG,CAAC,EACrD,EAAY,MAAM,EAClB,EAAS,MAAM,EACf,EAAO,WAAW,EAClB,EAAS,IACb,EACA,QAAS,CAAM,CAAC,EAAa,EAAE,UAAY,CAAC,EAAO,OAAO,WAAW,GAAG,EAAM,EAAE,MAAM,CAAG,EACzF,OAAO,EAAI,CACH,EAAa,EAAE,UAAY,EAAO,OAAO,WAAW,GAAK,CAAC,EAAS,IAAI,CAAE,GAE7E,EADgB,EAAe,EAAE,UAAU,MAAM,OAAQ,GAAW,EAAO,KAAO,CACxE,EAAS,QAAQ,CAC/B,EACA,OAAQ,CAAE,EAAO,KAAK,cAAc,CAAG,EACvC,QAAS,CAAE,EAAO,KAAK,eAAe,CAAG,EACzC,KAAK,EAAI,CAAE,OAAO,EAAS,IAAI,CAAE,GAAK,IAAM,CAChD,EACA,OAAO,CACX,EAEM,GAAqB,EAAiB,eAAgB,CAAY,ECtZlE,EAAa,IAAI,QAEjB,GAAsB,GAAqC,CACzD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAE7B,GAAkB,CAAc,EACpC"}
@@ -0,0 +1,2 @@
1
+ import{l as e,n as t,t as n}from"./codecs-Cb1ns_47.js";import{o as r,s as i}from"./dom-qAeVl7dc.js";import{t as a}from"./alpine-machine-BS13dbK4.js";import{t as o}from"./alpine-data-DZ17j0jc.js";import{t as s}from"./machine-Dqut4h89.js";import{n as c}from"./props-change-2xfsIAEN.js";import{C as l}from"./common-BOd_thC-.js";var u=[`stack`,`grid`,`inline`];e(l,`vertical`),e(u,`stack`),e([`default`,`trailing`],`default`),e([`stack`,`row`,`grid`],`stack`),e(u,`stack`);var d={invalid:n(t,`prop-invalid`)},f=[],p=e=>({event:t})=>c(t)?.props.invalid===e,m=e=>{let t=c(e.event)?.props;return t?{props:t}:void 0},h=({props:e,effects:t})=>s({initial:e.invalid?`invalid`:`valid`,on:{PROPS_CHANGED:[{target:`invalid`,guard:p(!0),reduce:`reconcileProps`,effects:`sync`},{target:`valid`,guard:p(!1),reduce:`reconcileProps`,effects:`sync`}],CONTENT_CHANGED:{effects:`sync`}},states:{valid:{tags:[`valid`]},invalid:{tags:[`invalid`]}}},{context:{},props:e,reducers:{reconcileProps:m},effects:t}),g=`input:not([type="hidden"]), textarea, select, button, [data-ui-control-target]`,_=(e,t)=>{let n=new Set((e??``).split(/\s+/).filter(Boolean));return n.add(t),Array.from(n).join(` `)},v=(e,t)=>(e??``).split(/\s+/).filter(e=>e&&!t.has(e)).join(` `),y=(e,t)=>(e.id||=`ui-${t}-${crypto.randomUUID()}`,e.id),b=()=>{let e=null,t=null,n=new WeakMap,o=new WeakMap,s=()=>{if(!e)throw Error(`Field has not been initialized.`);return e},c=()=>m.getCommittedSnapshot(),l=(e,t)=>{let i=n.get(e)??new Set,a=v(e.getAttribute(`aria-describedby`),i);t.forEach(e=>{a=_(a,e)}),a?r({el:e,attr:`aria-describedby`,value:a}):e.removeAttribute(`aria-describedby`),n.set(e,new Set(t))},u=(e,t)=>{if(t){e.hasAttribute(`data-ui-field-aria-invalid`)||(o.set(e,e.getAttribute(`aria-invalid`)),e.setAttribute(`data-ui-field-aria-invalid`,``)),e.setAttribute(`aria-invalid`,`true`);return}if(!e.hasAttribute(`data-ui-field-aria-invalid`))return;let n=o.get(e)??null;n===null?e.removeAttribute(`aria-invalid`):e.setAttribute(`aria-invalid`,n),e.removeAttribute(`data-ui-field-aria-invalid`),o.delete(e)},p=()=>{let e=s(),t=c().props.invalid;i({el:e,attr:`data-invalid`,present:t,value:`true`});let n=Array.from(e.querySelectorAll(g)).filter(t=>!t.closest(`[data-ui-field], [data-ui-fieldset]`)||t.closest(`[data-ui-field], [data-ui-fieldset]`)===e)[0],a=e.querySelector(`:scope > [data-ui-field-label]`),o=e.querySelector(`:scope > [data-ui-fieldset-legend]`),d=Array.from(e.querySelectorAll(`:scope > [data-ui-field-description]`)),f=Array.from(e.querySelectorAll(`:scope > [data-ui-field-error]`)),p=[...d,...f].filter(e=>!e.hasAttribute(`hidden`)).map(e=>y(e,e.hasAttribute(`data-ui-field-error`)?`field-error`:`field-description`));if(n){let e=y(n,`control`);if(a&&!a.htmlFor&&(a.htmlFor=e),o){let e=y(o,`fieldset-legend`);r({el:n,attr:`aria-labelledby`,value:_(n.getAttribute(`aria-labelledby`),e)})}l(n,p),u(n,t)}e.matches(`fieldset`)&&l(e,p)},m=a({schema:d,hooks:f,createMachine:({props:e})=>h({props:e,effects:{sync:p}})});return{...m,init(){e=this.$el,m.connect(e,this.snapshot),t=new MutationObserver(()=>m.send(`CONTENT_CHANGED`)),t.observe(s(),{childList:!0,subtree:!0}),p()},destroy(){t?.disconnect(),t=null,m.disconnect(),e=null}}},x=o(`UiField`,b),S=new WeakSet,C=e=>{S.has(e)||(S.add(e),x(e))};export{b as n,C as t};
2
+ //# sourceMappingURL=entry.generated-BehM6Hle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.generated-BehM6Hle.js","names":[],"sources":["../../../../../../../../client/src/components/field/contract.ts","../../../../../../../../client/src/components/field/machine.ts","../../../../../../../../client/src/components/field/index.ts","../../../../../../../../client/src/components/field/entry.generated.ts"],"sourcesContent":["import {attribute, bool, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {ORIENTATIONS, type Orientation} from '../common';\n\nconst FIELD_LAYOUTS = ['stack', 'grid', 'inline'] as const;\nconst FIELD_GROUP_LAYOUTS = ['stack', 'row', 'grid'] as const;\nconst FIELD_ORIENTATIONS = ORIENTATIONS;\n\ntype FieldLayout = typeof FIELD_LAYOUTS[number];\ntype FieldGroupLayout = typeof FIELD_GROUP_LAYOUTS[number];\ntype FieldOrientation = Orientation;\n\nconst fieldSchema = {\n name: string,\n controlId: string,\n label: string,\n description: string,\n descriptionTrailing: string,\n error: string,\n errors: string,\n badge: string,\n orientation: oneOf(FIELD_ORIENTATIONS, 'vertical' as FieldOrientation),\n layout: oneOf(FIELD_LAYOUTS, 'stack' as FieldLayout),\n disabled: bool,\n required: bool,\n invalid: bool,\n class: string,\n};\n\nconst fieldLabelSchema = {\n controlId: string,\n badge: string,\n required: bool,\n class: string,\n};\n\nconst fieldDescriptionSchema = {\n id: string,\n placement: oneOf(['default', 'trailing'] as const, 'default'),\n class: string,\n};\n\nconst fieldErrorSchema = {\n id: string,\n message: string,\n errors: string,\n class: string,\n};\n\nconst fieldGroupSchema = {\n layout: oneOf(FIELD_GROUP_LAYOUTS, 'stack' as FieldGroupLayout),\n class: string,\n};\n\nconst fieldsetSchema = {\n name: string,\n legend: string,\n description: string,\n error: string,\n errors: string,\n layout: oneOf(FIELD_LAYOUTS, 'stack' as FieldLayout),\n disabled: bool,\n required: bool,\n invalid: bool,\n class: string,\n};\n\nconst fieldsetLegendSchema = {\n badge: string,\n required: bool,\n class: string,\n};\n\nconst fieldRuntimeSchema = {\n invalid: attribute(bool, 'prop-invalid'),\n};\n\ntype FieldProps = SchemaToProps<typeof fieldSchema>;\ntype FieldGroupProps = SchemaToProps<typeof fieldGroupSchema>;\ntype FieldRuntimeProps = SchemaToProps<typeof fieldRuntimeSchema>;\ntype FieldsetProps = SchemaToProps<typeof fieldsetSchema>;\n\nexport {\n FIELD_GROUP_LAYOUTS,\n FIELD_LAYOUTS,\n FIELD_ORIENTATIONS,\n fieldDescriptionSchema,\n fieldErrorSchema,\n fieldGroupSchema,\n fieldLabelSchema,\n fieldRuntimeSchema,\n fieldSchema,\n fieldsetLegendSchema,\n fieldsetSchema,\n};\nexport type {FieldGroupLayout, FieldGroupProps, FieldLayout, FieldOrientation, FieldProps, FieldRuntimeProps, FieldsetProps};\n","import {createMachine, propsChangedEvent, type Machine, type MachineScope} from '../../runtime/state-machine';\nimport type {FieldRuntimeProps} from './contract';\n\ntype FieldContext = Record<string, never>;\ntype FieldEffects = {sync(scope: MachineScope<FieldContext, FieldRuntimeProps>): void};\nconst fieldHooks = [] as const;\nconst nextInvalidIs = (invalid: boolean) => ({event}: MachineScope<FieldContext, FieldRuntimeProps>): boolean => (\n propsChangedEvent<FieldRuntimeProps>(event)?.props.invalid === invalid\n);\nconst reconcileProps = (scope: MachineScope<FieldContext, FieldRuntimeProps>) => {\n const next = propsChangedEvent<FieldRuntimeProps>(scope.event)?.props;\n return next ? {props: next} : undefined;\n};\n\nconst createFieldMachine = ({props, effects}: {props: FieldRuntimeProps; effects: FieldEffects}): Machine<FieldContext, FieldRuntimeProps> => createMachine<FieldContext, FieldRuntimeProps>({\n initial: props.invalid ? 'invalid' : 'valid',\n on: {\n PROPS_CHANGED: [\n {target: 'invalid', guard: nextInvalidIs(true), reduce: 'reconcileProps', effects: 'sync'},\n {target: 'valid', guard: nextInvalidIs(false), reduce: 'reconcileProps', effects: 'sync'},\n ],\n CONTENT_CHANGED: {effects: 'sync'},\n },\n states: {valid: {tags: ['valid']}, invalid: {tags: ['invalid']}},\n}, {context: {}, props, reducers: {reconcileProps}, effects});\n\nexport {createFieldMachine, fieldHooks};\nexport type {FieldContext, FieldEffects};\n","import type Alpine from 'alpinejs';\n\nimport {type AlpineMachine, createAlpineMachine, defineAlpineData, type MachineSnapshot, type TrellisAlpineComponent} from '@client/runtime';\nimport {setAttribute, setPresence} from '@client/utils';\nimport {fieldRuntimeSchema, type FieldRuntimeProps} from './contract';\nimport {createFieldMachine, fieldHooks, type FieldContext} from './machine';\n\ntype FieldData = AlpineMachine<FieldContext, FieldRuntimeProps, typeof fieldHooks> & {\n init(): void;\n destroy(): void;\n};\n\nconst controlSelector = 'input:not([type=\"hidden\"]), textarea, select, button, [data-ui-control-target]';\nconst appendId = (value: string | null, id: string): string => {\n const tokens = new Set((value ?? '').split(/\\s+/).filter(Boolean));\n tokens.add(id);\n return Array.from(tokens).join(' ');\n};\nconst withoutIds = (value: string | null, ids: Set<string>): string => (\n (value ?? '').split(/\\s+/).filter((token) => token && !ids.has(token)).join(' ')\n);\nconst ensureId = (el: HTMLElement, prefix: string): string => {\n if (el.id) return el.id;\n el.id = `ui-${prefix}-${crypto.randomUUID()}`;\n return el.id;\n};\n\nconst UiField = (): TrellisAlpineComponent<FieldData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let observer: MutationObserver | null = null;\n const ownedDescriptions = new WeakMap<HTMLElement, Set<string>>();\n const originalInvalid = new WeakMap<HTMLElement, string | null>();\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('Field has not been initialized.');\n return rootEl;\n };\n const snapshot = (): MachineSnapshot<FieldContext, FieldRuntimeProps> => bridge.getCommittedSnapshot();\n const applyDescriptions = (el: HTMLElement, ids: string[]): void => {\n const previous = ownedDescriptions.get(el) ?? new Set<string>();\n let value = withoutIds(el.getAttribute('aria-describedby'), previous);\n ids.forEach((id) => { value = appendId(value, id); });\n if (value) setAttribute({el, attr: 'aria-describedby', value});\n else el.removeAttribute('aria-describedby');\n ownedDescriptions.set(el, new Set(ids));\n };\n const applyInvalid = (control: HTMLElement, invalid: boolean): void => {\n if (invalid) {\n if (!control.hasAttribute('data-ui-field-aria-invalid')) {\n originalInvalid.set(control, control.getAttribute('aria-invalid'));\n control.setAttribute('data-ui-field-aria-invalid', '');\n }\n control.setAttribute('aria-invalid', 'true');\n return;\n }\n if (!control.hasAttribute('data-ui-field-aria-invalid')) return;\n const original = originalInvalid.get(control) ?? null;\n if (original === null) control.removeAttribute('aria-invalid');\n else control.setAttribute('aria-invalid', original);\n control.removeAttribute('data-ui-field-aria-invalid');\n originalInvalid.delete(control);\n };\n const syncDom = (): void => {\n const field = root();\n const invalid = snapshot().props.invalid;\n setPresence({el: field, attr: 'data-invalid', present: invalid, value: 'true'});\n\n const controls = Array.from(field.querySelectorAll<HTMLElement>(controlSelector)).filter((control) => (\n !control.closest('[data-ui-field], [data-ui-fieldset]')\n || control.closest('[data-ui-field], [data-ui-fieldset]') === field\n ));\n const control = controls[0];\n const label = field.querySelector<HTMLLabelElement>(':scope > [data-ui-field-label]');\n const legend = field.querySelector<HTMLElement>(':scope > [data-ui-fieldset-legend]');\n const descriptions = Array.from(field.querySelectorAll<HTMLElement>(':scope > [data-ui-field-description]'));\n const errors = Array.from(field.querySelectorAll<HTMLElement>(':scope > [data-ui-field-error]'));\n const describedBy = [...descriptions, ...errors]\n .filter((el) => !el.hasAttribute('hidden'))\n .map((el) => ensureId(el, el.hasAttribute('data-ui-field-error') ? 'field-error' : 'field-description'));\n\n if (control) {\n const controlId = ensureId(control, 'control');\n if (label && !label.htmlFor) label.htmlFor = controlId;\n if (legend) {\n const legendId = ensureId(legend, 'fieldset-legend');\n setAttribute({el: control, attr: 'aria-labelledby', value: appendId(control.getAttribute('aria-labelledby'), legendId)});\n }\n applyDescriptions(control, describedBy);\n applyInvalid(control, invalid);\n }\n if (field.matches('fieldset')) applyDescriptions(field, describedBy);\n };\n const bridge = createAlpineMachine({\n schema: fieldRuntimeSchema,\n hooks: fieldHooks,\n createMachine: ({props}) => createFieldMachine({props, effects: {sync: syncDom}}),\n });\n\n return {\n ...bridge,\n init(): void {\n rootEl = this.$el;\n bridge.connect(rootEl, this.snapshot);\n observer = new MutationObserver(() => bridge.send('CONTENT_CHANGED'));\n observer.observe(root(), {childList: true, subtree: true});\n syncDom();\n },\n destroy(): void {\n observer?.disconnect();\n observer = null;\n bridge.disconnect();\n rootEl = null;\n },\n };\n};\n\nconst registerField = defineAlpineData('UiField', UiField);\n\nexport {registerField, UiField};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\n\nimport {registerField as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerField = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n\n registerComponent(AlpineInstance);\n};\n\nexport {registerField};\nexport default registerField;\nexport * from './index';\n"],"mappings":"qUAGA,IAAM,EAAgB,CAAC,QAAS,OAAQ,QAAQ,EAiB/B,EAAM,EAAoB,UAA8B,EAC7D,EAAM,EAAe,OAAsB,EAgBxC,EAAM,CAAC,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AW,CAAO,EC9GnD,EAAa,IAAI,QAEjB,EAAiB,GAAqC,CACpD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAE7B,EAAkB,CAAc,EACpC"}
@@ -0,0 +1,2 @@
1
+ import{f as e,l as t,n}from"./codecs-Cb1ns_47.js";import{t as r}from"./capability-resizable-C6LKIbpv.js";var i=[`auto`,`fixed`],a=[`compact`,`default`,`comfortable`],o=[`ghost`,`surface`],s=[`none`,`row`,`grid`],c=[`auto`,`full`],l=[`start`,`center`,`end`],u=[`top`,`middle`,`bottom`,`baseline`],d=[`none`,`ascending`,`descending`,`other`],f=[`col`,`colgroup`],p=[`row`,`rowgroup`],m=[`div`,`form`],h={layout:t(i,`auto`),density:t(a,`default`),variant:t(o,`ghost`),border:t(s,`none`),flush:n,zebra:n,hover:n.default(!0),stickyHeader:n,nowrap:n.default(!0),width:t(c,`full`),class:e,tableClass:e},g={side:t([`top`,`bottom`],`bottom`),class:e},_={class:e},v={selected:n,current:n,disabled:n,interactive:n,class:e},y={align:t(l,`start`),valign:t(u,`middle`),key:e,target:e,width:e,resizable:n,minWidth:e.default(`4rem`),maxWidth:e,sortable:n,sort:t(d,`none`),abbr:e,scope:t(f,`col`),class:e,contentClass:e,resizeHandleClass:e},b={as:t(m,`div`),id:e,class:e},x={align:t(l,`start`),valign:t(u,`middle`),scope:t(p,`row`),class:e},S={align:t(l,`start`),valign:t(u,`middle`),class:e},C={colspan:e.default(`1`),class:e,cellClass:e},w=new WeakSet,T=e=>{w.has(e)||(w.add(e),r(e))};export{C as _,a,h as b,p as c,o as d,c as f,y as g,b as h,f as i,d as l,S as m,l as n,m as o,g as p,s as r,i as s,T as t,u,x as v,_ as x,v as y};
2
+ //# sourceMappingURL=entry.generated-BhPEF6oz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry.generated-xcXw-cEl.js","names":[],"sources":["../../../../../../../../client/src/components/table/contract.ts","../../../../../../../../client/src/components/table/entry.generated.ts"],"sourcesContent":["import {bool, oneOf, string, type SchemaToProps} from '../../runtime';\n\nconst TABLE_LAYOUTS = ['auto', 'fixed'] as const;\nconst TABLE_DENSITIES = ['compact', 'default', 'comfortable'] as const;\nconst TABLE_VARIANTS = ['ghost', 'surface'] as const;\nconst TABLE_BORDERS = ['none', 'row', 'grid'] as const;\nconst TABLE_WIDTHS = ['auto', 'full'] as const;\nconst TABLE_ALIGNS = ['start', 'center', 'end'] as const;\nconst TABLE_VALIGNS = ['top', 'middle', 'bottom', 'baseline'] as const;\nconst TABLE_SORTS = ['none', 'ascending', 'descending', 'other'] as const;\nconst TABLE_COLUMN_SCOPES = ['col', 'colgroup'] as const;\nconst TABLE_ROW_HEADER_SCOPES = ['row', 'rowgroup'] as const;\nconst TABLE_FILTER_AS_VALUES = ['div', 'form'] as const;\n\nconst tableSchema = {\n layout: oneOf(TABLE_LAYOUTS, 'auto'),\n density: oneOf(TABLE_DENSITIES, 'default'),\n variant: oneOf(TABLE_VARIANTS, 'ghost'),\n border: oneOf(TABLE_BORDERS, 'none'),\n flush: bool,\n zebra: bool,\n hover: bool.default(true),\n stickyHeader: bool,\n nowrap: bool.default(true),\n width: oneOf(TABLE_WIDTHS, 'full'),\n class: string,\n tableClass: string,\n};\n\nconst tableCaptionSchema = {\n side: oneOf(['top', 'bottom'] as const, 'bottom'),\n class: string,\n};\n\nconst tableSectionSchema = {\n class: string,\n};\n\nconst tableRowSchema = {\n selected: bool,\n current: bool,\n disabled: bool,\n interactive: bool,\n class: string,\n};\n\nconst tableColumnSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n key: string,\n target: string,\n width: string,\n resizable: bool,\n minWidth: string.default('4rem'),\n maxWidth: string,\n sortable: bool,\n sort: oneOf(TABLE_SORTS, 'none'),\n abbr: string,\n scope: oneOf(TABLE_COLUMN_SCOPES, 'col'),\n class: string,\n contentClass: string,\n resizeHandleClass: string,\n};\n\nconst tableColumnFilterSchema = {\n as: oneOf(TABLE_FILTER_AS_VALUES, 'div'),\n id: string,\n class: string,\n};\n\nconst tableRowHeaderSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n scope: oneOf(TABLE_ROW_HEADER_SCOPES, 'row'),\n class: string,\n};\n\nconst tableCellSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n class: string,\n};\n\nconst tableEmptySchema = {\n colspan: string.default('1'),\n class: string,\n cellClass: string,\n};\n\ntype TableLayout = typeof TABLE_LAYOUTS[number];\ntype TableDensity = typeof TABLE_DENSITIES[number];\ntype TableVariant = typeof TABLE_VARIANTS[number];\ntype TableBorder = typeof TABLE_BORDERS[number];\ntype TableWidth = typeof TABLE_WIDTHS[number];\ntype TableAlign = typeof TABLE_ALIGNS[number];\ntype TableValign = typeof TABLE_VALIGNS[number];\ntype TableSort = typeof TABLE_SORTS[number];\ntype TableColumnScope = typeof TABLE_COLUMN_SCOPES[number];\ntype TableRowHeaderScope = typeof TABLE_ROW_HEADER_SCOPES[number];\ntype TableFilterAs = typeof TABLE_FILTER_AS_VALUES[number];\ntype TableProps = SchemaToProps<typeof tableSchema>;\ntype TableCaptionProps = SchemaToProps<typeof tableCaptionSchema>;\ntype TableSectionProps = SchemaToProps<typeof tableSectionSchema>;\ntype TableRowProps = SchemaToProps<typeof tableRowSchema>;\ntype TableColumnProps = SchemaToProps<typeof tableColumnSchema>;\ntype TableColumnFilterProps = SchemaToProps<typeof tableColumnFilterSchema>;\ntype TableRowHeaderProps = SchemaToProps<typeof tableRowHeaderSchema>;\ntype TableCellProps = SchemaToProps<typeof tableCellSchema>;\ntype TableEmptyProps = SchemaToProps<typeof tableEmptySchema>;\n\nexport {\n TABLE_ALIGNS,\n TABLE_BORDERS,\n TABLE_COLUMN_SCOPES,\n TABLE_DENSITIES,\n TABLE_FILTER_AS_VALUES,\n TABLE_LAYOUTS,\n TABLE_ROW_HEADER_SCOPES,\n TABLE_SORTS,\n TABLE_VALIGNS,\n TABLE_VARIANTS,\n TABLE_WIDTHS,\n tableCaptionSchema,\n tableCellSchema,\n tableColumnFilterSchema,\n tableColumnSchema,\n tableEmptySchema,\n tableRowHeaderSchema,\n tableRowSchema,\n tableSchema,\n tableSectionSchema,\n};\nexport type {\n TableAlign,\n TableBorder,\n TableCaptionProps,\n TableCellProps,\n TableColumnFilterProps,\n TableColumnProps,\n TableColumnScope,\n TableDensity,\n TableEmptyProps,\n TableFilterAs,\n TableLayout,\n TableProps,\n TableRowHeaderProps,\n TableRowHeaderScope,\n TableRowProps,\n TableSectionProps,\n TableSort,\n TableValign,\n TableVariant,\n TableWidth,\n};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\nimport {registerResizableCapability} from '../../capabilities/resizable';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerTable = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n registerResizableCapability(AlpineInstance);\n\n};\n\nexport {registerTable};\nexport default registerTable;\nexport * from './index';\n"],"mappings":"8FAEA,IAAM,EAAgB,CAAC,OAAQ,OAAO,EAChC,EAAkB,CAAC,UAAW,UAAW,aAAa,EACtD,EAAiB,CAAC,QAAS,SAAS,EACpC,EAAgB,CAAC,OAAQ,MAAO,MAAM,EACtC,EAAe,CAAC,OAAQ,MAAM,EAC9B,EAAe,CAAC,QAAS,SAAU,KAAK,EACxC,EAAgB,CAAC,MAAO,SAAU,SAAU,UAAU,EACtD,EAAc,CAAC,OAAQ,YAAa,aAAc,OAAO,EACzD,EAAsB,CAAC,MAAO,UAAU,EACxC,EAA0B,CAAC,MAAO,UAAU,EAC5C,EAAyB,CAAC,MAAO,MAAM,EAEvC,EAAc,CAChB,OAAQ,EAAM,EAAe,MAAM,EACnC,QAAS,EAAM,EAAiB,SAAS,EACzC,QAAS,EAAM,EAAgB,OAAO,EACtC,OAAQ,EAAM,EAAe,MAAM,EACnC,MAAO,EACP,MAAO,EACP,MAAO,EAAK,QAAQ,EAAI,EACxB,aAAc,EACd,OAAQ,EAAK,QAAQ,EAAI,EACzB,MAAO,EAAM,EAAc,MAAM,EACjC,MAAO,EACP,WAAY,CAChB,EAEM,EAAqB,CACvB,KAAM,EAAM,CAAC,MAAO,QAAQ,EAAY,QAAQ,EAChD,MAAO,CACX,EAEM,EAAqB,CACvB,MAAO,CACX,EAEM,EAAiB,CACnB,SAAU,EACV,QAAS,EACT,SAAU,EACV,YAAa,EACb,MAAO,CACX,EAEM,EAAoB,CACtB,MAAO,EAAM,EAAc,OAAO,EAClC,OAAQ,EAAM,EAAe,QAAQ,EACrC,IAAK,EACL,OAAQ,EACR,MAAO,EACP,UAAW,EACX,SAAU,EAAO,QAAQ,MAAM,EAC/B,SAAU,EACV,SAAU,EACV,KAAM,EAAM,EAAa,MAAM,EAC/B,KAAM,EACN,MAAO,EAAM,EAAqB,KAAK,EACvC,MAAO,EACP,aAAc,EACd,kBAAmB,CACvB,EAEM,EAA0B,CAC5B,GAAI,EAAM,EAAwB,KAAK,EACvC,GAAI,EACJ,MAAO,CACX,EAEM,EAAuB,CACzB,MAAO,EAAM,EAAc,OAAO,EAClC,OAAQ,EAAM,EAAe,QAAQ,EACrC,MAAO,EAAM,EAAyB,KAAK,EAC3C,MAAO,CACX,EAEM,EAAkB,CACpB,MAAO,EAAM,EAAc,OAAO,EAClC,OAAQ,EAAM,EAAe,QAAQ,EACrC,MAAO,CACX,EAEM,EAAmB,CACrB,QAAS,EAAO,QAAQ,GAAG,EAC3B,MAAO,EACP,UAAW,CACf,EClFM,EAAa,IAAI,QAEjB,EAAiB,GAAqC,CACpD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAC7B,EAA4B,CAAc,EAE9C"}
1
+ {"version":3,"file":"entry.generated-BhPEF6oz.js","names":[],"sources":["../../../../../../../../client/src/components/table/contract.ts","../../../../../../../../client/src/components/table/entry.generated.ts"],"sourcesContent":["import {bool, oneOf, string, type SchemaToProps} from '../../runtime';\n\nconst TABLE_LAYOUTS = ['auto', 'fixed'] as const;\nconst TABLE_DENSITIES = ['compact', 'default', 'comfortable'] as const;\nconst TABLE_VARIANTS = ['ghost', 'surface'] as const;\nconst TABLE_BORDERS = ['none', 'row', 'grid'] as const;\nconst TABLE_WIDTHS = ['auto', 'full'] as const;\nconst TABLE_ALIGNS = ['start', 'center', 'end'] as const;\nconst TABLE_VALIGNS = ['top', 'middle', 'bottom', 'baseline'] as const;\nconst TABLE_SORTS = ['none', 'ascending', 'descending', 'other'] as const;\nconst TABLE_COLUMN_SCOPES = ['col', 'colgroup'] as const;\nconst TABLE_ROW_HEADER_SCOPES = ['row', 'rowgroup'] as const;\nconst TABLE_FILTER_AS_VALUES = ['div', 'form'] as const;\n\nconst tableSchema = {\n layout: oneOf(TABLE_LAYOUTS, 'auto'),\n density: oneOf(TABLE_DENSITIES, 'default'),\n variant: oneOf(TABLE_VARIANTS, 'ghost'),\n border: oneOf(TABLE_BORDERS, 'none'),\n flush: bool,\n zebra: bool,\n hover: bool.default(true),\n stickyHeader: bool,\n nowrap: bool.default(true),\n width: oneOf(TABLE_WIDTHS, 'full'),\n class: string,\n tableClass: string,\n};\n\nconst tableCaptionSchema = {\n side: oneOf(['top', 'bottom'] as const, 'bottom'),\n class: string,\n};\n\nconst tableSectionSchema = {\n class: string,\n};\n\nconst tableRowSchema = {\n selected: bool,\n current: bool,\n disabled: bool,\n interactive: bool,\n class: string,\n};\n\nconst tableColumnSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n key: string,\n target: string,\n width: string,\n resizable: bool,\n minWidth: string.default('4rem'),\n maxWidth: string,\n sortable: bool,\n sort: oneOf(TABLE_SORTS, 'none'),\n abbr: string,\n scope: oneOf(TABLE_COLUMN_SCOPES, 'col'),\n class: string,\n contentClass: string,\n resizeHandleClass: string,\n};\n\nconst tableColumnFilterSchema = {\n as: oneOf(TABLE_FILTER_AS_VALUES, 'div'),\n id: string,\n class: string,\n};\n\nconst tableRowHeaderSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n scope: oneOf(TABLE_ROW_HEADER_SCOPES, 'row'),\n class: string,\n};\n\nconst tableCellSchema = {\n align: oneOf(TABLE_ALIGNS, 'start'),\n valign: oneOf(TABLE_VALIGNS, 'middle'),\n class: string,\n};\n\nconst tableEmptySchema = {\n colspan: string.default('1'),\n class: string,\n cellClass: string,\n};\n\ntype TableLayout = typeof TABLE_LAYOUTS[number];\ntype TableDensity = typeof TABLE_DENSITIES[number];\ntype TableVariant = typeof TABLE_VARIANTS[number];\ntype TableBorder = typeof TABLE_BORDERS[number];\ntype TableWidth = typeof TABLE_WIDTHS[number];\ntype TableAlign = typeof TABLE_ALIGNS[number];\ntype TableValign = typeof TABLE_VALIGNS[number];\ntype TableSort = typeof TABLE_SORTS[number];\ntype TableColumnScope = typeof TABLE_COLUMN_SCOPES[number];\ntype TableRowHeaderScope = typeof TABLE_ROW_HEADER_SCOPES[number];\ntype TableFilterAs = typeof TABLE_FILTER_AS_VALUES[number];\ntype TableProps = SchemaToProps<typeof tableSchema>;\ntype TableCaptionProps = SchemaToProps<typeof tableCaptionSchema>;\ntype TableSectionProps = SchemaToProps<typeof tableSectionSchema>;\ntype TableRowProps = SchemaToProps<typeof tableRowSchema>;\ntype TableColumnProps = SchemaToProps<typeof tableColumnSchema>;\ntype TableColumnFilterProps = SchemaToProps<typeof tableColumnFilterSchema>;\ntype TableRowHeaderProps = SchemaToProps<typeof tableRowHeaderSchema>;\ntype TableCellProps = SchemaToProps<typeof tableCellSchema>;\ntype TableEmptyProps = SchemaToProps<typeof tableEmptySchema>;\n\nexport {\n TABLE_ALIGNS,\n TABLE_BORDERS,\n TABLE_COLUMN_SCOPES,\n TABLE_DENSITIES,\n TABLE_FILTER_AS_VALUES,\n TABLE_LAYOUTS,\n TABLE_ROW_HEADER_SCOPES,\n TABLE_SORTS,\n TABLE_VALIGNS,\n TABLE_VARIANTS,\n TABLE_WIDTHS,\n tableCaptionSchema,\n tableCellSchema,\n tableColumnFilterSchema,\n tableColumnSchema,\n tableEmptySchema,\n tableRowHeaderSchema,\n tableRowSchema,\n tableSchema,\n tableSectionSchema,\n};\nexport type {\n TableAlign,\n TableBorder,\n TableCaptionProps,\n TableCellProps,\n TableColumnFilterProps,\n TableColumnProps,\n TableColumnScope,\n TableDensity,\n TableEmptyProps,\n TableFilterAs,\n TableLayout,\n TableProps,\n TableRowHeaderProps,\n TableRowHeaderScope,\n TableRowProps,\n TableSectionProps,\n TableSort,\n TableValign,\n TableVariant,\n TableWidth,\n};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\nimport {registerResizableCapability} from '../../capabilities/resizable';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerTable = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n registerResizableCapability(AlpineInstance);\n\n};\n\nexport {registerTable};\nexport default registerTable;\nexport * from './index';\n"],"mappings":"yGAEA,IAAM,EAAgB,CAAC,OAAQ,OAAO,EAChC,EAAkB,CAAC,UAAW,UAAW,aAAa,EACtD,EAAiB,CAAC,QAAS,SAAS,EACpC,EAAgB,CAAC,OAAQ,MAAO,MAAM,EACtC,EAAe,CAAC,OAAQ,MAAM,EAC9B,EAAe,CAAC,QAAS,SAAU,KAAK,EACxC,EAAgB,CAAC,MAAO,SAAU,SAAU,UAAU,EACtD,EAAc,CAAC,OAAQ,YAAa,aAAc,OAAO,EACzD,EAAsB,CAAC,MAAO,UAAU,EACxC,EAA0B,CAAC,MAAO,UAAU,EAC5C,EAAyB,CAAC,MAAO,MAAM,EAEvC,EAAc,CAChB,OAAQ,EAAM,EAAe,MAAM,EACnC,QAAS,E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motion-wMoceguq.js";import{c as t,f as n,l as r,n as i,s as a,u as o}from"./codecs-Cb1ns_47.js";import{n as s,r as c,s as l,t as u}from"./dom-qAeVl7dc.js";import{i as d,t as ee}from"./alpine-machine-BS13dbK4.js";import{t as f}from"./alpine-data-DZ17j0jc.js";import{t as p}from"./anchored-popover-BXEMsLrA.js";import{n as m,t as h}from"./styles-TfvwVPGw.js";import{t as te}from"./merge-bindings-C8ewA_FD.js";import{t as ne}from"./machine-Dqut4h89.js";import{n as g,t as _}from"./props-change-2xfsIAEN.js";import{t as re}from"./dismissable-layer-BROE-Ln2.js";import{i as ie,n as ae,r as oe,t as se}from"./form-control-BkVb2Qed.js";import{o as ce}from"./focus-scope-DtaPVNl5.js";import{t as le}from"./semantic-observer-BUswpsNx.js";import{n as v,t as y}from"./scroll-lock-DOw7dmi1.js";import{D as b,S as x,T as S,a as C,b as w,d as T,f as E,g as D,i as O,m as ue,n as de,o as k,p as A,r as j,s as M,t as N,u as fe,w as P,x as F}from"./common-BOd_thC-.js";var I=e=>e.trim().toLowerCase(),pe=e=>{if(e)try{return JSON.parse(e)}catch{return}},me=(e,t)=>{if(!(!t||e==null))return t.split(`.`).reduce((e,t)=>{if(!(typeof e!=`object`||!e))return e[t]},e)},he=h({definition:{component:`ui.badge`,parts:{root:{base:[`inline-flex min-w-0 shrink-0 select-none items-center justify-center gap-1 whitespace-nowrap font-badge outline-none`,`data-disabled:pointer-events-none`],variants:{variant:{soft:``,surface:``,outline:``,solid:``},color:{neutral:``,accent:``,success:``,warning:``,danger:``},size:{xs:`min-h-control-xs px-badge-padding-xs text-badge-xs [font-weight:var(--font-weight-badge-xs)]`,sm:`min-h-control-sm px-badge-padding-sm text-badge-sm [font-weight:var(--font-weight-badge-sm)]`,md:`min-h-control-md px-badge-padding-md text-badge-md [font-weight:var(--font-weight-badge-md)]`,lg:`min-h-control-lg px-badge-padding-lg text-badge-lg [font-weight:var(--font-weight-badge-lg)]`,xlg:`min-h-control-xlg px-badge-padding-xlg text-badge-xlg [font-weight:var(--font-weight-badge-xlg)]`},radius:C,insetLeft:{true:``,false:``},insetRight:{true:``,false:``},insetTop:{true:`-mt-1`,false:``},insetBottom:{true:`-mb-1`,false:``}},compounds:[{when:{insetLeft:!0,size:`xs`},class:`-ml-1.5`},{when:{insetLeft:!0,size:`sm`},class:`-ml-2`},{when:{insetLeft:!0,size:`md`},class:`-ml-2.5`},{when:{insetRight:!0,size:`xs`},class:`-mr-1.5`},{when:{insetRight:!0,size:`sm`},class:`-mr-2`},{when:{insetRight:!0,size:`md`},class:`-mr-2.5`}],defaults:{variant:`soft`,color:`neutral`,size:`sm`,radius:`sm`,insetLeft:!1,insetRight:!1,insetTop:!1,insetBottom:!1}},label:{base:`contents`},icon:{base:`shrink-0 fill-current text-current`,variants:{size:{xs:`size-icon-xs`,sm:`size-icon-xs`,md:`size-icon-sm`,lg:`size-icon-sm`,xlg:`size-icon`},position:{leading:``,trailing:``}},defaults:{size:`sm`,position:`leading`}},close:{base:[`-mr-1 inline-flex shrink-0 items-center justify-center rounded-full text-current outline-none`,`data-disabled:pointer-events-none`],variants:{size:{xs:`size-badge-close-xs`,sm:`size-badge-close-sm`,md:`size-badge-close-md`,lg:`size-badge-close-lg`,xlg:`size-badge-close-xlg`}},defaults:{size:`sm`}},closeIcon:{base:`size-icon-xs shrink-0 fill-current text-current`}}}}),L=[`soft`,`surface`,`outline`,`solid`],R=[`neutral`,`accent`,`success`,`warning`,`danger`],z=k,ge=[`span`,`button`],B=de,V=D,_e=j;r(L,`soft`),r(R,`neutral`),r(z,`sm`),r(_e,`sm`),r(ge,`span`),r(B,`button`),r(V,`mini`),r(B,`button`),n.default(`close`),r(V,`mini`),r(z,`sm`),n.default(`Remove`);var H=[`listbox`,`combobox`,`pillbox`,`native`],ve=M,ye=k,be=j,xe=S,Se=N,Ce=D,we=[`stay`,`close`],Te=[`check`,`checkbox`,`none`],U=b,Ee=fe,W={name:n,optionsId:n,value:n,values:a.array([]),placeholder:n,mode:r(H,`listbox`),multiple:i,searchable:i,creatable:i,filter:i.default(!0),clearable:i,clear:r(we,`stay`),suffix:n.default(`selected`),mark:r(Te,`check`),open:i,disabled:i,readonly:i,required:i,invalid:i,autoHighlight:i.default(!0),loop:i.default(!0),path:n,size:r(ye,`lg`),variant:r(ve,`outline`),radius:r(be,`md`),surface:r(U,`+2`),elevation:r(Ee,`3`),side:r(xe,`bottom`),align:r(Se,`start`),offset:t.clamp(-100,100).default(0),gap:t.clamp(0,50).default(4),empty:n.default(`No results found.`),icon:n,iconTrailing:n.default(`chevron__down`),iconVariant:r(Ce,`outline`),buttonClass:n,inputClass:n,listboxClass:n,optionClass:n,chipVariant:r(L,`soft`),chipColor:r(R,`neutral`),chipClass:n,class:n};r(Ce,`outline`),t.clamp(0,100).default(0);var De=[d({name:`opening`,state:`disclosure.opening`,project:()=>({}),onDone:`OPENING_DONE`,onError:`OPENING_ERROR`,sends:{close:()=>({type:`CLOSE`})}}),d({name:`closing`,state:`disclosure.closing`,project:()=>({}),onDone:`CLOSING_DONE`,onError:`CLOSING_ERROR`,sends:{open:()=>({type:`OPEN`})}}),d({name:`searching`,state:`feature.searching`,project:e=>({query:e.context.search.query,optionsId:e.context.search.optionsId}),onDone:`SEARCHING_DONE`,onError:`SEARCHING_ERROR`,sends:{search:e=>({type:`SEARCH`,query:e}),close:()=>({type:`CLOSE`})}}),d({name:`creating`,state:`feature.creating`,project:e=>({query:e.context.search.query,value:e.context.creation.value}),onDone:`CREATING_DONE`,onError:`CREATING_ERROR`,sends:{close:()=>({type:`CLOSE`})}})],G=e=>g(e)?.props??null,Oe=e=>e.disabled||e.readonly,K=({event:e})=>{let t=G(e);return!t||Oe(t)||!t.open?!1:_(e,`open`,`disabled`,`readonly`)},q=({event:e})=>{let t=G(e);return t?_(e,`open`)&&!t.open||_(e,`disabled`)&&t.disabled||_(e,`readonly`)&&t.readonly:!1},J=({event:e})=>{let t=G(e);return!!(t&&(_(e,`disabled`)&&t.disabled||_(e,`readonly`)&&t.readonly||_(e,`searchable`)&&!t.searchable))},Y=e=>!Array.isArray(e.values)||!Array.isArray(e.labels)?null:{values:e.values.filter(e=>typeof e==`string`),labels:e.labels.filter(e=>typeof e==`string`)},ke=({props:e,context:t,effects:n})=>ne({type:`parallel`,states:{disclosure:{initial:`closed`,states:{closed:{tags:[`closed`],on:{OPEN:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},TOGGLE:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},SEARCH:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},PROPS_CHANGED:{target:`opening`,guard:K,effects:`prepareOpen`}}},opening:{tags:[`visible`,`expanded`,`interactive`,`transitioning`],on:{OPENING_DONE:{target:`open`,effects:`finishOpen`},OPENING_ERROR:{target:`open`,effects:`finishOpen`},CLOSE:{target:`closing`,effects:`prepareClose`},TOGGLE:{target:`closing`,effects:`prepareClose`},CREATE:{target:`closing`,effects:`prepareClose`},SELECT:{target:`closing`,guard:`single`,effects:`prepareClose`},CLEAR:{target:`closing`,guard:`clearCloses`,effects:`prepareClose`},PROPS_CHANGED:{target:`closing`,guard:q,effects:`prepareClose`}}},open:{tags:[`visible`,`expanded`,`interactive`,`open`],on:{CLOSE:{target:`closing`,effects:`prepareClose`},TOGGLE:{target:`closing`,effects:`prepareClose`},CREATE:{target:`closing`,effects:`prepareClose`},SELECT:{target:`closing`,guard:`single`,effects:`prepareClose`},CLEAR:{target:`closing`,guard:`clearCloses`,effects:`prepareClose`},PROPS_CHANGED:{target:`closing`,guard:q,effects:`prepareClose`}}},closing:{tags:[`visible`,`transitioning`],on:{CLOSING_DONE:{target:`closed`,effects:`finishClose`},CLOSING_ERROR:{target:`closed`,effects:`finishClose`},OPEN:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},TOGGLE:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},SEARCH:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},PROPS_CHANGED:{target:`opening`,guard:K,effects:`prepareOpen`}}}}},feature:{initial:`idle`,on:{SELECT:{reduce:`replaceSelection`,effects:`commitSelection`},DESELECT:{reduce:`replaceSelection`,effects:`commitSelection`},SELECT_ALL:{reduce:`replaceSelection`,effects:`commitSelection`},RECONCILE_SELECTION:{reduce:`replaceSelection`,effects:`syncActive`},CLEAR:{reduce:`clear`,effects:`commitSelection`},ACTIVE:{reduce:`setActive`,effects:`syncActive`},OPTIONS_CHANGED:{effects:`syncOptions`},CLOSING_DONE:{reduce:`resetTransient`,effects:`syncActive`},CLOSING_ERROR:{reduce:`resetTransient`,effects:`syncActive`}},states:{idle:{on:{CLOSE:{},SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}},searching:{tags:[`searching`],on:{SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},CLOSE:{target:`idle`},SEARCHING_DONE:`idle`,SEARCHING_ERROR:`idle`,PROPS_CHANGED:[{target:`idle`,guard:J,reduce:`replaceProps`,effects:`syncProps`},{reduce:`replaceProps`,effects:`syncProps`}]}},creating:{tags:[`creating`],on:{SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},CLOSE:{target:`idle`},CREATING_DONE:{target:`idle`},CREATING_ERROR:{target:`idle`},PROPS_CHANGED:[{target:`idle`,guard:J,reduce:`replaceProps`,effects:`syncProps`},{reduce:`replaceProps`,effects:`syncProps`}]}}}}}},{context:t,props:e,reducers:{replaceProps:({event:e})=>{let t=G(e);return t?{props:t}:void 0},replaceSelection:({context:e,event:t})=>{let n=Y(t);if(n)return{context:{...e,selection:n}}},clear:({context:e})=>({context:{...e,selection:{values:[],labels:[]},search:{...e.search,query:``},navigation:{activeValue:``}}}),setSearch:({context:e,event:t})=>({context:{...e,search:{query:typeof t.query==`string`?t.query:``,optionsId:typeof t.optionsId==`string`?t.optionsId:e.search.optionsId},navigation:{activeValue:typeof t.activeValue==`string`?t.activeValue:e.navigation.activeValue}}}),setActive:({context:e,event:t})=>({context:{...e,navigation:{activeValue:typeof t.value==`string`?t.value:``}}}),setCreation:({context:e,event:t})=>({context:{...e,creation:{value:typeof t.value==`string`?t.value:e.search.query}}}),resetTransient:({context:e})=>({context:{...e,search:{...e.search,query:``},navigation:{activeValue:``},creation:{value:``}}})},guards:{canOpen:({props:e})=>!Oe(e),single:({props:e})=>!e.multiple,clearCloses:({props:e})=>e.clear===`close`},effects:{prepareOpen:n.prepareOpen,finishOpen:n.finishOpen,prepareClose:n.prepareClose,finishClose:n.finishClose,commitSelection:n.commitSelection,commitSearch:n.commitSearch,prepareCreate:n.prepareCreate,syncProps:n.syncProps,syncOptions:n.syncOptions,syncActive:n.syncActive}}),Ae=640,X=256,je=520,Me=.72,Z=12,Ne=16,Pe=720,Fe=720,Ie=({viewportWidth:e,viewportHeight:t,layoutViewportHeight:n,referenceTop:r,referenceBottom:i,touch:a})=>{if(e<=Ae)return`fullscreen`;let o=t<je||t<n*Me;if(a&&o)return`fullscreen`;if(a)return`dialog`;let s=Math.max(0,r),c=Math.max(0,t-i);return Math.max(s,c)<X?`dialog`:`anchored`},Le=()=>{let e=window.visualViewport;return e?{width:e.width,height:e.height,offsetTop:e.offsetTop,offsetLeft:e.offsetLeft}:{width:window.innerWidth,height:window.innerHeight,offsetTop:0,offsetLeft:0}},Re=()=>window.matchMedia?.(`(any-pointer: coarse)`).matches===!0||navigator.maxTouchPoints>0,ze=e=>{let t=p(e),n=!1,r=`anchored`,i=!1,a=null,o=()=>e.floating(),s=e=>{e!==i&&(i=e,e?y():v())},c=e=>{e.style.removeProperty(`border-radius`),e.style.removeProperty(`height`),e.style.removeProperty(`inset`),e.style.removeProperty(`max-height`),e.style.removeProperty(`max-width`),e.style.removeProperty(`position`),e.style.removeProperty(`transform-origin`),e.style.removeProperty(`width`)},l=(e,t)=>{let n=Le(),r=t===`dialog`?Ne:Z,i=t===`dialog`?Pe:1/0,a=t===`dialog`?Fe:1/0,o=Math.min(i,Math.max(0,n.width-r*2)),s=Math.min(a,Math.max(0,n.height-r*2)),c=n.offsetLeft+(n.width-o)/2,l=n.offsetTop+(n.height-s)/2;Object.assign(e.style,{borderRadius:`var(--radius-overlay-md)`,position:`fixed`,inset:`${l}px auto auto ${c}px`,width:`${o}px`,height:`${s}px`,maxWidth:`none`,maxHeight:`none`,transformOrigin:`center`})},u=()=>{let t=Le(),n=e.reference().getBoundingClientRect();return Ie({viewportWidth:t.width,viewportHeight:t.height,layoutViewportHeight:window.innerHeight,referenceTop:n.top-t.offsetTop,referenceBottom:n.bottom-t.offsetTop,touch:Re()})},d=()=>{if(!n)return;let i=o(),a=u();r=a,i.dataset.presentation=a;let d=i.querySelector(`[data-ui-select-sheet-heading]`);if(d&&(d.style.display=a===`anchored`?`none`:`flex`),a===`anchored`){i.removeAttribute(`aria-modal`),i.removeAttribute(`aria-labelledby`),i.removeAttribute(`role`),s(!1),c(i),t.mount();return}t.unmount(),i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-modal`,`true`),i.setAttribute(`aria-labelledby`,e.labelId()),s(!0),l(i,a)},ee=()=>{let e=()=>d(),t=window.visualViewport,n=window.matchMedia?.(`(any-pointer: coarse)`);return window.addEventListener(`resize`,e),window.addEventListener(`orientationchange`,e),t?.addEventListener(`resize`,e),t?.addEventListener(`scroll`,e),n?.addEventListener(`change`,e),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`orientationchange`,e),t?.removeEventListener(`resize`,e),t?.removeEventListener(`scroll`,e),n?.removeEventListener(`change`,e)}},f=()=>{if(!n){n=!0;try{o().showPopover()}catch{}d(),a=ee()}},m=()=>{if(n){n=!1,a?.(),a=null,t.unmount(),s(!1);try{o().hidePopover()}catch{}}};return{opened:()=>n,open:f,close:m,sync:d,destroy:m,presentation:()=>r}},Q=h({definition:{component:`ui.select`,parts:{root:{base:`relative inline-grid w-full min-w-0`},control:{base:ue,variants:{size:O,radius:C,variant:{outline:``,filled:``},mode:{listbox:``,combobox:``,pillbox:`flex-wrap gap-1 py-0.5`,native:``},empty:{true:``,false:``}},compounds:[{when:{mode:`pillbox`,empty:!1},class:`!pl-1.5`}],defaults:{size:`lg`,variant:`outline`,radius:`md`,mode:`listbox`,empty:!1}},button:{base:[`flex min-w-0 flex-1 items-center gap-2 border-0 bg-transparent p-0 text-left text-inherit outline-none`]},pillboxTrigger:{base:`min-w-16 self-stretch`},value:{base:`min-w-0 flex-1`},placeholder:{base:`min-w-0 flex-1 text-surface-ink-muted`},input:{base:[`w-full min-w-16 flex-1`,E]},search:{base:[`flex min-h-control-xlg shrink-0 items-center gap-2 px-3`,`text-sm`]},searchInput:{base:[`min-w-0 flex-1 text-sm`,E]},sheetHeader:{base:``},sheetHeading:{base:`min-w-0 items-center gap-3 px-4 pt-4`},sheetTitle:{base:`min-w-0 flex-1 truncate text-base font-medium`},sheetClose:{base:[`inline-flex size-control-md shrink-0 items-center justify-center rounded-control-sm border-0 bg-transparent`,`text-surface-ink-muted outline-none focus-visible:ui-focus-ring`]},chips:{base:`flex min-w-0 flex-wrap items-center gap-1`},chip:{base:[`max-w-64`]},chipLabel:{base:`block min-w-0 flex-1 truncate`},chipRemove:{base:``},icon:{base:`size-icon shrink-0 fill-current text-surface-ink-muted`,variants:{position:{leading:``,trailing:``}},defaults:{position:`leading`}},action:{base:T},popover:{base:[P,`overflow-hidden rounded-overlay-sm`]},listbox:{base:`min-h-0 outline-none`},viewport:{base:`min-h-0 max-h-select-listbox`},options:{base:`grid auto-rows-min content-start gap-1 p-popover-padding`},create:{base:`shrink-0 p-popover-padding`},option:{base:[x,`[&:has([data-ui-select-option-label]>*+*)]:h-auto`,`[&:has([data-ui-select-option-label]>*+*)]:items-start`,`[&:has([data-ui-select-option-label]>*+*)]:py-2`]},optionLabel:{base:`min-w-0 flex-1 truncate`},optionMeta:{base:`ml-auto text-current opacity-70`},optionIcon:{base:w,variants:{position:{leading:``,trailing:`ml-auto`}},defaults:{position:`leading`}},optionIndicator:{base:F},group:{base:`grid auto-rows-min content-start gap-1`},label:{base:`px-menu-item-padding-inline py-1`},empty:{base:`px-menu-item-padding-inline py-2 text-sm text-surface-ink-muted`},separatorRoot:{base:`-mx-popover my-popover h-[var(--border-width-edge-separator)]`},separatorRule:{base:`h-[var(--border-width-edge-separator)] w-full border-0`},nativeWrapper:{base:`relative w-full min-w-0`},native:{base:[A,`appearance-none pe-10`],variants:{size:O,radius:C},defaults:{size:`lg`,radius:`md`}},nativeIcon:{base:`pointer-events-none absolute right-3 top-1/2 size-icon -translate-y-1/2 fill-current text-icon`}}}}),$=`[data-ui-select-option], [data-ui-select-option-create]`,Be=`template[data-ui-select-option-selected-template]`,Ve=e=>{if(!(e instanceof Element)){e.childNodes.forEach(Ve);return}Array.from(e.attributes).forEach(t=>{let n=t.name;(n===`id`||n===`role`||n===`tabindex`||n.startsWith(`aria-selected`)||n.startsWith(`aria-disabled`)||n.startsWith(`data-ui-select-option`)||n.startsWith(`data-selected`)||n.startsWith(`data-highlighted`)||n.startsWith(`data-disabled`)||n.startsWith(`x-`)||n.startsWith(`@`)||n.startsWith(`:`)||n.startsWith(`on`))&&e.removeAttribute(n)}),e.childNodes.forEach(Ve),e.setAttribute(`x-ignore`,`true`)},He=e=>{let t=document.createDocumentFragment();return Array.from(e).forEach(e=>{if(e instanceof HTMLTemplateElement&&e.matches(Be))return;let n=e.cloneNode(!0);Ve(n),t.append(n)}),t},Ue=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),We=()=>{let e=null,t=!1,n=``,r=``,i=``,a=``,d=null,f=null,p=[],h=``,ne=``,g=!1,_=!1,v=null,y=``,b=0,x=()=>{if(!e)throw Error(`Select has not been initialized.`);return e},S=()=>{let e=x().querySelector(`[data-ui-select-control]`);if(!e)throw Error(`Select requires a control element.`);return e},C=()=>{let e=x().querySelector(`[data-ui-select-trigger], [data-ui-select-button], [data-ui-select-input]`);if(!e)throw Error(`Select requires a trigger element.`);return e},w=()=>x().querySelector(`[data-ui-select-input]`),T=()=>x().querySelector(`[data-ui-select-search-input]`),E=()=>{let e=x().querySelector(`[data-ui-select-sheet-title]`);if(!e)throw Error(`Select requires an adaptive picker title.`);return e},D=()=>{let e=x().querySelector(`[data-ui-select-popover]`);if(!e)throw Error(`Select requires a popover element.`);return e},O=()=>{let e=x().querySelector(`[data-ui-select-listbox]`);if(!e)throw Error(`Select requires a listbox element.`);return e},ue=()=>{let e=x().querySelector(`[data-ui-select-options]`);if(!e)throw Error(`Select requires an options element.`);return e},de=()=>x().querySelector(`[data-ui-select-chips]`),k=()=>x().querySelector(`[data-ui-select-hidden-inputs]`),A=()=>K.getCommittedSnapshot().props,j=()=>K.getCommittedSnapshot().context,M=()=>K.hasTag(`expanded`),N=()=>K.hasTag(`visible`),fe=(e,t)=>{let n=e.dataset.label||e.getAttribute(`aria-label`)||``;if(n)return n;if(e.dataset.textValue)return e.dataset.textValue;let r=me(pe(e.dataset.item),t.path);return r==null?(e.querySelector(`[data-ui-select-option-label]`)?.textContent??e.textContent??``).trim():String(r)},P=({props:e,query:t,selectedValues:n})=>{let r=I(t),a=Array.from(x().querySelectorAll($)).map((a,o)=>{let c=fe(a,e),l=a.dataset.value||c,u=a.hasAttribute(`data-ui-select-option-create`),d=r!==``&&I(c)===r,ee=!e.filter||r===``||I(`${c} ${a.dataset.suffix??``}`).includes(r),f=Number(a.dataset.minLength??`0`);return{el:a,id:a.id||`${i}-option-${o}`,value:u?a.dataset.value||t:l,label:c,selectedLabel:a.dataset.selectedLabel||c,disabled:s({value:a.dataset.disabled}),selected:n.includes(l),visible:u?t.length>=f&&!d:ee,create:u}});return a.some(e=>!e.create&&I(e.label)===r)?a.map(e=>e.create?{...e,visible:!1}:e):a},F=(e=j().search.query)=>P({props:A(),query:e,selectedValues:j().selection.values}),L=(e=j().search.query)=>F(e).filter(e=>e.visible&&!e.disabled&&!e.create),R=(e,t=A())=>{let n=Array.from(new Set(e.filter(Boolean))),r=t.multiple?n:n.slice(0,1),i=P({props:t,query:``,selectedValues:r});return{values:r,labels:r.map(e=>i.find(t=>t.value===e)?.selectedLabel??e)}},z=e=>e.multiple?Array.from(new Set([...e.values,...e.value?[e.value]:[]])):e.value?[e.value]:e.values.slice(0,1),ge=e=>{let t=z(e),n=P({props:e,query:``,selectedValues:[]}).filter(e=>s({value:e.el.dataset.selected})).map(e=>e.value);return{selection:R(t.length>0?t:n,e),search:{query:``,optionsId:``},navigation:{activeValue:``},creation:{value:``}}},B=()=>{let{selection:e}=j(),t=A();return e.values.length===0||t.mode===`pillbox`&&t.multiple?``:t.multiple&&e.values.length>1?`${e.values.length} ${t.suffix}`:e.labels[0]??e.values[0]??``},V=e=>{let t=e.el.querySelector(Be);if(t)return He(t.content.childNodes);let n=e.el.querySelector(`[data-ui-select-option-selected-content]`)??e.el.querySelector(`[data-ui-select-option-label]`);if(n)return He(n.childNodes);let r=document.createDocumentFragment();return r.append(document.createTextNode(e.selectedLabel)),r},_e=()=>{let e=A();if(t){let t=j().selection.values;(M()||!e.open||!e.disabled&&!e.readonly)&&o({el:x(),schema:W,key:`open`,value:M()}),o({el:x(),schema:W,key:`value`,value:e.multiple?``:t[0]??``}),o({el:x(),schema:W,key:`values`,value:e.multiple?[...t]:[]})}x().dataset.state=M()?`open`:`closed`,x().dataset.mark=e.mark,ae({el:x(),state:{disabled:e.disabled,required:e.required,invalid:e.invalid},value:`true`})},H=()=>A().mode===`pillbox`&&A().multiple,ve=()=>{let e=A(),t=H()&&j().selection.values.length===0,n=S();n.className=m({part:Q.parts.control,props:{...e,mode:H()?`pillbox`:e.mode===`combobox`?`combobox`:`listbox`,empty:t}}),n.dataset.state=M()?`open`:`closed`,n.dataset.mode=H()?`pillbox`:e.mode,l({el:n,attr:`data-ui-select-pillbox-control`,present:H(),value:``}),l({el:n,attr:`data-empty`,present:t,value:`true`}),ae({el:n,state:{disabled:e.disabled,invalid:e.invalid},value:`true`})},ye=()=>{let e=A(),t=C();t.id||=n,t.dataset.state=M()?`open`:`closed`,t.setAttribute(`aria-haspopup`,`listbox`),t.setAttribute(`aria-expanded`,M()?`true`:`false`),t.setAttribute(`aria-controls`,i),l({el:t,attr:`aria-invalid`,present:e.invalid,value:`true`}),t instanceof HTMLButtonElement&&(t.disabled=e.disabled);let r=B(),a=x().querySelector(`[data-ui-select-button-value]`),o=x().querySelector(`[data-ui-select-button-placeholder]`);if(a){a.replaceChildren();let e=j().selection.values.length===1&&r?F(``).find(e=>e.value===j().selection.values[0]):void 0;e?a.append(V(e)):a.textContent=r,a.hidden=r===``}o&&(o.hidden=H()?j().selection.values.length>0:r!==``),x().querySelectorAll(`[data-ui-select-clear], [data-ui-select-button-clear]`).forEach(t=>{t.hidden=e.disabled||!e.clearable||j().selection.values.length===0,t instanceof HTMLButtonElement&&(t.disabled=e.disabled)}),x().querySelectorAll(`[data-ui-select-search-clear]`).forEach(t=>{t.hidden=e.disabled||!j().search.query,t instanceof HTMLButtonElement&&(t.disabled=e.disabled)})},be=()=>{let e=A(),t=j(),n=w();n&&(n.id||=r,n.className=m({part:Q.parts.input,className:e.inputClass}),n.value=H()||M()&&g?t.search.query:B(),n.placeholder=H()&&t.selection.values.length>0?``:e.placeholder,n.setAttribute(`role`,`combobox`),n.setAttribute(`autocomplete`,`off`),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-expanded`,M()?`true`:`false`),n.setAttribute(`aria-controls`,i),oe({input:n,state:{disabled:e.disabled,readonly:e.readonly,required:e.required,nativeRequired:!1,invalid:e.invalid,ariaRequired:e.required}}));let a=T();a&&(a.value=t.search.query,a.disabled=e.disabled,a.readOnly=e.readonly);let o=F().find(e=>e.value===t.navigation.activeValue);[C(),n,a,O()].forEach(e=>{o?.id?e?.setAttribute(`aria-activedescendant`,o.id):e?.removeAttribute(`aria-activedescendant`)})},xe=()=>{let e=A(),t=D(),n=O();t.id=`${i}-popover`,t.className=m({part:Q.parts.popover,props:e,className:e.listboxClass}),t.dataset.uiSurface=e.surface,t.dataset.uiElevation=e.elevation,t.setAttribute(`popover`,`manual`),t.dataset.state=M()?`open`:`closed`,t.hidden=!N(),n.id=i,n.setAttribute(`role`,`listbox`),n.tabIndex=-1,n.setAttribute(`aria-labelledby`,C().id),l({el:n,attr:`aria-multiselectable`,present:e.multiple,value:`true`})},Se=()=>{let e=j();x().querySelectorAll(`[data-ui-select-create-query]`).forEach(t=>{t.textContent=e.search.query});let t=F();t.forEach(t=>{t.el.id=t.id,t.el.hidden=!t.visible,t.el.setAttribute(`role`,`option`),t.el.setAttribute(`aria-selected`,t.selected?`true`:`false`),t.create||(t.el.dataset.value=t.value),t.create||(t.el.dataset.label=t.label),l({el:t.el,attr:`data-selected`,present:t.selected,value:`true`}),l({el:t.el,attr:`data-highlighted`,present:t.value===e.navigation.activeValue,value:`true`}),l({el:t.el,attr:`data-disabled`,present:t.disabled,value:`true`}),l({el:t.el,attr:`aria-disabled`,present:t.disabled,value:`true`}),t.el.querySelectorAll(`[data-ui-select-option-indicator]`).forEach(e=>{l({el:e,attr:`data-selected`,present:t.selected,value:`true`})})});let n=x().querySelector(`[data-ui-select-option-empty]`);n&&(n.hidden=t.some(e=>e.visible&&!e.create))},Ce=()=>JSON.stringify(Array.from(x().querySelectorAll($)).map(e=>({create:e.hasAttribute(`data-ui-select-option-create`),value:e.dataset.value??``,label:e.hasAttribute(`data-ui-select-option-create`)?e.textContent?.trim()??``:e.dataset.label??e.textContent?.trim()??``,disabled:e.dataset.disabled??``,selected:e.dataset.selected??``}))),we=()=>{let e=de();if(!e)return;let t=A(),n=j(),r=F(``),i=n.selection.values.map((e,t)=>({value:e,label:n.selection.labels[t]??e,disabled:r.find(t=>t.value===e)?.disabled??!1})),a=JSON.stringify({chips:i,pillbox:H(),disabled:t.disabled,readonly:t.readonly,variant:t.chipVariant,color:t.chipColor,className:t.chipClass});if(a===ne||(ne=a,e.replaceChildren(),e.hidden=!H()||i.length===0,e.hidden))return;let o=m({part:he.parts.root,props:{variant:t.chipVariant,color:t.chipColor,size:`sm`,radius:`sm`},className:m({part:Q.parts.chip,props:{},className:t.chipClass})}),s=m({part:Q.parts.chipLabel}),c=m({part:he.parts.close,props:{size:`sm`},className:m({part:Q.parts.chipRemove})});i.forEach(n=>{let r=document.createElement(`span`);r.className=o,r.setAttribute(`data-ui-badge`,``),r.setAttribute(`data-ui-action-recipe`,`badge`),r.setAttribute(`data-ui-select-chip`,``),r.dataset.value=n.value,r.dataset.variant=t.chipVariant,r.dataset.color=t.chipColor,r.dataset.size=`sm`,r.dataset.radius=`sm`;let i=document.createElement(`span`);i.className=s,i.setAttribute(`data-ui-select-chip-label`,``),i.textContent=n.label,r.append(i);let a=document.createElement(`button`);a.type=`button`,a.className=c,a.setAttribute(`data-ui-badge-close`,``),a.setAttribute(`data-ui-select-chip-remove`,``),a.dataset.value=n.value,a.setAttribute(`aria-label`,`Remove ${n.label}`),a.disabled=t.disabled||t.readonly||n.disabled;let l=x().querySelector(`[data-ui-select-chip-remove-icon]`);l?a.append(l.content.cloneNode(!0)):a.textContent=`x`,r.append(a),e.append(r)})},Te=()=>{let e=k();if(!e)return;let t=A();h=ie({container:e,state:{name:t.name,required:t.required,values:t.disabled?[]:[...j().selection.values],form:x().dataset.form??``,marker:`data-ui-select-hidden-input`},currentKey:h})},U=()=>{_e(),ve(),ye(),be(),xe(),Se(),we(),Te()},Ee=()=>{if(!K.hasTag(`interactive`))return;let e=A();d?.presentation()===`anchored`?e.mode===`combobox`?w()?.focus({preventScroll:!0}):(e.searchable||H())&&T()?T()?.focus({preventScroll:!0}):C().focus({preventScroll:!0}):(T()??x().querySelector(`[data-ui-select-sheet-close]`)??O()).focus({preventScroll:!0})},G=()=>{let e=j(),t=R(e.selection.values);Ue(t.labels,e.selection.labels)||K.send({type:`RECONCILE_SELECTION`,...t});let n=L();e.navigation.activeValue&&!n.some(t=>t.value===e.navigation.activeValue)&&K.send({type:`ACTIVE`,value:A().autoHighlight?n[0]?.value??``:``}),U()},Oe=e=>{if((Array.isArray(e.changes)?e.changes:[]).flatMap(e=>e&&typeof e==`object`&&`key`in e?[String(e.key)]:[]).some(e=>e===`value`||e===`values`||e===`multiple`)){let e=R(z(A()));K.send({type:`RECONCILE_SELECTION`,...e})}U()},K=ee({schema:W,hooks:De,createMachine:({props:e})=>ke({props:e,context:ge(e),effects:{prepareOpen:()=>{_=!1,d?.open(),U(),queueMicrotask(Ee)},finishOpen:()=>{U(),c({el:x(),name:`ui:open`})},prepareClose:({event:e})=>{g=!1,_=e.restoreFocus===!0||e.type===`SELECT`||e.type===`CREATE`,_&&C().focus({preventScroll:!0}),U()},finishClose:()=>{d?.close(),U(),_&&C().focus({preventScroll:!0}),_=!1,c({el:x(),name:`ui:close`})},commitSelection:({event:e})=>{U(),se({container:k(),fallback:x(),marker:`data-ui-select-hidden-input`});let{selection:t}=j();e.type===`CLEAR`&&c({el:x(),name:`ui:clear`}),c({el:x(),name:`ui:change`,detail:{value:t.values[0]??``,values:[...t.values],label:t.labels[0]??``,labels:[...t.labels],option:v}}),v=null},commitSearch:()=>{U(),c({el:x(),name:`ui:search`,detail:{search:j().search.query}})},prepareCreate:({event:e})=>{U(),c({el:x(),name:`ui:create`,detail:{search:j().search.query,value:j().creation.value,modal:typeof e.modal==`string`?e.modal:``}})},syncProps:({event:e})=>Oe(e),syncOptions:G,syncActive:U}})}),q=(e,t)=>K.send({type:e,...t}),J=(e,t)=>{t?.preventDefault();let n=A();if(!(n.disabled||n.readonly||e.disabled)){if(e.create){K.send({type:`CREATE`,value:e.value||j().search.query,modal:e.el.dataset.modal??``});return}v=e.el,g=!1,q(`SELECT`,R(n.multiple?j().selection.values.includes(e.value)?j().selection.values.filter(t=>t!==e.value):[...j().selection.values,e.value]:[e.value]))}},Y=e=>{if(e===j().navigation.activeValue)return;K.send({type:`ACTIVE`,value:e});let t=F().find(t=>t.value===e);c({el:x(),name:`ui:highlight`,detail:{value:e,option:t?.el??null}})},Ae=e=>{let t=L();if(t.length===0)return;let n=t.findIndex(e=>e.value===j().navigation.activeValue),r=n<0?e>0?0:t.length-1:n+e;r>=t.length&&(r=A().loop?0:t.length-1),r<0&&(r=A().loop?t.length-1:0),Y(t[r]?.value??``)},X=e=>{let t=A();if(t.disabled||t.readonly)return;g=!0;let n=t.autoHighlight?L(e)[0]?.value??``:``;K.send({type:`SEARCH`,query:e,optionsId:a,activeValue:n})},je=e=>{if(e.key===`Tab`&&d?.presentation()!==`anchored`){ce(e,D());return}let t=e.target instanceof HTMLInputElement;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),M()||K.send({type:`OPEN`}),Ae(e.key===`ArrowDown`?1:-1);return}if(!t&&M()&&(e.key===`Home`||e.key===`End`)){e.preventDefault();let t=L();Y(e.key===`Home`?t[0]?.value??``:t.at(-1)?.value??``);return}if(M()&&(e.key===`Enter`||!t&&e.key===` `)){let t=F().find(e=>e.value===j().navigation.activeValue);t&&J(t,e);return}if((e.key===`Backspace`||e.key===`Delete`)&&H()&&!j().search.query){let t=w();if(t&&(t.selectionStart!==0||t.selectionEnd!==0))return;let n=[...j().selection.values].reverse().find(e=>!F(``).find(t=>t.value===e)?.disabled);n&&(e.preventDefault(),Z.deselect(n,e));return}if(e.key===`Escape`&&N()){e.preventDefault(),e.stopPropagation(),K.send({type:`CLOSE`,restoreFocus:!0});return}if(!t&&!A().searchable&&e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){y+=e.key.toLowerCase(),window.clearTimeout(b),b=window.setTimeout(()=>{y=``},500);let t=L().find(e=>I(e.label).startsWith(y));t&&Y(t.value)}},Me=()=>{let e=x(),t=(e,t)=>t.closest(`[data-ui-select-trigger], [data-ui-select-icon="trailing"], [data-ui-select-control]`)?(e.preventDefault(),C().focus({preventScroll:!0}),C()instanceof HTMLInputElement?M()||K.send({type:`OPEN`}):Z.toggle(e),!0):!1;u({target:e,event:`click`,cleanup:p,handler:e=>{let n=e.target;if(!(n instanceof Element))return;if(n.closest(`[data-ui-select-sheet-close]`)){Z.close(e);return}if(n.closest(`[data-ui-select-search-clear]`)){e.preventDefault(),X(``);return}if(n.closest(`[data-ui-select-clear], [data-ui-select-button-clear]`)){Z.clear(e);return}let r=n.closest(`[data-ui-select-chip-remove]`);if(r){Z.deselect(r.dataset.value??``,e);return}let i=n.closest($);if(i){let t=F().find(e=>e.el===i);t&&J(t,e);return}(!(e instanceof MouseEvent)||e.detail===0)&&t(e,n)}}),u({target:e,event:`input`,cleanup:p,handler:e=>{let t=e.target;t instanceof HTMLInputElement&&t.matches(`[data-ui-select-input], [data-ui-select-search-input]`)&&X(t.value)}}),u({target:e,event:`keydown`,cleanup:p,handler:e=>{e instanceof KeyboardEvent&&je(e)}}),u({target:e,event:`pointerdown`,cleanup:p,handler:e=>{let n=e.target;if(n instanceof Element){if(n.closest($)||n.closest(`[data-ui-select-search-clear]`)||n.closest(`[data-ui-select-clear], [data-ui-select-button-clear], [data-ui-select-chip-remove]`)){e.preventDefault();return}t(e,n)}}}),u({target:e,event:`pointerover`,cleanup:p,handler:e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($),r=n?F().find(e=>e.el===n):void 0;r&&r.visible&&!r.disabled&&Y(r.value)}}),u({target:e,event:`focusout`,cleanup:p,handler:t=>{if(!(t instanceof FocusEvent))return;let n=t.relatedTarget;n instanceof Node&&e.contains(n)||N()&&K.send({type:`CLOSE`})}}),u({target:D(),event:`toggle`,cleanup:p,handler:e=>{!(`newState`in e)||e.newState!==`closed`||!N()||K.send({type:`CLOSE`})}}),p.push(re({isEnabled:()=>K.hasTag(`interactive`),roots:()=>[x(),D()],onDismiss:()=>K.send({type:`CLOSE`})})),f=le({targets:O(),read:Ce,onChange:()=>K.send({type:`OPTIONS_CHANGED`}),observer:{childList:!0,subtree:!0}})},Z;return Z={...K,get isOpen(){return this.snapshot.current?.tags.includes(`expanded`)??!1},get isSearching(){return this.snapshot.current?.tags.includes(`searching`)??!1},get value(){return this.snapshot.current?.context.selection.values[0]??``},get values(){return[...this.snapshot.current?.context.selection.values??[]]},get selectedLabels(){return[...this.snapshot.current?.context.selection.labels??[]]},get search(){return this.snapshot.current?.context.search.query??``},get activeValue(){return this.snapshot.current?.context.navigation.activeValue??``},init(){e=this.$el,n=this.$id(`select-button`),r=this.$id(`select-input`),i=this.$id(`select-listbox`),a=ue().id||x().dataset.optionsId||this.$id(`select-options`),ue().id=a,K.connect(this.$el,this.snapshot),E().id||=`${i}-title`,d=ze({reference:S,floating:D,labelId:()=>E().id,position:()=>A().side,align:()=>A().align,gap:()=>A().gap,offset:()=>A().offset,matchReferenceWidth:!0}),Me(),U(),t=!0,A().open&&!A().disabled&&!A().readonly&&queueMicrotask(()=>K.send({type:`OPEN`}))},destroy(){window.clearTimeout(b),f?.(),f=null,p.forEach(e=>e()),p=[],d?.destroy(),d=null,K.disconnect(),e=null},get root(){let e=this.snapshot.current?.props??A();return te({inputs:[m({part:Q.parts.root,props:e,className:e.class}),{"data-ui-select":``,":data-state":()=>K.hasTag(`expanded`)?`open`:`closed`}]})},open(e){e?.preventDefault(),!(A().disabled||A().readonly)&&K.send({type:`OPEN`})},close(e){e?.preventDefault(),K.send({type:`CLOSE`,restoreFocus:e instanceof KeyboardEvent})},toggle(e){e?.preventDefault(),!(A().disabled||A().readonly)&&K.send({type:`TOGGLE`})},select(e,t){let n=F(``).find(t=>!t.create&&t.value===e);n&&J(n,t)},deselect(e,t){t?.preventDefault(),!(A().disabled||A().readonly)&&(F(``).find(t=>t.value===e)?.disabled||q(`DESELECT`,R(j().selection.values.filter(t=>t!==e))))},selectAll(e){if(e?.preventDefault(),!A().multiple||A().disabled||A().readonly)return;let t=L();q(`SELECT_ALL`,{values:t.map(e=>e.value),labels:t.map(e=>e.selectedLabel)})},clear(e){e?.preventDefault(),e?.stopPropagation(),!(A().disabled||A().readonly)&&(g=!1,K.send({type:`CLEAR`}))},setSearch:X},Z},Ge=f(`UiSelect`,We),Ke=new WeakSet,qe=t=>{Ke.has(t)||(Ke.add(t),e(t),Ge(t))};export{We as n,qe as t};
2
+ //# sourceMappingURL=entry.generated-BqOi_tIN.js.map